@tui-sandbox/library 10.2.0 → 10.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,37 @@
1
+ var Hc=Object.defineProperty;var Fc=(e,t,r)=>t in e?Hc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var me=(e,t,r)=>Fc(e,typeof t!="symbol"?t+"":t,r);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const _ of document.querySelectorAll('link[rel="modulepreload"]'))i(_);new MutationObserver(_=>{for(const C of _)if(C.type==="childList")for(const E of C.addedNodes)E.tagName==="LINK"&&E.rel==="modulepreload"&&i(E)}).observe(document,{childList:!0,subtree:!0});function r(_){const C={};return _.integrity&&(C.integrity=_.integrity),_.referrerPolicy&&(C.referrerPolicy=_.referrerPolicy),_.crossOrigin==="use-credentials"?C.credentials="include":_.crossOrigin==="anonymous"?C.credentials="omit":C.credentials="same-origin",C}function i(_){if(_.ep)return;_.ep=!0;const C=r(_);fetch(_.href,C)}})();function We(e){const t={subscribe(r){let i=null,_=!1,C=!1,E=!1;function n(){if(i===null){E=!0;return}C||(C=!0,typeof i=="function"?i():i&&i.unsubscribe())}return i=e({next(a){var u;_||(u=r.next)==null||u.call(r,a)},error(a){var u;_||(_=!0,(u=r.error)==null||u.call(r,a),n())},complete(){var a;_||(_=!0,(a=r.complete)==null||a.call(r),n())}}),E&&n(),{unsubscribe:n}},pipe(...r){return r.reduce(Nc,t)}};return t}function Nc(e,t){return t(e)}function jc(e){const t=new AbortController;return new Promise((i,_)=>{let C=!1;function E(){C||(C=!0,n.unsubscribe())}t.signal.addEventListener("abort",()=>{_(t.signal.reason)});const n=e.subscribe({next(a){C=!0,i(a),E()},error(a){_(a)},complete(){t.abort(),E()}})})}function Wc(e){return t=>{let r=0,i=null;const _=[];function C(){i||(i=t.subscribe({next(n){var a;for(const u of _)(a=u.next)==null||a.call(u,n)},error(n){var a;for(const u of _)(a=u.error)==null||a.call(u,n)},complete(){var n;for(const a of _)(n=a.complete)==null||n.call(a)}}))}function E(){if(r===0&&i){const n=i;i=null,n.unsubscribe()}}return We(n=>(r++,_.push(n),C(),{unsubscribe(){r--,E();const a=_.findIndex(u=>u===n);a>-1&&_.splice(a,1)}}))}}function ms(e){let t=e;const r=[],i=E=>{t!==void 0&&E.next(t),r.push(E)},_=E=>{r.splice(r.indexOf(E),1)},C=We(E=>(i(E),()=>{_(E)}));return C.next=E=>{if(t!==E){t=E;for(const n of r)n.next(E)}},C.get=()=>t,C}function gs(e){return We(t=>{function r(_=0,C=e.op){const E=e.links[_];if(!E)throw new Error("No more links to execute - did you forget to add an ending link?");return E({op:C,next(a){return r(_+1,a)}})}return r().subscribe(t)})}const vs=()=>{},Ni=e=>{Object.freeze&&Object.freeze(e)};function bs(e,t,r){var i,_;const C=t.join(".");return(i=r)[_=C]??(i[_]=new Proxy(vs,{get(E,n){if(!(typeof n!="string"||n==="then"))return bs(e,[...t,n],r)},apply(E,n,a){const u=t[t.length-1];let d={args:a,path:t};return u==="call"?d={args:a.length>=2?[a[1]]:[],path:t.slice(0,-1)}:u==="apply"&&(d={args:a.length>=2?a[1]:[],path:t.slice(0,-1)}),Ni(d.args),Ni(d.path),e(d)}})),r[C]}const Zc=e=>bs(e,[],Object.create(null)),Uc=e=>new Proxy(vs,{get(t,r){if(r!=="then")return e(r)}}),pt={INTERNAL_SERVER_ERROR:-32603,BAD_GATEWAY:-32603,SERVICE_UNAVAILABLE:-32603,GATEWAY_TIMEOUT:-32603};function Xe(e){return!!e&&!Array.isArray(e)&&typeof e=="object"}const Ss=e=>e();function Kc(e,t){if("error"in e){const i=t.deserialize(e.error);return{ok:!1,error:{...e,error:i}}}return{ok:!0,result:{...e.result,...(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)}}}}class tr extends Error{constructor(){super("Unable to transform response from server")}}function qc(e,t){let r;try{r=Kc(e,t)}catch{throw new tr}if(!r.ok&&(!Xe(r.error.error)||typeof r.error.error.code!="number"))throw new tr;if(r.ok&&!Xe(r.result))throw new tr;return r}function mt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ys;const rr=new WeakMap,Vc=()=>{};ys=Symbol.toStringTag;let Gc=ys;class be{subscribe(){let t,r;const{settlement:i}=this;if(i===null){if(this.subscribers===null)throw new Error("Unpromise settled but still has subscribers");const _=Xc();this.subscribers=Yc(this.subscribers,_),t=_.promise,r=()=>{this.subscribers!==null&&(this.subscribers=eh(this.subscribers,_))}}else{const{status:_}=i;_==="fulfilled"?t=Promise.resolve(i.value):t=Promise.reject(i.reason),r=Vc}return Object.assign(t,{unsubscribe:r})}then(t,r){const i=this.subscribe(),{unsubscribe:_}=i;return Object.assign(i.then(t,r),{unsubscribe:_})}catch(t){const r=this.subscribe(),{unsubscribe:i}=r;return Object.assign(r.catch(t),{unsubscribe:i})}finally(t){const r=this.subscribe(),{unsubscribe:i}=r;return Object.assign(r.finally(t),{unsubscribe:i})}static proxy(t){const r=be.getSubscribablePromise(t);return typeof r<"u"?r:be.createSubscribablePromise(t)}static createSubscribablePromise(t){const r=new be(t);return rr.set(t,r),rr.set(r,r),r}static getSubscribablePromise(t){return rr.get(t)}static resolve(t){const r=typeof t=="object"&&t!==null&&"then"in t&&typeof t.then=="function"?t:Promise.resolve(t);return be.proxy(r).subscribe()}static async any(t){const i=(Array.isArray(t)?t:[...t]).map(be.resolve);try{return await Promise.any(i)}finally{i.forEach(({unsubscribe:_})=>{_()})}}static async race(t){const i=(Array.isArray(t)?t:[...t]).map(be.resolve);try{return await Promise.race(i)}finally{i.forEach(({unsubscribe:_})=>{_()})}}static async raceReferences(t){const r=t.map(Jc);try{return await Promise.race(r)}finally{for(const i of r)i.unsubscribe()}}constructor(t){mt(this,"promise",void 0),mt(this,"subscribers",[]),mt(this,"settlement",null),mt(this,Gc,"Unpromise"),typeof t=="function"?this.promise=new Promise(t):this.promise=t;const r=this.promise.then(i=>{const{subscribers:_}=this;this.subscribers=null,this.settlement={status:"fulfilled",value:i},_==null||_.forEach(({resolve:C})=>{C(i)})});"catch"in r&&r.catch(i=>{const{subscribers:_}=this;this.subscribers=null,this.settlement={status:"rejected",reason:i},_==null||_.forEach(({reject:C})=>{C(i)})})}}function Jc(e){return be.proxy(e).then(()=>[e])}function Xc(){let e,t;return{promise:new Promise((i,_)=>{e=i,t=_}),resolve:e,reject:t}}function Yc(e,t){return[...e,t]}function Qc(e,t){return[...e.slice(0,t),...e.slice(t+1)]}function eh(e,t){const r=e.indexOf(t);return r!==-1?Qc(e,r):e}var ji,Wi;(ji=Symbol).dispose??(ji.dispose=Symbol());(Wi=Symbol).asyncDispose??(Wi.asyncDispose=Symbol());function th(e,t){const r=e,i=r[Symbol.dispose];return r[Symbol.dispose]=()=>{t(),i==null||i()},r}function rh(e,t){const r=e,i=r[Symbol.asyncDispose];return r[Symbol.asyncDispose]=async()=>{await t(),await(i==null?void 0:i())},r}const ws=Symbol();function ih(e){let t=null;return th({start(){if(t)throw new Error("Timer already started");return new Promise(i=>{t=setTimeout(()=>i(ws),e)})}},()=>{t&&clearTimeout(t)})}function Cs(e,t,r){if(t!=null){if(typeof t!="object"&&typeof t!="function")throw new TypeError("Object expected.");var i,_;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(i===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose],r&&(_=i)}if(typeof i!="function")throw new TypeError("Object not disposable.");_&&(i=function(){try{_.call(this)}catch(C){return Promise.reject(C)}}),e.stack.push({value:t,dispose:i,async:r})}else r&&e.stack.push({async:!0});return t}function pr(e){var t=typeof SuppressedError=="function"?SuppressedError:function(r,i,_){var C=new Error(_);return C.name="SuppressedError",C.error=r,C.suppressed=i,C};return(pr=function(i){function _(a){i.error=i.hasError?new t(a,i.error,"An error was suppressed during disposal."):a,i.hasError=!0}var C,E=0;function n(){for(;C=i.stack.pop();)try{if(!C.async&&E===1)return E=0,i.stack.push(C),Promise.resolve().then(n);if(C.dispose){var a=C.dispose.call(C.value);if(C.async)return E|=2,Promise.resolve(a).then(n,function(u){return _(u),n()})}else E|=1}catch(u){_(u)}if(E===1)return i.hasError?Promise.reject(i.error):Promise.resolve();if(i.hasError)throw i.error}return n()})(e)}const sh="ping",nh="serialized-error",oh="connected",ah="return";async function ch(e){const t={stack:[],error:void 0,hasError:!1};try{const r=Cs(t,ih(e.timeoutMs),!1),i=await be.race([e.promise,r.start()]);return i===ws?await e.onTimeout():i}catch(r){t.error=r,t.hasError=!0}finally{pr(t)}}function hh(e){const{deserialize:t=n=>n}=e;let r={};const i=e.signal;let _=null;const C=()=>new ReadableStream({async start(n){const[a,u]=await Promise.all([e.url(),e.init()]),d=_=new e.EventSource(a,u);n.enqueue({type:"connecting",eventSource:_,event:null}),d.addEventListener(oh,p=>{const y=JSON.parse(p.data);r=y,n.enqueue({type:"connected",options:y,eventSource:d})}),d.addEventListener(nh,p=>{const g=p;n.enqueue({type:"serialized-error",error:t(JSON.parse(g.data)),eventSource:d})}),d.addEventListener(sh,()=>{n.enqueue({type:"ping",eventSource:d})}),d.addEventListener(ah,()=>{d.close(),n.close(),_=null}),d.addEventListener("error",p=>{d.readyState===EventSource.CLOSED?n.error(p):n.enqueue({type:"connecting",eventSource:d,event:p})}),d.addEventListener("message",p=>{const g=p,m={data:t(JSON.parse(g.data))};g.lastEventId&&(m.id=g.lastEventId),n.enqueue({type:"data",data:m,eventSource:d})});const l=()=>{try{d.close(),n.close()}catch{}};i.aborted?l():i.addEventListener("abort",l)},cancel(){_==null||_.close()}}),E=()=>{let n=C(),a=n.getReader();async function u(){await a.cancel(),_=null}return rh({read(){return a.read()},async recreate(){await u(),n=C(),a=n.getReader()}},u)};return Ss(async function*(){const n={stack:[],error:void 0,hasError:!1};try{const a=Cs(n,E(),!0);for(;;){let u=a.read();const d=r.reconnectAfterInactivityMs;d&&(u=ch({promise:u,timeoutMs:d,onTimeout:async()=>{const p={value:{type:"timeout",ms:d,eventSource:_},done:!1};return await a.recreate(),p}}));const l=await u;if(l.done)return l.value;yield l.value}}catch(a){n.error=a,n.hasError=!0}finally{const a=pr(n);a&&await a}})}var ls,us,ds,fs,_s,ps;typeof window>"u"||"Deno"in window||((us=(ls=globalThis.process)==null?void 0:ls.env)==null?void 0:us.NODE_ENV)==="test"||(fs=(ds=globalThis.process)==null?void 0:ds.env)!=null&&fs.JEST_WORKER_ID||(ps=(_s=globalThis.process)==null?void 0:_s.env)!=null&&ps.VITEST_WORKER_ID;function gt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lh(e){return e instanceof ue||e instanceof Error&&e.name==="TRPCClientError"}function uh(e){return Xe(e)&&Xe(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function dh(e,t){return typeof e=="string"?e:Xe(e)&&typeof e.message=="string"?e.message:t}class ue extends Error{static from(t,r={}){const i=t;return lh(i)?(r.meta&&(i.meta={...i.meta,...r.meta}),i):uh(i)?new ue(i.error.message,{...r,result:i}):new ue(dh(i,"Unknown error"),{...r,cause:i})}constructor(t,r){var _,C;const i=r==null?void 0:r.cause;super(t,{cause:i}),gt(this,"cause",void 0),gt(this,"shape",void 0),gt(this,"data",void 0),gt(this,"meta",void 0),this.meta=r==null?void 0:r.meta,this.cause=i,this.shape=(_=r==null?void 0:r.result)==null?void 0:_.error,this.data=(C=r==null?void 0:r.result)==null?void 0:C.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,ue.prototype)}}function ir(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class fh{$request(t){return gs({links:this.links,op:{...t,context:t.context??{},id:++this.requestId}}).pipe(Wc())}async requestAsPromise(t){try{const r=this.$request(t);return(await jc(r)).result.data}catch(r){throw ue.from(r)}}query(t,r,i){return this.requestAsPromise({type:"query",path:t,input:r,context:i==null?void 0:i.context,signal:i==null?void 0:i.signal})}mutation(t,r,i){return this.requestAsPromise({type:"mutation",path:t,input:r,context:i==null?void 0:i.context,signal:i==null?void 0:i.signal})}subscription(t,r,i){return this.$request({type:"subscription",path:t,input:r,context:i.context,signal:i.signal}).subscribe({next(C){var E,n,a,u;switch(C.result.type){case"state":{(E=i.onConnectionStateChange)==null||E.call(i,C.result);break}case"started":{(n=i.onStarted)==null||n.call(i,{context:C.context});break}case"stopped":{(a=i.onStopped)==null||a.call(i);break}case"data":case void 0:{(u=i.onData)==null||u.call(i,C.result.data);break}}},error(C){var E;(E=i.onError)==null||E.call(i,C)},complete(){var C;(C=i.onComplete)==null||C.call(i)}})}constructor(t){ir(this,"links",void 0),ir(this,"runtime",void 0),ir(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=t.links.map(r=>r(this.runtime))}}const _h=Symbol.for("trpc_untypedClient"),ph={query:"query",mutate:"mutation",subscribe:"subscription"},mh=e=>ph[e];function gh(e){const t=Zc(({path:r,args:i})=>{const _=[...r],C=mh(_.pop()),E=_.join(".");return e[C](E,...i)});return Uc(r=>r===_h?e:t[r])}function Es(e){const t=new fh(e);return gh(t)}const Zi=e=>typeof e=="function";function vh(e){if(e)return e;if(typeof window<"u"&&Zi(window.fetch))return window.fetch;if(typeof globalThis<"u"&&Zi(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}const Ui=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function Ki(e){let t=null,r=null;const i=()=>{clearTimeout(r),r=null,t=null};function _(n){var d,l;const a=[[]];let u=0;for(;;){const p=n[u];if(!p)break;const g=a[a.length-1];if(p.aborted){(d=p.reject)==null||d.call(p,new Error("Aborted")),u++;continue}if(e.validate(g.concat(p).map(m=>m.key))){g.push(p),u++;continue}if(g.length===0){(l=p.reject)==null||l.call(p,new Error("Input is too big for a single dispatch")),u++;continue}a.push([])}return a}function C(){const n=_(t);i();for(const a of n){if(!a.length)continue;const u={items:a};for(const l of a)l.batch=u;e.fetch(u.items.map(l=>l.key)).then(async l=>{var p;await Promise.all(l.map(async(g,y)=>{var o,h;const m=u.items[y];try{const s=await Promise.resolve(g);(o=m.resolve)==null||o.call(m,s)}catch(s){(h=m.reject)==null||h.call(m,s)}m.batch=null,m.reject=null,m.resolve=null}));for(const g of u.items)(p=g.reject)==null||p.call(g,new Error("Missing result")),g.batch=null}).catch(l=>{var p;for(const g of u.items)(p=g.reject)==null||p.call(g,l),g.batch=null})}}function E(n){const a={aborted:!1,key:n,batch:null,resolve:Ui,reject:Ui},u=new Promise((d,l)=>{a.reject=l,a.resolve=d,t||(t=[]),t.push(a)});return r||(r=setTimeout(C)),u}return{load:E}}function bh(...e){const t=new AbortController,r=e.length;let i=0;const _=()=>{++i===r&&t.abort()};for(const C of e)C!=null&&C.aborted?_():C==null||C.addEventListener("abort",_,{once:!0});return t.signal}function Sh(...e){const t=new AbortController;for(const r of e)r!=null&&r.aborted?t.abort():r==null||r.addEventListener("abort",()=>t.abort(),{once:!0});return t.signal}function ks(e){const t=e;return t?"input"in t?t:{input:t,output:t}:{input:{serialize:r=>r,deserialize:r=>r},output:{serialize:r=>r,deserialize:r=>r}}}function yh(e){return{url:e.url.toString(),fetch:e.fetch,transformer:ks(e.transformer),methodOverride:e.methodOverride}}function wh(e){const t={};for(let r=0;r<e.length;r++){const i=e[r];t[r]=i}return t}const Ch={query:"GET",mutation:"POST",subscription:"PATCH"};function xs(e){return"input"in e?e.transformer.input.serialize(e.input):wh(e.inputs.map(t=>e.transformer.input.serialize(t)))}const mr=e=>{const t=e.url.split("?");let i=t[0].replace(/\/$/,"")+"/"+e.path;const _=[];if(t[1]&&_.push(t[1]),"inputs"in e&&_.push("batch=1"),e.type==="query"||e.type==="subscription"){const C=xs(e);C!==void 0&&e.methodOverride!=="POST"&&_.push(`input=${encodeURIComponent(JSON.stringify(C))}`)}return _.length&&(i+="?"+_.join("&")),i},Eh=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=xs(e);return t!==void 0?JSON.stringify(t):void 0},kh=e=>Lh({...e,contentTypeHeader:"application/json",getUrl:mr,getBody:Eh});class xh extends Error{constructor(){const t="AbortError";super(t),this.name=t,this.message=t}}const Dh=e=>{var t;if(e!=null&&e.aborted)throw(t=e.throwIfAborted)==null||t.call(e),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new xh};async function Rh(e){Dh(e.signal);const t=e.getUrl(e),r=e.getBody(e),{type:i}=e,_=await(async()=>{const E=await e.headers();return Symbol.iterator in E?Object.fromEntries(E):E})(),C={...e.contentTypeHeader?{"content-type":e.contentTypeHeader}:{},...e.trpcAcceptHeader?{"trpc-accept":e.trpcAcceptHeader}:void 0,..._};return vh(e.fetch)(t,{method:e.methodOverride??Ch[i],signal:e.signal,body:r,headers:C})}async function Lh(e){const t={},r=await Rh(e);t.response=r;const i=await r.json();return t.responseJSON=i,{json:i,meta:t}}function Ds(e){const t=yh(e),r=e.maxURLLength??1/0,i=e.maxItems??1/0;return()=>{const _=a=>({validate(u){if(r===1/0&&i===1/0)return!0;if(u.length>i)return!1;const d=u.map(g=>g.path).join(","),l=u.map(g=>g.input);return mr({...t,type:a,path:d,inputs:l,signal:null}).length<=r},async fetch(u){const d=u.map(o=>o.path).join(","),l=u.map(o=>o.input),p=bh(...u.map(o=>o.signal)),g=await kh({...t,path:d,inputs:l,type:a,headers(){return e.headers?typeof e.headers=="function"?e.headers({opList:u}):e.headers:{}},signal:p});return(Array.isArray(g.json)?g.json:u.map(()=>g.json)).map(o=>({meta:g.meta,json:o}))}}),C=Ki(_("query")),E=Ki(_("mutation")),n={query:C,mutation:E};return({op:a})=>We(u=>{/* istanbul ignore if -- @preserve */if(a.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const l=n[a.type].load(a);let p;return l.then(g=>{p=g;const y=qc(g.json,t.transformer.output);if(!y.ok){u.error(ue.from(y.error,{meta:g.meta}));return}u.next({context:g.meta,result:y.result}),u.complete()}).catch(g=>{u.error(ue.from(g,{meta:p==null?void 0:p.meta}))}),()=>{}})}}function qi(e){return Array.isArray(e)?e:[e]}function Rs(e){return t=>{const r=qi(e.true).map(_=>_(t)),i=qi(e.false).map(_=>_(t));return _=>We(C=>{const E=e.condition(_.op)?r:i;return gs({op:_.op,links:E}).subscribe(C)})}}const Ye=(e,...t)=>typeof e=="function"?e(...t):e;function Ah(){let e,t;return{promise:new Promise((i,_)=>{e=i,t=_}),resolve:e,reject:t}}async function Th(e){const t=await Ye(e.url);if(!e.connectionParams)return t;const i=`${t.includes("?")?"&":"?"}connectionParams=1`;return t+i}async function Oh(e){const t={method:"connectionParams",data:await Ye(e)};return JSON.stringify(t)}function De(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ih(e){const{promise:t,resolve:r,reject:i}=Ah();return e.addEventListener("open",()=>{e.removeEventListener("error",i),r()}),e.addEventListener("error",i),t}function Bh(e,{intervalMs:t,pongTimeoutMs:r}){let i,_;function C(){i=setTimeout(()=>{e.send("PING"),_=setTimeout(()=>{e.close()},r)},t)}function E(){clearTimeout(i),C()}function n(){clearTimeout(_),E()}e.addEventListener("open",C),e.addEventListener("message",({data:a})=>{clearTimeout(i),C(),a==="PONG"&&n()}),e.addEventListener("close",()=>{clearTimeout(i),clearTimeout(_)})}class wt{get ws(){return this.wsObservable.get()}set ws(t){this.wsObservable.next(t)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){if(this.openPromise)return this.openPromise;this.id=++wt.connectCount;const t=Th(this.urlOptions).then(r=>new this.WebSocketPonyfill(r));this.openPromise=t.then(async r=>{this.ws=r,r.addEventListener("message",function({data:i}){i==="PING"&&this.send("PONG")}),this.keepAliveOpts.enabled&&Bh(r,this.keepAliveOpts),r.addEventListener("close",()=>{this.ws===r&&(this.ws=null)}),await Ih(r),this.urlOptions.connectionParams&&r.send(await Oh(this.urlOptions.connectionParams))});try{await this.openPromise}finally{this.openPromise=null}}async close(){var t;try{await this.openPromise}finally{(t=this.ws)==null||t.close()}}constructor(t){if(De(this,"id",++wt.connectCount),De(this,"WebSocketPonyfill",void 0),De(this,"urlOptions",void 0),De(this,"keepAliveOpts",void 0),De(this,"wsObservable",ms(null)),De(this,"openPromise",null),this.WebSocketPonyfill=t.WebSocketPonyfill??WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=t.urlOptions,this.keepAliveOpts=t.keepAlive}}De(wt,"connectCount",0);function Ph(e,t){return!t||e!=null&&typeof e!="object"?e:{...e??{},lastEventId:t}}async function Mh(e){let t=await Ye(e.url);if(e.connectionParams){const r=await Ye(e.connectionParams),i=t.includes("?")?"&":"?";t+=i+"connectionParams="+encodeURIComponent(JSON.stringify(r))}return t}const zh=[pt.BAD_GATEWAY,pt.SERVICE_UNAVAILABLE,pt.GATEWAY_TIMEOUT,pt.INTERNAL_SERVER_ERROR];function Ls(e){const t=ks(e.transformer);return()=>({op:r})=>We(i=>{const{type:_,path:C,input:E}=r;/* istanbul ignore if -- @preserve */if(_!=="subscription")throw new Error("httpSubscriptionLink only supports subscriptions");let n;const a=new AbortController,u=Sh(r.signal,a.signal),d=hh({url:async()=>mr({transformer:t,url:await Mh(e),input:Ph(E,n),path:C,type:_,signal:null}),init:()=>Ye(e.eventSourceOptions,{op:r}),signal:u,deserialize:t.output.deserialize,EventSource:e.EventSource??globalThis.EventSource}),l=ms({type:"state",state:"connecting",error:null}),p=l.subscribe({next(g){i.next({result:g})}});return Ss(async()=>{for await(const g of d)switch(g.type){case"ping":break;case"data":const y=g.data;let m;y.id?(n=y.id,m={id:y.id,data:y}):m={data:y.data},i.next({result:m,context:{eventSource:g.eventSource}});break;case"connected":{i.next({result:{type:"started"},context:{eventSource:g.eventSource}}),l.next({type:"state",state:"pending",error:null});break}case"serialized-error":{const o=ue.from({error:g.error});if(zh.includes(g.error.code)){l.next({type:"state",state:"connecting",error:o});break}throw o}case"connecting":{const o=l.get(),h=g.event&&ue.from(g.event);if(!h&&o.state==="connecting")break;l.next({type:"state",state:"connecting",error:h});break}case"timeout":l.next({type:"state",state:"connecting",error:new ue(`Timeout of ${g.ms}ms reached while waiting for a response`)})}i.next({result:{type:"stopped"}}),l.next({type:"state",state:"idle",error:null}),i.complete()}).catch(g=>{i.error(ue.from(g))}),()=>{i.complete(),a.abort(),p.unsubscribe()}})}const $h={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}}}}},yt=e=>Object.entries(e),{version:Td,...Hh}=$h,As=yt(Hh).reduce((e,[t,r])=>(e[t]={...r,colorEntries:yt(r.colors),ansiColorEntries:yt(r.ansiColors)},e),{});yt(As);var sr={exports:{}},Vi;function Fh(){return Vi||(Vi=1,function(e,t){(function(r,i){e.exports=i()})(self,()=>(()=>{var r={};return(()=>{var i=r;Object.defineProperty(i,"__esModule",{value:!0}),i.FitAddon=void 0,i.FitAddon=class{activate(_){this._terminal=_}dispose(){}fit(){const _=this.proposeDimensions();if(!_||!this._terminal||isNaN(_.cols)||isNaN(_.rows))return;const C=this._terminal._core;this._terminal.rows===_.rows&&this._terminal.cols===_.cols||(C._renderService.clear(),this._terminal.resize(_.cols,_.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const _=this._terminal._core,C=_._renderService.dimensions;if(C.css.cell.width===0||C.css.cell.height===0)return;const E=this._terminal.options.scrollback===0?0:_.viewport.scrollBarWidth,n=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(n.getPropertyValue("height")),u=Math.max(0,parseInt(n.getPropertyValue("width"))),d=window.getComputedStyle(this._terminal.element),l=a-(parseInt(d.getPropertyValue("padding-top"))+parseInt(d.getPropertyValue("padding-bottom"))),p=u-(parseInt(d.getPropertyValue("padding-right"))+parseInt(d.getPropertyValue("padding-left")))-E;return{cols:Math.max(2,Math.floor(p/C.css.cell.width)),rows:Math.max(1,Math.floor(l/C.css.cell.height))}}}})(),r})())}(sr)),sr.exports}var Nh=Fh(),nr={exports:{}},Gi;function jh(){return Gi||(Gi=1,function(e,t){(function(r,i){e.exports=i()})(globalThis,()=>(()=>{var r={4567:function(E,n,a){var u=this&&this.__decorate||function(s,c,f,S){var b,w=arguments.length,v=w<3?c:S===null?S=Object.getOwnPropertyDescriptor(c,f):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(s,c,f,S);else for(var k=s.length-1;k>=0;k--)(b=s[k])&&(v=(w<3?b(v):w>3?b(c,f,v):b(c,f))||v);return w>3&&v&&Object.defineProperty(c,f,v),v},d=this&&this.__param||function(s,c){return function(f,S){c(f,S,s)}};Object.defineProperty(n,"__esModule",{value:!0}),n.AccessibilityManager=void 0;const l=a(9042),p=a(9924),g=a(844),y=a(4725),m=a(2585),o=a(3656);let h=n.AccessibilityManager=class extends g.Disposable{constructor(s,c,f,S){super(),this._terminal=s,this._coreBrowserService=f,this._renderService=S,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let b=0;b<this._terminal.rows;b++)this._rowElements[b]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[b]);if(this._topBoundaryFocusListener=b=>this._handleBoundaryFocus(b,0),this._bottomBoundaryFocusListener=b=>this._handleBoundaryFocus(b,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new 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(b=>this._handleResize(b.rows))),this.register(this._terminal.onRender(b=>this._refreshRows(b.start,b.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(b=>this._handleChar(b))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
2
+ `))),this.register(this._terminal.onA11yTab(b=>this._handleTab(b))),this.register(this._terminal.onKey(b=>this._handleKey(b.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,o.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,g.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(s){for(let c=0;c<s;c++)this._handleChar(" ")}_handleChar(s){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==s&&(this._charsToAnnounce+=s):this._charsToAnnounce+=s,s===`
3
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=l.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(s){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(s)||this._charsToConsume.push(s)}_refreshRows(s,c){this._liveRegionDebouncer.refresh(s,c,this._terminal.rows)}_renderRows(s,c){const f=this._terminal.buffer,S=f.lines.length.toString();for(let b=s;b<=c;b++){const w=f.lines.get(f.ydisp+b),v=[],k=(w==null?void 0:w.translateToString(!0,void 0,void 0,v))||"",A=(f.ydisp+b+1).toString(),O=this._rowElements[b];O&&(k.length===0?(O.innerText=" ",this._rowColumns.set(O,[0,1])):(O.textContent=k,this._rowColumns.set(O,v)),O.setAttribute("aria-posinset",A),O.setAttribute("aria-setsize",S))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(s,c){const f=s.target,S=this._rowElements[c===0?1:this._rowElements.length-2];if(f.getAttribute("aria-posinset")===(c===0?"1":`${this._terminal.buffer.lines.length}`)||s.relatedTarget!==S)return;let b,w;if(c===0?(b=f,w=this._rowElements.pop(),this._rowContainer.removeChild(w)):(b=this._rowElements.shift(),w=f,this._rowContainer.removeChild(b)),b.removeEventListener("focus",this._topBoundaryFocusListener),w.removeEventListener("focus",this._bottomBoundaryFocusListener),c===0){const v=this._createAccessibilityTreeNode();this._rowElements.unshift(v),this._rowContainer.insertAdjacentElement("afterbegin",v)}else{const v=this._createAccessibilityTreeNode();this._rowElements.push(v),this._rowContainer.appendChild(v)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(c===0?-1:1),this._rowElements[c===0?1:this._rowElements.length-2].focus(),s.preventDefault(),s.stopImmediatePropagation()}_handleSelectionChange(){var k;if(this._rowElements.length===0)return;const s=document.getSelection();if(!s)return;if(s.isCollapsed)return void(this._rowContainer.contains(s.anchorNode)&&this._terminal.clearSelection());if(!s.anchorNode||!s.focusNode)return void console.error("anchorNode and/or focusNode are null");let c={node:s.anchorNode,offset:s.anchorOffset},f={node:s.focusNode,offset:s.focusOffset};if((c.node.compareDocumentPosition(f.node)&Node.DOCUMENT_POSITION_PRECEDING||c.node===f.node&&c.offset>f.offset)&&([c,f]=[f,c]),c.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(c={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(c.node))return;const S=this._rowElements.slice(-1)[0];if(f.node.compareDocumentPosition(S)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(f={node:S,offset:((k=S.textContent)==null?void 0:k.length)??0}),!this._rowContainer.contains(f.node))return;const b=({node:A,offset:O})=>{const I=A instanceof Text?A.parentNode:A;let L=parseInt(I==null?void 0:I.getAttribute("aria-posinset"),10)-1;if(isNaN(L))return console.warn("row is invalid. Race condition?"),null;const $=this._rowColumns.get(I);if(!$)return console.warn("columns is null. Race condition?"),null;let F=O<$.length?$[O]:$.slice(-1)[0]+1;return F>=this._terminal.cols&&(++L,F=0),{row:L,column:F}},w=b(c),v=b(f);if(w&&v){if(w.row>v.row||w.row===v.row&&w.column>=v.column)throw new Error("invalid range");this._terminal.select(w.column,w.row,(v.row-w.row)*this._terminal.cols-w.column+v.column)}}_handleResize(s){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let c=this._rowContainer.children.length;c<this._terminal.rows;c++)this._rowElements[c]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[c]);for(;this._rowElements.length>s;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const s=this._coreBrowserService.mainDocument.createElement("div");return s.setAttribute("role","listitem"),s.tabIndex=-1,this._refreshRowDimensions(s),s}_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 s=0;s<this._terminal.rows;s++)this._refreshRowDimensions(this._rowElements[s])}}_refreshRowDimensions(s){s.style.height=`${this._renderService.dimensions.css.cell.height}px`}};n.AccessibilityManager=h=u([d(1,m.IInstantiationService),d(2,y.ICoreBrowserService),d(3,y.IRenderService)],h)},3614:(E,n)=>{function a(p){return p.replace(/\r?\n/g,"\r")}function u(p,g){return g?"\x1B[200~"+p+"\x1B[201~":p}function d(p,g,y,m){p=u(p=a(p),y.decPrivateModes.bracketedPasteMode&&m.rawOptions.ignoreBracketedPasteMode!==!0),y.triggerDataEvent(p,!0),g.value=""}function l(p,g,y){const m=y.getBoundingClientRect(),o=p.clientX-m.left-10,h=p.clientY-m.top-10;g.style.width="20px",g.style.height="20px",g.style.left=`${o}px`,g.style.top=`${h}px`,g.style.zIndex="1000",g.focus()}Object.defineProperty(n,"__esModule",{value:!0}),n.rightClickHandler=n.moveTextAreaUnderMouseCursor=n.paste=n.handlePasteEvent=n.copyHandler=n.bracketTextForPaste=n.prepareTextForTerminal=void 0,n.prepareTextForTerminal=a,n.bracketTextForPaste=u,n.copyHandler=function(p,g){p.clipboardData&&p.clipboardData.setData("text/plain",g.selectionText),p.preventDefault()},n.handlePasteEvent=function(p,g,y,m){p.stopPropagation(),p.clipboardData&&d(p.clipboardData.getData("text/plain"),g,y,m)},n.paste=d,n.moveTextAreaUnderMouseCursor=l,n.rightClickHandler=function(p,g,y,m,o){l(p,g,y),o&&m.rightClickSelect(p),g.value=m.selectionText,g.select()}},7239:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ColorContrastCache=void 0;const u=a(1505);n.ColorContrastCache=class{constructor(){this._color=new u.TwoKeyMap,this._css=new u.TwoKeyMap}setCss(d,l,p){this._css.set(d,l,p)}getCss(d,l){return this._css.get(d,l)}setColor(d,l,p){this._color.set(d,l,p)}getColor(d,l){return this._color.get(d,l)}clear(){this._color.clear(),this._css.clear()}}},3656:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.addDisposableDomListener=void 0,n.addDisposableDomListener=function(a,u,d,l){a.addEventListener(u,d,l);let p=!1;return{dispose:()=>{p||(p=!0,a.removeEventListener(u,d,l))}}}},3551:function(E,n,a){var u=this&&this.__decorate||function(h,s,c,f){var S,b=arguments.length,w=b<3?s:f===null?f=Object.getOwnPropertyDescriptor(s,c):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,s,c,f);else for(var v=h.length-1;v>=0;v--)(S=h[v])&&(w=(b<3?S(w):b>3?S(s,c,w):S(s,c))||w);return b>3&&w&&Object.defineProperty(s,c,w),w},d=this&&this.__param||function(h,s){return function(c,f){s(c,f,h)}};Object.defineProperty(n,"__esModule",{value:!0}),n.Linkifier=void 0;const l=a(3656),p=a(8460),g=a(844),y=a(2585),m=a(4725);let o=n.Linkifier=class extends g.Disposable{get currentLink(){return this._currentLink}constructor(h,s,c,f,S){super(),this._element=h,this._mouseService=s,this._renderService=c,this._bufferService=f,this._linkProviderService=S,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,g.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,g.toDisposable)(()=>{var b;this._lastMouseEvent=void 0,(b=this._activeProviderReplies)==null||b.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,l.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,l.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,l.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,l.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(h){this._lastMouseEvent=h;const s=this._positionFromMouseEvent(h,this._element,this._mouseService);if(!s)return;this._isMouseOut=!1;const c=h.composedPath();for(let f=0;f<c.length;f++){const S=c[f];if(S.classList.contains("xterm"))break;if(S.classList.contains("xterm-hover"))return}this._lastBufferCell&&s.x===this._lastBufferCell.x&&s.y===this._lastBufferCell.y||(this._handleHover(s),this._lastBufferCell=s)}_handleHover(h){if(this._activeLine!==h.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(h,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,h)||(this._clearCurrentLink(),this._askForLink(h,!0))}_askForLink(h,s){var f,S;this._activeProviderReplies&&s||((f=this._activeProviderReplies)==null||f.forEach(b=>{b==null||b.forEach(w=>{w.link.dispose&&w.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=h.y);let c=!1;for(const[b,w]of this._linkProviderService.linkProviders.entries())s?(S=this._activeProviderReplies)!=null&&S.get(b)&&(c=this._checkLinkProviderResult(b,h,c)):w.provideLinks(h.y,v=>{var A,O;if(this._isMouseOut)return;const k=v==null?void 0:v.map(I=>({link:I}));(A=this._activeProviderReplies)==null||A.set(b,k),c=this._checkLinkProviderResult(b,h,c),((O=this._activeProviderReplies)==null?void 0:O.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(h.y,this._activeProviderReplies)})}_removeIntersectingLinks(h,s){const c=new Set;for(let f=0;f<s.size;f++){const S=s.get(f);if(S)for(let b=0;b<S.length;b++){const w=S[b],v=w.link.range.start.y<h?0:w.link.range.start.x,k=w.link.range.end.y>h?this._bufferService.cols:w.link.range.end.x;for(let A=v;A<=k;A++){if(c.has(A)){S.splice(b--,1);break}c.add(A)}}}}_checkLinkProviderResult(h,s,c){var b;if(!this._activeProviderReplies)return c;const f=this._activeProviderReplies.get(h);let S=!1;for(let w=0;w<h;w++)this._activeProviderReplies.has(w)&&!this._activeProviderReplies.get(w)||(S=!0);if(!S&&f){const w=f.find(v=>this._linkAtPosition(v.link,s));w&&(c=!0,this._handleNewLink(w))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!c)for(let w=0;w<this._activeProviderReplies.size;w++){const v=(b=this._activeProviderReplies.get(w))==null?void 0:b.find(k=>this._linkAtPosition(k.link,s));if(v){c=!0,this._handleNewLink(v);break}}return c}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(h){if(!this._currentLink)return;const s=this._positionFromMouseEvent(h,this._element,this._mouseService);s&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,s)&&this._currentLink.link.activate(h,this._currentLink.link.text)}_clearCurrentLink(h,s){this._currentLink&&this._lastMouseEvent&&(!h||!s||this._currentLink.link.range.start.y>=h&&this._currentLink.link.range.end.y<=s)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,g.disposeArray)(this._linkCacheDisposables))}_handleNewLink(h){if(!this._lastMouseEvent)return;const s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._linkAtPosition(h.link,s)&&(this._currentLink=h,this._currentLink.state={decorations:{underline:h.link.decorations===void 0||h.link.decorations.underline,pointerCursor:h.link.decorations===void 0||h.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,h.link,this._lastMouseEvent),h.link.decorations={},Object.defineProperties(h.link.decorations,{pointerCursor:{get:()=>{var c,f;return(f=(c=this._currentLink)==null?void 0:c.state)==null?void 0:f.decorations.pointerCursor},set:c=>{var f;(f=this._currentLink)!=null&&f.state&&this._currentLink.state.decorations.pointerCursor!==c&&(this._currentLink.state.decorations.pointerCursor=c,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",c))}},underline:{get:()=>{var c,f;return(f=(c=this._currentLink)==null?void 0:c.state)==null?void 0:f.decorations.underline},set:c=>{var f,S,b;(f=this._currentLink)!=null&&f.state&&((b=(S=this._currentLink)==null?void 0:S.state)==null?void 0:b.decorations.underline)!==c&&(this._currentLink.state.decorations.underline=c,this._currentLink.state.isHovered&&this._fireUnderlineEvent(h.link,c))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(c=>{if(!this._currentLink)return;const f=c.start===0?0:c.start+1+this._bufferService.buffer.ydisp,S=this._bufferService.buffer.ydisp+1+c.end;if(this._currentLink.link.range.start.y>=f&&this._currentLink.link.range.end.y<=S&&(this._clearCurrentLink(f,S),this._lastMouseEvent)){const b=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);b&&this._askForLink(b,!1)}})))}_linkHover(h,s,c){var f;(f=this._currentLink)!=null&&f.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!0),this._currentLink.state.decorations.pointerCursor&&h.classList.add("xterm-cursor-pointer")),s.hover&&s.hover(c,s.text)}_fireUnderlineEvent(h,s){const c=h.range,f=this._bufferService.buffer.ydisp,S=this._createLinkUnderlineEvent(c.start.x-1,c.start.y-f-1,c.end.x,c.end.y-f-1,void 0);(s?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(S)}_linkLeave(h,s,c){var f;(f=this._currentLink)!=null&&f.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!1),this._currentLink.state.decorations.pointerCursor&&h.classList.remove("xterm-cursor-pointer")),s.leave&&s.leave(c,s.text)}_linkAtPosition(h,s){const c=h.range.start.y*this._bufferService.cols+h.range.start.x,f=h.range.end.y*this._bufferService.cols+h.range.end.x,S=s.y*this._bufferService.cols+s.x;return c<=S&&S<=f}_positionFromMouseEvent(h,s,c){const f=c.getCoords(h,s,this._bufferService.cols,this._bufferService.rows);if(f)return{x:f[0],y:f[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(h,s,c,f,S){return{x1:h,y1:s,x2:c,y2:f,cols:this._bufferService.cols,fg:S}}};n.Linkifier=o=u([d(1,m.IMouseService),d(2,m.IRenderService),d(3,y.IBufferService),d(4,m.ILinkProviderService)],o)},9042:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.tooMuchOutput=n.promptLabel=void 0,n.promptLabel="Terminal input",n.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(E,n,a){var u=this&&this.__decorate||function(m,o,h,s){var c,f=arguments.length,S=f<3?o:s===null?s=Object.getOwnPropertyDescriptor(o,h):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(m,o,h,s);else for(var b=m.length-1;b>=0;b--)(c=m[b])&&(S=(f<3?c(S):f>3?c(o,h,S):c(o,h))||S);return f>3&&S&&Object.defineProperty(o,h,S),S},d=this&&this.__param||function(m,o){return function(h,s){o(h,s,m)}};Object.defineProperty(n,"__esModule",{value:!0}),n.OscLinkProvider=void 0;const l=a(511),p=a(2585);let g=n.OscLinkProvider=class{constructor(m,o,h){this._bufferService=m,this._optionsService=o,this._oscLinkService=h}provideLinks(m,o){var k;const h=this._bufferService.buffer.lines.get(m-1);if(!h)return void o(void 0);const s=[],c=this._optionsService.rawOptions.linkHandler,f=new l.CellData,S=h.getTrimmedLength();let b=-1,w=-1,v=!1;for(let A=0;A<S;A++)if(w!==-1||h.hasContent(A)){if(h.loadCell(A,f),f.hasExtendedAttrs()&&f.extended.urlId){if(w===-1){w=A,b=f.extended.urlId;continue}v=f.extended.urlId!==b}else w!==-1&&(v=!0);if(v||w!==-1&&A===S-1){const O=(k=this._oscLinkService.getLinkData(b))==null?void 0:k.uri;if(O){const I={start:{x:w+1,y:m},end:{x:A+(v||A!==S-1?0:1),y:m}};let L=!1;if(!(c!=null&&c.allowNonHttpProtocols))try{const $=new URL(O);["http:","https:"].includes($.protocol)||(L=!0)}catch{L=!0}L||s.push({text:O,range:I,activate:($,F)=>c?c.activate($,F,I):y(0,F),hover:($,F)=>{var W;return(W=c==null?void 0:c.hover)==null?void 0:W.call(c,$,F,I)},leave:($,F)=>{var W;return(W=c==null?void 0:c.leave)==null?void 0:W.call(c,$,F,I)}})}v=!1,f.hasExtendedAttrs()&&f.extended.urlId?(w=A,b=f.extended.urlId):(w=-1,b=-1)}}o(s)}};function y(m,o){if(confirm(`Do you want to navigate to ${o}?
4
+
5
+ WARNING: This link could potentially be dangerous`)){const h=window.open();if(h){try{h.opener=null}catch{}h.location.href=o}else console.warn("Opening link blocked as opener could not be cleared")}}n.OscLinkProvider=g=u([d(0,p.IBufferService),d(1,p.IOptionsService),d(2,p.IOscLinkService)],g)},6193:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.RenderDebouncer=void 0,n.RenderDebouncer=class{constructor(a,u){this._renderCallback=a,this._coreBrowserService=u,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(a){return this._refreshCallbacks.push(a),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(a,u,d){this._rowCount=d,a=a!==void 0?a:0,u=u!==void 0?u:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,u):u,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const a=Math.max(this._rowStart,0),u=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,u),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},3236:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Terminal=void 0;const u=a(3614),d=a(3656),l=a(3551),p=a(9042),g=a(3730),y=a(1680),m=a(3107),o=a(5744),h=a(2950),s=a(1296),c=a(428),f=a(4269),S=a(5114),b=a(8934),w=a(3230),v=a(9312),k=a(4725),A=a(6731),O=a(8055),I=a(8969),L=a(8460),$=a(844),F=a(6114),W=a(8437),V=a(2584),Z=a(7399),x=a(5941),R=a(9074),T=a(2585),B=a(5435),N=a(4567),U=a(779);class J extends I.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(P={}){super(P),this.browser=F,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new $.MutableDisposable),this._onCursorMove=this.register(new L.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new L.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new L.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new L.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new L.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new L.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new L.EventEmitter),this._onBlur=this.register(new L.EventEmitter),this._onA11yCharEmitter=this.register(new L.EventEmitter),this._onA11yTabEmitter=this.register(new L.EventEmitter),this._onWillOpen=this.register(new L.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(R.DecorationService),this._instantiationService.setService(T.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(U.LinkProviderService),this._instantiationService.setService(k.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(g.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((D,j)=>this.refresh(D,j))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(D=>this._reportWindowsOptions(D))),this.register(this._inputHandler.onColor(D=>this._handleColorEvent(D))),this.register((0,L.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,L.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,L.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,L.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(D=>this._afterResize(D.cols,D.rows))),this.register((0,$.toDisposable)(()=>{var D,j;this._customKeyEventHandler=void 0,(j=(D=this.element)==null?void 0:D.parentNode)==null||j.removeChild(this.element)}))}_handleColorEvent(P){if(this._themeService)for(const D of P){let j,H="";switch(D.index){case 256:j="foreground",H="10";break;case 257:j="background",H="11";break;case 258:j="cursor",H="12";break;default:j="ansi",H="4;"+D.index}switch(D.type){case 0:const q=O.color.toColorRGB(j==="ansi"?this._themeService.colors.ansi[D.index]:this._themeService.colors[j]);this.coreService.triggerDataEvent(`${V.C0.ESC}]${H};${(0,x.toRgbString)(q)}${V.C1_ESCAPED.ST}`);break;case 1:if(j==="ansi")this._themeService.modifyColors(K=>K.ansi[D.index]=O.channels.toColor(...D.color));else{const K=j;this._themeService.modifyColors(ee=>ee[K]=O.channels.toColor(...D.color))}break;case 2:this._themeService.restoreColor(D.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(P){P?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(P){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(V.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var P;return(P=this.textarea)==null?void 0:P.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(V.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 P=this.buffer.ybase+this.buffer.y,D=this.buffer.lines.get(P);if(!D)return;const j=Math.min(this.buffer.x,this.cols-1),H=this._renderService.dimensions.css.cell.height,q=D.getWidth(j),K=this._renderService.dimensions.css.cell.width*q,ee=this.buffer.y*this._renderService.dimensions.css.cell.height,ie=j*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ie+"px",this.textarea.style.top=ee+"px",this.textarea.style.width=K+"px",this.textarea.style.height=H+"px",this.textarea.style.lineHeight=H+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,d.addDisposableDomListener)(this.element,"copy",D=>{this.hasSelection()&&(0,u.copyHandler)(D,this._selectionService)}));const P=D=>(0,u.handlePasteEvent)(D,this.textarea,this.coreService,this.optionsService);this.register((0,d.addDisposableDomListener)(this.textarea,"paste",P)),this.register((0,d.addDisposableDomListener)(this.element,"paste",P)),F.isFirefox?this.register((0,d.addDisposableDomListener)(this.element,"mousedown",D=>{D.button===2&&(0,u.rightClickHandler)(D,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,d.addDisposableDomListener)(this.element,"contextmenu",D=>{(0,u.rightClickHandler)(D,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),F.isLinux&&this.register((0,d.addDisposableDomListener)(this.element,"auxclick",D=>{D.button===1&&(0,u.moveTextAreaUnderMouseCursor)(D,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,d.addDisposableDomListener)(this.textarea,"keyup",P=>this._keyUp(P),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keydown",P=>this._keyDown(P),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keypress",P=>this._keyPress(P),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionupdate",P=>this._compositionHelper.compositionupdate(P))),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,d.addDisposableDomListener)(this.textarea,"input",P=>this._inputEvent(P),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(P){var j;if(!P)throw new Error("Terminal requires a parent element.");if(P.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((j=this.element)==null?void 0:j.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=P.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"),P.appendChild(this.element);const D=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),D.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,d.addDisposableDomListener)(this.screenElement,"mousemove",H=>this.updateCursorStyle(H))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),D.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",p.promptLabel),F.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(S.CoreBrowserService,this.textarea,P.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(k.ICoreBrowserService,this._coreBrowserService),this.register((0,d.addDisposableDomListener)(this.textarea,"focus",H=>this._handleTextAreaFocus(H))),this.register((0,d.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(c.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(k.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(A.ThemeService),this._instantiationService.setService(k.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(f.CharacterJoinerService),this._instantiationService.setService(k.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(w.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(k.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(h.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(b.MouseService),this._instantiationService.setService(k.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(l.Linkifier,this.screenElement)),this.element.appendChild(D);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(v.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(k.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,d.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(m.BufferDecorationRenderer,this.screenElement)),this.register((0,d.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(N.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",H=>this._handleScreenReaderModeOptionChange(H))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(o.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",H=>{!this._overviewRulerRenderer&&H&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(o.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(s.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const P=this,D=this.element;function j(K){const ee=P._mouseService.getMouseReportCoords(K,P.screenElement);if(!ee)return!1;let ie,se;switch(K.overrideType||K.type){case"mousemove":se=32,K.buttons===void 0?(ie=3,K.button!==void 0&&(ie=K.button<3?K.button:3)):ie=1&K.buttons?0:4&K.buttons?1:2&K.buttons?2:3;break;case"mouseup":se=0,ie=K.button<3?K.button:3;break;case"mousedown":se=1,ie=K.button<3?K.button:3;break;case"wheel":if(P._customWheelEventHandler&&P._customWheelEventHandler(K)===!1||P.viewport.getLinesScrolled(K)===0)return!1;se=K.deltaY<0?0:1,ie=4;break;default:return!1}return!(se===void 0||ie===void 0||ie>4)&&P.coreMouseService.triggerMouseEvent({col:ee.col,row:ee.row,x:ee.x,y:ee.y,button:ie,action:se,ctrl:K.ctrlKey,alt:K.altKey,shift:K.shiftKey})}const H={mouseup:null,wheel:null,mousedrag:null,mousemove:null},q={mouseup:K=>(j(K),K.buttons||(this._document.removeEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.removeEventListener("mousemove",H.mousedrag)),this.cancel(K)),wheel:K=>(j(K),this.cancel(K,!0)),mousedrag:K=>{K.buttons&&j(K)},mousemove:K=>{K.buttons||j(K)}};this.register(this.coreMouseService.onProtocolChange(K=>{K?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(K)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&K?H.mousemove||(D.addEventListener("mousemove",q.mousemove),H.mousemove=q.mousemove):(D.removeEventListener("mousemove",H.mousemove),H.mousemove=null),16&K?H.wheel||(D.addEventListener("wheel",q.wheel,{passive:!1}),H.wheel=q.wheel):(D.removeEventListener("wheel",H.wheel),H.wheel=null),2&K?H.mouseup||(H.mouseup=q.mouseup):(this._document.removeEventListener("mouseup",H.mouseup),H.mouseup=null),4&K?H.mousedrag||(H.mousedrag=q.mousedrag):(this._document.removeEventListener("mousemove",H.mousedrag),H.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,d.addDisposableDomListener)(D,"mousedown",K=>{if(K.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(K))return j(K),H.mouseup&&this._document.addEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.addEventListener("mousemove",H.mousedrag),this.cancel(K)})),this.register((0,d.addDisposableDomListener)(D,"wheel",K=>{if(!H.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(K)===!1)return!1;if(!this.buffer.hasScrollback){const ee=this.viewport.getLinesScrolled(K);if(ee===0)return;const ie=V.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(K.deltaY<0?"A":"B");let se="";for(let ae=0;ae<Math.abs(ee);ae++)se+=ie;return this.coreService.triggerDataEvent(se,!0),this.cancel(K,!0)}return this.viewport.handleWheel(K)?this.cancel(K):void 0}},{passive:!1})),this.register((0,d.addDisposableDomListener)(D,"touchstart",K=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(K),this.cancel(K)},{passive:!0})),this.register((0,d.addDisposableDomListener)(D,"touchmove",K=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(K)?void 0:this.cancel(K)},{passive:!1}))}refresh(P,D){var j;(j=this._renderService)==null||j.refreshRows(P,D)}updateCursorStyle(P){var D;(D=this._selectionService)!=null&&D.shouldColumnSelect(P)?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(P,D,j=0){var H;j===1?(super.scrollLines(P,D,j),this.refresh(0,this.rows-1)):(H=this.viewport)==null||H.scrollLines(P)}paste(P){(0,u.paste)(P,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(P){this._customKeyEventHandler=P}attachCustomWheelEventHandler(P){this._customWheelEventHandler=P}registerLinkProvider(P){return this._linkProviderService.registerLinkProvider(P)}registerCharacterJoiner(P){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const D=this._characterJoinerService.register(P);return this.refresh(0,this.rows-1),D}deregisterCharacterJoiner(P){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(P)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(P){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+P)}registerDecoration(P){return this._decorationService.registerDecoration(P)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(P,D,j){this._selectionService.setSelection(P,D,j)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var P;(P=this._selectionService)==null||P.clearSelection()}selectAll(){var P;(P=this._selectionService)==null||P.selectAll()}selectLines(P,D){var j;(j=this._selectionService)==null||j.selectLines(P,D)}_keyDown(P){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1)return!1;const D=this.browser.isMac&&this.options.macOptionIsMeta&&P.altKey;if(!D&&!this._compositionHelper.keydown(P))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;D||P.key!=="Dead"&&P.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const j=(0,Z.evaluateKeyboardEvent)(P,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(P),j.type===3||j.type===2){const H=this.rows-1;return this.scrollLines(j.type===2?-H:H),this.cancel(P,!0)}return j.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,P)||(j.cancel&&this.cancel(P,!0),!j.key||!!(P.key&&!P.ctrlKey&&!P.altKey&&!P.metaKey&&P.key.length===1&&P.key.charCodeAt(0)>=65&&P.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(j.key!==V.C0.ETX&&j.key!==V.C0.CR||(this.textarea.value=""),this._onKey.fire({key:j.key,domEvent:P}),this._showCursor(),this.coreService.triggerDataEvent(j.key,!0),!this.optionsService.rawOptions.screenReaderMode||P.altKey||P.ctrlKey?this.cancel(P,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(P,D){const j=P.isMac&&!this.options.macOptionIsMeta&&D.altKey&&!D.ctrlKey&&!D.metaKey||P.isWindows&&D.altKey&&D.ctrlKey&&!D.metaKey||P.isWindows&&D.getModifierState("AltGraph");return D.type==="keypress"?j:j&&(!D.keyCode||D.keyCode>47)}_keyUp(P){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1||(function(D){return D.keyCode===16||D.keyCode===17||D.keyCode===18}(P)||this.focus(),this.updateCursorStyle(P),this._keyPressHandled=!1)}_keyPress(P){let D;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1)return!1;if(this.cancel(P),P.charCode)D=P.charCode;else if(P.which===null||P.which===void 0)D=P.keyCode;else{if(P.which===0||P.charCode===0)return!1;D=P.which}return!(!D||(P.altKey||P.ctrlKey||P.metaKey)&&!this._isThirdLevelShift(this.browser,P)||(D=String.fromCharCode(D),this._onKey.fire({key:D,domEvent:P}),this._showCursor(),this.coreService.triggerDataEvent(D,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(P){if(P.data&&P.inputType==="insertText"&&(!P.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const D=P.data;return this.coreService.triggerDataEvent(D,!0),this.cancel(P),!0}return!1}resize(P,D){P!==this.cols||D!==this.rows?super.resize(P,D):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(P,D){var j,H;(j=this._charSizeService)==null||j.measure(),(H=this.viewport)==null||H.syncScrollArea(!0)}clear(){var P;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 D=1;D<this.rows;D++)this.buffer.lines.push(this.buffer.getBlankLine(W.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(P=this.viewport)==null||P.reset(),this.refresh(0,this.rows-1)}}reset(){var D,j;this.options.rows=this.rows,this.options.cols=this.cols;const P=this._customKeyEventHandler;this._setup(),super.reset(),(D=this._selectionService)==null||D.reset(),this._decorationService.reset(),(j=this.viewport)==null||j.reset(),this._customKeyEventHandler=P,this.refresh(0,this.rows-1)}clearTextureAtlas(){var P;(P=this._renderService)==null||P.clearTextureAtlas()}_reportFocus(){var P;(P=this.element)!=null&&P.classList.contains("focus")?this.coreService.triggerDataEvent(V.C0.ESC+"[I"):this.coreService.triggerDataEvent(V.C0.ESC+"[O")}_reportWindowsOptions(P){if(this._renderService)switch(P){case B.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const D=this._renderService.dimensions.css.canvas.width.toFixed(0),j=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${V.C0.ESC}[4;${j};${D}t`);break;case B.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const H=this._renderService.dimensions.css.cell.width.toFixed(0),q=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${V.C0.ESC}[6;${q};${H}t`)}}cancel(P,D){if(this.options.cancelEvents||D)return P.preventDefault(),P.stopPropagation(),!1}}n.Terminal=J},9924:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.TimeBasedDebouncer=void 0,n.TimeBasedDebouncer=class{constructor(a,u=1e3){this._renderCallback=a,this._debounceThresholdMS=u,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(a,u,d){this._rowCount=d,a=a!==void 0?a:0,u=u!==void 0?u:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,u):u;const l=Date.now();if(l-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=l,this._innerRefresh();else if(!this._additionalRefreshRequested){const p=l-this._lastRefreshMs,g=this._debounceThresholdMS-p;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},g)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const a=Math.max(this._rowStart,0),u=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,u)}}},1680:function(E,n,a){var u=this&&this.__decorate||function(h,s,c,f){var S,b=arguments.length,w=b<3?s:f===null?f=Object.getOwnPropertyDescriptor(s,c):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,s,c,f);else for(var v=h.length-1;v>=0;v--)(S=h[v])&&(w=(b<3?S(w):b>3?S(s,c,w):S(s,c))||w);return b>3&&w&&Object.defineProperty(s,c,w),w},d=this&&this.__param||function(h,s){return function(c,f){s(c,f,h)}};Object.defineProperty(n,"__esModule",{value:!0}),n.Viewport=void 0;const l=a(3656),p=a(4725),g=a(8460),y=a(844),m=a(2585);let o=n.Viewport=class extends y.Disposable{constructor(h,s,c,f,S,b,w,v){super(),this._viewportElement=h,this._scrollArea=s,this._bufferService=c,this._optionsService=f,this._charSizeService=S,this._renderService=b,this._coreBrowserService=w,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 g.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,l.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(k=>this._activeBuffer=k.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(k=>this._renderDimensions=k)),this._handleThemeChange(v.colors),this.register(v.onChangeColors(k=>this._handleThemeChange(k))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(h){this._viewportElement.style.backgroundColor=h.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(h){if(h)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 s=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==s&&(this._lastRecordedBufferHeight=s,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const h=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==h&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=h),this._refreshAnimationFrame=null}syncScrollArea(h=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(h);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(h)}_handleScroll(h){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const s=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:s,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const h=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(h*(this._smoothScrollState.target-this._smoothScrollState.origin)),h<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(h,s){const c=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(s<0&&this._viewportElement.scrollTop!==0||s>0&&c<this._lastRecordedBufferHeight)||(h.cancelable&&h.preventDefault(),!1)}handleWheel(h){const s=this._getPixelsScrolled(h);return s!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+s:this._smoothScrollState.target+=s,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=s,this._bubbleScroll(h,s))}scrollLines(h){if(h!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const s=h*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+s,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:h,suppressScrollEvent:!1})}_getPixelsScrolled(h){if(h.deltaY===0||h.shiftKey)return 0;let s=this._applyScrollModifier(h.deltaY,h);return h.deltaMode===WheelEvent.DOM_DELTA_LINE?s*=this._currentRowHeight:h.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._currentRowHeight*this._bufferService.rows),s}getBufferElements(h,s){var v;let c,f="";const S=[],b=s??this._bufferService.buffer.lines.length,w=this._bufferService.buffer.lines;for(let k=h;k<b;k++){const A=w.get(k);if(!A)continue;const O=(v=w.get(k+1))==null?void 0:v.isWrapped;if(f+=A.translateToString(!O),!O||k===w.length-1){const I=document.createElement("div");I.textContent=f,S.push(I),f.length>0&&(c=I),f=""}}return{bufferElements:S,cursorElement:c}}getLinesScrolled(h){if(h.deltaY===0||h.shiftKey)return 0;let s=this._applyScrollModifier(h.deltaY,h);return h.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=this._currentRowHeight+0,this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):h.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(h,s){const c=this._optionsService.rawOptions.fastScrollModifier;return c==="alt"&&s.altKey||c==="ctrl"&&s.ctrlKey||c==="shift"&&s.shiftKey?h*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:h*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(h){this._lastTouchY=h.touches[0].pageY}handleTouchMove(h){const s=this._lastTouchY-h.touches[0].pageY;return this._lastTouchY=h.touches[0].pageY,s!==0&&(this._viewportElement.scrollTop+=s,this._bubbleScroll(h,s))}};n.Viewport=o=u([d(2,m.IBufferService),d(3,m.IOptionsService),d(4,p.ICharSizeService),d(5,p.IRenderService),d(6,p.ICoreBrowserService),d(7,p.IThemeService)],o)},3107:function(E,n,a){var u=this&&this.__decorate||function(m,o,h,s){var c,f=arguments.length,S=f<3?o:s===null?s=Object.getOwnPropertyDescriptor(o,h):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(m,o,h,s);else for(var b=m.length-1;b>=0;b--)(c=m[b])&&(S=(f<3?c(S):f>3?c(o,h,S):c(o,h))||S);return f>3&&S&&Object.defineProperty(o,h,S),S},d=this&&this.__param||function(m,o){return function(h,s){o(h,s,m)}};Object.defineProperty(n,"__esModule",{value:!0}),n.BufferDecorationRenderer=void 0;const l=a(4725),p=a(844),g=a(2585);let y=n.BufferDecorationRenderer=class extends p.Disposable{constructor(m,o,h,s,c){super(),this._screenElement=m,this._bufferService=o,this._coreBrowserService=h,this._decorationService=s,this._renderService=c,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this.register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this.register(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(f=>this._removeDecoration(f))),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 m of this._decorationService.decorations)this._renderDecoration(m);this._dimensionsChanged=!1}_renderDecoration(m){this._refreshStyle(m),this._dimensionsChanged&&this._refreshXPosition(m)}_createElement(m){var s;const o=this._coreBrowserService.mainDocument.createElement("div");o.classList.add("xterm-decoration"),o.classList.toggle("xterm-decoration-top-layer",((s=m==null?void 0:m.options)==null?void 0:s.layer)==="top"),o.style.width=`${Math.round((m.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,o.style.height=(m.options.height||1)*this._renderService.dimensions.css.cell.height+"px",o.style.top=(m.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",o.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const h=m.options.x??0;return h&&h>this._bufferService.cols&&(o.style.display="none"),this._refreshXPosition(m,o),o}_refreshStyle(m){const o=m.marker.line-this._bufferService.buffers.active.ydisp;if(o<0||o>=this._bufferService.rows)m.element&&(m.element.style.display="none",m.onRenderEmitter.fire(m.element));else{let h=this._decorationElements.get(m);h||(h=this._createElement(m),m.element=h,this._decorationElements.set(m,h),this._container.appendChild(h),m.onDispose(()=>{this._decorationElements.delete(m),h.remove()})),h.style.top=o*this._renderService.dimensions.css.cell.height+"px",h.style.display=this._altBufferIsActive?"none":"block",m.onRenderEmitter.fire(h)}}_refreshXPosition(m,o=m.element){if(!o)return;const h=m.options.x??0;(m.options.anchor||"left")==="right"?o.style.right=h?h*this._renderService.dimensions.css.cell.width+"px":"":o.style.left=h?h*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(m){var o;(o=this._decorationElements.get(m))==null||o.remove(),this._decorationElements.delete(m),m.dispose()}};n.BufferDecorationRenderer=y=u([d(1,g.IBufferService),d(2,l.ICoreBrowserService),d(3,g.IDecorationService),d(4,l.IRenderService)],y)},5871:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ColorZoneStore=void 0,n.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(a){if(a.options.overviewRulerOptions){for(const u of this._zones)if(u.color===a.options.overviewRulerOptions.color&&u.position===a.options.overviewRulerOptions.position){if(this._lineIntersectsZone(u,a.marker.line))return;if(this._lineAdjacentToZone(u,a.marker.line,a.options.overviewRulerOptions.position))return void this._addLineToZone(u,a.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=a.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=a.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=a.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=a.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:a.options.overviewRulerOptions.color,position:a.options.overviewRulerOptions.position,startBufferLine:a.marker.line,endBufferLine:a.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(a){this._linePadding=a}_lineIntersectsZone(a,u){return u>=a.startBufferLine&&u<=a.endBufferLine}_lineAdjacentToZone(a,u,d){return u>=a.startBufferLine-this._linePadding[d||"full"]&&u<=a.endBufferLine+this._linePadding[d||"full"]}_addLineToZone(a,u){a.startBufferLine=Math.min(a.startBufferLine,u),a.endBufferLine=Math.max(a.endBufferLine,u)}}},5744:function(E,n,a){var u=this&&this.__decorate||function(c,f,S,b){var w,v=arguments.length,k=v<3?f:b===null?b=Object.getOwnPropertyDescriptor(f,S):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(c,f,S,b);else for(var A=c.length-1;A>=0;A--)(w=c[A])&&(k=(v<3?w(k):v>3?w(f,S,k):w(f,S))||k);return v>3&&k&&Object.defineProperty(f,S,k),k},d=this&&this.__param||function(c,f){return function(S,b){f(S,b,c)}};Object.defineProperty(n,"__esModule",{value:!0}),n.OverviewRulerRenderer=void 0;const l=a(5871),p=a(4725),g=a(844),y=a(2585),m={full:0,left:0,center:0,right:0},o={full:0,left:0,center:0,right:0},h={full:0,left:0,center:0,right:0};let s=n.OverviewRulerRenderer=class extends g.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(c,f,S,b,w,v,k){var O;super(),this._viewportElement=c,this._screenElement=f,this._bufferService=S,this._decorationService=b,this._renderService=w,this._optionsService=v,this._coreBrowserService=k,this._colorZoneStore=new l.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(O=this._viewportElement.parentElement)==null||O.insertBefore(this._canvas,this._viewportElement);const A=this._canvas.getContext("2d");if(!A)throw new Error("Ctx cannot be null");this._ctx=A,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,g.toDisposable)(()=>{var I;(I=this._canvas)==null||I.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 c=Math.floor(this._canvas.width/3),f=Math.ceil(this._canvas.width/3);o.full=this._canvas.width,o.left=c,o.center=f,o.right=c,this._refreshDrawHeightConstants(),h.full=0,h.left=0,h.center=o.left,h.right=o.left+o.center}_refreshDrawHeightConstants(){m.full=Math.round(2*this._coreBrowserService.dpr);const c=this._canvas.height/this._bufferService.buffer.lines.length,f=Math.round(Math.max(Math.min(c,12),6)*this._coreBrowserService.dpr);m.left=f,m.center=f,m.right=f}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*m.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*m.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*m.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*m.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 f of this._decorationService.decorations)this._colorZoneStore.addDecoration(f);this._ctx.lineWidth=1;const c=this._colorZoneStore.zones;for(const f of c)f.position!=="full"&&this._renderColorZone(f);for(const f of c)f.position==="full"&&this._renderColorZone(f);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(c){this._ctx.fillStyle=c.color,this._ctx.fillRect(h[c.position||"full"],Math.round((this._canvas.height-1)*(c.startBufferLine/this._bufferService.buffers.active.lines.length)-m[c.position||"full"]/2),o[c.position||"full"],Math.round((this._canvas.height-1)*((c.endBufferLine-c.startBufferLine)/this._bufferService.buffers.active.lines.length)+m[c.position||"full"]))}_queueRefresh(c,f){this._shouldUpdateDimensions=c||this._shouldUpdateDimensions,this._shouldUpdateAnchor=f||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};n.OverviewRulerRenderer=s=u([d(2,y.IBufferService),d(3,y.IDecorationService),d(4,p.IRenderService),d(5,y.IOptionsService),d(6,p.ICoreBrowserService)],s)},2950:function(E,n,a){var u=this&&this.__decorate||function(m,o,h,s){var c,f=arguments.length,S=f<3?o:s===null?s=Object.getOwnPropertyDescriptor(o,h):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(m,o,h,s);else for(var b=m.length-1;b>=0;b--)(c=m[b])&&(S=(f<3?c(S):f>3?c(o,h,S):c(o,h))||S);return f>3&&S&&Object.defineProperty(o,h,S),S},d=this&&this.__param||function(m,o){return function(h,s){o(h,s,m)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CompositionHelper=void 0;const l=a(4725),p=a(2585),g=a(2584);let y=n.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(m,o,h,s,c,f){this._textarea=m,this._compositionView=o,this._bufferService=h,this._optionsService=s,this._coreService=c,this._renderService=f,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(m){this._compositionView.textContent=m.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(m){if(this._isComposing||this._isSendingComposition){if(m.keyCode===229||m.keyCode===16||m.keyCode===17||m.keyCode===18)return!1;this._finalizeComposition(!1)}return m.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(m){if(this._compositionView.classList.remove("active"),this._isComposing=!1,m){const o={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let h;this._isSendingComposition=!1,o.start+=this._dataAlreadySent.length,h=this._isComposing?this._textarea.value.substring(o.start,o.end):this._textarea.value.substring(o.start),h.length>0&&this._coreService.triggerDataEvent(h,!0)}},0)}else{this._isSendingComposition=!1;const o=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(o,!0)}}_handleAnyTextareaChanges(){const m=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const o=this._textarea.value,h=o.replace(m,"");this._dataAlreadySent=h,o.length>m.length?this._coreService.triggerDataEvent(h,!0):o.length<m.length?this._coreService.triggerDataEvent(`${g.C0.DEL}`,!0):o.length===m.length&&o!==m&&this._coreService.triggerDataEvent(o,!0)}},0)}updateCompositionElements(m){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const o=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),h=this._renderService.dimensions.css.cell.height,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,c=o*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=c+"px",this._compositionView.style.top=s+"px",this._compositionView.style.height=h+"px",this._compositionView.style.lineHeight=h+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const f=this._compositionView.getBoundingClientRect();this._textarea.style.left=c+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(f.width,1)+"px",this._textarea.style.height=Math.max(f.height,1)+"px",this._textarea.style.lineHeight=f.height+"px"}m||setTimeout(()=>this.updateCompositionElements(!0),0)}}};n.CompositionHelper=y=u([d(2,p.IBufferService),d(3,p.IOptionsService),d(4,p.ICoreService),d(5,l.IRenderService)],y)},9806:(E,n)=>{function a(u,d,l){const p=l.getBoundingClientRect(),g=u.getComputedStyle(l),y=parseInt(g.getPropertyValue("padding-left")),m=parseInt(g.getPropertyValue("padding-top"));return[d.clientX-p.left-y,d.clientY-p.top-m]}Object.defineProperty(n,"__esModule",{value:!0}),n.getCoords=n.getCoordsRelativeToElement=void 0,n.getCoordsRelativeToElement=a,n.getCoords=function(u,d,l,p,g,y,m,o,h){if(!y)return;const s=a(u,d,l);return s?(s[0]=Math.ceil((s[0]+(h?m/2:0))/m),s[1]=Math.ceil(s[1]/o),s[0]=Math.min(Math.max(s[0],1),p+(h?1:0)),s[1]=Math.min(Math.max(s[1],1),g),s):void 0}},9504:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.moveToCellSequence=void 0;const u=a(2584);function d(o,h,s,c){const f=o-l(o,s),S=h-l(h,s),b=Math.abs(f-S)-function(w,v,k){let A=0;const O=w-l(w,k),I=v-l(v,k);for(let L=0;L<Math.abs(O-I);L++){const $=p(w,v)==="A"?-1:1,F=k.buffer.lines.get(O+$*L);F!=null&&F.isWrapped&&A++}return A}(o,h,s);return m(b,y(p(o,h),c))}function l(o,h){let s=0,c=h.buffer.lines.get(o),f=c==null?void 0:c.isWrapped;for(;f&&o>=0&&o<h.rows;)s++,c=h.buffer.lines.get(--o),f=c==null?void 0:c.isWrapped;return s}function p(o,h){return o>h?"A":"B"}function g(o,h,s,c,f,S){let b=o,w=h,v="";for(;b!==s||w!==c;)b+=f?1:-1,f&&b>S.cols-1?(v+=S.buffer.translateBufferLineToString(w,!1,o,b),b=0,o=0,w++):!f&&b<0&&(v+=S.buffer.translateBufferLineToString(w,!1,0,o+1),b=S.cols-1,o=b,w--);return v+S.buffer.translateBufferLineToString(w,!1,o,b)}function y(o,h){const s=h?"O":"[";return u.C0.ESC+s+o}function m(o,h){o=Math.floor(o);let s="";for(let c=0;c<o;c++)s+=h;return s}n.moveToCellSequence=function(o,h,s,c){const f=s.buffer.x,S=s.buffer.y;if(!s.buffer.hasScrollback)return function(v,k,A,O,I,L){return d(k,O,I,L).length===0?"":m(g(v,k,v,k-l(k,I),!1,I).length,y("D",L))}(f,S,0,h,s,c)+d(S,h,s,c)+function(v,k,A,O,I,L){let $;$=d(k,O,I,L).length>0?O-l(O,I):k;const F=O,W=function(V,Z,x,R,T,B){let N;return N=d(x,R,T,B).length>0?R-l(R,T):Z,V<x&&N<=R||V>=x&&N<R?"C":"D"}(v,k,A,O,I,L);return m(g(v,$,A,F,W==="C",I).length,y(W,L))}(f,S,o,h,s,c);let b;if(S===h)return b=f>o?"D":"C",m(Math.abs(f-o),y(b,c));b=S>h?"D":"C";const w=Math.abs(S-h);return m(function(v,k){return k.cols-v}(S>h?o:f,s)+(w-1)*s.cols+1+((S>h?f:o)-1),y(b,c))}},1296:function(E,n,a){var u=this&&this.__decorate||function(L,$,F,W){var V,Z=arguments.length,x=Z<3?$:W===null?W=Object.getOwnPropertyDescriptor($,F):W;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(L,$,F,W);else for(var R=L.length-1;R>=0;R--)(V=L[R])&&(x=(Z<3?V(x):Z>3?V($,F,x):V($,F))||x);return Z>3&&x&&Object.defineProperty($,F,x),x},d=this&&this.__param||function(L,$){return function(F,W){$(F,W,L)}};Object.defineProperty(n,"__esModule",{value:!0}),n.DomRenderer=void 0;const l=a(3787),p=a(2550),g=a(2223),y=a(6171),m=a(6052),o=a(4725),h=a(8055),s=a(8460),c=a(844),f=a(2585),S="xterm-dom-renderer-owner-",b="xterm-rows",w="xterm-fg-",v="xterm-bg-",k="xterm-focus",A="xterm-selection";let O=1,I=n.DomRenderer=class extends c.Disposable{constructor(L,$,F,W,V,Z,x,R,T,B,N,U,J){super(),this._terminal=L,this._document=$,this._element=F,this._screenElement=W,this._viewportElement=V,this._helperContainer=Z,this._linkifier2=x,this._charSizeService=T,this._optionsService=B,this._bufferService=N,this._coreBrowserService=U,this._themeService=J,this._terminalClass=O++,this._rowElements=[],this._selectionRenderModel=(0,m.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new s.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(b),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(A),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(X=>this._injectCss(X))),this._injectCss(this._themeService.colors),this._rowFactory=R.createInstance(l.DomRendererRowFactory,document),this._element.classList.add(S+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(X=>this._handleLinkHover(X))),this.register(this._linkifier2.onHideLinkUnderline(X=>this._handleLinkLeave(X))),this.register((0,c.toDisposable)(()=>{this._element.classList.remove(S+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new 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 L=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*L,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*L),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/L),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/L),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const F of this._rowElements)F.style.width=`${this.dimensions.css.canvas.width}px`,F.style.height=`${this.dimensions.css.cell.height}px`,F.style.lineHeight=`${this.dimensions.css.cell.height}px`,F.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const $=`${this._terminalSelector} .${b} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=$,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(L){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let $=`${this._terminalSelector} .${b} { color: ${L.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;$+=`${this._terminalSelector} .${b} .xterm-dim { color: ${h.color.multiplyOpacity(L.foreground,.5).css};}`,$+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const F=`blink_underline_${this._terminalClass}`,W=`blink_bar_${this._terminalClass}`,V=`blink_block_${this._terminalClass}`;$+=`@keyframes ${F} { 50% { border-bottom-style: hidden; }}`,$+=`@keyframes ${W} { 50% { box-shadow: none; }}`,$+=`@keyframes ${V} { 0% { background-color: ${L.cursor.css}; color: ${L.cursorAccent.css}; } 50% { background-color: inherit; color: ${L.cursor.css}; }}`,$+=`${this._terminalSelector} .${b}.${k} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${F} 1s step-end infinite;}${this._terminalSelector} .${b}.${k} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${W} 1s step-end infinite;}${this._terminalSelector} .${b}.${k} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${V} 1s step-end infinite;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-block { background-color: ${L.cursor.css}; color: ${L.cursorAccent.css};}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${L.cursor.css} !important; color: ${L.cursorAccent.css} !important;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${L.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${L.cursor.css} inset;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${L.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,$+=`${this._terminalSelector} .${A} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${A} div { position: absolute; background-color: ${L.selectionBackgroundOpaque.css};}${this._terminalSelector} .${A} div { position: absolute; background-color: ${L.selectionInactiveBackgroundOpaque.css};}`;for(const[Z,x]of L.ansi.entries())$+=`${this._terminalSelector} .${w}${Z} { color: ${x.css}; }${this._terminalSelector} .${w}${Z}.xterm-dim { color: ${h.color.multiplyOpacity(x,.5).css}; }${this._terminalSelector} .${v}${Z} { background-color: ${x.css}; }`;$+=`${this._terminalSelector} .${w}${g.INVERTED_DEFAULT_COLOR} { color: ${h.color.opaque(L.background).css}; }${this._terminalSelector} .${w}${g.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${h.color.multiplyOpacity(h.color.opaque(L.background),.5).css}; }${this._terminalSelector} .${v}${g.INVERTED_DEFAULT_COLOR} { background-color: ${L.foreground.css}; }`,this._themeStyleElement.textContent=$}_setDefaultSpacing(){const L=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${L}px`,this._rowFactory.defaultSpacing=L}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(L,$){for(let F=this._rowElements.length;F<=$;F++){const W=this._document.createElement("div");this._rowContainer.appendChild(W),this._rowElements.push(W)}for(;this._rowElements.length>$;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(L,$){this._refreshRowElements(L,$),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(k),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(k),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(L,$,F){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(L,$,F),this.renderRows(0,this._bufferService.rows-1),!L||!$)return;this._selectionRenderModel.update(this._terminal,L,$,F);const W=this._selectionRenderModel.viewportStartRow,V=this._selectionRenderModel.viewportEndRow,Z=this._selectionRenderModel.viewportCappedStartRow,x=this._selectionRenderModel.viewportCappedEndRow;if(Z>=this._bufferService.rows||x<0)return;const R=this._document.createDocumentFragment();if(F){const T=L[0]>$[0];R.appendChild(this._createSelectionElement(Z,T?$[0]:L[0],T?L[0]:$[0],x-Z+1))}else{const T=W===Z?L[0]:0,B=Z===V?$[0]:this._bufferService.cols;R.appendChild(this._createSelectionElement(Z,T,B));const N=x-Z-1;if(R.appendChild(this._createSelectionElement(Z+1,0,this._bufferService.cols,N)),Z!==x){const U=V===x?$[0]:this._bufferService.cols;R.appendChild(this._createSelectionElement(x,0,U))}}this._selectionContainer.appendChild(R)}_createSelectionElement(L,$,F,W=1){const V=this._document.createElement("div"),Z=$*this.dimensions.css.cell.width;let x=this.dimensions.css.cell.width*(F-$);return Z+x>this.dimensions.css.canvas.width&&(x=this.dimensions.css.canvas.width-Z),V.style.height=W*this.dimensions.css.cell.height+"px",V.style.top=L*this.dimensions.css.cell.height+"px",V.style.left=`${Z}px`,V.style.width=`${x}px`,V}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 L of this._rowElements)L.replaceChildren()}renderRows(L,$){const F=this._bufferService.buffer,W=F.ybase+F.y,V=Math.min(F.x,this._bufferService.cols-1),Z=this._optionsService.rawOptions.cursorBlink,x=this._optionsService.rawOptions.cursorStyle,R=this._optionsService.rawOptions.cursorInactiveStyle;for(let T=L;T<=$;T++){const B=T+F.ydisp,N=this._rowElements[T],U=F.lines.get(B);if(!N||!U)break;N.replaceChildren(...this._rowFactory.createRow(U,B,B===W,x,R,V,Z,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${S}${this._terminalClass}`}_handleLinkHover(L){this._setCellUnderline(L.x1,L.x2,L.y1,L.y2,L.cols,!0)}_handleLinkLeave(L){this._setCellUnderline(L.x1,L.x2,L.y1,L.y2,L.cols,!1)}_setCellUnderline(L,$,F,W,V,Z){F<0&&(L=0),W<0&&($=0);const x=this._bufferService.rows-1;F=Math.max(Math.min(F,x),0),W=Math.max(Math.min(W,x),0),V=Math.min(V,this._bufferService.cols);const R=this._bufferService.buffer,T=R.ybase+R.y,B=Math.min(R.x,V-1),N=this._optionsService.rawOptions.cursorBlink,U=this._optionsService.rawOptions.cursorStyle,J=this._optionsService.rawOptions.cursorInactiveStyle;for(let X=F;X<=W;++X){const P=X+R.ydisp,D=this._rowElements[X],j=R.lines.get(P);if(!D||!j)break;D.replaceChildren(...this._rowFactory.createRow(j,P,P===T,U,J,B,N,this.dimensions.css.cell.width,this._widthCache,Z?X===F?L:0:-1,Z?(X===W?$:V)-1:-1))}}};n.DomRenderer=I=u([d(7,f.IInstantiationService),d(8,o.ICharSizeService),d(9,f.IOptionsService),d(10,f.IBufferService),d(11,o.ICoreBrowserService),d(12,o.IThemeService)],I)},3787:function(E,n,a){var u=this&&this.__decorate||function(b,w,v,k){var A,O=arguments.length,I=O<3?w:k===null?k=Object.getOwnPropertyDescriptor(w,v):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(b,w,v,k);else for(var L=b.length-1;L>=0;L--)(A=b[L])&&(I=(O<3?A(I):O>3?A(w,v,I):A(w,v))||I);return O>3&&I&&Object.defineProperty(w,v,I),I},d=this&&this.__param||function(b,w){return function(v,k){w(v,k,b)}};Object.defineProperty(n,"__esModule",{value:!0}),n.DomRendererRowFactory=void 0;const l=a(2223),p=a(643),g=a(511),y=a(2585),m=a(8055),o=a(4725),h=a(4269),s=a(6171),c=a(3734);let f=n.DomRendererRowFactory=class{constructor(b,w,v,k,A,O,I){this._document=b,this._characterJoinerService=w,this._optionsService=v,this._coreBrowserService=k,this._coreService=A,this._decorationService=O,this._themeService=I,this._workCell=new g.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(b,w,v){this._selectionStart=b,this._selectionEnd=w,this._columnSelectMode=v}createRow(b,w,v,k,A,O,I,L,$,F,W){const V=[],Z=this._characterJoinerService.getJoinedCharacters(w),x=this._themeService.colors;let R,T=b.getNoBgTrimmedLength();v&&T<O+1&&(T=O+1);let B=0,N="",U=0,J=0,X=0,P=!1,D=0,j=!1,H=0;const q=[],K=F!==-1&&W!==-1;for(let ee=0;ee<T;ee++){b.loadCell(ee,this._workCell);let ie=this._workCell.getWidth();if(ie===0)continue;let se=!1,ae=ee,Y=this._workCell;if(Z.length>0&&ee===Z[0][0]){se=!0;const re=Z.shift();Y=new h.JoinedCellData(this._workCell,b.translateToString(!0,re[0],re[1]),re[1]-re[0]),ae=re[1]-1,ie=Y.getWidth()}const Ke=this._isCellInSelection(ee,w),Xt=v&&ee===O,Yt=K&&ee>=F&&ee<=W;let Qt=!1;this._decorationService.forEachDecorationAtCell(ee,w,void 0,re=>{Qt=!0});let ft=Y.getChars()||p.WHITESPACE_CELL_CHAR;if(ft===" "&&(Y.isUnderline()||Y.isOverline())&&(ft=" "),H=ie*L-$.get(ft,Y.isBold(),Y.isItalic()),R){if(B&&(Ke&&j||!Ke&&!j&&Y.bg===U)&&(Ke&&j&&x.selectionForeground||Y.fg===J)&&Y.extended.ext===X&&Yt===P&&H===D&&!Xt&&!se&&!Qt){Y.isInvisible()?N+=p.WHITESPACE_CELL_CHAR:N+=ft,B++;continue}B&&(R.textContent=N),R=this._document.createElement("span"),B=0,N=""}else R=this._document.createElement("span");if(U=Y.bg,J=Y.fg,X=Y.extended.ext,P=Yt,D=H,j=Ke,se&&O>=ee&&O<=ae&&(O=ee),!this._coreService.isCursorHidden&&Xt&&this._coreService.isCursorInitialized){if(q.push("xterm-cursor"),this._coreBrowserService.isFocused)I&&q.push("xterm-cursor-blink"),q.push(k==="bar"?"xterm-cursor-bar":k==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(A)switch(A){case"outline":q.push("xterm-cursor-outline");break;case"block":q.push("xterm-cursor-block");break;case"bar":q.push("xterm-cursor-bar");break;case"underline":q.push("xterm-cursor-underline")}}if(Y.isBold()&&q.push("xterm-bold"),Y.isItalic()&&q.push("xterm-italic"),Y.isDim()&&q.push("xterm-dim"),N=Y.isInvisible()?p.WHITESPACE_CELL_CHAR:Y.getChars()||p.WHITESPACE_CELL_CHAR,Y.isUnderline()&&(q.push(`xterm-underline-${Y.extended.underlineStyle}`),N===" "&&(N=" "),!Y.isUnderlineColorDefault()))if(Y.isUnderlineColorRGB())R.style.textDecorationColor=`rgb(${c.AttributeData.toColorRGB(Y.getUnderlineColor()).join(",")})`;else{let re=Y.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Y.isBold()&&re<8&&(re+=8),R.style.textDecorationColor=x.ansi[re].css}Y.isOverline()&&(q.push("xterm-overline"),N===" "&&(N=" ")),Y.isStrikethrough()&&q.push("xterm-strikethrough"),Yt&&(R.style.textDecoration="underline");let le=Y.getFgColor(),qe=Y.getFgColorMode(),pe=Y.getBgColor(),Ve=Y.getBgColorMode();const er=!!Y.isInverse();if(er){const re=le;le=pe,pe=re;const $c=qe;qe=Ve,Ve=$c}let we,_t,Ce,Ge=!1;switch(this._decorationService.forEachDecorationAtCell(ee,w,void 0,re=>{re.options.layer!=="top"&&Ge||(re.backgroundColorRGB&&(Ve=50331648,pe=re.backgroundColorRGB.rgba>>8&16777215,we=re.backgroundColorRGB),re.foregroundColorRGB&&(qe=50331648,le=re.foregroundColorRGB.rgba>>8&16777215,_t=re.foregroundColorRGB),Ge=re.options.layer==="top")}),!Ge&&Ke&&(we=this._coreBrowserService.isFocused?x.selectionBackgroundOpaque:x.selectionInactiveBackgroundOpaque,pe=we.rgba>>8&16777215,Ve=50331648,Ge=!0,x.selectionForeground&&(qe=50331648,le=x.selectionForeground.rgba>>8&16777215,_t=x.selectionForeground)),Ge&&q.push("xterm-decoration-top"),Ve){case 16777216:case 33554432:Ce=x.ansi[pe],q.push(`xterm-bg-${pe}`);break;case 50331648:Ce=m.channels.toColor(pe>>16,pe>>8&255,255&pe),this._addStyle(R,`background-color:#${S((pe>>>0).toString(16),"0",6)}`);break;default:er?(Ce=x.foreground,q.push(`xterm-bg-${l.INVERTED_DEFAULT_COLOR}`)):Ce=x.background}switch(we||Y.isDim()&&(we=m.color.multiplyOpacity(Ce,.5)),qe){case 16777216:case 33554432:Y.isBold()&&le<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(le+=8),this._applyMinimumContrast(R,Ce,x.ansi[le],Y,we,void 0)||q.push(`xterm-fg-${le}`);break;case 50331648:const re=m.channels.toColor(le>>16&255,le>>8&255,255&le);this._applyMinimumContrast(R,Ce,re,Y,we,_t)||this._addStyle(R,`color:#${S(le.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(R,Ce,x.foreground,Y,we,_t)||er&&q.push(`xterm-fg-${l.INVERTED_DEFAULT_COLOR}`)}q.length&&(R.className=q.join(" "),q.length=0),Xt||se||Qt?R.textContent=N:B++,H!==this.defaultSpacing&&(R.style.letterSpacing=`${H}px`),V.push(R),ee=ae}return R&&B&&(R.textContent=N),V}_applyMinimumContrast(b,w,v,k,A,O){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,s.treatGlyphAsBackgroundColor)(k.getCode()))return!1;const I=this._getContrastCache(k);let L;if(A||O||(L=I.getColor(w.rgba,v.rgba)),L===void 0){const $=this._optionsService.rawOptions.minimumContrastRatio/(k.isDim()?2:1);L=m.color.ensureContrastRatio(A||w,O||v,$),I.setColor((A||w).rgba,(O||v).rgba,L??null)}return!!L&&(this._addStyle(b,`color:${L.css}`),!0)}_getContrastCache(b){return b.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(b,w){b.setAttribute("style",`${b.getAttribute("style")||""}${w};`)}_isCellInSelection(b,w){const v=this._selectionStart,k=this._selectionEnd;return!(!v||!k)&&(this._columnSelectMode?v[0]<=k[0]?b>=v[0]&&w>=v[1]&&b<k[0]&&w<=k[1]:b<v[0]&&w>=v[1]&&b>=k[0]&&w<=k[1]:w>v[1]&&w<k[1]||v[1]===k[1]&&w===v[1]&&b>=v[0]&&b<k[0]||v[1]<k[1]&&w===k[1]&&b<k[0]||v[1]<k[1]&&w===v[1]&&b>=v[0])}};function S(b,w,v){for(;b.length<v;)b=w+b;return b}n.DomRendererRowFactory=f=u([d(1,o.ICharacterJoinerService),d(2,y.IOptionsService),d(3,o.ICoreBrowserService),d(4,y.ICoreService),d(5,y.IDecorationService),d(6,o.IThemeService)],f)},2550:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.WidthCache=void 0,n.WidthCache=class{constructor(a,u){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=a.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const d=a.createElement("span");d.classList.add("xterm-char-measure-element");const l=a.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontWeight="bold";const p=a.createElement("span");p.classList.add("xterm-char-measure-element"),p.style.fontStyle="italic";const g=a.createElement("span");g.classList.add("xterm-char-measure-element"),g.style.fontWeight="bold",g.style.fontStyle="italic",this._measureElements=[d,l,p,g],this._container.appendChild(d),this._container.appendChild(l),this._container.appendChild(p),this._container.appendChild(g),u.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(a,u,d,l){a===this._font&&u===this._fontSize&&d===this._weight&&l===this._weightBold||(this._font=a,this._fontSize=u,this._weight=d,this._weightBold=l,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${d}`,this._measureElements[1].style.fontWeight=`${l}`,this._measureElements[2].style.fontWeight=`${d}`,this._measureElements[3].style.fontWeight=`${l}`,this.clear())}get(a,u,d){let l=0;if(!u&&!d&&a.length===1&&(l=a.charCodeAt(0))<256){if(this._flat[l]!==-9999)return this._flat[l];const y=this._measure(a,0);return y>0&&(this._flat[l]=y),y}let p=a;u&&(p+="B"),d&&(p+="I");let g=this._holey.get(p);if(g===void 0){let y=0;u&&(y|=1),d&&(y|=2),g=this._measure(a,y),g>0&&this._holey.set(p,g)}return g}_measure(a,u){const d=this._measureElements[u];return d.textContent=a.repeat(32),d.offsetWidth/32}}},2223:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.TEXT_BASELINE=n.DIM_OPACITY=n.INVERTED_DEFAULT_COLOR=void 0;const u=a(6114);n.INVERTED_DEFAULT_COLOR=257,n.DIM_OPACITY=.5,n.TEXT_BASELINE=u.isFirefox||u.isLegacyEdge?"bottom":"ideographic"},6171:(E,n)=>{function a(d){return 57508<=d&&d<=57558}function u(d){return d>=128512&&d<=128591||d>=127744&&d<=128511||d>=128640&&d<=128767||d>=9728&&d<=9983||d>=9984&&d<=10175||d>=65024&&d<=65039||d>=129280&&d<=129535||d>=127462&&d<=127487}Object.defineProperty(n,"__esModule",{value:!0}),n.computeNextVariantOffset=n.createRenderDimensions=n.treatGlyphAsBackgroundColor=n.allowRescaling=n.isEmoji=n.isRestrictedPowerlineGlyph=n.isPowerlineGlyph=n.throwIfFalsy=void 0,n.throwIfFalsy=function(d){if(!d)throw new Error("value must not be falsy");return d},n.isPowerlineGlyph=a,n.isRestrictedPowerlineGlyph=function(d){return 57520<=d&&d<=57527},n.isEmoji=u,n.allowRescaling=function(d,l,p,g){return l===1&&p>Math.ceil(1.5*g)&&d!==void 0&&d>255&&!u(d)&&!a(d)&&!function(y){return 57344<=y&&y<=63743}(d)},n.treatGlyphAsBackgroundColor=function(d){return a(d)||function(l){return 9472<=l&&l<=9631}(d)},n.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}}}},n.computeNextVariantOffset=function(d,l,p=0){return(d-(2*Math.round(l)-p))%(2*Math.round(l))}},6052:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createSelectionRenderModel=void 0;class a{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(d,l,p,g=!1){if(this.selectionStart=l,this.selectionEnd=p,!l||!p||l[0]===p[0]&&l[1]===p[1])return void this.clear();const y=d.buffers.active.ydisp,m=l[1]-y,o=p[1]-y,h=Math.max(m,0),s=Math.min(o,d.rows-1);h>=d.rows||s<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=g,this.viewportStartRow=m,this.viewportEndRow=o,this.viewportCappedStartRow=h,this.viewportCappedEndRow=s,this.startCol=l[0],this.endCol=p[0])}isCellSelected(d,l,p){return!!this.hasSelection&&(p-=d.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?l>=this.startCol&&p>=this.viewportCappedStartRow&&l<this.endCol&&p<=this.viewportCappedEndRow:l<this.startCol&&p>=this.viewportCappedStartRow&&l>=this.endCol&&p<=this.viewportCappedEndRow:p>this.viewportStartRow&&p<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&p===this.viewportStartRow&&l>=this.startCol&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&p===this.viewportEndRow&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&p===this.viewportStartRow&&l>=this.startCol)}}n.createSelectionRenderModel=function(){return new a}},456:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.SelectionModel=void 0,n.SelectionModel=class{constructor(a){this._bufferService=a,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?a%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)-1]:[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[a,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[Math.max(a,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const a=this.selectionStart,u=this.selectionEnd;return!(!a||!u)&&(a[1]>u[1]||a[1]===u[1]&&a[0]>u[0])}handleTrim(a){return this.selectionStart&&(this.selectionStart[1]-=a),this.selectionEnd&&(this.selectionEnd[1]-=a),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(E,n,a){var u=this&&this.__decorate||function(s,c,f,S){var b,w=arguments.length,v=w<3?c:S===null?S=Object.getOwnPropertyDescriptor(c,f):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(s,c,f,S);else for(var k=s.length-1;k>=0;k--)(b=s[k])&&(v=(w<3?b(v):w>3?b(c,f,v):b(c,f))||v);return w>3&&v&&Object.defineProperty(c,f,v),v},d=this&&this.__param||function(s,c){return function(f,S){c(f,S,s)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CharSizeService=void 0;const l=a(2585),p=a(8460),g=a(844);let y=n.CharSizeService=class extends g.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(s,c,f){super(),this._optionsService=f,this.width=0,this.height=0,this._onCharSizeChange=this.register(new p.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new h(this._optionsService))}catch{this._measureStrategy=this.register(new o(s,c,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const s=this._measureStrategy.measure();s.width===this.width&&s.height===this.height||(this.width=s.width,this.height=s.height,this._onCharSizeChange.fire())}};n.CharSizeService=y=u([d(2,l.IOptionsService)],y);class m extends g.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(c,f){c!==void 0&&c>0&&f!==void 0&&f>0&&(this._result.width=c,this._result.height=f)}}class o extends m{constructor(c,f,S){super(),this._document=c,this._parentElement=f,this._optionsService=S,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class h extends m{constructor(c){super(),this._optionsService=c,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const f=this._ctx.measureText("W");if(!("width"in f&&"fontBoundingBoxAscent"in f&&"fontBoundingBoxDescent"in f))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const c=this._ctx.measureText("W");return this._validateAndSet(c.width,c.fontBoundingBoxAscent+c.fontBoundingBoxDescent),this._result}}},4269:function(E,n,a){var u=this&&this.__decorate||function(h,s,c,f){var S,b=arguments.length,w=b<3?s:f===null?f=Object.getOwnPropertyDescriptor(s,c):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,s,c,f);else for(var v=h.length-1;v>=0;v--)(S=h[v])&&(w=(b<3?S(w):b>3?S(s,c,w):S(s,c))||w);return b>3&&w&&Object.defineProperty(s,c,w),w},d=this&&this.__param||function(h,s){return function(c,f){s(c,f,h)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CharacterJoinerService=n.JoinedCellData=void 0;const l=a(3734),p=a(643),g=a(511),y=a(2585);class m extends l.AttributeData{constructor(s,c,f){super(),this.content=0,this.combinedData="",this.fg=s.fg,this.bg=s.bg,this.combinedData=c,this._width=f}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(s){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}n.JoinedCellData=m;let o=n.CharacterJoinerService=class Ts{constructor(s){this._bufferService=s,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new g.CellData}register(s){const c={id:this._nextCharacterJoinerId++,handler:s};return this._characterJoiners.push(c),c.id}deregister(s){for(let c=0;c<this._characterJoiners.length;c++)if(this._characterJoiners[c].id===s)return this._characterJoiners.splice(c,1),!0;return!1}getJoinedCharacters(s){if(this._characterJoiners.length===0)return[];const c=this._bufferService.buffer.lines.get(s);if(!c||c.length===0)return[];const f=[],S=c.translateToString(!0);let b=0,w=0,v=0,k=c.getFg(0),A=c.getBg(0);for(let O=0;O<c.getTrimmedLength();O++)if(c.loadCell(O,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==k||this._workCell.bg!==A){if(O-b>1){const I=this._getJoinedRanges(S,v,w,c,b);for(let L=0;L<I.length;L++)f.push(I[L])}b=O,v=w,k=this._workCell.fg,A=this._workCell.bg}w+=this._workCell.getChars().length||p.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-b>1){const O=this._getJoinedRanges(S,v,w,c,b);for(let I=0;I<O.length;I++)f.push(O[I])}return f}_getJoinedRanges(s,c,f,S,b){const w=s.substring(c,f);let v=[];try{v=this._characterJoiners[0].handler(w)}catch(k){console.error(k)}for(let k=1;k<this._characterJoiners.length;k++)try{const A=this._characterJoiners[k].handler(w);for(let O=0;O<A.length;O++)Ts._mergeRanges(v,A[O])}catch(A){console.error(A)}return this._stringRangesToCellRanges(v,S,b),v}_stringRangesToCellRanges(s,c,f){let S=0,b=!1,w=0,v=s[S];if(v){for(let k=f;k<this._bufferService.cols;k++){const A=c.getWidth(k),O=c.getString(k).length||p.WHITESPACE_CELL_CHAR.length;if(A!==0){if(!b&&v[0]<=w&&(v[0]=k,b=!0),v[1]<=w){if(v[1]=k,v=s[++S],!v)break;v[0]<=w?(v[0]=k,b=!0):b=!1}w+=O}}v&&(v[1]=this._bufferService.cols)}}static _mergeRanges(s,c){let f=!1;for(let S=0;S<s.length;S++){const b=s[S];if(f){if(c[1]<=b[0])return s[S-1][1]=c[1],s;if(c[1]<=b[1])return s[S-1][1]=Math.max(c[1],b[1]),s.splice(S,1),s;s.splice(S,1),S--}else{if(c[1]<=b[0])return s.splice(S,0,c),s;if(c[1]<=b[1])return b[0]=Math.min(c[0],b[0]),s;c[0]<b[1]&&(b[0]=Math.min(c[0],b[0]),f=!0)}}return f?s[s.length-1][1]=c[1]:s.push(c),s}};n.CharacterJoinerService=o=u([d(0,y.IBufferService)],o)},5114:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CoreBrowserService=void 0;const u=a(844),d=a(8460),l=a(3656);class p extends u.Disposable{constructor(m,o,h){super(),this._textarea=m,this._window=o,this.mainDocument=h,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new g(this._window),this._onDprChange=this.register(new d.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new d.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this.register((0,d.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get window(){return this._window}set window(m){this._window!==m&&(this._window=m,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}}n.CoreBrowserService=p;class g extends u.Disposable{constructor(m){super(),this._parentWindow=m,this._windowResizeListener=this.register(new u.MutableDisposable),this._onDprChange=this.register(new d.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,u.toDisposable)(()=>this.clearListener()))}setWindow(m){this._parentWindow=m,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,l.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var m;this._outerListener&&((m=this._resolutionMediaMatchList)==null||m.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.LinkProviderService=void 0;const u=a(844);class d extends u.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,u.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(p){return this.linkProviders.push(p),{dispose:()=>{const g=this.linkProviders.indexOf(p);g!==-1&&this.linkProviders.splice(g,1)}}}}n.LinkProviderService=d},8934:function(E,n,a){var u=this&&this.__decorate||function(y,m,o,h){var s,c=arguments.length,f=c<3?m:h===null?h=Object.getOwnPropertyDescriptor(m,o):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(y,m,o,h);else for(var S=y.length-1;S>=0;S--)(s=y[S])&&(f=(c<3?s(f):c>3?s(m,o,f):s(m,o))||f);return c>3&&f&&Object.defineProperty(m,o,f),f},d=this&&this.__param||function(y,m){return function(o,h){m(o,h,y)}};Object.defineProperty(n,"__esModule",{value:!0}),n.MouseService=void 0;const l=a(4725),p=a(9806);let g=n.MouseService=class{constructor(y,m){this._renderService=y,this._charSizeService=m}getCoords(y,m,o,h,s){return(0,p.getCoords)(window,y,m,o,h,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(y,m){const o=(0,p.getCoordsRelativeToElement)(window,y,m);if(this._charSizeService.hasValidSize)return o[0]=Math.min(Math.max(o[0],0),this._renderService.dimensions.css.canvas.width-1),o[1]=Math.min(Math.max(o[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(o[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(o[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(o[0]),y:Math.floor(o[1])}}};n.MouseService=g=u([d(0,l.IRenderService),d(1,l.ICharSizeService)],g)},3230:function(E,n,a){var u=this&&this.__decorate||function(s,c,f,S){var b,w=arguments.length,v=w<3?c:S===null?S=Object.getOwnPropertyDescriptor(c,f):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(s,c,f,S);else for(var k=s.length-1;k>=0;k--)(b=s[k])&&(v=(w<3?b(v):w>3?b(c,f,v):b(c,f))||v);return w>3&&v&&Object.defineProperty(c,f,v),v},d=this&&this.__param||function(s,c){return function(f,S){c(f,S,s)}};Object.defineProperty(n,"__esModule",{value:!0}),n.RenderService=void 0;const l=a(6193),p=a(4725),g=a(8460),y=a(844),m=a(7226),o=a(2585);let h=n.RenderService=class extends y.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(s,c,f,S,b,w,v,k){super(),this._rowCount=s,this._charSizeService=S,this._renderer=this.register(new y.MutableDisposable),this._pausedResizeTask=new m.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 g.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new g.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new g.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new g.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new l.RenderDebouncer((A,O)=>this._renderRows(A,O),v),this.register(this._renderDebouncer),this.register(v.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(w.onResize(()=>this._fullRefresh())),this.register(w.buffers.onBufferActivate(()=>{var A;return(A=this._renderer.value)==null?void 0:A.clear()})),this.register(f.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(b.onDecorationRegistered(()=>this._fullRefresh())),this.register(b.onDecorationRemoved(()=>this._fullRefresh())),this.register(f.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(w.cols,w.rows),this._fullRefresh()})),this.register(f.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(w.buffer.y,w.buffer.y,!0))),this.register(k.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(v.window,c),this.register(v.onWindowChange(A=>this._registerIntersectionObserver(A,c)))}_registerIntersectionObserver(s,c){if("IntersectionObserver"in s){const f=new s.IntersectionObserver(S=>this._handleIntersectionChange(S[S.length-1]),{threshold:0});f.observe(c),this._observerDisposable.value=(0,y.toDisposable)(()=>f.disconnect())}}_handleIntersectionChange(s){this._isPaused=s.isIntersecting===void 0?s.intersectionRatio===0:!s.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(s,c,f=!1){this._isPaused?this._needsFullRefresh=!0:(f||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(s,c,this._rowCount))}_renderRows(s,c){this._renderer.value&&(s=Math.min(s,this._rowCount-1),c=Math.min(c,this._rowCount-1),this._renderer.value.renderRows(s,c),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:s,end:c}),this._onRender.fire({start:s,end:c}),this._isNextRenderRedrawOnly=!0)}resize(s,c){this._rowCount=c,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(s){this._renderer.value=s,this._renderer.value&&(this._renderer.value.onRequestRedraw(c=>this.refreshRows(c.start,c.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(s){return this._renderDebouncer.addRefreshCallback(s)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var s,c;this._renderer.value&&((c=(s=this._renderer.value).clearTextureAtlas)==null||c.call(s),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(s,c){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var f;return(f=this._renderer.value)==null?void 0:f.handleResize(s,c)}):this._renderer.value.handleResize(s,c),this._fullRefresh())}handleCharSizeChanged(){var s;(s=this._renderer.value)==null||s.handleCharSizeChanged()}handleBlur(){var s;(s=this._renderer.value)==null||s.handleBlur()}handleFocus(){var s;(s=this._renderer.value)==null||s.handleFocus()}handleSelectionChanged(s,c,f){var S;this._selectionState.start=s,this._selectionState.end=c,this._selectionState.columnSelectMode=f,(S=this._renderer.value)==null||S.handleSelectionChanged(s,c,f)}handleCursorMove(){var s;(s=this._renderer.value)==null||s.handleCursorMove()}clear(){var s;(s=this._renderer.value)==null||s.clear()}};n.RenderService=h=u([d(2,o.IOptionsService),d(3,p.ICharSizeService),d(4,o.IDecorationService),d(5,o.IBufferService),d(6,p.ICoreBrowserService),d(7,p.IThemeService)],h)},9312:function(E,n,a){var u=this&&this.__decorate||function(v,k,A,O){var I,L=arguments.length,$=L<3?k:O===null?O=Object.getOwnPropertyDescriptor(k,A):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")$=Reflect.decorate(v,k,A,O);else for(var F=v.length-1;F>=0;F--)(I=v[F])&&($=(L<3?I($):L>3?I(k,A,$):I(k,A))||$);return L>3&&$&&Object.defineProperty(k,A,$),$},d=this&&this.__param||function(v,k){return function(A,O){k(A,O,v)}};Object.defineProperty(n,"__esModule",{value:!0}),n.SelectionService=void 0;const l=a(9806),p=a(9504),g=a(456),y=a(4725),m=a(8460),o=a(844),h=a(6114),s=a(4841),c=a(511),f=a(2585),S=" ",b=new RegExp(S,"g");let w=n.SelectionService=class extends o.Disposable{constructor(v,k,A,O,I,L,$,F,W){super(),this._element=v,this._screenElement=k,this._linkifier=A,this._bufferService=O,this._coreService=I,this._mouseService=L,this._optionsService=$,this._renderService=F,this._coreBrowserService=W,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new c.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new m.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new m.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new m.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new m.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=V=>this._handleMouseMove(V),this._mouseUpListener=V=>this._handleMouseUp(V),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(V=>this._handleTrim(V)),this.register(this._bufferService.buffers.onBufferActivate(V=>this._handleBufferActivate(V))),this.enable(),this._model=new g.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,o.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 v=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;return!(!v||!k||v[0]===k[0]&&v[1]===k[1])}get selectionText(){const v=this._model.finalSelectionStart,k=this._model.finalSelectionEnd;if(!v||!k)return"";const A=this._bufferService.buffer,O=[];if(this._activeSelectionMode===3){if(v[0]===k[0])return"";const I=v[0]<k[0]?v[0]:k[0],L=v[0]<k[0]?k[0]:v[0];for(let $=v[1];$<=k[1];$++){const F=A.translateBufferLineToString($,!0,I,L);O.push(F)}}else{const I=v[1]===k[1]?k[0]:void 0;O.push(A.translateBufferLineToString(v[1],!0,v[0],I));for(let L=v[1]+1;L<=k[1]-1;L++){const $=A.lines.get(L),F=A.translateBufferLineToString(L,!0);$!=null&&$.isWrapped?O[O.length-1]+=F:O.push(F)}if(v[1]!==k[1]){const L=A.lines.get(k[1]),$=A.translateBufferLineToString(k[1],!0,0,k[0]);L&&L.isWrapped?O[O.length-1]+=$:O.push($)}}return O.map(I=>I.replace(b," ")).join(h.isWindows?`\r
6
+ `:`
7
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(v){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),h.isLinux&&v&&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(v){const k=this._getMouseBufferCoords(v),A=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!!(A&&O&&k)&&this._areCoordsInSelection(k,A,O)}isCellInSelection(v,k){const A=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!(!A||!O)&&this._areCoordsInSelection([v,k],A,O)}_areCoordsInSelection(v,k,A){return v[1]>k[1]&&v[1]<A[1]||k[1]===A[1]&&v[1]===k[1]&&v[0]>=k[0]&&v[0]<A[0]||k[1]<A[1]&&v[1]===A[1]&&v[0]<A[0]||k[1]<A[1]&&v[1]===k[1]&&v[0]>=k[0]}_selectWordAtCursor(v,k){var I,L;const A=(L=(I=this._linkifier.currentLink)==null?void 0:I.link)==null?void 0:L.range;if(A)return this._model.selectionStart=[A.start.x-1,A.start.y-1],this._model.selectionStartLength=(0,s.getRangeLength)(A,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const O=this._getMouseBufferCoords(v);return!!O&&(this._selectWordAt(O,k),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(v,k){this._model.clearSelection(),v=Math.max(v,0),k=Math.min(k,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,v],this._model.selectionEnd=[this._bufferService.cols,k],this.refresh(),this._onSelectionChange.fire()}_handleTrim(v){this._model.handleTrim(v)&&this.refresh()}_getMouseBufferCoords(v){const k=this._mouseService.getCoords(v,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(k)return k[0]--,k[1]--,k[1]+=this._bufferService.buffer.ydisp,k}_getMouseEventScrollAmount(v){let k=(0,l.getCoordsRelativeToElement)(this._coreBrowserService.window,v,this._screenElement)[1];const A=this._renderService.dimensions.css.canvas.height;return k>=0&&k<=A?0:(k>A&&(k-=A),k=Math.min(Math.max(k,-50),50),k/=50,k/Math.abs(k)+Math.round(14*k))}shouldForceSelection(v){return h.isMac?v.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:v.shiftKey}handleMouseDown(v){if(this._mouseDownTimeStamp=v.timeStamp,(v.button!==2||!this.hasSelection)&&v.button===0){if(!this._enabled){if(!this.shouldForceSelection(v))return;v.stopPropagation()}v.preventDefault(),this._dragScrollAmount=0,this._enabled&&v.shiftKey?this._handleIncrementalClick(v):v.detail===1?this._handleSingleClick(v):v.detail===2?this._handleDoubleClick(v):v.detail===3&&this._handleTripleClick(v),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(v){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(v))}_handleSingleClick(v){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(v)?3:0,this._model.selectionStart=this._getMouseBufferCoords(v),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const k=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);k&&k.length!==this._model.selectionStart[0]&&k.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(v){this._selectWordAtCursor(v,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(v){const k=this._getMouseBufferCoords(v);k&&(this._activeSelectionMode=2,this._selectLineAt(k[1]))}shouldColumnSelect(v){return v.altKey&&!(h.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(v){if(v.stopImmediatePropagation(),!this._model.selectionStart)return;const k=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(v),!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(v),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const A=this._bufferService.buffer;if(this._model.selectionEnd[1]<A.lines.length){const O=A.lines.get(this._model.selectionEnd[1]);O&&O.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}k&&k[0]===this._model.selectionEnd[0]&&k[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const v=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(v.ydisp+this._bufferService.rows,v.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=v.ydisp),this.refresh()}}_handleMouseUp(v){const k=v.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&k<500&&v.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const A=this._mouseService.getCoords(v,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(A&&A[0]!==void 0&&A[1]!==void 0){const O=(0,p.moveToCellSequence)(A[0]-1,A[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(O,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const v=this._model.finalSelectionStart,k=this._model.finalSelectionEnd,A=!(!v||!k||v[0]===k[0]&&v[1]===k[1]);A?v&&k&&(this._oldSelectionStart&&this._oldSelectionEnd&&v[0]===this._oldSelectionStart[0]&&v[1]===this._oldSelectionStart[1]&&k[0]===this._oldSelectionEnd[0]&&k[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(v,k,A)):this._oldHasSelection&&this._fireOnSelectionChange(v,k,A)}_fireOnSelectionChange(v,k,A){this._oldSelectionStart=v,this._oldSelectionEnd=k,this._oldHasSelection=A,this._onSelectionChange.fire()}_handleBufferActivate(v){this.clearSelection(),this._trimListener.dispose(),this._trimListener=v.activeBuffer.lines.onTrim(k=>this._handleTrim(k))}_convertViewportColToCharacterIndex(v,k){let A=k;for(let O=0;k>=O;O++){const I=v.loadCell(O,this._workCell).getChars().length;this._workCell.getWidth()===0?A--:I>1&&k!==O&&(A+=I-1)}return A}setSelection(v,k,A){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[v,k],this._model.selectionStartLength=A,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(v){this._isClickInSelection(v)||(this._selectWordAtCursor(v,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(v,k,A=!0,O=!0){if(v[0]>=this._bufferService.cols)return;const I=this._bufferService.buffer,L=I.lines.get(v[1]);if(!L)return;const $=I.translateBufferLineToString(v[1],!1);let F=this._convertViewportColToCharacterIndex(L,v[0]),W=F;const V=v[0]-F;let Z=0,x=0,R=0,T=0;if($.charAt(F)===" "){for(;F>0&&$.charAt(F-1)===" ";)F--;for(;W<$.length&&$.charAt(W+1)===" ";)W++}else{let U=v[0],J=v[0];L.getWidth(U)===0&&(Z++,U--),L.getWidth(J)===2&&(x++,J++);const X=L.getString(J).length;for(X>1&&(T+=X-1,W+=X-1);U>0&&F>0&&!this._isCharWordSeparator(L.loadCell(U-1,this._workCell));){L.loadCell(U-1,this._workCell);const P=this._workCell.getChars().length;this._workCell.getWidth()===0?(Z++,U--):P>1&&(R+=P-1,F-=P-1),F--,U--}for(;J<L.length&&W+1<$.length&&!this._isCharWordSeparator(L.loadCell(J+1,this._workCell));){L.loadCell(J+1,this._workCell);const P=this._workCell.getChars().length;this._workCell.getWidth()===2?(x++,J++):P>1&&(T+=P-1,W+=P-1),W++,J++}}W++;let B=F+V-Z+R,N=Math.min(this._bufferService.cols,W-F+Z+x-R-T);if(k||$.slice(F,W).trim()!==""){if(A&&B===0&&L.getCodePoint(0)!==32){const U=I.lines.get(v[1]-1);if(U&&L.isWrapped&&U.getCodePoint(this._bufferService.cols-1)!==32){const J=this._getWordAt([this._bufferService.cols-1,v[1]-1],!1,!0,!1);if(J){const X=this._bufferService.cols-J.start;B-=X,N+=X}}}if(O&&B+N===this._bufferService.cols&&L.getCodePoint(this._bufferService.cols-1)!==32){const U=I.lines.get(v[1]+1);if(U!=null&&U.isWrapped&&U.getCodePoint(0)!==32){const J=this._getWordAt([0,v[1]+1],!1,!1,!0);J&&(N+=J.length)}}return{start:B,length:N}}}_selectWordAt(v,k){const A=this._getWordAt(v,k);if(A){for(;A.start<0;)A.start+=this._bufferService.cols,v[1]--;this._model.selectionStart=[A.start,v[1]],this._model.selectionStartLength=A.length}}_selectToWordAt(v){const k=this._getWordAt(v,!0);if(k){let A=v[1];for(;k.start<0;)k.start+=this._bufferService.cols,A--;if(!this._model.areSelectionValuesReversed())for(;k.start+k.length>this._bufferService.cols;)k.length-=this._bufferService.cols,A++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?k.start:k.start+k.length,A]}}_isCharWordSeparator(v){return v.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(v.getChars())>=0}_selectLineAt(v){const k=this._bufferService.buffer.getWrappedRangeForLine(v),A={start:{x:0,y:k.first},end:{x:this._bufferService.cols-1,y:k.last}};this._model.selectionStart=[0,k.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,s.getRangeLength)(A,this._bufferService.cols)}};n.SelectionService=w=u([d(3,f.IBufferService),d(4,f.ICoreService),d(5,y.IMouseService),d(6,f.IOptionsService),d(7,y.IRenderService),d(8,y.ICoreBrowserService)],w)},4725:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ILinkProviderService=n.IThemeService=n.ICharacterJoinerService=n.ISelectionService=n.IRenderService=n.IMouseService=n.ICoreBrowserService=n.ICharSizeService=void 0;const u=a(8343);n.ICharSizeService=(0,u.createDecorator)("CharSizeService"),n.ICoreBrowserService=(0,u.createDecorator)("CoreBrowserService"),n.IMouseService=(0,u.createDecorator)("MouseService"),n.IRenderService=(0,u.createDecorator)("RenderService"),n.ISelectionService=(0,u.createDecorator)("SelectionService"),n.ICharacterJoinerService=(0,u.createDecorator)("CharacterJoinerService"),n.IThemeService=(0,u.createDecorator)("ThemeService"),n.ILinkProviderService=(0,u.createDecorator)("LinkProviderService")},6731:function(E,n,a){var u=this&&this.__decorate||function(w,v,k,A){var O,I=arguments.length,L=I<3?v:A===null?A=Object.getOwnPropertyDescriptor(v,k):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(w,v,k,A);else for(var $=w.length-1;$>=0;$--)(O=w[$])&&(L=(I<3?O(L):I>3?O(v,k,L):O(v,k))||L);return I>3&&L&&Object.defineProperty(v,k,L),L},d=this&&this.__param||function(w,v){return function(k,A){v(k,A,w)}};Object.defineProperty(n,"__esModule",{value:!0}),n.ThemeService=n.DEFAULT_ANSI_COLORS=void 0;const l=a(7239),p=a(8055),g=a(8460),y=a(844),m=a(2585),o=p.css.toColor("#ffffff"),h=p.css.toColor("#000000"),s=p.css.toColor("#ffffff"),c=p.css.toColor("#000000"),f={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};n.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const w=[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")],v=[0,95,135,175,215,255];for(let k=0;k<216;k++){const A=v[k/36%6|0],O=v[k/6%6|0],I=v[k%6];w.push({css:p.channels.toCss(A,O,I),rgba:p.channels.toRgba(A,O,I)})}for(let k=0;k<24;k++){const A=8+10*k;w.push({css:p.channels.toCss(A,A,A),rgba:p.channels.toRgba(A,A,A)})}return w})());let S=n.ThemeService=class extends y.Disposable{get colors(){return this._colors}constructor(w){super(),this._optionsService=w,this._contrastCache=new l.ColorContrastCache,this._halfContrastCache=new l.ColorContrastCache,this._onChangeColors=this.register(new g.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:o,background:h,cursor:s,cursorAccent:c,selectionForeground:void 0,selectionBackgroundTransparent:f,selectionBackgroundOpaque:p.color.blend(h,f),selectionInactiveBackgroundTransparent:f,selectionInactiveBackgroundOpaque:p.color.blend(h,f),ansi:n.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(w={}){const v=this._colors;if(v.foreground=b(w.foreground,o),v.background=b(w.background,h),v.cursor=b(w.cursor,s),v.cursorAccent=b(w.cursorAccent,c),v.selectionBackgroundTransparent=b(w.selectionBackground,f),v.selectionBackgroundOpaque=p.color.blend(v.background,v.selectionBackgroundTransparent),v.selectionInactiveBackgroundTransparent=b(w.selectionInactiveBackground,v.selectionBackgroundTransparent),v.selectionInactiveBackgroundOpaque=p.color.blend(v.background,v.selectionInactiveBackgroundTransparent),v.selectionForeground=w.selectionForeground?b(w.selectionForeground,p.NULL_COLOR):void 0,v.selectionForeground===p.NULL_COLOR&&(v.selectionForeground=void 0),p.color.isOpaque(v.selectionBackgroundTransparent)&&(v.selectionBackgroundTransparent=p.color.opacity(v.selectionBackgroundTransparent,.3)),p.color.isOpaque(v.selectionInactiveBackgroundTransparent)&&(v.selectionInactiveBackgroundTransparent=p.color.opacity(v.selectionInactiveBackgroundTransparent,.3)),v.ansi=n.DEFAULT_ANSI_COLORS.slice(),v.ansi[0]=b(w.black,n.DEFAULT_ANSI_COLORS[0]),v.ansi[1]=b(w.red,n.DEFAULT_ANSI_COLORS[1]),v.ansi[2]=b(w.green,n.DEFAULT_ANSI_COLORS[2]),v.ansi[3]=b(w.yellow,n.DEFAULT_ANSI_COLORS[3]),v.ansi[4]=b(w.blue,n.DEFAULT_ANSI_COLORS[4]),v.ansi[5]=b(w.magenta,n.DEFAULT_ANSI_COLORS[5]),v.ansi[6]=b(w.cyan,n.DEFAULT_ANSI_COLORS[6]),v.ansi[7]=b(w.white,n.DEFAULT_ANSI_COLORS[7]),v.ansi[8]=b(w.brightBlack,n.DEFAULT_ANSI_COLORS[8]),v.ansi[9]=b(w.brightRed,n.DEFAULT_ANSI_COLORS[9]),v.ansi[10]=b(w.brightGreen,n.DEFAULT_ANSI_COLORS[10]),v.ansi[11]=b(w.brightYellow,n.DEFAULT_ANSI_COLORS[11]),v.ansi[12]=b(w.brightBlue,n.DEFAULT_ANSI_COLORS[12]),v.ansi[13]=b(w.brightMagenta,n.DEFAULT_ANSI_COLORS[13]),v.ansi[14]=b(w.brightCyan,n.DEFAULT_ANSI_COLORS[14]),v.ansi[15]=b(w.brightWhite,n.DEFAULT_ANSI_COLORS[15]),w.extendedAnsi){const k=Math.min(v.ansi.length-16,w.extendedAnsi.length);for(let A=0;A<k;A++)v.ansi[A+16]=b(w.extendedAnsi[A],n.DEFAULT_ANSI_COLORS[A+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(w){this._restoreColor(w),this._onChangeColors.fire(this.colors)}_restoreColor(w){if(w!==void 0)switch(w){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[w]=this._restoreColors.ansi[w]}else for(let v=0;v<this._restoreColors.ansi.length;++v)this._colors.ansi[v]=this._restoreColors.ansi[v]}modifyColors(w){w(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function b(w,v){if(w!==void 0)try{return p.css.toColor(w)}catch{}return v}n.ThemeService=S=u([d(0,m.IOptionsService)],S)},6349:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CircularList=void 0;const u=a(8460),d=a(844);class l extends d.Disposable{constructor(g){super(),this._maxLength=g,this.onDeleteEmitter=this.register(new u.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new u.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new u.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(g){if(this._maxLength===g)return;const y=new Array(g);for(let m=0;m<Math.min(g,this.length);m++)y[m]=this._array[this._getCyclicIndex(m)];this._array=y,this._maxLength=g,this._startIndex=0}get length(){return this._length}set length(g){if(g>this._length)for(let y=this._length;y<g;y++)this._array[y]=void 0;this._length=g}get(g){return this._array[this._getCyclicIndex(g)]}set(g,y){this._array[this._getCyclicIndex(g)]=y}push(g){this._array[this._getCyclicIndex(this._length)]=g,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(g,y,...m){if(y){for(let o=g;o<this._length-y;o++)this._array[this._getCyclicIndex(o)]=this._array[this._getCyclicIndex(o+y)];this._length-=y,this.onDeleteEmitter.fire({index:g,amount:y})}for(let o=this._length-1;o>=g;o--)this._array[this._getCyclicIndex(o+m.length)]=this._array[this._getCyclicIndex(o)];for(let o=0;o<m.length;o++)this._array[this._getCyclicIndex(g+o)]=m[o];if(m.length&&this.onInsertEmitter.fire({index:g,amount:m.length}),this._length+m.length>this._maxLength){const o=this._length+m.length-this._maxLength;this._startIndex+=o,this._length=this._maxLength,this.onTrimEmitter.fire(o)}else this._length+=m.length}trimStart(g){g>this._length&&(g=this._length),this._startIndex+=g,this._length-=g,this.onTrimEmitter.fire(g)}shiftElements(g,y,m){if(!(y<=0)){if(g<0||g>=this._length)throw new Error("start argument out of range");if(g+m<0)throw new Error("Cannot shift elements in list beyond index 0");if(m>0){for(let h=y-1;h>=0;h--)this.set(g+h+m,this.get(g+h));const o=g+y+m-this._length;if(o>0)for(this._length+=o;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let o=0;o<y;o++)this.set(g+o+m,this.get(g+o))}}_getCyclicIndex(g){return(this._startIndex+g)%this._maxLength}}n.CircularList=l},1439:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.clone=void 0,n.clone=function a(u,d=5){if(typeof u!="object")return u;const l=Array.isArray(u)?[]:{};for(const p in u)l[p]=d<=1?u[p]:u[p]&&a(u[p],d-1);return l}},8055:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.contrastRatio=n.toPaddedHex=n.rgba=n.rgb=n.css=n.color=n.channels=n.NULL_COLOR=void 0;let a=0,u=0,d=0,l=0;var p,g,y,m,o;function h(c){const f=c.toString(16);return f.length<2?"0"+f:f}function s(c,f){return c<f?(f+.05)/(c+.05):(c+.05)/(f+.05)}n.NULL_COLOR={css:"#00000000",rgba:0},function(c){c.toCss=function(f,S,b,w){return w!==void 0?`#${h(f)}${h(S)}${h(b)}${h(w)}`:`#${h(f)}${h(S)}${h(b)}`},c.toRgba=function(f,S,b,w=255){return(f<<24|S<<16|b<<8|w)>>>0},c.toColor=function(f,S,b,w){return{css:c.toCss(f,S,b,w),rgba:c.toRgba(f,S,b,w)}}}(p||(n.channels=p={})),function(c){function f(S,b){return l=Math.round(255*b),[a,u,d]=o.toChannels(S.rgba),{css:p.toCss(a,u,d,l),rgba:p.toRgba(a,u,d,l)}}c.blend=function(S,b){if(l=(255&b.rgba)/255,l===1)return{css:b.css,rgba:b.rgba};const w=b.rgba>>24&255,v=b.rgba>>16&255,k=b.rgba>>8&255,A=S.rgba>>24&255,O=S.rgba>>16&255,I=S.rgba>>8&255;return a=A+Math.round((w-A)*l),u=O+Math.round((v-O)*l),d=I+Math.round((k-I)*l),{css:p.toCss(a,u,d),rgba:p.toRgba(a,u,d)}},c.isOpaque=function(S){return(255&S.rgba)==255},c.ensureContrastRatio=function(S,b,w){const v=o.ensureContrastRatio(S.rgba,b.rgba,w);if(v)return p.toColor(v>>24&255,v>>16&255,v>>8&255)},c.opaque=function(S){const b=(255|S.rgba)>>>0;return[a,u,d]=o.toChannels(b),{css:p.toCss(a,u,d),rgba:b}},c.opacity=f,c.multiplyOpacity=function(S,b){return l=255&S.rgba,f(S,l*b/255)},c.toColorRGB=function(S){return[S.rgba>>24&255,S.rgba>>16&255,S.rgba>>8&255]}}(g||(n.color=g={})),function(c){let f,S;try{const b=document.createElement("canvas");b.width=1,b.height=1;const w=b.getContext("2d",{willReadFrequently:!0});w&&(f=w,f.globalCompositeOperation="copy",S=f.createLinearGradient(0,0,1,1))}catch{}c.toColor=function(b){if(b.match(/#[\da-f]{3,8}/i))switch(b.length){case 4:return a=parseInt(b.slice(1,2).repeat(2),16),u=parseInt(b.slice(2,3).repeat(2),16),d=parseInt(b.slice(3,4).repeat(2),16),p.toColor(a,u,d);case 5:return a=parseInt(b.slice(1,2).repeat(2),16),u=parseInt(b.slice(2,3).repeat(2),16),d=parseInt(b.slice(3,4).repeat(2),16),l=parseInt(b.slice(4,5).repeat(2),16),p.toColor(a,u,d,l);case 7:return{css:b,rgba:(parseInt(b.slice(1),16)<<8|255)>>>0};case 9:return{css:b,rgba:parseInt(b.slice(1),16)>>>0}}const w=b.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(w)return a=parseInt(w[1]),u=parseInt(w[2]),d=parseInt(w[3]),l=Math.round(255*(w[5]===void 0?1:parseFloat(w[5]))),p.toColor(a,u,d,l);if(!f||!S)throw new Error("css.toColor: Unsupported css format");if(f.fillStyle=S,f.fillStyle=b,typeof f.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(f.fillRect(0,0,1,1),[a,u,d,l]=f.getImageData(0,0,1,1).data,l!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:p.toRgba(a,u,d,l),css:b}}}(y||(n.css=y={})),function(c){function f(S,b,w){const v=S/255,k=b/255,A=w/255;return .2126*(v<=.03928?v/12.92:Math.pow((v+.055)/1.055,2.4))+.7152*(k<=.03928?k/12.92:Math.pow((k+.055)/1.055,2.4))+.0722*(A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4))}c.relativeLuminance=function(S){return f(S>>16&255,S>>8&255,255&S)},c.relativeLuminance2=f}(m||(n.rgb=m={})),function(c){function f(b,w,v){const k=b>>24&255,A=b>>16&255,O=b>>8&255;let I=w>>24&255,L=w>>16&255,$=w>>8&255,F=s(m.relativeLuminance2(I,L,$),m.relativeLuminance2(k,A,O));for(;F<v&&(I>0||L>0||$>0);)I-=Math.max(0,Math.ceil(.1*I)),L-=Math.max(0,Math.ceil(.1*L)),$-=Math.max(0,Math.ceil(.1*$)),F=s(m.relativeLuminance2(I,L,$),m.relativeLuminance2(k,A,O));return(I<<24|L<<16|$<<8|255)>>>0}function S(b,w,v){const k=b>>24&255,A=b>>16&255,O=b>>8&255;let I=w>>24&255,L=w>>16&255,$=w>>8&255,F=s(m.relativeLuminance2(I,L,$),m.relativeLuminance2(k,A,O));for(;F<v&&(I<255||L<255||$<255);)I=Math.min(255,I+Math.ceil(.1*(255-I))),L=Math.min(255,L+Math.ceil(.1*(255-L))),$=Math.min(255,$+Math.ceil(.1*(255-$))),F=s(m.relativeLuminance2(I,L,$),m.relativeLuminance2(k,A,O));return(I<<24|L<<16|$<<8|255)>>>0}c.blend=function(b,w){if(l=(255&w)/255,l===1)return w;const v=w>>24&255,k=w>>16&255,A=w>>8&255,O=b>>24&255,I=b>>16&255,L=b>>8&255;return a=O+Math.round((v-O)*l),u=I+Math.round((k-I)*l),d=L+Math.round((A-L)*l),p.toRgba(a,u,d)},c.ensureContrastRatio=function(b,w,v){const k=m.relativeLuminance(b>>8),A=m.relativeLuminance(w>>8);if(s(k,A)<v){if(A<k){const L=f(b,w,v),$=s(k,m.relativeLuminance(L>>8));if($<v){const F=S(b,w,v);return $>s(k,m.relativeLuminance(F>>8))?L:F}return L}const O=S(b,w,v),I=s(k,m.relativeLuminance(O>>8));if(I<v){const L=f(b,w,v);return I>s(k,m.relativeLuminance(L>>8))?O:L}return O}},c.reduceLuminance=f,c.increaseLuminance=S,c.toChannels=function(b){return[b>>24&255,b>>16&255,b>>8&255,255&b]}}(o||(n.rgba=o={})),n.toPaddedHex=h,n.contrastRatio=s},8969:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CoreTerminal=void 0;const u=a(844),d=a(2585),l=a(4348),p=a(7866),g=a(744),y=a(7302),m=a(6975),o=a(8460),h=a(1753),s=a(1480),c=a(7994),f=a(9282),S=a(5435),b=a(5981),w=a(2660);let v=!1;class k extends u.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new o.EventEmitter),this._onScroll.event(O=>{var I;(I=this._onScrollApi)==null||I.fire(O.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(O){for(const I in O)this.optionsService.options[I]=O[I]}constructor(O){super(),this._windowsWrappingHeuristics=this.register(new u.MutableDisposable),this._onBinary=this.register(new o.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new o.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new o.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new o.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new o.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new o.EventEmitter),this._instantiationService=new l.InstantiationService,this.optionsService=this.register(new y.OptionsService(O)),this._instantiationService.setService(d.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(g.BufferService)),this._instantiationService.setService(d.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(p.LogService)),this._instantiationService.setService(d.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(m.CoreService)),this._instantiationService.setService(d.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(h.CoreMouseService)),this._instantiationService.setService(d.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(s.UnicodeService)),this._instantiationService.setService(d.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(c.CharsetService),this._instantiationService.setService(d.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(w.OscLinkService),this._instantiationService.setService(d.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new S.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,o.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,o.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,o.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,o.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(I=>{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(I=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this.register(new b.WriteBuffer((I,L)=>this._inputHandler.parse(I,L))),this.register((0,o.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(O,I){this._writeBuffer.write(O,I)}writeSync(O,I){this._logService.logLevel<=d.LogLevelEnum.WARN&&!v&&(this._logService.warn("writeSync is unreliable and will be removed soon."),v=!0),this._writeBuffer.writeSync(O,I)}input(O,I=!0){this.coreService.triggerDataEvent(O,I)}resize(O,I){isNaN(O)||isNaN(I)||(O=Math.max(O,g.MINIMUM_COLS),I=Math.max(I,g.MINIMUM_ROWS),this._bufferService.resize(O,I))}scroll(O,I=!1){this._bufferService.scroll(O,I)}scrollLines(O,I,L){this._bufferService.scrollLines(O,I,L)}scrollPages(O){this.scrollLines(O*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(O){const I=O-this._bufferService.buffer.ydisp;I!==0&&this.scrollLines(I)}registerEscHandler(O,I){return this._inputHandler.registerEscHandler(O,I)}registerDcsHandler(O,I){return this._inputHandler.registerDcsHandler(O,I)}registerCsiHandler(O,I){return this._inputHandler.registerCsiHandler(O,I)}registerOscHandler(O,I){return this._inputHandler.registerOscHandler(O,I)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let O=!1;const I=this.optionsService.rawOptions.windowsPty;I&&I.buildNumber!==void 0&&I.buildNumber!==void 0?O=I.backend==="conpty"&&I.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(O=!0),O?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const O=[];O.push(this.onLineFeed(f.updateWindowsModeWrappedState.bind(null,this._bufferService))),O.push(this.registerCsiHandler({final:"H"},()=>((0,f.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,u.toDisposable)(()=>{for(const I of O)I.dispose()})}}}n.CoreTerminal=k},8460:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.runAndSubscribe=n.forwardEvent=n.EventEmitter=void 0,n.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let u=0;u<this._listeners.length;u++)if(this._listeners[u]===a)return void this._listeners.splice(u,1)}}})),this._event}fire(a,u){const d=[];for(let l=0;l<this._listeners.length;l++)d.push(this._listeners[l]);for(let l=0;l<d.length;l++)d[l].call(void 0,a,u)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},n.forwardEvent=function(a,u){return a(d=>u.fire(d))},n.runAndSubscribe=function(a,u){return u(void 0),a(d=>u(d))}},5435:function(E,n,a){var u=this&&this.__decorate||function(Z,x,R,T){var B,N=arguments.length,U=N<3?x:T===null?T=Object.getOwnPropertyDescriptor(x,R):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(Z,x,R,T);else for(var J=Z.length-1;J>=0;J--)(B=Z[J])&&(U=(N<3?B(U):N>3?B(x,R,U):B(x,R))||U);return N>3&&U&&Object.defineProperty(x,R,U),U},d=this&&this.__param||function(Z,x){return function(R,T){x(R,T,Z)}};Object.defineProperty(n,"__esModule",{value:!0}),n.InputHandler=n.WindowsOptionsReportType=void 0;const l=a(2584),p=a(7116),g=a(2015),y=a(844),m=a(482),o=a(8437),h=a(8460),s=a(643),c=a(511),f=a(3734),S=a(2585),b=a(1480),w=a(6242),v=a(6351),k=a(5941),A={"(":0,")":1,"*":2,"+":3,"-":1,".":2},O=131072;function I(Z,x){if(Z>24)return x.setWinLines||!1;switch(Z){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 L;(function(Z){Z[Z.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",Z[Z.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(L||(n.WindowsOptionsReportType=L={}));let $=0;class F extends y.Disposable{getAttrData(){return this._curAttrData}constructor(x,R,T,B,N,U,J,X,P=new g.EscapeSequenceParser){super(),this._bufferService=x,this._charsetService=R,this._coreService=T,this._logService=B,this._optionsService=N,this._oscLinkService=U,this._coreMouseService=J,this._unicodeService=X,this._parser=P,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new m.StringToUtf32,this._utf8Decoder=new m.Utf8ToUtf32,this._workCell=new c.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=o.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=o.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new h.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new h.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new h.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new h.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new h.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new h.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new h.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new h.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new h.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new h.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new h.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new h.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new h.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 W(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(D=>this._activeBuffer=D.activeBuffer)),this._parser.setCsiHandlerFallback((D,j)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(D),params:j.toArray()})}),this._parser.setEscHandlerFallback(D=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(D)})}),this._parser.setExecuteHandlerFallback(D=>{this._logService.debug("Unknown EXECUTE code: ",{code:D})}),this._parser.setOscHandlerFallback((D,j,H)=>{this._logService.debug("Unknown OSC code: ",{identifier:D,action:j,data:H})}),this._parser.setDcsHandlerFallback((D,j,H)=>{j==="HOOK"&&(H=H.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(D),action:j,payload:H})}),this._parser.setPrintHandler((D,j,H)=>this.print(D,j,H)),this._parser.registerCsiHandler({final:"@"},D=>this.insertChars(D)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},D=>this.scrollLeft(D)),this._parser.registerCsiHandler({final:"A"},D=>this.cursorUp(D)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},D=>this.scrollRight(D)),this._parser.registerCsiHandler({final:"B"},D=>this.cursorDown(D)),this._parser.registerCsiHandler({final:"C"},D=>this.cursorForward(D)),this._parser.registerCsiHandler({final:"D"},D=>this.cursorBackward(D)),this._parser.registerCsiHandler({final:"E"},D=>this.cursorNextLine(D)),this._parser.registerCsiHandler({final:"F"},D=>this.cursorPrecedingLine(D)),this._parser.registerCsiHandler({final:"G"},D=>this.cursorCharAbsolute(D)),this._parser.registerCsiHandler({final:"H"},D=>this.cursorPosition(D)),this._parser.registerCsiHandler({final:"I"},D=>this.cursorForwardTab(D)),this._parser.registerCsiHandler({final:"J"},D=>this.eraseInDisplay(D,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},D=>this.eraseInDisplay(D,!0)),this._parser.registerCsiHandler({final:"K"},D=>this.eraseInLine(D,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},D=>this.eraseInLine(D,!0)),this._parser.registerCsiHandler({final:"L"},D=>this.insertLines(D)),this._parser.registerCsiHandler({final:"M"},D=>this.deleteLines(D)),this._parser.registerCsiHandler({final:"P"},D=>this.deleteChars(D)),this._parser.registerCsiHandler({final:"S"},D=>this.scrollUp(D)),this._parser.registerCsiHandler({final:"T"},D=>this.scrollDown(D)),this._parser.registerCsiHandler({final:"X"},D=>this.eraseChars(D)),this._parser.registerCsiHandler({final:"Z"},D=>this.cursorBackwardTab(D)),this._parser.registerCsiHandler({final:"`"},D=>this.charPosAbsolute(D)),this._parser.registerCsiHandler({final:"a"},D=>this.hPositionRelative(D)),this._parser.registerCsiHandler({final:"b"},D=>this.repeatPrecedingCharacter(D)),this._parser.registerCsiHandler({final:"c"},D=>this.sendDeviceAttributesPrimary(D)),this._parser.registerCsiHandler({prefix:">",final:"c"},D=>this.sendDeviceAttributesSecondary(D)),this._parser.registerCsiHandler({final:"d"},D=>this.linePosAbsolute(D)),this._parser.registerCsiHandler({final:"e"},D=>this.vPositionRelative(D)),this._parser.registerCsiHandler({final:"f"},D=>this.hVPosition(D)),this._parser.registerCsiHandler({final:"g"},D=>this.tabClear(D)),this._parser.registerCsiHandler({final:"h"},D=>this.setMode(D)),this._parser.registerCsiHandler({prefix:"?",final:"h"},D=>this.setModePrivate(D)),this._parser.registerCsiHandler({final:"l"},D=>this.resetMode(D)),this._parser.registerCsiHandler({prefix:"?",final:"l"},D=>this.resetModePrivate(D)),this._parser.registerCsiHandler({final:"m"},D=>this.charAttributes(D)),this._parser.registerCsiHandler({final:"n"},D=>this.deviceStatus(D)),this._parser.registerCsiHandler({prefix:"?",final:"n"},D=>this.deviceStatusPrivate(D)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},D=>this.softReset(D)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},D=>this.setCursorStyle(D)),this._parser.registerCsiHandler({final:"r"},D=>this.setScrollRegion(D)),this._parser.registerCsiHandler({final:"s"},D=>this.saveCursor(D)),this._parser.registerCsiHandler({final:"t"},D=>this.windowOptions(D)),this._parser.registerCsiHandler({final:"u"},D=>this.restoreCursor(D)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},D=>this.insertColumns(D)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},D=>this.deleteColumns(D)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},D=>this.selectProtected(D)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},D=>this.requestMode(D,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},D=>this.requestMode(D,!1)),this._parser.setExecuteHandler(l.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(l.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(l.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(l.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(l.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(l.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(l.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(l.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(l.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(l.C1.IND,()=>this.index()),this._parser.setExecuteHandler(l.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(l.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new w.OscHandler(D=>(this.setTitle(D),this.setIconName(D),!0))),this._parser.registerOscHandler(1,new w.OscHandler(D=>this.setIconName(D))),this._parser.registerOscHandler(2,new w.OscHandler(D=>this.setTitle(D))),this._parser.registerOscHandler(4,new w.OscHandler(D=>this.setOrReportIndexedColor(D))),this._parser.registerOscHandler(8,new w.OscHandler(D=>this.setHyperlink(D))),this._parser.registerOscHandler(10,new w.OscHandler(D=>this.setOrReportFgColor(D))),this._parser.registerOscHandler(11,new w.OscHandler(D=>this.setOrReportBgColor(D))),this._parser.registerOscHandler(12,new w.OscHandler(D=>this.setOrReportCursorColor(D))),this._parser.registerOscHandler(104,new w.OscHandler(D=>this.restoreIndexedColor(D))),this._parser.registerOscHandler(110,new w.OscHandler(D=>this.restoreFgColor(D))),this._parser.registerOscHandler(111,new w.OscHandler(D=>this.restoreBgColor(D))),this._parser.registerOscHandler(112,new w.OscHandler(D=>this.restoreCursorColor(D))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(const D in p.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:D},()=>this.selectCharset("("+D)),this._parser.registerEscHandler({intermediates:")",final:D},()=>this.selectCharset(")"+D)),this._parser.registerEscHandler({intermediates:"*",final:D},()=>this.selectCharset("*"+D)),this._parser.registerEscHandler({intermediates:"+",final:D},()=>this.selectCharset("+"+D)),this._parser.registerEscHandler({intermediates:"-",final:D},()=>this.selectCharset("-"+D)),this._parser.registerEscHandler({intermediates:".",final:D},()=>this.selectCharset("."+D)),this._parser.registerEscHandler({intermediates:"/",final:D},()=>this.selectCharset("/"+D));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(D=>(this._logService.error("Parsing error: ",D),D)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new v.DcsHandler((D,j)=>this.requestStatusString(D,j)))}_preserveStack(x,R,T,B){this._parseStack.paused=!0,this._parseStack.cursorStartX=x,this._parseStack.cursorStartY=R,this._parseStack.decodedLength=T,this._parseStack.position=B}_logSlowResolvingAsync(x){this._logService.logLevel<=S.LogLevelEnum.WARN&&Promise.race([x,new Promise((R,T)=>setTimeout(()=>T("#SLOW_TIMEOUT"),5e3))]).catch(R=>{if(R!=="#SLOW_TIMEOUT")throw R;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(x,R){let T,B=this._activeBuffer.x,N=this._activeBuffer.y,U=0;const J=this._parseStack.paused;if(J){if(T=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,R))return this._logSlowResolvingAsync(T),T;B=this._parseStack.cursorStartX,N=this._parseStack.cursorStartY,this._parseStack.paused=!1,x.length>O&&(U=this._parseStack.position+O)}if(this._logService.logLevel<=S.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof x=="string"?` "${x}"`:` "${Array.prototype.map.call(x,D=>String.fromCharCode(D)).join("")}"`),typeof x=="string"?x.split("").map(D=>D.charCodeAt(0)):x),this._parseBuffer.length<x.length&&this._parseBuffer.length<O&&(this._parseBuffer=new Uint32Array(Math.min(x.length,O))),J||this._dirtyRowTracker.clearRange(),x.length>O)for(let D=U;D<x.length;D+=O){const j=D+O<x.length?D+O:x.length,H=typeof x=="string"?this._stringDecoder.decode(x.substring(D,j),this._parseBuffer):this._utf8Decoder.decode(x.subarray(D,j),this._parseBuffer);if(T=this._parser.parse(this._parseBuffer,H))return this._preserveStack(B,N,H,D),this._logSlowResolvingAsync(T),T}else if(!J){const D=typeof x=="string"?this._stringDecoder.decode(x,this._parseBuffer):this._utf8Decoder.decode(x,this._parseBuffer);if(T=this._parser.parse(this._parseBuffer,D))return this._preserveStack(B,N,D,0),this._logSlowResolvingAsync(T),T}this._activeBuffer.x===B&&this._activeBuffer.y===N||this._onCursorMove.fire();const X=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),P=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);P<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(P,this._bufferService.rows-1),Math.min(X,this._bufferService.rows-1))}print(x,R,T){let B,N;const U=this._charsetService.charset,J=this._optionsService.rawOptions.screenReaderMode,X=this._bufferService.cols,P=this._coreService.decPrivateModes.wraparound,D=this._coreService.modes.insertMode,j=this._curAttrData;let H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&T-R>0&&H.getWidth(this._activeBuffer.x-1)===2&&H.setCellFromCodepoint(this._activeBuffer.x-1,0,1,j);let q=this._parser.precedingJoinState;for(let K=R;K<T;++K){if(B=x[K],B<127&&U){const ae=U[String.fromCharCode(B)];ae&&(B=ae.charCodeAt(0))}const ee=this._unicodeService.charProperties(B,q);N=b.UnicodeService.extractWidth(ee);const ie=b.UnicodeService.extractShouldJoin(ee),se=ie?b.UnicodeService.extractWidth(q):0;if(q=ee,J&&this._onA11yChar.fire((0,m.stringFromCodePoint)(B)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+N-se>X){if(P){const ae=H;let Y=this._activeBuffer.x-se;for(this._activeBuffer.x=se,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),se>0&&H instanceof o.BufferLine&&H.copyCellsFrom(ae,Y,0,se,!1);Y<X;)ae.setCellFromCodepoint(Y++,0,1,j)}else if(this._activeBuffer.x=X-1,N===2)continue}if(ie&&this._activeBuffer.x){const ae=H.getWidth(this._activeBuffer.x-1)?1:2;H.addCodepointToCell(this._activeBuffer.x-ae,B,N);for(let Y=N-se;--Y>=0;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,j)}else if(D&&(H.insertCells(this._activeBuffer.x,N-se,this._activeBuffer.getNullCell(j)),H.getWidth(X-1)===2&&H.setCellFromCodepoint(X-1,s.NULL_CELL_CODE,s.NULL_CELL_WIDTH,j)),H.setCellFromCodepoint(this._activeBuffer.x++,B,N,j),N>0)for(;--N;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,j)}this._parser.precedingJoinState=q,this._activeBuffer.x<X&&T-R>0&&H.getWidth(this._activeBuffer.x)===0&&!H.hasContent(this._activeBuffer.x)&&H.setCellFromCodepoint(this._activeBuffer.x,0,1,j),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(x,R){return x.final!=="t"||x.prefix||x.intermediates?this._parser.registerCsiHandler(x,R):this._parser.registerCsiHandler(x,T=>!I(T.params[0],this._optionsService.rawOptions.windowOptions)||R(T))}registerDcsHandler(x,R){return this._parser.registerDcsHandler(x,new v.DcsHandler(R))}registerEscHandler(x,R){return this._parser.registerEscHandler(x,R)}registerOscHandler(x,R){return this._parser.registerOscHandler(x,new w.OscHandler(R))}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 R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);R.hasWidth(this._activeBuffer.x)&&!R.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,R){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=x,this._activeBuffer.y=this._activeBuffer.scrollTop+R):(this._activeBuffer.x=x,this._activeBuffer.y=R),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(x,R){this._restrictCursor(),this._setCursor(this._activeBuffer.x+x,this._activeBuffer.y+R)}cursorUp(x){const R=this._activeBuffer.y-this._activeBuffer.scrollTop;return R>=0?this._moveCursor(0,-Math.min(R,x.params[0]||1)):this._moveCursor(0,-(x.params[0]||1)),!0}cursorDown(x){const R=this._activeBuffer.scrollBottom-this._activeBuffer.y;return R>=0?this._moveCursor(0,Math.min(R,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 R=x.params[0];return R===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:R===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(x){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let R=x.params[0]||1;for(;R--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(x){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let R=x.params[0]||1;for(;R--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(x){const R=x.params[0];return R===1&&(this._curAttrData.bg|=536870912),R!==2&&R!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(x,R,T,B=!1,N=!1){const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+x);U.replaceCells(R,T,this._activeBuffer.getNullCell(this._eraseAttrData()),N),B&&(U.isWrapped=!1)}_resetBufferLine(x,R=!1){const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+x);T&&(T.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),R),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+x),T.isWrapped=!1)}eraseInDisplay(x,R=!1){let T;switch(this._restrictCursor(this._bufferService.cols),x.params[0]){case 0:for(T=this._activeBuffer.y,this._dirtyRowTracker.markDirty(T),this._eraseInBufferLine(T++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,R);T<this._bufferService.rows;T++)this._resetBufferLine(T,R);this._dirtyRowTracker.markDirty(T);break;case 1:for(T=this._activeBuffer.y,this._dirtyRowTracker.markDirty(T),this._eraseInBufferLine(T,0,this._activeBuffer.x+1,!0,R),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(T+1).isWrapped=!1);T--;)this._resetBufferLine(T,R);this._dirtyRowTracker.markDirty(0);break;case 2:for(T=this._bufferService.rows,this._dirtyRowTracker.markDirty(T-1);T--;)this._resetBufferLine(T,R);this._dirtyRowTracker.markDirty(0);break;case 3:const B=this._activeBuffer.lines.length-this._bufferService.rows;B>0&&(this._activeBuffer.lines.trimStart(B),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-B,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-B,0),this._onScroll.fire(0))}return!0}eraseInLine(x,R=!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,R);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,R);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,R)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(x){this._restrictCursor();let R=x.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const T=this._activeBuffer.ybase+this._activeBuffer.y,B=this._bufferService.rows-1-this._activeBuffer.scrollBottom,N=this._bufferService.rows-1+this._activeBuffer.ybase-B+1;for(;R--;)this._activeBuffer.lines.splice(N-1,1),this._activeBuffer.lines.splice(T,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(x){this._restrictCursor();let R=x.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const T=this._activeBuffer.ybase+this._activeBuffer.y;let B;for(B=this._bufferService.rows-1-this._activeBuffer.scrollBottom,B=this._bufferService.rows-1+this._activeBuffer.ybase-B;R--;)this._activeBuffer.lines.splice(T,1),this._activeBuffer.lines.splice(B,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(x){this._restrictCursor();const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.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 R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.deleteCells(this._activeBuffer.x,x.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(x){let R=x.params[0]||1;for(;R--;)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 R=x.params[0]||1;for(;R--;)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(o.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 R=x.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);B.deleteCells(0,R,this._activeBuffer.getNullCell(this._eraseAttrData())),B.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 R=x.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);B.insertCells(0,R,this._activeBuffer.getNullCell(this._eraseAttrData())),B.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 R=x.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);B.insertCells(this._activeBuffer.x,R,this._activeBuffer.getNullCell(this._eraseAttrData())),B.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 R=x.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);B.deleteCells(this._activeBuffer.x,R,this._activeBuffer.getNullCell(this._eraseAttrData())),B.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(x){this._restrictCursor();const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.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 R=this._parser.precedingJoinState;if(!R)return!0;const T=x.params[0]||1,B=b.UnicodeService.extractWidth(R),N=this._activeBuffer.x-B,U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(N),J=new Uint32Array(U.length*T);let X=0;for(let D=0;D<U.length;){const j=U.codePointAt(D)||0;J[X++]=j,D+=j>65535?2:1}let P=X;for(let D=1;D<T;++D)J.copyWithin(P,0,X),P+=X;return this.print(J,0,P),!0}sendDeviceAttributesPrimary(x){return x.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(l.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(l.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(x){return x.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(l.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(l.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(x.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(l.C0.ESC+"[>83;40003;0c")),!0}_is(x){return(this._optionsService.rawOptions.termName+"").indexOf(x)===0}setMode(x){for(let R=0;R<x.length;R++)switch(x.params[R]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(x){for(let R=0;R<x.length;R++)switch(x.params[R]){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 R=0;R<x.length;R++)switch(x.params[R]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(x){for(let R=0;R<x.length;R++)switch(x.params[R]){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[R]===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,R){const T=this._coreService.decPrivateModes,{activeProtocol:B,activeEncoding:N}=this._coreMouseService,U=this._coreService,{buffers:J,cols:X}=this._bufferService,{active:P,alt:D}=J,j=this._optionsService.rawOptions,H=ie=>ie?1:2,q=x.params[0];return K=q,ee=R?q===2?4:q===4?H(U.modes.insertMode):q===12?3:q===20?H(j.convertEol):0:q===1?H(T.applicationCursorKeys):q===3?j.windowOptions.setWinLines?X===80?2:X===132?1:0:0:q===6?H(T.origin):q===7?H(T.wraparound):q===8?3:q===9?H(B==="X10"):q===12?H(j.cursorBlink):q===25?H(!U.isCursorHidden):q===45?H(T.reverseWraparound):q===66?H(T.applicationKeypad):q===67?4:q===1e3?H(B==="VT200"):q===1002?H(B==="DRAG"):q===1003?H(B==="ANY"):q===1004?H(T.sendFocus):q===1005?4:q===1006?H(N==="SGR"):q===1015?4:q===1016?H(N==="SGR_PIXELS"):q===1048?1:q===47||q===1047||q===1049?H(P===D):q===2004?H(T.bracketedPasteMode):0,U.triggerDataEvent(`${l.C0.ESC}[${R?"":"?"}${K};${ee}$y`),!0;var K,ee}_updateAttrColor(x,R,T,B,N){return R===2?(x|=50331648,x&=-16777216,x|=f.AttributeData.fromColorRGB([T,B,N])):R===5&&(x&=-50331904,x|=33554432|255&T),x}_extractColor(x,R,T){const B=[0,0,-1,0,0,0];let N=0,U=0;do{if(B[U+N]=x.params[R+U],x.hasSubParams(R+U)){const J=x.getSubParams(R+U);let X=0;do B[1]===5&&(N=1),B[U+X+1+N]=J[X];while(++X<J.length&&X+U+1+N<B.length);break}if(B[1]===5&&U+N>=2||B[1]===2&&U+N>=5)break;B[1]&&(N=1)}while(++U+R<x.length&&U+N<B.length);for(let J=2;J<B.length;++J)B[J]===-1&&(B[J]=0);switch(B[0]){case 38:T.fg=this._updateAttrColor(T.fg,B[1],B[3],B[4],B[5]);break;case 48:T.bg=this._updateAttrColor(T.bg,B[1],B[3],B[4],B[5]);break;case 58:T.extended=T.extended.clone(),T.extended.underlineColor=this._updateAttrColor(T.extended.underlineColor,B[1],B[3],B[4],B[5])}return U}_processUnderline(x,R){R.extended=R.extended.clone(),(!~x||x>5)&&(x=1),R.extended.underlineStyle=x,R.fg|=268435456,x===0&&(R.fg&=-268435457),R.updateExtended()}_processSGR0(x){x.fg=o.DEFAULT_ATTR_DATA.fg,x.bg=o.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 R=x.length;let T;const B=this._curAttrData;for(let N=0;N<R;N++)T=x.params[N],T>=30&&T<=37?(B.fg&=-50331904,B.fg|=16777216|T-30):T>=40&&T<=47?(B.bg&=-50331904,B.bg|=16777216|T-40):T>=90&&T<=97?(B.fg&=-50331904,B.fg|=16777224|T-90):T>=100&&T<=107?(B.bg&=-50331904,B.bg|=16777224|T-100):T===0?this._processSGR0(B):T===1?B.fg|=134217728:T===3?B.bg|=67108864:T===4?(B.fg|=268435456,this._processUnderline(x.hasSubParams(N)?x.getSubParams(N)[0]:1,B)):T===5?B.fg|=536870912:T===7?B.fg|=67108864:T===8?B.fg|=1073741824:T===9?B.fg|=2147483648:T===2?B.bg|=134217728:T===21?this._processUnderline(2,B):T===22?(B.fg&=-134217729,B.bg&=-134217729):T===23?B.bg&=-67108865:T===24?(B.fg&=-268435457,this._processUnderline(0,B)):T===25?B.fg&=-536870913:T===27?B.fg&=-67108865:T===28?B.fg&=-1073741825:T===29?B.fg&=2147483647:T===39?(B.fg&=-67108864,B.fg|=16777215&o.DEFAULT_ATTR_DATA.fg):T===49?(B.bg&=-67108864,B.bg|=16777215&o.DEFAULT_ATTR_DATA.bg):T===38||T===48||T===58?N+=this._extractColor(x,N,B):T===53?B.bg|=1073741824:T===55?B.bg&=-1073741825:T===59?(B.extended=B.extended.clone(),B.extended.underlineColor=-1,B.updateExtended()):T===100?(B.fg&=-67108864,B.fg|=16777215&o.DEFAULT_ATTR_DATA.fg,B.bg&=-67108864,B.bg|=16777215&o.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",T);return!0}deviceStatus(x){switch(x.params[0]){case 5:this._coreService.triggerDataEvent(`${l.C0.ESC}[0n`);break;case 6:const R=this._activeBuffer.y+1,T=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${l.C0.ESC}[${R};${T}R`)}return!0}deviceStatusPrivate(x){if(x.params[0]===6){const R=this._activeBuffer.y+1,T=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${l.C0.ESC}[?${R};${T}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=o.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 R=x.params[0]||1;switch(R){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 T=R%2==1;return this._optionsService.options.cursorBlink=T,!0}setScrollRegion(x){const R=x.params[0]||1;let T;return(x.length<2||(T=x.params[1])>this._bufferService.rows||T===0)&&(T=this._bufferService.rows),T>R&&(this._activeBuffer.scrollTop=R-1,this._activeBuffer.scrollBottom=T-1,this._setCursor(0,0)),!0}windowOptions(x){if(!I(x.params[0],this._optionsService.rawOptions.windowOptions))return!0;const R=x.length>1?x.params[1]:0;switch(x.params[0]){case 14:R!==2&&this._onRequestWindowsOptionsReport.fire(L.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(L.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${l.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:R!==0&&R!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),R!==0&&R!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:R!==0&&R!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),R!==0&&R!==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 R=[],T=x.split(";");for(;T.length>1;){const B=T.shift(),N=T.shift();if(/^\d+$/.exec(B)){const U=parseInt(B);if(V(U))if(N==="?")R.push({type:0,index:U});else{const J=(0,k.parseColor)(N);J&&R.push({type:1,index:U,color:J})}}}return R.length&&this._onColor.fire(R),!0}setHyperlink(x){const R=x.split(";");return!(R.length<2)&&(R[1]?this._createHyperlink(R[0],R[1]):!R[0]&&this._finishHyperlink())}_createHyperlink(x,R){this._getCurrentLinkId()&&this._finishHyperlink();const T=x.split(":");let B;const N=T.findIndex(U=>U.startsWith("id="));return N!==-1&&(B=T[N].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:B,uri:R}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(x,R){const T=x.split(";");for(let B=0;B<T.length&&!(R>=this._specialColors.length);++B,++R)if(T[B]==="?")this._onColor.fire([{type:0,index:this._specialColors[R]}]);else{const N=(0,k.parseColor)(T[B]);N&&this._onColor.fire([{type:1,index:this._specialColors[R],color:N}])}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 R=[],T=x.split(";");for(let B=0;B<T.length;++B)if(/^\d+$/.exec(T[B])){const N=parseInt(T[B]);V(N)&&R.push({type:2,index:N})}return R.length&&this._onColor.fire(R),!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(A[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=o.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=o.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 c.CellData;x.content=4194373,x.fg=this._curAttrData.fg,x.bg=this._curAttrData.bg,this._setCursor(0,0);for(let R=0;R<this._bufferService.rows;++R){const T=this._activeBuffer.ybase+this._activeBuffer.y+R,B=this._activeBuffer.lines.get(T);B&&(B.fill(x),B.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(x,R){const T=this._bufferService.buffer,B=this._optionsService.rawOptions;return(N=>(this._coreService.triggerDataEvent(`${l.C0.ESC}${N}${l.C0.ESC}\\`),!0))(x==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:x==='"p'?'P1$r61;1"p':x==="r"?`P1$r${T.scrollTop+1};${T.scrollBottom+1}r`:x==="m"?"P1$r0m":x===" q"?`P1$r${{block:2,underline:4,bar:6}[B.cursorStyle]-(B.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(x,R){this._dirtyRowTracker.markRangeDirty(x,R)}}n.InputHandler=F;let W=class{constructor(Z){this._bufferService=Z,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(Z){Z<this.start?this.start=Z:Z>this.end&&(this.end=Z)}markRangeDirty(Z,x){Z>x&&($=Z,Z=x,x=$),Z<this.start&&(this.start=Z),x>this.end&&(this.end=x)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function V(Z){return 0<=Z&&Z<256}W=u([d(0,S.IBufferService)],W)},844:(E,n)=>{function a(u){for(const d of u)d.dispose();u.length=0}Object.defineProperty(n,"__esModule",{value:!0}),n.getDisposeArrayDisposable=n.disposeArray=n.toDisposable=n.MutableDisposable=n.Disposable=void 0,n.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const u of this._disposables)u.dispose();this._disposables.length=0}register(u){return this._disposables.push(u),u}unregister(u){const d=this._disposables.indexOf(u);d!==-1&&this._disposables.splice(d,1)}},n.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(u){var d;this._isDisposed||u===this._value||((d=this._value)==null||d.dispose(),this._value=u)}clear(){this.value=void 0}dispose(){var u;this._isDisposed=!0,(u=this._value)==null||u.dispose(),this._value=void 0}},n.toDisposable=function(u){return{dispose:u}},n.disposeArray=a,n.getDisposeArrayDisposable=function(u){return{dispose:()=>a(u)}}},1505:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.FourKeyMap=n.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(d,l,p){this._data[d]||(this._data[d]={}),this._data[d][l]=p}get(d,l){return this._data[d]?this._data[d][l]:void 0}clear(){this._data={}}}n.TwoKeyMap=a,n.FourKeyMap=class{constructor(){this._data=new a}set(u,d,l,p,g){this._data.get(u,d)||this._data.set(u,d,new a),this._data.get(u,d).set(l,p,g)}get(u,d,l,p){var g;return(g=this._data.get(u,d))==null?void 0:g.get(l,p)}clear(){this._data.clear()}}},6114:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.isChromeOS=n.isLinux=n.isWindows=n.isIphone=n.isIpad=n.isMac=n.getSafariVersion=n.isSafari=n.isLegacyEdge=n.isFirefox=n.isNode=void 0,n.isNode=typeof process<"u"&&"title"in process;const a=n.isNode?"node":navigator.userAgent,u=n.isNode?"node":navigator.platform;n.isFirefox=a.includes("Firefox"),n.isLegacyEdge=a.includes("Edge"),n.isSafari=/^((?!chrome|android).)*safari/i.test(a),n.getSafariVersion=function(){if(!n.isSafari)return 0;const d=a.match(/Version\/(\d+)/);return d===null||d.length<2?0:parseInt(d[1])},n.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(u),n.isIpad=u==="iPad",n.isIphone=u==="iPhone",n.isWindows=["Windows","Win16","Win32","WinCE"].includes(u),n.isLinux=u.indexOf("Linux")>=0,n.isChromeOS=/\bCrOS\b/.test(a)},6106:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.SortedList=void 0;let a=0;n.SortedList=class{constructor(u){this._getKey=u,this._array=[]}clear(){this._array.length=0}insert(u){this._array.length!==0?(a=this._search(this._getKey(u)),this._array.splice(a,0,u)):this._array.push(u)}delete(u){if(this._array.length===0)return!1;const d=this._getKey(u);if(d===void 0||(a=this._search(d),a===-1)||this._getKey(this._array[a])!==d)return!1;do if(this._array[a]===u)return this._array.splice(a,1),!0;while(++a<this._array.length&&this._getKey(this._array[a])===d);return!1}*getKeyIterator(u){if(this._array.length!==0&&(a=this._search(u),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===u))do yield this._array[a];while(++a<this._array.length&&this._getKey(this._array[a])===u)}forEachByKey(u,d){if(this._array.length!==0&&(a=this._search(u),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===u))do d(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===u)}values(){return[...this._array].values()}_search(u){let d=0,l=this._array.length-1;for(;l>=d;){let p=d+l>>1;const g=this._getKey(this._array[p]);if(g>u)l=p-1;else{if(!(g<u)){for(;p>0&&this._getKey(this._array[p-1])===u;)p--;return p}d=p+1}}return d}}},7226:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DebouncedIdleTask=n.IdleTaskQueue=n.PriorityTaskQueue=void 0;const u=a(6114);class d{constructor(){this._tasks=[],this._i=0}enqueue(g){this._tasks.push(g),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(g){this._idleCallback=void 0;let y=0,m=0,o=g.timeRemaining(),h=0;for(;this._i<this._tasks.length;){if(y=Date.now(),this._tasks[this._i]()||this._i++,y=Math.max(1,Date.now()-y),m=Math.max(y,m),h=g.timeRemaining(),1.5*m>h)return o-y<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(o-y))}ms`),void this._start();o=h}this.clear()}}class l extends d{_requestCallback(g){return setTimeout(()=>g(this._createDeadline(16)))}_cancelCallback(g){clearTimeout(g)}_createDeadline(g){const y=Date.now()+g;return{timeRemaining:()=>Math.max(0,y-Date.now())}}}n.PriorityTaskQueue=l,n.IdleTaskQueue=!u.isNode&&"requestIdleCallback"in window?class extends d{_requestCallback(p){return requestIdleCallback(p)}_cancelCallback(p){cancelIdleCallback(p)}}:l,n.DebouncedIdleTask=class{constructor(){this._queue=new n.IdleTaskQueue}set(p){this._queue.clear(),this._queue.enqueue(p)}flush(){this._queue.flush()}}},9282:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.updateWindowsModeWrappedState=void 0;const u=a(643);n.updateWindowsModeWrappedState=function(d){const l=d.buffer.lines.get(d.buffer.ybase+d.buffer.y-1),p=l==null?void 0:l.get(d.cols-1),g=d.buffer.lines.get(d.buffer.ybase+d.buffer.y);g&&p&&(g.isWrapped=p[u.CHAR_DATA_CODE_INDEX]!==u.NULL_CELL_CODE&&p[u.CHAR_DATA_CODE_INDEX]!==u.WHITESPACE_CELL_CODE)}},3734:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ExtendedAttrs=n.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new u}static toColorRGB(l){return[l>>>16&255,l>>>8&255,255&l]}static fromColorRGB(l){return(255&l[0])<<16|(255&l[1])<<8|255&l[2]}clone(){const l=new a;return l.fg=this.fg,l.bg=this.bg,l.extended=this.extended.clone(),l}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}n.AttributeData=a;class u{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(l){this._ext=l}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(l){this._ext&=-469762049,this._ext|=l<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(l){this._ext&=-67108864,this._ext|=67108863&l}get urlId(){return this._urlId}set urlId(l){this._urlId=l}get underlineVariantOffset(){const l=(3758096384&this._ext)>>29;return l<0?4294967288^l:l}set underlineVariantOffset(l){this._ext&=536870911,this._ext|=l<<29&3758096384}constructor(l=0,p=0){this._ext=0,this._urlId=0,this._ext=l,this._urlId=p}clone(){return new u(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}n.ExtendedAttrs=u},9092:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Buffer=n.MAX_BUFFER_SIZE=void 0;const u=a(6349),d=a(7226),l=a(3734),p=a(8437),g=a(4634),y=a(511),m=a(643),o=a(4863),h=a(7116);n.MAX_BUFFER_SIZE=4294967295,n.Buffer=class{constructor(s,c,f){this._hasScrollback=s,this._optionsService=c,this._bufferService=f,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=h.DEFAULT_CHARSET,this.markers=[],this._nullCell=y.CellData.fromCharData([0,m.NULL_CELL_CHAR,m.NULL_CELL_WIDTH,m.NULL_CELL_CODE]),this._whitespaceCell=y.CellData.fromCharData([0,m.WHITESPACE_CELL_CHAR,m.WHITESPACE_CELL_WIDTH,m.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new d.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(s){return s?(this._nullCell.fg=s.fg,this._nullCell.bg=s.bg,this._nullCell.extended=s.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new l.ExtendedAttrs),this._nullCell}getWhitespaceCell(s){return s?(this._whitespaceCell.fg=s.fg,this._whitespaceCell.bg=s.bg,this._whitespaceCell.extended=s.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new l.ExtendedAttrs),this._whitespaceCell}getBlankLine(s,c){return new p.BufferLine(this._bufferService.cols,this.getNullCell(s),c)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const s=this.ybase+this.y-this.ydisp;return s>=0&&s<this._rows}_getCorrectBufferLength(s){if(!this._hasScrollback)return s;const c=s+this._optionsService.rawOptions.scrollback;return c>n.MAX_BUFFER_SIZE?n.MAX_BUFFER_SIZE:c}fillViewportRows(s){if(this.lines.length===0){s===void 0&&(s=p.DEFAULT_ATTR_DATA);let c=this._rows;for(;c--;)this.lines.push(this.getBlankLine(s))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(s,c){const f=this.getNullCell(p.DEFAULT_ATTR_DATA);let S=0;const b=this._getCorrectBufferLength(c);if(b>this.lines.maxLength&&(this.lines.maxLength=b),this.lines.length>0){if(this._cols<s)for(let v=0;v<this.lines.length;v++)S+=+this.lines.get(v).resize(s,f);let w=0;if(this._rows<c)for(let v=this._rows;v<c;v++)this.lines.length<c+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new p.BufferLine(s,f)):this.ybase>0&&this.lines.length<=this.ybase+this.y+w+1?(this.ybase--,w++,this.ydisp>0&&this.ydisp--):this.lines.push(new p.BufferLine(s,f)));else for(let v=this._rows;v>c;v--)this.lines.length>c+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(b<this.lines.maxLength){const v=this.lines.length-b;v>0&&(this.lines.trimStart(v),this.ybase=Math.max(this.ybase-v,0),this.ydisp=Math.max(this.ydisp-v,0),this.savedY=Math.max(this.savedY-v,0)),this.lines.maxLength=b}this.x=Math.min(this.x,s-1),this.y=Math.min(this.y,c-1),w&&(this.y+=w),this.savedX=Math.min(this.savedX,s-1),this.scrollTop=0}if(this.scrollBottom=c-1,this._isReflowEnabled&&(this._reflow(s,c),this._cols>s))for(let w=0;w<this.lines.length;w++)S+=+this.lines.get(w).resize(s,f);this._cols=s,this._rows=c,this._memoryCleanupQueue.clear(),S>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let s=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,s=!1);let c=0;for(;this._memoryCleanupPosition<this.lines.length;)if(c+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),c>100)return!0;return s}get _isReflowEnabled(){const s=this._optionsService.rawOptions.windowsPty;return s&&s.buildNumber?this._hasScrollback&&s.backend==="conpty"&&s.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(s,c){this._cols!==s&&(s>this._cols?this._reflowLarger(s,c):this._reflowSmaller(s,c))}_reflowLarger(s,c){const f=(0,g.reflowLargerGetLinesToRemove)(this.lines,this._cols,s,this.ybase+this.y,this.getNullCell(p.DEFAULT_ATTR_DATA));if(f.length>0){const S=(0,g.reflowLargerCreateNewLayout)(this.lines,f);(0,g.reflowLargerApplyNewLayout)(this.lines,S.layout),this._reflowLargerAdjustViewport(s,c,S.countRemoved)}}_reflowLargerAdjustViewport(s,c,f){const S=this.getNullCell(p.DEFAULT_ATTR_DATA);let b=f;for(;b-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<c&&this.lines.push(new p.BufferLine(s,S))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-f,0)}_reflowSmaller(s,c){const f=this.getNullCell(p.DEFAULT_ATTR_DATA),S=[];let b=0;for(let w=this.lines.length-1;w>=0;w--){let v=this.lines.get(w);if(!v||!v.isWrapped&&v.getTrimmedLength()<=s)continue;const k=[v];for(;v.isWrapped&&w>0;)v=this.lines.get(--w),k.unshift(v);const A=this.ybase+this.y;if(A>=w&&A<w+k.length)continue;const O=k[k.length-1].getTrimmedLength(),I=(0,g.reflowSmallerGetNewLineLengths)(k,this._cols,s),L=I.length-k.length;let $;$=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+L):Math.max(0,this.lines.length-this.lines.maxLength+L);const F=[];for(let T=0;T<L;T++){const B=this.getBlankLine(p.DEFAULT_ATTR_DATA,!0);F.push(B)}F.length>0&&(S.push({start:w+k.length+b,newLines:F}),b+=F.length),k.push(...F);let W=I.length-1,V=I[W];V===0&&(W--,V=I[W]);let Z=k.length-L-1,x=O;for(;Z>=0;){const T=Math.min(x,V);if(k[W]===void 0)break;if(k[W].copyCellsFrom(k[Z],x-T,V-T,T,!0),V-=T,V===0&&(W--,V=I[W]),x-=T,x===0){Z--;const B=Math.max(Z,0);x=(0,g.getWrappedLineTrimmedLength)(k,B,this._cols)}}for(let T=0;T<k.length;T++)I[T]<s&&k[T].setCell(I[T],f);let R=L-$;for(;R-- >0;)this.ybase===0?this.y<c-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+b)-c&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+L,this.ybase+c-1)}if(S.length>0){const w=[],v=[];for(let W=0;W<this.lines.length;W++)v.push(this.lines.get(W));const k=this.lines.length;let A=k-1,O=0,I=S[O];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+b);let L=0;for(let W=Math.min(this.lines.maxLength-1,k+b-1);W>=0;W--)if(I&&I.start>A+L){for(let V=I.newLines.length-1;V>=0;V--)this.lines.set(W--,I.newLines[V]);W++,w.push({index:A+1,amount:I.newLines.length}),L+=I.newLines.length,I=S[++O]}else this.lines.set(W,v[A--]);let $=0;for(let W=w.length-1;W>=0;W--)w[W].index+=$,this.lines.onInsertEmitter.fire(w[W]),$+=w[W].amount;const F=Math.max(0,k+b-this.lines.maxLength);F>0&&this.lines.onTrimEmitter.fire(F)}}translateBufferLineToString(s,c,f=0,S){const b=this.lines.get(s);return b?b.translateToString(c,f,S):""}getWrappedRangeForLine(s){let c=s,f=s;for(;c>0&&this.lines.get(c).isWrapped;)c--;for(;f+1<this.lines.length&&this.lines.get(f+1).isWrapped;)f++;return{first:c,last:f}}setupTabStops(s){for(s!=null?this.tabs[s]||(s=this.prevStop(s)):(this.tabs={},s=0);s<this._cols;s+=this._optionsService.rawOptions.tabStopWidth)this.tabs[s]=!0}prevStop(s){for(s==null&&(s=this.x);!this.tabs[--s]&&s>0;);return s>=this._cols?this._cols-1:s<0?0:s}nextStop(s){for(s==null&&(s=this.x);!this.tabs[++s]&&s<this._cols;);return s>=this._cols?this._cols-1:s<0?0:s}clearMarkers(s){this._isClearing=!0;for(let c=0;c<this.markers.length;c++)this.markers[c].line===s&&(this.markers[c].dispose(),this.markers.splice(c--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let s=0;s<this.markers.length;s++)this.markers[s].dispose(),this.markers.splice(s--,1);this._isClearing=!1}addMarker(s){const c=new o.Marker(s);return this.markers.push(c),c.register(this.lines.onTrim(f=>{c.line-=f,c.line<0&&c.dispose()})),c.register(this.lines.onInsert(f=>{c.line>=f.index&&(c.line+=f.amount)})),c.register(this.lines.onDelete(f=>{c.line>=f.index&&c.line<f.index+f.amount&&c.dispose(),c.line>f.index&&(c.line-=f.amount)})),c.register(c.onDispose(()=>this._removeMarker(c))),c}_removeMarker(s){this._isClearing||this.markers.splice(this.markers.indexOf(s),1)}}},8437:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferLine=n.DEFAULT_ATTR_DATA=void 0;const u=a(3734),d=a(511),l=a(643),p=a(482);n.DEFAULT_ATTR_DATA=Object.freeze(new u.AttributeData);let g=0;class y{constructor(o,h,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*o);const c=h||d.CellData.fromCharData([0,l.NULL_CELL_CHAR,l.NULL_CELL_WIDTH,l.NULL_CELL_CODE]);for(let f=0;f<o;++f)this.setCell(f,c);this.length=o}get(o){const h=this._data[3*o+0],s=2097151&h;return[this._data[3*o+1],2097152&h?this._combined[o]:s?(0,p.stringFromCodePoint)(s):"",h>>22,2097152&h?this._combined[o].charCodeAt(this._combined[o].length-1):s]}set(o,h){this._data[3*o+1]=h[l.CHAR_DATA_ATTR_INDEX],h[l.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[o]=h[1],this._data[3*o+0]=2097152|o|h[l.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*o+0]=h[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|h[l.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(o){return this._data[3*o+0]>>22}hasWidth(o){return 12582912&this._data[3*o+0]}getFg(o){return this._data[3*o+1]}getBg(o){return this._data[3*o+2]}hasContent(o){return 4194303&this._data[3*o+0]}getCodePoint(o){const h=this._data[3*o+0];return 2097152&h?this._combined[o].charCodeAt(this._combined[o].length-1):2097151&h}isCombined(o){return 2097152&this._data[3*o+0]}getString(o){const h=this._data[3*o+0];return 2097152&h?this._combined[o]:2097151&h?(0,p.stringFromCodePoint)(2097151&h):""}isProtected(o){return 536870912&this._data[3*o+2]}loadCell(o,h){return g=3*o,h.content=this._data[g+0],h.fg=this._data[g+1],h.bg=this._data[g+2],2097152&h.content&&(h.combinedData=this._combined[o]),268435456&h.bg&&(h.extended=this._extendedAttrs[o]),h}setCell(o,h){2097152&h.content&&(this._combined[o]=h.combinedData),268435456&h.bg&&(this._extendedAttrs[o]=h.extended),this._data[3*o+0]=h.content,this._data[3*o+1]=h.fg,this._data[3*o+2]=h.bg}setCellFromCodepoint(o,h,s,c){268435456&c.bg&&(this._extendedAttrs[o]=c.extended),this._data[3*o+0]=h|s<<22,this._data[3*o+1]=c.fg,this._data[3*o+2]=c.bg}addCodepointToCell(o,h,s){let c=this._data[3*o+0];2097152&c?this._combined[o]+=(0,p.stringFromCodePoint)(h):2097151&c?(this._combined[o]=(0,p.stringFromCodePoint)(2097151&c)+(0,p.stringFromCodePoint)(h),c&=-2097152,c|=2097152):c=h|4194304,s&&(c&=-12582913,c|=s<<22),this._data[3*o+0]=c}insertCells(o,h,s){if((o%=this.length)&&this.getWidth(o-1)===2&&this.setCellFromCodepoint(o-1,0,1,s),h<this.length-o){const c=new d.CellData;for(let f=this.length-o-h-1;f>=0;--f)this.setCell(o+h+f,this.loadCell(o+f,c));for(let f=0;f<h;++f)this.setCell(o+f,s)}else for(let c=o;c<this.length;++c)this.setCell(c,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(o,h,s){if(o%=this.length,h<this.length-o){const c=new d.CellData;for(let f=0;f<this.length-o-h;++f)this.setCell(o+f,this.loadCell(o+h+f,c));for(let f=this.length-h;f<this.length;++f)this.setCell(f,s)}else for(let c=o;c<this.length;++c)this.setCell(c,s);o&&this.getWidth(o-1)===2&&this.setCellFromCodepoint(o-1,0,1,s),this.getWidth(o)!==0||this.hasContent(o)||this.setCellFromCodepoint(o,0,1,s)}replaceCells(o,h,s,c=!1){if(c)for(o&&this.getWidth(o-1)===2&&!this.isProtected(o-1)&&this.setCellFromCodepoint(o-1,0,1,s),h<this.length&&this.getWidth(h-1)===2&&!this.isProtected(h)&&this.setCellFromCodepoint(h,0,1,s);o<h&&o<this.length;)this.isProtected(o)||this.setCell(o,s),o++;else for(o&&this.getWidth(o-1)===2&&this.setCellFromCodepoint(o-1,0,1,s),h<this.length&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h,0,1,s);o<h&&o<this.length;)this.setCell(o++,s)}resize(o,h){if(o===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const s=3*o;if(o>this.length){if(this._data.buffer.byteLength>=4*s)this._data=new Uint32Array(this._data.buffer,0,s);else{const c=new Uint32Array(s);c.set(this._data),this._data=c}for(let c=this.length;c<o;++c)this.setCell(c,h)}else{this._data=this._data.subarray(0,s);const c=Object.keys(this._combined);for(let S=0;S<c.length;S++){const b=parseInt(c[S],10);b>=o&&delete this._combined[b]}const f=Object.keys(this._extendedAttrs);for(let S=0;S<f.length;S++){const b=parseInt(f[S],10);b>=o&&delete this._extendedAttrs[b]}}return this.length=o,4*s*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const o=new Uint32Array(this._data.length);return o.set(this._data),this._data=o,1}return 0}fill(o,h=!1){if(h)for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,o);else{this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,o)}}copyFrom(o){this.length!==o.length?this._data=new Uint32Array(o._data):this._data.set(o._data),this.length=o.length,this._combined={};for(const h in o._combined)this._combined[h]=o._combined[h];this._extendedAttrs={};for(const h in o._extendedAttrs)this._extendedAttrs[h]=o._extendedAttrs[h];this.isWrapped=o.isWrapped}clone(){const o=new y(0);o._data=new Uint32Array(this._data),o.length=this.length;for(const h in this._combined)o._combined[h]=this._combined[h];for(const h in this._extendedAttrs)o._extendedAttrs[h]=this._extendedAttrs[h];return o.isWrapped=this.isWrapped,o}getTrimmedLength(){for(let o=this.length-1;o>=0;--o)if(4194303&this._data[3*o+0])return o+(this._data[3*o+0]>>22);return 0}getNoBgTrimmedLength(){for(let o=this.length-1;o>=0;--o)if(4194303&this._data[3*o+0]||50331648&this._data[3*o+2])return o+(this._data[3*o+0]>>22);return 0}copyCellsFrom(o,h,s,c,f){const S=o._data;if(f)for(let w=c-1;w>=0;w--){for(let v=0;v<3;v++)this._data[3*(s+w)+v]=S[3*(h+w)+v];268435456&S[3*(h+w)+2]&&(this._extendedAttrs[s+w]=o._extendedAttrs[h+w])}else for(let w=0;w<c;w++){for(let v=0;v<3;v++)this._data[3*(s+w)+v]=S[3*(h+w)+v];268435456&S[3*(h+w)+2]&&(this._extendedAttrs[s+w]=o._extendedAttrs[h+w])}const b=Object.keys(o._combined);for(let w=0;w<b.length;w++){const v=parseInt(b[w],10);v>=h&&(this._combined[v-h+s]=o._combined[v])}}translateToString(o,h,s,c){h=h??0,s=s??this.length,o&&(s=Math.min(s,this.getTrimmedLength())),c&&(c.length=0);let f="";for(;h<s;){const S=this._data[3*h+0],b=2097151&S,w=2097152&S?this._combined[h]:b?(0,p.stringFromCodePoint)(b):l.WHITESPACE_CELL_CHAR;if(f+=w,c)for(let v=0;v<w.length;++v)c.push(h);h+=S>>22||1}return c&&c.push(h),f}}n.BufferLine=y},4841:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.getRangeLength=void 0,n.getRangeLength=function(a,u){if(a.start.y>a.end.y)throw new Error(`Buffer range end (${a.end.x}, ${a.end.y}) cannot be before start (${a.start.x}, ${a.start.y})`);return u*(a.end.y-a.start.y)+(a.end.x-a.start.x+1)}},4634:(E,n)=>{function a(u,d,l){if(d===u.length-1)return u[d].getTrimmedLength();const p=!u[d].hasContent(l-1)&&u[d].getWidth(l-1)===1,g=u[d+1].getWidth(0)===2;return p&&g?l-1:l}Object.defineProperty(n,"__esModule",{value:!0}),n.getWrappedLineTrimmedLength=n.reflowSmallerGetNewLineLengths=n.reflowLargerApplyNewLayout=n.reflowLargerCreateNewLayout=n.reflowLargerGetLinesToRemove=void 0,n.reflowLargerGetLinesToRemove=function(u,d,l,p,g){const y=[];for(let m=0;m<u.length-1;m++){let o=m,h=u.get(++o);if(!h.isWrapped)continue;const s=[u.get(m)];for(;o<u.length&&h.isWrapped;)s.push(h),h=u.get(++o);if(p>=m&&p<o){m+=s.length-1;continue}let c=0,f=a(s,c,d),S=1,b=0;for(;S<s.length;){const v=a(s,S,d),k=v-b,A=l-f,O=Math.min(k,A);s[c].copyCellsFrom(s[S],b,f,O,!1),f+=O,f===l&&(c++,f=0),b+=O,b===v&&(S++,b=0),f===0&&c!==0&&s[c-1].getWidth(l-1)===2&&(s[c].copyCellsFrom(s[c-1],l-1,f++,1,!1),s[c-1].setCell(l-1,g))}s[c].replaceCells(f,l,g);let w=0;for(let v=s.length-1;v>0&&(v>c||s[v].getTrimmedLength()===0);v--)w++;w>0&&(y.push(m+s.length-w),y.push(w)),m+=s.length-1}return y},n.reflowLargerCreateNewLayout=function(u,d){const l=[];let p=0,g=d[p],y=0;for(let m=0;m<u.length;m++)if(g===m){const o=d[++p];u.onDeleteEmitter.fire({index:m-y,amount:o}),m+=o-1,y+=o,g=d[++p]}else l.push(m);return{layout:l,countRemoved:y}},n.reflowLargerApplyNewLayout=function(u,d){const l=[];for(let p=0;p<d.length;p++)l.push(u.get(d[p]));for(let p=0;p<l.length;p++)u.set(p,l[p]);u.length=d.length},n.reflowSmallerGetNewLineLengths=function(u,d,l){const p=[],g=u.map((h,s)=>a(u,s,d)).reduce((h,s)=>h+s);let y=0,m=0,o=0;for(;o<g;){if(g-o<l){p.push(g-o);break}y+=l;const h=a(u,m,d);y>h&&(y-=h,m++);const s=u[m].getWidth(y-1)===2;s&&y--;const c=s?l-1:l;p.push(c),o+=c}return p},n.getWrappedLineTrimmedLength=a},5295:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferSet=void 0;const u=a(8460),d=a(844),l=a(9092);class p extends d.Disposable{constructor(y,m){super(),this._optionsService=y,this._bufferService=m,this._onBufferActivate=this.register(new u.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new l.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new l.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(y){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(y),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(y,m){this._normal.resize(y,m),this._alt.resize(y,m),this.setupTabStops(y)}setupTabStops(y){this._normal.setupTabStops(y),this._alt.setupTabStops(y)}}n.BufferSet=p},511:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CellData=void 0;const u=a(482),d=a(643),l=a(3734);class p extends l.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new l.ExtendedAttrs,this.combinedData=""}static fromCharData(y){const m=new p;return m.setFromCharData(y),m}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,u.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(y){this.fg=y[d.CHAR_DATA_ATTR_INDEX],this.bg=0;let m=!1;if(y[d.CHAR_DATA_CHAR_INDEX].length>2)m=!0;else if(y[d.CHAR_DATA_CHAR_INDEX].length===2){const o=y[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=o&&o<=56319){const h=y[d.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=h&&h<=57343?this.content=1024*(o-55296)+h-56320+65536|y[d.CHAR_DATA_WIDTH_INDEX]<<22:m=!0}else m=!0}else this.content=y[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[d.CHAR_DATA_WIDTH_INDEX]<<22;m&&(this.combinedData=y[d.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[d.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}n.CellData=p},643:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.WHITESPACE_CELL_CODE=n.WHITESPACE_CELL_WIDTH=n.WHITESPACE_CELL_CHAR=n.NULL_CELL_CODE=n.NULL_CELL_WIDTH=n.NULL_CELL_CHAR=n.CHAR_DATA_CODE_INDEX=n.CHAR_DATA_WIDTH_INDEX=n.CHAR_DATA_CHAR_INDEX=n.CHAR_DATA_ATTR_INDEX=n.DEFAULT_EXT=n.DEFAULT_ATTR=n.DEFAULT_COLOR=void 0,n.DEFAULT_COLOR=0,n.DEFAULT_ATTR=256|n.DEFAULT_COLOR<<9,n.DEFAULT_EXT=0,n.CHAR_DATA_ATTR_INDEX=0,n.CHAR_DATA_CHAR_INDEX=1,n.CHAR_DATA_WIDTH_INDEX=2,n.CHAR_DATA_CODE_INDEX=3,n.NULL_CELL_CHAR="",n.NULL_CELL_WIDTH=1,n.NULL_CELL_CODE=0,n.WHITESPACE_CELL_CHAR=" ",n.WHITESPACE_CELL_WIDTH=1,n.WHITESPACE_CELL_CODE=32},4863:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Marker=void 0;const u=a(8460),d=a(844);class l{get id(){return this._id}constructor(g){this.line=g,this.isDisposed=!1,this._disposables=[],this._id=l._nextId++,this._onDispose=this.register(new u.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,d.disposeArray)(this._disposables),this._disposables.length=0)}register(g){return this._disposables.push(g),g}}n.Marker=l,l._nextId=1},7116:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DEFAULT_CHARSET=n.CHARSETS=void 0,n.CHARSETS={},n.DEFAULT_CHARSET=n.CHARSETS.B,n.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:"≥","{":"π","|":"≠","}":"£","~":"·"},n.CHARSETS.A={"#":"£"},n.CHARSETS.B=void 0,n.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},n.CHARSETS.C=n.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},n.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},n.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},n.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},n.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},n.CHARSETS.E=n.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},n.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},n.CHARSETS.H=n.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},n.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(E,n)=>{var a,u,d;Object.defineProperty(n,"__esModule",{value:!0}),n.C1_ESCAPED=n.C1=n.C0=void 0,function(l){l.NUL="\0",l.SOH="",l.STX="",l.ETX="",l.EOT="",l.ENQ="",l.ACK="",l.BEL="\x07",l.BS="\b",l.HT=" ",l.LF=`
8
+ `,l.VT="\v",l.FF="\f",l.CR="\r",l.SO="",l.SI="",l.DLE="",l.DC1="",l.DC2="",l.DC3="",l.DC4="",l.NAK="",l.SYN="",l.ETB="",l.CAN="",l.EM="",l.SUB="",l.ESC="\x1B",l.FS="",l.GS="",l.RS="",l.US="",l.SP=" ",l.DEL=""}(a||(n.C0=a={})),function(l){l.PAD="€",l.HOP="",l.BPH="‚",l.NBH="ƒ",l.IND="„",l.NEL="…",l.SSA="†",l.ESA="‡",l.HTS="ˆ",l.HTJ="‰",l.VTS="Š",l.PLD="‹",l.PLU="Œ",l.RI="",l.SS2="Ž",l.SS3="",l.DCS="",l.PU1="‘",l.PU2="’",l.STS="“",l.CCH="”",l.MW="•",l.SPA="–",l.EPA="—",l.SOS="˜",l.SGCI="™",l.SCI="š",l.CSI="›",l.ST="œ",l.OSC="",l.PM="ž",l.APC="Ÿ"}(u||(n.C1=u={})),function(l){l.ST=`${a.ESC}\\`}(d||(n.C1_ESCAPED=d={}))},7399:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.evaluateKeyboardEvent=void 0;const u=a(2584),d={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};n.evaluateKeyboardEvent=function(l,p,g,y){const m={type:0,cancel:!1,key:void 0},o=(l.shiftKey?1:0)|(l.altKey?2:0)|(l.ctrlKey?4:0)|(l.metaKey?8:0);switch(l.keyCode){case 0:l.key==="UIKeyInputUpArrow"?m.key=p?u.C0.ESC+"OA":u.C0.ESC+"[A":l.key==="UIKeyInputLeftArrow"?m.key=p?u.C0.ESC+"OD":u.C0.ESC+"[D":l.key==="UIKeyInputRightArrow"?m.key=p?u.C0.ESC+"OC":u.C0.ESC+"[C":l.key==="UIKeyInputDownArrow"&&(m.key=p?u.C0.ESC+"OB":u.C0.ESC+"[B");break;case 8:m.key=l.ctrlKey?"\b":u.C0.DEL,l.altKey&&(m.key=u.C0.ESC+m.key);break;case 9:if(l.shiftKey){m.key=u.C0.ESC+"[Z";break}m.key=u.C0.HT,m.cancel=!0;break;case 13:m.key=l.altKey?u.C0.ESC+u.C0.CR:u.C0.CR,m.cancel=!0;break;case 27:m.key=u.C0.ESC,l.altKey&&(m.key=u.C0.ESC+u.C0.ESC),m.cancel=!0;break;case 37:if(l.metaKey)break;o?(m.key=u.C0.ESC+"[1;"+(o+1)+"D",m.key===u.C0.ESC+"[1;3D"&&(m.key=u.C0.ESC+(g?"b":"[1;5D"))):m.key=p?u.C0.ESC+"OD":u.C0.ESC+"[D";break;case 39:if(l.metaKey)break;o?(m.key=u.C0.ESC+"[1;"+(o+1)+"C",m.key===u.C0.ESC+"[1;3C"&&(m.key=u.C0.ESC+(g?"f":"[1;5C"))):m.key=p?u.C0.ESC+"OC":u.C0.ESC+"[C";break;case 38:if(l.metaKey)break;o?(m.key=u.C0.ESC+"[1;"+(o+1)+"A",g||m.key!==u.C0.ESC+"[1;3A"||(m.key=u.C0.ESC+"[1;5A")):m.key=p?u.C0.ESC+"OA":u.C0.ESC+"[A";break;case 40:if(l.metaKey)break;o?(m.key=u.C0.ESC+"[1;"+(o+1)+"B",g||m.key!==u.C0.ESC+"[1;3B"||(m.key=u.C0.ESC+"[1;5B")):m.key=p?u.C0.ESC+"OB":u.C0.ESC+"[B";break;case 45:l.shiftKey||l.ctrlKey||(m.key=u.C0.ESC+"[2~");break;case 46:m.key=o?u.C0.ESC+"[3;"+(o+1)+"~":u.C0.ESC+"[3~";break;case 36:m.key=o?u.C0.ESC+"[1;"+(o+1)+"H":p?u.C0.ESC+"OH":u.C0.ESC+"[H";break;case 35:m.key=o?u.C0.ESC+"[1;"+(o+1)+"F":p?u.C0.ESC+"OF":u.C0.ESC+"[F";break;case 33:l.shiftKey?m.type=2:l.ctrlKey?m.key=u.C0.ESC+"[5;"+(o+1)+"~":m.key=u.C0.ESC+"[5~";break;case 34:l.shiftKey?m.type=3:l.ctrlKey?m.key=u.C0.ESC+"[6;"+(o+1)+"~":m.key=u.C0.ESC+"[6~";break;case 112:m.key=o?u.C0.ESC+"[1;"+(o+1)+"P":u.C0.ESC+"OP";break;case 113:m.key=o?u.C0.ESC+"[1;"+(o+1)+"Q":u.C0.ESC+"OQ";break;case 114:m.key=o?u.C0.ESC+"[1;"+(o+1)+"R":u.C0.ESC+"OR";break;case 115:m.key=o?u.C0.ESC+"[1;"+(o+1)+"S":u.C0.ESC+"OS";break;case 116:m.key=o?u.C0.ESC+"[15;"+(o+1)+"~":u.C0.ESC+"[15~";break;case 117:m.key=o?u.C0.ESC+"[17;"+(o+1)+"~":u.C0.ESC+"[17~";break;case 118:m.key=o?u.C0.ESC+"[18;"+(o+1)+"~":u.C0.ESC+"[18~";break;case 119:m.key=o?u.C0.ESC+"[19;"+(o+1)+"~":u.C0.ESC+"[19~";break;case 120:m.key=o?u.C0.ESC+"[20;"+(o+1)+"~":u.C0.ESC+"[20~";break;case 121:m.key=o?u.C0.ESC+"[21;"+(o+1)+"~":u.C0.ESC+"[21~";break;case 122:m.key=o?u.C0.ESC+"[23;"+(o+1)+"~":u.C0.ESC+"[23~";break;case 123:m.key=o?u.C0.ESC+"[24;"+(o+1)+"~":u.C0.ESC+"[24~";break;default:if(!l.ctrlKey||l.shiftKey||l.altKey||l.metaKey)if(g&&!y||!l.altKey||l.metaKey)!g||l.altKey||l.ctrlKey||l.shiftKey||!l.metaKey?l.key&&!l.ctrlKey&&!l.altKey&&!l.metaKey&&l.keyCode>=48&&l.key.length===1?m.key=l.key:l.key&&l.ctrlKey&&(l.key==="_"&&(m.key=u.C0.US),l.key==="@"&&(m.key=u.C0.NUL)):l.keyCode===65&&(m.type=1);else{const h=d[l.keyCode],s=h==null?void 0:h[l.shiftKey?1:0];if(s)m.key=u.C0.ESC+s;else if(l.keyCode>=65&&l.keyCode<=90){const c=l.ctrlKey?l.keyCode-64:l.keyCode+32;let f=String.fromCharCode(c);l.shiftKey&&(f=f.toUpperCase()),m.key=u.C0.ESC+f}else if(l.keyCode===32)m.key=u.C0.ESC+(l.ctrlKey?u.C0.NUL:" ");else if(l.key==="Dead"&&l.code.startsWith("Key")){let c=l.code.slice(3,4);l.shiftKey||(c=c.toLowerCase()),m.key=u.C0.ESC+c,m.cancel=!0}}else l.keyCode>=65&&l.keyCode<=90?m.key=String.fromCharCode(l.keyCode-64):l.keyCode===32?m.key=u.C0.NUL:l.keyCode>=51&&l.keyCode<=55?m.key=String.fromCharCode(l.keyCode-51+27):l.keyCode===56?m.key=u.C0.DEL:l.keyCode===219?m.key=u.C0.ESC:l.keyCode===220?m.key=u.C0.FS:l.keyCode===221&&(m.key=u.C0.GS)}return m}},482:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Utf8ToUtf32=n.StringToUtf32=n.utf32ToString=n.stringFromCodePoint=void 0,n.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},n.utf32ToString=function(a,u=0,d=a.length){let l="";for(let p=u;p<d;++p){let g=a[p];g>65535?(g-=65536,l+=String.fromCharCode(55296+(g>>10))+String.fromCharCode(g%1024+56320)):l+=String.fromCharCode(g)}return l},n.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,u){const d=a.length;if(!d)return 0;let l=0,p=0;if(this._interim){const g=a.charCodeAt(p++);56320<=g&&g<=57343?u[l++]=1024*(this._interim-55296)+g-56320+65536:(u[l++]=this._interim,u[l++]=g),this._interim=0}for(let g=p;g<d;++g){const y=a.charCodeAt(g);if(55296<=y&&y<=56319){if(++g>=d)return this._interim=y,l;const m=a.charCodeAt(g);56320<=m&&m<=57343?u[l++]=1024*(y-55296)+m-56320+65536:(u[l++]=y,u[l++]=m)}else y!==65279&&(u[l++]=y)}return l}},n.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,u){const d=a.length;if(!d)return 0;let l,p,g,y,m=0,o=0,h=0;if(this.interim[0]){let f=!1,S=this.interim[0];S&=(224&S)==192?31:(240&S)==224?15:7;let b,w=0;for(;(b=63&this.interim[++w])&&w<4;)S<<=6,S|=b;const v=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,k=v-w;for(;h<k;){if(h>=d)return 0;if(b=a[h++],(192&b)!=128){h--,f=!0;break}this.interim[w++]=b,S<<=6,S|=63&b}f||(v===2?S<128?h--:u[m++]=S:v===3?S<2048||S>=55296&&S<=57343||S===65279||(u[m++]=S):S<65536||S>1114111||(u[m++]=S)),this.interim.fill(0)}const s=d-4;let c=h;for(;c<d;){for(;!(!(c<s)||128&(l=a[c])||128&(p=a[c+1])||128&(g=a[c+2])||128&(y=a[c+3]));)u[m++]=l,u[m++]=p,u[m++]=g,u[m++]=y,c+=4;if(l=a[c++],l<128)u[m++]=l;else if((224&l)==192){if(c>=d)return this.interim[0]=l,m;if(p=a[c++],(192&p)!=128){c--;continue}if(o=(31&l)<<6|63&p,o<128){c--;continue}u[m++]=o}else if((240&l)==224){if(c>=d)return this.interim[0]=l,m;if(p=a[c++],(192&p)!=128){c--;continue}if(c>=d)return this.interim[0]=l,this.interim[1]=p,m;if(g=a[c++],(192&g)!=128){c--;continue}if(o=(15&l)<<12|(63&p)<<6|63&g,o<2048||o>=55296&&o<=57343||o===65279)continue;u[m++]=o}else if((248&l)==240){if(c>=d)return this.interim[0]=l,m;if(p=a[c++],(192&p)!=128){c--;continue}if(c>=d)return this.interim[0]=l,this.interim[1]=p,m;if(g=a[c++],(192&g)!=128){c--;continue}if(c>=d)return this.interim[0]=l,this.interim[1]=p,this.interim[2]=g,m;if(y=a[c++],(192&y)!=128){c--;continue}if(o=(7&l)<<18|(63&p)<<12|(63&g)<<6|63&y,o<65536||o>1114111)continue;u[m++]=o}}return m}}},225:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.UnicodeV6=void 0;const u=a(1480),d=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],l=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let p;n.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 g=0;g<d.length;++g)p.fill(0,d[g][0],d[g][1]+1)}}wcwidth(g){return g<32?0:g<127?1:g<65536?p[g]:function(y,m){let o,h=0,s=m.length-1;if(y<m[0][0]||y>m[s][1])return!1;for(;s>=h;)if(o=h+s>>1,y>m[o][1])h=o+1;else{if(!(y<m[o][0]))return!0;s=o-1}return!1}(g,l)?0:g>=131072&&g<=196605||g>=196608&&g<=262141?2:1}charProperties(g,y){let m=this.wcwidth(g),o=m===0&&y!==0;if(o){const h=u.UnicodeService.extractWidth(y);h===0?o=!1:h>m&&(m=h)}return u.UnicodeService.createPropertyValue(0,m,o)}}},5981:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.WriteBuffer=void 0;const u=a(8460),d=a(844);class l extends d.Disposable{constructor(g){super(),this._action=g,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(g,y){if(y!==void 0&&this._syncCalls>y)return void(this._syncCalls=0);if(this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let m;for(this._isSyncWriting=!0;m=this._writeBuffer.shift();){this._action(m);const o=this._callbacks.shift();o&&o()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(g,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+=g.length,this._writeBuffer.push(g),this._callbacks.push(y),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(y)}_innerWrite(g=0,y=!0){const m=g||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const o=this._writeBuffer[this._bufferOffset],h=this._action(o,y);if(h){const c=f=>Date.now()-m>=12?setTimeout(()=>this._innerWrite(0,f)):this._innerWrite(m,f);return void h.catch(f=>(queueMicrotask(()=>{throw f}),Promise.resolve(!1))).then(c)}const s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=o.length,Date.now()-m>=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()}}n.WriteBuffer=l},5941:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.toRgbString=n.parseColor=void 0;const a=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,u=/^[\da-f]+$/;function d(l,p){const g=l.toString(16),y=g.length<2?"0"+g:g;switch(p){case 4:return g[0];case 8:return y;case 12:return(y+y).slice(0,3);default:return y+y}}n.parseColor=function(l){if(!l)return;let p=l.toLowerCase();if(p.indexOf("rgb:")===0){p=p.slice(4);const g=a.exec(p);if(g){const y=g[1]?15:g[4]?255:g[7]?4095:65535;return[Math.round(parseInt(g[1]||g[4]||g[7]||g[10],16)/y*255),Math.round(parseInt(g[2]||g[5]||g[8]||g[11],16)/y*255),Math.round(parseInt(g[3]||g[6]||g[9]||g[12],16)/y*255)]}}else if(p.indexOf("#")===0&&(p=p.slice(1),u.exec(p)&&[3,6,9,12].includes(p.length))){const g=p.length/3,y=[0,0,0];for(let m=0;m<3;++m){const o=parseInt(p.slice(g*m,g*m+g),16);y[m]=g===1?o<<4:g===2?o:g===3?o>>4:o>>8}return y}},n.toRgbString=function(l,p=16){const[g,y,m]=l;return`rgb:${d(g,p)}/${d(y,p)}/${d(m,p)}`}},5770:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.PAYLOAD_LIMIT=void 0,n.PAYLOAD_LIMIT=1e7},6351:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DcsHandler=n.DcsParser=void 0;const u=a(482),d=a(8742),l=a(5770),p=[];n.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,m){this._handlers[y]===void 0&&(this._handlers[y]=[]);const o=this._handlers[y];return o.push(m),{dispose:()=>{const h=o.indexOf(m);h!==-1&&o.splice(h,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,m){if(this.reset(),this._ident=y,this._active=this._handlers[y]||p,this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].hook(m);else this._handlerFb(this._ident,"HOOK",m)}put(y,m,o){if(this._active.length)for(let h=this._active.length-1;h>=0;h--)this._active[h].put(y,m,o);else this._handlerFb(this._ident,"PUT",(0,u.utf32ToString)(y,m,o))}unhook(y,m=!0){if(this._active.length){let o=!1,h=this._active.length-1,s=!1;if(this._stack.paused&&(h=this._stack.loopPosition-1,o=m,s=this._stack.fallThrough,this._stack.paused=!1),!s&&o===!1){for(;h>=0&&(o=this._active[h].unhook(y),o!==!0);h--)if(o instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=h,this._stack.fallThrough=!1,o;h--}for(;h>=0;h--)if(o=this._active[h].unhook(!1),o instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=h,this._stack.fallThrough=!0,o}else this._handlerFb(this._ident,"UNHOOK",y);this._active=p,this._ident=0}};const g=new d.Params;g.addParam(0),n.DcsHandler=class{constructor(y){this._handler=y,this._data="",this._params=g,this._hitLimit=!1}hook(y){this._params=y.length>1||y.params[0]?y.clone():g,this._data="",this._hitLimit=!1}put(y,m,o){this._hitLimit||(this._data+=(0,u.utf32ToString)(y,m,o),this._data.length>l.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(y){let m=!1;if(this._hitLimit)m=!1;else if(y&&(m=this._handler(this._data,this._params),m instanceof Promise))return m.then(o=>(this._params=g,this._data="",this._hitLimit=!1,o));return this._params=g,this._data="",this._hitLimit=!1,m}}},2015:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.EscapeSequenceParser=n.VT500_TRANSITION_TABLE=n.TransitionTable=void 0;const u=a(844),d=a(8742),l=a(6242),p=a(6351);class g{constructor(h){this.table=new Uint8Array(h)}setDefault(h,s){this.table.fill(h<<4|s)}add(h,s,c,f){this.table[s<<8|h]=c<<4|f}addMany(h,s,c,f){for(let S=0;S<h.length;S++)this.table[s<<8|h[S]]=c<<4|f}}n.TransitionTable=g;const y=160;n.VT500_TRANSITION_TABLE=function(){const o=new g(4095),h=Array.apply(null,Array(256)).map((w,v)=>v),s=(w,v)=>h.slice(w,v),c=s(32,127),f=s(0,24);f.push(25),f.push.apply(f,s(28,32));const S=s(0,14);let b;for(b in o.setDefault(1,0),o.addMany(c,0,2,0),S)o.addMany([24,26,153,154],b,3,0),o.addMany(s(128,144),b,3,0),o.addMany(s(144,152),b,3,0),o.add(156,b,0,0),o.add(27,b,11,1),o.add(157,b,4,8),o.addMany([152,158,159],b,0,7),o.add(155,b,11,3),o.add(144,b,11,9);return o.addMany(f,0,3,0),o.addMany(f,1,3,1),o.add(127,1,0,1),o.addMany(f,8,0,8),o.addMany(f,3,3,3),o.add(127,3,0,3),o.addMany(f,4,3,4),o.add(127,4,0,4),o.addMany(f,6,3,6),o.addMany(f,5,3,5),o.add(127,5,0,5),o.addMany(f,2,3,2),o.add(127,2,0,2),o.add(93,1,4,8),o.addMany(c,8,5,8),o.add(127,8,5,8),o.addMany([156,27,24,26,7],8,6,0),o.addMany(s(28,32),8,0,8),o.addMany([88,94,95],1,0,7),o.addMany(c,7,0,7),o.addMany(f,7,0,7),o.add(156,7,0,0),o.add(127,7,0,7),o.add(91,1,11,3),o.addMany(s(64,127),3,7,0),o.addMany(s(48,60),3,8,4),o.addMany([60,61,62,63],3,9,4),o.addMany(s(48,60),4,8,4),o.addMany(s(64,127),4,7,0),o.addMany([60,61,62,63],4,0,6),o.addMany(s(32,64),6,0,6),o.add(127,6,0,6),o.addMany(s(64,127),6,0,0),o.addMany(s(32,48),3,9,5),o.addMany(s(32,48),5,9,5),o.addMany(s(48,64),5,0,6),o.addMany(s(64,127),5,7,0),o.addMany(s(32,48),4,9,5),o.addMany(s(32,48),1,9,2),o.addMany(s(32,48),2,9,2),o.addMany(s(48,127),2,10,0),o.addMany(s(48,80),1,10,0),o.addMany(s(81,88),1,10,0),o.addMany([89,90,92],1,10,0),o.addMany(s(96,127),1,10,0),o.add(80,1,11,9),o.addMany(f,9,0,9),o.add(127,9,0,9),o.addMany(s(28,32),9,0,9),o.addMany(s(32,48),9,9,12),o.addMany(s(48,60),9,8,10),o.addMany([60,61,62,63],9,9,10),o.addMany(f,11,0,11),o.addMany(s(32,128),11,0,11),o.addMany(s(28,32),11,0,11),o.addMany(f,10,0,10),o.add(127,10,0,10),o.addMany(s(28,32),10,0,10),o.addMany(s(48,60),10,8,10),o.addMany([60,61,62,63],10,0,11),o.addMany(s(32,48),10,9,12),o.addMany(f,12,0,12),o.add(127,12,0,12),o.addMany(s(28,32),12,0,12),o.addMany(s(32,48),12,9,12),o.addMany(s(48,64),12,0,11),o.addMany(s(64,127),12,12,13),o.addMany(s(64,127),10,12,13),o.addMany(s(64,127),9,12,13),o.addMany(f,13,13,13),o.addMany(c,13,13,13),o.add(127,13,0,13),o.addMany([27,156,24,26],13,14,0),o.add(y,0,2,0),o.add(y,8,5,8),o.add(y,6,0,6),o.add(y,11,0,11),o.add(y,13,13,13),o}();class m extends u.Disposable{constructor(h=n.VT500_TRANSITION_TABLE){super(),this._transitions=h,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new d.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(s,c,f)=>{},this._executeHandlerFb=s=>{},this._csiHandlerFb=(s,c)=>{},this._escHandlerFb=s=>{},this._errorHandlerFb=s=>s,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,u.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new l.OscParser),this._dcsParser=this.register(new p.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(h,s=[64,126]){let c=0;if(h.prefix){if(h.prefix.length>1)throw new Error("only one byte as prefix supported");if(c=h.prefix.charCodeAt(0),c&&60>c||c>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(h.intermediates){if(h.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let S=0;S<h.intermediates.length;++S){const b=h.intermediates.charCodeAt(S);if(32>b||b>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");c<<=8,c|=b}}if(h.final.length!==1)throw new Error("final must be a single byte");const f=h.final.charCodeAt(0);if(s[0]>f||f>s[1])throw new Error(`final must be in range ${s[0]} .. ${s[1]}`);return c<<=8,c|=f,c}identToString(h){const s=[];for(;h;)s.push(String.fromCharCode(255&h)),h>>=8;return s.reverse().join("")}setPrintHandler(h){this._printHandler=h}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(h,s){const c=this._identifier(h,[48,126]);this._escHandlers[c]===void 0&&(this._escHandlers[c]=[]);const f=this._escHandlers[c];return f.push(s),{dispose:()=>{const S=f.indexOf(s);S!==-1&&f.splice(S,1)}}}clearEscHandler(h){this._escHandlers[this._identifier(h,[48,126])]&&delete this._escHandlers[this._identifier(h,[48,126])]}setEscHandlerFallback(h){this._escHandlerFb=h}setExecuteHandler(h,s){this._executeHandlers[h.charCodeAt(0)]=s}clearExecuteHandler(h){this._executeHandlers[h.charCodeAt(0)]&&delete this._executeHandlers[h.charCodeAt(0)]}setExecuteHandlerFallback(h){this._executeHandlerFb=h}registerCsiHandler(h,s){const c=this._identifier(h);this._csiHandlers[c]===void 0&&(this._csiHandlers[c]=[]);const f=this._csiHandlers[c];return f.push(s),{dispose:()=>{const S=f.indexOf(s);S!==-1&&f.splice(S,1)}}}clearCsiHandler(h){this._csiHandlers[this._identifier(h)]&&delete this._csiHandlers[this._identifier(h)]}setCsiHandlerFallback(h){this._csiHandlerFb=h}registerDcsHandler(h,s){return this._dcsParser.registerHandler(this._identifier(h),s)}clearDcsHandler(h){this._dcsParser.clearHandler(this._identifier(h))}setDcsHandlerFallback(h){this._dcsParser.setHandlerFallback(h)}registerOscHandler(h,s){return this._oscParser.registerHandler(h,s)}clearOscHandler(h){this._oscParser.clearHandler(h)}setOscHandlerFallback(h){this._oscParser.setHandlerFallback(h)}setErrorHandler(h){this._errorHandler=h}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(h,s,c,f,S){this._parseStack.state=h,this._parseStack.handlers=s,this._parseStack.handlerPos=c,this._parseStack.transition=f,this._parseStack.chunkPos=S}parse(h,s,c){let f,S=0,b=0,w=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,w=this._parseStack.chunkPos+1;else{if(c===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const v=this._parseStack.handlers;let k=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(c===!1&&k>-1){for(;k>=0&&(f=v[k](this._params),f!==!0);k--)if(f instanceof Promise)return this._parseStack.handlerPos=k,f}this._parseStack.handlers=[];break;case 4:if(c===!1&&k>-1){for(;k>=0&&(f=v[k](),f!==!0);k--)if(f instanceof Promise)return this._parseStack.handlerPos=k,f}this._parseStack.handlers=[];break;case 6:if(S=h[this._parseStack.chunkPos],f=this._dcsParser.unhook(S!==24&&S!==26,c),f)return f;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(S=h[this._parseStack.chunkPos],f=this._oscParser.end(S!==24&&S!==26,c),f)return f;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,w=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let v=w;v<s;++v){switch(S=h[v],b=this._transitions.table[this.currentState<<8|(S<160?S:y)],b>>4){case 2:for(let L=v+1;;++L){if(L>=s||(S=h[L])<32||S>126&&S<y){this._printHandler(h,v,L),v=L-1;break}if(++L>=s||(S=h[L])<32||S>126&&S<y){this._printHandler(h,v,L),v=L-1;break}if(++L>=s||(S=h[L])<32||S>126&&S<y){this._printHandler(h,v,L),v=L-1;break}if(++L>=s||(S=h[L])<32||S>126&&S<y){this._printHandler(h,v,L),v=L-1;break}}break;case 3:this._executeHandlers[S]?this._executeHandlers[S]():this._executeHandlerFb(S),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:v,code:S,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const k=this._csiHandlers[this._collect<<8|S];let A=k?k.length-1:-1;for(;A>=0&&(f=k[A](this._params),f!==!0);A--)if(f instanceof Promise)return this._preserveStack(3,k,A,b,v),f;A<0&&this._csiHandlerFb(this._collect<<8|S,this._params),this.precedingJoinState=0;break;case 8:do switch(S){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(S-48)}while(++v<s&&(S=h[v])>47&&S<60);v--;break;case 9:this._collect<<=8,this._collect|=S;break;case 10:const O=this._escHandlers[this._collect<<8|S];let I=O?O.length-1:-1;for(;I>=0&&(f=O[I](),f!==!0);I--)if(f instanceof Promise)return this._preserveStack(4,O,I,b,v),f;I<0&&this._escHandlerFb(this._collect<<8|S),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|S,this._params);break;case 13:for(let L=v+1;;++L)if(L>=s||(S=h[L])===24||S===26||S===27||S>127&&S<y){this._dcsParser.put(h,v,L),v=L-1;break}break;case 14:if(f=this._dcsParser.unhook(S!==24&&S!==26),f)return this._preserveStack(6,[],0,b,v),f;S===27&&(b|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let L=v+1;;L++)if(L>=s||(S=h[L])<32||S>127&&S<y){this._oscParser.put(h,v,L),v=L-1;break}break;case 6:if(f=this._oscParser.end(S!==24&&S!==26),f)return this._preserveStack(5,[],0,b,v),f;S===27&&(b|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&b}}}n.EscapeSequenceParser=m},6242:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.OscHandler=n.OscParser=void 0;const u=a(5770),d=a(482),l=[];n.OscParser=class{constructor(){this._state=0,this._active=l,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(p,g){this._handlers[p]===void 0&&(this._handlers[p]=[]);const y=this._handlers[p];return y.push(g),{dispose:()=>{const m=y.indexOf(g);m!==-1&&y.splice(m,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=l}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=l,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||l,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,g,y){if(this._active.length)for(let m=this._active.length-1;m>=0;m--)this._active[m].put(p,g,y);else this._handlerFb(this._id,"PUT",(0,d.utf32ToString)(p,g,y))}start(){this.reset(),this._state=1}put(p,g,y){if(this._state!==3){if(this._state===1)for(;g<y;){const m=p[g++];if(m===59){this._state=2,this._start();break}if(m<48||57<m)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+m-48}this._state===2&&y-g>0&&this._put(p,g,y)}}end(p,g=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let y=!1,m=this._active.length-1,o=!1;if(this._stack.paused&&(m=this._stack.loopPosition-1,y=g,o=this._stack.fallThrough,this._stack.paused=!1),!o&&y===!1){for(;m>=0&&(y=this._active[m].end(p),y!==!0);m--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!1,y;m--}for(;m>=0;m--)if(y=this._active[m].end(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!0,y}else this._handlerFb(this._id,"END",p);this._active=l,this._id=-1,this._state=0}}},n.OscHandler=class{constructor(p){this._handler=p,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(p,g,y){this._hitLimit||(this._data+=(0,d.utf32ToString)(p,g,y),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(p){let g=!1;if(this._hitLimit)g=!1;else if(p&&(g=this._handler(this._data),g instanceof Promise))return g.then(y=>(this._data="",this._hitLimit=!1,y));return this._data="",this._hitLimit=!1,g}}},8742:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Params=void 0;const a=2147483647;class u{static fromArray(l){const p=new u;if(!l.length)return p;for(let g=Array.isArray(l[0])?1:0;g<l.length;++g){const y=l[g];if(Array.isArray(y))for(let m=0;m<y.length;++m)p.addSubParam(y[m]);else p.addParam(y)}return p}constructor(l=32,p=32){if(this.maxLength=l,this.maxSubParamsLength=p,p>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(l),this.length=0,this._subParams=new Int32Array(p),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(l),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const l=new u(this.maxLength,this.maxSubParamsLength);return l.params.set(this.params),l.length=this.length,l._subParams.set(this._subParams),l._subParamsLength=this._subParamsLength,l._subParamsIdx.set(this._subParamsIdx),l._rejectDigits=this._rejectDigits,l._rejectSubDigits=this._rejectSubDigits,l._digitIsSub=this._digitIsSub,l}toArray(){const l=[];for(let p=0;p<this.length;++p){l.push(this.params[p]);const g=this._subParamsIdx[p]>>8,y=255&this._subParamsIdx[p];y-g>0&&l.push(Array.prototype.slice.call(this._subParams,g,y))}return l}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(l){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(l<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=l>a?a:l}}addSubParam(l){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(l<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=l>a?a:l,this._subParamsIdx[this.length-1]++}}hasSubParams(l){return(255&this._subParamsIdx[l])-(this._subParamsIdx[l]>>8)>0}getSubParams(l){const p=this._subParamsIdx[l]>>8,g=255&this._subParamsIdx[l];return g-p>0?this._subParams.subarray(p,g):null}getSubParamsAll(){const l={};for(let p=0;p<this.length;++p){const g=this._subParamsIdx[p]>>8,y=255&this._subParamsIdx[p];y-g>0&&(l[p]=this._subParams.slice(g,y))}return l}addDigit(l){let p;if(this._rejectDigits||!(p=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const g=this._digitIsSub?this._subParams:this.params,y=g[p-1];g[p-1]=~y?Math.min(10*y+l,a):l}}n.Params=u},5741:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.AddonManager=void 0,n.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let a=this._addons.length-1;a>=0;a--)this._addons[a].instance.dispose()}loadAddon(a,u){const d={instance:u,dispose:u.dispose,isDisposed:!1};this._addons.push(d),u.dispose=()=>this._wrappedAddonDispose(d),u.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let u=-1;for(let d=0;d<this._addons.length;d++)if(this._addons[d]===a){u=d;break}if(u===-1)throw new Error("Could not dispose an addon that has not been loaded");a.isDisposed=!0,a.dispose.apply(a.instance),this._addons.splice(u,1)}}},8771:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferApiView=void 0;const u=a(3785),d=a(511);n.BufferApiView=class{constructor(l,p){this._buffer=l,this.type=p}init(l){return this._buffer=l,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(l){const p=this._buffer.lines.get(l);if(p)return new u.BufferLineApiView(p)}getNullCell(){return new d.CellData}}},3785:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferLineApiView=void 0;const u=a(511);n.BufferLineApiView=class{constructor(d){this._line=d}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(d,l){if(!(d<0||d>=this._line.length))return l?(this._line.loadCell(d,l),l):this._line.loadCell(d,new u.CellData)}translateToString(d,l,p){return this._line.translateToString(d,l,p)}}},8285:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferNamespaceApi=void 0;const u=a(8771),d=a(8460),l=a(844);class p extends l.Disposable{constructor(y){super(),this._core=y,this._onBufferChange=this.register(new d.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new u.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new u.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)}}n.BufferNamespaceApi=p},7975:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ParserApi=void 0,n.ParserApi=class{constructor(a){this._core=a}registerCsiHandler(a,u){return this._core.registerCsiHandler(a,d=>u(d.toArray()))}addCsiHandler(a,u){return this.registerCsiHandler(a,u)}registerDcsHandler(a,u){return this._core.registerDcsHandler(a,(d,l)=>u(d,l.toArray()))}addDcsHandler(a,u){return this.registerDcsHandler(a,u)}registerEscHandler(a,u){return this._core.registerEscHandler(a,u)}addEscHandler(a,u){return this.registerEscHandler(a,u)}registerOscHandler(a,u){return this._core.registerOscHandler(a,u)}addOscHandler(a,u){return this.registerOscHandler(a,u)}}},7090:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.UnicodeApi=void 0,n.UnicodeApi=class{constructor(a){this._core=a}register(a){this._core.unicodeService.register(a)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(a){this._core.unicodeService.activeVersion=a}}},744:function(E,n,a){var u=this&&this.__decorate||function(o,h,s,c){var f,S=arguments.length,b=S<3?h:c===null?c=Object.getOwnPropertyDescriptor(h,s):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(o,h,s,c);else for(var w=o.length-1;w>=0;w--)(f=o[w])&&(b=(S<3?f(b):S>3?f(h,s,b):f(h,s))||b);return S>3&&b&&Object.defineProperty(h,s,b),b},d=this&&this.__param||function(o,h){return function(s,c){h(s,c,o)}};Object.defineProperty(n,"__esModule",{value:!0}),n.BufferService=n.MINIMUM_ROWS=n.MINIMUM_COLS=void 0;const l=a(8460),p=a(844),g=a(5295),y=a(2585);n.MINIMUM_COLS=2,n.MINIMUM_ROWS=1;let m=n.BufferService=class extends p.Disposable{get buffer(){return this.buffers.active}constructor(o){super(),this.isUserScrolling=!1,this._onResize=this.register(new l.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new l.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(o.rawOptions.cols||0,n.MINIMUM_COLS),this.rows=Math.max(o.rawOptions.rows||0,n.MINIMUM_ROWS),this.buffers=this.register(new g.BufferSet(o,this))}resize(o,h){this.cols=o,this.rows=h,this.buffers.resize(o,h),this._onResize.fire({cols:o,rows:h})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(o,h=!1){const s=this.buffer;let c;c=this._cachedBlankLine,c&&c.length===this.cols&&c.getFg(0)===o.fg&&c.getBg(0)===o.bg||(c=s.getBlankLine(o,h),this._cachedBlankLine=c),c.isWrapped=h;const f=s.ybase+s.scrollTop,S=s.ybase+s.scrollBottom;if(s.scrollTop===0){const b=s.lines.isFull;S===s.lines.length-1?b?s.lines.recycle().copyFrom(c):s.lines.push(c.clone()):s.lines.splice(S+1,0,c.clone()),b?this.isUserScrolling&&(s.ydisp=Math.max(s.ydisp-1,0)):(s.ybase++,this.isUserScrolling||s.ydisp++)}else{const b=S-f+1;s.lines.shiftElements(f+1,b-1,-1),s.lines.set(S,c.clone())}this.isUserScrolling||(s.ydisp=s.ybase),this._onScroll.fire(s.ydisp)}scrollLines(o,h,s){const c=this.buffer;if(o<0){if(c.ydisp===0)return;this.isUserScrolling=!0}else o+c.ydisp>=c.ybase&&(this.isUserScrolling=!1);const f=c.ydisp;c.ydisp=Math.max(Math.min(c.ydisp+o,c.ybase),0),f!==c.ydisp&&(h||this._onScroll.fire(c.ydisp))}};n.BufferService=m=u([d(0,y.IOptionsService)],m)},7994:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CharsetService=void 0,n.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(a){this.glevel=a,this.charset=this._charsets[a]}setgCharset(a,u){this._charsets[a]=u,this.glevel===a&&(this.charset=u)}}},1753:function(E,n,a){var u=this&&this.__decorate||function(c,f,S,b){var w,v=arguments.length,k=v<3?f:b===null?b=Object.getOwnPropertyDescriptor(f,S):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(c,f,S,b);else for(var A=c.length-1;A>=0;A--)(w=c[A])&&(k=(v<3?w(k):v>3?w(f,S,k):w(f,S))||k);return v>3&&k&&Object.defineProperty(f,S,k),k},d=this&&this.__param||function(c,f){return function(S,b){f(S,b,c)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CoreMouseService=void 0;const l=a(2585),p=a(8460),g=a(844),y={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:c=>c.button!==4&&c.action===1&&(c.ctrl=!1,c.alt=!1,c.shift=!1,!0)},VT200:{events:19,restrict:c=>c.action!==32},DRAG:{events:23,restrict:c=>c.action!==32||c.button!==3},ANY:{events:31,restrict:c=>!0}};function m(c,f){let S=(c.ctrl?16:0)|(c.shift?4:0)|(c.alt?8:0);return c.button===4?(S|=64,S|=c.action):(S|=3&c.button,4&c.button&&(S|=64),8&c.button&&(S|=128),c.action===32?S|=32:c.action!==0||f||(S|=3)),S}const o=String.fromCharCode,h={DEFAULT:c=>{const f=[m(c,!1)+32,c.col+32,c.row+32];return f[0]>255||f[1]>255||f[2]>255?"":`\x1B[M${o(f[0])}${o(f[1])}${o(f[2])}`},SGR:c=>{const f=c.action===0&&c.button!==4?"m":"M";return`\x1B[<${m(c,!0)};${c.col};${c.row}${f}`},SGR_PIXELS:c=>{const f=c.action===0&&c.button!==4?"m":"M";return`\x1B[<${m(c,!0)};${c.x};${c.y}${f}`}};let s=n.CoreMouseService=class extends g.Disposable{constructor(c,f){super(),this._bufferService=c,this._coreService=f,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 S of Object.keys(y))this.addProtocol(S,y[S]);for(const S of Object.keys(h))this.addEncoding(S,h[S]);this.reset()}addProtocol(c,f){this._protocols[c]=f}addEncoding(c,f){this._encodings[c]=f}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(c){if(!this._protocols[c])throw new Error(`unknown protocol "${c}"`);this._activeProtocol=c,this._onProtocolChange.fire(this._protocols[c].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(c){if(!this._encodings[c])throw new Error(`unknown encoding "${c}"`);this._activeEncoding=c}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(c){if(c.col<0||c.col>=this._bufferService.cols||c.row<0||c.row>=this._bufferService.rows||c.button===4&&c.action===32||c.button===3&&c.action!==32||c.button!==4&&(c.action===2||c.action===3)||(c.col++,c.row++,c.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,c,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(c))return!1;const f=this._encodings[this._activeEncoding](c);return f&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(f):this._coreService.triggerDataEvent(f,!0)),this._lastEvent=c,!0}explainEvents(c){return{down:!!(1&c),up:!!(2&c),drag:!!(4&c),move:!!(8&c),wheel:!!(16&c)}}_equalEvents(c,f,S){if(S){if(c.x!==f.x||c.y!==f.y)return!1}else if(c.col!==f.col||c.row!==f.row)return!1;return c.button===f.button&&c.action===f.action&&c.ctrl===f.ctrl&&c.alt===f.alt&&c.shift===f.shift}};n.CoreMouseService=s=u([d(0,l.IBufferService),d(1,l.ICoreService)],s)},6975:function(E,n,a){var u=this&&this.__decorate||function(s,c,f,S){var b,w=arguments.length,v=w<3?c:S===null?S=Object.getOwnPropertyDescriptor(c,f):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(s,c,f,S);else for(var k=s.length-1;k>=0;k--)(b=s[k])&&(v=(w<3?b(v):w>3?b(c,f,v):b(c,f))||v);return w>3&&v&&Object.defineProperty(c,f,v),v},d=this&&this.__param||function(s,c){return function(f,S){c(f,S,s)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CoreService=void 0;const l=a(1439),p=a(8460),g=a(844),y=a(2585),m=Object.freeze({insertMode:!1}),o=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let h=n.CoreService=class extends g.Disposable{constructor(s,c,f){super(),this._bufferService=s,this._logService=c,this._optionsService=f,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,l.clone)(m),this.decPrivateModes=(0,l.clone)(o)}reset(){this.modes=(0,l.clone)(m),this.decPrivateModes=(0,l.clone)(o)}triggerDataEvent(s,c=!1){if(this._optionsService.rawOptions.disableStdin)return;const f=this._bufferService.buffer;c&&this._optionsService.rawOptions.scrollOnUserInput&&f.ybase!==f.ydisp&&this._onRequestScrollToBottom.fire(),c&&this._onUserInput.fire(),this._logService.debug(`sending data "${s}"`,()=>s.split("").map(S=>S.charCodeAt(0))),this._onData.fire(s)}triggerBinaryEvent(s){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${s}"`,()=>s.split("").map(c=>c.charCodeAt(0))),this._onBinary.fire(s))}};n.CoreService=h=u([d(0,y.IBufferService),d(1,y.ILogService),d(2,y.IOptionsService)],h)},9074:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DecorationService=void 0;const u=a(8055),d=a(8460),l=a(844),p=a(6106);let g=0,y=0;class m extends l.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new p.SortedList(s=>s==null?void 0:s.marker.line),this._onDecorationRegistered=this.register(new d.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new d.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,l.toDisposable)(()=>this.reset()))}registerDecoration(s){if(s.marker.isDisposed)return;const c=new o(s);if(c){const f=c.marker.onDispose(()=>c.dispose());c.onDispose(()=>{c&&(this._decorations.delete(c)&&this._onDecorationRemoved.fire(c),f.dispose())}),this._decorations.insert(c),this._onDecorationRegistered.fire(c)}return c}reset(){for(const s of this._decorations.values())s.dispose();this._decorations.clear()}*getDecorationsAtCell(s,c,f){let S=0,b=0;for(const w of this._decorations.getKeyIterator(c))S=w.options.x??0,b=S+(w.options.width??1),s>=S&&s<b&&(!f||(w.options.layer??"bottom")===f)&&(yield w)}forEachDecorationAtCell(s,c,f,S){this._decorations.forEachByKey(c,b=>{g=b.options.x??0,y=g+(b.options.width??1),s>=g&&s<y&&(!f||(b.options.layer??"bottom")===f)&&S(b)})}}n.DecorationService=m;class o extends l.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=u.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=u.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(s){super(),this.options=s,this.onRenderEmitter=this.register(new d.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new d.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=s.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.InstantiationService=n.ServiceCollection=void 0;const u=a(2585),d=a(8343);class l{constructor(...g){this._entries=new Map;for(const[y,m]of g)this.set(y,m)}set(g,y){const m=this._entries.get(g);return this._entries.set(g,y),m}forEach(g){for(const[y,m]of this._entries.entries())g(y,m)}has(g){return this._entries.has(g)}get(g){return this._entries.get(g)}}n.ServiceCollection=l,n.InstantiationService=class{constructor(){this._services=new l,this._services.set(u.IInstantiationService,this)}setService(p,g){this._services.set(p,g)}getService(p){return this._services.get(p)}createInstance(p,...g){const y=(0,d.getServiceDependencies)(p).sort((h,s)=>h.index-s.index),m=[];for(const h of y){const s=this._services.get(h.id);if(!s)throw new Error(`[createInstance] ${p.name} depends on UNKNOWN service ${h.id}.`);m.push(s)}const o=y.length>0?y[0].index:g.length;if(g.length!==o)throw new Error(`[createInstance] First service dependency of ${p.name} at position ${o+1} conflicts with ${g.length} static arguments`);return new p(...g,...m)}}},7866:function(E,n,a){var u=this&&this.__decorate||function(o,h,s,c){var f,S=arguments.length,b=S<3?h:c===null?c=Object.getOwnPropertyDescriptor(h,s):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(o,h,s,c);else for(var w=o.length-1;w>=0;w--)(f=o[w])&&(b=(S<3?f(b):S>3?f(h,s,b):f(h,s))||b);return S>3&&b&&Object.defineProperty(h,s,b),b},d=this&&this.__param||function(o,h){return function(s,c){h(s,c,o)}};Object.defineProperty(n,"__esModule",{value:!0}),n.traceCall=n.setTraceLogger=n.LogService=void 0;const l=a(844),p=a(2585),g={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,m=n.LogService=class extends l.Disposable{get logLevel(){return this._logLevel}constructor(o){super(),this._optionsService=o,this._logLevel=p.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),y=this}_updateLogLevel(){this._logLevel=g[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(o){for(let h=0;h<o.length;h++)typeof o[h]=="function"&&(o[h]=o[h]())}_log(o,h,s){this._evalLazyOptionalParams(s),o.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+h,...s)}trace(o,...h){var s;this._logLevel<=p.LogLevelEnum.TRACE&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.trace.bind(this._optionsService.options.logger))??console.log,o,h)}debug(o,...h){var s;this._logLevel<=p.LogLevelEnum.DEBUG&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.debug.bind(this._optionsService.options.logger))??console.log,o,h)}info(o,...h){var s;this._logLevel<=p.LogLevelEnum.INFO&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.info.bind(this._optionsService.options.logger))??console.info,o,h)}warn(o,...h){var s;this._logLevel<=p.LogLevelEnum.WARN&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.warn.bind(this._optionsService.options.logger))??console.warn,o,h)}error(o,...h){var s;this._logLevel<=p.LogLevelEnum.ERROR&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.error.bind(this._optionsService.options.logger))??console.error,o,h)}};n.LogService=m=u([d(0,p.IOptionsService)],m),n.setTraceLogger=function(o){y=o},n.traceCall=function(o,h,s){if(typeof s.value!="function")throw new Error("not supported");const c=s.value;s.value=function(...f){if(y.logLevel!==p.LogLevelEnum.TRACE)return c.apply(this,f);y.trace(`GlyphRenderer#${c.name}(${f.map(b=>JSON.stringify(b)).join(", ")})`);const S=c.apply(this,f);return y.trace(`GlyphRenderer#${c.name} return`,S),S}}},7302:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.OptionsService=n.DEFAULT_OPTIONS=void 0;const u=a(8460),d=a(844),l=a(6114);n.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:l.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const p=["normal","bold","100","200","300","400","500","600","700","800","900"];class g extends d.Disposable{constructor(m){super(),this._onOptionChange=this.register(new u.EventEmitter),this.onOptionChange=this._onOptionChange.event;const o={...n.DEFAULT_OPTIONS};for(const h in m)if(h in o)try{const s=m[h];o[h]=this._sanitizeAndValidateOption(h,s)}catch(s){console.error(s)}this.rawOptions=o,this.options={...o},this._setupOptions(),this.register((0,d.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(m,o){return this.onOptionChange(h=>{h===m&&o(this.rawOptions[m])})}onMultipleOptionChange(m,o){return this.onOptionChange(h=>{m.indexOf(h)!==-1&&o()})}_setupOptions(){const m=h=>{if(!(h in n.DEFAULT_OPTIONS))throw new Error(`No option with key "${h}"`);return this.rawOptions[h]},o=(h,s)=>{if(!(h in n.DEFAULT_OPTIONS))throw new Error(`No option with key "${h}"`);s=this._sanitizeAndValidateOption(h,s),this.rawOptions[h]!==s&&(this.rawOptions[h]=s,this._onOptionChange.fire(h))};for(const h in this.rawOptions){const s={get:m.bind(this,h),set:o.bind(this,h)};Object.defineProperty(this.options,h,s)}}_sanitizeAndValidateOption(m,o){switch(m){case"cursorStyle":if(o||(o=n.DEFAULT_OPTIONS[m]),!function(h){return h==="block"||h==="underline"||h==="bar"}(o))throw new Error(`"${o}" is not a valid value for ${m}`);break;case"wordSeparator":o||(o=n.DEFAULT_OPTIONS[m]);break;case"fontWeight":case"fontWeightBold":if(typeof o=="number"&&1<=o&&o<=1e3)break;o=p.includes(o)?o:n.DEFAULT_OPTIONS[m];break;case"cursorWidth":o=Math.floor(o);case"lineHeight":case"tabStopWidth":if(o<1)throw new Error(`${m} cannot be less than 1, value: ${o}`);break;case"minimumContrastRatio":o=Math.max(1,Math.min(21,Math.round(10*o)/10));break;case"scrollback":if((o=Math.min(o,4294967295))<0)throw new Error(`${m} cannot be less than 0, value: ${o}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(o<=0)throw new Error(`${m} cannot be less than or equal to 0, value: ${o}`);break;case"rows":case"cols":if(!o&&o!==0)throw new Error(`${m} must be numeric, value: ${o}`);break;case"windowsPty":o=o??{}}return o}}n.OptionsService=g},2660:function(E,n,a){var u=this&&this.__decorate||function(g,y,m,o){var h,s=arguments.length,c=s<3?y:o===null?o=Object.getOwnPropertyDescriptor(y,m):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(g,y,m,o);else for(var f=g.length-1;f>=0;f--)(h=g[f])&&(c=(s<3?h(c):s>3?h(y,m,c):h(y,m))||c);return s>3&&c&&Object.defineProperty(y,m,c),c},d=this&&this.__param||function(g,y){return function(m,o){y(m,o,g)}};Object.defineProperty(n,"__esModule",{value:!0}),n.OscLinkService=void 0;const l=a(2585);let p=n.OscLinkService=class{constructor(g){this._bufferService=g,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(g){const y=this._bufferService.buffer;if(g.id===void 0){const f=y.addMarker(y.ybase+y.y),S={data:g,id:this._nextId++,lines:[f]};return f.onDispose(()=>this._removeMarkerFromLink(S,f)),this._dataByLinkId.set(S.id,S),S.id}const m=g,o=this._getEntryIdKey(m),h=this._entriesWithId.get(o);if(h)return this.addLineToLink(h.id,y.ybase+y.y),h.id;const s=y.addMarker(y.ybase+y.y),c={id:this._nextId++,key:this._getEntryIdKey(m),data:m,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(c,s)),this._entriesWithId.set(c.key,c),this._dataByLinkId.set(c.id,c),c.id}addLineToLink(g,y){const m=this._dataByLinkId.get(g);if(m&&m.lines.every(o=>o.line!==y)){const o=this._bufferService.buffer.addMarker(y);m.lines.push(o),o.onDispose(()=>this._removeMarkerFromLink(m,o))}}getLinkData(g){var y;return(y=this._dataByLinkId.get(g))==null?void 0:y.data}_getEntryIdKey(g){return`${g.id};;${g.uri}`}_removeMarkerFromLink(g,y){const m=g.lines.indexOf(y);m!==-1&&(g.lines.splice(m,1),g.lines.length===0&&(g.data.id!==void 0&&this._entriesWithId.delete(g.key),this._dataByLinkId.delete(g.id)))}};n.OscLinkService=p=u([d(0,l.IBufferService)],p)},8343:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createDecorator=n.getServiceDependencies=n.serviceRegistry=void 0;const a="di$target",u="di$dependencies";n.serviceRegistry=new Map,n.getServiceDependencies=function(d){return d[u]||[]},n.createDecorator=function(d){if(n.serviceRegistry.has(d))return n.serviceRegistry.get(d);const l=function(p,g,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(m,o,h){o[a]===o?o[u].push({id:m,index:h}):(o[u]=[{id:m,index:h}],o[a]=o)})(l,p,y)};return l.toString=()=>d,n.serviceRegistry.set(d,l),l}},2585:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.IDecorationService=n.IUnicodeService=n.IOscLinkService=n.IOptionsService=n.ILogService=n.LogLevelEnum=n.IInstantiationService=n.ICharsetService=n.ICoreService=n.ICoreMouseService=n.IBufferService=void 0;const u=a(8343);var d;n.IBufferService=(0,u.createDecorator)("BufferService"),n.ICoreMouseService=(0,u.createDecorator)("CoreMouseService"),n.ICoreService=(0,u.createDecorator)("CoreService"),n.ICharsetService=(0,u.createDecorator)("CharsetService"),n.IInstantiationService=(0,u.createDecorator)("InstantiationService"),function(l){l[l.TRACE=0]="TRACE",l[l.DEBUG=1]="DEBUG",l[l.INFO=2]="INFO",l[l.WARN=3]="WARN",l[l.ERROR=4]="ERROR",l[l.OFF=5]="OFF"}(d||(n.LogLevelEnum=d={})),n.ILogService=(0,u.createDecorator)("LogService"),n.IOptionsService=(0,u.createDecorator)("OptionsService"),n.IOscLinkService=(0,u.createDecorator)("OscLinkService"),n.IUnicodeService=(0,u.createDecorator)("UnicodeService"),n.IDecorationService=(0,u.createDecorator)("DecorationService")},1480:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.UnicodeService=void 0;const u=a(8460),d=a(225);class l{static extractShouldJoin(g){return(1&g)!=0}static extractWidth(g){return g>>1&3}static extractCharKind(g){return g>>3}static createPropertyValue(g,y,m=!1){return(16777215&g)<<3|(3&y)<<1|(m?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new u.EventEmitter,this.onChange=this._onChange.event;const g=new d.UnicodeV6;this.register(g),this._active=g.version,this._activeProvider=g}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(g){if(!this._providers[g])throw new Error(`unknown Unicode version "${g}"`);this._active=g,this._activeProvider=this._providers[g],this._onChange.fire(g)}register(g){this._providers[g.version]=g}wcwidth(g){return this._activeProvider.wcwidth(g)}getStringCellWidth(g){let y=0,m=0;const o=g.length;for(let h=0;h<o;++h){let s=g.charCodeAt(h);if(55296<=s&&s<=56319){if(++h>=o)return y+this.wcwidth(s);const S=g.charCodeAt(h);56320<=S&&S<=57343?s=1024*(s-55296)+S-56320+65536:y+=this.wcwidth(S)}const c=this.charProperties(s,m);let f=l.extractWidth(c);l.extractShouldJoin(c)&&(f-=l.extractWidth(m)),y+=f,m=c}return y}charProperties(g,y){return this._activeProvider.charProperties(g,y)}}n.UnicodeService=l}},i={};function _(E){var n=i[E];if(n!==void 0)return n.exports;var a=i[E]={exports:{}};return r[E].call(a.exports,a,a.exports,_),a.exports}var C={};return(()=>{var E=C;Object.defineProperty(E,"__esModule",{value:!0}),E.Terminal=void 0;const n=_(9042),a=_(3236),u=_(844),d=_(5741),l=_(8285),p=_(7975),g=_(7090),y=["cols","rows"];class m extends u.Disposable{constructor(h){super(),this._core=this.register(new a.Terminal(h)),this._addonManager=this.register(new d.AddonManager),this._publicOptions={...this._core.options};const s=f=>this._core.options[f],c=(f,S)=>{this._checkReadonlyOptions(f),this._core.options[f]=S};for(const f in this._core.options){const S={get:s.bind(this,f),set:c.bind(this,f)};Object.defineProperty(this._publicOptions,f,S)}}_checkReadonlyOptions(h){if(y.includes(h))throw new Error(`Option "${h}" 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 g.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new l.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const h=this._core.coreService.decPrivateModes;let s="none";switch(this._core.coreMouseService.activeProtocol){case"X10":s="x10";break;case"VT200":s="vt200";break;case"DRAG":s="drag";break;case"ANY":s="any"}return{applicationCursorKeysMode:h.applicationCursorKeys,applicationKeypadMode:h.applicationKeypad,bracketedPasteMode:h.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:s,originMode:h.origin,reverseWraparoundMode:h.reverseWraparound,sendFocusMode:h.sendFocus,wraparoundMode:h.wraparound}}get options(){return this._publicOptions}set options(h){for(const s in h)this._publicOptions[s]=h[s]}blur(){this._core.blur()}focus(){this._core.focus()}input(h,s=!0){this._core.input(h,s)}resize(h,s){this._verifyIntegers(h,s),this._core.resize(h,s)}open(h){this._core.open(h)}attachCustomKeyEventHandler(h){this._core.attachCustomKeyEventHandler(h)}attachCustomWheelEventHandler(h){this._core.attachCustomWheelEventHandler(h)}registerLinkProvider(h){return this._core.registerLinkProvider(h)}registerCharacterJoiner(h){return this._checkProposedApi(),this._core.registerCharacterJoiner(h)}deregisterCharacterJoiner(h){this._checkProposedApi(),this._core.deregisterCharacterJoiner(h)}registerMarker(h=0){return this._verifyIntegers(h),this._core.registerMarker(h)}registerDecoration(h){return this._checkProposedApi(),this._verifyPositiveIntegers(h.x??0,h.width??0,h.height??0),this._core.registerDecoration(h)}hasSelection(){return this._core.hasSelection()}select(h,s,c){this._verifyIntegers(h,s,c),this._core.select(h,s,c)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(h,s){this._verifyIntegers(h,s),this._core.selectLines(h,s)}dispose(){super.dispose()}scrollLines(h){this._verifyIntegers(h),this._core.scrollLines(h)}scrollPages(h){this._verifyIntegers(h),this._core.scrollPages(h)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(h){this._verifyIntegers(h),this._core.scrollToLine(h)}clear(){this._core.clear()}write(h,s){this._core.write(h,s)}writeln(h,s){this._core.write(h),this._core.write(`\r
9
+ `,s)}paste(h){this._core.paste(h)}refresh(h,s){this._verifyIntegers(h,s),this._core.refresh(h,s)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(h){this._addonManager.loadAddon(this,h)}static get strings(){return n}_verifyIntegers(...h){for(const s of h)if(s===1/0||isNaN(s)||s%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...h){for(const s of h)if(s&&(s===1/0||isNaN(s)||s%1!=0||s<0))throw new Error("This API only accepts positive integers")}}E.Terminal=m})(),C})())}(nr)),nr.exports}var Wh=jh();function M(e,t){class r{constructor(_){var C;const E=this;r.init(E,_),(C=E._zod).deferred??(C.deferred=[]);for(const n of E._zod.deferred)n()}static init(_,C){var E;_._zod??(_._zod={}),(E=_._zod).traits??(E.traits=new Set),_._zod.traits.add(e),t(_,C);for(const n in r.prototype)Object.defineProperty(_,n,{value:r.prototype[n].bind(_)});_._zod.constr=r,_._zod.def=C}static[Symbol.hasInstance](_){var C,E;return(E=(C=_==null?void 0:_._zod)==null?void 0:C.traits)==null?void 0:E.has(e)}}return Object.defineProperty(r,"name",{value:e}),r}const Os=Symbol("zod_brand");class $e extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const or={};function oe(e){return e&&Object.assign(or,e),or}function Zh(e){return e}function Uh(e){return e}function Kh(e){}function qh(e){throw new Error}function Vh(e){}function Gh(e){const t=Object.keys(e).filter(i=>typeof e[e[i]]!="number"),r={};for(const i of t)r[i]=e[i];return Object.values(r)}function Qe(e,t="|"){return e.map(r=>At(r)).join(t)}function Is(e,t){return typeof t=="bigint"?t.toString():t}function ye(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Te(e){return e==null}function Lt(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Bs(e,t){const r=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,_=r>i?r:i,C=Number.parseInt(e.toFixed(_).replace(".","")),E=Number.parseInt(t.toFixed(_).replace(".",""));return C%E/10**_}function Pe(e,t,r){Object.defineProperty(e,t,{get(){{const i=r();return e[t]=i,i}},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function ge(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Jh(e,t){return t?t.reduce((r,i)=>r==null?void 0:r[i],e):e}function Xh(e){const t=Object.keys(e),r=t.map(i=>e[i]);return Promise.all(r).then(i=>{const _={};for(let C=0;C<t.length;C++)_[t[C]]=i[C];return _})}function gr(e=10){const t="abcdefghijklmnopqrstuvwxyz";let r="";for(let i=0;i<e;i++)r+=t[Math.floor(Math.random()*t.length)];return r}function Be(e){return JSON.stringify(e)}function Ps(e){return typeof e=="object"&&e!==null}const Ms=ye(()=>{try{return new Function(""),!0}catch{return!1}});function et(e){return typeof e=="object"&&e!==null&&Object.getPrototypeOf(e)===Object.prototype}function Yh(e){let t=0;for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}const Qh=e=>{const t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Ct=new Set(["string","number","symbol"]),zs=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ke(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _e(e,t){return new e._zod.constr(t)}function el(e,t){const r=Array.isArray(e)?{}:e??{};return{checks:Array.isArray(e)?e:t??[],params:r}}function z(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function tl(e){let t;return new Proxy({},{get(r,i,_){return t??(t=e()),Reflect.get(t,i,_)},set(r,i,_,C){return t??(t=e()),Reflect.set(t,i,_,C)},has(r,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(r,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(r,i,_){return t??(t=e()),Reflect.defineProperty(t,i,_)}})}function At(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Oe(e){return Object.keys(e).filter(t=>e[t]._zod.qout==="true")}function rl(e){return Object.keys(e).filter(t=>t.endsWith("?")).map(t=>t.replace(/\?$/,""))}function $s(e){return e.replace(/^\?/,"").replace(/\?$/,"")}function xe(e){const t={},r={},i=[],_=[];for(const[C,E]of Object.entries(e)){C.endsWith("?")&&i.push(C.slice(0,-1)),C.startsWith("?")&&_.push(C.slice(1));const n=$s(C);r[n]=E,t[n]=C}return{shape:r,keyMap:t,optional:i,defaulted:_}}const Hs={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-17976931348623157e292,17976931348623157e292]},Fs={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Tt(e,t){const r={},i=[],_=e._zod.def.shape,C=new Set(e._zod.def.optional);for(const E in t){if(!(E in _))throw new Error(`Unrecognized key: "${E}"`);t[E]&&(r[E]=_[E],C.has(E)&&i.push(E))}return _e(e,{...e._zod.def,shape:r,optional:i,checks:[]})}function Ot(e,t){const r={...e._zod.def.shape},i=new Set(e._zod.def.optional);for(const _ in t){if(!(_ in e._zod.def.shape))throw new Error(`Unrecognized key: "${_}"`);t[_]&&(delete r[_],i.delete(_))}return _e(e,{...e._zod.def,shape:r,optional:[...i],checks:[]})}function Ns(e,t){const r={...e._zod.def,get shape(){const i={...e._zod.def.shape,...t};return ge(this,"shape",i),i},checks:[]};return Pe(r,"shape",()=>({...e._zod.def.shape,...t})),_e(e,r)}function Re(e,t){const r=new Set(Object.keys(t._zod.def.shape)),i=[...e._zod.def.optional.filter(_=>!r.has(_)),...t._zod.def.optional];return _e(e,{...e._zod.def,get shape(){const _={...e._zod.def.shape,...t._zod.def.shape};return ge(this,"shape",_),_},optional:i,catchall:t._zod.def.catchall,checks:[]})}function tt(e,t){const r=new Set(Object.keys(t._zod.def.shape)),i=[...e._zod.def.optional.filter(_=>!r.has(_)),...t._zod.def.optional];return _e(e,{...e._zod.def,get shape(){const _={...e._zod.def.shape,...t._zod.def.shape};return ge(this,"shape",_),_},optional:i,checks:[]})}function It(e,t,r){const i={...t._zod.def.shape},_=new Set(t._zod.def.optional);if(r)for(const C in r){if(!(C in i))throw new Error(`Unrecognized key: "${C}"`);r[C]&&(i[C]=new e({type:"optional",innerType:t._zod.def.shape[C]}),_.add(C))}else for(const C in t._zod.def.shape)i[C]=new e({type:"optional",innerType:t._zod.def.shape[C]}),_.add(C);return _e(t,{...t._zod.def,shape:i,optional:[..._],checks:[]})}function Bt(e,t,r){const i={...t._zod.def.shape};if(r)for(const _ in r){if(!(_ in i))throw new Error(`Unrecognized key: "${_}"`);r[_]&&(i[_]=new e({type:"nonoptional",innerType:t._zod.def.shape[_]}))}else for(const _ in t._zod.def.shape)i[_]=new e({type:"nonoptional",innerType:t._zod.def.shape[_]});return _e(t,{...t._zod.def,shape:i,optional:[],checks:[]})}function il(e){if(e.type==="interface"){const t=Object.keys(e.shape),r=new Set(Object.keys(e.shape));return{shape:{...e.shape},keys:t,keySet:r,numKeys:t.length,optionalKeys:new Set(e.optional)}}if(e.type==="object"){const t=Object.keys(e.shape),r=new Set(Object.keys(e.shape));return{shape:{...e.shape},keys:t,keySet:r,numKeys:t.length,optionalKeys:new Set(e.optional)}}throw new Error("Invalid object-like type")}function Me(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r].continue!==!0)return!0;return!1}function de(e,t){return t.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}function Je(e){return typeof e=="string"?e:e==null?void 0:e.message}function he(e,t,r){var _,C,E,n,a,u;const i={...e,path:e.path??[]};if(!e.message){const d=Je((E=(C=(_=e.inst)==null?void 0:_._zod.def)==null?void 0:C.error)==null?void 0:E.call(C,e))??Je((n=t==null?void 0:t.error)==null?void 0:n.call(t,e))??Je((a=r.customError)==null?void 0:a.call(r,e))??Je((u=r.localeError)==null?void 0:u.call(r,e))??"Invalid input";i.message=d}return delete i.inst,delete i.continue,t!=null&&t.reportInput||delete i.input,i}function Pt(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Mt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function He(...e){const[t,r,i]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:i}:{...t}}const sl=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:Fs,NUMBER_FORMAT_RANGES:Hs,aborted:Me,allowsEval:Ms,assert:Vh,assertEqual:Zh,assertIs:Kh,assertNever:qh,assertNotEqual:Uh,assignProp:ge,cached:ye,cleanInterfaceKey:$s,cleanInterfaceShape:xe,cleanRegex:Lt,clone:_e,createTransparentProxy:tl,defineLazy:Pe,esc:Be,escapeRegex:ke,extend:Ns,extendObjectLike:tt,finalizeIssue:he,floatSafeRemainder:Bs,getElementAtPath:Jh,getLengthableOrigin:Mt,getParsedType:Qh,getSizableOrigin:Pt,getValidEnumValues:Gh,isObject:Ps,isPlainObject:et,issue:He,joinValues:Qe,jsonStringifyReplacer:Is,mergeObjectLike:Re,normalizeObjectLikeDef:il,normalizeParams:z,nullish:Te,numKeys:Yh,omit:Ot,optionalInterfaceKeys:rl,optionalObjectKeys:Oe,partialObjectLike:It,pick:Tt,prefixIssues:de,primitiveTypes:zs,promiseAllObject:Xh,propertyKeyTypes:Ct,randomString:gr,requiredObjectLike:Bt,splitChecksAndParams:el,stringifyPrimitive:At,unwrapMessage:Je},Symbol.toStringTag,{value:"Module"})),Ji=Symbol.for("{{zod.error}}");class ve{get message(){return JSON.stringify(this.issues,Is,2)}constructor(t){Object.defineProperty(this,"_tag",{value:Ji,enumerable:!1}),Object.defineProperty(this,"name",{value:"$ZodError",enumerable:!1}),this.issues=t}static[Symbol.hasInstance](t){return(t==null?void 0:t._tag)===Ji}}function js(e,t=r=>r.message){const r={},i=[];for(const _ of e.issues)_.path.length>0?(r[_.path[0]]=r[_.path[0]]||[],r[_.path[0]].push(t(_))):i.push(t(_));return{formErrors:i,fieldErrors:r}}function Ws(e,t){const r=t||function(C){return C.message},i={_errors:[]},_=C=>{for(const E of C.issues)if(E.code==="invalid_union")E.errors.map(n=>_({issues:n}));else if(E.code==="invalid_key")_({issues:E.issues});else if(E.code==="invalid_element")_({issues:E.issues});else if(E.path.length===0)i._errors.push(r(E));else{let n=i,a=0;for(;a<E.path.length;){const u=E.path[a];a===E.path.length-1?(n[u]=n[u]||{_errors:[]},n[u]._errors.push(r(E))):n[u]=n[u]||{_errors:[]},n=n[u],a++}}};return _(e),i}function Zs(e,t){const r=t||function(C){return C.message},i={errors:[]},_=C=>{var E,n;for(const a of C.issues)if(a.code==="invalid_union")a.errors.map(u=>_({issues:u}));else if(a.code==="invalid_key")_({issues:a.issues});else if(a.code==="invalid_element")_({issues:a.issues});else if(a.path.length===0)i.errors.push(r(a));else{let u=i,d=0;for(;d<a.path.length;){const l=a.path[d],p=d===a.path.length-1;typeof l=="string"?(u.properties??(u.properties={}),(E=u.properties)[l]??(E[l]={errors:[]}),u=u.properties[l]):(u.items??(u.items=[]),(n=u.items)[l]??(n[l]={errors:[]}),u=u.items[l]),p&&u.errors.push(r(a)),d++}}};return _(e),i}function Us(e){const t=[];for(const r of e)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`["${String(r)}"]`):r.includes(".")?t.push(`["${r}"]`):(t.length&&t.push("."),t.push(r));return t.join("")}function Ks(e){var i;const t=[],r=[...e.issues].sort((_,C)=>_.path.length-C.path.length);for(const _ of r)t.push(`✖ ${_.message}`),(i=_.path)!=null&&i.length&&t.push(` → at ${Us(_.path)}`);return t.join(`
10
+ `)}function vr(e,t,r){const i=r?{...r,async:!1}:{async:!1},_=e._zod.run({value:t,issues:[]},i);if(_ instanceof Promise)throw new $e;if(_.issues.length)throw new((this==null?void 0:this.Error)??ve)(_.issues.map(C=>he(C,i,oe())));return _.value}const ar=vr.bind({Error:ve});function br(e,t,r){const i=r?{...r,async:!1}:{async:!1},_=e._zod.run({value:t,issues:[]},i);if(_ instanceof Promise)throw new $e;return _.issues.length?{success:!1,error:new((this==null?void 0:this.Error)??ve)(_.issues.map(C=>he(C,i,oe())))}:{success:!0,data:_.value}}const nl=br.bind({Error:ve});async function Sr(e,t,r){const i=r?{...r,async:!0}:{async:!0};let _=e._zod.run({value:t,issues:[]},i);if(_ instanceof Promise&&(_=await _),_.issues.length)throw new((this==null?void 0:this.Error)??ve)(_.issues.map(C=>he(C,i,oe())));return _.value}const cr=Sr.bind({Error:ve});async function yr(e,t,r){const i=r?{...r,async:!0}:{async:!0};let _=e._zod.run({value:t,issues:[]},i);return _ instanceof Promise&&(_=await _),_.issues.length?{success:!1,error:new((this==null?void 0:this.Error)??ve)(_.issues.map(C=>he(C,i,oe())))}:{success:!0,data:_.value}}const ol=yr.bind({Error:ve}),qs=/^[cC][^\s-]{8,}$/,Vs=/^[0-9a-z]+$/,Gs=/^[0-9A-HJKMNP-TV-Z]{26}$/,Js=/^[0-9a-vA-V]{20}$/,Xs=/^[A-Za-z0-9]{27}$/,Ys=/^[a-zA-Z0-9_-]{21}$/,Qs=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,al=/^[-+]?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)?)??$/,en=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Fe=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,cl=Fe(4),hl=Fe(6),ll=Fe(7),tn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ul=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,dl=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,fl=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,_l=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,rn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function sn(){return new RegExp(rn,"u")}const wr=/^(?:(?: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])$/,Cr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,nn=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,on=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,pl=new RegExp(`(${wr.source})|(${Cr.source})`),an=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,cn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hr=/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)+([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/,hn=/^\+(?:[0-9]){6,14}[0-9]$/,ln="((\\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])))",un=new RegExp(`^${ln}$`);function dn(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function fn(e){return new RegExp(`^${dn(e)}$`)}function _n(e){let t=`${ln}T${dn(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}const pn=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},mn=/^\d+n?$/,gn=/^\d+$/,vn=/^-?\d+(?:\.\d+)?/i,bn=/true|false/i,Sn=/null/i,yn=/undefined/i,wn=/^[^A-Z]*$/,Cn=/^[^a-z]*$/,En=Object.freeze(Object.defineProperty({__proto__:null,_emoji:rn,base64:an,base64url:cn,bigint:mn,boolean:bn,browserEmail:_l,cidrv4:nn,cidrv6:on,cuid:qs,cuid2:Vs,date:un,datetime:_n,duration:Qs,e164:hn,email:tn,emoji:sn,extendedDuration:al,guid:en,hostname:hr,html5Email:ul,integer:gn,ip:pl,ipv4:wr,ipv6:Cr,ksuid:Xs,lowercase:wn,nanoid:Ys,null:Sn,number:vn,rfc5322Email:dl,string:pn,time:fn,ulid:Gs,undefined:yn,unicodeEmail:fl,uppercase:Cn,uuid:Fe,uuid4:cl,uuid6:hl,uuid7:ll,xid:Js},Symbol.toStringTag,{value:"Module"})),ne=M("$ZodCheck",(e,t)=>{e._zod??(e._zod={}),e._zod.def=t}),kn={number:"number",bigint:"bigint",object:"date"},Er=M("$ZodCheckLessThan",(e,t)=>{ne.init(e,t);const r=kn[typeof t.value];e._zod.onattach=i=>{const _=i._zod.computed.maximum??Number.POSITIVE_INFINITY;t.value<_&&(i._zod.computed.maximum=t.value,i._zod.computed.inclusive=t.inclusive)},e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:r,code:"too_big",maximum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),kr=M("$ZodCheckGreaterThan",(e,t)=>{ne.init(e,t);const r=kn[typeof t.value];e._zod.onattach=i=>{const _=i._zod.computed.minimum??Number.NEGATIVE_INFINITY;t.value>_&&(i._zod.computed.minimum=t.value,i._zod.computed.inclusive=t.inclusive)},e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:r,code:"too_small",minimum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),xn=M("$ZodCheckMultipleOf",(e,t)=>{ne.init(e,t),e._zod.onattach=r=>{var i;(i=r._zod.computed).multipleOf??(i.multipleOf=t.value)},e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Bs(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Dn=M("$ZodCheckNumberFormat",(e,t)=>{var E;ne.init(e,t),t.format=t.format||"float64";const r=(E=t.format)==null?void 0:E.includes("int"),i=r?"int":"number",[_,C]=Hs[t.format];e._zod.onattach=n=>{n._zod.computed.format=t.format,n._zod.computed.minimum=_,n._zod.computed.maximum=C,r&&(n._zod.computed.pattern=gn)},e._zod.check=n=>{const a=n.value;if(r){if(!Number.isInteger(a)){n.issues.push({expected:i,format:t.format,code:"invalid_type",input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?n.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the the safe integer range.",inst:e,origin:i,continue:!t.abort}):n.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort});return}}a<_&&n.issues.push({origin:"number",input:a,code:"too_small",minimum:_,inclusive:!0,inst:e,continue:!t.abort}),a>C&&n.issues.push({origin:"number",input:a,code:"too_big",maximum:C,inst:e})}}),Rn=M("$ZodCheckBigIntFormat",(e,t)=>{ne.init(e,t);const[r,i]=Fs[t.format];e._zod.onattach=_=>{_._zod.computed.format=t.format,_._zod.computed.minimum=r,_._zod.computed.maximum=i},e._zod.check=_=>{const C=_.value;C<r&&_.issues.push({origin:"bigint",input:C,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),C>i&&_.issues.push({origin:"bigint",input:C,code:"too_big",maximum:i,inst:e})}}),Ln=M("$ZodCheckMaxSize",(e,t)=>{ne.init(e,t),e._zod.when=r=>{const i=r.value;return!Te(i)&&i.size!==void 0},e._zod.onattach=r=>{const i=r._zod.computed.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(r._zod.computed.maximum=t.maximum)},e._zod.check=r=>{const i=r.value;i.size<=t.maximum||r.issues.push({origin:Pt(i),code:"too_big",maximum:t.maximum,input:i,inst:e,continue:!t.abort})}}),An=M("$ZodCheckMinSize",(e,t)=>{ne.init(e,t),e._zod.when=r=>{const i=r.value;return!Te(i)&&i.size!==void 0},e._zod.onattach=r=>{const i=r._zod.computed.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(r._zod.computed.minimum=t.minimum)},e._zod.check=r=>{const i=r.value;i.size>=t.minimum||r.issues.push({origin:Pt(i),code:"too_small",minimum:t.minimum,input:i,inst:e,continue:!t.abort})}}),Tn=M("$ZodCheckSizeEquals",(e,t)=>{ne.init(e,t),e._zod.when=r=>{const i=r.value;return!Te(i)&&i.size!==void 0},e._zod.onattach=r=>{r._zod.computed.minimum=t.size,r._zod.computed.maximum=t.size,r._zod.computed.size=t.size},e._zod.check=r=>{const i=r.value,_=i.size;if(_===t.size)return;const C=_>t.size;r.issues.push({origin:Pt(i),...C?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},input:r.value,inst:e,continue:!t.abort})}}),On=M("$ZodCheckMaxLength",(e,t)=>{ne.init(e,t),e._zod.when=r=>{const i=r.value;return!Te(i)&&i.length!==void 0},e._zod.onattach=r=>{const i=r._zod.computed.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(r._zod.computed.maximum=t.maximum)},e._zod.check=r=>{const i=r.value;if(i.length<=t.maximum)return;const C=Mt(i);r.issues.push({origin:C,code:"too_big",maximum:t.maximum,input:i,inst:e,continue:!t.abort})}}),In=M("$ZodCheckMinLength",(e,t)=>{ne.init(e,t),e._zod.when=r=>{const i=r.value;return!Te(i)&&i.length!==void 0},e._zod.onattach=r=>{const i=r._zod.computed.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(r._zod.computed.minimum=t.minimum)},e._zod.check=r=>{const i=r.value;if(i.length>=t.minimum)return;const C=Mt(i);r.issues.push({origin:C,code:"too_small",minimum:t.minimum,input:i,inst:e,continue:!t.abort})}}),Bn=M("$ZodCheckLengthEquals",(e,t)=>{ne.init(e,t),e._zod.when=r=>{const i=r.value;return!Te(i)&&i.length!==void 0},e._zod.onattach=r=>{r._zod.computed.minimum=t.length,r._zod.computed.maximum=t.length,r._zod.computed.length=t.length},e._zod.check=r=>{const i=r.value,_=i.length;if(_===t.length)return;const C=Mt(i),E=_>t.length;r.issues.push({origin:C,...E?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},input:r.value,inst:e,continue:!t.abort})}}),nt=M("$ZodCheckStringFormat",(e,t)=>{var r;ne.init(e,t),e._zod.onattach=i=>{i._zod.computed.format=t.format,t.pattern&&(i._zod.computed.pattern=t.pattern)},(r=e._zod).check??(r.check=i=>{if(!t.pattern)throw new Error("Not implemented.");t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})})}),Pn=M("$ZodCheckRegex",(e,t)=>{nt.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Mn=M("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=wn),nt.init(e,t)}),zn=M("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Cn),nt.init(e,t)}),$n=M("$ZodCheckIncludes",(e,t)=>{ne.init(e,t);const r=new RegExp(ke(t.includes));t.pattern=r,e._zod.onattach=i=>{i._zod.computed.pattern=r},e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),Hn=M("$ZodCheckStartsWith",(e,t)=>{ne.init(e,t);const r=new RegExp(`^${ke(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach=i=>{i._zod.computed.pattern=r},e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),Fn=M("$ZodCheckEndsWith",(e,t)=>{ne.init(e,t);const r=new RegExp(`.*${ke(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach=i=>{i._zod.computed.pattern=new RegExp(`.*${ke(t.suffix)}$`)},e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});function Xi(e,t,r){e.issues.length&&t.issues.push(...de(r,e.issues))}const Nn=M("$ZodCheckProperty",(e,t)=>{ne.init(e,t),e._zod.check=r=>{const i=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(i instanceof Promise)return i.then(_=>Xi(_,r,t.property));Xi(i,r,t.property)}}),jn=M("$ZodCheckMimeType",(e,t)=>{ne.init(e,t);const r=new Set(t.mime);e._zod.onattach=i=>{i._zod.computed.mime=t.mime},e._zod.check=i=>{r.has(i.value.type)||i.issues.push({code:"invalid_value",values:t.mime,input:i.value.type,path:["type"],inst:e})}}),Wn=M("$ZodCheckOverwrite",(e,t)=>{ne.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Zn{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const i=t.split(`
11
+ `).filter(E=>E),_=Math.min(...i.map(E=>E.length-E.trimStart().length)),C=i.map(E=>E.slice(_)).map(E=>" ".repeat(this.indent*2)+E);for(const E of C)this.content.push(E)}compile(){const t=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(_=>` ${_}`)];return new Function(...t,i.join(`
12
+ `))}}const Un={major:0,minor:4,patch:6},Q=M("$ZodType",(e,t)=>{var _,C,E;var r;e??(e={}),e._zod.id=t.type+"_"+gr(10),e._zod.def=t,e._zod.computed=e._zod.computed||{},e._zod.version=Un;const i=[...e._zod.def.checks??[]];t.type,e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const n of i)(C=(_=n._zod).onattach)==null||C.call(_,e);if(i.length===0)(r=e._zod).deferred??(r.deferred=[]),(E=e._zod.deferred)==null||E.push(()=>{e._zod.run=e._zod.parse});else{const n=(a,u,d)=>{let l=Me(a),p;for(const g of u){if(g._zod.when){if(!g._zod.when(a))continue}else if(l)continue;const y=a.issues.length,m=g._zod.check(a);if(m instanceof Promise&&(d==null?void 0:d.async)===!1)throw new $e;if(p||m instanceof Promise)p=p??Promise.resolve(),p.then(async()=>{await m,a.issues.length!==y&&(l||(l=Me(a,y)))});else{if(a.issues.length===y)continue;l||(l=Me(a,y))}}return p?p.then(()=>a):a};e._zod.run=(a,u)=>{const d=e._zod.parse(a,u);if(d instanceof Promise){if(u.async===!1)throw new $e;return d.then(l=>n(l,i,u))}return n(d,i,u)}}e["~standard"]={validate:n=>{const a=e._zod.run({value:n,issues:[]},{});return a instanceof Promise?a.then(({issues:u,value:d})=>u.length===0?{value:d}:{issues:u.map(l=>he(l,{},oe()))}):a.issues.length===0?{value:a.value}:{issues:a.issues.map(u=>he(u,{},oe()))}},vendor:"zod",version:1}}),xr=M("$ZodString",(e,t)=>{var r;Q.init(e,t),e._zod.pattern=((r=e==null?void 0:e._zod.computed)==null?void 0:r.pattern)??pn(e._zod.computed),e._zod.parse=(i,_)=>{if(t.coerce)try{i.value=String(i.value)}catch{}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),te=M("$ZodStringFormat",(e,t)=>{nt.init(e,t),xr.init(e,t)}),Kn=M("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=en),te.init(e,t)}),qn=M("$ZodUUID",(e,t)=>{if(t.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Fe(i))}else t.pattern??(t.pattern=Fe());te.init(e,t)}),Vn=M("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=tn),te.init(e,t)}),Gn=M("$ZodURL",(e,t)=>{te.init(e,t),e._zod.check=r=>{try{const i=new URL(r.value);if(hr.lastIndex=0,!hr.test(i.hostname))throw new Error;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e})}}}),Jn=M("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=sn()),te.init(e,t)}),Xn=M("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Ys),te.init(e,t)}),Yn=M("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=qs),te.init(e,t)}),Qn=M("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Vs),te.init(e,t)}),eo=M("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Gs),te.init(e,t)}),to=M("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Js),te.init(e,t)}),ro=M("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Xs),te.init(e,t)}),io=M("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=_n(t)),te.init(e,t)}),so=M("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=un),te.init(e,t)}),no=M("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=fn(t)),te.init(e,t)}),oo=M("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Qs),te.init(e,t)}),ao=M("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=wr),te.init(e,t);const r=e._zod.onattach;e._zod.onattach=i=>{r==null||r(i),i._zod.computed.format="ipv4"}}),co=M("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Cr),te.init(e,t);const r=e._zod.onattach;e._zod.onattach=i=>{r==null||r(i),i._zod.computed.format="ipv6"},e._zod.check=i=>{try{new URL(`http://[${i.value}]`)}catch{i.issues.push({code:"invalid_format",format:"ipv6",input:i.value,inst:e})}}}),ho=M("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=nn),te.init(e,t);const r=e._zod.onattach;e._zod.onattach=i=>{r==null||r(i),i._zod.computed.format="cidrv4"}}),lo=M("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=on),te.init(e,t);const r=e._zod.onattach;e._zod.onattach=i=>{r==null||r(i),i._zod.computed.format="cidrv6"},e._zod.check=i=>{const[_,C]=i.value.split("/");try{if(!C)throw new Error;const E=Number(C);if(`${E}`!==C)throw new Error;if(E<0||E>128)throw new Error;new URL(`http://[${_}]`)}catch{i.issues.push({code:"invalid_format",format:"cidrv6",input:i.value,inst:e})}}}),uo=M("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=an),te.init(e,t);const r=e._zod.onattach;e._zod.onattach=i=>{r==null||r(i),i._zod.computed.contentEncoding="base64"}}),fo=M("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=cn),te.init(e,t);const r=e._zod.onattach;e._zod.onattach=i=>{r==null||r(i),i._zod.computed.contentEncoding="base64url"}}),_o=M("$ZodE164",(e,t)=>{t.pattern??(t.pattern=hn),te.init(e,t)});function po(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[i]=r,_=JSON.parse(atob(i));return!("typ"in _&&(_==null?void 0:_.typ)!=="JWT"||t&&(!("alg"in _)||_.alg!==t))}catch{return!1}}const mo=M("$ZodJWT",(e,t)=>{te.init(e,t),e._zod.check=r=>{po(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e})}}),Dr=M("$ZodNumber",(e,t)=>{Q.init(e,t),e._zod.pattern=e._zod.computed.pattern??vn,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const _=r.value;if(typeof _=="number"&&!Number.isNaN(_)&&Number.isFinite(_))return r;const C=typeof _=="number"?Number.isNaN(_)?"NaN":Number.isFinite(_)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:_,inst:e,...C?{received:C}:{}}),r}}),go=M("$ZodNumber",(e,t)=>{Dn.init(e,t),Dr.init(e,t)}),Rr=M("$ZodBoolean",(e,t)=>{Q.init(e,t),e._zod.pattern=bn,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=!!r.value}catch{}const _=r.value;return typeof _=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:_,inst:e}),r}}),Lr=M("$ZodBigInt",(e,t)=>{Q.init(e,t),e._zod.pattern=mn,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}const{value:_}=r;return typeof _=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:_,inst:e}),r}}),vo=M("$ZodBigInt",(e,t)=>{Rn.init(e,t),Lr.init(e,t)}),bo=M("$ZodSymbol",(e,t)=>{Q.init(e,t),e._zod.parse=(r,i)=>{const{value:_}=r;return typeof _=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:_,inst:e}),r}}),So=M("$ZodUndefined",(e,t)=>{Q.init(e,t),e._zod.pattern=yn,e._zod.values=new Set([void 0]),e._zod.parse=(r,i)=>{const{value:_}=r;return typeof _>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:_,inst:e}),r}}),yo=M("$ZodNull",(e,t)=>{Q.init(e,t),e._zod.pattern=Sn,e._zod.values=new Set([null]),e._zod.parse=(r,i)=>{const{value:_}=r;return _===null||r.issues.push({expected:"null",code:"invalid_type",input:_,inst:e}),r}}),wo=M("$ZodAny",(e,t)=>{Q.init(e,t),e._zod.parse=r=>r}),ot=M("$ZodUnknown",(e,t)=>{Q.init(e,t),e._zod.parse=r=>r}),zt=M("$ZodNever",(e,t)=>{Q.init(e,t),e._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Co=M("$ZodVoid",(e,t)=>{Q.init(e,t),e._zod.parse=(r,i)=>{const{value:_}=r;return typeof _>"u"||r.issues.push({expected:"void",code:"invalid_type",input:_,inst:e}),r}}),Eo=M("$ZodDate",(e,t)=>{Q.init(e,t),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}const _=r.value,C=_ instanceof Date;return C&&!Number.isNaN(_.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:_,...C?{received:"Invalid Date"}:{},inst:e}),r}});function Yi(e,t,r){e.issues.length&&t.issues.push(...de(r,e.issues)),t.value[r]=e.value}const ko=M("$ZodArray",(e,t)=>{Q.init(e,t),e._zod.parse=(r,i)=>{const _=r.value;if(!Array.isArray(_))return r.issues.push({expected:"array",code:"invalid_type",input:_,inst:e}),r;r.value=Array(_.length);const C=[];for(let E=0;E<_.length;E++){const n=_[E],a=t.element._zod.run({value:n,issues:[]},i);a instanceof Promise?C.push(a.then(u=>Yi(u,r,E))):Yi(a,r,E)}return C.length?Promise.all(C).then(()=>r):r}});function vt(e,t,r){e.issues.length?t.issues.push(...de(r,e.issues)):t.value[r]=e.value}function Qi(e,t,r,i){e.issues.length?i[r]===void 0?r in i&&(t.value[r]=void 0):t.issues.push(...de(r,e.issues)):e.value===void 0?r in i&&(t.value[r]=void 0):t.value[r]=e.value}const $t=M("$ZodObjectLike",(e,t)=>{Q.init(e,t);const r=ye(()=>{const u=Object.keys(t.shape);return{shape:t.shape,keys:u,keySet:new Set(u),numKeys:u.length,optionalKeys:new Set(t.optional)}});Pe(e._zod,"disc",()=>{const u=t.shape,d=new Map;let l=!1;for(const p in u){const g=u[p]._zod;if(g.values||g.disc){l=!0;const y={values:new Set(g.values??[]),maps:g.disc?[g.disc]:[]};d.set(p,y)}}if(l)return d});const i=u=>{const d=new Zn(["shape","payload","ctx"]),{keys:l,optionalKeys:p}=r.value,g=o=>{const h=Be(o);return`shape[${h}]._zod.run({ value: input[${h}], issues: [] }, ctx)`};d.write("const input = payload.value;");const y={};for(const o of l)y[o]=gr(15);for(const o of l){if(p.has(o))continue;const h=y[o];d.write(`const ${h} = ${g(o)};`),d.write(`
13
+ if (${h}.issues.length) payload.issues = payload.issues.concat(${h}.issues.map(iss => ({
14
+ ...iss,
15
+ path: iss.path ? [${Be(o)}, ...iss.path] : [${Be(o)}]
16
+ })));`)}d.write("payload.value = {"),d.indented(()=>{for(const o of l){if(p.has(o))continue;const h=y[o];d.write(` ${Be(o)}: ${h}.value,`)}}),d.write("}");for(const o of l){if(!p.has(o))continue;const h=y[o];d.write(`const ${h} = ${g(o)};`);const s=Be(o);d.write(`
17
+ if (${h}.issues.length) {
18
+ if (input[${s}] === undefined) {
19
+ if (${s} in input) {
20
+ payload.value[${s}] = undefined;
21
+ }
22
+ } else {
23
+ payload.issues = payload.issues.concat(
24
+ ${h}.issues.map((iss) => ({
25
+ ...iss,
26
+ path: iss.path ? [${s}, ...iss.path] : [${s}],
27
+ }))
28
+ );
29
+ }
30
+ } else if (${h}.value === undefined) {
31
+ if (${s} in input) payload.value[${s}] = undefined;
32
+ } else {
33
+ payload.value[${s}] = ${h}.value;
34
+ }
35
+ `)}d.write("return payload;");const m=d.compile();return(o,h)=>m(u,o,h)};let _;const C=Ms.value,E=et,{catchall:n}=t;let a;e._zod.parse=(u,d)=>{a??(a=r.value);const l=u.value;if(!E(l))return u.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),u;const p=[];if(C&&(d==null?void 0:d.async)===!1&&d.noPrecompilation!==!0)_||(_=i(t.shape)),u=_(u,d);else{u.value={};const{keys:h,shape:s,optionalKeys:c}=a;for(const f of h){const b=s[f]._zod.run({value:l[f],issues:[]},d),w=c.has(f);b instanceof Promise?p.push(b.then(v=>w?Qi(v,u,f,l):vt(v,u,f))):w?Qi(b,u,f,l):vt(b,u,f)}}if(!n)return p.length?Promise.all(p).then(()=>u):u;const g=[],y=a.keySet,m=n._zod,o=m.def.type;for(const h of Object.keys(l)){if(y.has(h))continue;if(o==="never"){g.push(h);continue}const s=m.run({value:l[h],issues:[]},d);s instanceof Promise?p.push(s.then(c=>vt(c,u,h))):vt(s,u,h)}return g.length&&u.issues.push({code:"unrecognized_keys",keys:g,input:l,inst:e}),p.length?Promise.all(p).then(()=>u):u}}),lr=M("$ZodInterface",(e,t)=>{$t.init(e,t)}),xo=M("$ZodObject",(e,t)=>{$t.init(e,t)});function ml(e,t,r,i){for(const _ of e)if(_.issues.length===0)return t.value=_.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(_=>_.issues.map(C=>he(C,i,oe())))}),t}const Ar=M("$ZodUnion",(e,t)=>{Q.init(e,t);const r=new Set;if(t.options.every(i=>i._zod.values)){for(const i of t.options)for(const _ of i._zod.values)r.add(_);e._zod.values=r}if(t.options.every(i=>i._zod.pattern)){const i=t.options.map(_=>_._zod.pattern);e._zod.pattern=new RegExp(`^(${i.map(_=>Lt(_.source)).join("|")})$`)}e._zod.parse=(i,_)=>{const C=[];for(const E of t.options){const n=E._zod.run({value:i.value,issues:[]},_);if(n instanceof Promise)C.push(n);else{if(n.issues.length===0)return n;C.push(n)}}return ml(C,i,e,_)}});function Do(e,t){let r=!0;for(const[i,_]of t){const C=e==null?void 0:e[i];if(_.values.size&&!_.values.has(C)&&(r=!1),_.maps.length>0)for(const E of _.maps)Do(C,E)||(r=!1)}return r}const Ro=M("$ZodDiscriminatedUnion",(e,t)=>{Ar.init(e,t);const r=e._zod.parse,i=new Map;for(const C of t.options){if(!C._zod.disc)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(C)}"`);for(const[E,n]of C._zod.disc){i.has(E)||i.set(E,{values:new Set,maps:[]});const a=i.get(E);for(const u of n.values)a.values.add(u);for(const u of n.maps)a.maps.push(u)}}e._zod.disc=i;const _=new Map;for(const C of t.options){const E=C._zod.disc;if(!E)throw new Error(`Invalid disciminated union element: ${C._zod.def.type}`);_.set(C,E)}e._zod.parse=(C,E)=>{const n=C.value;if(!Ps(n))return C.issues.push({code:"invalid_type",expected:"object",input:n,inst:e}),C;const a=[];for(const u of t.options)_.has(u)?Do(n,_.get(u))&&a.push(u):a.push(u);return a.length===1?a[0]._zod.run(C,E):t.unionFallback?r(C,E):(C.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:n,inst:e}),C)}}),Lo=M("$ZodIntersection",(e,t)=>{Q.init(e,t),e._zod.parse=(r,i)=>{const{value:_}=r,C=t.left._zod.run({value:_,issues:[]},i),E=t.right._zod.run({value:_,issues:[]},i);return C instanceof Promise||E instanceof Promise?Promise.all([C,E]).then(([a,u])=>es(r,a,u)):es(r,C,E)}});function ur(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(et(e)&&et(t)){const r=Object.keys(t),i=Object.keys(e).filter(C=>r.indexOf(C)!==-1),_={...e,...t};for(const C of i){const E=ur(e[C],t[C]);if(!E.valid)return{valid:!1,mergeErrorPath:[C,...E.mergeErrorPath]};_[C]=E.data}return{valid:!0,data:_}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let i=0;i<e.length;i++){const _=e[i],C=t[i],E=ur(_,C);if(!E.valid)return{valid:!1,mergeErrorPath:[i,...E.mergeErrorPath]};r.push(E.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function es(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),Me(e))return e;const i=ur(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Ht=M("$ZodTuple",(e,t)=>{Q.init(e,t);const r=t.items,i=r.length-[...r].reverse().findIndex(_=>_._zod.qout!=="true");e._zod.parse=(_,C)=>{const E=_.value;if(!Array.isArray(E))return _.issues.push({input:E,inst:e,expected:"tuple",code:"invalid_type"}),_;_.value=[];const n=[];if(!t.rest){const u=E.length>r.length,d=E.length<i-1;if(u||d)return _.issues.push({input:E,inst:e,origin:"array",...u?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length}}),_}let a=-1;for(const u of r){if(a++,a>=E.length&&a>=i)continue;const d=u._zod.run({value:E[a],issues:[]},C);d instanceof Promise?n.push(d.then(l=>bt(l,_,a))):bt(d,_,a)}if(t.rest){const u=E.slice(r.length);for(const d of u){a++;const l=t.rest._zod.run({value:d,issues:[]},C);l instanceof Promise?n.push(l.then(p=>bt(p,_,a))):bt(l,_,a)}}return n.length?Promise.all(n).then(()=>_):_}});function bt(e,t,r){e.issues.length?t.issues.push(...de(r,e.issues)):t.value[r]=e.value}const Ao=M("$ZodRecord",(e,t)=>{Q.init(e,t),e._zod.parse=(r,i)=>{const _=r.value;if(!et(_))return r.issues.push({expected:"record",code:"invalid_type",input:_,inst:e}),r;const C=[];if(t.keyType._zod.values){const E=t.keyType._zod.values;r.value={};for(const a of E)if(typeof a=="string"||typeof a=="number"||typeof a=="symbol"){const u=t.valueType._zod.run({value:_[a],issues:[]},i);u instanceof Promise?C.push(u.then(d=>{d.issues.length&&r.issues.push(...de(a,d.issues)),r.value[a]=d.value})):(u.issues.length&&r.issues.push(...de(a,u.issues)),r.value[a]=u.value)}let n;for(const a in _)E.has(a)||(n=n??[],n.push(a));n&&n.length>0&&r.issues.push({code:"unrecognized_keys",input:_,inst:e,keys:n})}else{r.value={};for(const E of Reflect.ownKeys(_)){if(E==="__proto__")continue;const n=t.keyType._zod.run({value:E,issues:[]},i);if(n instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(n.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:n.issues.map(u=>he(u,i,oe())),input:E,path:[E],inst:e});continue}const a=t.valueType._zod.run({value:_[E],issues:[]},i);a instanceof Promise?C.push(a.then(u=>{u.issues.length?r.issues.push(...de(E,u.issues)):r.value[n.value]=u.value})):a.issues.length?r.issues.push(...de(E,a.issues)):r.value[n.value]=a.value}}return C.length?Promise.all(C).then(()=>r):r}}),To=M("$ZodMap",(e,t)=>{Q.init(e,t),e._zod.parse=(r,i)=>{const _=r.value;if(!(_ instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:_,inst:e}),r;const C=[];r.value=new Map;for(const[E,n]of _){const a=t.keyType._zod.run({value:E,issues:[]},i),u=t.valueType._zod.run({value:n,issues:[]},i);a instanceof Promise||u instanceof Promise?C.push(Promise.all([a,u]).then(([d,l])=>{ts(d,l,r,E,_,e,i)})):ts(a,u,r,E,_,e,i)}return C.length?Promise.all(C).then(()=>r):r}});function ts(e,t,r,i,_,C,E){e.issues.length&&(Ct.has(typeof i)?r.issues.push(...de(i,e.issues)):r.issues.push({origin:"map",code:"invalid_key",input:_,inst:C,issues:e.issues.map(n=>he(n,E,oe()))})),t.issues.length?Ct.has(typeof i)?r.issues.push(...de(i,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:_,inst:C,key:i,issues:t.issues.map(n=>he(n,E,oe()))}):r.value.set(e.value,t.value)}const Oo=M("$ZodSet",(e,t)=>{Q.init(e,t),e._zod.parse=(r,i)=>{const _=r.value;if(!(_ instanceof Set))return r.issues.push({input:_,inst:e,expected:"set",code:"invalid_type"}),r;const C=[];r.value=new Set;for(const E of _){const n=t.valueType._zod.run({value:E,issues:[]},i);n instanceof Promise?C.push(n.then(a=>rs(a,r))):rs(n,r)}return C.length?Promise.all(C).then(()=>r):r}});function rs(e,t){e.issues.length?t.issues.push(...e.issues):t.value.add(e.value)}const Io=M("$ZodEnum",(e,t)=>{Q.init(e,t);const r=Object.entries(t.entries).filter(([i,_])=>typeof t.entries[t.entries[i]]!="number").map(([i,_])=>_);e._zod.values=new Set(r),e._zod.pattern=new RegExp(`^(${r.filter(i=>Ct.has(typeof i)).map(i=>typeof i=="string"?ke(i):i.toString()).join("|")})$`),e._zod.parse=(i,_)=>{const C=i.value;return e._zod.values.has(C)||i.issues.push({code:"invalid_value",values:r,input:C,inst:e}),i}}),Bo=M("$ZodLiteral",(e,t)=>{Q.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?ke(r):r?r.toString():String(r)).join("|")})$`),e._zod.parse=(r,i)=>{const _=r.value;return e._zod.values.has(_)||r.issues.push({code:"invalid_value",values:t.values,input:_,inst:e}),r}}),Po=M("$ZodFile",(e,t)=>{Q.init(e,t),e._zod.parse=(r,i)=>{const _=r.value;return _ instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:_,inst:e}),r}}),Mo=M("$ZodTransform",(e,t)=>{Q.init(e,t),e._zod.parse=(r,i)=>{const _=t.transform(r.value,r);if(i.async)return(_ instanceof Promise?_:Promise.resolve(_)).then(E=>(r.value=E,r));if(_ instanceof Promise)throw new $e;return r.value=_,r}}),zo=M("$ZodOptional",(e,t)=>{Q.init(e,t),e._zod.qout="true",t.innerType._zod.values&&(e._zod.values=new Set([...t.innerType._zod.values,void 0]));const r=t.innerType._zod.pattern;r&&(e._zod.pattern=new RegExp(`^(${Lt(r.source)})?$`)),e._zod.parse=(i,_)=>i.value===void 0?i:t.innerType._zod.run(i,_)}),$o=M("$ZodNullable",(e,t)=>{Q.init(e,t),e._zod.qin=t.innerType._zod.qin,e._zod.qout=t.innerType._zod.qout;const r=t.innerType._zod.pattern;r&&(e._zod.pattern=new RegExp(`^(${Lt(r.source)}|null)$`)),t.innerType._zod.values&&(e._zod.values=new Set([...t.innerType._zod.values,null])),e._zod.parse=(i,_)=>i.value===null?i:t.innerType._zod.run(i,_)}),Ho=M("$ZodDefault",(e,t)=>{Q.init(e,t),e._zod.values=t.innerType._zod.values,e._zod.parse=(r,i)=>{if(r.value===void 0)return r.value=t.defaultValue(),r;const _=t.innerType._zod.run(r,i);return _ instanceof Promise?_.then(C=>is(C,t)):is(_,t)}});function is(e,t){return e.value===void 0&&(e.value=t.defaultValue()),e}const Fo=M("$ZodNonOptional",(e,t)=>{Q.init(e,t),t.innerType._zod.values&&(e._zod.values=new Set([...t.innerType._zod.values].filter(r=>r!==void 0))),e._zod.parse=(r,i)=>{const _=t.innerType._zod.run(r,i);return _ instanceof Promise?_.then(C=>ss(C,e)):ss(_,e)}});function ss(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const No=M("$ZodSuccess",(e,t)=>{Q.init(e,t),e._zod.parse=(r,i)=>{const _=t.innerType._zod.run(r,i);return _ instanceof Promise?_.then(C=>(r.value=C.issues.length===0,r)):(r.value=_.issues.length===0,r)}}),jo=M("$ZodCatch",(e,t)=>{Q.init(e,t),e._zod.qout=t.innerType._zod.qout,e._zod.values=t.innerType._zod.values,e._zod.parse=(r,i)=>{const _=t.innerType._zod.run(r,i);return _ instanceof Promise?_.then(C=>(C.issues.length?(r.value=t.catchValue({...r,error:{issues:C.issues.map(E=>he(E,i,oe()))},input:r.value}),r.issues=[]):r.value=C.value,r)):(_.issues.length?(r.value=t.catchValue({...r,error:{issues:_.issues.map(C=>he(C,i,oe()))},input:r.value}),r.issues=[]):r.value=_.value,r)}}),Wo=M("$ZodNaN",(e,t)=>{Q.init(e,t),e._zod.parse=(r,i)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),Tr=M("$ZodPipe",(e,t)=>{Q.init(e,t),e._zod.values=t.in._zod.values,e._zod.parse=(r,i)=>{const _=t.in._zod.run(r,i);return _ instanceof Promise?_.then(C=>ns(C,t,i)):ns(_,t,i)}});function ns(e,t,r){return Me(e)?e:t.out._zod.run({value:e.value,issues:e.issues},r)}const Zo=M("$ZodReadonly",(e,t)=>{Q.init(e,t),e._zod.qout=t.innerType._zod.qout,e._zod.parse=(r,i)=>{const _=t.innerType._zod.run(r,i);return _ instanceof Promise?_.then(os):os(_)}});function os(e){return e.value=Object.freeze(e.value),e}const Uo=M("$ZodTemplateLiteral",(e,t)=>{Q.init(e,t);const r=[];for(const i of t.parts)if(i instanceof Q){if(!i._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...i._zod.traits].shift()}`);const _=i._zod.pattern instanceof RegExp?i._zod.pattern.source:i._zod.pattern;if(!_)throw new Error(`Invalid template literal part: ${i._zod.traits}`);const C=_.startsWith("^")?1:0,E=_.endsWith("$")?_.length-1:_.length;r.push(_.slice(C,E))}else if(i===null||zs.has(typeof i))r.push(ke(`${i}`));else throw new Error(`Invalid template literal part: ${i}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(i,_)=>typeof i.value!="string"?(i.issues.push({input:i.value,inst:e,expected:"template_literal",code:"invalid_type"}),i):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(i.value)||i.issues.push({input:i.value,inst:e,code:"invalid_format",format:"template_literal",pattern:e._zod.pattern.source}),i)}),Ko=M("$ZodPromise",(e,t)=>{Q.init(e,t),e._zod.parse=(r,i)=>Promise.resolve(r.value).then(_=>t.innerType._zod.run({value:_,issues:[]},i))}),qo=M("$ZodLazy",(e,t)=>{Q.init(e,t),Pe(e._zod,"_getter",t.getter),Pe(e._zod,"pattern",()=>e._zod._getter._zod.pattern),Pe(e._zod,"disc",()=>e._zod._getter._zod.disc),e._zod.parse=(r,i)=>e._zod._getter._zod.run(r,i)}),Vo=M("$ZodCustom",(e,t)=>{ne.init(e,t),Q.init(e,t),e._zod.parse=(r,i)=>r,e._zod.check=r=>{const i=r.value,_=t.fn(i);if(_ instanceof Promise)return _.then(C=>as(C,r,i,e));as(_,r,i,e)}});function as(e,t,r,i){if(!e){const _={code:"custom",input:r,inst:i,path:i._zod.def.path,continue:!i._zod.def.abort};i._zod.def.params&&(_.params=i._zod.def.params),t.issues.push(He(_))}}const gl={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function cs(e){return gl[e]??null}const vl=e=>{const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype)return e.constructor.name}}return t},bl={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},Sl=e=>{switch(e.code){case"invalid_type":return`Invalid input: expected ${e.expected}, received ${vl(e.input)}`;case"invalid_value":return e.values.length===1?`Invalid input: expected ${At(e.values[0])}`:`Invalid option: expected one of ${Qe(e.values,"|")}`;case"too_big":{const t=e.inclusive?"<=":"<",r=cs(e.origin);return r?`Too big: expected ${e.origin??"value"} to have ${t}${e.maximum.toString()} ${r.unit??"elements"}`:`Too big: expected ${e.origin??"value"} to be ${t}${e.maximum.toString()}`}case"too_small":{const t=e.inclusive?">=":">",r=cs(e.origin);return r?`Too small: expected ${e.origin} to have ${t}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${t}${e.minimum.toString()}`}case"invalid_format":{const t=e;return t.format==="starts_with"?`Invalid string: must start with "${e}"`:t.format==="ends_with"?`Invalid string: must end with "${t.suffix}"`:t.format==="includes"?`Invalid string: must include "${t.includes}"`:t.format==="regex"?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${bl[t.format]??e.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${e.divisor}`;case"unrecognized_keys":return`Unrecognized key${e.keys.length>1?"s":""}: ${Qe(e.keys,", ")}`;case"invalid_key":return`Invalid key in ${e.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${e.origin}`;default:return"Invalid input"}};function Go(){return{localeError:Sl}}const yl={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function hs(e){return yl[e]??null}const wl={regex:"string",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT"},Cl=e=>{switch(e.code){case"invalid_type":return`Invalid input: expected ${e.expected}`;case"invalid_value":return e.values.length===1?`Invalid input: expected ${At(e.values[0])}`:`Invalid option: expected one of ${Qe(e.values,"|")}`;case"too_big":{const t=e.inclusive?"<=":"<",r=hs(e.origin);return r?`Too big: expected ${e.origin??"value"} to have ${t}${e.maximum.toString()} ${r.unit??"elements"}`:`Too big: expected ${e.origin??"value"} to be ${t}${e.maximum.toString()}`}case"too_small":{const t=e.inclusive?">=":">",r=hs(e.origin);return r?`Too small: expected ${e.origin} to have ${t}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${t}${e.minimum.toString()}`}case"invalid_format":{const t=e;return t.format==="starts_with"?`Invalid string: must start with "${e}"`:t.format==="ends_with"?`Invalid string: must end with "${t.suffix}"`:t.format==="includes"?`Invalid string: must include "${t.includes}"`:t.format==="regex"?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${wl[t.format]??e.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${e.divisor}`;case"unrecognized_keys":return`Unrecognized key${e.keys.length>1?"s":""}: ${Qe(e.keys,", ")}`;case"invalid_key":return`Invalid key in ${e.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${e.origin}`;default:return"Invalid input"}};function El(){return{localeError:Cl}}const kl=Object.freeze(Object.defineProperty({__proto__:null,en:Go,enGB:El},Symbol.toStringTag,{value:"Module"})),Jo=Symbol("ZodOutput"),Xo=Symbol("ZodInput");class Ft{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const i=r[0];if(this._map.set(t,i),i&&typeof i=="object"&&"id"in i){if(this._idmap.has(i.id))throw new Error(`ID ${i.id} already exists in the registry`);this._idmap.set(i.id,t)}return this}remove(t){return this._map.delete(t),this}get(t){return this._map.get(t)}has(t){return this._map.has(t)}}class Or extends Ft{toJSONSchema(t){return{}}}const Ee=new Or;function Yo(){return new Ft}function xl(){return new Or}function Qo(e,t){return new e({type:"string",...z(t)})}function ea(e,t){return new e({type:"string",coerce:!0,...z(t)})}function Ir(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...z(t)})}function Et(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...z(t)})}function Br(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...z(t)})}function Pr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...z(t)})}function Mr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...z(t)})}function zr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...z(t)})}function $r(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...z(t)})}function Hr(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...z(t)})}function Fr(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...z(t)})}function Nr(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...z(t)})}function jr(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...z(t)})}function Wr(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...z(t)})}function Zr(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...z(t)})}function Ur(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...z(t)})}function Kr(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...z(t)})}function qr(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...z(t)})}function Vr(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...z(t)})}function Gr(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...z(t)})}function Jr(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...z(t)})}function Xr(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...z(t)})}function Yr(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...z(t)})}function Qr(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...z(t)})}function ta(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...z(t)})}function ra(e,t){return new e({type:"string",format:"date",check:"string_format",...z(t)})}function ia(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...z(t)})}function sa(e,t){return new e({type:"string",format:"duration",check:"string_format",...z(t)})}function na(e,t){return new e({type:"number",checks:[],...z(t)})}function oa(e,t){return new e({type:"number",coerce:!0,checks:[],...z(t)})}function aa(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...z(t)})}function ca(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...z(t)})}function ha(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...z(t)})}function la(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...z(t)})}function ua(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...z(t)})}function da(e,t){return new e({type:"boolean",...z(t)})}function fa(e,t){return new e({type:"boolean",coerce:!0,...z(t)})}function _a(e,t){return new e({type:"bigint",...z(t)})}function pa(e,t){return new e({type:"bigint",coerce:!0,...z(t)})}function ma(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...z(t)})}function ga(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...z(t)})}function va(e,t){return new e({type:"symbol",...z(t)})}function ba(e,t){return new e({type:"undefined",...z(t)})}function Sa(e,t){return new e({type:"null",...z(t)})}function ya(e,t){return new e({type:"any",...z(t)})}function Nt(e,t){return new e({type:"unknown",...z(t)})}function jt(e,t){return new e({type:"never",...z(t)})}function wa(e,t){return new e({type:"void",...z(t)})}function Ca(e,t){return new e({type:"date",...z(t)})}function Ea(e,t){return new e({type:"date",coerce:!0,...z(t)})}function ka(e,t){return new e({type:"nan",...z(t)})}function Le(e,t){return new Er({check:"less_than",...z(t),value:e,inclusive:!1})}function fe(e,t){return new Er({check:"less_than",...z(t),value:e,inclusive:!0})}function Ae(e,t){return new kr({check:"greater_than",...z(t),value:e,inclusive:!1})}function ce(e,t){return new kr({check:"greater_than",...z(t),value:e,inclusive:!0})}function xa(e){return Ae(0,e)}function Da(e){return Le(0,e)}function Ra(e){return fe(0,e)}function La(e){return ce(0,e)}function rt(e,t){return new xn({check:"multiple_of",...z(t),value:e})}function Wt(e,t){return new Ln({check:"max_size",...z(t),maximum:e})}function it(e,t){return new An({check:"min_size",...z(t),minimum:e})}function ei(e,t){return new Tn({check:"size_equals",...z(t),size:e})}function Zt(e,t){return new On({check:"max_length",...z(t),maximum:e})}function Ne(e,t){return new In({check:"min_length",...z(t),minimum:e})}function Ut(e,t){return new Bn({check:"length_equals",...z(t),length:e})}function ti(e,t){return new Pn({check:"string_format",format:"regex",...z(t),pattern:e})}function ri(e){return new Mn({check:"string_format",format:"lowercase",...z(e)})}function ii(e){return new zn({check:"string_format",format:"uppercase",...z(e)})}function si(e,t){return new $n({check:"string_format",format:"includes",...z(t),includes:e})}function ni(e,t){return new Hn({check:"string_format",format:"starts_with",...z(t),prefix:e})}function oi(e,t){return new Fn({check:"string_format",format:"ends_with",...z(t),suffix:e})}function Aa(e,t,r){return new Nn({check:"property",property:e,schema:t,...z(r)})}function ai(e,t){return new jn({check:"mime_type",mime:e,...z(t)})}function Ie(e){return new Wn({check:"overwrite",tx:e})}function ci(e){return Ie(t=>t.normalize(e))}function hi(){return Ie(e=>e.trim())}function li(){return Ie(e=>e.toLowerCase())}function ui(){return Ie(e=>e.toUpperCase())}function Ta(e,t,r){return new e({type:"array",element:t,...z(r)})}function Dl(e,t,r){const i=ye(()=>xe(t)),_={type:"interface",get shape(){const C=i.value.shape;return ge(this,"shape",C),C},get optional(){return i.value.optional},...z(r)};return new e(_)}function Rl(e,t,r){const i=ye(()=>xe(t)),_={type:"interface",get shape(){const C=i.value.shape;return ge(this,"shape",C),C},get optional(){return i.value.optional},catchall:jt(zt),...z(r)};return new e(_)}function Ll(e,t,r){const i=ye(()=>xe(t)),_={type:"interface",get optional(){return i.value.optional},get shape(){const C=i.value.shape;return ge(this,"shape",C),C},catchall:Nt(ot),...z(r)};return new e(_)}function Al(e,t,r){const i={type:"object",shape:t??{},get optional(){return Oe(t??{})},...z(r)};return new e(i)}function Tl(e,t,r){return new e({type:"object",shape:t,get optional(){return Oe(t)},catchall:jt(zt),...z(r)})}function Ol(e,t,r){return new e({type:"object",shape:t,get optional(){return Oe(t)},catchall:Nt(ot),...z(r)})}function Il(e,t,r){return new e({type:"union",options:t,...z(r)})}function Bl(e,t,r){return new e({type:"union",options:t,...z(r)})}function Pl(e,t,r,i){return new e({type:"intersection",left:t,right:r,...z(i)})}function Oa(e,t,r,i){const _=r instanceof Q,C=_?i:r,E=_?r:null;return new e({type:"tuple",items:t,rest:E,...z(C)})}function Ml(e,t,r,i){return new e({type:"record",keyType:t,valueType:r,...z(i)})}function zl(e,t,r,i){return new e({type:"map",keyType:t,valueType:r,...z(i)})}function $l(e,t,r){return new e({type:"set",valueType:t,...z(r)})}function Hl(e,t,r){const i=Array.isArray(t)?Object.fromEntries(t.map(_=>[_,_])):t;return new e({type:"enum",entries:i,...z(r)})}function Fl(e,t,r){return new e({type:"enum",entries:t,...z(r)})}function Nl(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...z(r)})}function Ia(e,t){return new e({type:"file",...z(t)})}function jl(e,t,r){return new e({type:"transform",transform:t,...z(r)})}function Wl(e,t,r){return new e({type:"optional",innerType:t,...z(r)})}function Zl(e,t,r){return new e({type:"nullable",innerType:t,...z(r)})}function Ul(e,t,r,i){return new e({type:"default",defaultValue:typeof r=="function"?r:()=>r,innerType:t,...z(i)})}function Kl(e,t,r){return new e({type:"nonoptional",innerType:t,...z(r)})}function ql(e,t,r){return new e({type:"success",innerType:t,...z(r)})}function Vl(e,t,r,i){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:()=>r,...z(i)})}function Gl(e,t,r,i){return new e({type:"pipe",in:t,out:r,...z(i)})}function Jl(e,t,r){return new e({type:"readonly",innerType:t,...z(r)})}function Xl(e,t,r){return new e({type:"template_literal",parts:t,...z(r)})}function Yl(e,t,r){return new e({type:"lazy",getter:t,...z(r)})}function Ql(e,t,r){return new e({type:"promise",innerType:t,...z(r)})}function Kt(e,t,r){return new e({type:"custom",check:"custom",fn:t,...z(r)})}function eu(e,t,r={}){return Kt(e,t,r)}function Ba(e,t){const r=z(t),i=new Set((r==null?void 0:r.truthy)??["true","1","yes","on","y","enabled"]),_=new Set((r==null?void 0:r.falsy)??["false","0","no","off","n","disabled"]),C=e.Pipe??Tr,E=e.Boolean??Rr,n=e.Unknown??ot,a=new n({type:"unknown",checks:[{_zod:{check:u=>{if(typeof u.value=="string"){let d=u.value;(r==null?void 0:r.case)!=="sensitive"&&(d=d.toLowerCase()),i.has(d)?u.value=!0:_.has(d)?u.value=!1:u.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,..._],input:u.value,inst:a})}else u.issues.push({code:"invalid_type",expected:"string",input:u.value})},def:{check:"custom"}}}]});return new C({type:"pipe",in:a,out:new E({type:"boolean"})})}class ze{constructor(t){this._def=t}implement(t){if(typeof t!="function")throw new Error("implement() must be called with a function");return(...r)=>{const i=this._def.input?ar(this._def.input,r):r;if(!Array.isArray(i))throw new Error("Invalid arguments schema: not an array or tuple schema.");const _=t(...i);return this._def.output?ar(this._def.output,_):_}}implementAsync(t){if(typeof t!="function")throw new Error("implement() must be called with a function");return async(...r)=>{const i=this._def.input?await cr(this._def.input,r):r;if(!Array.isArray(i))throw new Error("Invalid arguments schema: not an array or tuple schema.");const _=await t(...i);return this._def.output?cr(this._def.output,_):_}}input(...t){return Array.isArray(t[0])?new ze({type:"function",input:new Ht({type:"tuple",items:t[0],rest:t[1]}),output:this._def.output}):new ze({type:"function",input:t[0],output:this._def.output})}output(t){return new ze({type:"function",input:this._def.input,output:t})}}function Pa(e){return new ze({type:"function",input:Array.isArray(e==null?void 0:e.input)?Oa(Ht,e==null?void 0:e.input):(e==null?void 0:e.input)??null,output:(e==null?void 0:e.output)??null})}const tu={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string"};class dr{constructor(t){this.counter=0,this.metadataRegistry=(t==null?void 0:t.metadata)??Ee,this.target=(t==null?void 0:t.target)??"draft-2020-12",this.unrepresentable=(t==null?void 0:t.unrepresentable)??"throw",this.override=(t==null?void 0:t.override)??(()=>{}),this.pipes=(t==null?void 0:t.pipes)??"output",this.seen=new Map}process(t,r={path:[],schemaPath:[]}){const i=t._zod.def,_=this.seen.get(t);if(_)return _.count++,r.schemaPath.includes(t)&&(_.cycle=r.path),_.count++,_.schema;const C=r.initial??{schema:{},cached:{},count:1,cycle:void 0};this.seen.set(t,C),t._zod.toJSONSchema&&(C.schema=t._zod.toJSONSchema());const E=C.schema,n=this.metadataRegistry.get(t);n&&Object.assign(E,n);const a={...r,schemaPath:[...r.schemaPath,t],path:r.path};switch(i.type){case"string":{const d=E;d.type="string";const{minimum:l,maximum:p,format:g,pattern:y,contentEncoding:m}=t._zod.computed;l&&(d.minLength=l),p&&(d.maxLength=p),g&&(d.format=tu[g]??g),y&&(d.pattern=y.source),m&&(d.contentEncoding=m);break}case"number":{const d=E,{minimum:l,maximum:p,format:g,multipleOf:y,inclusive:m}=t._zod.computed;g!=null&&g.includes("int")?d.type="integer":d.type="number",l&&(m?d.minimum=l:d.exclusiveMinimum=l),p&&(m?d.maximum=p:d.exclusiveMaximum=p),y&&(d.multipleOf=y);break}case"boolean":{const d=E;d.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"undefined":{const d=E;d.type="null";break}case"null":{E.type="null";break}case"any":break;case"unknown":break;case"never":{E.not={};break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const d=E,{minimum:l,maximum:p}=t._zod.computed;l&&(d.minItems=l),p&&(d.maxItems=p),d.type="array",d.items=this.process(i.element,{...a,path:[...a.path,"items"]});break}case"object":case"interface":{const d=E;d.type="object",d.properties={};const l=i.shape;for(const m in l)d.properties[m]=this.process(l[m],{...a,path:[...a.path,"properties",m]});const p=new Set(Object.keys(l)),g=new Set(i.optional),y=new Set([...p].filter(m=>!g.has(m)));d.required=Array.from(y),i.catchall&&(d.additionalProperties=this.process(i.catchall,{...a,path:[...a.path,"additionalProperties"]}));break}case"union":{const d=E;d.oneOf=i.options.map((l,p)=>this.process(l,{...a,path:[...a.path,"oneOf",p]}));break}case"intersection":{const d=E;d.allOf=[this.process(i.left,{...a,path:[...a.path,"allOf",0]}),this.process(i.right,{...a,path:[...a.path,"allOf",1]})];break}case"tuple":{const d=E;d.type="array";const l=i.items.map((y,m)=>this.process(y,{...a,path:[...a.path,"prefixItems",m]}));if(this.target==="draft-2020-12"?d.prefixItems=l:d.items=l,i.rest){const y=this.process(i.rest,{...a,path:[...a.path,"items"]});this.target==="draft-2020-12"?d.items=y:d.additionalItems=y}i.rest&&(d.items=this.process(i.rest,{...a,path:[...a.path,"items"]}));const{minimum:p,maximum:g}=t._zod.computed;p&&(d.minItems=p),g&&(d.maxItems=g);break}case"record":{const d=E;d.type="object",d.propertyNames=this.process(i.keyType,{...a,path:[...a.path,"propertyNames"]}),d.additionalProperties=this.process(i.valueType,{...a,path:[...a.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const d=E;d.enum=Object.values(i.entries);break}case"literal":{const d=E;for(const l of i.values){if(l===void 0)throw new Error("Literal `undefined` cannot be represented in JSON Schema");if(typeof l=="bigint")throw new Error("BigInt literals cannot be represented in JSON Schema")}i.values.length===1?d.const=i.values[0]:d.enum=i.values;break}case"file":{if(this.unrepresentable==="throw")throw new Error("File cannot be represented in JSON Schema");break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"optional":{const d=this.process(i.innerType,a),l=E;l.oneOf=[d,{type:"null"}];break}case"nullable":{const d=this.process(i.innerType,a);E.oneOf=[d,{type:"null"}];break}case"nonoptional":{const d=this.process(i.innerType,a);Object.assign(E,d),E.not={type:"null"};break}case"success":{const d=E;d.type="boolean";break}case"default":{const d=this.process(i.innerType,a);Object.assign(E,d),E.default=i.defaultValue();break}case"catch":{const d=this.process(i.innerType,a);let l;try{l=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}E.if=d,E.then=d,E.else={const:l};break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"pipe":{const d=this.pipes==="input"?i.in:i.out;this.process(d,a);const l=this.seen.get(d);this.seen.set(t,l);break}case"readonly":{const d=this.process(i.innerType,a);Object.assign(E,d),E.readOnly=!0;break}case"template_literal":{const d=E,l=t._zod.pattern;if(!l)throw new Error("Pattern not found in template literal");d.type="string",d.pattern=l.source;break}case"promise":{const d=i.innerType;this.process(d,a);const l=this.seen.get(d);this.seen.set(t,l);break}case"lazy":{const d=t._zod._getter;this.process(d,a);const l=this.seen.get(d);this.seen.set(t,l);break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}const u=this.seen.get(t);return this.override({zodSchema:t,jsonSchema:u.schema}),Object.assign(u.cached,u.schema),u.schema}emit(t,r){var a,u,d;const i={cycles:(r==null?void 0:r.cycles)??"ref",reused:(r==null?void 0:r.reused)??"inline",external:(r==null?void 0:r.external)??void 0},_={},C=((a=i.external)==null?void 0:a.defs)??{},E=this.seen.get(t);if(!E)throw new Error("Unprocessed schema. This is a bug in Zod.");Object.assign(_,E.cached);const n=l=>{var o;if(l[1]===E)return{ref:"#"};const p=this.target==="draft-2020-12"?"$defs":"definitions";if(i.external){const h=(o=i.external.registry.get(l[0]))==null?void 0:o.id;if(h)return{ref:i.external.uri(h)};const s=l[1].defId??l[1].schema.id??`schema${this.counter++}`;return l[1].defId=s,{defId:s,ref:`${i.external.uri("__shared")}#/${p}/${s}`}}const y=`#/${p}/`,m=l[1].schema.id??`__schema${this.counter++}`;return{defId:m,ref:y+m}};for(const l of this.seen.entries()){const p=l[1];if(t===l[0]){St({schema:p.schema,ref:"#"});continue}if(i.external){const g=(u=i.external.registry.get(l[0]))==null?void 0:u.id;if(t!==l[0]&&g){const{ref:y,defId:m}=n(l);m&&(C[m]={...p.cached}),St({schema:p.schema,ref:y});continue}}if(p.cycle){if(i.cycles==="throw")throw new Error(`Cycle detected: #/${(d=p.cycle)==null?void 0:d.join("/")}/<root>
36
+
37
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);if(i.cycles==="ref"){const{ref:g,defId:y}=n(l);y&&(C[y]={...p.cached}),St({schema:p.schema,ref:g})}continue}if(p.count>1&&i.reused==="ref"){const{ref:g,defId:y}=n(l);y&&(C[y]={...p.cached}),St({schema:p.schema,ref:g});continue}}!i.external&&Object.keys(C).length>0&&(this.target==="draft-2020-12"?_.$defs=C:_.definitions=C);try{return JSON.parse(JSON.stringify(_))}catch(l){throw console.log(l),new Error("Error converting schema to JSON.")}}}function St(e){const{schema:t,ref:r}=e;for(const i in t)delete t[i],t.$ref=r}function Ma(e,t){if(e instanceof Ft){const i=new dr(t),_={};for(const n of e._idmap.entries()){const[a,u]=n;i.process(u)}console.log(i.seen.size);const C={},E={registry:e,uri:(t==null?void 0:t.uri)||(n=>n),defs:_};for(const n of e._idmap.entries()){const[a,u]=n;C[a]=i.emit(u,{...t,external:E})}if(Object.keys(_).length>0){const n=i.target==="draft-2020-12"?"$defs":"definitions";C.__shared={[n]:_}}return{schemas:C}}const r=new dr(t);return r.process(e),r.emit(e,t)}const ru=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),iu=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:wo,$ZodArray:ko,$ZodAsyncError:$e,$ZodBase64:uo,$ZodBase64URL:fo,$ZodBigInt:Lr,$ZodBigIntFormat:vo,$ZodBoolean:Rr,$ZodCIDRv4:ho,$ZodCIDRv6:lo,$ZodCUID:Yn,$ZodCUID2:Qn,$ZodCatch:jo,$ZodCheck:ne,$ZodCheckBigIntFormat:Rn,$ZodCheckEndsWith:Fn,$ZodCheckGreaterThan:kr,$ZodCheckIncludes:$n,$ZodCheckLengthEquals:Bn,$ZodCheckLessThan:Er,$ZodCheckLowerCase:Mn,$ZodCheckMaxLength:On,$ZodCheckMaxSize:Ln,$ZodCheckMimeType:jn,$ZodCheckMinLength:In,$ZodCheckMinSize:An,$ZodCheckMultipleOf:xn,$ZodCheckNumberFormat:Dn,$ZodCheckOverwrite:Wn,$ZodCheckProperty:Nn,$ZodCheckRegex:Pn,$ZodCheckSizeEquals:Tn,$ZodCheckStartsWith:Hn,$ZodCheckStringFormat:nt,$ZodCheckUpperCase:zn,$ZodCustom:Vo,$ZodDate:Eo,$ZodDefault:Ho,$ZodDiscriminatedUnion:Ro,$ZodE164:_o,$ZodEmail:Vn,$ZodEmoji:Jn,$ZodEnum:Io,$ZodError:ve,$ZodFile:Po,$ZodFunction:ze,$ZodGUID:Kn,$ZodIPv4:ao,$ZodIPv6:co,$ZodISODate:so,$ZodISODateTime:io,$ZodISODuration:oo,$ZodISOTime:no,$ZodInterface:lr,$ZodIntersection:Lo,$ZodJSONSchemaRegistry:Or,$ZodJWT:mo,$ZodKSUID:ro,$ZodLazy:qo,$ZodLiteral:Bo,$ZodMap:To,$ZodNaN:Wo,$ZodNanoID:Xn,$ZodNever:zt,$ZodNonOptional:Fo,$ZodNull:yo,$ZodNullable:$o,$ZodNumber:Dr,$ZodNumberFormat:go,$ZodObject:xo,$ZodObjectLike:$t,$ZodOptional:zo,$ZodPipe:Tr,$ZodPromise:Ko,$ZodReadonly:Zo,$ZodRecord:Ao,$ZodRegistry:Ft,$ZodSet:Oo,$ZodString:xr,$ZodStringFormat:te,$ZodSuccess:No,$ZodSymbol:bo,$ZodTemplateLiteral:Uo,$ZodTransform:Mo,$ZodTuple:Ht,$ZodType:Q,$ZodULID:eo,$ZodURL:Gn,$ZodUUID:qn,$ZodUndefined:So,$ZodUnion:Ar,$ZodUnknown:ot,$ZodVoid:Co,$ZodXID:to,$brand:Os,$constructor:M,$input:Xo,$output:Jo,Doc:Zn,JSONSchema:ru,JSONSchemaGenerator:dr,_any:ya,_array:Ta,_base64:Jr,_base64url:Xr,_bigint:_a,_boolean:da,_catch:Vl,_cidrv4:Vr,_cidrv6:Gr,_coercedBigint:pa,_coercedBoolean:fa,_coercedDate:Ea,_coercedNumber:oa,_coercedString:ea,_cuid:Nr,_cuid2:jr,_custom:Kt,_date:Ca,_default:Ul,_discriminatedUnion:Bl,_e164:Yr,_email:Ir,_emoji:Hr,_endsWith:oi,_enum:Hl,_file:Ia,_float32:ca,_float64:ha,_gt:Ae,_gte:ce,_guid:Et,_includes:si,_int:aa,_int32:la,_int64:ma,_interface:Dl,_intersection:Pl,_ipv4:Kr,_ipv6:qr,_isoDate:ra,_isoDateTime:ta,_isoDuration:sa,_isoTime:ia,_jwt:Qr,_ksuid:Ur,_lazy:Yl,_length:Ut,_literal:Nl,_looseInterface:Ll,_looseObject:Ol,_lowercase:ri,_lt:Le,_lte:fe,_map:zl,_max:fe,_maxLength:Zt,_maxSize:Wt,_mime:ai,_min:ce,_minLength:Ne,_minSize:it,_multipleOf:rt,_nan:ka,_nanoid:Fr,_nativeEnum:Fl,_negative:Da,_never:jt,_nonnegative:La,_nonoptional:Kl,_nonpositive:Ra,_normalize:ci,_null:Sa,_nullable:Zl,_number:na,_object:Al,_optional:Wl,_overwrite:Ie,_parse:vr,_parseAsync:Sr,_pipe:Gl,_positive:xa,_promise:Ql,_property:Aa,_readonly:Jl,_record:Ml,_refine:eu,_regex:ti,_safeParse:br,_safeParseAsync:yr,_set:$l,_size:ei,_startsWith:ni,_strictInterface:Rl,_strictObject:Tl,_string:Qo,_stringbool:Ba,_success:ql,_symbol:va,_templateLiteral:Xl,_toLowerCase:li,_toUpperCase:ui,_transform:jl,_trim:hi,_tuple:Oa,_uint32:ua,_uint64:ga,_ulid:Wr,_undefined:ba,_union:Il,_unknown:Nt,_uppercase:ii,_url:$r,_uuid:Br,_uuidv4:Pr,_uuidv6:Mr,_uuidv7:zr,_void:wa,_xid:Zr,clone:_e,config:oe,flattenError:js,formatError:Ws,function:Pa,globalConfig:or,globalRegistry:Ee,isValidJWT:po,jsonSchemaRegistry:xl,locales:kl,parse:ar,parseAsync:cr,prettifyError:Ks,regexes:En,registry:Yo,safeParse:nl,safeParseAsync:ol,toDotPath:Us,toJSONSchema:Ma,treeifyError:Zs,util:sl,version:Un},Symbol.toStringTag,{value:"Module"})),za=M("ZodISODateTime",(e,t)=>{io.init(e,t),ct.init(e,t)});function $a(e){return ta(za,e)}const Ha=M("ZodISODate",(e,t)=>{so.init(e,t),ct.init(e,t)});function Fa(e){return ra(Ha,e)}const Na=M("ZodISOTime",(e,t)=>{no.init(e,t),ct.init(e,t)});function ja(e){return ia(Na,e)}const Wa=M("ZodISODuration",(e,t)=>{oo.init(e,t),ct.init(e,t)});function Za(e){return sa(Wa,e)}const su=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:Ha,ZodISODateTime:za,ZodISODuration:Wa,ZodISOTime:Na,date:Fa,datetime:$a,duration:Za,time:ja},Symbol.toStringTag,{value:"Module"}));class at extends ve{format(t){return Ws(this,t)}flatten(t){return js(this,t)}addIssue(t){this.issues.push(t)}addIssues(t){this.issues.push(...t)}get isEmpty(){return this.issues.length===0}}const Ua=vr.bind({Error:at}),Ka=br.bind({Error:at}),qa=Sr.bind({Error:at}),Va=yr.bind({Error:at});function nu(e){return ea(qt,e)}function ou(e){return oa(Li,e)}function au(e){return fa(Vt,e)}function cu(e){return pa(Gt,e)}function hu(e){return Ea(Oi,e)}const lu=Object.freeze(Object.defineProperty({__proto__:null,bigint:cu,boolean:au,date:hu,number:ou,string:nu},Symbol.toStringTag,{value:"Module"})),G=M("ZodType",(e,t)=>(Q.init(e,t),e.def=t,e._def=t,e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"}}}:i)]}),e.clone=r=>_e(e,r??t),e.brand=()=>e,e.register=(r,i)=>(r.add(e,i),e),e.parse=(r,i)=>Ua(e,r,i),e.safeParse=(r,i)=>Ka(e,r,i),e.parseAsync=async(r,i)=>qa(e,r,i),e.safeParseAsync=async(r,i)=>Va(e,r,i),e.spa=e.safeParseAsync,e.refine=(r,i)=>e.check(Ic(r,i)),e.superRefine=r=>e.check(Bc(r)),e.overwrite=r=>e.check(Ie(r)),e.optional=r=>xt(e,r),e.nullable=r=>Dt(e,r),e.nullish=()=>xt(Dt(e)),e.nonoptional=r=>yc(e,r),e.array=()=>Ii(e),e.or=r=>Mi([e,r]),e.and=r=>cc(e,r),e.transform=r=>Rt(e,$i(r)),e.default=(r,i)=>Sc(e,r,i),e.catch=r=>Ec(e,r),e.pipe=r=>Rt(e,r),e.readonly=()=>Dc(e),e.describe=r=>{const i=e.clone(),_=Ee.get(e)??{};return _.description=r,Ee.add(i,_),i},Object.defineProperty(e,"description",{get(){var r;return(r=Ee.get(e))==null?void 0:r.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ee.get(e);const i=e.clone();return Ee.add(i,r[0]),i},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),qt=M("ZodString",(e,t)=>{xr.init(e,t),G.init(e,t),e.format=e._zod.computed.format??null,e.minLength=e._zod.computed.minimum??null,e.maxLength=e._zod.computed.maximum??null,e.email=r=>e.check(Ir(di,r)),e.url=r=>e.check($r(fi,r)),e.jwt=r=>e.check(Qr(Ri,r)),e.emoji=r=>e.check(Hr(_i,r)),e.guid=r=>e.check(Et(kt,r)),e.uuid=r=>e.check(Br(Se,r)),e.uuidv4=r=>e.check(Pr(Se,r)),e.uuidv6=r=>e.check(Mr(Se,r)),e.uuidv7=r=>e.check(zr(Se,r)),e.nanoid=r=>e.check(Fr(pi,r)),e.guid=r=>e.check(Et(kt,r)),e.cuid=r=>e.check(Nr(mi,r)),e.cuid2=r=>e.check(jr(gi,r)),e.ulid=r=>e.check(Wr(vi,r)),e.base64=r=>e.check(Jr(ki,r)),e.base64url=r=>e.check(Xr(xi,r)),e.xid=r=>e.check(Zr(bi,r)),e.ksuid=r=>e.check(Ur(Si,r)),e.ipv4=r=>e.check(Kr(yi,r)),e.ipv6=r=>e.check(qr(wi,r)),e.cidrv4=r=>e.check(Vr(Ci,r)),e.cidrv6=r=>e.check(Gr(Ei,r)),e.e164=r=>e.check(Yr(Di,r)),e.datetime=r=>e.check($a(r)),e.date=r=>e.check(Fa(r)),e.time=r=>e.check(ja(r)),e.duration=r=>e.check(Za(r)),e.regex=(...r)=>e.check(ti(...r)),e.includes=(...r)=>e.check(si(...r)),e.startsWith=r=>e.check(ni(r)),e.endsWith=r=>e.check(oi(r)),e.min=(...r)=>e.check(Ne(...r)),e.max=(...r)=>e.check(Zt(...r)),e.length=(...r)=>e.check(Ut(...r)),e.nonempty=(...r)=>e.check(Ne(1,...r)),e.lowercase=r=>e.check(ri(r)),e.uppercase=r=>e.check(ii(r)),e.trim=()=>e.check(hi()),e.normalize=(...r)=>e.check(ci(...r)),e.toLowerCase=()=>e.check(li()),e.toUpperCase=()=>e.check(ui())});function fr(e){return Qo(qt,e)}const ct=M("ZodStringFormat",(e,t)=>{te.init(e,t),qt.init(e,t)}),di=M("ZodEmail",(e,t)=>{Vn.init(e,t),G.init(e,t)});function uu(e){return Ir(di,e)}const kt=M("ZodGUID",(e,t)=>{Kn.init(e,t),G.init(e,t)});function du(e){return Et(kt,e)}const Se=M("ZodUUID",(e,t)=>{qn.init(e,t),G.init(e,t)});function fu(e){return Br(Se,e)}function _u(e){return Pr(Se,e)}function pu(e){return Mr(Se,e)}function mu(e){return zr(Se,e)}const fi=M("ZodURL",(e,t)=>{Gn.init(e,t),G.init(e,t)});function gu(e){return $r(fi,e)}const _i=M("ZodEmoji",(e,t)=>{Jn.init(e,t),G.init(e,t)});function vu(e){return Hr(_i,e)}const pi=M("ZodNanoID",(e,t)=>{Xn.init(e,t),G.init(e,t)});function bu(e){return Fr(pi,e)}const mi=M("ZodCUID",(e,t)=>{Yn.init(e,t),G.init(e,t)});function Su(e){return Nr(mi,e)}const gi=M("ZodCUID2",(e,t)=>{Qn.init(e,t),G.init(e,t)});function yu(e){return jr(gi,e)}const vi=M("ZodULID",(e,t)=>{eo.init(e,t),G.init(e,t)});function wu(e){return Wr(vi,e)}const bi=M("ZodXID",(e,t)=>{to.init(e,t),G.init(e,t)});function Cu(e){return Zr(bi,e)}const Si=M("ZodKSUID",(e,t)=>{ro.init(e,t),G.init(e,t)});function Eu(e){return Ur(Si,e)}const yi=M("ZodIPv4",(e,t)=>{ao.init(e,t),G.init(e,t)});function ku(e){return Kr(yi,e)}const wi=M("ZodIPv6",(e,t)=>{co.init(e,t),G.init(e,t)});function xu(e){return qr(wi,e)}const Ci=M("ZodCIDRv4",(e,t)=>{ho.init(e,t),G.init(e,t)});function Du(e){return Vr(Ci,e)}const Ei=M("ZodCIDRv6",(e,t)=>{lo.init(e,t),G.init(e,t)});function Ru(e){return Gr(Ei,e)}const ki=M("ZodBase64",(e,t)=>{uo.init(e,t),G.init(e,t)});function Lu(e){return Jr(ki,e)}const xi=M("ZodBase64URL",(e,t)=>{fo.init(e,t),G.init(e,t)});function Au(e){return Xr(xi,e)}const Di=M("ZodE164",(e,t)=>{_o.init(e,t),G.init(e,t)});function Tu(e){return Yr(Di,e)}const Ri=M("ZodJWT",(e,t)=>{mo.init(e,t),G.init(e,t)});function Ou(e){return Qr(Ri,e)}const Li=M("ZodNumber",(e,t)=>{Dr.init(e,t),G.init(e,t),e.gt=(r,i)=>e.check(Ae(r,i)),e.gte=(r,i)=>e.check(ce(r,i)),e.min=(r,i)=>e.check(ce(r,i)),e.lt=(r,i)=>e.check(Le(r,i)),e.lte=(r,i)=>e.check(fe(r,i)),e.max=(r,i)=>e.check(fe(r,i)),e.int=r=>e.check(_r(r)),e.safe=r=>e.check(_r(r)),e.positive=r=>e.check(Ae(0,r)),e.nonnegative=r=>e.check(ce(0,r)),e.negative=r=>e.check(Le(0,r)),e.nonpositive=r=>e.check(fe(0,r)),e.multipleOf=(r,i)=>e.check(rt(r,i)),e.step=(r,i)=>e.check(rt(r,i)),e.finite=()=>e,e.minValue=e._zod.computed.minimum??null,e.maxValue=e._zod.computed.maximum??null,e.isInt=(e._zod.computed.format??"").includes("int")||Number.isSafeInteger(e._zod.computed.multipleOf??.5),e.isFinite=!0,e.format=e._zod.computed.format??null});function Ga(e){return na(Li,e)}const Ze=M("ZodNumberFormat",(e,t)=>{go.init(e,t),G.init(e,t)});function _r(e){return aa(Ze,e)}function Iu(e){return ca(Ze,e)}function Bu(e){return ha(Ze,e)}function Pu(e){return la(Ze,e)}function Mu(e){return ua(Ze,e)}const Vt=M("ZodBoolean",(e,t)=>{Rr.init(e,t),G.init(e,t)});function Ja(e){return da(Vt,e)}const Gt=M("ZodBigInt",(e,t)=>{Lr.init(e,t),G.init(e,t),e.gte=(r,i)=>e.check(ce(r,i)),e.min=(r,i)=>e.check(ce(r,i)),e.gt=(r,i)=>e.check(Ae(r,i)),e.gte=(r,i)=>e.check(ce(r,i)),e.min=(r,i)=>e.check(ce(r,i)),e.lt=(r,i)=>e.check(Le(r,i)),e.lte=(r,i)=>e.check(fe(r,i)),e.max=(r,i)=>e.check(fe(r,i)),e.positive=r=>e.check(Ae(BigInt(0),r)),e.negative=r=>e.check(Le(BigInt(0),r)),e.nonpositive=r=>e.check(fe(BigInt(0),r)),e.nonnegative=r=>e.check(ce(BigInt(0),r)),e.multipleOf=(r,i)=>e.check(rt(r,i)),e.minValue=e._zod.computed.minimum??null,e.maxValue=e._zod.computed.maximum??null,e.format=e._zod.computed.format??null});function zu(e){return _a(Gt,e)}const Ai=M("ZodBigIntFormat",(e,t)=>{vo.init(e,t),Gt.init(e,t)});function $u(e){return ma(Ai,e)}function Hu(e){return ga(Ai,e)}const Xa=M("ZodSymbol",(e,t)=>{bo.init(e,t),G.init(e,t)});function Fu(e){return va(Xa,e)}const Ya=M("ZodUndefined",(e,t)=>{So.init(e,t),G.init(e,t)});function Nu(e){return ba(Ya,e)}const Qa=M("ZodNull",(e,t)=>{yo.init(e,t),G.init(e,t)});function ec(e){return Sa(Qa,e)}const tc=M("ZodAny",(e,t)=>{wo.init(e,t),G.init(e,t)});function ju(e){return ya(tc,e)}const Ti=M("ZodUnknown",(e,t)=>{ot.init(e,t),G.init(e,t)});function je(e){return Nt(Ti,e)}const rc=M("ZodNever",(e,t)=>{zt.init(e,t),G.init(e,t)});function ht(e){return jt(rc,e)}const ic=M("ZodVoid",(e,t)=>{Co.init(e,t),G.init(e,t)});function Wu(e){return wa(ic,e)}const Oi=M("ZodDate",(e,t)=>{Eo.init(e,t),G.init(e,t),e.min=(i,_)=>e.check(ce(i,_)),e.max=(i,_)=>e.check(fe(i,_));const r=e._zod.computed;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function Zu(e){return Ca(Oi,e)}const sc=M("ZodArray",(e,t)=>{ko.init(e,t),G.init(e,t),e.element=t.element,e.min=(r,i)=>e.check(Ne(r,i)),e.nonempty=r=>e.check(Ne(1,r)),e.max=(r,i)=>e.check(Zt(r,i)),e.length=(r,i)=>e.check(Ut(r,i))});function Ii(e,t){return Ta(sc,e,t)}const Uu=M("ZodObjectLike",(e,t)=>{$t.init(e,t),G.init(e,t)});function Ku(e){const t=e._zod.def.type==="interface"?xe(e._zod.def.shape).shape:e._zod.def.shape;return pc(Object.keys(t))}const lt=M("ZodInterface",(e,t)=>{lr.init(e,t),G.init(e,t),e.keyof=()=>zi(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.loose=()=>e.clone({...e._zod.def,catchall:je()}),e.strict=()=>e.clone({...e._zod.def,catchall:ht()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>r instanceof lr?tt(e,r):tt(e,Bi(r)),e.merge=r=>Re(e,r),e.pick=r=>Tt(e,r),e.omit=r=>Ot(e,r),e.partial=(...r)=>It(ut,e,r[0]),e.required=(...r)=>Bt(dt,e,r[0])});function Bi(e,t,r=lt){const i=ye(()=>xe(e)),_={type:"interface",get shape(){const C=i.value.shape;return ge(this,"shape",C),C},get optional(){return i.value.optional},...z(t)};return new r(_)}function qu(e,t){const r=ye(()=>xe(e)),i={type:"interface",get shape(){const _=r.value.shape;return ge(this,"shape",_),_},get optional(){return r.value.optional},catchall:ht(),...z(t)};return new lt(i)}function Vu(e,t){const r=ye(()=>xe(e)),i={type:"interface",get optional(){return r.value.optional},get shape(){const _=r.value.shape;return ge(this,"shape",_),_},catchall:je(),...z(t)};return new lt(i)}const Ue=M("ZodObject",(e,t)=>{xo.init(e,t),G.init(e,t),e.shape=t.shape,e.keyof=()=>zi(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:je()}),e.loose=()=>e.clone({...e._zod.def,catchall:je()}),e.strict=()=>e.clone({...e._zod.def,catchall:ht()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>r instanceof Ue?tt(e,r):tt(e,Pi(r)),e.merge=r=>Re(e,r),e.pick=r=>Tt(e,r),e.omit=r=>Ot(e,r),e.partial=(...r)=>It(ut,e,r[0]),e.required=(...r)=>Bt(dt,e,r[0])});function Pi(e,t){const r={type:"object",shape:e??{},get optional(){return Oe(e??{})},...z(t)};return new Ue(r)}function Gu(e,t){return new Ue({type:"object",shape:e,get optional(){return Oe(e)},catchall:ht(),...z(t)})}function Ju(e,t){return new Ue({type:"object",shape:e,get optional(){return Oe(e)},catchall:je(),...z(t)})}function Xu(e,t){return t instanceof Q?Re(e,t):e instanceof lt?Re(e,Bi(t)):e instanceof Ue?Re(e,Pi(t)):Ns(e,t)}function Yu(e,t){return Re(e,t)}function Qu(e,t){return Tt(e,t)}function ed(e,t){return Ot(e,t)}function td(e,t){return It(ut,e,t)}function rd(e,t){return Bt(dt,e,t)}const nc=M("ZodUnion",(e,t)=>{Ar.init(e,t),G.init(e,t),e.options=t.options});function Mi(e,t){return new nc({type:"union",options:e,...z(t)})}const oc=M("ZodDiscriminatedUnion",(e,t)=>{Ro.init(e,t),G.init(e,t)});function id(...e){typeof e[0]=="string"&&(e=e.slice(1));const[t,r]=e;return new oc({type:"union",options:t,...z(r)})}const ac=M("ZodIntersection",(e,t)=>{Lo.init(e,t),G.init(e,t)});function cc(e,t,r){return new ac({type:"intersection",left:e,right:t,...z(r)})}const hc=M("ZodTuple",(e,t)=>{Ht.init(e,t),G.init(e,t),e.rest=r=>e.clone({...e._zod.def,rest:r})});function sd(e,t,r){const i=t instanceof Q,_=i?r:t,C=i?t:null;return new hc({type:"tuple",items:e,rest:C,...z(_)})}const lc=M("ZodRecord",(e,t)=>{Ao.init(e,t),G.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function uc(e,t,r){return new lc({type:"record",keyType:e,valueType:t,...z(r)})}const dc=M("ZodMap",(e,t)=>{To.init(e,t),G.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function nd(e,t,r){return new dc({type:"map",keyType:e,valueType:t,...z(r)})}const fc=M("ZodSet",(e,t)=>{Oo.init(e,t),G.init(e,t),e.min=(...r)=>e.check(it(...r)),e.nonempty=r=>e.check(it(1,r)),e.max=(...r)=>e.check(Wt(...r)),e.size=(...r)=>e.check(ei(...r))});function od(e,t){return new fc({type:"set",valueType:e,...z(t)})}const st=M("ZodEnum",(e,t)=>{Io.init(e,t),G.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(i,_)=>{const C={};for(const E of i)if(r.has(E))C[E]=t.entries[E];else throw new Error(`Key ${E} not found in enum`);return new st({...t,checks:[],...z(_),entries:C})},e.exclude=(i,_)=>{const C={...t.entries};for(const E of i)if(r.has(E))delete C[E];else throw new Error(`Key ${E} not found in enum`);return new st({...t,checks:[],...z(_),entries:C})}});function zi(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new st({type:"enum",entries:r,...z(t)})}function ad(e,t){return new st({type:"enum",entries:e,...z(t)})}const _c=M("ZodLiteral",(e,t)=>{Bo.init(e,t),G.init(e,t),e.values=new Set(t.values)});function pc(e,t){return new _c({type:"literal",values:Array.isArray(e)?e:[e],...z(t)})}const mc=M("ZodFile",(e,t)=>{Po.init(e,t),G.init(e,t),e.min=(r,i)=>e.check(it(r,i)),e.max=(r,i)=>e.check(Wt(r,i)),e.mime=(r,i)=>e.check(ai(r,i))});function cd(e){return Ia(mc,e)}const gc=M("ZodTransform",(e,t)=>{Mo.init(e,t),G.init(e,t),e._zod.parse=(r,i)=>{r.addIssue=C=>{if(typeof C=="string")r.issues.push(He(C,r.value,t));else{const E=C;E.fatal&&(E.continue=!1),E.code??(E.code="custom"),E.input??(E.input=r.value),E.inst??(E.inst=e),E.continue??(E.continue=!t.abort),r.issues.push(He(E))}};const _=t.transform(r.value,r);return _ instanceof Promise?_.then(C=>(r.value=C,r)):(r.value=_,r)}});function $i(e,t){return new gc({type:"transform",transform:e,...z(t)})}const ut=M("ZodOptional",(e,t)=>{zo.init(e,t),G.init(e,t),e.unwrap=()=>e._zod.def.innerType});function xt(e,t){return new ut({type:"optional",innerType:e,...z(t)})}const vc=M("ZodNullable",(e,t)=>{$o.init(e,t),G.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Dt(e,t){return new vc({type:"nullable",innerType:e,...z(t)})}function hd(e){return xt(Dt(e))}const bc=M("ZodDefault",(e,t)=>{Ho.init(e,t),G.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Sc(e,t,r){return new bc({type:"default",defaultValue:typeof t=="function"?t:()=>t,innerType:e,...z(r)})}const dt=M("ZodNonOptional",(e,t)=>{Fo.init(e,t),G.init(e,t),e.unwrap=()=>e._zod.def.innerType});function yc(e,t){return new dt({type:"nonoptional",innerType:e,...z(t)})}const wc=M("ZodSuccess",(e,t)=>{No.init(e,t),G.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ld(e,t){return new wc({type:"success",innerType:e,...z(t)})}const Cc=M("ZodCatch",(e,t)=>{jo.init(e,t),G.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ec(e,t,r){return new Cc({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t,...z(r)})}const kc=M("ZodNaN",(e,t)=>{Wo.init(e,t),G.init(e,t)});function ud(e){return ka(kc,e)}const Hi=M("ZodPipe",(e,t)=>{Tr.init(e,t),G.init(e,t),e.in=t.in,e.out=t.out});function Rt(e,t,r){return new Hi({type:"pipe",in:e,out:t,...z(r)})}const xc=M("ZodReadonly",(e,t)=>{Zo.init(e,t),G.init(e,t)});function Dc(e,t){return new xc({type:"readonly",innerType:e,...z(t)})}const Rc=M("ZodTemplateLiteral",(e,t)=>{Uo.init(e,t),G.init(e,t)});function dd(e,t){return new Rc({type:"template_literal",parts:e,...z(t)})}const Lc=M("ZodLazy",(e,t)=>{qo.init(e,t),G.init(e,t),e.unwrap=()=>e._zod.def.getter()});function Ac(e){return new Lc({type:"lazy",getter:e})}const Tc=M("ZodPromise",(e,t)=>{Ko.init(e,t),G.init(e,t),e.unwrap=()=>e._zod.def.innerType});function fd(e,t){return new Tc({type:"promise",innerType:e,...z(t)})}const Jt=M("ZodCustom",(e,t)=>{Vo.init(e,t),G.init(e,t)});function Oc(e,t){const r=new ne({check:"custom",...z(t)});return r._zod.check=e,r}function _d(e,t){return Kt(Jt,e??(()=>!0),t)}function Ic(e,t={}){return Kt(Jt,e,t)}function Bc(e,t){const r=Oc(i=>(i.addIssue=_=>{if(typeof _=="string")i.issues.push(He(_,i.value,r._zod.def));else{const C=_;C.fatal&&(C.continue=!1),C.code??(C.code="custom"),C.input??(C.input=i.value),C.inst??(C.inst=r),C.continue??(C.continue=!r._zod.def.abort),i.issues.push(He(C))}},e(i.value,i)),t);return r}function pd(e,t={error:`Input not instance of ${e.name}`}){return new Jt({type:"custom",check:"custom",fn:r=>r instanceof e,abort:!0,...z(t)})}const md=Ba.bind(null,{Pipe:Hi,Boolean:Vt,Unknown:Ti});function gd(e){const t=Ac(()=>Mi([fr(e),Ga(),Ja(),ec(),Ii(t),uc(fr(),t)]));return t}function vd(e,t,r){return Rt($i(e,r),t,r)}const bd={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"},Sd=Object.freeze({status:"aborted"}),yd=Sd;function wd(e){oe({customError:e})}function Cd(){return oe().customError}oe(Go());const Ed=Object.freeze(Object.defineProperty({__proto__:null,$brand:Os,$input:Xo,$output:Jo,NEVER:yd,ZodAny:tc,ZodArray:sc,ZodBase64:ki,ZodBase64URL:xi,ZodBigInt:Gt,ZodBigIntFormat:Ai,ZodBoolean:Vt,ZodCIDRv4:Ci,ZodCIDRv6:Ei,ZodCUID:mi,ZodCUID2:gi,ZodCatch:Cc,ZodCustom:Jt,ZodDate:Oi,ZodDefault:bc,ZodDiscriminatedUnion:oc,ZodE164:Di,ZodEmail:di,ZodEmoji:_i,ZodEnum:st,ZodError:at,ZodFile:mc,ZodGUID:kt,ZodIPv4:yi,ZodIPv6:wi,ZodInterface:lt,ZodIntersection:ac,ZodIssueCode:bd,ZodJWT:Ri,ZodKSUID:Si,ZodLazy:Lc,ZodLiteral:_c,ZodMap:dc,ZodNaN:kc,ZodNanoID:pi,ZodNever:rc,ZodNonOptional:dt,ZodNull:Qa,ZodNullable:vc,ZodNumber:Li,ZodNumberFormat:Ze,ZodObject:Ue,ZodObjectLike:Uu,ZodOptional:ut,ZodPipe:Hi,ZodPromise:Tc,ZodReadonly:xc,ZodRecord:lc,ZodSet:fc,ZodString:qt,ZodStringFormat:ct,ZodSuccess:wc,ZodSymbol:Xa,ZodTemplateLiteral:Rc,ZodTransform:gc,ZodTuple:hc,ZodType:G,ZodULID:vi,ZodURL:fi,ZodUUID:Se,ZodUndefined:Ya,ZodUnion:nc,ZodUnknown:Ti,ZodVoid:ic,ZodXID:bi,_default:Sc,any:ju,array:Ii,base64:Lu,base64url:Au,bigint:zu,boolean:Ja,catch:Ec,check:Oc,cidrv4:Du,cidrv6:Ru,clone:_e,coerce:lu,config:oe,core:iu,cuid:Su,cuid2:yu,custom:_d,date:Zu,discriminatedUnion:id,e164:Tu,email:uu,emoji:vu,endsWith:oi,enum:zi,extend:Xu,file:cd,float32:Iu,float64:Bu,function:Pa,getErrorMap:Cd,globalRegistry:Ee,gt:Ae,gte:ce,guid:du,includes:si,instanceof:pd,int:_r,int32:Pu,int64:$u,interface:Bi,intersection:cc,ipv4:ku,ipv6:xu,iso:su,json:gd,jwt:Ou,keyof:Ku,ksuid:Eu,lazy:Ac,length:Ut,literal:pc,looseInterface:Vu,looseObject:Ju,lowercase:ri,lt:Le,lte:fe,map:nd,maxLength:Zt,maxSize:Wt,merge:Yu,mime:ai,minLength:Ne,minSize:it,multipleOf:rt,nan:ud,nanoid:bu,nativeEnum:ad,negative:Da,never:ht,nonnegative:La,nonoptional:yc,nonpositive:Ra,normalize:ci,null:ec,nullable:Dt,nullish:hd,number:Ga,object:Pi,omit:ed,optional:xt,overwrite:Ie,parse:Ua,parseAsync:qa,partial:td,pick:Qu,pipe:Rt,positive:xa,preprocess:vd,prettifyError:Ks,promise:fd,property:Aa,readonly:Dc,record:uc,refine:Ic,regex:ti,regexes:En,registry:Yo,required:rd,safeParse:Ka,safeParseAsync:Va,set:od,setErrorMap:wd,size:ei,startsWith:ni,strictInterface:qu,strictObject:Gu,string:fr,stringbool:md,success:ld,superRefine:Bc,symbol:Fu,templateLiteral:dd,toJSONSchema:Ma,toLowerCase:li,toUpperCase:ui,transform:$i,treeifyError:Zs,trim:hi,tuple:sd,uint32:Mu,uint64:Hu,ulid:wu,undefined:Nu,union:Mi,unknown:je,uppercase:ii,url:gu,uuid:fu,uuidv4:_u,uuidv6:pu,uuidv7:mu,void:Wu,xid:Cu},Symbol.toStringTag,{value:"Module"}));function kd(e){const t=/\x1b\[<(\d+);(\d+);(\d+)([mM])/.exec(e);if(!t)return;if(!t[1]||!t[2]||!t[3]||!t[4])throw new Error(`Mouse event: Invalid match for data ${e}`);const r=parseInt(t[1],10),i=parseInt(t[2],10),_=parseInt(t[3],10),C=t[4]==="m";return console.log(`Mouse event: buttonCode=${r}, column=${i}, row=${_}, isRelease=${C}`),e}function Pc(e,t){const r=new Wh.Terminal({cursorBlink:!1,convertEol:!0,fontSize:13}),i=As.macchiato.colors;r.options.theme={background:i.base.hex,black:i.crust.hex,brightBlack:i.surface2.hex,blue:i.blue.hex,brightBlue:i.blue.hex,brightCyan:i.sky.hex,brightRed:i.maroon.hex,brightYellow:i.yellow.hex,cursor:i.text.hex,cyan:i.sky.hex,foreground:i.text.hex,green:i.green.hex,magenta:i.lavender.hex,red:i.red.hex,white:i.text.hex,yellow:i.yellow.hex};const _=new Nh.FitAddon;return r.loadAddon(_),r.open(e),_.fit(),window.addEventListener("resize",()=>{_.fit()}),r.onData(C=>{if(typeof C!="string")throw new Error(`unexpected onData message type: '${JSON.stringify(C)}'`);const E=kd(C);E&&t.onMouseEvent(E)}),r.onKey(C=>{t.onKeyPress(C)}),r}function Mc(){let e=Ed.string().safeParse(sessionStorage.getItem("tabId")).data;return e||(e=Math.random().toString(36),sessionStorage.setItem("tabId",e)),{tabId:e}}class xd{constructor(t){me(this,"ready");me(this,"tabId");me(this,"terminal");me(this,"trpc");const r=Es({links:[Rs({condition:C=>C.type==="subscription",true:Ls({url:"/trpc"}),false:Ds({url:"/trpc"})})]});this.trpc=r,this.tabId=Mc();const i=this.tabId,_=Pc(t,{onMouseEvent(C){r.neovim.sendStdin.mutate({tabId:i,data:C}).catch(E=>{console.error("Error sending mouse event",E)})},onKeyPress(C){r.neovim.sendStdin.mutate({tabId:i,data:C.key})}});this.terminal=_,this.ready=new Promise(C=>{console.log("Subscribing to stdout"),r.neovim.initializeStdout.subscribe({client:i},{onStarted(){C()},onData(E){_.write(E)},onError(E){console.error("Error from the application",E)}})})}async startNeovim(t){return await this.ready,await this.trpc.neovim.start.mutate({startNeovimArguments:{filename:t.filename,additionalEnvironmentVariables:t.additionalEnvironmentVariables,startupScriptModifications:t.startupScriptModifications,terminalDimensions:{cols:this.terminal.cols,rows:this.terminal.rows}},tabId:this.tabId})}async runBlockingShellCommand(t){return await this.ready,this.trpc.neovim.runBlockingShellCommand.mutate({...t,tabId:this.tabId})}async runLuaCode(t){return await this.ready,this.trpc.neovim.runLuaCode.mutate({...t,tabId:this.tabId})}async waitForLuaCode(t){await this.ready;try{return await this.trpc.neovim.waitForLuaCode.mutate({...t,tabId:this.tabId})}catch(r){throw r}}async runExCommand(t){return await this.ready,this.trpc.neovim.runExCommand.mutate({...t,tabId:this.tabId})}}class Dd{constructor(t){me(this,"ready");me(this,"tabId");me(this,"terminal");me(this,"trpc");const r=Es({links:[Rs({condition:C=>C.type==="subscription",true:Ls({url:"/trpc"}),false:Ds({url:"/trpc"})})]});this.trpc=r,this.tabId=Mc();const i=this.tabId,_=Pc(t,{onMouseEvent(C){r.terminal.sendStdin.mutate({tabId:i,data:C}).catch(E=>{console.error("Error sending mouse event",E)})},onKeyPress(C){r.terminal.sendStdin.mutate({tabId:i,data:C.key})}});this.terminal=_,this.ready=new Promise(C=>{console.log("Subscribing to stdout"),r.terminal.onStdout.subscribe({client:i},{onStarted(){C()},onData(E){_.write(E)},onError(E){console.error("Error from the application",E)}})})}async startTerminalApplication(t){return await this.ready,await this.trpc.terminal.start.mutate({tabId:this.tabId,startTerminalArguments:{additionalEnvironmentVariables:t.additionalEnvironmentVariables,commandToRun:t.commandToRun,terminalDimensions:{cols:this.terminal.cols,rows:this.terminal.rows}}})}async runBlockingShellCommand(t){return await this.ready,this.trpc.terminal.runBlockingShellCommand.mutate({...t,tabId:this.tabId})}}class zc{constructor(t){me(this,"value");this.factory=t}get(){return this.value===void 0&&(this.value=this.factory()),this.value}}const Fi=document.querySelector("#app");if(!Fi)throw new Error("No app element found");const Rd=new zc(()=>new xd(Fi)),Ld=new zc(()=>new Dd(Fi));window.startNeovim=async function(e){const t=Rd.get(),r=await t.startNeovim({additionalEnvironmentVariables:e==null?void 0:e.additionalEnvironmentVariables,filename:(e==null?void 0:e.filename)??"initial-file.txt",startupScriptModifications:(e==null?void 0:e.startupScriptModifications)??[]});return{runBlockingShellCommand(_){return t.runBlockingShellCommand(_)},runLuaCode(_){return t.runLuaCode(_)},waitForLuaCode(_){return t.waitForLuaCode(_)},runExCommand(_){return t.runExCommand(_)},dir:r}};window.startTerminalApplication=async function(e){const t=Ld.get();return{dir:await t.startTerminalApplication(e),runBlockingShellCommand(_){return t.runBlockingShellCommand(_)}}};