mulmoterminal 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,186 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(e&&(t=e(e=0)),t),s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,a)=>(a=n==null?{}:e(i(n)),l(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),d=e=>a.call(e,`module.exports`)?e[`module.exports`]:l(t({},`__esModule`,{value:!0}),e);(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function f(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var p={},m=[],h=()=>{},g=()=>!1,_=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),v=e=>e.startsWith(`onUpdate:`),y=Object.assign,b=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},x=Object.prototype.hasOwnProperty,S=(e,t)=>x.call(e,t),C=Array.isArray,ee=e=>k(e)===`[object Map]`,te=e=>k(e)===`[object Set]`,ne=e=>k(e)===`[object Date]`,w=e=>typeof e==`function`,T=e=>typeof e==`string`,E=e=>typeof e==`symbol`,D=e=>typeof e==`object`&&!!e,re=e=>(D(e)||w(e))&&w(e.then)&&w(e.catch),O=Object.prototype.toString,k=e=>O.call(e),A=e=>k(e).slice(8,-1),j=e=>k(e)===`[object Object]`,ie=e=>T(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,ae=f(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),oe=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},se=/-\w/g,ce=oe(e=>e.replace(se,e=>e.slice(1).toUpperCase())),le=/\B([A-Z])/g,ue=oe(e=>e.replace(le,`-$1`).toLowerCase()),de=oe(e=>e.charAt(0).toUpperCase()+e.slice(1)),fe=oe(e=>e?`on${de(e)}`:``),pe=(e,t)=>!Object.is(e,t),me=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},M=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},he=e=>{let t=parseFloat(e);return isNaN(t)?e:t},ge,_e=()=>ge||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{};function ve(e){if(C(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=T(r)?Se(r):ve(r);if(i)for(let e in i)t[e]=i[e]}return t}else if(T(e)||D(e))return e}var ye=/;(?![^(]*\))/g,be=/:([^]+)/,xe=/\/\*[^]*?\*\//g;function Se(e){let t={};return e.replace(xe,``).split(ye).forEach(e=>{if(e){let n=e.split(be);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function Ce(e){let t=``;if(T(e))t=e;else if(C(e))for(let n=0;n<e.length;n++){let r=Ce(e[n]);r&&(t+=r+` `)}else if(D(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}var we=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,Te=f(we);we+``;function Ee(e){return!!e||e===``}function De(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=Oe(e[r],t[r]);return n}function Oe(e,t){if(e===t)return!0;let n=ne(e),r=ne(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=E(e),r=E(t),n||r)return e===t;if(n=C(e),r=C(t),n||r)return n&&r?De(e,t):!1;if(n=D(e),r=D(t),n||r){if(!n||!r||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e){let r=e.hasOwnProperty(n),i=t.hasOwnProperty(n);if(r&&!i||!r&&i||!Oe(e[n],t[n]))return!1}}return String(e)===String(t)}function ke(e,t){return e.findIndex(e=>Oe(e,t))}var Ae=e=>!!(e&&e.__v_isRef===!0),N=e=>T(e)?e:e==null?``:C(e)||D(e)&&(e.toString===O||!w(e.toString))?Ae(e)?N(e.value):JSON.stringify(e,je,2):String(e),je=(e,t)=>Ae(t)?je(e,t.value):ee(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[Me(t,r)+` =>`]=n,e),{})}:te(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>Me(e))}:E(t)?Me(t):D(t)&&!C(t)&&!j(t)?String(t):t,Me=(e,t=``)=>E(e)?`Symbol(${e.description??t})`:e,Ne,Pe=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&Ne&&(Ne.active?(this.parent=Ne,this.index=(Ne.scopes||=[]).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){let t=Ne;try{return Ne=this,e()}finally{Ne=t}}}on(){++this._on===1&&(this.prevScope=Ne,Ne=this)}off(){if(this._on>0&&--this._on===0){if(Ne===this)Ne=this.prevScope;else{let e=Ne;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}};function Fe(){return Ne}var P,Ie=new WeakSet,Le=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Ne&&(Ne.active?Ne.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Ie.has(this)&&(Ie.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Ve(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,et(this),We(this);let e=P,t=Xe;P=this,Xe=!0;try{return this.fn()}finally{Ge(this),P=e,Xe=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Je(e);this.deps=this.depsTail=void 0,et(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Ie.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Ke(this)&&this.run()}get dirty(){return Ke(this)}},Re=0,ze,Be;function Ve(e,t=!1){if(e.flags|=8,t){e.next=Be,Be=e;return}e.next=ze,ze=e}function He(){Re++}function Ue(){if(--Re>0)return;if(Be){let e=Be;for(Be=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;ze;){let t=ze;for(ze=void 0;t;){let n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(t){e||=t}t=n}}if(e)throw e}function We(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Ge(e){let t,n=e.depsTail,r=n;for(;r;){let e=r.prevDep;r.version===-1?(r===n&&(n=e),Je(r),Ye(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function Ke(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(qe(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function qe(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===tt)||(e.globalVersion=tt,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Ke(e))))return;e.flags|=2;let t=e.dep,n=P,r=Xe;P=e,Xe=!0;try{We(e);let n=e.fn(e._value);(t.version===0||pe(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{P=n,Xe=r,Ge(e),e.flags&=-3}}function Je(e,t=!1){let{dep:n,prevSub:r,nextSub:i}=e;if(r&&(r.nextSub=i,e.prevSub=void 0),i&&(i.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)Je(e,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Ye(e){let{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}var Xe=!0,Ze=[];function Qe(){Ze.push(Xe),Xe=!1}function $e(){let e=Ze.pop();Xe=e===void 0?!0:e}function et(e){let{cleanup:t}=e;if(e.cleanup=void 0,t){let e=P;P=void 0;try{t()}finally{P=e}}}var tt=0,nt=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},rt=class{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!P||!Xe||P===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==P)t=this.activeLink=new nt(P,this),P.deps?(t.prevDep=P.depsTail,P.depsTail.nextDep=t,P.depsTail=t):P.deps=P.depsTail=t,it(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){let e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=P.depsTail,t.nextDep=void 0,P.depsTail.nextDep=t,P.depsTail=t,P.deps===t&&(P.deps=e)}return t}trigger(e){this.version++,tt++,this.notify(e)}notify(e){He();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{Ue()}}};function it(e){if(e.dep.sc++,e.sub.flags&4){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)it(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}var at=new WeakMap,ot=Symbol(``),st=Symbol(``),ct=Symbol(``);function lt(e,t,n){if(Xe&&P){let t=at.get(e);t||at.set(e,t=new Map);let r=t.get(n);r||(t.set(n,r=new rt),r.map=t,r.key=n),r.track()}}function ut(e,t,n,r,i,a){let o=at.get(e);if(!o){tt++;return}let s=e=>{e&&e.trigger()};if(He(),t===`clear`)o.forEach(s);else{let i=C(e),a=i&&ie(n);if(i&&n===`length`){let e=Number(r);o.forEach((t,n)=>{(n===`length`||n===ct||!E(n)&&n>=e)&&s(t)})}else switch((n!==void 0||o.has(void 0))&&s(o.get(n)),a&&s(o.get(ct)),t){case`add`:i?a&&s(o.get(`length`)):(s(o.get(ot)),ee(e)&&s(o.get(st)));break;case`delete`:i||(s(o.get(ot)),ee(e)&&s(o.get(st)));break;case`set`:ee(e)&&s(o.get(ot));break}}Ue()}function dt(e){let t=F(e);return t===e?t:(lt(t,`iterate`,ct),Xt(e)?t:t.map($t))}function ft(e){return lt(e=F(e),`iterate`,ct),e}function pt(e,t){return Yt(e)?en(Jt(e)?$t(t):t):$t(t)}var mt={__proto__:null,[Symbol.iterator](){return ht(this,Symbol.iterator,e=>pt(this,e))},concat(...e){return dt(this).concat(...e.map(e=>C(e)?dt(e):e))},entries(){return ht(this,`entries`,e=>(e[1]=pt(this,e[1]),e))},every(e,t){return _t(this,`every`,e,t,void 0,arguments)},filter(e,t){return _t(this,`filter`,e,t,e=>e.map(e=>pt(this,e)),arguments)},find(e,t){return _t(this,`find`,e,t,e=>pt(this,e),arguments)},findIndex(e,t){return _t(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return _t(this,`findLast`,e,t,e=>pt(this,e),arguments)},findLastIndex(e,t){return _t(this,`findLastIndex`,e,t,void 0,arguments)},forEach(e,t){return _t(this,`forEach`,e,t,void 0,arguments)},includes(...e){return yt(this,`includes`,e)},indexOf(...e){return yt(this,`indexOf`,e)},join(e){return dt(this).join(e)},lastIndexOf(...e){return yt(this,`lastIndexOf`,e)},map(e,t){return _t(this,`map`,e,t,void 0,arguments)},pop(){return bt(this,`pop`)},push(...e){return bt(this,`push`,e)},reduce(e,...t){return vt(this,`reduce`,e,t)},reduceRight(e,...t){return vt(this,`reduceRight`,e,t)},shift(){return bt(this,`shift`)},some(e,t){return _t(this,`some`,e,t,void 0,arguments)},splice(...e){return bt(this,`splice`,e)},toReversed(){return dt(this).toReversed()},toSorted(e){return dt(this).toSorted(e)},toSpliced(...e){return dt(this).toSpliced(...e)},unshift(...e){return bt(this,`unshift`,e)},values(){return ht(this,`values`,e=>pt(this,e))}};function ht(e,t,n){let r=ft(e),i=r[t]();return r!==e&&!Xt(e)&&(i._next=i.next,i.next=()=>{let e=i._next();return e.done||(e.value=n(e.value)),e}),i}var gt=Array.prototype;function _t(e,t,n,r,i,a){let o=ft(e),s=o!==e&&!Xt(e),c=o[t];if(c!==gt[t]){let t=c.apply(e,a);return s?$t(t):t}let l=n;o!==e&&(s?l=function(t,r){return n.call(this,pt(e,t),r,e)}:n.length>2&&(l=function(t,r){return n.call(this,t,r,e)}));let u=c.call(o,l,r);return s&&i?i(u):u}function vt(e,t,n,r){let i=ft(e),a=i!==e&&!Xt(e),o=n,s=!1;i!==e&&(a?(s=r.length===0,o=function(t,r,i){return s&&(s=!1,t=pt(e,t)),n.call(this,t,pt(e,r),i,e)}):n.length>3&&(o=function(t,r,i){return n.call(this,t,r,i,e)}));let c=i[t](o,...r);return s?pt(e,c):c}function yt(e,t,n){let r=F(e);lt(r,`iterate`,ct);let i=r[t](...n);return(i===-1||i===!1)&&Zt(n[0])?(n[0]=F(n[0]),r[t](...n)):i}function bt(e,t,n=[]){Qe(),He();let r=F(e)[t].apply(e,n);return Ue(),$e(),r}var xt=f(`__proto__,__v_isRef,__isVue`),St=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(E));function Ct(e){E(e)||(e=String(e));let t=F(this);return lt(t,`has`,e),t.hasOwnProperty(e)}var wt=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t===`__v_skip`)return e.__v_skip;let r=this._isReadonly,i=this._isShallow;if(t===`__v_isReactive`)return!r;if(t===`__v_isReadonly`)return r;if(t===`__v_isShallow`)return i;if(t===`__v_raw`)return n===(r?i?Ht:Vt:i?Bt:zt).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let a=C(e);if(!r){let e;if(a&&(e=mt[t]))return e;if(t===`hasOwnProperty`)return Ct}let o=Reflect.get(e,t,tn(e)?e:n);if((E(t)?St.has(t):xt(t))||(r||lt(e,`get`,t),i))return o;if(tn(o)){let e=a&&ie(t)?o:o.value;return r&&D(e)?Kt(e):e}return D(o)?r?Kt(o):Wt(o):o}},Tt=class extends wt{constructor(e=!1){super(!1,e)}set(e,t,n,r){let i=e[t],a=C(e)&&ie(t);if(!this._isShallow){let e=Yt(i);if(!Xt(n)&&!Yt(n)&&(i=F(i),n=F(n)),!a&&tn(i)&&!tn(n))return e||(i.value=n),!0}let o=a?Number(t)<e.length:S(e,t),s=Reflect.set(e,t,n,tn(e)?e:r);return e===F(r)&&(o?pe(n,i)&&ut(e,`set`,t,n,i):ut(e,`add`,t,n)),s}deleteProperty(e,t){let n=S(e,t),r=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&ut(e,`delete`,t,void 0,r),i}has(e,t){let n=Reflect.has(e,t);return(!E(t)||!St.has(t))&&lt(e,`has`,t),n}ownKeys(e){return lt(e,`iterate`,C(e)?`length`:ot),Reflect.ownKeys(e)}},Et=class extends wt{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},Dt=new Tt,Ot=new Et,kt=new Tt(!0),At=e=>e,jt=e=>Reflect.getPrototypeOf(e);function Mt(e,t,n){return function(...r){let i=this.__v_raw,a=F(i),o=ee(a),s=e===`entries`||e===Symbol.iterator&&o,c=e===`keys`&&o,l=i[e](...r),u=n?At:t?en:$t;return!t&&lt(a,`iterate`,c?st:ot),y(Object.create(l),{next(){let{value:e,done:t}=l.next();return t?{value:e,done:t}:{value:s?[u(e[0]),u(e[1])]:u(e),done:t}}})}}function Nt(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function Pt(e,t){let n={get(n){let r=this.__v_raw,i=F(r),a=F(n);e||(pe(n,a)&&lt(i,`get`,n),lt(i,`get`,a));let{has:o}=jt(i),s=t?At:e?en:$t;if(o.call(i,n))return s(r.get(n));if(o.call(i,a))return s(r.get(a));r!==i&&r.get(n)},get size(){let t=this.__v_raw;return!e&&lt(F(t),`iterate`,ot),t.size},has(t){let n=this.__v_raw,r=F(n),i=F(t);return e||(pe(t,i)&&lt(r,`has`,t),lt(r,`has`,i)),t===i?n.has(t):n.has(t)||n.has(i)},forEach(n,r){let i=this,a=i.__v_raw,o=F(a),s=t?At:e?en:$t;return!e&&lt(o,`iterate`,ot),a.forEach((e,t)=>n.call(r,s(e),s(t),i))}};return y(n,e?{add:Nt(`add`),set:Nt(`set`),delete:Nt(`delete`),clear:Nt(`clear`)}:{add(e){let n=F(this),r=jt(n),i=F(e),a=!t&&!Xt(e)&&!Yt(e)?i:e;return r.has.call(n,a)||pe(e,a)&&r.has.call(n,e)||pe(i,a)&&r.has.call(n,i)||(n.add(a),ut(n,`add`,a,a)),this},set(e,n){!t&&!Xt(n)&&!Yt(n)&&(n=F(n));let r=F(this),{has:i,get:a}=jt(r),o=i.call(r,e);o||=(e=F(e),i.call(r,e));let s=a.call(r,e);return r.set(e,n),o?pe(n,s)&&ut(r,`set`,e,n,s):ut(r,`add`,e,n),this},delete(e){let t=F(this),{has:n,get:r}=jt(t),i=n.call(t,e);i||=(e=F(e),n.call(t,e));let a=r?r.call(t,e):void 0,o=t.delete(e);return i&&ut(t,`delete`,e,void 0,a),o},clear(){let e=F(this),t=e.size!==0,n=e.clear();return t&&ut(e,`clear`,void 0,void 0,void 0),n}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(r=>{n[r]=Mt(r,e,t)}),n}function Ft(e,t){let n=Pt(e,t);return(t,r,i)=>r===`__v_isReactive`?!e:r===`__v_isReadonly`?e:r===`__v_raw`?t:Reflect.get(S(n,r)&&r in t?n:t,r,i)}var It={get:Ft(!1,!1)},Lt={get:Ft(!1,!0)},Rt={get:Ft(!0,!1)},zt=new WeakMap,Bt=new WeakMap,Vt=new WeakMap,Ht=new WeakMap;function Ut(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function Wt(e){return Yt(e)?e:qt(e,!1,Dt,It,zt)}function Gt(e){return qt(e,!1,kt,Lt,Bt)}function Kt(e){return qt(e,!0,Ot,Rt,Vt)}function qt(e,t,n,r,i){if(!D(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;let a=i.get(e);if(a)return a;let o=Ut(A(e));if(o===0)return e;let s=new Proxy(e,o===2?r:n);return i.set(e,s),s}function Jt(e){return Yt(e)?Jt(e.__v_raw):!!(e&&e.__v_isReactive)}function Yt(e){return!!(e&&e.__v_isReadonly)}function Xt(e){return!!(e&&e.__v_isShallow)}function Zt(e){return e?!!e.__v_raw:!1}function F(e){let t=e&&e.__v_raw;return t?F(t):e}function Qt(e){return!S(e,`__v_skip`)&&Object.isExtensible(e)&&M(e,`__v_skip`,!0),e}var $t=e=>D(e)?Wt(e):e,en=e=>D(e)?Kt(e):e;function tn(e){return e?e.__v_isRef===!0:!1}function I(e){return nn(e,!1)}function nn(e,t){return tn(e)?e:new rn(e,t)}var rn=class{constructor(e,t){this.dep=new rt,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:F(e),this._value=t?e:$t(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||Xt(e)||Yt(e);e=n?e:F(e),pe(e,t)&&(this._rawValue=e,this._value=n?e:$t(e),this.dep.trigger())}};function L(e){return tn(e)?e.value:e}var an={get:(e,t,n)=>t===`__v_raw`?e:L(Reflect.get(e,t,n)),set:(e,t,n,r)=>{let i=e[t];return tn(i)&&!tn(n)?(i.value=n,!0):Reflect.set(e,t,n,r)}};function on(e){return Jt(e)?e:new Proxy(e,an)}var sn=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new rt(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=tt-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&P!==this)return Ve(this,!0),!0}get value(){let e=this.dep.track();return qe(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}};function cn(e,t,n=!1){let r,i;return w(e)?r=e:(r=e.get,i=e.set),new sn(r,i,n)}var ln={},un=new WeakMap,dn=void 0;function fn(e,t=!1,n=dn){if(n){let t=un.get(n);t||un.set(n,t=[]),t.push(e)}}function pn(e,t,n=p){let{immediate:r,deep:i,once:a,scheduler:o,augmentJob:s,call:c}=n,l=e=>i?e:Xt(e)||i===!1||i===0?mn(e,1):mn(e),u,d,f,m,g=!1,_=!1;if(tn(e)?(d=()=>e.value,g=Xt(e)):Jt(e)?(d=()=>l(e),g=!0):C(e)?(_=!0,g=e.some(e=>Jt(e)||Xt(e)),d=()=>e.map(e=>{if(tn(e))return e.value;if(Jt(e))return l(e);if(w(e))return c?c(e,2):e()})):d=w(e)?t?c?()=>c(e,2):e:()=>{if(f){Qe();try{f()}finally{$e()}}let t=dn;dn=u;try{return c?c(e,3,[m]):e(m)}finally{dn=t}}:h,t&&i){let e=d,t=i===!0?1/0:i;d=()=>mn(e(),t)}let v=Fe(),y=()=>{u.stop(),v&&v.active&&b(v.effects,u)};if(a&&t){let e=t;t=(...t)=>{let n=e(...t);return y(),n}}let x=_?Array(e.length).fill(ln):ln,S=e=>{if(!(!(u.flags&1)||!u.dirty&&!e))if(t){let n=u.run();if(e||i||g||(_?n.some((e,t)=>pe(e,x[t])):pe(n,x))){f&&f();let e=dn;dn=u;try{let e=[n,x===ln?void 0:_&&x[0]===ln?[]:x,m];x=n,c?c(t,3,e):t(...e)}finally{dn=e}}}else u.run()};return s&&s(S),u=new Le(d),u.scheduler=o?()=>o(S,!1):S,m=e=>fn(e,!1,u),f=u.onStop=()=>{let e=un.get(u);if(e){if(c)c(e,4);else for(let t of e)t();un.delete(u)}},t?r?S(!0):x=u.run():o?o(S.bind(null,!0),!0):u.run(),y.pause=u.pause.bind(u),y.resume=u.resume.bind(u),y.stop=y,y}function mn(e,t=1/0,n){if(t<=0||!D(e)||e.__v_skip||(n||=new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,tn(e))mn(e.value,t,n);else if(C(e))for(let r=0;r<e.length;r++)mn(e[r],t,n);else if(te(e)||ee(e))e.forEach(e=>{mn(e,t,n)});else if(j(e)){for(let r in e)mn(e[r],t,n);for(let r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&mn(e[r],t,n)}return e}function hn(e,t,n,r){try{return r?e(...r):e()}catch(e){_n(e,t,n)}}function gn(e,t,n,r){if(w(e)){let i=hn(e,t,n,r);return i&&re(i)&&i.catch(e=>{_n(e,t,n)}),i}if(C(e)){let i=[];for(let a=0;a<e.length;a++)i.push(gn(e[a],t,n,r));return i}}function _n(e,t,n,r=!0){let i=t?t.vnode:null,{errorHandler:a,throwUnhandledErrorInProduction:o}=t&&t.appContext.config||p;if(t){let r=t.parent,i=t.proxy,o=`https://vuejs.org/error-reference/#runtime-${n}`;for(;r;){let t=r.ec;if(t){for(let n=0;n<t.length;n++)if(t[n](e,i,o)===!1)return}r=r.parent}if(a){Qe(),hn(a,null,10,[e,i,o]),$e();return}}vn(e,n,i,r,o)}function vn(e,t,n,r=!0,i=!1){if(i)throw e;console.error(e)}var yn=[],bn=-1,xn=[],Sn=null,Cn=0,wn=Promise.resolve(),Tn=null;function En(e){let t=Tn||wn;return e?t.then(this?e.bind(this):e):t}function Dn(e){let t=bn+1,n=yn.length;for(;t<n;){let r=t+n>>>1,i=yn[r],a=Nn(i);a<e||a===e&&i.flags&2?t=r+1:n=r}return t}function On(e){if(!(e.flags&1)){let t=Nn(e),n=yn[yn.length-1];!n||!(e.flags&2)&&t>=Nn(n)?yn.push(e):yn.splice(Dn(t),0,e),e.flags|=1,kn()}}function kn(){Tn||=wn.then(Pn)}function An(e){C(e)?xn.push(...e):Sn&&e.id===-1?Sn.splice(Cn+1,0,e):e.flags&1||(xn.push(e),e.flags|=1),kn()}function jn(e,t,n=bn+1){for(;n<yn.length;n++){let t=yn[n];if(t&&t.flags&2){if(e&&t.id!==e.uid)continue;yn.splice(n,1),n--,t.flags&4&&(t.flags&=-2),t(),t.flags&4||(t.flags&=-2)}}}function Mn(e){if(xn.length){let e=[...new Set(xn)].sort((e,t)=>Nn(e)-Nn(t));if(xn.length=0,Sn){Sn.push(...e);return}for(Sn=e,Cn=0;Cn<Sn.length;Cn++){let e=Sn[Cn];e.flags&4&&(e.flags&=-2),e.flags&8||e(),e.flags&=-2}Sn=null,Cn=0}}var Nn=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Pn(e){try{for(bn=0;bn<yn.length;bn++){let e=yn[bn];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),hn(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;bn<yn.length;bn++){let e=yn[bn];e&&(e.flags&=-2)}bn=-1,yn.length=0,Mn(e),Tn=null,(yn.length||xn.length)&&Pn(e)}}var Fn=null,In=null;function Ln(e){let t=Fn;return Fn=e,In=e&&e.type.__scopeId||null,t}function Rn(e,t=Fn,n){if(!t||e._n)return e;let r=(...n)=>{r._d&&la(-1);let i=Ln(t),a;try{a=e(...n)}finally{Ln(i),r._d&&la(1)}return a};return r._n=!0,r._c=!0,r._d=!0,r}function zn(e,t){if(Fn===null)return e;let n=Ga(Fn),r=e.dirs||=[];for(let e=0;e<t.length;e++){let[i,a,o,s=p]=t[e];i&&(w(i)&&(i={mounted:i,updated:i}),i.deep&&mn(a),r.push({dir:i,instance:n,value:a,oldValue:void 0,arg:o,modifiers:s}))}return e}function Bn(e,t,n,r){let i=e.dirs,a=t&&t.dirs;for(let o=0;o<i.length;o++){let s=i[o];a&&(s.oldValue=a[o].value);let c=s.dir[r];c&&(Qe(),gn(c,n,8,[e.el,s,e,t]),$e())}}function Vn(e,t){if(ka){let n=ka.provides,r=ka.parent&&ka.parent.provides;r===n&&(n=ka.provides=Object.create(r)),n[e]=t}}function Hn(e,t,n=!1){let r=Aa();if(r||fi){let i=fi?fi._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&e in i)return i[e];if(arguments.length>1)return n&&w(t)?t.call(r&&r.proxy):t}}var Un=Symbol.for(`v-scx`),Wn=()=>Hn(Un);function Gn(e,t,n){return Kn(e,t,n)}function Kn(e,t,n=p){let{immediate:r,deep:i,flush:a,once:o}=n,s=y({},n),c=t&&r||!t&&a!==`post`,l;if(Ia){if(a===`sync`){let e=Wn();l=e.__watcherHandles||=[]}else if(!c){let e=()=>{};return e.stop=h,e.resume=h,e.pause=h,e}}let u=ka;s.call=(e,t,n)=>gn(e,u,t,n);let d=!1;a===`post`?s.scheduler=e=>{Ui(e,u&&u.suspense)}:a!==`sync`&&(d=!0,s.scheduler=(e,t)=>{t?e():On(e)}),s.augmentJob=e=>{t&&(e.flags|=4),d&&(e.flags|=2,u&&(e.id=u.uid,e.i=u))};let f=pn(e,t,s);return Ia&&(l?l.push(f):c&&f()),f}function qn(e,t,n){let r=this.proxy,i=T(e)?e.includes(`.`)?Jn(r,e):()=>r[e]:e.bind(r,r),a;w(t)?a=t:(a=t.handler,n=t);let o=Na(this),s=Kn(i,a.bind(r),n);return o(),s}function Jn(e,t){let n=t.split(`.`);return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}var Yn=new WeakMap,Xn=Symbol(`_vte`),Zn=e=>e.__isTeleport,Qn=e=>e&&(e.disabled||e.disabled===``),$n=e=>e&&(e.defer||e.defer===``),er=e=>typeof SVGElement<`u`&&e instanceof SVGElement,tr=e=>typeof MathMLElement==`function`&&e instanceof MathMLElement,nr=(e,t)=>{let n=e&&e.to;return T(n)?t?t(n):null:n},rr={name:`Teleport`,__isTeleport:!0,process(e,t,n,r,i,a,o,s,c,l){let{mc:u,pc:d,pbc:f,o:{insert:p,querySelector:m,createText:h,createComment:g,parentNode:_}}=l,v=Qn(t.props),{dynamicChildren:y}=t,b=(e,t,n)=>{e.shapeFlag&16&&u(e.children,t,n,i,a,o,s,c)},x=(e=t)=>{let n=Qn(e.props),r=e.target=nr(e.props,m),a=cr(r,e,h,p);r&&(o!==`svg`&&er(r)?o=`svg`:o!==`mathml`&&tr(r)&&(o=`mathml`),i&&i.isCE&&(i.ce._teleportTargets||(i.ce._teleportTargets=new Set)).add(r),n||(b(e,r,a),sr(e,!1)))},S=e=>{let t=()=>{Yn.get(e)===t&&(Yn.delete(e),Qn(e.props)&&(b(e,_(e.el)||n,e.anchor),sr(e,!0)),x(e))};Yn.set(e,t),Ui(t,a)};if(e==null){let e=t.el=h(``),i=t.anchor=h(``);if(p(e,n,r),p(i,n,r),$n(t.props)||a&&a.pendingBranch){S(t);return}v&&(b(t,n,i),sr(t,!0)),x()}else{t.el=e.el;let r=t.anchor=e.anchor,u=Yn.get(e);if(u){u.flags|=8,Yn.delete(e),S(t);return}t.targetStart=e.targetStart;let p=t.target=e.target,h=t.targetAnchor=e.targetAnchor,g=Qn(e.props),_=g?n:p,b=g?r:h;if(o===`svg`||er(p)?o=`svg`:(o===`mathml`||tr(p))&&(o=`mathml`),y?(f(e.dynamicChildren,y,_,i,a,o,s),Yi(e,t,!0)):c||d(e,t,_,b,i,a,o,s,!1),v)g?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):ir(t,n,r,l,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){let e=t.target=nr(t.props,m);e&&ir(t,e,null,l,0)}else g&&ir(t,p,h,l,1);sr(t,v)}},remove(e,t,n,{um:r,o:{remove:i}},a){let{shapeFlag:o,children:s,anchor:c,targetStart:l,targetAnchor:u,target:d,props:f}=e,p=a||!Qn(f),m=Yn.get(e);if(m&&(m.flags|=8,Yn.delete(e)),d&&(i(l),i(u)),a&&i(c),!m&&o&16)for(let e=0;e<s.length;e++){let i=s[e];r(i,t,n,p,!!i.dynamicChildren)}},move:ir,hydrate:ar};function ir(e,t,n,{o:{insert:r},m:i},a=2){a===0&&r(e.targetAnchor,t,n);let{el:o,anchor:s,shapeFlag:c,children:l,props:u}=e,d=a===2;if(d&&r(o,t,n),!Yn.has(e)&&(!d||Qn(u))&&c&16)for(let e=0;e<l.length;e++)i(l[e],t,n,2);d&&r(s,t,n)}function ar(e,t,n,r,i,a,{o:{nextSibling:o,parentNode:s,querySelector:c,insert:l,createText:u}},d){function f(e,n){let r=n;for(;r;){if(r&&r.nodeType===8){if(r.data===`teleport start anchor`)t.targetStart=r;else if(r.data===`teleport anchor`){t.targetAnchor=r,e._lpa=t.targetAnchor&&o(t.targetAnchor);break}}r=o(r)}}function p(e,t){t.anchor=d(o(e),t,s(e),n,r,i,a)}let m=t.target=nr(t.props,c),h=Qn(t.props);if(m){let c=m._lpa||m.firstChild;t.shapeFlag&16&&(h?(p(e,t),f(m,c),t.targetAnchor||cr(m,t,u,l,s(e)===m?e:null)):(t.anchor=o(e),f(m,c),t.targetAnchor||cr(m,t,u,l),d(c&&o(c),t,m,n,r,i,a))),sr(t,h)}else h&&t.shapeFlag&16&&(p(e,t),t.targetStart=e,t.targetAnchor=o(e));return t.anchor&&o(t.anchor)}var or=rr;function sr(e,t){let n=e.ctx;if(n&&n.ut){let r,i;for(t?(r=e.el,i=e.anchor):(r=e.targetStart,i=e.targetAnchor);r&&r!==i;)r.nodeType===1&&r.setAttribute(`data-v-owner`,n.uid),r=r.nextSibling;n.ut()}}function cr(e,t,n,r,i=null){let a=t.targetStart=n(``),o=t.targetAnchor=n(``);return a[Xn]=o,e&&(r(a,e,i),r(o,e,i)),o}var lr=Symbol(`_leaveCb`);function ur(e,t){e.shapeFlag&6&&e.component?(e.transition=t,ur(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function dr(e,t){return w(e)?y({name:e.name},t,{setup:e}):e}function fr(e){e.ids=[e.ids[0]+ e.ids[2]+++`-`,0,0]}function pr(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}var mr=new WeakMap;function hr(e,t,n,r,i=!1){if(C(e)){e.forEach((e,a)=>hr(e,t&&(C(t)?t[a]:t),n,r,i));return}if(_r(r)&&!i){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&hr(e,t,n,r.component.subTree);return}let a=r.shapeFlag&4?Ga(r.component):r.el,o=i?null:a,{i:s,r:c}=e,l=t&&t.r,u=s.refs===p?s.refs={}:s.refs,d=s.setupState,f=F(d),m=d===p?g:e=>pr(u,e)?!1:S(f,e),h=(e,t)=>!(t&&pr(u,t));if(l!=null&&l!==c){if(gr(t),T(l))u[l]=null,m(l)&&(d[l]=null);else if(tn(l)){let e=t;h(l,e.k)&&(l.value=null),e.k&&(u[e.k]=null)}}if(w(c))hn(c,s,12,[o,u]);else{let t=T(c),r=tn(c);if(t||r){let s=()=>{if(e.f){let n=t?m(c)?d[c]:u[c]:h(c)||!e.k?c.value:u[e.k];if(i)C(n)&&b(n,a);else if(C(n))n.includes(a)||n.push(a);else if(t)u[c]=[a],m(c)&&(d[c]=u[c]);else{let t=[a];h(c,e.k)&&(c.value=t),e.k&&(u[e.k]=t)}}else t?(u[c]=o,m(c)&&(d[c]=o)):r&&(h(c,e.k)&&(c.value=o),e.k&&(u[e.k]=o))};if(o){let t=()=>{s(),mr.delete(e)};t.id=-1,mr.set(e,t),Ui(t,n)}else gr(e),s()}}}function gr(e){let t=mr.get(e);t&&(t.flags|=8,mr.delete(e))}_e().requestIdleCallback,_e().cancelIdleCallback;var _r=e=>!!e.type.__asyncLoader,vr=e=>e.type.__isKeepAlive;function yr(e,t){xr(e,`a`,t)}function br(e,t){xr(e,`da`,t)}function xr(e,t,n=ka){let r=e.__wdc||=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()};if(Cr(t,r,n),n){let e=n.parent;for(;e&&e.parent;)vr(e.parent.vnode)&&Sr(r,t,n,e),e=e.parent}}function Sr(e,t,n,r){let i=Cr(t,e,r,!0);Ar(()=>{b(r[t],i)},n)}function Cr(e,t,n=ka,r=!1){if(n){let i=n[e]||(n[e]=[]),a=t.__weh||=(...r)=>{Qe();let i=Na(n),a=gn(t,n,e,r);return i(),$e(),a};return r?i.unshift(a):i.push(a),a}}var wr=e=>(t,n=ka)=>{(!Ia||e===`sp`)&&Cr(e,(...e)=>t(...e),n)},Tr=wr(`bm`),Er=wr(`m`),Dr=wr(`bu`),Or=wr(`u`),kr=wr(`bum`),Ar=wr(`um`),jr=wr(`sp`),Mr=wr(`rtg`),Nr=wr(`rtc`);function Pr(e,t=ka){Cr(`ec`,e,t)}var Fr=`components`,Ir=Symbol.for(`v-ndc`);function Lr(e){return T(e)?Rr(Fr,e,!1)||e:e||Ir}function Rr(e,t,n=!0,r=!1){let i=Fn||ka;if(i){let n=i.type;if(e===Fr){let e=Ka(n,!1);if(e&&(e===t||e===ce(t)||e===de(ce(t))))return n}let a=zr(i[e]||n[e],t)||zr(i.appContext[e],t);return!a&&r?n:a}}function zr(e,t){return e&&(e[t]||e[ce(t)]||e[de(ce(t))])}function Br(e,t,n,r){let i,a=n&&n[r],o=C(e);if(o||T(e)){let n=o&&Jt(e),r=!1,s=!1;n&&(r=!Xt(e),s=Yt(e),e=ft(e)),i=Array(e.length);for(let n=0,o=e.length;n<o;n++)i[n]=t(r?s?en($t(e[n])):$t(e[n]):e[n],n,void 0,a&&a[n])}else if(typeof e==`number`){i=Array(e);for(let n=0;n<e;n++)i[n]=t(n+1,n,void 0,a&&a[n])}else if(D(e))if(e[Symbol.iterator])i=Array.from(e,(e,n)=>t(e,n,void 0,a&&a[n]));else{let n=Object.keys(e);i=Array(n.length);for(let r=0,o=n.length;r<o;r++){let o=n[r];i[r]=t(e[o],o,r,a&&a[r])}}else i=[];return n&&(n[r]=i),i}function Vr(e,t,n={},r,i){if(Fn.ce||Fn.parent&&_r(Fn.parent)&&Fn.parent.ce){let e=Object.keys(n).length>0;return t!=="default"&&(n.name=t),z(),da(R,null,[ga(`slot`,n,r&&r())],e?-2:64)}let a=e[t];a&&a._c&&(a._d=!1),z();let o=a&&Hr(a(n)),s=n.key||o&&o.key,c=da(R,{key:(s&&!E(s)?s:`_${t}`)+(!o&&r?`_fb`:``)},o||(r?r():[]),o&&e._===1?64:-2);return!i&&c.scopeId&&(c.slotScopeIds=[c.scopeId+`-s`]),a&&a._c&&(a._d=!0),c}function Hr(e){return e.some(e=>fa(e)?!(e.type===ra||e.type===R&&!Hr(e.children)):!0)?e:null}var Ur=e=>e?Fa(e)?Ga(e):Ur(e.parent):null,Wr=y(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Ur(e.parent),$root:e=>Ur(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>$r(e),$forceUpdate:e=>e.f||=()=>{On(e.update)},$nextTick:e=>e.n||=En.bind(e.proxy),$watch:e=>qn.bind(e)}),Gr=(e,t)=>e!==p&&!e.__isScriptSetup&&S(e,t),Kr={get({_:e},t){if(t===`__v_skip`)return!0;let{ctx:n,setupState:r,data:i,props:a,accessCache:o,type:s,appContext:c}=e;if(t[0]!==`$`){let e=o[t];if(e!==void 0)switch(e){case 1:return r[t];case 2:return i[t];case 4:return n[t];case 3:return a[t]}else if(Gr(r,t))return o[t]=1,r[t];else if(i!==p&&S(i,t))return o[t]=2,i[t];else if(S(a,t))return o[t]=3,a[t];else if(n!==p&&S(n,t))return o[t]=4,n[t];else Jr&&(o[t]=0)}let l=Wr[t],u,d;if(l)return t===`$attrs`&&lt(e.attrs,`get`,``),l(e);if((u=s.__cssModules)&&(u=u[t]))return u;if(n!==p&&S(n,t))return o[t]=4,n[t];if(d=c.config.globalProperties,S(d,t))return d[t]},set({_:e},t,n){let{data:r,setupState:i,ctx:a}=e;return Gr(i,t)?(i[t]=n,!0):r!==p&&S(r,t)?(r[t]=n,!0):S(e.props,t)||t[0]===`$`&&t.slice(1)in e?!1:(a[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:i,props:a,type:o}},s){let c;return!!(n[s]||e!==p&&s[0]!==`$`&&S(e,s)||Gr(t,s)||S(a,s)||S(r,s)||S(Wr,s)||S(i.config.globalProperties,s)||(c=o.__cssModules)&&c[s])},defineProperty(e,t,n){return n.get==null?S(n,`value`)&&this.set(e,t,n.value,null):e._.accessCache[t]=0,Reflect.defineProperty(e,t,n)}};function qr(e){return C(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}var Jr=!0;function Yr(e){let t=$r(e),n=e.proxy,r=e.ctx;Jr=!1,t.beforeCreate&&Zr(t.beforeCreate,e,`bc`);let{data:i,computed:a,methods:o,watch:s,provide:c,inject:l,created:u,beforeMount:d,mounted:f,beforeUpdate:p,updated:m,activated:g,deactivated:_,beforeDestroy:v,beforeUnmount:y,destroyed:b,unmounted:x,render:S,renderTracked:ee,renderTriggered:te,errorCaptured:ne,serverPrefetch:T,expose:E,inheritAttrs:re,components:O,directives:k,filters:A}=t;if(l&&Xr(l,r,null),o)for(let e in o){let t=o[e];w(t)&&(r[e]=t.bind(n))}if(i){let t=i.call(n,n);D(t)&&(e.data=Wt(t))}if(Jr=!0,a)for(let e in a){let t=a[e],i=U({get:w(t)?t.bind(n,n):w(t.get)?t.get.bind(n,n):h,set:!w(t)&&w(t.set)?t.set.bind(n):h});Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e})}if(s)for(let e in s)Qr(s[e],r,n,e);if(c){let e=w(c)?c.call(n):c;Reflect.ownKeys(e).forEach(t=>{Vn(t,e[t])})}u&&Zr(u,e,`c`);function j(e,t){C(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(j(Tr,d),j(Er,f),j(Dr,p),j(Or,m),j(yr,g),j(br,_),j(Pr,ne),j(Nr,ee),j(Mr,te),j(kr,y),j(Ar,x),j(jr,T),C(E))if(E.length){let t=e.exposed||={};E.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t,enumerable:!0})})}else e.exposed||={};S&&e.render===h&&(e.render=S),re!=null&&(e.inheritAttrs=re),O&&(e.components=O),k&&(e.directives=k),T&&fr(e)}function Xr(e,t,n=h){C(e)&&(e=ii(e));for(let n in e){let r=e[n],i;i=D(r)?`default`in r?Hn(r.from||n,r.default,!0):Hn(r.from||n):Hn(r),tn(i)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e}):t[n]=i}}function Zr(e,t,n){gn(C(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function Qr(e,t,n,r){let i=r.includes(`.`)?Jn(n,r):()=>n[r];if(T(e)){let n=t[e];w(n)&&Gn(i,n)}else if(w(e))Gn(i,e.bind(n));else if(D(e))if(C(e))e.forEach(e=>Qr(e,t,n,r));else{let r=w(e.handler)?e.handler.bind(n):t[e.handler];w(r)&&Gn(i,r,e)}}function $r(e){let t=e.type,{mixins:n,extends:r}=t,{mixins:i,optionsCache:a,config:{optionMergeStrategies:o}}=e.appContext,s=a.get(t),c;return s?c=s:!i.length&&!n&&!r?c=t:(c={},i.length&&i.forEach(e=>ei(c,e,o,!0)),ei(c,t,o)),D(t)&&a.set(t,c),c}function ei(e,t,n,r=!1){let{mixins:i,extends:a}=t;a&&ei(e,a,n,!0),i&&i.forEach(t=>ei(e,t,n,!0));for(let i in t)if(!(r&&i===`expose`)){let r=ti[i]||n&&n[i];e[i]=r?r(e[i],t[i]):t[i]}return e}var ti={data:ni,props:si,emits:si,methods:oi,computed:oi,beforeCreate:ai,created:ai,beforeMount:ai,mounted:ai,beforeUpdate:ai,updated:ai,beforeDestroy:ai,beforeUnmount:ai,destroyed:ai,unmounted:ai,activated:ai,deactivated:ai,errorCaptured:ai,serverPrefetch:ai,components:oi,directives:oi,watch:ci,provide:ni,inject:ri};function ni(e,t){return t?e?function(){return y(w(e)?e.call(this,this):e,w(t)?t.call(this,this):t)}:t:e}function ri(e,t){return oi(ii(e),ii(t))}function ii(e){if(C(e)){let t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function ai(e,t){return e?[...new Set([].concat(e,t))]:t}function oi(e,t){return e?y(Object.create(null),e,t):t}function si(e,t){return e?C(e)&&C(t)?[...new Set([...e,...t])]:y(Object.create(null),qr(e),qr(t??{})):t}function ci(e,t){if(!e)return t;if(!t)return e;let n=y(Object.create(null),e);for(let r in t)n[r]=ai(e[r],t[r]);return n}function li(){return{app:null,config:{isNativeTag:g,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}var ui=0;function di(e,t){return function(n,r=null){w(n)||(n=y({},n)),r!=null&&!D(r)&&(r=null);let i=li(),a=new WeakSet,o=[],s=!1,c=i.app={_uid:ui++,_component:n,_props:r,_container:null,_context:i,_instance:null,version:Ya,get config(){return i.config},set config(e){},use(e,...t){return a.has(e)||(e&&w(e.install)?(a.add(e),e.install(c,...t)):w(e)&&(a.add(e),e(c,...t))),c},mixin(e){return i.mixins.includes(e)||i.mixins.push(e),c},component(e,t){return t?(i.components[e]=t,c):i.components[e]},directive(e,t){return t?(i.directives[e]=t,c):i.directives[e]},mount(a,o,l){if(!s){let u=c._ceVNode||ga(n,r);return u.appContext=i,l===!0?l=`svg`:l===!1&&(l=void 0),o&&t?t(u,a):e(u,a,l),s=!0,c._container=a,a.__vue_app__=c,Ga(u.component)}},onUnmount(e){o.push(e)},unmount(){s&&(gn(o,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(e,t){return i.provides[e]=t,c},runWithContext(e){let t=fi;fi=c;try{return e()}finally{fi=t}}};return c}}var fi=null,pi=(e,t)=>t===`modelValue`||t===`model-value`?e.modelModifiers:e[`${t}Modifiers`]||e[`${ce(t)}Modifiers`]||e[`${ue(t)}Modifiers`];function mi(e,t,...n){if(e.isUnmounted)return;let r=e.vnode.props||p,i=n,a=t.startsWith(`update:`),o=a&&pi(r,t.slice(7));o&&(o.trim&&(i=n.map(e=>T(e)?e.trim():e)),o.number&&(i=n.map(he)));let s,c=r[s=fe(t)]||r[s=fe(ce(t))];!c&&a&&(c=r[s=fe(ue(t))]),c&&gn(c,e,6,i);let l=r[s+`Once`];if(l){if(!e.emitted)e.emitted={};else if(e.emitted[s])return;e.emitted[s]=!0,gn(l,e,6,i)}}var hi=new WeakMap;function gi(e,t,n=!1){let r=n?hi:t.emitsCache,i=r.get(e);if(i!==void 0)return i;let a=e.emits,o={},s=!1;if(!w(e)){let r=e=>{let n=gi(e,t,!0);n&&(s=!0,y(o,n))};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}return!a&&!s?(D(e)&&r.set(e,null),null):(C(a)?a.forEach(e=>o[e]=null):y(o,a),D(e)&&r.set(e,o),o)}function _i(e,t){return!e||!_(t)?!1:(t=t.slice(2).replace(/Once$/,``),S(e,t[0].toLowerCase()+t.slice(1))||S(e,ue(t))||S(e,t))}function vi(e){let{type:t,vnode:n,proxy:r,withProxy:i,propsOptions:[a],slots:o,attrs:s,emit:c,render:l,renderCache:u,props:d,data:f,setupState:p,ctx:m,inheritAttrs:h}=e,g=Ln(e),_,y;try{if(n.shapeFlag&4){let e=i||r,t=e;_=xa(l.call(t,e,u,d,p,f,m)),y=s}else{let e=t;_=xa(e.length>1?e(d,{attrs:s,slots:o,emit:c}):e(d,null)),y=t.props?s:yi(s)}}catch(t){aa.length=0,_n(t,e,1),_=ga(ra)}let b=_;if(y&&h!==!1){let e=Object.keys(y),{shapeFlag:t}=b;e.length&&t&7&&(a&&e.some(v)&&(y=bi(y,a)),b=ya(b,y,!1,!0))}return n.dirs&&(b=ya(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(n.dirs):n.dirs),n.transition&&ur(b,n.transition),_=b,Ln(g),_}var yi=e=>{let t;for(let n in e)(n===`class`||n===`style`||_(n))&&((t||={})[n]=e[n]);return t},bi=(e,t)=>{let n={};for(let r in e)(!v(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function xi(e,t,n){let{props:r,children:i,component:a}=e,{props:o,children:s,patchFlag:c}=t,l=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return r?Si(r,o,l):!!o;if(c&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let n=e[t];if(Ci(o,r,n)&&!_i(l,n))return!0}}}else return(i||s)&&(!s||!s.$stable)?!0:r===o?!1:r?o?Si(r,o,l):!0:!!o;return!1}function Si(e,t,n){let r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let i=0;i<r.length;i++){let a=r[i];if(Ci(t,e,a)&&!_i(n,a))return!0}return!1}function Ci(e,t,n){let r=e[n],i=t[n];return n===`style`&&D(r)&&D(i)?!Oe(r,i):r!==i}function wi({vnode:e,parent:t,suspense:n},r){for(;t;){let n=t.subTree;if(n.suspense&&n.suspense.activeBranch===e&&(n.suspense.vnode.el=n.el=r,e=n),n===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}var Ti={},Ei=()=>Object.create(Ti),Di=e=>Object.getPrototypeOf(e)===Ti;function Oi(e,t,n,r=!1){let i={},a=Ei();e.propsDefaults=Object.create(null),Ai(e,t,i,a);for(let t in e.propsOptions[0])t in i||(i[t]=void 0);n?e.props=r?i:Gt(i):e.type.props?e.props=i:e.props=a,e.attrs=a}function ki(e,t,n,r){let{props:i,attrs:a,vnode:{patchFlag:o}}=e,s=F(i),[c]=e.propsOptions,l=!1;if((r||o>0)&&!(o&16)){if(o&8){let n=e.vnode.dynamicProps;for(let r=0;r<n.length;r++){let o=n[r];if(_i(e.emitsOptions,o))continue;let u=t[o];if(c)if(S(a,o))u!==a[o]&&(a[o]=u,l=!0);else{let t=ce(o);i[t]=ji(c,s,t,u,e,!1)}else u!==a[o]&&(a[o]=u,l=!0)}}}else{Ai(e,t,i,a)&&(l=!0);let r;for(let a in s)(!t||!S(t,a)&&((r=ue(a))===a||!S(t,r)))&&(c?n&&(n[a]!==void 0||n[r]!==void 0)&&(i[a]=ji(c,s,a,void 0,e,!0)):delete i[a]);if(a!==s)for(let e in a)(!t||!S(t,e))&&(delete a[e],l=!0)}l&&ut(e.attrs,`set`,``)}function Ai(e,t,n,r){let[i,a]=e.propsOptions,o=!1,s;if(t)for(let c in t){if(ae(c))continue;let l=t[c],u;i&&S(i,u=ce(c))?!a||!a.includes(u)?n[u]=l:(s||={})[u]=l:_i(e.emitsOptions,c)||(!(c in r)||l!==r[c])&&(r[c]=l,o=!0)}if(a){let t=F(n),r=s||p;for(let o=0;o<a.length;o++){let s=a[o];n[s]=ji(i,t,s,r[s],e,!S(r,s))}}return o}function ji(e,t,n,r,i,a){let o=e[n];if(o!=null){let e=S(o,`default`);if(e&&r===void 0){let e=o.default;if(o.type!==Function&&!o.skipFactory&&w(e)){let{propsDefaults:a}=i;if(n in a)r=a[n];else{let o=Na(i);r=a[n]=e.call(null,t),o()}}else r=e;i.ce&&i.ce._setProp(n,r)}o[0]&&(a&&!e?r=!1:o[1]&&(r===``||r===ue(n))&&(r=!0))}return r}var Mi=new WeakMap;function Ni(e,t,n=!1){let r=n?Mi:t.propsCache,i=r.get(e);if(i)return i;let a=e.props,o={},s=[],c=!1;if(!w(e)){let r=e=>{c=!0;let[n,r]=Ni(e,t,!0);y(o,n),r&&s.push(...r)};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}if(!a&&!c)return D(e)&&r.set(e,m),m;if(C(a))for(let e=0;e<a.length;e++){let t=ce(a[e]);Pi(t)&&(o[t]=p)}else if(a)for(let e in a){let t=ce(e);if(Pi(t)){let n=a[e],r=o[t]=C(n)||w(n)?{type:n}:y({},n),i=r.type,c=!1,l=!0;if(C(i))for(let e=0;e<i.length;++e){let t=i[e],n=w(t)&&t.name;if(n===`Boolean`){c=!0;break}else n===`String`&&(l=!1)}else c=w(i)&&i.name===`Boolean`;r[0]=c,r[1]=l,(c||S(r,`default`))&&s.push(t)}}let l=[o,s];return D(e)&&r.set(e,l),l}function Pi(e){return e[0]!==`$`&&!ae(e)}var Fi=e=>e===`_`||e===`_ctx`||e===`$stable`,Ii=e=>C(e)?e.map(xa):[xa(e)],Li=(e,t,n)=>{if(t._n)return t;let r=Rn((...e)=>Ii(t(...e)),n);return r._c=!1,r},Ri=(e,t,n)=>{let r=e._ctx;for(let n in e){if(Fi(n))continue;let i=e[n];if(w(i))t[n]=Li(n,i,r);else if(i!=null){let e=Ii(i);t[n]=()=>e}}},zi=(e,t)=>{let n=Ii(t);e.slots.default=()=>n},Bi=(e,t,n)=>{for(let r in t)(n||!Fi(r))&&(e[r]=t[r])},Vi=(e,t,n)=>{let r=e.slots=Ei();if(e.vnode.shapeFlag&32){let e=t._;e?(Bi(r,t,n),n&&M(r,`_`,e,!0)):Ri(t,r)}else t&&zi(e,t)},Hi=(e,t,n)=>{let{vnode:r,slots:i}=e,a=!0,o=p;if(r.shapeFlag&32){let e=t._;e?n&&e===1?a=!1:Bi(i,t,n):(a=!t.$stable,Ri(t,i)),o=t}else t&&(zi(e,t),o={default:1});if(a)for(let e in i)!Fi(e)&&o[e]==null&&delete i[e]},Ui=ta;function Wi(e){return Gi(e)}function Gi(e,t){let n=_e();n.__VUE__=!0;let{insert:r,remove:i,patchProp:a,createElement:o,createText:s,createComment:c,setText:l,setElementText:u,parentNode:d,nextSibling:f,setScopeId:g=h,insertStaticContent:_}=e,v=(e,t,n,r=null,i=null,a=null,o=void 0,s=null,c=!!t.dynamicChildren)=>{if(e===t)return;e&&!pa(e,t)&&(r=he(e),ue(e,i,a,!0),e=null),t.patchFlag===-2&&(c=!1,t.dynamicChildren=null);let{type:l,ref:u,shapeFlag:d}=t;switch(l){case na:y(e,t,n,r);break;case ra:b(e,t,n,r);break;case ia:e??x(t,n,r,o);break;case R:re(e,t,n,r,i,a,o,s,c);break;default:d&1?ee(e,t,n,r,i,a,o,s,c):d&6?O(e,t,n,r,i,a,o,s,c):(d&64||d&128)&&l.process(e,t,n,r,i,a,o,s,c,ye)}u!=null&&i?hr(u,e&&e.ref,a,t||e,!t):u==null&&e&&e.ref!=null&&hr(e.ref,null,a,e,!0)},y=(e,t,n,i)=>{if(e==null)r(t.el=s(t.children),n,i);else{let n=t.el=e.el;t.children!==e.children&&l(n,t.children)}},b=(e,t,n,i)=>{e==null?r(t.el=c(t.children||``),n,i):t.el=e.el},x=(e,t,n,r)=>{[e.el,e.anchor]=_(e.children,t,n,r,e.el,e.anchor)},S=({el:e,anchor:t},n,i)=>{let a;for(;e&&e!==t;)a=f(e),r(e,n,i),e=a;r(t,n,i)},C=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=f(e),i(e),e=n;i(t)},ee=(e,t,n,r,i,a,o,s,c)=>{if(t.type===`svg`?o=`svg`:t.type===`math`&&(o=`mathml`),e==null)te(t,n,r,i,a,o,s,c);else{let n=e.el&&e.el._isVueCE?e.el:null;try{n&&n._beginPatch(),T(e,t,i,a,o,s,c)}finally{n&&n._endPatch()}}},te=(e,t,n,i,s,c,l,d)=>{let f,p,{props:m,shapeFlag:h,transition:g,dirs:_}=e;if(f=e.el=o(e.type,c,m&&m.is,m),h&8?u(f,e.children):h&16&&w(e.children,f,null,i,s,Ki(e,c),l,d),_&&Bn(e,null,i,`created`),ne(f,e,e.scopeId,l,i),m){for(let e in m)e!==`value`&&!ae(e)&&a(f,e,null,m[e],c,i);`value`in m&&a(f,`value`,null,m.value,c),(p=m.onVnodeBeforeMount)&&Ta(p,i,e)}_&&Bn(e,null,i,`beforeMount`);let v=Ji(s,g);v&&g.beforeEnter(f),r(f,t,n),((p=m&&m.onVnodeMounted)||v||_)&&Ui(()=>{try{p&&Ta(p,i,e),v&&g.enter(f),_&&Bn(e,null,i,`mounted`)}finally{}},s)},ne=(e,t,n,r,i)=>{if(n&&g(e,n),r)for(let t=0;t<r.length;t++)g(e,r[t]);if(i){let n=i.subTree;if(t===n||ea(n.type)&&(n.ssContent===t||n.ssFallback===t)){let t=i.vnode;ne(e,t,t.scopeId,t.slotScopeIds,i.parent)}}},w=(e,t,n,r,i,a,o,s,c=0)=>{for(let l=c;l<e.length;l++)v(null,e[l]=s?Sa(e[l]):xa(e[l]),t,n,r,i,a,o,s)},T=(e,t,n,r,i,o,s)=>{let c=t.el=e.el,{patchFlag:l,dynamicChildren:d,dirs:f}=t;l|=e.patchFlag&16;let m=e.props||p,h=t.props||p,g;if(n&&qi(n,!1),(g=h.onVnodeBeforeUpdate)&&Ta(g,n,t,e),f&&Bn(t,e,n,`beforeUpdate`),n&&qi(n,!0),(m.innerHTML&&h.innerHTML==null||m.textContent&&h.textContent==null)&&u(c,``),d?E(e.dynamicChildren,d,c,n,r,Ki(t,i),o):s||oe(e,t,c,null,n,r,Ki(t,i),o,!1),l>0){if(l&16)D(c,m,h,n,i);else if(l&2&&m.class!==h.class&&a(c,`class`,null,h.class,i),l&4&&a(c,`style`,m.style,h.style,i),l&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let r=e[t],o=m[r],s=h[r];(s!==o||r===`value`)&&a(c,r,o,s,i,n)}}l&1&&e.children!==t.children&&u(c,t.children)}else !s&&d==null&&D(c,m,h,n,i);((g=h.onVnodeUpdated)||f)&&Ui(()=>{g&&Ta(g,n,t,e),f&&Bn(t,e,n,`updated`)},r)},E=(e,t,n,r,i,a,o)=>{for(let s=0;s<t.length;s++){let c=e[s],l=t[s];v(c,l,c.el&&(c.type===R||!pa(c,l)||c.shapeFlag&198)?d(c.el):n,null,r,i,a,o,!0)}},D=(e,t,n,r,i)=>{if(t!==n){if(t!==p)for(let o in t)!ae(o)&&!(o in n)&&a(e,o,t[o],null,i,r);for(let o in n){if(ae(o))continue;let s=n[o],c=t[o];s!==c&&o!==`value`&&a(e,o,c,s,i,r)}`value`in n&&a(e,`value`,t.value,n.value,i)}},re=(e,t,n,i,a,o,c,l,u)=>{let d=t.el=e?e.el:s(``),f=t.anchor=e?e.anchor:s(``),{patchFlag:p,dynamicChildren:m,slotScopeIds:h}=t;h&&(l=l?l.concat(h):h),e==null?(r(d,n,i),r(f,n,i),w(t.children||[],n,f,a,o,c,l,u)):p>0&&p&64&&m&&e.dynamicChildren&&e.dynamicChildren.length===m.length?(E(e.dynamicChildren,m,n,a,o,c,l),(t.key!=null||a&&t===a.subTree)&&Yi(e,t,!0)):oe(e,t,n,f,a,o,c,l,u)},O=(e,t,n,r,i,a,o,s,c)=>{t.slotScopeIds=s,e==null?t.shapeFlag&512?i.ctx.activate(t,n,r,o,c):k(t,n,r,i,a,o,c):A(e,t,c)},k=(e,t,n,r,i,a,o)=>{let s=e.component=Oa(e,r,i);if(vr(e)&&(s.ctx.renderer=ye),La(s,!1,o),s.asyncDep){if(i&&i.registerDep(s,j,o),!e.el){let r=s.subTree=ga(ra);b(null,r,t,n),e.placeholder=r.el}}else j(s,e,t,n,i,a,o)},A=(e,t,n)=>{let r=t.component=e.component;if(xi(e,t,n))if(r.asyncDep&&!r.asyncResolved){ie(r,t,n);return}else r.next=t,r.update();else t.el=e.el,r.vnode=t},j=(e,t,n,r,i,a,o)=>{let s=()=>{if(e.isMounted){let{next:t,bu:n,u:r,parent:s,vnode:c}=e;{let n=Zi(e);if(n){t&&(t.el=c.el,ie(e,t,o)),n.asyncDep.then(()=>{Ui(()=>{e.isUnmounted||l()},i)});return}}let u=t,f;qi(e,!1),t?(t.el=c.el,ie(e,t,o)):t=c,n&&me(n),(f=t.props&&t.props.onVnodeBeforeUpdate)&&Ta(f,s,t,c),qi(e,!0);let p=vi(e),m=e.subTree;e.subTree=p,v(m,p,d(m.el),he(m),e,i,a),t.el=p.el,u===null&&wi(e,p.el),r&&Ui(r,i),(f=t.props&&t.props.onVnodeUpdated)&&Ui(()=>Ta(f,s,t,c),i)}else{let o,{el:s,props:c}=t,{bm:l,m:u,parent:d,root:f,type:p}=e,m=_r(t);if(qi(e,!1),l&&me(l),!m&&(o=c&&c.onVnodeBeforeMount)&&Ta(o,d,t),qi(e,!0),s&&xe){let t=()=>{e.subTree=vi(e),xe(s,e.subTree,e,i,null)};m&&p.__asyncHydrate?p.__asyncHydrate(s,e,t):t()}else{f.ce&&f.ce._hasShadowRoot()&&f.ce._injectChildStyle(p,e.parent?e.parent.type:void 0);let o=e.subTree=vi(e);v(null,o,n,r,e,i,a),t.el=o.el}if(u&&Ui(u,i),!m&&(o=c&&c.onVnodeMounted)){let e=t;Ui(()=>Ta(o,d,e),i)}(t.shapeFlag&256||d&&_r(d.vnode)&&d.vnode.shapeFlag&256)&&e.a&&Ui(e.a,i),e.isMounted=!0,t=n=r=null}};e.scope.on();let c=e.effect=new Le(s);e.scope.off();let l=e.update=c.run.bind(c),u=e.job=c.runIfDirty.bind(c);u.i=e,u.id=e.uid,c.scheduler=()=>On(u),qi(e,!0),l()},ie=(e,t,n)=>{t.component=e;let r=e.vnode.props;e.vnode=t,e.next=null,ki(e,t.props,r,n),Hi(e,t.children,n),Qe(),jn(e),$e()},oe=(e,t,n,r,i,a,o,s,c=!1)=>{let l=e&&e.children,d=e?e.shapeFlag:0,f=t.children,{patchFlag:p,shapeFlag:m}=t;if(p>0){if(p&128){ce(l,f,n,r,i,a,o,s,c);return}else if(p&256){se(l,f,n,r,i,a,o,s,c);return}}m&8?(d&16&&M(l,i,a),f!==l&&u(n,f)):d&16?m&16?ce(l,f,n,r,i,a,o,s,c):M(l,i,a,!0):(d&8&&u(n,``),m&16&&w(f,n,r,i,a,o,s,c))},se=(e,t,n,r,i,a,o,s,c)=>{e||=m,t||=m;let l=e.length,u=t.length,d=Math.min(l,u),f;for(f=0;f<d;f++){let r=t[f]=c?Sa(t[f]):xa(t[f]);v(e[f],r,n,null,i,a,o,s,c)}l>u?M(e,i,a,!0,!1,d):w(t,n,r,i,a,o,s,c,d)},ce=(e,t,n,r,i,a,o,s,c)=>{let l=0,u=t.length,d=e.length-1,f=u-1;for(;l<=d&&l<=f;){let r=e[l],u=t[l]=c?Sa(t[l]):xa(t[l]);if(pa(r,u))v(r,u,n,null,i,a,o,s,c);else break;l++}for(;l<=d&&l<=f;){let r=e[d],l=t[f]=c?Sa(t[f]):xa(t[f]);if(pa(r,l))v(r,l,n,null,i,a,o,s,c);else break;d--,f--}if(l>d){if(l<=f){let e=f+1,d=e<u?t[e].el:r;for(;l<=f;)v(null,t[l]=c?Sa(t[l]):xa(t[l]),n,d,i,a,o,s,c),l++}}else if(l>f)for(;l<=d;)ue(e[l],i,a,!0),l++;else{let p=l,h=l,g=new Map;for(l=h;l<=f;l++){let e=t[l]=c?Sa(t[l]):xa(t[l]);e.key!=null&&g.set(e.key,l)}let _,y=0,b=f-h+1,x=!1,S=0,C=Array(b);for(l=0;l<b;l++)C[l]=0;for(l=p;l<=d;l++){let r=e[l];if(y>=b){ue(r,i,a,!0);continue}let u;if(r.key!=null)u=g.get(r.key);else for(_=h;_<=f;_++)if(C[_-h]===0&&pa(r,t[_])){u=_;break}u===void 0?ue(r,i,a,!0):(C[u-h]=l+1,u>=S?S=u:x=!0,v(r,t[u],n,null,i,a,o,s,c),y++)}let ee=x?Xi(C):m;for(_=ee.length-1,l=b-1;l>=0;l--){let e=h+l,d=t[e],f=t[e+1],p=e+1<u?f.el||$i(f):r;C[l]===0?v(null,d,n,p,i,a,o,s,c):x&&(_<0||l!==ee[_]?le(d,n,p,2):_--)}}},le=(e,t,n,a,o=null)=>{let{el:s,type:c,transition:l,children:u,shapeFlag:d}=e;if(d&6){le(e.component.subTree,t,n,a);return}if(d&128){e.suspense.move(t,n,a);return}if(d&64){c.move(e,t,n,ye);return}if(c===R){r(s,t,n);for(let e=0;e<u.length;e++)le(u[e],t,n,a);r(e.anchor,t,n);return}if(c===ia){S(e,t,n);return}if(a!==2&&d&1&&l)if(a===0)l.persisted&&!s[lr]?r(s,t,n):(l.beforeEnter(s),r(s,t,n),Ui(()=>l.enter(s),o));else{let{leave:a,delayLeave:o,afterLeave:c}=l,u=()=>{e.ctx.isUnmounted?i(s):r(s,t,n)},d=()=>{let e=s._isLeaving||!!s[lr];s._isLeaving&&s[lr](!0),l.persisted&&!e?u():a(s,()=>{u(),c&&c()})};o?o(s,u,d):d()}else r(s,t,n)},ue=(e,t,n,r=!1,i=!1)=>{let{type:a,props:o,ref:s,children:c,dynamicChildren:l,shapeFlag:u,patchFlag:d,dirs:f,cacheIndex:p,memo:m}=e;if(d===-2&&(i=!1),s!=null&&(Qe(),hr(s,null,n,e,!0),$e()),p!=null&&(t.renderCache[p]=void 0),u&256){t.ctx.deactivate(e);return}let h=u&1&&f,g=!_r(e),_;if(g&&(_=o&&o.onVnodeBeforeUnmount)&&Ta(_,t,e),u&6)pe(e.component,n,r);else{if(u&128){e.suspense.unmount(n,r);return}h&&Bn(e,null,t,`beforeUnmount`),u&64?e.type.remove(e,t,n,ye,r):l&&!l.hasOnce&&(a!==R||d>0&&d&64)?M(l,t,n,!1,!0):(a===R&&d&384||!i&&u&16)&&M(c,t,n),r&&de(e)}let v=m!=null&&p==null;(g&&(_=o&&o.onVnodeUnmounted)||h||v)&&Ui(()=>{_&&Ta(_,t,e),h&&Bn(e,null,t,`unmounted`),v&&(e.el=null)},n)},de=e=>{let{type:t,el:n,anchor:r,transition:a}=e;if(t===R){fe(n,r);return}if(t===ia){C(e);return}let o=()=>{i(n),a&&!a.persisted&&a.afterLeave&&a.afterLeave()};if(e.shapeFlag&1&&a&&!a.persisted){let{leave:t,delayLeave:r}=a,i=()=>t(n,o);r?r(e.el,o,i):i()}else o()},fe=(e,t)=>{let n;for(;e!==t;)n=f(e),i(e),e=n;i(t)},pe=(e,t,n)=>{let{bum:r,scope:i,job:a,subTree:o,um:s,m:c,a:l}=e;Qi(c),Qi(l),r&&me(r),i.stop(),a&&(a.flags|=8,ue(o,e,t,n)),s&&Ui(s,t),Ui(()=>{e.isUnmounted=!0},t)},M=(e,t,n,r=!1,i=!1,a=0)=>{for(let o=a;o<e.length;o++)ue(e[o],t,n,r,i)},he=e=>{if(e.shapeFlag&6)return he(e.component.subTree);if(e.shapeFlag&128)return e.suspense.next();let t=f(e.anchor||e.el),n=t&&t[Xn];return n?f(n):t},ge=!1,ve=(e,t,n)=>{let r;e==null?t._vnode&&(ue(t._vnode,null,null,!0),r=t._vnode.component):v(t._vnode||null,e,t,null,null,null,n),t._vnode=e,ge||=(ge=!0,jn(r),Mn(),!1)},ye={p:v,um:ue,m:le,r:de,mt:k,mc:w,pc:oe,pbc:E,n:he,o:e},be,xe;return t&&([be,xe]=t(ye)),{render:ve,hydrate:be,createApp:di(ve,be)}}function Ki({type:e,props:t},n){return n===`svg`&&e===`foreignObject`||n===`mathml`&&e===`annotation-xml`&&t&&t.encoding&&t.encoding.includes(`html`)?void 0:n}function qi({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Ji(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Yi(e,t,n=!1){let r=e.children,i=t.children;if(C(r)&&C(i))for(let e=0;e<r.length;e++){let t=r[e],a=i[e];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=i[e]=Sa(i[e]),a.el=t.el),!n&&a.patchFlag!==-2&&Yi(t,a)),a.type===na&&(a.patchFlag===-1&&(a=i[e]=Sa(a)),a.el=t.el),a.type===ra&&!a.el&&(a.el=t.el)}}function Xi(e){let t=e.slice(),n=[0],r,i,a,o,s,c=e.length;for(r=0;r<c;r++){let c=e[r];if(c!==0){if(i=n[n.length-1],e[i]<c){t[r]=i,n.push(r);continue}for(a=0,o=n.length-1;a<o;)s=a+o>>1,e[n[s]]<c?a=s+1:o=s;c<e[n[a]]&&(a>0&&(t[r]=n[a-1]),n[a]=r)}}for(a=n.length,o=n[a-1];a-- >0;)n[a]=o,o=t[o];return n}function Zi(e){let t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Zi(t)}function Qi(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function $i(e){if(e.placeholder)return e.placeholder;let t=e.component;return t?$i(t.subTree):null}var ea=e=>e.__isSuspense;function ta(e,t){t&&t.pendingBranch?C(e)?t.effects.push(...e):t.effects.push(e):An(e)}var R=Symbol.for(`v-fgt`),na=Symbol.for(`v-txt`),ra=Symbol.for(`v-cmt`),ia=Symbol.for(`v-stc`),aa=[],oa=null;function z(e=!1){aa.push(oa=e?null:[])}function sa(){aa.pop(),oa=aa[aa.length-1]||null}var ca=1;function la(e,t=!1){ca+=e,e<0&&oa&&t&&(oa.hasOnce=!0)}function ua(e){return e.dynamicChildren=ca>0?oa||m:null,sa(),ca>0&&oa&&oa.push(e),e}function B(e,t,n,r,i,a){return ua(V(e,t,n,r,i,a,!0))}function da(e,t,n,r,i){return ua(ga(e,t,n,r,i,!0))}function fa(e){return e?e.__v_isVNode===!0:!1}function pa(e,t){return e.type===t.type&&e.key===t.key}var ma=({key:e})=>e??null,ha=({ref:e,ref_key:t,ref_for:n})=>(typeof e==`number`&&(e=``+e),e==null?null:T(e)||tn(e)||w(e)?{i:Fn,r:e,k:t,f:!!n}:e);function V(e,t=null,n=null,r=0,i=null,a=e===R?0:1,o=!1,s=!1){let c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&ma(t),ref:t&&ha(t),scopeId:In,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Fn};return s?(Ca(c,n),a&128&&e.normalize(c)):n&&(c.shapeFlag|=T(n)?8:16),ca>0&&!o&&oa&&(c.patchFlag>0||a&6)&&c.patchFlag!==32&&oa.push(c),c}var ga=_a;function _a(e,t=null,n=null,r=0,i=null,a=!1){if((!e||e===Ir)&&(e=ra),fa(e)){let r=ya(e,t,!0);return n&&Ca(r,n),ca>0&&!a&&oa&&(r.shapeFlag&6?oa[oa.indexOf(e)]=r:oa.push(r)),r.patchFlag=-2,r}if(qa(e)&&(e=e.__vccOpts),t){t=va(t);let{class:e,style:n}=t;e&&!T(e)&&(t.class=Ce(e)),D(n)&&(Zt(n)&&!C(n)&&(n=y({},n)),t.style=ve(n))}let o=T(e)?1:ea(e)?128:Zn(e)?64:D(e)?4:w(e)?2:0;return V(e,t,n,r,i,o,a,!0)}function va(e){return e?Zt(e)||Di(e)?y({},e):e:null}function ya(e,t,n=!1,r=!1){let{props:i,ref:a,patchFlag:o,children:s,transition:c}=e,l=t?wa(i||{},t):i,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:l,key:l&&ma(l),ref:t&&t.ref?n&&a?C(a)?a.concat(ha(t)):[a,ha(t)]:ha(t):a,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:s,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==R?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&ya(e.ssContent),ssFallback:e.ssFallback&&ya(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return c&&r&&ur(u,c.clone(u)),u}function ba(e=` `,t=0){return ga(na,null,e,t)}function H(e=``,t=!1){return t?(z(),da(ra,null,e)):ga(ra,null,e)}function xa(e){return e==null||typeof e==`boolean`?ga(ra):C(e)?ga(R,null,e.slice()):fa(e)?Sa(e):ga(na,null,String(e))}function Sa(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:ya(e)}function Ca(e,t){let n=0,{shapeFlag:r}=e;if(t==null)t=null;else if(C(t))n=16;else if(typeof t==`object`)if(r&65){let n=t.default;n&&(n._c&&(n._d=!1),Ca(e,n()),n._c&&(n._d=!0));return}else{n=32;let r=t._;!r&&!Di(t)?t._ctx=Fn:r===3&&Fn&&(Fn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else w(t)?(t={default:t,_ctx:Fn},n=32):(t=String(t),r&64?(n=16,t=[ba(t)]):n=8);e.children=t,e.shapeFlag|=n}function wa(...e){let t={};for(let n=0;n<e.length;n++){let r=e[n];for(let e in r)if(e===`class`)t.class!==r.class&&(t.class=Ce([t.class,r.class]));else if(e===`style`)t.style=ve([t.style,r.style]);else if(_(e)){let n=t[e],i=r[e];i&&n!==i&&!(C(n)&&n.includes(i))?t[e]=n?[].concat(n,i):i:i==null&&n==null&&!v(e)&&(t[e]=i)}else e!==``&&(t[e]=r[e])}return t}function Ta(e,t,n,r=null){gn(e,t,7,[n,r])}var Ea=li(),Da=0;function Oa(e,t,n){let r=e.type,i=(t?t.appContext:e.appContext)||Ea,a={uid:Da++,vnode:e,type:r,parent:t,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Pe(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(i.provides),ids:t?t.ids:[``,0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Ni(r,i),emitsOptions:gi(r,i),emit:null,emitted:null,propsDefaults:p,inheritAttrs:r.inheritAttrs,ctx:p,data:p,props:p,attrs:p,slots:p,refs:p,setupState:p,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return a.ctx={_:a},a.root=t?t.root:a,a.emit=mi.bind(null,a),e.ce&&e.ce(a),a}var ka=null,Aa=()=>ka||Fn,ja,Ma;{let e=_e(),t=(t,n)=>{let r;return(r=e[t])||(r=e[t]=[]),r.push(n),e=>{r.length>1?r.forEach(t=>t(e)):r[0](e)}};ja=t(`__VUE_INSTANCE_SETTERS__`,e=>ka=e),Ma=t(`__VUE_SSR_SETTERS__`,e=>Ia=e)}var Na=e=>{let t=ka;return ja(e),e.scope.on(),()=>{e.scope.off(),ja(t)}},Pa=()=>{ka&&ka.scope.off(),ja(null)};function Fa(e){return e.vnode.shapeFlag&4}var Ia=!1;function La(e,t=!1,n=!1){t&&Ma(t);let{props:r,children:i}=e.vnode,a=Fa(e);Oi(e,r,a,t),Vi(e,i,n||t);let o=a?Ra(e,t):void 0;return t&&Ma(!1),o}function Ra(e,t){let n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Kr);let{setup:r}=n;if(r){Qe();let n=e.setupContext=r.length>1?Wa(e):null,i=Na(e),a=hn(r,e,0,[e.props,n]),o=re(a);if($e(),i(),(o||e.sp)&&!_r(e)&&fr(e),o){if(a.then(Pa,Pa),t)return a.then(n=>{za(e,n,t)}).catch(t=>{_n(t,e,0)});e.asyncDep=a}else za(e,a,t)}else Ha(e,t)}function za(e,t,n){w(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:D(t)&&(e.setupState=on(t)),Ha(e,n)}var Ba,Va;function Ha(e,t,n){let r=e.type;if(!e.render){if(!t&&Ba&&!r.render){let t=r.template||$r(e).template;if(t){let{isCustomElement:n,compilerOptions:i}=e.appContext.config,{delimiters:a,compilerOptions:o}=r;r.render=Ba(t,y(y({isCustomElement:n,delimiters:a},i),o))}}e.render=r.render||h,Va&&Va(e)}{let t=Na(e);Qe();try{Yr(e)}finally{$e(),t()}}}var Ua={get(e,t){return lt(e,`get`,``),e[t]}};function Wa(e){return{attrs:new Proxy(e.attrs,Ua),slots:e.slots,emit:e.emit,expose:t=>{e.exposed=t||{}}}}function Ga(e){return e.exposed?e.exposeProxy||=new Proxy(on(Qt(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Wr)return Wr[n](e)},has(e,t){return t in e||t in Wr}}):e.proxy}function Ka(e,t=!0){return w(e)?e.displayName||e.name:e.name||t&&e.__name}function qa(e){return w(e)&&`__vccOpts`in e}var U=(e,t)=>cn(e,t,Ia);function Ja(e,t,n){try{la(-1);let r=arguments.length;return r===2?D(t)&&!C(t)?fa(t)?ga(e,null,[t]):ga(e,t):ga(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&fa(n)&&(n=[n]),ga(e,t,n))}finally{la(1)}}var Ya=`3.5.38`,Xa=void 0,Za=typeof window<`u`&&window.trustedTypes;if(Za)try{Xa=Za.createPolicy(`vue`,{createHTML:e=>e})}catch{}var Qa=Xa?e=>Xa.createHTML(e):e=>e,$a=`http://www.w3.org/2000/svg`,eo=`http://www.w3.org/1998/Math/MathML`,to=typeof document<`u`?document:null,no=to&&to.createElement(`template`),ro={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{let t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{let i=t===`svg`?to.createElementNS($a,e):t===`mathml`?to.createElementNS(eo,e):n?to.createElement(e,{is:n}):to.createElement(e);return e===`select`&&r&&r.multiple!=null&&i.setAttribute(`multiple`,r.multiple),i},createText:e=>to.createTextNode(e),createComment:e=>to.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>to.querySelector(e),setScopeId(e,t){e.setAttribute(t,``)},insertStaticContent(e,t,n,r,i,a){let o=n?n.previousSibling:t.lastChild;if(i&&(i===a||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),!(i===a||!(i=i.nextSibling)););else{no.innerHTML=Qa(r===`svg`?`<svg>${e}</svg>`:r===`mathml`?`<math>${e}</math>`:e);let i=no.content;if(r===`svg`||r===`mathml`){let e=i.firstChild;for(;e.firstChild;)i.appendChild(e.firstChild);i.removeChild(e)}t.insertBefore(i,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},io=Symbol(`_vtc`);function ao(e,t,n){let r=e[io];r&&(t=(t?[t,...r]:[...r]).join(` `)),t==null?e.removeAttribute(`class`):n?e.setAttribute(`class`,t):e.className=t}var oo=Symbol(`_vod`),so=Symbol(`_vsh`),co={name:`show`,beforeMount(e,{value:t},{transition:n}){e[oo]=e.style.display===`none`?``:e.style.display,n&&t?n.beforeEnter(e):lo(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),lo(e,!0),r.enter(e)):r.leave(e,()=>{lo(e,!1)}):lo(e,t))},beforeUnmount(e,{value:t}){lo(e,t)}};function lo(e,t){e.style.display=t?e[oo]:`none`,e[so]=!t}var uo=Symbol(``),fo=/(?:^|;)\s*display\s*:/;function po(e,t,n){let r=e.style,i=T(n),a=!1;if(n&&!i){if(t)if(T(t))for(let e of t.split(`;`)){let t=e.slice(0,e.indexOf(`:`)).trim();n[t]??ho(r,t,``)}else for(let e in t)n[e]??ho(r,e,``);for(let i in n){i===`display`&&(a=!0);let o=n[i];o==null?ho(r,i,``):yo(e,i,!T(t)&&t?t[i]:void 0,o)||ho(r,i,o)}}else if(i){if(t!==n){let e=r[uo];e&&(n+=`;`+e),r.cssText=n,a=fo.test(n)}}else t&&e.removeAttribute(`style`);oo in e&&(e[oo]=a?r.display:``,e[so]&&(r.display=`none`))}var mo=/\s*!important$/;function ho(e,t,n){if(C(n))n.forEach(n=>ho(e,t,n));else if(n??=``,t.startsWith(`--`))e.setProperty(t,n);else{let r=vo(e,t);mo.test(n)?e.setProperty(ue(r),n.replace(mo,``),`important`):e[r]=n}}var go=[`Webkit`,`Moz`,`ms`],_o={};function vo(e,t){let n=_o[t];if(n)return n;let r=ce(t);if(r!==`filter`&&r in e)return _o[t]=r;r=de(r);for(let n=0;n<go.length;n++){let i=go[n]+r;if(i in e)return _o[t]=i}return t}function yo(e,t,n,r){return e.tagName===`TEXTAREA`&&(t===`width`||t===`height`)&&T(r)&&n===r}var bo=`http://www.w3.org/1999/xlink`;function xo(e,t,n,r,i,a=Te(t)){r&&t.startsWith(`xlink:`)?n==null?e.removeAttributeNS(bo,t.slice(6,t.length)):e.setAttributeNS(bo,t,n):n==null||a&&!Ee(n)?e.removeAttribute(t):e.setAttribute(t,a?``:E(n)?String(n):n)}function So(e,t,n,r,i){if(t===`innerHTML`||t===`textContent`){n!=null&&(e[t]=t===`innerHTML`?Qa(n):n);return}let a=e.tagName;if(t===`value`&&a!==`PROGRESS`&&!a.includes(`-`)){let r=a===`OPTION`?e.getAttribute(`value`)||``:e.value,i=n==null?e.type===`checkbox`?`on`:``:String(n);(r!==i||!(`_value`in e))&&(e.value=i),n??e.removeAttribute(t),e._value=n;return}let o=!1;if(n===``||n==null){let r=typeof e[t];r===`boolean`?n=Ee(n):n==null&&r===`string`?(n=``,o=!0):r===`number`&&(n=0,o=!0)}try{e[t]=n}catch{}o&&e.removeAttribute(i||t)}function Co(e,t,n,r){e.addEventListener(t,n,r)}function wo(e,t,n,r){e.removeEventListener(t,n,r)}var To=Symbol(`_vei`);function Eo(e,t,n,r,i=null){let a=e[To]||(e[To]={}),o=a[t];if(r&&o)o.value=r;else{let[n,s]=Oo(t);r?Co(e,n,a[t]=Mo(r,i),s):o&&(wo(e,n,o,s),a[t]=void 0)}}var Do=/(?:Once|Passive|Capture)$/;function Oo(e){let t;if(Do.test(e)){t={};let n;for(;n=e.match(Do);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[e[2]===`:`?e.slice(3):ue(e.slice(2)),t]}var ko=0,Ao=Promise.resolve(),jo=()=>ko||=(Ao.then(()=>ko=0),Date.now());function Mo(e,t){let n=e=>{if(!e._vts)e._vts=Date.now();else if(e._vts<=n.attached)return;let r=n.value;if(C(r)){let n=e.stopImmediatePropagation;e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0};let i=r.slice(),a=[e];for(let n=0;n<i.length&&!e._stopped;n++){let e=i[n];e&&gn(e,t,5,a)}}else gn(r,t,5,[e])};return n.value=e,n.attached=jo(),n}var No=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Po=(e,t,n,r,i,a)=>{let o=i===`svg`;t===`class`?ao(e,r,o):t===`style`?po(e,n,r):_(t)?v(t)||Eo(e,t,n,r,a):(t[0]===`.`?(t=t.slice(1),!0):t[0]===`^`?(t=t.slice(1),!1):Fo(e,t,r,o))?(So(e,t,r),!e.tagName.includes(`-`)&&(t===`value`||t===`checked`||t===`selected`)&&xo(e,t,r,o,a,t!==`value`)):e._isVueCE&&(Io(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!T(r)))?So(e,ce(t),r,a,t):(t===`true-value`?e._trueValue=r:t===`false-value`&&(e._falseValue=r),xo(e,t,r,o))};function Fo(e,t,n,r){if(r)return!!(t===`innerHTML`||t===`textContent`||t in e&&No(t)&&w(n));if(t===`spellcheck`||t===`draggable`||t===`translate`||t===`autocorrect`||t===`sandbox`&&e.tagName===`IFRAME`||t===`form`||t===`list`&&e.tagName===`INPUT`||t===`type`&&e.tagName===`TEXTAREA`)return!1;if(t===`width`||t===`height`){let t=e.tagName;if(t===`IMG`||t===`VIDEO`||t===`CANVAS`||t===`SOURCE`)return!1}return No(t)&&T(n)?!1:t in e}function Io(e,t){let n=e._def.props;if(!n)return!1;let r=ce(t);return Array.isArray(n)?n.some(e=>ce(e)===r):Object.keys(n).some(e=>ce(e)===r)}var Lo=e=>{let t=e.props[`onUpdate:modelValue`]||!1;return C(t)?e=>me(t,e):t};function Ro(e){e.target.composing=!0}function zo(e){let t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event(`input`)))}var Bo=Symbol(`_assign`);function Vo(e,t,n){return t&&(e=e.trim()),n&&(e=he(e)),e}var Ho={created(e,{modifiers:{lazy:t,trim:n,number:r}},i){e[Bo]=Lo(i);let a=r||i.props&&i.props.type===`number`;Co(e,t?`change`:`input`,t=>{t.target.composing||e[Bo](Vo(e.value,n,a))}),(n||a)&&Co(e,`change`,()=>{e.value=Vo(e.value,n,a)}),t||(Co(e,`compositionstart`,Ro),Co(e,`compositionend`,zo),Co(e,`change`,zo))},mounted(e,{value:t}){e.value=t??``},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[Bo]=Lo(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?he(e.value):e.value,c=t??``;if(s===c)return;let l=e.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c)}},Uo={deep:!0,created(e,t,n){e[Bo]=Lo(n),Co(e,`change`,()=>{let t=e._modelValue,n=Jo(e),r=e.checked,i=e[Bo];if(C(t)){let e=ke(t,n),a=e!==-1;if(r&&!a)i(t.concat(n));else if(!r&&a){let n=[...t];n.splice(e,1),i(n)}}else if(te(t)){let e=new Set(t);r?e.add(n):e.delete(n),i(e)}else i(Yo(e,r))})},mounted:Wo,beforeUpdate(e,t,n){e[Bo]=Lo(n),Wo(e,t,n)}};function Wo(e,{value:t,oldValue:n},r){e._modelValue=t;let i;if(C(t))i=ke(t,r.props.value)>-1;else if(te(t))i=t.has(r.props.value);else{if(t===n)return;i=Oe(t,Yo(e,!0))}e.checked!==i&&(e.checked=i)}var Go={created(e,{value:t},n){e.checked=Oe(t,n.props.value),e[Bo]=Lo(n),Co(e,`change`,()=>{e[Bo](Jo(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[Bo]=Lo(r),t!==n&&(e.checked=Oe(t,r.props.value))}},Ko={deep:!0,created(e,{value:t,modifiers:{number:n}},r){let i=te(t);Co(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?he(Jo(e)):Jo(e));e[Bo](e.multiple?i?new Set(t):t:t[0]),e._assigning=!0,En(()=>{e._assigning=!1})}),e[Bo]=Lo(r)},mounted(e,{value:t}){qo(e,t)},beforeUpdate(e,t,n){e[Bo]=Lo(n)},updated(e,{value:t}){e._assigning||qo(e,t)}};function qo(e,t){let n=e.multiple,r=C(t);if(!(n&&!r&&!te(t))){for(let i=0,a=e.options.length;i<a;i++){let a=e.options[i],o=Jo(a);if(n)if(r){let e=typeof o;e===`string`||e===`number`?a.selected=t.some(e=>String(e)===String(o)):a.selected=ke(t,o)>-1}else a.selected=t.has(o);else if(Oe(Jo(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Jo(e){return`_value`in e?e._value:e.value}function Yo(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var Xo=[`ctrl`,`shift`,`alt`,`meta`],Zo={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>Xo.some(n=>e[`${n}Key`]&&!t.includes(n))},Qo=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=Zo[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},$o=y({patchProp:Po},ro),es;function ts(){return es||=Wi($o)}var ns=((...e)=>{let t=ts().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=is(e);if(!r)return;let i=t._component;!w(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,rs(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t});function rs(e){if(e instanceof SVGElement)return`svg`;if(typeof MathMLElement==`function`&&e instanceof MathMLElement)return`mathml`}function is(e){return T(e)?document.querySelector(e):e}var as=[`aria-pressed`],os=dr({__name:`FilterChip`,props:{active:{type:Boolean},label:{},count:{}},emits:[`click`],setup(e){return(t,n)=>(z(),B(`button`,{type:`button`,"aria-pressed":e.active,class:Ce([`chip`,{active:e.active}]),onClick:n[0]||=e=>t.$emit(`click`)},[ba(N(e.label),1),e.count===void 0?H(``,!0):(z(),B(R,{key:0},[ba(` (`+N(e.count)+`) `,1)],64))],10,as))}}),ss=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},cs=ss(os,[[`__scopeId`,`data-v-0d423d77`]]),ls={class:`sidebar`},us={class:`sidebar-header`},ds={class:`filters`},fs={key:0,class:`state`},ps={key:1,class:`state error`},ms={key:2,class:`state`},hs={key:3,class:`state`},gs={key:4,class:`list`},_s=[`title`,`onClick`],vs={class:`item-title`},ys={key:0,class:`spinner`,title:`Claude is working`,"aria-label":`Claude is working`},bs={class:`item-time`},xs=ss(dr({__name:`Sidebar`,props:{sessions:{},loading:{type:Boolean},error:{},activeId:{},filter:{}},emits:[`select`,`new`,`toggle-layout`,`refresh`,`update:filter`],setup(e,{emit:t}){let n=e,r=t,i=U(()=>n.sessions.filter(e=>e.waiting).length),a=U(()=>n.filter===`unread`?n.sessions.filter(e=>e.waiting):n.sessions);function o(e){let t=Date.now()-e,n=Math.round(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.round(n/60);return r<24?`${r}h ago`:`${Math.round(r/24)}d ago`}return(t,s)=>(z(),B(`aside`,ls,[V(`div`,us,[s[5]||=V(`span`,{class:`heading`},`Sessions`,-1),V(`button`,{class:`icon-btn`,title:`Switch to horizontal tabs`,"aria-label":`Switch to horizontal tabs`,onClick:s[0]||=e=>r(`toggle-layout`)},`⇥`)]),V(`button`,{class:`new-btn`,onClick:s[1]||=e=>r(`new`)},`+ New session`),V(`div`,ds,[ga(cs,{label:`All`,active:e.filter===`all`,onClick:s[2]||=e=>r(`update:filter`,`all`)},null,8,[`active`]),ga(cs,{label:`Unread`,count:i.value,active:e.filter===`unread`,onClick:s[3]||=e=>r(`update:filter`,`unread`)},null,8,[`count`,`active`]),V(`button`,{class:`icon-btn sort-btn`,title:`Sort by most recent`,"aria-label":`Sort by most recent`,onClick:s[4]||=e=>r(`refresh`)},`⟳`)]),e.loading?(z(),B(`div`,fs,`Loading…`)):e.error?(z(),B(`div`,ps,N(e.error),1)):e.sessions.length===0?(z(),B(`div`,ms,`No sessions yet`)):a.value.length===0?(z(),B(`div`,hs,`No unread sessions`)):(z(),B(`ul`,gs,[(z(!0),B(R,null,Br(a.value,e=>(z(),B(`li`,{key:e.id,class:Ce([`item`,{active:e.id===n.activeId,waiting:e.waiting}]),title:e.title,onClick:t=>r(`select`,e.id)},[V(`span`,vs,[e.working&&!e.waiting&&e.id!==n.activeId?(z(),B(`span`,ys)):H(``,!0),ba(` `+N(e.title),1)]),V(`span`,bs,N(o(e.mtime)),1)],10,_s))),128))]))]))}}),[[`__scopeId`,`data-v-65add4c2`]]),Ss={class:`tabbar`},Cs={class:`filters`},ws={class:`tabs`},Ts=[`title`,`aria-current`,`onClick`],Es={key:0,class:`spinner`,title:`Claude is working`,"aria-label":`Claude is working`},Ds={class:`tab-title`},Os={key:1,class:`unread-dot`,"aria-label":`Unread`},ks={class:`actions`},As=8,js=ss(dr({__name:`SessionTabBar`,props:{sessions:{},activeId:{},filter:{}},emits:[`select`,`new`,`toggle-layout`,`refresh`,`update:filter`],setup(e,{emit:t}){let n=e,r=t,i=U(()=>n.sessions.filter(e=>e.waiting).length),a=U(()=>(n.filter===`unread`?n.sessions.filter(e=>e.waiting):n.sessions).slice(0,As));return(t,o)=>(z(),B(`div`,Ss,[V(`button`,{class:`new-btn`,title:`New session`,"aria-label":`New session`,onClick:o[0]||=e=>r(`new`)},`+`),V(`div`,Cs,[ga(cs,{label:`All`,active:e.filter===`all`,onClick:o[1]||=e=>r(`update:filter`,`all`)},null,8,[`active`]),ga(cs,{label:`Unread`,count:i.value,active:e.filter===`unread`,onClick:o[2]||=e=>r(`update:filter`,`unread`)},null,8,[`count`,`active`]),V(`button`,{class:`icon-btn sort-btn`,title:`Sort by most recent`,"aria-label":`Sort by most recent`,onClick:o[3]||=e=>r(`refresh`)},`⟳`)]),V(`div`,ws,[(z(!0),B(R,null,Br(a.value,e=>(z(),B(`button`,{key:e.id,class:Ce([`tab`,{active:e.id===n.activeId,waiting:e.waiting}]),title:e.title,"aria-current":e.id===n.activeId?`page`:void 0,onClick:t=>r(`select`,e.id)},[e.working&&!e.waiting&&e.id!==n.activeId?(z(),B(`span`,Es)):H(``,!0),V(`span`,Ds,N(e.title),1),e.waiting&&e.id!==n.activeId?(z(),B(`span`,Os)):H(``,!0)],10,Ts))),128))]),V(`div`,ks,[V(`button`,{class:`icon-btn`,title:`Switch to vertical sidebar`,"aria-label":`Switch to vertical sidebar`,onClick:o[4]||=e=>r(`toggle-layout`)},`⇤`)])]))}}),[[`__scopeId`,`data-v-09487b28`]]),Ms=Object.defineProperty,Ns=Object.getOwnPropertyDescriptor,Ps=(e,t)=>{for(var n in t)Ms(e,n,{get:t[n],enumerable:!0})},Fs=(e,t,n,r)=>{for(var i=r>1?void 0:r?Ns(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Ms(t,n,i),i},W=(e,t)=>(n,r)=>t(n,r,e),Is=`Terminal input`,Ls={get:()=>Is,set:e=>Is=e},Rs=`Too much output to announce, navigate to rows manually to read`,zs={get:()=>Rs,set:e=>Rs=e};function Bs(e){return e.replace(/\r?\n/g,`\r`)}function Vs(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function Hs(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function Us(e,t,n,r){e.stopPropagation(),e.clipboardData&&Ws(e.clipboardData.getData(`text/plain`),t,n,r)}function Ws(e,t,n,r){e=Bs(e),e=Vs(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function Gs(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function Ks(e,t,n,r,i){Gs(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function qs(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Js(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var Ys=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},Xs=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}else this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},Zs=``,Qs=` `,$s=class e{constructor(){this.fg=0,this.bg=0,this.extended=new ec}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return(this.fg&50331648)==0}isBgDefault(){return(this.bg&50331648)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},ec=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},tc=class e extends $s{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ec,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?qs(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},nc=`di$target`,rc=`di$dependencies`,ic=new Map;function ac(e){return e[rc]||[]}function oc(e){if(ic.has(e))return ic.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);sc(t,e,r)};return t._id=e,ic.set(e,t),t}function sc(e,t,n){t[nc]===t?t[rc].push({id:e,index:n}):(t[rc]=[{id:e,index:n}],t[nc]=t)}var cc=oc(`BufferService`),lc=oc(`CoreMouseService`),uc=oc(`CoreService`),dc=oc(`CharsetService`),fc=oc(`InstantiationService`),pc=oc(`LogService`),mc=oc(`OptionsService`),hc=oc(`OscLinkService`),gc=oc(`UnicodeService`),_c=oc(`DecorationService`),vc=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new tc,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId)if(c===-1){c=t,s=a.extended.urlId;continue}else l=a.extended.urlId!==s;else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):yc(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};vc=Fs([W(0,cc),W(1,mc),W(2,hc)],vc);function yc(e,t){if(confirm(`Do you want to navigate to ${t}?
2
+
3
+ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var bc=oc(`CharSizeService`),xc=oc(`CoreBrowserService`),Sc=oc(`MouseService`),Cc=oc(`RenderService`),wc=oc(`SelectionService`),Tc=oc(`CharacterJoinerService`),Ec=oc(`ThemeService`),Dc=oc(`LinkProviderService`),Oc=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Pc.isErrorNoTelemetry(e)?new Pc(e.message+`
4
+
5
+ `+e.stack):Error(e.message+`
6
+
7
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function kc(e){jc(e)||Oc.onUnexpectedError(e)}var Ac=`Canceled`;function jc(e){return e instanceof Mc?!0:e instanceof Error&&e.name===Ac&&e.message===Ac}var Mc=class extends Error{constructor(){super(Ac),this.name=this.message}};function Nc(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var Pc=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},Fc=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function Ic(e,t,n=0,r=e.length){let i=n,a=r;for(;i<a;){let n=Math.floor((i+a)/2);t(e[n])?i=n+1:a=n}return i-1}var Lc=class e{constructor(e){this._array=e,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(e.assertInvariants){if(this._prevFindLastPredicate){for(let e of this._array)if(this._prevFindLastPredicate(e)&&!t(e))throw Error(`MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.`)}this._prevFindLastPredicate=t}let n=Ic(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=n+1,n===-1?void 0:this._array[n]}};Lc.assertInvariants=!1;function Rc(e,t=0){return e[e.length-(1+t)]}var zc;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(zc||={});function Bc(e,t){return(n,r)=>t(e(n),e(r))}var Vc=(e,t)=>e-t,Hc=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>t(n)?e(n):!0))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>e(n)?(t=n,!1):!0),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||zc.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};Hc.empty=new Hc(e=>{});function Uc(e,t){let n=Object.create(null);for(let r of e){let e=t(r),i=n[e];i||=n[e]=[],i.push(r)}return n}var Wc=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||new Set}};function Gc(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var Kc;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(Kc||={});var qc=!1,Jc=null,Yc=class e{constructor(){this.livingDisposables=new Map}getDisposableData(t){let n=this.livingDisposables.get(t);return n||(n={parent:null,source:null,isSingleton:!1,value:t,idx:e.idx++},this.livingDisposables.set(t,n)),n}trackDisposable(e){let t=this.getDisposableData(e);t.source||=Error().stack}setParent(e,t){let n=this.getDisposableData(e);n.parent=t}markAsDisposed(e){this.livingDisposables.delete(e)}markAsSingleton(e){this.getDisposableData(e).isSingleton=!0}getRootParent(e,t){let n=t.get(e);if(n)return n;let r=e.parent?this.getRootParent(this.getDisposableData(e.parent),t):e;return t.set(e,r),r}getTrackedDisposables(){let e=new Map;return[...this.livingDisposables.entries()].filter(([,t])=>t.source!==null&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let e=new Map,t=[...this.livingDisposables.values()].filter(t=>t.source!==null&&!this.getRootParent(t,e).isSingleton);if(t.length===0)return;let r=new Set(t.map(e=>e.value));if(n=t.filter(e=>!(e.parent&&r.has(e.parent))),n.length===0)throw Error(`There are cyclic diposable chains!`)}if(!n)return;function r(e){function t(e,t){for(;e.length>0&&t.some(t=>typeof t==`string`?t===e[0]:e[0].match(t));)e.shift()}let n=e.source.split(`
8
+ `).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new Wc;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(`
9
+ `),e)}n.sort(Bc(e=>e.idx,Vc));let a=``,o=0;for(let t of n.slice(0,e)){o++;let e=r(t),s=[];for(let t=0;t<e.length;t++){let a=e[t];a=`(shared with ${i.get(e.slice(0,t+1).join(`
10
+ `)).size}/${n.length} leaks) at ${a}`;let o=Uc([...i.get(e.slice(0,t).join(`
11
+ `))].map(e=>r(e)[t]),e=>e);delete o[e[t]];for(let[e,t]of Object.entries(o))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(a)}a+=`
12
+
13
+
14
+ ==================== Leaking disposable ${o}/${n.length}: ${t.value.constructor.name} ====================
15
+ ${s.join(`
16
+ `)}
17
+ ============================================================
18
+
19
+ `}return n.length>e&&(a+=`
20
+
21
+
22
+ ... and ${n.length-e} more leaking disposables
23
+
24
+ `),{leaks:n,details:a}}};Yc.idx=0;function Xc(e){Jc=e}if(qc){let e=`__is_disposable_tracked__`;Xc(new class{trackDisposable(t){let n=Error(`Potentially leaked disposable`).stack;setTimeout(()=>{t[e]||console.log(n)},3e3)}setParent(t,n){if(t&&t!==G.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==G.None)try{t[e]=!0}catch{}}markAsSingleton(e){}})}function Zc(e){return Jc?.trackDisposable(e),e}function Qc(e){Jc?.markAsDisposed(e)}function $c(e,t){Jc?.setParent(e,t)}function el(e,t){if(Jc)for(let n of e)Jc.setParent(n,t)}function tl(e){return Jc?.markAsSingleton(e),e}function nl(e){if(Kc.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function rl(...e){let t=il(()=>nl(e));return el(e,t),t}function il(e){let t=Zc({dispose:Gc(()=>{Qc(t),e()})});return t}var al=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,Zc(this)}dispose(){this._isDisposed||(Qc(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{nl(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return $c(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),$c(e,null))}};al.DISABLE_DISPOSED_WARNING=!1;var ol=al,G=class{constructor(){this._store=new ol,Zc(this),$c(this._store,this)}dispose(){Qc(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};G.None=Object.freeze({dispose(){}});var sl=class{constructor(){this._isDisposed=!1,Zc(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&$c(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Qc(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&$c(e,null),e}},cl=typeof window==`object`?window:globalThis,ll=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};ll.Undefined=new ll(void 0);var ul=ll,dl=class{constructor(){this._first=ul.Undefined,this._last=ul.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ul.Undefined}clear(){let e=this._first;for(;e!==ul.Undefined;){let t=e.next;e.prev=ul.Undefined,e.next=ul.Undefined,e=t}this._first=ul.Undefined,this._last=ul.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new ul(e);if(this._first===ul.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==ul.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ul.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ul.Undefined&&e.next!==ul.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ul.Undefined&&e.next===ul.Undefined?(this._first=ul.Undefined,this._last=ul.Undefined):e.next===ul.Undefined?(this._last=this._last.prev,this._last.next=ul.Undefined):e.prev===ul.Undefined&&(this._first=this._first.next,this._first.prev=ul.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==ul.Undefined;)yield e.element,e=e.next}},fl=globalThis.performance&&typeof globalThis.performance.now==`function`,pl=class e{static create(t){return new e(t)}constructor(e){this._now=fl&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},ml=!1,hl=!1,gl=!1,_l;(e=>{e.None=()=>G.None;function t(e){if(gl){let{onDidAddListener:t}=e,n=Cl.create(),r=0;e.onDidAddListener=()=>{++r===2&&(console.warn(`snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here`),n.print()),t?.()}}}function n(e,t){return f(e,()=>{},0,void 0,!0,void 0,t)}e.defer=n;function r(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=r;function i(e,t,n){return u((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=i;function a(e,t,n){return u((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=a;function o(e,t,n){return u((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=o;function s(e){return e}e.signal=s;function c(...e){return(t,n=null,r)=>d(rl(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=c;function l(e,t,n,r){let a=n;return i(e,e=>(a=t(a,e),a),r)}e.reduce=l;function u(e,n){let r,i={onWillAddFirstListener(){r=e(a.fire,a)},onDidRemoveLastListener(){r?.dispose()}};n||t(i);let a=new K(i);return n?.add(a),a.event}function d(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function f(e,n,r=100,i=!1,a=!1,o,s){let c,l,u,d=0,f,p={leakWarningThreshold:o,onWillAddFirstListener(){c=e(e=>{d++,l=n(l,e),i&&!u&&(m.fire(l),l=void 0),f=()=>{let e=l;l=void 0,u=void 0,(!i||d>1)&&m.fire(e),d=0},typeof r==`number`?(clearTimeout(u),u=setTimeout(f,r)):u===void 0&&(u=0,queueMicrotask(f))})},onWillRemoveListener(){a&&d>0&&f?.()},onDidRemoveLastListener(){f=void 0,c.dispose()}};s||t(p);let m=new K(p);return s?.add(m),m.event}e.debounce=f;function p(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=p;function m(e,t=(e,t)=>e===t,n){let r=!0,i;return o(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=m;function h(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=h;function g(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new K({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=g;function _(e,t){return(n,r,i)=>{let a=t(new y);return e(function(e){let t=a.evaluate(e);t!==v&&n.call(r,t)},void 0,i)}}e.chain=_;let v=Symbol(`HaltChainable`);class y{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:v),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:v}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===v)break;return e}}function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new K({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=b;function x(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new K({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=x;function S(e){return new Promise(t=>r(e)(t))}e.toPromise=S;function C(e){let t=new K;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=C;function ee(e,t){return e(e=>t.fire(e))}e.forward=ee;function te(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=te;class ne{constructor(e,n){this._observable=e,this._counter=0,this._hasChanged=!1;let r={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};n||t(r),this.emitter=new K(r),n&&n.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function w(e,t){return new ne(e,t).emitter.event}e.fromObservable=w;function T(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof ol?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=T})(_l||={});var vl=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new pl,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};vl.all=new Set,vl._idPool=0;var yl=vl,bl=-1,xl=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new wl(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};xl._idPool=1;var Sl=xl,Cl=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
25
+ `).slice(2).join(`
26
+ `))}},wl=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},Tl=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},El=0,Dl=class{constructor(e){this.value=e,this.id=El++}},Ol=2,kl=(e,t)=>{if(e instanceof Dl)t(e);else for(let n=0;n<e.length;n++){let r=e[n];r&&t(r)}},Al;if(ml){let e=[];setInterval(()=>{e.length!==0&&(console.warn(`[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:`),console.warn(e.join(`
27
+ `)),e.length=0)},3e3),Al=new FinalizationRegistry(t=>{typeof t==`string`&&e.push(t)})}var K=class{constructor(e){this._size=0,this._options=e,this._leakageMon=bl>0||this._options?.leakWarningThreshold?new Sl(e?.onListenerError??kc,this._options?.leakWarningThreshold??bl):void 0,this._perfMon=this._options?._profName?new yl(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(hl){let e=this._listeners;queueMicrotask(()=>{kl(e,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new Tl(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||kc)(n),G.None}if(this._disposed)return G.None;t&&(e=e.bind(t));let r=new Dl(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Cl.create(),i=this._leakageMon.check(r.stack,this._size+1)),hl&&(r.stack=Cl.create()),this._listeners?this._listeners instanceof Dl?(this._deliveryQueue??=new jl,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=il(()=>{Al?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof ol?n.add(a):Array.isArray(n)&&n.push(a),Al){let e=Error().stack.split(`
28
+ `).slice(2,3).join(`
29
+ `).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);Al.register(a,t?.[2]??e,a)}return a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Ol<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||kc;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Dl)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},jl=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Ml=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new K,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new K,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Ml.INSTANCE=new Ml;var Nl=Ml;function Pl(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}Nl.INSTANCE.onDidChangeZoomLevel;function Fl(e){return Nl.INSTANCE.getZoomFactor(e)}Nl.INSTANCE.onDidChangeFullscreen;var Il=typeof navigator==`object`?navigator.userAgent:``,Ll=Il.indexOf(`Firefox`)>=0,Rl=Il.indexOf(`AppleWebKit`)>=0,zl=Il.indexOf(`Chrome`)>=0,Bl=!zl&&Il.indexOf(`Safari`)>=0;Il.indexOf(`Electron/`),Il.indexOf(`Android`);var Vl=!1;if(typeof cl.matchMedia==`function`){let e=cl.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=cl.matchMedia(`(display-mode: fullscreen)`);Vl=e.matches,Pl(cl,e,({matches:e})=>{Vl&&t.matches||(Vl=e)})}function Hl(){return Vl}var Ul=`en`,Wl=!1,Gl=!1,Kl=!1,ql=!1,Jl=!1,Yl=Ul,Xl,Zl=globalThis,Ql;typeof Zl.vscode<`u`&&typeof Zl.vscode.process<`u`?Ql=Zl.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(Ql=process);var $l=typeof Ql?.versions?.electron==`string`&&Ql?.type===`renderer`;if(typeof Ql==`object`){Wl=Ql.platform===`win32`,Gl=Ql.platform===`darwin`,Kl=Ql.platform===`linux`,Kl&&Ql.env.SNAP&&Ql.env.SNAP_REVISION,Ql.env.CI||Ql.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Yl=Ul;let e=Ql.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,Yl=t.resolvedLanguage||Ul,t.languagePack?.translationsConfigFile}catch{}ql=!0}else typeof navigator==`object`&&!$l?(Xl=navigator.userAgent,Wl=Xl.indexOf(`Windows`)>=0,Gl=Xl.indexOf(`Macintosh`)>=0,(Xl.indexOf(`Macintosh`)>=0||Xl.indexOf(`iPad`)>=0||Xl.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,Kl=Xl.indexOf(`Linux`)>=0,Xl?.indexOf(`Mobi`),Jl=!0,Yl=globalThis._VSCODE_NLS_LANGUAGE||Ul,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var eu=Wl,tu=Gl,nu=Kl,ru=ql;Jl&&typeof Zl.importScripts==`function`&&Zl.origin;var iu=Xl,au=Yl,ou;(e=>{function t(){return au}e.value=t;function n(){return au.length===2?au===`en`:au.length>=3?au[0]===`e`&&au[1]===`n`&&au[2]===`-`:!1}e.isDefaultVariant=n;function r(){return au===`en`}e.isDefault=r})(ou||={});var su=typeof Zl.postMessage==`function`&&!Zl.importScripts;(()=>{if(su){let e=[];Zl.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Zl.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var cu=!!(iu&&iu.indexOf(`Chrome`)>=0);iu&&iu.indexOf(`Firefox`),!cu&&iu&&iu.indexOf(`Safari`),iu&&iu.indexOf(`Edg/`),iu&&iu.indexOf(`Android`);var lu=typeof navigator==`object`?navigator:{};ru||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||lu&&lu.clipboard&&lu.clipboard.writeText,ru||lu&&lu.clipboard&&lu.clipboard.readText,ru||Hl()||lu.keyboard,`ontouchstart`in cl||lu.maxTouchPoints,cl.PointerEvent&&(`ontouchstart`in cl||navigator.maxTouchPoints);var uu=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},du=new uu,fu=new uu,pu=new uu,mu=Array(230),hu;(e=>{function t(e){return du.keyCodeToStr(e)}e.toString=t;function n(e){return du.strToKeyCode(e)}e.fromString=n;function r(e){return fu.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return pu.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return fu.strToKeyCode(e)||pu.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return du.keyCodeToStr(e)}e.toElectronAccelerator=o})(hu||={});var gu=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new _u([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},_u=class{constructor(e){if(e.length===0)throw Nc(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=`;`),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function vu(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return hu.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(Ll)switch(t){case 59:return 85;case 60:if(nu)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(tu)return 57;break}else if(Rl&&(tu&&t===93||!tu&&t===92))return 57;return mu[t]||0}var yu=tu?256:2048,bu=512,xu=1024,Su=tu?2048:256,Cu=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.(`AltGraph`),this.keyCode=vu(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=yu),this.altKey&&(t|=bu),this.shiftKey&&(t|=xu),this.metaKey&&(t|=Su),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new gu(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},wu=new WeakMap;function Tu(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!==`null`&&n.origin!==`null`&&t.origin!==n.origin)return null}catch{return null}return e.parent}var Eu=class{static getSameOriginWindowChain(e){let t=wu.get(e);if(!t){t=[],wu.set(e,t);let n=e,r;do r=Tu(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let e of i){let i=e.window.deref();if(n+=i?.scrollY??0,r+=i?.scrollX??0,i===t||!e.iframeElement)break;let a=e.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},Du=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type===`dblclick`&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX==`number`?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=Eu.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Ou=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(zl){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1]):123)<=122}if(e){let t=e,n=e,i=e.view?.devicePixelRatio||1;if(typeof t.wheelDeltaY<`u`)r?this.deltaY=t.wheelDeltaY/(120*i):this.deltaY=t.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<`u`&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type===`wheel`){let t=e;t.deltaMode===t.DOM_DELTA_LINE?Ll&&!tu?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)Bl&&eu?this.deltaX=-(t.wheelDeltaX/120):r?this.deltaX=t.wheelDeltaX/(120*i):this.deltaX=t.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<`u`&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type===`wheel`){let t=e;t.deltaMode===t.DOM_DELTA_LINE?Ll&&!tu?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*i):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},ku=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),Au;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof ju?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:_l.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:ku})})(Au||={});var ju=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?ku:(this._emitter||=new K,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},Mu=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e==`function`&&typeof t==`number`&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Fc(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Fc(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Nu=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new Fc(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=il(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var Pu;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(Pu||={});var Fu=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new K,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await _l.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Fu.EMPTY=Fu.fromArray([]);function Iu(e){return 55296<=e&&e<=56319}function Lu(e){return 56320<=e&&e<=57343}function Ru(e,t){return(e-55296<<10)+(t-56320)+65536}function zu(e){return Bu(e,0)}function Bu(e,t){switch(typeof e){case`object`:return e===null?Vu(349,t):Array.isArray(e)?Wu(e,t):Gu(e,t);case`string`:return Uu(e,t);case`boolean`:return Hu(e,t);case`number`:return Vu(e,t);case`undefined`:return Vu(937,t);default:return Vu(617,t)}}function Vu(e,t){return(t<<5)-t+e|0}function Hu(e,t){return Vu(e?433:863,t)}function Uu(e,t){t=Vu(149417,t);for(let n=0,r=e.length;n<r;n++)t=Vu(e.charCodeAt(n),t);return t}function Wu(e,t){return t=Vu(104579,t),e.reduce((e,t)=>Bu(t,e),t)}function Gu(e,t){return t=Vu(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=Uu(n,t),Bu(e[n],t)),t)}function Ku(e,t,n=32){let r=n-t,i=~((1<<r)-1);return(e<<t|(i&e)>>>r)>>>0}function qu(e,t=0,n=e.byteLength,r=0){for(let i=0;i<n;i++)e[t+i]=r}function Ju(e,t,n=`0`){for(;e.length<t;)e=n+e;return e}function Yu(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``):Ju((e>>>0).toString(16),t/4)}var Xu=class e{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){let t=e.length;if(t===0)return;let n=this._buff,r=this._buffLen,i=this._leftoverHighSurrogate,a,o;for(i===0?(a=e.charCodeAt(0),o=0):(a=i,o=-1,i=0);;){let s=a;if(Iu(a))if(o+1<t){let t=e.charCodeAt(o+1);Lu(t)?(o++,s=Ru(a,t)):s=65533}else{i=a;break}else Lu(a)&&(s=65533);if(r=this._push(n,r,s),o++,o<t)a=e.charCodeAt(o);else break}this._buffLen=r,this._leftoverHighSurrogate=i}_push(e,t,n){return n<128?e[t++]=n:n<2048?(e[t++]=192|(n&1984)>>>6,e[t++]=128|(n&63)>>>0):n<65536?(e[t++]=224|(n&61440)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0):(e[t++]=240|(n&1835008)>>>18,e[t++]=128|(n&258048)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),Yu(this._h0)+Yu(this._h1)+Yu(this._h2)+Yu(this._h3)+Yu(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,qu(this._buff,this._buffLen),this._buffLen>56&&(this._step(),qu(this._buff));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let t=e._bigBlock32,n=this._buffDV;for(let e=0;e<64;e+=4)t.setUint32(e,n.getUint32(e,!1),!1);for(let e=64;e<320;e+=4)t.setUint32(e,Ku(t.getUint32(e-12,!1)^t.getUint32(e-32,!1)^t.getUint32(e-56,!1)^t.getUint32(e-64,!1),1),!1);let r=this._h0,i=this._h1,a=this._h2,o=this._h3,s=this._h4,c,l,u;for(let e=0;e<80;e++)e<20?(c=i&a|~i&o,l=1518500249):e<40?(c=i^a^o,l=1859775393):e<60?(c=i&a|i&o|a&o,l=2400959708):(c=i^a^o,l=3395469782),u=Ku(r,5)+c+s+l+t.getUint32(e*4,!1)&4294967295,s=o,o=a,a=Ku(i,30),i=r,r=u;this._h0=this._h0+r&4294967295,this._h1=this._h1+i&4294967295,this._h2=this._h2+a&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+s&4294967295}};Xu._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:Zu,getWindow:Qu,getDocument:$u,getWindows:ed,getWindowsCount:td,getWindowId:nd,getWindowById:rd,hasWindow:id,onDidRegisterWindow:ad,onWillUnregisterWindow:od,onDidUnregisterWindow:sd}=function(){let e=new Map,t={window:cl,disposables:new ol};e.set(cl.vscodeWindowId,t);let n=new K,r=new K,i=new K;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return G.None;let a=new ol,o={window:t,disposables:a.add(new ol)};return e.set(t.vscodeWindowId,o),a.add(il(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(q(t,_d.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:cl},getDocument(e){return Qu(e).document}}}(),cd=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function q(e,t,n,r){return new cd(e,t,n,r)}function ld(e,t){return function(n){return t(new Du(e,n))}}function ud(e){return function(t){return e(new Cu(t))}}var dd=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=ld(Qu(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=ud(n)),q(e,t,i,r)},fd,pd=class extends Nu{constructor(e){super(),this.defaultTarget=e&&Qu(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},md=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){kc(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(md.sort),a.shift().execute();r.set(i,!1)};fd=(t,r,a=0)=>{let o=nd(t),s=new md(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var hd=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};hd.None=new hd(0,0);function gd(e){let t=e.getBoundingClientRect(),n=Qu(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=zu(n),a=r.get(i);if(a)a.users+=1;else{let o=new K,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(il(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var _d={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:Rl?`webkitAnimationStart`:`animationstart`,ANIMATION_END:Rl?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:Rl?`webkitAnimationIteration`:`animationiteration`},vd=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function yd(e,t,n,...r){let i=vd.exec(t);if(!i)throw Error(`Bad use of emmet`);let a=i[1]||`div`,o;return o=e===`http://www.w3.org/1999/xhtml`?document.createElement(a):document.createElementNS(e,a),i[3]&&(o.id=i[3]),i[4]&&(o.className=i[4].replace(/\./g,` `).trim()),n&&Object.entries(n).forEach(([e,t])=>{typeof t>`u`||(/^on\w+$/.test(e)?o[e]=t:e===`selected`?t&&o.setAttribute(e,`true`):o.setAttribute(e,t))}),o.append(...r),o}function bd(e,t,...n){return yd(`http://www.w3.org/1999/xhtml`,e,t,...n)}bd.SVG=function(e,t,...n){return yd(`http://www.w3.org/2000/svg`,e,t,...n)};var xd=class{constructor(e){this.domNode=e,this._maxWidth=``,this._width=``,this._height=``,this._top=``,this._left=``,this._bottom=``,this._right=``,this._paddingTop=``,this._paddingLeft=``,this._paddingBottom=``,this._paddingRight=``,this._fontFamily=``,this._fontWeight=``,this._fontSize=``,this._fontStyle=``,this._fontFeatureSettings=``,this._fontVariationSettings=``,this._textDecoration=``,this._lineHeight=``,this._letterSpacing=``,this._className=``,this._display=``,this._position=``,this._visibility=``,this._color=``,this._backgroundColor=``,this._layerHint=!1,this._contain=`none`,this._boxShadow=``}setMaxWidth(e){let t=Sd(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Sd(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Sd(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Sd(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Sd(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Sd(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Sd(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Sd(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Sd(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Sd(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Sd(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Sd(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Sd(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Sd(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?`translate3d(0px, 0px, 0px)`:``)}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Sd(e){return typeof e==`number`?`${e}px`:e}function Cd(e){return new xd(e)}var wd=class{constructor(){this._hooks=new ol,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(il(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=Qu(e)}this._hooks.add(q(a,_d.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(q(a,_d.POINTER_UP,e=>this.stopMonitoring(!0)))}};function Td(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var Ed;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(Ed||={});var Dd=class e extends G{constructor(){super(),this.dispatched=!1,this.targets=new dl,this.ignoreTargets=new dl,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(_l.runAndSubscribe(ad,({window:e,disposables:t})=>{t.add(q(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(q(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(q(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:cl,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=tl(new e),il(e.INSTANCE.targets.push(t))):G.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=tl(new e),il(e.INSTANCE.ignoreTargets.push(t))):G.None}static isTouchDevice(){return`ontouchstart`in cl||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n<r;n++){let r=e.targetTouches.item(n);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let i=this.newGestureEvent(Ed.Start,r.target);i.pageX=r.pageX,i.pageY=r.pageY,this.dispatchEvent(i)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let a=0,o=n.changedTouches.length;a<o;a++){let o=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn(`move of an UNKNOWN touch`,o);continue}let s=this.activeTouches[o.identifier],c=Date.now()-s.initialTimeStamp;if(c<e.HOLD_DELAY&&Math.abs(s.initialPageX-Rc(s.rollingPageX))<30&&Math.abs(s.initialPageY-Rc(s.rollingPageY))<30){let e=this.newGestureEvent(Ed.Tap,s.initialTarget);e.pageX=Rc(s.rollingPageX),e.pageY=Rc(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-Rc(s.rollingPageX))<30&&Math.abs(s.initialPageY-Rc(s.rollingPageY))<30){let e=this.newGestureEvent(Ed.Contextmenu,s.initialTarget);e.pageX=Rc(s.rollingPageX),e.pageY=Rc(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=Rc(s.rollingPageX),n=Rc(s.rollingPageY),i=Rc(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(Ed.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===Ed.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else (t.type===Ed.Change||t.type===Ed.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=fd(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(Ed.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn(`end of an UNKNOWN touch`,r);continue}let i=this.activeTouches[r.identifier],a=this.newGestureEvent(Ed.Change,i.initialTarget);a.translationX=r.pageX-Rc(i.rollingPageX),a.translationY=r.pageY-Rc(i.rollingPageY),a.pageX=r.pageX,a.pageY=r.pageY,this.dispatchEvent(a),i.rollingPageX.length>3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};Dd.SCROLL_FRICTION=-.005,Dd.HOLD_DELAY=700,Dd.CLEAR_TAP_COUNT_TIME=400,Fs([Td],Dd,`isTouchDevice`,1);var Od=Dd,kd=class extends G{onclick(e,t){this._register(q(e,_d.CLICK,n=>t(new Du(Qu(e),n))))}onmousedown(e,t){this._register(q(e,_d.MOUSE_DOWN,n=>t(new Du(Qu(e),n))))}onmouseover(e,t){this._register(q(e,_d.MOUSE_OVER,n=>t(new Du(Qu(e),n))))}onmouseleave(e,t){this._register(q(e,_d.MOUSE_LEAVE,n=>t(new Du(Qu(e),n))))}onkeydown(e,t){this._register(q(e,_d.KEY_DOWN,e=>t(new Cu(e))))}onkeyup(e,t){this._register(q(e,_d.KEY_UP,e=>t(new Cu(e))))}oninput(e,t){this._register(q(e,_d.INPUT,t))}onblur(e,t){this._register(q(e,_d.BLUR,t))}onfocus(e,t){this._register(q(e,_d.FOCUS,t))}onchange(e,t){this._register(q(e,_d.CHANGE,t))}ignoreGesture(e){return Od.ignoreTarget(e)}},Ad=11,jd=class extends kd{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement(`div`),this.bgDomNode.className=`arrow-background`,this.bgDomNode.style.position=`absolute`,this.bgDomNode.style.width=e.bgWidth+`px`,this.bgDomNode.style.height=e.bgHeight+`px`,typeof e.top<`u`&&(this.bgDomNode.style.top=`0px`),typeof e.left<`u`&&(this.bgDomNode.style.left=`0px`),typeof e.bottom<`u`&&(this.bgDomNode.style.bottom=`0px`),typeof e.right<`u`&&(this.bgDomNode.style.right=`0px`),this.domNode=document.createElement(`div`),this.domNode.className=e.className,this.domNode.style.position=`absolute`,this.domNode.style.width=Ad+`px`,this.domNode.style.height=Ad+`px`,typeof e.top<`u`&&(this.domNode.style.top=e.top+`px`),typeof e.left<`u`&&(this.domNode.style.left=e.left+`px`),typeof e.bottom<`u`&&(this.domNode.style.bottom=e.bottom+`px`),typeof e.right<`u`&&(this.domNode.style.right=e.right+`px`),this._pointerMoveMonitor=this._register(new wd),this._register(dd(this.bgDomNode,_d.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(dd(this.domNode,_d.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new pd),this._pointerdownScheduleRepeatTimer=this._register(new Mu)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Qu(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},Md=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<`u`?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<`u`?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},Nd=class extends G{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new K),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Md(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>`u`?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>`u`?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new Ld(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=Ld.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},Pd=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Fd(e,t){let n=t-e;return function(t){return e+n*zd(t)}}function Id(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var Ld=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.duration=r,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,n){if(Math.abs(e-t)>2.5*n){let r,i;return e<t?(r=e+.75*n,i=t-.75*n):(r=e-.75*n,i=t+.75*n),Id(Fd(e,r),Fd(i,t),.33)}return Fd(e,t)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;return t<1?new Pd(this.scrollLeft(t),this.scrollTop(t),!1):new Pd(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return e.start(t,n,r)}static start(t,n,r){return r+=10,new e(t,n,Date.now()-10,r)}};function Rd(e){return e**3}function zd(e){return 1-Rd(1-e)}var Bd=class extends G{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Mu)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?` fade`:``)))}},Vd=140,Hd=class extends kd{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new Bd(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new wd),this._shouldRender=!0,this.domNode=Cd(document.createElement(`div`)),this.domNode.setAttribute(`role`,`presentation`),this.domNode.setAttribute(`aria-hidden`,`true`),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition(`absolute`),this._register(q(this.domNode.domNode,_d.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new jd(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=Cd(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(q(this.slider.domNode,_d.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=gd(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(eu&&a>Vd){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName(`active`,!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Ud=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize===t?!1:(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize===t?!1:(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition===t?!1:(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},Wd=class extends Hd{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Ud(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:`horizontal`,scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},Gd=class extends Hd{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Ud(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:`vertical`,scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},Kd=500,qd=50,Jd=!0,Yd=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Xd=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,n=1,r=this._rear;do{let i=r===this._front?e:2**-n;if(e-=i,t+=this._memory[r].score*i,r===this._front)break;r=(this._capacity+r-1)%this._capacity,n++}while(!0);return t<=.5}acceptStandardWheelEvent(e){if(zl){let t=Fl(Qu(e.browserEvent));this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,n){let r=null,i=new Yd(e,t,n);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=i),i.score=this._computeScore(i,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Xd.INSTANCE=new Xd;var Zd=Xd,Qd=class extends kd{constructor(e,t,n){super(),this._onScroll=this._register(new K),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new K),this.onWillScroll=this._onWillScroll.event,this._options=ef(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Gd(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new Wd(this._scrollable,this._options,r)),this._domNode=document.createElement(`div`),this._domNode.className=`xterm-scrollable-element `+this._options.className,this._domNode.setAttribute(`role`,`presentation`),this._domNode.style.position=`relative`,this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Cd(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Cd(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Cd(document.createElement(`div`)),this._topLeftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new Mu),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=nl(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,tu&&(this._options.className+=` mac`),this._domNode.className=`xterm-scrollable-element `+this._options.className}updateOptions(e){typeof e.handleMouseWheel<`u`&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<`u`&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<`u`&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<`u`&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<`u`&&(this._options.horizontal=e.horizontal),typeof e.vertical<`u`&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<`u`&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<`u`&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<`u`&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Ou(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=nl(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(q(this._listenOnDomNode,_d.MOUSE_WHEEL,e=>{this._onMouseWheel(new Ou(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=Zd.INSTANCE;Jd&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!tu&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=qd*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=qd*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(Jd&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),Kd)}},$d=class extends Qd{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function ef(e){let t={lazyRender:typeof e.lazyRender<`u`?e.lazyRender:!1,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<`u`?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`?e.horizontalHasArrows:!1,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,tu&&(t.className+=` mac`),t}var tf=class extends G{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new K),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new Nd({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>fd(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new $d(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(_l.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(il(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(il(()=>this._styleElement.remove())),this._register(_l.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(`
30
+ `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};tf=Fs([W(2,cc),W(3,xc),W(4,lc),W(5,Ec),W(6,mc),W(7,Cc)],tf);var nf=class extends G{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,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(e=>this._removeDecoration(e))),this._register(il(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};nf=Fs([W(1,cc),W(2,xc),W(3,_c),W(4,Cc)],nf);var rf=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(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},af={full:0,left:0,center:0,right:0},of={full:0,left:0,center:0,right:0},sf={full:0,left:0,center:0,right:0},cf=class extends G{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new rf,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(il(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw Error(`Ctx cannot be null`);this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),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())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange(`overviewRuler`,()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);of.full=this._canvas.width,of.left=e,of.center=t,of.right=e,this._refreshDrawHeightConstants(),sf.full=1,sf.left=1,sf.center=1+of.left,sf.right=1+of.left+of.center}_refreshDrawHeightConstants(){af.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);af.left=t,af.center=t,af.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*af.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*af.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*af.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*af.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(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(sf[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-af[e.position||`full`]/2),of[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+af[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};cf=Fs([W(2,cc),W(3,_c),W(4,Cc),W(5,mc),W(6,Ec),W(7,xc)],cf);var J;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
31
+ `,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))(J||={});var lf;(e=>(e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`))(lf||={});var uf;(e=>e.ST=`${J.ESC}\\`)(uf||={});var df=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${J.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};df=Fs([W(2,cc),W(3,mc),W(4,uc),W(5,Cc)],df);var ff=0,pf=0,mf=0,hf=0,gf={css:`#00000000`,rgba:0},_f;(e=>{function t(e,t,n,r){return r===void 0?`#${Sf(e)}${Sf(t)}${Sf(n)}`:`#${Sf(e)}${Sf(t)}${Sf(n)}${Sf(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(_f||={});var vf;(e=>{function t(e,t){if(hf=(t.rgba&255)/255,hf===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return ff=a+Math.round((n-a)*hf),pf=o+Math.round((r-o)*hf),mf=s+Math.round((i-s)*hf),{css:_f.toCss(ff,pf,mf),rgba:_f.toRgba(ff,pf,mf)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=xf.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return _f.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[ff,pf,mf]=xf.toChannels(t),{css:_f.toCss(ff,pf,mf),rgba:t}}e.opaque=i;function a(e,t){return hf=Math.round(t*255),[ff,pf,mf]=xf.toChannels(e.rgba),{css:_f.toCss(ff,pf,mf,hf),rgba:_f.toRgba(ff,pf,mf,hf)}}e.opacity=a;function o(e,t){return hf=e.rgba&255,a(e,hf*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(vf||={});var yf;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return ff=parseInt(e.slice(1,2).repeat(2),16),pf=parseInt(e.slice(2,3).repeat(2),16),mf=parseInt(e.slice(3,4).repeat(2),16),_f.toColor(ff,pf,mf);case 5:return ff=parseInt(e.slice(1,2).repeat(2),16),pf=parseInt(e.slice(2,3).repeat(2),16),mf=parseInt(e.slice(3,4).repeat(2),16),hf=parseInt(e.slice(4,5).repeat(2),16),_f.toColor(ff,pf,mf,hf);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return ff=parseInt(r[1]),pf=parseInt(r[2]),mf=parseInt(r[3]),hf=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),_f.toColor(ff,pf,mf,hf);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[ff,pf,mf,hf]=t.getImageData(0,0,1,1).data,hf!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:_f.toRgba(ff,pf,mf,hf),css:e}}e.toColor=r})(yf||={});var bf;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(bf||={});var xf;(e=>{function t(e,t){if(hf=(t&255)/255,hf===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return ff=a+Math.round((n-a)*hf),pf=o+Math.round((r-o)*hf),mf=s+Math.round((i-s)*hf),_f.toRgba(ff,pf,mf)}e.blend=t;function n(e,t,n){let a=bf.relativeLuminance(e>>8),o=bf.relativeLuminance(t>>8);if(Cf(a,o)<n){if(o<a){let o=r(e,t,n),s=Cf(a,bf.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>Cf(a,bf.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=Cf(a,bf.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>Cf(a,bf.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=Cf(bf.relativeLuminance2(o,s,c),bf.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=Cf(bf.relativeLuminance2(o,s,c),bf.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=Cf(bf.relativeLuminance2(o,s,c),bf.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=Cf(bf.relativeLuminance2(o,s,c),bf.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(xf||={});function Sf(e){let t=e.toString(16);return t.length<2?`0`+t:t}function Cf(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var wf=class extends $s{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Tf=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new tc}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,o=0,s=t.getFg(0),c=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==s||this._workCell.bg!==c){if(e-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,o=a,s=this._workCell.fg,c=this._workCell.bg}a+=this._workCell.getChars().length||Qs.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(e,t,n,r,i){let a=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(a)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let t=this._characterJoiners[e].handler(a);for(let e=0;e<t.length;e++)Tf._mergeRanges(o,t[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,o=e[r];if(o){for(let s=n;s<this._bufferService.cols;s++){let n=t.getWidth(s),c=t.getString(s).length||Qs.length;if(n!==0){if(!i&&o[0]<=a&&(o[0]=s,i=!0),o[1]<=a){if(o[1]=s,o=e[++r],!o)break;o[0]<=a?(o[0]=s,i=!0):i=!1}a+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};Tf=Fs([W(0,cc)],Tf);function Ef(e){return 57508<=e&&e<=57558}function Df(e){return 9472<=e&&e<=9631}function Of(e){return Ef(e)||Df(e)}function kf(){return{css:{canvas:Af(),cell:Af()},device:{canvas:Af(),cell:Af(),char:{width:0,height:0,left:0,top:0}}}}function Af(){return{width:0,height:0}}var jf=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new tc,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,a,o,s,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<a+1&&(m=a+1);let h,g=0,_=``,v=0,y=0,b=0,x=0,S=!1,C=0,ee=!1,te=0,ne=0,w=[],T=l!==-1&&u!==-1;for(let E=0;E<m;E++){e.loadCell(E,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let D=!1,re=E>=ne,O=E,k=this._workCell;if(f.length>0&&E===f[0][0]&&re){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)re&&=i===this._isCellInSelection(v,t);re&&=!n||a<r[0]||a>=r[1],re?(D=!0,k=new wf(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),O=r[1]-1,m=k.getWidth()):ne=r[1]}let A=this._isCellInSelection(E,t),j=n&&E===a,ie=T&&E>=l&&E<=u,ae=!1;this._decorationService.forEachDecorationAtCell(E,t,void 0,e=>{ae=!0});let oe=k.getChars()||Qs;if(oe===` `&&(k.isUnderline()||k.isOverline())&&(oe=`\xA0`),te=m*s-c.get(oe,k.isBold(),k.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(A&&ee||!A&&!ee&&k.bg===y)&&(A&&ee&&p.selectionForeground||k.fg===b)&&k.extended.ext===x&&ie===S&&te===C&&!j&&!D&&!ae&&re){k.isInvisible()?_+=Qs:_+=oe,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=k.bg,b=k.fg,x=k.extended.ext,S=ie,C=te,ee=A,D&&a>=E&&a<=O&&(a=E),!this._coreService.isCursorHidden&&j&&this._coreService.isCursorInitialized){if(w.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&w.push(`xterm-cursor-blink`),w.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:w.push(`xterm-cursor-outline`);break;case`block`:w.push(`xterm-cursor-block`);break;case`bar`:w.push(`xterm-cursor-bar`);break;case`underline`:w.push(`xterm-cursor-underline`);break;default:break}}if(k.isBold()&&w.push(`xterm-bold`),k.isItalic()&&w.push(`xterm-italic`),k.isDim()&&w.push(`xterm-dim`),_=k.isInvisible()?Qs:k.getChars()||Qs,k.isUnderline()&&(w.push(`xterm-underline-${k.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!k.isUnderlineColorDefault()))if(k.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${$s.toColorRGB(k.getUnderlineColor()).join(`,`)})`;else{let e=k.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&k.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}k.isOverline()&&(w.push(`xterm-overline`),_===` `&&(_=`\xA0`)),k.isStrikethrough()&&w.push(`xterm-strikethrough`),ie&&(h.style.textDecoration=`underline`);let se=k.getFgColor(),ce=k.getFgColorMode(),le=k.getBgColor(),ue=k.getBgColorMode(),de=!!k.isInverse();if(de){let e=se;se=le,le=e;let t=ce;ce=ue,ue=t}let fe,pe,me=!1;this._decorationService.forEachDecorationAtCell(E,t,void 0,e=>{e.options.layer!==`top`&&me||(e.backgroundColorRGB&&(ue=50331648,le=e.backgroundColorRGB.rgba>>8&16777215,fe=e.backgroundColorRGB),e.foregroundColorRGB&&(ce=50331648,se=e.foregroundColorRGB.rgba>>8&16777215,pe=e.foregroundColorRGB),me=e.options.layer===`top`)}),!me&&A&&(fe=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,le=fe.rgba>>8&16777215,ue=50331648,me=!0,p.selectionForeground&&(ce=50331648,se=p.selectionForeground.rgba>>8&16777215,pe=p.selectionForeground)),me&&w.push(`xterm-decoration-top`);let M;switch(ue){case 16777216:case 33554432:M=p.ansi[le],w.push(`xterm-bg-${le}`);break;case 50331648:M=_f.toColor(le>>16,le>>8&255,le&255),this._addStyle(h,`background-color:#${Mf((le>>>0).toString(16),`0`,6)}`);break;default:de?(M=p.foreground,w.push(`xterm-bg-257`)):M=p.background}switch(fe||k.isDim()&&(fe=vf.multiplyOpacity(M,.5)),ce){case 16777216:case 33554432:k.isBold()&&se<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(se+=8),this._applyMinimumContrast(h,M,p.ansi[se],k,fe,void 0)||w.push(`xterm-fg-${se}`);break;case 50331648:let e=_f.toColor(se>>16&255,se>>8&255,se&255);this._applyMinimumContrast(h,M,e,k,fe,pe)||this._addStyle(h,`color:#${Mf(se.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,M,p.foreground,k,fe,pe)||de&&w.push(`xterm-fg-257`)}w.length&&=(h.className=w.join(` `),0),!j&&!D&&!ae&&re?g++:h.textContent=_,te!==this.defaultSpacing&&(h.style.letterSpacing=`${te}px`),d.push(h),E=O}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||Of(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=vf.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};jf=Fs([W(1,Tc),W(2,mc),W(3,xc),W(4,uc),W(5,_c),W(6,Ec)],jf);function Mf(e,t,n){for(;e.length<n;)e=t+e;return e}var Nf=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.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`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.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(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},Pf=class{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(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function Ff(){return new Pf}var If=`xterm-dom-renderer-owner-`,Lf=`xterm-rows`,Rf=`xterm-fg-`,zf=`xterm-bg-`,Bf=`xterm-focus`,Vf=`xterm-selection`,Hf=1,Uf=class extends G{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=Hf++,this._rowElements=[],this._selectionRenderModel=Ff(),this.onRequestRedraw=this._register(new K).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(Lf),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(Vf),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=kf(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(jf,document),this._element.classList.add(If+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(il(()=>{this._element.classList.remove(If+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Nf(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(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),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/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),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(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Lf} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${Lf} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${Lf} .xterm-dim { color: ${vf.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Lf}.${Bf} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Lf}.${Bf} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Lf}.${Bf} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Lf} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Lf} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Lf} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Lf} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Lf} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Vf} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Vf} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Vf} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${Rf}${n} { color: ${r.css}; }${this._terminalSelector} .${Rf}${n}.xterm-dim { color: ${vf.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${zf}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${Rf}257 { color: ${vf.opaque(e.background).css}; }${this._terminalSelector} .${Rf}257.xterm-dim { color: ${vf.multiplyOpacity(vf.opaque(e.background),.5).css}; }${this._terminalSelector} .${zf}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Bf),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Bf),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}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(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${If}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};Uf=Fs([W(7,fc),W(8,bc),W(9,mc),W(10,cc),W(11,uc),W(12,xc),W(13,Ec)],Uf);var Wf=class extends G{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new K),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new qf(this._optionsService))}catch{this._measureStrategy=this._register(new Kf(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Wf=Fs([W(2,mc)],Wf);var Gf=class extends G{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},Kf=class extends Gf{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,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}},qf=class extends Gf{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},Jf=class extends G{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Yf(this._window)),this._onDprChange=this._register(new K),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new K),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(_l.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(q(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(q(this._textarea,`blur`,()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,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}},Yf=class extends G{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new sl),this._onDprChange=this._register(new K),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(il(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=q(this._parentWindow,`resize`,()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},Xf=class extends G{constructor(){super(),this.linkProviders=[],this._register(il(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Zf(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function Qf(e,t,n,r,i,a,o,s,c){if(!a)return;let l=Zf(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+ +!!c),l[1]=Math.min(Math.max(l[1],1),i),l}var $f=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return Qf(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=Zf(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};$f=Fs([W(0,Cc),W(1,bc)],$f);var ep=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),!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){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},tp={};Ps(tp,{getSafariVersion:()=>cp,isChromeOS:()=>mp,isFirefox:()=>ap,isIpad:()=>up,isIphone:()=>dp,isLegacyEdge:()=>op,isLinux:()=>pp,isMac:()=>lp,isNode:()=>np,isSafari:()=>sp,isWindows:()=>fp});var np=typeof process<`u`&&`title`in process,rp=np?`node`:navigator.userAgent,ip=np?`node`:navigator.platform,ap=rp.includes(`Firefox`),op=rp.includes(`Edge`),sp=/^((?!chrome|android).)*safari/i.test(rp);function cp(){if(!sp)return 0;let e=rp.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var lp=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(ip),up=ip===`iPad`,dp=ip===`iPhone`,fp=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(ip),pp=ip.indexOf(`Linux`)>=0,mp=/\bCrOS\b/.test(rp),hp=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},gp=class extends hp{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},_p=class extends hp{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},vp=!np&&`requestIdleCallback`in window?_p:gp,yp=class{constructor(){this._queue=new vp}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},bp=class extends G{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new sl),this._pausedResizeTask=new yp,this._observerDisposable=this._register(new sl),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 K),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new K),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new K),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new K),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new ep((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new xp(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(il(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=il(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};bp=Fs([W(2,mc),W(3,bc),W(4,uc),W(5,_c),W(6,cc),W(7,xc),W(8,Ec)],bp);var xp=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function Sp(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return Tp(i,a,e,t,n,r)+Ep(a,t,n,r)+Dp(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,Pp(Math.abs(i-e),Np(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return Pp(wp(a>t?e:i,n)+(s-1)*n.cols+1+Cp(a>t?i:e,n),Np(o,r))}function Cp(e,t){return e-1}function wp(e,t){return t.cols-e}function Tp(e,t,n,r,i,a){return Ep(t,r,i,a).length===0?``:Pp(Mp(e,t,e,t-kp(t,i),!1,i).length,Np(`D`,a))}function Ep(e,t,n,r){let i=e-kp(e,n),a=t-kp(t,n);return Pp(Math.abs(i-a)-Op(e,t,n),Np(jp(e,t),r))}function Dp(e,t,n,r,i,a){let o;o=Ep(t,r,i,a).length>0?r-kp(r,i):t;let s=r,c=Ap(e,t,n,r,i,a);return Pp(Mp(e,o,n,s,c===`C`,i).length,Np(c,a))}function Op(e,t,n){let r=0,i=e-kp(e,n),a=t-kp(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=jp(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function kp(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function Ap(e,t,n,r,i,a){let o;return o=Ep(n,r,i,a).length>0?r-kp(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function jp(e,t){return e>t?`A`:`B`}function Mp(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&s<a.buffer.lines.length;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function Np(e,t){let n=t?`O`:`[`;return J.ESC+n+e}function Pp(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var Fp=class{constructor(e){this._bufferService=e,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.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()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Ip(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Lp=50,Rp=15,zp=50,Bp=500,Vp=RegExp(`\xA0`,`g`),Hp=class extends G{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new tc,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new K),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new K),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new K),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new K),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new Fp(this._bufferService),this._activeSelectionMode=0,this._register(il(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}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(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map(e=>e.replace(Vp,` `)).join(fp?`\r
32
+ `:`
33
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),pp&&e&&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(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=Ip(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Zf(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-Lp),Lp),t/=Lp,t/Math.abs(t)+Math.round(t*(Rp-1)))}shouldForceSelection(e){return lp?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),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(),zp)}_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(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(lp&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}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(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[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});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<Bp&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=Sp(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(!(!t&&o.slice(s,c).trim()===``)){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Ip(n,this._bufferService.cols)}};Hp=Fs([W(3,cc),W(4,uc),W(5,Sc),W(6,mc),W(7,Cc),W(8,xc)],Hp);var Up=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Wp=class{constructor(){this._color=new Up,this._css=new Up}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Gp=Object.freeze((()=>{let e=[yf.toColor(`#2e3436`),yf.toColor(`#cc0000`),yf.toColor(`#4e9a06`),yf.toColor(`#c4a000`),yf.toColor(`#3465a4`),yf.toColor(`#75507b`),yf.toColor(`#06989a`),yf.toColor(`#d3d7cf`),yf.toColor(`#555753`),yf.toColor(`#ef2929`),yf.toColor(`#8ae234`),yf.toColor(`#fce94f`),yf.toColor(`#729fcf`),yf.toColor(`#ad7fa8`),yf.toColor(`#34e2e2`),yf.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:_f.toCss(r,i,a),rgba:_f.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:_f.toCss(n,n,n),rgba:_f.toRgba(n,n,n)})}return e})()),Kp=yf.toColor(`#ffffff`),qp=yf.toColor(`#000000`),Jp=yf.toColor(`#ffffff`),Yp=qp,Xp={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},Zp=Kp,Qp=class extends G{constructor(e){super(),this._optionsService=e,this._contrastCache=new Wp,this._halfContrastCache=new Wp,this._onChangeColors=this._register(new K),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Kp,background:qp,cursor:Jp,cursorAccent:Yp,selectionForeground:void 0,selectionBackgroundTransparent:Xp,selectionBackgroundOpaque:vf.blend(qp,Xp),selectionInactiveBackgroundTransparent:Xp,selectionInactiveBackgroundOpaque:vf.blend(qp,Xp),scrollbarSliderBackground:vf.opacity(Kp,.2),scrollbarSliderHoverBackground:vf.opacity(Kp,.4),scrollbarSliderActiveBackground:vf.opacity(Kp,.5),overviewRulerBorder:Kp,ansi:Gp.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)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=Y(e.foreground,Kp),t.background=Y(e.background,qp),t.cursor=vf.blend(t.background,Y(e.cursor,Jp)),t.cursorAccent=vf.blend(t.background,Y(e.cursorAccent,Yp)),t.selectionBackgroundTransparent=Y(e.selectionBackground,Xp),t.selectionBackgroundOpaque=vf.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Y(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=vf.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Y(e.selectionForeground,gf):void 0,t.selectionForeground===gf&&(t.selectionForeground=void 0),vf.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=vf.opacity(t.selectionBackgroundTransparent,.3)),vf.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=vf.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Y(e.scrollbarSliderBackground,vf.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Y(e.scrollbarSliderHoverBackground,vf.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Y(e.scrollbarSliderActiveBackground,vf.opacity(t.foreground,.5)),t.overviewRulerBorder=Y(e.overviewRulerBorder,Zp),t.ansi=Gp.slice(),t.ansi[0]=Y(e.black,Gp[0]),t.ansi[1]=Y(e.red,Gp[1]),t.ansi[2]=Y(e.green,Gp[2]),t.ansi[3]=Y(e.yellow,Gp[3]),t.ansi[4]=Y(e.blue,Gp[4]),t.ansi[5]=Y(e.magenta,Gp[5]),t.ansi[6]=Y(e.cyan,Gp[6]),t.ansi[7]=Y(e.white,Gp[7]),t.ansi[8]=Y(e.brightBlack,Gp[8]),t.ansi[9]=Y(e.brightRed,Gp[9]),t.ansi[10]=Y(e.brightGreen,Gp[10]),t.ansi[11]=Y(e.brightYellow,Gp[11]),t.ansi[12]=Y(e.brightBlue,Gp[12]),t.ansi[13]=Y(e.brightMagenta,Gp[13]),t.ansi[14]=Y(e.brightCyan,Gp[14]),t.ansi[15]=Y(e.brightWhite,Gp[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=Y(e.extendedAnsi[r],Gp[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(e){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[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(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()}}};Qp=Fs([W(0,mc)],Qp);function Y(e,t){if(e!==void 0)try{return yf.toColor(e)}catch{}return t}var $p=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},em=class{constructor(){this._services=new $p,this._services.set(fc,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=ac(e).sort((e,t)=>e.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},tm={trace:0,debug:1,info:2,warn:3,error:4,off:5},nm=`xterm.js: `,rm=class extends G{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),im=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=tm[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:nm)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};rm=Fs([W(0,mc)],rm);var im,am=class extends G{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new K),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new K),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new K),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw 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(e,t,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},X=3,om=Object.freeze(new $s),sm=0,cm=2,lm=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*X);let r=t||tc.fromCharData([0,Zs,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*X+0],n=t&2097151;return[this._data[e*X+1],t&2097152?this._combined[e]:n?qs(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*X+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*X+0]=e|2097152|t[2]<<22):this._data[e*X+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*X+0]>>22}hasWidth(e){return this._data[e*X+0]&12582912}getFg(e){return this._data[e*X+1]}getBg(e){return this._data[e*X+2]}hasContent(e){return this._data[e*X+0]&4194303}getCodePoint(e){let t=this._data[e*X+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*X+0]&2097152}getString(e){let t=this._data[e*X+0];return t&2097152?this._combined[e]:t&2097151?qs(t&2097151):``}isProtected(e){return this._data[e*X+2]&536870912}loadCell(e,t){return sm=e*X,t.content=this._data[sm+0],t.fg=this._data[sm+1],t.bg=this._data[sm+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*X+0]=t.content,this._data[e*X+1]=t.fg,this._data[e*X+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*X+0]=t|n<<22,this._data[e*X+1]=r.fg,this._data[e*X+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*X+0];r&2097152?this._combined[e]+=qs(t):r&2097151?(this._combined[e]=qs(r&2097151)+qs(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*X+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new tc;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new tc;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return this._data.length*4*cm<this._data.buffer.byteLength;let n=e*X;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*cm<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*cm<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t){for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);return}this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let e in this._combined)t._combined[e]=this._combined[e];for(let e in this._extendedAttrs)t._extendedAttrs[e]=this._extendedAttrs[e];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*X+0]&4194303)return e+(this._data[e*X+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*X+0]&4194303||this._data[e*X+2]&50331648)return e+(this._data[e*X+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<X;e++)this._data[(n+i)*X+e]=a[(t+i)*X+e];a[(t+i)*X+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<X;e++)this._data[(n+i)*X+e]=a[(t+i)*X+e];a[(t+i)*X+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[t*X+0],n=e&2097151,a=e&2097152?this._combined[t]:n?qs(n):Qs;if(i+=a,r)for(let e=0;e<a.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}};function um(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(!a&&r>=s&&r<c){s+=u.length-1;continue}let d=0,f=mm(u,d,t),p=1,m=0;for(;p<u.length;){let e=mm(u,p,t),r=e-m,a=n-f,o=Math.min(r,a);u[d].copyCellsFrom(u[p],m,f,o,!1),f+=o,f===n&&(d++,f=0),m+=o,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,f++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(f,n,i);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function dm(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}}function fm(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length}function pm(e,t,n){let r=[],i=e.map((n,r)=>mm(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;s<i;){if(i-s<n){r.push(i-s);break}a+=n;let c=mm(e,o,t);a>c&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function mm(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var hm=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new K),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),nl(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};hm._nextId=1;var gm=hm,_m={},vm=_m.B;_m[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:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},_m.A={"#":`£`},_m.B=void 0,_m[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},_m.C=_m[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},_m.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},_m.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},_m.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},_m.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},_m.E=_m[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},_m.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},_m.H=_m[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},_m[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var ym=4294967295,bm=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=om.clone(),this.savedCharset=vm,this.markers=[],this._nullCell=tc.fromCharData([0,Zs,1,0]),this._whitespaceCell=tc.fromCharData([0,Qs,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new vp,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new am(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new ec),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new ec),this._whitespaceCell}getBlankLine(e,t){return new lm(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>ym?ym:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=om);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new am(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(om),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new lm(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new lm(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=um(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(om),n);if(r.length>0){let n=dm(this.lines,r);fm(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(om),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new lm(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(om),i=[],a=0;for(let o=this.lines.length-1;o>=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e<o+c.length)continue}let l=c[c.length-1].getTrimmedLength(),u=pm(c,this._cols,e),d=u.length-c.length,f;f=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let e=0;e<d;e++){let e=this.getBlankLine(om,!0);p.push(e)}p.length>0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=mm(c,Math.max(g,0),this._cols))}for(let t=0;t<c.length;t++)u[t]<e&&c[t].setCell(u[t],r);let v=d-f;for(;v-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,r=n-1,o=0,s=i[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+a-1);l>=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new gm(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},xm=class extends G{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new K),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 bm(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new bm(!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(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),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(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},Sm=2,Cm=1,wm=class extends G{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new K),this.onResize=this._onResize.event,this._onScroll=this._register(new K),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Sm),this.rows=Math.max(e.rawOptions.rows||0,Cm),this.buffers=this._register(new xm(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};wm=Fs([W(0,mc)],wm);var Tm={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:lp,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},Em=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],Dm=class extends G{constructor(e){super(),this._onOptionChange=this._register(new K),this.onOptionChange=this._onOptionChange.event;let t={...Tm};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(il(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in Tm))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in Tm))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=Tm[e],!Om(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=Tm[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=Em.includes(t)?t:Tm[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={};break}return t}};function Om(e){return e===`block`||e===`underline`||e===`bar`}function km(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&km(e[r],t-1);return n}var Am=Object.freeze({insertMode:!1}),jm=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Mm=class extends G{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new K),this.onData=this._onData.event,this._onUserInput=this._register(new K),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new K),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new K),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=km(Am),this.decPrivateModes=km(jm)}reset(){this.modes=km(Am),this.decPrivateModes=km(jm)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace(`sending binary (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};Mm=Fs([W(0,cc),W(1,pc),W(2,mc)],Mm);var Nm={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function Pm(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var Fm=String.fromCharCode,Im={DEFAULT:e=>{let t=[Pm(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${Fm(t[0])}${Fm(t[1])}${Fm(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${Pm(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${Pm(e,!0)};${e.x};${e.y}${t}`}},Lm=class extends G{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new K),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(Nm))this.addProtocol(e,Nm[e]);for(let e of Object.keys(Im))this.addEncoding(e,Im[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};Lm=Fs([W(0,cc),W(1,uc),W(2,mc)],Lm);var Rm=[[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]],zm=[[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]],Bm;function Vm(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var Hm=class{constructor(){if(this.version=`6`,!Bm){Bm=new Uint8Array(65536),Bm.fill(1),Bm[0]=0,Bm.fill(0,1,32),Bm.fill(0,127,160),Bm.fill(2,4352,4448),Bm[9001]=2,Bm[9002]=2,Bm.fill(2,11904,42192),Bm[12351]=1,Bm.fill(2,44032,55204),Bm.fill(2,63744,64256),Bm.fill(2,65040,65050),Bm.fill(2,65072,65136),Bm.fill(2,65280,65377),Bm.fill(2,65504,65511);for(let e=0;e<Rm.length;++e)Bm.fill(0,Rm[e][0],Rm[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Bm[e]:Vm(e,zm)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=Um.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return Um.createPropertyValue(0,n,r)}},Um=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new K,this.onChange=this._onChange.event;let e=new Hm;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},Wm=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function Gm(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Km=2147483647,qm=256,Jm=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>qm)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=+!!Array.isArray(t[0]);e<t.length;++e){let r=t[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)n.addSubParam(r[e]);else n.addParam(r)}return n}clone(){let t=new e(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>Km?Km:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>Km?Km:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,Km):e}},Ym=[],Xm=class{constructor(){this._state=0,this._active=Ym,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Ym}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=Ym,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Ym,!this._active.length)this._handlerFb(this._id,`START`);else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,Js(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,`END`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=Ym,this._id=-1,this._state=0}}},Zm=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Js(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},Qm=[],$m=class{constructor(){this._handlers=Object.create(null),this._active=Qm,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Qm}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Qm,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Qm,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,Js(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=Qm,this._ident=0}},eh=new Jm;eh.addParam(0);var th=class{constructor(e){this._handler=e,this._data=``,this._params=eh,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():eh,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Js(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=eh,this._data=``,this._hitLimit=!1,e));return this._params=eh,this._data=``,this._hitLimit=!1,t}},nh=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},rh=160,ih=function(){let e=new nh(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(rh,0,2,0),e.add(rh,8,5,8),e.add(rh,6,0,6),e.add(rh,11,0,11),e.add(rh,13,13,13),e}(),ah=class extends G{constructor(e=ih){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new Jm,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(il(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Xm),this._dcsParser=this._register(new $m),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}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(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let n=a;n<t;++n){switch(r=e[n],i=this._transitions.table[this.currentState<<8|(r<160?r:rh)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<rh){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<rh){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<rh){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<rh){this._printHandler(e,n,i),n=i-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],s=a?a.length-1:-1;for(;s>=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++n<t&&(r=e[n])>47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<0&&this._escHandlerFb(this._collect<<8|r),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|r,this._params);break;case 13:for(let i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r<rh){this._dcsParser.put(e,n,i),n=i-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,n),o;r===27&&(i|=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 i=n+1;;i++)if(i>=t||(r=e[i])<32||r>127&&r<rh){this._oscParser.put(e,n,i),n=i-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},oh=/^([\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})$/,sh=/^[\da-f]+$/;function ch(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=oh.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),sh.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}}function lh(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function uh(e,t=16){let[n,r,i]=e;return`rgb:${lh(n,t)}/${lh(r,t)}/${lh(i,t)}`}var dh={"(":0,")":1,"*":2,"+":3,"-":1,".":2},fh=131072,ph=10;function mh(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var hh=5e3,gh=0,_h=class extends G{constructor(e,t,n,r,i,a,o,s,c=new ah){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Ys,this._utf8Decoder=new Xs,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=om.clone(),this._eraseAttrDataInternal=om.clone(),this._onRequestBell=this._register(new K),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new K),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new K),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new K),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new K),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new K),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new K),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new K),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new K),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new K),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new K),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new K),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new K),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 vh(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(J.BEL,()=>this.bell()),this._parser.setExecuteHandler(J.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(J.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(J.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(J.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(J.BS,()=>this.backspace()),this._parser.setExecuteHandler(J.HT,()=>this.tab()),this._parser.setExecuteHandler(J.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(J.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(lf.IND,()=>this.index()),this._parser.setExecuteHandler(lf.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(lf.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Zm(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new Zm(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new Zm(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new Zm(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new Zm(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new Zm(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new Zm(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new Zm(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new Zm(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new Zm(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new Zm(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new Zm(e=>this.restoreCursorColor(e))),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(let e in _m)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new th((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),hh))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${hh} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>fh&&(a=this._parseStack.position+fh)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<fh&&(this._parseBuffer=new Uint32Array(Math.min(e.length,fh))),o||this._dirtyRowTracker.clearRange(),e.length>fh)for(let t=a;t<e.length;t+=fh){let a=t+fh<e.length?t+fh:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(s,this._bufferService.rows-1)})}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,f);i=Um.extractWidth(t);let n=Um.extractShouldJoin(t),m=n?Um.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(qs(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-m>s){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,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),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof lm&&d.copyCellsFrom(e,t,0,m,!1);t<s;)e.setCellFromCodepoint(t++,0,1,u)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-m;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<s&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>mh(e.params[0],this._optionsService.rawOptions.windowOptions)?t(e):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new th(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Zm(t))}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(){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&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)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(om));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=Um.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(J.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(J.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(J.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(J.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(J.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,vm),this._charsetService.setgCharset(1,vm),this._charsetService.setgCharset(2,vm),this._charsetService.setgCharset(3,vm);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(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){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:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${J.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=$s.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=om.fg,e.bg=om.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=om.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=om.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=om.fg&16777215,r.bg&=-67108864,r.bg|=om.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${J.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${J.ESC}[${e};${t}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${J.ESC}[?${e};${t}R`);break;case 15:break;case 25:break;case 26:break;case 53:break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=om.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`;break}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!mh(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${J.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>ph&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>ph&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(yh(n))if(r===`?`)t.push({type:0,index:n});else{let e=ch(r);e&&t.push({type:1,index:n,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=ch(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);yh(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,vm),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(dh[e[0]],_m[e[1]]||vm),!0):(this.selectDefaultCharset(),!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){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=om.clone(),this._eraseAttrDataInternal=om.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new tc;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${J.ESC}${e}${J.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},vh=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(gh=e,e=t,t=gh),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};vh=Fs([W(0,cc)],vh);function yh(e){return 0<=e&&e<256}var bh=5e7,xh=12,Sh=50,Ch=class extends G{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new K),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>bh)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=xh?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=xh)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>Sh&&(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()}},wh=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};wh=Fs([W(0,cc)],wh);var Th=!1,Eh=class extends G{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new sl),this._onBinary=this._register(new K),this.onBinary=this._onBinary.event,this._onData=this._register(new K),this.onData=this._onData.event,this._onLineFeed=this._register(new K),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new K),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new K),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new K),this._instantiationService=new em,this.optionsService=this._register(new Dm(e)),this._instantiationService.setService(mc,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(wm)),this._instantiationService.setService(cc,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(rm)),this._instantiationService.setService(pc,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Mm)),this._instantiationService.setService(uc,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Lm)),this._instantiationService.setService(lc,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Um)),this._instantiationService.setService(gc,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Wm),this._instantiationService.setService(dc,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(wh),this._instantiationService.setService(hc,this._oscLinkService),this._inputHandler=this._register(new _h(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(_l.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(_l.forward(this._bufferService.onResize,this._onResize)),this._register(_l.forward(this.coreService.onData,this._onData)),this._register(_l.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new Ch((e,t)=>this._inputHandler.parse(e,t))),this._register(_l.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new K),this._onScroll.event(e=>{this._onScrollApi?.fire(e.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(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!Th&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),Th=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,Sm),t=Math.max(t,Cm),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(Gm.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(Gm(this._bufferService),!1))),this._windowsWrappingHeuristics.value=il(()=>{for(let t of e)t.dispose()})}}},Dh={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:[`'`,`"`]};function Oh(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?t?i.key=J.ESC+`OA`:i.key=J.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?t?i.key=J.ESC+`OD`:i.key=J.ESC+`[D`:e.key===`UIKeyInputRightArrow`?t?i.key=J.ESC+`OC`:i.key=J.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(t?i.key=J.ESC+`OB`:i.key=J.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:J.DEL,e.altKey&&(i.key=J.ESC+i.key);break;case 9:if(e.shiftKey){i.key=J.ESC+`[Z`;break}i.key=J.HT,i.cancel=!0;break;case 13:i.key=e.altKey?J.ESC+J.CR:J.CR,i.cancel=!0;break;case 27:i.key=J.ESC,e.altKey&&(i.key=J.ESC+J.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;a?i.key=J.ESC+`[1;`+(a+1)+`D`:t?i.key=J.ESC+`OD`:i.key=J.ESC+`[D`;break;case 39:if(e.metaKey)break;a?i.key=J.ESC+`[1;`+(a+1)+`C`:t?i.key=J.ESC+`OC`:i.key=J.ESC+`[C`;break;case 38:if(e.metaKey)break;a?i.key=J.ESC+`[1;`+(a+1)+`A`:t?i.key=J.ESC+`OA`:i.key=J.ESC+`[A`;break;case 40:if(e.metaKey)break;a?i.key=J.ESC+`[1;`+(a+1)+`B`:t?i.key=J.ESC+`OB`:i.key=J.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=J.ESC+`[2~`);break;case 46:a?i.key=J.ESC+`[3;`+(a+1)+`~`:i.key=J.ESC+`[3~`;break;case 36:a?i.key=J.ESC+`[1;`+(a+1)+`H`:t?i.key=J.ESC+`OH`:i.key=J.ESC+`[H`;break;case 35:a?i.key=J.ESC+`[1;`+(a+1)+`F`:t?i.key=J.ESC+`OF`:i.key=J.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=J.ESC+`[5;`+(a+1)+`~`:i.key=J.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=J.ESC+`[6;`+(a+1)+`~`:i.key=J.ESC+`[6~`;break;case 112:a?i.key=J.ESC+`[1;`+(a+1)+`P`:i.key=J.ESC+`OP`;break;case 113:a?i.key=J.ESC+`[1;`+(a+1)+`Q`:i.key=J.ESC+`OQ`;break;case 114:a?i.key=J.ESC+`[1;`+(a+1)+`R`:i.key=J.ESC+`OR`;break;case 115:a?i.key=J.ESC+`[1;`+(a+1)+`S`:i.key=J.ESC+`OS`;break;case 116:a?i.key=J.ESC+`[15;`+(a+1)+`~`:i.key=J.ESC+`[15~`;break;case 117:a?i.key=J.ESC+`[17;`+(a+1)+`~`:i.key=J.ESC+`[17~`;break;case 118:a?i.key=J.ESC+`[18;`+(a+1)+`~`:i.key=J.ESC+`[18~`;break;case 119:a?i.key=J.ESC+`[19;`+(a+1)+`~`:i.key=J.ESC+`[19~`;break;case 120:a?i.key=J.ESC+`[20;`+(a+1)+`~`:i.key=J.ESC+`[20~`;break;case 121:a?i.key=J.ESC+`[21;`+(a+1)+`~`:i.key=J.ESC+`[21~`;break;case 122:a?i.key=J.ESC+`[23;`+(a+1)+`~`:i.key=J.ESC+`[23~`;break;case 123:a?i.key=J.ESC+`[24;`+(a+1)+`~`:i.key=J.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=J.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=J.DEL:e.keyCode===219?i.key=J.ESC:e.keyCode===220?i.key=J.FS:e.keyCode===221&&(i.key=J.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=Dh[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=J.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=J.ESC+n}else if(e.keyCode===32)i.key=J.ESC+(e.ctrlKey?J.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=J.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=J.US),e.key===`@`&&(i.key=J.NUL));break}return i}var kh=0,Ah=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new vp,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new vp,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(kh=this._search(t),kh===-1)||this._getKey(this._array[kh])!==t)return!1;do if(this._array[kh]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(kh),!0;while(++kh<this._array.length&&this._getKey(this._array[kh])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(kh=this._search(e),!(kh<0||kh>=this._array.length)&&this._getKey(this._array[kh])===e))do yield this._array[kh];while(++kh<this._array.length&&this._getKey(this._array[kh])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(kh=this._search(e),!(kh<0||kh>=this._array.length)&&this._getKey(this._array[kh])===e))do t(this._array[kh]);while(++kh<this._array.length&&this._getKey(this._array[kh])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},jh=0,Mh=0,Nh=class extends G{constructor(){super(),this._decorations=new Ah(e=>e?.marker.line),this._onDecorationRegistered=this._register(new K),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new K),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(il(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new Ph(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,t=>{jh=t.options.x??0,Mh=jh+(t.options.width??1),e>=jh&&e<Mh&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},Ph=class extends ol{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new K),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new K),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=yf.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=yf.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Fh=1e3,Ih=class{constructor(e,t=Fh){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},Lh=20,Rh=!1,zh=class extends G{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Ih(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);Rh?(this._accessibilityContainer.classList.add(`debug`),this._rowContainer.classList.add(`debug`),this._debugRootContainer=i.createElement(`div`),this._debugRootContainer.classList.add(`xterm`),this._debugRootContainer.appendChild(i.createTextNode(`------start a11y------`)),this._debugRootContainer.appendChild(this._accessibilityContainer),this._debugRootContainer.appendChild(i.createTextNode(`------end a11y------`)),this._terminal.element.insertAdjacentElement(`afterend`,this._debugRootContainer)):this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
34
+ `))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(q(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(il(()=>{Rh?this._debugRootContainer.remove():this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<Lh+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
35
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===Lh+1&&(this._liveRegion.textContent+=zs.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};zh=Fs([W(1,fc),W(2,xc),W(3,Cc)],zh);var Bh=class extends G{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new K),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new K),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(il(()=>{nl(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(q(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(q(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(q(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(q(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)(!this._activeProviderReplies.has(t)||this._activeProviderReplies.get(t))&&(i=!0);if(!i&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&Vh(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,nl(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};Bh=Fs([W(1,Sc),W(2,Cc),W(3,cc),W(4,Dc)],Bh);function Vh(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var Hh=class extends Eh{constructor(e={}){super(e),this._linkifier=this._register(new sl),this.browser=tp,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new sl),this._onCursorMove=this._register(new K),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new K),this.onKey=this._onKey.event,this._onRender=this._register(new K),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new K),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new K),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new K),this.onBell=this._onBell.event,this._onFocus=this._register(new K),this._onBlur=this._register(new K),this._onA11yCharEmitter=this._register(new K),this._onA11yTabEmitter=this._register(new K),this._onWillOpen=this._register(new K),this._setup(),this._decorationService=this._instantiationService.createInstance(Nh),this._instantiationService.setService(_c,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Xf),this._instantiationService.setService(Dc,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(vc)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(_l.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(_l.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(_l.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(_l.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(il(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}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}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=vf.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${J.ESC}]${n};${uh(r)}${uf.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=_f.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=_f.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(zh,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(J.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(J.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(q(this.element,`copy`,e=>{this.hasSelection()&&Hs(e,this._selectionService)}));let e=e=>Us(e,this.textarea,this.coreService,this.optionsService);this._register(q(this.textarea,`paste`,e)),this._register(q(this.element,`paste`,e)),ap?this._register(q(this.element,`mousedown`,e=>{e.button===2&&Ks(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(q(this.element,`contextmenu`,e=>{Ks(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),pp&&this._register(q(this.element,`auxclick`,e=>{e.button===1&&Gs(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(q(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(q(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(q(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(q(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(q(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(q(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(q(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.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`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(q(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,Ls.get()),mp||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._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Jf,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(xc,this._coreBrowserService),this._register(q(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(q(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Wf,this._document,this._helperContainer),this._instantiationService.setService(bc,this._charSizeService),this._themeService=this._instantiationService.createInstance(Qp),this._instantiationService.setService(Ec,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Tf),this._instantiationService.setService(Tc,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(bp,this.rows,this.screenElement)),this._instantiationService.setService(Cc,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(df,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance($f),this._instantiationService.setService(Sc,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Bh,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),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._viewport=this._register(this._instantiationService.createInstance(tf,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Hp,this.element,this.screenElement,r)),this._instantiationService.setService(wc,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(_l.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(nf,this.screenElement)),this._register(q(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),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(zh,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(cf,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(cf,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Uf,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),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()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(q(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(q(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=J.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?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(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){Ws(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=Oh(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===J.ETX||n.key===J.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Uh(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(om));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(J.ESC+`[I`):this.coreService.triggerDataEvent(J.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${J.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${J.ESC}[6;${r};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function Uh(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var Wh=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},Gh=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new tc)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},Kh=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,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(e){let t=this._buffer.lines.get(e);if(t)return new Gh(t)}getNullCell(){return new tc}},qh=class extends G{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new K),this.onBufferChange=this._onBufferChange.event,this._normal=new Kh(this._core.buffers.normal,`normal`),this._alternate=new Kh(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 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)}},Jh=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},Yh=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},Xh=[`cols`,`rows`],Zh=0,Qh=class extends G{constructor(e){super(),this._core=this._register(new Hh(e)),this._addonManager=this._register(new Wh),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(Xh.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw 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||=new Jh(this._core),this._parser}get unicode(){return this._checkProposedApi(),new Yh(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._register(new qh(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`;break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
36
+ `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Ls.get()},set promptLabel(e){Ls.set(e)},get tooMuchOutput(){return zs.get()},set tooMuchOutput(e){zs.set(e)}}}_verifyIntegers(...e){for(Zh of e)if(Zh===1/0||isNaN(Zh)||Zh%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(Zh of e)if(Zh&&(Zh===1/0||isNaN(Zh)||Zh%1!=0||Zh<0))throw Error(`This API only accepts positive integers`)}},$h=2,eg=1,tg=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max($h,Math.floor(u/e.css.cell.width)),rows:Math.max(eg,Math.floor(l/e.css.cell.height))}}},ng=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=ig.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function rg(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var ig=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!rg(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),!(!n.isWrapped||o.indexOf(` `)!==-1)););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},ag=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function og(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var sg=class{constructor(e=og,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||ag;this._linkProvider=this._terminal.registerLinkProvider(new ng(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}},cg={class:`terminal-wrapper`},lg={class:`header`},ug=ss(dr({__name:`Terminal`,props:{sessionId:{},connectKey:{}},emits:[`session`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=I(),o=I(`connecting`),s,c,l=null,u;function d(){l&&l.close(),s.reset(),o.value=`connecting`;let e=location.protocol===`https:`?`wss:`:`ws:`,t=r.sessionId?`?session=${encodeURIComponent(r.sessionId)}`:``,n=new WebSocket(`${e}//${location.host}/ws${t}`);l=n,n.onopen=()=>{n===l&&(o.value=`connected`,n.send(JSON.stringify({type:`resize`,cols:s.cols,rows:s.rows})))},n.onmessage=e=>{if(n!==l)return;let t=JSON.parse(e.data);t.type===`output`?s.write(t.data):t.type===`session`?i(`session`,t.id):t.type===`exit`&&(s.write(`\r
37
+ \x1B[33m[session ended]\x1B[0m\r
38
+ `),o.value=`disconnected`)},n.onclose=()=>{n===l&&(o.value=`disconnected`)}}Er(()=>{s=new Qh({cursorBlink:!0,fontSize:14,fontFamily:`'JetBrains Mono', 'Fira Code', 'Menlo', monospace`,theme:{background:`#1a1a2e`,foreground:`#e0e0e0`,cursor:`#e0e0e0`,selectionBackground:`#3a3a5e`}}),c=new tg,s.loadAddon(c),s.loadAddon(new sg);let e=a.value;e&&(s.open(e),c.fit(),s.onData(e=>{l&&l.readyState===WebSocket.OPEN&&l.send(JSON.stringify({type:`input`,data:e}))}),u=new ResizeObserver(()=>{c.fit(),l&&l.readyState===WebSocket.OPEN&&l.send(JSON.stringify({type:`resize`,cols:s.cols,rows:s.rows}))}),u.observe(e),d(),s.focus())}),Gn(()=>r.connectKey,()=>{d(),s.focus()});function f(e){let t=l;return!t||t.readyState!==WebSocket.OPEN?!1:(t.send(JSON.stringify({type:`input`,data:e})),setTimeout(()=>{t===l&&t.readyState===WebSocket.OPEN&&t.send(JSON.stringify({type:`input`,data:`\r`}))},60),!0)}return t({submitText:f}),Ar(()=>{u?.disconnect(),l?.close(),s?.dispose()}),(e,t)=>(z(),B(`div`,cg,[V(`div`,lg,[t[0]||=V(`span`,{class:`title`},`mulmoterminal`,-1),V(`span`,{class:Ce([`status`,o.value])},N(o.value),3)]),V(`div`,{ref_key:`terminalRef`,ref:a,class:`terminal-container`},null,512)]))}}),[[`__scopeId`,`data-v-0a7d9e9b`]]),dg=Object.create(null);dg.open=`0`,dg.close=`1`,dg.ping=`2`,dg.pong=`3`,dg.message=`4`,dg.upgrade=`5`,dg.noop=`6`;var fg=Object.create(null);Object.keys(dg).forEach(e=>{fg[dg[e]]=e});var pg={type:`error`,data:`parser error`},mg=typeof Blob==`function`||typeof Blob<`u`&&Object.prototype.toString.call(Blob)===`[object BlobConstructor]`,hg=typeof ArrayBuffer==`function`,gg=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,_g=({type:e,data:t},n,r)=>mg&&t instanceof Blob?n?r(t):vg(t,r):hg&&(t instanceof ArrayBuffer||gg(t))?n?r(t):vg(new Blob([t]),r):r(dg[e]+(t||``)),vg=(e,t)=>{let n=new FileReader;return n.onload=function(){let e=n.result.split(`,`)[1];t(`b`+(e||``))},n.readAsDataURL(e)};function yg(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var bg;function xg(e,t){if(mg&&e.data instanceof Blob)return e.data.arrayBuffer().then(yg).then(t);if(hg&&(e.data instanceof ArrayBuffer||gg(e.data)))return t(yg(e.data));_g(e,!1,e=>{bg||=new TextEncoder,t(bg.encode(e))})}var Sg=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Cg=typeof Uint8Array>`u`?[]:new Uint8Array(256);for(let e=0;e<64;e++)Cg[Sg.charCodeAt(e)]=e;var wg=e=>{let t=e.length*.75,n=e.length,r,i=0,a,o,s,c;e[e.length-1]===`=`&&(t--,e[e.length-2]===`=`&&t--);let l=new ArrayBuffer(t),u=new Uint8Array(l);for(r=0;r<n;r+=4)a=Cg[e.charCodeAt(r)],o=Cg[e.charCodeAt(r+1)],s=Cg[e.charCodeAt(r+2)],c=Cg[e.charCodeAt(r+3)],u[i++]=a<<2|o>>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},Tg=typeof ArrayBuffer==`function`,Eg=(e,t)=>{if(typeof e!=`string`)return{type:`message`,data:Og(e,t)};let n=e.charAt(0);return n===`b`?{type:`message`,data:Dg(e.substring(1),t)}:fg[n]?e.length>1?{type:fg[n],data:e.substring(1)}:{type:fg[n]}:pg},Dg=(e,t)=>Tg?Og(wg(e),t):{base64:!0,data:e},Og=(e,t)=>{switch(t){case`blob`:return e instanceof Blob?e:new Blob([e]);default:return e instanceof ArrayBuffer?e:e.buffer}},kg=``,Ag=(e,t)=>{let n=e.length,r=Array(n),i=0;e.forEach((e,a)=>{_g(e,!1,e=>{r[a]=e,++i===n&&t(r.join(kg))})})},jg=(e,t)=>{let n=e.split(kg),r=[];for(let e=0;e<n.length;e++){let i=Eg(n[e],t);if(r.push(i),i.type===`error`)break}return r};function Mg(){return new TransformStream({transform(e,t){xg(e,n=>{let r=n.length,i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);let e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{i=new Uint8Array(9);let e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!=`string`&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}var Ng;function Pg(e){return e.reduce((e,t)=>e+t.length,0)}function Fg(e,t){if(e[0].length===t)return e.shift();let n=new Uint8Array(t),r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function Ig(e,t){Ng||=new TextDecoder;let n=[],r=0,i=-1,a=!1;return new TransformStream({transform(o,s){for(n.push(o);;){if(r===0){if(Pg(n)<1)break;let e=Fg(n,1);a=(e[0]&128)==128,i=e[0]&127,r=i<126?3:i===126?1:2}else if(r===1){if(Pg(n)<2)break;let e=Fg(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(r===2){if(Pg(n)<8)break;let e=Fg(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),a=t.getUint32(0);if(a>2**21-1){s.enqueue(pg);break}i=a*2**32+t.getUint32(4),r=3}else{if(Pg(n)<i)break;let e=Fg(n,i);s.enqueue(Eg(a?e:Ng.decode(e),t)),r=0}if(i===0||i>e){s.enqueue(pg);break}}}})}function Lg(e){if(e)return Rg(e)}function Rg(e){for(var t in Lg.prototype)e[t]=Lg.prototype[t];return e}Lg.prototype.on=Lg.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks[`$`+e]=this._callbacks[`$`+e]||[]).push(t),this},Lg.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},Lg.prototype.off=Lg.prototype.removeListener=Lg.prototype.removeAllListeners=Lg.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks[`$`+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks[`$`+e],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===t||r.fn===t){n.splice(i,1);break}return n.length===0&&delete this._callbacks[`$`+e],this},Lg.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=Array(arguments.length-1),n=this._callbacks[`$`+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,t)}return this},Lg.prototype.emitReserved=Lg.prototype.emit,Lg.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks[`$`+e]||[]},Lg.prototype.hasListeners=function(e){return!!this.listeners(e).length};var zg=typeof Promise==`function`&&typeof Promise.resolve==`function`?e=>Promise.resolve().then(e):(e,t)=>t(e,0),Bg=typeof self<`u`?self:typeof window<`u`?window:Function(`return this`)(),Vg=`arraybuffer`;function Hg(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}var Ug=Bg.setTimeout,Wg=Bg.clearTimeout;function Gg(e,t){t.useNativeTimers?(e.setTimeoutFn=Ug.bind(Bg),e.clearTimeoutFn=Wg.bind(Bg)):(e.setTimeoutFn=Bg.setTimeout.bind(Bg),e.clearTimeoutFn=Bg.clearTimeout.bind(Bg))}var Kg=1.33;function qg(e){return typeof e==`string`?Jg(e):Math.ceil((e.byteLength||e.size)*Kg)}function Jg(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function Yg(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Xg(e){let t=``;for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+=`&`),t+=encodeURIComponent(n)+`=`+encodeURIComponent(e[n]));return t}function Zg(e){let t={},n=e.split(`&`);for(let e=0,r=n.length;e<r;e++){let r=n[e].split(`=`);t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}var Qg=class extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type=`TransportError`}},$g=class extends Lg{constructor(e){super(),this.writable=!1,Gg(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved(`error`,new Qg(e,t,n)),this}open(){return this.readyState=`opening`,this.doOpen(),this}close(){return(this.readyState===`opening`||this.readyState===`open`)&&(this.doClose(),this.onClose()),this}send(e){this.readyState===`open`&&this.write(e)}onOpen(){this.readyState=`open`,this.writable=!0,super.emitReserved(`open`)}onData(e){let t=Eg(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved(`packet`,e)}onClose(e){this.readyState=`closed`,super.emitReserved(`close`,e)}pause(e){}createUri(e,t={}){return e+`://`+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(`:`)===-1?e:`[`+e+`]`}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?`:`+this.opts.port:``}_query(e){let t=Xg(e);return t.length?`?`+t:``}},e_=class extends $g{constructor(){super(...arguments),this._polling=!1}get name(){return`polling`}doOpen(){this._poll()}pause(e){this.readyState=`pausing`;let t=()=>{this.readyState=`paused`,e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once(`pollComplete`,function(){--e||t()})),this.writable||(e++,this.once(`drain`,function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved(`poll`)}onData(e){jg(e,this.socket.binaryType).forEach(e=>{if(this.readyState===`opening`&&e.type===`open`&&this.onOpen(),e.type===`close`)return this.onClose({description:`transport closed by the server`}),!1;this.onPacket(e)}),this.readyState!==`closed`&&(this._polling=!1,this.emitReserved(`pollComplete`),this.readyState===`open`&&this._poll())}doClose(){let e=()=>{this.write([{type:`close`}])};this.readyState===`open`?e():this.once(`open`,e)}write(e){this.writable=!1,Ag(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved(`drain`)})})}uri(){let e=this.opts.secure?`https`:`http`,t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=Yg()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}},t_=!1;try{t_=typeof XMLHttpRequest<`u`&&`withCredentials`in new XMLHttpRequest}catch{}var n_=t_;function r_(){}var i_=class extends e_{constructor(e){if(super(e),typeof location<`u`){let t=location.protocol===`https:`,n=location.port;n||=t?`443`:`80`,this.xd=typeof location<`u`&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){let n=this.request({method:`POST`,data:e});n.on(`success`,t),n.on(`error`,(e,t)=>{this.onError(`xhr post error`,e,t)})}doPoll(){let e=this.request();e.on(`data`,this.onData.bind(this)),e.on(`error`,(e,t)=>{this.onError(`xhr poll error`,e,t)}),this.pollXhr=e}},a_=class e extends Lg{constructor(e,t,n){super(),this.createRequest=e,Gg(this,n),this._opts=n,this._method=n.method||`GET`,this._uri=t,this._data=n.data===void 0?null:n.data,this._create()}_create(){var t;let n=Hg(this._opts,`agent`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`autoUnref`);n.xdomain=!!this._opts.xd;let r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}}catch{}if(this._method===`POST`)try{r.setRequestHeader(`Content-type`,`text/plain;charset=UTF-8`)}catch{}try{r.setRequestHeader(`Accept`,`*/*`)}catch{}(t=this._opts.cookieJar)==null||t.addCookies(r),`withCredentials`in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;r.readyState===3&&((e=this._opts.cookieJar)==null||e.parseCookies(r.getResponseHeader(`set-cookie`))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status==`number`?r.status:0)},0))},r.send(this._data)}catch(e){this.setTimeoutFn(()=>{this._onError(e)},0);return}typeof document<`u`&&(this._index=e.requestsCount++,e.requests[this._index]=this)}_onError(e){this.emitReserved(`error`,e,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(this._xhr===void 0||this._xhr===null)){if(this._xhr.onreadystatechange=r_,t)try{this._xhr.abort()}catch{}typeof document<`u`&&delete e.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved(`data`,e),this.emitReserved(`success`),this._cleanup())}abort(){this._cleanup()}};if(a_.requestsCount=0,a_.requests={},typeof document<`u`){if(typeof attachEvent==`function`)attachEvent(`onunload`,o_);else if(typeof addEventListener==`function`){let e=`onpagehide`in Bg?`pagehide`:`unload`;addEventListener(e,o_,!1)}}function o_(){for(let e in a_.requests)a_.requests.hasOwnProperty(e)&&a_.requests[e].abort()}var s_=(function(){let e=l_({xdomain:!1});return e&&e.responseType!==null})(),c_=class extends i_{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=s_&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new a_(l_,this.uri(),e)}};function l_(e){let t=e.xdomain;try{if(typeof XMLHttpRequest<`u`&&(!t||n_))return new XMLHttpRequest}catch{}if(!t)try{return new Bg[[`Active`,`Object`].join(`X`)](`Microsoft.XMLHTTP`)}catch{}}var u_=typeof navigator<`u`&&typeof navigator.product==`string`&&navigator.product.toLowerCase()===`reactnative`,d_=class extends $g{get name(){return`websocket`}doOpen(){let e=this.uri(),t=this.opts.protocols,n=u_?{}:Hg(this.opts,`agent`,`perMessageDeflate`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`localAddress`,`protocolVersion`,`origin`,`maxPayload`,`family`,`checkServerIdentity`);this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(e){return this.emitReserved(`error`,e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:`websocket connection closed`,context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError(`websocket error`,e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;_g(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch{}r&&zg(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){this.ws!==void 0&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?`wss`:`ws`,t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Yg()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},f_=Bg.WebSocket||Bg.MozWebSocket,p_={websocket:class extends d_{createSocket(e,t,n){return u_?new f_(e,t,n):t?new f_(e,t):new f_(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends $g{get name(){return`webtransport`}doOpen(){try{this._transport=new WebTransport(this.createUri(`https`),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved(`error`,e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError(`webtransport error`,e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=Ig(2**53-1,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=Mg();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();let i=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),i())}).catch(e=>{})};i();let a={type:`open`};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&zg(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)==null||e.close()}},polling:c_},m_=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,h_=[`source`,`protocol`,`authority`,`userInfo`,`user`,`password`,`host`,`port`,`relative`,`path`,`directory`,`file`,`query`,`anchor`];function g_(e){if(e.length>8e3)throw`URI too long`;let t=e,n=e.indexOf(`[`),r=e.indexOf(`]`);n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,`;`)+e.substring(r,e.length));let i=m_.exec(e||``),a={},o=14;for(;o--;)a[h_[o]]=i[o]||``;return n!=-1&&r!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,`:`),a.authority=a.authority.replace(`[`,``).replace(`]`,``).replace(/;/g,`:`),a.ipv6uri=!0),a.pathNames=__(a,a.path),a.queryKey=v_(a,a.query),a}function __(e,t){let n=t.replace(/\/{2,9}/g,`/`).split(`/`);return(t.slice(0,1)==`/`||t.length===0)&&n.splice(0,1),t.slice(-1)==`/`&&n.splice(n.length-1,1),n}function v_(e,t){let n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}var y_=typeof addEventListener==`function`&&typeof removeEventListener==`function`,b_=[];y_&&addEventListener(`offline`,()=>{b_.forEach(e=>e())},!1);var x_=class e extends Lg{constructor(e,t){if(super(),this.binaryType=Vg,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e==`object`&&(t=e,e=null),e){let n=g_(e);t.hostname=n.host,t.secure=n.protocol===`https`||n.protocol===`wss`,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=g_(t.host).host);Gg(this,t),this.secure=t.secure==null?typeof location<`u`&&location.protocol===`https:`:t.secure,t.hostname&&!t.port&&(t.port=this.secure?`443`:`80`),this.hostname=t.hostname||(typeof location<`u`?location.hostname:`localhost`),this.port=t.port||(typeof location<`u`&&location.port?location.port:this.secure?`443`:`80`),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{let t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:`/engine.io`,agent:!1,withCredentials:!1,upgrade:!0,timestampParam:`t`,rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,``)+(this.opts.addTrailingSlash?`/`:``),typeof this.opts.query==`string`&&(this.opts.query=Zg(this.opts.query)),y_&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener(`beforeunload`,this._beforeunloadEventListener,!1)),this.hostname!==`localhost`&&(this._offlineEventListener=()=>{this._onClose(`transport close`,{description:`network connection lost`})},b_.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);let n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved(`error`,`No transports available`)},0);return}let t=this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&this.transports.indexOf(`websocket`)!==-1?`websocket`:this.transports[0];this.readyState=`opening`;let n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on(`drain`,this._onDrain.bind(this)).on(`packet`,this._onPacket.bind(this)).on(`error`,this._onError.bind(this)).on(`close`,e=>this._onClose(`transport close`,e))}onOpen(){this.readyState=`open`,e.priorWebsocketSuccess=this.transport.name===`websocket`,this.emitReserved(`open`),this.flush()}_onPacket(e){if(this.readyState===`opening`||this.readyState===`open`||this.readyState===`closing`)switch(this.emitReserved(`packet`,e),this.emitReserved(`heartbeat`),e.type){case`open`:this.onHandshake(JSON.parse(e.data));break;case`ping`:this._sendPacket(`pong`),this.emitReserved(`ping`),this.emitReserved(`pong`),this._resetPingTimeout();break;case`error`:let t=Error(`server error`);t.code=e.data,this._onError(t);break;case`message`:this.emitReserved(`data`,e.data),this.emitReserved(`message`,e.data);break}}onHandshake(e){this.emitReserved(`handshake`,e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!==`closed`&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose(`ping timeout`)},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved(`drain`):this.flush()}flush(){if(this.readyState!==`closed`&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved(`flush`)}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name===`polling`&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){let n=this.writeBuffer[t].data;if(n&&(e+=qg(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,zg(()=>{this._onClose(`ping timeout`)},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket(`message`,e,t,n),this}send(e,t,n){return this._sendPacket(`message`,e,t,n),this}_sendPacket(e,t,n,r){if(typeof t==`function`&&(r=t,t=void 0),typeof n==`function`&&(r=n,n=null),this.readyState===`closing`||this.readyState===`closed`)return;n||={},n.compress=!1!==n.compress;let i={type:e,data:t,options:n};this.emitReserved(`packetCreate`,i),this.writeBuffer.push(i),r&&this.once(`flush`,r),this.flush()}close(){let e=()=>{this._onClose(`forced close`),this.transport.close()},t=()=>{this.off(`upgrade`,t),this.off(`upgradeError`,t),e()},n=()=>{this.once(`upgrade`,t),this.once(`upgradeError`,t)};return(this.readyState===`opening`||this.readyState===`open`)&&(this.readyState=`closing`,this.writeBuffer.length?this.once(`drain`,()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(t){if(e.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState===`opening`)return this.transports.shift(),this._open();this.emitReserved(`error`,t),this._onClose(`transport error`,t)}_onClose(e,t){if(this.readyState===`opening`||this.readyState===`open`||this.readyState===`closing`){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners(`close`),this.transport.close(),this.transport.removeAllListeners(),y_&&(this._beforeunloadEventListener&&removeEventListener(`beforeunload`,this._beforeunloadEventListener,!1),this._offlineEventListener)){let e=b_.indexOf(this._offlineEventListener);e!==-1&&b_.splice(e,1)}this.readyState=`closed`,this.id=null,this.emitReserved(`close`,e,t),this.writeBuffer=[],this._prevBufferLen=0}}};x_.protocol=4;var S_=class extends x_{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState===`open`&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;x_.priorWebsocketSuccess=!1;let r=()=>{n||(t.send([{type:`ping`,data:`probe`}]),t.once(`packet`,e=>{if(!n)if(e.type===`pong`&&e.data===`probe`){if(this.upgrading=!0,this.emitReserved(`upgrading`,t),!t)return;x_.priorWebsocketSuccess=t.name===`websocket`,this.transport.pause(()=>{n||this.readyState!==`closed`&&(l(),this.setTransport(t),t.send([{type:`upgrade`}]),this.emitReserved(`upgrade`,t),t=null,this.upgrading=!1,this.flush())})}else{let e=Error(`probe error`);e.transport=t.name,this.emitReserved(`upgradeError`,e)}}))};function i(){n||(n=!0,l(),t.close(),t=null)}let a=e=>{let n=Error(`probe error: `+e);n.transport=t.name,i(),this.emitReserved(`upgradeError`,n)};function o(){a(`transport closed`)}function s(){a(`socket closed`)}function c(e){t&&e.name!==t.name&&i()}let l=()=>{t.removeListener(`open`,r),t.removeListener(`error`,a),t.removeListener(`close`,o),this.off(`close`,s),this.off(`upgrading`,c)};t.once(`open`,r),t.once(`error`,a),t.once(`close`,o),this.once(`close`,s),this.once(`upgrading`,c),this._upgrades.indexOf(`webtransport`)!==-1&&e!==`webtransport`?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}},C_=class extends S_{constructor(e,t={}){let n=typeof e==`object`?e:t;(!n.transports||n.transports&&typeof n.transports[0]==`string`)&&(n.transports=(n.transports||[`polling`,`websocket`,`webtransport`]).map(e=>p_[e]).filter(e=>!!e)),super(e,n)}};C_.protocol;function w_(e,t=``,n){let r=e;n||=typeof location<`u`&&location,e??=n.protocol+`//`+n.host,typeof e==`string`&&(e.charAt(0)===`/`&&(e=e.charAt(1)===`/`?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=n===void 0?`https://`+e:n.protocol+`//`+e),r=g_(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port=`80`:/^(http|ws)s$/.test(r.protocol)&&(r.port=`443`)),r.path=r.path||`/`;let i=r.host.indexOf(`:`)===-1?r.host:`[`+r.host+`]`;return r.id=r.protocol+`://`+i+`:`+r.port+t,r.href=r.protocol+`://`+i+(n&&n.port===r.port?``:`:`+r.port),r}var T_=typeof ArrayBuffer==`function`,E_=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,D_=Object.prototype.toString,O_=typeof Blob==`function`||typeof Blob<`u`&&D_.call(Blob)===`[object BlobConstructor]`,k_=typeof File==`function`||typeof File<`u`&&D_.call(File)===`[object FileConstructor]`;function A_(e){return T_&&(e instanceof ArrayBuffer||E_(e))||O_&&e instanceof Blob||k_&&e instanceof File}function j_(e,t){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(j_(e[t]))return!0;return!1}if(A_(e))return!0;if(e.toJSON&&typeof e.toJSON==`function`&&arguments.length===1)return j_(e.toJSON(),!0);for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&j_(e[t]))return!0;return!1}function M_(e){let t=[],n=e.data,r=e;return r.data=N_(n,t),r.attachments=t.length,{packet:r,buffers:t}}function N_(e,t){if(!e)return e;if(A_(e)){let n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=N_(e[r],t);return n}else if(typeof e==`object`&&!(e instanceof Date)){let n={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=N_(e[r],t));return n}return e}function P_(e,t){return e.data=F_(e.data,t),delete e.attachments,e}function F_(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num==`number`&&e.num>=0&&e.num<t.length)return t[e.num];throw Error(`illegal attachments`)}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=F_(e[n],t);else if(typeof e==`object`)for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=F_(e[n],t));return e}var I_=c({Decoder:()=>z_,Encoder:()=>R_,PacketType:()=>Z,isPacketValid:()=>K_,protocol:()=>5}),L_=[`connect`,`connect_error`,`disconnect`,`disconnecting`,`newListener`,`removeListener`],Z;(function(e){e[e.CONNECT=0]=`CONNECT`,e[e.DISCONNECT=1]=`DISCONNECT`,e[e.EVENT=2]=`EVENT`,e[e.ACK=3]=`ACK`,e[e.CONNECT_ERROR=4]=`CONNECT_ERROR`,e[e.BINARY_EVENT=5]=`BINARY_EVENT`,e[e.BINARY_ACK=6]=`BINARY_ACK`})(Z||={});var R_=class{constructor(e){this.replacer=e}encode(e){return(e.type===Z.EVENT||e.type===Z.ACK)&&j_(e)?this.encodeAsBinary({type:e.type===Z.EVENT?Z.BINARY_EVENT:Z.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=``+e.type;return(e.type===Z.BINARY_EVENT||e.type===Z.BINARY_ACK)&&(t+=e.attachments+`-`),e.nsp&&e.nsp!==`/`&&(t+=e.nsp+`,`),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=M_(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},z_=class e extends Lg{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e==`function`?{reviver:e}:e)}add(e){let t;if(typeof e==`string`){if(this.reconstructor)throw Error(`got plaintext data when reconstructing a packet`);t=this.decodeString(e);let n=t.type===Z.BINARY_EVENT;n||t.type===Z.BINARY_ACK?(t.type=n?Z.EVENT:Z.ACK,this.reconstructor=new B_(t),t.attachments===0&&super.emitReserved(`decoded`,t)):super.emitReserved(`decoded`,t)}else if(A_(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved(`decoded`,t));else throw Error(`got binary data when not reconstructing a packet`);else throw Error(`Unknown type: `+e)}decodeString(t){let n=0,r={type:Number(t.charAt(0))};if(Z[r.type]===void 0)throw Error(`unknown packet type `+r.type);if(r.type===Z.BINARY_EVENT||r.type===Z.BINARY_ACK){let e=n+1;for(;t.charAt(++n)!==`-`&&n!=t.length;);let i=t.substring(e,n);if(i!=Number(i)||t.charAt(n)!==`-`)throw Error(`Illegal attachments`);let a=Number(i);if(!H_(a)||a<0)throw Error(`Illegal attachments`);if(a>this.opts.maxAttachments)throw Error(`too many attachments`);r.attachments=a}if(t.charAt(n+1)===`/`){let e=n+1;for(;++n&&!(t.charAt(n)===`,`||n===t.length););r.nsp=t.substring(e,n)}else r.nsp=`/`;let i=t.charAt(n+1);if(i!==``&&Number(i)==i){let e=n+1;for(;++n;){let e=t.charAt(n);if(e==null||Number(e)!=e){--n;break}if(n===t.length)break}r.id=Number(t.substring(e,n+1))}if(t.charAt(++n)){let i=this.tryParse(t.substr(n));if(e.isPayloadValid(r.type,i))r.data=i;else throw Error(`invalid payload`)}return r}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case Z.CONNECT:return W_(t);case Z.DISCONNECT:return t===void 0;case Z.CONNECT_ERROR:return typeof t==`string`||W_(t);case Z.EVENT:case Z.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&L_.indexOf(t[0])===-1);case Z.ACK:case Z.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&=(this.reconstructor.finishedReconstruction(),null)}},B_=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let e=P_(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function V_(e){return typeof e==`string`}var H_=Number.isInteger||function(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e};function U_(e){return e===void 0||H_(e)}function W_(e){return Object.prototype.toString.call(e)===`[object Object]`}function G_(e,t){switch(e){case Z.CONNECT:return t===void 0||W_(t);case Z.DISCONNECT:return t===void 0;case Z.EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&L_.indexOf(t[0])===-1);case Z.ACK:return Array.isArray(t);case Z.CONNECT_ERROR:return typeof t==`string`||W_(t);default:return!1}}function K_(e){return V_(e.nsp)&&U_(e.id)&&G_(e.type,e.data)}function q_(e,t,n){return e.on(t,n),function(){e.off(t,n)}}var J_=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),Y_=class extends Lg{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[q_(e,`open`,this.onopen.bind(this)),q_(e,`packet`,this.onpacket.bind(this)),q_(e,`error`,this.onerror.bind(this)),q_(e,`close`,this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState===`open`&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift(`message`),this.emit.apply(this,e),this}emit(e,...t){if(J_.hasOwnProperty(e))throw Error(`"`+e.toString()+`" is a reserved event name`);if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let n={type:Z.EVENT,data:t};if(n.options={},n.options.compress=this.flags.compress!==!1,typeof t[t.length-1]==`function`){let e=this.ids++,r=t.pop();this._registerAckCallback(e,r),n.id=e}let r=this.io.engine?.transport?.writable,i=this.connected&&!this.io.engine?._hasPingExpired();return this.flags.volatile&&!r||(i?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){let n=this.flags.timeout??this._opts.ackTimeout;if(n===void 0){this.acks[e]=t;return}let r=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,Error(`operation has timed out`))},n),i=(...e)=>{this.io.clearTimeoutFn(r),t.apply(this,e)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...t){return new Promise((n,r)=>{let i=(e,t)=>e?r(e):n(t);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]==`function`&&(t=e.pop());let n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>(this._queue[0],e===null?(this._queue.shift(),t&&t(null,...r)):n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth==`function`?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Z.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved(`connect_error`,e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved(`disconnect`,e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){let t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,Error(`socket has been disconnected`))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Z.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved(`connect_error`,Error(`It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)`));break;case Z.EVENT:case Z.BINARY_EVENT:this.onevent(e);break;case Z.ACK:case Z.BINARY_ACK:this.onack(e);break;case Z.DISCONNECT:this.ondisconnect();break;case Z.CONNECT_ERROR:this.destroy();let t=Error(e.data.message);t.data=e.data.data,this.emitReserved(`connect_error`,t);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]==`string`&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,n=!1;return function(...r){n||(n=!0,t.packet({type:Z.ACK,id:e,data:r}))}}onack(e){let t=this.acks[e.id];typeof t==`function`&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved(`connect`)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose(`io server disconnect`)}destroy(){this.subs&&=(this.subs.forEach(e=>e()),void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Z.DISCONNECT}),this.destroy(),this.connected&&this.onclose(`io client disconnect`),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let n of t)n.apply(this,e.data)}}};function X_(e){e||={},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}X_.prototype.duration=function(){var e=this.ms*this.factor**+ this.attempts++;if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0},X_.prototype.reset=function(){this.attempts=0},X_.prototype.setMin=function(e){this.ms=e},X_.prototype.setMax=function(e){this.max=e},X_.prototype.setJitter=function(e){this.jitter=e};var Z_=class extends Lg{constructor(e,t){super(),this.nsps={},this.subs=[],e&&typeof e==`object`&&(t=e,e=void 0),t||={},t.path=t.path||`/socket.io`,this.opts=t,Gg(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor??.5),this.backoff=new X_({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState=`closed`,this.uri=e;let n=t.parser||I_;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)==null||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)==null||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)==null||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf(`open`))return this;this.engine=new C_(this.uri,this.opts);let t=this.engine,n=this;this._readyState=`opening`,this.skipReconnect=!1;let r=q_(t,`open`,function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState=`closed`,this.emitReserved(`error`,t),e?e(t):this.maybeReconnectOnOpen()},a=q_(t,`error`,i);if(!1!==this._timeout){let e=this._timeout,n=this.setTimeoutFn(()=>{r(),i(Error(`timeout`)),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState=`open`,this.emitReserved(`open`);let e=this.engine;this.subs.push(q_(e,`ping`,this.onping.bind(this)),q_(e,`data`,this.ondata.bind(this)),q_(e,`error`,this.onerror.bind(this)),q_(e,`close`,this.onclose.bind(this)),q_(this.decoder,`decoded`,this.ondecoded.bind(this)))}onping(){this.emitReserved(`ping`)}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose(`parse error`,e)}}ondecoded(e){zg(()=>{this.emitReserved(`packet`,e)},this.setTimeoutFn)}onerror(e){this.emitReserved(`error`,e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new Y_(this,e,t),this.nsps[e]=n),n}_destroy(e){let t=Object.keys(this.nsps);for(let e of t)if(this.nsps[e].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose(`forced close`)}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),(n=this.engine)==null||n.close(),this.backoff.reset(),this._readyState=`closed`,this.emitReserved(`close`,e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved(`reconnect_failed`),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved(`reconnect_attempt`,e.backoff.attempts),!e.skipReconnect&&e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved(`reconnect_error`,t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved(`reconnect`,e)}},Q_={};function $_(e,t){typeof e==`object`&&(t=e,e=void 0),t||={};let n=w_(e,t.path||`/socket.io`),r=n.source,i=n.id,a=n.path,o=Q_[i]&&a in Q_[i].nsps,s=t.forceNew||t[`force new connection`]||!1===t.multiplex||o,c;return s?c=new Z_(r,t):(Q_[i]||(Q_[i]=new Z_(r,t)),c=Q_[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign($_,{Manager:Z_,Socket:Y_,io:$_,connect:$_});var ev=null,tv=new Map;function nv(){if(ev)return ev;let e=$_({path:`/ws/pubsub`,transports:[`websocket`]});return e.on(`connect`,()=>{for(let t of tv.keys())e.emit(`subscribe`,t)}),e.on(`data`,e=>{let t=tv.get(e.channel);if(t)for(let n of t)n(e.data)}),ev=e,e}function rv(){function e(e,t){let n=tv.get(e);n||(n=new Set,tv.set(e,n)),n.add(t);let r=nv();return r.connected&&r.emit(`subscribe`,e),()=>{let n=tv.get(e);n&&(n.delete(t),n.size===0&&(tv.delete(e),ev?.connected&&ev.emit(`unsubscribe`,e)))}}return{subscribe:e}}var iv={packages:[`@mulmoclaude/markdown-plugin`,`@mulmoclaude/form-plugin`,`@mulmochat-plugin/generate-image`],local:[]},av=Object.create,ov=Object.defineProperty,sv=Object.getOwnPropertyDescriptor,cv=Object.getOwnPropertyNames,lv=Object.getPrototypeOf,uv=Object.prototype.hasOwnProperty,dv=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),fv=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=cv(t),a=0,o=i.length,s;a<o;a++)s=i[a],!uv.call(e,s)&&s!==n&&ov(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=sv(t,s))||r.enumerable});return e},pv=(e,t,n)=>(n=e==null?{}:av(lv(e)),fv(t||!e||!e.__esModule?ov(n,`default`,{value:e,enumerable:!0}):n,e)),mv=dv(((e,t)=>{function n(e){return e==null}function r(e){return typeof e==`object`&&!!e}function i(e){return Array.isArray(e)?e:n(e)?[]:[e]}function a(e,t){if(t){let n=Object.keys(t);for(let r=0,i=n.length;r<i;r+=1){let i=n[r];e[i]=t[i]}}return e}function o(e,t){let n=``;for(let r=0;r<t;r+=1)n+=e;return n}function s(e){return e===0&&1/e==-1/0}t.exports.isNothing=n,t.exports.isObject=r,t.exports.toArray=i,t.exports.repeat=o,t.exports.isNegativeZero=s,t.exports.extend=a})),hv=dv(((e,t)=>{function n(e,t){let n=``,r=e.reason||`(unknown reason)`;return e.mark?(e.mark.name&&(n+=`in "`+e.mark.name+`" `),n+=`(`+(e.mark.line+1)+`:`+(e.mark.column+1)+`)`,!t&&e.mark.snippet&&(n+=`
39
+
40
+ `+e.mark.snippet),r+` `+n):r}function r(e,t){Error.call(this),this.name=`YAMLException`,this.reason=e,this.mark=t,this.message=n(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=Error().stack||``}r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r.prototype.toString=function(e){return this.name+`: `+n(this,e)},t.exports=r})),gv=dv(((e,t)=>{var n=mv();function r(e,t,n,r,i){let a=``,o=``,s=Math.floor(i/2)-1;return r-t>s&&(a=` ... `,t=r-s+a.length),n-r>s&&(o=` ...`,n=r+s-o.length),{str:a+e.slice(t,n).replace(/\t/g,`→`)+o,pos:r-t+a.length}}function i(e,t){return n.repeat(` `,t-e.length)+e}function a(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||=79,typeof t.indent!=`number`&&(t.indent=1),typeof t.linesBefore!=`number`&&(t.linesBefore=3),typeof t.linesAfter!=`number`&&(t.linesAfter=2);let a=/\r?\n|\r|\0/g,o=[0],s=[],c,l=-1;for(;c=a.exec(e.buffer);)s.push(c.index),o.push(c.index+c[0].length),e.position<=c.index&&l<0&&(l=o.length-2);l<0&&(l=o.length-1);let u=``,d=Math.min(e.line+t.linesAfter,s.length).toString().length,f=t.maxLength-(t.indent+d+3);for(let a=1;a<=t.linesBefore&&!(l-a<0);a++){let c=r(e.buffer,o[l-a],s[l-a],e.position-(o[l]-o[l-a]),f);u=n.repeat(` `,t.indent)+i((e.line-a+1).toString(),d)+` | `+c.str+`
41
+ `+u}let p=r(e.buffer,o[l],s[l],e.position,f);u+=n.repeat(` `,t.indent)+i((e.line+1).toString(),d)+` | `+p.str+`
42
+ `,u+=n.repeat(`-`,t.indent+d+3+p.pos)+`^
43
+ `;for(let a=1;a<=t.linesAfter&&!(l+a>=s.length);a++){let c=r(e.buffer,o[l+a],s[l+a],e.position-(o[l]-o[l+a]),f);u+=n.repeat(` `,t.indent)+i((e.line+a+1).toString(),d)+` | `+c.str+`
44
+ `}return u.replace(/\n$/,``)}t.exports=a})),_v=dv(((e,t)=>{var n=hv(),r=[`kind`,`multi`,`resolve`,`construct`,`instanceOf`,`predicate`,`represent`,`representName`,`defaultStyle`,`styleAliases`],i=[`scalar`,`sequence`,`mapping`];function a(e){let t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(e){t[String(e)]=n})}),t}function o(e,t){if(t||={},Object.keys(t).forEach(function(t){if(r.indexOf(t)===-1)throw new n(`Unknown option "`+t+`" is met in definition of "`+e+`" YAML type.`)}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=a(t.styleAliases||null),i.indexOf(this.kind)===-1)throw new n(`Unknown kind "`+this.kind+`" is specified for "`+e+`" YAML type.`)}t.exports=o})),vv=dv(((e,t)=>{var n=hv(),r=_v();function i(e,t){let n=[];return e[t].forEach(function(e){let t=n.length;n.forEach(function(n,r){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=r)}),n[t]=e}),n}function a(){let e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function t(t){t.multi?(e.multi[t.kind].push(t),e.multi.fallback.push(t)):e[t.kind][t.tag]=e.fallback[t.tag]=t}for(let e=0,n=arguments.length;e<n;e+=1)arguments[e].forEach(t);return e}function o(e){return this.extend(e)}o.prototype.extend=function(e){let t=[],s=[];if(e instanceof r)s.push(e);else if(Array.isArray(e))s=s.concat(e);else if(e&&(Array.isArray(e.implicit)||Array.isArray(e.explicit)))e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(s=s.concat(e.explicit));else throw new n(`Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })`);t.forEach(function(e){if(!(e instanceof r))throw new n(`Specified list of YAML types (or a single Type object) contains a non-Type object.`);if(e.loadKind&&e.loadKind!==`scalar`)throw new n(`There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.`);if(e.multi)throw new n(`There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.`)}),s.forEach(function(e){if(!(e instanceof r))throw new n(`Specified list of YAML types (or a single Type object) contains a non-Type object.`)});let c=Object.create(o.prototype);return c.implicit=(this.implicit||[]).concat(t),c.explicit=(this.explicit||[]).concat(s),c.compiledImplicit=i(c,`implicit`),c.compiledExplicit=i(c,`explicit`),c.compiledTypeMap=a(c.compiledImplicit,c.compiledExplicit),c},t.exports=o})),yv=dv(((e,t)=>{t.exports=new(_v())(`tag:yaml.org,2002:str`,{kind:`scalar`,construct:function(e){return e===null?``:e}})})),bv=dv(((e,t)=>{t.exports=new(_v())(`tag:yaml.org,2002:seq`,{kind:`sequence`,construct:function(e){return e===null?[]:e}})})),xv=dv(((e,t)=>{t.exports=new(_v())(`tag:yaml.org,2002:map`,{kind:`mapping`,construct:function(e){return e===null?{}:e}})})),Sv=dv(((e,t)=>{t.exports=new(vv())({explicit:[yv(),bv(),xv()]})})),Cv=dv(((e,t)=>{var n=_v();function r(e){if(e===null)return!0;let t=e.length;return t===1&&e===`~`||t===4&&(e===`null`||e===`Null`||e===`NULL`)}function i(){return null}function a(e){return e===null}t.exports=new n(`tag:yaml.org,2002:null`,{kind:`scalar`,resolve:r,construct:i,predicate:a,represent:{canonical:function(){return`~`},lowercase:function(){return`null`},uppercase:function(){return`NULL`},camelcase:function(){return`Null`},empty:function(){return``}},defaultStyle:`lowercase`})})),wv=dv(((e,t)=>{var n=_v();function r(e){if(e===null)return!1;let t=e.length;return t===4&&(e===`true`||e===`True`||e===`TRUE`)||t===5&&(e===`false`||e===`False`||e===`FALSE`)}function i(e){return e===`true`||e===`True`||e===`TRUE`}function a(e){return Object.prototype.toString.call(e)===`[object Boolean]`}t.exports=new n(`tag:yaml.org,2002:bool`,{kind:`scalar`,resolve:r,construct:i,predicate:a,represent:{lowercase:function(e){return e?`true`:`false`},uppercase:function(e){return e?`TRUE`:`FALSE`},camelcase:function(e){return e?`True`:`False`}},defaultStyle:`lowercase`})})),Tv=dv(((e,t)=>{var n=mv(),r=_v();function i(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function a(e){return e>=48&&e<=55}function o(e){return e>=48&&e<=57}function s(e){if(e===null)return!1;let t=e.length,n=0,r=!1;if(!t)return!1;let s=e[n];if((s===`-`||s===`+`)&&(s=e[++n]),s===`0`){if(n+1===t)return!0;if(s=e[++n],s===`b`){for(n++;n<t;n++){if(s=e[n],s!==`0`&&s!==`1`)return!1;r=!0}return r&&Number.isFinite(c(e))}if(s===`x`){for(n++;n<t;n++){if(!i(e.charCodeAt(n)))return!1;r=!0}return r&&Number.isFinite(c(e))}if(s===`o`){for(n++;n<t;n++){if(!a(e.charCodeAt(n)))return!1;r=!0}return r&&Number.isFinite(c(e))}}for(;n<t;n++){if(!o(e.charCodeAt(n)))return!1;r=!0}return r?Number.isFinite(c(e)):!1}function c(e){let t=e,n=1,r=t[0];if((r===`-`||r===`+`)&&(r===`-`&&(n=-1),t=t.slice(1),r=t[0]),t===`0`)return 0;if(r===`0`){if(t[1]===`b`)return n*parseInt(t.slice(2),2);if(t[1]===`x`)return n*parseInt(t.slice(2),16);if(t[1]===`o`)return n*parseInt(t.slice(2),8)}return n*parseInt(t,10)}function l(e){return c(e)}function u(e){return Object.prototype.toString.call(e)===`[object Number]`&&e%1==0&&!n.isNegativeZero(e)}t.exports=new r(`tag:yaml.org,2002:int`,{kind:`scalar`,resolve:s,construct:l,predicate:u,represent:{binary:function(e){return e>=0?`0b`+e.toString(2):`-0b`+e.toString(2).slice(1)},octal:function(e){return e>=0?`0o`+e.toString(8):`-0o`+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?`0x`+e.toString(16).toUpperCase():`-0x`+e.toString(16).toUpperCase().slice(1)}},defaultStyle:`decimal`,styleAliases:{binary:[2,`bin`],octal:[8,`oct`],decimal:[10,`dec`],hexadecimal:[16,`hex`]}})})),Ev=dv(((e,t)=>{var n=mv(),r=_v(),i=RegExp(`^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`),a=RegExp(`^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`);function o(e){return e===null||!i.test(e)?!1:Number.isFinite(parseFloat(e,10))?!0:a.test(e)}function s(e){let t=e.toLowerCase(),n=t[0]===`-`?-1:1;return`+-`.indexOf(t[0])>=0&&(t=t.slice(1)),t===`.inf`?n===1?1/0:-1/0:t===`.nan`?NaN:n*parseFloat(t,10)}var c=/^[-+]?[0-9]+e/;function l(e,t){if(isNaN(e))switch(t){case`lowercase`:return`.nan`;case`uppercase`:return`.NAN`;case`camelcase`:return`.NaN`}else if(e===1/0)switch(t){case`lowercase`:return`.inf`;case`uppercase`:return`.INF`;case`camelcase`:return`.Inf`}else if(e===-1/0)switch(t){case`lowercase`:return`-.inf`;case`uppercase`:return`-.INF`;case`camelcase`:return`-.Inf`}else if(n.isNegativeZero(e))return`-0.0`;let r=e.toString(10);return c.test(r)?r.replace(`e`,`.e`):r}function u(e){return Object.prototype.toString.call(e)===`[object Number]`&&(e%1!=0||n.isNegativeZero(e))}t.exports=new r(`tag:yaml.org,2002:float`,{kind:`scalar`,resolve:o,construct:s,predicate:u,represent:l,defaultStyle:`lowercase`})})),Dv=dv(((e,t)=>{t.exports=Sv().extend({implicit:[Cv(),wv(),Tv(),Ev()]})})),Ov=dv(((e,t)=>{t.exports=Dv()})),kv=dv(((e,t)=>{var n=_v(),r=RegExp(`^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$`),i=RegExp(`^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$`);function a(e){return e===null?!1:r.exec(e)!==null||i.exec(e)!==null}function o(e){let t=0,n=null,a=r.exec(e);if(a===null&&(a=i.exec(e)),a===null)throw Error(`Date resolve error`);let o=+a[1],s=a[2]-1,c=+a[3];if(!a[4])return new Date(Date.UTC(o,s,c));let l=+a[4],u=+a[5],d=+a[6];if(a[7]){for(t=a[7].slice(0,3);t.length<3;)t+=`0`;t=+t}if(a[9]){let e=+a[10],t=+(a[11]||0);n=(e*60+t)*6e4,a[9]===`-`&&(n=-n)}let f=new Date(Date.UTC(o,s,c,l,u,d,t));return n&&f.setTime(f.getTime()-n),f}function s(e){return e.toISOString()}t.exports=new n(`tag:yaml.org,2002:timestamp`,{kind:`scalar`,resolve:a,construct:o,instanceOf:Date,represent:s})})),Av=dv(((e,t)=>{var n=_v();function r(e){return e===`<<`||e===null}t.exports=new n(`tag:yaml.org,2002:merge`,{kind:`scalar`,resolve:r})})),jv=dv(((e,t)=>{var n=_v(),r=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
45
+ \r`;function i(e){if(e===null)return!1;let t=0,n=e.length,i=r;for(let r=0;r<n;r++){let n=i.indexOf(e.charAt(r));if(!(n>64)){if(n<0)return!1;t+=6}}return t%8==0}function a(e){let t=e.replace(/[\r\n=]/g,``),n=t.length,i=r,a=0,o=[];for(let e=0;e<n;e++)e%4==0&&e&&(o.push(a>>16&255),o.push(a>>8&255),o.push(a&255)),a=a<<6|i.indexOf(t.charAt(e));let s=n%4*6;return s===0?(o.push(a>>16&255),o.push(a>>8&255),o.push(a&255)):s===18?(o.push(a>>10&255),o.push(a>>2&255)):s===12&&o.push(a>>4&255),new Uint8Array(o)}function o(e){let t=``,n=0,i=e.length,a=r;for(let r=0;r<i;r++)r%3==0&&r&&(t+=a[n>>18&63],t+=a[n>>12&63],t+=a[n>>6&63],t+=a[n&63]),n=(n<<8)+e[r];let o=i%3;return o===0?(t+=a[n>>18&63],t+=a[n>>12&63],t+=a[n>>6&63],t+=a[n&63]):o===2?(t+=a[n>>10&63],t+=a[n>>4&63],t+=a[n<<2&63],t+=a[64]):o===1&&(t+=a[n>>2&63],t+=a[n<<4&63],t+=a[64],t+=a[64]),t}function s(e){return Object.prototype.toString.call(e)===`[object Uint8Array]`}t.exports=new n(`tag:yaml.org,2002:binary`,{kind:`scalar`,resolve:i,construct:a,predicate:s,represent:o})})),Mv=dv(((e,t)=>{var n=_v(),r=Object.prototype.hasOwnProperty,i=Object.prototype.toString;function a(e){if(e===null)return!0;let t=[],n=e;for(let e=0,a=n.length;e<a;e+=1){let a=n[e],o=!1;if(i.call(a)!==`[object Object]`)return!1;let s;for(s in a)if(r.call(a,s))if(!o)o=!0;else return!1;if(!o)return!1;if(t.indexOf(s)===-1)t.push(s);else return!1}return!0}function o(e){return e===null?[]:e}t.exports=new n(`tag:yaml.org,2002:omap`,{kind:`sequence`,resolve:a,construct:o})})),Nv=dv(((e,t)=>{var n=_v(),r=Object.prototype.toString;function i(e){if(e===null)return!0;let t=e,n=Array(t.length);for(let e=0,i=t.length;e<i;e+=1){let i=t[e];if(r.call(i)!==`[object Object]`)return!1;let a=Object.keys(i);if(a.length!==1)return!1;n[e]=[a[0],i[a[0]]]}return!0}function a(e){if(e===null)return[];let t=e,n=Array(t.length);for(let e=0,r=t.length;e<r;e+=1){let r=t[e],i=Object.keys(r);n[e]=[i[0],r[i[0]]]}return n}t.exports=new n(`tag:yaml.org,2002:pairs`,{kind:`sequence`,resolve:i,construct:a})})),Pv=dv(((e,t)=>{var n=_v(),r=Object.prototype.hasOwnProperty;function i(e){if(e===null)return!0;let t=e;for(let e in t)if(r.call(t,e)&&t[e]!==null)return!1;return!0}function a(e){return e===null?{}:e}t.exports=new n(`tag:yaml.org,2002:set`,{kind:`mapping`,resolve:i,construct:a})})),Fv=dv(((e,t)=>{t.exports=Ov().extend({implicit:[kv(),Av()],explicit:[jv(),Mv(),Nv(),Pv()]})})),Iv=dv(((e,t)=>{var n=mv(),r=hv(),i=gv(),a=Fv(),o=Object.prototype.hasOwnProperty,s=1,c=2,l=3,u=4,d=1,f=2,p=3,m=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,h=/[\x85\u2028\u2029]/,g=/[,\[\]{}]/,_=/^(?:!|!!|![0-9A-Za-z-]+!)$/,v=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function y(e){return Object.prototype.toString.call(e)}function b(e){return e===10||e===13}function x(e){return e===9||e===32}function S(e){return e===9||e===32||e===10||e===13}function C(e){return e===44||e===91||e===93||e===123||e===125}function ee(e){if(e>=48&&e<=57)return e-48;let t=e|32;return t>=97&&t<=102?t-97+10:-1}function te(e){return e===120?2:e===117?4:e===85?8:0}function ne(e){return e>=48&&e<=57?e-48:-1}function w(e){switch(e){case 48:return`\0`;case 97:return`\x07`;case 98:return`\b`;case 116:return` `;case 9:return` `;case 110:return`
46
+ `;case 118:return`\v`;case 102:return`\f`;case 114:return`\r`;case 101:return`\x1B`;case 32:return` `;case 34:return`"`;case 47:return`/`;case 92:return`\\`;case 78:return`…`;case 95:return`\xA0`;case 76:return`\u2028`;case 80:return`\u2029`;default:return``}}function T(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function E(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}var D=Array(256),re=Array(256);for(let e=0;e<256;e++)D[e]=+!!w(e),re[e]=w(e);function O(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||a,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.maxDepth=typeof t.maxDepth==`number`?t.maxDepth:100,this.maxMergeSeqLength=typeof t.maxMergeSeqLength==`number`?t.maxMergeSeqLength:20,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function k(e,t){let n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=i(n),new r(t,n)}function A(e,t){throw k(e,t)}function j(e,t){e.onWarning&&e.onWarning.call(null,k(e,t))}function ie(e,t,n){let r=e.anchorMapTransactions;if(r.length!==0){let n=r[r.length-1];o.call(n,t)||(n[t]={existed:o.call(e.anchorMap,t),value:e.anchorMap[t]})}e.anchorMap[t]=n}function ae(e){e.anchorMapTransactions.push(Object.create(null))}function oe(e){let t=e.anchorMapTransactions.pop(),n=e.anchorMapTransactions;if(n.length===0)return;let r=n[n.length-1],i=Object.keys(t);for(let e=0,n=i.length;e<n;e+=1){let n=i[e];o.call(r,n)||(r[n]=t[n])}}function se(e){let t=e.anchorMapTransactions.pop(),n=Object.keys(t);for(let r=n.length-1;r>=0;--r){let i=t[n[r]];i.existed?e.anchorMap[n[r]]=i.value:delete e.anchorMap[n[r]]}}function ce(e){return{position:e.position,line:e.line,lineStart:e.lineStart,lineIndent:e.lineIndent,firstTabInLine:e.firstTabInLine,tag:e.tag,anchor:e.anchor,kind:e.kind,result:e.result}}function le(e,t){e.position=t.position,e.line=t.line,e.lineStart=t.lineStart,e.lineIndent=t.lineIndent,e.firstTabInLine=t.firstTabInLine,e.tag=t.tag,e.anchor=t.anchor,e.kind=t.kind,e.result=t.result}var ue={YAML:function(e,t,n){e.version!==null&&A(e,`duplication of %YAML directive`),n.length!==1&&A(e,`YAML directive accepts exactly one argument`);let r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]);r===null&&A(e,`ill-formed argument of the YAML directive`);let i=parseInt(r[1],10),a=parseInt(r[2],10);i!==1&&A(e,`unacceptable YAML version of the document`),e.version=n[0],e.checkLineBreaks=a<2,a!==1&&a!==2&&j(e,`unsupported YAML version of the document`)},TAG:function(e,t,n){let r;n.length!==2&&A(e,`TAG directive accepts exactly two arguments`);let i=n[0];r=n[1],_.test(i)||A(e,`ill-formed tag handle (first argument) of the TAG directive`),o.call(e.tagMap,i)&&A(e,`there is a previously declared suffix for "`+i+`" tag handle`),v.test(r)||A(e,`ill-formed tag prefix (second argument) of the TAG directive`);try{r=decodeURIComponent(r)}catch{A(e,`tag prefix is malformed: `+r)}e.tagMap[i]=r}};function de(e,t,n,r){if(t<n){let i=e.input.slice(t,n);if(r)for(let t=0,n=i.length;t<n;t+=1){let n=i.charCodeAt(t);n===9||n>=32&&n<=1114111||A(e,`expected valid JSON character`)}else m.test(i)&&A(e,`the stream contains non-printable characters`);e.result+=i}}function fe(e,t,r,i){n.isObject(r)||A(e,`cannot merge mappings; the provided source object is unacceptable`);let a=Object.keys(r);for(let e=0,n=a.length;e<n;e+=1){let n=a[e];o.call(t,n)||(E(t,n,r[n]),i[n]=!0)}}function pe(e,t,n,r,i,a,s,c,l){if(Array.isArray(i)){i=Array.prototype.slice.call(i);for(let t=0,n=i.length;t<n;t+=1)Array.isArray(i[t])&&A(e,`nested arrays are not supported inside keys`),typeof i==`object`&&y(i[t])===`[object Object]`&&(i[t]=`[object Object]`)}if(typeof i==`object`&&y(i)===`[object Object]`&&(i=`[object Object]`),i=String(i),t===null&&(t={}),r===`tag:yaml.org,2002:merge`)if(Array.isArray(a)){a.length>e.maxMergeSeqLength&&A(e,`merge sequence length exceeded maxMergeSeqLength (`+e.maxMergeSeqLength+`)`);let r=new Set;for(let i=0,o=a.length;i<o;i+=1){let o=a[i];r.has(o)||(r.add(o),fe(e,t,o,n))}}else fe(e,t,a,n);else !e.json&&!o.call(n,i)&&o.call(t,i)&&(e.line=s||e.line,e.lineStart=c||e.lineStart,e.position=l||e.position,A(e,`duplicated mapping key`)),E(t,i,a),delete n[i];return t}function me(e){let t=e.input.charCodeAt(e.position);t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):A(e,`a line break is expected`),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function M(e,t,n){let r=0,i=e.input.charCodeAt(e.position);for(;i!==0;){for(;x(i);)i===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),i=e.input.charCodeAt(++e.position);if(t&&i===35)do i=e.input.charCodeAt(++e.position);while(i!==10&&i!==13&&i!==0);if(b(i))for(me(e),i=e.input.charCodeAt(e.position),r++,e.lineIndent=0;i===32;)e.lineIndent++,i=e.input.charCodeAt(++e.position);else break}return n!==-1&&r!==0&&e.lineIndent<n&&j(e,`deficient indentation`),r}function he(e){let t=e.position,n=e.input.charCodeAt(t);return!!((n===45||n===46)&&n===e.input.charCodeAt(t+1)&&n===e.input.charCodeAt(t+2)&&(t+=3,n=e.input.charCodeAt(t),n===0||S(n)))}function ge(e,t){t===1?e.result+=` `:t>1&&(e.result+=n.repeat(`
47
+ `,t-1))}function _e(e,t,n){let r,i,a,o,s,c,l=e.kind,u=e.result,d=e.input.charCodeAt(e.position);if(S(d)||C(d)||d===35||d===38||d===42||d===33||d===124||d===62||d===39||d===34||d===37||d===64||d===96)return!1;if(d===63||d===45){let t=e.input.charCodeAt(e.position+1);if(S(t)||n&&C(t))return!1}for(e.kind=`scalar`,e.result=``,r=i=e.position,a=!1;d!==0;){if(d===58){let t=e.input.charCodeAt(e.position+1);if(S(t)||n&&C(t))break}else if(d===35){if(S(e.input.charCodeAt(e.position-1)))break}else if(e.position===e.lineStart&&he(e)||n&&C(d))break;else if(b(d))if(o=e.line,s=e.lineStart,c=e.lineIndent,M(e,!1,-1),e.lineIndent>=t){a=!0,d=e.input.charCodeAt(e.position);continue}else{e.position=i,e.line=o,e.lineStart=s,e.lineIndent=c;break}a&&=(de(e,r,i,!1),ge(e,e.line-o),r=i=e.position,!1),x(d)||(i=e.position+1),d=e.input.charCodeAt(++e.position)}return de(e,r,i,!1),e.result?!0:(e.kind=l,e.result=u,!1)}function ve(e,t){let n,r,i=e.input.charCodeAt(e.position);if(i!==39)return!1;for(e.kind=`scalar`,e.result=``,e.position++,n=r=e.position;(i=e.input.charCodeAt(e.position))!==0;)if(i===39)if(de(e,n,e.position,!0),i=e.input.charCodeAt(++e.position),i===39)n=e.position,e.position++,r=e.position;else return!0;else b(i)?(de(e,n,r,!0),ge(e,M(e,!1,t)),n=r=e.position):e.position===e.lineStart&&he(e)?A(e,`unexpected end of the document within a single quoted scalar`):(e.position++,x(i)||(r=e.position));A(e,`unexpected end of the stream within a single quoted scalar`)}function ye(e,t){let n,r,i,a=e.input.charCodeAt(e.position);if(a!==34)return!1;for(e.kind=`scalar`,e.result=``,e.position++,n=r=e.position;(a=e.input.charCodeAt(e.position))!==0;)if(a===34)return de(e,n,e.position,!0),e.position++,!0;else if(a===92){if(de(e,n,e.position,!0),a=e.input.charCodeAt(++e.position),b(a))M(e,!1,t);else if(a<256&&D[a])e.result+=re[a],e.position++;else if((i=te(a))>0){let t=i,n=0;for(;t>0;t--)a=e.input.charCodeAt(++e.position),(i=ee(a))>=0?n=(n<<4)+i:A(e,`expected hexadecimal character`);e.result+=T(n),e.position++}else A(e,`unknown escape sequence`);n=r=e.position}else b(a)?(de(e,n,r,!0),ge(e,M(e,!1,t)),n=r=e.position):e.position===e.lineStart&&he(e)?A(e,`unexpected end of the document within a double quoted scalar`):(e.position++,x(a)||(r=e.position));A(e,`unexpected end of the stream within a double quoted scalar`)}function be(e,t){let n=!0,r,i,a,o=e.tag,c,l=e.anchor,u,d,f,p,m=Object.create(null),h,g,_,v=e.input.charCodeAt(e.position);if(v===91)u=93,p=!1,c=[];else if(v===123)u=125,p=!0,c={};else return!1;for(e.anchor!==null&&ie(e,e.anchor,c),v=e.input.charCodeAt(++e.position);v!==0;){if(M(e,!0,t),v=e.input.charCodeAt(e.position),v===u)return e.position++,e.tag=o,e.anchor=l,e.kind=p?`mapping`:`sequence`,e.result=c,!0;n?v===44&&A(e,`expected the node content, but found ','`):A(e,`missed comma between flow collection entries`),g=h=_=null,d=f=!1,v===63&&S(e.input.charCodeAt(e.position+1))&&(d=f=!0,e.position++,M(e,!0,t)),r=e.line,i=e.lineStart,a=e.position,Oe(e,t,s,!1,!0),g=e.tag,h=e.result,M(e,!0,t),v=e.input.charCodeAt(e.position),(f||e.line===r)&&v===58&&(d=!0,v=e.input.charCodeAt(++e.position),M(e,!0,t),Oe(e,t,s,!1,!0),_=e.result),p?pe(e,c,m,g,h,_,r,i,a):d?c.push(pe(e,null,m,g,h,_,r,i,a)):c.push(h),M(e,!0,t),v=e.input.charCodeAt(e.position),v===44?(n=!0,v=e.input.charCodeAt(++e.position)):n=!1}A(e,`unexpected end of the stream within a flow collection`)}function xe(e,t){let r,i=d,a=!1,o=!1,s=t,c=0,l=!1,u,m=e.input.charCodeAt(e.position);if(m===124)r=!1;else if(m===62)r=!0;else return!1;for(e.kind=`scalar`,e.result=``;m!==0;)if(m=e.input.charCodeAt(++e.position),m===43||m===45)d===i?i=m===43?p:f:A(e,`repeat of a chomping mode identifier`);else if((u=ne(m))>=0)u===0?A(e,`bad explicit indentation width of a block scalar; it cannot be less than one`):o?A(e,`repeat of an indentation width identifier`):(s=t+u-1,o=!0);else break;if(x(m)){do m=e.input.charCodeAt(++e.position);while(x(m));if(m===35)do m=e.input.charCodeAt(++e.position);while(!b(m)&&m!==0)}for(;m!==0;){for(me(e),e.lineIndent=0,m=e.input.charCodeAt(e.position);(!o||e.lineIndent<s)&&m===32;)e.lineIndent++,m=e.input.charCodeAt(++e.position);if(!o&&e.lineIndent>s&&(s=e.lineIndent),b(m)){c++;continue}if(!o&&s===0&&A(e,`missing indentation for block scalar`),e.lineIndent<s){i===p?e.result+=n.repeat(`
48
+ `,a?1+c:c):i===d&&a&&(e.result+=`
49
+ `);break}r?x(m)?(l=!0,e.result+=n.repeat(`
50
+ `,a?1+c:c)):l?(l=!1,e.result+=n.repeat(`
51
+ `,c+1)):c===0?a&&(e.result+=` `):e.result+=n.repeat(`
52
+ `,c):e.result+=n.repeat(`
53
+ `,a?1+c:c),a=!0,o=!0,c=0;let t=e.position;for(;!b(m)&&m!==0;)m=e.input.charCodeAt(++e.position);de(e,t,e.position,!1)}return!0}function Se(e,t){let n=e.tag,r=e.anchor,i=[],a=!1;if(e.firstTabInLine!==-1)return!1;e.anchor!==null&&ie(e,e.anchor,i);let o=e.input.charCodeAt(e.position);for(;o!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,A(e,`tab characters must not be used in indentation`)),!(o!==45||!S(e.input.charCodeAt(e.position+1))));){if(a=!0,e.position++,M(e,!0,-1)&&e.lineIndent<=t){i.push(null),o=e.input.charCodeAt(e.position);continue}let n=e.line;if(Oe(e,t,l,!1,!0),i.push(e.result),M(e,!0,-1),o=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&o!==0)A(e,`bad indentation of a sequence entry`);else if(e.lineIndent<t)break}return a?(e.tag=n,e.anchor=r,e.kind=`sequence`,e.result=i,!0):!1}function Ce(e,t,n){let r,i,a,o,s=e.tag,l=e.anchor,d={},f=Object.create(null),p=null,m=null,h=null,g=!1,_=!1;if(e.firstTabInLine!==-1)return!1;e.anchor!==null&&ie(e,e.anchor,d);let v=e.input.charCodeAt(e.position);for(;v!==0;){!g&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,A(e,`tab characters must not be used in indentation`));let y=e.input.charCodeAt(e.position+1),b=e.line;if((v===63||v===58)&&S(y))v===63?(g&&(pe(e,d,f,p,m,null,i,a,o),p=m=h=null),_=!0,g=!0,r=!0):g?(g=!1,r=!0):A(e,`incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line`),e.position+=1,v=y;else{if(i=e.line,a=e.lineStart,o=e.position,!Oe(e,n,c,!1,!0))break;if(e.line===b){for(v=e.input.charCodeAt(e.position);x(v);)v=e.input.charCodeAt(++e.position);if(v===58)v=e.input.charCodeAt(++e.position),S(v)||A(e,`a whitespace character is expected after the key-value separator within a block mapping`),g&&(pe(e,d,f,p,m,null,i,a,o),p=m=h=null),_=!0,g=!1,r=!1,p=e.tag,m=e.result;else if(_)A(e,`can not read an implicit mapping pair; a colon is missed`);else return e.tag=s,e.anchor=l,!0}else if(_)A(e,`can not read a block mapping entry; a multiline key may not be an implicit key`);else return e.tag=s,e.anchor=l,!0}if((e.line===b||e.lineIndent>t)&&(g&&(i=e.line,a=e.lineStart,o=e.position),Oe(e,t,u,!0,r)&&(g?m=e.result:h=e.result),g||(pe(e,d,f,p,m,h,i,a,o),p=m=h=null),M(e,!0,-1),v=e.input.charCodeAt(e.position)),(e.line===b||e.lineIndent>t)&&v!==0)A(e,`bad indentation of a mapping entry`);else if(e.lineIndent<t)break}return g&&pe(e,d,f,p,m,null,i,a,o),_&&(e.tag=s,e.anchor=l,e.kind=`mapping`,e.result=d),_}function we(e){let t=!1,n=!1,r,i,a=e.input.charCodeAt(e.position);if(a!==33)return!1;e.tag!==null&&A(e,`duplication of a tag property`),a=e.input.charCodeAt(++e.position),a===60?(t=!0,a=e.input.charCodeAt(++e.position)):a===33?(n=!0,r=`!!`,a=e.input.charCodeAt(++e.position)):r=`!`;let s=e.position;if(t){do a=e.input.charCodeAt(++e.position);while(a!==0&&a!==62);e.position<e.length?(i=e.input.slice(s,e.position),a=e.input.charCodeAt(++e.position)):A(e,`unexpected end of the stream within a verbatim tag`)}else{for(;a!==0&&!S(a);)a===33&&(n?A(e,`tag suffix cannot contain exclamation marks`):(r=e.input.slice(s-1,e.position+1),_.test(r)||A(e,`named tag handle cannot contain such characters`),n=!0,s=e.position+1)),a=e.input.charCodeAt(++e.position);i=e.input.slice(s,e.position),g.test(i)&&A(e,`tag suffix cannot contain flow indicator characters`)}i&&!v.test(i)&&A(e,`tag name cannot contain such characters: `+i);try{i=decodeURIComponent(i)}catch{A(e,`tag name is malformed: `+i)}return t?e.tag=i:o.call(e.tagMap,r)?e.tag=e.tagMap[r]+i:r===`!`?e.tag=`!`+i:r===`!!`?e.tag=`tag:yaml.org,2002:`+i:A(e,`undeclared tag handle "`+r+`"`),!0}function Te(e){let t=e.input.charCodeAt(e.position);if(t!==38)return!1;e.anchor!==null&&A(e,`duplication of an anchor property`),t=e.input.charCodeAt(++e.position);let n=e.position;for(;t!==0&&!S(t)&&!C(t);)t=e.input.charCodeAt(++e.position);return e.position===n&&A(e,`name of an anchor node must contain at least one character`),e.anchor=e.input.slice(n,e.position),!0}function Ee(e){let t=e.input.charCodeAt(e.position);if(t!==42)return!1;t=e.input.charCodeAt(++e.position);let n=e.position;for(;t!==0&&!S(t)&&!C(t);)t=e.input.charCodeAt(++e.position);e.position===n&&A(e,`name of an alias node must contain at least one character`);let r=e.input.slice(n,e.position);return o.call(e.anchorMap,r)||A(e,`unidentified alias "`+r+`"`),e.result=e.anchorMap[r],M(e,!0,-1),!0}function De(e,t,n,r){let i=ce(e);return ae(e),le(e,t),e.tag=null,e.anchor=null,e.kind=null,e.result=null,Ce(e,n,r)&&e.kind===`mapping`?(oe(e),!0):(se(e),le(e,i),!1)}function Oe(e,t,n,r,i){let a,d,f=1,p=!1,m=!1,h=null,g,_,v;e.depth>=e.maxDepth&&A(e,`nesting exceeded maxDepth (`+e.maxDepth+`)`),e.depth+=1,e.listener!==null&&e.listener(`open`,e),e.tag=null,e.anchor=null,e.kind=null,e.result=null;let y=a=d=u===n||l===n;if(r&&M(e,!0,-1)&&(p=!0,e.lineIndent>t?f=1:e.lineIndent===t?f=0:e.lineIndent<t&&(f=-1)),f===1)for(;;){let n=e.input.charCodeAt(e.position),r=ce(e);if(p&&(n===33&&e.tag!==null||n===38&&e.anchor!==null)||!we(e)&&!Te(e))break;h===null&&(h=r),M(e,!0,-1)?(p=!0,d=y,e.lineIndent>t?f=1:e.lineIndent===t?f=0:e.lineIndent<t&&(f=-1)):d=!1}if(d&&=p||i,f===1||u===n)if(_=s===n||c===n?t:t+1,v=e.position-e.lineStart,f===1)if(d&&(Se(e,v)||Ce(e,v,_))||be(e,_))m=!0;else{let t=e.input.charCodeAt(e.position);h!==null&&y&&!d&&t!==124&&t!==62&&De(e,h,h.position-h.lineStart,_)||a&&xe(e,_)||ve(e,_)||ye(e,_)?m=!0:Ee(e)?(m=!0,(e.tag!==null||e.anchor!==null)&&A(e,`alias node should not have any properties`)):_e(e,_,s===n)&&(m=!0,e.tag===null&&(e.tag=`?`)),e.anchor!==null&&ie(e,e.anchor,e.result)}else f===0&&(m=d&&Se(e,v));if(e.tag===null)e.anchor!==null&&ie(e,e.anchor,e.result);else if(e.tag===`?`){e.result!==null&&e.kind!==`scalar`&&A(e,`unacceptable node kind for !<?> tag; it should be "scalar", not "`+e.kind+`"`);for(let t=0,n=e.implicitTypes.length;t<n;t+=1)if(g=e.implicitTypes[t],g.resolve(e.result)){e.result=g.construct(e.result),e.tag=g.tag,e.anchor!==null&&ie(e,e.anchor,e.result);break}}else if(e.tag!==`!`){if(o.call(e.typeMap[e.kind||`fallback`],e.tag))g=e.typeMap[e.kind||`fallback`][e.tag];else{g=null;let t=e.typeMap.multi[e.kind||`fallback`];for(let n=0,r=t.length;n<r;n+=1)if(e.tag.slice(0,t[n].tag.length)===t[n].tag){g=t[n];break}}g||A(e,`unknown tag !<`+e.tag+`>`),e.result!==null&&g.kind!==e.kind&&A(e,`unacceptable node kind for !<`+e.tag+`> tag; it should be "`+g.kind+`", not "`+e.kind+`"`),g.resolve(e.result,e.tag)?(e.result=g.construct(e.result,e.tag),e.anchor!==null&&ie(e,e.anchor,e.result)):A(e,`cannot resolve a node with !<`+e.tag+`> explicit tag`)}return e.listener!==null&&e.listener(`close`,e),--e.depth,e.tag!==null||e.anchor!==null||m}function ke(e){let t=e.position,n=!1,r;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(r=e.input.charCodeAt(e.position))!==0&&(M(e,!0,-1),r=e.input.charCodeAt(e.position),!(e.lineIndent>0||r!==37));){n=!0,r=e.input.charCodeAt(++e.position);let t=e.position;for(;r!==0&&!S(r);)r=e.input.charCodeAt(++e.position);let i=e.input.slice(t,e.position),a=[];for(i.length<1&&A(e,`directive name must not be less than one character in length`);r!==0;){for(;x(r);)r=e.input.charCodeAt(++e.position);if(r===35){do r=e.input.charCodeAt(++e.position);while(r!==0&&!b(r));break}if(b(r))break;for(t=e.position;r!==0&&!S(r);)r=e.input.charCodeAt(++e.position);a.push(e.input.slice(t,e.position))}r!==0&&me(e),o.call(ue,i)?ue[i](e,i,a):j(e,`unknown document directive "`+i+`"`)}if(M(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,M(e,!0,-1)):n&&A(e,`directives end mark is expected`),Oe(e,e.lineIndent-1,u,!1,!0),M(e,!0,-1),e.checkLineBreaks&&h.test(e.input.slice(t,e.position))&&j(e,`non-ASCII line breaks are interpreted as content`),e.documents.push(e.result),e.position===e.lineStart&&he(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,M(e,!0,-1));return}e.position<e.length-1&&A(e,`end of the stream or a document separator is expected`)}function Ae(e,t){e=String(e),t||={},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
54
+ `),e.charCodeAt(0)===65279&&(e=e.slice(1)));let n=new O(e,t),r=e.indexOf(`\0`);for(r!==-1&&(n.position=r,A(n,`null byte is not allowed in input`)),n.input+=`\0`;n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)ke(n);return n.documents}function N(e,t,n){typeof t==`object`&&t&&n===void 0&&(n=t,t=null);let r=Ae(e,n);if(typeof t!=`function`)return r;for(let e=0,n=r.length;e<n;e+=1)t(r[e])}function je(e,t){let n=Ae(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new r(`expected a single document in the stream, but found more`)}}t.exports.loadAll=N,t.exports.load=je})),Lv=dv(((e,t)=>{var n=mv(),r=hv(),i=Fv(),a=Object.prototype.toString,o=Object.prototype.hasOwnProperty,s=65279,c=9,l=10,u=13,d=32,f=33,p=34,m=35,h=37,g=38,_=39,v=42,y=44,b=45,x=58,S=61,C=62,ee=63,te=64,ne=91,w=93,T=96,E=123,D=124,re=125,O={};O[0]=`\\0`,O[7]=`\\a`,O[8]=`\\b`,O[9]=`\\t`,O[10]=`\\n`,O[11]=`\\v`,O[12]=`\\f`,O[13]=`\\r`,O[27]=`\\e`,O[34]=`\\"`,O[92]=`\\\\`,O[133]=`\\N`,O[160]=`\\_`,O[8232]=`\\L`,O[8233]=`\\P`;var k=[`y`,`Y`,`yes`,`Yes`,`YES`,`on`,`On`,`ON`,`n`,`N`,`no`,`No`,`NO`,`off`,`Off`,`OFF`],A=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function j(e,t){if(t===null)return{};let n={},r=Object.keys(t);for(let i=0,a=r.length;i<a;i+=1){let a=r[i],s=String(t[a]);a.slice(0,2)===`!!`&&(a=`tag:yaml.org,2002:`+a.slice(2));let c=e.compiledTypeMap.fallback[a];c&&o.call(c.styleAliases,s)&&(s=c.styleAliases[s]),n[a]=s}return n}function ie(e){let t,i,a=e.toString(16).toUpperCase();if(e<=255)t=`x`,i=2;else if(e<=65535)t=`u`,i=4;else if(e<=4294967295)t=`U`,i=8;else throw new r(`code point within a string may not be greater than 0xFFFFFFFF`);return`\\`+t+n.repeat(`0`,i-a.length)+a}var ae=1,oe=2;function se(e){this.schema=e.schema||i,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=n.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=j(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType===`"`?oe:ae,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer==`function`?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result=``,this.duplicates=[],this.usedDuplicates=null}function ce(e,t){let r=n.repeat(` `,t),i=0,a=``,o=e.length;for(;i<o;){let t,n=e.indexOf(`
55
+ `,i);n===-1?(t=e.slice(i),i=o):(t=e.slice(i,n+1),i=n+1),t.length&&t!==`
56
+ `&&(a+=r),a+=t}return a}function le(e,t){return`
57
+ `+n.repeat(` `,e.indent*t)}function ue(e,t){for(let n=0,r=e.implicitTypes.length;n<r;n+=1)if(e.implicitTypes[n].resolve(t))return!0;return!1}function de(e){return e===d||e===c}function fe(e){return e>=32&&e<=126||e>=161&&e<=55295&&e!==8232&&e!==8233||e>=57344&&e<=65533&&e!==s||e>=65536&&e<=1114111}function pe(e){return fe(e)&&e!==s&&e!==u&&e!==l}function me(e,t,n){let r=pe(e),i=r&&!de(e);return(n?r:r&&e!==y&&e!==ne&&e!==w&&e!==E&&e!==re)&&e!==m&&!(t===x&&!i)||pe(t)&&!de(t)&&e===m||t===x&&i}function M(e){return fe(e)&&e!==s&&!de(e)&&e!==b&&e!==ee&&e!==x&&e!==y&&e!==ne&&e!==w&&e!==E&&e!==re&&e!==m&&e!==g&&e!==v&&e!==f&&e!==D&&e!==S&&e!==C&&e!==_&&e!==p&&e!==h&&e!==te&&e!==T}function he(e){return!de(e)&&e!==x}function ge(e,t){let n=e.charCodeAt(t),r;return n>=55296&&n<=56319&&t+1<e.length&&(r=e.charCodeAt(t+1),r>=56320&&r<=57343)?(n-55296)*1024+r-56320+65536:n}function _e(e){return/^\n* /.test(e)}var ve=1,ye=2,be=3,xe=4,Se=5;function Ce(e,t,n,r,i,a,o,s){let c,u=0,d=null,f=!1,p=!1,m=r!==-1,h=-1,g=M(ge(e,0))&&he(ge(e,e.length-1));if(t||o)for(c=0;c<e.length;u>=65536?c+=2:c++){if(u=ge(e,c),!fe(u))return Se;g&&=me(u,d,s),d=u}else{for(c=0;c<e.length;u>=65536?c+=2:c++){if(u=ge(e,c),u===l)f=!0,m&&(p||=c-h-1>r&&e[h+1]!==` `,h=c);else if(!fe(u))return Se;g&&=me(u,d,s),d=u}p||=m&&c-h-1>r&&e[h+1]!==` `}return!f&&!p?g&&!o&&!i(e)?ve:a===oe?Se:ye:n>9&&_e(e)?Se:o?a===oe?Se:ye:p?xe:be}function we(e,t,n,i,a){e.dump=function(){if(t.length===0)return e.quotingType===oe?`""`:`''`;if(!e.noCompatMode&&(k.indexOf(t)!==-1||A.test(t)))return e.quotingType===oe?`"`+t+`"`:`'`+t+`'`;let o=e.indent*Math.max(1,n),s=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-o),c=i||e.flowLevel>-1&&n>=e.flowLevel;function l(t){return ue(e,t)}switch(Ce(t,c,e.indent,s,l,e.quotingType,e.forceQuotes&&!i,a)){case ve:return t;case ye:return`'`+t.replace(/'/g,`''`)+`'`;case be:return`|`+Te(t,e.indent)+Ee(ce(t,o));case xe:return`>`+Te(t,e.indent)+Ee(ce(De(t,s),o));case Se:return`"`+ke(t,s)+`"`;default:throw new r(`impossible error: invalid scalar style`)}}()}function Te(e,t){let n=_e(e)?String(t):``,r=e[e.length-1]===`
58
+ `;return n+(r&&(e[e.length-2]===`
59
+ `||e===`
60
+ `)?`+`:r?``:`-`)+`
61
+ `}function Ee(e){return e[e.length-1]===`
62
+ `?e.slice(0,-1):e}function De(e,t){let n=/(\n+)([^\n]*)/g,r=function(){let r=e.indexOf(`
63
+ `);return r=r===-1?e.length:r,n.lastIndex=r,Oe(e.slice(0,r),t)}(),i=e[0]===`
64
+ `||e[0]===` `,a,o;for(;o=n.exec(e);){let e=o[1],n=o[2];a=n[0]===` `,r+=e+(!i&&!a&&n!==``?`
65
+ `:``)+Oe(n,t),i=a}return r}function Oe(e,t){if(e===``||e[0]===` `)return e;let n=/ [^ ]/g,r,i=0,a,o=0,s=0,c=``;for(;r=n.exec(e);)s=r.index,s-i>t&&(a=o>i?o:s,c+=`
66
+ `+e.slice(i,a),i=a+1),o=s;return c+=`
67
+ `,e.length-i>t&&o>i?c+=e.slice(i,o)+`
68
+ `+e.slice(o+1):c+=e.slice(i),c.slice(1)}function ke(e){let t=``,n=0;for(let r=0;r<e.length;n>=65536?r+=2:r++){n=ge(e,r);let i=O[n];!i&&fe(n)?(t+=e[r],n>=65536&&(t+=e[r+1])):t+=i||ie(n)}return t}function Ae(e,t,n){let r=``,i=e.tag;for(let i=0,a=n.length;i<a;i+=1){let a=n[i];e.replacer&&(a=e.replacer.call(n,String(i),a)),(Pe(e,t,a,!1,!1)||a===void 0&&Pe(e,t,null,!1,!1))&&(r!==``&&(r+=`,`+(e.condenseFlow?``:` `)),r+=e.dump)}e.tag=i,e.dump=`[`+r+`]`}function N(e,t,n,r){let i=``,a=e.tag;for(let a=0,o=n.length;a<o;a+=1){let o=n[a];e.replacer&&(o=e.replacer.call(n,String(a),o)),(Pe(e,t+1,o,!0,!0,!1,!0)||o===void 0&&Pe(e,t+1,null,!0,!0,!1,!0))&&((!r||i!==``)&&(i+=le(e,t)),e.dump&&l===e.dump.charCodeAt(0)?i+=`-`:i+=`- `,i+=e.dump)}e.tag=a,e.dump=i||`[]`}function je(e,t,n){let r=``,i=e.tag,a=Object.keys(n);for(let i=0,o=a.length;i<o;i+=1){let o=``;r!==``&&(o+=`, `),e.condenseFlow&&(o+=`"`);let s=a[i],c=n[s];e.replacer&&(c=e.replacer.call(n,s,c)),Pe(e,t,s,!1,!1)&&(e.dump.length>1024&&(o+=`? `),o+=e.dump+(e.condenseFlow?`"`:``)+`:`+(e.condenseFlow?``:` `),Pe(e,t,c,!1,!1)&&(o+=e.dump,r+=o))}e.tag=i,e.dump=`{`+r+`}`}function Me(e,t,n,i){let a=``,o=e.tag,s=Object.keys(n);if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys==`function`)s.sort(e.sortKeys);else if(e.sortKeys)throw new r(`sortKeys must be a boolean or a function`);for(let r=0,o=s.length;r<o;r+=1){let o=``;(!i||a!==``)&&(o+=le(e,t));let c=s[r],u=n[c];if(e.replacer&&(u=e.replacer.call(n,c,u)),!Pe(e,t+1,c,!0,!0,!0))continue;let d=e.tag!==null&&e.tag!==`?`||e.dump&&e.dump.length>1024;d&&(e.dump&&l===e.dump.charCodeAt(0)?o+=`?`:o+=`? `),o+=e.dump,d&&(o+=le(e,t)),Pe(e,t+1,u,!0,d)&&(e.dump&&l===e.dump.charCodeAt(0)?o+=`:`:o+=`: `,o+=e.dump,a+=o)}e.tag=o,e.dump=a||`{}`}function Ne(e,t,n){let i=n?e.explicitTypes:e.implicitTypes;for(let s=0,c=i.length;s<c;s+=1){let c=i[s];if((c.instanceOf||c.predicate)&&(!c.instanceOf||typeof t==`object`&&t instanceof c.instanceOf)&&(!c.predicate||c.predicate(t))){if(n?c.multi&&c.representName?e.tag=c.representName(t):e.tag=c.tag:e.tag=`?`,c.represent){let n=e.styleMap[c.tag]||c.defaultStyle,i;if(a.call(c.represent)===`[object Function]`)i=c.represent(t,n);else if(o.call(c.represent,n))i=c.represent[n](t,n);else throw new r(`!<`+c.tag+`> tag resolver accepts not "`+n+`" style`);e.dump=i}return!0}}return!1}function Pe(e,t,n,i,o,s,c){e.tag=null,e.dump=n,Ne(e,n,!1)||Ne(e,n,!0);let l=a.call(e.dump),u=i;i&&=e.flowLevel<0||e.flowLevel>t;let d=l===`[object Object]`||l===`[object Array]`,f,p;if(d&&(f=e.duplicates.indexOf(n),p=f!==-1),(e.tag!==null&&e.tag!==`?`||p||e.indent!==2&&t>0)&&(o=!1),p&&e.usedDuplicates[f])e.dump=`*ref_`+f;else{if(d&&p&&!e.usedDuplicates[f]&&(e.usedDuplicates[f]=!0),l===`[object Object]`)i&&Object.keys(e.dump).length!==0?(Me(e,t,e.dump,o),p&&(e.dump=`&ref_`+f+e.dump)):(je(e,t,e.dump),p&&(e.dump=`&ref_`+f+` `+e.dump));else if(l===`[object Array]`)i&&e.dump.length!==0?(e.noArrayIndent&&!c&&t>0?N(e,t-1,e.dump,o):N(e,t,e.dump,o),p&&(e.dump=`&ref_`+f+e.dump)):(Ae(e,t,e.dump),p&&(e.dump=`&ref_`+f+` `+e.dump));else if(l===`[object String]`)e.tag!==`?`&&we(e,e.dump,t,s,u);else if(l===`[object Undefined]`)return!1;else{if(e.skipInvalid)return!1;throw new r(`unacceptable kind of an object to dump `+l)}if(e.tag!==null&&e.tag!==`?`){let t=encodeURI(e.tag[0]===`!`?e.tag.slice(1):e.tag).replace(/!/g,`%21`);t=e.tag[0]===`!`?`!`+t:t.slice(0,18)===`tag:yaml.org,2002:`?`!!`+t.slice(18):`!<`+t+`>`,e.dump=t+` `+e.dump}}return!0}function Fe(e,t){let n=[],r=[];P(e,n,r);let i=r.length;for(let e=0;e<i;e+=1)t.duplicates.push(n[r[e]]);t.usedDuplicates=Array(i)}function P(e,t,n){if(typeof e==`object`&&e){let r=t.indexOf(e);if(r!==-1)n.indexOf(r)===-1&&n.push(r);else if(t.push(e),Array.isArray(e))for(let r=0,i=e.length;r<i;r+=1)P(e[r],t,n);else{let r=Object.keys(e);for(let i=0,a=r.length;i<a;i+=1)P(e[r[i]],t,n)}}}function Ie(e,t){t||={};let n=new se(t);n.noRefs||Fe(e,n);let r=e;return n.replacer&&(r=n.replacer.call({"":r},``,r)),Pe(n,0,r,!0,!0)?n.dump+`
69
+ `:``}t.exports.dump=Ie})),Rv=pv(dv(((e,t)=>{var n=Iv(),r=Lv();function i(e,t){return function(){throw Error(`Function yaml.`+e+` is removed in js-yaml 4. Use yaml.`+t+` instead, which is now safe by default.`)}}t.exports.Type=_v(),t.exports.Schema=vv(),t.exports.FAILSAFE_SCHEMA=Sv(),t.exports.JSON_SCHEMA=Dv(),t.exports.CORE_SCHEMA=Ov(),t.exports.DEFAULT_SCHEMA=Fv(),t.exports.load=n.load,t.exports.loadAll=n.loadAll,t.exports.dump=r.dump,t.exports.YAMLException=hv(),t.exports.types={binary:jv(),float:Ev(),map:xv(),null:Cv(),pairs:Nv(),set:Pv(),timestamp:kv(),bool:wv(),int:Tv(),merge:Av(),omap:Mv(),seq:bv(),str:yv()},t.exports.safeLoad=i(`safeLoad`,`load`),t.exports.safeLoadAll=i(`safeLoadAll`,`loadAll`),t.exports.safeDump=i(`safeDump`,`dump`)}))(),1),{Type:zv,Schema:Bv,FAILSAFE_SCHEMA:Vv,JSON_SCHEMA:Hv,CORE_SCHEMA:Uv,DEFAULT_SCHEMA:Wv,load:Gv,loadAll:Kv,dump:qv,YAMLException:Jv,types:Yv,safeLoad:Xv,safeLoadAll:Zv,safeDump:Qv}=Rv.default,$v=Rv.default,ey=`modulepreload`,ty=function(e){return`/`+e},ny={},ry=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=ty(t,n),t in ny)return;ny[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:ey,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},iy=`presentDocument`;function ay(e){return e.endsWith(`.md`)?e.startsWith(`artifacts/documents/`):!1}var oy={type:`function`,name:iy,description:`Display a document in markdown format.`,prompt:`Use the ${iy} tool when the user asks for a document that combines text with embedded images — guides, reports, tutorials, articles, or any structured content with visuals. Prefer this over standalone image generation when the user wants informational content with supporting visuals.\n\nFormat embedded images as: ![Detailed image prompt](__too_be_replaced_image_path__)
70
+
71
+ ── Slide-deck (Marp) mode ──
72
+ When the user asks for a slide deck / presentation / スライド, opt into Marp by writing this YAML frontmatter at the very top of the markdown:
73
+ ---
74
+ marp: true
75
+ theme: default
76
+ size: 16:9
77
+ ---
78
+ Then separate slides with \`---\` on its own line. The right-pane preview and the Export-PDF button both honour Marp output.
79
+
80
+ Marp image directives (alt-text position) — use these instead of plain ![]() when slide layout matters, because a plain inline image is clipped to ~60% of slide height to leave room for surrounding text:
81
+ - ![bg](path) — full-slide background (does not push other content)
82
+ - ![bg fit](path) — background scaled to fit, no crop
83
+ - ![fit](path) — fit-to-content inline
84
+ - ![w:600 h:400](path) — explicit pixel size
85
+ For a GENERATED image WITH a directive you must use THREE slots: the directive in the alt-text slot, the placeholder \`__too_be_replaced_image_path__\` in the URL slot, AND the image prompt in a quoted markdown TITLE right after the URL:
86
+ ![bg right:45%](__too_be_replaced_image_path__ "A detailed description of the image to generate")
87
+ The title is REQUIRED in this form — the alt slot is taken by the directive, so WITHOUT a title there is no prompt and no image is generated. (Plain non-directive images keep the prompt in the alt slot, as shown earlier.)
88
+
89
+ Aspect: \`size: 16:9\` (default 1280×720) or \`size: 4:3\` (960×720) — handled natively by Marp. For other shapes MulmoClaude bridges the directive so vertical / square / custom decks work too:
90
+ - \`size: 9:16\` → 1080×1920 portrait
91
+ - \`size: 16:10\` → 1280×800
92
+ - \`size: 1:1\` → 1080×1080 square
93
+ - \`size: WxH\` → any custom pixel canvas (e.g. \`size: 1920x1080\`)
94
+ Themes: \`theme: default\` | \`gaia\` | \`uncover\`. Custom sizes compose on top of whichever theme is chosen.`,parameters:{type:`object`,properties:{title:{type:`string`,description:`Title for the document`},markdown:{type:`string`,description:`The markdown content to display. Describe embedded images in the following format: ![Detailed image prompt](__too_be_replaced_image_path__). IMPORTANT: For embedded images, you MUST use the EXACT placeholder path '__too_be_replaced_image_path__'.`},filenamePrefix:{type:`string`,description:`Short English filename prefix (without extension). Use lowercase with hyphens, e.g. 'project-summary'. The server sanitizes the value and appends a random id to prevent collisions.`}},required:[`title`,`markdown`,`filenamePrefix`]}};async function sy(e,t){let{app:n}=e;if(!n)throw Error(`markdown plugin: context.app (MarkdownHostApp) was not provided by the host`);switch(t.kind){case`loadDoc`:return n.loadDoc(t.path);case`saveDoc`:return n.saveDoc(t.path,t.markdown);case`marpThemes`:return n.marpThemes();case`exportPdf`:return n.exportPdf({markdown:t.markdown,filename:t.filename,marp:t.marp,baseDir:t.baseDir,format:t.format,stripFrontmatter:t.stripFrontmatter});case`fillImages`:return n.fillImages(t.markdown);default:throw Error(`markdown plugin: unknown dispatch kind ${JSON.stringify(t)}`)}}async function cy(e,t){let{app:n}=e;if(!n)throw Error(`markdown plugin: context.app (MarkdownHostApp) was not provided by the host`);let{title:r,markdown:i,filenamePrefix:a}=t,o=(await n.fillImages(i)).markdown,{path:s}=await n.saveNewDoc(a??`document`,o);return{message:`Document created${r?`: ${r}`:``}`,data:{markdown:s,filenamePrefix:a},instructions:`The document has been presented to the user in a rendered markdown view.`}}var ly=new Set([`loadDoc`,`saveDoc`,`marpThemes`,`exportPdf`,`fillImages`]);function uy(e){if(typeof e!=`object`||!e)return!1;let t=e.kind;return typeof t==`string`&&ly.has(t)}var dy={toolDefinition:oy,execute:async(e,t)=>{let n=e;return uy(t)?sy(n,t):cy(n,t)},generatingMessage:`Creating document...`,isEnabled:()=>!0},fy=`/api/files/raw`,py=`artifacts/images/`;function my(e){return e.startsWith(`data:`)?e:e.startsWith(py)?`/${e}`:`${fy}?path=${encodeURIComponent(e)}`}var hy=[`id`,`class`,`style`],gy={div:[...hy],span:[...hy],img:[`src`,`alt`,`width`,`height`,...hy],br:[],sub:[...hy],sup:[...hy],small:[...hy]},_y=/^---\r?\n/,vy=/(?:^|\r?\n)---\s*(?:\r?\n|$)/;function yy(e){if(!_y.test(e))return{meta:{},body:e,hasHeader:!1};let t=e.replace(_y,``),n=vy.exec(t);if(!n||n.index===void 0)return{meta:{},body:e,hasHeader:!1};let r=t.slice(0,n.index),i=t.slice(n.index+n[0].length),a=by(r);return a===null?{meta:{},body:e,hasHeader:!1}:{meta:a,body:i,hasHeader:!0}}function by(e){try{let t=$v.load(e,{schema:$v.FAILSAFE_SCHEMA});return t==null?{}:typeof t!=`object`||Array.isArray(t)?null:t}catch{return null}}var xy={"9:16":[1080,1920],"16:10":[1280,800],"1:1":[1080,1080]},Sy=/^(\d{3,5})[xX](\d{3,5})$/,Cy=200,wy=3840,Ty=/^[A-Za-z0-9_-]+$/;function Ey(e){return Number.isFinite(e)&&e>=Cy&&e<=wy}function Dy(e){let t=xy[e];if(t)return{width:t[0],height:t[1]};let n=Sy.exec(e);if(!n)return null;let r=Number(n[1]),i=Number(n[2]);return!Ey(r)||!Ey(i)?null:{width:r,height:i}}function Oy(e,t){return`---\n${$v.dump(e,{lineWidth:-1,sortKeys:!1}).trimEnd()}\n---\n${t}`}function ky(e,t){let{meta:n,body:r,hasHeader:i}=yy(t);if(!i)return t;let a=typeof n.size==`string`?n.size.trim():``;if(a===``||a===`16:9`||a===`4:3`)return t;let o=Dy(a);if(!o)return t;let s=typeof n.theme==`string`?n.theme.trim():`default`,c=Ty.test(s)?s:`default`;if(c.startsWith(`mc_size_`))return t;let l=`mc_size_${c}_${o.width}x${o.height}`;e.themeSet.add(`/* @theme ${l} */\n@import "${c}";\nsection { width: ${o.width}px; height: ${o.height}px; }`);let u={...n,theme:l};return delete u.size,Oy(u,r)}var Ay=1280,jy=200,My=3840;function Ny(e,t){return!Number.isFinite(e)||e<jy?t:Math.min(e,My)}var Py=/div\.marpit\s*>\s*section\s*\{[^}]*?width:\s*(\d+)px[^}]*?height:\s*(\d+)px/;function Fy(e){let t=e.match(Py);return t?{width:Ny(Number(t[1]),Ay),height:Ny(Number(t[2]),720)}:{width:Ay,height:720}}var Iy=/viewBox="0 0 (\d+) (\d+)"/;function Ly(e){let t=e.match(Iy);return t?{width:Ny(Number(t[1]),Ay),height:Ny(Number(t[2]),720)}:{width:Ay,height:720}}async function Ry(e,t={}){let n=t.inlineSVG??!1,{Marp:r}=await ry(async()=>{let{Marp:e}=await import(`./marp-DqK0_Srt.js`).then(e=>u(e.default,1));return{Marp:e}},[]),i=new r({inlineSVG:n,html:gy,emoji:{unicode:!1,shortcode:!1}});for(let e of t.themes??[])i.themeSet.add(e.css);let a=ky(i,e),{html:o,css:s}=i.render(a),{width:c,height:l}=n?Ly(o):Fy(s);return{html:o,css:s,slideWidth:c,slideHeight:l}}var zy=Symbol(`guiChatPluginRuntime`);function By(){let e=Hn(zy);if(!e)throw Error(`useRuntime() called outside of <PluginScopedRoot> — the host must provide PLUGIN_RUNTIME_KEY`);return e}function Vy(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Hy=Vy();function Uy(e){Hy=e}var Wy={exec:()=>null};function Gy(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function Q(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(qy.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Ky=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),qy={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Gy(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Gy(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Gy(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Gy(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Gy(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:Gy(e=>RegExp(`^ {0,${e}}>`))},Jy=/^(?:[ \t]*(?:\n|$))+/,Yy=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Xy=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Zy=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Qy=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,$y=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,eb=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,tb=Q(eb).replace(/bull/g,$y).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),nb=Q(eb).replace(/bull/g,$y).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),rb=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ib=/^[^\n]+/,ab=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ob=Q(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,ab).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),sb=Q(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,$y).getRegex(),cb=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,lb=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ub=Q(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,lb).replace(`tag`,cb).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),db=Q(rb).replace(`hr`,Zy).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,cb).getRegex(),fb={blockquote:Q(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,db).getRegex(),code:Yy,def:ob,fences:Xy,heading:Qy,hr:Zy,html:ub,lheading:tb,list:sb,newline:Jy,paragraph:db,table:Wy,text:ib},pb=Q(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Zy).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,cb).getRegex(),mb={...fb,lheading:nb,table:pb,paragraph:Q(rb).replace(`hr`,Zy).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,pb).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,cb).getRegex()},hb={...fb,html:Q(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,lb).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Wy,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Q(rb).replace(`hr`,Zy).replace(`heading`,` *#{1,6} *[^
95
+ ]`).replace(`lheading`,tb).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},gb=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,_b=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,vb=/^( {2,}|\\)\n(?!\s*$)/,yb=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,bb=/[\p{P}\p{S}]/u,xb=/[\s\p{P}\p{S}]/u,Sb=/[^\s\p{P}\p{S}]/u,Cb=Q(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,xb).getRegex(),wb=/(?!~)[\p{P}\p{S}]/u,Tb=/(?!~)[\s\p{P}\p{S}]/u,Eb=/(?:[^\s\p{P}\p{S}]|~)/u,Db=Q(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Ky?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Ob=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,kb=Q(Ob,`u`).replace(/punct/g,bb).getRegex(),Ab=Q(Ob,`u`).replace(/punct/g,wb).getRegex(),jb=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Mb=Q(jb,`gu`).replace(/notPunctSpace/g,Sb).replace(/punctSpace/g,xb).replace(/punct/g,bb).getRegex(),Nb=Q(jb,`gu`).replace(/notPunctSpace/g,Eb).replace(/punctSpace/g,Tb).replace(/punct/g,wb).getRegex(),Pb=Q(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Sb).replace(/punctSpace/g,xb).replace(/punct/g,bb).getRegex(),Fb=Q(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,bb).getRegex(),Ib=Q(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Sb).replace(/punctSpace/g,xb).replace(/punct/g,bb).getRegex(),Lb=Q(/\\(punct)/,`gu`).replace(/punct/g,bb).getRegex(),Rb=Q(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[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])?)+(?![-_])/).getRegex(),zb=Q(lb).replace(`(?:-->|$)`,`-->`).getRegex(),Bb=Q(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,zb).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Vb=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Hb=Q(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,Vb).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ub=Q(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Vb).replace(`ref`,ab).getRegex(),Wb=Q(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,ab).getRegex(),Gb=Q(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Ub).replace(`nolink`,Wb).getRegex(),Kb=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,qb={_backpedal:Wy,anyPunctuation:Lb,autolink:Rb,blockSkip:Db,br:vb,code:_b,del:Wy,delLDelim:Wy,delRDelim:Wy,emStrongLDelim:kb,emStrongRDelimAst:Mb,emStrongRDelimUnd:Pb,escape:gb,link:Hb,nolink:Wb,punctuation:Cb,reflink:Ub,reflinkSearch:Gb,tag:Bb,text:yb,url:Wy},Jb={...qb,link:Q(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Vb).getRegex(),reflink:Q(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Vb).getRegex()},Yb={...qb,emStrongRDelimAst:Nb,emStrongLDelim:Ab,delLDelim:Fb,delRDelim:Ib,url:Q(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Kb).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Q(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,Kb).getRegex()},Xb={...Yb,br:Q(vb).replace(`{2,}`,`*`).getRegex(),text:Q(Yb.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Zb={normal:fb,gfm:mb,pedantic:hb},Qb={normal:qb,gfm:Yb,breaks:Xb,pedantic:Jb},$b={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},ex=e=>$b[e];function tx(e,t){if(t){if(qy.escapeTest.test(e))return e.replace(qy.escapeReplace,ex)}else if(qy.escapeTestNoEncode.test(e))return e.replace(qy.escapeReplaceNoEncode,ex);return e}function nx(e){try{e=encodeURI(e).replace(qy.percentDecode,`%`)}catch{return null}return e}function rx(e,t){let n=e.replace(qy.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(qy.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(qy.slashPipe,`|`);return n}function ix(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function ax(e){let t=e.split(`
96
+ `),n=t.length-1;for(;n>=0&&qy.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
97
+ `)}function ox(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function sx(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function cx(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function lx(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
98
+ `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
99
+ `)}var ux=class{options;rules;lexer;constructor(e){this.options=e||Hy}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:ax(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=lx(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=ix(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:ix(t[0],`
100
+ `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:ix(t[0],`
101
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=ix(t[0],`
102
+ `).split(`
103
+ `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
104
+ `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
105
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
106
+ ${s}`:s,r=r?`${r}
107
+ ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
108
+ `+e.join(`
109
+ `),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
110
+ `+e.join(`
111
+ `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
112
+ `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=sx(t[2].split(`
113
+ `,1)[0],t[1].length),l=e.split(`
114
+ `,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
115
+ `,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
116
+ `,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
117
+ `+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
118
+ `+l}u=!l.trim(),r+=p+`
119
+ `,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]);let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1;if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=ax(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:ix(t[0],`
120
+ `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=rx(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
121
+ `):[],a={type:`table`,raw:ix(t[0],`
122
+ `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(rx(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:ix(t[0],`
123
+ `),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
124
+ `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=ix(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=ox(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),cx(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return cx(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},dx=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Hy,this.options.tokenizer=this.options.tokenizer||new ux,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:qy,block:Zb.normal,inline:Qb.normal};this.options.pedantic?(t.block=Zb.pedantic,t.inline=Qb.pedantic):this.options.gfm&&(t.block=Zb.gfm,this.options.breaks?t.inline=Qb.breaks:t.inline=Qb.gfm),this.tokenizer.rules=t}static get rules(){return{block:Zb,inline:Qb}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(qy.carriageReturn,`
125
+ `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(qy.tabCharGlobal,` `).replace(qy.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
126
+ `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
127
+ `)?``:`
128
+ `)+i.raw,n.text+=`
129
+ `+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
130
+ `)?``:`
131
+ `)+i.raw,n.text+=`
132
+ `+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
133
+ `)?``:`
134
+ `)+i.raw,r.text+=`
135
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
136
+ `)?``:`
137
+ `)+i.raw,n.text+=`
138
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``,s=1/0;for(;e;){if(e.length<s)s=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},fx=class{options;parser;constructor(e){this.options=e||Hy}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(qy.notSpaceStart)?.[0],i=e.replace(qy.endingNewline,``)+`
139
+ `;return r?`<pre><code class="language-`+tx(r)+`">`+(n?i:tx(i,!0))+`</code></pre>
140
+ `:`<pre><code>`+(n?i:tx(i,!0))+`</code></pre>
141
+ `}blockquote({tokens:e}){return`<blockquote>
142
+ ${this.parser.parse(e)}</blockquote>
143
+ `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
144
+ `}hr(e){return`<hr>
145
+ `}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
146
+ `+r+`</`+i+`>
147
+ `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
148
+ `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
149
+ `}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
150
+ <thead>
151
+ `+t+`</thead>
152
+ `+r+`</table>
153
+ `}tablerow({text:e}){return`<tr>
154
+ ${e}</tr>
155
+ `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
156
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${tx(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=nx(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+tx(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=nx(e);if(i===null)return tx(n);e=i;let a=`<img src="${e}" alt="${tx(n)}"`;return t&&(a+=` title="${tx(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:tx(e.text)}},px=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},mx=class e{options;renderer;textRenderer;constructor(e){this.options=e||Hy,this.options.renderer=this.options.renderer||new fx,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new px}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},hx=class{options;block;constructor(e){this.options=e||Hy}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?dx.lex:dx.lexInline}provideParser(e=this.block){return e?mx.parse:mx.parseInline}},gx=new class{defaults=Vy();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=mx;Renderer=fx;TextRenderer=px;Lexer=dx;Tokenizer=ux;Hooks=hx;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new fx(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new ux(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new hx;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];hx.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&hx.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return dx.lex(e,t??this.defaults)}parser(e,t){return mx.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?dx.lex:dx.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?mx.parse:mx.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?dx.lex:dx.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?mx.parse:mx.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
157
+ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+tx(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function $(e,t){return gx.parse(e,t)}$.options=$.setOptions=function(e){return gx.setOptions(e),$.defaults=gx.defaults,Uy($.defaults),$},$.getDefaults=Vy,$.defaults=Hy,$.use=function(...e){return gx.use(...e),$.defaults=gx.defaults,Uy($.defaults),$},$.walkTokens=function(e,t){return gx.walkTokens(e,t)},$.parseInline=gx.parseInline,$.Parser=mx,$.parser=mx.parse,$.Renderer=fx,$.TextRenderer=px,$.Lexer=dx,$.lexer=dx.lex,$.Tokenizer=ux,$.Hooks=hx,$.parse=$,$.options,$.setOptions,$.use,$.walkTokens,$.parseInline,mx.parse,dx.lex;function _x(e){if(e==null)return``;if(typeof e==`object`)try{return JSON.stringify(e)}catch{return String(e)}return String(e)}function vx(e){return U(()=>{let t=yy(e.value??``),n=Object.entries(t.meta).map(([e,t])=>({key:e,value:t}));return{...t,fields:n}})}var yx={img:[`src`],source:[`src`],video:[`poster`,`src`],audio:[`src`]},bx={img:[`srcset`],source:[`srcset`]};function xx(e){return e===` `||e===` `||e===`
158
+ `||e===`\f`||e===`\r`}function Sx(e){let t=e.length;for(;t>0&&e[t-1]===`,`;)t--;return e.slice(0,t)}function Cx(e,t){let n=t;for(;n<e.length&&(xx(e[n])||e[n]===`,`);)n++;return n}function wx(e,t){let n=t,r=n;for(;n<e.length&&!xx(e[n]);)n++;let i=e.slice(r,n),a=Sx(i);if(a.length!==i.length)return{candidate:a?{url:a,descriptor:``}:null,next:n};for(;n<e.length&&xx(e[n]);)n++;let o=n;for(;n<e.length&&e[n]!==`,`;)n++;let s=e.slice(o,n).trim();return n<e.length&&e[n]===`,`&&n++,{candidate:a?{url:a,descriptor:s}:null,next:n}}function Tx(e){let t=[],n=0;for(;n<e.length&&(n=Cx(e,n),!(n>=e.length));){let{candidate:r,next:i}=wx(e,n);n=i,r&&t.push(r)}return t}function Ex(e,t){let n=Tx(e);if(n.length===0)return e;let r=!1,i=n.map(({url:e,descriptor:n})=>{let i=t(e),a=i===null||i===e?e:(r=!0,i);return n?`${a} ${n}`:a});return r?i.join(`, `):e}var Dx=/<(?:img|source|video|audio)\b(?:[^>"']|"[^"]*"|'[^']*')*\/?>/gi,Ox=/^<([a-z]+)/i,kx=/(\s+)([A-Za-z][\w:-]*)(?:(\s*=\s*)("([^"]*)"|'([^']*)'|([^\s>"'][^\s>]*)))?/g;function Ax(e,t){return e&&e.replace(Dx,e=>{let n=Ox.exec(e);if(!n)return e;let r=n[1].toLowerCase(),i=yx[r],a=bx[r];return!i&&!a?e:e.replace(kx,(...e)=>jx(e,i??[],a??[],t))})}function jx(e,t,n,r){let[i,a,o,s,,c,l,u]=e;if(!s)return i;let d=o.toLowerCase(),f=n.includes(d);if(!f&&!t.includes(d))return i;let p=(c??l??u??``).trim();if(!p)return i;let m=f?Ex(p,r):r(p);if(m===null||m===p)return i;let h=c===void 0?l===void 0?`"`:`'`:`"`;return`${a}${o}${s}${h}${m}${h}`}function Mx(e){return!!(e.startsWith(`data:`)||e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`/api/`))}function Nx(e,t){let n=t.startsWith(`/`),r=[...n?[]:e.split(`/`).filter(e=>e!==``&&e!==`.`)],i=(n?t.slice(1):t).split(`/`);for(let e of i)if(!(e===``||e===`.`)){if(e===`..`){if(r.length===0)return null;r.pop();continue}r.push(e)}return r.length===0?null:r.join(`/`)}function Px(e){if(!e.startsWith(`![`))return null;let t=1;for(let n=2;n<e.length;n++){let r=e[n];if(r===`[`)t++;else if(r===`]`&&(t--,t===0))return e.slice(2,n)}return null}function Fx(e,t){let n=(e.href??``).trim();if(n===``||Mx(n))return null;let r=Nx(t,n);if(r===null)return null;let i=my(r),a=Px(e.raw)??e.text??``;return e.title?`![${a}](${i} "${e.title.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}")`:`![${a}](${i})`}function Ix(e,t){return Ax(e,e=>{if(Mx(e))return null;let n=Nx(t,e);return n===null?null:my(n)})}function Lx(e){return e.type===`code`||e.type===`codespan`}function Rx(e){let t=e;return Array.isArray(t.tokens)&&t.tokens.length>0?t.tokens:Array.isArray(t.items)&&t.items.length>0?t.items:null}function zx(e,t,n,r){let i=t.map(e=>e.raw??``).join(``);if(i===``)return!1;let a=e.indexOf(i);if(a<0)return!1;a>0&&r.push(e.slice(0,a));for(let e of t)Bx(e,n,r);let o=e.slice(a+i.length);return o&&r.push(o),!0}function Bx(e,t,n){if(Lx(e)){n.push(e.raw);return}if(e.type===`image`){let r=Fx(e,t);n.push(r??e.raw);return}if(e.type===`html`){let r=e.raw??``;n.push(Ix(r,t));return}let r=e.raw??``,i=Rx(e);i&&zx(r,i,t,n)||n.push(r)}function Vx(e,t=``){let n=$.lexer(e),r=[];for(let e of n)Bx(e,t,r);return r.join(``)}var Hx=/^(\s*(?:>\s*)*)([-*+]|\d+[.)])(\s+)\[([ xX])\]/,Ux=/^( {0,3})(`{3,}|~{3,})/,Wx=/^(\s*(?:>\s?)+)/;function Gx(e,t){let n=e.match(Wx),r=n?e.slice(n[0].length):e,i=r.match(Ux);if(i){let[,,e]=i;if(!t.inFence)return t.inFence=!0,t.marker=e,!0;let n=r.slice(i[0].length);return t.marker&&e[0]===t.marker[0]&&e.length>=t.marker.length&&/^\s*$/.test(n)?(t.inFence=!1,t.marker=null,!0):!0}return t.inFence}function Kx(e,t){let[n,r,i,a,o]=t;return`${r}${i}${a}[${o===` `?`x`:` `}]${e.slice(n.length)}`}function qx(e){let t=e.split(`
159
+ `),n={inFence:!1,marker:null},r=[];for(let e=0;e<t.length;e++){let i=t[e];Gx(i,n)||Hx.test(i)&&r.push(e)}return r}function Jx(e,t){if(!Number.isInteger(t)||t<0)return null;let n=qx(e);if(t>=n.length)return null;let r=n[t],i=e.split(`
160
+ `),a=i[r].match(Hx);return a?(i[r]=Kx(i[r],a),i.join(`
161
+ `)):null}function Yx(e){return e.replace(/<input ([^>]*)disabled="" type="checkbox">/g,`<input $1class="md-task" type="checkbox">`)}function Xx(e,t){let n=atob(e),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return new Blob([r],{type:t})}function Zx(e,t){let n=t.endsWith(`.pdf`)?t:`${t}.pdf`,r=URL.createObjectURL(e);try{let e=document.createElement(`a`);e.href=r,e.download=n,document.body.appendChild(e),e.click(),e.remove()}finally{setTimeout(()=>URL.revokeObjectURL(r),0)}}function Qx(){let{dispatch:e}=By(),t=I(!1),n=I(null);async function r(r){if(r.markdown){t.value=!0,n.value=null;try{let{pdfBase64:t}=await e({kind:`exportPdf`,...r});Zx(Xx(t,`application/pdf`),r.filename)}catch(e){n.value=e instanceof Error?e.message:String(e)}finally{t.value=!1}}}return{pdfDownloading:t,pdfError:n,downloadPdf:r}}function $x(e,t){if(!e.startsWith(`http://`)&&!e.startsWith(`https://`))return!1;try{return new URL(e).origin!==t}catch{return!1}}function eS(e){if(e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey)return!1;let t=e.target;if(!t)return!1;let n=t.closest(`a`);if(!n)return!1;let r=n.href;return $x(r,window.location.origin)?(e.preventDefault(),window.open(r,`_blank`,`noopener,noreferrer`),!0):!1}function tS(e=2e3){let t=I(!1),n;async function r(r){try{await navigator.clipboard.writeText(r),t.value=!0,clearTimeout(n),n=setTimeout(()=>{t.value=!1},e)}catch{}}return{copied:t,copy:r}}var nS=/[/\\:*?"<>|]/g;function rS(e,t=`download`){return e.replace(nS,`_`).trim()||t}function iS(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function aS(e){return`${rS(e.name??``,e.fallback)}-${iS(e.timestampMs??Date.now())}.pdf`}function oS(e){let t=I(0),{pubsub:n}=By(),r=null;function i(e){r?.(),r=null,t.value=0,e&&(r=n.subscribe(`file:${e}`,e=>{typeof e?.mtimeMs==`number`&&e.mtimeMs>t.value&&(t.value=e.mtimeMs)}))}return Gn(e,i,{immediate:!0}),Ar(()=>{r?.(),r=null}),{version:t}}function sS(e){let t=e.marp;if(t===!0||t===1)return!0;if(typeof t==`string`){let e=t.trim().toLowerCase();return e===`true`||e===`yes`||e===`1`}return!1}var cS={de:{loading:`Dokument wird geladen...`,loadFailed:`⚠ Laden des Dokuments fehlgeschlagen: {error}`,refreshFailed:`⚠ Aktualisieren des Dokuments fehlgeschlagen: {error} — es wird der zuletzt erfolgreich geladene Inhalt angezeigt.`,noContent:`Kein Markdown-Inhalt verfügbar`,pdf:`PDF`,pdfFailedShort:`⚠ PDF fehlgeschlagen`,editSource:`Markdown-Quelle bearbeiten`,saving:`Wird gespeichert...`,applyChanges:`Änderungen übernehmen`,cancel:`Abbrechen`,saveFailed:`Speichern fehlgeschlagen: {error}`,saveError:`⚠ {error}`,copyLabel:`Kopieren`,copiedLabel:`Kopiert!`,taskCountMismatch:`Die Anzahl der Aufgaben in der Markdown-Quelle und im gerenderten Ergebnis stimmt nicht überein. Das Umschalten wurde abgelehnt, um eine Beschädigung der Datei zu vermeiden.`,marpSlidesMode:`Marp-Folien · {count}`,marpExportPdf:`Als PDF exportieren`,marpRenderFailed:`⚠ Rendern der Marp-Folien fehlgeschlagen: {error}`,marpSplitEnter:`Quelle neben der Vorschau bearbeiten`,marpSplitExit:`Quelleneditor schließen`,marpSplitEditorLabel:`Quelle`},en:{loading:`Loading document...`,loadFailed:`⚠ Failed to load document: {error}`,refreshFailed:`⚠ Failed to refresh document: {error} — showing last successfully loaded content.`,noContent:`No markdown content available`,pdf:`PDF`,pdfFailedShort:`⚠ PDF failed`,editSource:`Edit Markdown Source`,saving:`Saving...`,applyChanges:`Apply Changes`,cancel:`Cancel`,saveFailed:`Save failed: {error}`,saveError:`⚠ Save failed: {error}`,copyLabel:`Copy`,copiedLabel:`Copied!`,taskCountMismatch:`Markdown source and rendered output disagree on the number of tasks. Refusing to toggle to avoid corruption.`,marpSlidesMode:`Marp slides · {count}`,marpExportPdf:`Export PDF`,marpRenderFailed:`⚠ Failed to render Marp slides: {error}`,marpSplitEnter:`Edit source side-by-side with preview`,marpSplitExit:`Hide source editor`,marpSplitEditorLabel:`Source`},es:{loading:`Cargando documento...`,loadFailed:`⚠ Error al cargar el documento: {error}`,refreshFailed:`⚠ Error al actualizar el documento: {error} — mostrando el último contenido cargado con éxito.`,noContent:`No hay contenido Markdown disponible`,pdf:`PDF`,pdfFailedShort:`⚠ Error de PDF`,editSource:`Editar fuente Markdown`,saving:`Guardando...`,applyChanges:`Aplicar cambios`,cancel:`Cancelar`,saveFailed:`Error al guardar: {error}`,saveError:`⚠ Error al guardar: {error}`,copyLabel:`Copiar`,copiedLabel:`¡Copiado!`,taskCountMismatch:`El número de tareas no coincide entre la fuente Markdown y la salida renderizada. Se rechazó el cambio para evitar dañar el archivo.`,marpSlidesMode:`Diapositivas Marp · {count}`,marpExportPdf:`Exportar PDF`,marpRenderFailed:`⚠ Error al renderizar las diapositivas Marp: {error}`,marpSplitEnter:`Editar la fuente junto a la vista previa`,marpSplitExit:`Cerrar el editor de la fuente`,marpSplitEditorLabel:`Fuente`},fr:{loading:`Chargement du document...`,loadFailed:`⚠ Échec du chargement du document : {error}`,refreshFailed:`⚠ Échec de l'actualisation du document : {error} — affichage du dernier contenu chargé avec succès.`,noContent:`Aucun contenu Markdown disponible`,pdf:`PDF`,pdfFailedShort:`⚠ Échec PDF`,editSource:`Modifier la source Markdown`,saving:`Enregistrement...`,applyChanges:`Appliquer les modifications`,cancel:`Annuler`,saveFailed:`Échec de l'enregistrement : {error}`,saveError:`⚠ {error}`,copyLabel:`Copier`,copiedLabel:`Copié !`,taskCountMismatch:`Le nombre de tâches diffère entre la source Markdown et le rendu. La modification a été refusée pour éviter de corrompre le fichier.`,marpSlidesMode:`Diapositives Marp · {count}`,marpExportPdf:`Exporter en PDF`,marpRenderFailed:`⚠ Échec du rendu des diapositives Marp : {error}`,marpSplitEnter:`Modifier la source en parallèle de l'aperçu`,marpSplitExit:`Fermer l'éditeur de source`,marpSplitEditorLabel:`Source`},ja:{loading:`ドキュメント読み込み中...`,loadFailed:`⚠ ドキュメントの読み込みに失敗: {error}`,refreshFailed:`⚠ ドキュメントの更新に失敗: {error} — 前回読み込んだ内容を表示しています。`,noContent:`Markdown コンテンツがありません`,pdf:`PDF`,pdfFailedShort:`⚠ PDF 失敗`,editSource:`Markdown ソースを編集`,saving:`保存中...`,applyChanges:`変更を適用`,cancel:`キャンセル`,saveFailed:`保存失敗: {error}`,saveError:`⚠ 保存失敗: {error}`,copyLabel:`コピー`,copiedLabel:`コピーしました!`,taskCountMismatch:`Markdown ソースと描画結果でタスク数が一致しないため、ファイル破損を避けるためトグル操作を中止しました。`,marpSlidesMode:`Marp スライド · {count}`,marpExportPdf:`PDFを書き出し`,marpRenderFailed:`⚠ Marp スライドの描画に失敗しました: {error}`,marpSplitEnter:`ソースを並べて編集`,marpSplitExit:`ソースエディタを閉じる`,marpSplitEditorLabel:`ソース`},ko:{loading:`문서를 불러오는 중...`,loadFailed:`⚠ 문서 불러오기 실패: {error}`,refreshFailed:`⚠ 문서 새로고침 실패: {error} — 마지막으로 성공적으로 불러온 내용을 표시합니다.`,noContent:`사용 가능한 Markdown 콘텐츠가 없습니다`,pdf:`PDF`,pdfFailedShort:`⚠ PDF 실패`,editSource:`Markdown 원본 편집`,saving:`저장 중...`,applyChanges:`변경 사항 적용`,cancel:`취소`,saveFailed:`저장 실패: {error}`,saveError:`⚠ 저장 실패: {error}`,copyLabel:`복사`,copiedLabel:`복사됨!`,taskCountMismatch:`Markdown 원본과 렌더링 결과의 작업 수가 일치하지 않아, 파일 손상을 방지하기 위해 토글이 거부되었습니다.`,marpSlidesMode:`Marp 슬라이드 · {count}`,marpExportPdf:`PDF로 내보내기`,marpRenderFailed:`⚠ Marp 슬라이드 렌더링 실패: {error}`,marpSplitEnter:`소스를 나란히 편집`,marpSplitExit:`소스 편집기 닫기`,marpSplitEditorLabel:`소스`},"pt-BR":{loading:`Carregando documento...`,loadFailed:`⚠ Falha ao carregar o documento: {error}`,refreshFailed:`⚠ Falha ao atualizar o documento: {error} — exibindo o último conteúdo carregado com sucesso.`,noContent:`Nenhum conteúdo Markdown disponível`,pdf:`PDF`,pdfFailedShort:`⚠ Falha no PDF`,editSource:`Editar fonte Markdown`,saving:`Salvando...`,applyChanges:`Aplicar alterações`,cancel:`Cancelar`,saveFailed:`Falha ao salvar: {error}`,saveError:`⚠ {error}`,copyLabel:`Copiar`,copiedLabel:`Copiado!`,taskCountMismatch:`O número de tarefas diverge entre a fonte Markdown e a saída renderizada. A alternância foi recusada para evitar corromper o arquivo.`,marpSlidesMode:`Slides Marp · {count}`,marpExportPdf:`Exportar PDF`,marpRenderFailed:`⚠ Falha ao renderizar os slides Marp: {error}`,marpSplitEnter:`Editar o código fonte ao lado da visualização`,marpSplitExit:`Fechar o editor de código`,marpSplitEditorLabel:`Código`},zh:{loading:`正在加载文档...`,loadFailed:`⚠ 加载文档失败: {error}`,refreshFailed:`⚠ 刷新文档失败: {error} — 正在显示上次成功加载的内容。`,noContent:`没有可用的 Markdown 内容`,pdf:`PDF`,pdfFailedShort:`⚠ PDF 失败`,editSource:`编辑 Markdown 源`,saving:`保存中...`,applyChanges:`应用更改`,cancel:`取消`,saveFailed:`保存失败: {error}`,saveError:`⚠ 保存失败: {error}`,copyLabel:`复制`,copiedLabel:`已复制!`,taskCountMismatch:`Markdown 源与渲染输出的任务数不一致,为避免文件损坏,已拒绝切换。`,marpSlidesMode:`Marp 幻灯片 · {count}`,marpExportPdf:`导出 PDF`,marpRenderFailed:`⚠ Marp 幻灯片渲染失败: {error}`,marpSplitEnter:`并排编辑源代码`,marpSplitExit:`关闭源代码编辑器`,marpSplitEditorLabel:`源代码`}};function lS(e){return Object.prototype.hasOwnProperty.call(cS,e)}var uS=`pluginMarkdown.`;function dS(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e):e}function fS(){let e=Hn(zy,void 0)?.locale??I(`en`);return(t,n)=>{let r=(lS(e.value)?cS[e.value]:cS.en)[t.startsWith(uS)?t.slice(15):t];return r===void 0?t:dS(r,n)}}function pS(e,t){if(e instanceof Error)return e.message;if(typeof e==`object`&&e){let t=e;if(typeof t.details==`string`&&t.details)return t.details;if(typeof t.message==`string`&&t.message)return t.message}return t===void 0?String(e):t}var mS={class:`flex items-center justify-end gap-2 px-3 py-2 border-b border-gray-100 shrink-0`},hS={class:`text-xs text-gray-500 mr-auto pl-2`},gS=[`disabled`],_S={class:`material-icons text-base`},vS=[`title`],yS={key:0,class:`load-error-banner`,role:`alert`},bS=[`srcdoc`,`title`],xS=1280,SS=720,CS=16,wS=16,TS=12,ES=800,DS=.05,OS=1,kS=dr({__name:`MarpView`,props:{markdown:{},pdfFilename:{},baseDir:{}},setup(e){let t=fS(),{dispatch:n}=By(),r=e,i=`${TS}px`,a=I(null),o=I(ES),s=I(``),c=I(0),l=I(xS),u=I(SS),d=I(null),{pdfDownloading:f,pdfError:p,downloadPdf:m}=Qx(),h=U(()=>l.value+wS*2),g=U(()=>{let e=(o.value-TS*2)/h.value;return Math.min(OS,Math.max(DS,e))}),_=U(()=>c.value===0?wS*2:c.value*u.value+Math.max(0,c.value-1)*CS+wS*2),v=U(()=>Math.ceil(_.value*g.value));function y(){let e=typeof window<`u`?window.location.origin:``;return[`default-src 'none'`,`img-src ${e?`${e} data:`:`data:`}`,`style-src 'unsafe-inline' 'self'`,`font-src 'self' data:`,`connect-src 'none'`,`frame-ancestors 'none'`].join(`; `)}function b(e){return`html,body { margin:0; padding:${wS}px; background:transparent; overflow:hidden; }
162
+ ${e}
163
+ div.marpit > section {
164
+ display: block !important;
165
+ margin: 0 auto ${CS}px !important;
166
+ box-shadow: 0 2px 8px rgba(0,0,0,0.12);
167
+ border-radius: 6px;
168
+ }
169
+ div.marpit > section img:not([data-marp-twemoji]) {
170
+ max-width: 100%;
171
+ max-height: 60cqh;
172
+ object-fit: contain;
173
+ }`}function x(e,t){return`<!doctype html>
174
+ <html><head><meta charset="utf-8">
175
+ <meta http-equiv="Content-Security-Policy" content="${y()}">
176
+ <meta name="referrer" content="no-referrer">
177
+ <style>${b(t)}</style></head><body>${e}</body></html>`}function S(e){let t=e.match(/<section[\s>]/g);return t?t.length:0}function C(){s.value=``,c.value=0,l.value=xS,u.value=SS}let ee=null;async function te(){if(ee!==null)return ee;try{let{themes:e}=await n({kind:`marpThemes`});return Array.isArray(e)?(ee=e,ee):[]}catch{return[]}}async function ne(e){let t=await te();return Ry(Vx(e,r.baseDir??``),{themes:t})}let w=0;async function T(e){let t=++w;if(d.value=null,!e){C();return}try{let{html:n,css:r,slideWidth:i,slideHeight:a}=await ne(e);if(t!==w)return;c.value=S(n),l.value=i,u.value=a,s.value=x(n,r)}catch(e){if(t!==w)return;d.value=pS(e),C()}}Gn(()=>[r.markdown,r.baseDir],([e])=>{T(e)},{immediate:!0});let E=null;Er(()=>{a.value&&(o.value=a.value.clientWidth||ES,E=new ResizeObserver(e=>{let[t]=e;t&&(o.value=t.contentRect.width||ES)}),E.observe(a.value))}),kr(()=>{E?.disconnect(),E=null});async function D(){r.markdown&&await m({markdown:r.markdown,filename:r.pdfFilename,marp:!0,baseDir:r.baseDir})}return(e,n)=>(z(),B(`div`,{ref_key:`containerEl`,ref:a,class:`marp-container`},[V(`div`,mS,[V(`span`,hS,N(L(t)(`pluginMarkdown.marpSlidesMode`,{count:c.value})),1),Vr(e.$slots,`toolbar`,{},void 0,!0),V(`button`,{class:`h-8 px-2.5 flex items-center gap-1 rounded bg-green-600 hover:bg-green-700 text-white text-sm disabled:opacity-60 disabled:cursor-not-allowed transition-colors`,disabled:L(f),onClick:D},[V(`span`,_S,N(L(f)?`hourglass_empty`:`download`),1),ba(` `+N(L(t)(`pluginMarkdown.marpExportPdf`)),1)],8,gS),L(p)?(z(),B(`span`,{key:0,class:`text-xs text-red-500`,title:L(p)},N(L(t)(`pluginMarkdown.pdfFailedShort`)),9,vS)):H(``,!0)]),d.value?(z(),B(`div`,yS,N(L(t)(`pluginMarkdown.marpRenderFailed`,{error:d.value})),1)):H(``,!0),V(`div`,{class:`marp-frame-wrapper`,style:ve({padding:i})},[s.value?(z(),B(`div`,{key:0,style:ve({height:v.value+`px`,overflow:`hidden`})},[V(`iframe`,{srcdoc:s.value,style:ve({width:h.value+`px`,height:_.value+`px`,transform:`scale(${g.value})`,transformOrigin:`top left`}),sandbox:``,class:`marp-frame`,title:L(t)(`pluginMarkdown.marpSlidesMode`,{count:c.value})},null,12,bS)],4)):H(``,!0)],4)],512))}}),AS=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},jS=AS(kS,[[`__scopeId`,`data-v-1ec606a9`]]),MS={style:{height:`min(80vh, 720px)`,display:`flex`,overflow:`hidden`}},NS={style:{display:`flex`,"flex-direction":`column`,flex:`1 1 50%`,"min-width":`0`,"min-height":`0`,"border-right":`1px solid #e0e0e0`}},PS={class:`flex items-center gap-2 px-3 py-2 border-b border-gray-100 shrink-0`},FS={class:`text-xs text-gray-500 mr-auto`},IS=[`value`,`aria-label`],LS={style:{flex:`1 1 50%`,"min-width":`0`,"min-height":`0`,"overflow-y":`auto`}},RS=AS(dr({__name:`MarpSplitEditor`,props:{modelValue:{},pdfFilename:{},baseDir:{},editorLabel:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=t;function r(e){n(`update:modelValue`,e.target.value)}return(t,n)=>(z(),B(`div`,MS,[V(`div`,NS,[V(`div`,PS,[V(`span`,FS,N(e.editorLabel),1),Vr(t.$slots,`actions`,{},void 0,!0)]),Vr(t.$slots,`error`,{},void 0,!0),V(`textarea`,{value:e.modelValue,"aria-label":e.editorLabel,class:`marp-split-textarea`,style:{flex:`1 1 0`,"min-height":`0`},spellcheck:`false`,onInput:r},null,40,IS)]),V(`div`,LS,[ga(jS,{markdown:e.modelValue,"pdf-filename":e.pdfFilename,"base-dir":e.baseDir},{toolbar:Rn(()=>[Vr(t.$slots,`preview-toolbar`,{},void 0,!0)]),_:3},8,[`markdown`,`pdf-filename`,`base-dir`])])]))}}),[[`__scopeId`,`data-v-dfff3148`]]),zS={class:`markdown-container`},BS={key:0,class:`min-h-full p-8 flex items-center justify-center`},VS={class:`text-gray-500`},HS={key:1,class:`min-h-full p-8 flex items-center justify-center`},US={class:`load-error-banner`,role:`alert`},WS={key:2,class:`min-h-full p-8 flex items-center justify-center`},GS={class:`text-gray-500`},KS={key:0,class:`load-error-banner shrink-0`,role:`alert`},qS=[`disabled`],JS={key:0,class:`save-error mx-2 mt-1`,role:`alert`},YS=[`title`,`aria-label`],XS={class:`flex-1 min-h-0 overflow-y-auto flex flex-col`},ZS={class:`m-auto w-full`},QS=[`title`,`aria-label`],$S={class:`bottom-bar-wrapper`},eC={class:`editor-actions`},tC=[`disabled`],nC={key:0,class:`save-error`,role:`alert`},rC={class:`flex items-center justify-end gap-2 px-3 py-2 border-b border-gray-100 shrink-0`},iC=[`disabled`],aC={class:`material-icons text-base`},oC=[`title`],sC={key:0,class:`load-error-banner`,role:`alert`},cC={class:`markdown-content-wrapper`},lC={class:`p-4`},uC={key:0,class:`mb-3 rounded border border-gray-200 bg-gray-50 p-3 text-xs`},dC={class:`font-semibold text-gray-600 shrink-0`},fC={key:0,class:`flex flex-wrap gap-1`},pC={key:1,class:`text-gray-800 break-words`},mC=[`innerHTML`],hC={class:`bottom-bar-wrapper`},gC={class:`editor-actions`},_C=[`disabled`],vC={key:0,class:`save-error`,role:`alert`},yC=[`title`],bC={class:`material-icons`},xC=AS(dr({__name:`View`,props:{selectedResult:{}},emits:[`updateResult`],setup(e,{emit:t}){let n=fS(),{dispatch:r}=By(),i=e,a=t,o=I(!1),s=I(!1),c=I(null),l=I(null),u=I(``),d=I(``);async function f(){l.value=null;let e=i.selectedResult.data?.markdown;if(!e){u.value=``,d.value=``;return}if(ay(e)){o.value=!0;try{let{content:t}=await r({kind:`loadDoc`,path:e});u.value=t??``}catch(e){l.value=e instanceof Error?e.message:String(e),o.value=!1;return}o.value=!1}else u.value=e;d.value=u.value}f();let p=U(()=>d.value!==u.value),{version:m}=oS(U(()=>{let e=i.selectedResult.data?.markdown;return typeof e==`string`&&ay(e)?e:null})),h=I(0),g=I(),_=I(!1),v=I(!1);Gn(m,(e,t)=>{if(!(e===0||e===t)){if(h.value>0){--h.value;return}g.value?.open&&(g.value.open=!1),_.value&&=!1,f()}});let y=vx(u),b=U(()=>sS(y.value.meta));function x(){g.value?.open&&(g.value.open=!1),v.value=!1,c.value=null,_.value=!0}function S(){d.value=u.value,c.value=null,_.value=!1}let C=U(()=>{let e=i.selectedResult.data?.markdown;if(typeof e!=`string`||!ay(e))return;let t=e.lastIndexOf(`/`);return t<0?``:e.slice(0,t)}),ee=U(()=>aS({name:i.selectedResult.data?.filenamePrefix||i.selectedResult.title||``,fallback:`slides`,timestampMs:Date.now()})),te=U(()=>{if(!u.value)return``;let e=i.selectedResult.data?.markdown,t=typeof e==`string`&&ay(e)?e.slice(0,e.lastIndexOf(`/`)):``;return Yx($(Vx(y.value.body,t)))});Gn(()=>i.selectedResult?.viewState?.scrollToAnchor,e=>{e&&En(()=>{let t=document.getElementById(e);t?t.scrollIntoView({behavior:`smooth`,block:`start`}):console.warn(`Anchor element with id "${e}" not found`)})});let{copied:ne,copy:w}=tS();function T(e){let{open:t}=e.target;v.value=t,t||(d.value=u.value,c.value=null)}function E(){g.value&&(g.value.open=!1)}async function D(){await w(u.value)}let{pdfDownloading:re,pdfError:O,downloadPdf:k}=Qx();async function A(){if(!u.value)return;let e=aS({name:i.selectedResult.data?.filenamePrefix||i.selectedResult.title||``,fallback:`document`,timestampMs:Date.now()});await k({markdown:u.value,filename:e})}async function j(){let e=i.selectedResult.data?.markdown;if(e){if(c.value=null,ay(e)){s.value=!0,h.value+=1;try{await r({kind:`saveDoc`,path:e,markdown:d.value})}catch(e){h.value=Math.max(0,h.value-1),c.value=e instanceof Error?e.message:String(e);return}finally{s.value=!1}}u.value=d.value,a(`updateResult`,{...i.selectedResult,data:{...i.selectedResult.data,markdown:ay(e)?e:d.value,pdfPath:void 0}}),g.value&&(g.value.open=!1)}}let ie=Promise.resolve();async function ae(e,t){if(i.selectedResult.data?.markdown!==e)return;h.value+=1;let n=!0,a=``;try{await r({kind:`saveDoc`,path:e,markdown:t})}catch(e){n=!1,a=e instanceof Error?e.message:String(e)}if(i.selectedResult.data?.markdown===e){if(!n){h.value=Math.max(0,h.value-1),c.value=a,await f();return}c.value=null}}function oe(e){if(eS(e))return;let{target:t}=e;if(!(t instanceof HTMLInputElement)||t.type!==`checkbox`||!t.classList.contains(`md-task`))return;if(v.value){t.checked=!t.checked;return}let r=e.currentTarget.querySelectorAll(`input.md-task`),o=Array.from(r).indexOf(t);if(o<0)return;let{body:s}=y.value,l=u.value.slice(0,u.value.length-s.length);if(qx(s).length!==r.length){t.checked=!t.checked,c.value=n(`pluginMarkdown.taskCountMismatch`);return}let f=Jx(s,o);if(f===null){t.checked=!t.checked;return}let p=l+f;u.value=p,d.value=p;let m=i.selectedResult.data?.markdown;typeof m==`string`&&ay(m)?ie=ie.then(()=>ae(m,p)):a(`updateResult`,{...i.selectedResult,data:{...i.selectedResult.data,markdown:p,pdfPath:void 0}})}return Gn(()=>i.selectedResult.data?.markdown,()=>{_.value=!1,h.value=0,f()}),(e,t)=>(z(),B(`div`,zS,[o.value?(z(),B(`div`,BS,[V(`div`,VS,N(L(n)(`pluginMarkdown.loading`)),1)])):l.value&&!u.value?(z(),B(`div`,HS,[V(`div`,US,N(L(n)(`pluginMarkdown.loadFailed`,{error:l.value})),1)])):u.value?b.value?(z(),B(R,{key:3},[l.value?(z(),B(`div`,KS,N(L(n)(`pluginMarkdown.refreshFailed`,{error:l.value})),1)):H(``,!0),_.value?(z(),da(RS,{key:1,modelValue:d.value,"onUpdate:modelValue":t[1]||=e=>d.value=e,"pdf-filename":ee.value,"base-dir":C.value,"editor-label":L(n)(`pluginMarkdown.marpSplitEditorLabel`)},{actions:Rn(()=>[V(`button`,{class:`apply-btn`,disabled:!p.value||s.value,onClick:j},N(s.value?L(n)(`pluginMarkdown.saving`):L(n)(`pluginMarkdown.applyChanges`)),9,qS),V(`button`,{class:`cancel-btn`,onClick:S},N(L(n)(`pluginMarkdown.cancel`)),1)]),error:Rn(()=>[c.value?(z(),B(`p`,JS,N(L(n)(`pluginMarkdown.saveError`,{error:c.value})),1)):H(``,!0)]),"preview-toolbar":Rn(()=>[V(`button`,{class:`h-8 px-2.5 flex items-center gap-1 rounded bg-gray-100 hover:bg-gray-200 text-gray-700 text-sm`,title:L(n)(`pluginMarkdown.marpSplitExit`),"aria-label":L(n)(`pluginMarkdown.marpSplitExit`),onClick:t[0]||=e=>_.value=!1},[...t[4]||=[V(`span`,{class:`material-icons text-base`,"aria-hidden":`true`},`close_fullscreen`,-1)]],8,YS)]),_:1},8,[`modelValue`,`pdf-filename`,`base-dir`,`editor-label`])):(z(),B(R,{key:2},[V(`div`,XS,[V(`div`,ZS,[ga(jS,{markdown:u.value,"pdf-filename":ee.value,"base-dir":C.value},{toolbar:Rn(()=>[V(`button`,{class:`h-8 px-2.5 flex items-center gap-1 rounded bg-gray-100 hover:bg-gray-200 text-gray-700 text-sm`,title:L(n)(`pluginMarkdown.marpSplitEnter`),"aria-label":L(n)(`pluginMarkdown.marpSplitEnter`),onClick:x},[...t[5]||=[V(`span`,{class:`material-icons text-base`,"aria-hidden":`true`},`open_in_full`,-1)]],8,QS)]),_:1},8,[`markdown`,`pdf-filename`,`base-dir`])])]),V(`div`,$S,[V(`details`,{ref_key:`sourceDetails`,ref:g,class:`markdown-source`,onToggle:T},[V(`summary`,null,N(L(n)(`pluginMarkdown.editSource`)),1),zn(V(`textarea`,{"onUpdate:modelValue":t[2]||=e=>d.value=e,class:`markdown-editor`,spellcheck:`false`},null,512),[[Ho,d.value]]),V(`div`,eC,[V(`button`,{class:`apply-btn`,disabled:!p.value||s.value,onClick:j},N(s.value?L(n)(`pluginMarkdown.saving`):L(n)(`pluginMarkdown.applyChanges`)),9,tC),V(`button`,{class:`cancel-btn`,onClick:E},N(L(n)(`pluginMarkdown.cancel`)),1)]),c.value?(z(),B(`p`,nC,N(L(n)(`pluginMarkdown.saveError`,{error:c.value})),1)):H(``,!0)],544)])],64))],64)):(z(),B(R,{key:4},[V(`div`,rC,[V(`button`,{class:`h-8 px-2.5 flex items-center gap-1 rounded bg-green-600 hover:bg-green-700 text-white text-sm disabled:opacity-60 disabled:cursor-not-allowed transition-colors`,disabled:L(re),onClick:A},[V(`span`,aC,N(L(re)?`hourglass_empty`:`download`),1),ba(` `+N(L(n)(`pluginMarkdown.pdf`)),1)],8,iC),L(O)?(z(),B(`span`,{key:0,class:`text-xs text-red-500`,title:L(O)},N(L(n)(`pluginMarkdown.pdfFailedShort`)),9,oC)):H(``,!0)]),l.value?(z(),B(`div`,sC,N(L(n)(`pluginMarkdown.refreshFailed`,{error:l.value})),1)):H(``,!0),V(`div`,cC,[V(`div`,lC,[L(y).fields.length>0?(z(),B(`div`,uC,[(z(!0),B(R,null,Br(L(y).fields,e=>(z(),B(`div`,{key:e.key,class:`flex items-baseline gap-2 py-0.5`},[V(`span`,dC,N(e.key)+`:`,1),Array.isArray(e.value)?(z(),B(`span`,fC,[(z(!0),B(R,null,Br(e.value,(e,t)=>(z(),B(`span`,{key:String(t)+`:`+L(_x)(e),class:`rounded-full bg-white border border-gray-300 px-2 py-0.5 text-gray-700`},N(L(_x)(e)),1))),128))])):(z(),B(`span`,pC,N(L(_x)(e.value)),1))]))),128))])):H(``,!0),V(`div`,{class:`markdown-content prose prose-slate max-w-none`,onClick:oe,innerHTML:te.value},null,8,mC)])]),V(`div`,hC,[V(`details`,{ref_key:`sourceDetails`,ref:g,class:`markdown-source`,onToggle:T},[V(`summary`,null,N(L(n)(`pluginMarkdown.editSource`)),1),zn(V(`textarea`,{"onUpdate:modelValue":t[3]||=e=>d.value=e,class:`markdown-editor`,spellcheck:`false`},null,512),[[Ho,d.value]]),V(`div`,gC,[V(`button`,{class:`apply-btn`,disabled:!p.value||s.value,onClick:j},N(s.value?L(n)(`pluginMarkdown.saving`):L(n)(`pluginMarkdown.applyChanges`)),9,_C),V(`button`,{class:`cancel-btn`,onClick:E},N(L(n)(`pluginMarkdown.cancel`)),1)]),c.value?(z(),B(`p`,vC,N(L(n)(`pluginMarkdown.saveError`,{error:c.value})),1)):H(``,!0)],544),zn(V(`button`,{class:`copy-btn`,title:L(ne)?L(n)(`pluginMarkdown.copiedLabel`):L(n)(`pluginMarkdown.copyLabel`),onClick:D},[V(`span`,bC,N(L(ne)?`check`:`content_copy`),1)],8,yC),[[co,!v.value]])])],64)):(z(),B(`div`,WS,[V(`div`,GS,N(L(n)(`pluginMarkdown.noContent`)),1)]))]))}}),[[`__scopeId`,`data-v-0b1ec4b2`]]);function SC(e){for(let t of CC(e)){if(t.length<2||t[0]!==`#`||!wC(t.charCodeAt(1)))continue;let e=t.slice(2).trim();if(e.length>0)return e}return null}function CC(e){return e.split(/\r\n|\r|\n/)}function wC(e){return e===32||e===9}var TC={class:`p-2 bg-purple-100 rounded overflow-hidden`},EC={class:`text-sm text-gray-800 font-medium truncate flex items-center gap-1`},DC={key:0,class:`material-icons text-base text-purple-700`,"aria-hidden":`true`},OC={class:`truncate`},kC={key:0,class:`text-xs text-purple-700 mt-1`},AC={key:1,class:`text-xs text-gray-500 mt-1 line-clamp-4 whitespace-pre-line`},jC=dr({__name:`Preview`,props:{result:{}},setup(e){let t=fS(),{dispatch:n}=By(),r=e,i=I(``);async function a(){let e=r.result.data?.markdown;if(!e||!ay(e)){i.value=``;return}try{let{content:t}=await n({kind:`loadDoc`,path:e});i.value=t??``}catch{i.value=``}}a(),Gn(()=>r.result.data?.markdown,a);let o=U(()=>{let e=r.result.data?.markdown;return e?ay(e)?i.value:e:``});function s(e){return e.trim()?(e.match(/^---\s*$/gm)?.length??0)+1:0}let c=U(()=>{let e=o.value;if(!e)return null;let{meta:t,body:n}=yy(e);return sS(t)?{slideCount:s(n)}:null}),l=U(()=>{if(r.result.title)return r.result.title;let e=o.value;if(e){let t=SC(e);if(t)return t}return`Markdown Document`});function u(e){return e.split(`
178
+ `).filter(e=>!/^#{1,6}\s/.test(e)&&e.trim()!==``).map(e=>e.replace(/[*_`~[\]]/g,``).trim()).filter(Boolean).slice(0,6).join(`
179
+ `)}let d=U(()=>{let e=o.value;return e?u(e):``});return(e,n)=>(z(),B(`div`,TC,[V(`div`,EC,[c.value?(z(),B(`span`,DC,`slideshow`)):H(``,!0),V(`span`,OC,N(l.value),1)]),c.value?(z(),B(`div`,kC,N(L(t)(`pluginMarkdown.marpSlidesMode`,{count:c.value.slideCount})),1)):d.value?(z(),B(`div`,AC,N(d.value),1)):H(``,!0)]))}}),MC={...dy,viewComponent:xC,previewComponent:jC},NC={type:`function`,name:`presentForm`,description:`Create a structured form to collect information from the user. Supports various field types including text input, textarea, multiple choice (radio), dropdown menus, checkboxes, date/time pickers, and number inputs. Each field can have validation rules and help text.`,parameters:{type:`object`,properties:{title:{type:`string`,description:`Optional title for the form (e.g., 'User Registration')`},description:{type:`string`,description:`Optional description explaining the purpose of the form`},fields:{type:`array`,description:`Array of form fields with various types and configurations`,items:{type:`object`,properties:{id:{type:`string`,description:`Unique identifier for the field (e.g., 'email', 'birthdate'). This will be the key in the JSON response. Use descriptive camelCase or snake_case names.`},type:{type:`string`,enum:[`text`,`textarea`,`radio`,`dropdown`,`checkbox`,`date`,`time`,`number`],description:`Field type: 'text' for short text, 'textarea' for long text, 'radio' for 2-6 choices, 'dropdown' for many choices, 'checkbox' for multiple selections, 'date' for date picker, 'time' for time picker, 'number' for numeric input`},label:{type:`string`,description:`Field label shown to the user`},description:{type:`string`,description:`Optional help text explaining the field`},required:{type:`boolean`,description:`Whether the field is required (default: false)`},placeholder:{type:`string`,description:`Placeholder text for text/textarea fields`},validation:{type:`string`,description:`For text fields: 'email', 'url', 'phone', or a regex pattern`},minLength:{type:`number`,description:`Minimum character length for textarea fields`},maxLength:{type:`number`,description:`Maximum character length for textarea fields`},rows:{type:`number`,description:`Number of visible rows for textarea (default: 4)`},choices:{type:`array`,items:{type:`string`},description:`Array of choices for radio/dropdown/checkbox fields. Radio should have 2-6 choices, dropdown for 7+ choices.`},searchable:{type:`boolean`,description:`Make dropdown searchable (for large lists)`},minSelections:{type:`number`,description:`Minimum number of selections for checkbox fields`},maxSelections:{type:`number`,description:`Maximum number of selections for checkbox fields`},minDate:{type:`string`,description:`Minimum date (ISO format: YYYY-MM-DD)`},maxDate:{type:`string`,description:`Maximum date (ISO format: YYYY-MM-DD)`},format:{type:`string`,description:`Format for time fields: '12hr' or '24hr'`},min:{type:`number`,description:`Minimum value for number fields`},max:{type:`number`,description:`Maximum value for number fields`},step:{type:`number`,description:`Step increment for number fields`},defaultValue:{description:`Optional default/pre-filled value for the field. Type varies by field: string for text/textarea/radio/dropdown/date/time, number for number fields, array of strings for checkbox fields. For radio/dropdown, must be one of the choices. For checkbox, must be a subset of choices.`}},required:[`id`,`type`,`label`]},minItems:1}},required:[`fields`]}};function PC(e){if(e.type===`radio`){if(!Array.isArray(e.choices)||e.choices.length<2)throw Error(`Field '${e.id}': radio fields must have at least 2 choices`);return}if((e.type===`dropdown`||e.type===`checkbox`)&&(!Array.isArray(e.choices)||e.choices.length<1))throw Error(`Field '${e.id}': ${e.type} fields must have at least 1 choice`)}function FC(e){let{minSelections:t,maxSelections:n,choices:r,id:i}=e;if(t!==void 0&&n!==void 0&&t>n)throw Error(`Field '${i}': minSelections cannot be greater than maxSelections`);if(n!==void 0&&n>r.length)throw Error(`Field '${i}': maxSelections cannot exceed number of choices`);if(t!==void 0&&t>r.length)throw Error(`Field '${i}': minSelections cannot exceed number of choices`)}function IC(e){if((e.type===`text`||e.type===`textarea`)&&e.minLength!==void 0&&e.maxLength!==void 0&&e.minLength>e.maxLength)throw Error(`Field '${e.id}': minLength cannot be greater than maxLength`);if(e.type===`number`&&e.min!==void 0&&e.max!==void 0&&e.min>e.max)throw Error(`Field '${e.id}': min cannot be greater than max`);if(e.type===`date`&&e.minDate&&e.maxDate&&e.minDate>e.maxDate)throw Error(`Field '${e.id}': minDate cannot be after maxDate`);e.type===`checkbox`&&FC(e)}function LC(e,t,n){if(!e.id||typeof e.id!=`string`)throw Error(`Field ${t+1} must have a valid 'id' property`);if(!e.type||typeof e.type!=`string`)throw Error(`Field ${t+1} must have a valid 'type' property`);if(!e.label||typeof e.label!=`string`)throw Error(`Field ${t+1} must have a valid 'label' property`);if(n.has(e.id))throw Error(`Duplicate field ID: '${e.id}'`);n.add(e.id),PC(e),IC(e)}var RC={toolDefinition:NC,execute:async(e,t)=>{try{let{title:e,description:n,fields:r}=t;if(!r||!Array.isArray(r)||r.length===0)throw Error(`At least one field is required`);let i=new Set;r.forEach((e,t)=>LC(e,t,i));let a={title:e,description:n,fields:r};return{message:`Form created with ${`${r.length} field${r.length>1?`s`:``}`}${e?`: ${e}`:``}`,data:a,jsonData:a,instructions:"The form has been presented to the user. Wait for the user to fill out and submit it. They will reply with a markdown bullet list of `- {label}: {value}` lines."}}catch(e){return{message:`Form error: ${e instanceof Error?e.message:`Unknown error`}`,instructions:`Acknowledge that there was an error creating the form and suggest trying again with corrected field definitions.`}}},generatingMessage:`Preparing form...`,isEnabled:()=>!0},zC=[{name:`Contact form`,args:{title:`Contact us`,description:`We'll get back to you shortly.`,fields:[{id:`name`,type:`text`,label:`Your name`,required:!0},{id:`email`,type:`text`,label:`Email`,validation:`email`,required:!0},{id:`topic`,type:`dropdown`,label:`Topic`,choices:[`Sales`,`Support`,`Other`],required:!0},{id:`message`,type:`textarea`,label:`Message`,rows:5,maxLength:500,required:!0}]}},{name:`Survey`,args:{title:`Quick survey`,fields:[{id:`satisfaction`,type:`radio`,label:`How satisfied are you?`,choices:[`Very`,`Somewhat`,`Not at all`],required:!0},{id:`features`,type:`checkbox`,label:`Which features do you use?`,choices:[`Search`,`Export`,`Sharing`]},{id:`since`,type:`date`,label:`Using since`}]}}],BC={de:{errorSummary:`Bitte korrigieren Sie die folgenden Fehler`,requiredMarker:`*`,selectOption:`Bitte auswählen`,charactersCount:(e,t)=>`${e} / ${t} Zeichen`,charactersCountNoMax:e=>`${e} Zeichen`,submitted:`Gesendet`,submit:`Senden`,progress:(e,t)=>`${e} von ${t} Pflichtfeldern ausgefüllt`,fallbackTitle:`Formular`,fieldCount:e=>e===1?`${e} Feld`:`${e} Felder`},en:{errorSummary:`Please fix the following errors`,requiredMarker:`*`,selectOption:`Select an option`,charactersCount:(e,t)=>`${e} / ${t} characters`,charactersCountNoMax:e=>`${e} characters`,submitted:`Submitted`,submit:`Submit`,progress:(e,t)=>`${e} of ${t} required fields completed`,fallbackTitle:`Form`,fieldCount:e=>`${e} field${e===1?``:`s`}`},es:{errorSummary:`Por favor, corrija los siguientes errores`,requiredMarker:`*`,selectOption:`Seleccione una opción`,charactersCount:(e,t)=>`${e} / ${t} caracteres`,charactersCountNoMax:e=>`${e} caracteres`,submitted:`Enviado`,submit:`Enviar`,progress:(e,t)=>`${e} de ${t} campos obligatorios completados`,fallbackTitle:`Formulario`,fieldCount:e=>e===1?`${e} campo`:`${e} campos`},fr:{errorSummary:`Veuillez corriger les erreurs suivantes`,requiredMarker:`*`,selectOption:`Sélectionnez une option`,charactersCount:(e,t)=>`${e} / ${t} caractères`,charactersCountNoMax:e=>`${e} caractères`,submitted:`Envoyé`,submit:`Envoyer`,progress:(e,t)=>`${e} sur ${t} champs obligatoires remplis`,fallbackTitle:`Formulaire`,fieldCount:e=>e===1?`${e} champ`:`${e} champs`},ja:{errorSummary:`次のエラーを修正してください`,requiredMarker:`*`,selectOption:`選択してください`,charactersCount:(e,t)=>`${e} / ${t} 文字`,charactersCountNoMax:e=>`${e} 文字`,submitted:`送信済み`,submit:`送信`,progress:(e,t)=>`必須項目 ${t} 件中 ${e} 件入力済み`,fallbackTitle:`フォーム`,fieldCount:e=>`${e} 項目`},ko:{errorSummary:`다음 오류를 수정해주세요`,requiredMarker:`*`,selectOption:`선택하세요`,charactersCount:(e,t)=>`${e} / ${t} 자`,charactersCountNoMax:e=>`${e} 자`,submitted:`제출됨`,submit:`제출`,progress:(e,t)=>`필수 항목 ${t}개 중 ${e}개 입력됨`,fallbackTitle:`양식`,fieldCount:e=>`${e}개 항목`},"pt-BR":{errorSummary:`Por favor, corrija os seguintes erros`,requiredMarker:`*`,selectOption:`Selecione uma opção`,charactersCount:(e,t)=>`${e} / ${t} caracteres`,charactersCountNoMax:e=>`${e} caracteres`,submitted:`Enviado`,submit:`Enviar`,progress:(e,t)=>`${e} de ${t} campos obrigatórios preenchidos`,fallbackTitle:`Formulário`,fieldCount:e=>e===1?`${e} campo`:`${e} campos`},zh:{errorSummary:`请修正以下错误`,requiredMarker:`*`,selectOption:`请选择`,charactersCount:(e,t)=>`${e} / ${t} 字符`,charactersCountNoMax:e=>`${e} 字符`,submitted:`已提交`,submit:`提交`,progress:(e,t)=>`已填写 ${e} / ${t} 个必填字段`,fallbackTitle:`表单`,fieldCount:e=>`${e} 个字段`}};function VC(e){return Object.prototype.hasOwnProperty.call(BC,e)}function HC(){let e=Hn(zy,void 0)?.locale??I(`en`);return U(()=>VC(e.value)?BC[e.value]:BC.en)}var UC={class:`w-full h-full overflow-y-auto p-8`,"data-testid":`present-form-view`},WC={key:0,class:`max-w-3xl w-full mx-auto`},GC={key:0,class:`text-gray-900 text-3xl font-bold mb-4 text-center`},KC={key:1,class:`text-gray-600 text-center mb-8 text-lg`},qC={key:2,class:`bg-red-50 border-2 border-red-500 rounded-lg p-4 mb-6`,role:`alert`},JC={class:`text-red-800 font-semibold mb-2 flex items-center gap-2`},YC={class:`text-red-700 space-y-1`},XC=[`href`,`onClick`],ZC=[`id`],QC=[`for`],$C={key:0,class:`text-red-500 ml-1`,"aria-label":`required`},ew={key:0,class:`text-gray-600 text-sm mb-2`},tw=[`id`,`onUpdate:modelValue`,`placeholder`,`aria-invalid`,`aria-describedby`,`onBlur`,`onInput`],nw=[`id`,`onUpdate:modelValue`,`placeholder`,`rows`,`aria-invalid`,`aria-describedby`,`onBlur`,`onInput`],rw=[`id`,`onUpdate:modelValue`,`min`,`max`,`step`,`aria-invalid`,`aria-describedby`,`onBlur`,`onInput`],iw=[`id`,`onUpdate:modelValue`,`min`,`max`,`aria-invalid`,`aria-describedby`,`onBlur`,`onChange`],aw=[`id`,`onUpdate:modelValue`,`aria-invalid`,`aria-describedby`,`onBlur`,`onChange`],ow=[`aria-invalid`,`aria-describedby`],sw=[`onUpdate:modelValue`,`name`,`value`,`onChange`,`onBlur`],cw={class:`text-gray-800`},lw=[`id`,`onUpdate:modelValue`,`aria-invalid`,`aria-describedby`,`onBlur`,`onChange`],uw={value:null,disabled:``},dw=[`value`],fw=[`aria-invalid`,`aria-describedby`],pw=[`onUpdate:modelValue`,`value`,`onChange`,`onBlur`],mw={class:`text-gray-800`},hw=[`id`],gw={class:`mt-8 flex justify-center`},_w=[`disabled`],vw={class:`mt-4 text-center text-gray-600 text-sm`},yw=254,bw=((e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n})(dr({__name:`View`,props:{selectedResult:{},sendTextMessage:{type:Function}},emits:[`updateResult`],setup(e,{emit:t}){let n=HC(),r=e,i=t,a=I(null),o=I({}),s=I(new Set),c=I(new Map),l=I(!1),u=I(!1),d=I(!1);function f(e,t){return!t||!t.jsonData||t.uuid!==e.uuid||t.jsonData!==e.jsonData}function p(e){e.userResponses&&Object.assign(o.value,e.userResponses),e.touched&&(s.value=new Set(e.touched),e.touched.forEach(e=>re(e))),e.submitted!==void 0&&(l.value=e.submitted)}function m(e){d.value=!0,a.value=e.jsonData,o.value={},a.value.fields.forEach(e=>{o.value[e.id]=b(e)}),e.viewState&&p(e.viewState),d.value=!1}Gn(()=>r.selectedResult,(e,t)=>{!e||e.toolName!==`presentForm`||!e.jsonData||f(e,t)&&m(e)},{immediate:!0}),Gn([o,s,l],()=>{d.value||!r.selectedResult||i(`updateResult`,{...r.selectedResult,viewState:{userResponses:{...o.value},touched:Array.from(s.value),submitted:l.value}})},{deep:!0});function h(e){if(!e)return``;if(typeof e==`string`)return e;if(typeof e==`object`){if(`label`in e&&e.label!==void 0&&e.label!==null)return String(e.label||``);if(`value`in e&&e.value!==void 0&&e.value!==null)return String(e.value||``)}return String(e)}function g(e){if(!e)return``;if(typeof e==`string`)return e;if(typeof e==`object`){if(`value`in e&&e.value!==void 0&&e.value!==null)return String(e.value||``);if(`label`in e&&e.label!==void 0&&e.label!==null)return String(e.label||``)}return String(e)}function _(e,t){if(e===t)return!0;if(!e)return!1;let n=g(e),r=h(e),i=t;return t&&typeof t==`object`&&(`value`in t?i=t.value:`label`in t&&(i=t.label)),String(n)===String(i)||String(r)===String(i)}function v(e,t){if(e.type===`radio`||e.type===`dropdown`){let n=e.choices.findIndex(e=>_(e,t));return n===-1?null:n}return e.type===`checkbox`?Array.isArray(t)?t.map(t=>e.choices.findIndex(e=>_(e,t))).filter(e=>e!==-1):[]:t}function y(e){return e.type===`text`||e.type===`textarea`||e.type===`date`||e.type===`time`?``:e.type===`number`?e.min===void 0?0:e.min:e.type===`checkbox`?[]:null}function b(e){let t=e.defaultValue;return t===void 0?y(e):v(e,t)}function x(e){return e==null?!0:typeof e==`string`?e.trim()===``:Array.isArray(e)?e.length===0:!1}function S(e){if(!e||e.length>yw)return!1;let t=e.indexOf(`@`);if(t<=0||t!==e.lastIndexOf(`@`))return!1;let n=e.slice(0,t),r=e.slice(t+1);if(/\s/.test(n)||/\s/.test(r))return!1;let i=r.lastIndexOf(`.`);return i>0&&i<r.length-1}function C(e){try{return new URL(e),!0}catch{return!1}}function ee(e){return/^[\d\s\-+()]+$/.test(e)&&e.replace(/\D/g,``).length>=10}function te(e,t){if(e.validation===`email`&&!S(t))return`Please enter a valid email address`;if(e.validation===`url`&&!C(t))return`Please enter a valid URL`;if(e.validation===`phone`&&!ee(t))return`Please enter a valid phone number`;if(typeof e.validation==`string`&&![`email`,`url`,`phone`].includes(e.validation))try{if(!new RegExp(e.validation).test(t))return`${e.label} format is invalid`}catch{console.warn(`Invalid regex pattern: ${e.validation}`)}return null}function ne(e,t){return e.minLength&&t.length<e.minLength?`Must be at least ${e.minLength} characters (currently ${t.length})`:e.maxLength&&t.length>e.maxLength?`Must be no more than ${e.maxLength} characters (currently ${t.length})`:null}function w(e,t){return e.min!==void 0&&t<e.min?`Must be at least ${e.min}`:e.max!==void 0&&t>e.max?`Must be no more than ${e.max}`:null}function T(e,t){return e.minDate&&t<e.minDate?`Date must be on or after ${e.minDate}`:e.maxDate&&t>e.maxDate?`Date must be on or before ${e.maxDate}`:null}function E(e,t){let n=t?.length||0;return e.minSelections&&n<e.minSelections?`Please select at least ${e.minSelections} option${e.minSelections>1?`s`:``}`:e.maxSelections&&n>e.maxSelections?`Please select no more than ${e.maxSelections} option${e.maxSelections>1?`s`:``}`:null}function D(e,t){return e.required&&x(t)?`${e.label} is required`:x(t)?null:e.type===`text`?te(e,t):e.type===`textarea`?ne(e,t):e.type===`number`?w(e,t):e.type===`date`?T(e,t):e.type===`checkbox`?E(e,t):null}function re(e){let t=a.value?.fields.find(t=>t.id===e);if(!t)return!0;let n=o.value[e],r=D(t,n);return r?(c.value.set(e,{fieldId:e,message:r,type:`custom`}),!1):(c.value.delete(e),!0)}function O(e){s.value.add(e),re(e)}function k(e){s.value.has(e)&&re(e)}function A(e){return c.value.has(e)}function j(e){let t=document.getElementById(`input-${e}`);t&&(t.focus(),t.scrollIntoView({behavior:`smooth`,block:`center`}))}function ie(e){return(e.type===`text`||e.type===`textarea`)&&e.maxLength!==void 0}function ae(e){if(e.type!==`text`&&e.type!==`textarea`)return!1;let{maxLength:t}=e;return t?(o.value[e.id]||``).length/t>.9:!1}let oe=U(()=>a.value?.fields.filter(e=>e.required).length||0),se=U(()=>a.value?a.value.fields.filter(e=>e.required&&!x(o.value[e.id])).length:0);function ce(){if(l.value)return;if(a.value?.fields.forEach(e=>{s.value.add(e.id),re(e.id)}),c.value.size>0){u.value=!0;let[e]=Array.from(c.value.keys());j(e);return}let e=[];a.value?.title&&e.push(`**${ue(a.value.title)}**`,``),a.value?.fields.forEach(t=>{e.push(`- ${ue(t.label)}: ${de(t,o.value[t.id])}`)}),l.value=!0,r.sendTextMessage(e.join(`
180
+ `))}function le(e){return e.replace(/\n/g,`
181
+ `)}function ue(e){return typeof e==`string`?e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e.length>0).join(` `):h(e)}function de(e,t){let n=`(none)`;if(e.type===`radio`||e.type===`dropdown`)return t==null?n:ue(e.choices[t]);if(e.type===`checkbox`){let r=(t||[]).map(t=>ue(e.choices[t]));return r.length===0?n:`\n - ${r.join(`
182
+ - `)}`}if(typeof t==`string`){let e=t.trim();return e===``?n:le(e)}return t==null?n:String(t)}return(e,t)=>(z(),B(`div`,UC,[a.value?(z(),B(`div`,WC,[a.value.title?(z(),B(`h2`,GC,N(a.value.title),1)):H(``,!0),a.value.description?(z(),B(`p`,KC,N(a.value.description),1)):H(``,!0),u.value&&c.value.size>0?(z(),B(`div`,qC,[V(`h3`,JC,[t[0]||=V(`svg`,{class:`w-5 h-5`,fill:`currentColor`,viewBox:`0 0 20 20`,"aria-hidden":`true`},[V(`path`,{"fill-rule":`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z`,"clip-rule":`evenodd`})],-1),ba(` `+N(L(n).errorSummary),1)]),V(`ul`,YC,[(z(!0),B(R,null,Br(c.value,([e,t])=>(z(),B(`li`,{key:e},[V(`a`,{href:`#${e}`,class:`hover:underline cursor-pointer`,onClick:Qo(t=>j(e),[`prevent`])},N(t.message),9,XC)]))),128))])])):H(``,!0),V(`form`,{class:`space-y-6`,onSubmit:Qo(ce,[`prevent`])},[(z(!0),B(R,null,Br(a.value.fields,e=>(z(),B(`div`,{id:e.id,key:e.id,class:Ce([`form-field`,{"has-error":A(e.id)&&s.value.has(e.id)}])},[V(`label`,{for:`input-${e.id}`,class:Ce([`block text-gray-800 font-semibold mb-2`,{"text-red-600":A(e.id)&&s.value.has(e.id)}])},[ba(N(e.label)+` `,1),e.required?(z(),B(`span`,$C,N(L(n).requiredMarker),1)):H(``,!0)],10,QC),e.description?(z(),B(`p`,ew,N(e.description),1)):H(``,!0),e.type===`text`?zn((z(),B(`input`,{key:1,id:`input-${e.id}`,"onUpdate:modelValue":t=>o.value[e.id]=t,type:`text`,placeholder:e.placeholder,"aria-invalid":A(e.id)&&s.value.has(e.id),"aria-describedby":A(e.id)&&s.value.has(e.id)?`${e.id}-error`:void 0,class:Ce([`w-full px-4 py-2 border-2 border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 transition-colors`,{"border-red-500 focus:ring-red-500":A(e.id)&&s.value.has(e.id),"border-gray-300":!A(e.id)||!s.value.has(e.id)}]),onBlur:t=>O(e.id),onInput:t=>k(e.id)},null,42,tw)),[[Ho,o.value[e.id]]]):e.type===`textarea`?zn((z(),B(`textarea`,{key:2,id:`input-${e.id}`,"onUpdate:modelValue":t=>o.value[e.id]=t,placeholder:e.placeholder,rows:e.rows||4,"aria-invalid":A(e.id)&&s.value.has(e.id),"aria-describedby":A(e.id)&&s.value.has(e.id)?`${e.id}-error`:void 0,class:Ce([`w-full px-4 py-2 border-2 border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 transition-colors resize-y`,{"border-red-500 focus:ring-red-500":A(e.id)&&s.value.has(e.id),"border-gray-300":!A(e.id)||!s.value.has(e.id)}]),onBlur:t=>O(e.id),onInput:t=>k(e.id)},null,42,nw)),[[Ho,o.value[e.id]]]):e.type===`number`?zn((z(),B(`input`,{key:3,id:`input-${e.id}`,"onUpdate:modelValue":t=>o.value[e.id]=t,type:`number`,min:e.min,max:e.max,step:e.step,"aria-invalid":A(e.id)&&s.value.has(e.id),"aria-describedby":A(e.id)&&s.value.has(e.id)?`${e.id}-error`:void 0,class:Ce([`w-full px-4 py-2 border-2 border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 transition-colors`,{"border-red-500 focus:ring-red-500":A(e.id)&&s.value.has(e.id),"border-gray-300":!A(e.id)||!s.value.has(e.id)}]),onBlur:t=>O(e.id),onInput:t=>k(e.id)},null,42,rw)),[[Ho,o.value[e.id],void 0,{number:!0}]]):e.type===`date`?zn((z(),B(`input`,{key:4,id:`input-${e.id}`,"onUpdate:modelValue":t=>o.value[e.id]=t,type:`date`,min:e.minDate,max:e.maxDate,"aria-invalid":A(e.id)&&s.value.has(e.id),"aria-describedby":A(e.id)&&s.value.has(e.id)?`${e.id}-error`:void 0,class:Ce([`w-full px-4 py-2 border-2 border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 transition-colors`,{"border-red-500 focus:ring-red-500":A(e.id)&&s.value.has(e.id),"border-gray-300":!A(e.id)||!s.value.has(e.id)}]),onBlur:t=>O(e.id),onChange:t=>k(e.id)},null,42,iw)),[[Ho,o.value[e.id]]]):e.type===`time`?zn((z(),B(`input`,{key:5,id:`input-${e.id}`,"onUpdate:modelValue":t=>o.value[e.id]=t,type:`time`,"aria-invalid":A(e.id)&&s.value.has(e.id),"aria-describedby":A(e.id)&&s.value.has(e.id)?`${e.id}-error`:void 0,class:Ce([`w-full px-4 py-2 border-2 border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 transition-colors`,{"border-red-500 focus:ring-red-500":A(e.id)&&s.value.has(e.id),"border-gray-300":!A(e.id)||!s.value.has(e.id)}]),onBlur:t=>O(e.id),onChange:t=>k(e.id)},null,42,aw)),[[Ho,o.value[e.id]]]):e.type===`radio`?(z(),B(`div`,{key:6,class:`space-y-2`,role:`radiogroup`,"aria-invalid":A(e.id)&&s.value.has(e.id),"aria-describedby":A(e.id)&&s.value.has(e.id)?`${e.id}-error`:void 0},[(z(!0),B(R,null,Br(e.choices,(t,n)=>(z(),B(`label`,{key:n,class:Ce([`flex items-center p-3 border-2 border-gray-300 rounded-lg cursor-pointer transition-all hover:bg-gray-50`,{"border-blue-500 bg-blue-50":o.value[e.id]===n,"border-gray-300":o.value[e.id]!==n}])},[zn(V(`input`,{"onUpdate:modelValue":t=>o.value[e.id]=t,type:`radio`,name:e.id,value:n,class:`mr-3 h-4 w-4 flex-shrink-0`,onChange:t=>k(e.id),onBlur:t=>O(e.id)},null,40,sw),[[Go,o.value[e.id]]]),V(`span`,cw,N(h(t)),1)],2))),128))],8,ow)):e.type===`dropdown`?zn((z(),B(`select`,{key:7,id:`input-${e.id}`,"onUpdate:modelValue":t=>o.value[e.id]=t,"aria-invalid":A(e.id)&&s.value.has(e.id),"aria-describedby":A(e.id)&&s.value.has(e.id)?`${e.id}-error`:void 0,class:Ce([`w-full px-4 py-2 border-2 border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 transition-colors bg-white`,{"border-red-500 focus:ring-red-500":A(e.id)&&s.value.has(e.id),"border-gray-300":!A(e.id)||!s.value.has(e.id)}]),onBlur:t=>O(e.id),onChange:t=>k(e.id)},[V(`option`,uw,N(L(n).selectOption),1),(z(!0),B(R,null,Br(e.choices,(e,t)=>(z(),B(`option`,{key:t,value:t},N(h(e)),9,dw))),128))],42,lw)),[[Ko,o.value[e.id]]]):e.type===`checkbox`?(z(),B(`div`,{key:8,class:`space-y-2`,role:`group`,"aria-invalid":A(e.id)&&s.value.has(e.id),"aria-describedby":A(e.id)&&s.value.has(e.id)?`${e.id}-error`:void 0},[(z(!0),B(R,null,Br(e.choices,(t,n)=>(z(),B(`label`,{key:n,class:Ce([`flex items-center p-3 border-2 border-gray-300 rounded-lg cursor-pointer transition-all hover:bg-gray-50`,{"border-blue-500 bg-blue-50":(o.value[e.id]||[]).includes(n),"border-gray-300":!(o.value[e.id]||[]).includes(n)}])},[zn(V(`input`,{"onUpdate:modelValue":t=>o.value[e.id]=t,type:`checkbox`,value:n,class:`mr-3 h-4 w-4 flex-shrink-0`,onChange:t=>k(e.id),onBlur:t=>O(e.id)},null,40,pw),[[Uo,o.value[e.id]]]),V(`span`,mw,N(h(t)),1)],2))),128))],8,fw)):H(``,!0),A(e.id)&&s.value.has(e.id)?(z(),B(`div`,{key:9,id:`${e.id}-error`,class:`flex items-center gap-2 mt-2 text-red-600 text-sm`,role:`alert`},[t[1]||=V(`svg`,{class:`w-4 h-4 flex-shrink-0`,fill:`currentColor`,viewBox:`0 0 20 20`,"aria-hidden":`true`},[V(`path`,{"fill-rule":`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z`,"clip-rule":`evenodd`})],-1),ba(` `+N(c.value.get(e.id)?.message),1)],8,hw)):H(``,!0),ie(e)?(z(),B(`div`,{key:10,class:Ce([`text-sm mt-2`,{"text-amber-600 font-semibold":ae(e),"text-gray-500":!ae(e)}])},[e.maxLength?(z(),B(R,{key:0},[ba(N(L(n).charactersCount((o.value[e.id]||``).length,e.maxLength)),1)],64)):(z(),B(R,{key:1},[ba(N(L(n).charactersCountNoMax((o.value[e.id]||``).length)),1)],64))],2)):H(``,!0)],10,ZC))),128)),V(`div`,gw,[V(`button`,{type:`submit`,disabled:l.value,class:Ce([l.value?`bg-green-600 cursor-default`:`bg-blue-600 hover:bg-blue-700`,`px-8 py-3 rounded-lg text-white font-semibold text-lg transition-colors`])},N(l.value?L(n).submitted:L(n).submit),11,_w)]),V(`div`,vw,N(L(n).progress(se.value,oe.value)),1)],32)])):H(``,!0)]))}}),[[`__scopeId`,`data-v-2b6705b6`]]),xw={class:`w-full h-full flex flex-col items-center justify-center p-4 bg-gradient-to-br from-blue-50 to-indigo-50 rounded-lg border-2 border-gray-200`},Sw={class:`text-center`},Cw={class:`text-gray-900 font-bold text-lg mb-1 line-clamp-2`},ww={class:`text-gray-600 text-sm mb-2`},Tw={key:0,class:`flex items-center justify-center gap-2`},Ew={class:`w-32 h-2 bg-gray-200 rounded-full overflow-hidden`},Dw={class:`text-xs text-gray-500`},Ow={key:1,class:`inline-flex items-center gap-1 px-3 py-1 bg-green-100 text-green-700 rounded-full text-xs font-semibold`},kw=dr({__name:`Preview`,props:{result:{}},setup(e){let t=HC(),n=e,r=U(()=>n.result?.toolName===`presentForm`?n.result.data??n.result.jsonData:null),i=U(()=>n.result?.viewState||null),a=U(()=>r.value?.fields.length||0),o=U(()=>i.value?.submitted||!1),s=U(()=>{if(!r.value||o.value)return 100;let e=r.value.fields.filter(e=>e.required);if(e.length===0)return 0;let t=i.value?.userResponses||{},n=e.filter(e=>{let n=t[e.id];return n==null?!1:typeof n==`string`?n.trim()!==``:Array.isArray(n)?n.length>0:!0}).length;return Math.round(n/e.length*100)});return(e,n)=>(z(),B(`div`,xw,[V(`div`,Sw,[n[1]||=V(`svg`,{class:`w-12 h-12 mx-auto mb-3 text-blue-600`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[V(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z`})],-1),V(`h3`,Cw,N(r.value?.title||L(t).fallbackTitle),1),V(`p`,ww,N(L(t).fieldCount(a.value)),1),o.value?(z(),B(`div`,Ow,[n[0]||=V(`svg`,{class:`w-3 h-3`,fill:`currentColor`,viewBox:`0 0 20 20`},[V(`path`,{"fill-rule":`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z`,"clip-rule":`evenodd`})],-1),ba(` `+N(L(t).submitted),1)])):(z(),B(`div`,Tw,[V(`div`,Ew,[V(`div`,{class:`h-full bg-blue-600 transition-all duration-300`,style:ve({width:`${s.value}%`})},null,4)]),V(`span`,Dw,N(`${s.value}%`),1)]))])]))}}),Aw=`Use the presentForm tool to collect structured input from the user with a form, instead of asking for everything as free text. Supports text, textarea, number, radio, dropdown, checkbox, date, and time fields, each with optional validation. When the user submits, their answers arrive as your next message — wait for it before continuing.`,jw={...RC,viewComponent:bw,previewComponent:kw,samples:zC,systemPrompt:Aw},Mw=`generateImage`,Nw={type:`function`,name:Mw,description:`Generate an image based on the prompt and display it on the screen. Be descriptive and specify the concrete details of the images in the prompt. Each call generates one image.`,parameters:{type:`object`,properties:{prompt:{type:`string`,description:`A detailed prompt describing the image to generate`}},required:[`prompt`]}},Pw=[{name:`Sunset Beach`,args:{imageData:`https://picsum.photos/id/28/800/600`,prompt:`A beautiful sunset over a calm ocean beach with palm trees`}},{name:`Mountain Lake`,args:{imageData:`https://picsum.photos/id/29/800/600`,prompt:`A serene mountain lake surrounded by pine trees and snow-capped peaks`}},{name:`City Skyline`,args:{imageData:`https://picsum.photos/id/43/800/600`,prompt:`A modern city skyline at night with glowing skyscrapers`}},{name:`Forest Path`,args:{imageData:`https://picsum.photos/id/15/800/600`,prompt:`A winding path through an enchanted forest with sunlight filtering through the leaves`}}];function Fw(e,t,n){return{toolName:Mw,data:{imageData:e,prompt:n},message:``,title:t}}var Iw={toolDefinition:Nw,execute:async(e,t)=>{let{prompt:n}=t;return e.app?.generateImage?e.app.generateImage(n):{message:`generateImage function not available`}},generatingMessage:`Generating image...`,isEnabled:()=>!0,inputHandlers:[{type:`file`,acceptedTypes:[`image/png`,`image/jpeg`],handleInput:(e,t)=>Fw(e,t,``)},{type:`clipboard-image`,handleInput:e=>Fw(e,`clipboard-image.png`,``)}],systemPrompt:`When you are talking about places, objects, people, movies, books and other things, you MUST use the ${Mw} API to draw pictures to make the conversation more engaging.`,backends:[`imageGen`],samples:Pw},Lw={class:`w-full h-full overflow-y-auto`},Rw={class:`min-h-full flex flex-col items-center justify-center p-4`},zw={class:`flex-1 flex items-center justify-center min-h-0`},Bw=[`src`],Vw={key:0,class:`mt-4 p-3 bg-gray-100 dark:bg-gray-800 rounded-lg max-w-full flex-shrink-0`},Hw={class:`text-sm text-gray-700 dark:text-gray-300`},Uw=dr({__name:`ImageView`,props:{selectedResult:{}},setup(e){return(t,n)=>(z(),B(`div`,Lw,[V(`div`,Rw,[V(`div`,zw,[V(`img`,{src:e.selectedResult.data?.imageData,class:`max-w-full max-h-full object-contain rounded`,alt:`Current generated image`},null,8,Bw)]),e.selectedResult.data?.prompt?(z(),B(`div`,Vw,[V(`p`,Hw,[n[0]||=V(`span`,{class:`font-medium`},`Prompt:`,-1),ba(` `+N(e.selectedResult.data.prompt),1)])])):H(``,!0)])]))}}),Ww={class:`min-h-24 flex items-center justify-center`},Gw=[`src`],Kw={key:1,class:`text-gray-400 text-sm`},qw=dr({__name:`ImagePreview`,props:{result:{}},setup(e){return(t,n)=>(z(),B(`div`,Ww,[e.result.data?.imageData?(z(),B(`img`,{key:0,src:e.result.data.imageData,class:`max-w-full h-auto rounded`,alt:`Generated image`},null,8,Gw)):(z(),B(`div`,Kw,`No image yet`))]))}}),Jw=dr({__name:`View`,props:{selectedResult:{},sendTextMessage:{type:Function}},emits:[`updateResult`],setup(e){let t=e,n=I(null);return Gn(()=>t.selectedResult,e=>{e?.toolName===`generateImage`&&e.data&&(n.value=e)},{immediate:!0,deep:!0}),(e,t)=>n.value?(z(),da(L(Uw),{key:0,selectedResult:n.value},null,8,[`selectedResult`])):H(``,!0)}}),Yw=dr({__name:`Preview`,props:{result:{}},setup(e){return(t,n)=>(z(),da(L(qw),{result:e.result},null,8,[`result`]))}}),Xw={plugin:{...Iw,viewComponent:Jw,previewComponent:Yw}};function Zw(e,t){return`plugin:${e}:${t}`}var Qw=new Set([`http:`,`https:`]);function $w(e){return t=>{let n;try{n=new URL(t)}catch{console.warn(`[plugin/${e}] openUrl rejected unparseable URL`,{url:t});return}if(!Qw.has(n.protocol)){console.warn(`[plugin/${e}] openUrl rejected non-http(s) scheme`,{scheme:n.protocol});return}window.open(t,`_blank`,`noopener,noreferrer`)}}function eT(e){let t=`/api/plugin/${encodeURIComponent(e)}`;return async n=>{let r=await fetch(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n??{})});if(!r.ok){let t=await r.text().catch(()=>``);throw Error(`plugin/${e} dispatch failed (${r.status}): ${t||r.statusText}`)}return await r.json()}}var tT=I(`en`);function nT(e){let{scope:t,toolName:n}=e,{subscribe:r}=rv(),i=`[plugin/${t}]`;return{pubsub:{subscribe(e,n){return r(Zw(t,e),n)}},locale:U(()=>tT.value),log:{debug:(e,t)=>console.debug(i,e,t),info:(e,t)=>console.info(i,e,t),warn:(e,t)=>console.warn(i,e,t),error:(e,t)=>console.error(i,e,t)},openUrl:$w(t),dispatch:eT(n),endpoints:void 0}}function rT(e,t,n){return Qt(dr({name:`PluginRuntimeScope:${e}`,inheritAttrs:!1,setup(r,{attrs:i,slots:a}){return Vn(zy,nT({scope:e,toolName:t})),()=>Ja(n,i,a)}}))}var iT={"@mulmoclaude/markdown-plugin":{toolName:MC.toolDefinition.name,viewComponent:rT(`markdown`,MC.toolDefinition.name,MC.viewComponent),css:`/*! tailwindcss v4.3.1 | MIT License | https://tailwindcss.com */
183
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-font-weight:initial;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-500:oklch(63.7% .237 25.331);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-700:oklch(49.6% .265 301.924);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--font-weight-medium:500;--font-weight-semibold:600;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.static{position:static}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.m-auto{margin:auto}.mx-2{margin-inline:calc(var(--spacing) * 2)}.mt-1{margin-top:var(--spacing)}.mr-auto{margin-right:auto}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.line-clamp-4{-webkit-line-clamp:4;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.hidden{display:none}.inline{display:inline}.table{display:table}.h-8{height:calc(var(--spacing) * 8)}.h-full{height:100%}.min-h-0{min-height:0}.min-h-full{min-height:100%}.w-full{width:100%}.max-w-none{max-width:none}.flex-1{flex:1}.flex-shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.resize{resize:both}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:var(--spacing)}.gap-2{gap:calc(var(--spacing) * 2)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.border{border-style:var(--tw-border-style);border-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-gray-100{border-color:var(--color-gray-100)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-green-600{background-color:var(--color-green-600)}.bg-purple-100{background-color:var(--color-purple-100)}.bg-white{background-color:var(--color-white)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-8{padding:calc(var(--spacing) * 8)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-2{padding-block:calc(var(--spacing) * 2)}.pl-2{padding-left:calc(var(--spacing) * 2)}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.break-words{overflow-wrap:break-word}.whitespace-pre-line{white-space:pre-line}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-purple-700{color:var(--color-purple-700)}.text-red-500{color:var(--color-red-500)}.text-white{color:var(--color-white)}.lowercase{text-transform:lowercase}.italic{font-style:italic}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a)) drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a) drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.grayscale{--tw-grayscale:grayscale(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.invert{--tw-invert:invert(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.sepia{--tw-sepia:sepia(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media (hover:hover){.hover\\:bg-gray-200:hover{background-color:var(--color-gray-200)}.hover\\:bg-green-700:hover{background-color:var(--color-green-700)}}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-60:disabled{opacity:.6}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}.marp-container[data-v-1ec606a9]{background:#f8fafc;border-radius:6px;flex-direction:column;width:100%;display:flex}.marp-frame-wrapper[data-v-1ec606a9]{flex:1;min-height:0;overflow-y:auto}.marp-frame[data-v-1ec606a9]{background:0 0;border:none;display:block}.load-error-banner[data-v-1ec606a9]{color:#b71c1c;background:#fdecea;border:1px solid #f5c2c7;border-radius:4px;margin:.75rem 1rem;padding:.5rem .75rem;font-size:.875rem}.marp-split-textarea[data-v-dfff3148]{color:#333;resize:none;background:#fff;border:none;border-radius:0;width:100%;padding:1rem;font-family:Courier New,monospace;font-size:.9rem;line-height:1.5}.marp-split-textarea[data-v-dfff3148]:focus{outline:none}.markdown-container[data-v-0b1ec4b2]{background:#fff;flex-direction:column;width:100%;height:100%;display:flex}.markdown-content-wrapper[data-v-0b1ec4b2]{flex:1;min-height:0;overflow-y:auto}.markdown-content[data-v-0b1ec4b2] h1{margin-top:1em;margin-bottom:.5em;font-size:2rem;font-weight:700}.markdown-content[data-v-0b1ec4b2] h2{margin-top:1em;margin-bottom:.5em;font-size:1.75rem;font-weight:700}.markdown-content[data-v-0b1ec4b2] h3{margin-top:1em;margin-bottom:.5em;font-size:1.5rem;font-weight:700}.markdown-content[data-v-0b1ec4b2] h4{margin-top:1em;margin-bottom:.5em;font-size:1.25rem;font-weight:700}.markdown-content[data-v-0b1ec4b2] h5{margin-top:1em;margin-bottom:.5em;font-size:1.125rem;font-weight:700}.markdown-content[data-v-0b1ec4b2] h6{margin-top:1em;margin-bottom:.5em;font-size:1rem;font-weight:700}.bottom-bar-wrapper[data-v-0b1ec4b2]{flex-shrink:0;position:relative}.copy-btn[data-v-0b1ec4b2]{color:#333;cursor:pointer;z-index:1;background:0 0;border:none;padding:.4rem;position:absolute;bottom:.3rem;right:.65rem}.copy-btn[data-v-0b1ec4b2]:hover{color:#000}.copy-btn .material-icons[data-v-0b1ec4b2]{font-size:1.15rem}.markdown-source[data-v-0b1ec4b2]{background:#f5f5f5;border-top:1px solid #e0e0e0;flex-shrink:0;padding:.5rem;font-family:monospace;font-size:.85rem}.markdown-source summary[data-v-0b1ec4b2]{cursor:pointer;-webkit-user-select:none;user-select:none;color:#333;background:#e8e8e8;border-radius:4px;padding:.5rem;font-weight:500}.markdown-source[open] summary[data-v-0b1ec4b2]{margin-bottom:.5rem}.markdown-source summary[data-v-0b1ec4b2]:hover{background:#d8d8d8}.markdown-editor[data-v-0b1ec4b2]{color:#333;resize:vertical;background:#fff;border:1px solid #ccc;border-radius:4px;width:100%;height:40vh;margin-bottom:.5rem;padding:1rem;font-family:Courier New,monospace;font-size:.9rem;line-height:1.5}.markdown-editor[data-v-0b1ec4b2]:focus{border-color:#4caf50;outline:none;box-shadow:0 0 0 2px #4caf501a}.apply-btn[data-v-0b1ec4b2]{color:#fff;cursor:pointer;background:#4caf50;border:none;border-radius:4px;padding:.5rem 1rem;font-size:.9rem;font-weight:500;transition:background .2s}.apply-btn[data-v-0b1ec4b2]:hover{background:#45a049}.apply-btn[data-v-0b1ec4b2]:active{background:#3d8b40}.apply-btn[data-v-0b1ec4b2]:disabled{color:#666;cursor:not-allowed;opacity:.6;background:#ccc}.apply-btn[data-v-0b1ec4b2]:disabled:hover{background:#ccc}.editor-actions[data-v-0b1ec4b2]{justify-content:space-between;display:flex}.save-error[data-v-0b1ec4b2]{color:#b71c1c;background:#fdecea;border:1px solid #f5c2c7;border-radius:4px;margin:.5rem 0 0;padding:.4rem .6rem;font-size:.85rem}.load-error-banner[data-v-0b1ec4b2]{color:#b71c1c;background:#fdecea;border:1px solid #f5c2c7;border-radius:4px;margin:.75rem 1rem;padding:.5rem .75rem;font-size:.875rem}.cancel-btn[data-v-0b1ec4b2]{color:#333;cursor:pointer;background:#e0e0e0;border:none;border-radius:4px;padding:.5rem 1rem;font-size:.9rem;font-weight:500;transition:background .2s}.cancel-btn[data-v-0b1ec4b2]:hover{background:#d0d0d0}`},"@mulmoclaude/form-plugin":{toolName:jw.toolDefinition.name,viewComponent:jw.viewComponent,css:`/*! tailwindcss v4.3.1 | MIT License | https://tailwindcss.com */
184
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-font-weight:initial;--tw-duration:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-amber-600:oklch(66.6% .179 58.318);--color-green-100:oklch(96.2% .044 156.743);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-blue-50:oklch(97% .014 254.604);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-indigo-50:oklch(96.2% .018 272.314);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-semibold:600;--font-weight-bold:700;--radius-lg:.5rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.collapse{visibility:collapse}.visible{visibility:visible}.mx-auto{margin-inline:auto}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-8{margin-top:calc(var(--spacing) * 8)}.mr-3{margin-right:calc(var(--spacing) * 3)}.mb-1{margin-bottom:var(--spacing)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.ml-1{margin-left:var(--spacing)}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.h-2{height:calc(var(--spacing) * 2)}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-12{height:calc(var(--spacing) * 12)}.h-full{height:100%}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-12{width:calc(var(--spacing) * 12)}.w-32{width:calc(var(--spacing) * 32)}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.flex-shrink-0{flex-shrink:0}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.resize-y{resize:vertical}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.gap-1{gap:var(--spacing)}.gap-2{gap:calc(var(--spacing) * 2)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-blue-500{border-color:var(--color-blue-500)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-red-500{border-color:var(--color-red-500)}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-600{background-color:var(--color-blue-600)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-green-100{background-color:var(--color-green-100)}.bg-green-600{background-color:var(--color-green-600)}.bg-red-50{background-color:var(--color-red-50)}.bg-white{background-color:var(--color-white)}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-blue-50{--tw-gradient-from:var(--color-blue-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-indigo-50{--tw-gradient-to:var(--color-indigo-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-8{padding:calc(var(--spacing) * 8)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-8{padding-inline:calc(var(--spacing) * 8)}.py-1{padding-block:var(--spacing)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.text-center{text-align:center}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-amber-600{color:var(--color-amber-600)}.text-blue-600{color:var(--color-blue-600)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-green-700{color:var(--color-green-700)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-red-800{color:var(--color-red-800)}.text-white{color:var(--color-white)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-300{--tw-duration:.3s;transition-duration:.3s}@media (hover:hover){.hover\\:bg-blue-700:hover{background-color:var(--color-blue-700)}.hover\\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\\:underline:hover{text-decoration-line:underline}}.focus\\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\\:ring-blue-500:focus{--tw-ring-color:var(--color-blue-500)}.focus\\:ring-red-500:focus{--tw-ring-color:var(--color-red-500)}.focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}.form-field[data-v-2b6705b6]{transition:all .2s}.form-field.has-error[data-v-2b6705b6]{animation:.3s shake-2b6705b6}@keyframes shake-2b6705b6{0%,to{transform:translate(0)}25%{transform:translate(-5px)}75%{transform:translate(5px)}}`},"@mulmochat-plugin/generate-image":{toolName:Xw.plugin.toolDefinition.name,viewComponent:Xw.plugin.viewComponent,css:`/*! tailwindcss v4.3.1 | MIT License | https://tailwindcss.com */
185
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--radius-md:.375rem;--radius-lg:.5rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.mt-4{margin-top:calc(var(--spacing) * 4)}.block{display:block}.contents{display:contents}.flex{display:flex}.hidden{display:none}.inline{display:inline}.table{display:table}.h-auto{height:auto}.h-full{height:100%}.max-h-full{max-height:100%}.min-h-0{min-height:0}.min-h-24{min-height:calc(var(--spacing) * 24)}.min-h-full{min-height:100%}.w-full{width:100%}.max-w-full{max-width:100%}.flex-1{flex:1}.flex-shrink{flex-shrink:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.grow{flex-grow:1}.border-collapse{border-collapse:collapse}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.resize{resize:both}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-lg{border-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.bg-gray-100{background-color:var(--color-gray-100)}.object-contain{object-fit:contain}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.text-gray-400{color:var(--color-gray-400)}.text-gray-700{color:var(--color-gray-700)}.text-gray-900{color:var(--color-gray-900)}.italic{font-style:italic}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media (prefers-color-scheme:dark){.dark\\:bg-gray-800{background-color:var(--color-gray-800)}.dark\\:text-gray-300{color:var(--color-gray-300)}}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}`}},aT=Object.assign({}),oT=iv,sT={};for(let e of oT.packages??[]){let t=iT[e];t&&(sT[t.toolName]=t)}var cT=new Set(oT.local??[]);for(let[e,t]of Object.entries(aT)){let n=e.split(`/`).slice(-2)[0];cT.has(n)&&(sT[t.REGISTRATION.toolName]=t.REGISTRATION)}function lT(e){return sT[e]}var uT=new Set;function dT(e){if(!e)return;let t=e.match(/@property\s+--[^{]+\{[^}]*\}/g);if(!t)return;let n=t.join(`
186
+ `);if(uT.has(n))return;uT.add(n);let r=document.createElement(`style`);r.setAttribute(`data-gui-plugin-tw-properties`,``),r.textContent=n,document.head.appendChild(r)}var fT=ss(dr({__name:`PluginFrame`,props:{css:{}},setup(e){let t=e,n=I(),r=I(null);return Er(()=>{dT(t.css);let e=n.value;if(!e)return;let i=e.attachShadow({mode:`open`});if(t.css){let e=document.createElement(`style`);e.textContent=t.css,i.appendChild(e)}let a=document.createElement(`div`);a.style.background=`#ffffff`,a.style.color=`#111827`,a.style.borderRadius=`8px`,a.style.overflow=`hidden`,i.appendChild(a),r.value=a}),(e,t)=>(z(),B(`div`,{ref_key:`hostEl`,ref:n,class:`plugin-frame-host`},[r.value?(z(),da(or,{key:0,to:r.value},[Vr(e.$slots,`default`,{},void 0,!0)],8,[`to`])):H(``,!0)],512))}}),[[`__scopeId`,`data-v-5e7324b3`]]),pT={class:`gui-panel`},mT={class:`header`},hT=[`aria-pressed`],gT={class:`content`},_T={key:0,class:`empty`},vT=ss(dr({__name:`GuiPanel`,props:{sessionId:{},sendTextMessage:{type:Function},toolsOpen:{type:Boolean}},emits:[`toggleTools`],setup(e,{emit:t}){let n=e,r=t,i=I([]),a=e=>`session:${e}`;function o(e){let t=i.value.findIndex(t=>t.uuid===e.uuid);t>=0?i.value[t]=e:i.value=[...i.value,e]}async function s(e){try{let t=await fetch(`/api/agent/toolResults/${encodeURIComponent(e)}`);if(e!==n.sessionId)return;if(!t.ok)throw Error(`HTTP ${t.status}`);let r=await t.json();if(e!==n.sessionId)return;i.value=r.toolResults??[]}catch{e===n.sessionId&&(i.value=[])}}let{subscribe:c}=rv(),l;function u(e){l?.(),l=void 0,e&&(l=c(a(e),e=>o(e)))}Gn(()=>n.sessionId,e=>{e?s(e):i.value=[],u(e)},{immediate:!0}),Ar(()=>l?.());async function d(e,t){let r={...e,...t};if(o(r),n.sessionId)try{await fetch(`/api/agent/toolResult`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({...r,sessionId:n.sessionId,persistOnly:!0})})}catch{}}let f=U(()=>i.value.length>0);return(t,n)=>(z(),B(`section`,pT,[V(`div`,mT,[n[1]||=V(`span`,{class:`title`},`GUI`,-1),V(`button`,{type:`button`,class:Ce([`gear`,{active:e.toolsOpen}]),title:`Tools & tool-call history`,"aria-label":`Toggle tools pane`,"aria-pressed":e.toolsOpen?`true`:`false`,onClick:n[0]||=e=>r(`toggleTools`)},` ⚙ `,10,hT)]),V(`div`,gT,[f.value?H(``,!0):(z(),B(`div`,_T,[...n[2]||=[ba(` Ask Claude to use `,-1),V(`code`,null,`presentDocument`,-1),ba(` or `,-1),V(`code`,null,`presentForm`,-1),ba(` to render content here. `,-1)]])),(z(!0),B(R,null,Br(i.value,t=>(z(),B(R,{key:t.uuid},[L(lT)(t.toolName)?(z(),da(fT,{key:0,class:`frame`,css:L(lT)(t.toolName).css},{default:Rn(()=>[(z(),da(Lr(L(lT)(t.toolName).viewComponent),{"selected-result":t,"send-text-message":e.sendTextMessage,onUpdateResult:e=>d(t,e)},null,40,[`selected-result`,`send-text-message`,`onUpdateResult`]))]),_:2},1032,[`css`])):H(``,!0)],64))),128))])]))}}),[[`__scopeId`,`data-v-51ab822d`]]),yT={class:`tools-pane`},bT={class:`content`},xT={class:`section`},ST={key:0,class:`muted`},CT=[`onClick`],wT={class:`tool-name`},TT={key:0,class:`caret`},ET={key:0,class:`tool-desc`},DT={class:`section`},OT={class:`section-title section-title--with-action`},kT=[`disabled`,`title`,`aria-label`],AT={key:0,class:`muted`},jT=[`onClick`],MT={class:`call-name`},NT={class:`call-meta`},PT={key:0,class:`badge running`},FT={key:1,class:`badge failed`},IT={key:2,class:`badge done`},LT={class:`time`},RT={key:0,class:`call-body`},zT={class:`block`},BT={class:`label`},VT={key:1,class:`muted italic`},HT=ss(dr({__name:`ToolsPane`,props:{sessionId:{}},setup(e){let t=e,n=I([]),r=I([]),i=I(new Set),a=I(new Set);async function o(){try{let e=await fetch(`/api/tools`);if(!e.ok)throw Error(`HTTP ${e.status}`);n.value=(await e.json()).tools??[]}catch{n.value=[]}}o();function s(e,t){return e.toolUseId??`${e.toolName}-${t}`}function c(e){let t=r.value,n=e.toolUseId?t.findIndex(t=>t.toolUseId===e.toolUseId):-1;n>=0?t[n]=e:r.value=[...t,e]}async function l(e){try{let n=await fetch(`/api/tool-calls/${encodeURIComponent(e)}`);if(e!==t.sessionId)return;if(!n.ok)throw Error(`HTTP ${n.status}`);let i=await n.json();if(e!==t.sessionId)return;r.value=i.toolCalls??[]}catch{e===t.sessionId&&(r.value=[])}}let{subscribe:u}=rv(),d;function f(e){d?.(),d=void 0,e&&(d=u(`toolcalls:${e}`,e=>c(e)))}Gn(()=>t.sessionId,e=>{a.value=new Set,e?l(e):r.value=[],f(e)},{immediate:!0}),Ar(()=>d?.());function p(e){let t=new Set(i.value);t.has(e)?t.delete(e):t.add(e),i.value=t}function m(e){let t=new Set(a.value);t.has(e)?t.delete(e):t.add(e),a.value=t}function h(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}function g(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}let _=I(!1),v;async function y(){if(r.value.length!==0)try{await window.navigator.clipboard.writeText(JSON.stringify(r.value,null,2)),_.value=!0,window.clearTimeout(v),v=window.setTimeout(()=>{_.value=!1},2e3)}catch{}}return Ar(()=>window.clearTimeout(v)),(e,t)=>(z(),B(`section`,yT,[t[3]||=V(`div`,{class:`header`},[V(`span`,{class:`title`},`Tools`)],-1),V(`div`,bT,[V(`div`,xT,[t[0]||=V(`div`,{class:`section-title`},`Available Tools`,-1),n.value.length===0?(z(),B(`div`,ST,`No GUI plugin tools enabled.`)):H(``,!0),(z(!0),B(R,null,Br(n.value,e=>(z(),B(`div`,{key:e.toolName,class:`tool`},[V(`button`,{class:`tool-head`,type:`button`,onClick:t=>p(e.toolName)},[V(`code`,wT,N(e.toolName),1),e.description?(z(),B(`span`,TT,N(i.value.has(e.toolName)?`▲`:`▼`),1)):H(``,!0)],8,CT),i.value.has(e.toolName)?(z(),B(`div`,ET,N(e.description),1)):H(``,!0)]))),128))]),V(`div`,DT,[V(`div`,OT,[t[1]||=V(`span`,null,`Tool Call History`,-1),V(`button`,{class:`copy-history`,type:`button`,disabled:r.value.length===0,title:_.value?`Copied!`:`Copy all call history`,"aria-label":_.value?`Copied!`:`Copy all call history`,onClick:y},N(_.value?`✓ Copied`:`Copy all`),9,kT)]),r.value.length===0?(z(),B(`div`,AT,`No tool calls yet.`)):H(``,!0),(z(!0),B(R,null,Br(r.value,(e,n)=>(z(),B(`div`,{key:s(e,n),class:`call`},[V(`button`,{class:`call-head`,type:`button`,onClick:t=>m(s(e,n))},[V(`code`,MT,N(e.toolName),1),V(`span`,NT,[e.status===`running`?(z(),B(`span`,PT,`running…`)):e.status===`failed`?(z(),B(`span`,FT,`failed`)):(z(),B(`span`,IT,N(e.durationMs==null?`done`:`${e.durationMs} ms`),1)),V(`span`,LT,N(h(e.at)),1)])],8,jT),a.value.has(s(e,n))?(z(),B(`div`,RT,[t[2]||=V(`div`,{class:`label`},`arguments`,-1),V(`pre`,zT,N(g(e.toolInput)),1),e.status===`completed`||e.status===`failed`?(z(),B(R,{key:0},[V(`div`,BT,N(e.status===`failed`?`error`:`result`),1),V(`pre`,{class:Ce([`block`,e.status===`failed`?`error`:`result`])},N(g(e.toolOutput)||`(no output)`),3)],64)):(z(),B(`div`,VT,`Waiting for result…`))])):H(``,!0)]))),128))])])]))}}),[[`__scopeId`,`data-v-167cc06d`]]);function UT(e,t,n){if(n||e.length===0)return t;let r=new Map(t.map(e=>[e.id,e])),i=new Set(e.map(e=>e.id)),a=e.filter(e=>r.has(e.id)).map(e=>r.get(e.id));return[...t.filter(e=>!i.has(e.id)),...a]}function WT(){let e=I([]),t=I(!0),n=I(null);async function r(r=!1){try{let t=await fetch(`/api/sessions`);if(!t.ok)throw Error(`HTTP ${t.status}`);let i=await t.json();e.value=UT(e.value,i.sessions??[],r),n.value=null}catch(t){e.value.length===0&&(n.value=t instanceof Error?t.message:String(t))}finally{t.value=!1}}function i(){return r(!0)}let{subscribe:a}=rv(),o;return Er(()=>{r(),o=a(`sessions`,()=>r())}),Ar(()=>o?.()),{sessions:e,loading:t,error:n,load:r,refresh:i}}var GT={class:`main`},KT=[`aria-valuenow`,`aria-valuemax`],qT=320,JT=360;ns(ss(dr({__name:`App`,setup(e){let t=I(null),n=I(0),r=I(null),{sessions:i,loading:a,error:o,refresh:s}=WT(),c=I(`all`),l=I(Number(localStorage.getItem(`terminal_width`))||560),u=I(window.innerWidth),d=U(()=>Math.max(qT,u.value-JT));function f(e){return Math.max(qT,Math.min(e,d.value))}function p(){localStorage.setItem(`terminal_width`,String(l.value))}let m=null;function h(e){e.preventDefault();let t=e.clientX,n=l.value,r=e=>{l.value=f(n+(e.clientX-t))},i=()=>{p(),m?.()};m=()=>{window.removeEventListener(`mousemove`,r),window.removeEventListener(`mouseup`,i),document.body.style.cursor=``,document.body.style.userSelect=``,m=null},document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,window.addEventListener(`mousemove`,r),window.addEventListener(`mouseup`,i)}function g(e){if(e.key===`ArrowLeft`)l.value=f(l.value-16);else if(e.key===`ArrowRight`)l.value=f(l.value+16);else if(e.key===`Home`)l.value=qT;else if(e.key===`End`)l.value=d.value;else return;e.preventDefault(),p()}function _(){u.value=window.innerWidth,l.value=f(l.value)}Er(()=>window.addEventListener(`resize`,_)),Ar(()=>{m?.(),window.removeEventListener(`resize`,_)});let v=I(localStorage.getItem(`session_layout`)===`horizontal`?`horizontal`:`vertical`);Gn(v,e=>localStorage.setItem(`session_layout`,e));function y(){v.value=v.value===`vertical`?`horizontal`:`vertical`}let b=I(localStorage.getItem(`tools_pane_visible`)===`true`);Gn(b,e=>localStorage.setItem(`tools_pane_visible`,String(e)));function x(){b.value=!b.value}function S(e){return r.value?.submitText(e)??!1}function C(e){t.value=e,n.value++}function ee(){t.value=null,n.value++}function te(e){t.value=e}return(e,u)=>(z(),B(`div`,{class:Ce([`app`,v.value===`horizontal`?`app-horizontal`:`app-vertical`])},[v.value===`vertical`?(z(),da(xs,{key:0,filter:c.value,"onUpdate:filter":u[0]||=e=>c.value=e,sessions:L(i),loading:L(a),error:L(o),"active-id":t.value,onSelect:C,onNew:ee,onToggleLayout:y,onRefresh:L(s)},null,8,[`filter`,`sessions`,`loading`,`error`,`active-id`,`onRefresh`])):(z(),da(js,{key:1,filter:c.value,"onUpdate:filter":u[1]||=e=>c.value=e,sessions:L(i),"active-id":t.value,onSelect:C,onNew:ee,onToggleLayout:y,onRefresh:L(s)},null,8,[`filter`,`sessions`,`active-id`,`onRefresh`])),V(`div`,GT,[ga(ug,{ref_key:`terminalRef`,ref:r,class:`terminal-pane`,style:ve({flex:`0 0 ${l.value}px`}),"session-id":t.value,"connect-key":n.value,onSession:te},null,8,[`style`,`session-id`,`connect-key`]),V(`div`,{class:`splitter`,role:`separator`,tabindex:`0`,"aria-orientation":`vertical`,"aria-label":`Resize terminal`,"aria-valuenow":l.value,"aria-valuemin":qT,"aria-valuemax":d.value,title:`Drag (or use arrow keys) to resize the terminal`,onMousedown:h,onKeydown:g},null,40,KT),ga(vT,{"session-id":t.value,"send-text-message":S,"tools-open":b.value,onToggleTools:x},null,8,[`session-id`,`tools-open`]),b.value?(z(),da(HT,{key:0,"session-id":t.value},null,8,[`session-id`])):H(``,!0)])],2))}}),[[`__scopeId`,`data-v-be189b61`]])).mount(`#app`);export{d as i,o as n,c as r,s as t};