claude-remote-cli 3.5.1 → 3.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/frontend/assets/{index-CjI-jAI3.js → index-Anv1KpSt.js} +21 -21
- package/dist/frontend/assets/{index-Diib6HQl.css → index-CyOBs5Qv.css} +2 -2
- package/dist/frontend/index.html +2 -2
- package/dist/server/config.js +22 -0
- package/dist/server/index.js +16 -14
- package/dist/server/sessions.js +1 -1
- package/dist/server/workspaces.js +38 -8
- package/dist/test/config.test.js +114 -1
- package/package.json +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var Mp=Object.defineProperty;var Md=e=>{throw TypeError(e)};var Ap=(e,t,i)=>t in e?Mp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var Vi=(e,t,i)=>Ap(e,typeof t!="symbol"?t+"":t,i),zl=(e,t,i)=>t.has(e)||Md("Cannot "+i);var v=(e,t,i)=>(zl(e,t,"read from private field"),i?i.call(e):t.get(e)),ie=(e,t,i)=>t.has(e)?Md("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),X=(e,t,i,r)=>(zl(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),xe=(e,t,i)=>(zl(e,t,"access private method"),i);var Ca=(e,t,i,r)=>({set _(s){X(e,t,s,i)},get _(){return v(e,t,r)}});(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const n of s)if(n.type==="childList")for(const o of n.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function i(s){const n={};return s.integrity&&(n.integrity=s.integrity),s.referrerPolicy&&(n.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?n.credentials="include":s.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function r(s){if(s.ep)return;s.ep=!0;const n=i(s);fetch(s.href,n)}})();const fh=!1;var Kc=Array.isArray,Op=Array.prototype.indexOf,Zn=Array.prototype.includes,ml=Array.from,Lp=Object.defineProperty,Dn=Object.getOwnPropertyDescriptor,Bf=Object.getOwnPropertyDescriptors,Ip=Object.prototype,Bp=Array.prototype,qc=Object.getPrototypeOf,Ad=Object.isExtensible;const Np=()=>{};function Fp(e){for(var t=0;t<e.length;t++)e[t]()}function Nf(){var e,t,i=new Promise((r,s)=>{e=r,t=s});return{promise:i,resolve:e,reject:t}}function Wp(e,t){if(Array.isArray(e))return e;if(!(Symbol.iterator in e))return Array.from(e);const i=[];for(const r of e)if(i.push(r),i.length===t)break;return i}const $t=2,na=4,oa=8,Ff=1<<24,Xr=16,ur=32,bn=64,_h=128,Ki=512,Ht=1024,Zt=2048,cr=4096,Ti=8192,Kr=16384,un=32768,fn=65536,Od=1<<17,Wf=1<<18,ao=1<<19,Hf=1<<20,zr=1<<25,_n=65536,vh=1<<21,jc=1<<22,ys=1<<23,qr=Symbol("$state"),Hp=Symbol("legacy props"),zp=Symbol(""),Fs=new class extends Error{constructor(){super(...arguments);Vi(this,"name","StaleReactionError");Vi(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var yf;const Up=!!((yf=globalThis.document)!=null&&yf.contentType)&&globalThis.document.contentType.includes("xml");function Yc(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Kp(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function qp(e,t,i){throw new Error("https://svelte.dev/e/each_key_duplicate")}function jp(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Yp(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Vp(e){throw new Error("https://svelte.dev/e/effect_orphan")}function Gp(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Xp(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function $p(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Zp(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Qp(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Jp(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const eg=1,tg=2,zf=4,ig=8,rg=16,sg=1,ng=4,og=8,ag=16,lg=1,hg=2,Ut=Symbol(),Uf="http://www.w3.org/1999/xhtml",cg="http://www.w3.org/2000/svg",dg="http://www.w3.org/1998/Math/MathML";function ug(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function fg(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function Kf(e){return e===this.v}function qf(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function jf(e){return!qf(e,this.v)}let _g=!1,Tt=null;function Qn(e){Tt=e}function Yf(e){return Gf().get(e)}function vg(e,t){return Gf().set(e,t),t}function ft(e,t=!1,i){Tt={p:Tt,i:!1,c:null,e:null,s:e,x:null,l:null}}function _t(e){var t=Tt,i=t.e;if(i!==null){t.e=null;for(var r of i)p_(r)}return e!==void 0&&(t.x=e),t.i=!0,Tt=t.p,e??{}}function Vf(){return!0}function Gf(e){return Tt===null&&Yc(),Tt.c??(Tt.c=new Map(pg(Tt)||void 0))}function pg(e){let t=e.p;for(;t!==null;){const i=t.c;if(i!==null)return i;t=t.p}return null}let Ws=[];function Xf(){var e=Ws;Ws=[],Fp(e)}function Dr(e){if(Ws.length===0&&!Mo){var t=Ws;queueMicrotask(()=>{t===Ws&&Xf()})}Ws.push(e)}function gg(){for(;Ws.length>0;)Xf()}function $f(e){var t=Ge;if(t===null)return Ke.f|=ys,e;if((t.f&un)===0&&(t.f&na)===0)throw e;gs(e,t)}function gs(e,t){for(;t!==null;){if((t.f&_h)!==0){if((t.f&un)===0)throw e;try{t.b.error(e);return}catch(i){e=i}}t=t.parent}throw e}const mg=-7169;function bt(e,t){e.f=e.f&mg|t}function Vc(e){(e.f&Ki)!==0||e.deps===null?bt(e,Ht):bt(e,cr)}function Zf(e){if(e!==null)for(const t of e)(t.f&$t)===0||(t.f&_n)===0||(t.f^=_n,Zf(t.deps))}function Qf(e,t,i){(e.f&Zt)!==0?t.add(e):(e.f&cr)!==0&&i.add(e),Zf(e.deps),bt(e,Ht)}const ka=new Set;let Le=null,Va=null,Vt=null,_i=[],bl=null,ph=!1,Mo=!1;var Mn,An,qs,On,$o,Zo,js,Br,Ln,Ri,gh,mh,bh,Jf;const Rd=class Rd{constructor(){ie(this,Ri);Vi(this,"current",new Map);Vi(this,"previous",new Map);ie(this,Mn,new Set);ie(this,An,new Set);ie(this,qs,0);ie(this,On,0);ie(this,$o,null);ie(this,Zo,new Set);ie(this,js,new Set);ie(this,Br,new Map);Vi(this,"is_fork",!1);ie(this,Ln,!1)}skip_effect(t){v(this,Br).has(t)||v(this,Br).set(t,{d:[],m:[]})}unskip_effect(t){var i=v(this,Br).get(t);if(i){v(this,Br).delete(t);for(var r of i.d)bt(r,Zt),nr(r);for(r of i.m)bt(r,cr),nr(r)}}process(t){var s;_i=[],this.apply();var i=[],r=[];for(const n of t)xe(this,Ri,mh).call(this,n,i,r);if(xe(this,Ri,gh).call(this)){xe(this,Ri,bh).call(this,r),xe(this,Ri,bh).call(this,i);for(const[n,o]of v(this,Br))r_(n,o)}else{for(const n of v(this,Mn))n();v(this,Mn).clear(),v(this,qs)===0&&xe(this,Ri,Jf).call(this),Va=this,Le=null,Ld(r),Ld(i),Va=null,(s=v(this,$o))==null||s.resolve()}Vt=null}capture(t,i){i!==Ut&&!this.previous.has(t)&&this.previous.set(t,i),(t.f&ys)===0&&(this.current.set(t,t.v),Vt==null||Vt.set(t,t.v))}activate(){Le=this,this.apply()}deactivate(){Le===this&&(Le=null,Vt=null)}flush(){if(this.activate(),_i.length>0){if(e_(),Le!==null&&Le!==this)return}else v(this,qs)===0&&this.process([]);this.deactivate()}discard(){for(const t of v(this,An))t(this);v(this,An).clear()}increment(t){X(this,qs,v(this,qs)+1),t&&X(this,On,v(this,On)+1)}decrement(t){X(this,qs,v(this,qs)-1),t&&X(this,On,v(this,On)-1),!v(this,Ln)&&(X(this,Ln,!0),Dr(()=>{X(this,Ln,!1),xe(this,Ri,gh).call(this)?_i.length>0&&this.flush():this.revive()}))}revive(){for(const t of v(this,Zo))v(this,js).delete(t),bt(t,Zt),nr(t);for(const t of v(this,js))bt(t,cr),nr(t);this.flush()}oncommit(t){v(this,Mn).add(t)}ondiscard(t){v(this,An).add(t)}settled(){return(v(this,$o)??X(this,$o,Nf())).promise}static ensure(){if(Le===null){const t=Le=new Rd;ka.add(Le),Mo||Dr(()=>{Le===t&&t.flush()})}return Le}apply(){}};Mn=new WeakMap,An=new WeakMap,qs=new WeakMap,On=new WeakMap,$o=new WeakMap,Zo=new WeakMap,js=new WeakMap,Br=new WeakMap,Ln=new WeakMap,Ri=new WeakSet,gh=function(){return this.is_fork||v(this,On)>0},mh=function(t,i,r){t.f^=Ht;for(var s=t.first;s!==null;){var n=s.f,o=(n&(ur|bn))!==0,l=o&&(n&Ht)!==0,h=l||(n&Ti)!==0||v(this,Br).has(s);if(!h&&s.fn!==null){o?s.f^=Ht:(n&na)!==0?i.push(s):ha(s)&&((n&Xr)!==0&&v(this,js).add(s),eo(s));var c=s.first;if(c!==null){s=c;continue}}for(;s!==null;){var u=s.next;if(u!==null){s=u;break}s=s.parent}}},bh=function(t){for(var i=0;i<t.length;i+=1)Qf(t[i],v(this,Zo),v(this,js))},Jf=function(){var s;if(ka.size>1){this.previous.clear();var t=Vt,i=!0;for(const n of ka){if(n===this){i=!1;continue}const o=[];for(const[h,c]of this.current){if(n.current.has(h))if(i&&c!==n.current.get(h))n.current.set(h,c);else continue;o.push(h)}if(o.length===0)continue;const l=[...n.current.keys()].filter(h=>!this.current.has(h));if(l.length>0){var r=_i;_i=[];const h=new Set,c=new Map;for(const u of o)t_(u,l,h,c);if(_i.length>0){Le=n,n.apply();for(const u of _i)xe(s=n,Ri,mh).call(s,u,[],[]);n.deactivate()}_i=r}}Le=null,Vt=t}ka.delete(this)};let Ss=Rd;function bg(e){var t=Mo;Mo=!0;try{for(var i;;){if(gg(),_i.length===0&&(Le==null||Le.flush(),_i.length===0))return bl=null,i;e_()}}finally{Mo=t}}function e_(){ph=!0;var e=null;try{for(var t=0;_i.length>0;){var i=Ss.ensure();if(t++>1e3){var r,s;yg()}i.process(_i),ws.clear()}}finally{_i=[],ph=!1,bl=null}}function yg(){try{Gp()}catch(e){gs(e,bl)}}let $i=null;function Ld(e){var t=e.length;if(t!==0){for(var i=0;i<t;){var r=e[i++];if((r.f&(Kr|Ti))===0&&ha(r)&&($i=new Set,eo(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&b_(r),($i==null?void 0:$i.size)>0)){ws.clear();for(const s of $i){if((s.f&(Kr|Ti))!==0)continue;const n=[s];let o=s.parent;for(;o!==null;)$i.has(o)&&($i.delete(o),n.push(o)),o=o.parent;for(let l=n.length-1;l>=0;l--){const h=n[l];(h.f&(Kr|Ti))===0&&eo(h)}}$i.clear()}}$i=null}}function t_(e,t,i,r){if(!i.has(e)&&(i.add(e),e.reactions!==null))for(const s of e.reactions){const n=s.f;(n&$t)!==0?t_(s,t,i,r):(n&(jc|Xr))!==0&&(n&Zt)===0&&i_(s,t,r)&&(bt(s,Zt),nr(s))}}function i_(e,t,i){const r=i.get(e);if(r!==void 0)return r;if(e.deps!==null)for(const s of e.deps){if(Zn.call(t,s))return!0;if((s.f&$t)!==0&&i_(s,t,i))return i.set(s,!0),!0}return i.set(e,!1),!1}function nr(e){var t=bl=e,i=t.b;if(i!=null&&i.is_pending&&(e.f&(na|oa|Ff))!==0&&(e.f&un)===0){i.defer_effect(e);return}for(;t.parent!==null;){t=t.parent;var r=t.f;if(ph&&t===Ge&&(r&Xr)!==0&&(r&Wf)===0&&(r&un)!==0)return;if((r&(bn|ur))!==0){if((r&Ht)===0)return;t.f^=Ht}}_i.push(t)}function r_(e,t){if(!((e.f&ur)!==0&&(e.f&Ht)!==0)){(e.f&Zt)!==0?t.d.push(e):(e.f&cr)!==0&&t.m.push(e),bt(e,Ht);for(var i=e.first;i!==null;)r_(i,t),i=i.next}}function Sg(e){let t=0,i=Ts(0),r;return()=>{$c()&&(a(i),la(()=>(t===0&&(r=$r(()=>e(()=>Cs(i)))),t+=1,()=>{Dr(()=>{t-=1,t===0&&(r==null||r(),r=void 0,Cs(i))})})))}}var wg=fn|ao;function Cg(e,t,i,r){new kg(e,t,i,r)}var Li,zc,br,Ys,di,yr,xi,Qi,Nr,Vs,as,In,Bn,Nn,Fr,_l,Pt,xg,Eg,Dg,yh,Ba,Na,Sh;class kg{constructor(t,i,r,s){ie(this,Pt);Vi(this,"parent");Vi(this,"is_pending",!1);Vi(this,"transform_error");ie(this,Li);ie(this,zc,null);ie(this,br);ie(this,Ys);ie(this,di);ie(this,yr,null);ie(this,xi,null);ie(this,Qi,null);ie(this,Nr,null);ie(this,Vs,0);ie(this,as,0);ie(this,In,!1);ie(this,Bn,new Set);ie(this,Nn,new Set);ie(this,Fr,null);ie(this,_l,Sg(()=>(X(this,Fr,Ts(v(this,Vs))),()=>{X(this,Fr,null)})));var n;X(this,Li,t),X(this,br,i),X(this,Ys,o=>{var l=Ge;l.b=this,l.f|=_h,r(o)}),this.parent=Ge.b,this.transform_error=s??((n=this.parent)==null?void 0:n.transform_error)??(o=>o),X(this,di,wl(()=>{xe(this,Pt,yh).call(this)},wg))}defer_effect(t){Qf(t,v(this,Bn),v(this,Nn))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!v(this,br).pending}update_pending_count(t){xe(this,Pt,Sh).call(this,t),X(this,Vs,v(this,Vs)+t),!(!v(this,Fr)||v(this,In))&&(X(this,In,!0),Dr(()=>{X(this,In,!1),v(this,Fr)&&Jn(v(this,Fr),v(this,Vs))}))}get_effect_pending(){return v(this,_l).call(this),a(v(this,Fr))}error(t){var i=v(this,br).onerror;let r=v(this,br).failed;if(!i&&!r)throw t;v(this,yr)&&(mi(v(this,yr)),X(this,yr,null)),v(this,xi)&&(mi(v(this,xi)),X(this,xi,null)),v(this,Qi)&&(mi(v(this,Qi)),X(this,Qi,null));var s=!1,n=!1;const o=()=>{if(s){fg();return}s=!0,n&&Jp(),v(this,Qi)!==null&&on(v(this,Qi),()=>{X(this,Qi,null)}),xe(this,Pt,Na).call(this,()=>{Ss.ensure(),xe(this,Pt,yh).call(this)})},l=h=>{try{n=!0,i==null||i(h,o),n=!1}catch(c){gs(c,v(this,di)&&v(this,di).parent)}r&&X(this,Qi,xe(this,Pt,Na).call(this,()=>{Ss.ensure();try{return Fi(()=>{var c=Ge;c.b=this,c.f|=_h,r(v(this,Li),()=>h,()=>o)})}catch(c){return gs(c,v(this,di).parent),null}}))};Dr(()=>{var h;try{h=this.transform_error(t)}catch(c){gs(c,v(this,di)&&v(this,di).parent);return}h!==null&&typeof h=="object"&&typeof h.then=="function"?h.then(l,c=>gs(c,v(this,di)&&v(this,di).parent)):l(h)})}}Li=new WeakMap,zc=new WeakMap,br=new WeakMap,Ys=new WeakMap,di=new WeakMap,yr=new WeakMap,xi=new WeakMap,Qi=new WeakMap,Nr=new WeakMap,Vs=new WeakMap,as=new WeakMap,In=new WeakMap,Bn=new WeakMap,Nn=new WeakMap,Fr=new WeakMap,_l=new WeakMap,Pt=new WeakSet,xg=function(){try{X(this,yr,Fi(()=>v(this,Ys).call(this,v(this,Li))))}catch(t){this.error(t)}},Eg=function(t){const i=v(this,br).failed;i&&X(this,Qi,Fi(()=>{i(v(this,Li),()=>t,()=>()=>{})}))},Dg=function(){const t=v(this,br).pending;t&&(this.is_pending=!0,X(this,xi,Fi(()=>t(v(this,Li)))),Dr(()=>{var i=X(this,Nr,document.createDocumentFragment()),r=jr();i.append(r),X(this,yr,xe(this,Pt,Na).call(this,()=>(Ss.ensure(),Fi(()=>v(this,Ys).call(this,r))))),v(this,as)===0&&(v(this,Li).before(i),X(this,Nr,null),on(v(this,xi),()=>{X(this,xi,null)}),xe(this,Pt,Ba).call(this))}))},yh=function(){try{if(this.is_pending=this.has_pending_snippet(),X(this,as,0),X(this,Vs,0),X(this,yr,Fi(()=>{v(this,Ys).call(this,v(this,Li))})),v(this,as)>0){var t=X(this,Nr,document.createDocumentFragment());w_(v(this,yr),t);const i=v(this,br).pending;X(this,xi,Fi(()=>i(v(this,Li))))}else xe(this,Pt,Ba).call(this)}catch(i){this.error(i)}},Ba=function(){this.is_pending=!1;for(const t of v(this,Bn))bt(t,Zt),nr(t);for(const t of v(this,Nn))bt(t,cr),nr(t);v(this,Bn).clear(),v(this,Nn).clear()},Na=function(t){var i=Ge,r=Ke,s=Tt;Rr(v(this,di)),Yi(v(this,di)),Qn(v(this,di).ctx);try{return t()}catch(n){return $f(n),null}finally{Rr(i),Yi(r),Qn(s)}},Sh=function(t){var i;if(!this.has_pending_snippet()){this.parent&&xe(i=this.parent,Pt,Sh).call(i,t);return}X(this,as,v(this,as)+t),v(this,as)===0&&(xe(this,Pt,Ba).call(this),v(this,xi)&&on(v(this,xi),()=>{X(this,xi,null)}),v(this,Nr)&&(v(this,Li).before(v(this,Nr)),X(this,Nr,null)))};function Tg(e,t,i,r){const s=yl;var n=e.filter(d=>!d.settled);if(i.length===0&&n.length===0){r(t.map(s));return}var o=Ge,l=Rg(),h=n.length===1?n[0].promise:n.length>1?Promise.all(n.map(d=>d.promise)):null;function c(d){l();try{r(d)}catch(f){(o.f&Kr)===0&&gs(f,o)}wh()}if(i.length===0){h.then(()=>c(t.map(s)));return}function u(){l(),Promise.all(i.map(d=>Mg(d))).then(d=>c([...t.map(s),...d])).catch(d=>gs(d,o))}h?h.then(u):u()}function Rg(){var e=Ge,t=Ke,i=Tt,r=Le;return function(n=!0){Rr(e),Yi(t),Qn(i),n&&(r==null||r.activate())}}function wh(e=!0){Rr(null),Yi(null),Qn(null),e&&(Le==null||Le.deactivate())}function Pg(){var e=Ge.b,t=Le,i=e.is_rendered();return e.update_pending_count(1),t.increment(i),()=>{e.update_pending_count(-1),t.decrement(i)}}function yl(e){var t=$t|Zt,i=Ke!==null&&(Ke.f&$t)!==0?Ke:null;return Ge!==null&&(Ge.f|=ao),{ctx:Tt,deps:null,effects:null,equals:Kf,f:t,fn:e,reactions:null,rv:0,v:Ut,wv:0,parent:i??Ge,ac:null}}function Mg(e,t,i){Ge===null&&Kp();var s=void 0,n=Ts(Ut),o=!Ke,l=new Map;return Yg(()=>{var f;var h=Nf();s=h.promise;try{Promise.resolve(e()).then(h.resolve,h.reject).finally(wh)}catch(_){h.reject(_),wh()}var c=Le;if(o){var u=Pg();(f=l.get(c))==null||f.reject(Fs),l.delete(c),l.set(c,h)}const d=(_,p=void 0)=>{if(c.activate(),p)p!==Fs&&(n.f|=ys,Jn(n,p));else{(n.f&ys)!==0&&(n.f^=ys),Jn(n,_);for(const[b,g]of l){if(l.delete(b),b===c)break;g.reject(Fs)}}u&&u()};h.promise.then(d,_=>d(null,_||"unknown"))}),Zc(()=>{for(const h of l.values())h.reject(Fs)}),new Promise(h=>{function c(u){function d(){u===s?h(n):c(s)}u.then(d,d)}c(s)})}function fe(e){const t=yl(e);return C_(t),t}function s_(e){const t=yl(e);return t.equals=jf,t}function Ag(e){var t=e.effects;if(t!==null){e.effects=null;for(var i=0;i<t.length;i+=1)mi(t[i])}}function Og(e){for(var t=e.parent;t!==null;){if((t.f&$t)===0)return(t.f&Kr)===0?t:null;t=t.parent}return null}function Gc(e){var t,i=Ge;Rr(Og(e));try{e.f&=~_n,Ag(e),t=D_(e)}finally{Rr(i)}return t}function n_(e){var t=Gc(e);if(!e.equals(t)&&(e.wv=x_(),(!(Le!=null&&Le.is_fork)||e.deps===null)&&(e.v=t,e.deps===null))){bt(e,Ht);return}Rs||(Vt!==null?($c()||Le!=null&&Le.is_fork)&&Vt.set(e,t):Vc(e))}function Lg(e){var t,i;if(e.effects!==null)for(const r of e.effects)(r.teardown||r.ac)&&((t=r.teardown)==null||t.call(r),(i=r.ac)==null||i.abort(Fs),r.teardown=Np,r.ac=null,Ho(r,0),Jc(r))}function o_(e){if(e.effects!==null)for(const t of e.effects)t.teardown&&eo(t)}let Ch=new Set;const ws=new Map;let a_=!1;function Ts(e,t){var i={f:0,v:e,reactions:null,equals:Kf,rv:0,wv:0};return i}function H(e,t){const i=Ts(e);return C_(i),i}function Ig(e,t=!1,i=!0){const r=Ts(e);return t||(r.equals=jf),r}function m(e,t,i=!1){Ke!==null&&(!or||(Ke.f&Od)!==0)&&Vf()&&(Ke.f&($t|Xr|jc|Od))!==0&&(qi===null||!Zn.call(qi,e))&&Qp();let r=i?Ze(t):t;return Jn(e,r)}function Jn(e,t){if(!e.equals(t)){var i=e.v;Rs?ws.set(e,t):ws.set(e,i),e.v=t;var r=Ss.ensure();if(r.capture(e,i),(e.f&$t)!==0){const s=e;(e.f&Zt)!==0&&Gc(s),Vc(s)}e.wv=x_(),l_(e,Zt),Ge!==null&&(Ge.f&Ht)!==0&&(Ge.f&(ur|bn))===0&&(Oi===null?Gg([e]):Oi.push(e)),!r.is_fork&&Ch.size>0&&!a_&&Bg()}return t}function Bg(){a_=!1;for(const e of Ch)(e.f&Ht)!==0&&bt(e,cr),ha(e)&&eo(e);Ch.clear()}function Ng(e,t=1){var i=a(e),r=t===1?i++:i--;return m(e,i),r}function Cs(e){m(e,e.v+1)}function l_(e,t){var i=e.reactions;if(i!==null)for(var r=i.length,s=0;s<r;s++){var n=i[s],o=n.f,l=(o&Zt)===0;if(l&&bt(n,t),(o&$t)!==0){var h=n;Vt==null||Vt.delete(h),(o&_n)===0&&(o&Ki&&(n.f|=_n),l_(h,cr))}else l&&((o&Xr)!==0&&$i!==null&&$i.add(n),nr(n))}}function Ze(e){if(typeof e!="object"||e===null||qr in e)return e;const t=qc(e);if(t!==Ip&&t!==Bp)return e;var i=new Map,r=Kc(e),s=H(0),n=Yr,o=l=>{if(Yr===n)return l();var h=Ke,c=Yr;Yi(null),Fd(n);var u=l();return Yi(h),Fd(c),u};return r&&i.set("length",H(e.length)),new Proxy(e,{defineProperty(l,h,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&$p();var u=i.get(h);return u===void 0?o(()=>{var d=H(c.value);return i.set(h,d),d}):m(u,c.value,!0),!0},deleteProperty(l,h){var c=i.get(h);if(c===void 0){if(h in l){const u=o(()=>H(Ut));i.set(h,u),Cs(s)}}else m(c,Ut),Cs(s);return!0},get(l,h,c){var _;if(h===qr)return e;var u=i.get(h),d=h in l;if(u===void 0&&(!d||(_=Dn(l,h))!=null&&_.writable)&&(u=o(()=>{var p=Ze(d?l[h]:Ut),b=H(p);return b}),i.set(h,u)),u!==void 0){var f=a(u);return f===Ut?void 0:f}return Reflect.get(l,h,c)},getOwnPropertyDescriptor(l,h){var c=Reflect.getOwnPropertyDescriptor(l,h);if(c&&"value"in c){var u=i.get(h);u&&(c.value=a(u))}else if(c===void 0){var d=i.get(h),f=d==null?void 0:d.v;if(d!==void 0&&f!==Ut)return{enumerable:!0,configurable:!0,value:f,writable:!0}}return c},has(l,h){var f;if(h===qr)return!0;var c=i.get(h),u=c!==void 0&&c.v!==Ut||Reflect.has(l,h);if(c!==void 0||Ge!==null&&(!u||(f=Dn(l,h))!=null&&f.writable)){c===void 0&&(c=o(()=>{var _=u?Ze(l[h]):Ut,p=H(_);return p}),i.set(h,c));var d=a(c);if(d===Ut)return!1}return u},set(l,h,c,u){var C;var d=i.get(h),f=h in l;if(r&&h==="length")for(var _=c;_<d.v;_+=1){var p=i.get(_+"");p!==void 0?m(p,Ut):_ in l&&(p=o(()=>H(Ut)),i.set(_+"",p))}if(d===void 0)(!f||(C=Dn(l,h))!=null&&C.writable)&&(d=o(()=>H(void 0)),m(d,Ze(c)),i.set(h,d));else{f=d.v!==Ut;var b=o(()=>Ze(c));m(d,b)}var g=Reflect.getOwnPropertyDescriptor(l,h);if(g!=null&&g.set&&g.set.call(u,c),!f){if(r&&typeof h=="string"){var S=i.get("length"),x=Number(h);Number.isInteger(x)&&x>=S.v&&m(S,x+1)}Cs(s)}return!0},ownKeys(l){a(s);var h=Reflect.ownKeys(l).filter(d=>{var f=i.get(d);return f===void 0||f.v!==Ut});for(var[c,u]of i)u.v!==Ut&&!(c in l)&&h.push(c);return h},setPrototypeOf(){Zp()}})}function Id(e){try{if(e!==null&&typeof e=="object"&&qr in e)return e[qr]}catch{}return e}function Fg(e,t){return Object.is(Id(e),Id(t))}var Ga,h_,c_,d_,u_;function Wg(){if(Ga===void 0){Ga=window,h_=document,c_=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,i=Text.prototype;d_=Dn(t,"firstChild").get,u_=Dn(t,"nextSibling").get,Ad(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Ad(i)&&(i.__t=void 0)}}function jr(e=""){return document.createTextNode(e)}function nn(e){return d_.call(e)}function aa(e){return u_.call(e)}function y(e,t){return nn(e)}function kt(e,t=!1){{var i=nn(e);return i instanceof Comment&&i.data===""?aa(i):i}}function D(e,t=1,i=!1){let r=e;for(;t--;)r=aa(r);return r}function Hg(e){e.textContent=""}function f_(){return!1}function __(e,t,i){return document.createElementNS(t??Uf,e,void 0)}function zg(e,t){{const i=document.body;e.autofocus=!0,Dr(()=>{document.activeElement===i&&e.focus()})}}let Bd=!1;function Ug(){Bd||(Bd=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const i of e.target.elements)(t=i.__on_r)==null||t.call(i)})},{capture:!0}))}function Sl(e){var t=Ke,i=Ge;Yi(null),Rr(null);try{return e()}finally{Yi(t),Rr(i)}}function Xc(e,t,i,r=i){e.addEventListener(t,()=>Sl(i));const s=e.__on_r;s?e.__on_r=()=>{s(),r(!0)}:e.__on_r=()=>r(!0),Ug()}function v_(e){Ge===null&&(Ke===null&&Vp(),Yp()),Rs&&jp()}function Kg(e,t){var i=t.last;i===null?t.last=t.first=e:(i.next=e,e.prev=i,t.last=e)}function Ar(e,t,i){var r=Ge;r!==null&&(r.f&Ti)!==0&&(e|=Ti);var s={ctx:Tt,deps:null,nodes:null,f:e|Zt|Ki,first:null,fn:t,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null};if(i)try{eo(s)}catch(l){throw mi(s),l}else t!==null&&nr(s);var n=s;if(i&&n.deps===null&&n.teardown===null&&n.nodes===null&&n.first===n.last&&(n.f&ao)===0&&(n=n.first,(e&Xr)!==0&&(e&fn)!==0&&n!==null&&(n.f|=fn)),n!==null&&(n.parent=r,r!==null&&Kg(n,r),Ke!==null&&(Ke.f&$t)!==0&&(e&bn)===0)){var o=Ke;(o.effects??(o.effects=[])).push(n)}return s}function $c(){return Ke!==null&&!or}function Zc(e){const t=Ar(oa,null,!1);return bt(t,Ht),t.teardown=e,t}function hr(e){v_();var t=Ge.f,i=!Ke&&(t&ur)!==0&&(t&un)===0;if(i){var r=Tt;(r.e??(r.e=[])).push(e)}else return p_(e)}function p_(e){return Ar(na|Hf,e,!1)}function qg(e){return v_(),Ar(oa|Hf,e,!0)}function jg(e){Ss.ensure();const t=Ar(bn|ao,e,!0);return(i={})=>new Promise(r=>{i.outro?on(t,()=>{mi(t),r(void 0)}):(mi(t),r(void 0))})}function Qc(e){return Ar(na,e,!1)}function Yg(e){return Ar(jc|ao,e,!0)}function la(e,t=0){return Ar(oa|t,e,!0)}function ce(e,t=[],i=[],r=[]){Tg(r,t,i,s=>{Ar(oa,()=>e(...s.map(a)),!0)})}function wl(e,t=0){var i=Ar(Xr|t,e,!0);return i}function Fi(e){return Ar(ur|ao,e,!0)}function g_(e){var t=e.teardown;if(t!==null){const i=Rs,r=Ke;Nd(!0),Yi(null);try{t.call(null)}finally{Nd(i),Yi(r)}}}function Jc(e,t=!1){var i=e.first;for(e.first=e.last=null;i!==null;){const s=i.ac;s!==null&&Sl(()=>{s.abort(Fs)});var r=i.next;(i.f&bn)!==0?i.parent=null:mi(i,t),i=r}}function Vg(e){for(var t=e.first;t!==null;){var i=t.next;(t.f&ur)===0&&mi(t),t=i}}function mi(e,t=!0){var i=!1;(t||(e.f&Wf)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(m_(e.nodes.start,e.nodes.end),i=!0),Jc(e,t&&!i),Ho(e,0),bt(e,Kr);var r=e.nodes&&e.nodes.t;if(r!==null)for(const n of r)n.stop();g_(e);var s=e.parent;s!==null&&s.first!==null&&b_(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function m_(e,t){for(;e!==null;){var i=e===t?null:aa(e);e.remove(),e=i}}function b_(e){var t=e.parent,i=e.prev,r=e.next;i!==null&&(i.next=r),r!==null&&(r.prev=i),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=i))}function on(e,t,i=!0){var r=[];y_(e,r,!0);var s=()=>{i&&mi(e),t&&t()},n=r.length;if(n>0){var o=()=>--n||s();for(var l of r)l.out(o)}else s()}function y_(e,t,i){if((e.f&Ti)===0){e.f^=Ti;var r=e.nodes&&e.nodes.t;if(r!==null)for(const l of r)(l.is_global||i)&&t.push(l);for(var s=e.first;s!==null;){var n=s.next,o=(s.f&fn)!==0||(s.f&ur)!==0&&(e.f&Xr)!==0;y_(s,t,o?i:!1),s=n}}}function ed(e){S_(e,!0)}function S_(e,t){if((e.f&Ti)!==0){e.f^=Ti,(e.f&Ht)===0&&(bt(e,Zt),nr(e));for(var i=e.first;i!==null;){var r=i.next,s=(i.f&fn)!==0||(i.f&ur)!==0;S_(i,s?t:!1),i=r}var n=e.nodes&&e.nodes.t;if(n!==null)for(const o of n)(o.is_global||t)&&o.in()}}function w_(e,t){if(e.nodes)for(var i=e.nodes.start,r=e.nodes.end;i!==null;){var s=i===r?null:aa(i);t.append(i),i=s}}let Fa=!1,Rs=!1;function Nd(e){Rs=e}let Ke=null,or=!1;function Yi(e){Ke=e}let Ge=null;function Rr(e){Ge=e}let qi=null;function C_(e){Ke!==null&&(qi===null?qi=[e]:qi.push(e))}let vi=null,ki=0,Oi=null;function Gg(e){Oi=e}let k_=1,Hs=0,Yr=Hs;function Fd(e){Yr=e}function x_(){return++k_}function ha(e){var t=e.f;if((t&Zt)!==0)return!0;if(t&$t&&(e.f&=~_n),(t&cr)!==0){for(var i=e.deps,r=i.length,s=0;s<r;s++){var n=i[s];if(ha(n)&&n_(n),n.wv>e.wv)return!0}(t&Ki)!==0&&Vt===null&&bt(e,Ht)}return!1}function E_(e,t,i=!0){var r=e.reactions;if(r!==null&&!(qi!==null&&Zn.call(qi,e)))for(var s=0;s<r.length;s++){var n=r[s];(n.f&$t)!==0?E_(n,t,!1):t===n&&(i?bt(n,Zt):(n.f&Ht)!==0&&bt(n,cr),nr(n))}}function D_(e){var b;var t=vi,i=ki,r=Oi,s=Ke,n=qi,o=Tt,l=or,h=Yr,c=e.f;vi=null,ki=0,Oi=null,Ke=(c&(ur|bn))===0?e:null,qi=null,Qn(e.ctx),or=!1,Yr=++Hs,e.ac!==null&&(Sl(()=>{e.ac.abort(Fs)}),e.ac=null);try{e.f|=vh;var u=e.fn,d=u();e.f|=un;var f=e.deps,_=Le==null?void 0:Le.is_fork;if(vi!==null){var p;if(_||Ho(e,ki),f!==null&&ki>0)for(f.length=ki+vi.length,p=0;p<vi.length;p++)f[ki+p]=vi[p];else e.deps=f=vi;if($c()&&(e.f&Ki)!==0)for(p=ki;p<f.length;p++)((b=f[p]).reactions??(b.reactions=[])).push(e)}else!_&&f!==null&&ki<f.length&&(Ho(e,ki),f.length=ki);if(Vf()&&Oi!==null&&!or&&f!==null&&(e.f&($t|cr|Zt))===0)for(p=0;p<Oi.length;p++)E_(Oi[p],e);if(s!==null&&s!==e){if(Hs++,s.deps!==null)for(let g=0;g<i;g+=1)s.deps[g].rv=Hs;if(t!==null)for(const g of t)g.rv=Hs;Oi!==null&&(r===null?r=Oi:r.push(...Oi))}return(e.f&ys)!==0&&(e.f^=ys),d}catch(g){return $f(g)}finally{e.f^=vh,vi=t,ki=i,Oi=r,Ke=s,qi=n,Qn(o),or=l,Yr=h}}function Xg(e,t){let i=t.reactions;if(i!==null){var r=Op.call(i,e);if(r!==-1){var s=i.length-1;s===0?i=t.reactions=null:(i[r]=i[s],i.pop())}}if(i===null&&(t.f&$t)!==0&&(vi===null||!Zn.call(vi,t))){var n=t;(n.f&Ki)!==0&&(n.f^=Ki,n.f&=~_n),Vc(n),Lg(n),Ho(n,0)}}function Ho(e,t){var i=e.deps;if(i!==null)for(var r=t;r<i.length;r++)Xg(e,i[r])}function eo(e){var t=e.f;if((t&Kr)===0){bt(e,Ht);var i=Ge,r=Fa;Ge=e,Fa=!0;try{(t&(Xr|Ff))!==0?Vg(e):Jc(e),g_(e);var s=D_(e);e.teardown=typeof s=="function"?s:null,e.wv=k_;var n;fh&&_g&&(e.f&Zt)!==0&&e.deps}finally{Fa=r,Ge=i}}}async function $g(){await Promise.resolve(),bg()}function a(e){var t=e.f,i=(t&$t)!==0;if(Ke!==null&&!or){var r=Ge!==null&&(Ge.f&Kr)!==0;if(!r&&(qi===null||!Zn.call(qi,e))){var s=Ke.deps;if((Ke.f&vh)!==0)e.rv<Hs&&(e.rv=Hs,vi===null&&s!==null&&s[ki]===e?ki++:vi===null?vi=[e]:vi.push(e));else{(Ke.deps??(Ke.deps=[])).push(e);var n=e.reactions;n===null?e.reactions=[Ke]:Zn.call(n,Ke)||n.push(Ke)}}}if(Rs&&ws.has(e))return ws.get(e);if(i){var o=e;if(Rs){var l=o.v;return((o.f&Ht)===0&&o.reactions!==null||R_(o))&&(l=Gc(o)),ws.set(o,l),l}var h=(o.f&Ki)===0&&!or&&Ke!==null&&(Fa||(Ke.f&Ki)!==0),c=(o.f&un)===0;ha(o)&&(h&&(o.f|=Ki),n_(o)),h&&!c&&(o_(o),T_(o))}if(Vt!=null&&Vt.has(e))return Vt.get(e);if((e.f&ys)!==0)throw e.v;return e.v}function T_(e){if(e.f|=Ki,e.deps!==null)for(const t of e.deps)(t.reactions??(t.reactions=[])).push(e),(t.f&$t)!==0&&(t.f&Ki)===0&&(o_(t),T_(t))}function R_(e){if(e.v===Ut)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(ws.has(t)||(t.f&$t)!==0&&R_(t))return!0;return!1}function $r(e){var t=or;try{return or=!0,e()}finally{or=t}}function Zg(e){if(!(typeof e!="object"||!e||e instanceof EventTarget)){if(qr in e)kh(e);else if(!Array.isArray(e))for(let t in e){const i=e[t];typeof i=="object"&&i&&qr in i&&kh(i)}}}function kh(e,t=new Set){if(typeof e=="object"&&e!==null&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let r in e)try{kh(e[r],t)}catch{}const i=qc(e);if(i!==Object.prototype&&i!==Array.prototype&&i!==Map.prototype&&i!==Set.prototype&&i!==Date.prototype){const r=Bf(i);for(let s in r){const n=r[s].get;if(n)try{n.call(e)}catch{}}}}}const Qg=["touchstart","touchmove"];function Jg(e){return Qg.includes(e)}const zs=Symbol("events"),P_=new Set,xh=new Set;function em(e,t,i,r={}){function s(n){if(r.capture||Eh.call(t,n),!n.cancelBubble)return Sl(()=>i==null?void 0:i.call(this,n))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?Dr(()=>{t.addEventListener(e,s,r)}):t.addEventListener(e,s,r),s}function ar(e,t,i,r,s){var n={capture:r,passive:s},o=em(e,t,i,n);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Zc(()=>{t.removeEventListener(e,o,n)})}function V(e,t,i){(t[zs]??(t[zs]={}))[e]=i}function vt(e){for(var t=0;t<e.length;t++)P_.add(e[t]);for(var i of xh)i(e)}let Wd=null;function Eh(e){var g,S;var t=this,i=t.ownerDocument,r=e.type,s=((g=e.composedPath)==null?void 0:g.call(e))||[],n=s[0]||e.target;Wd=e;var o=0,l=Wd===e&&e[zs];if(l){var h=s.indexOf(l);if(h!==-1&&(t===document||t===window)){e[zs]=t;return}var c=s.indexOf(t);if(c===-1)return;h<=c&&(o=h)}if(n=s[o]||e.target,n!==t){Lp(e,"currentTarget",{configurable:!0,get(){return n||i}});var u=Ke,d=Ge;Yi(null),Rr(null);try{for(var f,_=[];n!==null;){var p=n.assignedSlot||n.parentNode||n.host||null;try{var b=(S=n[zs])==null?void 0:S[r];b!=null&&(!n.disabled||e.target===n)&&b.call(n,e)}catch(x){f?_.push(x):f=x}if(e.cancelBubble||p===t||p===null)break;n=p}if(f){for(let x of _)queueMicrotask(()=>{throw x});throw f}}finally{e[zs]=t,delete e.currentTarget,Yi(u),Rr(d)}}}var Sf;const Ul=((Sf=globalThis==null?void 0:globalThis.window)==null?void 0:Sf.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function tm(e){return(Ul==null?void 0:Ul.createHTML(e))??e}function im(e){var t=__("template");return t.innerHTML=tm(e.replaceAll("<!>","<!---->")),t.content}function zo(e,t){var i=Ge;i.nodes===null&&(i.nodes={start:e,end:t,a:null,t:null})}function F(e,t){var i=(t&lg)!==0,r=(t&hg)!==0,s,n=!e.startsWith("<!>");return()=>{s===void 0&&(s=im(n?e:"<!>"+e),i||(s=nn(s)));var o=r||c_?document.importNode(s,!0):s.cloneNode(!0);if(i){var l=nn(o),h=o.lastChild;zo(l,h)}else zo(o,o);return o}}function an(e=""){{var t=jr(e+"");return zo(t,t),t}}function Vr(){var e=document.createDocumentFragment(),t=document.createComment(""),i=jr();return e.append(t,i),zo(t,i),e}function I(e,t){e!==null&&e.before(t)}function oe(e,t){var i=t==null?"":typeof t=="object"?`${t}`:t;i!==(e.__t??(e.__t=e.nodeValue))&&(e.__t=i,e.nodeValue=`${i}`)}function rm(e,t){return sm(e,t)}const xa=new Map;function sm(e,{target:t,anchor:i,props:r={},events:s,context:n,intro:o=!0,transformError:l}){Wg();var h=void 0,c=jg(()=>{var u=i??t.appendChild(jr());Cg(u,{pending:()=>{}},_=>{ft({});var p=Tt;n&&(p.c=n),s&&(r.$$events=s),h=e(_,r)||{},_t()},l);var d=new Set,f=_=>{for(var p=0;p<_.length;p++){var b=_[p];if(!d.has(b)){d.add(b);var g=Jg(b);for(const C of[t,document]){var S=xa.get(C);S===void 0&&(S=new Map,xa.set(C,S));var x=S.get(b);x===void 0?(C.addEventListener(b,Eh,{passive:g}),S.set(b,1)):S.set(b,x+1)}}}};return f(ml(P_)),xh.add(f),()=>{var g;for(var _ of d)for(const S of[t,document]){var p=xa.get(S),b=p.get(_);--b==0?(S.removeEventListener(_,Eh),p.delete(_),p.size===0&&xa.delete(S)):p.set(_,b)}xh.delete(f),u!==i&&((g=u.parentNode)==null||g.removeChild(u))}});return nm.set(h,c),h}let nm=new WeakMap;var Ji,Sr,Ei,Gs,Qo,Jo,vl;class M_{constructor(t,i=!0){Vi(this,"anchor");ie(this,Ji,new Map);ie(this,Sr,new Map);ie(this,Ei,new Map);ie(this,Gs,new Set);ie(this,Qo,!0);ie(this,Jo,()=>{var t=Le;if(v(this,Ji).has(t)){var i=v(this,Ji).get(t),r=v(this,Sr).get(i);if(r)ed(r),v(this,Gs).delete(i);else{var s=v(this,Ei).get(i);s&&(v(this,Sr).set(i,s.effect),v(this,Ei).delete(i),s.fragment.lastChild.remove(),this.anchor.before(s.fragment),r=s.effect)}for(const[n,o]of v(this,Ji)){if(v(this,Ji).delete(n),n===t)break;const l=v(this,Ei).get(o);l&&(mi(l.effect),v(this,Ei).delete(o))}for(const[n,o]of v(this,Sr)){if(n===i||v(this,Gs).has(n))continue;const l=()=>{if(Array.from(v(this,Ji).values()).includes(n)){var c=document.createDocumentFragment();w_(o,c),c.append(jr()),v(this,Ei).set(n,{effect:o,fragment:c})}else mi(o);v(this,Gs).delete(n),v(this,Sr).delete(n)};v(this,Qo)||!r?(v(this,Gs).add(n),on(o,l,!1)):l()}}});ie(this,vl,t=>{v(this,Ji).delete(t);const i=Array.from(v(this,Ji).values());for(const[r,s]of v(this,Ei))i.includes(r)||(mi(s.effect),v(this,Ei).delete(r))});this.anchor=t,X(this,Qo,i)}ensure(t,i){var r=Le,s=f_();if(i&&!v(this,Sr).has(t)&&!v(this,Ei).has(t))if(s){var n=document.createDocumentFragment(),o=jr();n.append(o),v(this,Ei).set(t,{effect:Fi(()=>i(o)),fragment:n})}else v(this,Sr).set(t,Fi(()=>i(this.anchor)));if(v(this,Ji).set(r,t),s){for(const[l,h]of v(this,Sr))l===t?r.unskip_effect(h):r.skip_effect(h);for(const[l,h]of v(this,Ei))l===t?r.unskip_effect(h.effect):r.skip_effect(h.effect);r.oncommit(v(this,Jo)),r.ondiscard(v(this,vl))}else v(this,Jo).call(this)}}Ji=new WeakMap,Sr=new WeakMap,Ei=new WeakMap,Gs=new WeakMap,Qo=new WeakMap,Jo=new WeakMap,vl=new WeakMap;function re(e,t,i=!1){var r=new M_(e),s=i?fn:0;function n(o,l){r.ensure(o,l)}wl(()=>{var o=!1;t((l,h=0)=>{o=!0,n(h,l)}),o||n(!1,null)},s)}function Uo(e,t){return t}function om(e,t,i){for(var r=[],s=t.length,n,o=t.length,l=0;l<s;l++){let d=t[l];on(d,()=>{if(n){if(n.pending.delete(d),n.done.add(d),n.pending.size===0){var f=e.outrogroups;Dh(ml(n.done)),f.delete(n),f.size===0&&(e.outrogroups=null)}}else o-=1},!1)}if(o===0){var h=r.length===0&&i!==null;if(h){var c=i,u=c.parentNode;Hg(u),u.append(c),e.items.clear()}Dh(t,!h)}else n={pending:new Set(t),done:new Set},(e.outrogroups??(e.outrogroups=new Set)).add(n)}function Dh(e,t=!0){for(var i=0;i<e.length;i++)mi(e[i],t)}var Hd;function Xt(e,t,i,r,s,n=null){var o=e,l=new Map,h=(t&zf)!==0;if(h){var c=e;o=c.appendChild(jr())}var u=null,d=s_(()=>{var S=i();return Kc(S)?S:S==null?[]:ml(S)}),f,_=!0;function p(){g.fallback=u,am(g,f,o,t,r),u!==null&&(f.length===0?(u.f&zr)===0?ed(u):(u.f^=zr,Co(u,null,o)):on(u,()=>{u=null}))}var b=wl(()=>{f=a(d);for(var S=f.length,x=new Set,C=Le,w=f_(),k=0;k<S;k+=1){var M=f[k],B=r(M,k),q=_?null:l.get(B);q?(q.v&&Jn(q.v,M),q.i&&Jn(q.i,k),w&&C.unskip_effect(q.e)):(q=lm(l,_?o:Hd??(Hd=jr()),M,B,k,s,t,i),_||(q.e.f|=zr),l.set(B,q)),x.add(B)}if(S===0&&n&&!u&&(_?u=Fi(()=>n(o)):(u=Fi(()=>n(Hd??(Hd=jr()))),u.f|=zr)),S>x.size&&qp(),!_)if(w){for(const[Y,ne]of l)x.has(Y)||C.skip_effect(ne.e);C.oncommit(p),C.ondiscard(()=>{})}else p();a(d)}),g={effect:b,items:l,outrogroups:null,fallback:u};_=!1}function fo(e){for(;e!==null&&(e.f&ur)===0;)e=e.next;return e}function am(e,t,i,r,s){var ne,j,N,L,R,O,U,T,E;var n=(r&ig)!==0,o=t.length,l=e.items,h=fo(e.effect.first),c,u=null,d,f=[],_=[],p,b,g,S;if(n)for(S=0;S<o;S+=1)p=t[S],b=s(p,S),g=l.get(b).e,(g.f&zr)===0&&((j=(ne=g.nodes)==null?void 0:ne.a)==null||j.measure(),(d??(d=new Set)).add(g));for(S=0;S<o;S+=1){if(p=t[S],b=s(p,S),g=l.get(b).e,e.outrogroups!==null)for(const Q of e.outrogroups)Q.pending.delete(g),Q.done.delete(g);if((g.f&zr)!==0)if(g.f^=zr,g===h)Co(g,null,i);else{var x=u?u.next:h;g===e.effect.last&&(e.effect.last=g.prev),g.prev&&(g.prev.next=g.next),g.next&&(g.next.prev=g.prev),es(e,u,g),es(e,g,x),Co(g,x,i),u=g,f=[],_=[],h=fo(u.next);continue}if((g.f&Ti)!==0&&(ed(g),n&&((L=(N=g.nodes)==null?void 0:N.a)==null||L.unfix(),(d??(d=new Set)).delete(g))),g!==h){if(c!==void 0&&c.has(g)){if(f.length<_.length){var C=_[0],w;u=C.prev;var k=f[0],M=f[f.length-1];for(w=0;w<f.length;w+=1)Co(f[w],C,i);for(w=0;w<_.length;w+=1)c.delete(_[w]);es(e,k.prev,M.next),es(e,u,k),es(e,M,C),h=C,u=M,S-=1,f=[],_=[]}else c.delete(g),Co(g,h,i),es(e,g.prev,g.next),es(e,g,u===null?e.effect.first:u.next),es(e,u,g),u=g;continue}for(f=[],_=[];h!==null&&h!==g;)(c??(c=new Set)).add(h),_.push(h),h=fo(h.next);if(h===null)continue}(g.f&zr)===0&&f.push(g),u=g,h=fo(g.next)}if(e.outrogroups!==null){for(const Q of e.outrogroups)Q.pending.size===0&&(Dh(ml(Q.done)),(R=e.outrogroups)==null||R.delete(Q));e.outrogroups.size===0&&(e.outrogroups=null)}if(h!==null||c!==void 0){var B=[];if(c!==void 0)for(g of c)(g.f&Ti)===0&&B.push(g);for(;h!==null;)(h.f&Ti)===0&&h!==e.fallback&&B.push(h),h=fo(h.next);var q=B.length;if(q>0){var Y=(r&zf)!==0&&o===0?i:null;if(n){for(S=0;S<q;S+=1)(U=(O=B[S].nodes)==null?void 0:O.a)==null||U.measure();for(S=0;S<q;S+=1)(E=(T=B[S].nodes)==null?void 0:T.a)==null||E.fix()}om(e,B,Y)}}n&&Dr(()=>{var Q,ee;if(d!==void 0)for(g of d)(ee=(Q=g.nodes)==null?void 0:Q.a)==null||ee.apply()})}function lm(e,t,i,r,s,n,o,l){var h=(o&eg)!==0?(o&rg)===0?Ig(i,!1,!1):Ts(i):null,c=(o&tg)!==0?Ts(s):null;return{v:h,i:c,e:Fi(()=>(n(t,h??i,c??s,l),()=>{e.delete(r)}))}}function Co(e,t,i){if(e.nodes)for(var r=e.nodes.start,s=e.nodes.end,n=t&&(t.f&zr)===0?t.nodes.start:i;r!==null;){var o=aa(r);if(n.before(r),r===s)return;r=o}}function es(e,t,i){t===null?e.effect.first=i:t.next=i,i===null?e.effect.last=t:i.prev=t}function zd(e,t,i=!1,r=!1,s=!1){var n=e,o="";ce(()=>{var l=Ge;if(o!==(o=t()??"")&&(l.nodes!==null&&(m_(l.nodes.start,l.nodes.end),l.nodes=null),o!=="")){var h=i?cg:r?dg:void 0,c=__(i?"svg":r?"math":"template",h);c.innerHTML=o;var u=i||r?c:c.content;if(zo(nn(u),u.lastChild),i||r)for(;nn(u);)n.before(nn(u));else n.before(u)}})}function hm(e,t,...i){var r=new M_(e);wl(()=>{const s=t()??null;r.ensure(s,s&&(n=>s(n,...i)))},fn)}function cm(e,t,i){Qc(()=>{var r=$r(()=>t(e,i==null?void 0:i())||{});if(i&&(r!=null&&r.update)){var s=!1,n={};la(()=>{var o=i();Zg(o),s&&qf(n,o)&&(n=o,r.update(o))}),s=!0}if(r!=null&&r.destroy)return()=>r.destroy()})}function A_(e){var t,i,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(i=A_(e[t]))&&(r&&(r+=" "),r+=i)}else for(i in e)e[i]&&(r&&(r+=" "),r+=i);return r}function dm(){for(var e,t,i=0,r="",s=arguments.length;i<s;i++)(e=arguments[i])&&(t=A_(e))&&(r&&(r+=" "),r+=t);return r}function O_(e){return typeof e=="object"?dm(e):e??""}const Ud=[...`
|
|
2
|
-
\r\f \v\uFEFF`];function um(e,t,i){var r=e==null?"":""+e;if(t&&(r=r?r+" "+t:t),i){for(var s of Object.keys(i))if(i[s])r=r?r+" "+s:s;else if(r.length)for(var n=s.length,o=0;(o=r.indexOf(s,o))>=0;){var l=o+n;(o===0||Ud.includes(r[o-1]))&&(l===r.length||Ud.includes(r[l]))?r=(o===0?"":r.substring(0,o))+r.substring(l+1):o=l}}return r===""?null:r}function Kd(e,t=!1){var i=t?" !important;":";",r="";for(var s of Object.keys(e)){var n=e[s];n!=null&&n!==""&&(r+=" "+s+": "+n+i)}return r}function Kl(e){return e[0]!=="-"||e[1]!=="-"?e.toLowerCase():e}function fm(e,t){if(t){var i="",r,s;if(Array.isArray(t)?(r=t[0],s=t[1]):r=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var n=!1,o=0,l=!1,h=[];r&&h.push(...Object.keys(r).map(Kl)),s&&h.push(...Object.keys(s).map(Kl));var c=0,u=-1;const b=e.length;for(var d=0;d<b;d++){var f=e[d];if(l?f==="/"&&e[d-1]==="*"&&(l=!1):n?n===f&&(n=!1):f==="/"&&e[d+1]==="*"?l=!0:f==='"'||f==="'"?n=f:f==="("?o++:f===")"&&o--,!l&&n===!1&&o===0){if(f===":"&&u===-1)u=d;else if(f===";"||d===b-1){if(u!==-1){var _=Kl(e.substring(c,u).trim());if(!h.includes(_)){f!==";"&&d++;var p=e.substring(c,d).trim();i+=" "+p+";"}}c=d+1,u=-1}}}}return r&&(i+=Kd(r)),s&&(i+=Kd(s,!0)),i=i.trim(),i===""?null:i}return e==null?null:String(e)}function tt(e,t,i,r,s,n){var o=e.__className;if(o!==i||o===void 0){var l=um(i,r,n);l==null?e.removeAttribute("class"):t?e.className=l:e.setAttribute("class",l),e.__className=i}else if(n&&s!==n)for(var h in n){var c=!!n[h];(s==null||c!==!!s[h])&&e.classList.toggle(h,c)}return n}function ql(e,t={},i,r){for(var s in i){var n=i[s];t[s]!==n&&(i[s]==null?e.style.removeProperty(s):e.style.setProperty(s,n,r))}}function lo(e,t,i,r){var s=e.__style;if(s!==t){var n=fm(t,r);n==null?e.removeAttribute("style"):e.style.cssText=n,e.__style=t}else r&&(Array.isArray(r)?(ql(e,i==null?void 0:i[0],r[0]),ql(e,i==null?void 0:i[1],r[1],"important")):ql(e,i,r));return r}function L_(e,t,i=!1){if(e.multiple){if(t==null)return;if(!Kc(t))return ug();for(var r of e.options)r.selected=t.includes(Ao(r));return}for(r of e.options){var s=Ao(r);if(Fg(s,t)){r.selected=!0;return}}(!i||t!==void 0)&&(e.selectedIndex=-1)}function _m(e){var t=new MutationObserver(()=>{L_(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Zc(()=>{t.disconnect()})}function Xa(e,t,i=t){var r=new WeakSet,s=!0;Xc(e,"change",n=>{var o=n?"[selected]":":checked",l;if(e.multiple)l=[].map.call(e.querySelectorAll(o),Ao);else{var h=e.querySelector(o)??e.querySelector("option:not([disabled])");l=h&&Ao(h)}i(l),Le!==null&&r.add(Le)}),Qc(()=>{var n=t();if(e===document.activeElement){var o=Va??Le;if(r.has(o))return}if(L_(e,n,s),s&&n===void 0){var l=e.querySelector(":checked");l!==null&&(n=Ao(l),i(n))}e.__value=n,s=!1}),_m(e)}function Ao(e){return"__value"in e?e.__value:e.value}const vm=Symbol("is custom element"),pm=Symbol("is html"),gm=Up?"progress":"PROGRESS";function mm(e,t){var i=td(e);i.value===(i.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!==gm)||(e.value=t??"")}function bm(e,t){var i=td(e);i.checked!==(i.checked=t??void 0)&&(e.checked=t)}function Ue(e,t,i,r){var s=td(e);s[t]!==(s[t]=i)&&(t==="loading"&&(e[zp]=i),i==null?e.removeAttribute(t):typeof i!="string"&&ym(e).includes(t)?e[t]=i:e.setAttribute(t,i))}function td(e){return e.__attributes??(e.__attributes={[vm]:e.nodeName.includes("-"),[pm]:e.namespaceURI===Uf})}var qd=new Map;function ym(e){var t=e.getAttribute("is")||e.nodeName,i=qd.get(t);if(i)return i;qd.set(t,i=[]);for(var r,s=e,n=Element.prototype;n!==s;){r=Bf(s);for(var o in r)r[o].set&&i.push(o);s=qc(s)}return i}function zi(e,t,i=t){var r=new WeakSet;Xc(e,"input",async s=>{var n=s?e.defaultValue:e.value;if(n=jl(e)?Yl(n):n,i(n),Le!==null&&r.add(Le),await $g(),n!==(n=t())){var o=e.selectionStart,l=e.selectionEnd,h=e.value.length;if(e.value=n??"",l!==null){var c=e.value.length;o===l&&l===h&&c>h?(e.selectionStart=c,e.selectionEnd=c):(e.selectionStart=o,e.selectionEnd=Math.min(l,c))}}}),$r(t)==null&&e.value&&(i(jl(e)?Yl(e.value):e.value),Le!==null&&r.add(Le)),la(()=>{var s=t();if(e===document.activeElement){var n=Va??Le;if(r.has(n))return}jl(e)&&s===Yl(e.value)||e.type==="date"&&!s&&!e.value||s!==e.value&&(e.value=s??"")})}function rr(e,t,i=t){Xc(e,"change",r=>{var s=r?e.defaultChecked:e.checked;i(s)}),$r(t)==null&&i(e.checked),la(()=>{var r=t();e.checked=!!r})}function jl(e){var t=e.type;return t==="number"||t==="range"}function Yl(e){return e===""?null:+e}function jd(e,t){return e===t||(e==null?void 0:e[qr])===t}function st(e={},t,i,r){return Qc(()=>{var s,n;return la(()=>{s=n,n=(r==null?void 0:r())||[],$r(()=>{e!==i(...n)&&(t(e,...n),s&&jd(i(...s),e)&&t(null,...s))})}),()=>{Dr(()=>{n&&jd(i(...n),e)&&t(null,...n)})}}),e}let Ea=!1;function Sm(e){var t=Ea;try{return Ea=!1,[e(),Ea]}finally{Ea=t}}function dr(e,t,i,r){var x;var s=(i&og)!==0,n=(i&ag)!==0,o=r,l=!0,h=()=>(l&&(l=!1,o=n?$r(r):r),o),c;if(s){var u=qr in e||Hp in e;c=((x=Dn(e,t))==null?void 0:x.set)??(u&&t in e?C=>e[t]=C:void 0)}var d,f=!1;s?[d,f]=Sm(()=>e[t]):d=e[t],d===void 0&&r!==void 0&&(d=h(),c&&(Xp(),c(d)));var _;if(_=()=>{var C=e[t];return C===void 0?h():(l=!0,C)},(i&ng)===0)return _;if(c){var p=e.$$legacy;return(function(C,w){return arguments.length>0?((!w||p||f)&&c(w?_():C),C):_()})}var b=!1,g=((i&sg)!==0?yl:s_)(()=>(b=!1,_()));s&&a(g);var S=Ge;return(function(C,w){if(arguments.length>0){const k=w?a(g):s?Ze(C):C;return m(g,k),b=!0,o!==void 0&&(o=k),C}return Rs&&b||(S.f&Kr)!==0?g.v:a(g)})}function ho(e){Tt===null&&Yc(),hr(()=>{const t=$r(e);if(typeof t=="function")return t})}function wm(e){Tt===null&&Yc(),ho(()=>()=>$r(e))}const Cm="5";var wf;typeof window<"u"&&((wf=window.__svelte??(window.__svelte={})).v??(wf.v=new Set)).add(Cm);class I_ extends Error{constructor(i){super("conflict");Vi(this,"sessionId");this.name="ConflictError",this.sessionId=i}}async function At(e){if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}async function km(e){const t=await fetch("/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pin:e})});if(!t.ok){const i=await t.json();throw new Error(i.error||"Authentication failed")}}async function xm(){return(await fetch("/sessions")).ok}async function Em(){return At(await fetch("/sessions"))}async function Dm(){return At(await fetch("/worktrees"))}async function Tm(){return(await At(await fetch("/workspaces"))).workspaces}async function Rm(e){return(await At(await fetch("/workspaces/reorder",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:e})}))).workspaces}async function Yd(e,t){const i=new URLSearchParams;return e&&i.set("path",e),At(await fetch("/workspaces/browse?"+i.toString()))}async function Pm(e){return At(await fetch("/workspaces/bulk",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:e})}))}async function Mm(e){var i,r;const t=await At(await fetch("/workspaces/dashboard?path="+encodeURIComponent(e)));return{prs:((i=t.pullRequests)==null?void 0:i.prs)??[],activity:t.activity??[],isGitRepo:!0,defaultBranch:null,hasGhCli:!((r=t.pullRequests)!=null&&r.error)}}async function Am(e,t){const i=await fetch("/workspaces/ci-status?path="+encodeURIComponent(e)+"&branch="+encodeURIComponent(t));return i.ok?i.json():null}async function Om(e,t){const i=await fetch("/workspaces/pr?path="+encodeURIComponent(e)+"&branch="+encodeURIComponent(t));return i.ok?i.json():null}async function Lm(e){return(await At(await fetch("/workspaces/current-branch?path="+encodeURIComponent(e)))).branch}async function Vl(e,t){const i=await fetch("/workspaces/worktree?path="+encodeURIComponent(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:t})});if(!i.ok){const r=await i.json();throw new Error(r.error||"Failed to create worktree")}return i.json()}async function Im(e,t){return(await fetch("/workspaces/branch?path="+encodeURIComponent(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:t})})).json()}async function id(e,t={}){const i=new URLSearchParams({repo:e});return t.refresh&&i.set("refresh","1"),At(await fetch("/branches?"+i.toString()))}async function ln(e){const t=await fetch("/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.status===409){const i=await t.json();throw new I_(i.sessionId??"")}return At(t)}async function B_(e){const t=await fetch("/sessions/repo",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.status===409){const i=await t.json();throw new I_(i.sessionId??"")}return At(t)}async function Bm(e){await fetch("/sessions/"+e,{method:"DELETE"})}async function N_(e,t){const i=await fetch("/worktrees",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreePath:e,repoPath:t})});if(!i.ok){const r=await i.json();throw new Error(r.error||"Failed to delete worktree")}}async function Nm(e,t,i){return At(await fetch("/sessions/"+e+"/image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:t,mimeType:i})}))}async function F_(){return At(await fetch("/version"))}async function W_(){return At(await fetch("/update",{method:"POST"}))}async function Fm(){return(await At(await fetch("/config/defaultAgent"))).defaultAgent}async function Wm(e){if(!(await fetch("/config/defaultAgent",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaultAgent:e})})).ok)throw new Error("Failed to update default agent")}async function Cl(e){return(await At(await fetch(`/config/${e}`)))[e]}async function kl(e,t){const i=await fetch(`/config/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[e]:t})});if(!i.ok){const r=await i.json();throw new Error(r.error||`Failed to update ${e}`)}}const Hm=()=>Cl("defaultContinue"),zm=e=>kl("defaultContinue",e),Um=()=>Cl("defaultYolo"),Km=e=>kl("defaultYolo",e),qm=()=>Cl("launchInTmux"),jm=e=>kl("launchInTmux",e),Ym=()=>Cl("defaultNotifications"),Vm=e=>kl("defaultNotifications",e);async function Gm(e,t){if(!(await fetch("/push/subscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({subscription:e,sessionIds:t})})).ok)throw new Error("Push subscribe failed")}async function Th(e){return At(await fetch("/workspaces/settings?path="+encodeURIComponent(e)))}async function Xm(e,t){const i=await fetch("/workspaces/settings?path="+encodeURIComponent(e),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!i.ok){const r=await i.json();throw new Error(r.error||"Failed to update workspace settings")}}async function $m(){return At(await fetch("/sessions/meta"))}async function Zm(e,t){const i="/sessions/"+encodeURIComponent(e)+"/meta?refresh=true";return At(await fetch(i))}let $a=H(!1),Rh=H(null),Ph=H(!0);function H_(){return{get authenticated(){return a($a)},get pinError(){return a(Rh)},get checking(){return a(Ph)}}}async function Qm(){m(Ph,!0);try{m($a,await xm(),!0)}catch{m($a,!1)}finally{m(Ph,!1)}}async function Jm(e){m(Rh,null);try{await km(e),m($a,!0)}catch(t){m(Rh,t instanceof Error?t.message:"Authentication failed",!0)}}const z_="claude-remote-sidebar-width",U_="claude-remote-sidebar-collapsed",Mh="claude-remote-active-workspace",K_=240,q_=180,j_=500,eb=44;function tb(){try{const e=localStorage.getItem(z_);if(e){const t=parseInt(e,10);if(t>=q_&&t<=j_)return t}}catch{}return K_}function ib(){try{return localStorage.getItem(U_)==="true"}catch{return!1}}function rb(){try{return localStorage.getItem(Mh)}catch{return null}}let Za=H(!1),Ah=H(Ze(tb())),Oo=H(Ze(ib())),Vd=H(""),Gd=H(Ze(rb())),Qa=H(!1);function rd(){return{get sidebarOpen(){return a(Za)},set sidebarOpen(e){m(Za,e,!0)},get sidebarWidth(){return a(Ah)},set sidebarWidth(e){m(Ah,e,!0)},get sidebarCollapsed(){return a(Oo)},set sidebarCollapsed(e){m(Oo,e,!0)},get searchQuery(){return a(Vd)},set searchQuery(e){m(Vd,e,!0)},get activeWorkspacePath(){return a(Gd)},set activeWorkspacePath(e){m(Gd,e,!0);try{e===null?localStorage.removeItem(Mh):localStorage.setItem(Mh,e)}catch{}},get reorderMode(){return a(Qa)},set reorderMode(e){m(Qa,e,!0)}}}function Xd(){m(Za,!0)}function Di(){m(Za,!1)}function sb(){m(Qa,!0)}function nb(){m(Qa,!1)}function $d(){try{localStorage.setItem(z_,String(a(Ah)))}catch{}}function Gl(){m(Oo,!a(Oo));try{localStorage.setItem(U_,String(a(Oo)))}catch{}}const Y_="claude-remote-collapsed-workspaces";function ob(){try{const e=localStorage.getItem(Y_);if(e)return new Set(JSON.parse(e))}catch{}return new Set}let Ns=H(Ze(ob()));function ab(){try{localStorage.setItem(Y_,JSON.stringify([...a(Ns)]))}catch{}}function lb(e){a(Ns).has(e)?a(Ns).delete(e):a(Ns).add(e),m(Ns,new Set(a(Ns)),!0),ab()}function hb(e){return a(Ns).has(e)}let V_=H(0);setInterval(()=>{Ng(V_)},3e4);function cb(){return a(V_)}let Lo=null,db=null;function ub(e){Lo=e,"serviceWorker"in navigator&&navigator.serviceWorker.addEventListener("message",t=>{const i=t.data;i.type==="notification-click"&&i.sessionId&&Lo&&Lo(i.sessionId,i.sessionType||"repo")})}function G_(){return document.hidden||!document.hasFocus()}function X_(e){if(typeof Notification>"u"||Notification.permission!=="granted")return;const t=new Notification(e.displayName||"Claude Remote CLI",{body:"Session needs your input",tag:"session-"+e.id,data:{sessionId:e.id,sessionType:e.type}});t.onclick=()=>{window.focus(),Lo&&Lo(e.id,e.type),t.close()}}function $_(){return"serviceWorker"in navigator&&"PushManager"in window}async function fb(){if($_())try{db=await navigator.serviceWorker.register("/sw.js")}catch{return}}async function _b(e){if($_())try{const i=await(await navigator.serviceWorker.ready).pushManager.getSubscription();i&&await Gm(i.toJSON(),e)}catch{}}const Z_="claude-remote-notifications",Oh="claude-remote-active-session";function vb(){try{return localStorage.getItem(Oh)}catch{return null}}function Q_(e){try{e===null?localStorage.removeItem(Oh):localStorage.setItem(Oh,e)}catch{}}let vn=H(Ze([])),J_=H(Ze([])),sd=H(Ze([])),hn=H(Ze(vb())),Gr=Ze({}),pn=Ze({}),xl=Ze({}),Io=H(Ze(new Map)),Pr=H(Ze({}));try{const e=localStorage.getItem(Z_);e&&m(Pr,JSON.parse(e),!0)}catch{}function ev(){try{localStorage.setItem(Z_,JSON.stringify(a(Pr)))}catch{}}function nd(){return{get sessions(){return a(vn)},get worktrees(){return a(J_)},get workspaces(){return a(sd)},get activeSessionId(){return a(hn)},set activeSessionId(e){m(hn,e,!0),Q_(e)},get attentionSessions(){return Gr},get loadingItems(){return xl},get notificationSessions(){return a(Pr)}}}async function Bt(){try{const[e,t,i]=await Promise.all([Em(),Dm(),Tm()]);m(vn,e,!0),m(J_,t,!0),m(sd,i,!0);const r=new Set(a(vn).map(n=>n.id));a(hn)!==null&&!r.has(a(hn))&&(m(hn,null),Q_(null));let s=!1;for(const n of Object.keys(Gr))r.has(n)||delete Gr[n];for(const n of Object.keys(pn))r.has(n)||delete pn[n];for(const n of Object.keys(a(Pr)))r.has(n)||(delete a(Pr)[n],s=!0);s&&ev();try{const n=await $m(),o=new Map;for(const[l,h]of Object.entries(n))o.set(l,h);m(Io,o,!0)}catch{}}catch{}}function tv(e){return a(vn).filter(t=>t.repoPath===e||t.repoPath.startsWith(e+"/"))}const iv=3e4;function pb(e,t,i){const r=a(vn).find(s=>s.id===e);r&&(r.branchName=t,r.displayName=i)}function gb(e,t){const i=a(vn).find(r=>r.id===e);if(i&&(i.agentState=t),t==="waiting-for-input"&&e!==a(hn)&&(i==null?void 0:i.type)!=="terminal"){const r=pn[e];if(r&&Date.now()-r<iv)return;delete pn[e],Gr[e]=!0,i&&a(Pr)[e]&&G_()&&X_(i)}else(t==="processing"||t==="initializing")&&delete Gr[e]}function mb(e,t){const i=a(vn).find(r=>r.id===e);if(i&&(i.idle=t),!(i!=null&&i.agentState&&i.agentState!=="idle"))if(t&&e!==a(hn)&&(i==null?void 0:i.type)!=="terminal"){const r=pn[e];if(r&&Date.now()-r<iv)return;delete pn[e],Gr[e]=!0,i&&a(Pr)[e]&&G_()&&X_(i)}else delete Gr[e]}function Zd(e){delete Gr[e],pn[e]=Date.now()}function _o(e,t){e in a(Pr)||(a(Pr)[e]=t,ev())}function bb(){return Object.entries(a(Pr)).filter(([,e])=>e).map(([e])=>e)}function Xl(e){return Gr[e.id]?"attention":e.agentState==="permission-prompt"?"permission-prompt":e.idle?"idle":"running"}function Cn(e){xl[e]=!0}function kn(e){delete xl[e]}function Zi(e){return!!xl[e]}function Qd(e){return a(Io).get(e)}async function yb(e){try{const t=await Zm(e,{refresh:!0});a(Io).set(e,t),m(Io,new Map(a(Io)),!0)}catch{}}async function Sb(e){const t=await Rm(e);m(sd,t,!0)}const rv=location.protocol==="https:"?"wss:":"ws:";let Ms=null,pi=null,Pi=null;const Jd=30;let Bo=null,Tn=0;function sv(e){Ms&&(Ms.close(),Ms=null);const t=rv+"//"+location.host+"/ws/events";Ms=new WebSocket(t),Ms.onmessage=i=>{try{e(JSON.parse(i.data))}catch{}},Ms.onclose=()=>{setTimeout(()=>sv(e),3e3)},Ms.onerror=()=>{}}function nv(e,t,i,r){Bo&&(clearTimeout(Bo),Bo=null),Tn=0,Pi&&(Pi.onopen=null,Pi.onmessage=null,Pi.onclose=null,Pi.onerror=null,Pi.close(),Pi=null),pi&&(pi.onclose=null,pi.close(),pi=null);const s=rv+"//"+location.host+"/ws/"+e,n=new WebSocket(s);Pi=n,n.onopen=()=>{Pi=null,pi=n,Tn=0,i()},n.onmessage=o=>{t.write(o.data)},n.onclose=o=>{if(Pi===n&&(Pi=null),!(Pi!==n&&pi!==n)){if(o.code===1e3){t.write(`\r
|
|
1
|
+
var Up=Object.defineProperty;var Bd=e=>{throw TypeError(e)};var Kp=(e,t,i)=>t in e?Up(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var Gi=(e,t,i)=>Kp(e,typeof t!="symbol"?t+"":t,i),Yl=(e,t,i)=>t.has(e)||Bd("Cannot "+i);var v=(e,t,i)=>(Yl(e,t,"read from private field"),i?i.call(e):t.get(e)),ie=(e,t,i)=>t.has(e)?Bd("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),G=(e,t,i,r)=>(Yl(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),xe=(e,t,i)=>(Yl(e,t,"access private method"),i);var xa=(e,t,i,r)=>({set _(s){G(e,t,s,i)},get _(){return v(e,t,r)}});(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const n of s)if(n.type==="childList")for(const o of n.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function i(s){const n={};return s.integrity&&(n.integrity=s.integrity),s.referrerPolicy&&(n.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?n.credentials="include":s.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function r(s){if(s.ep)return;s.ep=!0;const n=i(s);fetch(s.href,n)}})();const mh=!1;var Vc=Array.isArray,qp=Array.prototype.indexOf,eo=Array.prototype.includes,yl=Array.from,jp=Object.defineProperty,Pn=Object.getOwnPropertyDescriptor,Kf=Object.getOwnPropertyDescriptors,Yp=Object.prototype,Vp=Array.prototype,Gc=Object.getPrototypeOf,Nd=Object.isExtensible;const Gp=()=>{};function $p(e){for(var t=0;t<e.length;t++)e[t]()}function qf(){var e,t,i=new Promise((r,s)=>{e=r,t=s});return{promise:i,resolve:e,reject:t}}function Xp(e,t){if(Array.isArray(e))return e;if(!(Symbol.iterator in e))return Array.from(e);const i=[];for(const r of e)if(i.push(r),i.length===t)break;return i}const Qt=2,la=4,ha=8,jf=1<<24,$r=16,fr=32,yn=64,bh=128,qi=512,Ut=1024,Jt=2048,dr=4096,Ri=8192,Kr=16384,fn=32768,_n=65536,Fd=1<<17,Yf=1<<18,co=1<<19,Vf=1<<20,zr=1<<25,vn=65536,yh=1<<21,$c=1<<22,ys=1<<23,qr=Symbol("$state"),Zp=Symbol("legacy props"),Qp=Symbol(""),Ws=new class extends Error{constructor(){super(...arguments);Gi(this,"name","StaleReactionError");Gi(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var Df;const Jp=!!((Df=globalThis.document)!=null&&Df.contentType)&&globalThis.document.contentType.includes("xml");function Xc(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function eg(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function tg(e,t,i){throw new Error("https://svelte.dev/e/each_key_duplicate")}function ig(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function rg(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function sg(e){throw new Error("https://svelte.dev/e/effect_orphan")}function ng(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function og(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function ag(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function lg(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function hg(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function cg(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const dg=1,ug=2,Gf=4,fg=8,_g=16,vg=1,pg=4,gg=8,mg=16,bg=1,yg=2,qt=Symbol(),$f="http://www.w3.org/1999/xhtml",Sg="http://www.w3.org/2000/svg",wg="http://www.w3.org/1998/Math/MathML";function Cg(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function kg(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function Xf(e){return e===this.v}function Zf(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Qf(e){return!Zf(e,this.v)}let xg=!1,Pt=null;function to(e){Pt=e}function Jf(e){return t_().get(e)}function Eg(e,t){return t_().set(e,t),t}function _t(e,t=!1,i){Pt={p:Pt,i:!1,c:null,e:null,s:e,x:null,l:null}}function vt(e){var t=Pt,i=t.e;if(i!==null){t.e=null;for(var r of i)C_(r)}return e!==void 0&&(t.x=e),t.i=!0,Pt=t.p,e??{}}function e_(){return!0}function t_(e){return Pt===null&&Xc(),Pt.c??(Pt.c=new Map(Dg(Pt)||void 0))}function Dg(e){let t=e.p;for(;t!==null;){const i=t.c;if(i!==null)return i;t=t.p}return null}let Hs=[];function i_(){var e=Hs;Hs=[],$p(e)}function Dr(e){if(Hs.length===0&&!Lo){var t=Hs;queueMicrotask(()=>{t===Hs&&i_()})}Hs.push(e)}function Tg(){for(;Hs.length>0;)i_()}function r_(e){var t=Ge;if(t===null)return qe.f|=ys,e;if((t.f&fn)===0&&(t.f&la)===0)throw e;gs(e,t)}function gs(e,t){for(;t!==null;){if((t.f&bh)!==0){if((t.f&fn)===0)throw e;try{t.b.error(e);return}catch(i){e=i}}t=t.parent}throw e}const Rg=-7169;function yt(e,t){e.f=e.f&Rg|t}function Zc(e){(e.f&qi)!==0||e.deps===null?yt(e,Ut):yt(e,dr)}function s_(e){if(e!==null)for(const t of e)(t.f&Qt)===0||(t.f&vn)===0||(t.f^=vn,s_(t.deps))}function n_(e,t,i){(e.f&Jt)!==0?t.add(e):(e.f&dr)!==0&&i.add(e),s_(e.deps),yt(e,Ut)}const Ea=new Set;let Ie=null,$a=null,$t=null,vi=[],Sl=null,Sh=!1,Lo=!1;var Ln,In,js,Bn,Jo,ea,Ys,Br,Nn,Pi,wh,Ch,kh,o_;const Od=class Od{constructor(){ie(this,Pi);Gi(this,"current",new Map);Gi(this,"previous",new Map);ie(this,Ln,new Set);ie(this,In,new Set);ie(this,js,0);ie(this,Bn,0);ie(this,Jo,null);ie(this,ea,new Set);ie(this,Ys,new Set);ie(this,Br,new Map);Gi(this,"is_fork",!1);ie(this,Nn,!1)}skip_effect(t){v(this,Br).has(t)||v(this,Br).set(t,{d:[],m:[]})}unskip_effect(t){var i=v(this,Br).get(t);if(i){v(this,Br).delete(t);for(var r of i.d)yt(r,Jt),or(r);for(r of i.m)yt(r,dr),or(r)}}process(t){var s;vi=[],this.apply();var i=[],r=[];for(const n of t)xe(this,Pi,Ch).call(this,n,i,r);if(xe(this,Pi,wh).call(this)){xe(this,Pi,kh).call(this,r),xe(this,Pi,kh).call(this,i);for(const[n,o]of v(this,Br))c_(n,o)}else{for(const n of v(this,Ln))n();v(this,Ln).clear(),v(this,js)===0&&xe(this,Pi,o_).call(this),$a=this,Ie=null,Wd(r),Wd(i),$a=null,(s=v(this,Jo))==null||s.resolve()}$t=null}capture(t,i){i!==qt&&!this.previous.has(t)&&this.previous.set(t,i),(t.f&ys)===0&&(this.current.set(t,t.v),$t==null||$t.set(t,t.v))}activate(){Ie=this,this.apply()}deactivate(){Ie===this&&(Ie=null,$t=null)}flush(){if(this.activate(),vi.length>0){if(a_(),Ie!==null&&Ie!==this)return}else v(this,js)===0&&this.process([]);this.deactivate()}discard(){for(const t of v(this,In))t(this);v(this,In).clear()}increment(t){G(this,js,v(this,js)+1),t&&G(this,Bn,v(this,Bn)+1)}decrement(t){G(this,js,v(this,js)-1),t&&G(this,Bn,v(this,Bn)-1),!v(this,Nn)&&(G(this,Nn,!0),Dr(()=>{G(this,Nn,!1),xe(this,Pi,wh).call(this)?vi.length>0&&this.flush():this.revive()}))}revive(){for(const t of v(this,ea))v(this,Ys).delete(t),yt(t,Jt),or(t);for(const t of v(this,Ys))yt(t,dr),or(t);this.flush()}oncommit(t){v(this,Ln).add(t)}ondiscard(t){v(this,In).add(t)}settled(){return(v(this,Jo)??G(this,Jo,qf())).promise}static ensure(){if(Ie===null){const t=Ie=new Od;Ea.add(Ie),Lo||Dr(()=>{Ie===t&&t.flush()})}return Ie}apply(){}};Ln=new WeakMap,In=new WeakMap,js=new WeakMap,Bn=new WeakMap,Jo=new WeakMap,ea=new WeakMap,Ys=new WeakMap,Br=new WeakMap,Nn=new WeakMap,Pi=new WeakSet,wh=function(){return this.is_fork||v(this,Bn)>0},Ch=function(t,i,r){t.f^=Ut;for(var s=t.first;s!==null;){var n=s.f,o=(n&(fr|yn))!==0,l=o&&(n&Ut)!==0,h=l||(n&Ri)!==0||v(this,Br).has(s);if(!h&&s.fn!==null){o?s.f^=Ut:(n&la)!==0?i.push(s):ua(s)&&((n&$r)!==0&&v(this,Ys).add(s),ro(s));var c=s.first;if(c!==null){s=c;continue}}for(;s!==null;){var u=s.next;if(u!==null){s=u;break}s=s.parent}}},kh=function(t){for(var i=0;i<t.length;i+=1)n_(t[i],v(this,ea),v(this,Ys))},o_=function(){var s;if(Ea.size>1){this.previous.clear();var t=$t,i=!0;for(const n of Ea){if(n===this){i=!1;continue}const o=[];for(const[h,c]of this.current){if(n.current.has(h))if(i&&c!==n.current.get(h))n.current.set(h,c);else continue;o.push(h)}if(o.length===0)continue;const l=[...n.current.keys()].filter(h=>!this.current.has(h));if(l.length>0){var r=vi;vi=[];const h=new Set,c=new Map;for(const u of o)l_(u,l,h,c);if(vi.length>0){Ie=n,n.apply();for(const u of vi)xe(s=n,Pi,Ch).call(s,u,[],[]);n.deactivate()}vi=r}}Ie=null,$t=t}Ea.delete(this)};let Ss=Od;function Pg(e){var t=Lo;Lo=!0;try{for(var i;;){if(Tg(),vi.length===0&&(Ie==null||Ie.flush(),vi.length===0))return Sl=null,i;a_()}}finally{Lo=t}}function a_(){Sh=!0;var e=null;try{for(var t=0;vi.length>0;){var i=Ss.ensure();if(t++>1e3){var r,s;Mg()}i.process(vi),ws.clear()}}finally{vi=[],Sh=!1,Sl=null}}function Mg(){try{ng()}catch(e){gs(e,Sl)}}let Zi=null;function Wd(e){var t=e.length;if(t!==0){for(var i=0;i<t;){var r=e[i++];if((r.f&(Kr|Ri))===0&&ua(r)&&(Zi=new Set,ro(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&E_(r),(Zi==null?void 0:Zi.size)>0)){ws.clear();for(const s of Zi){if((s.f&(Kr|Ri))!==0)continue;const n=[s];let o=s.parent;for(;o!==null;)Zi.has(o)&&(Zi.delete(o),n.push(o)),o=o.parent;for(let l=n.length-1;l>=0;l--){const h=n[l];(h.f&(Kr|Ri))===0&&ro(h)}}Zi.clear()}}Zi=null}}function l_(e,t,i,r){if(!i.has(e)&&(i.add(e),e.reactions!==null))for(const s of e.reactions){const n=s.f;(n&Qt)!==0?l_(s,t,i,r):(n&($c|$r))!==0&&(n&Jt)===0&&h_(s,t,r)&&(yt(s,Jt),or(s))}}function h_(e,t,i){const r=i.get(e);if(r!==void 0)return r;if(e.deps!==null)for(const s of e.deps){if(eo.call(t,s))return!0;if((s.f&Qt)!==0&&h_(s,t,i))return i.set(s,!0),!0}return i.set(e,!1),!1}function or(e){var t=Sl=e,i=t.b;if(i!=null&&i.is_pending&&(e.f&(la|ha|jf))!==0&&(e.f&fn)===0){i.defer_effect(e);return}for(;t.parent!==null;){t=t.parent;var r=t.f;if(Sh&&t===Ge&&(r&$r)!==0&&(r&Yf)===0&&(r&fn)!==0)return;if((r&(yn|fr))!==0){if((r&Ut)===0)return;t.f^=Ut}}vi.push(t)}function c_(e,t){if(!((e.f&fr)!==0&&(e.f&Ut)!==0)){(e.f&Jt)!==0?t.d.push(e):(e.f&dr)!==0&&t.m.push(e),yt(e,Ut);for(var i=e.first;i!==null;)c_(i,t),i=i.next}}function Ag(e){let t=0,i=Ts(0),r;return()=>{ed()&&(a(i),da(()=>(t===0&&(r=Xr(()=>e(()=>Cs(i)))),t+=1,()=>{Dr(()=>{t-=1,t===0&&(r==null||r(),r=void 0,Cs(i))})})))}}var Og=_n|co;function Lg(e,t,i,r){new Ig(e,t,i,r)}var Ii,jc,br,Vs,ui,yr,Ei,Ji,Nr,Gs,as,Fn,Wn,Hn,Fr,pl,At,Bg,Ng,Fg,xh,Fa,Wa,Eh;class Ig{constructor(t,i,r,s){ie(this,At);Gi(this,"parent");Gi(this,"is_pending",!1);Gi(this,"transform_error");ie(this,Ii);ie(this,jc,null);ie(this,br);ie(this,Vs);ie(this,ui);ie(this,yr,null);ie(this,Ei,null);ie(this,Ji,null);ie(this,Nr,null);ie(this,Gs,0);ie(this,as,0);ie(this,Fn,!1);ie(this,Wn,new Set);ie(this,Hn,new Set);ie(this,Fr,null);ie(this,pl,Ag(()=>(G(this,Fr,Ts(v(this,Gs))),()=>{G(this,Fr,null)})));var n;G(this,Ii,t),G(this,br,i),G(this,Vs,o=>{var l=Ge;l.b=this,l.f|=bh,r(o)}),this.parent=Ge.b,this.transform_error=s??((n=this.parent)==null?void 0:n.transform_error)??(o=>o),G(this,ui,kl(()=>{xe(this,At,xh).call(this)},Og))}defer_effect(t){n_(t,v(this,Wn),v(this,Hn))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!v(this,br).pending}update_pending_count(t){xe(this,At,Eh).call(this,t),G(this,Gs,v(this,Gs)+t),!(!v(this,Fr)||v(this,Fn))&&(G(this,Fn,!0),Dr(()=>{G(this,Fn,!1),v(this,Fr)&&io(v(this,Fr),v(this,Gs))}))}get_effect_pending(){return v(this,pl).call(this),a(v(this,Fr))}error(t){var i=v(this,br).onerror;let r=v(this,br).failed;if(!i&&!r)throw t;v(this,yr)&&(bi(v(this,yr)),G(this,yr,null)),v(this,Ei)&&(bi(v(this,Ei)),G(this,Ei,null)),v(this,Ji)&&(bi(v(this,Ji)),G(this,Ji,null));var s=!1,n=!1;const o=()=>{if(s){kg();return}s=!0,n&&cg(),v(this,Ji)!==null&&an(v(this,Ji),()=>{G(this,Ji,null)}),xe(this,At,Wa).call(this,()=>{Ss.ensure(),xe(this,At,xh).call(this)})},l=h=>{try{n=!0,i==null||i(h,o),n=!1}catch(c){gs(c,v(this,ui)&&v(this,ui).parent)}r&&G(this,Ji,xe(this,At,Wa).call(this,()=>{Ss.ensure();try{return Wi(()=>{var c=Ge;c.b=this,c.f|=bh,r(v(this,Ii),()=>h,()=>o)})}catch(c){return gs(c,v(this,ui).parent),null}}))};Dr(()=>{var h;try{h=this.transform_error(t)}catch(c){gs(c,v(this,ui)&&v(this,ui).parent);return}h!==null&&typeof h=="object"&&typeof h.then=="function"?h.then(l,c=>gs(c,v(this,ui)&&v(this,ui).parent)):l(h)})}}Ii=new WeakMap,jc=new WeakMap,br=new WeakMap,Vs=new WeakMap,ui=new WeakMap,yr=new WeakMap,Ei=new WeakMap,Ji=new WeakMap,Nr=new WeakMap,Gs=new WeakMap,as=new WeakMap,Fn=new WeakMap,Wn=new WeakMap,Hn=new WeakMap,Fr=new WeakMap,pl=new WeakMap,At=new WeakSet,Bg=function(){try{G(this,yr,Wi(()=>v(this,Vs).call(this,v(this,Ii))))}catch(t){this.error(t)}},Ng=function(t){const i=v(this,br).failed;i&&G(this,Ji,Wi(()=>{i(v(this,Ii),()=>t,()=>()=>{})}))},Fg=function(){const t=v(this,br).pending;t&&(this.is_pending=!0,G(this,Ei,Wi(()=>t(v(this,Ii)))),Dr(()=>{var i=G(this,Nr,document.createDocumentFragment()),r=jr();i.append(r),G(this,yr,xe(this,At,Wa).call(this,()=>(Ss.ensure(),Wi(()=>v(this,Vs).call(this,r))))),v(this,as)===0&&(v(this,Ii).before(i),G(this,Nr,null),an(v(this,Ei),()=>{G(this,Ei,null)}),xe(this,At,Fa).call(this))}))},xh=function(){try{if(this.is_pending=this.has_pending_snippet(),G(this,as,0),G(this,Gs,0),G(this,yr,Wi(()=>{v(this,Vs).call(this,v(this,Ii))})),v(this,as)>0){var t=G(this,Nr,document.createDocumentFragment());R_(v(this,yr),t);const i=v(this,br).pending;G(this,Ei,Wi(()=>i(v(this,Ii))))}else xe(this,At,Fa).call(this)}catch(i){this.error(i)}},Fa=function(){this.is_pending=!1;for(const t of v(this,Wn))yt(t,Jt),or(t);for(const t of v(this,Hn))yt(t,dr),or(t);v(this,Wn).clear(),v(this,Hn).clear()},Wa=function(t){var i=Ge,r=qe,s=Pt;Rr(v(this,ui)),Vi(v(this,ui)),to(v(this,ui).ctx);try{return t()}catch(n){return r_(n),null}finally{Rr(i),Vi(r),to(s)}},Eh=function(t){var i;if(!this.has_pending_snippet()){this.parent&&xe(i=this.parent,At,Eh).call(i,t);return}G(this,as,v(this,as)+t),v(this,as)===0&&(xe(this,At,Fa).call(this),v(this,Ei)&&an(v(this,Ei),()=>{G(this,Ei,null)}),v(this,Nr)&&(v(this,Ii).before(v(this,Nr)),G(this,Nr,null)))};function Wg(e,t,i,r){const s=wl;var n=e.filter(d=>!d.settled);if(i.length===0&&n.length===0){r(t.map(s));return}var o=Ge,l=Hg(),h=n.length===1?n[0].promise:n.length>1?Promise.all(n.map(d=>d.promise)):null;function c(d){l();try{r(d)}catch(f){(o.f&Kr)===0&&gs(f,o)}Dh()}if(i.length===0){h.then(()=>c(t.map(s)));return}function u(){l(),Promise.all(i.map(d=>Ug(d))).then(d=>c([...t.map(s),...d])).catch(d=>gs(d,o))}h?h.then(u):u()}function Hg(){var e=Ge,t=qe,i=Pt,r=Ie;return function(n=!0){Rr(e),Vi(t),to(i),n&&(r==null||r.activate())}}function Dh(e=!0){Rr(null),Vi(null),to(null),e&&(Ie==null||Ie.deactivate())}function zg(){var e=Ge.b,t=Ie,i=e.is_rendered();return e.update_pending_count(1),t.increment(i),()=>{e.update_pending_count(-1),t.decrement(i)}}function wl(e){var t=Qt|Jt,i=qe!==null&&(qe.f&Qt)!==0?qe:null;return Ge!==null&&(Ge.f|=co),{ctx:Pt,deps:null,effects:null,equals:Xf,f:t,fn:e,reactions:null,rv:0,v:qt,wv:0,parent:i??Ge,ac:null}}function Ug(e,t,i){Ge===null&&eg();var s=void 0,n=Ts(qt),o=!qe,l=new Map;return rm(()=>{var f;var h=qf();s=h.promise;try{Promise.resolve(e()).then(h.resolve,h.reject).finally(Dh)}catch(_){h.reject(_),Dh()}var c=Ie;if(o){var u=zg();(f=l.get(c))==null||f.reject(Ws),l.delete(c),l.set(c,h)}const d=(_,p=void 0)=>{if(c.activate(),p)p!==Ws&&(n.f|=ys,io(n,p));else{(n.f&ys)!==0&&(n.f^=ys),io(n,_);for(const[b,g]of l){if(l.delete(b),b===c)break;g.reject(Ws)}}u&&u()};h.promise.then(d,_=>d(null,_||"unknown"))}),td(()=>{for(const h of l.values())h.reject(Ws)}),new Promise(h=>{function c(u){function d(){u===s?h(n):c(s)}u.then(d,d)}c(s)})}function de(e){const t=wl(e);return P_(t),t}function d_(e){const t=wl(e);return t.equals=Qf,t}function Kg(e){var t=e.effects;if(t!==null){e.effects=null;for(var i=0;i<t.length;i+=1)bi(t[i])}}function qg(e){for(var t=e.parent;t!==null;){if((t.f&Qt)===0)return(t.f&Kr)===0?t:null;t=t.parent}return null}function Qc(e){var t,i=Ge;Rr(qg(e));try{e.f&=~vn,Kg(e),t=L_(e)}finally{Rr(i)}return t}function u_(e){var t=Qc(e);if(!e.equals(t)&&(e.wv=A_(),(!(Ie!=null&&Ie.is_fork)||e.deps===null)&&(e.v=t,e.deps===null))){yt(e,Ut);return}Rs||($t!==null?(ed()||Ie!=null&&Ie.is_fork)&&$t.set(e,t):Zc(e))}function jg(e){var t,i;if(e.effects!==null)for(const r of e.effects)(r.teardown||r.ac)&&((t=r.teardown)==null||t.call(r),(i=r.ac)==null||i.abort(Ws),r.teardown=Gp,r.ac=null,Ko(r,0),rd(r))}function f_(e){if(e.effects!==null)for(const t of e.effects)t.teardown&&ro(t)}let Th=new Set;const ws=new Map;let __=!1;function Ts(e,t){var i={f:0,v:e,reactions:null,equals:Xf,rv:0,wv:0};return i}function W(e,t){const i=Ts(e);return P_(i),i}function Yg(e,t=!1,i=!0){const r=Ts(e);return t||(r.equals=Qf),r}function m(e,t,i=!1){qe!==null&&(!ar||(qe.f&Fd)!==0)&&e_()&&(qe.f&(Qt|$r|$c|Fd))!==0&&(ji===null||!eo.call(ji,e))&&hg();let r=i?$e(t):t;return io(e,r)}function io(e,t){if(!e.equals(t)){var i=e.v;Rs?ws.set(e,t):ws.set(e,i),e.v=t;var r=Ss.ensure();if(r.capture(e,i),(e.f&Qt)!==0){const s=e;(e.f&Jt)!==0&&Qc(s),Zc(s)}e.wv=A_(),v_(e,Jt),Ge!==null&&(Ge.f&Ut)!==0&&(Ge.f&(fr|yn))===0&&(Li===null?nm([e]):Li.push(e)),!r.is_fork&&Th.size>0&&!__&&Vg()}return t}function Vg(){__=!1;for(const e of Th)(e.f&Ut)!==0&&yt(e,dr),ua(e)&&ro(e);Th.clear()}function Gg(e,t=1){var i=a(e),r=t===1?i++:i--;return m(e,i),r}function Cs(e){m(e,e.v+1)}function v_(e,t){var i=e.reactions;if(i!==null)for(var r=i.length,s=0;s<r;s++){var n=i[s],o=n.f,l=(o&Jt)===0;if(l&&yt(n,t),(o&Qt)!==0){var h=n;$t==null||$t.delete(h),(o&vn)===0&&(o&qi&&(n.f|=vn),v_(h,dr))}else l&&((o&$r)!==0&&Zi!==null&&Zi.add(n),or(n))}}function $e(e){if(typeof e!="object"||e===null||qr in e)return e;const t=Gc(e);if(t!==Yp&&t!==Vp)return e;var i=new Map,r=Vc(e),s=W(0),n=Yr,o=l=>{if(Yr===n)return l();var h=qe,c=Yr;Vi(null),Kd(n);var u=l();return Vi(h),Kd(c),u};return r&&i.set("length",W(e.length)),new Proxy(e,{defineProperty(l,h,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&ag();var u=i.get(h);return u===void 0?o(()=>{var d=W(c.value);return i.set(h,d),d}):m(u,c.value,!0),!0},deleteProperty(l,h){var c=i.get(h);if(c===void 0){if(h in l){const u=o(()=>W(qt));i.set(h,u),Cs(s)}}else m(c,qt),Cs(s);return!0},get(l,h,c){var _;if(h===qr)return e;var u=i.get(h),d=h in l;if(u===void 0&&(!d||(_=Pn(l,h))!=null&&_.writable)&&(u=o(()=>{var p=$e(d?l[h]:qt),b=W(p);return b}),i.set(h,u)),u!==void 0){var f=a(u);return f===qt?void 0:f}return Reflect.get(l,h,c)},getOwnPropertyDescriptor(l,h){var c=Reflect.getOwnPropertyDescriptor(l,h);if(c&&"value"in c){var u=i.get(h);u&&(c.value=a(u))}else if(c===void 0){var d=i.get(h),f=d==null?void 0:d.v;if(d!==void 0&&f!==qt)return{enumerable:!0,configurable:!0,value:f,writable:!0}}return c},has(l,h){var f;if(h===qr)return!0;var c=i.get(h),u=c!==void 0&&c.v!==qt||Reflect.has(l,h);if(c!==void 0||Ge!==null&&(!u||(f=Pn(l,h))!=null&&f.writable)){c===void 0&&(c=o(()=>{var _=u?$e(l[h]):qt,p=W(_);return p}),i.set(h,c));var d=a(c);if(d===qt)return!1}return u},set(l,h,c,u){var C;var d=i.get(h),f=h in l;if(r&&h==="length")for(var _=c;_<d.v;_+=1){var p=i.get(_+"");p!==void 0?m(p,qt):_ in l&&(p=o(()=>W(qt)),i.set(_+"",p))}if(d===void 0)(!f||(C=Pn(l,h))!=null&&C.writable)&&(d=o(()=>W(void 0)),m(d,$e(c)),i.set(h,d));else{f=d.v!==qt;var b=o(()=>$e(c));m(d,b)}var g=Reflect.getOwnPropertyDescriptor(l,h);if(g!=null&&g.set&&g.set.call(u,c),!f){if(r&&typeof h=="string"){var S=i.get("length"),x=Number(h);Number.isInteger(x)&&x>=S.v&&m(S,x+1)}Cs(s)}return!0},ownKeys(l){a(s);var h=Reflect.ownKeys(l).filter(d=>{var f=i.get(d);return f===void 0||f.v!==qt});for(var[c,u]of i)u.v!==qt&&!(c in l)&&h.push(c);return h},setPrototypeOf(){lg()}})}function Hd(e){try{if(e!==null&&typeof e=="object"&&qr in e)return e[qr]}catch{}return e}function $g(e,t){return Object.is(Hd(e),Hd(t))}var Xa,p_,g_,m_,b_;function Xg(){if(Xa===void 0){Xa=window,p_=document,g_=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,i=Text.prototype;m_=Pn(t,"firstChild").get,b_=Pn(t,"nextSibling").get,Nd(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Nd(i)&&(i.__t=void 0)}}function jr(e=""){return document.createTextNode(e)}function on(e){return m_.call(e)}function ca(e){return b_.call(e)}function y(e,t){return on(e)}function kt(e,t=!1){{var i=on(e);return i instanceof Comment&&i.data===""?ca(i):i}}function D(e,t=1,i=!1){let r=e;for(;t--;)r=ca(r);return r}function Zg(e){e.textContent=""}function y_(){return!1}function S_(e,t,i){return document.createElementNS(t??$f,e,void 0)}function Qg(e,t){{const i=document.body;e.autofocus=!0,Dr(()=>{document.activeElement===i&&e.focus()})}}let zd=!1;function Jg(){zd||(zd=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const i of e.target.elements)(t=i.__on_r)==null||t.call(i)})},{capture:!0}))}function Cl(e){var t=qe,i=Ge;Vi(null),Rr(null);try{return e()}finally{Vi(t),Rr(i)}}function Jc(e,t,i,r=i){e.addEventListener(t,()=>Cl(i));const s=e.__on_r;s?e.__on_r=()=>{s(),r(!0)}:e.__on_r=()=>r(!0),Jg()}function w_(e){Ge===null&&(qe===null&&sg(),rg()),Rs&&ig()}function em(e,t){var i=t.last;i===null?t.last=t.first=e:(i.next=e,e.prev=i,t.last=e)}function Ar(e,t,i){var r=Ge;r!==null&&(r.f&Ri)!==0&&(e|=Ri);var s={ctx:Pt,deps:null,nodes:null,f:e|Jt|qi,first:null,fn:t,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null};if(i)try{ro(s)}catch(l){throw bi(s),l}else t!==null&&or(s);var n=s;if(i&&n.deps===null&&n.teardown===null&&n.nodes===null&&n.first===n.last&&(n.f&co)===0&&(n=n.first,(e&$r)!==0&&(e&_n)!==0&&n!==null&&(n.f|=_n)),n!==null&&(n.parent=r,r!==null&&em(n,r),qe!==null&&(qe.f&Qt)!==0&&(e&yn)===0)){var o=qe;(o.effects??(o.effects=[])).push(n)}return s}function ed(){return qe!==null&&!ar}function td(e){const t=Ar(ha,null,!1);return yt(t,Ut),t.teardown=e,t}function cr(e){w_();var t=Ge.f,i=!qe&&(t&fr)!==0&&(t&fn)===0;if(i){var r=Pt;(r.e??(r.e=[])).push(e)}else return C_(e)}function C_(e){return Ar(la|Vf,e,!1)}function tm(e){return w_(),Ar(ha|Vf,e,!0)}function im(e){Ss.ensure();const t=Ar(yn|co,e,!0);return(i={})=>new Promise(r=>{i.outro?an(t,()=>{bi(t),r(void 0)}):(bi(t),r(void 0))})}function id(e){return Ar(la,e,!1)}function rm(e){return Ar($c|co,e,!0)}function da(e,t=0){return Ar(ha|t,e,!0)}function le(e,t=[],i=[],r=[]){Wg(r,t,i,s=>{Ar(ha,()=>e(...s.map(a)),!0)})}function kl(e,t=0){var i=Ar($r|t,e,!0);return i}function Wi(e){return Ar(fr|co,e,!0)}function k_(e){var t=e.teardown;if(t!==null){const i=Rs,r=qe;Ud(!0),Vi(null);try{t.call(null)}finally{Ud(i),Vi(r)}}}function rd(e,t=!1){var i=e.first;for(e.first=e.last=null;i!==null;){const s=i.ac;s!==null&&Cl(()=>{s.abort(Ws)});var r=i.next;(i.f&yn)!==0?i.parent=null:bi(i,t),i=r}}function sm(e){for(var t=e.first;t!==null;){var i=t.next;(t.f&fr)===0&&bi(t),t=i}}function bi(e,t=!0){var i=!1;(t||(e.f&Yf)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(x_(e.nodes.start,e.nodes.end),i=!0),rd(e,t&&!i),Ko(e,0),yt(e,Kr);var r=e.nodes&&e.nodes.t;if(r!==null)for(const n of r)n.stop();k_(e);var s=e.parent;s!==null&&s.first!==null&&E_(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function x_(e,t){for(;e!==null;){var i=e===t?null:ca(e);e.remove(),e=i}}function E_(e){var t=e.parent,i=e.prev,r=e.next;i!==null&&(i.next=r),r!==null&&(r.prev=i),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=i))}function an(e,t,i=!0){var r=[];D_(e,r,!0);var s=()=>{i&&bi(e),t&&t()},n=r.length;if(n>0){var o=()=>--n||s();for(var l of r)l.out(o)}else s()}function D_(e,t,i){if((e.f&Ri)===0){e.f^=Ri;var r=e.nodes&&e.nodes.t;if(r!==null)for(const l of r)(l.is_global||i)&&t.push(l);for(var s=e.first;s!==null;){var n=s.next,o=(s.f&_n)!==0||(s.f&fr)!==0&&(e.f&$r)!==0;D_(s,t,o?i:!1),s=n}}}function sd(e){T_(e,!0)}function T_(e,t){if((e.f&Ri)!==0){e.f^=Ri,(e.f&Ut)===0&&(yt(e,Jt),or(e));for(var i=e.first;i!==null;){var r=i.next,s=(i.f&_n)!==0||(i.f&fr)!==0;T_(i,s?t:!1),i=r}var n=e.nodes&&e.nodes.t;if(n!==null)for(const o of n)(o.is_global||t)&&o.in()}}function R_(e,t){if(e.nodes)for(var i=e.nodes.start,r=e.nodes.end;i!==null;){var s=i===r?null:ca(i);t.append(i),i=s}}let Ha=!1,Rs=!1;function Ud(e){Rs=e}let qe=null,ar=!1;function Vi(e){qe=e}let Ge=null;function Rr(e){Ge=e}let ji=null;function P_(e){qe!==null&&(ji===null?ji=[e]:ji.push(e))}let pi=null,xi=0,Li=null;function nm(e){Li=e}let M_=1,zs=0,Yr=zs;function Kd(e){Yr=e}function A_(){return++M_}function ua(e){var t=e.f;if((t&Jt)!==0)return!0;if(t&Qt&&(e.f&=~vn),(t&dr)!==0){for(var i=e.deps,r=i.length,s=0;s<r;s++){var n=i[s];if(ua(n)&&u_(n),n.wv>e.wv)return!0}(t&qi)!==0&&$t===null&&yt(e,Ut)}return!1}function O_(e,t,i=!0){var r=e.reactions;if(r!==null&&!(ji!==null&&eo.call(ji,e)))for(var s=0;s<r.length;s++){var n=r[s];(n.f&Qt)!==0?O_(n,t,!1):t===n&&(i?yt(n,Jt):(n.f&Ut)!==0&&yt(n,dr),or(n))}}function L_(e){var b;var t=pi,i=xi,r=Li,s=qe,n=ji,o=Pt,l=ar,h=Yr,c=e.f;pi=null,xi=0,Li=null,qe=(c&(fr|yn))===0?e:null,ji=null,to(e.ctx),ar=!1,Yr=++zs,e.ac!==null&&(Cl(()=>{e.ac.abort(Ws)}),e.ac=null);try{e.f|=yh;var u=e.fn,d=u();e.f|=fn;var f=e.deps,_=Ie==null?void 0:Ie.is_fork;if(pi!==null){var p;if(_||Ko(e,xi),f!==null&&xi>0)for(f.length=xi+pi.length,p=0;p<pi.length;p++)f[xi+p]=pi[p];else e.deps=f=pi;if(ed()&&(e.f&qi)!==0)for(p=xi;p<f.length;p++)((b=f[p]).reactions??(b.reactions=[])).push(e)}else!_&&f!==null&&xi<f.length&&(Ko(e,xi),f.length=xi);if(e_()&&Li!==null&&!ar&&f!==null&&(e.f&(Qt|dr|Jt))===0)for(p=0;p<Li.length;p++)O_(Li[p],e);if(s!==null&&s!==e){if(zs++,s.deps!==null)for(let g=0;g<i;g+=1)s.deps[g].rv=zs;if(t!==null)for(const g of t)g.rv=zs;Li!==null&&(r===null?r=Li:r.push(...Li))}return(e.f&ys)!==0&&(e.f^=ys),d}catch(g){return r_(g)}finally{e.f^=yh,pi=t,xi=i,Li=r,qe=s,ji=n,to(o),ar=l,Yr=h}}function om(e,t){let i=t.reactions;if(i!==null){var r=qp.call(i,e);if(r!==-1){var s=i.length-1;s===0?i=t.reactions=null:(i[r]=i[s],i.pop())}}if(i===null&&(t.f&Qt)!==0&&(pi===null||!eo.call(pi,t))){var n=t;(n.f&qi)!==0&&(n.f^=qi,n.f&=~vn),Zc(n),jg(n),Ko(n,0)}}function Ko(e,t){var i=e.deps;if(i!==null)for(var r=t;r<i.length;r++)om(e,i[r])}function ro(e){var t=e.f;if((t&Kr)===0){yt(e,Ut);var i=Ge,r=Ha;Ge=e,Ha=!0;try{(t&($r|jf))!==0?sm(e):rd(e),k_(e);var s=L_(e);e.teardown=typeof s=="function"?s:null,e.wv=M_;var n;mh&&xg&&(e.f&Jt)!==0&&e.deps}finally{Ha=r,Ge=i}}}async function am(){await Promise.resolve(),Pg()}function a(e){var t=e.f,i=(t&Qt)!==0;if(qe!==null&&!ar){var r=Ge!==null&&(Ge.f&Kr)!==0;if(!r&&(ji===null||!eo.call(ji,e))){var s=qe.deps;if((qe.f&yh)!==0)e.rv<zs&&(e.rv=zs,pi===null&&s!==null&&s[xi]===e?xi++:pi===null?pi=[e]:pi.push(e));else{(qe.deps??(qe.deps=[])).push(e);var n=e.reactions;n===null?e.reactions=[qe]:eo.call(n,qe)||n.push(qe)}}}if(Rs&&ws.has(e))return ws.get(e);if(i){var o=e;if(Rs){var l=o.v;return((o.f&Ut)===0&&o.reactions!==null||B_(o))&&(l=Qc(o)),ws.set(o,l),l}var h=(o.f&qi)===0&&!ar&&qe!==null&&(Ha||(qe.f&qi)!==0),c=(o.f&fn)===0;ua(o)&&(h&&(o.f|=qi),u_(o)),h&&!c&&(f_(o),I_(o))}if($t!=null&&$t.has(e))return $t.get(e);if((e.f&ys)!==0)throw e.v;return e.v}function I_(e){if(e.f|=qi,e.deps!==null)for(const t of e.deps)(t.reactions??(t.reactions=[])).push(e),(t.f&Qt)!==0&&(t.f&qi)===0&&(f_(t),I_(t))}function B_(e){if(e.v===qt)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(ws.has(t)||(t.f&Qt)!==0&&B_(t))return!0;return!1}function Xr(e){var t=ar;try{return ar=!0,e()}finally{ar=t}}function lm(e){if(!(typeof e!="object"||!e||e instanceof EventTarget)){if(qr in e)Rh(e);else if(!Array.isArray(e))for(let t in e){const i=e[t];typeof i=="object"&&i&&qr in i&&Rh(i)}}}function Rh(e,t=new Set){if(typeof e=="object"&&e!==null&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let r in e)try{Rh(e[r],t)}catch{}const i=Gc(e);if(i!==Object.prototype&&i!==Array.prototype&&i!==Map.prototype&&i!==Set.prototype&&i!==Date.prototype){const r=Kf(i);for(let s in r){const n=r[s].get;if(n)try{n.call(e)}catch{}}}}}const hm=["touchstart","touchmove"];function cm(e){return hm.includes(e)}const Us=Symbol("events"),N_=new Set,Ph=new Set;function dm(e,t,i,r={}){function s(n){if(r.capture||Mh.call(t,n),!n.cancelBubble)return Cl(()=>i==null?void 0:i.call(this,n))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?Dr(()=>{t.addEventListener(e,s,r)}):t.addEventListener(e,s,r),s}function lr(e,t,i,r,s){var n={capture:r,passive:s},o=dm(e,t,i,n);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&td(()=>{t.removeEventListener(e,o,n)})}function V(e,t,i){(t[Us]??(t[Us]={}))[e]=i}function pt(e){for(var t=0;t<e.length;t++)N_.add(e[t]);for(var i of Ph)i(e)}let qd=null;function Mh(e){var g,S;var t=this,i=t.ownerDocument,r=e.type,s=((g=e.composedPath)==null?void 0:g.call(e))||[],n=s[0]||e.target;qd=e;var o=0,l=qd===e&&e[Us];if(l){var h=s.indexOf(l);if(h!==-1&&(t===document||t===window)){e[Us]=t;return}var c=s.indexOf(t);if(c===-1)return;h<=c&&(o=h)}if(n=s[o]||e.target,n!==t){jp(e,"currentTarget",{configurable:!0,get(){return n||i}});var u=qe,d=Ge;Vi(null),Rr(null);try{for(var f,_=[];n!==null;){var p=n.assignedSlot||n.parentNode||n.host||null;try{var b=(S=n[Us])==null?void 0:S[r];b!=null&&(!n.disabled||e.target===n)&&b.call(n,e)}catch(x){f?_.push(x):f=x}if(e.cancelBubble||p===t||p===null)break;n=p}if(f){for(let x of _)queueMicrotask(()=>{throw x});throw f}}finally{e[Us]=t,delete e.currentTarget,Vi(u),Rr(d)}}}var Tf;const Vl=((Tf=globalThis==null?void 0:globalThis.window)==null?void 0:Tf.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function um(e){return(Vl==null?void 0:Vl.createHTML(e))??e}function fm(e){var t=S_("template");return t.innerHTML=um(e.replaceAll("<!>","<!---->")),t.content}function qo(e,t){var i=Ge;i.nodes===null&&(i.nodes={start:e,end:t,a:null,t:null})}function F(e,t){var i=(t&bg)!==0,r=(t&yg)!==0,s,n=!e.startsWith("<!>");return()=>{s===void 0&&(s=fm(n?e:"<!>"+e),i||(s=on(s)));var o=r||g_?document.importNode(s,!0):s.cloneNode(!0);if(i){var l=on(o),h=o.lastChild;qo(l,h)}else qo(o,o);return o}}function ln(e=""){{var t=jr(e+"");return qo(t,t),t}}function Vr(){var e=document.createDocumentFragment(),t=document.createComment(""),i=jr();return e.append(t,i),qo(t,i),e}function I(e,t){e!==null&&e.before(t)}function oe(e,t){var i=t==null?"":typeof t=="object"?`${t}`:t;i!==(e.__t??(e.__t=e.nodeValue))&&(e.__t=i,e.nodeValue=`${i}`)}function _m(e,t){return vm(e,t)}const Da=new Map;function vm(e,{target:t,anchor:i,props:r={},events:s,context:n,intro:o=!0,transformError:l}){Xg();var h=void 0,c=im(()=>{var u=i??t.appendChild(jr());Lg(u,{pending:()=>{}},_=>{_t({});var p=Pt;n&&(p.c=n),s&&(r.$$events=s),h=e(_,r)||{},vt()},l);var d=new Set,f=_=>{for(var p=0;p<_.length;p++){var b=_[p];if(!d.has(b)){d.add(b);var g=cm(b);for(const C of[t,document]){var S=Da.get(C);S===void 0&&(S=new Map,Da.set(C,S));var x=S.get(b);x===void 0?(C.addEventListener(b,Mh,{passive:g}),S.set(b,1)):S.set(b,x+1)}}}};return f(yl(N_)),Ph.add(f),()=>{var g;for(var _ of d)for(const S of[t,document]){var p=Da.get(S),b=p.get(_);--b==0?(S.removeEventListener(_,Mh),p.delete(_),p.size===0&&Da.delete(S)):p.set(_,b)}Ph.delete(f),u!==i&&((g=u.parentNode)==null||g.removeChild(u))}});return pm.set(h,c),h}let pm=new WeakMap;var er,Sr,Di,$s,ta,ia,gl;class F_{constructor(t,i=!0){Gi(this,"anchor");ie(this,er,new Map);ie(this,Sr,new Map);ie(this,Di,new Map);ie(this,$s,new Set);ie(this,ta,!0);ie(this,ia,()=>{var t=Ie;if(v(this,er).has(t)){var i=v(this,er).get(t),r=v(this,Sr).get(i);if(r)sd(r),v(this,$s).delete(i);else{var s=v(this,Di).get(i);s&&(v(this,Sr).set(i,s.effect),v(this,Di).delete(i),s.fragment.lastChild.remove(),this.anchor.before(s.fragment),r=s.effect)}for(const[n,o]of v(this,er)){if(v(this,er).delete(n),n===t)break;const l=v(this,Di).get(o);l&&(bi(l.effect),v(this,Di).delete(o))}for(const[n,o]of v(this,Sr)){if(n===i||v(this,$s).has(n))continue;const l=()=>{if(Array.from(v(this,er).values()).includes(n)){var c=document.createDocumentFragment();R_(o,c),c.append(jr()),v(this,Di).set(n,{effect:o,fragment:c})}else bi(o);v(this,$s).delete(n),v(this,Sr).delete(n)};v(this,ta)||!r?(v(this,$s).add(n),an(o,l,!1)):l()}}});ie(this,gl,t=>{v(this,er).delete(t);const i=Array.from(v(this,er).values());for(const[r,s]of v(this,Di))i.includes(r)||(bi(s.effect),v(this,Di).delete(r))});this.anchor=t,G(this,ta,i)}ensure(t,i){var r=Ie,s=y_();if(i&&!v(this,Sr).has(t)&&!v(this,Di).has(t))if(s){var n=document.createDocumentFragment(),o=jr();n.append(o),v(this,Di).set(t,{effect:Wi(()=>i(o)),fragment:n})}else v(this,Sr).set(t,Wi(()=>i(this.anchor)));if(v(this,er).set(r,t),s){for(const[l,h]of v(this,Sr))l===t?r.unskip_effect(h):r.skip_effect(h);for(const[l,h]of v(this,Di))l===t?r.unskip_effect(h.effect):r.skip_effect(h.effect);r.oncommit(v(this,ia)),r.ondiscard(v(this,gl))}else v(this,ia).call(this)}}er=new WeakMap,Sr=new WeakMap,Di=new WeakMap,$s=new WeakMap,ta=new WeakMap,ia=new WeakMap,gl=new WeakMap;function re(e,t,i=!1){var r=new F_(e),s=i?_n:0;function n(o,l){r.ensure(o,l)}kl(()=>{var o=!1;t((l,h=0)=>{o=!0,n(h,l)}),o||n(!1,null)},s)}function jo(e,t){return t}function gm(e,t,i){for(var r=[],s=t.length,n,o=t.length,l=0;l<s;l++){let d=t[l];an(d,()=>{if(n){if(n.pending.delete(d),n.done.add(d),n.pending.size===0){var f=e.outrogroups;Ah(yl(n.done)),f.delete(n),f.size===0&&(e.outrogroups=null)}}else o-=1},!1)}if(o===0){var h=r.length===0&&i!==null;if(h){var c=i,u=c.parentNode;Zg(u),u.append(c),e.items.clear()}Ah(t,!h)}else n={pending:new Set(t),done:new Set},(e.outrogroups??(e.outrogroups=new Set)).add(n)}function Ah(e,t=!0){for(var i=0;i<e.length;i++)bi(e[i],t)}var jd;function Zt(e,t,i,r,s,n=null){var o=e,l=new Map,h=(t&Gf)!==0;if(h){var c=e;o=c.appendChild(jr())}var u=null,d=d_(()=>{var S=i();return Vc(S)?S:S==null?[]:yl(S)}),f,_=!0;function p(){g.fallback=u,mm(g,f,o,t,r),u!==null&&(f.length===0?(u.f&zr)===0?sd(u):(u.f^=zr,Eo(u,null,o)):an(u,()=>{u=null}))}var b=kl(()=>{f=a(d);for(var S=f.length,x=new Set,C=Ie,w=y_(),k=0;k<S;k+=1){var M=f[k],B=r(M,k),K=_?null:l.get(B);K?(K.v&&io(K.v,M),K.i&&io(K.i,k),w&&C.unskip_effect(K.e)):(K=bm(l,_?o:jd??(jd=jr()),M,B,k,s,t,i),_||(K.e.f|=zr),l.set(B,K)),x.add(B)}if(S===0&&n&&!u&&(_?u=Wi(()=>n(o)):(u=Wi(()=>n(jd??(jd=jr()))),u.f|=zr)),S>x.size&&tg(),!_)if(w){for(const[j,se]of l)x.has(j)||C.skip_effect(se.e);C.oncommit(p),C.ondiscard(()=>{})}else p();a(d)}),g={effect:b,items:l,outrogroups:null,fallback:u};_=!1}function po(e){for(;e!==null&&(e.f&fr)===0;)e=e.next;return e}function mm(e,t,i,r,s){var se,Y,N,L,T,O,U,R,E;var n=(r&fg)!==0,o=t.length,l=e.items,h=po(e.effect.first),c,u=null,d,f=[],_=[],p,b,g,S;if(n)for(S=0;S<o;S+=1)p=t[S],b=s(p,S),g=l.get(b).e,(g.f&zr)===0&&((Y=(se=g.nodes)==null?void 0:se.a)==null||Y.measure(),(d??(d=new Set)).add(g));for(S=0;S<o;S+=1){if(p=t[S],b=s(p,S),g=l.get(b).e,e.outrogroups!==null)for(const J of e.outrogroups)J.pending.delete(g),J.done.delete(g);if((g.f&zr)!==0)if(g.f^=zr,g===h)Eo(g,null,i);else{var x=u?u.next:h;g===e.effect.last&&(e.effect.last=g.prev),g.prev&&(g.prev.next=g.next),g.next&&(g.next.prev=g.prev),es(e,u,g),es(e,g,x),Eo(g,x,i),u=g,f=[],_=[],h=po(u.next);continue}if((g.f&Ri)!==0&&(sd(g),n&&((L=(N=g.nodes)==null?void 0:N.a)==null||L.unfix(),(d??(d=new Set)).delete(g))),g!==h){if(c!==void 0&&c.has(g)){if(f.length<_.length){var C=_[0],w;u=C.prev;var k=f[0],M=f[f.length-1];for(w=0;w<f.length;w+=1)Eo(f[w],C,i);for(w=0;w<_.length;w+=1)c.delete(_[w]);es(e,k.prev,M.next),es(e,u,k),es(e,M,C),h=C,u=M,S-=1,f=[],_=[]}else c.delete(g),Eo(g,h,i),es(e,g.prev,g.next),es(e,g,u===null?e.effect.first:u.next),es(e,u,g),u=g;continue}for(f=[],_=[];h!==null&&h!==g;)(c??(c=new Set)).add(h),_.push(h),h=po(h.next);if(h===null)continue}(g.f&zr)===0&&f.push(g),u=g,h=po(g.next)}if(e.outrogroups!==null){for(const J of e.outrogroups)J.pending.size===0&&(Ah(yl(J.done)),(T=e.outrogroups)==null||T.delete(J));e.outrogroups.size===0&&(e.outrogroups=null)}if(h!==null||c!==void 0){var B=[];if(c!==void 0)for(g of c)(g.f&Ri)===0&&B.push(g);for(;h!==null;)(h.f&Ri)===0&&h!==e.fallback&&B.push(h),h=po(h.next);var K=B.length;if(K>0){var j=(r&Gf)!==0&&o===0?i:null;if(n){for(S=0;S<K;S+=1)(U=(O=B[S].nodes)==null?void 0:O.a)==null||U.measure();for(S=0;S<K;S+=1)(E=(R=B[S].nodes)==null?void 0:R.a)==null||E.fix()}gm(e,B,j)}}n&&Dr(()=>{var J,te;if(d!==void 0)for(g of d)(te=(J=g.nodes)==null?void 0:J.a)==null||te.apply()})}function bm(e,t,i,r,s,n,o,l){var h=(o&dg)!==0?(o&_g)===0?Yg(i,!1,!1):Ts(i):null,c=(o&ug)!==0?Ts(s):null;return{v:h,i:c,e:Wi(()=>(n(t,h??i,c??s,l),()=>{e.delete(r)}))}}function Eo(e,t,i){if(e.nodes)for(var r=e.nodes.start,s=e.nodes.end,n=t&&(t.f&zr)===0?t.nodes.start:i;r!==null;){var o=ca(r);if(n.before(r),r===s)return;r=o}}function es(e,t,i){t===null?e.effect.first=i:t.next=i,i===null?e.effect.last=t:i.prev=t}function Yd(e,t,i=!1,r=!1,s=!1){var n=e,o="";le(()=>{var l=Ge;if(o!==(o=t()??"")&&(l.nodes!==null&&(x_(l.nodes.start,l.nodes.end),l.nodes=null),o!=="")){var h=i?Sg:r?wg:void 0,c=S_(i?"svg":r?"math":"template",h);c.innerHTML=o;var u=i||r?c:c.content;if(qo(on(u),u.lastChild),i||r)for(;on(u);)n.before(on(u));else n.before(u)}})}function ym(e,t,...i){var r=new F_(e);kl(()=>{const s=t()??null;r.ensure(s,s&&(n=>s(n,...i)))},_n)}function Sm(e,t,i){id(()=>{var r=Xr(()=>t(e,i==null?void 0:i())||{});if(i&&(r!=null&&r.update)){var s=!1,n={};da(()=>{var o=i();lm(o),s&&Zf(n,o)&&(n=o,r.update(o))}),s=!0}if(r!=null&&r.destroy)return()=>r.destroy()})}function W_(e){var t,i,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(i=W_(e[t]))&&(r&&(r+=" "),r+=i)}else for(i in e)e[i]&&(r&&(r+=" "),r+=i);return r}function wm(){for(var e,t,i=0,r="",s=arguments.length;i<s;i++)(e=arguments[i])&&(t=W_(e))&&(r&&(r+=" "),r+=t);return r}function H_(e){return typeof e=="object"?wm(e):e??""}const Vd=[...`
|
|
2
|
+
\r\f \v\uFEFF`];function Cm(e,t,i){var r=e==null?"":""+e;if(t&&(r=r?r+" "+t:t),i){for(var s of Object.keys(i))if(i[s])r=r?r+" "+s:s;else if(r.length)for(var n=s.length,o=0;(o=r.indexOf(s,o))>=0;){var l=o+n;(o===0||Vd.includes(r[o-1]))&&(l===r.length||Vd.includes(r[l]))?r=(o===0?"":r.substring(0,o))+r.substring(l+1):o=l}}return r===""?null:r}function Gd(e,t=!1){var i=t?" !important;":";",r="";for(var s of Object.keys(e)){var n=e[s];n!=null&&n!==""&&(r+=" "+s+": "+n+i)}return r}function Gl(e){return e[0]!=="-"||e[1]!=="-"?e.toLowerCase():e}function km(e,t){if(t){var i="",r,s;if(Array.isArray(t)?(r=t[0],s=t[1]):r=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var n=!1,o=0,l=!1,h=[];r&&h.push(...Object.keys(r).map(Gl)),s&&h.push(...Object.keys(s).map(Gl));var c=0,u=-1;const b=e.length;for(var d=0;d<b;d++){var f=e[d];if(l?f==="/"&&e[d-1]==="*"&&(l=!1):n?n===f&&(n=!1):f==="/"&&e[d+1]==="*"?l=!0:f==='"'||f==="'"?n=f:f==="("?o++:f===")"&&o--,!l&&n===!1&&o===0){if(f===":"&&u===-1)u=d;else if(f===";"||d===b-1){if(u!==-1){var _=Gl(e.substring(c,u).trim());if(!h.includes(_)){f!==";"&&d++;var p=e.substring(c,d).trim();i+=" "+p+";"}}c=d+1,u=-1}}}}return r&&(i+=Gd(r)),s&&(i+=Gd(s,!0)),i=i.trim(),i===""?null:i}return e==null?null:String(e)}function tt(e,t,i,r,s,n){var o=e.__className;if(o!==i||o===void 0){var l=Cm(i,r,n);l==null?e.removeAttribute("class"):t?e.className=l:e.setAttribute("class",l),e.__className=i}else if(n&&s!==n)for(var h in n){var c=!!n[h];(s==null||c!==!!s[h])&&e.classList.toggle(h,c)}return n}function $l(e,t={},i,r){for(var s in i){var n=i[s];t[s]!==n&&(i[s]==null?e.style.removeProperty(s):e.style.setProperty(s,n,r))}}function uo(e,t,i,r){var s=e.__style;if(s!==t){var n=km(t,r);n==null?e.removeAttribute("style"):e.style.cssText=n,e.__style=t}else r&&(Array.isArray(r)?($l(e,i==null?void 0:i[0],r[0]),$l(e,i==null?void 0:i[1],r[1],"important")):$l(e,i,r));return r}function z_(e,t,i=!1){if(e.multiple){if(t==null)return;if(!Vc(t))return Cg();for(var r of e.options)r.selected=t.includes(Io(r));return}for(r of e.options){var s=Io(r);if($g(s,t)){r.selected=!0;return}}(!i||t!==void 0)&&(e.selectedIndex=-1)}function xm(e){var t=new MutationObserver(()=>{z_(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),td(()=>{t.disconnect()})}function Za(e,t,i=t){var r=new WeakSet,s=!0;Jc(e,"change",n=>{var o=n?"[selected]":":checked",l;if(e.multiple)l=[].map.call(e.querySelectorAll(o),Io);else{var h=e.querySelector(o)??e.querySelector("option:not([disabled])");l=h&&Io(h)}i(l),Ie!==null&&r.add(Ie)}),id(()=>{var n=t();if(e===document.activeElement){var o=$a??Ie;if(r.has(o))return}if(z_(e,n,s),s&&n===void 0){var l=e.querySelector(":checked");l!==null&&(n=Io(l),i(n))}e.__value=n,s=!1}),xm(e)}function Io(e){return"__value"in e?e.__value:e.value}const Em=Symbol("is custom element"),Dm=Symbol("is html"),Tm=Jp?"progress":"PROGRESS";function Rm(e,t){var i=nd(e);i.value===(i.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!==Tm)||(e.value=t??"")}function Pm(e,t){var i=nd(e);i.checked!==(i.checked=t??void 0)&&(e.checked=t)}function ze(e,t,i,r){var s=nd(e);s[t]!==(s[t]=i)&&(t==="loading"&&(e[Qp]=i),i==null?e.removeAttribute(t):typeof i!="string"&&Mm(e).includes(t)?e[t]=i:e.setAttribute(t,i))}function nd(e){return e.__attributes??(e.__attributes={[Em]:e.nodeName.includes("-"),[Dm]:e.namespaceURI===$f})}var $d=new Map;function Mm(e){var t=e.getAttribute("is")||e.nodeName,i=$d.get(t);if(i)return i;$d.set(t,i=[]);for(var r,s=e,n=Element.prototype;n!==s;){r=Kf(s);for(var o in r)r[o].set&&i.push(o);s=Gc(s)}return i}function Ui(e,t,i=t){var r=new WeakSet;Jc(e,"input",async s=>{var n=s?e.defaultValue:e.value;if(n=Xl(e)?Zl(n):n,i(n),Ie!==null&&r.add(Ie),await am(),n!==(n=t())){var o=e.selectionStart,l=e.selectionEnd,h=e.value.length;if(e.value=n??"",l!==null){var c=e.value.length;o===l&&l===h&&c>h?(e.selectionStart=c,e.selectionEnd=c):(e.selectionStart=o,e.selectionEnd=Math.min(l,c))}}}),Xr(t)==null&&e.value&&(i(Xl(e)?Zl(e.value):e.value),Ie!==null&&r.add(Ie)),da(()=>{var s=t();if(e===document.activeElement){var n=$a??Ie;if(r.has(n))return}Xl(e)&&s===Zl(e.value)||e.type==="date"&&!s&&!e.value||s!==e.value&&(e.value=s??"")})}function sr(e,t,i=t){Jc(e,"change",r=>{var s=r?e.defaultChecked:e.checked;i(s)}),Xr(t)==null&&i(e.checked),da(()=>{var r=t();e.checked=!!r})}function Xl(e){var t=e.type;return t==="number"||t==="range"}function Zl(e){return e===""?null:+e}function Xd(e,t){return e===t||(e==null?void 0:e[qr])===t}function it(e={},t,i,r){return id(()=>{var s,n;return da(()=>{s=n,n=(r==null?void 0:r())||[],Xr(()=>{e!==i(...n)&&(t(e,...n),s&&Xd(i(...s),e)&&t(null,...s))})}),()=>{Dr(()=>{n&&Xd(i(...n),e)&&t(null,...n)})}}),e}let Ta=!1;function Am(e){var t=Ta;try{return Ta=!1,[e(),Ta]}finally{Ta=t}}function ur(e,t,i,r){var x;var s=(i&gg)!==0,n=(i&mg)!==0,o=r,l=!0,h=()=>(l&&(l=!1,o=n?Xr(r):r),o),c;if(s){var u=qr in e||Zp in e;c=((x=Pn(e,t))==null?void 0:x.set)??(u&&t in e?C=>e[t]=C:void 0)}var d,f=!1;s?[d,f]=Am(()=>e[t]):d=e[t],d===void 0&&r!==void 0&&(d=h(),c&&(og(),c(d)));var _;if(_=()=>{var C=e[t];return C===void 0?h():(l=!0,C)},(i&pg)===0)return _;if(c){var p=e.$$legacy;return(function(C,w){return arguments.length>0?((!w||p||f)&&c(w?_():C),C):_()})}var b=!1,g=((i&vg)!==0?wl:d_)(()=>(b=!1,_()));s&&a(g);var S=Ge;return(function(C,w){if(arguments.length>0){const k=w?a(g):s?$e(C):C;return m(g,k),b=!0,o!==void 0&&(o=k),C}return Rs&&b||(S.f&Kr)!==0?g.v:a(g)})}function fo(e){Pt===null&&Xc(),cr(()=>{const t=Xr(e);if(typeof t=="function")return t})}function Om(e){Pt===null&&Xc(),fo(()=>()=>Xr(e))}const Lm="5";var Rf;typeof window<"u"&&((Rf=window.__svelte??(window.__svelte={})).v??(Rf.v=new Set)).add(Lm);class U_ extends Error{constructor(i){super("conflict");Gi(this,"sessionId");this.name="ConflictError",this.sessionId=i}}async function xt(e){if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}async function Im(e){const t=await fetch("/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pin:e})});if(!t.ok){const i=await t.json();throw new Error(i.error||"Authentication failed")}}async function Bm(){return(await fetch("/sessions")).ok}async function Nm(){return xt(await fetch("/sessions"))}async function Fm(){return xt(await fetch("/worktrees"))}async function Wm(){return(await xt(await fetch("/workspaces"))).workspaces}async function Hm(e){return(await xt(await fetch("/workspaces/reorder",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:e})}))).workspaces}async function Zd(e,t){const i=new URLSearchParams;return e&&i.set("path",e),xt(await fetch("/workspaces/browse?"+i.toString()))}async function zm(e){return xt(await fetch("/workspaces/bulk",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:e})}))}async function Um(e){var i,r;const t=await xt(await fetch("/workspaces/dashboard?path="+encodeURIComponent(e)));return{prs:((i=t.pullRequests)==null?void 0:i.prs)??[],activity:t.activity??[],isGitRepo:!0,defaultBranch:null,hasGhCli:!((r=t.pullRequests)!=null&&r.error)}}async function Km(e,t){const i=await fetch("/workspaces/ci-status?path="+encodeURIComponent(e)+"&branch="+encodeURIComponent(t));return i.ok?i.json():null}async function qm(e,t){const i=await fetch("/workspaces/pr?path="+encodeURIComponent(e)+"&branch="+encodeURIComponent(t));return i.ok?i.json():null}async function jm(e){return(await xt(await fetch("/workspaces/current-branch?path="+encodeURIComponent(e)))).branch}async function Ql(e,t){const i=await fetch("/workspaces/worktree?path="+encodeURIComponent(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:t})});if(!i.ok){const r=await i.json();throw new Error(r.error||"Failed to create worktree")}return i.json()}async function Ym(e,t){return(await fetch("/workspaces/branch?path="+encodeURIComponent(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:t})})).json()}async function od(e,t={}){const i=new URLSearchParams({repo:e});return t.refresh&&i.set("refresh","1"),xt(await fetch("/branches?"+i.toString()))}async function hn(e){const t=await fetch("/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.status===409){const i=await t.json();throw new U_(i.sessionId??"")}return xt(t)}async function K_(e){const t=await fetch("/sessions/repo",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.status===409){const i=await t.json();throw new U_(i.sessionId??"")}return xt(t)}async function Vm(e){await fetch("/sessions/"+e,{method:"DELETE"})}async function q_(e,t){const i=await fetch("/worktrees",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreePath:e,repoPath:t})});if(!i.ok){const r=await i.json();throw new Error(r.error||"Failed to delete worktree")}}async function Gm(e,t,i){return xt(await fetch("/sessions/"+e+"/image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:t,mimeType:i})}))}async function j_(){return xt(await fetch("/version"))}async function Y_(){return xt(await fetch("/update",{method:"POST"}))}async function $m(){return(await xt(await fetch("/config/defaultAgent"))).defaultAgent}async function Xm(e){if(!(await fetch("/config/defaultAgent",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaultAgent:e})})).ok)throw new Error("Failed to update default agent")}async function xl(e){return(await xt(await fetch(`/config/${e}`)))[e]}async function El(e,t){const i=await fetch(`/config/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[e]:t})});if(!i.ok){const r=await i.json();throw new Error(r.error||`Failed to update ${e}`)}}const Zm=()=>xl("defaultContinue"),Qm=e=>El("defaultContinue",e),Jm=()=>xl("defaultYolo"),eb=e=>El("defaultYolo",e),tb=()=>xl("launchInTmux"),ib=e=>El("launchInTmux",e),rb=()=>xl("defaultNotifications"),sb=e=>El("defaultNotifications",e);async function nb(e,t){if(!(await fetch("/push/subscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({subscription:e,sessionIds:t})})).ok)throw new Error("Push subscribe failed")}async function ob(e){return xt(await fetch("/workspaces/settings?path="+encodeURIComponent(e)))}async function Qd(e){return xt(await fetch("/workspaces/settings?merged=true&path="+encodeURIComponent(e)))}async function Jd(e,t){const i=await fetch("/workspaces/settings?path="+encodeURIComponent(e),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!i.ok){const r=await i.json();throw new Error(r.error||"Failed to update workspace settings")}}async function ab(){return xt(await fetch("/sessions/meta"))}async function lb(e,t){const i="/sessions/"+encodeURIComponent(e)+"/meta?refresh=true";return xt(await fetch(i))}let Qa=W(!1),Oh=W(null),Lh=W(!0);function V_(){return{get authenticated(){return a(Qa)},get pinError(){return a(Oh)},get checking(){return a(Lh)}}}async function hb(){m(Lh,!0);try{m(Qa,await Bm(),!0)}catch{m(Qa,!1)}finally{m(Lh,!1)}}async function cb(e){m(Oh,null);try{await Im(e),m(Qa,!0)}catch(t){m(Oh,t instanceof Error?t.message:"Authentication failed",!0)}}const G_="claude-remote-sidebar-width",$_="claude-remote-sidebar-collapsed",Ih="claude-remote-active-workspace",X_=240,Z_=180,Q_=500,db=44;function ub(){try{const e=localStorage.getItem(G_);if(e){const t=parseInt(e,10);if(t>=Z_&&t<=Q_)return t}}catch{}return X_}function fb(){try{return localStorage.getItem($_)==="true"}catch{return!1}}function _b(){try{return localStorage.getItem(Ih)}catch{return null}}let Ja=W(!1),Bh=W($e(ub())),Bo=W($e(fb())),eu=W(""),tu=W($e(_b())),el=W(!1);function ad(){return{get sidebarOpen(){return a(Ja)},set sidebarOpen(e){m(Ja,e,!0)},get sidebarWidth(){return a(Bh)},set sidebarWidth(e){m(Bh,e,!0)},get sidebarCollapsed(){return a(Bo)},set sidebarCollapsed(e){m(Bo,e,!0)},get searchQuery(){return a(eu)},set searchQuery(e){m(eu,e,!0)},get activeWorkspacePath(){return a(tu)},set activeWorkspacePath(e){m(tu,e,!0);try{e===null?localStorage.removeItem(Ih):localStorage.setItem(Ih,e)}catch{}},get reorderMode(){return a(el)},set reorderMode(e){m(el,e,!0)}}}function iu(){m(Ja,!0)}function Ti(){m(Ja,!1)}function vb(){m(el,!0)}function pb(){m(el,!1)}function ru(){try{localStorage.setItem(G_,String(a(Bh)))}catch{}}function Jl(){m(Bo,!a(Bo));try{localStorage.setItem($_,String(a(Bo)))}catch{}}const J_="claude-remote-collapsed-workspaces";function gb(){try{const e=localStorage.getItem(J_);if(e)return new Set(JSON.parse(e))}catch{}return new Set}let Fs=W($e(gb()));function mb(){try{localStorage.setItem(J_,JSON.stringify([...a(Fs)]))}catch{}}function bb(e){a(Fs).has(e)?a(Fs).delete(e):a(Fs).add(e),m(Fs,new Set(a(Fs)),!0),mb()}function yb(e){return a(Fs).has(e)}let ev=W(0);setInterval(()=>{Gg(ev)},3e4);function Sb(){return a(ev)}let No=null,wb=null;function Cb(e){No=e,"serviceWorker"in navigator&&navigator.serviceWorker.addEventListener("message",t=>{const i=t.data;i.type==="notification-click"&&i.sessionId&&No&&No(i.sessionId,i.sessionType||"repo")})}function tv(){return document.hidden||!document.hasFocus()}function iv(e){if(typeof Notification>"u"||Notification.permission!=="granted")return;const t=new Notification(e.displayName||"Claude Remote CLI",{body:"Session needs your input",tag:"session-"+e.id,data:{sessionId:e.id,sessionType:e.type}});t.onclick=()=>{window.focus(),No&&No(e.id,e.type),t.close()}}function rv(){return"serviceWorker"in navigator&&"PushManager"in window}async function kb(){if(rv())try{wb=await navigator.serviceWorker.register("/sw.js")}catch{return}}async function xb(e){if(rv())try{const i=await(await navigator.serviceWorker.ready).pushManager.getSubscription();i&&await nb(i.toJSON(),e)}catch{}}const sv="claude-remote-notifications",Nh="claude-remote-active-session";function Eb(){try{return localStorage.getItem(Nh)}catch{return null}}function nv(e){try{e===null?localStorage.removeItem(Nh):localStorage.setItem(Nh,e)}catch{}}let pn=W($e([])),ov=W($e([])),ld=W($e([])),cn=W($e(Eb())),Gr=$e({}),gn=$e({}),Dl=$e({}),Fo=W($e(new Map)),Pr=W($e({}));try{const e=localStorage.getItem(sv);e&&m(Pr,JSON.parse(e),!0)}catch{}function av(){try{localStorage.setItem(sv,JSON.stringify(a(Pr)))}catch{}}function hd(){return{get sessions(){return a(pn)},get worktrees(){return a(ov)},get workspaces(){return a(ld)},get activeSessionId(){return a(cn)},set activeSessionId(e){m(cn,e,!0),nv(e)},get attentionSessions(){return Gr},get loadingItems(){return Dl},get notificationSessions(){return a(Pr)}}}async function Ft(){try{const[e,t,i]=await Promise.all([Nm(),Fm(),Wm()]);m(pn,e,!0),m(ov,t,!0),m(ld,i,!0);const r=new Set(a(pn).map(n=>n.id));a(cn)!==null&&!r.has(a(cn))&&(m(cn,null),nv(null));let s=!1;for(const n of Object.keys(Gr))r.has(n)||delete Gr[n];for(const n of Object.keys(gn))r.has(n)||delete gn[n];for(const n of Object.keys(a(Pr)))r.has(n)||(delete a(Pr)[n],s=!0);s&&av();try{const n=await ab(),o=new Map;for(const[l,h]of Object.entries(n))o.set(l,h);m(Fo,o,!0)}catch{}}catch{}}function lv(e){return a(pn).filter(t=>t.repoPath===e||t.repoPath.startsWith(e+"/"))}const hv=3e4;function Db(e,t,i){const r=a(pn).find(s=>s.id===e);r&&(r.branchName=t,r.displayName=i)}function Tb(e,t){const i=a(pn).find(r=>r.id===e);if(i&&(i.agentState=t),t==="waiting-for-input"&&e!==a(cn)&&(i==null?void 0:i.type)!=="terminal"){const r=gn[e];if(r&&Date.now()-r<hv)return;delete gn[e],Gr[e]=!0,i&&a(Pr)[e]&&tv()&&iv(i)}else(t==="processing"||t==="initializing")&&delete Gr[e]}function Rb(e,t){const i=a(pn).find(r=>r.id===e);if(i&&(i.idle=t),!(i!=null&&i.agentState&&i.agentState!=="idle"))if(t&&e!==a(cn)&&(i==null?void 0:i.type)!=="terminal"){const r=gn[e];if(r&&Date.now()-r<hv)return;delete gn[e],Gr[e]=!0,i&&a(Pr)[e]&&tv()&&iv(i)}else delete Gr[e]}function su(e){delete Gr[e],gn[e]=Date.now()}function go(e,t){e in a(Pr)||(a(Pr)[e]=t,av())}function Pb(){return Object.entries(a(Pr)).filter(([,e])=>e).map(([e])=>e)}function eh(e){return Gr[e.id]?"attention":e.agentState==="permission-prompt"?"permission-prompt":e.idle?"idle":"running"}function En(e){Dl[e]=!0}function Dn(e){delete Dl[e]}function Qi(e){return!!Dl[e]}function nu(e){return a(Fo).get(e)}async function Mb(e){try{const t=await lb(e,{refresh:!0});a(Fo).set(e,t),m(Fo,new Map(a(Fo)),!0)}catch{}}async function Ab(e){const t=await Hm(e);m(ld,t,!0)}const cv=location.protocol==="https:"?"wss:":"ws:";let As=null,gi=null,Mi=null;const ou=30;let Wo=null,Mn=0;function dv(e){As&&(As.close(),As=null);const t=cv+"//"+location.host+"/ws/events";As=new WebSocket(t),As.onmessage=i=>{try{e(JSON.parse(i.data))}catch{}},As.onclose=()=>{setTimeout(()=>dv(e),3e3)},As.onerror=()=>{}}function uv(e,t,i,r){Wo&&(clearTimeout(Wo),Wo=null),Mn=0,Mi&&(Mi.onopen=null,Mi.onmessage=null,Mi.onclose=null,Mi.onerror=null,Mi.close(),Mi=null),gi&&(gi.onclose=null,gi.close(),gi=null);const s=cv+"//"+location.host+"/ws/"+e,n=new WebSocket(s);Mi=n,n.onopen=()=>{Mi=null,gi=n,Mn=0,i()},n.onmessage=o=>{t.write(o.data)},n.onclose=o=>{if(Mi===n&&(Mi=null),!(Mi!==n&&gi!==n)){if(o.code===1e3){t.write(`\r
|
|
3
3
|
[Session ended]\r
|
|
4
|
-
`),
|
|
4
|
+
`),gi=null,r();return}gi=null,Mn===0&&t.write(`\r
|
|
5
5
|
[Reconnecting...]\r
|
|
6
|
-
`),
|
|
7
|
-
[Gave up reconnecting after `+
|
|
8
|
-
`);return}const s=Math.min(1e3*2**
|
|
6
|
+
`),fv(e,t,i,r)}},n.onerror=()=>{}}function fv(e,t,i,r){if(Mn>=ou){t.write(`\r
|
|
7
|
+
[Gave up reconnecting after `+ou+` attempts]\r
|
|
8
|
+
`);return}const s=Math.min(1e3*2**Mn,1e4);Mn++,Wo=setTimeout(async()=>{Wo=null;try{if(!(await(await fetch("/sessions")).json()).some(l=>l.id===e)){t.write(`\r
|
|
9
9
|
[Session ended]\r
|
|
10
|
-
`),r();return}t.clear(),
|
|
11
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
12
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
13
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,l;return{s:function(){i=i.call(e)},n:function(){var h=i.next();return n=h.done,h},e:function(h){o=!0,l=h},f:function(){try{!n&&i.return!=null&&i.return()}finally{if(o)throw l}}}}var Bb="finalize",Nb="consider";function io(e,t,i){e.dispatchEvent(new CustomEvent(Bb,{detail:{items:t,info:i}}))}function Ps(e,t,i){e.dispatchEvent(new CustomEvent(Nb,{detail:{items:t,info:i}}))}var El="draggedEntered",da="draggedLeft",Dl="draggedOverIndex",hd="draggedLeftDocument",el={LEFT_FOR_ANOTHER:"leftForAnother",OUTSIDE_OF_ANY:"outsideOfAny"};function Fb(e,t,i){e.dispatchEvent(new CustomEvent(El,{detail:{indexObj:t,draggedEl:i}}))}function Wb(e,t,i){e.dispatchEvent(new CustomEvent(da,{detail:{draggedEl:t,type:el.LEFT_FOR_ANOTHER,theOtherDz:i}}))}function Hb(e,t){e.dispatchEvent(new CustomEvent(da,{detail:{draggedEl:t,type:el.OUTSIDE_OF_ANY}}))}function zb(e,t,i){e.dispatchEvent(new CustomEvent(Dl,{detail:{indexObj:t,draggedEl:i}}))}function Ub(e){window.dispatchEvent(new CustomEvent(hd,{detail:{draggedEl:e}}))}var ai={DRAG_STARTED:"dragStarted",DRAGGED_ENTERED:El,DRAGGED_ENTERED_ANOTHER:"dragEnteredAnother",DRAGGED_OVER_INDEX:Dl,DRAGGED_LEFT:da,DRAGGED_LEFT_ALL:"draggedLeftAll",DROPPED_INTO_ZONE:"droppedIntoZone",DROPPED_INTO_ANOTHER:"droppedIntoAnother",DROPPED_OUTSIDE_OF_ANY:"droppedOutsideOfAny",DRAG_STOPPED:"dragStopped"},bi={POINTER:"pointer",KEYBOARD:"keyboard"},Tl="isDndShadowItem",Rl="data-is-dnd-shadow-item-internal",Kb="data-is-dnd-shadow-item-hint",dv="id:dnd-shadow-placeholder-0000",qb="dnd-action-dragged-el",Rt="id",Ih=0;function uv(){Ih++}function fv(){if(Ih===0)throw new Error("Bug! trying to decrement when there are no dropzones");Ih--}var cd=typeof window>"u";function Bh(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i,r=t?Vb(e):e.getBoundingClientRect(),s=getComputedStyle(e),n=s.transform;if(n){var o,l,h,c;if(n.startsWith("matrix3d("))i=n.slice(9,-1).split(/, /),o=+i[0],l=+i[5],h=+i[12],c=+i[13];else if(n.startsWith("matrix("))i=n.slice(7,-1).split(/, /),o=+i[0],l=+i[3],h=+i[4],c=+i[5];else return r;var u=s.transformOrigin,d=r.x-h-(1-o)*parseFloat(u),f=r.y-c-(1-l)*parseFloat(u.slice(u.indexOf(" ")+1)),_=o?r.width/o:e.offsetWidth,p=l?r.height/l:e.offsetHeight;return{x:d,y:f,width:_,height:p,top:f,right:d+_,bottom:f+p,left:d}}else return r}function Nh(e){var t=Bh(e);return{top:t.top+window.scrollY,bottom:t.bottom+window.scrollY,left:t.left+window.scrollX,right:t.right+window.scrollX}}function _v(e){var t=e.getBoundingClientRect();return{top:t.top+window.scrollY,bottom:t.bottom+window.scrollY,left:t.left+window.scrollX,right:t.right+window.scrollX}}function vv(e){return{x:(e.left+e.right)/2,y:(e.top+e.bottom)/2}}function jb(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function No(e,t){return e.y<=t.bottom&&e.y>=t.top&&e.x>=t.left&&e.x<=t.right}function pv(e){return vv(_v(e))}function iu(e,t){var i=pv(t);return jb(e,i)}function Yb(e){var t=_v(e);return t.right<0||t.left>document.documentElement.scrollWidth||t.bottom<0||t.top>document.documentElement.scrollHeight}function Vb(e){for(var t=e.getBoundingClientRect(),i={top:t.top,bottom:t.bottom,left:t.left,right:t.right},r=!1,s=!1,n=e.parentElement;n&&n!==document.body;){var o=window.getComputedStyle(n),l=o.overflowY,h=o.overflowX,c=l==="scroll"||l==="auto",u=h==="scroll"||h==="auto";if(c||u){var d=n.getBoundingClientRect();if(c){var f=Math.max(i.top,d.top),_=Math.min(i.bottom,d.bottom);(f!==i.top||_!==i.bottom)&&(r=!0),i.top=f,i.bottom=_}if(u){var p=Math.max(i.left,d.left),b=Math.min(i.right,d.right);(p!==i.left||b!==i.right)&&(s=!0),i.left=p,i.right=b}}n=n.parentElement}return r||s?{top:i.top,bottom:i.bottom,left:i.left,right:i.right,width:Math.max(0,i.right-i.left),height:Math.max(0,i.bottom-i.top)}:{top:t.top,bottom:t.bottom,left:t.left,right:t.right,width:Math.max(0,t.right-t.left),height:Math.max(0,t.bottom-t.top)}}var Rn;function dd(){Rn=new Map}dd();function Gb(e){var t=Array.from(e.children).findIndex(function(i){return i.getAttribute(Rl)});if(t>=0)return Rn.has(e)||Rn.set(e,new Map),Rn.get(e).set(t,Nh(e.children[t])),t}function Xb(e,t){var i=Nh(t);if(!No(e,i))return null;var r=t.children;if(r.length===0)return{index:0,isProximityBased:!0};for(var s=Gb(t),n=0;n<r.length;n++){var o=Nh(r[n]);if(No(e,o)){var l=Rn.has(t)&&Rn.get(t).get(n);return l&&!No(e,l)?{index:s,isProximityBased:!1}:{index:n,isProximityBased:!1}}}for(var h=Number.MAX_VALUE,c=void 0,u=0;u<r.length;u++){var d=iu(e,r[u]);d<h&&(h=d,c=u)}if(r.length>0){var f=r.length,_=r[f-1],p=_.cloneNode(!1);p.style.visibility="hidden",p.style.pointerEvents="none",t.appendChild(p);var b=iu(e,p);b<h&&(c=f),t.removeChild(p)}return{index:c,isProximityBased:!0}}function vo(e){return JSON.stringify(e,null,2)}function tl(e){if(!e)throw new Error("cannot get depth of a falsy node");return gv(e,0)}function gv(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.parentElement?gv(e.parentElement,t+1):t-1}function $b(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var i in e)if(!{}.hasOwnProperty.call(t,i)||t[i]!==e[i])return!1;return!0}function Zb(e,t){if(e.length!==t.length)return!1;for(var i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}var Qb=200,ru=10,Fh;function Jb(e,t){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Qb,r=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0,n,o,l=!1,h,c=Array.from(t).sort(function(d,f){return tl(f)-tl(d)});function u(){var d=s(),f=r.multiScrollIfNeeded();if(!f&&h&&Math.abs(h.x-d.x)<ru&&Math.abs(h.y-d.y)<ru){Fh=window.setTimeout(u,i);return}if(Yb(e)){Ub(e);return}h=d;var _=!1,p=ca(c),b;try{for(p.s();!(b=p.n()).done;){var g=b.value;f&&dd();var S=Xb(d,g);if(S!==null){var x=S.index;_=!0,g!==n?(n&&Wb(n,e,g),Fb(g,S,e),n=g):x!==o&&(zb(g,S,e),o=x);break}}}catch(C){p.e(C)}finally{p.f()}!_&&l&&n?(Hb(n,e),n=void 0,o=void 0,l=!1):l=!0,Fh=window.setTimeout(u,i)}u()}function ey(){clearTimeout(Fh),dd()}var po=30;function ty(){var e;function t(){e={directionObj:void 0,stepPx:0}}t();function i(n){var o=e,l=o.directionObj,h=o.stepPx;l&&(n.scrollBy(l.x*h,l.y*h),window.requestAnimationFrame(function(){return i(n)}))}function r(n){return po-n}function s(n,o){if(!o)return!1;var l=iy(n,o),h=!!e.directionObj;if(l===null)return h&&t(),!1;var c=!1,u=!1;return o.scrollHeight>o.clientHeight&&(l.bottom<po?(c=!0,e.directionObj={x:0,y:1},e.stepPx=r(l.bottom)):l.top<po&&(c=!0,e.directionObj={x:0,y:-1},e.stepPx=r(l.top)),!h&&c)||o.scrollWidth>o.clientWidth&&(l.right<po?(u=!0,e.directionObj={x:1,y:0},e.stepPx=r(l.right)):l.left<po&&(u=!0,e.directionObj={x:-1,y:0},e.stepPx=r(l.left)),!h&&u)?(i(o),!0):(t(),!1)}return{scrollIfNeeded:s,resetScrolling:t}}function iy(e,t){var i=t===document.scrollingElement?{top:0,bottom:window.innerHeight,left:0,right:window.innerWidth}:t.getBoundingClientRect();return No(e,i)?{top:e.y-i.top,bottom:i.bottom-e.y,left:e.x-i.left,right:i.right-e.x}:null}function ry(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,i=ny(e),r=Array.from(i).sort(function(h,c){return tl(c)-tl(h)}),s=ty(),n=s.scrollIfNeeded,o=s.resetScrolling;function l(){var h=t();if(!h||!r)return!1;for(var c=r.filter(function(f){return No(h,f.getBoundingClientRect())||f===document.scrollingElement}),u=0;u<c.length;u++){var d=n(h,c[u]);if(d)return!0}return!1}return{multiScrollIfNeeded:i.size>0?l:function(){return!1},destroy:function(){return o()}}}function sy(e){if(!e)return[];for(var t=[],i=e;i;){var r=window.getComputedStyle(i),s=r.overflow;s.split(" ").some(function(n){return n.includes("auto")||n.includes("scroll")})&&t.push(i),i=i.parentElement}return t}function ny(e){var t=new Set,i=ca(e),r;try{for(i.s();!(r=i.n()).done;){var s=r.value;sy(s).forEach(function(n){return t.add(n)})}}catch(n){i.e(n)}finally{i.f()}return(document.scrollingElement.scrollHeight>document.scrollingElement.clientHeight||document.scrollingElement.scrollWidth>document.scrollingElement.clientHeight)&&t.add(document.scrollingElement),t}function oy(e){var t=e.cloneNode(!0),i=[],r=e.tagName==="SELECT",s=r?[e]:Ui(e.querySelectorAll("select")),n=ca(s),o;try{for(n.s();!(o=n.n()).done;){var l=o.value;i.push(l.value)}}catch(C){n.e(C)}finally{n.f()}if(s.length>0)for(var h=r?[t]:Ui(t.querySelectorAll("select")),c=0;c<h.length;c++){var u=h[c],d=i[c],f=u.querySelector('option[value="'.concat(d,'"'));f&&f.setAttribute("selected",!0)}var _=e.tagName==="CANVAS",p=_?[e]:Ui(e.querySelectorAll("canvas"));if(p.length>0)for(var b=_?[t]:Ui(t.querySelectorAll("canvas")),g=0;g<b.length;g++){var S=p[g],x=b[g];x.width=S.width,x.height=S.height,S.width>0&&S.height>0&&x.getContext("2d").drawImage(S,0,0)}return t}var Ko=Object.freeze({USE_COMPUTED_STYLE_INSTEAD_OF_BOUNDING_RECT:"USE_COMPUTED_STYLE_INSTEAD_OF_BOUNDING_RECT"}),ay=to({},Ko.USE_COMPUTED_STYLE_INSTEAD_OF_BOUNDING_RECT,!1);function mv(e){if(!Ko[e])throw new Error("Can't get non existing feature flag ".concat(e,"! Supported flags: ").concat(Object.keys(Ko)));return ay[e]}var ly=.2;function As(e){return"".concat(e," ").concat(ly,"s ease")}function hy(e,t){var i=e.getBoundingClientRect(),r=oy(e);bv(e,r),r.id=qb,r.style.position="fixed";var s=i.top,n=i.left;if(r.style.top="".concat(s,"px"),r.style.left="".concat(n,"px"),t){var o=vv(i);s-=o.y-t.y,n-=o.x-t.x,window.setTimeout(function(){r.style.top="".concat(s,"px"),r.style.left="".concat(n,"px")},0)}return r.style.margin="0",r.style.boxSizing="border-box",r.style.height="".concat(i.height,"px"),r.style.width="".concat(i.width,"px"),r.style.transition="".concat(As("top"),", ").concat(As("left"),", ").concat(As("background-color"),", ").concat(As("opacity"),", ").concat(As("color")," "),window.setTimeout(function(){return r.style.transition+=", ".concat(As("width"),", ").concat(As("height"))},0),r.style.zIndex="9999",r.style.cursor="grabbing",r}function cy(e){e.style.cursor="grab"}function dy(e,t,i,r){bv(t,e);var s=t.getBoundingClientRect(),n=e.getBoundingClientRect(),o=s.width-n.width,l=s.height-n.height;if(o||l){var h={left:(i-n.left)/n.width,top:(r-n.top)/n.height};mv(Ko.USE_COMPUTED_STYLE_INSTEAD_OF_BOUNDING_RECT)||(e.style.height="".concat(s.height,"px"),e.style.width="".concat(s.width,"px")),e.style.left="".concat(parseFloat(e.style.left)-h.left*o,"px"),e.style.top="".concat(parseFloat(e.style.top)-h.top*l,"px")}}function bv(e,t){var i=window.getComputedStyle(e);Array.from(i).filter(function(r){return r.startsWith("background")||r.startsWith("padding")||r.startsWith("font")||r.startsWith("text")||r.startsWith("align")||r.startsWith("justify")||r.startsWith("display")||r.startsWith("flex")||r.startsWith("border")||r==="opacity"||r==="color"||r==="list-style-type"||mv(Ko.USE_COMPUTED_STYLE_INSTEAD_OF_BOUNDING_RECT)&&(r==="width"||r==="height")}).forEach(function(r){return t.style.setProperty(r,i.getPropertyValue(r),i.getPropertyPriority(r))})}function uy(e,t){e.draggable=!1,e.ondragstart=function(){return!1},t?(e.style.userSelect="",e.style.WebkitUserSelect="",e.style.cursor=""):(e.style.userSelect="none",e.style.WebkitUserSelect="none",e.style.cursor="grab")}function yv(e){e.style.display="none",e.style.position="fixed",e.style.zIndex="-5"}function fy(e){e.style.visibility="hidden",e.setAttribute(Rl,"true")}function _y(e){e.style.visibility="",e.removeAttribute(Rl)}function Wa(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return[]};e.forEach(function(r){var s=t(r);Object.keys(s).forEach(function(n){r.style[n]=s[n]}),i(r).forEach(function(n){return r.classList.add(n)})})}function il(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return[]};e.forEach(function(r){var s=t(r);Object.keys(s).forEach(function(n){r.style[n]=""}),i(r).forEach(function(n){return r.classList.contains(n)&&r.classList.remove(n)})})}function vy(e){var t=e.style.minHeight;e.style.minHeight=window.getComputedStyle(e).getPropertyValue("height");var i=e.style.minWidth;return e.style.minWidth=window.getComputedStyle(e).getPropertyValue("width"),function(){e.style.minHeight=t,e.style.minWidth=i}}var py="--any--",gy=100,my=20,Da=3,by=80,su={outline:"rgba(255, 255, 102, 0.7) solid 2px"},nu="data-is-dnd-original-dragged-item",fi,Dt,gi,Pl,at,Ml,xs,Yt,gr,Lt,ns=!1,ud=!1,fd,ua=!1,Ha=[],Fo,mr,ko=!1,_d=!1,lr=new Map,mt=new Map,Zl=new WeakMap;function yy(e,t){lr.has(t)||lr.set(t,new Set),lr.get(t).has(e)||(lr.get(t).add(e),uv())}function ou(e,t){lr.get(t).delete(e),fv(),lr.get(t).size===0&&lr.delete(t)}function Sy(){var e=lr.get(Pl),t=ca(e),i;try{for(t.s();!(i=t.n()).done;){var r=i.value;r.addEventListener(El,Sv),r.addEventListener(da,wv),r.addEventListener(Dl,Cv)}}catch(l){t.e(l)}finally{t.f()}window.addEventListener(hd,ro);var s=Math.max.apply(Math,Ui(Array.from(e.keys()).map(function(l){return mt.get(l).dropAnimationDurationMs}))),n=s===0?my:Math.max(s,gy);Fo=ry(e,function(){return Lt});var o=_d?function(){return{x:Lt.x+window.scrollX,y:Lt.y+window.scrollY}}:function(){return pv(Dt)};Jb(Dt,e,n*1.07,Fo,o)}function wy(){var e=lr.get(Pl),t=ca(e),i;try{for(t.s();!(i=t.n()).done;){var r=i.value;r.removeEventListener(El,Sv),r.removeEventListener(da,wv),r.removeEventListener(Dl,Cv)}}catch(s){t.e(s)}finally{t.f()}window.removeEventListener(hd,ro),Fo&&(Fo.destroy(),Fo=void 0),ey()}function Al(e){return e.findIndex(function(t){return!!t[Tl]})}function Cy(e){var t;return Ja(Ja({},e),{},(t={},to(t,Tl,!0),to(t,Rt,dv),t))}function Sv(e){var t=mt.get(e.currentTarget),i=t.items,r=t.dropFromOthersDisabled;if(!(r&&e.currentTarget!==at)){if(ua=!1,i=i.filter(function(l){return l[Rt]!==xs[Rt]&&l[Rt]!==dv}),at!==e.currentTarget){var s=mt.get(at).items,n=s.filter(function(l){return!l[Tl]});Ps(at,n,{trigger:ai.DRAGGED_ENTERED_ANOTHER,id:gi[Rt],source:bi.POINTER})}var o=e.detail.indexObj.index;Yt=e.currentTarget,i.splice(o,0,xs),Ps(e.currentTarget,i,{trigger:ai.DRAGGED_ENTERED,id:gi[Rt],source:bi.POINTER})}}function wv(e){if(ns){var t=mt.get(e.currentTarget),i=t.items,r=t.dropFromOthersDisabled;if(!(r&&e.currentTarget!==at&&e.currentTarget!==Yt)){var s=Ui(i),n=Al(s);n!==-1&&s.splice(n,1);var o=Yt;Yt=void 0;var l=e.detail,h=l.type,c=l.theOtherDz;if(h===el.OUTSIDE_OF_ANY||h===el.LEFT_FOR_ANOTHER&&c!==at&&mt.get(c).dropFromOthersDisabled){ua=!0,Yt=at;var u=o===at?s:Ui(mt.get(at).items);u.splice(Ml,0,xs),Ps(at,u,{trigger:ai.DRAGGED_LEFT_ALL,id:gi[Rt],source:bi.POINTER})}Ps(e.currentTarget,s,{trigger:ai.DRAGGED_LEFT,id:gi[Rt],source:bi.POINTER})}}}function Cv(e){var t=mt.get(e.currentTarget),i=t.items,r=t.dropFromOthersDisabled;if(!(r&&e.currentTarget!==at)){var s=Ui(i);ua=!1;var n=e.detail.indexObj.index,o=Al(s);o!==-1&&s.splice(o,1),s.splice(n,0,xs),Ps(e.currentTarget,s,{trigger:ai.DRAGGED_OVER_INDEX,id:gi[Rt],source:bi.POINTER})}}function rl(e){e.preventDefault();var t=e.touches?e.touches[0]:e;Lt={x:t.clientX,y:t.clientY},Dt.style.transform="translate3d(".concat(Lt.x-gr.x,"px, ").concat(Lt.y-gr.y,"px, 0)")}function ro(){ud=!0,window.removeEventListener("mousemove",rl),window.removeEventListener("touchmove",rl),window.removeEventListener("mouseup",ro),window.removeEventListener("touchend",ro),wy(),cy(Dt),Yt||(Yt=at);var e=mt.get(Yt),t=e.items,i=e.type;il(lr.get(i),function(n){return mt.get(n).dropTargetStyle},function(n){return mt.get(n).dropTargetClasses});var r=Al(t);r===-1&&Yt===at&&(r=Ml),t=t.map(function(n){return n[Tl]?gi:n});function s(){fd(),io(Yt,t,{trigger:ua?ai.DROPPED_OUTSIDE_OF_ANY:ai.DROPPED_INTO_ZONE,id:gi[Rt],source:bi.POINTER}),Yt!==at&&io(at,mt.get(at).items,{trigger:ai.DROPPED_INTO_ANOTHER,id:gi[Rt],source:bi.POINTER});var n=Array.from(Yt.children).find(function(o){return o.getAttribute(Rl)});n&&_y(n),Ey()}mt.get(Yt).dropAnimationDisabled?s():ky(r,s)}function ky(e,t){var i=e>-1?Bh(Yt.children[e],!1):Bh(Yt,!1),r={x:i.left-parseFloat(Dt.style.left),y:i.top-parseFloat(Dt.style.top)},s=mt.get(Yt),n=s.dropAnimationDurationMs,o="transform ".concat(n,"ms ease");Dt.style.transition=Dt.style.transition?Dt.style.transition+","+o:o,Dt.style.transform="translate3d(".concat(r.x,"px, ").concat(r.y,"px, 0)"),window.setTimeout(t,n)}function xy(e,t){Ha.push({dz:e,destroy:t}),window.requestAnimationFrame(function(){yv(e),document.body.appendChild(e)})}function Ey(){Dt&&Dt.remove&&Dt.remove(),fi&&fi.remove&&fi.remove(),Dt=void 0,fi=void 0,gi=void 0,Pl=void 0,at=void 0,Ml=void 0,xs=void 0,Yt=void 0,gr=void 0,Lt=void 0,ns=!1,ud=!1,fd=void 0,ua=!1,mr&&clearTimeout(mr),mr=void 0,ko=!1,_d=!1,Ha.length&&(Ha.forEach(function(e){var t=e.dz,i=e.destroy;i(),t.remove()}),Ha=[])}function Dy(e,t){var i=!1,r={items:void 0,type:void 0,flipDurationMs:0,dragDisabled:!1,morphDisabled:!1,dropFromOthersDisabled:!1,dropTargetStyle:su,dropTargetClasses:[],transformDraggedElement:function(){},centreDraggedOnCursor:!1,useCursorForDetection:!1,dropAnimationDisabled:!1,delayTouchStartMs:0},s=new Map;function n(){window.addEventListener("mousemove",h,{passive:!1}),window.addEventListener("touchmove",h,{passive:!1,capture:!1}),window.addEventListener("mouseup",l,{passive:!1}),window.addEventListener("touchend",l,{passive:!1})}function o(){window.removeEventListener("mousemove",h),window.removeEventListener("touchmove",h),window.removeEventListener("mouseup",l),window.removeEventListener("touchend",l),mr&&(clearTimeout(mr),mr=void 0,ko=!1)}function l(f){if(o(),fi=void 0,gr=void 0,Lt=void 0,f.type==="touchend"){var _=new Event("click",{bubbles:!0,cancelable:!0});f.target.dispatchEvent(_)}}function h(f){var _=!!f.touches,p=_?f.touches[0]:f;if(_&&r.delayTouchStartMs>0&&!ko){Lt={x:p.clientX,y:p.clientY},(Math.abs(Lt.x-gr.x)>=Da||Math.abs(Lt.y-gr.y)>=Da)&&(mr&&(clearTimeout(mr),mr=void 0),l(f));return}f.preventDefault(),Lt={x:p.clientX,y:p.clientY},(Math.abs(Lt.x-gr.x)>=Da||Math.abs(Lt.y-gr.y)>=Da)&&(o(),u())}function c(f){if(!(f.target!==f.currentTarget&&(f.target.value!==void 0||f.target.isContentEditable))&&!f.button&&!ns){var _=!!f.touches,p=_&&r.delayTouchStartMs>0;p||f.preventDefault(),f.stopPropagation();var b=_?f.touches[0]:f;gr={x:b.clientX,y:b.clientY},Lt=Ja({},gr),fi=f.currentTarget,p&&(ko=!1,mr=window.setTimeout(function(){fi&&(ko=!0,o(),u())},r.delayTouchStartMs)),n()}}function u(){ns=!0;var f=s.get(fi);Ml=f,at=fi.parentElement;var _=at.closest("dialog")||at.closest("[popover]")||at.getRootNode(),p=_.body||_,b=r.items,g=r.type,S=r.centreDraggedOnCursor,x=r.useCursorForDetection,C=Ui(b);gi=C[f],Pl=g,xs=Cy(gi),_d=x,Dt=hy(fi,S&&Lt),p.appendChild(Dt);function w(){fi.parentElement?window.requestAnimationFrame(w):(fi.setAttribute(nu,!0),p.appendChild(fi),Sy(),yv(fi),xs[Rt]=gi[Rt],Dt.focus())}window.requestAnimationFrame(w),Wa(Array.from(lr.get(r.type)).filter(function(k){return k===at||!mt.get(k).dropFromOthersDisabled}),function(k){return mt.get(k).dropTargetStyle},function(k){return mt.get(k).dropTargetClasses}),C.splice(f,1,xs),fd=vy(at),Ps(at,C,{trigger:ai.DRAG_STARTED,id:gi[Rt],source:bi.POINTER}),window.addEventListener("mousemove",rl,{passive:!1}),window.addEventListener("touchmove",rl,{passive:!1,capture:!1}),window.addEventListener("mouseup",ro,{passive:!1}),window.addEventListener("touchend",ro,{passive:!1})}function d(f){var _=f.items,p=_===void 0?void 0:_,b=f.flipDurationMs,g=b===void 0?0:b,S=f.type,x=S===void 0?py:S,C=f.dragDisabled,w=C===void 0?!1:C,k=f.morphDisabled,M=k===void 0?!1:k,B=f.dropFromOthersDisabled,q=B===void 0?!1:B,Y=f.dropTargetStyle,ne=Y===void 0?su:Y,j=f.dropTargetClasses,N=j===void 0?[]:j,L=f.transformDraggedElement,R=L===void 0?function(){}:L,O=f.centreDraggedOnCursor,U=O===void 0?!1:O,T=f.useCursorForDetection,E=T===void 0?!1:T,Q=f.dropAnimationDisabled,ee=Q===void 0?!1:Q,ge=f.delayTouchStart,we=ge===void 0?!1:ge;r.dropAnimationDurationMs=g;var de=0;we===!0?de=by:typeof we=="number"&&isFinite(we)&&we>=0&&(de=we),r.delayTouchStartMs=de,r.type&&x!==r.type&&ou(e,r.type),r.type=x,r.items=Ui(p),r.dragDisabled=w,r.morphDisabled=M,r.transformDraggedElement=R,r.centreDraggedOnCursor=U,r.useCursorForDetection=E,r.dropAnimationDisabled=ee,i&&ns&&!ud&&(!$b(ne,r.dropTargetStyle)||!Zb(N,r.dropTargetClasses))&&(il([e],function(){return r.dropTargetStyle},function(){return N}),Wa([e],function(){return ne},function(){return N})),r.dropTargetStyle=ne,r.dropTargetClasses=Ui(N);function Ce(ye,me){return mt.get(ye)?mt.get(ye)[me]:r[me]}i&&ns&&r.dropFromOthersDisabled!==q&&(q?il([e],function(ye){return Ce(ye,"dropTargetStyle")},function(ye){return Ce(ye,"dropTargetClasses")}):Wa([e],function(ye){return Ce(ye,"dropTargetStyle")},function(ye){return Ce(ye,"dropTargetClasses")})),r.dropFromOthersDisabled=q,mt.set(e,r),yy(e,x);for(var Te=ns?Al(r.items):-1,De=0;De<e.children.length;De++){var ve=e.children[De];if(uy(ve,w),De===Te){M||dy(Dt,ve,Lt.x,Lt.y),r.transformDraggedElement(Dt,gi,De),fy(ve);continue}ve.removeEventListener("mousedown",Zl.get(ve)),ve.removeEventListener("touchstart",Zl.get(ve)),w||(ve.addEventListener("mousedown",c),ve.addEventListener("touchstart",c),Zl.set(ve,c)),s.set(ve,De),i||(i=!0)}}return d(t),{update:function(_){d(_)},destroy:function(){function _(){ou(e,mt.get(e).type),mt.delete(e)}ns&&!e.closest("[".concat(nu,"]"))?xy(e,_):_()}}}var Ta,Wh={DND_ZONE_ACTIVE:"dnd-zone-active",DND_ZONE_DRAG_DISABLED:"dnd-zone-drag-disabled"},kv=(Ta={},to(Ta,Wh.DND_ZONE_ACTIVE,"Tab to one the items and press space-bar or enter to start dragging it"),to(Ta,Wh.DND_ZONE_DRAG_DISABLED,"This is a disabled drag and drop list"),Ta),Ty="dnd-action-aria-alert",St;function Hh(){St||(St=document.createElement("div"),(function(){St.id=Ty,St.style.position="fixed",St.style.bottom="0",St.style.left="0",St.style.zIndex="-5",St.style.opacity="0",St.style.height="0",St.style.width="0",St.setAttribute("role","alert")})(),document.body.prepend(St),Object.entries(kv).forEach(function(e){var t=Rb(e,2),i=t[0],r=t[1];return document.body.prepend(My(i,r))}))}function Ry(){return cd?null:(document.readyState==="complete"?Hh():window.addEventListener("DOMContentLoaded",Hh),Ja({},Wh))}function Py(){cd||!St||(Object.keys(kv).forEach(function(e){var t;return(t=document.getElementById(e))===null||t===void 0?void 0:t.remove()}),St.remove(),St=void 0)}function My(e,t){var i=document.createElement("div");return i.id=e,i.innerHTML="<p>".concat(t,"</p>"),i.style.display="none",i.style.position="fixed",i.style.zIndex="-5",i}function Pn(e){if(!cd){St||Hh(),St.innerHTML="";var t=document.createTextNode(e);St.appendChild(t),St.style.display="none",St.style.display="inline"}}var Ay="--any--",au={outline:"rgba(255, 255, 102, 0.7) solid 2px"},Bi=!1,zh,ii,cn="",Ls,xr,ms="",sl=new WeakSet,lu=new WeakMap,hu=new WeakMap,Uh=new Map,qt=new Map,sr=new Map,nl;function Oy(e,t){sr.size===0&&(nl=Ry(),window.addEventListener("keydown",xv),window.addEventListener("click",Ev)),sr.has(t)||sr.set(t,new Set),sr.get(t).has(e)||(sr.get(t).add(e),uv())}function cu(e,t){ii===e&&qo(),sr.get(t).delete(e),fv(),sr.get(t).size===0&&sr.delete(t),sr.size===0&&(window.removeEventListener("keydown",xv),window.removeEventListener("click",Ev),nl=void 0,Py())}function xv(e){if(Bi)switch(e.key){case"Escape":{qo();break}}}function Ev(){Bi&&(sl.has(document.activeElement)||qo())}function Ly(e){if(Bi){var t=e.currentTarget;if(t!==ii){cn=t.getAttribute("aria-label")||"";var i=qt.get(ii),r=i.items,s=r.find(function(d){return d[Rt]===xr}),n=r.indexOf(s),o=r.splice(n,1)[0],l=qt.get(t),h=l.items,c=l.autoAriaDisabled;t.getBoundingClientRect().top<ii.getBoundingClientRect().top||t.getBoundingClientRect().left<ii.getBoundingClientRect().left?(h.push(o),c||Pn("Moved item ".concat(ms," to the end of the list ").concat(cn))):(h.unshift(o),c||Pn("Moved item ".concat(ms," to the beginning of the list ").concat(cn)));var u=ii;io(u,r,{trigger:ai.DROPPED_INTO_ANOTHER,id:xr,source:bi.KEYBOARD}),io(t,h,{trigger:ai.DROPPED_INTO_ZONE,id:xr,source:bi.KEYBOARD}),ii=t}}}function Dv(){Uh.forEach(function(e,t){var i=e.update;return i(qt.get(t))})}function qo(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;qt.get(ii).autoAriaDisabled||Pn("Stopped dragging item ".concat(ms)),sl.has(document.activeElement)&&document.activeElement.blur(),e&&Ps(ii,qt.get(ii).items,{trigger:ai.DRAG_STOPPED,id:xr,source:bi.KEYBOARD}),il(sr.get(zh),function(t){return qt.get(t).dropTargetStyle},function(t){return qt.get(t).dropTargetClasses}),Ls=null,xr=null,ms="",zh=null,ii=null,cn="",Bi=!1,Dv()}function Iy(e,t){var i={items:void 0,type:void 0,dragDisabled:!1,zoneTabIndex:0,zoneItemTabIndex:0,dropFromOthersDisabled:!1,dropTargetStyle:au,dropTargetClasses:[],autoAriaDisabled:!1};function r(u,d,f){u.length<=1||u.splice(f,1,u.splice(d,1,u[f])[0])}function s(u){switch(u.key){case"Enter":case" ":{if((u.target.disabled!==void 0||u.target.href||u.target.isContentEditable)&&!sl.has(u.target))return;u.preventDefault(),u.stopPropagation(),Bi?qo():n(u);break}case"ArrowDown":case"ArrowRight":{if(!Bi)return;u.preventDefault(),u.stopPropagation();var d=qt.get(e),f=d.items,_=Array.from(e.children),p=_.indexOf(u.currentTarget);p<_.length-1&&(i.autoAriaDisabled||Pn("Moved item ".concat(ms," to position ").concat(p+2," in the list ").concat(cn)),r(f,p,p+1),io(e,f,{trigger:ai.DROPPED_INTO_ZONE,id:xr,source:bi.KEYBOARD}));break}case"ArrowUp":case"ArrowLeft":{if(!Bi)return;u.preventDefault(),u.stopPropagation();var b=qt.get(e),g=b.items,S=Array.from(e.children),x=S.indexOf(u.currentTarget);x>0&&(i.autoAriaDisabled||Pn("Moved item ".concat(ms," to position ").concat(x," in the list ").concat(cn)),r(g,x,x-1),io(e,g,{trigger:ai.DROPPED_INTO_ZONE,id:xr,source:bi.KEYBOARD}));break}}}function n(u){l(u.currentTarget),ii=e,zh=i.type,Bi=!0;var d=Array.from(sr.get(i.type)).filter(function(_){return _===ii||!qt.get(_).dropFromOthersDisabled});if(Wa(d,function(_){return qt.get(_).dropTargetStyle},function(_){return qt.get(_).dropTargetClasses}),!i.autoAriaDisabled){var f="Started dragging item ".concat(ms,". Use the arrow keys to move it within its list ").concat(cn);d.length>1&&(f+=", or tab to another list in order to move the item into it"),Pn(f)}Ps(e,qt.get(e).items,{trigger:ai.DRAG_STARTED,id:xr,source:bi.KEYBOARD}),Dv()}function o(u){Bi&&u.currentTarget!==Ls&&(u.stopPropagation(),qo(!1),n(u))}function l(u){var d=qt.get(e),f=d.items,_=Array.from(e.children),p=_.indexOf(u);Ls=u,Ls.tabIndex=i.zoneItemTabIndex,xr=f[p][Rt],ms=_[p].getAttribute("aria-label")||""}function h(u){var d=u.items,f=d===void 0?[]:d,_=u.type,p=_===void 0?Ay:_,b=u.dragDisabled,g=b===void 0?!1:b,S=u.zoneTabIndex,x=S===void 0?0:S,C=u.zoneItemTabIndex,w=C===void 0?0:C,k=u.dropFromOthersDisabled,M=k===void 0?!1:k,B=u.dropTargetStyle,q=B===void 0?au:B,Y=u.dropTargetClasses,ne=Y===void 0?[]:Y,j=u.autoAriaDisabled,N=j===void 0?!1:j;i.items=Ui(f),i.dragDisabled=g,i.dropFromOthersDisabled=M,i.zoneTabIndex=x,i.zoneItemTabIndex=w,i.dropTargetStyle=q,i.dropTargetClasses=ne,i.autoAriaDisabled=N,i.type&&p!==i.type&&cu(e,i.type),i.type=p,Oy(e,p),N||(e.setAttribute("role","list"),e.setAttribute("aria-describedby",g?nl.DND_ZONE_DRAG_DISABLED:nl.DND_ZONE_ACTIVE)),qt.set(e,i),Bi?e.tabIndex=e===ii||Ls.contains(e)||i.dropFromOthersDisabled||ii&&i.type!==qt.get(ii).type?-1:0:e.tabIndex=i.zoneTabIndex,e.addEventListener("focus",Ly);for(var L=function(U){var T=e.children[U];sl.add(T),T.tabIndex=Bi?-1:i.zoneItemTabIndex,N||T.setAttribute("role","listitem"),T.removeEventListener("keydown",lu.get(T)),T.removeEventListener("click",hu.get(T)),g||(T.addEventListener("keydown",s),lu.set(T,s),T.addEventListener("click",o),hu.set(T,o)),Bi&&i.items[U][Rt]===xr&&(Ls=T,Ls.tabIndex=i.zoneItemTabIndex,T.focus())},R=0;R<e.children.length;R++)L(R)}h(t);var c={update:function(d){h(d)},destroy:function(){cu(e,i.type),qt.delete(e),Uh.delete(e)}};return Uh.set(e,c),c}var By=["items","flipDurationMs","type","dragDisabled","morphDisabled","dropFromOthersDisabled","zoneTabIndex","zoneItemTabIndex","dropTargetStyle","dropTargetClasses","transformDraggedElement","autoAriaDisabled","centreDraggedOnCursor","useCursorForDetection","delayTouchStart","dropAnimationDisabled"];function Ql(e,t){if(Ny(e))return{update:function(){},destroy:function(){}};du(t);var i=Dy(e,t),r=Iy(e,t);return{update:function(n){du(n),i.update(n),r.update(n)},destroy:function(){i.destroy(),r.destroy()}}}function Ny(e){return!!e.closest("[".concat(Kb,'="true"]'))}function du(e){var t=e.items;e.flipDurationMs,e.type,e.dragDisabled,e.morphDisabled,e.dropFromOthersDisabled;var i=e.zoneTabIndex,r=e.zoneItemTabIndex;e.dropTargetStyle;var s=e.dropTargetClasses;e.transformDraggedElement,e.autoAriaDisabled,e.centreDraggedOnCursor,e.useCursorForDetection;var n=e.delayTouchStart;e.dropAnimationDisabled;var o=Tb(e,By);if(Object.keys(o).length>0&&console.warn("dndzone will ignore unknown options",o),!t)throw new Error("no 'items' key provided to dndzone");var l=t.find(function(u){return!{}.hasOwnProperty.call(u,Rt)});if(l)throw new Error("missing '".concat(Rt,"' property for item ").concat(vo(l)));if(s&&!Array.isArray(s))throw new Error("dropTargetClasses should be an array but instead it is a ".concat(xn(s),", ").concat(vo(s)));if(i&&!uu(i))throw new Error("zoneTabIndex should be a number but instead it is a ".concat(xn(i),", ").concat(vo(i)));if(r&&!uu(r))throw new Error("zoneItemTabIndex should be a number but instead it is a ".concat(xn(r),", ").concat(vo(r)));if(n!==void 0&&n!==!1){var h=n===!0,c=typeof n=="number"&&isFinite(n)&&n>=0;if(!h&&!c)throw new Error("delayTouchStart should be a boolean (true/false) or a non-negative number but instead it is a ".concat(xn(n),", ").concat(vo(n)))}}function uu(e){return!isNaN(e)&&(function(t){return(t|0)===t})(parseFloat(e))}var Fy=F('<button class="context-menu-trigger svelte-1nmhce7" aria-label="Actions" aria-haspopup="true">···</button>'),Wy=F('<li role="menuitem"> </li>'),Hy=F('<div class="context-menu-backdrop svelte-1nmhce7"></div> <ul class="context-menu svelte-1nmhce7" role="menu"></ul>',1),zy=F("<!> <!>",1);function fu(e,t){ft(t,!0);let i=dr(t,"hideTrigger",3,!1),r=H(!1),s=H(null),n=H(null),o=H(null);function l(w){w.stopPropagation(),a(r)?h():(m(r,!0),requestAnimationFrame(u))}function h(){m(r,!1),m(o,null)}function c(w){m(o,w.getBoundingClientRect(),!0),m(r,!0),requestAnimationFrame(u)}function u(){var q;if(!a(n))return;const w=a(o)||((q=a(s))==null?void 0:q.getBoundingClientRect());if(!w)return;const k=a(n).getBoundingClientRect();let M=w.bottom+4,B=w.right-k.width;M+k.height>window.innerHeight-8&&(M=w.top-k.height-4),B<8&&(B=8),a(n).style.top=M+"px",a(n).style.left=B+"px"}function d(w,k){k.stopPropagation(),!w.disabled&&(h(),w.action())}function f(w){!a(r)||w.key!=="Escape"||(w.stopPropagation(),h())}function _(w){w.stopPropagation(),h()}var p={openAt:c},b=zy();ar("keydown",h_,f);var g=kt(b);{var S=w=>{var k=Fy();st(k,M=>m(s,M),()=>a(s)),ce(()=>Ue(k,"aria-expanded",a(r))),V("click",k,l),I(w,k)};re(g,w=>{i()||w(S)})}var x=D(g,2);{var C=w=>{var k=Hy(),M=kt(k),B=D(M,2);Xt(B,21,()=>t.items,Uo,(q,Y)=>{var ne=Wy();let j;var N=y(ne);ce(()=>{j=tt(ne,1,"context-menu-item svelte-1nmhce7",null,j,{"context-menu-item--danger":a(Y).danger,"context-menu-item--disabled":a(Y).disabled}),Ue(ne,"tabindex",a(Y).disabled?-1:0),oe(N,a(Y).label)}),V("click",ne,L=>d(a(Y),L)),V("keydown",ne,L=>L.key==="Enter"&&d(a(Y),L)),I(q,ne)}),st(B,q=>m(n,q),()=>a(n)),V("click",M,_),V("click",B,q=>q.stopPropagation()),I(w,k)};re(x,w=>{a(r)&&w(C)})}return I(e,b),_t(p)}vt(["click","keydown"]);var Uy=F("<span> </span>"),Ky=F('<span class="collapse-count svelte-168i8d5"> </span>'),qy=F('<div class="workspace-actions svelte-168i8d5"><span class="action-btn svelte-168i8d5" title="Settings">⚙</span></div>'),jy=F('<span class="terminal-icon svelte-168i8d5">>_</span>'),Yy=F("<span></span>"),Vy=F('<span class="session-count-badge svelte-168i8d5"> </span>'),Gy=F('<span class="diff-badge svelte-168i8d5"><span class="diff-add svelte-168i8d5"> </span> <span class="diff-del svelte-168i8d5"> </span></span>'),Xy=F('<span class="secondary-branch svelte-168i8d5"> </span>'),$y=F('<span class="secondary-pr svelte-168i8d5"> </span>'),Zy=F('<li><div class="session-row-primary svelte-168i8d5"><!> <span> </span> <!> <!></div> <div class="session-row-secondary svelte-168i8d5"><span class="secondary-time svelte-168i8d5"> </span> <!> <!></div> <div class="row-menu-overlay svelte-168i8d5"><!></div></li>'),Qy=F('<div class="session-row-secondary svelte-168i8d5"><span class="secondary-branch svelte-168i8d5"> </span></div>'),Jy=F('<li><div class="session-row-primary svelte-168i8d5"><span class="dot dot-inactive svelte-168i8d5"></span> <span class="session-name svelte-168i8d5"> </span></div> <!></li>'),eS=F('<span class="diff-badge svelte-168i8d5"><span class="diff-add svelte-168i8d5"> </span> <span class="diff-del svelte-168i8d5"> </span></span>'),tS=F('<span class="secondary-branch svelte-168i8d5"> </span>'),iS=F('<span class="secondary-pr svelte-168i8d5"> </span>'),rS=F('<li><div class="session-row-primary svelte-168i8d5"><span class="dot dot-inactive svelte-168i8d5"></span> <span class="session-name svelte-168i8d5"> </span> <!></div> <div class="session-row-secondary svelte-168i8d5"><span class="secondary-time svelte-168i8d5"> </span> <!> <!></div> <div class="row-menu-overlay svelte-168i8d5"><!></div></li>'),sS=F('<ul class="session-list svelte-168i8d5"><!> <!></ul>'),nS=F('<div><span class="add-worktree-btn svelte-168i8d5"> </span></div>'),oS=F('<div class="workspace-divider svelte-168i8d5"></div>'),aS=F('<div><div><div class="workspace-left svelte-168i8d5"><!> <span class="initial-block svelte-168i8d5"> </span> <span class="workspace-name svelte-168i8d5"> </span> <!></div> <!></div> <!> <!> <!></div>');function lS(e,t){ft(t,!0);const i=nd(),r=rd();let s=dr(t,"inactiveWorktrees",19,()=>[]),n=fe(()=>[...t.sessionGroups.values()].flat());const o=["#d97757","#4ade80","#60a5fa","#a78bfa","#f472b6","#fb923c","#34d399","#f87171"];function l(Z){let ue=0;for(let A=0;A<Z.length;A++)ue=(ue<<5)-ue+Z.charCodeAt(A)|0;return o[Math.abs(ue)%o.length]??"#d97757"}let h=fe(()=>l(t.workspace.name)),c=fe(()=>t.workspace.name.charAt(0).toUpperCase()),u=fe(()=>hb(t.workspace.path)),d=fe(()=>a(n).length+s().length);function f(Z){return"status-dot status-dot--"+Xl(Z)}function _(Z){return Z.type==="repo"?Z.displayName&&Z.displayName!==Z.repoName?Z.displayName:"default":Z.displayName||Z.branchName||Z.repoName||Z.id}let p=fe(()=>a(n).some(Z=>Xl(Z)==="attention")),b=fe(()=>Zi(`new-worktree:${t.workspace.path}`)),g=fe(()=>r.reorderMode),S=Ze(typeof window<"u"&&window.matchMedia("(max-width: 600px)").matches),x={},C=null;function w(Z,ue){C=setTimeout(()=>{C=null;const A=x[Z];A&&A.openAt(ue)},500)}function k(){C&&(clearTimeout(C),C=null)}function M(){C&&(clearTimeout(C),C=null)}let B=fe(cb);function q(Z){return a(B),eu(Z.lastActivity)}function Y(Z){return a(B),eu(Z.lastActivity)}async function ne(Z){const ue=prompt("Rename session:",_(Z));ue&&ue.trim()&&(await fetch(`/sessions/${Z.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({displayName:ue.trim()})}),await Bt())}function j(Z){return[{label:"Rename",action:()=>ne(Z)},{label:"Kill",action:()=>{var ue;return(ue=t.onDeleteSession)==null?void 0:ue.call(t,Z.id)},danger:!0}]}function N(Z){return[{label:"Resume",action:async()=>{if(!Zi(Z.path)){Cn(Z.path);try{const ue=await ln({repoPath:t.workspace.path,repoName:t.workspace.name,worktreePath:Z.path,branchName:Z.branchName||Z.name});await Bt(),t.onSelectSession(ue.id)}catch{}finally{kn(Z.path)}}}},{label:"Resume (YOLO)",action:async()=>{if(!Zi(Z.path)){Cn(Z.path);try{const ue=await ln({repoPath:t.workspace.path,repoName:t.workspace.name,worktreePath:Z.path,branchName:Z.branchName||Z.name,yolo:!0});await Bt(),t.onSelectSession(ue.id)}catch{}finally{kn(Z.path)}}}},{label:"Delete Worktree",action:()=>{var ue;return(ue=t.onDeleteWorktree)==null?void 0:ue.call(t,Z)},danger:!0}]}var L=aS();let R;var O=y(L);let U;var T=y(O),E=y(T);{var Q=Z=>{var ue=Uy();let A;var $=y(ue);ce(()=>{A=tt(ue,1,"collapse-chevron svelte-168i8d5",null,A,{collapsed:a(u)}),oe($,a(u)?"›":"⌄")}),V("click",ue,se=>{se.stopPropagation(),lb(t.workspace.path)}),I(Z,ue)};re(E,Z=>{a(g)||Z(Q)})}var ee=D(E,2);let ge;var we=y(ee),de=D(ee,2),Ce=y(de),Te=D(de,2);{var De=Z=>{var ue=Ky(),A=y(ue);ce(()=>oe(A,a(d))),I(Z,ue)};re(Te,Z=>{a(u)&&a(d)>0&&!a(g)&&Z(De)})}var ve=D(T,2);{var ye=Z=>{var ue=qy(),A=y(ue);V("click",A,$=>{$.stopPropagation(),t.onOpenSettings(t.workspace)}),I(Z,ue)};re(ve,Z=>{a(g)||Z(ye)})}var me=D(O,2);{var Ie=Z=>{var ue=sS(),A=y(ue);Xt(A,17,()=>[...t.sessionGroups.entries()],([se,J])=>se,(se,J)=>{var Se=fe(()=>Wp(a(J),2));let le=()=>a(Se)[0],Me=()=>a(Se)[1];const Oe=fe(()=>Me().sort((be,Ee)=>Ee.lastActivity.localeCompare(be.lastActivity))[0]),z=fe(()=>Me().length),G=fe(()=>le()===t.workspace.path),pe=fe(()=>a(z)>0),P=fe(()=>Me().some(be=>Xl(be)==="attention"));var W=Vr(),he=kt(W);{var ke=be=>{const Ee=fe(()=>Qd(a(Oe).id)),$e=fe(()=>a(Ee)&&(a(Ee).additions>0||a(Ee).deletions>0));var it=Zy();let Qt;var Be=y(it),Ne=y(Be);{var Ye=je=>{var et=jy();I(je,et)},nt=je=>{var et=Yy();ce(te=>tt(et,1,te,"svelte-168i8d5"),[()=>O_(f(a(Oe)))]),I(je,et)};re(Ne,je=>{a(Oe).type==="terminal"?je(Ye):je(nt,!1)})}var rt=D(Ne,2);let si;var yi=y(rt),Jt=D(rt,2);{var Si=je=>{var et=Vy(),te=y(et);ce(()=>oe(te,a(z))),I(je,et)};re(Jt,je=>{a(z)>1&&je(Si)})}var Or=D(Jt,2);{var fr=je=>{var et=Gy(),te=y(et),Ve=y(te),yt=D(te,2),Jr=y(yt);ce(()=>{oe(Ve,`+${a(Ee).additions??""}`),oe(Jr,`-${a(Ee).deletions??""}`)}),I(je,et)};re(Or,je=>{a($e)&&je(fr)})}var ma=D(Be,2),ba=y(ma),Nl=y(ba),ya=D(ba,2);{var Fl=je=>{var et=Xy(),te=y(et);ce(()=>oe(te,a(Oe).branchName)),I(je,et)};re(ya,je=>{a(Oe).branchName&&je(Fl)})}var Sa=D(ya,2);{var Wl=je=>{var et=$y(),te=y(et);ce(()=>oe(te,`PR #${a(Ee).prNumber??""}`)),I(je,et)};re(Sa,je=>{var et;(et=a(Ee))!=null&&et.prNumber&&je(Wl)})}var wa=D(ma,2),Hl=y(wa);{let je=fe(()=>j(a(Oe)));st(fu(Hl,{get items(){return a(je)},get hideTrigger(){return S}}),(et,te)=>x[te.id]=et,et=>x==null?void 0:x[et.id],()=>[a(Oe)])}ce((je,et,te)=>{Qt=tt(it,1,"session-row svelte-168i8d5",null,Qt,je),si=tt(rt,1,"session-name svelte-168i8d5",null,si,{bold:a(P)}),oe(yi,et),oe(Nl,te)},[()=>({terminal:a(Oe).type==="terminal",selected:Me().some(je=>i.activeSessionId===je.id),attention:a(P)}),()=>_(a(Oe)),()=>q(a(Oe))]),V("click",it,()=>t.onSelectSession(a(Oe).id)),V("touchstart",it,je=>w(a(Oe).id,je.currentTarget)),V("touchend",it,k),V("touchmove",it,M),I(be,it)},Pe=be=>{const Ee=fe(()=>`repo-session:${t.workspace.path}`);var $e=Jy();let it;var Qt=y($e),Be=D(y(Qt),2),Ne=y(Be),Ye=D(Qt,2);{var nt=rt=>{var si=Qy(),yi=y(si),Jt=y(yi);ce(()=>oe(Jt,t.workspace.defaultBranch)),I(rt,si)};re(Ye,rt=>{t.workspace.defaultBranch&&rt(nt)})}ce((rt,si)=>{it=tt($e,1,"session-row inactive svelte-168i8d5",null,it,rt),oe(Ne,si)},[()=>({loading:Zi(a(Ee))}),()=>Zi(a(Ee))?"starting...":"default"]),V("click",$e,async()=>{if(!Zi(a(Ee))){Cn(a(Ee));try{const rt=await B_({repoPath:t.workspace.path,repoName:t.workspace.name,continue:!0});await Bt(),t.onSelectSession(rt.id)}catch{}finally{kn(a(Ee))}}}),I(be,$e)};re(he,be=>{a(pe)&&a(Oe)?be(ke):a(G)&&be(Pe,1)})}I(se,W)});var $=D(A,2);Xt($,17,s,se=>se.path,(se,J)=>{const Se=fe(()=>Qd(a(J).path)),le=fe(()=>a(Se)&&(a(Se).additions>0||a(Se).deletions>0));var Me=rS();let Oe;var z=y(Me),G=D(y(z),2),pe=y(G),P=D(G,2);{var W=Ne=>{var Ye=eS(),nt=y(Ye),rt=y(nt),si=D(nt,2),yi=y(si);ce(()=>{oe(rt,`+${a(Se).additions??""}`),oe(yi,`-${a(Se).deletions??""}`)}),I(Ne,Ye)};re(P,Ne=>{a(le)&&Ne(W)})}var he=D(z,2),ke=y(he),Pe=y(ke),be=D(ke,2);{var Ee=Ne=>{var Ye=tS(),nt=y(Ye);ce(()=>oe(nt,a(J).branchName)),I(Ne,Ye)};re(be,Ne=>{a(J).branchName&&Ne(Ee)})}var $e=D(be,2);{var it=Ne=>{var Ye=iS(),nt=y(Ye);ce(()=>oe(nt,`PR #${a(Se).prNumber??""}`)),I(Ne,Ye)};re($e,Ne=>{var Ye;(Ye=a(Se))!=null&&Ye.prNumber&&Ne(it)})}var Qt=D(he,2),Be=y(Qt);{let Ne=fe(()=>N(a(J)));st(fu(Be,{get items(){return a(Ne)},get hideTrigger(){return S}}),(Ye,nt)=>x[nt.path]=Ye,Ye=>x==null?void 0:x[Ye.path],()=>[a(J)])}ce((Ne,Ye,nt)=>{Oe=tt(Me,1,"session-row inactive svelte-168i8d5",null,Oe,Ne),oe(pe,Ye),oe(Pe,nt)},[()=>({loading:Zi(a(J).path)}),()=>Zi(a(J).path)?"resuming...":a(J).branchName||a(J).displayName||a(J).name,()=>Y(a(J))]),V("click",Me,async()=>{if(!Zi(a(J).path)){Cn(a(J).path);try{const Ne=await ln({repoPath:t.workspace.path,repoName:t.workspace.name,worktreePath:a(J).path,branchName:a(J).branchName||a(J).name});await Bt(),t.onSelectSession(Ne.id)}catch{}finally{kn(a(J).path)}}}),V("touchstart",Me,Ne=>w(a(J).path,Ne.currentTarget)),V("touchend",Me,k),V("touchmove",Me,M),I(se,Me)}),I(Z,ue)};re(me,Z=>{!a(u)&&!a(g)&&Z(Ie)})}var Fe=D(me,2);{var ze=Z=>{var ue=nS();let A;var $=y(ue),se=y($);ce(()=>{A=tt(ue,1,"add-worktree-row svelte-168i8d5",null,A,{disabled:a(b)}),oe(se,a(b)?"creating...":"+ new worktree")}),V("click",ue,()=>{a(b)||t.onNewWorktree(t.workspace)}),I(Z,ue)};re(Fe,Z=>{!a(u)&&!a(g)&&Z(ze)})}var Re=D(Fe,2);{var Qe=Z=>{var ue=oS();I(Z,ue)};re(Re,Z=>{a(g)||Z(Qe)})}ce(()=>{R=tt(L,1,"workspace-item svelte-168i8d5",null,R,{active:t.isActive}),U=tt(O,1,"workspace-header svelte-168i8d5",null,U,{attention:a(p),"reorder-mode":a(g)}),ge=lo(ee,"",ge,{background:a(h)}),oe(we,a(c)),oe(Ce,t.workspace.name)}),V("click",O,()=>{a(g)||t.onSelectWorkspace(t.workspace.path)}),I(e,L),_t()}vt(["click","touchstart","touchend","touchmove"]);var hS=F('<strong class="svelte-itm1qs"> </strong>'),cS=F("<span> </span>"),dS=F('<li role="option"><!> <span class="dropdown-path svelte-itm1qs"> </span></li>'),uS=F('<ul class="dropdown svelte-itm1qs" role="listbox"></ul>'),fS=F('<div class="smart-search svelte-itm1qs"><div class="input-row svelte-itm1qs"><span class="prompt svelte-itm1qs">></span> <input type="text" class="search-input svelte-itm1qs" placeholder="search workspaces..." autocomplete="off"/></div> <!></div>');function _S(e,t){ft(t,!0);let i=H(""),r=H(0),s=H(void 0),n=fe(()=>{if(!a(i).trim())return[];const g=a(i).toLowerCase();return t.workspaces.filter(S=>S.name.toLowerCase().includes(g))}),o=fe(()=>a(i).trim().length>0&&a(n).length>0);hr(()=>{a(n).length,m(r,0)});function l(g){m(i,g.target.value,!0)}function h(g){var S;if(g.key==="Escape"){m(i,""),(S=a(s))==null||S.blur();return}if(a(o)){if(g.key==="ArrowDown")g.preventDefault(),m(r,Math.min(a(r)+1,a(n).length-1),!0);else if(g.key==="ArrowUp")g.preventDefault(),m(r,Math.max(a(r)-1,0),!0);else if(g.key==="Enter"){g.preventDefault();const x=a(n)[a(r)];x&&c(x)}}}function c(g){var S;t.onSelect(g.path),m(i,""),(S=a(s))==null||S.blur()}function u(g,S){if(!S)return[{text:g,bold:!1}];const x=g.toLowerCase(),C=S.toLowerCase(),w=x.indexOf(C);return w===-1?[{text:g,bold:!1}]:[{text:g.slice(0,w),bold:!1},{text:g.slice(w,w+C.length),bold:!0},{text:g.slice(w+C.length),bold:!1}].filter(k=>k.text.length>0)}var d=fS(),f=y(d),_=D(y(f),2);Ue(_,"spellcheck",!1),st(_,g=>m(s,g),()=>a(s));var p=D(f,2);{var b=g=>{var S=uS();Xt(S,23,()=>a(n),x=>x.path,(x,C,w)=>{var k=dS();let M;var B=y(k);Xt(B,17,()=>u(a(C).name,a(i)),Uo,(ne,j)=>{var N=Vr(),L=kt(N);{var R=U=>{var T=hS(),E=y(T);ce(()=>oe(E,a(j).text)),I(U,T)},O=U=>{var T=cS(),E=y(T);ce(()=>oe(E,a(j).text)),I(U,T)};re(L,U=>{a(j).bold?U(R):U(O,!1)})}I(ne,N)});var q=D(B,2),Y=y(q);ce(()=>{M=tt(k,1,"dropdown-item svelte-itm1qs",null,M,{focused:a(w)===a(r)}),Ue(k,"aria-selected",a(w)===a(r)),oe(Y,a(C).path)}),V("click",k,()=>c(a(C))),ar("mouseenter",k,()=>{m(r,a(w),!0)}),I(x,k)}),I(g,S)};re(p,g=>{a(o)&&g(b)})}ce(()=>mm(_,a(i))),V("input",_,l),V("keydown",_,h),I(e,d),_t()}vt(["input","keydown","click"]);var vS=F('<span class="sidebar-label svelte-owj5vn">Workspaces</span>'),pS=F("<div><!></div>"),gS=F('<div class="empty-state svelte-owj5vn"><span>No workspaces</span></div>'),mS=F('<button class="done-reorder-btn svelte-owj5vn">Done reordering</button>'),bS=F('<button class="add-workspace-btn svelte-owj5vn">+ Add Workspace</button>'),yS=F('<!> <div class="workspace-list svelte-owj5vn"><!> <!></div> <!> <div class="sidebar-footer-row svelte-owj5vn"><!> <button class="settings-icon-btn svelte-owj5vn" aria-label="Settings">⚙</button></div> <div class="resize-handle svelte-owj5vn"></div>',1),SS=F('<aside><div class="sidebar-header svelte-owj5vn"><button class="collapse-btn svelte-owj5vn"> </button> <!> <button class="icon-btn svelte-owj5vn" aria-label="Close sidebar">✕</button></div> <!></aside>');function wS(e,t){ft(t,!0);const i=rd(),r=nd();let s=fe(()=>i.sidebarCollapsed?eb:i.sidebarWidth);function n(R){i.activeWorkspacePath=R,r.activeSessionId=null}function o(R){i.activeWorkspacePath=R,Di()}function l(R){R.preventDefault();const O=R.clientX,U=i.sidebarWidth,T=Q=>{const ee=Math.min(j_,Math.max(q_,U+(Q.clientX-O)));i.sidebarWidth=ee},E=()=>{document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",E),document.body.style.cursor="",document.body.style.userSelect="",$d()};document.addEventListener("mousemove",T),document.addEventListener("mouseup",E),document.body.style.cursor="col-resize",document.body.style.userSelect="none"}function h(R){R.preventDefault(),i.sidebarWidth=K_,$d()}const c=200;let u=fe(()=>r.workspaces.map(R=>({id:R.path,workspace:R}))),d=H(Ze([]));hr(()=>{m(d,a(u),!0)});function f(R){m(d,R.detail.items,!0)}function _(R){m(d,R.detail.items,!0);const O=a(d).map(U=>U.id);Sb(O)}function p(){nb()}let b=null;function g(){b=setTimeout(()=>{sb(),b=null},500)}function S(){b&&(clearTimeout(b),b=null)}function x(){b&&(clearTimeout(b),b=null)}var C=SS();let w,k;var M=y(C),B=y(M),q=y(B),Y=D(B,2);{var ne=R=>{var O=vS();I(R,O)};re(Y,R=>{i.sidebarCollapsed||R(ne)})}var j=D(Y,2),N=D(M,2);{var L=R=>{var O=yS(),U=kt(O);{var T=me=>{_S(me,{get workspaces(){return r.workspaces},onSelect:o})};re(U,me=>{i.reorderMode||me(T)})}var E=D(U,2),Q=y(E);Xt(Q,17,()=>a(d),me=>me.id,(me,Ie)=>{const Fe=fe(()=>a(Ie).workspace),ze=fe(()=>tv(a(Fe).path)),Re=fe(()=>new Set(a(ze).map($=>$.repoPath))),Qe=fe(()=>r.worktrees.filter($=>$.repoPath===a(Fe).path&&$.path.startsWith(a(Fe).path+"/")&&!a(Re).has($.path))),Z=fe(()=>(()=>{const $=new Map;$.set(a(Fe).path,[]);for(const se of a(ze)){const J=$.get(se.repoPath);J?J.push(se):$.set(se.repoPath,[se])}return $})());var ue=pS(),A=y(ue);{let $=fe(()=>i.activeWorkspacePath===a(Fe).path&&!r.activeSessionId);lS(A,{get workspace(){return a(Fe)},get sessionGroups(){return a(Z)},get inactiveWorktrees(){return a(Qe)},get isActive(){return a($)},onSelectWorkspace:n,get onSelectSession(){return t.onSelectSession},get onNewWorktree(){return t.onNewWorktree},onOpenSettings:se=>t.onOpenSettings(se),onDeleteSession:se=>{var J;return(J=t.onDeleteSession)==null?void 0:J.call(t,se)},onDeleteWorktree:se=>{var J;return(J=t.onDeleteWorktree)==null?void 0:J.call(t,se)}})}I(me,ue)});var ee=D(Q,2);{var ge=me=>{var Ie=gS();I(me,Ie)};re(ee,me=>{r.workspaces.length===0&&me(ge)})}cm(E,(me,Ie)=>Ql==null?void 0:Ql(me,Ie),()=>({items:a(d),flipDurationMs:c,type:"workspaces",dropTargetStyle:{}}));var we=D(E,2);{var de=me=>{var Ie=mS();V("click",Ie,p),I(me,Ie)};re(we,me=>{i.reorderMode&&me(de)})}var Ce=D(we,2),Te=y(Ce);{var De=me=>{var Ie=bS();V("click",Ie,function(...Fe){var ze;(ze=t.onAddWorkspace)==null||ze.apply(this,Fe)}),I(me,Ie)};re(Te,me=>{i.reorderMode||me(De)})}var ve=D(Te,2),ye=D(Ce,2);ar("consider",E,f),ar("finalize",E,_),V("touchstart",E,g),V("touchend",E,S),V("touchmove",E,x),V("click",ve,()=>t.onOpenSettings()),V("mousedown",ye,l),V("dblclick",ye,h),I(R,O)};re(N,R=>{i.sidebarCollapsed||R(L)})}ce(()=>{w=tt(C,1,"sidebar svelte-owj5vn",null,w,{open:i.sidebarOpen,collapsed:i.sidebarCollapsed}),k=lo(C,"",k,{width:`${a(s)??""}px`,"min-width":`${a(s)??""}px`}),Ue(B,"aria-label",i.sidebarCollapsed?"Expand sidebar":"Collapse sidebar"),oe(q,i.sidebarCollapsed?"»":"«")}),V("click",B,function(...R){Gl==null||Gl.apply(this,R)}),V("click",j,function(...R){Di==null||Di.apply(this,R)}),I(e,C),_t()}vt(["click","touchstart","touchend","touchmove","mousedown","dblclick"]);/**
|
|
10
|
+
`),r();return}t.clear(),uv(e,t,i,r)}catch{fv(e,t,i,r)}},s)}function ks(e){gi&&gi.readyState===WebSocket.OPEN&&gi.send(e)}function th(e,t){gi&&gi.readyState===WebSocket.OPEN&&gi.send(JSON.stringify({type:"resize",cols:e,rows:t}))}const $i=$e({defaultContinue:!0,defaultYolo:!1,launchInTmux:!1,defaultAgent:"claude",defaultNotifications:!0});function cd(){return $i}async function _v(){const[e,t,i,r,s]=await Promise.all([Zm().catch(()=>$i.defaultContinue),Jm().catch(()=>$i.defaultYolo),tb().catch(()=>$i.launchInTmux),$m().catch(()=>$i.defaultAgent),rb().catch(()=>$i.defaultNotifications)]);$i.defaultContinue=e,$i.defaultYolo=t,$i.launchInTmux=i,$i.defaultAgent=r,$i.defaultNotifications=s}function Ob(e){if(!e)return"";const t=Date.now(),i=new Date(e).getTime(),r=Math.floor((t-i)/1e3);if(r<60)return"just now";const s=Math.floor(r/60);if(s<60)return s+"m ago";const n=Math.floor(s/60);if(n<24)return n+"h ago";const o=Math.floor(n/24);if(o===1)return"yesterday";if(o<7)return o+"d ago";const l=new Date(e);return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][l.getMonth()]+" "+l.getDate()}function au(e){if(!e)return"";const t=Date.now(),i=new Date(e).getTime(),r=Math.floor((t-i)/1e3);if(r<60)return r+"s";const s=Math.floor(r/60);if(s<60)return s+"m";const n=Math.floor(s/60);if(n<24)return n+"h";const o=new Date(e),l=String(o.getDate()).padStart(2,"0"),h=String(o.getMonth()+1).padStart(2,"0"),c=o.getFullYear();return`${l}/${h}/${c}`}const jt=typeof window<"u"&&"ontouchstart"in window&&/Android|iPhone|iPad|iPod/i.test(navigator.userAgent);function dd(e){const{commitsAhead:t,prState:i,ciFailing:r,ciPending:s,ciTotal:n,mergeable:o,unresolvedCommentCount:l}=e;return t<=0&&i===null?{type:"none",color:"none",label:""}:i===null?{type:"create-pr",color:"accent",label:"Create PR"}:i==="DRAFT"?{type:"ready-for-review",color:"muted",label:"Ready for Review"}:i==="MERGED"?{type:"archive-merged",color:"merged",label:"Archive"}:i==="CLOSED"?{type:"archive-closed",color:"muted",label:"Archive"}:i==="OPEN"?o==="CONFLICTING"?{type:"fix-conflicts",color:"error",label:"Fix Conflicts"}:r>0?{type:"fix-errors",color:"error",label:`Fix Errors ${r}/${n}`}:s>0?{type:"checks-running",color:"warning",label:"Checks Running..."}:l>0?{type:"resolve-comments",color:"accent",label:`Resolve Comments (${l})`}:{type:"review-pr",color:"success",label:"Review PR"}:{type:"none",color:"none",label:""}}function Lb(e,t){return e.type==="resolve-comments"?{type:"review-pr",color:"muted",label:"Review PR"}:null}function vv(e,t){switch(e.type){case"create-pr":return`Create a pull request for the branch "${t.branchName}". Write a clear title and description based on the changes.`;case"ready-for-review":return`Mark the draft PR for branch "${t.branchName}" as ready for review using: gh pr ready`;case"review-pr":return`Review the pull request #${t.prNumber} for branch "${t.branchName}". Read the diff, check for bugs and code quality.`;case"fix-conflicts":return`There are merge conflicts with the base branch "${t.baseBranch}". Run \`git merge ${t.baseBranch}\` and resolve all conflicts.`;case"resolve-comments":return`There are ${t.unresolvedCommentCount} unresolved review comments on PR #${t.prNumber}. Read each comment thread, triage them, and address the feedback.`;case"fix-errors":return`The CI checks are failing on branch "${t.branchName}". Investigate the failing checks and fix the errors.`;case"archive-merged":case"archive-closed":return null;case"checks-running":case"none":return null}}function pv(e){switch(e){case"accent":return"var(--accent)";case"success":return"var(--status-success)";case"error":return"var(--status-error)";case"warning":return"var(--status-warning)";case"merged":return"var(--status-merged)";case"muted":return"var(--border)";case"none":return"transparent"}}function gv(e){return e==="success"||e==="warning"}var Ib=F('<p class="error svelte-1qp96yb"> </p>'),Bb=F('<div class="pin-gate svelte-1qp96yb"><div class="pin-container svelte-1qp96yb"><h1 class="svelte-1qp96yb">Claude Remote CLI</h1> <p class="svelte-1qp96yb">Enter PIN to continue</p> <input type="password" inputmode="numeric" maxlength="20" placeholder="PIN" class="svelte-1qp96yb"/> <button class="svelte-1qp96yb">Unlock</button> <!></div></div>');function Nb(e,t){_t(t,!0);const i=V_();let r=W("");async function s(){const f=a(r).trim();f&&(await cb(f),i.pinError&&m(r,""))}function n(f){f.key==="Enter"&&s()}var o=Bb(),l=y(o),h=D(y(l),4);Qg(h);var c=D(h,2),u=D(c,2);{var d=f=>{var _=Ib(),p=y(_);le(()=>oe(p,i.pinError)),I(f,_)};re(u,f=>{i.pinError&&f(d)})}V("keydown",h,n),Ui(h,()=>a(r),f=>m(r,f)),V("click",c,s),I(e,o),vt()}pt(["keydown","click"]);function lu(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),i.push.apply(i,r)}return i}function tl(e){for(var t=1;t<arguments.length;t++){var i=arguments[t]!=null?arguments[t]:{};t%2?lu(Object(i),!0).forEach(function(r){so(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):lu(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function Tn(e){"@babel/helpers - typeof";return Tn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tn(e)}function so(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Fb(e,t){if(e==null)return{};var i={},r=Object.keys(e),s,n;for(n=0;n<r.length;n++)s=r[n],!(t.indexOf(s)>=0)&&(i[s]=e[s]);return i}function Wb(e,t){if(e==null)return{};var i=Fb(e,t),r,s;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;s<n.length;s++)r=n[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function Hb(e,t){return Ub(e)||qb(e,t)||ud(e,t)||Yb()}function Ki(e){return zb(e)||Kb(e)||ud(e)||jb()}function zb(e){if(Array.isArray(e))return Fh(e)}function Ub(e){if(Array.isArray(e))return e}function Kb(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function qb(e,t){var i=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(i!=null){var r=[],s=!0,n=!1,o,l;try{for(i=i.call(e);!(s=(o=i.next()).done)&&(r.push(o.value),!(t&&r.length===t));s=!0);}catch(h){n=!0,l=h}finally{try{!s&&i.return!=null&&i.return()}finally{if(n)throw l}}return r}}function ud(e,t){if(e){if(typeof e=="string")return Fh(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);if(i==="Object"&&e.constructor&&(i=e.constructor.name),i==="Map"||i==="Set")return Array.from(e);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Fh(e,t)}}function Fh(e,t){(t==null||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}function jb(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
11
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Yb(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
12
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fa(e,t){var i=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=ud(e))||t){i&&(e=i);var r=0,s=function(){};return{s,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(h){throw h},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
13
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,l;return{s:function(){i=i.call(e)},n:function(){var h=i.next();return n=h.done,h},e:function(h){o=!0,l=h},f:function(){try{!n&&i.return!=null&&i.return()}finally{if(o)throw l}}}}var Vb="finalize",Gb="consider";function no(e,t,i){e.dispatchEvent(new CustomEvent(Vb,{detail:{items:t,info:i}}))}function Ps(e,t,i){e.dispatchEvent(new CustomEvent(Gb,{detail:{items:t,info:i}}))}var Tl="draggedEntered",_a="draggedLeft",Rl="draggedOverIndex",fd="draggedLeftDocument",il={LEFT_FOR_ANOTHER:"leftForAnother",OUTSIDE_OF_ANY:"outsideOfAny"};function $b(e,t,i){e.dispatchEvent(new CustomEvent(Tl,{detail:{indexObj:t,draggedEl:i}}))}function Xb(e,t,i){e.dispatchEvent(new CustomEvent(_a,{detail:{draggedEl:t,type:il.LEFT_FOR_ANOTHER,theOtherDz:i}}))}function Zb(e,t){e.dispatchEvent(new CustomEvent(_a,{detail:{draggedEl:t,type:il.OUTSIDE_OF_ANY}}))}function Qb(e,t,i){e.dispatchEvent(new CustomEvent(Rl,{detail:{indexObj:t,draggedEl:i}}))}function Jb(e){window.dispatchEvent(new CustomEvent(fd,{detail:{draggedEl:e}}))}var li={DRAG_STARTED:"dragStarted",DRAGGED_ENTERED:Tl,DRAGGED_ENTERED_ANOTHER:"dragEnteredAnother",DRAGGED_OVER_INDEX:Rl,DRAGGED_LEFT:_a,DRAGGED_LEFT_ALL:"draggedLeftAll",DROPPED_INTO_ZONE:"droppedIntoZone",DROPPED_INTO_ANOTHER:"droppedIntoAnother",DROPPED_OUTSIDE_OF_ANY:"droppedOutsideOfAny",DRAG_STOPPED:"dragStopped"},yi={POINTER:"pointer",KEYBOARD:"keyboard"},Pl="isDndShadowItem",Ml="data-is-dnd-shadow-item-internal",ey="data-is-dnd-shadow-item-hint",mv="id:dnd-shadow-placeholder-0000",ty="dnd-action-dragged-el",Mt="id",Wh=0;function bv(){Wh++}function yv(){if(Wh===0)throw new Error("Bug! trying to decrement when there are no dropzones");Wh--}var _d=typeof window>"u";function Hh(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i,r=t?sy(e):e.getBoundingClientRect(),s=getComputedStyle(e),n=s.transform;if(n){var o,l,h,c;if(n.startsWith("matrix3d("))i=n.slice(9,-1).split(/, /),o=+i[0],l=+i[5],h=+i[12],c=+i[13];else if(n.startsWith("matrix("))i=n.slice(7,-1).split(/, /),o=+i[0],l=+i[3],h=+i[4],c=+i[5];else return r;var u=s.transformOrigin,d=r.x-h-(1-o)*parseFloat(u),f=r.y-c-(1-l)*parseFloat(u.slice(u.indexOf(" ")+1)),_=o?r.width/o:e.offsetWidth,p=l?r.height/l:e.offsetHeight;return{x:d,y:f,width:_,height:p,top:f,right:d+_,bottom:f+p,left:d}}else return r}function zh(e){var t=Hh(e);return{top:t.top+window.scrollY,bottom:t.bottom+window.scrollY,left:t.left+window.scrollX,right:t.right+window.scrollX}}function Sv(e){var t=e.getBoundingClientRect();return{top:t.top+window.scrollY,bottom:t.bottom+window.scrollY,left:t.left+window.scrollX,right:t.right+window.scrollX}}function wv(e){return{x:(e.left+e.right)/2,y:(e.top+e.bottom)/2}}function iy(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ho(e,t){return e.y<=t.bottom&&e.y>=t.top&&e.x>=t.left&&e.x<=t.right}function Cv(e){return wv(Sv(e))}function hu(e,t){var i=Cv(t);return iy(e,i)}function ry(e){var t=Sv(e);return t.right<0||t.left>document.documentElement.scrollWidth||t.bottom<0||t.top>document.documentElement.scrollHeight}function sy(e){for(var t=e.getBoundingClientRect(),i={top:t.top,bottom:t.bottom,left:t.left,right:t.right},r=!1,s=!1,n=e.parentElement;n&&n!==document.body;){var o=window.getComputedStyle(n),l=o.overflowY,h=o.overflowX,c=l==="scroll"||l==="auto",u=h==="scroll"||h==="auto";if(c||u){var d=n.getBoundingClientRect();if(c){var f=Math.max(i.top,d.top),_=Math.min(i.bottom,d.bottom);(f!==i.top||_!==i.bottom)&&(r=!0),i.top=f,i.bottom=_}if(u){var p=Math.max(i.left,d.left),b=Math.min(i.right,d.right);(p!==i.left||b!==i.right)&&(s=!0),i.left=p,i.right=b}}n=n.parentElement}return r||s?{top:i.top,bottom:i.bottom,left:i.left,right:i.right,width:Math.max(0,i.right-i.left),height:Math.max(0,i.bottom-i.top)}:{top:t.top,bottom:t.bottom,left:t.left,right:t.right,width:Math.max(0,t.right-t.left),height:Math.max(0,t.bottom-t.top)}}var An;function vd(){An=new Map}vd();function ny(e){var t=Array.from(e.children).findIndex(function(i){return i.getAttribute(Ml)});if(t>=0)return An.has(e)||An.set(e,new Map),An.get(e).set(t,zh(e.children[t])),t}function oy(e,t){var i=zh(t);if(!Ho(e,i))return null;var r=t.children;if(r.length===0)return{index:0,isProximityBased:!0};for(var s=ny(t),n=0;n<r.length;n++){var o=zh(r[n]);if(Ho(e,o)){var l=An.has(t)&&An.get(t).get(n);return l&&!Ho(e,l)?{index:s,isProximityBased:!1}:{index:n,isProximityBased:!1}}}for(var h=Number.MAX_VALUE,c=void 0,u=0;u<r.length;u++){var d=hu(e,r[u]);d<h&&(h=d,c=u)}if(r.length>0){var f=r.length,_=r[f-1],p=_.cloneNode(!1);p.style.visibility="hidden",p.style.pointerEvents="none",t.appendChild(p);var b=hu(e,p);b<h&&(c=f),t.removeChild(p)}return{index:c,isProximityBased:!0}}function mo(e){return JSON.stringify(e,null,2)}function rl(e){if(!e)throw new Error("cannot get depth of a falsy node");return kv(e,0)}function kv(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.parentElement?kv(e.parentElement,t+1):t-1}function ay(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var i in e)if(!{}.hasOwnProperty.call(t,i)||t[i]!==e[i])return!1;return!0}function ly(e,t){if(e.length!==t.length)return!1;for(var i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}var hy=200,cu=10,Uh;function cy(e,t){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:hy,r=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0,n,o,l=!1,h,c=Array.from(t).sort(function(d,f){return rl(f)-rl(d)});function u(){var d=s(),f=r.multiScrollIfNeeded();if(!f&&h&&Math.abs(h.x-d.x)<cu&&Math.abs(h.y-d.y)<cu){Uh=window.setTimeout(u,i);return}if(ry(e)){Jb(e);return}h=d;var _=!1,p=fa(c),b;try{for(p.s();!(b=p.n()).done;){var g=b.value;f&&vd();var S=oy(d,g);if(S!==null){var x=S.index;_=!0,g!==n?(n&&Xb(n,e,g),$b(g,S,e),n=g):x!==o&&(Qb(g,S,e),o=x);break}}}catch(C){p.e(C)}finally{p.f()}!_&&l&&n?(Zb(n,e),n=void 0,o=void 0,l=!1):l=!0,Uh=window.setTimeout(u,i)}u()}function dy(){clearTimeout(Uh),vd()}var bo=30;function uy(){var e;function t(){e={directionObj:void 0,stepPx:0}}t();function i(n){var o=e,l=o.directionObj,h=o.stepPx;l&&(n.scrollBy(l.x*h,l.y*h),window.requestAnimationFrame(function(){return i(n)}))}function r(n){return bo-n}function s(n,o){if(!o)return!1;var l=fy(n,o),h=!!e.directionObj;if(l===null)return h&&t(),!1;var c=!1,u=!1;return o.scrollHeight>o.clientHeight&&(l.bottom<bo?(c=!0,e.directionObj={x:0,y:1},e.stepPx=r(l.bottom)):l.top<bo&&(c=!0,e.directionObj={x:0,y:-1},e.stepPx=r(l.top)),!h&&c)||o.scrollWidth>o.clientWidth&&(l.right<bo?(u=!0,e.directionObj={x:1,y:0},e.stepPx=r(l.right)):l.left<bo&&(u=!0,e.directionObj={x:-1,y:0},e.stepPx=r(l.left)),!h&&u)?(i(o),!0):(t(),!1)}return{scrollIfNeeded:s,resetScrolling:t}}function fy(e,t){var i=t===document.scrollingElement?{top:0,bottom:window.innerHeight,left:0,right:window.innerWidth}:t.getBoundingClientRect();return Ho(e,i)?{top:e.y-i.top,bottom:i.bottom-e.y,left:e.x-i.left,right:i.right-e.x}:null}function _y(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,i=py(e),r=Array.from(i).sort(function(h,c){return rl(c)-rl(h)}),s=uy(),n=s.scrollIfNeeded,o=s.resetScrolling;function l(){var h=t();if(!h||!r)return!1;for(var c=r.filter(function(f){return Ho(h,f.getBoundingClientRect())||f===document.scrollingElement}),u=0;u<c.length;u++){var d=n(h,c[u]);if(d)return!0}return!1}return{multiScrollIfNeeded:i.size>0?l:function(){return!1},destroy:function(){return o()}}}function vy(e){if(!e)return[];for(var t=[],i=e;i;){var r=window.getComputedStyle(i),s=r.overflow;s.split(" ").some(function(n){return n.includes("auto")||n.includes("scroll")})&&t.push(i),i=i.parentElement}return t}function py(e){var t=new Set,i=fa(e),r;try{for(i.s();!(r=i.n()).done;){var s=r.value;vy(s).forEach(function(n){return t.add(n)})}}catch(n){i.e(n)}finally{i.f()}return(document.scrollingElement.scrollHeight>document.scrollingElement.clientHeight||document.scrollingElement.scrollWidth>document.scrollingElement.clientHeight)&&t.add(document.scrollingElement),t}function gy(e){var t=e.cloneNode(!0),i=[],r=e.tagName==="SELECT",s=r?[e]:Ki(e.querySelectorAll("select")),n=fa(s),o;try{for(n.s();!(o=n.n()).done;){var l=o.value;i.push(l.value)}}catch(C){n.e(C)}finally{n.f()}if(s.length>0)for(var h=r?[t]:Ki(t.querySelectorAll("select")),c=0;c<h.length;c++){var u=h[c],d=i[c],f=u.querySelector('option[value="'.concat(d,'"'));f&&f.setAttribute("selected",!0)}var _=e.tagName==="CANVAS",p=_?[e]:Ki(e.querySelectorAll("canvas"));if(p.length>0)for(var b=_?[t]:Ki(t.querySelectorAll("canvas")),g=0;g<b.length;g++){var S=p[g],x=b[g];x.width=S.width,x.height=S.height,S.width>0&&S.height>0&&x.getContext("2d").drawImage(S,0,0)}return t}var Yo=Object.freeze({USE_COMPUTED_STYLE_INSTEAD_OF_BOUNDING_RECT:"USE_COMPUTED_STYLE_INSTEAD_OF_BOUNDING_RECT"}),my=so({},Yo.USE_COMPUTED_STYLE_INSTEAD_OF_BOUNDING_RECT,!1);function xv(e){if(!Yo[e])throw new Error("Can't get non existing feature flag ".concat(e,"! Supported flags: ").concat(Object.keys(Yo)));return my[e]}var by=.2;function Os(e){return"".concat(e," ").concat(by,"s ease")}function yy(e,t){var i=e.getBoundingClientRect(),r=gy(e);Ev(e,r),r.id=ty,r.style.position="fixed";var s=i.top,n=i.left;if(r.style.top="".concat(s,"px"),r.style.left="".concat(n,"px"),t){var o=wv(i);s-=o.y-t.y,n-=o.x-t.x,window.setTimeout(function(){r.style.top="".concat(s,"px"),r.style.left="".concat(n,"px")},0)}return r.style.margin="0",r.style.boxSizing="border-box",r.style.height="".concat(i.height,"px"),r.style.width="".concat(i.width,"px"),r.style.transition="".concat(Os("top"),", ").concat(Os("left"),", ").concat(Os("background-color"),", ").concat(Os("opacity"),", ").concat(Os("color")," "),window.setTimeout(function(){return r.style.transition+=", ".concat(Os("width"),", ").concat(Os("height"))},0),r.style.zIndex="9999",r.style.cursor="grabbing",r}function Sy(e){e.style.cursor="grab"}function wy(e,t,i,r){Ev(t,e);var s=t.getBoundingClientRect(),n=e.getBoundingClientRect(),o=s.width-n.width,l=s.height-n.height;if(o||l){var h={left:(i-n.left)/n.width,top:(r-n.top)/n.height};xv(Yo.USE_COMPUTED_STYLE_INSTEAD_OF_BOUNDING_RECT)||(e.style.height="".concat(s.height,"px"),e.style.width="".concat(s.width,"px")),e.style.left="".concat(parseFloat(e.style.left)-h.left*o,"px"),e.style.top="".concat(parseFloat(e.style.top)-h.top*l,"px")}}function Ev(e,t){var i=window.getComputedStyle(e);Array.from(i).filter(function(r){return r.startsWith("background")||r.startsWith("padding")||r.startsWith("font")||r.startsWith("text")||r.startsWith("align")||r.startsWith("justify")||r.startsWith("display")||r.startsWith("flex")||r.startsWith("border")||r==="opacity"||r==="color"||r==="list-style-type"||xv(Yo.USE_COMPUTED_STYLE_INSTEAD_OF_BOUNDING_RECT)&&(r==="width"||r==="height")}).forEach(function(r){return t.style.setProperty(r,i.getPropertyValue(r),i.getPropertyPriority(r))})}function Cy(e,t){e.draggable=!1,e.ondragstart=function(){return!1},t?(e.style.userSelect="",e.style.WebkitUserSelect="",e.style.cursor=""):(e.style.userSelect="none",e.style.WebkitUserSelect="none",e.style.cursor="grab")}function Dv(e){e.style.display="none",e.style.position="fixed",e.style.zIndex="-5"}function ky(e){e.style.visibility="hidden",e.setAttribute(Ml,"true")}function xy(e){e.style.visibility="",e.removeAttribute(Ml)}function za(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return[]};e.forEach(function(r){var s=t(r);Object.keys(s).forEach(function(n){r.style[n]=s[n]}),i(r).forEach(function(n){return r.classList.add(n)})})}function sl(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return[]};e.forEach(function(r){var s=t(r);Object.keys(s).forEach(function(n){r.style[n]=""}),i(r).forEach(function(n){return r.classList.contains(n)&&r.classList.remove(n)})})}function Ey(e){var t=e.style.minHeight;e.style.minHeight=window.getComputedStyle(e).getPropertyValue("height");var i=e.style.minWidth;return e.style.minWidth=window.getComputedStyle(e).getPropertyValue("width"),function(){e.style.minHeight=t,e.style.minWidth=i}}var Dy="--any--",Ty=100,Ry=20,Ra=3,Py=80,du={outline:"rgba(255, 255, 102, 0.7) solid 2px"},uu="data-is-dnd-original-dragged-item",_i,Rt,mi,Al,at,Ol,xs,Gt,gr,Bt,ns=!1,pd=!1,gd,va=!1,Ua=[],zo,mr,Do=!1,md=!1,hr=new Map,bt=new Map,ih=new WeakMap;function My(e,t){hr.has(t)||hr.set(t,new Set),hr.get(t).has(e)||(hr.get(t).add(e),bv())}function fu(e,t){hr.get(t).delete(e),yv(),hr.get(t).size===0&&hr.delete(t)}function Ay(){var e=hr.get(Al),t=fa(e),i;try{for(t.s();!(i=t.n()).done;){var r=i.value;r.addEventListener(Tl,Tv),r.addEventListener(_a,Rv),r.addEventListener(Rl,Pv)}}catch(l){t.e(l)}finally{t.f()}window.addEventListener(fd,oo);var s=Math.max.apply(Math,Ki(Array.from(e.keys()).map(function(l){return bt.get(l).dropAnimationDurationMs}))),n=s===0?Ry:Math.max(s,Ty);zo=_y(e,function(){return Bt});var o=md?function(){return{x:Bt.x+window.scrollX,y:Bt.y+window.scrollY}}:function(){return Cv(Rt)};cy(Rt,e,n*1.07,zo,o)}function Oy(){var e=hr.get(Al),t=fa(e),i;try{for(t.s();!(i=t.n()).done;){var r=i.value;r.removeEventListener(Tl,Tv),r.removeEventListener(_a,Rv),r.removeEventListener(Rl,Pv)}}catch(s){t.e(s)}finally{t.f()}window.removeEventListener(fd,oo),zo&&(zo.destroy(),zo=void 0),dy()}function Ll(e){return e.findIndex(function(t){return!!t[Pl]})}function Ly(e){var t;return tl(tl({},e),{},(t={},so(t,Pl,!0),so(t,Mt,mv),t))}function Tv(e){var t=bt.get(e.currentTarget),i=t.items,r=t.dropFromOthersDisabled;if(!(r&&e.currentTarget!==at)){if(va=!1,i=i.filter(function(l){return l[Mt]!==xs[Mt]&&l[Mt]!==mv}),at!==e.currentTarget){var s=bt.get(at).items,n=s.filter(function(l){return!l[Pl]});Ps(at,n,{trigger:li.DRAGGED_ENTERED_ANOTHER,id:mi[Mt],source:yi.POINTER})}var o=e.detail.indexObj.index;Gt=e.currentTarget,i.splice(o,0,xs),Ps(e.currentTarget,i,{trigger:li.DRAGGED_ENTERED,id:mi[Mt],source:yi.POINTER})}}function Rv(e){if(ns){var t=bt.get(e.currentTarget),i=t.items,r=t.dropFromOthersDisabled;if(!(r&&e.currentTarget!==at&&e.currentTarget!==Gt)){var s=Ki(i),n=Ll(s);n!==-1&&s.splice(n,1);var o=Gt;Gt=void 0;var l=e.detail,h=l.type,c=l.theOtherDz;if(h===il.OUTSIDE_OF_ANY||h===il.LEFT_FOR_ANOTHER&&c!==at&&bt.get(c).dropFromOthersDisabled){va=!0,Gt=at;var u=o===at?s:Ki(bt.get(at).items);u.splice(Ol,0,xs),Ps(at,u,{trigger:li.DRAGGED_LEFT_ALL,id:mi[Mt],source:yi.POINTER})}Ps(e.currentTarget,s,{trigger:li.DRAGGED_LEFT,id:mi[Mt],source:yi.POINTER})}}}function Pv(e){var t=bt.get(e.currentTarget),i=t.items,r=t.dropFromOthersDisabled;if(!(r&&e.currentTarget!==at)){var s=Ki(i);va=!1;var n=e.detail.indexObj.index,o=Ll(s);o!==-1&&s.splice(o,1),s.splice(n,0,xs),Ps(e.currentTarget,s,{trigger:li.DRAGGED_OVER_INDEX,id:mi[Mt],source:yi.POINTER})}}function nl(e){e.preventDefault();var t=e.touches?e.touches[0]:e;Bt={x:t.clientX,y:t.clientY},Rt.style.transform="translate3d(".concat(Bt.x-gr.x,"px, ").concat(Bt.y-gr.y,"px, 0)")}function oo(){pd=!0,window.removeEventListener("mousemove",nl),window.removeEventListener("touchmove",nl),window.removeEventListener("mouseup",oo),window.removeEventListener("touchend",oo),Oy(),Sy(Rt),Gt||(Gt=at);var e=bt.get(Gt),t=e.items,i=e.type;sl(hr.get(i),function(n){return bt.get(n).dropTargetStyle},function(n){return bt.get(n).dropTargetClasses});var r=Ll(t);r===-1&&Gt===at&&(r=Ol),t=t.map(function(n){return n[Pl]?mi:n});function s(){gd(),no(Gt,t,{trigger:va?li.DROPPED_OUTSIDE_OF_ANY:li.DROPPED_INTO_ZONE,id:mi[Mt],source:yi.POINTER}),Gt!==at&&no(at,bt.get(at).items,{trigger:li.DROPPED_INTO_ANOTHER,id:mi[Mt],source:yi.POINTER});var n=Array.from(Gt.children).find(function(o){return o.getAttribute(Ml)});n&&xy(n),Ny()}bt.get(Gt).dropAnimationDisabled?s():Iy(r,s)}function Iy(e,t){var i=e>-1?Hh(Gt.children[e],!1):Hh(Gt,!1),r={x:i.left-parseFloat(Rt.style.left),y:i.top-parseFloat(Rt.style.top)},s=bt.get(Gt),n=s.dropAnimationDurationMs,o="transform ".concat(n,"ms ease");Rt.style.transition=Rt.style.transition?Rt.style.transition+","+o:o,Rt.style.transform="translate3d(".concat(r.x,"px, ").concat(r.y,"px, 0)"),window.setTimeout(t,n)}function By(e,t){Ua.push({dz:e,destroy:t}),window.requestAnimationFrame(function(){Dv(e),document.body.appendChild(e)})}function Ny(){Rt&&Rt.remove&&Rt.remove(),_i&&_i.remove&&_i.remove(),Rt=void 0,_i=void 0,mi=void 0,Al=void 0,at=void 0,Ol=void 0,xs=void 0,Gt=void 0,gr=void 0,Bt=void 0,ns=!1,pd=!1,gd=void 0,va=!1,mr&&clearTimeout(mr),mr=void 0,Do=!1,md=!1,Ua.length&&(Ua.forEach(function(e){var t=e.dz,i=e.destroy;i(),t.remove()}),Ua=[])}function Fy(e,t){var i=!1,r={items:void 0,type:void 0,flipDurationMs:0,dragDisabled:!1,morphDisabled:!1,dropFromOthersDisabled:!1,dropTargetStyle:du,dropTargetClasses:[],transformDraggedElement:function(){},centreDraggedOnCursor:!1,useCursorForDetection:!1,dropAnimationDisabled:!1,delayTouchStartMs:0},s=new Map;function n(){window.addEventListener("mousemove",h,{passive:!1}),window.addEventListener("touchmove",h,{passive:!1,capture:!1}),window.addEventListener("mouseup",l,{passive:!1}),window.addEventListener("touchend",l,{passive:!1})}function o(){window.removeEventListener("mousemove",h),window.removeEventListener("touchmove",h),window.removeEventListener("mouseup",l),window.removeEventListener("touchend",l),mr&&(clearTimeout(mr),mr=void 0,Do=!1)}function l(f){if(o(),_i=void 0,gr=void 0,Bt=void 0,f.type==="touchend"){var _=new Event("click",{bubbles:!0,cancelable:!0});f.target.dispatchEvent(_)}}function h(f){var _=!!f.touches,p=_?f.touches[0]:f;if(_&&r.delayTouchStartMs>0&&!Do){Bt={x:p.clientX,y:p.clientY},(Math.abs(Bt.x-gr.x)>=Ra||Math.abs(Bt.y-gr.y)>=Ra)&&(mr&&(clearTimeout(mr),mr=void 0),l(f));return}f.preventDefault(),Bt={x:p.clientX,y:p.clientY},(Math.abs(Bt.x-gr.x)>=Ra||Math.abs(Bt.y-gr.y)>=Ra)&&(o(),u())}function c(f){if(!(f.target!==f.currentTarget&&(f.target.value!==void 0||f.target.isContentEditable))&&!f.button&&!ns){var _=!!f.touches,p=_&&r.delayTouchStartMs>0;p||f.preventDefault(),f.stopPropagation();var b=_?f.touches[0]:f;gr={x:b.clientX,y:b.clientY},Bt=tl({},gr),_i=f.currentTarget,p&&(Do=!1,mr=window.setTimeout(function(){_i&&(Do=!0,o(),u())},r.delayTouchStartMs)),n()}}function u(){ns=!0;var f=s.get(_i);Ol=f,at=_i.parentElement;var _=at.closest("dialog")||at.closest("[popover]")||at.getRootNode(),p=_.body||_,b=r.items,g=r.type,S=r.centreDraggedOnCursor,x=r.useCursorForDetection,C=Ki(b);mi=C[f],Al=g,xs=Ly(mi),md=x,Rt=yy(_i,S&&Bt),p.appendChild(Rt);function w(){_i.parentElement?window.requestAnimationFrame(w):(_i.setAttribute(uu,!0),p.appendChild(_i),Ay(),Dv(_i),xs[Mt]=mi[Mt],Rt.focus())}window.requestAnimationFrame(w),za(Array.from(hr.get(r.type)).filter(function(k){return k===at||!bt.get(k).dropFromOthersDisabled}),function(k){return bt.get(k).dropTargetStyle},function(k){return bt.get(k).dropTargetClasses}),C.splice(f,1,xs),gd=Ey(at),Ps(at,C,{trigger:li.DRAG_STARTED,id:mi[Mt],source:yi.POINTER}),window.addEventListener("mousemove",nl,{passive:!1}),window.addEventListener("touchmove",nl,{passive:!1,capture:!1}),window.addEventListener("mouseup",oo,{passive:!1}),window.addEventListener("touchend",oo,{passive:!1})}function d(f){var _=f.items,p=_===void 0?void 0:_,b=f.flipDurationMs,g=b===void 0?0:b,S=f.type,x=S===void 0?Dy:S,C=f.dragDisabled,w=C===void 0?!1:C,k=f.morphDisabled,M=k===void 0?!1:k,B=f.dropFromOthersDisabled,K=B===void 0?!1:B,j=f.dropTargetStyle,se=j===void 0?du:j,Y=f.dropTargetClasses,N=Y===void 0?[]:Y,L=f.transformDraggedElement,T=L===void 0?function(){}:L,O=f.centreDraggedOnCursor,U=O===void 0?!1:O,R=f.useCursorForDetection,E=R===void 0?!1:R,J=f.dropAnimationDisabled,te=J===void 0?!1:J,pe=f.delayTouchStart,ke=pe===void 0?!1:pe;r.dropAnimationDurationMs=g;var ue=0;ke===!0?ue=Py:typeof ke=="number"&&isFinite(ke)&&ke>=0&&(ue=ke),r.delayTouchStartMs=ue,r.type&&x!==r.type&&fu(e,r.type),r.type=x,r.items=Ki(p),r.dragDisabled=w,r.morphDisabled=M,r.transformDraggedElement=T,r.centreDraggedOnCursor=U,r.useCursorForDetection=E,r.dropAnimationDisabled=te,i&&ns&&!pd&&(!ay(se,r.dropTargetStyle)||!ly(N,r.dropTargetClasses))&&(sl([e],function(){return r.dropTargetStyle},function(){return N}),za([e],function(){return se},function(){return N})),r.dropTargetStyle=se,r.dropTargetClasses=Ki(N);function Ce(ye,ge){return bt.get(ye)?bt.get(ye)[ge]:r[ge]}i&&ns&&r.dropFromOthersDisabled!==K&&(K?sl([e],function(ye){return Ce(ye,"dropTargetStyle")},function(ye){return Ce(ye,"dropTargetClasses")}):za([e],function(ye){return Ce(ye,"dropTargetStyle")},function(ye){return Ce(ye,"dropTargetClasses")})),r.dropFromOthersDisabled=K,bt.set(e,r),My(e,x);for(var De=ns?Ll(r.items):-1,Te=0;Te<e.children.length;Te++){var ve=e.children[Te];if(Cy(ve,w),Te===De){M||wy(Rt,ve,Bt.x,Bt.y),r.transformDraggedElement(Rt,mi,Te),ky(ve);continue}ve.removeEventListener("mousedown",ih.get(ve)),ve.removeEventListener("touchstart",ih.get(ve)),w||(ve.addEventListener("mousedown",c),ve.addEventListener("touchstart",c),ih.set(ve,c)),s.set(ve,Te),i||(i=!0)}}return d(t),{update:function(_){d(_)},destroy:function(){function _(){fu(e,bt.get(e).type),bt.delete(e)}ns&&!e.closest("[".concat(uu,"]"))?By(e,_):_()}}}var Pa,Kh={DND_ZONE_ACTIVE:"dnd-zone-active",DND_ZONE_DRAG_DISABLED:"dnd-zone-drag-disabled"},Mv=(Pa={},so(Pa,Kh.DND_ZONE_ACTIVE,"Tab to one the items and press space-bar or enter to start dragging it"),so(Pa,Kh.DND_ZONE_DRAG_DISABLED,"This is a disabled drag and drop list"),Pa),Wy="dnd-action-aria-alert",St;function qh(){St||(St=document.createElement("div"),(function(){St.id=Wy,St.style.position="fixed",St.style.bottom="0",St.style.left="0",St.style.zIndex="-5",St.style.opacity="0",St.style.height="0",St.style.width="0",St.setAttribute("role","alert")})(),document.body.prepend(St),Object.entries(Mv).forEach(function(e){var t=Hb(e,2),i=t[0],r=t[1];return document.body.prepend(Uy(i,r))}))}function Hy(){return _d?null:(document.readyState==="complete"?qh():window.addEventListener("DOMContentLoaded",qh),tl({},Kh))}function zy(){_d||!St||(Object.keys(Mv).forEach(function(e){var t;return(t=document.getElementById(e))===null||t===void 0?void 0:t.remove()}),St.remove(),St=void 0)}function Uy(e,t){var i=document.createElement("div");return i.id=e,i.innerHTML="<p>".concat(t,"</p>"),i.style.display="none",i.style.position="fixed",i.style.zIndex="-5",i}function On(e){if(!_d){St||qh(),St.innerHTML="";var t=document.createTextNode(e);St.appendChild(t),St.style.display="none",St.style.display="inline"}}var Ky="--any--",_u={outline:"rgba(255, 255, 102, 0.7) solid 2px"},Ni=!1,jh,si,dn="",Is,xr,ms="",ol=new WeakSet,vu=new WeakMap,pu=new WeakMap,Yh=new Map,Yt=new Map,nr=new Map,al;function qy(e,t){nr.size===0&&(al=Hy(),window.addEventListener("keydown",Av),window.addEventListener("click",Ov)),nr.has(t)||nr.set(t,new Set),nr.get(t).has(e)||(nr.get(t).add(e),bv())}function gu(e,t){si===e&&Vo(),nr.get(t).delete(e),yv(),nr.get(t).size===0&&nr.delete(t),nr.size===0&&(window.removeEventListener("keydown",Av),window.removeEventListener("click",Ov),al=void 0,zy())}function Av(e){if(Ni)switch(e.key){case"Escape":{Vo();break}}}function Ov(){Ni&&(ol.has(document.activeElement)||Vo())}function jy(e){if(Ni){var t=e.currentTarget;if(t!==si){dn=t.getAttribute("aria-label")||"";var i=Yt.get(si),r=i.items,s=r.find(function(d){return d[Mt]===xr}),n=r.indexOf(s),o=r.splice(n,1)[0],l=Yt.get(t),h=l.items,c=l.autoAriaDisabled;t.getBoundingClientRect().top<si.getBoundingClientRect().top||t.getBoundingClientRect().left<si.getBoundingClientRect().left?(h.push(o),c||On("Moved item ".concat(ms," to the end of the list ").concat(dn))):(h.unshift(o),c||On("Moved item ".concat(ms," to the beginning of the list ").concat(dn)));var u=si;no(u,r,{trigger:li.DROPPED_INTO_ANOTHER,id:xr,source:yi.KEYBOARD}),no(t,h,{trigger:li.DROPPED_INTO_ZONE,id:xr,source:yi.KEYBOARD}),si=t}}}function Lv(){Yh.forEach(function(e,t){var i=e.update;return i(Yt.get(t))})}function Vo(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;Yt.get(si).autoAriaDisabled||On("Stopped dragging item ".concat(ms)),ol.has(document.activeElement)&&document.activeElement.blur(),e&&Ps(si,Yt.get(si).items,{trigger:li.DRAG_STOPPED,id:xr,source:yi.KEYBOARD}),sl(nr.get(jh),function(t){return Yt.get(t).dropTargetStyle},function(t){return Yt.get(t).dropTargetClasses}),Is=null,xr=null,ms="",jh=null,si=null,dn="",Ni=!1,Lv()}function Yy(e,t){var i={items:void 0,type:void 0,dragDisabled:!1,zoneTabIndex:0,zoneItemTabIndex:0,dropFromOthersDisabled:!1,dropTargetStyle:_u,dropTargetClasses:[],autoAriaDisabled:!1};function r(u,d,f){u.length<=1||u.splice(f,1,u.splice(d,1,u[f])[0])}function s(u){switch(u.key){case"Enter":case" ":{if((u.target.disabled!==void 0||u.target.href||u.target.isContentEditable)&&!ol.has(u.target))return;u.preventDefault(),u.stopPropagation(),Ni?Vo():n(u);break}case"ArrowDown":case"ArrowRight":{if(!Ni)return;u.preventDefault(),u.stopPropagation();var d=Yt.get(e),f=d.items,_=Array.from(e.children),p=_.indexOf(u.currentTarget);p<_.length-1&&(i.autoAriaDisabled||On("Moved item ".concat(ms," to position ").concat(p+2," in the list ").concat(dn)),r(f,p,p+1),no(e,f,{trigger:li.DROPPED_INTO_ZONE,id:xr,source:yi.KEYBOARD}));break}case"ArrowUp":case"ArrowLeft":{if(!Ni)return;u.preventDefault(),u.stopPropagation();var b=Yt.get(e),g=b.items,S=Array.from(e.children),x=S.indexOf(u.currentTarget);x>0&&(i.autoAriaDisabled||On("Moved item ".concat(ms," to position ").concat(x," in the list ").concat(dn)),r(g,x,x-1),no(e,g,{trigger:li.DROPPED_INTO_ZONE,id:xr,source:yi.KEYBOARD}));break}}}function n(u){l(u.currentTarget),si=e,jh=i.type,Ni=!0;var d=Array.from(nr.get(i.type)).filter(function(_){return _===si||!Yt.get(_).dropFromOthersDisabled});if(za(d,function(_){return Yt.get(_).dropTargetStyle},function(_){return Yt.get(_).dropTargetClasses}),!i.autoAriaDisabled){var f="Started dragging item ".concat(ms,". Use the arrow keys to move it within its list ").concat(dn);d.length>1&&(f+=", or tab to another list in order to move the item into it"),On(f)}Ps(e,Yt.get(e).items,{trigger:li.DRAG_STARTED,id:xr,source:yi.KEYBOARD}),Lv()}function o(u){Ni&&u.currentTarget!==Is&&(u.stopPropagation(),Vo(!1),n(u))}function l(u){var d=Yt.get(e),f=d.items,_=Array.from(e.children),p=_.indexOf(u);Is=u,Is.tabIndex=i.zoneItemTabIndex,xr=f[p][Mt],ms=_[p].getAttribute("aria-label")||""}function h(u){var d=u.items,f=d===void 0?[]:d,_=u.type,p=_===void 0?Ky:_,b=u.dragDisabled,g=b===void 0?!1:b,S=u.zoneTabIndex,x=S===void 0?0:S,C=u.zoneItemTabIndex,w=C===void 0?0:C,k=u.dropFromOthersDisabled,M=k===void 0?!1:k,B=u.dropTargetStyle,K=B===void 0?_u:B,j=u.dropTargetClasses,se=j===void 0?[]:j,Y=u.autoAriaDisabled,N=Y===void 0?!1:Y;i.items=Ki(f),i.dragDisabled=g,i.dropFromOthersDisabled=M,i.zoneTabIndex=x,i.zoneItemTabIndex=w,i.dropTargetStyle=K,i.dropTargetClasses=se,i.autoAriaDisabled=N,i.type&&p!==i.type&&gu(e,i.type),i.type=p,qy(e,p),N||(e.setAttribute("role","list"),e.setAttribute("aria-describedby",g?al.DND_ZONE_DRAG_DISABLED:al.DND_ZONE_ACTIVE)),Yt.set(e,i),Ni?e.tabIndex=e===si||Is.contains(e)||i.dropFromOthersDisabled||si&&i.type!==Yt.get(si).type?-1:0:e.tabIndex=i.zoneTabIndex,e.addEventListener("focus",jy);for(var L=function(U){var R=e.children[U];ol.add(R),R.tabIndex=Ni?-1:i.zoneItemTabIndex,N||R.setAttribute("role","listitem"),R.removeEventListener("keydown",vu.get(R)),R.removeEventListener("click",pu.get(R)),g||(R.addEventListener("keydown",s),vu.set(R,s),R.addEventListener("click",o),pu.set(R,o)),Ni&&i.items[U][Mt]===xr&&(Is=R,Is.tabIndex=i.zoneItemTabIndex,R.focus())},T=0;T<e.children.length;T++)L(T)}h(t);var c={update:function(d){h(d)},destroy:function(){gu(e,i.type),Yt.delete(e),Yh.delete(e)}};return Yh.set(e,c),c}var Vy=["items","flipDurationMs","type","dragDisabled","morphDisabled","dropFromOthersDisabled","zoneTabIndex","zoneItemTabIndex","dropTargetStyle","dropTargetClasses","transformDraggedElement","autoAriaDisabled","centreDraggedOnCursor","useCursorForDetection","delayTouchStart","dropAnimationDisabled"];function rh(e,t){if(Gy(e))return{update:function(){},destroy:function(){}};mu(t);var i=Fy(e,t),r=Yy(e,t);return{update:function(n){mu(n),i.update(n),r.update(n)},destroy:function(){i.destroy(),r.destroy()}}}function Gy(e){return!!e.closest("[".concat(ey,'="true"]'))}function mu(e){var t=e.items;e.flipDurationMs,e.type,e.dragDisabled,e.morphDisabled,e.dropFromOthersDisabled;var i=e.zoneTabIndex,r=e.zoneItemTabIndex;e.dropTargetStyle;var s=e.dropTargetClasses;e.transformDraggedElement,e.autoAriaDisabled,e.centreDraggedOnCursor,e.useCursorForDetection;var n=e.delayTouchStart;e.dropAnimationDisabled;var o=Wb(e,Vy);if(Object.keys(o).length>0&&console.warn("dndzone will ignore unknown options",o),!t)throw new Error("no 'items' key provided to dndzone");var l=t.find(function(u){return!{}.hasOwnProperty.call(u,Mt)});if(l)throw new Error("missing '".concat(Mt,"' property for item ").concat(mo(l)));if(s&&!Array.isArray(s))throw new Error("dropTargetClasses should be an array but instead it is a ".concat(Tn(s),", ").concat(mo(s)));if(i&&!bu(i))throw new Error("zoneTabIndex should be a number but instead it is a ".concat(Tn(i),", ").concat(mo(i)));if(r&&!bu(r))throw new Error("zoneItemTabIndex should be a number but instead it is a ".concat(Tn(r),", ").concat(mo(r)));if(n!==void 0&&n!==!1){var h=n===!0,c=typeof n=="number"&&isFinite(n)&&n>=0;if(!h&&!c)throw new Error("delayTouchStart should be a boolean (true/false) or a non-negative number but instead it is a ".concat(Tn(n),", ").concat(mo(n)))}}function bu(e){return!isNaN(e)&&(function(t){return(t|0)===t})(parseFloat(e))}var $y=F('<button class="context-menu-trigger svelte-1nmhce7" aria-label="Actions" aria-haspopup="true">···</button>'),Xy=F('<li role="menuitem"> </li>'),Zy=F('<div class="context-menu-backdrop svelte-1nmhce7"></div> <ul class="context-menu svelte-1nmhce7" role="menu"></ul>',1),Qy=F("<!> <!>",1);function yu(e,t){_t(t,!0);let i=ur(t,"hideTrigger",3,!1),r=W(!1),s=W(null),n=W(null),o=W(null);function l(w){w.stopPropagation(),a(r)?h():(m(r,!0),requestAnimationFrame(u))}function h(){m(r,!1),m(o,null)}function c(w){m(o,w.getBoundingClientRect(),!0),m(r,!0),requestAnimationFrame(u)}function u(){var K;if(!a(n))return;const w=a(o)||((K=a(s))==null?void 0:K.getBoundingClientRect());if(!w)return;const k=a(n).getBoundingClientRect();let M=w.bottom+4,B=w.right-k.width;M+k.height>window.innerHeight-8&&(M=w.top-k.height-4),B<8&&(B=8),a(n).style.top=M+"px",a(n).style.left=B+"px"}function d(w,k){k.stopPropagation(),!w.disabled&&(h(),w.action())}function f(w){!a(r)||w.key!=="Escape"||(w.stopPropagation(),h())}function _(w){w.stopPropagation(),h()}var p={openAt:c},b=Qy();lr("keydown",p_,f);var g=kt(b);{var S=w=>{var k=$y();it(k,M=>m(s,M),()=>a(s)),le(()=>ze(k,"aria-expanded",a(r))),V("click",k,l),I(w,k)};re(g,w=>{i()||w(S)})}var x=D(g,2);{var C=w=>{var k=Zy(),M=kt(k),B=D(M,2);Zt(B,21,()=>t.items,jo,(K,j)=>{var se=Xy();let Y;var N=y(se);le(()=>{Y=tt(se,1,"context-menu-item svelte-1nmhce7",null,Y,{"context-menu-item--danger":a(j).danger,"context-menu-item--disabled":a(j).disabled}),ze(se,"tabindex",a(j).disabled?-1:0),oe(N,a(j).label)}),V("click",se,L=>d(a(j),L)),V("keydown",se,L=>L.key==="Enter"&&d(a(j),L)),I(K,se)}),it(B,K=>m(n,K),()=>a(n)),V("click",M,_),V("click",B,K=>K.stopPropagation()),I(w,k)};re(x,w=>{a(r)&&w(C)})}return I(e,b),vt(p)}pt(["click","keydown"]);var Jy=F("<span> </span>"),eS=F('<span class="collapse-count svelte-168i8d5"> </span>'),tS=F('<div class="workspace-actions svelte-168i8d5"><span class="action-btn svelte-168i8d5" title="Settings">⚙</span></div>'),iS=F('<span class="terminal-icon svelte-168i8d5">>_</span>'),rS=F("<span></span>"),sS=F('<span class="session-count-badge svelte-168i8d5"> </span>'),nS=F('<span class="diff-badge svelte-168i8d5"><span class="diff-add svelte-168i8d5"> </span> <span class="diff-del svelte-168i8d5"> </span></span>'),oS=F('<span class="secondary-branch svelte-168i8d5"> </span>'),aS=F('<span class="secondary-pr svelte-168i8d5"> </span>'),lS=F('<li><div class="session-row-primary svelte-168i8d5"><!> <span> </span> <!> <!></div> <div class="session-row-secondary svelte-168i8d5"><span class="secondary-time svelte-168i8d5"> </span> <!> <!></div> <div class="row-menu-overlay svelte-168i8d5"><!></div></li>'),hS=F('<div class="session-row-secondary svelte-168i8d5"><span class="secondary-branch svelte-168i8d5"> </span></div>'),cS=F('<li><div class="session-row-primary svelte-168i8d5"><span class="dot dot-inactive svelte-168i8d5"></span> <span class="session-name svelte-168i8d5"> </span></div> <!></li>'),dS=F('<span class="diff-badge svelte-168i8d5"><span class="diff-add svelte-168i8d5"> </span> <span class="diff-del svelte-168i8d5"> </span></span>'),uS=F('<span class="secondary-branch svelte-168i8d5"> </span>'),fS=F('<span class="secondary-pr svelte-168i8d5"> </span>'),_S=F('<li><div class="session-row-primary svelte-168i8d5"><span class="dot dot-inactive svelte-168i8d5"></span> <span class="session-name svelte-168i8d5"> </span> <!></div> <div class="session-row-secondary svelte-168i8d5"><span class="secondary-time svelte-168i8d5"> </span> <!> <!></div> <div class="row-menu-overlay svelte-168i8d5"><!></div></li>'),vS=F('<ul class="session-list svelte-168i8d5"><!> <!></ul>'),pS=F('<div><span class="add-worktree-btn svelte-168i8d5"> </span></div>'),gS=F('<div class="workspace-divider svelte-168i8d5"></div>'),mS=F('<div><div><div class="workspace-left svelte-168i8d5"><!> <span class="initial-block svelte-168i8d5"> </span> <span class="workspace-name svelte-168i8d5"> </span> <!></div> <!></div> <!> <!> <!></div>');function bS(e,t){_t(t,!0);const i=hd(),r=ad();let s=ur(t,"inactiveWorktrees",19,()=>[]),n=de(()=>[...t.sessionGroups.values()].flat());const o=["#d97757","#4ade80","#60a5fa","#a78bfa","#f472b6","#fb923c","#34d399","#f87171"];function l(Z){let _e=0;for(let A=0;A<Z.length;A++)_e=(_e<<5)-_e+Z.charCodeAt(A)|0;return o[Math.abs(_e)%o.length]??"#d97757"}let h=de(()=>l(t.workspace.name)),c=de(()=>t.workspace.name.charAt(0).toUpperCase()),u=de(()=>yb(t.workspace.path)),d=de(()=>a(n).length+s().length);function f(Z){return"status-dot status-dot--"+eh(Z)}function _(Z){return Z.type==="repo"?Z.displayName&&Z.displayName!==Z.repoName?Z.displayName:"default":Z.displayName||Z.branchName||Z.repoName||Z.id}let p=de(()=>a(n).some(Z=>eh(Z)==="attention")),b=de(()=>Qi(`new-worktree:${t.workspace.path}`)),g=de(()=>r.reorderMode),S=$e(typeof window<"u"&&window.matchMedia("(max-width: 600px)").matches),x={},C=null;function w(Z,_e){C=setTimeout(()=>{C=null;const A=x[Z];A&&A.openAt(_e)},500)}function k(){C&&(clearTimeout(C),C=null)}function M(){C&&(clearTimeout(C),C=null)}let B=de(Sb);function K(Z){return a(B),au(Z.lastActivity)}function j(Z){return a(B),au(Z.lastActivity)}async function se(Z){const _e=prompt("Rename session:",_(Z));_e&&_e.trim()&&(await fetch(`/sessions/${Z.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({displayName:_e.trim()})}),await Ft())}function Y(Z){return[{label:"Rename",action:()=>se(Z)},{label:"Kill",action:()=>{var _e;return(_e=t.onDeleteSession)==null?void 0:_e.call(t,Z.id)},danger:!0}]}function N(Z){return[{label:"Resume",action:async()=>{if(!Qi(Z.path)){En(Z.path);try{const _e=await hn({repoPath:t.workspace.path,repoName:t.workspace.name,worktreePath:Z.path,branchName:Z.branchName||Z.name});await Ft(),t.onSelectSession(_e.id)}catch{}finally{Dn(Z.path)}}}},{label:"Resume (YOLO)",action:async()=>{if(!Qi(Z.path)){En(Z.path);try{const _e=await hn({repoPath:t.workspace.path,repoName:t.workspace.name,worktreePath:Z.path,branchName:Z.branchName||Z.name,yolo:!0});await Ft(),t.onSelectSession(_e.id)}catch{}finally{Dn(Z.path)}}}},{label:"Delete Worktree",action:()=>{var _e;return(_e=t.onDeleteWorktree)==null?void 0:_e.call(t,Z)},danger:!0}]}var L=mS();let T;var O=y(L);let U;var R=y(O),E=y(R);{var J=Z=>{var _e=Jy();let A;var Q=y(_e);le(()=>{A=tt(_e,1,"collapse-chevron svelte-168i8d5",null,A,{collapsed:a(u)}),oe(Q,a(u)?"›":"⌄")}),V("click",_e,ne=>{ne.stopPropagation(),bb(t.workspace.path)}),I(Z,_e)};re(E,Z=>{a(g)||Z(J)})}var te=D(E,2);let pe;var ke=y(te),ue=D(te,2),Ce=y(ue),De=D(ue,2);{var Te=Z=>{var _e=eS(),A=y(_e);le(()=>oe(A,a(d))),I(Z,_e)};re(De,Z=>{a(u)&&a(d)>0&&!a(g)&&Z(Te)})}var ve=D(R,2);{var ye=Z=>{var _e=tS(),A=y(_e);V("click",A,Q=>{Q.stopPropagation(),t.onOpenSettings(t.workspace)}),I(Z,_e)};re(ve,Z=>{a(g)||Z(ye)})}var ge=D(O,2);{var Oe=Z=>{var _e=vS(),A=y(_e);Zt(A,17,()=>[...t.sessionGroups.entries()],([ne,ee])=>ne,(ne,ee)=>{var Se=de(()=>Xp(a(ee),2));let he=()=>a(Se)[0],Me=()=>a(Se)[1];const Le=de(()=>Me().sort((be,Ee)=>Ee.lastActivity.localeCompare(be.lastActivity))[0]),z=de(()=>Me().length),$=de(()=>he()===t.workspace.path),me=de(()=>a(z)>0),P=de(()=>Me().some(be=>eh(be)==="attention"));var H=Vr(),ce=kt(H);{var we=be=>{const Ee=de(()=>nu(a(Le).id)),Qe=de(()=>a(Ee)&&(a(Ee).additions>0||a(Ee).deletions>0));var st=lS();let Et;var Be=y(st),Fe=y(Be);{var Ye=Ve=>{var et=iS();I(Ve,et)},nt=Ve=>{var et=rS();le(ti=>tt(et,1,ti,"svelte-168i8d5"),[()=>H_(f(a(Le)))]),I(Ve,et)};re(Fe,Ve=>{a(Le).type==="terminal"?Ve(Ye):Ve(nt,!1)})}var ot=D(Fe,2);let Lt;var Si=y(ot),ei=D(ot,2);{var wi=Ve=>{var et=sS(),ti=y(et);le(()=>oe(ti,a(z))),I(Ve,et)};re(ei,Ve=>{a(z)>1&&Ve(wi)})}var Or=D(ei,2);{var Jr=Ve=>{var et=nS(),ti=y(et),Ca=y(ti),ql=D(ti,2),ka=y(ql);le(()=>{oe(Ca,`+${a(Ee).additions??""}`),oe(ka,`-${a(Ee).deletions??""}`)}),I(Ve,et)};re(Or,Ve=>{a(Qe)&&Ve(Jr)})}var Ms=D(Be,2),Sa=y(Ms),Wl=y(Sa),wa=D(Sa,2);{var Hl=Ve=>{var et=oS(),ti=y(et);le(()=>oe(ti,a(Le).branchName)),I(Ve,et)};re(wa,Ve=>{a(Le).branchName&&Ve(Hl)})}var zl=D(wa,2);{var wn=Ve=>{var et=aS(),ti=y(et);le(()=>oe(ti,`PR #${a(Ee).prNumber??""}`)),I(Ve,et)};re(zl,Ve=>{var et;(et=a(Ee))!=null&&et.prNumber&&Ve(wn)})}var Ul=D(Ms,2),Kl=y(Ul);{let Ve=de(()=>Y(a(Le)));it(yu(Kl,{get items(){return a(Ve)},get hideTrigger(){return S}}),(et,ti)=>x[ti.id]=et,et=>x==null?void 0:x[et.id],()=>[a(Le)])}le((Ve,et,ti)=>{Et=tt(st,1,"session-row svelte-168i8d5",null,Et,Ve),Lt=tt(ot,1,"session-name svelte-168i8d5",null,Lt,{bold:a(P)}),oe(Si,et),oe(Wl,ti)},[()=>({terminal:a(Le).type==="terminal",selected:Me().some(Ve=>i.activeSessionId===Ve.id),attention:a(P)}),()=>_(a(Le)),()=>K(a(Le))]),V("click",st,()=>t.onSelectSession(a(Le).id)),V("touchstart",st,Ve=>w(a(Le).id,Ve.currentTarget)),V("touchend",st,k),V("touchmove",st,M),I(be,st)},Pe=be=>{const Ee=de(()=>`repo-session:${t.workspace.path}`);var Qe=cS();let st;var Et=y(Qe),Be=D(y(Et),2),Fe=y(Be),Ye=D(Et,2);{var nt=ot=>{var Lt=hS(),Si=y(Lt),ei=y(Si);le(()=>oe(ei,t.workspace.defaultBranch)),I(ot,Lt)};re(Ye,ot=>{t.workspace.defaultBranch&&ot(nt)})}le((ot,Lt)=>{st=tt(Qe,1,"session-row inactive svelte-168i8d5",null,st,ot),oe(Fe,Lt)},[()=>({loading:Qi(a(Ee))}),()=>Qi(a(Ee))?"starting...":"default"]),V("click",Qe,async()=>{if(!Qi(a(Ee))){En(a(Ee));try{const ot=await K_({repoPath:t.workspace.path,repoName:t.workspace.name});await Ft(),t.onSelectSession(ot.id)}catch{}finally{Dn(a(Ee))}}}),I(be,Qe)};re(ce,be=>{a(me)&&a(Le)?be(we):a($)&&be(Pe,1)})}I(ne,H)});var Q=D(A,2);Zt(Q,17,s,ne=>ne.path,(ne,ee)=>{const Se=de(()=>nu(a(ee).path)),he=de(()=>a(Se)&&(a(Se).additions>0||a(Se).deletions>0));var Me=_S();let Le;var z=y(Me),$=D(y(z),2),me=y($),P=D($,2);{var H=Fe=>{var Ye=dS(),nt=y(Ye),ot=y(nt),Lt=D(nt,2),Si=y(Lt);le(()=>{oe(ot,`+${a(Se).additions??""}`),oe(Si,`-${a(Se).deletions??""}`)}),I(Fe,Ye)};re(P,Fe=>{a(he)&&Fe(H)})}var ce=D(z,2),we=y(ce),Pe=y(we),be=D(we,2);{var Ee=Fe=>{var Ye=uS(),nt=y(Ye);le(()=>oe(nt,a(ee).branchName)),I(Fe,Ye)};re(be,Fe=>{a(ee).branchName&&Fe(Ee)})}var Qe=D(be,2);{var st=Fe=>{var Ye=fS(),nt=y(Ye);le(()=>oe(nt,`PR #${a(Se).prNumber??""}`)),I(Fe,Ye)};re(Qe,Fe=>{var Ye;(Ye=a(Se))!=null&&Ye.prNumber&&Fe(st)})}var Et=D(ce,2),Be=y(Et);{let Fe=de(()=>N(a(ee)));it(yu(Be,{get items(){return a(Fe)},get hideTrigger(){return S}}),(Ye,nt)=>x[nt.path]=Ye,Ye=>x==null?void 0:x[Ye.path],()=>[a(ee)])}le((Fe,Ye,nt)=>{Le=tt(Me,1,"session-row inactive svelte-168i8d5",null,Le,Fe),oe(me,Ye),oe(Pe,nt)},[()=>({loading:Qi(a(ee).path)}),()=>Qi(a(ee).path)?"resuming...":a(ee).branchName||a(ee).displayName||a(ee).name,()=>j(a(ee))]),V("click",Me,async()=>{if(!Qi(a(ee).path)){En(a(ee).path);try{const Fe=await hn({repoPath:t.workspace.path,repoName:t.workspace.name,worktreePath:a(ee).path,branchName:a(ee).branchName||a(ee).name});await Ft(),t.onSelectSession(Fe.id)}catch{}finally{Dn(a(ee).path)}}}),V("touchstart",Me,Fe=>w(a(ee).path,Fe.currentTarget)),V("touchend",Me,k),V("touchmove",Me,M),I(ne,Me)}),I(Z,_e)};re(ge,Z=>{!a(u)&&!a(g)&&Z(Oe)})}var Ne=D(ge,2);{var Ue=Z=>{var _e=pS();let A;var Q=y(_e),ne=y(Q);le(()=>{A=tt(_e,1,"add-worktree-row svelte-168i8d5",null,A,{disabled:a(b)}),oe(ne,a(b)?"creating...":"+ new worktree")}),V("click",_e,()=>{a(b)||t.onNewWorktree(t.workspace)}),I(Z,_e)};re(Ne,Z=>{!a(u)&&!a(g)&&Z(Ue)})}var Re=D(Ne,2);{var Ze=Z=>{var _e=gS();I(Z,_e)};re(Re,Z=>{a(g)||Z(Ze)})}le(()=>{T=tt(L,1,"workspace-item svelte-168i8d5",null,T,{active:t.isActive}),U=tt(O,1,"workspace-header svelte-168i8d5",null,U,{attention:a(p),"reorder-mode":a(g)}),pe=uo(te,"",pe,{background:a(h)}),oe(ke,a(c)),oe(Ce,t.workspace.name)}),V("click",O,()=>{a(g)||t.onSelectWorkspace(t.workspace.path)}),I(e,L),vt()}pt(["click","touchstart","touchend","touchmove"]);var yS=F('<strong class="svelte-itm1qs"> </strong>'),SS=F("<span> </span>"),wS=F('<li role="option"><!> <span class="dropdown-path svelte-itm1qs"> </span></li>'),CS=F('<ul class="dropdown svelte-itm1qs" role="listbox"></ul>'),kS=F('<div class="smart-search svelte-itm1qs"><div class="input-row svelte-itm1qs"><span class="prompt svelte-itm1qs">></span> <input type="text" class="search-input svelte-itm1qs" placeholder="search workspaces..." autocomplete="off"/></div> <!></div>');function xS(e,t){_t(t,!0);let i=W(""),r=W(0),s=W(void 0),n=de(()=>{if(!a(i).trim())return[];const g=a(i).toLowerCase();return t.workspaces.filter(S=>S.name.toLowerCase().includes(g))}),o=de(()=>a(i).trim().length>0&&a(n).length>0);cr(()=>{a(n).length,m(r,0)});function l(g){m(i,g.target.value,!0)}function h(g){var S;if(g.key==="Escape"){m(i,""),(S=a(s))==null||S.blur();return}if(a(o)){if(g.key==="ArrowDown")g.preventDefault(),m(r,Math.min(a(r)+1,a(n).length-1),!0);else if(g.key==="ArrowUp")g.preventDefault(),m(r,Math.max(a(r)-1,0),!0);else if(g.key==="Enter"){g.preventDefault();const x=a(n)[a(r)];x&&c(x)}}}function c(g){var S;t.onSelect(g.path),m(i,""),(S=a(s))==null||S.blur()}function u(g,S){if(!S)return[{text:g,bold:!1}];const x=g.toLowerCase(),C=S.toLowerCase(),w=x.indexOf(C);return w===-1?[{text:g,bold:!1}]:[{text:g.slice(0,w),bold:!1},{text:g.slice(w,w+C.length),bold:!0},{text:g.slice(w+C.length),bold:!1}].filter(k=>k.text.length>0)}var d=kS(),f=y(d),_=D(y(f),2);ze(_,"spellcheck",!1),it(_,g=>m(s,g),()=>a(s));var p=D(f,2);{var b=g=>{var S=CS();Zt(S,23,()=>a(n),x=>x.path,(x,C,w)=>{var k=wS();let M;var B=y(k);Zt(B,17,()=>u(a(C).name,a(i)),jo,(se,Y)=>{var N=Vr(),L=kt(N);{var T=U=>{var R=yS(),E=y(R);le(()=>oe(E,a(Y).text)),I(U,R)},O=U=>{var R=SS(),E=y(R);le(()=>oe(E,a(Y).text)),I(U,R)};re(L,U=>{a(Y).bold?U(T):U(O,!1)})}I(se,N)});var K=D(B,2),j=y(K);le(()=>{M=tt(k,1,"dropdown-item svelte-itm1qs",null,M,{focused:a(w)===a(r)}),ze(k,"aria-selected",a(w)===a(r)),oe(j,a(C).path)}),V("click",k,()=>c(a(C))),lr("mouseenter",k,()=>{m(r,a(w),!0)}),I(x,k)}),I(g,S)};re(p,g=>{a(o)&&g(b)})}le(()=>Rm(_,a(i))),V("input",_,l),V("keydown",_,h),I(e,d),vt()}pt(["input","keydown","click"]);var ES=F('<span class="sidebar-label svelte-owj5vn">Workspaces</span>'),DS=F("<div><!></div>"),TS=F('<div class="empty-state svelte-owj5vn"><span>No workspaces</span></div>'),RS=F('<button class="done-reorder-btn svelte-owj5vn">Done reordering</button>'),PS=F('<button class="add-workspace-btn svelte-owj5vn">+ Add Workspace</button>'),MS=F('<!> <div class="workspace-list svelte-owj5vn"><!> <!></div> <!> <div class="sidebar-footer-row svelte-owj5vn"><!> <button class="settings-icon-btn svelte-owj5vn" aria-label="Settings">⚙</button></div> <div class="resize-handle svelte-owj5vn"></div>',1),AS=F('<aside><div class="sidebar-header svelte-owj5vn"><button class="collapse-btn svelte-owj5vn"> </button> <!> <button class="icon-btn svelte-owj5vn" aria-label="Close sidebar">✕</button></div> <!></aside>');function OS(e,t){_t(t,!0);const i=ad(),r=hd();let s=de(()=>i.sidebarCollapsed?db:i.sidebarWidth);function n(T){i.activeWorkspacePath=T,r.activeSessionId=null}function o(T){i.activeWorkspacePath=T,Ti()}function l(T){T.preventDefault();const O=T.clientX,U=i.sidebarWidth,R=J=>{const te=Math.min(Q_,Math.max(Z_,U+(J.clientX-O)));i.sidebarWidth=te},E=()=>{document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",E),document.body.style.cursor="",document.body.style.userSelect="",ru()};document.addEventListener("mousemove",R),document.addEventListener("mouseup",E),document.body.style.cursor="col-resize",document.body.style.userSelect="none"}function h(T){T.preventDefault(),i.sidebarWidth=X_,ru()}const c=200;let u=de(()=>r.workspaces.map(T=>({id:T.path,workspace:T}))),d=W($e([]));cr(()=>{m(d,a(u),!0)});function f(T){m(d,T.detail.items,!0)}function _(T){m(d,T.detail.items,!0);const O=a(d).map(U=>U.id);Ab(O)}function p(){pb()}let b=null;function g(){b=setTimeout(()=>{vb(),b=null},500)}function S(){b&&(clearTimeout(b),b=null)}function x(){b&&(clearTimeout(b),b=null)}var C=AS();let w,k;var M=y(C),B=y(M),K=y(B),j=D(B,2);{var se=T=>{var O=ES();I(T,O)};re(j,T=>{i.sidebarCollapsed||T(se)})}var Y=D(j,2),N=D(M,2);{var L=T=>{var O=MS(),U=kt(O);{var R=ge=>{xS(ge,{get workspaces(){return r.workspaces},onSelect:o})};re(U,ge=>{i.reorderMode||ge(R)})}var E=D(U,2),J=y(E);Zt(J,17,()=>a(d),ge=>ge.id,(ge,Oe)=>{const Ne=de(()=>a(Oe).workspace),Ue=de(()=>lv(a(Ne).path)),Re=de(()=>new Set(a(Ue).map(Q=>Q.repoPath))),Ze=de(()=>r.worktrees.filter(Q=>Q.repoPath===a(Ne).path&&Q.path.startsWith(a(Ne).path+"/")&&!a(Re).has(Q.path))),Z=de(()=>(()=>{const Q=new Map;Q.set(a(Ne).path,[]);for(const ne of a(Ue)){const ee=Q.get(ne.repoPath);ee?ee.push(ne):Q.set(ne.repoPath,[ne])}return Q})());var _e=DS(),A=y(_e);{let Q=de(()=>i.activeWorkspacePath===a(Ne).path&&!r.activeSessionId);bS(A,{get workspace(){return a(Ne)},get sessionGroups(){return a(Z)},get inactiveWorktrees(){return a(Ze)},get isActive(){return a(Q)},onSelectWorkspace:n,get onSelectSession(){return t.onSelectSession},get onNewWorktree(){return t.onNewWorktree},onOpenSettings:ne=>t.onOpenSettings(ne),onDeleteSession:ne=>{var ee;return(ee=t.onDeleteSession)==null?void 0:ee.call(t,ne)},onDeleteWorktree:ne=>{var ee;return(ee=t.onDeleteWorktree)==null?void 0:ee.call(t,ne)}})}I(ge,_e)});var te=D(J,2);{var pe=ge=>{var Oe=TS();I(ge,Oe)};re(te,ge=>{r.workspaces.length===0&&ge(pe)})}Sm(E,(ge,Oe)=>rh==null?void 0:rh(ge,Oe),()=>({items:a(d),flipDurationMs:c,type:"workspaces",dropTargetStyle:{}}));var ke=D(E,2);{var ue=ge=>{var Oe=RS();V("click",Oe,p),I(ge,Oe)};re(ke,ge=>{i.reorderMode&&ge(ue)})}var Ce=D(ke,2),De=y(Ce);{var Te=ge=>{var Oe=PS();V("click",Oe,function(...Ne){var Ue;(Ue=t.onAddWorkspace)==null||Ue.apply(this,Ne)}),I(ge,Oe)};re(De,ge=>{i.reorderMode||ge(Te)})}var ve=D(De,2),ye=D(Ce,2);lr("consider",E,f),lr("finalize",E,_),V("touchstart",E,g),V("touchend",E,S),V("touchmove",E,x),V("click",ve,()=>t.onOpenSettings()),V("mousedown",ye,l),V("dblclick",ye,h),I(T,O)};re(N,T=>{i.sidebarCollapsed||T(L)})}le(()=>{w=tt(C,1,"sidebar svelte-owj5vn",null,w,{open:i.sidebarOpen,collapsed:i.sidebarCollapsed}),k=uo(C,"",k,{width:`${a(s)??""}px`,"min-width":`${a(s)??""}px`}),ze(B,"aria-label",i.sidebarCollapsed?"Expand sidebar":"Collapse sidebar"),oe(K,i.sidebarCollapsed?"»":"«")}),V("click",B,function(...T){Jl==null||Jl.apply(this,T)}),V("click",Y,function(...T){Ti==null||Ti.apply(this,T)}),I(e,C),vt()}pt(["click","touchstart","touchend","touchmove","mousedown","dblclick"]);/**
|
|
14
14
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
15
15
|
* @license MIT
|
|
16
16
|
*
|
|
@@ -21,22 +21,22 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
21
21
|
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
22
22
|
* http://bellard.org/jslinux/
|
|
23
23
|
* Copyright (c) 2011 Fabrice Bellard
|
|
24
|
-
*/var
|
|
24
|
+
*/var Iv=Object.defineProperty,LS=Object.getOwnPropertyDescriptor,IS=(e,t)=>{for(var i in t)Iv(e,i,{get:t[i],enumerable:!0})},gt=(e,t,i,r)=>{for(var s=r>1?void 0:r?LS(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(s=(r?o(t,i,s):o(s))||s);return r&&s&&Iv(t,i,s),s},fe=(e,t)=>(i,r)=>t(i,r,e),Su="Terminal input",Vh={get:()=>Su,set:e=>Su=e},wu="Too much output to announce, navigate to rows manually to read",Gh={get:()=>wu,set:e=>wu=e};function BS(e){return e.replace(/\r?\n/g,"\r")}function NS(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function FS(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function WS(e,t,i,r){if(e.stopPropagation(),e.clipboardData){let s=e.clipboardData.getData("text/plain");Bv(s,t,i,r)}}function Bv(e,t,i,r){e=BS(e),e=NS(e,i.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function Nv(e,t,i){let r=i.getBoundingClientRect(),s=e.clientX-r.left-10,n=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${s}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function Cu(e,t,i,r,s){Nv(e,t,i),s&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function os(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Il(e,t=0,i=e.length){let r="";for(let s=t;s<i;++s){let n=e[s];n>65535?(n-=65536,r+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):r+=String.fromCharCode(n)}return r}var HS=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let r=0,s=0;if(this._interim){let n=e.charCodeAt(s++);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 n=s;n<i;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=i)return this._interim=o,r;let l=e.charCodeAt(n);56320<=l&&l<=57343?t[r++]=(o-55296)*1024+l-56320+65536:(t[r++]=o,t[r++]=l);continue}o!==65279&&(t[r++]=o)}return r}},zS=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let r=0,s,n,o,l,h=0,c=0;if(this.interim[0]){let f=!1,_=this.interim[0];_&=(_&224)===192?31:(_&240)===224?15:7;let p=0,b;for(;(b=this.interim[++p]&63)&&p<4;)_<<=6,_|=b;let g=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,S=g-p;for(;c<S;){if(c>=i)return 0;if(b=e[c++],(b&192)!==128){c--,f=!0;break}else this.interim[p++]=b,_<<=6,_|=b&63}f||(g===2?_<128?c--:t[r++]=_:g===3?_<2048||_>=55296&&_<=57343||_===65279||(t[r++]=_):_<65536||_>1114111||(t[r++]=_)),this.interim.fill(0)}let u=i-4,d=c;for(;d<i;){for(;d<u&&!((s=e[d])&128)&&!((n=e[d+1])&128)&&!((o=e[d+2])&128)&&!((l=e[d+3])&128);)t[r++]=s,t[r++]=n,t[r++]=o,t[r++]=l,d+=4;if(s=e[d++],s<128)t[r++]=s;else if((s&224)===192){if(d>=i)return this.interim[0]=s,r;if(n=e[d++],(n&192)!==128){d--;continue}if(h=(s&31)<<6|n&63,h<128){d--;continue}t[r++]=h}else if((s&240)===224){if(d>=i)return this.interim[0]=s,r;if(n=e[d++],(n&192)!==128){d--;continue}if(d>=i)return this.interim[0]=s,this.interim[1]=n,r;if(o=e[d++],(o&192)!==128){d--;continue}if(h=(s&15)<<12|(n&63)<<6|o&63,h<2048||h>=55296&&h<=57343||h===65279)continue;t[r++]=h}else if((s&248)===240){if(d>=i)return this.interim[0]=s,r;if(n=e[d++],(n&192)!==128){d--;continue}if(d>=i)return this.interim[0]=s,this.interim[1]=n,r;if(o=e[d++],(o&192)!==128){d--;continue}if(d>=i)return this.interim[0]=s,this.interim[1]=n,this.interim[2]=o,r;if(l=e[d++],(l&192)!==128){d--;continue}if(h=(s&7)<<18|(n&63)<<12|(o&63)<<6|l&63,h<65536||h>1114111)continue;t[r++]=h}}return r}},Fv="",bs=" ",pa=class Wv{constructor(){this.fg=0,this.bg=0,this.extended=new ll}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new Wv;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}},ll=class Hv{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new Hv(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Yi=class zv extends pa{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ll,this.combinedData=""}static fromCharData(t){let i=new zv;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?os(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let s=t[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(r-55296)*1024+s-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ku="di$target",$h="di$dependencies",sh=new Map;function US(e){return e[$h]||[]}function Kt(e){if(sh.has(e))return sh.get(e);let t=function(i,r,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");KS(t,i,s)};return t._id=e,sh.set(e,t),t}function KS(e,t,i){t[ku]===t?t[$h].push({id:e,index:i}):(t[$h]=[{id:e,index:i}],t[ku]=t)}var hi=Kt("BufferService"),Uv=Kt("CoreMouseService"),Sn=Kt("CoreService"),qS=Kt("CharsetService"),bd=Kt("InstantiationService"),Kv=Kt("LogService"),ci=Kt("OptionsService"),qv=Kt("OscLinkService"),jS=Kt("UnicodeService"),ga=Kt("DecorationService"),Xh=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){var u;let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let r=[],s=this._optionsService.rawOptions.linkHandler,n=new Yi,o=i.getTrimmedLength(),l=-1,h=-1,c=!1;for(let d=0;d<o;d++)if(!(h===-1&&!i.hasContent(d))){if(i.loadCell(d,n),n.hasExtendedAttrs()&&n.extended.urlId)if(h===-1){h=d,l=n.extended.urlId;continue}else c=n.extended.urlId!==l;else h!==-1&&(c=!0);if(c||h!==-1&&d===o-1){let f=(u=this._oscLinkService.getLinkData(l))==null?void 0:u.uri;if(f){let _={start:{x:h+1,y:e},end:{x:d+(!c&&d===o-1?1:0),y:e}},p=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{let b=new URL(f);["http:","https:"].includes(b.protocol)||(p=!0)}catch{p=!0}p||r.push({text:f,range:_,activate:(b,g)=>s?s.activate(b,g,_):YS(b,g),hover:(b,g)=>{var S;return(S=s==null?void 0:s.hover)==null?void 0:S.call(s,b,g,_)},leave:(b,g)=>{var S;return(S=s==null?void 0:s.leave)==null?void 0:S.call(s,b,g,_)}})}c=!1,n.hasExtendedAttrs()&&n.extended.urlId?(h=d,l=n.extended.urlId):(h=-1,l=-1)}}t(r)}};Xh=gt([fe(0,hi),fe(1,ci),fe(2,qv)],Xh);function YS(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
25
25
|
|
|
26
|
-
WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var
|
|
26
|
+
WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Bl=Kt("CharSizeService"),Zr=Kt("CoreBrowserService"),yd=Kt("MouseService"),Qr=Kt("RenderService"),VS=Kt("SelectionService"),jv=Kt("CharacterJoinerService"),_o=Kt("ThemeService"),Yv=Kt("LinkProviderService"),GS=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?xu.isErrorNoTelemetry(e)?new xu(e.message+`
|
|
27
27
|
|
|
28
28
|
`+e.stack):new Error(e.message+`
|
|
29
29
|
|
|
30
|
-
`+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)}},FS=new NS;function za(e){WS(e)||FS.onUnexpectedError(e)}var Vh="Canceled";function WS(e){return e instanceof HS?!0:e instanceof Error&&e.name===Vh&&e.message===Vh}var HS=class extends Error{constructor(){super(Vh),this.name=this.message}};function zS(e){return new Error(`Illegal argument: ${e}`)}var mu=class Gh extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Gh)return t;let i=new Gh;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Xh=class Hv extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,Hv.prototype)}};function wi(e,t=0){return e[e.length-(1+t)]}var US;(e=>{function t(n){return n<0}e.isLessThan=t;function i(n){return n<=0}e.isLessThanOrEqual=i;function r(n){return n>0}e.isGreaterThan=r;function s(n){return n===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(US||(US={}));function KS(e,t){let i=this,r=!1,s;return function(){return r||(r=!0,t||(s=e.apply(i,arguments))),s}}var zv;(e=>{function t(w){return w&&typeof w=="object"&&typeof w[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function r(){return i}e.empty=r;function*s(w){yield w}e.single=s;function n(w){return t(w)?w:s(w)}e.wrap=n;function o(w){return w||i}e.from=o;function*l(w){for(let k=w.length-1;k>=0;k--)yield w[k]}e.reverse=l;function h(w){return!w||w[Symbol.iterator]().next().done===!0}e.isEmpty=h;function c(w){return w[Symbol.iterator]().next().value}e.first=c;function u(w,k){let M=0;for(let B of w)if(k(B,M++))return!0;return!1}e.some=u;function d(w,k){for(let M of w)if(k(M))return M}e.find=d;function*f(w,k){for(let M of w)k(M)&&(yield M)}e.filter=f;function*_(w,k){let M=0;for(let B of w)yield k(B,M++)}e.map=_;function*p(w,k){let M=0;for(let B of w)yield*k(B,M++)}e.flatMap=p;function*b(...w){for(let k of w)yield*k}e.concat=b;function g(w,k,M){let B=M;for(let q of w)B=k(B,q);return B}e.reduce=g;function*S(w,k,M=w.length){for(k<0&&(k+=w.length),M<0?M+=w.length:M>w.length&&(M=w.length);k<M;k++)yield w[k]}e.slice=S;function x(w,k=Number.POSITIVE_INFINITY){let M=[];if(k===0)return[M,w];let B=w[Symbol.iterator]();for(let q=0;q<k;q++){let Y=B.next();if(Y.done)return[M,e.empty()];M.push(Y.value)}return[M,{[Symbol.iterator](){return B}}]}e.consume=x;async function C(w){let k=[];for await(let M of w)k.push(M);return Promise.resolve(k)}e.asyncToArray=C})(zv||(zv={}));function gn(e){if(zv.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(r){t.push(r)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function qS(...e){return lt(()=>gn(e))}function lt(e){return{dispose:KS(()=>{e()})}}var Uv=class Kv{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{gn(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?Kv.DISABLE_DISPOSED_WARNING||console.warn(new 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(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};Uv.DISABLE_DISPOSED_WARNING=!1;var Es=Uv,He=class{constructor(){this._store=new Es,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};He.None=Object.freeze({dispose(){}});var so=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},Ur=typeof window=="object"?window:globalThis,$h=class Zh{constructor(t){this.element=t,this.next=Zh.Undefined,this.prev=Zh.Undefined}};$h.Undefined=new $h(void 0);var ht=$h,bu=class{constructor(){this._first=ht.Undefined,this._last=ht.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ht.Undefined}clear(){let e=this._first;for(;e!==ht.Undefined;){let t=e.next;e.prev=ht.Undefined,e.next=ht.Undefined,e=t}this._first=ht.Undefined,this._last=ht.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new ht(e);if(this._first===ht.Undefined)this._first=i,this._last=i;else if(t){let s=this._last;this._last=i,i.prev=s,s.next=i}else{let s=this._first;this._first=i,i.next=s,s.prev=i}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(i))}}shift(){if(this._first!==ht.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ht.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ht.Undefined&&e.next!==ht.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ht.Undefined&&e.next===ht.Undefined?(this._first=ht.Undefined,this._last=ht.Undefined):e.next===ht.Undefined?(this._last=this._last.prev,this._last.next=ht.Undefined):e.prev===ht.Undefined&&(this._first=this._first.next,this._first.prev=ht.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ht.Undefined;)yield e.element,e=e.next}},jS=globalThis.performance&&typeof globalThis.performance.now=="function",YS=class qv{static create(t){return new qv(t)}constructor(t){this._now=jS&&t===!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._stopTime-this._startTime:this._now()-this._startTime}},Gt;(e=>{e.None=()=>He.None;function t(N,L){return d(N,()=>{},0,void 0,!0,void 0,L)}e.defer=t;function i(N){return(L,R=null,O)=>{let U=!1,T;return T=N(E=>{if(!U)return T?T.dispose():U=!0,L.call(R,E)},null,O),U&&T.dispose(),T}}e.once=i;function r(N,L,R){return c((O,U=null,T)=>N(E=>O.call(U,L(E)),null,T),R)}e.map=r;function s(N,L,R){return c((O,U=null,T)=>N(E=>{L(E),O.call(U,E)},null,T),R)}e.forEach=s;function n(N,L,R){return c((O,U=null,T)=>N(E=>L(E)&&O.call(U,E),null,T),R)}e.filter=n;function o(N){return N}e.signal=o;function l(...N){return(L,R=null,O)=>{let U=qS(...N.map(T=>T(E=>L.call(R,E))));return u(U,O)}}e.any=l;function h(N,L,R,O){let U=R;return r(N,T=>(U=L(U,T),U),O)}e.reduce=h;function c(N,L){let R,O={onWillAddFirstListener(){R=N(U.fire,U)},onDidRemoveLastListener(){R==null||R.dispose()}},U=new ae(O);return L==null||L.add(U),U.event}function u(N,L){return L instanceof Array?L.push(N):L&&L.add(N),N}function d(N,L,R=100,O=!1,U=!1,T,E){let Q,ee,ge,we=0,de,Ce={leakWarningThreshold:T,onWillAddFirstListener(){Q=N(De=>{we++,ee=L(ee,De),O&&!ge&&(Te.fire(ee),ee=void 0),de=()=>{let ve=ee;ee=void 0,ge=void 0,(!O||we>1)&&Te.fire(ve),we=0},typeof R=="number"?(clearTimeout(ge),ge=setTimeout(de,R)):ge===void 0&&(ge=0,queueMicrotask(de))})},onWillRemoveListener(){U&&we>0&&(de==null||de())},onDidRemoveLastListener(){de=void 0,Q.dispose()}},Te=new ae(Ce);return E==null||E.add(Te),Te.event}e.debounce=d;function f(N,L=0,R){return e.debounce(N,(O,U)=>O?(O.push(U),O):[U],L,void 0,!0,void 0,R)}e.accumulate=f;function _(N,L=(O,U)=>O===U,R){let O=!0,U;return n(N,T=>{let E=O||!L(T,U);return O=!1,U=T,E},R)}e.latch=_;function p(N,L,R){return[e.filter(N,L,R),e.filter(N,O=>!L(O),R)]}e.split=p;function b(N,L=!1,R=[],O){let U=R.slice(),T=N(ee=>{U?U.push(ee):Q.fire(ee)});O&&O.add(T);let E=()=>{U==null||U.forEach(ee=>Q.fire(ee)),U=null},Q=new ae({onWillAddFirstListener(){T||(T=N(ee=>Q.fire(ee)),O&&O.add(T))},onDidAddFirstListener(){U&&(L?setTimeout(E):E())},onDidRemoveLastListener(){T&&T.dispose(),T=null}});return O&&O.add(Q),Q.event}e.buffer=b;function g(N,L){return(R,O,U)=>{let T=L(new x);return N(function(E){let Q=T.evaluate(E);Q!==S&&R.call(O,Q)},void 0,U)}}e.chain=g;let S=Symbol("HaltChainable");class x{constructor(){this.steps=[]}map(L){return this.steps.push(L),this}forEach(L){return this.steps.push(R=>(L(R),R)),this}filter(L){return this.steps.push(R=>L(R)?R:S),this}reduce(L,R){let O=R;return this.steps.push(U=>(O=L(O,U),O)),this}latch(L=(R,O)=>R===O){let R=!0,O;return this.steps.push(U=>{let T=R||!L(U,O);return R=!1,O=U,T?U:S}),this}evaluate(L){for(let R of this.steps)if(L=R(L),L===S)break;return L}}function C(N,L,R=O=>O){let O=(...Q)=>E.fire(R(...Q)),U=()=>N.on(L,O),T=()=>N.removeListener(L,O),E=new ae({onWillAddFirstListener:U,onDidRemoveLastListener:T});return E.event}e.fromNodeEventEmitter=C;function w(N,L,R=O=>O){let O=(...Q)=>E.fire(R(...Q)),U=()=>N.addEventListener(L,O),T=()=>N.removeEventListener(L,O),E=new ae({onWillAddFirstListener:U,onDidRemoveLastListener:T});return E.event}e.fromDOMEventEmitter=w;function k(N){return new Promise(L=>i(N)(L))}e.toPromise=k;function M(N){let L=new ae;return N.then(R=>{L.fire(R)},()=>{L.fire(void 0)}).finally(()=>{L.dispose()}),L.event}e.fromPromise=M;function B(N,L){return N(R=>L.fire(R))}e.forward=B;function q(N,L,R){return L(R),N(O=>L(O))}e.runAndSubscribe=q;class Y{constructor(L,R){this._observable=L,this._counter=0,this._hasChanged=!1;let O={onWillAddFirstListener:()=>{L.addObserver(this)},onDidRemoveLastListener:()=>{L.removeObserver(this)}};this.emitter=new ae(O),R&&R.add(this.emitter)}beginUpdate(L){this._counter++}handlePossibleChange(L){}handleChange(L,R){this._hasChanged=!0}endUpdate(L){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function ne(N,L){return new Y(N,L).emitter.event}e.fromObservable=ne;function j(N){return(L,R,O)=>{let U=0,T=!1,E={beginUpdate(){U++},endUpdate(){U--,U===0&&(N.reportChanges(),T&&(T=!1,L.call(R)))},handlePossibleChange(){},handleChange(){T=!0}};N.addObserver(E),N.reportChanges();let Q={dispose(){N.removeObserver(E)}};return O instanceof Es?O.add(Q):Array.isArray(O)&&O.push(Q),Q}}e.fromObservableLight=j})(Gt||(Gt={}));var Qh=class Jh{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Jh._idPool++}`,Jh.all.add(this)}start(t){this._stopWatch=new YS,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Qh.all=new Set,Qh._idPool=0;var VS=Qh,GS=-1,jv=class Yv{constructor(t,i,r=(Yv._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,i){let r=this.threshold;if(r<=0||i<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[n,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(n);let h=new ZS(l,n);this._errorHandler(h)}return()=>{let n=this._stacks.get(t.value)||0;this._stacks.set(t.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[r,s]of this._stacks)(!t||i<s)&&(t=[r,s],i=s);return t}};jv._idPool=1;var XS=jv,$S=class Vv{constructor(t){this.value=t}static create(){let t=new Error;return new Vv(t.stack??"")}print(){console.warn(this.value.split(`
|
|
30
|
+
`+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)}},$S=new GS;function Ka(e){XS(e)||$S.onUnexpectedError(e)}var Zh="Canceled";function XS(e){return e instanceof ZS?!0:e instanceof Error&&e.name===Zh&&e.message===Zh}var ZS=class extends Error{constructor(){super(Zh),this.name=this.message}};function QS(e){return new Error(`Illegal argument: ${e}`)}var xu=class Qh extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Qh)return t;let i=new Qh;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Jh=class Vv extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,Vv.prototype)}};function Ci(e,t=0){return e[e.length-(1+t)]}var JS;(e=>{function t(n){return n<0}e.isLessThan=t;function i(n){return n<=0}e.isLessThanOrEqual=i;function r(n){return n>0}e.isGreaterThan=r;function s(n){return n===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(JS||(JS={}));function ew(e,t){let i=this,r=!1,s;return function(){return r||(r=!0,t||(s=e.apply(i,arguments))),s}}var Gv;(e=>{function t(w){return w&&typeof w=="object"&&typeof w[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function r(){return i}e.empty=r;function*s(w){yield w}e.single=s;function n(w){return t(w)?w:s(w)}e.wrap=n;function o(w){return w||i}e.from=o;function*l(w){for(let k=w.length-1;k>=0;k--)yield w[k]}e.reverse=l;function h(w){return!w||w[Symbol.iterator]().next().done===!0}e.isEmpty=h;function c(w){return w[Symbol.iterator]().next().value}e.first=c;function u(w,k){let M=0;for(let B of w)if(k(B,M++))return!0;return!1}e.some=u;function d(w,k){for(let M of w)if(k(M))return M}e.find=d;function*f(w,k){for(let M of w)k(M)&&(yield M)}e.filter=f;function*_(w,k){let M=0;for(let B of w)yield k(B,M++)}e.map=_;function*p(w,k){let M=0;for(let B of w)yield*k(B,M++)}e.flatMap=p;function*b(...w){for(let k of w)yield*k}e.concat=b;function g(w,k,M){let B=M;for(let K of w)B=k(B,K);return B}e.reduce=g;function*S(w,k,M=w.length){for(k<0&&(k+=w.length),M<0?M+=w.length:M>w.length&&(M=w.length);k<M;k++)yield w[k]}e.slice=S;function x(w,k=Number.POSITIVE_INFINITY){let M=[];if(k===0)return[M,w];let B=w[Symbol.iterator]();for(let K=0;K<k;K++){let j=B.next();if(j.done)return[M,e.empty()];M.push(j.value)}return[M,{[Symbol.iterator](){return B}}]}e.consume=x;async function C(w){let k=[];for await(let M of w)k.push(M);return Promise.resolve(k)}e.asyncToArray=C})(Gv||(Gv={}));function mn(e){if(Gv.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(r){t.push(r)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function tw(...e){return lt(()=>mn(e))}function lt(e){return{dispose:ew(()=>{e()})}}var $v=class Xv{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{mn(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?Xv.DISABLE_DISPOSED_WARNING||console.warn(new 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(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};$v.DISABLE_DISPOSED_WARNING=!1;var Es=$v,He=class{constructor(){this._store=new Es,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};He.None=Object.freeze({dispose(){}});var ao=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},Ur=typeof window=="object"?window:globalThis,ec=class tc{constructor(t){this.element=t,this.next=tc.Undefined,this.prev=tc.Undefined}};ec.Undefined=new ec(void 0);var ct=ec,Eu=class{constructor(){this._first=ct.Undefined,this._last=ct.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ct.Undefined}clear(){let e=this._first;for(;e!==ct.Undefined;){let t=e.next;e.prev=ct.Undefined,e.next=ct.Undefined,e=t}this._first=ct.Undefined,this._last=ct.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new ct(e);if(this._first===ct.Undefined)this._first=i,this._last=i;else if(t){let s=this._last;this._last=i,i.prev=s,s.next=i}else{let s=this._first;this._first=i,i.next=s,s.prev=i}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(i))}}shift(){if(this._first!==ct.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ct.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ct.Undefined&&e.next!==ct.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ct.Undefined&&e.next===ct.Undefined?(this._first=ct.Undefined,this._last=ct.Undefined):e.next===ct.Undefined?(this._last=this._last.prev,this._last.next=ct.Undefined):e.prev===ct.Undefined&&(this._first=this._first.next,this._first.prev=ct.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ct.Undefined;)yield e.element,e=e.next}},iw=globalThis.performance&&typeof globalThis.performance.now=="function",rw=class Zv{static create(t){return new Zv(t)}constructor(t){this._now=iw&&t===!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._stopTime-this._startTime:this._now()-this._startTime}},Xt;(e=>{e.None=()=>He.None;function t(N,L){return d(N,()=>{},0,void 0,!0,void 0,L)}e.defer=t;function i(N){return(L,T=null,O)=>{let U=!1,R;return R=N(E=>{if(!U)return R?R.dispose():U=!0,L.call(T,E)},null,O),U&&R.dispose(),R}}e.once=i;function r(N,L,T){return c((O,U=null,R)=>N(E=>O.call(U,L(E)),null,R),T)}e.map=r;function s(N,L,T){return c((O,U=null,R)=>N(E=>{L(E),O.call(U,E)},null,R),T)}e.forEach=s;function n(N,L,T){return c((O,U=null,R)=>N(E=>L(E)&&O.call(U,E),null,R),T)}e.filter=n;function o(N){return N}e.signal=o;function l(...N){return(L,T=null,O)=>{let U=tw(...N.map(R=>R(E=>L.call(T,E))));return u(U,O)}}e.any=l;function h(N,L,T,O){let U=T;return r(N,R=>(U=L(U,R),U),O)}e.reduce=h;function c(N,L){let T,O={onWillAddFirstListener(){T=N(U.fire,U)},onDidRemoveLastListener(){T==null||T.dispose()}},U=new ae(O);return L==null||L.add(U),U.event}function u(N,L){return L instanceof Array?L.push(N):L&&L.add(N),N}function d(N,L,T=100,O=!1,U=!1,R,E){let J,te,pe,ke=0,ue,Ce={leakWarningThreshold:R,onWillAddFirstListener(){J=N(Te=>{ke++,te=L(te,Te),O&&!pe&&(De.fire(te),te=void 0),ue=()=>{let ve=te;te=void 0,pe=void 0,(!O||ke>1)&&De.fire(ve),ke=0},typeof T=="number"?(clearTimeout(pe),pe=setTimeout(ue,T)):pe===void 0&&(pe=0,queueMicrotask(ue))})},onWillRemoveListener(){U&&ke>0&&(ue==null||ue())},onDidRemoveLastListener(){ue=void 0,J.dispose()}},De=new ae(Ce);return E==null||E.add(De),De.event}e.debounce=d;function f(N,L=0,T){return e.debounce(N,(O,U)=>O?(O.push(U),O):[U],L,void 0,!0,void 0,T)}e.accumulate=f;function _(N,L=(O,U)=>O===U,T){let O=!0,U;return n(N,R=>{let E=O||!L(R,U);return O=!1,U=R,E},T)}e.latch=_;function p(N,L,T){return[e.filter(N,L,T),e.filter(N,O=>!L(O),T)]}e.split=p;function b(N,L=!1,T=[],O){let U=T.slice(),R=N(te=>{U?U.push(te):J.fire(te)});O&&O.add(R);let E=()=>{U==null||U.forEach(te=>J.fire(te)),U=null},J=new ae({onWillAddFirstListener(){R||(R=N(te=>J.fire(te)),O&&O.add(R))},onDidAddFirstListener(){U&&(L?setTimeout(E):E())},onDidRemoveLastListener(){R&&R.dispose(),R=null}});return O&&O.add(J),J.event}e.buffer=b;function g(N,L){return(T,O,U)=>{let R=L(new x);return N(function(E){let J=R.evaluate(E);J!==S&&T.call(O,J)},void 0,U)}}e.chain=g;let S=Symbol("HaltChainable");class x{constructor(){this.steps=[]}map(L){return this.steps.push(L),this}forEach(L){return this.steps.push(T=>(L(T),T)),this}filter(L){return this.steps.push(T=>L(T)?T:S),this}reduce(L,T){let O=T;return this.steps.push(U=>(O=L(O,U),O)),this}latch(L=(T,O)=>T===O){let T=!0,O;return this.steps.push(U=>{let R=T||!L(U,O);return T=!1,O=U,R?U:S}),this}evaluate(L){for(let T of this.steps)if(L=T(L),L===S)break;return L}}function C(N,L,T=O=>O){let O=(...J)=>E.fire(T(...J)),U=()=>N.on(L,O),R=()=>N.removeListener(L,O),E=new ae({onWillAddFirstListener:U,onDidRemoveLastListener:R});return E.event}e.fromNodeEventEmitter=C;function w(N,L,T=O=>O){let O=(...J)=>E.fire(T(...J)),U=()=>N.addEventListener(L,O),R=()=>N.removeEventListener(L,O),E=new ae({onWillAddFirstListener:U,onDidRemoveLastListener:R});return E.event}e.fromDOMEventEmitter=w;function k(N){return new Promise(L=>i(N)(L))}e.toPromise=k;function M(N){let L=new ae;return N.then(T=>{L.fire(T)},()=>{L.fire(void 0)}).finally(()=>{L.dispose()}),L.event}e.fromPromise=M;function B(N,L){return N(T=>L.fire(T))}e.forward=B;function K(N,L,T){return L(T),N(O=>L(O))}e.runAndSubscribe=K;class j{constructor(L,T){this._observable=L,this._counter=0,this._hasChanged=!1;let O={onWillAddFirstListener:()=>{L.addObserver(this)},onDidRemoveLastListener:()=>{L.removeObserver(this)}};this.emitter=new ae(O),T&&T.add(this.emitter)}beginUpdate(L){this._counter++}handlePossibleChange(L){}handleChange(L,T){this._hasChanged=!0}endUpdate(L){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function se(N,L){return new j(N,L).emitter.event}e.fromObservable=se;function Y(N){return(L,T,O)=>{let U=0,R=!1,E={beginUpdate(){U++},endUpdate(){U--,U===0&&(N.reportChanges(),R&&(R=!1,L.call(T)))},handlePossibleChange(){},handleChange(){R=!0}};N.addObserver(E),N.reportChanges();let J={dispose(){N.removeObserver(E)}};return O instanceof Es?O.add(J):Array.isArray(O)&&O.push(J),J}}e.fromObservableLight=Y})(Xt||(Xt={}));var ic=class rc{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${rc._idPool++}`,rc.all.add(this)}start(t){this._stopWatch=new rw,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};ic.all=new Set,ic._idPool=0;var sw=ic,nw=-1,Qv=class Jv{constructor(t,i,r=(Jv._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,i){let r=this.threshold;if(r<=0||i<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[n,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(n);let h=new lw(l,n);this._errorHandler(h)}return()=>{let n=this._stacks.get(t.value)||0;this._stacks.set(t.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[r,s]of this._stacks)(!t||i<s)&&(t=[r,s],i=s);return t}};Qv._idPool=1;var ow=Qv,aw=class ep{constructor(t){this.value=t}static create(){let t=new Error;return new ep(t.stack??"")}print(){console.warn(this.value.split(`
|
|
31
31
|
`).slice(2).join(`
|
|
32
|
-
`))}},ZS=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},QS=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},JS=0,eh=class{constructor(e){this.value=e,this.id=JS++}},ew=2,tw,ae=class{constructor(e){var t,i,r,s;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new XS((e==null?void 0:e.onListenerError)??za,((i=this._options)==null?void 0:i.leakWarningThreshold)??GS):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new VS(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var e,t,i,r;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||i.call(t),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(e,t,i)=>{var o,l,h,c,u;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],_=new QS(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(((o=this._options)==null?void 0:o.onListenerError)||za)(_),He.None}if(this._disposed)return He.None;t&&(e=e.bind(t));let r=new eh(e),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=$S.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof eh?(this._deliveryQueue??(this._deliveryQueue=new iw),this._listeners=[this._listeners,r]):this._listeners.push(r):((h=(l=this._options)==null?void 0:l.onWillAddFirstListener)==null||h.call(l,this),this._listeners=r,(u=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null||u.call(c,this)),this._size++;let n=lt(()=>{s==null||s(),this._removeListener(r)});return i instanceof Es?i.add(n):Array.isArray(i)&&i.push(n),n}),this._event}_removeListener(e){var s,n,o,l;if((n=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||n.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(l=(o=this._options)==null?void 0:o.onDidRemoveLastListener)==null||l.call(o,this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*ew<=t.length){let h=0;for(let c=0;c<t.length;c++)t[c]?t[h++]=t[c]:r&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){var r;if(!e)return;let i=((r=this._options)==null?void 0:r.onListenerError)||za;if(!i){e.value(t);return}try{e.value(t)}catch(s){i(s)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,i,r,s;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof eh)this._deliver(this._listeners,e);else{let n=this._deliveryQueue;n.enqueue(this,e,this._listeners.length),this._deliverQueue(n)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},iw=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},ec=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ae,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ae,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let r=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let r=this.getWindowId(i);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};ec.INSTANCE=new ec;var gd=ec;function rw(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}gd.INSTANCE.onDidChangeZoomLevel;function sw(e){return gd.INSTANCE.getZoomFactor(e)}gd.INSTANCE.onDidChangeFullscreen;var uo=typeof navigator=="object"?navigator.userAgent:"",tc=uo.indexOf("Firefox")>=0,nw=uo.indexOf("AppleWebKit")>=0,md=uo.indexOf("Chrome")>=0,ow=!md&&uo.indexOf("Safari")>=0;uo.indexOf("Electron/")>=0;uo.indexOf("Android")>=0;var th=!1;if(typeof Ur.matchMedia=="function"){let e=Ur.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Ur.matchMedia("(display-mode: fullscreen)");th=e.matches,rw(Ur,e,({matches:i})=>{th&&t.matches||(th=i)})}var En="en",ic=!1,rc=!1,Ua=!1,Gv=!1,Ra,Ka=En,yu=En,aw,Xi,dn=globalThis,jt,Cf;typeof dn.vscode<"u"&&typeof dn.vscode.process<"u"?jt=dn.vscode.process:typeof process<"u"&&typeof((Cf=process==null?void 0:process.versions)==null?void 0:Cf.node)=="string"&&(jt=process);var kf,lw=typeof((kf=jt==null?void 0:jt.versions)==null?void 0:kf.electron)=="string",hw=lw&&(jt==null?void 0:jt.type)==="renderer",xf;if(typeof jt=="object"){ic=jt.platform==="win32",rc=jt.platform==="darwin",Ua=jt.platform==="linux",Ua&&jt.env.SNAP&&jt.env.SNAP_REVISION,jt.env.CI||jt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Ra=En,Ka=En;let e=jt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Ra=t.userLocale,yu=t.osLocale,Ka=t.resolvedLanguage||En,aw=(xf=t.languagePack)==null?void 0:xf.translationsConfigFile}catch{}Gv=!0}else typeof navigator=="object"&&!hw?(Xi=navigator.userAgent,ic=Xi.indexOf("Windows")>=0,rc=Xi.indexOf("Macintosh")>=0,(Xi.indexOf("Macintosh")>=0||Xi.indexOf("iPad")>=0||Xi.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Ua=Xi.indexOf("Linux")>=0,(Xi==null?void 0:Xi.indexOf("Mobi"))>=0,Ka=globalThis._VSCODE_NLS_LANGUAGE||En,Ra=navigator.language.toLowerCase(),yu=Ra):console.error("Unable to resolve platform.");var Xv=ic,Tr=rc,cw=Ua,Su=Gv,Mr=Xi,ts=Ka,dw;(e=>{function t(){return ts}e.value=t;function i(){return ts.length===2?ts==="en":ts.length>=3?ts[0]==="e"&&ts[1]==="n"&&ts[2]==="-":!1}e.isDefaultVariant=i;function r(){return ts==="en"}e.isDefault=r})(dw||(dw={}));var uw=typeof dn.postMessage=="function"&&!dn.importScripts;(()=>{if(uw){let e=[];dn.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let r=0,s=e.length;r<s;r++){let n=e[r];if(n.id===i.data.vscodeScheduleAsyncWork){e.splice(r,1),n.callback();return}}});let t=0;return i=>{let r=++t;e.push({id:r,callback:i}),dn.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var fw=!!(Mr&&Mr.indexOf("Chrome")>=0);Mr&&Mr.indexOf("Firefox")>=0;!fw&&Mr&&Mr.indexOf("Safari")>=0;Mr&&Mr.indexOf("Edg/")>=0;Mr&&Mr.indexOf("Android")>=0;var Sn=typeof navigator=="object"?navigator:{};Su||document.queryCommandSupported&&document.queryCommandSupported("copy")||Sn&&Sn.clipboard&&Sn.clipboard.writeText,Su||Sn&&Sn.clipboard&&Sn.clipboard.readText;var bd=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}},ih=new bd,wu=new bd,Cu=new bd,_w=new Array(230),$v;(e=>{function t(l){return ih.keyCodeToStr(l)}e.toString=t;function i(l){return ih.strToKeyCode(l)}e.fromString=i;function r(l){return wu.keyCodeToStr(l)}e.toUserSettingsUS=r;function s(l){return Cu.keyCodeToStr(l)}e.toUserSettingsGeneral=s;function n(l){return wu.strToKeyCode(l)||Cu.strToKeyCode(l)}e.fromUserSettings=n;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return ih.keyCodeToStr(l)}e.toElectronAccelerator=o})($v||($v={}));var vw=class Zv{constructor(t,i,r,s,n){this.ctrlKey=t,this.shiftKey=i,this.altKey=r,this.metaKey=s,this.keyCode=n}equals(t){return t instanceof Zv&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",r=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${t}${i}${r}${s}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new pw([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},pw=class{constructor(e){if(e.length===0)throw zS("chords");this.chords=e}getHashCode(){let e="";for(let t=0,i=this.chords.length;t<i;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 gw(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return $v.fromString(i)}let t=e.keyCode;if(t===3)return 7;if(tc)switch(t){case 59:return 85;case 60:if(cw)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Tr)return 57;break}else if(nw&&(Tr&&t===93||!Tr&&t===92))return 57;return _w[t]||0}var mw=Tr?256:2048,bw=512,yw=1024,Sw=Tr?2048:256,ku=class{constructor(e){var i;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=(i=t.getModifierState)==null?void 0:i.call(t,"AltGraph"),this.keyCode=gw(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|=mw),this.altKey&&(t|=bw),this.shiftKey&&(t|=yw),this.metaKey&&(t|=Sw),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new vw(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},xu=new WeakMap;function ww(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,i=e.parent.location;if(t.origin!=="null"&&i.origin!=="null"&&t.origin!==i.origin)return null}catch{return null}return e.parent}var Cw=class{static getSameOriginWindowChain(e){let t=xu.get(e);if(!t){t=[],xu.set(e,t);let i=e,r;do r=ww(i),r?t.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):t.push({window:new WeakRef(i),iframeElement:null}),i=r;while(i)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,r=0,s=this.getSameOriginWindowChain(e);for(let n of s){let o=n.window.deref();if(i+=(o==null?void 0:o.scrollY)??0,r+=(o==null?void 0:o.scrollX)??0,o===t||!n.iframeElement)break;let l=n.iframeElement.getBoundingClientRect();i+=l.top,r+=l.left}return{top:i,left:r}}},Pa=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 i=Cw.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Eu=class{constructor(e,t=0,i=0){var s;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=i,this.deltaX=t;let r=!1;if(md){let n=navigator.userAgent.match(/Chrome\/(\d+)/);r=(n?parseInt(n[1]):123)<=122}if(e){let n=e,o=e,l=((s=e.view)==null?void 0:s.devicePixelRatio)||1;if(typeof n.wheelDeltaY<"u")r?this.deltaY=n.wheelDeltaY/(120*l):this.deltaY=n.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?tc&&!Tr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof n.wheelDeltaX<"u")ow&&Xv?this.deltaX=-(n.wheelDeltaX/120):r?this.deltaX=n.wheelDeltaX/(120*l):this.deltaX=n.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?tc&&!Tr?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*l):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},Qv=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),kw;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof xw?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Gt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Qv})})(kw||(kw={}));var xw=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?Qv:(this._emitter||(this._emitter=new ae),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},yd=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 Xh("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Xh("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Ew=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,i=globalThis){if(this.isDisposed)throw new Xh("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=i.setInterval(()=>{e()},t);this.disposable=lt(()=>{i.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Dw;(e=>{async function t(r){let s,n=await Promise.all(r.map(o=>o.then(l=>l,l=>{s||(s=l)})));if(typeof s<"u")throw s;return n}e.settled=t;function i(r){return new Promise(async(s,n)=>{try{await r(s,n)}catch(o){n(o)}})}e.withAsyncBody=i})(Dw||(Dw={}));var Du=class Ai{static fromArray(t){return new Ai(i=>{i.emitMany(t)})}static fromPromise(t){return new Ai(async i=>{i.emitMany(await t)})}static fromPromises(t){return new Ai(async i=>{await Promise.all(t.map(async r=>i.emitOne(await r)))})}static merge(t){return new Ai(async i=>{await Promise.all(t.map(async r=>{for await(let s of r)i.emitOne(s)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new ae,queueMicrotask(async()=>{let r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Gt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var i;return(i=this._onReturn)==null||i.call(this),{done:!0,value:void 0}}}}static map(t,i){return new Ai(async r=>{for await(let s of t)r.emitOne(i(s))})}map(t){return Ai.map(this,t)}static filter(t,i){return new Ai(async r=>{for await(let s of t)i(s)&&r.emitOne(s)})}filter(t){return Ai.filter(this,t)}static coalesce(t){return Ai.filter(t,i=>!!i)}coalesce(){return Ai.coalesce(this)}static async toPromise(t){let i=[];for await(let r of t)i.push(r);return i}toPromise(){return Ai.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Du.EMPTY=Du.fromArray([]);var{getWindow:Er,getWindowId:Tw,onDidRegisterWindow:Rw}=(function(){let e=new Map,t={window:Ur,disposables:new Es};e.set(Ur.vscodeWindowId,t);let i=new ae,r=new ae,s=new ae;function n(o,l){return(typeof o=="number"?e.get(o):void 0)??(l?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(o){if(e.has(o.vscodeWindowId))return He.None;let l=new Es,h={window:o,disposables:l.add(new Es)};return e.set(o.vscodeWindowId,h),l.add(lt(()=>{e.delete(o.vscodeWindowId),r.fire(o)})),l.add(Ae(o,It.BEFORE_UNLOAD,()=>{s.fire(o)})),i.fire(h),l},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:n,getWindow(o){var c;let l=o;if((c=l==null?void 0:l.ownerDocument)!=null&&c.defaultView)return l.ownerDocument.defaultView.window;let h=o;return h!=null&&h.view?h.view.window:Ur},getDocument(o){return Er(o).document}}})(),Pw=class{constructor(e,t,i,r){this._node=e,this._type=t,this._handler=i,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,this._handler=null)}};function Ae(e,t,i,r){return new Pw(e,t,i,r)}var Tu=function(e,t,i,r){return Ae(e,t,i,r)},Sd,Mw=class extends Ew{constructor(e){super(),this.defaultTarget=e&&Er(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},Ru=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){za(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,r=new Map,s=n=>{i.set(n,!1);let o=e.get(n)??[];for(t.set(n,o),e.set(n,[]),r.set(n,!0);o.length>0;)o.sort(Ru.sort),o.shift().execute();r.set(n,!1)};Sd=(n,o,l=0)=>{let h=Tw(n),c=new Ru(o,l),u=e.get(h);return u||(u=[],e.set(h,u)),u.push(c),i.get(h)||(i.set(h,!0),n.requestAnimationFrame(()=>s(h))),c}})();function Aw(e){let t=e.getBoundingClientRect(),i=Er(e);return{left:t.left+i.scrollX,top:t.top+i.scrollY,width:t.width,height:t.height}}var It={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},Ow=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=ci(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=ci(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=ci(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=ci(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=ci(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=ci(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=ci(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=ci(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=ci(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=ci(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=ci(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=ci(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=ci(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=ci(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 ci(e){return typeof e=="number"?`${e}px`:e}function Wo(e){return new Ow(e)}var Jv=class{constructor(){this._hooks=new Es,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 i=this._onStopCallback;this._onStopCallback=null,e&&i&&i(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,i,r,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=s;let n=e;try{e.setPointerCapture(t),this._hooks.add(lt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{n=Er(e)}this._hooks.add(Ae(n,It.POINTER_MOVE,o=>{if(o.buttons!==i){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(Ae(n,It.POINTER_UP,o=>this.stopMonitoring(!0)))}};function Lw(e,t,i){let r=null,s=null;if(typeof i.value=="function"?(r="value",s=i.value,s.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(r="get",s=i.get),!s)throw new Error("not supported");let n=`$memoize$${t}`;i[r]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,o)}),this[n]}}var pr;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(pr||(pr={}));var xo=class ei extends He{constructor(){super(),this.dispatched=!1,this.targets=new bu,this.ignoreTargets=new bu,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Gt.runAndSubscribe(Rw,({window:t,disposables:i})=>{i.add(Ae(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),i.add(Ae(t.document,"touchend",r=>this.onTouchEnd(t,r))),i.add(Ae(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:Ur,disposables:this._store}))}static addTarget(t){if(!ei.isTouchDevice())return He.None;ei.INSTANCE||(ei.INSTANCE=new ei);let i=ei.INSTANCE.targets.push(t);return lt(i)}static ignoreTarget(t){if(!ei.isTouchDevice())return He.None;ei.INSTANCE||(ei.INSTANCE=new ei);let i=ei.INSTANCE.ignoreTargets.push(t);return lt(i)}static isTouchDevice(){return"ontouchstart"in Ur||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,s=t.targetTouches.length;r<s;r++){let n=t.targetTouches.item(r);this.activeTouches[n.identifier]={id:n.identifier,initialTarget:n.target,initialTimeStamp:i,initialPageX:n.pageX,initialPageY:n.pageY,rollingTimestamps:[i],rollingPageX:[n.pageX],rollingPageY:[n.pageY]};let o=this.newGestureEvent(pr.Start,n.target);o.pageX=n.pageX,o.pageY=n.pageY,this.dispatchEvent(o)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,i){let r=Date.now(),s=Object.keys(this.activeTouches).length;for(let n=0,o=i.changedTouches.length;n<o;n++){let l=i.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let h=this.activeTouches[l.identifier],c=Date.now()-h.initialTimeStamp;if(c<ei.HOLD_DELAY&&Math.abs(h.initialPageX-wi(h.rollingPageX))<30&&Math.abs(h.initialPageY-wi(h.rollingPageY))<30){let u=this.newGestureEvent(pr.Tap,h.initialTarget);u.pageX=wi(h.rollingPageX),u.pageY=wi(h.rollingPageY),this.dispatchEvent(u)}else if(c>=ei.HOLD_DELAY&&Math.abs(h.initialPageX-wi(h.rollingPageX))<30&&Math.abs(h.initialPageY-wi(h.rollingPageY))<30){let u=this.newGestureEvent(pr.Contextmenu,h.initialTarget);u.pageX=wi(h.rollingPageX),u.pageY=wi(h.rollingPageY),this.dispatchEvent(u)}else if(s===1){let u=wi(h.rollingPageX),d=wi(h.rollingPageY),f=wi(h.rollingTimestamps)-h.rollingTimestamps[0],_=u-h.rollingPageX[0],p=d-h.rollingPageY[0],b=[...this.targets].filter(g=>h.initialTarget instanceof Node&&g.contains(h.initialTarget));this.inertia(t,b,r,Math.abs(_)/f,_>0?1:-1,u,Math.abs(p)/f,p>0?1:-1,d)}this.dispatchEvent(this.newGestureEvent(pr.End,h.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,i){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=i,r.tapCount=0,r}dispatchEvent(t){if(t.type===pr.Tap){let i=new Date().getTime(),r=0;i-this._lastSetTapCountTime>ei.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=i,t.tapCount=r}else(t.type===pr.Change||t.type===pr.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let i=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let s=0,n=t.initialTarget;for(;n&&n!==r;)s++,n=n.parentElement;i.push([s,r])}i.sort((r,s)=>r[0]-s[0]);for(let[r,s]of i)s.dispatchEvent(t),this.dispatched=!0}}inertia(t,i,r,s,n,o,l,h,c){this.handle=Sd(t,()=>{let u=Date.now(),d=u-r,f=0,_=0,p=!0;s+=ei.SCROLL_FRICTION*d,l+=ei.SCROLL_FRICTION*d,s>0&&(p=!1,f=n*s*d),l>0&&(p=!1,_=h*l*d);let b=this.newGestureEvent(pr.Change);b.translationX=f,b.translationY=_,i.forEach(g=>g.dispatchEvent(b)),p||this.inertia(t,i,u,s,n,o+f,l,h,c+_)})}onTouchMove(t){let i=Date.now();for(let r=0,s=t.changedTouches.length;r<s;r++){let n=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(n.identifier))){console.warn("end of an UNKNOWN touch",n);continue}let o=this.activeTouches[n.identifier],l=this.newGestureEvent(pr.Change,o.initialTarget);l.translationX=n.pageX-wi(o.rollingPageX),l.translationY=n.pageY-wi(o.rollingPageY),l.pageX=n.pageX,l.pageY=n.pageY,this.dispatchEvent(l),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(n.pageX),o.rollingPageY.push(n.pageY),o.rollingTimestamps.push(i)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};xo.SCROLL_FRICTION=-.005,xo.HOLD_DELAY=700,xo.CLEAR_TAP_COUNT_TIME=400,pt([Lw],xo,"isTouchDevice",1);var Iw=xo,wd=class extends He{onclick(e,t){this._register(Ae(e,It.CLICK,i=>t(new Pa(Er(e),i))))}onmousedown(e,t){this._register(Ae(e,It.MOUSE_DOWN,i=>t(new Pa(Er(e),i))))}onmouseover(e,t){this._register(Ae(e,It.MOUSE_OVER,i=>t(new Pa(Er(e),i))))}onmouseleave(e,t){this._register(Ae(e,It.MOUSE_LEAVE,i=>t(new Pa(Er(e),i))))}onkeydown(e,t){this._register(Ae(e,It.KEY_DOWN,i=>t(new ku(i))))}onkeyup(e,t){this._register(Ae(e,It.KEY_UP,i=>t(new ku(i))))}oninput(e,t){this._register(Ae(e,It.INPUT,t))}onblur(e,t){this._register(Ae(e,It.BLUR,t))}onfocus(e,t){this._register(Ae(e,It.FOCUS,t))}onchange(e,t){this._register(Ae(e,It.CHANGE,t))}ignoreGesture(e){return Iw.ignoreTarget(e)}},Pu=11,Bw=class extends wd{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=Pu+"px",this.domNode.style.height=Pu+"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 Jv),this._register(Tu(this.bgDomNode,It.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Tu(this.domNode,It.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new Mw),this._pointerdownScheduleRepeatTimer=this._register(new yd)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Er(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},Nw=class sc{constructor(t,i,r,s,n,o,l){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,r=r|0,s=s|0,n=n|0,o=o|0,l=l|0),this.rawScrollLeft=s,this.rawScrollTop=l,i<0&&(i=0),s+i>r&&(s=r-i),s<0&&(s=0),n<0&&(n=0),l+n>o&&(l=o-n),l<0&&(l=0),this.width=i,this.scrollWidth=r,this.scrollLeft=s,this.height=n,this.scrollHeight=o,this.scrollTop=l}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,i){return new sc(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new sc(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(t,i){let r=this.width!==t.width,s=this.scrollWidth!==t.scrollWidth,n=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,l=this.scrollHeight!==t.scrollHeight,h=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:i,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:s,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:h}}},Fw=class extends He{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Nw(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var r;let i=this._state.withScrollDimensions(e,t);this._setState(i,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.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(),this._smoothScrolling=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 i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let r;t?r=new Au(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let i=this._state.withScrollPosition(e);this._smoothScrolling=Au.start(this._state,i,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 i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}},Mu=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function rh(e,t){let i=t-e;return function(r){return e+i*zw(r)}}function Ww(e,t,i){return function(r){return r<i?e(r/i):t((r-i)/(1-i))}}var Au=class nc{constructor(t,i,r,s){this.from=t,this.to=i,this.duration=s,this.startTime=r,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(t,i,r){if(Math.abs(t-i)>2.5*r){let s,n;return t<i?(s=t+.75*r,n=i-.75*r):(s=t-.75*r,n=i+.75*r),Ww(rh(t,s),rh(n,i),.33)}return rh(t,i)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let i=(t-this.startTime)/this.duration;if(i<1){let r=this.scrollLeft(i),s=this.scrollTop(i);return new Mu(r,s,!1)}return new Mu(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,i,r){return nc.start(t,i,r)}static start(t,i,r){r=r+10;let s=Date.now()-10;return new nc(t,i,s,r)}};function Hw(e){return Math.pow(e,3)}function zw(e){return 1-Hw(1-e)}var Uw=class extends He{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new yd)}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(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},Kw=140,ep=class extends wd{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 Uw(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Jv),this._shouldRender=!0,this.domNode=Wo(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(Ae(this.domNode.domNode,It.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new Bw(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,r){this.slider=Wo(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof i=="number"&&this.slider.setWidth(i),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Ae(this.slider.domNode,It.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.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,i=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);i<=s&&s<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,i=e.offsetY;else{let s=Aw(this.domNode.domNode);t=e.pageX-s.left,i=e.pageY-s.top}let r=this._pointerDownRelativePosition(t,i);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),i=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{let n=this._sliderOrthogonalPointerPosition(s),o=Math.abs(n-i);if(Xv&&o>Kw){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let l=this._sliderPointerPosition(s)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(l))},()=>{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()}},tp=class oc{constructor(t,i,r,s,n,o){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=s,this._scrollSize=n,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new oc(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let i=Math.round(t);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(t){let i=Math.round(t);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let i=Math.round(t);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,i,r,s,n){let o=Math.max(0,r-t),l=Math.max(0,o-2*i),h=s>0&&s>r;if(!h)return{computedAvailableSize:Math.round(o),computedIsNeeded:h,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(r*l/s))),u=(l-c)/(s-r),d=n*u;return{computedAvailableSize:Math.round(o),computedIsNeeded:h,computedSliderSize:Math.round(c),computedSliderRatio:u,computedSliderPosition:Math.round(d)}}_refreshComputedValues(){let t=oc._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(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize,r=this._scrollPosition;return i<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let i=this._computedSliderPosition+t;return Math.round(i/this._computedSliderRatio)}},qw=class extends ep{constructor(e,t,i){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new tp(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,s.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new 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}},jw=class extends ep{constructor(e,t,i){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new tp(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,s.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new 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}},Yw=500,Ou=50,Vw=class{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}},ac=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,i=0,r=1,s=this._rear;do{let n=s===this._front?t:Math.pow(2,-r);if(t-=n,i+=this._memory[s].score*n,s===this._front)break;s=(this._capacity+s-1)%this._capacity,r++}while(!0);return i<=.5}acceptStandardWheelEvent(t){if(md){let i=Er(t.browserEvent),r=sw(i);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,i,r){let s=null,n=new Vw(t,i,r);this._front===-1&&this._rear===-1?(this._memory[0]=n,this._front=0,this._rear=0):(s=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]=n),n.score=this._computeScore(n,s)}_computeScore(t,i){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),i){let s=Math.abs(t.deltaX),n=Math.abs(t.deltaY),o=Math.abs(i.deltaX),l=Math.abs(i.deltaY),h=Math.max(Math.min(s,o),1),c=Math.max(Math.min(n,l),1),u=Math.max(s,o),d=Math.max(n,l);u%h===0&&d%c===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};ac.INSTANCE=new ac;var Gw=ac,Xw=class extends wd{constructor(e,t,i){super(),this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ae),this.onWillScroll=this._onWillScroll.event,this._options=Zw(t),this._scrollable=i,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));let r={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new jw(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new qw(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=Wo(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Wo(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Wo(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,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new yd),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=gn(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,Tr&&(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 Eu(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=gn(this._mouseWheelToDispose),e)){let t=i=>{this._onMouseWheel(new Eu(i))};this._mouseWheelToDispose.push(Ae(this._listenOnDomNode,It.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var s;if((s=e.browserEvent)!=null&&s.defaultPrevented)return;let t=Gw.INSTANCE;t.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let n=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+n===0?o=n=0:Math.abs(n)>=Math.abs(o)?o=0:n=0),this._options.flipAxes&&([n,o]=[o,n]);let l=!Tr&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!o&&(o=n,n=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,n=n*this._options.fastScrollSensitivity);let h=this._scrollable.getFutureScrollPosition(),c={};if(n){let u=Ou*n,d=h.scrollTop-(u<0?Math.floor(u):Math.ceil(u));this._verticalScrollbar.writeScrollPosition(c,d)}if(o){let u=Ou*o,d=h.scrollLeft-(u<0?Math.floor(u):Math.ceil(u));this._horizontalScrollbar.writeScrollPosition(c,d)}c=this._scrollable.validateScrollPosition(c),(h.scrollLeft!==c.scrollLeft||h.scrollTop!==c.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),i=!0)}let r=i;!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 new 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,i=e.scrollLeft>0,r=i?" left":"",s=t?" top":"",n=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${s}${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(),Yw)}},$w=class extends Xw{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Zw(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,Tr&&(t.className+=" mac"),t}var lc=class extends He{constructor(e,t,i,r,s,n,o,l){super(),this._bufferService=i,this._optionsService=o,this._renderService=l,this._onRequestScrollLines=this._register(new ae),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let h=this._register(new Fw({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>Sd(r.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{h.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new $w(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},h)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Gt.runAndSubscribe(n.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=n.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(lt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(lt(()=>this._styleElement.remove())),this._register(Gt.runAndSubscribe(n.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${n.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${n.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${n.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
33
|
-
`)})),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(c=>this._handleScroll(c)))}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(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.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),i=t-this._bufferService.buffer.ydisp;i!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}};lc=pt([_e(2,li),_e(3,Zr),_e(4,Iv),_e(5,co),_e(6,hi),_e(7,Qr)],lc);var hc=class extends He{constructor(e,t,i,r,s){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=r,this._renderService=s,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(n=>this._removeDecoration(n))),this._register(lt(()=>{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){var r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.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 i=e.options.x??0;return i&&i>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 i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;let i=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=i?`${i*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=i?`${i*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};hc=pt([_e(1,li),_e(2,Zr),_e(3,_a),_e(4,Qr)],hc);var Qw=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,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},_r={full:0,left:0,center:0,right:0},is={full:0,left:0,center:0,right:0},go={full:0,left:0,center:0,right:0},al=class extends He{constructor(e,t,i,r,s,n,o,l){var c;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=r,this._renderService=s,this._optionsService=n,this._themeService=o,this._coreBrowserService=l,this._colorZoneStore=new Qw,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(),(c=this._viewportElement.parentElement)==null||c.insertBefore(this._canvas,this._viewportElement),this._register(lt(()=>{var u;return(u=this._canvas)==null?void 0:u.remove()}));let h=this._canvas.getContext("2d");if(h)this._ctx=h;else throw new 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(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);is.full=this._canvas.width,is.left=e,is.center=t,is.right=e,this._refreshDrawHeightConstants(),go.full=1,go.left=1,go.center=1+is.left,go.right=1+is.left+is.center}_refreshDrawHeightConstants(){_r.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);_r.left=t,_r.center=t,_r.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_r.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_r.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_r.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_r.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 t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);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(go[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-_r[e.position||"full"]/2),is[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+_r[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}))}};al=pt([_e(2,li),_e(3,_a),_e(4,Qr),_e(5,hi),_e(6,co),_e(7,Zr)],al);var K;(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=`
|
|
34
|
-
`,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=""))(K||(K={}));var qa;(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=""))(qa||(qa={}));var ip;(e=>e.ST=`${K.ESC}\\`)(ip||(ip={}));var cc=class{constructor(e,t,i,r,s,n){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=r,this._coreService=s,this._renderService=n,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 t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let i;t.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(t.start,this._compositionPosition.start):i=this._textarea.value.substring(t.start),i.length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.length<e.length?this._coreService.triggerDataEvent(`${K.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 t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),i=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let n=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(n.width,1)+"px",this._textarea.style.height=Math.max(n.height,1)+"px",this._textarea.style.lineHeight=n.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};cc=pt([_e(2,li),_e(3,hi),_e(4,yn),_e(5,Qr)],cc);var Nt=0,Ft=0,Wt=0,ut=0,Lu={css:"#00000000",rgba:0},Ct;(e=>{function t(s,n,o,l){return l!==void 0?`#${Os(s)}${Os(n)}${Os(o)}${Os(l)}`:`#${Os(s)}${Os(n)}${Os(o)}`}e.toCss=t;function i(s,n,o,l=255){return(s<<24|n<<16|o<<8|l)>>>0}e.toRgba=i;function r(s,n,o,l){return{css:e.toCss(s,n,o,l),rgba:e.toRgba(s,n,o,l)}}e.toColor=r})(Ct||(Ct={}));var ot;(e=>{function t(h,c){if(ut=(c.rgba&255)/255,ut===1)return{css:c.css,rgba:c.rgba};let u=c.rgba>>24&255,d=c.rgba>>16&255,f=c.rgba>>8&255,_=h.rgba>>24&255,p=h.rgba>>16&255,b=h.rgba>>8&255;Nt=_+Math.round((u-_)*ut),Ft=p+Math.round((d-p)*ut),Wt=b+Math.round((f-b)*ut);let g=Ct.toCss(Nt,Ft,Wt),S=Ct.toRgba(Nt,Ft,Wt);return{css:g,rgba:S}}e.blend=t;function i(h){return(h.rgba&255)===255}e.isOpaque=i;function r(h,c,u){let d=ja.ensureContrastRatio(h.rgba,c.rgba,u);if(d)return Ct.toColor(d>>24&255,d>>16&255,d>>8&255)}e.ensureContrastRatio=r;function s(h){let c=(h.rgba|255)>>>0;return[Nt,Ft,Wt]=ja.toChannels(c),{css:Ct.toCss(Nt,Ft,Wt),rgba:c}}e.opaque=s;function n(h,c){return ut=Math.round(c*255),[Nt,Ft,Wt]=ja.toChannels(h.rgba),{css:Ct.toCss(Nt,Ft,Wt,ut),rgba:Ct.toRgba(Nt,Ft,Wt,ut)}}e.opacity=n;function o(h,c){return ut=h.rgba&255,n(h,ut*c/255)}e.multiplyOpacity=o;function l(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=l})(ot||(ot={}));var ct;(e=>{let t,i;try{let s=document.createElement("canvas");s.width=1,s.height=1;let n=s.getContext("2d",{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Nt=parseInt(s.slice(1,2).repeat(2),16),Ft=parseInt(s.slice(2,3).repeat(2),16),Wt=parseInt(s.slice(3,4).repeat(2),16),Ct.toColor(Nt,Ft,Wt);case 5:return Nt=parseInt(s.slice(1,2).repeat(2),16),Ft=parseInt(s.slice(2,3).repeat(2),16),Wt=parseInt(s.slice(3,4).repeat(2),16),ut=parseInt(s.slice(4,5).repeat(2),16),Ct.toColor(Nt,Ft,Wt,ut);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let n=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Nt=parseInt(n[1]),Ft=parseInt(n[2]),Wt=parseInt(n[3]),ut=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Ct.toColor(Nt,Ft,Wt,ut);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Nt,Ft,Wt,ut]=t.getImageData(0,0,1,1).data,ut!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ct.toRgba(Nt,Ft,Wt,ut),css:s}}e.toColor=r})(ct||(ct={}));var ni;(e=>{function t(r){return i(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function i(r,s,n){let o=r/255,l=s/255,h=n/255,c=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),u=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),d=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return c*.2126+u*.7152+d*.0722}e.relativeLuminance2=i})(ni||(ni={}));var ja;(e=>{function t(o,l){if(ut=(l&255)/255,ut===1)return l;let h=l>>24&255,c=l>>16&255,u=l>>8&255,d=o>>24&255,f=o>>16&255,_=o>>8&255;return Nt=d+Math.round((h-d)*ut),Ft=f+Math.round((c-f)*ut),Wt=_+Math.round((u-_)*ut),Ct.toRgba(Nt,Ft,Wt)}e.blend=t;function i(o,l,h){let c=ni.relativeLuminance(o>>8),u=ni.relativeLuminance(l>>8);if(Lr(c,u)<h){if(u<c){let _=r(o,l,h),p=Lr(c,ni.relativeLuminance(_>>8));if(p<h){let b=s(o,l,h),g=Lr(c,ni.relativeLuminance(b>>8));return p>g?_:b}return _}let d=s(o,l,h),f=Lr(c,ni.relativeLuminance(d>>8));if(f<h){let _=r(o,l,h),p=Lr(c,ni.relativeLuminance(_>>8));return f>p?d:_}return d}}e.ensureContrastRatio=i;function r(o,l,h){let c=o>>24&255,u=o>>16&255,d=o>>8&255,f=l>>24&255,_=l>>16&255,p=l>>8&255,b=Lr(ni.relativeLuminance2(f,_,p),ni.relativeLuminance2(c,u,d));for(;b<h&&(f>0||_>0||p>0);)f-=Math.max(0,Math.ceil(f*.1)),_-=Math.max(0,Math.ceil(_*.1)),p-=Math.max(0,Math.ceil(p*.1)),b=Lr(ni.relativeLuminance2(f,_,p),ni.relativeLuminance2(c,u,d));return(f<<24|_<<16|p<<8|255)>>>0}e.reduceLuminance=r;function s(o,l,h){let c=o>>24&255,u=o>>16&255,d=o>>8&255,f=l>>24&255,_=l>>16&255,p=l>>8&255,b=Lr(ni.relativeLuminance2(f,_,p),ni.relativeLuminance2(c,u,d));for(;b<h&&(f<255||_<255||p<255);)f=Math.min(255,f+Math.ceil((255-f)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),b=Lr(ni.relativeLuminance2(f,_,p),ni.relativeLuminance2(c,u,d));return(f<<24|_<<16|p<<8|255)>>>0}e.increaseLuminance=s;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=n})(ja||(ja={}));function Os(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Lr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var Jw=class extends fa{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ll=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new ji}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 i=[],r=t.translateToString(!0),s=0,n=0,o=0,l=t.getFg(0),h=t.getBg(0);for(let c=0;c<t.getTrimmedLength();c++)if(t.loadCell(c,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==l||this._workCell.bg!==h){if(c-s>1){let u=this._getJoinedRanges(r,o,n,t,s);for(let d=0;d<u.length;d++)i.push(u[d])}s=c,o=n,l=this._workCell.fg,h=this._workCell.bg}n+=this._workCell.getChars().length||bs.length}if(this._bufferService.cols-s>1){let c=this._getJoinedRanges(r,o,n,t,s);for(let u=0;u<c.length;u++)i.push(c[u])}return i}_getJoinedRanges(e,t,i,r,s){let n=e.substring(t,i),o=[];try{o=this._characterJoiners[0].handler(n)}catch(l){console.error(l)}for(let l=1;l<this._characterJoiners.length;l++)try{let h=this._characterJoiners[l].handler(n);for(let c=0;c<h.length;c++)ll._mergeRanges(o,h[c])}catch(h){console.error(h)}return this._stringRangesToCellRanges(o,r,s),o}_stringRangesToCellRanges(e,t,i){let r=0,s=!1,n=0,o=e[r];if(o){for(let l=i;l<this._bufferService.cols;l++){let h=t.getWidth(l),c=t.getString(l).length||bs.length;if(h!==0){if(!s&&o[0]<=n&&(o[0]=l,s=!0),o[1]<=n){if(o[1]=l,o=e[++r],!o)break;o[0]<=n?(o[0]=l,s=!0):s=!1}n+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let i=!1;for(let r=0;r<e.length;r++){let s=e[r];if(i){if(t[1]<=s[0])return e[r-1][1]=t[1],e;if(t[1]<=s[1])return e[r-1][1]=Math.max(t[1],s[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=s[0])return e.splice(r,0,t),e;if(t[1]<=s[1])return s[0]=Math.min(t[0],s[0]),e;t[0]<s[1]&&(s[0]=Math.min(t[0],s[0]),i=!0);continue}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};ll=pt([_e(0,li)],ll);function e0(e){return 57508<=e&&e<=57558}function t0(e){return 9472<=e&&e<=9631}function i0(e){return e0(e)||t0(e)}function r0(){return{css:{canvas:Ma(),cell:Ma()},device:{canvas:Ma(),cell:Ma(),char:{width:0,height:0,left:0,top:0}}}}function Ma(){return{width:0,height:0}}var dc=class{constructor(e,t,i,r,s,n,o){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=r,this._coreService=s,this._decorationService=n,this._themeService=o,this._workCell=new ji,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,r,s,n,o,l,h,c,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),_=this._themeService.colors,p=e.getNoBgTrimmedLength();i&&p<n+1&&(p=n+1);let b,g=0,S="",x=0,C=0,w=0,k=0,M=!1,B=0,q=!1,Y=0,ne=0,j=[],N=c!==-1&&u!==-1;for(let L=0;L<p;L++){e.loadCell(L,this._workCell);let R=this._workCell.getWidth();if(R===0)continue;let O=!1,U=L>=ne,T=L,E=this._workCell;if(f.length>0&&L===f[0][0]&&U){let Re=f.shift(),Qe=this._isCellInSelection(Re[0],t);for(x=Re[0]+1;x<Re[1];x++)U&&(U=Qe===this._isCellInSelection(x,t));U&&(U=!i||n<Re[0]||n>=Re[1]),U?(O=!0,E=new Jw(this._workCell,e.translateToString(!0,Re[0],Re[1]),Re[1]-Re[0]),T=Re[1]-1,R=E.getWidth()):ne=Re[1]}let Q=this._isCellInSelection(L,t),ee=i&&L===n,ge=N&&L>=c&&L<=u,we=!1;this._decorationService.forEachDecorationAtCell(L,t,void 0,Re=>{we=!0});let de=E.getChars()||bs;if(de===" "&&(E.isUnderline()||E.isOverline())&&(de=" "),Y=R*l-h.get(de,E.isBold(),E.isItalic()),!b)b=this._document.createElement("span");else if(g&&(Q&&q||!Q&&!q&&E.bg===C)&&(Q&&q&&_.selectionForeground||E.fg===w)&&E.extended.ext===k&&ge===M&&Y===B&&!ee&&!O&&!we&&U){E.isInvisible()?S+=bs:S+=de,g++;continue}else g&&(b.textContent=S),b=this._document.createElement("span"),g=0,S="";if(C=E.bg,w=E.fg,k=E.extended.ext,M=ge,B=Y,q=Q,O&&n>=L&&n<=T&&(n=L),!this._coreService.isCursorHidden&&ee&&this._coreService.isCursorInitialized){if(j.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&j.push("xterm-cursor-blink"),j.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":j.push("xterm-cursor-outline");break;case"block":j.push("xterm-cursor-block");break;case"bar":j.push("xterm-cursor-bar");break;case"underline":j.push("xterm-cursor-underline");break}}if(E.isBold()&&j.push("xterm-bold"),E.isItalic()&&j.push("xterm-italic"),E.isDim()&&j.push("xterm-dim"),E.isInvisible()?S=bs:S=E.getChars()||bs,E.isUnderline()&&(j.push(`xterm-underline-${E.extended.underlineStyle}`),S===" "&&(S=" "),!E.isUnderlineColorDefault()))if(E.isUnderlineColorRGB())b.style.textDecorationColor=`rgb(${fa.toColorRGB(E.getUnderlineColor()).join(",")})`;else{let Re=E.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&E.isBold()&&Re<8&&(Re+=8),b.style.textDecorationColor=_.ansi[Re].css}E.isOverline()&&(j.push("xterm-overline"),S===" "&&(S=" ")),E.isStrikethrough()&&j.push("xterm-strikethrough"),ge&&(b.style.textDecoration="underline");let Ce=E.getFgColor(),Te=E.getFgColorMode(),De=E.getBgColor(),ve=E.getBgColorMode(),ye=!!E.isInverse();if(ye){let Re=Ce;Ce=De,De=Re;let Qe=Te;Te=ve,ve=Qe}let me,Ie,Fe=!1;this._decorationService.forEachDecorationAtCell(L,t,void 0,Re=>{Re.options.layer!=="top"&&Fe||(Re.backgroundColorRGB&&(ve=50331648,De=Re.backgroundColorRGB.rgba>>8&16777215,me=Re.backgroundColorRGB),Re.foregroundColorRGB&&(Te=50331648,Ce=Re.foregroundColorRGB.rgba>>8&16777215,Ie=Re.foregroundColorRGB),Fe=Re.options.layer==="top")}),!Fe&&Q&&(me=this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque,De=me.rgba>>8&16777215,ve=50331648,Fe=!0,_.selectionForeground&&(Te=50331648,Ce=_.selectionForeground.rgba>>8&16777215,Ie=_.selectionForeground)),Fe&&j.push("xterm-decoration-top");let ze;switch(ve){case 16777216:case 33554432:ze=_.ansi[De],j.push(`xterm-bg-${De}`);break;case 50331648:ze=Ct.toColor(De>>16,De>>8&255,De&255),this._addStyle(b,`background-color:#${Iu((De>>>0).toString(16),"0",6)}`);break;case 0:default:ye?(ze=_.foreground,j.push("xterm-bg-257")):ze=_.background}switch(me||E.isDim()&&(me=ot.multiplyOpacity(ze,.5)),Te){case 16777216:case 33554432:E.isBold()&&Ce<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Ce+=8),this._applyMinimumContrast(b,ze,_.ansi[Ce],E,me,void 0)||j.push(`xterm-fg-${Ce}`);break;case 50331648:let Re=Ct.toColor(Ce>>16&255,Ce>>8&255,Ce&255);this._applyMinimumContrast(b,ze,Re,E,me,Ie)||this._addStyle(b,`color:#${Iu(Ce.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(b,ze,_.foreground,E,me,Ie)||ye&&j.push("xterm-fg-257")}j.length&&(b.className=j.join(" "),j.length=0),!ee&&!O&&!we&&U?g++:b.textContent=S,Y!==this.defaultSpacing&&(b.style.letterSpacing=`${Y}px`),d.push(b),L=T}return b&&g&&(b.textContent=S),d}_applyMinimumContrast(e,t,i,r,s,n){if(this._optionsService.rawOptions.minimumContrastRatio===1||i0(r.getCode()))return!1;let o=this._getContrastCache(r),l;if(!s&&!n&&(l=o.getColor(t.rgba,i.rgba)),l===void 0){let h=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);l=ot.ensureContrastRatio(s||t,n||i,h),o.setColor((s||t).rgba,(n||i).rgba,l??null)}return l?(this._addStyle(e,`color:${l.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 i=this._selectionStart,r=this._selectionEnd;return!i||!r?!1:this._columnSelectMode?i[0]<=r[0]?e>=i[0]&&t>=i[1]&&e<r[0]&&t<=r[1]:e<i[0]&&t>=i[1]&&e>=r[0]&&t<=r[1]:t>i[1]&&t<r[1]||i[1]===r[1]&&t===i[1]&&e>=i[0]&&e<r[0]||i[1]<r[1]&&t===r[1]&&e<r[0]||i[1]<r[1]&&t===i[1]&&e>=i[0]}};dc=pt([_e(1,Fv),_e(2,hi),_e(3,Zr),_e(4,yn),_e(5,_a),_e(6,co)],dc);function Iu(e,t,i){for(;e.length<i;)e=t+e;return e}var s0=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 i=e.createElement("span");i.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontStyle="italic";let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold",n.style.fontStyle="italic",this._measureElements=[i,r,s,n],this._container.appendChild(i),this._container.appendChild(r),this._container.appendChild(s),this._container.appendChild(n),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,i,r){e===this._font&&t===this._fontSize&&i===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,i){let r=0;if(!t&&!i&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let o=this._measure(e,0);return o>0&&(this._flat[r]=o),o}let s=e;t&&(s+="B"),i&&(s+="I");let n=this._holey.get(s);if(n===void 0){let o=0;t&&(o|=1),i&&(o|=2),n=this._measure(e,o),n>0&&this._holey.set(s,n)}return n}_measure(e,t){let i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}},n0=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,i,r=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let s=e.buffers.active.ydisp,n=t[1]-s,o=i[1]-s,l=Math.max(n,0),h=Math.min(o,e.rows-1);if(l>=e.rows||h<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=l,this.viewportCappedEndRow=h,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol):!1}};function o0(){return new n0}var sh="xterm-dom-renderer-owner-",Mi="xterm-rows",Aa="xterm-fg-",Bu="xterm-bg-",mo="xterm-focus",Oa="xterm-selection",a0=1,uc=class extends He{constructor(e,t,i,r,s,n,o,l,h,c,u,d,f,_){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=r,this._viewportElement=s,this._helperContainer=n,this._linkifier2=o,this._charSizeService=h,this._optionsService=c,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=_,this._terminalClass=a0++,this._rowElements=[],this._selectionRenderModel=o0(),this.onRequestRedraw=this._register(new ae).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Mi),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(Oa),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=r0(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(p=>this._injectCss(p))),this._injectCss(this._themeService.colors),this._rowFactory=l.createInstance(dc,document),this._element.classList.add(sh+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(p=>this._handleLinkHover(p))),this._register(this._linkifier2.onHideLinkUnderline(p=>this._handleLinkLeave(p))),this._register(lt(()=>{this._element.classList.remove(sh+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new s0(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 i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Mi} 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} .${Mi} { 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} .${Mi} .xterm-dim { color: ${ot.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 i=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,s=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${s} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Mi}.${mo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Mi}.${mo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Mi}.${mo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Mi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Mi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Mi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Mi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Mi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Oa} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Oa} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Oa} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,o]of e.ansi.entries())t+=`${this._terminalSelector} .${Aa}${n} { color: ${o.css}; }${this._terminalSelector} .${Aa}${n}.xterm-dim { color: ${ot.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${Bu}${n} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${Aa}257 { color: ${ot.opaque(e.background).css}; }${this._terminalSelector} .${Aa}257.xterm-dim { color: ${ot.multiplyOpacity(ot.opaque(e.background),.5).css}; }${this._terminalSelector} .${Bu}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 i=this._rowElements.length;i<=t;i++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}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(mo),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(mo),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,i),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,s=this._selectionRenderModel.viewportEndRow,n=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(i){let h=e[0]>t[0];l.appendChild(this._createSelectionElement(n,h?t[0]:e[0],h?e[0]:t[0],o-n+1))}else{let h=r===n?e[0]:0,c=n===s?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(n,h,c));let u=o-n-1;if(l.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,u)),n!==o){let d=s===o?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(o,0,d))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,t,i,r=1){let s=this._document.createElement("div"),n=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(i-t);return n+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-n),s.style.height=`${r*this.dimensions.css.cell.height}px`,s.style.top=`${e*this.dimensions.css.cell.height}px`,s.style.left=`${n}px`,s.style.width=`${o}px`,s}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 i=this._bufferService.buffer,r=i.ybase+i.y,s=Math.min(i.x,this._bufferService.cols-1),n=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,l=this._optionsService.rawOptions.cursorInactiveStyle;for(let h=e;h<=t;h++){let c=h+i.ydisp,u=this._rowElements[h],d=i.lines.get(c);if(!u||!d)break;u.replaceChildren(...this._rowFactory.createRow(d,c,c===r,o,l,s,n,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${sh}${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,i,r,s,n){i<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;i=Math.max(Math.min(i,o),0),r=Math.max(Math.min(r,o),0),s=Math.min(s,this._bufferService.cols);let l=this._bufferService.buffer,h=l.ybase+l.y,c=Math.min(l.x,s-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let _=i;_<=r;++_){let p=_+l.ydisp,b=this._rowElements[_],g=l.lines.get(p);if(!b||!g)break;b.replaceChildren(...this._rowFactory.createRow(g,p,p===h,d,f,c,u,this.dimensions.css.cell.width,this._widthCache,n?_===i?e:0:-1,n?(_===r?t:s)-1:-1))}}};uc=pt([_e(7,vd),_e(8,Ll),_e(9,hi),_e(10,li),_e(11,yn),_e(12,Zr),_e(13,co)],uc);var fc=class extends He{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ae),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new h0(this._optionsService))}catch{this._measureStrategy=this._register(new l0(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())}};fc=pt([_e(2,hi)],fc);var rp=class extends He{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)}},l0=class extends rp{constructor(e,t,i){super(),this._document=e,this._parentElement=t,this._optionsService=i,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}},h0=class extends rp{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 new 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}},c0=class extends He{constructor(e,t,i){super(),this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new d0(this._window)),this._onDprChange=this._register(new ae),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ae),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(Gt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Ae(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Ae(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}},d0=class extends He{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new so),this._onDprChange=this._register(new ae),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(lt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Ae(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.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)}},u0=class extends He{constructor(){super(),this.linkProviders=[],this._register(lt(()=>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 Cd(e,t,i){let r=i.getBoundingClientRect(),s=e.getComputedStyle(i),n=parseInt(s.getPropertyValue("padding-left")),o=parseInt(s.getPropertyValue("padding-top"));return[t.clientX-r.left-n,t.clientY-r.top-o]}function f0(e,t,i,r,s,n,o,l,h){if(!n)return;let c=Cd(e,t,i);if(c)return c[0]=Math.ceil((c[0]+(h?o/2:0))/o),c[1]=Math.ceil(c[1]/l),c[0]=Math.min(Math.max(c[0],1),r+(h?1:0)),c[1]=Math.min(Math.max(c[1],1),s),c}var _c=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,r,s){return f0(window,e,t,i,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(e,t){let i=Cd(window,e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};_c=pt([_e(0,Qr),_e(1,Ll)],_c);var _0=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,i){this._rowCount=i,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):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=[]}},sp={};kS(sp,{getSafariVersion:()=>p0,isChromeOS:()=>lp,isFirefox:()=>np,isIpad:()=>g0,isIphone:()=>m0,isLegacyEdge:()=>v0,isLinux:()=>kd,isMac:()=>hl,isNode:()=>Il,isSafari:()=>op,isWindows:()=>ap});var Il=typeof process<"u"&&"title"in process,va=Il?"node":navigator.userAgent,pa=Il?"node":navigator.platform,np=va.includes("Firefox"),v0=va.includes("Edge"),op=/^((?!chrome|android).)*safari/i.test(va);function p0(){if(!op)return 0;let e=va.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var hl=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(pa),g0=pa==="iPad",m0=pa==="iPhone",ap=["Windows","Win16","Win32","WinCE"].includes(pa),kd=pa.indexOf("Linux")>=0,lp=/\bCrOS\b/.test(va),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),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,r=e.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),s=e.timeRemaining(),i*1.5>s){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=s}this.clear()}},b0=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())}}},y0=class extends hp{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},cl=!Il&&"requestIdleCallback"in window?y0:b0,S0=class{constructor(){this._queue=new cl}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},vc=class extends He{constructor(e,t,i,r,s,n,o,l,h){super(),this._rowCount=e,this._optionsService=i,this._charSizeService=r,this._coreService=s,this._coreBrowserService=l,this._renderer=this._register(new so),this._pausedResizeTask=new S0,this._observerDisposable=this._register(new so),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 ae),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ae),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ae),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ae),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new _0((c,u)=>this._renderRows(c,u),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new w0(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(lt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var c;return(c=this._renderer.value)==null?void 0:c.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(n.onDecorationRegistered(()=>this._fullRefresh())),this._register(n.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(h.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let i=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=lt(()=>i.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,i=!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)),i||(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),this._needsSelectionRefresh=!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(t=>this.refreshRows(t.start,t.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(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),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(()=>{var i;return(i=this._renderer.value)==null?void 0:i.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,i){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,i)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};vc=pt([_e(2,hi),_e(3,Ll),_e(4,yn),_e(5,_a),_e(6,li),_e(7,Zr),_e(8,co)],vc);var w0=class{constructor(e,t,i){this._coreBrowserService=e,this._coreService=t,this._onTimeout=i,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 C0(e,t,i,r){let s=i.buffer.x,n=i.buffer.y;if(!i.buffer.hasScrollback)return E0(s,n,e,t,i,r)+Bl(n,t,i,r)+D0(s,n,e,t,i,r);let o;if(n===t)return o=s>e?"D":"C",Yo(Math.abs(s-e),jo(o,r));o=n>t?"D":"C";let l=Math.abs(n-t),h=x0(n>t?e:s,i)+(l-1)*i.cols+1+k0(n>t?s:e);return Yo(h,jo(o,r))}function k0(e,t){return e-1}function x0(e,t){return t.cols-e}function E0(e,t,i,r,s,n){return Bl(t,r,s,n).length===0?"":Yo(dp(e,t,e,t-mn(t,s),!1,s).length,jo("D",n))}function Bl(e,t,i,r){let s=e-mn(e,i),n=t-mn(t,i),o=Math.abs(s-n)-T0(e,t,i);return Yo(o,jo(cp(e,t),r))}function D0(e,t,i,r,s,n){let o;Bl(t,r,s,n).length>0?o=r-mn(r,s):o=t;let l=r,h=R0(e,t,i,r,s,n);return Yo(dp(e,o,i,l,h==="C",s).length,jo(h,n))}function T0(e,t,i){var o;let r=0,s=e-mn(e,i),n=t-mn(t,i);for(let l=0;l<Math.abs(s-n);l++){let h=cp(e,t)==="A"?-1:1;(o=i.buffer.lines.get(s+h*l))!=null&&o.isWrapped&&r++}return r}function mn(e,t){let i=0,r=t.buffer.lines.get(e),s=r==null?void 0:r.isWrapped;for(;s&&e>=0&&e<t.rows;)i++,r=t.buffer.lines.get(--e),s=r==null?void 0:r.isWrapped;return i}function R0(e,t,i,r,s,n){let o;return Bl(i,r,s,n).length>0?o=r-mn(r,s):o=t,e<i&&o<=r||e>=i&&o<r?"C":"D"}function cp(e,t){return e>t?"A":"B"}function dp(e,t,i,r,s,n){let o=e,l=t,h="";for(;(o!==i||l!==r)&&l>=0&&l<n.buffer.lines.length;)o+=s?1:-1,s&&o>n.cols-1?(h+=n.buffer.translateBufferLineToString(l,!1,e,o),o=0,e=0,l++):!s&&o<0&&(h+=n.buffer.translateBufferLineToString(l,!1,0,e+1),o=n.cols-1,e=o,l--);return h+n.buffer.translateBufferLineToString(l,!1,e,o)}function jo(e,t){let i=t?"O":"[";return K.ESC+i+e}function Yo(e,t){e=Math.floor(e);let i="";for(let r=0;r<e;r++)i+=t;return i}var P0=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 Nu(e,t){if(e.start.y>e.end.y)throw new 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 nh=50,M0=15,A0=50,O0=500,L0=" ",I0=new RegExp(L0,"g"),pc=class extends He{constructor(e,t,i,r,s,n,o,l,h){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=r,this._coreService=s,this._mouseService=n,this._optionsService=o,this._renderService=l,this._coreBrowserService=h,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new ji,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ae),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ae),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ae),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ae),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new P0(this._bufferService),this._activeSelectionMode=0,this._register(lt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.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 i=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let s=e[0]<t[0]?e[0]:t[0],n=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let l=i.translateBufferLineToString(o,!0,s,n);r.push(l)}}else{let s=e[1]===t[1]?t[0]:void 0;r.push(i.translateBufferLineToString(e[1],!0,e[0],s));for(let n=e[1]+1;n<=t[1]-1;n++){let o=i.lines.get(n),l=i.translateBufferLineToString(n,!0);o!=null&&o.isWrapped?r[r.length-1]+=l:r.push(l)}if(e[1]!==t[1]){let n=i.lines.get(t[1]),o=i.translateBufferLineToString(t[1],!0,0,t[0]);n&&n.isWrapped?r[r.length-1]+=o:r.push(o)}}return r.map(s=>s.replace(I0," ")).join(ap?`\r
|
|
32
|
+
`))}},lw=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},hw=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},cw=0,nh=class{constructor(e){this.value=e,this.id=cw++}},dw=2,uw,ae=class{constructor(e){var t,i,r,s;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new ow((e==null?void 0:e.onListenerError)??Ka,((i=this._options)==null?void 0:i.leakWarningThreshold)??nw):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new sw(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var e,t,i,r;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||i.call(t),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(e,t,i)=>{var o,l,h,c,u;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],_=new hw(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(((o=this._options)==null?void 0:o.onListenerError)||Ka)(_),He.None}if(this._disposed)return He.None;t&&(e=e.bind(t));let r=new nh(e),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=aw.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof nh?(this._deliveryQueue??(this._deliveryQueue=new fw),this._listeners=[this._listeners,r]):this._listeners.push(r):((h=(l=this._options)==null?void 0:l.onWillAddFirstListener)==null||h.call(l,this),this._listeners=r,(u=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null||u.call(c,this)),this._size++;let n=lt(()=>{s==null||s(),this._removeListener(r)});return i instanceof Es?i.add(n):Array.isArray(i)&&i.push(n),n}),this._event}_removeListener(e){var s,n,o,l;if((n=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||n.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(l=(o=this._options)==null?void 0:o.onDidRemoveLastListener)==null||l.call(o,this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*dw<=t.length){let h=0;for(let c=0;c<t.length;c++)t[c]?t[h++]=t[c]:r&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=h}}_deliver(e,t){var r;if(!e)return;let i=((r=this._options)==null?void 0:r.onListenerError)||Ka;if(!i){e.value(t);return}try{e.value(t)}catch(s){i(s)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,i,r,s;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof nh)this._deliver(this._listeners,e);else{let n=this._deliveryQueue;n.enqueue(this,e,this._listeners.length),this._deliverQueue(n)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},fw=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},sc=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ae,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ae,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let r=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let r=this.getWindowId(i);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};sc.INSTANCE=new sc;var Sd=sc;function _w(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}Sd.INSTANCE.onDidChangeZoomLevel;function vw(e){return Sd.INSTANCE.getZoomFactor(e)}Sd.INSTANCE.onDidChangeFullscreen;var vo=typeof navigator=="object"?navigator.userAgent:"",nc=vo.indexOf("Firefox")>=0,pw=vo.indexOf("AppleWebKit")>=0,wd=vo.indexOf("Chrome")>=0,gw=!wd&&vo.indexOf("Safari")>=0;vo.indexOf("Electron/")>=0;vo.indexOf("Android")>=0;var oh=!1;if(typeof Ur.matchMedia=="function"){let e=Ur.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Ur.matchMedia("(display-mode: fullscreen)");oh=e.matches,_w(Ur,e,({matches:i})=>{oh&&t.matches||(oh=i)})}var Rn="en",oc=!1,ac=!1,qa=!1,tp=!1,Ma,ja=Rn,Du=Rn,mw,Xi,un=globalThis,Vt,Pf;typeof un.vscode<"u"&&typeof un.vscode.process<"u"?Vt=un.vscode.process:typeof process<"u"&&typeof((Pf=process==null?void 0:process.versions)==null?void 0:Pf.node)=="string"&&(Vt=process);var Mf,bw=typeof((Mf=Vt==null?void 0:Vt.versions)==null?void 0:Mf.electron)=="string",yw=bw&&(Vt==null?void 0:Vt.type)==="renderer",Af;if(typeof Vt=="object"){oc=Vt.platform==="win32",ac=Vt.platform==="darwin",qa=Vt.platform==="linux",qa&&Vt.env.SNAP&&Vt.env.SNAP_REVISION,Vt.env.CI||Vt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Ma=Rn,ja=Rn;let e=Vt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Ma=t.userLocale,Du=t.osLocale,ja=t.resolvedLanguage||Rn,mw=(Af=t.languagePack)==null?void 0:Af.translationsConfigFile}catch{}tp=!0}else typeof navigator=="object"&&!yw?(Xi=navigator.userAgent,oc=Xi.indexOf("Windows")>=0,ac=Xi.indexOf("Macintosh")>=0,(Xi.indexOf("Macintosh")>=0||Xi.indexOf("iPad")>=0||Xi.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,qa=Xi.indexOf("Linux")>=0,(Xi==null?void 0:Xi.indexOf("Mobi"))>=0,ja=globalThis._VSCODE_NLS_LANGUAGE||Rn,Ma=navigator.language.toLowerCase(),Du=Ma):console.error("Unable to resolve platform.");var ip=oc,Tr=ac,Sw=qa,Tu=tp,Mr=Xi,ts=ja,ww;(e=>{function t(){return ts}e.value=t;function i(){return ts.length===2?ts==="en":ts.length>=3?ts[0]==="e"&&ts[1]==="n"&&ts[2]==="-":!1}e.isDefaultVariant=i;function r(){return ts==="en"}e.isDefault=r})(ww||(ww={}));var Cw=typeof un.postMessage=="function"&&!un.importScripts;(()=>{if(Cw){let e=[];un.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let r=0,s=e.length;r<s;r++){let n=e[r];if(n.id===i.data.vscodeScheduleAsyncWork){e.splice(r,1),n.callback();return}}});let t=0;return i=>{let r=++t;e.push({id:r,callback:i}),un.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var kw=!!(Mr&&Mr.indexOf("Chrome")>=0);Mr&&Mr.indexOf("Firefox")>=0;!kw&&Mr&&Mr.indexOf("Safari")>=0;Mr&&Mr.indexOf("Edg/")>=0;Mr&&Mr.indexOf("Android")>=0;var kn=typeof navigator=="object"?navigator:{};Tu||document.queryCommandSupported&&document.queryCommandSupported("copy")||kn&&kn.clipboard&&kn.clipboard.writeText,Tu||kn&&kn.clipboard&&kn.clipboard.readText;var Cd=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}},ah=new Cd,Ru=new Cd,Pu=new Cd,xw=new Array(230),rp;(e=>{function t(l){return ah.keyCodeToStr(l)}e.toString=t;function i(l){return ah.strToKeyCode(l)}e.fromString=i;function r(l){return Ru.keyCodeToStr(l)}e.toUserSettingsUS=r;function s(l){return Pu.keyCodeToStr(l)}e.toUserSettingsGeneral=s;function n(l){return Ru.strToKeyCode(l)||Pu.strToKeyCode(l)}e.fromUserSettings=n;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return ah.keyCodeToStr(l)}e.toElectronAccelerator=o})(rp||(rp={}));var Ew=class sp{constructor(t,i,r,s,n){this.ctrlKey=t,this.shiftKey=i,this.altKey=r,this.metaKey=s,this.keyCode=n}equals(t){return t instanceof sp&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",r=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${t}${i}${r}${s}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Dw([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Dw=class{constructor(e){if(e.length===0)throw QS("chords");this.chords=e}getHashCode(){let e="";for(let t=0,i=this.chords.length;t<i;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 Tw(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return rp.fromString(i)}let t=e.keyCode;if(t===3)return 7;if(nc)switch(t){case 59:return 85;case 60:if(Sw)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Tr)return 57;break}else if(pw&&(Tr&&t===93||!Tr&&t===92))return 57;return xw[t]||0}var Rw=Tr?256:2048,Pw=512,Mw=1024,Aw=Tr?2048:256,Mu=class{constructor(e){var i;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=(i=t.getModifierState)==null?void 0:i.call(t,"AltGraph"),this.keyCode=Tw(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|=Rw),this.altKey&&(t|=Pw),this.shiftKey&&(t|=Mw),this.metaKey&&(t|=Aw),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Ew(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Au=new WeakMap;function Ow(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,i=e.parent.location;if(t.origin!=="null"&&i.origin!=="null"&&t.origin!==i.origin)return null}catch{return null}return e.parent}var Lw=class{static getSameOriginWindowChain(e){let t=Au.get(e);if(!t){t=[],Au.set(e,t);let i=e,r;do r=Ow(i),r?t.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):t.push({window:new WeakRef(i),iframeElement:null}),i=r;while(i)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,r=0,s=this.getSameOriginWindowChain(e);for(let n of s){let o=n.window.deref();if(i+=(o==null?void 0:o.scrollY)??0,r+=(o==null?void 0:o.scrollX)??0,o===t||!n.iframeElement)break;let l=n.iframeElement.getBoundingClientRect();i+=l.top,r+=l.left}return{top:i,left:r}}},Aa=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 i=Lw.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Ou=class{constructor(e,t=0,i=0){var s;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=i,this.deltaX=t;let r=!1;if(wd){let n=navigator.userAgent.match(/Chrome\/(\d+)/);r=(n?parseInt(n[1]):123)<=122}if(e){let n=e,o=e,l=((s=e.view)==null?void 0:s.devicePixelRatio)||1;if(typeof n.wheelDeltaY<"u")r?this.deltaY=n.wheelDeltaY/(120*l):this.deltaY=n.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?nc&&!Tr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof n.wheelDeltaX<"u")gw&&ip?this.deltaX=-(n.wheelDeltaX/120):r?this.deltaX=n.wheelDeltaX/(120*l):this.deltaX=n.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?nc&&!Tr?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*l):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},np=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),Iw;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof Bw?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Xt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:np})})(Iw||(Iw={}));var Bw=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?np:(this._emitter||(this._emitter=new ae),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},kd=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 Jh("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Jh("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Nw=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,i=globalThis){if(this.isDisposed)throw new Jh("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=i.setInterval(()=>{e()},t);this.disposable=lt(()=>{i.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Fw;(e=>{async function t(r){let s,n=await Promise.all(r.map(o=>o.then(l=>l,l=>{s||(s=l)})));if(typeof s<"u")throw s;return n}e.settled=t;function i(r){return new Promise(async(s,n)=>{try{await r(s,n)}catch(o){n(o)}})}e.withAsyncBody=i})(Fw||(Fw={}));var Lu=class Oi{static fromArray(t){return new Oi(i=>{i.emitMany(t)})}static fromPromise(t){return new Oi(async i=>{i.emitMany(await t)})}static fromPromises(t){return new Oi(async i=>{await Promise.all(t.map(async r=>i.emitOne(await r)))})}static merge(t){return new Oi(async i=>{await Promise.all(t.map(async r=>{for await(let s of r)i.emitOne(s)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new ae,queueMicrotask(async()=>{let r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Xt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var i;return(i=this._onReturn)==null||i.call(this),{done:!0,value:void 0}}}}static map(t,i){return new Oi(async r=>{for await(let s of t)r.emitOne(i(s))})}map(t){return Oi.map(this,t)}static filter(t,i){return new Oi(async r=>{for await(let s of t)i(s)&&r.emitOne(s)})}filter(t){return Oi.filter(this,t)}static coalesce(t){return Oi.filter(t,i=>!!i)}coalesce(){return Oi.coalesce(this)}static async toPromise(t){let i=[];for await(let r of t)i.push(r);return i}toPromise(){return Oi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Lu.EMPTY=Lu.fromArray([]);var{getWindow:Er,getWindowId:Ww,onDidRegisterWindow:Hw}=(function(){let e=new Map,t={window:Ur,disposables:new Es};e.set(Ur.vscodeWindowId,t);let i=new ae,r=new ae,s=new ae;function n(o,l){return(typeof o=="number"?e.get(o):void 0)??(l?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(o){if(e.has(o.vscodeWindowId))return He.None;let l=new Es,h={window:o,disposables:l.add(new Es)};return e.set(o.vscodeWindowId,h),l.add(lt(()=>{e.delete(o.vscodeWindowId),r.fire(o)})),l.add(Ae(o,Nt.BEFORE_UNLOAD,()=>{s.fire(o)})),i.fire(h),l},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:n,getWindow(o){var c;let l=o;if((c=l==null?void 0:l.ownerDocument)!=null&&c.defaultView)return l.ownerDocument.defaultView.window;let h=o;return h!=null&&h.view?h.view.window:Ur},getDocument(o){return Er(o).document}}})(),zw=class{constructor(e,t,i,r){this._node=e,this._type=t,this._handler=i,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,this._handler=null)}};function Ae(e,t,i,r){return new zw(e,t,i,r)}var Iu=function(e,t,i,r){return Ae(e,t,i,r)},xd,Uw=class extends Nw{constructor(e){super(),this.defaultTarget=e&&Er(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},Bu=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){Ka(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,r=new Map,s=n=>{i.set(n,!1);let o=e.get(n)??[];for(t.set(n,o),e.set(n,[]),r.set(n,!0);o.length>0;)o.sort(Bu.sort),o.shift().execute();r.set(n,!1)};xd=(n,o,l=0)=>{let h=Ww(n),c=new Bu(o,l),u=e.get(h);return u||(u=[],e.set(h,u)),u.push(c),i.get(h)||(i.set(h,!0),n.requestAnimationFrame(()=>s(h))),c}})();function Kw(e){let t=e.getBoundingClientRect(),i=Er(e);return{left:t.left+i.scrollX,top:t.top+i.scrollY,width:t.width,height:t.height}}var Nt={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},qw=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=di(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=di(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=di(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=di(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=di(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=di(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=di(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=di(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=di(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=di(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=di(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=di(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=di(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=di(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 di(e){return typeof e=="number"?`${e}px`:e}function Uo(e){return new qw(e)}var op=class{constructor(){this._hooks=new Es,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 i=this._onStopCallback;this._onStopCallback=null,e&&i&&i(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,i,r,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=s;let n=e;try{e.setPointerCapture(t),this._hooks.add(lt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{n=Er(e)}this._hooks.add(Ae(n,Nt.POINTER_MOVE,o=>{if(o.buttons!==i){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(Ae(n,Nt.POINTER_UP,o=>this.stopMonitoring(!0)))}};function jw(e,t,i){let r=null,s=null;if(typeof i.value=="function"?(r="value",s=i.value,s.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(r="get",s=i.get),!s)throw new Error("not supported");let n=`$memoize$${t}`;i[r]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,o)}),this[n]}}var pr;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(pr||(pr={}));var To=class ii extends He{constructor(){super(),this.dispatched=!1,this.targets=new Eu,this.ignoreTargets=new Eu,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Xt.runAndSubscribe(Hw,({window:t,disposables:i})=>{i.add(Ae(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),i.add(Ae(t.document,"touchend",r=>this.onTouchEnd(t,r))),i.add(Ae(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:Ur,disposables:this._store}))}static addTarget(t){if(!ii.isTouchDevice())return He.None;ii.INSTANCE||(ii.INSTANCE=new ii);let i=ii.INSTANCE.targets.push(t);return lt(i)}static ignoreTarget(t){if(!ii.isTouchDevice())return He.None;ii.INSTANCE||(ii.INSTANCE=new ii);let i=ii.INSTANCE.ignoreTargets.push(t);return lt(i)}static isTouchDevice(){return"ontouchstart"in Ur||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,s=t.targetTouches.length;r<s;r++){let n=t.targetTouches.item(r);this.activeTouches[n.identifier]={id:n.identifier,initialTarget:n.target,initialTimeStamp:i,initialPageX:n.pageX,initialPageY:n.pageY,rollingTimestamps:[i],rollingPageX:[n.pageX],rollingPageY:[n.pageY]};let o=this.newGestureEvent(pr.Start,n.target);o.pageX=n.pageX,o.pageY=n.pageY,this.dispatchEvent(o)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,i){let r=Date.now(),s=Object.keys(this.activeTouches).length;for(let n=0,o=i.changedTouches.length;n<o;n++){let l=i.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let h=this.activeTouches[l.identifier],c=Date.now()-h.initialTimeStamp;if(c<ii.HOLD_DELAY&&Math.abs(h.initialPageX-Ci(h.rollingPageX))<30&&Math.abs(h.initialPageY-Ci(h.rollingPageY))<30){let u=this.newGestureEvent(pr.Tap,h.initialTarget);u.pageX=Ci(h.rollingPageX),u.pageY=Ci(h.rollingPageY),this.dispatchEvent(u)}else if(c>=ii.HOLD_DELAY&&Math.abs(h.initialPageX-Ci(h.rollingPageX))<30&&Math.abs(h.initialPageY-Ci(h.rollingPageY))<30){let u=this.newGestureEvent(pr.Contextmenu,h.initialTarget);u.pageX=Ci(h.rollingPageX),u.pageY=Ci(h.rollingPageY),this.dispatchEvent(u)}else if(s===1){let u=Ci(h.rollingPageX),d=Ci(h.rollingPageY),f=Ci(h.rollingTimestamps)-h.rollingTimestamps[0],_=u-h.rollingPageX[0],p=d-h.rollingPageY[0],b=[...this.targets].filter(g=>h.initialTarget instanceof Node&&g.contains(h.initialTarget));this.inertia(t,b,r,Math.abs(_)/f,_>0?1:-1,u,Math.abs(p)/f,p>0?1:-1,d)}this.dispatchEvent(this.newGestureEvent(pr.End,h.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,i){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=i,r.tapCount=0,r}dispatchEvent(t){if(t.type===pr.Tap){let i=new Date().getTime(),r=0;i-this._lastSetTapCountTime>ii.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=i,t.tapCount=r}else(t.type===pr.Change||t.type===pr.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let i=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let s=0,n=t.initialTarget;for(;n&&n!==r;)s++,n=n.parentElement;i.push([s,r])}i.sort((r,s)=>r[0]-s[0]);for(let[r,s]of i)s.dispatchEvent(t),this.dispatched=!0}}inertia(t,i,r,s,n,o,l,h,c){this.handle=xd(t,()=>{let u=Date.now(),d=u-r,f=0,_=0,p=!0;s+=ii.SCROLL_FRICTION*d,l+=ii.SCROLL_FRICTION*d,s>0&&(p=!1,f=n*s*d),l>0&&(p=!1,_=h*l*d);let b=this.newGestureEvent(pr.Change);b.translationX=f,b.translationY=_,i.forEach(g=>g.dispatchEvent(b)),p||this.inertia(t,i,u,s,n,o+f,l,h,c+_)})}onTouchMove(t){let i=Date.now();for(let r=0,s=t.changedTouches.length;r<s;r++){let n=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(n.identifier))){console.warn("end of an UNKNOWN touch",n);continue}let o=this.activeTouches[n.identifier],l=this.newGestureEvent(pr.Change,o.initialTarget);l.translationX=n.pageX-Ci(o.rollingPageX),l.translationY=n.pageY-Ci(o.rollingPageY),l.pageX=n.pageX,l.pageY=n.pageY,this.dispatchEvent(l),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(n.pageX),o.rollingPageY.push(n.pageY),o.rollingTimestamps.push(i)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};To.SCROLL_FRICTION=-.005,To.HOLD_DELAY=700,To.CLEAR_TAP_COUNT_TIME=400,gt([jw],To,"isTouchDevice",1);var Yw=To,Ed=class extends He{onclick(e,t){this._register(Ae(e,Nt.CLICK,i=>t(new Aa(Er(e),i))))}onmousedown(e,t){this._register(Ae(e,Nt.MOUSE_DOWN,i=>t(new Aa(Er(e),i))))}onmouseover(e,t){this._register(Ae(e,Nt.MOUSE_OVER,i=>t(new Aa(Er(e),i))))}onmouseleave(e,t){this._register(Ae(e,Nt.MOUSE_LEAVE,i=>t(new Aa(Er(e),i))))}onkeydown(e,t){this._register(Ae(e,Nt.KEY_DOWN,i=>t(new Mu(i))))}onkeyup(e,t){this._register(Ae(e,Nt.KEY_UP,i=>t(new Mu(i))))}oninput(e,t){this._register(Ae(e,Nt.INPUT,t))}onblur(e,t){this._register(Ae(e,Nt.BLUR,t))}onfocus(e,t){this._register(Ae(e,Nt.FOCUS,t))}onchange(e,t){this._register(Ae(e,Nt.CHANGE,t))}ignoreGesture(e){return Yw.ignoreTarget(e)}},Nu=11,Vw=class extends Ed{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=Nu+"px",this.domNode.style.height=Nu+"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 op),this._register(Iu(this.bgDomNode,Nt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Iu(this.domNode,Nt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new Uw),this._pointerdownScheduleRepeatTimer=this._register(new kd)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Er(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},Gw=class lc{constructor(t,i,r,s,n,o,l){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,r=r|0,s=s|0,n=n|0,o=o|0,l=l|0),this.rawScrollLeft=s,this.rawScrollTop=l,i<0&&(i=0),s+i>r&&(s=r-i),s<0&&(s=0),n<0&&(n=0),l+n>o&&(l=o-n),l<0&&(l=0),this.width=i,this.scrollWidth=r,this.scrollLeft=s,this.height=n,this.scrollHeight=o,this.scrollTop=l}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,i){return new lc(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new lc(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(t,i){let r=this.width!==t.width,s=this.scrollWidth!==t.scrollWidth,n=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,l=this.scrollHeight!==t.scrollHeight,h=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:i,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:s,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:h}}},$w=class extends He{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Gw(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var r;let i=this._state.withScrollDimensions(e,t);this._setState(i,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.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(),this._smoothScrolling=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 i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let r;t?r=new Wu(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let i=this._state.withScrollPosition(e);this._smoothScrolling=Wu.start(this._state,i,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 i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}},Fu=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function lh(e,t){let i=t-e;return function(r){return e+i*Qw(r)}}function Xw(e,t,i){return function(r){return r<i?e(r/i):t((r-i)/(1-i))}}var Wu=class hc{constructor(t,i,r,s){this.from=t,this.to=i,this.duration=s,this.startTime=r,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(t,i,r){if(Math.abs(t-i)>2.5*r){let s,n;return t<i?(s=t+.75*r,n=i-.75*r):(s=t-.75*r,n=i+.75*r),Xw(lh(t,s),lh(n,i),.33)}return lh(t,i)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let i=(t-this.startTime)/this.duration;if(i<1){let r=this.scrollLeft(i),s=this.scrollTop(i);return new Fu(r,s,!1)}return new Fu(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,i,r){return hc.start(t,i,r)}static start(t,i,r){r=r+10;let s=Date.now()-10;return new hc(t,i,s,r)}};function Zw(e){return Math.pow(e,3)}function Qw(e){return 1-Zw(1-e)}var Jw=class extends He{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new kd)}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(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},e0=140,ap=class extends Ed{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 Jw(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new op),this._shouldRender=!0,this.domNode=Uo(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(Ae(this.domNode.domNode,Nt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new Vw(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,r){this.slider=Uo(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof i=="number"&&this.slider.setWidth(i),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Ae(this.slider.domNode,Nt.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.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,i=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);i<=s&&s<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,i=e.offsetY;else{let s=Kw(this.domNode.domNode);t=e.pageX-s.left,i=e.pageY-s.top}let r=this._pointerDownRelativePosition(t,i);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),i=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{let n=this._sliderOrthogonalPointerPosition(s),o=Math.abs(n-i);if(ip&&o>e0){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let l=this._sliderPointerPosition(s)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(l))},()=>{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()}},lp=class cc{constructor(t,i,r,s,n,o){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=s,this._scrollSize=n,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new cc(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let i=Math.round(t);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(t){let i=Math.round(t);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let i=Math.round(t);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,i,r,s,n){let o=Math.max(0,r-t),l=Math.max(0,o-2*i),h=s>0&&s>r;if(!h)return{computedAvailableSize:Math.round(o),computedIsNeeded:h,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(r*l/s))),u=(l-c)/(s-r),d=n*u;return{computedAvailableSize:Math.round(o),computedIsNeeded:h,computedSliderSize:Math.round(c),computedSliderRatio:u,computedSliderPosition:Math.round(d)}}_refreshComputedValues(){let t=cc._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(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize,r=this._scrollPosition;return i<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let i=this._computedSliderPosition+t;return Math.round(i/this._computedSliderRatio)}},t0=class extends ap{constructor(e,t,i){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new lp(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,s.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new 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}},i0=class extends ap{constructor(e,t,i){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new lp(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,s.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new 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}},r0=500,Hu=50,s0=class{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}},dc=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,i=0,r=1,s=this._rear;do{let n=s===this._front?t:Math.pow(2,-r);if(t-=n,i+=this._memory[s].score*n,s===this._front)break;s=(this._capacity+s-1)%this._capacity,r++}while(!0);return i<=.5}acceptStandardWheelEvent(t){if(wd){let i=Er(t.browserEvent),r=vw(i);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,i,r){let s=null,n=new s0(t,i,r);this._front===-1&&this._rear===-1?(this._memory[0]=n,this._front=0,this._rear=0):(s=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]=n),n.score=this._computeScore(n,s)}_computeScore(t,i){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),i){let s=Math.abs(t.deltaX),n=Math.abs(t.deltaY),o=Math.abs(i.deltaX),l=Math.abs(i.deltaY),h=Math.max(Math.min(s,o),1),c=Math.max(Math.min(n,l),1),u=Math.max(s,o),d=Math.max(n,l);u%h===0&&d%c===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};dc.INSTANCE=new dc;var n0=dc,o0=class extends Ed{constructor(e,t,i){super(),this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ae),this.onWillScroll=this._onWillScroll.event,this._options=l0(t),this._scrollable=i,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));let r={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new i0(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new t0(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=Uo(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Uo(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Uo(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,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new kd),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=mn(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,Tr&&(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){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=mn(this._mouseWheelToDispose),e)){let t=i=>{this._onMouseWheel(new Ou(i))};this._mouseWheelToDispose.push(Ae(this._listenOnDomNode,Nt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var s;if((s=e.browserEvent)!=null&&s.defaultPrevented)return;let t=n0.INSTANCE;t.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let n=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+n===0?o=n=0:Math.abs(n)>=Math.abs(o)?o=0:n=0),this._options.flipAxes&&([n,o]=[o,n]);let l=!Tr&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!o&&(o=n,n=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,n=n*this._options.fastScrollSensitivity);let h=this._scrollable.getFutureScrollPosition(),c={};if(n){let u=Hu*n,d=h.scrollTop-(u<0?Math.floor(u):Math.ceil(u));this._verticalScrollbar.writeScrollPosition(c,d)}if(o){let u=Hu*o,d=h.scrollLeft-(u<0?Math.floor(u):Math.ceil(u));this._horizontalScrollbar.writeScrollPosition(c,d)}c=this._scrollable.validateScrollPosition(c),(h.scrollLeft!==c.scrollLeft||h.scrollTop!==c.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),i=!0)}let r=i;!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 new 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,i=e.scrollLeft>0,r=i?" left":"",s=t?" top":"",n=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${s}${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(),r0)}},a0=class extends o0{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function l0(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,Tr&&(t.className+=" mac"),t}var uc=class extends He{constructor(e,t,i,r,s,n,o,l){super(),this._bufferService=i,this._optionsService=o,this._renderService=l,this._onRequestScrollLines=this._register(new ae),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let h=this._register(new $w({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>xd(r.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{h.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new a0(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},h)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Xt.runAndSubscribe(n.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=n.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(lt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(lt(()=>this._styleElement.remove())),this._register(Xt.runAndSubscribe(n.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${n.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${n.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${n.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
33
|
+
`)})),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(c=>this._handleScroll(c)))}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(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.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),i=t-this._bufferService.buffer.ydisp;i!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}};uc=gt([fe(2,hi),fe(3,Zr),fe(4,Uv),fe(5,_o),fe(6,ci),fe(7,Qr)],uc);var fc=class extends He{constructor(e,t,i,r,s){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=r,this._renderService=s,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(n=>this._removeDecoration(n))),this._register(lt(()=>{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){var r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.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 i=e.options.x??0;return i&&i>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 i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;let i=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=i?`${i*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=i?`${i*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};fc=gt([fe(1,hi),fe(2,Zr),fe(3,ga),fe(4,Qr)],fc);var h0=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,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},_r={full:0,left:0,center:0,right:0},is={full:0,left:0,center:0,right:0},yo={full:0,left:0,center:0,right:0},hl=class extends He{constructor(e,t,i,r,s,n,o,l){var c;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=r,this._renderService=s,this._optionsService=n,this._themeService=o,this._coreBrowserService=l,this._colorZoneStore=new h0,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(),(c=this._viewportElement.parentElement)==null||c.insertBefore(this._canvas,this._viewportElement),this._register(lt(()=>{var u;return(u=this._canvas)==null?void 0:u.remove()}));let h=this._canvas.getContext("2d");if(h)this._ctx=h;else throw new 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(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);is.full=this._canvas.width,is.left=e,is.center=t,is.right=e,this._refreshDrawHeightConstants(),yo.full=1,yo.left=1,yo.center=1+is.left,yo.right=1+is.left+is.center}_refreshDrawHeightConstants(){_r.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);_r.left=t,_r.center=t,_r.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_r.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_r.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_r.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_r.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 t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);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(yo[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-_r[e.position||"full"]/2),is[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+_r[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}))}};hl=gt([fe(2,hi),fe(3,ga),fe(4,Qr),fe(5,ci),fe(6,_o),fe(7,Zr)],hl);var q;(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=`
|
|
34
|
+
`,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=""))(q||(q={}));var Ya;(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=""))(Ya||(Ya={}));var hp;(e=>e.ST=`${q.ESC}\\`)(hp||(hp={}));var _c=class{constructor(e,t,i,r,s,n){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=r,this._coreService=s,this._renderService=n,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 t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let i;t.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(t.start,this._compositionPosition.start):i=this._textarea.value.substring(t.start),i.length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.length<e.length?this._coreService.triggerDataEvent(`${q.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 t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),i=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let n=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(n.width,1)+"px",this._textarea.style.height=Math.max(n.height,1)+"px",this._textarea.style.lineHeight=n.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};_c=gt([fe(2,hi),fe(3,ci),fe(4,Sn),fe(5,Qr)],_c);var Wt=0,Ht=0,zt=0,ft=0,zu={css:"#00000000",rgba:0},Ct;(e=>{function t(s,n,o,l){return l!==void 0?`#${Ls(s)}${Ls(n)}${Ls(o)}${Ls(l)}`:`#${Ls(s)}${Ls(n)}${Ls(o)}`}e.toCss=t;function i(s,n,o,l=255){return(s<<24|n<<16|o<<8|l)>>>0}e.toRgba=i;function r(s,n,o,l){return{css:e.toCss(s,n,o,l),rgba:e.toRgba(s,n,o,l)}}e.toColor=r})(Ct||(Ct={}));var rt;(e=>{function t(h,c){if(ft=(c.rgba&255)/255,ft===1)return{css:c.css,rgba:c.rgba};let u=c.rgba>>24&255,d=c.rgba>>16&255,f=c.rgba>>8&255,_=h.rgba>>24&255,p=h.rgba>>16&255,b=h.rgba>>8&255;Wt=_+Math.round((u-_)*ft),Ht=p+Math.round((d-p)*ft),zt=b+Math.round((f-b)*ft);let g=Ct.toCss(Wt,Ht,zt),S=Ct.toRgba(Wt,Ht,zt);return{css:g,rgba:S}}e.blend=t;function i(h){return(h.rgba&255)===255}e.isOpaque=i;function r(h,c,u){let d=Va.ensureContrastRatio(h.rgba,c.rgba,u);if(d)return Ct.toColor(d>>24&255,d>>16&255,d>>8&255)}e.ensureContrastRatio=r;function s(h){let c=(h.rgba|255)>>>0;return[Wt,Ht,zt]=Va.toChannels(c),{css:Ct.toCss(Wt,Ht,zt),rgba:c}}e.opaque=s;function n(h,c){return ft=Math.round(c*255),[Wt,Ht,zt]=Va.toChannels(h.rgba),{css:Ct.toCss(Wt,Ht,zt,ft),rgba:Ct.toRgba(Wt,Ht,zt,ft)}}e.opacity=n;function o(h,c){return ft=h.rgba&255,n(h,ft*c/255)}e.multiplyOpacity=o;function l(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=l})(rt||(rt={}));var dt;(e=>{let t,i;try{let s=document.createElement("canvas");s.width=1,s.height=1;let n=s.getContext("2d",{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Wt=parseInt(s.slice(1,2).repeat(2),16),Ht=parseInt(s.slice(2,3).repeat(2),16),zt=parseInt(s.slice(3,4).repeat(2),16),Ct.toColor(Wt,Ht,zt);case 5:return Wt=parseInt(s.slice(1,2).repeat(2),16),Ht=parseInt(s.slice(2,3).repeat(2),16),zt=parseInt(s.slice(3,4).repeat(2),16),ft=parseInt(s.slice(4,5).repeat(2),16),Ct.toColor(Wt,Ht,zt,ft);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let n=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Wt=parseInt(n[1]),Ht=parseInt(n[2]),zt=parseInt(n[3]),ft=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Ct.toColor(Wt,Ht,zt,ft);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Wt,Ht,zt,ft]=t.getImageData(0,0,1,1).data,ft!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ct.toRgba(Wt,Ht,zt,ft),css:s}}e.toColor=r})(dt||(dt={}));var oi;(e=>{function t(r){return i(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function i(r,s,n){let o=r/255,l=s/255,h=n/255,c=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),u=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),d=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return c*.2126+u*.7152+d*.0722}e.relativeLuminance2=i})(oi||(oi={}));var Va;(e=>{function t(o,l){if(ft=(l&255)/255,ft===1)return l;let h=l>>24&255,c=l>>16&255,u=l>>8&255,d=o>>24&255,f=o>>16&255,_=o>>8&255;return Wt=d+Math.round((h-d)*ft),Ht=f+Math.round((c-f)*ft),zt=_+Math.round((u-_)*ft),Ct.toRgba(Wt,Ht,zt)}e.blend=t;function i(o,l,h){let c=oi.relativeLuminance(o>>8),u=oi.relativeLuminance(l>>8);if(Lr(c,u)<h){if(u<c){let _=r(o,l,h),p=Lr(c,oi.relativeLuminance(_>>8));if(p<h){let b=s(o,l,h),g=Lr(c,oi.relativeLuminance(b>>8));return p>g?_:b}return _}let d=s(o,l,h),f=Lr(c,oi.relativeLuminance(d>>8));if(f<h){let _=r(o,l,h),p=Lr(c,oi.relativeLuminance(_>>8));return f>p?d:_}return d}}e.ensureContrastRatio=i;function r(o,l,h){let c=o>>24&255,u=o>>16&255,d=o>>8&255,f=l>>24&255,_=l>>16&255,p=l>>8&255,b=Lr(oi.relativeLuminance2(f,_,p),oi.relativeLuminance2(c,u,d));for(;b<h&&(f>0||_>0||p>0);)f-=Math.max(0,Math.ceil(f*.1)),_-=Math.max(0,Math.ceil(_*.1)),p-=Math.max(0,Math.ceil(p*.1)),b=Lr(oi.relativeLuminance2(f,_,p),oi.relativeLuminance2(c,u,d));return(f<<24|_<<16|p<<8|255)>>>0}e.reduceLuminance=r;function s(o,l,h){let c=o>>24&255,u=o>>16&255,d=o>>8&255,f=l>>24&255,_=l>>16&255,p=l>>8&255,b=Lr(oi.relativeLuminance2(f,_,p),oi.relativeLuminance2(c,u,d));for(;b<h&&(f<255||_<255||p<255);)f=Math.min(255,f+Math.ceil((255-f)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),b=Lr(oi.relativeLuminance2(f,_,p),oi.relativeLuminance2(c,u,d));return(f<<24|_<<16|p<<8|255)>>>0}e.increaseLuminance=s;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=n})(Va||(Va={}));function Ls(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Lr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var c0=class extends pa{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},cl=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Yi}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 i=[],r=t.translateToString(!0),s=0,n=0,o=0,l=t.getFg(0),h=t.getBg(0);for(let c=0;c<t.getTrimmedLength();c++)if(t.loadCell(c,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==l||this._workCell.bg!==h){if(c-s>1){let u=this._getJoinedRanges(r,o,n,t,s);for(let d=0;d<u.length;d++)i.push(u[d])}s=c,o=n,l=this._workCell.fg,h=this._workCell.bg}n+=this._workCell.getChars().length||bs.length}if(this._bufferService.cols-s>1){let c=this._getJoinedRanges(r,o,n,t,s);for(let u=0;u<c.length;u++)i.push(c[u])}return i}_getJoinedRanges(e,t,i,r,s){let n=e.substring(t,i),o=[];try{o=this._characterJoiners[0].handler(n)}catch(l){console.error(l)}for(let l=1;l<this._characterJoiners.length;l++)try{let h=this._characterJoiners[l].handler(n);for(let c=0;c<h.length;c++)cl._mergeRanges(o,h[c])}catch(h){console.error(h)}return this._stringRangesToCellRanges(o,r,s),o}_stringRangesToCellRanges(e,t,i){let r=0,s=!1,n=0,o=e[r];if(o){for(let l=i;l<this._bufferService.cols;l++){let h=t.getWidth(l),c=t.getString(l).length||bs.length;if(h!==0){if(!s&&o[0]<=n&&(o[0]=l,s=!0),o[1]<=n){if(o[1]=l,o=e[++r],!o)break;o[0]<=n?(o[0]=l,s=!0):s=!1}n+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let i=!1;for(let r=0;r<e.length;r++){let s=e[r];if(i){if(t[1]<=s[0])return e[r-1][1]=t[1],e;if(t[1]<=s[1])return e[r-1][1]=Math.max(t[1],s[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=s[0])return e.splice(r,0,t),e;if(t[1]<=s[1])return s[0]=Math.min(t[0],s[0]),e;t[0]<s[1]&&(s[0]=Math.min(t[0],s[0]),i=!0);continue}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};cl=gt([fe(0,hi)],cl);function d0(e){return 57508<=e&&e<=57558}function u0(e){return 9472<=e&&e<=9631}function f0(e){return d0(e)||u0(e)}function _0(){return{css:{canvas:Oa(),cell:Oa()},device:{canvas:Oa(),cell:Oa(),char:{width:0,height:0,left:0,top:0}}}}function Oa(){return{width:0,height:0}}var vc=class{constructor(e,t,i,r,s,n,o){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=r,this._coreService=s,this._decorationService=n,this._themeService=o,this._workCell=new Yi,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,r,s,n,o,l,h,c,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),_=this._themeService.colors,p=e.getNoBgTrimmedLength();i&&p<n+1&&(p=n+1);let b,g=0,S="",x=0,C=0,w=0,k=0,M=!1,B=0,K=!1,j=0,se=0,Y=[],N=c!==-1&&u!==-1;for(let L=0;L<p;L++){e.loadCell(L,this._workCell);let T=this._workCell.getWidth();if(T===0)continue;let O=!1,U=L>=se,R=L,E=this._workCell;if(f.length>0&&L===f[0][0]&&U){let Re=f.shift(),Ze=this._isCellInSelection(Re[0],t);for(x=Re[0]+1;x<Re[1];x++)U&&(U=Ze===this._isCellInSelection(x,t));U&&(U=!i||n<Re[0]||n>=Re[1]),U?(O=!0,E=new c0(this._workCell,e.translateToString(!0,Re[0],Re[1]),Re[1]-Re[0]),R=Re[1]-1,T=E.getWidth()):se=Re[1]}let J=this._isCellInSelection(L,t),te=i&&L===n,pe=N&&L>=c&&L<=u,ke=!1;this._decorationService.forEachDecorationAtCell(L,t,void 0,Re=>{ke=!0});let ue=E.getChars()||bs;if(ue===" "&&(E.isUnderline()||E.isOverline())&&(ue=" "),j=T*l-h.get(ue,E.isBold(),E.isItalic()),!b)b=this._document.createElement("span");else if(g&&(J&&K||!J&&!K&&E.bg===C)&&(J&&K&&_.selectionForeground||E.fg===w)&&E.extended.ext===k&&pe===M&&j===B&&!te&&!O&&!ke&&U){E.isInvisible()?S+=bs:S+=ue,g++;continue}else g&&(b.textContent=S),b=this._document.createElement("span"),g=0,S="";if(C=E.bg,w=E.fg,k=E.extended.ext,M=pe,B=j,K=J,O&&n>=L&&n<=R&&(n=L),!this._coreService.isCursorHidden&&te&&this._coreService.isCursorInitialized){if(Y.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&Y.push("xterm-cursor-blink"),Y.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":Y.push("xterm-cursor-outline");break;case"block":Y.push("xterm-cursor-block");break;case"bar":Y.push("xterm-cursor-bar");break;case"underline":Y.push("xterm-cursor-underline");break}}if(E.isBold()&&Y.push("xterm-bold"),E.isItalic()&&Y.push("xterm-italic"),E.isDim()&&Y.push("xterm-dim"),E.isInvisible()?S=bs:S=E.getChars()||bs,E.isUnderline()&&(Y.push(`xterm-underline-${E.extended.underlineStyle}`),S===" "&&(S=" "),!E.isUnderlineColorDefault()))if(E.isUnderlineColorRGB())b.style.textDecorationColor=`rgb(${pa.toColorRGB(E.getUnderlineColor()).join(",")})`;else{let Re=E.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&E.isBold()&&Re<8&&(Re+=8),b.style.textDecorationColor=_.ansi[Re].css}E.isOverline()&&(Y.push("xterm-overline"),S===" "&&(S=" ")),E.isStrikethrough()&&Y.push("xterm-strikethrough"),pe&&(b.style.textDecoration="underline");let Ce=E.getFgColor(),De=E.getFgColorMode(),Te=E.getBgColor(),ve=E.getBgColorMode(),ye=!!E.isInverse();if(ye){let Re=Ce;Ce=Te,Te=Re;let Ze=De;De=ve,ve=Ze}let ge,Oe,Ne=!1;this._decorationService.forEachDecorationAtCell(L,t,void 0,Re=>{Re.options.layer!=="top"&&Ne||(Re.backgroundColorRGB&&(ve=50331648,Te=Re.backgroundColorRGB.rgba>>8&16777215,ge=Re.backgroundColorRGB),Re.foregroundColorRGB&&(De=50331648,Ce=Re.foregroundColorRGB.rgba>>8&16777215,Oe=Re.foregroundColorRGB),Ne=Re.options.layer==="top")}),!Ne&&J&&(ge=this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque,Te=ge.rgba>>8&16777215,ve=50331648,Ne=!0,_.selectionForeground&&(De=50331648,Ce=_.selectionForeground.rgba>>8&16777215,Oe=_.selectionForeground)),Ne&&Y.push("xterm-decoration-top");let Ue;switch(ve){case 16777216:case 33554432:Ue=_.ansi[Te],Y.push(`xterm-bg-${Te}`);break;case 50331648:Ue=Ct.toColor(Te>>16,Te>>8&255,Te&255),this._addStyle(b,`background-color:#${Uu((Te>>>0).toString(16),"0",6)}`);break;case 0:default:ye?(Ue=_.foreground,Y.push("xterm-bg-257")):Ue=_.background}switch(ge||E.isDim()&&(ge=rt.multiplyOpacity(Ue,.5)),De){case 16777216:case 33554432:E.isBold()&&Ce<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Ce+=8),this._applyMinimumContrast(b,Ue,_.ansi[Ce],E,ge,void 0)||Y.push(`xterm-fg-${Ce}`);break;case 50331648:let Re=Ct.toColor(Ce>>16&255,Ce>>8&255,Ce&255);this._applyMinimumContrast(b,Ue,Re,E,ge,Oe)||this._addStyle(b,`color:#${Uu(Ce.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(b,Ue,_.foreground,E,ge,Oe)||ye&&Y.push("xterm-fg-257")}Y.length&&(b.className=Y.join(" "),Y.length=0),!te&&!O&&!ke&&U?g++:b.textContent=S,j!==this.defaultSpacing&&(b.style.letterSpacing=`${j}px`),d.push(b),L=R}return b&&g&&(b.textContent=S),d}_applyMinimumContrast(e,t,i,r,s,n){if(this._optionsService.rawOptions.minimumContrastRatio===1||f0(r.getCode()))return!1;let o=this._getContrastCache(r),l;if(!s&&!n&&(l=o.getColor(t.rgba,i.rgba)),l===void 0){let h=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);l=rt.ensureContrastRatio(s||t,n||i,h),o.setColor((s||t).rgba,(n||i).rgba,l??null)}return l?(this._addStyle(e,`color:${l.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 i=this._selectionStart,r=this._selectionEnd;return!i||!r?!1:this._columnSelectMode?i[0]<=r[0]?e>=i[0]&&t>=i[1]&&e<r[0]&&t<=r[1]:e<i[0]&&t>=i[1]&&e>=r[0]&&t<=r[1]:t>i[1]&&t<r[1]||i[1]===r[1]&&t===i[1]&&e>=i[0]&&e<r[0]||i[1]<r[1]&&t===r[1]&&e<r[0]||i[1]<r[1]&&t===i[1]&&e>=i[0]}};vc=gt([fe(1,jv),fe(2,ci),fe(3,Zr),fe(4,Sn),fe(5,ga),fe(6,_o)],vc);function Uu(e,t,i){for(;e.length<i;)e=t+e;return e}var v0=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 i=e.createElement("span");i.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontStyle="italic";let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold",n.style.fontStyle="italic",this._measureElements=[i,r,s,n],this._container.appendChild(i),this._container.appendChild(r),this._container.appendChild(s),this._container.appendChild(n),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,i,r){e===this._font&&t===this._fontSize&&i===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,i){let r=0;if(!t&&!i&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let o=this._measure(e,0);return o>0&&(this._flat[r]=o),o}let s=e;t&&(s+="B"),i&&(s+="I");let n=this._holey.get(s);if(n===void 0){let o=0;t&&(o|=1),i&&(o|=2),n=this._measure(e,o),n>0&&this._holey.set(s,n)}return n}_measure(e,t){let i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}},p0=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,i,r=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let s=e.buffers.active.ydisp,n=t[1]-s,o=i[1]-s,l=Math.max(n,0),h=Math.min(o,e.rows-1);if(l>=e.rows||h<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=l,this.viewportCappedEndRow=h,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol):!1}};function g0(){return new p0}var hh="xterm-dom-renderer-owner-",Ai="xterm-rows",La="xterm-fg-",Ku="xterm-bg-",So="xterm-focus",Ia="xterm-selection",m0=1,pc=class extends He{constructor(e,t,i,r,s,n,o,l,h,c,u,d,f,_){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=r,this._viewportElement=s,this._helperContainer=n,this._linkifier2=o,this._charSizeService=h,this._optionsService=c,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=_,this._terminalClass=m0++,this._rowElements=[],this._selectionRenderModel=g0(),this.onRequestRedraw=this._register(new ae).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Ai),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(Ia),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=_0(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(p=>this._injectCss(p))),this._injectCss(this._themeService.colors),this._rowFactory=l.createInstance(vc,document),this._element.classList.add(hh+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(p=>this._handleLinkHover(p))),this._register(this._linkifier2.onHideLinkUnderline(p=>this._handleLinkLeave(p))),this._register(lt(()=>{this._element.classList.remove(hh+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new v0(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 i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Ai} 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} .${Ai} { 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} .${Ai} .xterm-dim { color: ${rt.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 i=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,s=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${s} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Ai}.${So} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Ai}.${So} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Ai}.${So} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Ai} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Ai} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Ai} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Ai} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Ai} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Ia} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Ia} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Ia} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,o]of e.ansi.entries())t+=`${this._terminalSelector} .${La}${n} { color: ${o.css}; }${this._terminalSelector} .${La}${n}.xterm-dim { color: ${rt.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${Ku}${n} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${La}257 { color: ${rt.opaque(e.background).css}; }${this._terminalSelector} .${La}257.xterm-dim { color: ${rt.multiplyOpacity(rt.opaque(e.background),.5).css}; }${this._terminalSelector} .${Ku}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 i=this._rowElements.length;i<=t;i++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}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(So),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(So),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,i),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,s=this._selectionRenderModel.viewportEndRow,n=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(i){let h=e[0]>t[0];l.appendChild(this._createSelectionElement(n,h?t[0]:e[0],h?e[0]:t[0],o-n+1))}else{let h=r===n?e[0]:0,c=n===s?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(n,h,c));let u=o-n-1;if(l.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,u)),n!==o){let d=s===o?t[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(o,0,d))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,t,i,r=1){let s=this._document.createElement("div"),n=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(i-t);return n+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-n),s.style.height=`${r*this.dimensions.css.cell.height}px`,s.style.top=`${e*this.dimensions.css.cell.height}px`,s.style.left=`${n}px`,s.style.width=`${o}px`,s}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 i=this._bufferService.buffer,r=i.ybase+i.y,s=Math.min(i.x,this._bufferService.cols-1),n=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,l=this._optionsService.rawOptions.cursorInactiveStyle;for(let h=e;h<=t;h++){let c=h+i.ydisp,u=this._rowElements[h],d=i.lines.get(c);if(!u||!d)break;u.replaceChildren(...this._rowFactory.createRow(d,c,c===r,o,l,s,n,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${hh}${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,i,r,s,n){i<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;i=Math.max(Math.min(i,o),0),r=Math.max(Math.min(r,o),0),s=Math.min(s,this._bufferService.cols);let l=this._bufferService.buffer,h=l.ybase+l.y,c=Math.min(l.x,s-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let _=i;_<=r;++_){let p=_+l.ydisp,b=this._rowElements[_],g=l.lines.get(p);if(!b||!g)break;b.replaceChildren(...this._rowFactory.createRow(g,p,p===h,d,f,c,u,this.dimensions.css.cell.width,this._widthCache,n?_===i?e:0:-1,n?(_===r?t:s)-1:-1))}}};pc=gt([fe(7,bd),fe(8,Bl),fe(9,ci),fe(10,hi),fe(11,Sn),fe(12,Zr),fe(13,_o)],pc);var gc=class extends He{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ae),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new y0(this._optionsService))}catch{this._measureStrategy=this._register(new b0(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())}};gc=gt([fe(2,ci)],gc);var cp=class extends He{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)}},b0=class extends cp{constructor(e,t,i){super(),this._document=e,this._parentElement=t,this._optionsService=i,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}},y0=class extends cp{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 new 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}},S0=class extends He{constructor(e,t,i){super(),this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new w0(this._window)),this._onDprChange=this._register(new ae),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ae),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(Xt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Ae(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Ae(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}},w0=class extends He{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new ao),this._onDprChange=this._register(new ae),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(lt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Ae(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.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)}},C0=class extends He{constructor(){super(),this.linkProviders=[],this._register(lt(()=>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 Dd(e,t,i){let r=i.getBoundingClientRect(),s=e.getComputedStyle(i),n=parseInt(s.getPropertyValue("padding-left")),o=parseInt(s.getPropertyValue("padding-top"));return[t.clientX-r.left-n,t.clientY-r.top-o]}function k0(e,t,i,r,s,n,o,l,h){if(!n)return;let c=Dd(e,t,i);if(c)return c[0]=Math.ceil((c[0]+(h?o/2:0))/o),c[1]=Math.ceil(c[1]/l),c[0]=Math.min(Math.max(c[0],1),r+(h?1:0)),c[1]=Math.min(Math.max(c[1],1),s),c}var mc=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,r,s){return k0(window,e,t,i,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(e,t){let i=Dd(window,e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};mc=gt([fe(0,Qr),fe(1,Bl)],mc);var x0=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,i){this._rowCount=i,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):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=[]}},dp={};IS(dp,{getSafariVersion:()=>D0,isChromeOS:()=>vp,isFirefox:()=>up,isIpad:()=>T0,isIphone:()=>R0,isLegacyEdge:()=>E0,isLinux:()=>Td,isMac:()=>dl,isNode:()=>Nl,isSafari:()=>fp,isWindows:()=>_p});var Nl=typeof process<"u"&&"title"in process,ma=Nl?"node":navigator.userAgent,ba=Nl?"node":navigator.platform,up=ma.includes("Firefox"),E0=ma.includes("Edge"),fp=/^((?!chrome|android).)*safari/i.test(ma);function D0(){if(!fp)return 0;let e=ma.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var dl=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(ba),T0=ba==="iPad",R0=ba==="iPhone",_p=["Windows","Win16","Win32","WinCE"].includes(ba),Td=ba.indexOf("Linux")>=0,vp=/\bCrOS\b/.test(ma),pp=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),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,r=e.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),s=e.timeRemaining(),i*1.5>s){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=s}this.clear()}},P0=class extends pp{_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())}}},M0=class extends pp{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},ul=!Nl&&"requestIdleCallback"in window?M0:P0,A0=class{constructor(){this._queue=new ul}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},bc=class extends He{constructor(e,t,i,r,s,n,o,l,h){super(),this._rowCount=e,this._optionsService=i,this._charSizeService=r,this._coreService=s,this._coreBrowserService=l,this._renderer=this._register(new ao),this._pausedResizeTask=new A0,this._observerDisposable=this._register(new ao),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 ae),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ae),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ae),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ae),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new x0((c,u)=>this._renderRows(c,u),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new O0(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(lt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var c;return(c=this._renderer.value)==null?void 0:c.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(n.onDecorationRegistered(()=>this._fullRefresh())),this._register(n.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(h.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let i=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=lt(()=>i.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,i=!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)),i||(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),this._needsSelectionRefresh=!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(t=>this.refreshRows(t.start,t.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(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),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(()=>{var i;return(i=this._renderer.value)==null?void 0:i.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,i){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,i)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};bc=gt([fe(2,ci),fe(3,Bl),fe(4,Sn),fe(5,ga),fe(6,hi),fe(7,Zr),fe(8,_o)],bc);var O0=class{constructor(e,t,i){this._coreBrowserService=e,this._coreService=t,this._onTimeout=i,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 L0(e,t,i,r){let s=i.buffer.x,n=i.buffer.y;if(!i.buffer.hasScrollback)return N0(s,n,e,t,i,r)+Fl(n,t,i,r)+F0(s,n,e,t,i,r);let o;if(n===t)return o=s>e?"D":"C",$o(Math.abs(s-e),Go(o,r));o=n>t?"D":"C";let l=Math.abs(n-t),h=B0(n>t?e:s,i)+(l-1)*i.cols+1+I0(n>t?s:e);return $o(h,Go(o,r))}function I0(e,t){return e-1}function B0(e,t){return t.cols-e}function N0(e,t,i,r,s,n){return Fl(t,r,s,n).length===0?"":$o(mp(e,t,e,t-bn(t,s),!1,s).length,Go("D",n))}function Fl(e,t,i,r){let s=e-bn(e,i),n=t-bn(t,i),o=Math.abs(s-n)-W0(e,t,i);return $o(o,Go(gp(e,t),r))}function F0(e,t,i,r,s,n){let o;Fl(t,r,s,n).length>0?o=r-bn(r,s):o=t;let l=r,h=H0(e,t,i,r,s,n);return $o(mp(e,o,i,l,h==="C",s).length,Go(h,n))}function W0(e,t,i){var o;let r=0,s=e-bn(e,i),n=t-bn(t,i);for(let l=0;l<Math.abs(s-n);l++){let h=gp(e,t)==="A"?-1:1;(o=i.buffer.lines.get(s+h*l))!=null&&o.isWrapped&&r++}return r}function bn(e,t){let i=0,r=t.buffer.lines.get(e),s=r==null?void 0:r.isWrapped;for(;s&&e>=0&&e<t.rows;)i++,r=t.buffer.lines.get(--e),s=r==null?void 0:r.isWrapped;return i}function H0(e,t,i,r,s,n){let o;return Fl(i,r,s,n).length>0?o=r-bn(r,s):o=t,e<i&&o<=r||e>=i&&o<r?"C":"D"}function gp(e,t){return e>t?"A":"B"}function mp(e,t,i,r,s,n){let o=e,l=t,h="";for(;(o!==i||l!==r)&&l>=0&&l<n.buffer.lines.length;)o+=s?1:-1,s&&o>n.cols-1?(h+=n.buffer.translateBufferLineToString(l,!1,e,o),o=0,e=0,l++):!s&&o<0&&(h+=n.buffer.translateBufferLineToString(l,!1,0,e+1),o=n.cols-1,e=o,l--);return h+n.buffer.translateBufferLineToString(l,!1,e,o)}function Go(e,t){let i=t?"O":"[";return q.ESC+i+e}function $o(e,t){e=Math.floor(e);let i="";for(let r=0;r<e;r++)i+=t;return i}var z0=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 qu(e,t){if(e.start.y>e.end.y)throw new 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 ch=50,U0=15,K0=50,q0=500,j0=" ",Y0=new RegExp(j0,"g"),yc=class extends He{constructor(e,t,i,r,s,n,o,l,h){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=r,this._coreService=s,this._mouseService=n,this._optionsService=o,this._renderService=l,this._coreBrowserService=h,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Yi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ae),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ae),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ae),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ae),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new z0(this._bufferService),this._activeSelectionMode=0,this._register(lt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.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 i=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let s=e[0]<t[0]?e[0]:t[0],n=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let l=i.translateBufferLineToString(o,!0,s,n);r.push(l)}}else{let s=e[1]===t[1]?t[0]:void 0;r.push(i.translateBufferLineToString(e[1],!0,e[0],s));for(let n=e[1]+1;n<=t[1]-1;n++){let o=i.lines.get(n),l=i.translateBufferLineToString(n,!0);o!=null&&o.isWrapped?r[r.length-1]+=l:r.push(l)}if(e[1]!==t[1]){let n=i.lines.get(t[1]),o=i.translateBufferLineToString(t[1],!0,0,t[0]);n&&n.isWrapped?r[r.length-1]+=o:r.push(o)}}return r.map(s=>s.replace(Y0," ")).join(_p?`\r
|
|
35
35
|
`:`
|
|
36
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),kd&&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),i=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!i||!r||!t?!1:this._areCoordsInSelection(t,i,r)}isCellInSelection(e,t){let i=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!i||!r?!1:this._areCoordsInSelection([e,t],i,r)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]<i[1]||t[1]===i[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<i[0]||t[1]<i[1]&&e[1]===i[1]&&e[0]<i[0]||t[1]<i[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var s,n;let i=(n=(s=this._linkifier.currentLink)==null?void 0:s.link)==null?void 0:n.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=Nu(i,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=Cd(this._coreBrowserService.window,e,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-nh),nh),t/=nh,t/Math.abs(t)+Math.round(t*(M0-1)))}shouldForceSelection(e){return hl?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(),A0)}_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&&!(hl&&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 i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){let r=i.lines.get(this._model.selectionEnd[1]);r&&r.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<O0&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&i[0]!==void 0&&i[1]!==void 0){let r=C0(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!i){this._oldHasSelection&&this._fireOnSelectionChange(e,t,i);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,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let r=0;t>=r;r++){let s=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?i--:s>1&&t!==r&&(i+=s-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let s=this._bufferService.buffer,n=s.lines.get(e[1]);if(!n)return;let o=s.translateBufferLineToString(e[1],!1),l=this._convertViewportColToCharacterIndex(n,e[0]),h=l,c=e[0]-l,u=0,d=0,f=0,_=0;if(o.charAt(l)===" "){for(;l>0&&o.charAt(l-1)===" ";)l--;for(;h<o.length&&o.charAt(h+1)===" ";)h++}else{let g=e[0],S=e[0];n.getWidth(g)===0&&(u++,g--),n.getWidth(S)===2&&(d++,S++);let x=n.getString(S).length;for(x>1&&(_+=x-1,h+=x-1);g>0&&l>0&&!this._isCharWordSeparator(n.loadCell(g-1,this._workCell));){n.loadCell(g-1,this._workCell);let C=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,g--):C>1&&(f+=C-1,l-=C-1),l--,g--}for(;S<n.length&&h+1<o.length&&!this._isCharWordSeparator(n.loadCell(S+1,this._workCell));){n.loadCell(S+1,this._workCell);let C=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,S++):C>1&&(_+=C-1,h+=C-1),h++,S++}}h++;let p=l+c-u+f,b=Math.min(this._bufferService.cols,h-l+u+d-f-_);if(!(!t&&o.slice(l,h).trim()==="")){if(i&&p===0&&n.getCodePoint(0)!==32){let g=s.lines.get(e[1]-1);if(g&&n.isWrapped&&g.getCodePoint(this._bufferService.cols-1)!==32){let S=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(S){let x=this._bufferService.cols-S.start;p-=x,b+=x}}}if(r&&p+b===this._bufferService.cols&&n.getCodePoint(this._bufferService.cols-1)!==32){let g=s.lines.get(e[1]+1);if(g!=null&&g.isWrapped&&g.getCodePoint(0)!==32){let S=this._getWordAt([0,e[1]+1],!1,!1,!0);S&&(b+=S.length)}}return{start:p,length:b}}}_selectWordAt(e,t){let i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),i={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=Nu(i,this._bufferService.cols)}};pc=pt([_e(3,li),_e(4,yn),_e(5,pd),_e(6,hi),_e(7,Qr),_e(8,Zr)],pc);var Fu=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Wu=class{constructor(){this._color=new Fu,this._css=new Fu}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},xt=Object.freeze((()=>{let e=[ct.toColor("#2e3436"),ct.toColor("#cc0000"),ct.toColor("#4e9a06"),ct.toColor("#c4a000"),ct.toColor("#3465a4"),ct.toColor("#75507b"),ct.toColor("#06989a"),ct.toColor("#d3d7cf"),ct.toColor("#555753"),ct.toColor("#ef2929"),ct.toColor("#8ae234"),ct.toColor("#fce94f"),ct.toColor("#729fcf"),ct.toColor("#ad7fa8"),ct.toColor("#34e2e2"),ct.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){let r=t[i/36%6|0],s=t[i/6%6|0],n=t[i%6];e.push({css:Ct.toCss(r,s,n),rgba:Ct.toRgba(r,s,n)})}for(let i=0;i<24;i++){let r=8+i*10;e.push({css:Ct.toCss(r,r,r),rgba:Ct.toRgba(r,r,r)})}return e})()),Is=ct.toColor("#ffffff"),Eo=ct.toColor("#000000"),Hu=ct.toColor("#ffffff"),zu=Eo,bo={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},B0=Is,gc=class extends He{constructor(e){super(),this._optionsService=e,this._contrastCache=new Wu,this._halfContrastCache=new Wu,this._onChangeColors=this._register(new ae),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Is,background:Eo,cursor:Hu,cursorAccent:zu,selectionForeground:void 0,selectionBackgroundTransparent:bo,selectionBackgroundOpaque:ot.blend(Eo,bo),selectionInactiveBackgroundTransparent:bo,selectionInactiveBackgroundOpaque:ot.blend(Eo,bo),scrollbarSliderBackground:ot.opacity(Is,.2),scrollbarSliderHoverBackground:ot.opacity(Is,.4),scrollbarSliderActiveBackground:ot.opacity(Is,.5),overviewRulerBorder:Is,ansi:xt.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=Je(e.foreground,Is),t.background=Je(e.background,Eo),t.cursor=ot.blend(t.background,Je(e.cursor,Hu)),t.cursorAccent=ot.blend(t.background,Je(e.cursorAccent,zu)),t.selectionBackgroundTransparent=Je(e.selectionBackground,bo),t.selectionBackgroundOpaque=ot.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Je(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=ot.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Je(e.selectionForeground,Lu):void 0,t.selectionForeground===Lu&&(t.selectionForeground=void 0),ot.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=ot.opacity(t.selectionBackgroundTransparent,.3)),ot.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=ot.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Je(e.scrollbarSliderBackground,ot.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Je(e.scrollbarSliderHoverBackground,ot.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Je(e.scrollbarSliderActiveBackground,ot.opacity(t.foreground,.5)),t.overviewRulerBorder=Je(e.overviewRulerBorder,B0),t.ansi=xt.slice(),t.ansi[0]=Je(e.black,xt[0]),t.ansi[1]=Je(e.red,xt[1]),t.ansi[2]=Je(e.green,xt[2]),t.ansi[3]=Je(e.yellow,xt[3]),t.ansi[4]=Je(e.blue,xt[4]),t.ansi[5]=Je(e.magenta,xt[5]),t.ansi[6]=Je(e.cyan,xt[6]),t.ansi[7]=Je(e.white,xt[7]),t.ansi[8]=Je(e.brightBlack,xt[8]),t.ansi[9]=Je(e.brightRed,xt[9]),t.ansi[10]=Je(e.brightGreen,xt[10]),t.ansi[11]=Je(e.brightYellow,xt[11]),t.ansi[12]=Je(e.brightBlue,xt[12]),t.ansi[13]=Je(e.brightMagenta,xt[13]),t.ansi[14]=Je(e.brightCyan,xt[14]),t.ansi[15]=Je(e.brightWhite,xt[15]),e.extendedAnsi){let i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<i;r++)t.ansi[r+16]=Je(e.extendedAnsi[r],xt[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 t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];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()}}};gc=pt([_e(0,hi)],gc);function Je(e,t){if(e!==void 0)try{return ct.toColor(e)}catch{}return t}var N0=class{constructor(...e){this._entries=new Map;for(let[t,i]of e)this.set(t,i)}set(e,t){let i=this._entries.get(e);return this._entries.set(e,t),i}forEach(e){for(let[t,i]of this._entries.entries())e(t,i)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},F0=class{constructor(){this._services=new N0,this._services.set(vd,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=MS(e).sort((n,o)=>n.index-o.index),r=[];for(let n of i){let o=this._services.get(n.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${n.id._id}.`);r.push(o)}let s=i.length>0?i[0].index:t.length;if(t.length!==s)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${s+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},W0={trace:0,debug:1,info:2,warn:3,error:4,off:5},H0="xterm.js: ",mc=class extends He{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=W0[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,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":H0)+t,...i)}trace(e,...t){var i;this._logLevel<=0&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var i;this._logLevel<=1&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var i;this._logLevel<=2&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var i;this._logLevel<=3&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var i;this._logLevel<=4&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,t)}};mc=pt([_e(0,hi)],mc);var Uu=class extends He{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ae),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ae),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ae),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let i=0;i<Math.min(e,this.length);i++)t[i]=this._array[this._getCyclicIndex(i)];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 new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...i){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+i.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<i.length;r++)this._array[this._getCyclicIndex(e+r)]=i[r];if(i.length&&this.onInsertEmitter.fire({index:e,amount:i.length}),this._length+i.length>this._maxLength){let r=this._length+i.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let s=t-1;s>=0;s--)this.set(e+s+i,this.get(e+s));let r=e+t+i-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+i,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},We=3,wt=Object.freeze(new fa),La=0,oh=2,Do=class up{constructor(t,i,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*We);let s=i||ji.fromCharData([0,Mv,1,0]);for(let n=0;n<t;++n)this.setCell(n,s);this.length=t}get(t){let i=this._data[t*We+0],r=i&2097151;return[this._data[t*We+1],i&2097152?this._combined[t]:r?os(r):"",i>>22,i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,i){this._data[t*We+1]=i[0],i[1].length>1?(this._combined[t]=i[1],this._data[t*We+0]=t|2097152|i[2]<<22):this._data[t*We+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(t){return this._data[t*We+0]>>22}hasWidth(t){return this._data[t*We+0]&12582912}getFg(t){return this._data[t*We+1]}getBg(t){return this._data[t*We+2]}hasContent(t){return this._data[t*We+0]&4194303}getCodePoint(t){let i=this._data[t*We+0];return i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i&2097151}isCombined(t){return this._data[t*We+0]&2097152}getString(t){let i=this._data[t*We+0];return i&2097152?this._combined[t]:i&2097151?os(i&2097151):""}isProtected(t){return this._data[t*We+2]&536870912}loadCell(t,i){return La=t*We,i.content=this._data[La+0],i.fg=this._data[La+1],i.bg=this._data[La+2],i.content&2097152&&(i.combinedData=this._combined[t]),i.bg&268435456&&(i.extended=this._extendedAttrs[t]),i}setCell(t,i){i.content&2097152&&(this._combined[t]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*We+0]=i.content,this._data[t*We+1]=i.fg,this._data[t*We+2]=i.bg}setCellFromCodepoint(t,i,r,s){s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*We+0]=i|r<<22,this._data[t*We+1]=s.fg,this._data[t*We+2]=s.bg}addCodepointToCell(t,i,r){let s=this._data[t*We+0];s&2097152?this._combined[t]+=os(i):s&2097151?(this._combined[t]=os(s&2097151)+os(i),s&=-2097152,s|=2097152):s=i|1<<22,r&&(s&=-12582913,s|=r<<22),this._data[t*We+0]=s}insertCells(t,i,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),i<this.length-t){let s=new ji;for(let n=this.length-t-i-1;n>=0;--n)this.setCell(t+i+n,this.loadCell(t+n,s));for(let n=0;n<i;++n)this.setCell(t+n,r)}else for(let s=t;s<this.length;++s)this.setCell(s,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,i,r){if(t%=this.length,i<this.length-t){let s=new ji;for(let n=0;n<this.length-t-i;++n)this.setCell(t+n,this.loadCell(t+i+n,s));for(let n=this.length-i;n<this.length;++n)this.setCell(n,r)}else for(let s=t;s<this.length;++s)this.setCell(s,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,i,r,s=!1){if(s){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,r);t<i&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,r);t<i&&t<this.length;)this.setCell(t++,r)}resize(t,i){if(t===this.length)return this._data.length*4*oh<this._data.buffer.byteLength;let r=t*We;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let s=new Uint32Array(r);s.set(this._data),this._data=s}for(let s=this.length;s<t;++s)this.setCell(s,i)}else{this._data=this._data.subarray(0,r);let s=Object.keys(this._combined);for(let o=0;o<s.length;o++){let l=parseInt(s[o],10);l>=t&&delete this._combined[l]}let n=Object.keys(this._extendedAttrs);for(let o=0;o<n.length;o++){let l=parseInt(n[o],10);l>=t&&delete this._extendedAttrs[l]}}return this.length=t,r*4*oh<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*oh<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,i=!1){if(i){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let i in t._combined)this._combined[i]=t._combined[i];this._extendedAttrs={};for(let i in t._extendedAttrs)this._extendedAttrs[i]=t._extendedAttrs[i];this.isWrapped=t.isWrapped}clone(){let t=new up(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let i in this._combined)t._combined[i]=this._combined[i];for(let i in this._extendedAttrs)t._extendedAttrs[i]=this._extendedAttrs[i];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*We+0]&4194303)return t+(this._data[t*We+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*We+0]&4194303||this._data[t*We+2]&50331648)return t+(this._data[t*We+0]>>22);return 0}copyCellsFrom(t,i,r,s,n){let o=t._data;if(n)for(let h=s-1;h>=0;h--){for(let c=0;c<We;c++)this._data[(r+h)*We+c]=o[(i+h)*We+c];o[(i+h)*We+2]&268435456&&(this._extendedAttrs[r+h]=t._extendedAttrs[i+h])}else for(let h=0;h<s;h++){for(let c=0;c<We;c++)this._data[(r+h)*We+c]=o[(i+h)*We+c];o[(i+h)*We+2]&268435456&&(this._extendedAttrs[r+h]=t._extendedAttrs[i+h])}let l=Object.keys(t._combined);for(let h=0;h<l.length;h++){let c=parseInt(l[h],10);c>=i&&(this._combined[c-i+r]=t._combined[c])}}translateToString(t,i,r,s){i=i??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),s&&(s.length=0);let n="";for(;i<r;){let o=this._data[i*We+0],l=o&2097151,h=o&2097152?this._combined[i]:l?os(l):bs;if(n+=h,s)for(let c=0;c<h.length;++c)s.push(i);i+=o>>22||1}return s&&s.push(i),n}};function z0(e,t,i,r,s,n){let o=[];for(let l=0;l<e.length-1;l++){let h=l,c=e.get(++h);if(!c.isWrapped)continue;let u=[e.get(l)];for(;h<e.length&&c.isWrapped;)u.push(c),c=e.get(++h);if(!n&&r>=l&&r<h){l+=u.length-1;continue}let d=0,f=Vo(u,d,t),_=1,p=0;for(;_<u.length;){let g=Vo(u,_,t),S=g-p,x=i-f,C=Math.min(S,x);u[d].copyCellsFrom(u[_],p,f,C,!1),f+=C,f===i&&(d++,f=0),p+=C,p===g&&(_++,p=0),f===0&&d!==0&&u[d-1].getWidth(i-1)===2&&(u[d].copyCellsFrom(u[d-1],i-1,f++,1,!1),u[d-1].setCell(i-1,s))}u[d].replaceCells(f,i,s);let b=0;for(let g=u.length-1;g>0&&(g>d||u[g].getTrimmedLength()===0);g--)b++;b>0&&(o.push(l+u.length-b),o.push(b)),l+=u.length-1}return o}function U0(e,t){let i=[],r=0,s=t[r],n=0;for(let o=0;o<e.length;o++)if(s===o){let l=t[++r];e.onDeleteEmitter.fire({index:o-n,amount:l}),o+=l-1,n+=l,s=t[++r]}else i.push(o);return{layout:i,countRemoved:n}}function K0(e,t){let i=[];for(let r=0;r<t.length;r++)i.push(e.get(t[r]));for(let r=0;r<i.length;r++)e.set(r,i[r]);e.length=t.length}function q0(e,t,i){let r=[],s=e.map((h,c)=>Vo(e,c,t)).reduce((h,c)=>h+c),n=0,o=0,l=0;for(;l<s;){if(s-l<i){r.push(s-l);break}n+=i;let h=Vo(e,o,t);n>h&&(n-=h,o++);let c=e[o].getWidth(n-1)===2;c&&n--;let u=c?i-1:i;r.push(u),l+=u}return r}function Vo(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(i-1)&&e[t].getWidth(i-1)===1,s=e[t+1].getWidth(0)===2;return r&&s?i-1:i}var fp=class _p{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=_p._nextId++,this._onDispose=this.register(new ae),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),gn(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};fp._nextId=1;var j0=fp,Mt={},Bs=Mt.B;Mt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Mt.A={"#":"£"};Mt.B=void 0;Mt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Mt.C=Mt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Mt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Mt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Mt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Mt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Mt.E=Mt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Mt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Mt.H=Mt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Mt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Ku=4294967295,qu=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=wt.clone(),this.savedCharset=Bs,this.markers=[],this._nullCell=ji.fromCharData([0,Mv,1,0]),this._whitespaceCell=ji.fromCharData([0,bs,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new cl,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Uu(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 ol),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 ol),this._whitespaceCell}getBlankLine(e,t){return new Do(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>Ku?Ku:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=wt);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 Uu(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(wt),r=0,s=this._getCorrectBufferLength(t);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)r+=+this.lines.get(o).resize(e,i);let n=0;if(this._rows<t)for(let o=this._rows;o<t;o++)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 Do(e,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new Do(e,i)));else for(let o=this._rows;o>t;o--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let o=this.lines.length-s;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=s}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),n&&(this.y+=n),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 n=0;n<this.lines.length;n++)r+=+this.lines.get(n).resize(e,i);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 i=this._optionsService.rawOptions.reflowCursorLine,r=z0(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(wt),i);if(r.length>0){let s=U0(this.lines,r);K0(this.lines,s.layout),this._reflowLargerAdjustViewport(e,t,s.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let r=this.getNullCell(wt),s=i;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Do(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(wt),s=[],n=0;for(let o=this.lines.length-1;o>=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let h=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),h.unshift(l);if(!i){let C=this.ybase+this.y;if(C>=o&&C<o+h.length)continue}let c=h[h.length-1].getTrimmedLength(),u=q0(h,this._cols,e),d=u.length-h.length,f;this.ybase===0&&this.y!==this.lines.length-1?f=Math.max(0,this.y-this.lines.maxLength+d):f=Math.max(0,this.lines.length-this.lines.maxLength+d);let _=[];for(let C=0;C<d;C++){let w=this.getBlankLine(wt,!0);_.push(w)}_.length>0&&(s.push({start:o+h.length+n,newLines:_}),n+=_.length),h.push(..._);let p=u.length-1,b=u[p];b===0&&(p--,b=u[p]);let g=h.length-d-1,S=c;for(;g>=0;){let C=Math.min(S,b);if(h[p]===void 0)break;if(h[p].copyCellsFrom(h[g],S-C,b-C,C,!0),b-=C,b===0&&(p--,b=u[p]),S-=C,S===0){g--;let w=Math.max(g,0);S=Vo(h,w,this._cols)}}for(let C=0;C<h.length;C++)u[C]<e&&h[C].setCell(u[C],r);let x=d-f;for(;x-- >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+n)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(s.length>0){let o=[],l=[];for(let b=0;b<this.lines.length;b++)l.push(this.lines.get(b));let h=this.lines.length,c=h-1,u=0,d=s[u];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let f=0;for(let b=Math.min(this.lines.maxLength-1,h+n-1);b>=0;b--)if(d&&d.start>c+f){for(let g=d.newLines.length-1;g>=0;g--)this.lines.set(b--,d.newLines[g]);b++,o.push({index:c+1,amount:d.newLines.length}),f+=d.newLines.length,d=s[++u]}else this.lines.set(b,l[c--]);let _=0;for(let b=o.length-1;b>=0;b--)o[b].index+=_,this.lines.onInsertEmitter.fire(o[b]),_+=o[b].amount;let p=Math.max(0,h+n-this.lines.maxLength);p>0&&this.lines.onTrimEmitter.fire(p)}}translateBufferLineToString(e,t,i=0,r){let s=this.lines.get(e);return s?s.translateToString(t,i,r):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:t,last:i}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(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 j0(e);return this.markers.push(t),t.register(this.lines.onTrim(i=>{t.line-=i,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(i=>{t.line>=i.index&&(t.line+=i.amount)})),t.register(this.lines.onDelete(i=>{t.line>=i.index&&t.line<i.index+i.amount&&t.dispose(),t.line>i.index&&(t.line-=i.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},Y0=class extends He{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ae),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 qu(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new qu(!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)}},vp=2,pp=1,bc=class extends He{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ae),this.onResize=this._onResize.event,this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,vp),this.rows=Math.max(e.rawOptions.rows||0,pp),this.buffers=this._register(new Y0(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let i=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:i,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let i=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=i.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let s=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(i.scrollTop===0){let o=i.lines.isFull;n===i.lines.length-1?o?i.lines.recycle().copyFrom(r):i.lines.push(r.clone()):i.lines.splice(n+1,0,r.clone()),o?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let o=n-s+1;i.lines.shiftElements(s+1,o-1,-1),i.lines.set(n,r.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t){let i=this.buffer;if(e<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let r=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),r!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};bc=pt([_e(0,hi)],bc);var wn={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:hl,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},V0=["normal","bold","100","200","300","400","500","600","700","800","900"],G0=class extends He{constructor(e){super(),this._onOptionChange=this._register(new ae),this.onOptionChange=this._onOptionChange.event;let t={...wn};for(let i in e)if(i in t)try{let r=e[i];t[i]=this._sanitizeAndValidateOption(i,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(lt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(i=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(i=>{e.indexOf(i)!==-1&&t()})}_setupOptions(){let e=i=>{if(!(i in wn))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},t=(i,r)=>{if(!(i in wn))throw new Error(`No option with key "${i}"`);r=this._sanitizeAndValidateOption(i,r),this.rawOptions[i]!==r&&(this.rawOptions[i]=r,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let r={get:e.bind(this,i),set:t.bind(this,i)};Object.defineProperty(this.options,i,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=wn[e]),!X0(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=wn[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=V0.includes(t)?t:wn[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new 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 new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function X0(e){return e==="block"||e==="underline"||e==="bar"}function To(e,t=5){if(typeof e!="object")return e;let i=Array.isArray(e)?[]:{};for(let r in e)i[r]=t<=1?e[r]:e[r]&&To(e[r],t-1);return i}var ju=Object.freeze({insertMode:!1}),Yu=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),yc=class extends He{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new ae),this.onData=this._onData.event,this._onUserInput=this._register(new ae),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ae),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ae),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=To(ju),this.decPrivateModes=To(Yu)}reset(){this.modes=To(ju),this.decPrivateModes=To(Yu)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.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(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};yc=pt([_e(0,li),_e(1,Bv),_e(2,hi)],yc);var Vu={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 ah(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(i|=64,i|=e.action):(i|=e.button&3,e.button&4&&(i|=64),e.button&8&&(i|=128),e.action===32?i|=32:e.action===0&&!t&&(i|=3)),i}var lh=String.fromCharCode,Gu={DEFAULT:e=>{let t=[ah(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${lh(t[0])}${lh(t[1])}${lh(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${ah(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${ah(e,!0)};${e.x};${e.y}${t}`}},Sc=class extends He{constructor(e,t,i){super(),this._bufferService=e,this._coreService=t,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ae),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(Vu))this.addProtocol(r,Vu[r]);for(let r of Object.keys(Gu))this.addEncoding(r,Gu[r]);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 new 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 new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,i){if(e.deltaY===0||e.shiftKey||t===void 0||i===void 0)return 0;let r=t/i,s=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=r+0,Math.abs(e.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_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,i){if(i){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)}};Sc=pt([_e(0,li),_e(1,yn),_e(2,hi)],Sc);var hh=[[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]],$0=[[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]],Et;function Z0(e,t){let i=0,r=t.length-1,s;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=i;)if(s=i+r>>1,e>t[s][1])i=s+1;else if(e<t[s][0])r=s-1;else return!0;return!1}var Q0=class{constructor(){if(this.version="6",!Et){Et=new Uint8Array(65536),Et.fill(1),Et[0]=0,Et.fill(0,1,32),Et.fill(0,127,160),Et.fill(2,4352,4448),Et[9001]=2,Et[9002]=2,Et.fill(2,11904,42192),Et[12351]=1,Et.fill(2,44032,55204),Et.fill(2,63744,64256),Et.fill(2,65040,65050),Et.fill(2,65072,65136),Et.fill(2,65280,65377),Et.fill(2,65504,65511);for(let e=0;e<hh.length;++e)Et.fill(0,hh[e][0],hh[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Et[e]:Z0(e,$0)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),r=i===0&&t!==0;if(r){let s=Us.extractWidth(t);s===0?r=!1:s>i&&(i=s)}return Us.createPropertyValue(0,i,r)}},Us=class Ya{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ae,this.onChange=this._onChange.event;let t=new Q0;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,i,r=!1){return(t&16777215)<<3|(i&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let i=0,r=0,s=t.length;for(let n=0;n<s;++n){let o=t.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=s)return i+this.wcwidth(o);let c=t.charCodeAt(n);56320<=c&&c<=57343?o=(o-55296)*1024+c-56320+65536:i+=this.wcwidth(c)}let l=this.charProperties(o,r),h=Ya.extractWidth(l);Ya.extractShouldJoin(l)&&(h-=Ya.extractWidth(r)),i+=h,r=l}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},J0=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 Xu(e){var r;let t=(r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:r.get(e.cols-1),i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);i&&t&&(i.isWrapped=t[3]!==0&&t[3]!==32)}var yo=2147483647,e1=256,gp=class wc{constructor(t=32,i=32){if(this.maxLength=t,this.maxSubParamsLength=i,i>e1)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let i=new wc;if(!t.length)return i;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let s=t[r];if(Array.isArray(s))for(let n=0;n<s.length;++n)i.addSubParam(s[n]);else i.addParam(s)}return i}clone(){let t=new wc(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 t=[];for(let i=0;i<this.length;++i){t.push(this.params[i]);let r=this._subParamsIdx[i]>>8,s=this._subParamsIdx[i]&255;s-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,s))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>yo?yo:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>yo?yo:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let i=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-i>0?this._subParams.subarray(i,r):null}getSubParamsAll(){let t={};for(let i=0;i<this.length;++i){let r=this._subParamsIdx[i]>>8,s=this._subParamsIdx[i]&255;s-r>0&&(t[i]=this._subParams.slice(r,s))}return t}addDigit(t){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,s=r[i-1];r[i-1]=~s?Math.min(s*10+t,yo):t}},So=[],t1=class{constructor(){this._state=0,this._active=So,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 i=this._handlers[e];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,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=So}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=So,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||So,!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,i){if(!this._active.length)this._handlerFb(this._id,"PUT",Ol(e,t,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,i)}start(){this.reset(),this._state=1}put(e,t,i){if(this._state!==3){if(this._state===1)for(;t<i;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&i-t>0&&this._put(e,t,i)}}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 i=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&i===!1){for(;r>=0&&(i=this._active[r].end(e),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=So,this._id=-1,this._state=0}}},Ci=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=Ol(e,t,i),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(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,t}},wo=[],i1=class{constructor(){this._handlers=Object.create(null),this._active=wo,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=wo}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,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=wo,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||wo,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(t)}put(e,t,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",Ol(e,t,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,i)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let i=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&i===!1){for(;r>=0&&(i=this._active[r].unhook(e),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=wo,this._ident=0}},Ro=new gp;Ro.addParam(0);var $u=class{constructor(e){this._handler=e,this._data="",this._params=Ro,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Ro,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=Ol(e,t,i),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(i=>(this._params=Ro,this._data="",this._hitLimit=!1,i));return this._params=Ro,this._data="",this._hitLimit=!1,t}},r1=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,r){this.table[t<<8|e]=i<<4|r}addMany(e,t,i,r){for(let s=0;s<e.length;s++)this.table[t<<8|e[s]]=i<<4|r}},Wi=160,s1=(function(){let e=new r1(4095),t=Array.apply(null,Array(256)).map((l,h)=>h),i=(l,h)=>t.slice(l,h),r=i(32,127),s=i(0,24);s.push(25),s.push.apply(s,i(28,32));let n=i(0,14),o;e.setDefault(1,0),e.addMany(r,0,2,0);for(o in n)e.addMany([24,26,153,154],o,3,0),e.addMany(i(128,144),o,3,0),e.addMany(i(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(s,0,3,0),e.addMany(s,1,3,1),e.add(127,1,0,1),e.addMany(s,8,0,8),e.addMany(s,3,3,3),e.add(127,3,0,3),e.addMany(s,4,3,4),e.add(127,4,0,4),e.addMany(s,6,3,6),e.addMany(s,5,3,5),e.add(127,5,0,5),e.addMany(s,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(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(s,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(s,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(s,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(s,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(s,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(s,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(Wi,0,2,0),e.add(Wi,8,5,8),e.add(Wi,6,0,6),e.add(Wi,11,0,11),e.add(Wi,13,13,13),e})(),n1=class extends He{constructor(e=s1){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 gp,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,i,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,i)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(lt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new t1),this._dcsParser=this._register(new i1),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let s=0;s<e.intermediates.length;++s){let n=e.intermediates.charCodeAt(s);if(32>n||n>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=n}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=r,i}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 i=this._identifier(e,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let r=this._escHandlers[i];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,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 i=this._identifier(e);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let r=this._csiHandlers[i];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,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,i,r,s){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=r,this._parseStack.chunkPos=s}parse(e,t,i){let r=0,s=0,n=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,n=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let l=this._parseStack.handlers,h=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&h>-1){for(;h>=0&&(o=l[h](this._params),o!==!0);h--)if(o instanceof Promise)return this._parseStack.handlerPos=h,o}this._parseStack.handlers=[];break;case 4:if(i===!1&&h>-1){for(;h>=0&&(o=l[h](),o!==!0);h--)if(o instanceof Promise)return this._parseStack.handlerPos=h,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,i),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,i),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,n=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let l=n;l<t;++l){switch(r=e[l],s=this._transitions.table[this.currentState<<8|(r<160?r:Wi)],s>>4){case 2:for(let f=l+1;;++f){if(f>=t||(r=e[f])<32||r>126&&r<Wi){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(r=e[f])<32||r>126&&r<Wi){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(r=e[f])<32||r>126&&r<Wi){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(r=e[f])<32||r>126&&r<Wi){this._printHandler(e,l,f),l=f-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:l,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let h=this._csiHandlers[this._collect<<8|r],c=h?h.length-1:-1;for(;c>=0&&(o=h[c](this._params),o!==!0);c--)if(o instanceof Promise)return this._preserveStack(3,h,c,s,l),o;c<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(++l<t&&(r=e[l])>47&&r<60);l--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let u=this._escHandlers[this._collect<<8|r],d=u?u.length-1:-1;for(;d>=0&&(o=u[d](),o!==!0);d--)if(o instanceof Promise)return this._preserveStack(4,u,d,s,l),o;d<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 f=l+1;;++f)if(f>=t||(r=e[f])===24||r===26||r===27||r>127&&r<Wi){this._dcsParser.put(e,l,f),l=f-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,s,l),o;r===27&&(s|=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 f=l+1;;f++)if(f>=t||(r=e[f])<32||r>127&&r<Wi){this._oscParser.put(e,l,f),l=f-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,s,l),o;r===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=s&15}}},o1=/^([\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})$/,a1=/^[\da-f]+$/;function Zu(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let i=o1.exec(t);if(i){let r=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/r*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/r*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),a1.exec(t)&&[3,6,9,12].includes(t.length))){let i=t.length/3,r=[0,0,0];for(let s=0;s<3;++s){let n=parseInt(t.slice(i*s,i*s+i),16);r[s]=i===1?n<<4:i===2?n:i===3?n>>4:n>>8}return r}}function ch(e,t){let i=e.toString(16),r=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function l1(e,t=16){let[i,r,s]=e;return`rgb:${ch(i,t)}/${ch(r,t)}/${ch(s,t)}`}var h1={"(":0,")":1,"*":2,"+":3,"-":1,".":2},rs=131072,Qu=10;function Ju(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 ef=5e3,tf=0,c1=class extends He{constructor(e,t,i,r,s,n,o,l,h=new n1){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=r,this._optionsService=s,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=l,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new RS,this._utf8Decoder=new PS,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=wt.clone(),this._eraseAttrDataInternal=wt.clone(),this._onRequestBell=this._register(new ae),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ae),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ae),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ae),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ae),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ae),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ae),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ae),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ae),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ae),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ae),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ae),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 Cc(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(c=>this._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,u)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:u.toArray()})}),this._parser.setEscHandlerFallback(c=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(c)})}),this._parser.setExecuteHandlerFallback(c=>{this._logService.debug("Unknown EXECUTE code: ",{code:c})}),this._parser.setOscHandlerFallback((c,u,d)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:u,data:d})}),this._parser.setDcsHandlerFallback((c,u,d)=>{u==="HOOK"&&(d=d.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:u,payload:d})}),this._parser.setPrintHandler((c,u,d)=>this.print(c,u,d)),this._parser.registerCsiHandler({final:"@"},c=>this.insertChars(c)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},c=>this.scrollLeft(c)),this._parser.registerCsiHandler({final:"A"},c=>this.cursorUp(c)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},c=>this.scrollRight(c)),this._parser.registerCsiHandler({final:"B"},c=>this.cursorDown(c)),this._parser.registerCsiHandler({final:"C"},c=>this.cursorForward(c)),this._parser.registerCsiHandler({final:"D"},c=>this.cursorBackward(c)),this._parser.registerCsiHandler({final:"E"},c=>this.cursorNextLine(c)),this._parser.registerCsiHandler({final:"F"},c=>this.cursorPrecedingLine(c)),this._parser.registerCsiHandler({final:"G"},c=>this.cursorCharAbsolute(c)),this._parser.registerCsiHandler({final:"H"},c=>this.cursorPosition(c)),this._parser.registerCsiHandler({final:"I"},c=>this.cursorForwardTab(c)),this._parser.registerCsiHandler({final:"J"},c=>this.eraseInDisplay(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},c=>this.eraseInDisplay(c,!0)),this._parser.registerCsiHandler({final:"K"},c=>this.eraseInLine(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},c=>this.eraseInLine(c,!0)),this._parser.registerCsiHandler({final:"L"},c=>this.insertLines(c)),this._parser.registerCsiHandler({final:"M"},c=>this.deleteLines(c)),this._parser.registerCsiHandler({final:"P"},c=>this.deleteChars(c)),this._parser.registerCsiHandler({final:"S"},c=>this.scrollUp(c)),this._parser.registerCsiHandler({final:"T"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"X"},c=>this.eraseChars(c)),this._parser.registerCsiHandler({final:"Z"},c=>this.cursorBackwardTab(c)),this._parser.registerCsiHandler({final:"`"},c=>this.charPosAbsolute(c)),this._parser.registerCsiHandler({final:"a"},c=>this.hPositionRelative(c)),this._parser.registerCsiHandler({final:"b"},c=>this.repeatPrecedingCharacter(c)),this._parser.registerCsiHandler({final:"c"},c=>this.sendDeviceAttributesPrimary(c)),this._parser.registerCsiHandler({prefix:">",final:"c"},c=>this.sendDeviceAttributesSecondary(c)),this._parser.registerCsiHandler({final:"d"},c=>this.linePosAbsolute(c)),this._parser.registerCsiHandler({final:"e"},c=>this.vPositionRelative(c)),this._parser.registerCsiHandler({final:"f"},c=>this.hVPosition(c)),this._parser.registerCsiHandler({final:"g"},c=>this.tabClear(c)),this._parser.registerCsiHandler({final:"h"},c=>this.setMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"h"},c=>this.setModePrivate(c)),this._parser.registerCsiHandler({final:"l"},c=>this.resetMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"l"},c=>this.resetModePrivate(c)),this._parser.registerCsiHandler({final:"m"},c=>this.charAttributes(c)),this._parser.registerCsiHandler({final:"n"},c=>this.deviceStatus(c)),this._parser.registerCsiHandler({prefix:"?",final:"n"},c=>this.deviceStatusPrivate(c)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},c=>this.softReset(c)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},c=>this.setCursorStyle(c)),this._parser.registerCsiHandler({final:"r"},c=>this.setScrollRegion(c)),this._parser.registerCsiHandler({final:"s"},c=>this.saveCursor(c)),this._parser.registerCsiHandler({final:"t"},c=>this.windowOptions(c)),this._parser.registerCsiHandler({final:"u"},c=>this.restoreCursor(c)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},c=>this.insertColumns(c)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},c=>this.deleteColumns(c)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},c=>this.selectProtected(c)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},c=>this.requestMode(c,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},c=>this.requestMode(c,!1)),this._parser.setExecuteHandler(K.BEL,()=>this.bell()),this._parser.setExecuteHandler(K.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(K.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(K.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(K.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(K.BS,()=>this.backspace()),this._parser.setExecuteHandler(K.HT,()=>this.tab()),this._parser.setExecuteHandler(K.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(K.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(qa.IND,()=>this.index()),this._parser.setExecuteHandler(qa.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(qa.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ci(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new Ci(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new Ci(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new Ci(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new Ci(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new Ci(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new Ci(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new Ci(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new Ci(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new Ci(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new Ci(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new Ci(c=>this.restoreCursorColor(c))),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 c in Mt)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new $u((c,u)=>this.requestStatusString(c,u)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,i,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),ef))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${ef} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,r=this._activeBuffer.x,s=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;r=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>rs&&(n=this._parseStack.position+rs)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,c=>String.fromCharCode(c)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(c=>c.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<rs&&(this._parseBuffer=new Uint32Array(Math.min(e.length,rs))),o||this._dirtyRowTracker.clearRange(),e.length>rs)for(let c=n;c<e.length;c+=rs){let u=c+rs<e.length?c+rs:e.length,d=typeof e=="string"?this._stringDecoder.decode(e.substring(c,u),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,u),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,d))return this._preserveStack(r,s,d,c),this._logSlowResolvingAsync(i),i}else if(!o){let c=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,c))return this._preserveStack(r,s,c,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==r||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),h=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);h<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(h,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(e,t,i){let r,s,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,h=this._coreService.decPrivateModes.wraparound,c=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&&i-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 _=t;_<i;++_){if(r=e[_],r<127&&n){let S=n[String.fromCharCode(r)];S&&(r=S.charCodeAt(0))}let p=this._unicodeService.charProperties(r,f);s=Us.extractWidth(p);let b=Us.extractShouldJoin(p),g=b?Us.extractWidth(f):0;if(f=p,o&&this._onA11yChar.fire(os(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-g>l){if(h){let S=d,x=this._activeBuffer.x-g;for(this._activeBuffer.x=g,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),g>0&&d instanceof Do&&d.copyCellsFrom(S,x,0,g,!1);x<l;)S.setCellFromCodepoint(x++,0,1,u)}else if(this._activeBuffer.x=l-1,s===2)continue}if(b&&this._activeBuffer.x){let S=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-S,r,s);for(let x=s-g;--x>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(c&&(d.insertCells(this._activeBuffer.x,s-g,this._activeBuffer.getNullCell(u)),d.getWidth(l-1)===2&&d.setCellFromCodepoint(l-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,s,u),s>0)for(;--s;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<l&&i-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,i=>Ju(i.params[0],this._optionsService.rawOptions.windowOptions)?t(i):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new $u(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Ci(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(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.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,i,r=!1,s=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),s),r&&(n.isWrapped=!1)}_resetBufferLine(e,t=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){var r;this._restrictCursor(this._bufferService.cols);let i;switch(e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);i<this._bufferService.rows;i++)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i))!=null&&r.getTrimmedLength()););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,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 i=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(i,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 i=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(i,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(wt));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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 i=e.params[0]||1,r=Us.extractWidth(t),s=this._activeBuffer.x-r,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),o=new Uint32Array(n.length*i),l=0;for(let c=0;c<n.length;){let u=n.codePointAt(c)||0;o[l++]=u,c+=u>65535?2:1}let h=l;for(let c=1;c<i;++c)o.copyWithin(h,0,l),h+=l;return this.print(o,0,h),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(K.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(K.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(K.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(K.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(K.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,Bs),this._charsetService.setgCharset(1,Bs),this._charsetService.setgCharset(2,Bs),this._charsetService.setgCharset(3,Bs);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){(b=>(b[b.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",b[b.SET=1]="SET",b[b.RESET=2]="RESET",b[b.PERMANENTLY_SET=3]="PERMANENTLY_SET",b[b.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(i={}));let r=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:n}=this._coreMouseService,o=this._coreService,{buffers:l,cols:h}=this._bufferService,{active:c,alt:u}=l,d=this._optionsService.rawOptions,f=(b,g)=>(o.triggerDataEvent(`${K.ESC}[${t?"":"?"}${b};${g}$y`),!0),_=b=>b?1:2,p=e.params[0];return t?p===2?f(p,4):p===4?f(p,_(o.modes.insertMode)):p===12?f(p,3):p===20?f(p,_(d.convertEol)):f(p,0):p===1?f(p,_(r.applicationCursorKeys)):p===3?f(p,d.windowOptions.setWinLines?h===80?2:h===132?1:0:0):p===6?f(p,_(r.origin)):p===7?f(p,_(r.wraparound)):p===8?f(p,3):p===9?f(p,_(s==="X10")):p===12?f(p,_(d.cursorBlink)):p===25?f(p,_(!o.isCursorHidden)):p===45?f(p,_(r.reverseWraparound)):p===66?f(p,_(r.applicationKeypad)):p===67?f(p,4):p===1e3?f(p,_(s==="VT200")):p===1002?f(p,_(s==="DRAG")):p===1003?f(p,_(s==="ANY")):p===1004?f(p,_(r.sendFocus)):p===1005?f(p,4):p===1006?f(p,_(n==="SGR")):p===1015?f(p,4):p===1016?f(p,_(n==="SGR_PIXELS")):p===1048?f(p,1):p===47||p===1047||p===1049?f(p,_(c===u)):p===2004?f(p,_(r.bracketedPasteMode)):p===2026?f(p,_(r.synchronizedOutput)):f(p,0)}_updateAttrColor(e,t,i,r,s){return t===2?(e|=50331648,e&=-16777216,e|=fa.fromColorRGB([i,r,s])):t===5&&(e&=-50331904,e|=33554432|i&255),e}_extractColor(e,t,i){let r=[0,0,-1,0,0,0],s=0,n=0;do{if(r[n+s]=e.params[t+n],e.hasSubParams(t+n)){let o=e.getSubParams(t+n),l=0;do r[1]===5&&(s=1),r[n+l+1+s]=o[l];while(++l<o.length&&l+n+1+s<r.length);break}if(r[1]===5&&n+s>=2||r[1]===2&&n+s>=5)break;r[1]&&(s=1)}while(++n+t<e.length&&n+s<r.length);for(let o=2;o<r.length;++o)r[o]===-1&&(r[o]=0);switch(r[0]){case 38:i.fg=this._updateAttrColor(i.fg,r[1],r[3],r[4],r[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,r[1],r[3],r[4],r[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,r[1],r[3],r[4],r[5])}return n}_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=wt.fg,e.bg=wt.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,i,r=this._curAttrData;for(let s=0;s<t;s++)i=e.params[s],i>=30&&i<=37?(r.fg&=-50331904,r.fg|=16777216|i-30):i>=40&&i<=47?(r.bg&=-50331904,r.bg|=16777216|i-40):i>=90&&i<=97?(r.fg&=-50331904,r.fg|=16777216|i-90|8):i>=100&&i<=107?(r.bg&=-50331904,r.bg|=16777216|i-100|8):i===0?this._processSGR0(r):i===1?r.fg|=134217728:i===3?r.bg|=67108864:i===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(s)?e.getSubParams(s)[0]:1,r)):i===5?r.fg|=536870912:i===7?r.fg|=67108864:i===8?r.fg|=1073741824:i===9?r.fg|=2147483648:i===2?r.bg|=134217728:i===21?this._processUnderline(2,r):i===22?(r.fg&=-134217729,r.bg&=-134217729):i===23?r.bg&=-67108865:i===24?(r.fg&=-268435457,this._processUnderline(0,r)):i===25?r.fg&=-536870913:i===27?r.fg&=-67108865:i===28?r.fg&=-1073741825:i===29?r.fg&=2147483647:i===39?(r.fg&=-67108864,r.fg|=wt.fg&16777215):i===49?(r.bg&=-67108864,r.bg|=wt.bg&16777215):i===38||i===48||i===58?s+=this._extractColor(e,s,r):i===53?r.bg|=1073741824:i===55?r.bg&=-1073741825:i===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):i===100?(r.fg&=-67108864,r.fg|=wt.fg&16777215,r.bg&=-67108864,r.bg|=wt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${K.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${K.ESC}[${t};${i}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${K.ESC}[?${t};${i}R`);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=wt.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 i=t%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(e){let t=e.params[0]||1,i;return(e.length<2||(i=e.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Ju(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(`${K.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Qu&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Qu&&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=[],i=e.split(";");for(;i.length>1;){let r=i.shift(),s=i.shift();if(/^\d+$/.exec(r)){let n=parseInt(r);if(rf(n))if(s==="?")t.push({type:0,index:n});else{let o=Zu(s);o&&t.push({type:1,index:n,color:o})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let i=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(i,r):i.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let i=e.split(":"),r,s=i.findIndex(n=>n.startsWith("id="));return s!==-1&&(r=i[s].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 i=e.split(";");for(let r=0;r<i.length&&!(t>=this._specialColors.length);++r,++t)if(i[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let s=Zu(i[r]);s&&this._onColor.fire([{type:1,index:this._specialColors[t],color:s}])}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=[],i=e.split(";");for(let r=0;r<i.length;++r)if(/^\d+$/.exec(i[r])){let s=parseInt(i[r]);rf(s)&&t.push({type:2,index:s})}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,Bs),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(h1[e[0]],Mt[e[1]]||Bs),!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=wt.clone(),this._eraseAttrDataInternal=wt.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 ji;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let i=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(i);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let i=o=>(this._coreService.triggerDataEvent(`${K.ESC}${o}${K.ESC}\\`),!0),r=this._bufferService.buffer,s=this._optionsService.rawOptions;return i(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"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}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Cc=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&&(tf=e,e=t,t=tf),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Cc=pt([_e(0,li)],Cc);function rf(e){return 0<=e&&e<256}var d1=5e7,sf=12,u1=50,f1=class extends He{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 ae),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 i;for(;i=this._writeBuffer.shift();){this._action(i);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>d1)throw new 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 i=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],s=this._action(r,t);if(s){let o=l=>performance.now()-i>=sf?setTimeout(()=>this._innerWrite(0,l)):this._innerWrite(i,l);s.catch(l=>(queueMicrotask(()=>{throw l}),Promise.resolve(!1))).then(o);return}let n=this._callbacks[this._bufferOffset];if(n&&n(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-i>=sf)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>u1&&(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()}},kc=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 l=t.addMarker(t.ybase+t.y),h={data:e,id:this._nextId++,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(h,l)),this._dataByLinkId.set(h.id,h),h.id}let i=e,r=this._getEntryIdKey(i),s=this._entriesWithId.get(r);if(s)return this.addLineToLink(s.id,t.ybase+t.y),s.id;let n=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(o,n)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let i=this._dataByLinkId.get(e);if(i&&i.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);i.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(i,r))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let i=e.lines.indexOf(t);i!==-1&&(e.lines.splice(i,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};kc=pt([_e(0,li)],kc);var nf=!1,_1=class extends He{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new so),this._onBinary=this._register(new ae),this.onBinary=this._onBinary.event,this._onData=this._register(new ae),this.onData=this._onData.event,this._onLineFeed=this._register(new ae),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ae),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ae),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ae),this._instantiationService=new F0,this.optionsService=this._register(new G0(e)),this._instantiationService.setService(hi,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(bc)),this._instantiationService.setService(li,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(mc)),this._instantiationService.setService(Bv,this._logService),this.coreService=this._register(this._instantiationService.createInstance(yc)),this._instantiationService.setService(yn,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Sc)),this._instantiationService.setService(Iv,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Us)),this._instantiationService.setService(LS,this.unicodeService),this._charsetService=this._instantiationService.createInstance(J0),this._instantiationService.setService(OS,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(kc),this._instantiationService.setService(Nv,this._oscLinkService),this._inputHandler=this._register(new c1(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Gt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Gt.forward(this._bufferService.onResize,this._onResize)),this._register(Gt.forward(this.coreService.onData,this._onData)),this._register(Gt.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 f1((t,i)=>this._inputHandler.parse(t,i))),this._register(Gt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ae),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.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&&!nf&&(this._logService.warn("writeSync is unreliable and will be removed soon."),nf=!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,vp),t=Math.max(t,pp),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(Xu.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Xu(this._bufferService),!1))),this._windowsWrappingHeuristics.value=lt(()=>{for(let t of e)t.dispose()})}}},v1={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 p1(e,t,i,r){var o;let s={type:0,cancel:!1,key:void 0},n=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?s.key=K.ESC+"OA":s.key=K.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?s.key=K.ESC+"OD":s.key=K.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?s.key=K.ESC+"OC":s.key=K.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?s.key=K.ESC+"OB":s.key=K.ESC+"[B");break;case 8:s.key=e.ctrlKey?"\b":K.DEL,e.altKey&&(s.key=K.ESC+s.key);break;case 9:if(e.shiftKey){s.key=K.ESC+"[Z";break}s.key=K.HT,s.cancel=!0;break;case 13:s.key=e.altKey?K.ESC+K.CR:K.CR,s.cancel=!0;break;case 27:s.key=K.ESC,e.altKey&&(s.key=K.ESC+K.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;n?s.key=K.ESC+"[1;"+(n+1)+"D":t?s.key=K.ESC+"OD":s.key=K.ESC+"[D";break;case 39:if(e.metaKey)break;n?s.key=K.ESC+"[1;"+(n+1)+"C":t?s.key=K.ESC+"OC":s.key=K.ESC+"[C";break;case 38:if(e.metaKey)break;n?s.key=K.ESC+"[1;"+(n+1)+"A":t?s.key=K.ESC+"OA":s.key=K.ESC+"[A";break;case 40:if(e.metaKey)break;n?s.key=K.ESC+"[1;"+(n+1)+"B":t?s.key=K.ESC+"OB":s.key=K.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(s.key=K.ESC+"[2~");break;case 46:n?s.key=K.ESC+"[3;"+(n+1)+"~":s.key=K.ESC+"[3~";break;case 36:n?s.key=K.ESC+"[1;"+(n+1)+"H":t?s.key=K.ESC+"OH":s.key=K.ESC+"[H";break;case 35:n?s.key=K.ESC+"[1;"+(n+1)+"F":t?s.key=K.ESC+"OF":s.key=K.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=K.ESC+"[5;"+(n+1)+"~":s.key=K.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=K.ESC+"[6;"+(n+1)+"~":s.key=K.ESC+"[6~";break;case 112:n?s.key=K.ESC+"[1;"+(n+1)+"P":s.key=K.ESC+"OP";break;case 113:n?s.key=K.ESC+"[1;"+(n+1)+"Q":s.key=K.ESC+"OQ";break;case 114:n?s.key=K.ESC+"[1;"+(n+1)+"R":s.key=K.ESC+"OR";break;case 115:n?s.key=K.ESC+"[1;"+(n+1)+"S":s.key=K.ESC+"OS";break;case 116:n?s.key=K.ESC+"[15;"+(n+1)+"~":s.key=K.ESC+"[15~";break;case 117:n?s.key=K.ESC+"[17;"+(n+1)+"~":s.key=K.ESC+"[17~";break;case 118:n?s.key=K.ESC+"[18;"+(n+1)+"~":s.key=K.ESC+"[18~";break;case 119:n?s.key=K.ESC+"[19;"+(n+1)+"~":s.key=K.ESC+"[19~";break;case 120:n?s.key=K.ESC+"[20;"+(n+1)+"~":s.key=K.ESC+"[20~";break;case 121:n?s.key=K.ESC+"[21;"+(n+1)+"~":s.key=K.ESC+"[21~";break;case 122:n?s.key=K.ESC+"[23;"+(n+1)+"~":s.key=K.ESC+"[23~";break;case 123:n?s.key=K.ESC+"[24;"+(n+1)+"~":s.key=K.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?s.key=K.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?s.key=K.DEL:e.keyCode===219?s.key=K.ESC:e.keyCode===220?s.key=K.FS:e.keyCode===221&&(s.key=K.GS);else if((!i||r)&&e.altKey&&!e.metaKey){let l=(o=v1[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(l)s.key=K.ESC+l;else if(e.keyCode>=65&&e.keyCode<=90){let h=e.ctrlKey?e.keyCode-64:e.keyCode+32,c=String.fromCharCode(h);e.shiftKey&&(c=c.toUpperCase()),s.key=K.ESC+c}else if(e.keyCode===32)s.key=K.ESC+(e.ctrlKey?K.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let h=e.code.slice(3,4);e.shiftKey||(h=h.toLowerCase()),s.key=K.ESC+h,s.cancel=!0}}else i&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(s.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?s.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(s.key=K.US),e.key==="@"&&(s.key=K.NUL));break}return s}var gt=0,g1=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new cl,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new cl,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((s,n)=>this._getKey(s)-this._getKey(n)),t=0,i=0,r=new Array(this._array.length+this._insertedValues.length);for(let s=0;s<r.length;s++)i>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(r[s]=e[t],t++):r[s]=this._array[i++];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||(gt=this._search(t),gt===-1)||this._getKey(this._array[gt])!==t)return!1;do if(this._array[gt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(gt),!0;while(++gt<this._array.length&&this._getKey(this._array[gt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((s,n)=>s-n),t=0,i=new Array(this._array.length-e.length),r=0;for(let s=0;s<this._array.length;s++)e[t]===s?t++:i[r++]=this._array[s];this._array=i,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&&(gt=this._search(e),!(gt<0||gt>=this._array.length)&&this._getKey(this._array[gt])===e))do yield this._array[gt];while(++gt<this._array.length&&this._getKey(this._array[gt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(gt=this._search(e),!(gt<0||gt>=this._array.length)&&this._getKey(this._array[gt])===e))do t(this._array[gt]);while(++gt<this._array.length&&this._getKey(this._array[gt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,i=this._array.length-1;for(;i>=t;){let r=t+i>>1,s=this._getKey(this._array[r]);if(s>e)i=r-1;else if(s<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},dh=0,of=0,m1=class extends He{constructor(){super(),this._decorations=new g1(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new ae),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ae),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(lt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new b1(e);if(t){let i=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),i.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,i){let r=0,s=0;for(let n of this._decorations.getKeyIterator(t))r=n.options.x??0,s=r+(n.options.width??1),e>=r&&e<s&&(!i||(n.options.layer??"bottom")===i)&&(yield n)}forEachDecorationAtCell(e,t,i,r){this._decorations.forEachByKey(t,s=>{dh=s.options.x??0,of=dh+(s.options.width??1),e>=dh&&e<of&&(!i||(s.options.layer??"bottom")===i)&&r(s)})}},b1=class extends Es{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ae),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ae),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=ct.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=ct.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},y1=1e3,S1=class{constructor(e,t=y1){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,i){this._rowCount=i,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let s=r-this._lastRefreshMs,n=this._debounceThresholdMS-s;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},n)}}_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)}},af=20,dl=class extends He{constructor(e,t,i,r){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=n=>this._handleBoundaryFocus(n,0),this._bottomBoundaryFocusListener=n=>this._handleBoundaryFocus(n,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=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new S1(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(n=>this._handleResize(n.rows))),this._register(this._terminal.onRender(n=>this._refreshRows(n.start,n.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(n=>this._handleChar(n))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
37
|
-
`))),this._register(this._terminal.onA11yTab(n=>this._handleTab(n))),this._register(this._terminal.onKey(n=>this._handleKey(n.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Ae(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(lt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<
|
|
38
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===af+1&&(this._liveRegion.textContent+=qh.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let i=this._terminal.buffer,r=i.lines.length.toString();for(let s=e;s<=t;s++){let n=i.lines.get(i.ydisp+s),o=[],l=(n==null?void 0:n.translateToString(!0,void 0,void 0,o))||"",h=(i.ydisp+s+1).toString(),c=this._rowElements[s];c&&(l.length===0?(c.textContent=" ",this._rowColumns.set(c,[0,1])):(c.textContent=l,this._rowColumns.set(c,o)),c.setAttribute("aria-posinset",h),c.setAttribute("aria-setsize",r),this._alignRowWidth(c))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],s=i.getAttribute("aria-posinset"),n=t===0?"1":`${this._terminal.buffer.lines.length}`;if(s===n||e.relatedTarget!==r)return;let o,l;if(t===0?(o=i,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=i,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),l.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h)}else{let h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h)}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(){var l;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},i={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===i.node&&t.offset>i.offset)&&([t,i]=[i,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(i.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:r,offset:((l=r.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(i.node))return;let s=({node:h,offset:c})=>{let u=h instanceof Text?h.parentNode:h,d=parseInt(u==null?void 0:u.getAttribute("aria-posinset"),10)-1;if(isNaN(d))return console.warn("row is invalid. Race condition?"),null;let f=this._rowColumns.get(u);if(!f)return console.warn("columns is null. Race condition?"),null;let _=c<f.length?f[c]:f.slice(-1)[0]+1;return _>=this._terminal.cols&&(++d,_=0),{row:d,column:_}},n=s(t),o=s(i);if(!(!n||!o)){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);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){var s,n;e.style.transform="";let t=e.getBoundingClientRect().width,i=(n=(s=this._rowColumns.get(e))==null?void 0:s.slice(-1))==null?void 0:n[0];if(!i)return;let r=i*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};dl=pt([_e(1,vd),_e(2,Zr),_e(3,Qr)],dl);var xc=class extends He{constructor(e,t,i,r,s){super(),this._element=e,this._mouseService=t,this._renderService=i,this._bufferService=r,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ae),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ae),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(lt(()=>{var n;gn(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(n=this._activeProviderReplies)==null||n.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Ae(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ae(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ae(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ae(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 i=e.composedPath();for(let r=0;r<i.length;r++){let s=i[r];if(s.classList.contains("xterm"))break;if(s.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){var r,s;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(n=>{n==null||n.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(let[n,o]of this._linkProviderService.linkProviders.entries())t?(s=this._activeProviderReplies)!=null&&s.get(n)&&(i=this._checkLinkProviderResult(n,e,i)):o.provideLinks(e.y,l=>{var c,u;if(this._isMouseOut)return;let h=l==null?void 0:l.map(d=>({link:d}));(c=this._activeProviderReplies)==null||c.set(n,h),i=this._checkLinkProviderResult(n,e,i),((u=this._activeProviderReplies)==null?void 0:u.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let i=new Set;for(let r=0;r<t.size;r++){let s=t.get(r);if(s)for(let n=0;n<s.length;n++){let o=s[n],l=o.link.range.start.y<e?0:o.link.range.start.x,h=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let c=l;c<=h;c++){if(i.has(c)){s.splice(n--,1);break}i.add(c)}}}}_checkLinkProviderResult(e,t,i){var n;if(!this._activeProviderReplies)return i;let r=this._activeProviderReplies.get(e),s=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(s=!0);if(!s&&r){let o=r.find(l=>this._linkAtPosition(l.link,t));o&&(i=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let o=0;o<this._activeProviderReplies.size;o++){let l=(n=this._activeProviderReplies.get(o))==null?void 0:n.find(h=>this._linkAtPosition(h.link,t));if(l){i=!0,this._handleNewLink(l);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&w1(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,gn(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:()=>{var i,r;return(r=(i=this._currentLink)==null?void 0:i.state)==null?void 0:r.decorations.pointerCursor},set:i=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>{var i,r;return(r=(i=this._currentLink)==null?void 0:i.state)==null?void 0:r.decorations.underline},set:i=>{var r,s,n;(r=this._currentLink)!=null&&r.state&&((n=(s=this._currentLink)==null?void 0:s.state)==null?void 0:n.decorations.underline)!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let r=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(r,s),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(e,t,i){var r;(r=this._currentLink)!=null&&r.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(i,t.text)}_fireUnderlineEvent(e,t){let i=e.range,r=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-r-1,i.end.x,i.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(e,t,i){var r;(r=this._currentLink)!=null&&r.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(i,t.text)}_linkAtPosition(e,t){let i=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,s=t.y*this._bufferService.cols+t.x;return i<=s&&s<=r}_positionFromMouseEvent(e,t,i){let r=i.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,i,r,s){return{x1:e,y1:t,x2:i,y2:r,cols:this._bufferService.cols,fg:s}}};xc=pt([_e(1,pd),_e(2,Qr),_e(3,li),_e(4,Wv)],xc);function w1(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 C1=class extends _1{constructor(e={}){super(e),this._linkifier=this._register(new so),this.browser=sp,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new so),this._onCursorMove=this._register(new ae),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ae),this.onKey=this._onKey.event,this._onRender=this._register(new ae),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ae),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ae),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ae),this.onBell=this._onBell.event,this._onFocus=this._register(new ae),this._onBlur=this._register(new ae),this._onA11yCharEmitter=this._register(new ae),this._onA11yTabEmitter=this._register(new ae),this._onWillOpen=this._register(new ae),this._setup(),this._decorationService=this._instantiationService.createInstance(m1),this._instantiationService.setService(_a,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(u0),this._instantiationService.setService(Wv,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Yh)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(Gt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Gt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Gt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Gt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(lt(()=>{var t,i;this._customKeyEventHandler=void 0,(i=(t=this.element)==null?void 0:t.parentNode)==null||i.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 i,r="";switch(t.index){case 256:i="foreground",r="10";break;case 257:i="background",r="11";break;case 258:i="cursor",r="12";break;default:i="ansi",r="4;"+t.index}switch(t.type){case 0:let s=ot.toColorRGB(i==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${K.ESC}]${r};${l1(s)}${ip.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors(n=>n.ansi[t.index]=Ct.toColor(...t.color));else{let n=i;this._themeService.modifyColors(o=>o[n]=Ct.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(dl,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.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 i=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,s=t.getWidth(i),n=this._renderService.dimensions.css.cell.width*s,o=this.buffer.y*this._renderService.dimensions.css.cell.height,l=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=l+"px",this.textarea.style.top=o+"px",this.textarea.style.width=n+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Ae(this.element,"copy",t=>{this.hasSelection()&&DS(t,this._selectionService)}));let e=t=>TS(t,this.textarea,this.coreService,this.optionsService);this._register(Ae(this.textarea,"paste",e)),this._register(Ae(this.element,"paste",e)),np?this._register(Ae(this.element,"mousedown",t=>{t.button===2&&pu(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ae(this.element,"contextmenu",t=>{pu(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),kd&&this._register(Ae(this.element,"auxclick",t=>{t.button===1&&Pv(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ae(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Ae(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Ae(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Ae(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Ae(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Ae(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ae(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var s;if(!e)throw new 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"),((s=this.element)==null?void 0:s.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(Ae(this.screenElement,"mousemove",n=>this.updateCursorStyle(n))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let i=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Kh.get()),lp||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",()=>i.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(c0,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Zr,this._coreBrowserService),this._register(Ae(this.textarea,"focus",n=>this._handleTextAreaFocus(n))),this._register(Ae(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(fc,this._document,this._helperContainer),this._instantiationService.setService(Ll,this._charSizeService),this._themeService=this._instantiationService.createInstance(gc),this._instantiationService.setService(co,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(ll),this._instantiationService.setService(Fv,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(vc,this.rows,this.screenElement)),this._instantiationService.setService(Qr,this._renderService),this._register(this._renderService.onRenderedViewportChange(n=>this._onRender.fire(n))),this.onResize(n=>this._renderService.resize(n.cols,n.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(cc,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(_c),this._instantiationService.setService(pd,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(xc,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(lc,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(n=>{super.scrollLines(n,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(pc,this.element,this.screenElement,r)),this._instantiationService.setService(BS,this._selectionService),this._register(this._selectionService.onRequestScrollLines(n=>this.scrollLines(n.amount,n.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(n=>this._renderService.handleSelectionChanged(n.start,n.end,n.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(n=>{this.textarea.value=n,this.textarea.focus(),this.textarea.select()})),this._register(Gt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var n;this._selectionService.refresh(),(n=this._viewport)==null||n.queueSync()})),this._register(this._instantiationService.createInstance(hc,this.screenElement)),this._register(Ae(this.element,"mousedown",n=>this._selectionService.handleMouseDown(n))),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(dl,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",n=>this._handleScreenReaderModeOptionChange(n))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(al,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",n=>{!this._overviewRulerRenderer&&n&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(al,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(uc,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function i(n){var c,u,d,f,_;let o=e._mouseService.getMouseReportCoords(n,e.screenElement);if(!o)return!1;let l,h;switch(n.overrideType||n.type){case"mousemove":h=32,n.buttons===void 0?(l=3,n.button!==void 0&&(l=n.button<3?n.button:3)):l=n.buttons&1?0:n.buttons&4?1:n.buttons&2?2:3;break;case"mouseup":h=0,l=n.button<3?n.button:3;break;case"mousedown":h=1,l=n.button<3?n.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(n)===!1)return!1;let p=n.deltaY;if(p===0||e.coreMouseService.consumeWheelEvent(n,(f=(d=(u=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:u.device)==null?void 0:d.cell)==null?void 0:f.height,(_=e._coreBrowserService)==null?void 0:_.dpr)===0)return!1;h=p<0?0:1,l=4;break;default:return!1}return h===void 0||l===void 0||l>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:l,action:h,ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s={mouseup:n=>(i(n),n.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(n)),wheel:n=>(i(n),this.cancel(n,!0)),mousedrag:n=>{n.buttons&&i(n)},mousemove:n=>{n.buttons||i(n)}};this._register(this.coreMouseService.onProtocolChange(n=>{n?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(n)),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()),n&8?r.mousemove||(t.addEventListener("mousemove",s.mousemove),r.mousemove=s.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),n&16?r.wheel||(t.addEventListener("wheel",s.wheel,{passive:!1}),r.wheel=s.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),n&2?r.mouseup||(r.mouseup=s.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),n&4?r.mousedrag||(r.mousedrag=s.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Ae(t,"mousedown",n=>{if(n.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(n)))return i(n),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(n)})),this._register(Ae(t,"wheel",n=>{var o,l,h,c,u;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(n)===!1)return!1;if(!this.buffer.hasScrollback){if(n.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(n,(c=(h=(l=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:l.device)==null?void 0:h.cell)==null?void 0:c.height,(u=e._coreBrowserService)==null?void 0:u.dpr)===0)return this.cancel(n,!0);let d=K.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(n.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(d,!0),this.cancel(n,!0)}}},{passive:!1}))}refresh(e,t){var i;(i=this._renderService)==null||i.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.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){Rv(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 new 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 new 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,i){this._selectionService.setSelection(e,t,i)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var i;(i=this._selectionService)==null||i.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 i=p1(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),i.type===3||i.type===2){let r=this.rows-1;return this.scrollLines(i.type===2?-r:r),this.cancel(e,!0)}if(i.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.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((i.key===K.ETX||i.key===K.CR)&&(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let i=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"?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(k1(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){var i;(i=this._charSizeService)==null||i.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(wt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(K.ESC+"[I"):this.coreService.triggerDataEvent(K.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),i=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${K.ESC}[4;${i};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${K.ESC}[6;${s};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function k1(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var x1=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===e){t=i;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},E1=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 ji)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},lf=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 E1(t)}getNullCell(){return new ji}},D1=class extends He{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ae),this.onBufferChange=this._onBufferChange.event,this._normal=new lf(this._core.buffers.normal,"normal"),this._alternate=new lf(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},T1=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,i=>t(i.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(i,r)=>t(i,r.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)}},R1=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}},P1=["cols","rows"],vr=0,M1=class extends He{constructor(e){super(),this._core=this._register(new C1(e)),this._addonManager=this._register(new x1),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],i=(r,s)=>{this._checkReadonlyOptions(r),this._core.options[r]=s};for(let r in this._core.options){let s={get:t.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this._publicOptions,r,s)}}_checkReadonlyOptions(e){if(P1.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new T1(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new R1(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new D1(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,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}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
|
|
39
|
-
`,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
|
|
36
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Td&&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),i=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!i||!r||!t?!1:this._areCoordsInSelection(t,i,r)}isCellInSelection(e,t){let i=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!i||!r?!1:this._areCoordsInSelection([e,t],i,r)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]<i[1]||t[1]===i[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<i[0]||t[1]<i[1]&&e[1]===i[1]&&e[0]<i[0]||t[1]<i[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var s,n;let i=(n=(s=this._linkifier.currentLink)==null?void 0:s.link)==null?void 0:n.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=qu(i,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=Dd(this._coreBrowserService.window,e,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-ch),ch),t/=ch,t/Math.abs(t)+Math.round(t*(U0-1)))}shouldForceSelection(e){return dl?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(),K0)}_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&&!(dl&&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 i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){let r=i.lines.get(this._model.selectionEnd[1]);r&&r.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<q0&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&i[0]!==void 0&&i[1]!==void 0){let r=L0(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!i){this._oldHasSelection&&this._fireOnSelectionChange(e,t,i);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,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let r=0;t>=r;r++){let s=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?i--:s>1&&t!==r&&(i+=s-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let s=this._bufferService.buffer,n=s.lines.get(e[1]);if(!n)return;let o=s.translateBufferLineToString(e[1],!1),l=this._convertViewportColToCharacterIndex(n,e[0]),h=l,c=e[0]-l,u=0,d=0,f=0,_=0;if(o.charAt(l)===" "){for(;l>0&&o.charAt(l-1)===" ";)l--;for(;h<o.length&&o.charAt(h+1)===" ";)h++}else{let g=e[0],S=e[0];n.getWidth(g)===0&&(u++,g--),n.getWidth(S)===2&&(d++,S++);let x=n.getString(S).length;for(x>1&&(_+=x-1,h+=x-1);g>0&&l>0&&!this._isCharWordSeparator(n.loadCell(g-1,this._workCell));){n.loadCell(g-1,this._workCell);let C=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,g--):C>1&&(f+=C-1,l-=C-1),l--,g--}for(;S<n.length&&h+1<o.length&&!this._isCharWordSeparator(n.loadCell(S+1,this._workCell));){n.loadCell(S+1,this._workCell);let C=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,S++):C>1&&(_+=C-1,h+=C-1),h++,S++}}h++;let p=l+c-u+f,b=Math.min(this._bufferService.cols,h-l+u+d-f-_);if(!(!t&&o.slice(l,h).trim()==="")){if(i&&p===0&&n.getCodePoint(0)!==32){let g=s.lines.get(e[1]-1);if(g&&n.isWrapped&&g.getCodePoint(this._bufferService.cols-1)!==32){let S=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(S){let x=this._bufferService.cols-S.start;p-=x,b+=x}}}if(r&&p+b===this._bufferService.cols&&n.getCodePoint(this._bufferService.cols-1)!==32){let g=s.lines.get(e[1]+1);if(g!=null&&g.isWrapped&&g.getCodePoint(0)!==32){let S=this._getWordAt([0,e[1]+1],!1,!1,!0);S&&(b+=S.length)}}return{start:p,length:b}}}_selectWordAt(e,t){let i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),i={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=qu(i,this._bufferService.cols)}};yc=gt([fe(3,hi),fe(4,Sn),fe(5,yd),fe(6,ci),fe(7,Qr),fe(8,Zr)],yc);var ju=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Yu=class{constructor(){this._color=new ju,this._css=new ju}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Dt=Object.freeze((()=>{let e=[dt.toColor("#2e3436"),dt.toColor("#cc0000"),dt.toColor("#4e9a06"),dt.toColor("#c4a000"),dt.toColor("#3465a4"),dt.toColor("#75507b"),dt.toColor("#06989a"),dt.toColor("#d3d7cf"),dt.toColor("#555753"),dt.toColor("#ef2929"),dt.toColor("#8ae234"),dt.toColor("#fce94f"),dt.toColor("#729fcf"),dt.toColor("#ad7fa8"),dt.toColor("#34e2e2"),dt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){let r=t[i/36%6|0],s=t[i/6%6|0],n=t[i%6];e.push({css:Ct.toCss(r,s,n),rgba:Ct.toRgba(r,s,n)})}for(let i=0;i<24;i++){let r=8+i*10;e.push({css:Ct.toCss(r,r,r),rgba:Ct.toRgba(r,r,r)})}return e})()),Bs=dt.toColor("#ffffff"),Ro=dt.toColor("#000000"),Vu=dt.toColor("#ffffff"),Gu=Ro,wo={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},V0=Bs,Sc=class extends He{constructor(e){super(),this._optionsService=e,this._contrastCache=new Yu,this._halfContrastCache=new Yu,this._onChangeColors=this._register(new ae),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Bs,background:Ro,cursor:Vu,cursorAccent:Gu,selectionForeground:void 0,selectionBackgroundTransparent:wo,selectionBackgroundOpaque:rt.blend(Ro,wo),selectionInactiveBackgroundTransparent:wo,selectionInactiveBackgroundOpaque:rt.blend(Ro,wo),scrollbarSliderBackground:rt.opacity(Bs,.2),scrollbarSliderHoverBackground:rt.opacity(Bs,.4),scrollbarSliderActiveBackground:rt.opacity(Bs,.5),overviewRulerBorder:Bs,ansi:Dt.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=Je(e.foreground,Bs),t.background=Je(e.background,Ro),t.cursor=rt.blend(t.background,Je(e.cursor,Vu)),t.cursorAccent=rt.blend(t.background,Je(e.cursorAccent,Gu)),t.selectionBackgroundTransparent=Je(e.selectionBackground,wo),t.selectionBackgroundOpaque=rt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Je(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=rt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Je(e.selectionForeground,zu):void 0,t.selectionForeground===zu&&(t.selectionForeground=void 0),rt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=rt.opacity(t.selectionBackgroundTransparent,.3)),rt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=rt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Je(e.scrollbarSliderBackground,rt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Je(e.scrollbarSliderHoverBackground,rt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Je(e.scrollbarSliderActiveBackground,rt.opacity(t.foreground,.5)),t.overviewRulerBorder=Je(e.overviewRulerBorder,V0),t.ansi=Dt.slice(),t.ansi[0]=Je(e.black,Dt[0]),t.ansi[1]=Je(e.red,Dt[1]),t.ansi[2]=Je(e.green,Dt[2]),t.ansi[3]=Je(e.yellow,Dt[3]),t.ansi[4]=Je(e.blue,Dt[4]),t.ansi[5]=Je(e.magenta,Dt[5]),t.ansi[6]=Je(e.cyan,Dt[6]),t.ansi[7]=Je(e.white,Dt[7]),t.ansi[8]=Je(e.brightBlack,Dt[8]),t.ansi[9]=Je(e.brightRed,Dt[9]),t.ansi[10]=Je(e.brightGreen,Dt[10]),t.ansi[11]=Je(e.brightYellow,Dt[11]),t.ansi[12]=Je(e.brightBlue,Dt[12]),t.ansi[13]=Je(e.brightMagenta,Dt[13]),t.ansi[14]=Je(e.brightCyan,Dt[14]),t.ansi[15]=Je(e.brightWhite,Dt[15]),e.extendedAnsi){let i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<i;r++)t.ansi[r+16]=Je(e.extendedAnsi[r],Dt[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 t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];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()}}};Sc=gt([fe(0,ci)],Sc);function Je(e,t){if(e!==void 0)try{return dt.toColor(e)}catch{}return t}var G0=class{constructor(...e){this._entries=new Map;for(let[t,i]of e)this.set(t,i)}set(e,t){let i=this._entries.get(e);return this._entries.set(e,t),i}forEach(e){for(let[t,i]of this._entries.entries())e(t,i)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},$0=class{constructor(){this._services=new G0,this._services.set(bd,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=US(e).sort((n,o)=>n.index-o.index),r=[];for(let n of i){let o=this._services.get(n.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${n.id._id}.`);r.push(o)}let s=i.length>0?i[0].index:t.length;if(t.length!==s)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${s+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},X0={trace:0,debug:1,info:2,warn:3,error:4,off:5},Z0="xterm.js: ",wc=class extends He{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=X0[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,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":Z0)+t,...i)}trace(e,...t){var i;this._logLevel<=0&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var i;this._logLevel<=1&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var i;this._logLevel<=2&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var i;this._logLevel<=3&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var i;this._logLevel<=4&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,t)}};wc=gt([fe(0,ci)],wc);var $u=class extends He{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ae),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ae),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ae),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let i=0;i<Math.min(e,this.length);i++)t[i]=this._array[this._getCyclicIndex(i)];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 new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...i){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+i.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<i.length;r++)this._array[this._getCyclicIndex(e+r)]=i[r];if(i.length&&this.onInsertEmitter.fire({index:e,amount:i.length}),this._length+i.length>this._maxLength){let r=this._length+i.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let s=t-1;s>=0;s--)this.set(e+s+i,this.get(e+s));let r=e+t+i-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+i,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},We=3,wt=Object.freeze(new pa),Ba=0,dh=2,Po=class bp{constructor(t,i,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*We);let s=i||Yi.fromCharData([0,Fv,1,0]);for(let n=0;n<t;++n)this.setCell(n,s);this.length=t}get(t){let i=this._data[t*We+0],r=i&2097151;return[this._data[t*We+1],i&2097152?this._combined[t]:r?os(r):"",i>>22,i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,i){this._data[t*We+1]=i[0],i[1].length>1?(this._combined[t]=i[1],this._data[t*We+0]=t|2097152|i[2]<<22):this._data[t*We+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(t){return this._data[t*We+0]>>22}hasWidth(t){return this._data[t*We+0]&12582912}getFg(t){return this._data[t*We+1]}getBg(t){return this._data[t*We+2]}hasContent(t){return this._data[t*We+0]&4194303}getCodePoint(t){let i=this._data[t*We+0];return i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i&2097151}isCombined(t){return this._data[t*We+0]&2097152}getString(t){let i=this._data[t*We+0];return i&2097152?this._combined[t]:i&2097151?os(i&2097151):""}isProtected(t){return this._data[t*We+2]&536870912}loadCell(t,i){return Ba=t*We,i.content=this._data[Ba+0],i.fg=this._data[Ba+1],i.bg=this._data[Ba+2],i.content&2097152&&(i.combinedData=this._combined[t]),i.bg&268435456&&(i.extended=this._extendedAttrs[t]),i}setCell(t,i){i.content&2097152&&(this._combined[t]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*We+0]=i.content,this._data[t*We+1]=i.fg,this._data[t*We+2]=i.bg}setCellFromCodepoint(t,i,r,s){s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*We+0]=i|r<<22,this._data[t*We+1]=s.fg,this._data[t*We+2]=s.bg}addCodepointToCell(t,i,r){let s=this._data[t*We+0];s&2097152?this._combined[t]+=os(i):s&2097151?(this._combined[t]=os(s&2097151)+os(i),s&=-2097152,s|=2097152):s=i|1<<22,r&&(s&=-12582913,s|=r<<22),this._data[t*We+0]=s}insertCells(t,i,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),i<this.length-t){let s=new Yi;for(let n=this.length-t-i-1;n>=0;--n)this.setCell(t+i+n,this.loadCell(t+n,s));for(let n=0;n<i;++n)this.setCell(t+n,r)}else for(let s=t;s<this.length;++s)this.setCell(s,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,i,r){if(t%=this.length,i<this.length-t){let s=new Yi;for(let n=0;n<this.length-t-i;++n)this.setCell(t+n,this.loadCell(t+i+n,s));for(let n=this.length-i;n<this.length;++n)this.setCell(n,r)}else for(let s=t;s<this.length;++s)this.setCell(s,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,i,r,s=!1){if(s){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,r);t<i&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,r);t<i&&t<this.length;)this.setCell(t++,r)}resize(t,i){if(t===this.length)return this._data.length*4*dh<this._data.buffer.byteLength;let r=t*We;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let s=new Uint32Array(r);s.set(this._data),this._data=s}for(let s=this.length;s<t;++s)this.setCell(s,i)}else{this._data=this._data.subarray(0,r);let s=Object.keys(this._combined);for(let o=0;o<s.length;o++){let l=parseInt(s[o],10);l>=t&&delete this._combined[l]}let n=Object.keys(this._extendedAttrs);for(let o=0;o<n.length;o++){let l=parseInt(n[o],10);l>=t&&delete this._extendedAttrs[l]}}return this.length=t,r*4*dh<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*dh<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,i=!1){if(i){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let i in t._combined)this._combined[i]=t._combined[i];this._extendedAttrs={};for(let i in t._extendedAttrs)this._extendedAttrs[i]=t._extendedAttrs[i];this.isWrapped=t.isWrapped}clone(){let t=new bp(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let i in this._combined)t._combined[i]=this._combined[i];for(let i in this._extendedAttrs)t._extendedAttrs[i]=this._extendedAttrs[i];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*We+0]&4194303)return t+(this._data[t*We+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*We+0]&4194303||this._data[t*We+2]&50331648)return t+(this._data[t*We+0]>>22);return 0}copyCellsFrom(t,i,r,s,n){let o=t._data;if(n)for(let h=s-1;h>=0;h--){for(let c=0;c<We;c++)this._data[(r+h)*We+c]=o[(i+h)*We+c];o[(i+h)*We+2]&268435456&&(this._extendedAttrs[r+h]=t._extendedAttrs[i+h])}else for(let h=0;h<s;h++){for(let c=0;c<We;c++)this._data[(r+h)*We+c]=o[(i+h)*We+c];o[(i+h)*We+2]&268435456&&(this._extendedAttrs[r+h]=t._extendedAttrs[i+h])}let l=Object.keys(t._combined);for(let h=0;h<l.length;h++){let c=parseInt(l[h],10);c>=i&&(this._combined[c-i+r]=t._combined[c])}}translateToString(t,i,r,s){i=i??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),s&&(s.length=0);let n="";for(;i<r;){let o=this._data[i*We+0],l=o&2097151,h=o&2097152?this._combined[i]:l?os(l):bs;if(n+=h,s)for(let c=0;c<h.length;++c)s.push(i);i+=o>>22||1}return s&&s.push(i),n}};function Q0(e,t,i,r,s,n){let o=[];for(let l=0;l<e.length-1;l++){let h=l,c=e.get(++h);if(!c.isWrapped)continue;let u=[e.get(l)];for(;h<e.length&&c.isWrapped;)u.push(c),c=e.get(++h);if(!n&&r>=l&&r<h){l+=u.length-1;continue}let d=0,f=Xo(u,d,t),_=1,p=0;for(;_<u.length;){let g=Xo(u,_,t),S=g-p,x=i-f,C=Math.min(S,x);u[d].copyCellsFrom(u[_],p,f,C,!1),f+=C,f===i&&(d++,f=0),p+=C,p===g&&(_++,p=0),f===0&&d!==0&&u[d-1].getWidth(i-1)===2&&(u[d].copyCellsFrom(u[d-1],i-1,f++,1,!1),u[d-1].setCell(i-1,s))}u[d].replaceCells(f,i,s);let b=0;for(let g=u.length-1;g>0&&(g>d||u[g].getTrimmedLength()===0);g--)b++;b>0&&(o.push(l+u.length-b),o.push(b)),l+=u.length-1}return o}function J0(e,t){let i=[],r=0,s=t[r],n=0;for(let o=0;o<e.length;o++)if(s===o){let l=t[++r];e.onDeleteEmitter.fire({index:o-n,amount:l}),o+=l-1,n+=l,s=t[++r]}else i.push(o);return{layout:i,countRemoved:n}}function e1(e,t){let i=[];for(let r=0;r<t.length;r++)i.push(e.get(t[r]));for(let r=0;r<i.length;r++)e.set(r,i[r]);e.length=t.length}function t1(e,t,i){let r=[],s=e.map((h,c)=>Xo(e,c,t)).reduce((h,c)=>h+c),n=0,o=0,l=0;for(;l<s;){if(s-l<i){r.push(s-l);break}n+=i;let h=Xo(e,o,t);n>h&&(n-=h,o++);let c=e[o].getWidth(n-1)===2;c&&n--;let u=c?i-1:i;r.push(u),l+=u}return r}function Xo(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(i-1)&&e[t].getWidth(i-1)===1,s=e[t+1].getWidth(0)===2;return r&&s?i-1:i}var yp=class Sp{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Sp._nextId++,this._onDispose=this.register(new ae),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),mn(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};yp._nextId=1;var i1=yp,Ot={},Ns=Ot.B;Ot[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Ot.A={"#":"£"};Ot.B=void 0;Ot[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Ot.C=Ot[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ot.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Ot.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Ot.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Ot.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Ot.E=Ot[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Ot.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Ot.H=Ot[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ot["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Xu=4294967295,Zu=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=wt.clone(),this.savedCharset=Ns,this.markers=[],this._nullCell=Yi.fromCharData([0,Fv,1,0]),this._whitespaceCell=Yi.fromCharData([0,bs,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new ul,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new $u(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 ll),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 ll),this._whitespaceCell}getBlankLine(e,t){return new Po(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>Xu?Xu:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=wt);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 $u(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(wt),r=0,s=this._getCorrectBufferLength(t);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)r+=+this.lines.get(o).resize(e,i);let n=0;if(this._rows<t)for(let o=this._rows;o<t;o++)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 Po(e,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new Po(e,i)));else for(let o=this._rows;o>t;o--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let o=this.lines.length-s;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=s}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),n&&(this.y+=n),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 n=0;n<this.lines.length;n++)r+=+this.lines.get(n).resize(e,i);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 i=this._optionsService.rawOptions.reflowCursorLine,r=Q0(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(wt),i);if(r.length>0){let s=J0(this.lines,r);e1(this.lines,s.layout),this._reflowLargerAdjustViewport(e,t,s.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let r=this.getNullCell(wt),s=i;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Po(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(wt),s=[],n=0;for(let o=this.lines.length-1;o>=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let h=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),h.unshift(l);if(!i){let C=this.ybase+this.y;if(C>=o&&C<o+h.length)continue}let c=h[h.length-1].getTrimmedLength(),u=t1(h,this._cols,e),d=u.length-h.length,f;this.ybase===0&&this.y!==this.lines.length-1?f=Math.max(0,this.y-this.lines.maxLength+d):f=Math.max(0,this.lines.length-this.lines.maxLength+d);let _=[];for(let C=0;C<d;C++){let w=this.getBlankLine(wt,!0);_.push(w)}_.length>0&&(s.push({start:o+h.length+n,newLines:_}),n+=_.length),h.push(..._);let p=u.length-1,b=u[p];b===0&&(p--,b=u[p]);let g=h.length-d-1,S=c;for(;g>=0;){let C=Math.min(S,b);if(h[p]===void 0)break;if(h[p].copyCellsFrom(h[g],S-C,b-C,C,!0),b-=C,b===0&&(p--,b=u[p]),S-=C,S===0){g--;let w=Math.max(g,0);S=Xo(h,w,this._cols)}}for(let C=0;C<h.length;C++)u[C]<e&&h[C].setCell(u[C],r);let x=d-f;for(;x-- >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+n)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(s.length>0){let o=[],l=[];for(let b=0;b<this.lines.length;b++)l.push(this.lines.get(b));let h=this.lines.length,c=h-1,u=0,d=s[u];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let f=0;for(let b=Math.min(this.lines.maxLength-1,h+n-1);b>=0;b--)if(d&&d.start>c+f){for(let g=d.newLines.length-1;g>=0;g--)this.lines.set(b--,d.newLines[g]);b++,o.push({index:c+1,amount:d.newLines.length}),f+=d.newLines.length,d=s[++u]}else this.lines.set(b,l[c--]);let _=0;for(let b=o.length-1;b>=0;b--)o[b].index+=_,this.lines.onInsertEmitter.fire(o[b]),_+=o[b].amount;let p=Math.max(0,h+n-this.lines.maxLength);p>0&&this.lines.onTrimEmitter.fire(p)}}translateBufferLineToString(e,t,i=0,r){let s=this.lines.get(e);return s?s.translateToString(t,i,r):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:t,last:i}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(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 i1(e);return this.markers.push(t),t.register(this.lines.onTrim(i=>{t.line-=i,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(i=>{t.line>=i.index&&(t.line+=i.amount)})),t.register(this.lines.onDelete(i=>{t.line>=i.index&&t.line<i.index+i.amount&&t.dispose(),t.line>i.index&&(t.line-=i.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},r1=class extends He{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ae),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 Zu(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Zu(!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)}},wp=2,Cp=1,Cc=class extends He{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ae),this.onResize=this._onResize.event,this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,wp),this.rows=Math.max(e.rawOptions.rows||0,Cp),this.buffers=this._register(new r1(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let i=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:i,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let i=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=i.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let s=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(i.scrollTop===0){let o=i.lines.isFull;n===i.lines.length-1?o?i.lines.recycle().copyFrom(r):i.lines.push(r.clone()):i.lines.splice(n+1,0,r.clone()),o?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let o=n-s+1;i.lines.shiftElements(s+1,o-1,-1),i.lines.set(n,r.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t){let i=this.buffer;if(e<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let r=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),r!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};Cc=gt([fe(0,ci)],Cc);var xn={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:dl,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},s1=["normal","bold","100","200","300","400","500","600","700","800","900"],n1=class extends He{constructor(e){super(),this._onOptionChange=this._register(new ae),this.onOptionChange=this._onOptionChange.event;let t={...xn};for(let i in e)if(i in t)try{let r=e[i];t[i]=this._sanitizeAndValidateOption(i,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(lt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(i=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(i=>{e.indexOf(i)!==-1&&t()})}_setupOptions(){let e=i=>{if(!(i in xn))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},t=(i,r)=>{if(!(i in xn))throw new Error(`No option with key "${i}"`);r=this._sanitizeAndValidateOption(i,r),this.rawOptions[i]!==r&&(this.rawOptions[i]=r,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let r={get:e.bind(this,i),set:t.bind(this,i)};Object.defineProperty(this.options,i,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=xn[e]),!o1(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=xn[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=s1.includes(t)?t:xn[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new 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 new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function o1(e){return e==="block"||e==="underline"||e==="bar"}function Mo(e,t=5){if(typeof e!="object")return e;let i=Array.isArray(e)?[]:{};for(let r in e)i[r]=t<=1?e[r]:e[r]&&Mo(e[r],t-1);return i}var Qu=Object.freeze({insertMode:!1}),Ju=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),kc=class extends He{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new ae),this.onData=this._onData.event,this._onUserInput=this._register(new ae),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ae),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ae),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Mo(Qu),this.decPrivateModes=Mo(Ju)}reset(){this.modes=Mo(Qu),this.decPrivateModes=Mo(Ju)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.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(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};kc=gt([fe(0,hi),fe(1,Kv),fe(2,ci)],kc);var ef={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 uh(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(i|=64,i|=e.action):(i|=e.button&3,e.button&4&&(i|=64),e.button&8&&(i|=128),e.action===32?i|=32:e.action===0&&!t&&(i|=3)),i}var fh=String.fromCharCode,tf={DEFAULT:e=>{let t=[uh(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${fh(t[0])}${fh(t[1])}${fh(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${uh(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${uh(e,!0)};${e.x};${e.y}${t}`}},xc=class extends He{constructor(e,t,i){super(),this._bufferService=e,this._coreService=t,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ae),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(ef))this.addProtocol(r,ef[r]);for(let r of Object.keys(tf))this.addEncoding(r,tf[r]);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 new 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 new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,i){if(e.deltaY===0||e.shiftKey||t===void 0||i===void 0)return 0;let r=t/i,s=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=r+0,Math.abs(e.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_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,i){if(i){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)}};xc=gt([fe(0,hi),fe(1,Sn),fe(2,ci)],xc);var _h=[[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]],a1=[[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]],Tt;function l1(e,t){let i=0,r=t.length-1,s;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=i;)if(s=i+r>>1,e>t[s][1])i=s+1;else if(e<t[s][0])r=s-1;else return!0;return!1}var h1=class{constructor(){if(this.version="6",!Tt){Tt=new Uint8Array(65536),Tt.fill(1),Tt[0]=0,Tt.fill(0,1,32),Tt.fill(0,127,160),Tt.fill(2,4352,4448),Tt[9001]=2,Tt[9002]=2,Tt.fill(2,11904,42192),Tt[12351]=1,Tt.fill(2,44032,55204),Tt.fill(2,63744,64256),Tt.fill(2,65040,65050),Tt.fill(2,65072,65136),Tt.fill(2,65280,65377),Tt.fill(2,65504,65511);for(let e=0;e<_h.length;++e)Tt.fill(0,_h[e][0],_h[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Tt[e]:l1(e,a1)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),r=i===0&&t!==0;if(r){let s=Ks.extractWidth(t);s===0?r=!1:s>i&&(i=s)}return Ks.createPropertyValue(0,i,r)}},Ks=class Ga{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ae,this.onChange=this._onChange.event;let t=new h1;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,i,r=!1){return(t&16777215)<<3|(i&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let i=0,r=0,s=t.length;for(let n=0;n<s;++n){let o=t.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=s)return i+this.wcwidth(o);let c=t.charCodeAt(n);56320<=c&&c<=57343?o=(o-55296)*1024+c-56320+65536:i+=this.wcwidth(c)}let l=this.charProperties(o,r),h=Ga.extractWidth(l);Ga.extractShouldJoin(l)&&(h-=Ga.extractWidth(r)),i+=h,r=l}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},c1=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 rf(e){var r;let t=(r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:r.get(e.cols-1),i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);i&&t&&(i.isWrapped=t[3]!==0&&t[3]!==32)}var Co=2147483647,d1=256,kp=class Ec{constructor(t=32,i=32){if(this.maxLength=t,this.maxSubParamsLength=i,i>d1)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let i=new Ec;if(!t.length)return i;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let s=t[r];if(Array.isArray(s))for(let n=0;n<s.length;++n)i.addSubParam(s[n]);else i.addParam(s)}return i}clone(){let t=new Ec(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 t=[];for(let i=0;i<this.length;++i){t.push(this.params[i]);let r=this._subParamsIdx[i]>>8,s=this._subParamsIdx[i]&255;s-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,s))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Co?Co:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Co?Co:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let i=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-i>0?this._subParams.subarray(i,r):null}getSubParamsAll(){let t={};for(let i=0;i<this.length;++i){let r=this._subParamsIdx[i]>>8,s=this._subParamsIdx[i]&255;s-r>0&&(t[i]=this._subParams.slice(r,s))}return t}addDigit(t){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,s=r[i-1];r[i-1]=~s?Math.min(s*10+t,Co):t}},ko=[],u1=class{constructor(){this._state=0,this._active=ko,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 i=this._handlers[e];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,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=ko}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=ko,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||ko,!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,i){if(!this._active.length)this._handlerFb(this._id,"PUT",Il(e,t,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,i)}start(){this.reset(),this._state=1}put(e,t,i){if(this._state!==3){if(this._state===1)for(;t<i;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&i-t>0&&this._put(e,t,i)}}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 i=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&i===!1){for(;r>=0&&(i=this._active[r].end(e),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=ko,this._id=-1,this._state=0}}},ki=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=Il(e,t,i),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(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,t}},xo=[],f1=class{constructor(){this._handlers=Object.create(null),this._active=xo,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=xo}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,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=xo,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||xo,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(t)}put(e,t,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",Il(e,t,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,i)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let i=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&i===!1){for(;r>=0&&(i=this._active[r].unhook(e),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=xo,this._ident=0}},Ao=new kp;Ao.addParam(0);var sf=class{constructor(e){this._handler=e,this._data="",this._params=Ao,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Ao,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=Il(e,t,i),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(i=>(this._params=Ao,this._data="",this._hitLimit=!1,i));return this._params=Ao,this._data="",this._hitLimit=!1,t}},_1=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,r){this.table[t<<8|e]=i<<4|r}addMany(e,t,i,r){for(let s=0;s<e.length;s++)this.table[t<<8|e[s]]=i<<4|r}},Hi=160,v1=(function(){let e=new _1(4095),t=Array.apply(null,Array(256)).map((l,h)=>h),i=(l,h)=>t.slice(l,h),r=i(32,127),s=i(0,24);s.push(25),s.push.apply(s,i(28,32));let n=i(0,14),o;e.setDefault(1,0),e.addMany(r,0,2,0);for(o in n)e.addMany([24,26,153,154],o,3,0),e.addMany(i(128,144),o,3,0),e.addMany(i(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(s,0,3,0),e.addMany(s,1,3,1),e.add(127,1,0,1),e.addMany(s,8,0,8),e.addMany(s,3,3,3),e.add(127,3,0,3),e.addMany(s,4,3,4),e.add(127,4,0,4),e.addMany(s,6,3,6),e.addMany(s,5,3,5),e.add(127,5,0,5),e.addMany(s,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(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(s,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(s,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(s,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(s,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(s,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(s,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(Hi,0,2,0),e.add(Hi,8,5,8),e.add(Hi,6,0,6),e.add(Hi,11,0,11),e.add(Hi,13,13,13),e})(),p1=class extends He{constructor(e=v1){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 kp,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,i,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,i)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(lt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new u1),this._dcsParser=this._register(new f1),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let s=0;s<e.intermediates.length;++s){let n=e.intermediates.charCodeAt(s);if(32>n||n>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=n}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=r,i}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 i=this._identifier(e,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let r=this._escHandlers[i];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,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 i=this._identifier(e);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let r=this._csiHandlers[i];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,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,i,r,s){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=r,this._parseStack.chunkPos=s}parse(e,t,i){let r=0,s=0,n=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,n=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let l=this._parseStack.handlers,h=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&h>-1){for(;h>=0&&(o=l[h](this._params),o!==!0);h--)if(o instanceof Promise)return this._parseStack.handlerPos=h,o}this._parseStack.handlers=[];break;case 4:if(i===!1&&h>-1){for(;h>=0&&(o=l[h](),o!==!0);h--)if(o instanceof Promise)return this._parseStack.handlerPos=h,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,i),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,i),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,n=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let l=n;l<t;++l){switch(r=e[l],s=this._transitions.table[this.currentState<<8|(r<160?r:Hi)],s>>4){case 2:for(let f=l+1;;++f){if(f>=t||(r=e[f])<32||r>126&&r<Hi){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(r=e[f])<32||r>126&&r<Hi){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(r=e[f])<32||r>126&&r<Hi){this._printHandler(e,l,f),l=f-1;break}if(++f>=t||(r=e[f])<32||r>126&&r<Hi){this._printHandler(e,l,f),l=f-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:l,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let h=this._csiHandlers[this._collect<<8|r],c=h?h.length-1:-1;for(;c>=0&&(o=h[c](this._params),o!==!0);c--)if(o instanceof Promise)return this._preserveStack(3,h,c,s,l),o;c<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(++l<t&&(r=e[l])>47&&r<60);l--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let u=this._escHandlers[this._collect<<8|r],d=u?u.length-1:-1;for(;d>=0&&(o=u[d](),o!==!0);d--)if(o instanceof Promise)return this._preserveStack(4,u,d,s,l),o;d<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 f=l+1;;++f)if(f>=t||(r=e[f])===24||r===26||r===27||r>127&&r<Hi){this._dcsParser.put(e,l,f),l=f-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,s,l),o;r===27&&(s|=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 f=l+1;;f++)if(f>=t||(r=e[f])<32||r>127&&r<Hi){this._oscParser.put(e,l,f),l=f-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,s,l),o;r===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=s&15}}},g1=/^([\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})$/,m1=/^[\da-f]+$/;function nf(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let i=g1.exec(t);if(i){let r=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/r*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/r*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),m1.exec(t)&&[3,6,9,12].includes(t.length))){let i=t.length/3,r=[0,0,0];for(let s=0;s<3;++s){let n=parseInt(t.slice(i*s,i*s+i),16);r[s]=i===1?n<<4:i===2?n:i===3?n>>4:n>>8}return r}}function vh(e,t){let i=e.toString(16),r=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function b1(e,t=16){let[i,r,s]=e;return`rgb:${vh(i,t)}/${vh(r,t)}/${vh(s,t)}`}var y1={"(":0,")":1,"*":2,"+":3,"-":1,".":2},rs=131072,of=10;function af(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 lf=5e3,hf=0,S1=class extends He{constructor(e,t,i,r,s,n,o,l,h=new p1){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=r,this._optionsService=s,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=l,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new HS,this._utf8Decoder=new zS,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=wt.clone(),this._eraseAttrDataInternal=wt.clone(),this._onRequestBell=this._register(new ae),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ae),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ae),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ae),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ae),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ae),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ae),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ae),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ae),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ae),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ae),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ae),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 Dc(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(c=>this._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,u)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:u.toArray()})}),this._parser.setEscHandlerFallback(c=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(c)})}),this._parser.setExecuteHandlerFallback(c=>{this._logService.debug("Unknown EXECUTE code: ",{code:c})}),this._parser.setOscHandlerFallback((c,u,d)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:u,data:d})}),this._parser.setDcsHandlerFallback((c,u,d)=>{u==="HOOK"&&(d=d.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:u,payload:d})}),this._parser.setPrintHandler((c,u,d)=>this.print(c,u,d)),this._parser.registerCsiHandler({final:"@"},c=>this.insertChars(c)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},c=>this.scrollLeft(c)),this._parser.registerCsiHandler({final:"A"},c=>this.cursorUp(c)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},c=>this.scrollRight(c)),this._parser.registerCsiHandler({final:"B"},c=>this.cursorDown(c)),this._parser.registerCsiHandler({final:"C"},c=>this.cursorForward(c)),this._parser.registerCsiHandler({final:"D"},c=>this.cursorBackward(c)),this._parser.registerCsiHandler({final:"E"},c=>this.cursorNextLine(c)),this._parser.registerCsiHandler({final:"F"},c=>this.cursorPrecedingLine(c)),this._parser.registerCsiHandler({final:"G"},c=>this.cursorCharAbsolute(c)),this._parser.registerCsiHandler({final:"H"},c=>this.cursorPosition(c)),this._parser.registerCsiHandler({final:"I"},c=>this.cursorForwardTab(c)),this._parser.registerCsiHandler({final:"J"},c=>this.eraseInDisplay(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},c=>this.eraseInDisplay(c,!0)),this._parser.registerCsiHandler({final:"K"},c=>this.eraseInLine(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},c=>this.eraseInLine(c,!0)),this._parser.registerCsiHandler({final:"L"},c=>this.insertLines(c)),this._parser.registerCsiHandler({final:"M"},c=>this.deleteLines(c)),this._parser.registerCsiHandler({final:"P"},c=>this.deleteChars(c)),this._parser.registerCsiHandler({final:"S"},c=>this.scrollUp(c)),this._parser.registerCsiHandler({final:"T"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"X"},c=>this.eraseChars(c)),this._parser.registerCsiHandler({final:"Z"},c=>this.cursorBackwardTab(c)),this._parser.registerCsiHandler({final:"`"},c=>this.charPosAbsolute(c)),this._parser.registerCsiHandler({final:"a"},c=>this.hPositionRelative(c)),this._parser.registerCsiHandler({final:"b"},c=>this.repeatPrecedingCharacter(c)),this._parser.registerCsiHandler({final:"c"},c=>this.sendDeviceAttributesPrimary(c)),this._parser.registerCsiHandler({prefix:">",final:"c"},c=>this.sendDeviceAttributesSecondary(c)),this._parser.registerCsiHandler({final:"d"},c=>this.linePosAbsolute(c)),this._parser.registerCsiHandler({final:"e"},c=>this.vPositionRelative(c)),this._parser.registerCsiHandler({final:"f"},c=>this.hVPosition(c)),this._parser.registerCsiHandler({final:"g"},c=>this.tabClear(c)),this._parser.registerCsiHandler({final:"h"},c=>this.setMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"h"},c=>this.setModePrivate(c)),this._parser.registerCsiHandler({final:"l"},c=>this.resetMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"l"},c=>this.resetModePrivate(c)),this._parser.registerCsiHandler({final:"m"},c=>this.charAttributes(c)),this._parser.registerCsiHandler({final:"n"},c=>this.deviceStatus(c)),this._parser.registerCsiHandler({prefix:"?",final:"n"},c=>this.deviceStatusPrivate(c)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},c=>this.softReset(c)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},c=>this.setCursorStyle(c)),this._parser.registerCsiHandler({final:"r"},c=>this.setScrollRegion(c)),this._parser.registerCsiHandler({final:"s"},c=>this.saveCursor(c)),this._parser.registerCsiHandler({final:"t"},c=>this.windowOptions(c)),this._parser.registerCsiHandler({final:"u"},c=>this.restoreCursor(c)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},c=>this.insertColumns(c)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},c=>this.deleteColumns(c)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},c=>this.selectProtected(c)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},c=>this.requestMode(c,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},c=>this.requestMode(c,!1)),this._parser.setExecuteHandler(q.BEL,()=>this.bell()),this._parser.setExecuteHandler(q.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(q.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(q.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(q.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(q.BS,()=>this.backspace()),this._parser.setExecuteHandler(q.HT,()=>this.tab()),this._parser.setExecuteHandler(q.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(q.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Ya.IND,()=>this.index()),this._parser.setExecuteHandler(Ya.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Ya.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new ki(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new ki(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new ki(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new ki(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new ki(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new ki(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new ki(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new ki(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new ki(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new ki(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new ki(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new ki(c=>this.restoreCursorColor(c))),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 c in Ot)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new sf((c,u)=>this.requestStatusString(c,u)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,i,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),lf))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${lf} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,r=this._activeBuffer.x,s=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;r=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>rs&&(n=this._parseStack.position+rs)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,c=>String.fromCharCode(c)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(c=>c.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<rs&&(this._parseBuffer=new Uint32Array(Math.min(e.length,rs))),o||this._dirtyRowTracker.clearRange(),e.length>rs)for(let c=n;c<e.length;c+=rs){let u=c+rs<e.length?c+rs:e.length,d=typeof e=="string"?this._stringDecoder.decode(e.substring(c,u),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,u),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,d))return this._preserveStack(r,s,d,c),this._logSlowResolvingAsync(i),i}else if(!o){let c=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,c))return this._preserveStack(r,s,c,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==r||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),h=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);h<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(h,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(e,t,i){let r,s,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,h=this._coreService.decPrivateModes.wraparound,c=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&&i-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 _=t;_<i;++_){if(r=e[_],r<127&&n){let S=n[String.fromCharCode(r)];S&&(r=S.charCodeAt(0))}let p=this._unicodeService.charProperties(r,f);s=Ks.extractWidth(p);let b=Ks.extractShouldJoin(p),g=b?Ks.extractWidth(f):0;if(f=p,o&&this._onA11yChar.fire(os(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-g>l){if(h){let S=d,x=this._activeBuffer.x-g;for(this._activeBuffer.x=g,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),g>0&&d instanceof Po&&d.copyCellsFrom(S,x,0,g,!1);x<l;)S.setCellFromCodepoint(x++,0,1,u)}else if(this._activeBuffer.x=l-1,s===2)continue}if(b&&this._activeBuffer.x){let S=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-S,r,s);for(let x=s-g;--x>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(c&&(d.insertCells(this._activeBuffer.x,s-g,this._activeBuffer.getNullCell(u)),d.getWidth(l-1)===2&&d.setCellFromCodepoint(l-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,s,u),s>0)for(;--s;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<l&&i-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,i=>af(i.params[0],this._optionsService.rawOptions.windowOptions)?t(i):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new sf(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new ki(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(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.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,i,r=!1,s=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),s),r&&(n.isWrapped=!1)}_resetBufferLine(e,t=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){var r;this._restrictCursor(this._bufferService.cols);let i;switch(e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);i<this._bufferService.rows;i++)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i))!=null&&r.getTrimmedLength()););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,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 i=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(i,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 i=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(i,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(wt));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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 i=e.params[0]||1,r=Ks.extractWidth(t),s=this._activeBuffer.x-r,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),o=new Uint32Array(n.length*i),l=0;for(let c=0;c<n.length;){let u=n.codePointAt(c)||0;o[l++]=u,c+=u>65535?2:1}let h=l;for(let c=1;c<i;++c)o.copyWithin(h,0,l),h+=l;return this.print(o,0,h),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(q.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(q.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(q.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(q.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(q.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,Ns),this._charsetService.setgCharset(1,Ns),this._charsetService.setgCharset(2,Ns),this._charsetService.setgCharset(3,Ns);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){(b=>(b[b.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",b[b.SET=1]="SET",b[b.RESET=2]="RESET",b[b.PERMANENTLY_SET=3]="PERMANENTLY_SET",b[b.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(i={}));let r=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:n}=this._coreMouseService,o=this._coreService,{buffers:l,cols:h}=this._bufferService,{active:c,alt:u}=l,d=this._optionsService.rawOptions,f=(b,g)=>(o.triggerDataEvent(`${q.ESC}[${t?"":"?"}${b};${g}$y`),!0),_=b=>b?1:2,p=e.params[0];return t?p===2?f(p,4):p===4?f(p,_(o.modes.insertMode)):p===12?f(p,3):p===20?f(p,_(d.convertEol)):f(p,0):p===1?f(p,_(r.applicationCursorKeys)):p===3?f(p,d.windowOptions.setWinLines?h===80?2:h===132?1:0:0):p===6?f(p,_(r.origin)):p===7?f(p,_(r.wraparound)):p===8?f(p,3):p===9?f(p,_(s==="X10")):p===12?f(p,_(d.cursorBlink)):p===25?f(p,_(!o.isCursorHidden)):p===45?f(p,_(r.reverseWraparound)):p===66?f(p,_(r.applicationKeypad)):p===67?f(p,4):p===1e3?f(p,_(s==="VT200")):p===1002?f(p,_(s==="DRAG")):p===1003?f(p,_(s==="ANY")):p===1004?f(p,_(r.sendFocus)):p===1005?f(p,4):p===1006?f(p,_(n==="SGR")):p===1015?f(p,4):p===1016?f(p,_(n==="SGR_PIXELS")):p===1048?f(p,1):p===47||p===1047||p===1049?f(p,_(c===u)):p===2004?f(p,_(r.bracketedPasteMode)):p===2026?f(p,_(r.synchronizedOutput)):f(p,0)}_updateAttrColor(e,t,i,r,s){return t===2?(e|=50331648,e&=-16777216,e|=pa.fromColorRGB([i,r,s])):t===5&&(e&=-50331904,e|=33554432|i&255),e}_extractColor(e,t,i){let r=[0,0,-1,0,0,0],s=0,n=0;do{if(r[n+s]=e.params[t+n],e.hasSubParams(t+n)){let o=e.getSubParams(t+n),l=0;do r[1]===5&&(s=1),r[n+l+1+s]=o[l];while(++l<o.length&&l+n+1+s<r.length);break}if(r[1]===5&&n+s>=2||r[1]===2&&n+s>=5)break;r[1]&&(s=1)}while(++n+t<e.length&&n+s<r.length);for(let o=2;o<r.length;++o)r[o]===-1&&(r[o]=0);switch(r[0]){case 38:i.fg=this._updateAttrColor(i.fg,r[1],r[3],r[4],r[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,r[1],r[3],r[4],r[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,r[1],r[3],r[4],r[5])}return n}_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=wt.fg,e.bg=wt.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,i,r=this._curAttrData;for(let s=0;s<t;s++)i=e.params[s],i>=30&&i<=37?(r.fg&=-50331904,r.fg|=16777216|i-30):i>=40&&i<=47?(r.bg&=-50331904,r.bg|=16777216|i-40):i>=90&&i<=97?(r.fg&=-50331904,r.fg|=16777216|i-90|8):i>=100&&i<=107?(r.bg&=-50331904,r.bg|=16777216|i-100|8):i===0?this._processSGR0(r):i===1?r.fg|=134217728:i===3?r.bg|=67108864:i===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(s)?e.getSubParams(s)[0]:1,r)):i===5?r.fg|=536870912:i===7?r.fg|=67108864:i===8?r.fg|=1073741824:i===9?r.fg|=2147483648:i===2?r.bg|=134217728:i===21?this._processUnderline(2,r):i===22?(r.fg&=-134217729,r.bg&=-134217729):i===23?r.bg&=-67108865:i===24?(r.fg&=-268435457,this._processUnderline(0,r)):i===25?r.fg&=-536870913:i===27?r.fg&=-67108865:i===28?r.fg&=-1073741825:i===29?r.fg&=2147483647:i===39?(r.fg&=-67108864,r.fg|=wt.fg&16777215):i===49?(r.bg&=-67108864,r.bg|=wt.bg&16777215):i===38||i===48||i===58?s+=this._extractColor(e,s,r):i===53?r.bg|=1073741824:i===55?r.bg&=-1073741825:i===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):i===100?(r.fg&=-67108864,r.fg|=wt.fg&16777215,r.bg&=-67108864,r.bg|=wt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${q.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${q.ESC}[${t};${i}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${q.ESC}[?${t};${i}R`);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=wt.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 i=t%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(e){let t=e.params[0]||1,i;return(e.length<2||(i=e.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(e){if(!af(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(`${q.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>of&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>of&&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=[],i=e.split(";");for(;i.length>1;){let r=i.shift(),s=i.shift();if(/^\d+$/.exec(r)){let n=parseInt(r);if(cf(n))if(s==="?")t.push({type:0,index:n});else{let o=nf(s);o&&t.push({type:1,index:n,color:o})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let i=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(i,r):i.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let i=e.split(":"),r,s=i.findIndex(n=>n.startsWith("id="));return s!==-1&&(r=i[s].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 i=e.split(";");for(let r=0;r<i.length&&!(t>=this._specialColors.length);++r,++t)if(i[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let s=nf(i[r]);s&&this._onColor.fire([{type:1,index:this._specialColors[t],color:s}])}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=[],i=e.split(";");for(let r=0;r<i.length;++r)if(/^\d+$/.exec(i[r])){let s=parseInt(i[r]);cf(s)&&t.push({type:2,index:s})}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,Ns),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(y1[e[0]],Ot[e[1]]||Ns),!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=wt.clone(),this._eraseAttrDataInternal=wt.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 Yi;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let i=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(i);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let i=o=>(this._coreService.triggerDataEvent(`${q.ESC}${o}${q.ESC}\\`),!0),r=this._bufferService.buffer,s=this._optionsService.rawOptions;return i(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"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}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Dc=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&&(hf=e,e=t,t=hf),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Dc=gt([fe(0,hi)],Dc);function cf(e){return 0<=e&&e<256}var w1=5e7,df=12,C1=50,k1=class extends He{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 ae),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 i;for(;i=this._writeBuffer.shift();){this._action(i);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>w1)throw new 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 i=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],s=this._action(r,t);if(s){let o=l=>performance.now()-i>=df?setTimeout(()=>this._innerWrite(0,l)):this._innerWrite(i,l);s.catch(l=>(queueMicrotask(()=>{throw l}),Promise.resolve(!1))).then(o);return}let n=this._callbacks[this._bufferOffset];if(n&&n(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-i>=df)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>C1&&(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()}},Tc=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 l=t.addMarker(t.ybase+t.y),h={data:e,id:this._nextId++,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(h,l)),this._dataByLinkId.set(h.id,h),h.id}let i=e,r=this._getEntryIdKey(i),s=this._entriesWithId.get(r);if(s)return this.addLineToLink(s.id,t.ybase+t.y),s.id;let n=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(o,n)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let i=this._dataByLinkId.get(e);if(i&&i.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);i.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(i,r))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let i=e.lines.indexOf(t);i!==-1&&(e.lines.splice(i,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Tc=gt([fe(0,hi)],Tc);var uf=!1,x1=class extends He{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new ao),this._onBinary=this._register(new ae),this.onBinary=this._onBinary.event,this._onData=this._register(new ae),this.onData=this._onData.event,this._onLineFeed=this._register(new ae),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ae),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ae),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ae),this._instantiationService=new $0,this.optionsService=this._register(new n1(e)),this._instantiationService.setService(ci,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Cc)),this._instantiationService.setService(hi,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(wc)),this._instantiationService.setService(Kv,this._logService),this.coreService=this._register(this._instantiationService.createInstance(kc)),this._instantiationService.setService(Sn,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(xc)),this._instantiationService.setService(Uv,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Ks)),this._instantiationService.setService(jS,this.unicodeService),this._charsetService=this._instantiationService.createInstance(c1),this._instantiationService.setService(qS,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Tc),this._instantiationService.setService(qv,this._oscLinkService),this._inputHandler=this._register(new S1(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Xt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Xt.forward(this._bufferService.onResize,this._onResize)),this._register(Xt.forward(this.coreService.onData,this._onData)),this._register(Xt.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 k1((t,i)=>this._inputHandler.parse(t,i))),this._register(Xt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ae),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.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&&!uf&&(this._logService.warn("writeSync is unreliable and will be removed soon."),uf=!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,wp),t=Math.max(t,Cp),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(rf.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(rf(this._bufferService),!1))),this._windowsWrappingHeuristics.value=lt(()=>{for(let t of e)t.dispose()})}}},E1={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 D1(e,t,i,r){var o;let s={type:0,cancel:!1,key:void 0},n=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?s.key=q.ESC+"OA":s.key=q.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?s.key=q.ESC+"OD":s.key=q.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?s.key=q.ESC+"OC":s.key=q.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?s.key=q.ESC+"OB":s.key=q.ESC+"[B");break;case 8:s.key=e.ctrlKey?"\b":q.DEL,e.altKey&&(s.key=q.ESC+s.key);break;case 9:if(e.shiftKey){s.key=q.ESC+"[Z";break}s.key=q.HT,s.cancel=!0;break;case 13:s.key=e.altKey?q.ESC+q.CR:q.CR,s.cancel=!0;break;case 27:s.key=q.ESC,e.altKey&&(s.key=q.ESC+q.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;n?s.key=q.ESC+"[1;"+(n+1)+"D":t?s.key=q.ESC+"OD":s.key=q.ESC+"[D";break;case 39:if(e.metaKey)break;n?s.key=q.ESC+"[1;"+(n+1)+"C":t?s.key=q.ESC+"OC":s.key=q.ESC+"[C";break;case 38:if(e.metaKey)break;n?s.key=q.ESC+"[1;"+(n+1)+"A":t?s.key=q.ESC+"OA":s.key=q.ESC+"[A";break;case 40:if(e.metaKey)break;n?s.key=q.ESC+"[1;"+(n+1)+"B":t?s.key=q.ESC+"OB":s.key=q.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(s.key=q.ESC+"[2~");break;case 46:n?s.key=q.ESC+"[3;"+(n+1)+"~":s.key=q.ESC+"[3~";break;case 36:n?s.key=q.ESC+"[1;"+(n+1)+"H":t?s.key=q.ESC+"OH":s.key=q.ESC+"[H";break;case 35:n?s.key=q.ESC+"[1;"+(n+1)+"F":t?s.key=q.ESC+"OF":s.key=q.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=q.ESC+"[5;"+(n+1)+"~":s.key=q.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=q.ESC+"[6;"+(n+1)+"~":s.key=q.ESC+"[6~";break;case 112:n?s.key=q.ESC+"[1;"+(n+1)+"P":s.key=q.ESC+"OP";break;case 113:n?s.key=q.ESC+"[1;"+(n+1)+"Q":s.key=q.ESC+"OQ";break;case 114:n?s.key=q.ESC+"[1;"+(n+1)+"R":s.key=q.ESC+"OR";break;case 115:n?s.key=q.ESC+"[1;"+(n+1)+"S":s.key=q.ESC+"OS";break;case 116:n?s.key=q.ESC+"[15;"+(n+1)+"~":s.key=q.ESC+"[15~";break;case 117:n?s.key=q.ESC+"[17;"+(n+1)+"~":s.key=q.ESC+"[17~";break;case 118:n?s.key=q.ESC+"[18;"+(n+1)+"~":s.key=q.ESC+"[18~";break;case 119:n?s.key=q.ESC+"[19;"+(n+1)+"~":s.key=q.ESC+"[19~";break;case 120:n?s.key=q.ESC+"[20;"+(n+1)+"~":s.key=q.ESC+"[20~";break;case 121:n?s.key=q.ESC+"[21;"+(n+1)+"~":s.key=q.ESC+"[21~";break;case 122:n?s.key=q.ESC+"[23;"+(n+1)+"~":s.key=q.ESC+"[23~";break;case 123:n?s.key=q.ESC+"[24;"+(n+1)+"~":s.key=q.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?s.key=q.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?s.key=q.DEL:e.keyCode===219?s.key=q.ESC:e.keyCode===220?s.key=q.FS:e.keyCode===221&&(s.key=q.GS);else if((!i||r)&&e.altKey&&!e.metaKey){let l=(o=E1[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(l)s.key=q.ESC+l;else if(e.keyCode>=65&&e.keyCode<=90){let h=e.ctrlKey?e.keyCode-64:e.keyCode+32,c=String.fromCharCode(h);e.shiftKey&&(c=c.toUpperCase()),s.key=q.ESC+c}else if(e.keyCode===32)s.key=q.ESC+(e.ctrlKey?q.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let h=e.code.slice(3,4);e.shiftKey||(h=h.toLowerCase()),s.key=q.ESC+h,s.cancel=!0}}else i&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(s.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?s.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(s.key=q.US),e.key==="@"&&(s.key=q.NUL));break}return s}var mt=0,T1=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new ul,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new ul,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((s,n)=>this._getKey(s)-this._getKey(n)),t=0,i=0,r=new Array(this._array.length+this._insertedValues.length);for(let s=0;s<r.length;s++)i>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(r[s]=e[t],t++):r[s]=this._array[i++];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||(mt=this._search(t),mt===-1)||this._getKey(this._array[mt])!==t)return!1;do if(this._array[mt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(mt),!0;while(++mt<this._array.length&&this._getKey(this._array[mt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((s,n)=>s-n),t=0,i=new Array(this._array.length-e.length),r=0;for(let s=0;s<this._array.length;s++)e[t]===s?t++:i[r++]=this._array[s];this._array=i,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&&(mt=this._search(e),!(mt<0||mt>=this._array.length)&&this._getKey(this._array[mt])===e))do yield this._array[mt];while(++mt<this._array.length&&this._getKey(this._array[mt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(mt=this._search(e),!(mt<0||mt>=this._array.length)&&this._getKey(this._array[mt])===e))do t(this._array[mt]);while(++mt<this._array.length&&this._getKey(this._array[mt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,i=this._array.length-1;for(;i>=t;){let r=t+i>>1,s=this._getKey(this._array[r]);if(s>e)i=r-1;else if(s<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},ph=0,ff=0,R1=class extends He{constructor(){super(),this._decorations=new T1(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new ae),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ae),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(lt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new P1(e);if(t){let i=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),i.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,i){let r=0,s=0;for(let n of this._decorations.getKeyIterator(t))r=n.options.x??0,s=r+(n.options.width??1),e>=r&&e<s&&(!i||(n.options.layer??"bottom")===i)&&(yield n)}forEachDecorationAtCell(e,t,i,r){this._decorations.forEachByKey(t,s=>{ph=s.options.x??0,ff=ph+(s.options.width??1),e>=ph&&e<ff&&(!i||(s.options.layer??"bottom")===i)&&r(s)})}},P1=class extends Es{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ae),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ae),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=dt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=dt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},M1=1e3,A1=class{constructor(e,t=M1){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,i){this._rowCount=i,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let s=r-this._lastRefreshMs,n=this._debounceThresholdMS-s;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},n)}}_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)}},_f=20,fl=class extends He{constructor(e,t,i,r){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=n=>this._handleBoundaryFocus(n,0),this._bottomBoundaryFocusListener=n=>this._handleBoundaryFocus(n,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=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new A1(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(n=>this._handleResize(n.rows))),this._register(this._terminal.onRender(n=>this._refreshRows(n.start,n.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(n=>this._handleChar(n))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
37
|
+
`))),this._register(this._terminal.onA11yTab(n=>this._handleTab(n))),this._register(this._terminal.onKey(n=>this._handleKey(n.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Ae(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(lt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<_f+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
38
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===_f+1&&(this._liveRegion.textContent+=Gh.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let i=this._terminal.buffer,r=i.lines.length.toString();for(let s=e;s<=t;s++){let n=i.lines.get(i.ydisp+s),o=[],l=(n==null?void 0:n.translateToString(!0,void 0,void 0,o))||"",h=(i.ydisp+s+1).toString(),c=this._rowElements[s];c&&(l.length===0?(c.textContent=" ",this._rowColumns.set(c,[0,1])):(c.textContent=l,this._rowColumns.set(c,o)),c.setAttribute("aria-posinset",h),c.setAttribute("aria-setsize",r),this._alignRowWidth(c))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],s=i.getAttribute("aria-posinset"),n=t===0?"1":`${this._terminal.buffer.lines.length}`;if(s===n||e.relatedTarget!==r)return;let o,l;if(t===0?(o=i,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=i,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),l.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h)}else{let h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h)}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(){var l;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},i={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===i.node&&t.offset>i.offset)&&([t,i]=[i,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(i.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:r,offset:((l=r.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(i.node))return;let s=({node:h,offset:c})=>{let u=h instanceof Text?h.parentNode:h,d=parseInt(u==null?void 0:u.getAttribute("aria-posinset"),10)-1;if(isNaN(d))return console.warn("row is invalid. Race condition?"),null;let f=this._rowColumns.get(u);if(!f)return console.warn("columns is null. Race condition?"),null;let _=c<f.length?f[c]:f.slice(-1)[0]+1;return _>=this._terminal.cols&&(++d,_=0),{row:d,column:_}},n=s(t),o=s(i);if(!(!n||!o)){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);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){var s,n;e.style.transform="";let t=e.getBoundingClientRect().width,i=(n=(s=this._rowColumns.get(e))==null?void 0:s.slice(-1))==null?void 0:n[0];if(!i)return;let r=i*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};fl=gt([fe(1,bd),fe(2,Zr),fe(3,Qr)],fl);var Rc=class extends He{constructor(e,t,i,r,s){super(),this._element=e,this._mouseService=t,this._renderService=i,this._bufferService=r,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ae),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ae),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(lt(()=>{var n;mn(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(n=this._activeProviderReplies)==null||n.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Ae(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ae(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ae(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ae(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 i=e.composedPath();for(let r=0;r<i.length;r++){let s=i[r];if(s.classList.contains("xterm"))break;if(s.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){var r,s;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(n=>{n==null||n.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(let[n,o]of this._linkProviderService.linkProviders.entries())t?(s=this._activeProviderReplies)!=null&&s.get(n)&&(i=this._checkLinkProviderResult(n,e,i)):o.provideLinks(e.y,l=>{var c,u;if(this._isMouseOut)return;let h=l==null?void 0:l.map(d=>({link:d}));(c=this._activeProviderReplies)==null||c.set(n,h),i=this._checkLinkProviderResult(n,e,i),((u=this._activeProviderReplies)==null?void 0:u.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let i=new Set;for(let r=0;r<t.size;r++){let s=t.get(r);if(s)for(let n=0;n<s.length;n++){let o=s[n],l=o.link.range.start.y<e?0:o.link.range.start.x,h=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let c=l;c<=h;c++){if(i.has(c)){s.splice(n--,1);break}i.add(c)}}}}_checkLinkProviderResult(e,t,i){var n;if(!this._activeProviderReplies)return i;let r=this._activeProviderReplies.get(e),s=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(s=!0);if(!s&&r){let o=r.find(l=>this._linkAtPosition(l.link,t));o&&(i=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let o=0;o<this._activeProviderReplies.size;o++){let l=(n=this._activeProviderReplies.get(o))==null?void 0:n.find(h=>this._linkAtPosition(h.link,t));if(l){i=!0,this._handleNewLink(l);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&O1(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,mn(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:()=>{var i,r;return(r=(i=this._currentLink)==null?void 0:i.state)==null?void 0:r.decorations.pointerCursor},set:i=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>{var i,r;return(r=(i=this._currentLink)==null?void 0:i.state)==null?void 0:r.decorations.underline},set:i=>{var r,s,n;(r=this._currentLink)!=null&&r.state&&((n=(s=this._currentLink)==null?void 0:s.state)==null?void 0:n.decorations.underline)!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let r=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(r,s),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(e,t,i){var r;(r=this._currentLink)!=null&&r.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(i,t.text)}_fireUnderlineEvent(e,t){let i=e.range,r=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-r-1,i.end.x,i.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(e,t,i){var r;(r=this._currentLink)!=null&&r.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(i,t.text)}_linkAtPosition(e,t){let i=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,s=t.y*this._bufferService.cols+t.x;return i<=s&&s<=r}_positionFromMouseEvent(e,t,i){let r=i.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,i,r,s){return{x1:e,y1:t,x2:i,y2:r,cols:this._bufferService.cols,fg:s}}};Rc=gt([fe(1,yd),fe(2,Qr),fe(3,hi),fe(4,Yv)],Rc);function O1(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 L1=class extends x1{constructor(e={}){super(e),this._linkifier=this._register(new ao),this.browser=dp,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new ao),this._onCursorMove=this._register(new ae),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ae),this.onKey=this._onKey.event,this._onRender=this._register(new ae),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ae),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ae),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ae),this.onBell=this._onBell.event,this._onFocus=this._register(new ae),this._onBlur=this._register(new ae),this._onA11yCharEmitter=this._register(new ae),this._onA11yTabEmitter=this._register(new ae),this._onWillOpen=this._register(new ae),this._setup(),this._decorationService=this._instantiationService.createInstance(R1),this._instantiationService.setService(ga,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(C0),this._instantiationService.setService(Yv,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Xh)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(Xt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Xt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Xt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Xt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(lt(()=>{var t,i;this._customKeyEventHandler=void 0,(i=(t=this.element)==null?void 0:t.parentNode)==null||i.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 i,r="";switch(t.index){case 256:i="foreground",r="10";break;case 257:i="background",r="11";break;case 258:i="cursor",r="12";break;default:i="ansi",r="4;"+t.index}switch(t.type){case 0:let s=rt.toColorRGB(i==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${q.ESC}]${r};${b1(s)}${hp.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors(n=>n.ansi[t.index]=Ct.toColor(...t.color));else{let n=i;this._themeService.modifyColors(o=>o[n]=Ct.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(fl,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(q.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(q.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 i=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,s=t.getWidth(i),n=this._renderService.dimensions.css.cell.width*s,o=this.buffer.y*this._renderService.dimensions.css.cell.height,l=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=l+"px",this.textarea.style.top=o+"px",this.textarea.style.width=n+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Ae(this.element,"copy",t=>{this.hasSelection()&&FS(t,this._selectionService)}));let e=t=>WS(t,this.textarea,this.coreService,this.optionsService);this._register(Ae(this.textarea,"paste",e)),this._register(Ae(this.element,"paste",e)),up?this._register(Ae(this.element,"mousedown",t=>{t.button===2&&Cu(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ae(this.element,"contextmenu",t=>{Cu(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Td&&this._register(Ae(this.element,"auxclick",t=>{t.button===1&&Nv(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ae(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Ae(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Ae(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Ae(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Ae(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Ae(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ae(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var s;if(!e)throw new 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"),((s=this.element)==null?void 0:s.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(Ae(this.screenElement,"mousemove",n=>this.updateCursorStyle(n))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let i=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Vh.get()),vp||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",()=>i.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(S0,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Zr,this._coreBrowserService),this._register(Ae(this.textarea,"focus",n=>this._handleTextAreaFocus(n))),this._register(Ae(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(gc,this._document,this._helperContainer),this._instantiationService.setService(Bl,this._charSizeService),this._themeService=this._instantiationService.createInstance(Sc),this._instantiationService.setService(_o,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(cl),this._instantiationService.setService(jv,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(bc,this.rows,this.screenElement)),this._instantiationService.setService(Qr,this._renderService),this._register(this._renderService.onRenderedViewportChange(n=>this._onRender.fire(n))),this.onResize(n=>this._renderService.resize(n.cols,n.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(_c,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(mc),this._instantiationService.setService(yd,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Rc,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(uc,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(n=>{super.scrollLines(n,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(yc,this.element,this.screenElement,r)),this._instantiationService.setService(VS,this._selectionService),this._register(this._selectionService.onRequestScrollLines(n=>this.scrollLines(n.amount,n.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(n=>this._renderService.handleSelectionChanged(n.start,n.end,n.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(n=>{this.textarea.value=n,this.textarea.focus(),this.textarea.select()})),this._register(Xt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var n;this._selectionService.refresh(),(n=this._viewport)==null||n.queueSync()})),this._register(this._instantiationService.createInstance(fc,this.screenElement)),this._register(Ae(this.element,"mousedown",n=>this._selectionService.handleMouseDown(n))),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(fl,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",n=>this._handleScreenReaderModeOptionChange(n))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(hl,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",n=>{!this._overviewRulerRenderer&&n&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(hl,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(pc,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function i(n){var c,u,d,f,_;let o=e._mouseService.getMouseReportCoords(n,e.screenElement);if(!o)return!1;let l,h;switch(n.overrideType||n.type){case"mousemove":h=32,n.buttons===void 0?(l=3,n.button!==void 0&&(l=n.button<3?n.button:3)):l=n.buttons&1?0:n.buttons&4?1:n.buttons&2?2:3;break;case"mouseup":h=0,l=n.button<3?n.button:3;break;case"mousedown":h=1,l=n.button<3?n.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(n)===!1)return!1;let p=n.deltaY;if(p===0||e.coreMouseService.consumeWheelEvent(n,(f=(d=(u=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:u.device)==null?void 0:d.cell)==null?void 0:f.height,(_=e._coreBrowserService)==null?void 0:_.dpr)===0)return!1;h=p<0?0:1,l=4;break;default:return!1}return h===void 0||l===void 0||l>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:l,action:h,ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s={mouseup:n=>(i(n),n.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(n)),wheel:n=>(i(n),this.cancel(n,!0)),mousedrag:n=>{n.buttons&&i(n)},mousemove:n=>{n.buttons||i(n)}};this._register(this.coreMouseService.onProtocolChange(n=>{n?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(n)),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()),n&8?r.mousemove||(t.addEventListener("mousemove",s.mousemove),r.mousemove=s.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),n&16?r.wheel||(t.addEventListener("wheel",s.wheel,{passive:!1}),r.wheel=s.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),n&2?r.mouseup||(r.mouseup=s.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),n&4?r.mousedrag||(r.mousedrag=s.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Ae(t,"mousedown",n=>{if(n.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(n)))return i(n),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(n)})),this._register(Ae(t,"wheel",n=>{var o,l,h,c,u;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(n)===!1)return!1;if(!this.buffer.hasScrollback){if(n.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(n,(c=(h=(l=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:l.device)==null?void 0:h.cell)==null?void 0:c.height,(u=e._coreBrowserService)==null?void 0:u.dpr)===0)return this.cancel(n,!0);let d=q.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(n.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(d,!0),this.cancel(n,!0)}}},{passive:!1}))}refresh(e,t){var i;(i=this._renderService)==null||i.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.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){Bv(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 new 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 new 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,i){this._selectionService.setSelection(e,t,i)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var i;(i=this._selectionService)==null||i.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 i=D1(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),i.type===3||i.type===2){let r=this.rows-1;return this.scrollLines(i.type===2?-r:r),this.cancel(e,!0)}if(i.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.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((i.key===q.ETX||i.key===q.CR)&&(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let i=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"?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(I1(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){var i;(i=this._charSizeService)==null||i.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(wt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(q.ESC+"[I"):this.coreService.triggerDataEvent(q.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),i=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${q.ESC}[4;${i};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${q.ESC}[6;${s};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function I1(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var B1=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===e){t=i;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},N1=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 Yi)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},vf=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 N1(t)}getNullCell(){return new Yi}},F1=class extends He{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ae),this.onBufferChange=this._onBufferChange.event,this._normal=new vf(this._core.buffers.normal,"normal"),this._alternate=new vf(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},W1=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,i=>t(i.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(i,r)=>t(i,r.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)}},H1=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}},z1=["cols","rows"],vr=0,U1=class extends He{constructor(e){super(),this._core=this._register(new L1(e)),this._addonManager=this._register(new B1),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],i=(r,s)=>{this._checkReadonlyOptions(r),this._core.options[r]=s};for(let r in this._core.options){let s={get:t.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this._publicOptions,r,s)}}_checkReadonlyOptions(e){if(z1.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new W1(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new H1(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new F1(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,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}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
|
|
39
|
+
`,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 Vh.get()},set promptLabel(e){Vh.set(e)},get tooMuchOutput(){return Gh.get()},set tooMuchOutput(e){Gh.set(e)}}}_verifyIntegers(...e){for(vr of e)if(vr===1/0||isNaN(vr)||vr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(vr of e)if(vr&&(vr===1/0||isNaN(vr)||vr%1!==0||vr<0))throw new Error("This API only accepts positive integers")}};/**
|
|
40
40
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
41
41
|
* @license MIT
|
|
42
42
|
*
|
|
@@ -47,4 +47,4 @@ WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){t
|
|
|
47
47
|
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
48
48
|
* http://bellard.org/jslinux/
|
|
49
49
|
* Copyright (c) 2011 Fabrice Bellard
|
|
50
|
-
*/var A1=2,O1=1,L1=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(){var d;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:((d=this._terminal.options.overviewRuler)==null?void 0:d.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(i.getPropertyValue("height")),s=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},l=o.top+o.bottom,h=o.right+o.left,c=r-l,u=s-h-t;return{cols:Math.max(A1,Math.floor(u/e.css.cell.width)),rows:Math.max(O1,Math.floor(c/e.css.cell.height))}}},I1=F('<div class="scroll-fabs svelte-5qgfij"><button class="scroll-fab svelte-5qgfij" data-dir="up" aria-label="Page up">▲</button> <button class="scroll-fab svelte-5qgfij" data-dir="down" aria-label="Page down">▼</button> <button class="scroll-fab scroll-fab-bottom svelte-5qgfij" data-dir="bottom" aria-label="Skip to bottom">↧</button></div>'),B1=F('<div><div class="terminal-container svelte-5qgfij" role="presentation"></div> <div class="terminal-scrollbar svelte-5qgfij" role="scrollbar" aria-orientation="vertical"><div class="terminal-scrollbar-thumb svelte-5qgfij" role="presentation"></div></div> <!></div>');function N1(e,t){ft(t,!0);let i=dr(t,"useTmux",3,!1),r=dr(t,"companionMode",3,!1),s,n=H(null),o,l=!1;function h(){return a(n)}function c(){var z;(z=a(n))==null||z.focus()}function u(){if(!a(n))return;const z=a(n).buffer.active,G=z.viewportY>=z.baseY,pe=z.viewportY;o==null||o.fit(),G?a(n).scrollToBottom():a(n).scrollToLine(pe),$l(a(n).cols,a(n).rows),O()}ho(()=>{const z=new M1({cursorBlink:!0,fontSize:Kt?12:14,fontFamily:"Menlo, monospace",scrollback:1e4,theme:{background:"#000000",foreground:"#d4d4d4",cursor:"#d4d4d4"}});if(o=new L1,z.loadAddon(o),z.open(s),Kt){const P=s.querySelector(".xterm-viewport");P&&(P.style.touchAction="none",P.style.overflowY="hidden");const W=s.querySelector(".xterm-screen");if(W){W.addEventListener("wheel",ke=>{ke.stopImmediatePropagation(),ke.preventDefault()},{capture:!0,passive:!1});const he=ke=>{z.modes.mouseTrackingMode!=="none"&&ke.stopImmediatePropagation()};for(const ke of["mousedown","mouseup","mousemove"])W.addEventListener(ke,he,{capture:!0})}}o.fit(),z.onData(P=>ks(P));{const P=/Mac|iPhone|iPad|iPod/.test(navigator.platform||"");z.attachCustomKeyEventHandler(W=>!P&&W.type==="keydown"&&W.ctrlKey&&!W.shiftKey&&!W.altKey&&!W.metaKey&&(W.key==="v"||W.key==="V")&&navigator.clipboard&&navigator.clipboard.read?(navigator.clipboard.read().then(he=>{let ke=null,Pe=null;for(const be of he){for(const Ee of be.types)if(Ee.startsWith("image/")){Pe=Ee,ke=be;break}if(ke)break}ke&&Pe?ke.getType(Pe).then(be=>me(be,Pe)):navigator.clipboard.readText().then(be=>{be&&z.paste(be)})}).catch(()=>{navigator.clipboard.readText&&navigator.clipboard.readText().then(he=>{he&&z.paste(he)}).catch(()=>{})}),!1):!0)}z.parser.registerOscHandler(52,P=>{var ke;const W=P.indexOf(";");if(W===-1)return!0;const he=P.slice(W+1);if(!he||he==="?")return!0;try{const Pe=Uint8Array.from(atob(he),Ee=>Ee.charCodeAt(0)),be=new TextDecoder("utf-8").decode(Pe);(ke=navigator.clipboard)==null||ke.writeText(be).catch(()=>{})}catch{}return!0}),z.onScroll(O),z.onWriteParsed(O);let G=null;const pe=new ResizeObserver(()=>{G&&clearTimeout(G),G=setTimeout(()=>{const P=z.buffer.active,W=P.viewportY>=P.baseY,he=P.viewportY;o.fit(),W?z.scrollToBottom():z.scrollToLine(he),$l(z.cols,z.rows),O()},Kt?150:0)});return pe.observe(s),Kt&&(document.addEventListener("touchmove",de,{passive:!1}),document.addEventListener("touchend",Ce),document.addEventListener("touchcancel",Ce)),m(n,z,!0),()=>{G&&clearTimeout(G),Y&&clearTimeout(Y),pe.disconnect(),z.dispose(),m(n,null),S=!1,d=!1,Kt&&(document.removeEventListener("touchmove",de),document.removeEventListener("touchend",Ce),document.removeEventListener("touchcancel",Ce))}}),hr(()=>{t.sessionId&&a(n)&&!r()&&(a(n).write("\x1B[?1049l"),a(n).clear(),nv(t.sessionId,a(n),()=>{a(n)&&$l(a(n).cols,a(n).rows)},()=>{}))});let d=!1,f=0,_=0,p=H(0),b=H(0),g=H(!1),S=!1,x=0,C=0,w=!1,k=0,M=0,B=H(!1),q=H(!1),Y=null,ne=0,j=0;const N=500,L=10;let R=!1;function O(){R||(R=!0,requestAnimationFrame(U))}function U(){if(R=!1,!a(n))return;const z=a(n).buffer.active,G=z.baseY+a(n).rows,pe=z.viewportY,P=ve;if(!P)return;const W=P.clientHeight;if(G<=a(n).rows){m(g,!1);return}m(g,!0),m(p,Math.max(Kt?44:20,a(n).rows/G*W),!0),m(b,pe/(G-a(n).rows)*(W-a(p)))}function T(z){if(!a(n)||!ve)return;const G=ve.getBoundingClientRect(),P=a(n).buffer.active.baseY+a(n).rows;if(P<=a(n).rows)return;const W=ve.clientHeight,he=Math.max(Kt?44:20,a(n).rows/P*W),ke=W-he,Pe=z-G.top-he/2,be=Math.max(0,Math.min(1,Pe/ke)),Ee=Math.round(be*(P-a(n).rows));a(n).scrollToLine(Ee)}function E(z){const G=z.touches[0];G&&(d=!0,f=G.clientY,_=a(b))}function Q(){var z;a(q)&&(m(q,!1),(z=t.onCopyModeChange)==null||z.call(t,!1))}function ee(){var pe;if(Y=null,S=!1,navigator.vibrate&&navigator.vibrate(50),i()){m(q,!0),(pe=t.onCopyModeChange)==null||pe.call(t,!0),ks("[");return}m(B,!0);const z=s.querySelector(".xterm-screen");z&&(z.style.userSelect="text",z.style.webkitUserSelect="text"),s.querySelectorAll("canvas").forEach(P=>{P.style.pointerEvents="none"});const G=s.querySelector(".xterm-rows");if(G){const P=document.createRange();P.selectNodeContents(G);const W=window.getSelection();W==null||W.removeAllRanges(),W==null||W.addRange(P)}}function ge(){var G;m(B,!1);const z=s.querySelector(".xterm-screen");z&&(z.style.userSelect="",z.style.webkitUserSelect=""),s.querySelectorAll("canvas").forEach(pe=>{pe.style.pointerEvents=""}),(G=window.getSelection())==null||G.removeAllRanges()}function we(z){var pe;if(a(B)){const P=((pe=window.getSelection())==null?void 0:pe.toString())??"";P.trim().length>0&&(navigator.clipboard.writeText(P).catch(()=>{}),navigator.vibrate&&navigator.vibrate(30)),ge();return}if(a(q)||z.target.closest(".terminal-scrollbar")||z.target.closest(".scroll-fabs")||!a(n))return;const G=z.touches[0];G&&(x=G.clientY,M=G.clientY,C=a(n).buffer.active.viewportY,w=!1,k=0,S=!0,ne=G.clientX,j=G.clientY,Y&&clearTimeout(Y),Y=setTimeout(()=>{ee()},N))}function de(z){const G=z.touches[0];if(G){if(d){if(!a(n)||!ve)return;z.preventDefault();const pe=G.clientY-f,W=a(n).buffer.active.baseY+a(n).rows;if(W<=a(n).rows)return;const he=ve.clientHeight,ke=Math.max(44,a(n).rows/W*he),Pe=he-ke,Ee=Math.max(0,Math.min(Pe,_+pe))/Pe,$e=Math.round(Ee*(W-a(n).rows));a(n).scrollToLine($e);return}if(S&&a(n)&&!a(B)){if(Y){const P=Math.abs(G.clientX-ne),W=Math.abs(G.clientY-j);(P>L||W>L)&&(clearTimeout(Y),Y=null)}if(a(n).rows===0||s.clientHeight===0)return;const pe=x-G.clientY;if(Math.abs(pe)>5){w=!0,z.preventDefault();const P=s.clientHeight/a(n).rows;if(a(n).buffer.active.type==="alternate"){const W=M-G.clientY;M=G.clientY;const he=W/P;k+=he;const ke=Math.trunc(k);if(ke!==0){k-=ke;const Pe=ke>0?65:64,be=Math.max(1,Math.round(a(n).cols/2)),Ee=Math.max(1,Math.round(a(n).rows/2)),$e=`\x1B[<${Pe};${be};${Ee}M`,it=Math.min(Math.abs(ke),5);for(let Qt=0;Qt<it;Qt++)ks($e)}}else{const W=pe/P,he=a(n).buffer.active.baseY,ke=Math.max(0,Math.min(he,Math.round(C+W)));a(n).scrollToLine(ke)}}}}}function Ce(){Y&&(clearTimeout(Y),Y=null),d=!1,S=!1,w=!1,k=0}function Te(z){z.target!==ye&&T(z.clientY)}function De(z){var P,W,he;z.preventDefault();const G=z.target.closest("button");if(!G)return;const pe=G.dataset.dir;pe==="up"?(P=a(n))==null||P.scrollPages(-1):pe==="down"?(W=a(n))==null||W.scrollPages(1):pe==="bottom"&&((he=a(n))==null||he.scrollToBottom())}let ve,ye;async function me(z,G){var P;if(l||!t.sessionId)return;l=!0,(P=t.onImageUpload)==null||P.call(t,"Pasting image…",!1);const pe=new FileReader;pe.onload=async()=>{var he,ke,Pe;const W=pe.result.split(",")[1];try{const be=await Nm(t.sessionId,W,G);be.clipboardSet?(he=t.onImageUpload)==null||he.call(t,"Image pasted",!1):(ke=t.onImageUpload)==null||ke.call(t,be.path,!0,be.path)}catch(be){const Ee=be instanceof Error?be.message:"Image upload failed";(Pe=t.onImageUpload)==null||Pe.call(t,Ee,!1)}finally{l=!1}},pe.readAsDataURL(z)}function Ie(z){var G;if((G=z.clipboardData)!=null&&G.items){for(const pe of z.clipboardData.items)if(pe.type.startsWith("image/")){z.preventDefault(),z.stopPropagation();const P=pe.getAsFile();P&&me(P,pe.type);return}}}let Fe=H(!1);function ze(z){var G;(G=z.dataTransfer)!=null&&G.types.includes("Files")&&(z.preventDefault(),m(Fe,!0))}function Re(){m(Fe,!1)}function Qe(z){var pe;if(z.preventDefault(),m(Fe,!1),!((pe=z.dataTransfer)!=null&&pe.files.length))return;const G=z.dataTransfer.files[0];G.type.startsWith("image/")&&me(G,G.type)}function Z(z){var G;d||w||z.target.closest(".terminal-scrollbar")||a(B)||((G=a(n))==null||G.focus(),z.preventDefault())}var ue={getTerm:h,focusTerm:c,fitTerm:u,exitCopyMode:Q,handleImageUpload:me},A=B1();let $;var se=y(A);st(se,z=>s=z,()=>s);var J=D(se,2);Ue(J,"aria-valuenow",0);var Se=y(J);let le;st(Se,z=>ye=z,()=>ye),st(J,z=>ve=z,()=>ve);var Me=D(J,2);{var Oe=z=>{var G=I1();V("mousedown",G,De),I(z,G)};re(Me,z=>{Kt&&a(g)&&z(Oe)})}return ce(()=>{$=tt(A,1,"terminal-wrapper svelte-5qgfij",null,$,{"drag-over":a(Fe),"selection-mode":a(B)}),le=lo(Se,"",le,{display:a(g)?"block":"none",height:a(p)+"px",top:a(b)+"px"})}),V("touchstart",A,function(...z){var G;(G=Kt?we:void 0)==null||G.apply(this,z)}),V("touchend",A,function(...z){var G;(G=Kt?Z:void 0)==null||G.apply(this,z)}),ar("paste",se,Ie),ar("dragover",se,ze),ar("dragleave",se,Re),ar("drop",se,Qe),V("click",J,Te),V("touchstart",Se,E),I(e,A),_t(ue)}vt(["touchstart","touchend","click","mousedown"]);var ga=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},F1={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ls,Uc,Ef,W1=(Ef=class{constructor(){ie(this,ls,F1);ie(this,Uc,!1)}setTimeoutProvider(e){X(this,ls,e)}setTimeout(e,t){return v(this,ls).setTimeout(e,t)}clearTimeout(e){v(this,ls).clearTimeout(e)}setInterval(e,t){return v(this,ls).setInterval(e,t)}clearInterval(e){v(this,ls).clearInterval(e)}},ls=new WeakMap,Uc=new WeakMap,Ef),Ks=new W1;function H1(e){setTimeout(e,0)}var no=typeof window>"u"||"Deno"in globalThis;function Ni(){}function z1(e,t){return typeof e=="function"?e(t):e}function Ec(e){return typeof e=="number"&&e>=0&&e!==1/0}function mp(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ds(e,t){return typeof e=="function"?e(t):e}function Hi(e,t){return typeof e=="function"?e(t):e}function hf(e,t){const{type:i="all",exact:r,fetchStatus:s,predicate:n,queryKey:o,stale:l}=e;if(o){if(r){if(t.queryHash!==xd(o,t.options))return!1}else if(!Xo(t.queryKey,o))return!1}if(i!=="all"){const h=t.isActive();if(i==="active"&&!h||i==="inactive"&&h)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||s&&s!==t.state.fetchStatus||n&&!n(t))}function cf(e,t){const{exact:i,status:r,predicate:s,mutationKey:n}=e;if(n){if(!t.options.mutationKey)return!1;if(i){if(Go(t.options.mutationKey)!==Go(n))return!1}else if(!Xo(t.options.mutationKey,n))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function xd(e,t){return((t==null?void 0:t.queryKeyHashFn)||Go)(e)}function Go(e){return JSON.stringify(e,(t,i)=>Tc(i)?Object.keys(i).sort().reduce((r,s)=>(r[s]=i[s],r),{}):i)}function Xo(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(i=>Xo(e[i],t[i])):!1}var U1=Object.prototype.hasOwnProperty;function bp(e,t,i=0){if(e===t)return e;if(i>500)return t;const r=df(e)&&df(t);if(!r&&!(Tc(e)&&Tc(t)))return t;const n=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),l=o.length,h=r?new Array(l):{};let c=0;for(let u=0;u<l;u++){const d=r?u:o[u],f=e[d],_=t[d];if(f===_){h[d]=f,(r?u<n:U1.call(e,d))&&c++;continue}if(f===null||_===null||typeof f!="object"||typeof _!="object"){h[d]=_;continue}const p=bp(f,_,i+1);h[d]=p,p===f&&c++}return n===l&&c===n?e:h}function Dc(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(e[i]!==t[i])return!1;return!0}function df(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Tc(e){if(!uf(e))return!1;const t=e.constructor;if(t===void 0)return!0;const i=t.prototype;return!(!uf(i)||!i.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function uf(e){return Object.prototype.toString.call(e)==="[object Object]"}function K1(e){return new Promise(t=>{Ks.setTimeout(t,e)})}function Rc(e,t,i){return typeof i.structuralSharing=="function"?i.structuralSharing(e,t):i.structuralSharing!==!1?bp(e,t):t}function q1(e,t,i=0){const r=[...e,t];return i&&r.length>i?r.slice(1):r}function j1(e,t,i=0){const r=[t,...e];return i&&r.length>i?r.slice(0,-1):r}var Ed=Symbol();function yp(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Ed?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Y1(e,t,i){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),r||(r=!0,s.aborted?i():s.addEventListener("abort",i,{once:!0})),s)}),e}var Xs,hs,Fn,Df,V1=(Df=class extends ga{constructor(){super();ie(this,Xs);ie(this,hs);ie(this,Fn);X(this,Fn,t=>{if(!no&&window.addEventListener){const i=()=>t();return window.addEventListener("visibilitychange",i,!1),()=>{window.removeEventListener("visibilitychange",i)}}})}onSubscribe(){v(this,hs)||this.setEventListener(v(this,Fn))}onUnsubscribe(){var t;this.hasListeners()||((t=v(this,hs))==null||t.call(this),X(this,hs,void 0))}setEventListener(t){var i;X(this,Fn,t),(i=v(this,hs))==null||i.call(this),X(this,hs,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){v(this,Xs)!==t&&(X(this,Xs,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(i=>{i(t)})}isFocused(){var t;return typeof v(this,Xs)=="boolean"?v(this,Xs):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Xs=new WeakMap,hs=new WeakMap,Fn=new WeakMap,Df),Dd=new V1;function Pc(){let e,t;const i=new Promise((s,n)=>{e=s,t=n});i.status="pending",i.catch(()=>{});function r(s){Object.assign(i,s),delete i.resolve,delete i.reject}return i.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},i.reject=s=>{r({status:"rejected",reason:s}),t(s)},i}var G1=H1;function X1(){let e=[],t=0,i=l=>{l()},r=l=>{l()},s=G1;const n=l=>{t?e.push(l):s(()=>{i(l)})},o=()=>{const l=e;e=[],l.length&&s(()=>{r(()=>{l.forEach(h=>{i(h)})})})};return{batch:l=>{let h;t++;try{h=l()}finally{t--,t||o()}return h},batchCalls:l=>(...h)=>{n(()=>{l(...h)})},schedule:n,setNotifyFunction:l=>{i=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{s=l}}}var ri=X1(),Wn,cs,Hn,Tf,$1=(Tf=class extends ga{constructor(){super();ie(this,Wn,!0);ie(this,cs);ie(this,Hn);X(this,Hn,t=>{if(!no&&window.addEventListener){const i=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",r)}}})}onSubscribe(){v(this,cs)||this.setEventListener(v(this,Hn))}onUnsubscribe(){var t;this.hasListeners()||((t=v(this,cs))==null||t.call(this),X(this,cs,void 0))}setEventListener(t){var i;X(this,Hn,t),(i=v(this,cs))==null||i.call(this),X(this,cs,t(this.setOnline.bind(this)))}setOnline(t){v(this,Wn)!==t&&(X(this,Wn,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return v(this,Wn)}},Wn=new WeakMap,cs=new WeakMap,Hn=new WeakMap,Tf),ul=new $1;function Z1(e){return Math.min(1e3*2**e,3e4)}function Sp(e){return(e??"online")==="online"?ul.isOnline():!0}var Mc=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function wp(e){let t=!1,i=0,r;const s=Pc(),n=()=>s.status!=="pending",o=b=>{var g;if(!n()){const S=new Mc(b);f(S),(g=e.onCancel)==null||g.call(e,S)}},l=()=>{t=!0},h=()=>{t=!1},c=()=>Dd.isFocused()&&(e.networkMode==="always"||ul.isOnline())&&e.canRun(),u=()=>Sp(e.networkMode)&&e.canRun(),d=b=>{n()||(r==null||r(),s.resolve(b))},f=b=>{n()||(r==null||r(),s.reject(b))},_=()=>new Promise(b=>{var g;r=S=>{(n()||c())&&b(S)},(g=e.onPause)==null||g.call(e)}).then(()=>{var b;r=void 0,n()||(b=e.onContinue)==null||b.call(e)}),p=()=>{if(n())return;let b;const g=i===0?e.initialPromise:void 0;try{b=g??e.fn()}catch(S){b=Promise.reject(S)}Promise.resolve(b).then(d).catch(S=>{var M;if(n())return;const x=e.retry??(no?0:3),C=e.retryDelay??Z1,w=typeof C=="function"?C(i,S):C,k=x===!0||typeof x=="number"&&i<x||typeof x=="function"&&x(i,S);if(t||!k){f(S);return}i++,(M=e.onFail)==null||M.call(e,i,S),K1(w).then(()=>c()?void 0:_()).then(()=>{t?f(S):p()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:l,continueRetry:h,canStart:u,start:()=>(u()?p():_().then(p),s)}}var $s,Rf,Cp=(Rf=class{constructor(){ie(this,$s)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ec(this.gcTime)&&X(this,$s,Ks.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(no?1/0:300*1e3))}clearGcTimeout(){v(this,$s)&&(Ks.clearTimeout(v(this,$s)),X(this,$s,void 0))}},$s=new WeakMap,Rf),Zs,zn,Ii,Qs,Ot,ea,Js,er,Ir,Pf,Q1=(Pf=class extends Cp{constructor(t){super();ie(this,er);ie(this,Zs);ie(this,zn);ie(this,Ii);ie(this,Qs);ie(this,Ot);ie(this,ea);ie(this,Js);X(this,Js,!1),X(this,ea,t.defaultOptions),this.setOptions(t.options),this.observers=[],X(this,Qs,t.client),X(this,Ii,v(this,Qs).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,X(this,Zs,_f(this.options)),this.state=t.state??v(this,Zs),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=v(this,Ot))==null?void 0:t.promise}setOptions(t){if(this.options={...v(this,ea),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=_f(this.options);i.data!==void 0&&(this.setState(ff(i.data,i.dataUpdatedAt)),X(this,Zs,i))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&v(this,Ii).remove(this)}setData(t,i){const r=Rc(this.state.data,t,this.options);return xe(this,er,Ir).call(this,{data:r,type:"success",dataUpdatedAt:i==null?void 0:i.updatedAt,manual:i==null?void 0:i.manual}),r}setState(t,i){xe(this,er,Ir).call(this,{type:"setState",state:t,setStateOptions:i})}cancel(t){var r,s;const i=(r=v(this,Ot))==null?void 0:r.promise;return(s=v(this,Ot))==null||s.cancel(t),i?i.then(Ni).catch(Ni):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(v(this,Zs))}isActive(){return this.observers.some(t=>Hi(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ed||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Ds(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!mp(this.state.dataUpdatedAt,t)}onFocus(){var i;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(i=v(this,Ot))==null||i.continue()}onOnline(){var i;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(i=v(this,Ot))==null||i.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),v(this,Ii).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(i=>i!==t),this.observers.length||(v(this,Ot)&&(v(this,Js)?v(this,Ot).cancel({revert:!0}):v(this,Ot).cancelRetry()),this.scheduleGc()),v(this,Ii).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||xe(this,er,Ir).call(this,{type:"invalidate"})}async fetch(t,i){var h,c,u,d,f,_,p,b,g,S,x,C;if(this.state.fetchStatus!=="idle"&&((h=v(this,Ot))==null?void 0:h.status())!=="rejected"){if(this.state.data!==void 0&&(i!=null&&i.cancelRefetch))this.cancel({silent:!0});else if(v(this,Ot))return v(this,Ot).continueRetry(),v(this,Ot).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(k=>k.options.queryFn);w&&this.setOptions(w.options)}const r=new AbortController,s=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(X(this,Js,!0),r.signal)})},n=()=>{const w=yp(this.options,i),M=(()=>{const B={client:v(this,Qs),queryKey:this.queryKey,meta:this.meta};return s(B),B})();return X(this,Js,!1),this.options.persister?this.options.persister(w,M,this):w(M)},l=(()=>{const w={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:v(this,Qs),state:this.state,fetchFn:n};return s(w),w})();(c=this.options.behavior)==null||c.onFetch(l,this),X(this,zn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=l.fetchOptions)==null?void 0:u.meta))&&xe(this,er,Ir).call(this,{type:"fetch",meta:(d=l.fetchOptions)==null?void 0:d.meta}),X(this,Ot,wp({initialPromise:i==null?void 0:i.initialPromise,fn:l.fetchFn,onCancel:w=>{w instanceof Mc&&w.revert&&this.setState({...v(this,zn),fetchStatus:"idle"}),r.abort()},onFail:(w,k)=>{xe(this,er,Ir).call(this,{type:"failed",failureCount:w,error:k})},onPause:()=>{xe(this,er,Ir).call(this,{type:"pause"})},onContinue:()=>{xe(this,er,Ir).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const w=await v(this,Ot).start();if(w===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(w),(_=(f=v(this,Ii).config).onSuccess)==null||_.call(f,w,this),(b=(p=v(this,Ii).config).onSettled)==null||b.call(p,w,this.state.error,this),w}catch(w){if(w instanceof Mc){if(w.silent)return v(this,Ot).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw xe(this,er,Ir).call(this,{type:"error",error:w}),(S=(g=v(this,Ii).config).onError)==null||S.call(g,w,this),(C=(x=v(this,Ii).config).onSettled)==null||C.call(x,this.state.data,w,this),w}finally{this.scheduleGc()}}},Zs=new WeakMap,zn=new WeakMap,Ii=new WeakMap,Qs=new WeakMap,Ot=new WeakMap,ea=new WeakMap,Js=new WeakMap,er=new WeakSet,Ir=function(t){const i=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...kp(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...ff(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return X(this,zn,t.manual?s:void 0),s;case"error":const n=t.error;return{...r,error:n,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=i(this.state),ri.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),v(this,Ii).notify({query:this,type:"updated",action:t})})},Pf);function kp(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Sp(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ff(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function _f(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,i=t!==void 0,r=i?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:i?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:i?"success":"pending",fetchStatus:"idle"}}var ui,qe,ta,oi,en,Un,Wr,ds,ia,Kn,qn,tn,rn,us,jn,Xe,Po,Ac,Oc,Lc,Ic,Bc,Nc,Fc,xp,Mf,J1=(Mf=class extends ga{constructor(t,i){super();ie(this,Xe);ie(this,ui);ie(this,qe);ie(this,ta);ie(this,oi);ie(this,en);ie(this,Un);ie(this,Wr);ie(this,ds);ie(this,ia);ie(this,Kn);ie(this,qn);ie(this,tn);ie(this,rn);ie(this,us);ie(this,jn,new Set);this.options=i,X(this,ui,t),X(this,ds,null),X(this,Wr,Pc()),this.bindMethods(),this.setOptions(i)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(v(this,qe).addObserver(this),vf(v(this,qe),this.options)?xe(this,Xe,Po).call(this):this.updateResult(),xe(this,Xe,Ic).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Wc(v(this,qe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Wc(v(this,qe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,xe(this,Xe,Bc).call(this),xe(this,Xe,Nc).call(this),v(this,qe).removeObserver(this)}setOptions(t){const i=this.options,r=v(this,qe);if(this.options=v(this,ui).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Hi(this.options.enabled,v(this,qe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");xe(this,Xe,Fc).call(this),v(this,qe).setOptions(this.options),i._defaulted&&!Dc(this.options,i)&&v(this,ui).getQueryCache().notify({type:"observerOptionsUpdated",query:v(this,qe),observer:this});const s=this.hasListeners();s&&pf(v(this,qe),r,this.options,i)&&xe(this,Xe,Po).call(this),this.updateResult(),s&&(v(this,qe)!==r||Hi(this.options.enabled,v(this,qe))!==Hi(i.enabled,v(this,qe))||Ds(this.options.staleTime,v(this,qe))!==Ds(i.staleTime,v(this,qe)))&&xe(this,Xe,Ac).call(this);const n=xe(this,Xe,Oc).call(this);s&&(v(this,qe)!==r||Hi(this.options.enabled,v(this,qe))!==Hi(i.enabled,v(this,qe))||n!==v(this,us))&&xe(this,Xe,Lc).call(this,n)}getOptimisticResult(t){const i=v(this,ui).getQueryCache().build(v(this,ui),t),r=this.createResult(i,t);return tC(this,r)&&(X(this,oi,r),X(this,Un,this.options),X(this,en,v(this,qe).state)),r}getCurrentResult(){return v(this,oi)}trackResult(t,i){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),i==null||i(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&v(this,Wr).status==="pending"&&v(this,Wr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){v(this,jn).add(t)}getCurrentQuery(){return v(this,qe)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const i=v(this,ui).defaultQueryOptions(t),r=v(this,ui).getQueryCache().build(v(this,ui),i);return r.fetch().then(()=>this.createResult(r,i))}fetch(t){return xe(this,Xe,Po).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),v(this,oi)))}createResult(t,i){var Y;const r=v(this,qe),s=this.options,n=v(this,oi),o=v(this,en),l=v(this,Un),c=t!==r?t.state:v(this,ta),{state:u}=t;let d={...u},f=!1,_;if(i._optimisticResults){const ne=this.hasListeners(),j=!ne&&vf(t,i),N=ne&&pf(t,r,i,s);(j||N)&&(d={...d,...kp(u.data,t.options)}),i._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:p,errorUpdatedAt:b,status:g}=d;_=d.data;let S=!1;if(i.placeholderData!==void 0&&_===void 0&&g==="pending"){let ne;n!=null&&n.isPlaceholderData&&i.placeholderData===(l==null?void 0:l.placeholderData)?(ne=n.data,S=!0):ne=typeof i.placeholderData=="function"?i.placeholderData((Y=v(this,qn))==null?void 0:Y.state.data,v(this,qn)):i.placeholderData,ne!==void 0&&(g="success",_=Rc(n==null?void 0:n.data,ne,i),f=!0)}if(i.select&&_!==void 0&&!S)if(n&&_===(o==null?void 0:o.data)&&i.select===v(this,ia))_=v(this,Kn);else try{X(this,ia,i.select),_=i.select(_),_=Rc(n==null?void 0:n.data,_,i),X(this,Kn,_),X(this,ds,null)}catch(ne){X(this,ds,ne)}v(this,ds)&&(p=v(this,ds),_=v(this,Kn),b=Date.now(),g="error");const x=d.fetchStatus==="fetching",C=g==="pending",w=g==="error",k=C&&x,M=_!==void 0,q={status:g,fetchStatus:d.fetchStatus,isPending:C,isSuccess:g==="success",isError:w,isInitialLoading:k,isLoading:k,data:_,dataUpdatedAt:d.dataUpdatedAt,error:p,errorUpdatedAt:b,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>c.dataUpdateCount||d.errorUpdateCount>c.errorUpdateCount,isFetching:x,isRefetching:x&&!C,isLoadingError:w&&!M,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:w&&M,isStale:Td(t,i),refetch:this.refetch,promise:v(this,Wr),isEnabled:Hi(i.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const ne=q.data!==void 0,j=q.status==="error"&&!ne,N=O=>{j?O.reject(q.error):ne&&O.resolve(q.data)},L=()=>{const O=X(this,Wr,q.promise=Pc());N(O)},R=v(this,Wr);switch(R.status){case"pending":t.queryHash===r.queryHash&&N(R);break;case"fulfilled":(j||q.data!==R.value)&&L();break;case"rejected":(!j||q.error!==R.reason)&&L();break}}return q}updateResult(){const t=v(this,oi),i=this.createResult(v(this,qe),this.options);if(X(this,en,v(this,qe).state),X(this,Un,this.options),v(this,en).data!==void 0&&X(this,qn,v(this,qe)),Dc(i,t))return;X(this,oi,i);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,n=typeof s=="function"?s():s;if(n==="all"||!n&&!v(this,jn).size)return!0;const o=new Set(n??v(this,jn));return this.options.throwOnError&&o.add("error"),Object.keys(v(this,oi)).some(l=>{const h=l;return v(this,oi)[h]!==t[h]&&o.has(h)})};xe(this,Xe,xp).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&xe(this,Xe,Ic).call(this)}},ui=new WeakMap,qe=new WeakMap,ta=new WeakMap,oi=new WeakMap,en=new WeakMap,Un=new WeakMap,Wr=new WeakMap,ds=new WeakMap,ia=new WeakMap,Kn=new WeakMap,qn=new WeakMap,tn=new WeakMap,rn=new WeakMap,us=new WeakMap,jn=new WeakMap,Xe=new WeakSet,Po=function(t){xe(this,Xe,Fc).call(this);let i=v(this,qe).fetch(this.options,t);return t!=null&&t.throwOnError||(i=i.catch(Ni)),i},Ac=function(){xe(this,Xe,Bc).call(this);const t=Ds(this.options.staleTime,v(this,qe));if(no||v(this,oi).isStale||!Ec(t))return;const r=mp(v(this,oi).dataUpdatedAt,t)+1;X(this,tn,Ks.setTimeout(()=>{v(this,oi).isStale||this.updateResult()},r))},Oc=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(v(this,qe)):this.options.refetchInterval)??!1},Lc=function(t){xe(this,Xe,Nc).call(this),X(this,us,t),!(no||Hi(this.options.enabled,v(this,qe))===!1||!Ec(v(this,us))||v(this,us)===0)&&X(this,rn,Ks.setInterval(()=>{(this.options.refetchIntervalInBackground||Dd.isFocused())&&xe(this,Xe,Po).call(this)},v(this,us)))},Ic=function(){xe(this,Xe,Ac).call(this),xe(this,Xe,Lc).call(this,xe(this,Xe,Oc).call(this))},Bc=function(){v(this,tn)&&(Ks.clearTimeout(v(this,tn)),X(this,tn,void 0))},Nc=function(){v(this,rn)&&(Ks.clearInterval(v(this,rn)),X(this,rn,void 0))},Fc=function(){const t=v(this,ui).getQueryCache().build(v(this,ui),this.options);if(t===v(this,qe))return;const i=v(this,qe);X(this,qe,t),X(this,ta,t.state),this.hasListeners()&&(i==null||i.removeObserver(this),t.addObserver(this))},xp=function(t){ri.batch(()=>{t.listeners&&this.listeners.forEach(i=>{i(v(this,oi))}),v(this,ui).getQueryCache().notify({query:v(this,qe),type:"observerResultsUpdated"})})},Mf);function eC(e,t){return Hi(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function vf(e,t){return eC(e,t)||e.state.data!==void 0&&Wc(e,t,t.refetchOnMount)}function Wc(e,t,i){if(Hi(t.enabled,e)!==!1&&Ds(t.staleTime,e)!=="static"){const r=typeof i=="function"?i(e):i;return r==="always"||r!==!1&&Td(e,t)}return!1}function pf(e,t,i,r){return(e!==t||Hi(r.enabled,e)===!1)&&(!i.suspense||e.state.status!=="error")&&Td(e,i)}function Td(e,t){return Hi(t.enabled,e)!==!1&&e.isStaleByTime(Ds(t.staleTime,e))}function tC(e,t){return!Dc(e.getCurrentResult(),t)}function gf(e){return{onFetch:(t,i)=>{var u,d,f,_,p;const r=t.options,s=(f=(d=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:f.direction,n=((_=t.state.data)==null?void 0:_.pages)||[],o=((p=t.state.data)==null?void 0:p.pageParams)||[];let l={pages:[],pageParams:[]},h=0;const c=async()=>{let b=!1;const g=C=>{Y1(C,()=>t.signal,()=>b=!0)},S=yp(t.options,t.fetchOptions),x=async(C,w,k)=>{if(b)return Promise.reject();if(w==null&&C.pages.length)return Promise.resolve(C);const B=(()=>{const j={client:t.client,queryKey:t.queryKey,pageParam:w,direction:k?"backward":"forward",meta:t.options.meta};return g(j),j})(),q=await S(B),{maxPages:Y}=t.options,ne=k?j1:q1;return{pages:ne(C.pages,q,Y),pageParams:ne(C.pageParams,w,Y)}};if(s&&n.length){const C=s==="backward",w=C?iC:mf,k={pages:n,pageParams:o},M=w(r,k);l=await x(k,M,C)}else{const C=e??n.length;do{const w=h===0?o[0]??r.initialPageParam:mf(r,l);if(h>0&&w==null)break;l=await x(l,w),h++}while(h<C)}return l};t.options.persister?t.fetchFn=()=>{var b,g;return(g=(b=t.options).persister)==null?void 0:g.call(b,c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},i)}:t.fetchFn=c}}}function mf(e,{pages:t,pageParams:i}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,i[r],i):void 0}function iC(e,{pages:t,pageParams:i}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,i[0],i):void 0}var ra,wr,ti,sn,Cr,ss,Af,rC=(Af=class extends Cp{constructor(t){super();ie(this,Cr);ie(this,ra);ie(this,wr);ie(this,ti);ie(this,sn);X(this,ra,t.client),this.mutationId=t.mutationId,X(this,ti,t.mutationCache),X(this,wr,[]),this.state=t.state||sC(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){v(this,wr).includes(t)||(v(this,wr).push(t),this.clearGcTimeout(),v(this,ti).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){X(this,wr,v(this,wr).filter(i=>i!==t)),this.scheduleGc(),v(this,ti).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){v(this,wr).length||(this.state.status==="pending"?this.scheduleGc():v(this,ti).remove(this))}continue(){var t;return((t=v(this,sn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,l,h,c,u,d,f,_,p,b,g,S,x,C,w,k,M,B;const i=()=>{xe(this,Cr,ss).call(this,{type:"continue"})},r={client:v(this,ra),meta:this.options.meta,mutationKey:this.options.mutationKey};X(this,sn,wp({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(q,Y)=>{xe(this,Cr,ss).call(this,{type:"failed",failureCount:q,error:Y})},onPause:()=>{xe(this,Cr,ss).call(this,{type:"pause"})},onContinue:i,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>v(this,ti).canRun(this)}));const s=this.state.status==="pending",n=!v(this,sn).canStart();try{if(s)i();else{xe(this,Cr,ss).call(this,{type:"pending",variables:t,isPaused:n}),v(this,ti).config.onMutate&&await v(this,ti).config.onMutate(t,this,r);const Y=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t,r));Y!==this.state.context&&xe(this,Cr,ss).call(this,{type:"pending",context:Y,variables:t,isPaused:n})}const q=await v(this,sn).start();return await((c=(h=v(this,ti).config).onSuccess)==null?void 0:c.call(h,q,t,this.state.context,this,r)),await((d=(u=this.options).onSuccess)==null?void 0:d.call(u,q,t,this.state.context,r)),await((_=(f=v(this,ti).config).onSettled)==null?void 0:_.call(f,q,null,this.state.variables,this.state.context,this,r)),await((b=(p=this.options).onSettled)==null?void 0:b.call(p,q,null,t,this.state.context,r)),xe(this,Cr,ss).call(this,{type:"success",data:q}),q}catch(q){try{await((S=(g=v(this,ti).config).onError)==null?void 0:S.call(g,q,t,this.state.context,this,r))}catch(Y){Promise.reject(Y)}try{await((C=(x=this.options).onError)==null?void 0:C.call(x,q,t,this.state.context,r))}catch(Y){Promise.reject(Y)}try{await((k=(w=v(this,ti).config).onSettled)==null?void 0:k.call(w,void 0,q,this.state.variables,this.state.context,this,r))}catch(Y){Promise.reject(Y)}try{await((B=(M=this.options).onSettled)==null?void 0:B.call(M,void 0,q,t,this.state.context,r))}catch(Y){Promise.reject(Y)}throw xe(this,Cr,ss).call(this,{type:"error",error:q}),q}finally{v(this,ti).runNext(this)}}},ra=new WeakMap,wr=new WeakMap,ti=new WeakMap,sn=new WeakMap,Cr=new WeakSet,ss=function(t){const i=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=i(this.state),ri.batch(()=>{v(this,wr).forEach(r=>{r.onMutationUpdate(t)}),v(this,ti).notify({mutation:this,type:"updated",action:t})})},Af);function sC(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Hr,tr,sa,Of,nC=(Of=class extends ga{constructor(t={}){super();ie(this,Hr);ie(this,tr);ie(this,sa);this.config=t,X(this,Hr,new Set),X(this,tr,new Map),X(this,sa,0)}build(t,i,r){const s=new rC({client:t,mutationCache:this,mutationId:++Ca(this,sa)._,options:t.defaultMutationOptions(i),state:r});return this.add(s),s}add(t){v(this,Hr).add(t);const i=Ia(t);if(typeof i=="string"){const r=v(this,tr).get(i);r?r.push(t):v(this,tr).set(i,[t])}this.notify({type:"added",mutation:t})}remove(t){if(v(this,Hr).delete(t)){const i=Ia(t);if(typeof i=="string"){const r=v(this,tr).get(i);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&v(this,tr).delete(i)}}this.notify({type:"removed",mutation:t})}canRun(t){const i=Ia(t);if(typeof i=="string"){const r=v(this,tr).get(i),s=r==null?void 0:r.find(n=>n.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const i=Ia(t);if(typeof i=="string"){const s=(r=v(this,tr).get(i))==null?void 0:r.find(n=>n!==t&&n.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ri.batch(()=>{v(this,Hr).forEach(t=>{this.notify({type:"removed",mutation:t})}),v(this,Hr).clear(),v(this,tr).clear()})}getAll(){return Array.from(v(this,Hr))}find(t){const i={exact:!0,...t};return this.getAll().find(r=>cf(i,r))}findAll(t={}){return this.getAll().filter(i=>cf(t,i))}notify(t){ri.batch(()=>{this.listeners.forEach(i=>{i(t)})})}resumePausedMutations(){const t=this.getAll().filter(i=>i.state.isPaused);return ri.batch(()=>Promise.all(t.map(i=>i.continue().catch(Ni))))}},Hr=new WeakMap,tr=new WeakMap,sa=new WeakMap,Of);function Ia(e){var t;return(t=e.options.scope)==null?void 0:t.id}var kr,Lf,oC=(Lf=class extends ga{constructor(t={}){super();ie(this,kr);this.config=t,X(this,kr,new Map)}build(t,i,r){const s=i.queryKey,n=i.queryHash??xd(s,i);let o=this.get(n);return o||(o=new Q1({client:t,queryKey:s,queryHash:n,options:t.defaultQueryOptions(i),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){v(this,kr).has(t.queryHash)||(v(this,kr).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const i=v(this,kr).get(t.queryHash);i&&(t.destroy(),i===t&&v(this,kr).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ri.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return v(this,kr).get(t)}getAll(){return[...v(this,kr).values()]}find(t){const i={exact:!0,...t};return this.getAll().find(r=>hf(i,r))}findAll(t={}){const i=this.getAll();return Object.keys(t).length>0?i.filter(r=>hf(t,r)):i}notify(t){ri.batch(()=>{this.listeners.forEach(i=>{i(t)})})}onFocus(){ri.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ri.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},kr=new WeakMap,Lf),dt,fs,_s,Yn,Vn,vs,Gn,Xn,If,Ep=(If=class{constructor(e={}){ie(this,dt);ie(this,fs);ie(this,_s);ie(this,Yn);ie(this,Vn);ie(this,vs);ie(this,Gn);ie(this,Xn);X(this,dt,e.queryCache||new oC),X(this,fs,e.mutationCache||new nC),X(this,_s,e.defaultOptions||{}),X(this,Yn,new Map),X(this,Vn,new Map),X(this,vs,0)}mount(){Ca(this,vs)._++,v(this,vs)===1&&(X(this,Gn,Dd.subscribe(async e=>{e&&(await this.resumePausedMutations(),v(this,dt).onFocus())})),X(this,Xn,ul.subscribe(async e=>{e&&(await this.resumePausedMutations(),v(this,dt).onOnline())})))}unmount(){var e,t;Ca(this,vs)._--,v(this,vs)===0&&((e=v(this,Gn))==null||e.call(this),X(this,Gn,void 0),(t=v(this,Xn))==null||t.call(this),X(this,Xn,void 0))}isFetching(e){return v(this,dt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return v(this,fs).findAll({...e,status:"pending"}).length}getQueryData(e){var i;const t=this.defaultQueryOptions({queryKey:e});return(i=v(this,dt).get(t.queryHash))==null?void 0:i.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),i=v(this,dt).build(this,t),r=i.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&i.isStaleByTime(Ds(t.staleTime,i))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return v(this,dt).findAll(e).map(({queryKey:t,state:i})=>{const r=i.data;return[t,r]})}setQueryData(e,t,i){const r=this.defaultQueryOptions({queryKey:e}),s=v(this,dt).get(r.queryHash),n=s==null?void 0:s.state.data,o=z1(t,n);if(o!==void 0)return v(this,dt).build(this,r).setData(o,{...i,manual:!0})}setQueriesData(e,t,i){return ri.batch(()=>v(this,dt).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,i)]))}getQueryState(e){var i;const t=this.defaultQueryOptions({queryKey:e});return(i=v(this,dt).get(t.queryHash))==null?void 0:i.state}removeQueries(e){const t=v(this,dt);ri.batch(()=>{t.findAll(e).forEach(i=>{t.remove(i)})})}resetQueries(e,t){const i=v(this,dt);return ri.batch(()=>(i.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const i={revert:!0,...t},r=ri.batch(()=>v(this,dt).findAll(e).map(s=>s.cancel(i)));return Promise.all(r).then(Ni).catch(Ni)}invalidateQueries(e,t={}){return ri.batch(()=>(v(this,dt).findAll(e).forEach(i=>{i.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const i={...t,cancelRefetch:t.cancelRefetch??!0},r=ri.batch(()=>v(this,dt).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let n=s.fetch(void 0,i);return i.throwOnError||(n=n.catch(Ni)),s.state.fetchStatus==="paused"?Promise.resolve():n}));return Promise.all(r).then(Ni)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const i=v(this,dt).build(this,t);return i.isStaleByTime(Ds(t.staleTime,i))?i.fetch(t):Promise.resolve(i.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ni).catch(Ni)}fetchInfiniteQuery(e){return e.behavior=gf(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ni).catch(Ni)}ensureInfiniteQueryData(e){return e.behavior=gf(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ul.isOnline()?v(this,fs).resumePausedMutations():Promise.resolve()}getQueryCache(){return v(this,dt)}getMutationCache(){return v(this,fs)}getDefaultOptions(){return v(this,_s)}setDefaultOptions(e){X(this,_s,e)}setQueryDefaults(e,t){v(this,Yn).set(Go(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...v(this,Yn).values()],i={};return t.forEach(r=>{Xo(e,r.queryKey)&&Object.assign(i,r.defaultOptions)}),i}setMutationDefaults(e,t){v(this,Vn).set(Go(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...v(this,Vn).values()],i={};return t.forEach(r=>{Xo(e,r.mutationKey)&&Object.assign(i,r.defaultOptions)}),i}defaultQueryOptions(e){if(e._defaulted)return e;const t={...v(this,_s).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=xd(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Ed&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...v(this,_s).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){v(this,dt).clear(),v(this,fs).clear()}},dt=new WeakMap,fs=new WeakMap,_s=new WeakMap,Yn=new WeakMap,Vn=new WeakMap,vs=new WeakMap,Gn=new WeakMap,Xn=new WeakMap,If);const Dp=Symbol("QueryClient"),aC=()=>{const e=Yf(Dp);if(!e)throw new Error("No QueryClient was found in Svelte context. Did you forget to wrap your component with QueryClientProvider?");return e},lC=e=>{vg(Dp,e)},hC=Symbol("isRestoring"),cC=()=>{try{return Yf(hC)??{current:!1}}catch{return{current:!1}}};function dC(){return cC()}function uC(e){return aC()}var fC=["forEach","isDisjointFrom","isSubsetOf","isSupersetOf"],_C=["difference","intersection","symmetricDifference","union"],bf=!1,$n,ir,ps,pl,oo,Tp,Rp;const gl=class gl extends Set{constructor(i){super();ie(this,oo);ie(this,$n,new Map);ie(this,ir,H(0));ie(this,ps,H(0));ie(this,pl,Yr||-1);if(i){for(var r of i)super.add(r);v(this,ps).v=super.size}bf||xe(this,oo,Rp).call(this)}has(i){var r=super.has(i),s=v(this,$n),n=s.get(i);if(n===void 0){if(!r)return a(v(this,ir)),!1;n=xe(this,oo,Tp).call(this,!0),s.set(i,n)}return a(n),r}add(i){return super.has(i)||(super.add(i),m(v(this,ps),super.size),Cs(v(this,ir))),this}delete(i){var r=super.delete(i),s=v(this,$n),n=s.get(i);return n!==void 0&&(s.delete(i),m(n,!1)),r&&(m(v(this,ps),super.size),Cs(v(this,ir))),r}clear(){if(super.size!==0){super.clear();var i=v(this,$n);for(var r of i.values())m(r,!1);i.clear(),m(v(this,ps),0),Cs(v(this,ir))}}keys(){return this.values()}values(){return a(v(this,ir)),super.values()}entries(){return a(v(this,ir)),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return a(v(this,ps))}};$n=new WeakMap,ir=new WeakMap,ps=new WeakMap,pl=new WeakMap,oo=new WeakSet,Tp=function(i){return Yr===v(this,pl)?H(i):Ts(i)},Rp=function(){bf=!0;var i=gl.prototype,r=Set.prototype;for(const s of fC)i[s]=function(...n){return a(v(this,ir)),r[s].apply(this,n)};for(const s of _C)i[s]=function(...n){a(v(this,ir));var o=r[s].apply(this,n);return new gl(o)}};let Hc=gl;function vC(e){const t=Array.isArray(e)?[]:{},i=new Hc,r=new Proxy(t,{set(n,o,l,h){if(i.delete(o),o in n)return Reflect.set(n,o,l,h);let c=H(l);return Object.defineProperty(n,o,{configurable:!0,enumerable:!0,get:()=>a(c)&&gC(a(c))?a(c)():a(c),set:u=>{m(c,u)}}),!0},has:(n,o)=>i.has(o)?!1:o in n,ownKeys(n){return Reflect.ownKeys(n).filter(o=>!i.has(o))},getOwnPropertyDescriptor(n,o){if(!i.has(o))return Reflect.getOwnPropertyDescriptor(n,o)},deleteProperty(n,o){return o in n?(n[o]=void 0,i.add(o),Array.isArray(n)&&n.length--,!0):!1}});function s(n){const o=Object.keys(r),l=Object.keys(n),h=o.filter(c=>!l.includes(c));for(const c of h)delete r[c];for(const c of l)r[c]=pC(()=>n[c])}return s(e),[r,s]}const Pp=Symbol("LazyValue");function pC(e){return e[Pp]=!0,e}function gC(e){return!!e[Pp]}function mC(e,t){switch(e){case"post":hr(t);break;case"pre":qg(t);break}}const uh=(e,t,i)=>{let r=!1,s=Array.isArray(e)?[]:void 0;mC(t,()=>{const n=Array.isArray(e)?e.map(l=>l()):e();if(!r){r=!0,s=n;return}const o=$r(()=>i(n,s));return s=n,o})};function bC(e,t,i){const r=fe(()=>uC()),s=dC(),n=fe(()=>{const u=a(r).defaultQueryOptions(e());return u._optimisticResults=s.current?"isRestoring":"optimistic",u});let o=H(Ze(new t(a(r),a(n))));uh(()=>a(r),"pre",()=>{m(o,new t(a(r),a(n)),!0)});function l(){const u=a(o).getOptimisticResult(a(n));return a(n).notifyOnChangeProps?u:a(o).trackResult(u)}const[h,c]=vC(l());return hr(()=>{const u=s.current?()=>{}:a(o).subscribe(()=>c(l()));return a(o).updateResult(),u}),uh(()=>a(n),"pre",()=>{a(o).setOptions(a(n))}),uh(()=>[a(n),a(o)],"pre",()=>{c(l())}),h}function fl(e,t){return bC(e,J1)}function yC(e,t){ft(t,!0);const i=dr(t,"client",19,()=>new Ep);ho(()=>{i().mount()}),lC(i()),wm(()=>{i().unmount()});var r=Vr(),s=kt(r);hm(s,()=>t.children),I(e,r),_t()}var SC=F('<div class="branch-error svelte-1ogsozk"> </div>'),wC=F('<div class="branch-loading svelte-1ogsozk">Loading...</div>'),CC=F('<div class="branch-empty svelte-1ogsozk">No branches match</div>'),kC=F('<span class="branch-check svelte-1ogsozk">✓</span>'),xC=F('<span class="branch-check branch-check--empty svelte-1ogsozk"></span>'),EC=F('<span class="branch-spinner svelte-1ogsozk">…</span>'),DC=F('<li role="option"><!> <span class="branch-option-name svelte-1ogsozk"> </span> <!></li>'),TC=F('<ul class="branch-list svelte-1ogsozk"></ul>'),RC=F('<div class="branch-dropdown svelte-1ogsozk" role="listbox" tabindex="-1" aria-label="Branches"><div class="branch-filter-wrap svelte-1ogsozk"><input type="text" class="branch-filter svelte-1ogsozk" placeholder="Filter branches..." aria-label="Filter branches"/></div> <!> <!></div>'),PC=F('<div class="branch-switcher svelte-1ogsozk"><button class="branch-trigger svelte-1ogsozk" aria-label="Switch branch" aria-haspopup="listbox"><span class="branch-icon svelte-1ogsozk">⑂</span> <span class="branch-name svelte-1ogsozk"> </span> <svg class="branch-caret svelte-1ogsozk" width="10" height="6" viewBox="0 0 10 6" aria-hidden="true"><path d="M1 1l4 4 4-4" stroke="currentColor" fill="none" stroke-width="1.5" stroke-linecap="round"></path></svg></button> <!></div>');function MC(e,t){ft(t,!0);let i=H(!1),r=H(""),s=H(null),n=H(null),o=H(null),l=H(null);const h=fl(()=>({queryKey:["branches",t.workspacePath],queryFn:()=>id(t.workspacePath),staleTime:3e4,enabled:a(i)}));let c=fe(()=>{const k=h.data??[];if(!a(r).trim())return k;const M=a(r).toLowerCase();return k.filter(B=>B.toLowerCase().includes(M))});function u(){m(i,!0),m(r,""),m(l,null),requestAnimationFrame(()=>{var k;return(k=a(n))==null?void 0:k.focus()})}function d(){m(i,!1),m(r,"")}async function f(k){if(k===t.currentBranch){d();return}m(o,k,!0),m(l,null);try{const M=await Im(t.workspacePath,k);M.success?(d(),t.onSwitch(k)):m(l,M.error??"Failed to switch branch",!0)}catch{m(l,"Failed to switch branch")}finally{m(o,null)}}function _(k){a(i)&&a(s)&&document.contains(k.target)&&!a(s).contains(k.target)&&d()}function p(k){k.key==="Escape"&&a(i)&&(d(),k.stopPropagation())}var b=PC();ar("click",Ga,_);var g=y(b),S=D(y(g),2),x=y(S),C=D(g,2);{var w=k=>{var M=RC(),B=y(M),q=y(B);st(q,O=>m(n,O),()=>a(n));var Y=D(B,2);{var ne=O=>{var U=SC(),T=y(U);ce(()=>oe(T,a(l))),I(O,U)};re(Y,O=>{a(l)&&O(ne)})}var j=D(Y,2);{var N=O=>{var U=wC();I(O,U)},L=O=>{var U=CC();I(O,U)},R=O=>{var U=TC();Xt(U,20,()=>a(c),T=>T,(T,E)=>{var Q=DC();let ee;var ge=y(Q);{var we=ye=>{var me=kC();I(ye,me)},de=ye=>{var me=xC();I(ye,me)};re(ge,ye=>{E===t.currentBranch?ye(we):ye(de,!1)})}var Ce=D(ge,2),Te=y(Ce),De=D(Ce,2);{var ve=ye=>{var me=EC();I(ye,me)};re(De,ye=>{a(o)===E&&ye(ve)})}ce(()=>{ee=tt(Q,1,"branch-option svelte-1ogsozk",null,ee,{"branch-current":E===t.currentBranch,"branch-switching":a(o)===E}),Ue(Q,"aria-selected",E===t.currentBranch),oe(Te,E)}),V("mousedown",Q,()=>f(E)),I(T,Q)}),I(O,U)};re(j,O=>{h.isLoading?O(N):a(c).length===0?O(L,1):O(R,!1)})}V("keydown",M,p),V("keydown",q,p),zi(q,()=>a(r),O=>m(r,O)),I(k,M)};re(C,k=>{a(i)&&k(w)})}st(b,k=>m(s,k),()=>a(s)),ce(()=>{Ue(g,"aria-expanded",a(i)),oe(x,t.currentBranch)}),V("click",g,u),I(e,b),_t()}vt(["click","keydown","mousedown"]);var AC=F('<span class="target-branch svelte-1shtc4l" aria-label="target branch"><span class="target-sep svelte-1shtc4l">›</span> <span class="target-name svelte-1shtc4l"> </span></span>'),OC=F('<div class="bar-middle svelte-1shtc4l" aria-label="pull request"><a class="pr-link svelte-1shtc4l" target="_blank" rel="noopener noreferrer"> <svg class="pr-ext-icon svelte-1shtc4l" width="10" height="10" viewBox="0 0 10 10" aria-hidden="true"><path d="M1 9L9 1M9 1H4M9 1V6" stroke="currentColor" fill="none" stroke-width="1.5" stroke-linecap="round"></path></svg></a></div> <span class="diff-stats svelte-1shtc4l"><span class="diff-add svelte-1shtc4l"> </span> <span class="diff-del svelte-1shtc4l"> </span></span>',1),LC=F('<span class="bar-loading svelte-1shtc4l">…</span>'),IC=F('<button class="action-btn action-btn--secondary svelte-1shtc4l"> </button>'),BC=F("<button> </button>"),NC=F("<!> <!>",1),FC=F('<div><div class="bar-left svelte-1shtc4l"><!> <!></div> <!> <div class="bar-right svelte-1shtc4l"><!></div></div>');function WC(e,t){ft(t,!0);let i=H(Ze(t.branchName));hr(()=>{m(i,t.branchName,!0)}),hr(()=>{!t.branchName&&t.workspacePath&&Lm(t.workspacePath).then(j=>{j&&m(i,j,!0)})});const r=fl(()=>({queryKey:["pr",t.workspacePath,a(i)],queryFn:()=>Om(t.workspacePath,a(i)),staleTime:6e4,refetchOnWindowFocus:!0})),s=fl(()=>{var j;return{queryKey:["ci-status",t.workspacePath,a(i)],queryFn:()=>Am(t.workspacePath,a(i)),staleTime:3e4,refetchOnWindowFocus:!0,enabled:((j=r.data)==null?void 0:j.state)==="OPEN"}});hr(()=>{t.sessionId&&(r.refetch(),s.refetch())});let n=fe(()=>r.data??null),o=fe(()=>s.data??null),l=fe(()=>{var j,N,L,R,O,U;return{commitsAhead:a(n)?1:0,prState:a(n)?a(n).isDraft?"DRAFT":a(n).state:null,ciPassing:((j=a(o))==null?void 0:j.passing)??0,ciFailing:((N=a(o))==null?void 0:N.failing)??0,ciPending:((L=a(o))==null?void 0:L.pending)??0,ciTotal:((R=a(o))==null?void 0:R.total)??0,mergeable:((O=a(n))==null?void 0:O.mergeable)??null,unresolvedCommentCount:((U=a(n))==null?void 0:U.unresolvedCommentCount)??0}}),h=fe(()=>ad(a(l))),c=fe(()=>Cb(a(h),a(l))),u=fe(()=>hv(a(h).color)),d=fe(()=>cv(a(h).color)),f=fe(()=>a(h).type!=="none");function _(j=a(h)){var R,O,U,T;const N={branchName:a(i),baseBranch:((R=a(n))==null?void 0:R.baseRefName)??"",prNumber:((O=a(n))==null?void 0:O.number)??0,unresolvedCommentCount:((U=a(n))==null?void 0:U.unresolvedCommentCount)??0},L=lv(j,N);L!==null?t.sessionId&&ks(L+"\r"):(T=t.onArchive)==null||T.call(t)}function p(j){m(i,j,!0)}var b=FC();let g;var S=y(b),x=y(S);MC(x,{get workspacePath(){return t.workspacePath},get currentBranch(){return a(i)},onSwitch:p});var C=D(x,2);{var w=j=>{var N=AC(),L=D(y(N),2),R=y(L);ce(()=>oe(R,a(n).baseRefName)),I(j,N)};re(C,j=>{var N;(N=a(n))!=null&&N.baseRefName&&j(w)})}var k=D(S,2);{var M=j=>{var N=OC(),L=kt(N),R=y(L),O=y(R),U=D(L,2),T=y(U),E=y(T),Q=D(T,2),ee=y(Q);ce(()=>{Ue(R,"href",a(n).url),Ue(R,"aria-label",`PR #${a(n).number??""}: ${a(n).title??""}`),oe(O,`PR #${a(n).number??""} `),oe(E,`+${a(n).additions??""}`),oe(ee,`-${a(n).deletions??""}`)}),I(j,N)};re(k,j=>{a(n)&&j(M)})}var B=D(k,2),q=y(B);{var Y=j=>{var N=LC();I(j,N)},ne=j=>{var N=NC(),L=kt(N);{var R=T=>{var E=IC(),Q=y(E);ce(()=>{Ue(E,"aria-label",a(c).label),oe(Q,a(c).label)}),V("click",E,()=>_(a(c))),I(T,E)};re(L,T=>{a(c)&&T(R)})}var O=D(L,2);{var U=T=>{var E=BC();let Q,ee;var ge=y(E);ce(()=>{Q=tt(E,1,"action-btn svelte-1shtc4l",null,Q,{"action-btn--dark-text":a(d),"action-btn--disabled":a(h).type==="checks-running"}),E.disabled=a(h).type==="checks-running",Ue(E,"aria-label",a(h).label),ee=lo(E,"",ee,{"--action-color":a(u)}),oe(ge,a(h).label)}),V("click",E,()=>_()),I(T,E)};re(O,T=>{a(f)&&T(U)})}I(j,N)};re(q,j=>{r.isLoading?j(Y):j(ne,!1)})}ce(()=>{var j,N;return g=tt(b,1,"pr-top-bar svelte-1shtc4l",null,g,{"bar-merged":((j=a(n))==null?void 0:j.state)==="MERGED","bar-conflicts":((N=a(n))==null?void 0:N.mergeable)==="CONFLICTING"})}),I(e,b),_t()}vt(["click"]);var HC=F('<button role="tab"><span class="tab-icon svelte-3dfyyn" aria-hidden="true"> </span> <span class="tab-name svelte-3dfyyn"> </span> <span class="tab-close svelte-3dfyyn" role="button">×</span></button>'),zC=F('<div class="new-menu svelte-3dfyyn" role="menu" tabindex="-1"><button class="new-menu-item svelte-3dfyyn" role="menuitem"><span class="new-menu-icon svelte-3dfyyn">🤖</span> New Claude Session</button> <button class="new-menu-item svelte-3dfyyn" role="menuitem"><span class="new-menu-icon svelte-3dfyyn">🖥</span> New Terminal</button></div>'),UC=F('<div class="session-tab-bar svelte-3dfyyn" role="tablist" aria-label="Sessions"><div class="tabs-scroll svelte-3dfyyn"></div> <div class="new-btn-wrap svelte-3dfyyn"><button class="tab-new svelte-3dfyyn" aria-label="New session" aria-haspopup="menu">+</button> <!></div></div>');function KC(e,t){ft(t,!0);let i=H(!1),r=H(null);function s(x){return x.type==="terminal"?"🖥":"🤖"}function n(x,C){x.stopPropagation(),t.onCloseSession(C)}function o(x,C){(x.key==="Enter"||x.key===" ")&&(x.stopPropagation(),t.onCloseSession(C))}function l(){m(i,!a(i))}function h(){m(i,!1),t.onNewSession()}function c(){m(i,!1),t.onNewTerminal()}function u(x){var C;a(i)&&a(r)&&document.contains(x.target)&&!((C=a(r).closest(".new-btn-wrap"))!=null&&C.contains(x.target))&&m(i,!1)}function d(x){var C;x.key==="Escape"&&a(i)&&(m(i,!1),(C=a(r))==null||C.focus())}var f=UC();ar("click",Ga,u);var _=y(f);Xt(_,21,()=>t.sessions,x=>x.id,(x,C)=>{const w=fe(()=>a(C).id===t.activeSessionId);var k=HC();let M;var B=y(k),q=y(B),Y=D(B,2),ne=y(Y),j=D(Y,2);ce(N=>{M=tt(k,1,"tab svelte-3dfyyn",null,M,{"tab--active":a(w)}),Ue(k,"aria-selected",a(w)),Ue(k,"aria-label",a(C).displayName||a(C).id),Ue(k,"tabindex",a(w)?0:-1),oe(q,N),oe(ne,a(C).displayName||a(C).repoName||a(C).id),Ue(j,"aria-label",`Close ${(a(C).displayName||a(C).id)??""}`)},[()=>s(a(C))]),V("click",k,()=>t.onSelectSession(a(C).id)),V("click",j,N=>n(N,a(C).id)),V("keydown",j,N=>o(N,a(C).id)),I(x,k)});var p=D(_,2),b=y(p);st(b,x=>m(r,x),()=>a(r));var g=D(b,2);{var S=x=>{var C=zC(),w=y(C),k=D(w,2);V("keydown",C,d),V("click",w,h),V("click",k,c),I(x,C)};re(g,x=>{a(i)&&x(S)})}ce(()=>Ue(b,"aria-expanded",a(i))),V("click",b,l),V("keydown",b,d),I(e,f),_t()}vt(["click","keydown"]);var qC=F('<div class="non-git-notice svelte-bvvs2r"><span class="non-git-msg svelte-bvvs2r">Not a git repository</span></div>'),jC=F('<div class="pr-row skeleton svelte-bvvs2r"><div class="skeleton-line skeleton-title svelte-bvvs2r"></div> <div class="skeleton-line skeleton-meta svelte-bvvs2r"></div></div>'),YC=F('<div class="scroll-container svelte-bvvs2r"><div class="pr-list svelte-bvvs2r"></div></div>'),VC=F('<div class="section-message svelte-bvvs2r">Could not load pull requests</div>'),GC=F('<div class="section-message info svelte-bvvs2r">Install GitHub CLI for PR tracking — <a href="https://cli.github.com" target="_blank" rel="noopener noreferrer" class="svelte-bvvs2r">cli.github.com</a></div>'),XC=F('<div class="section-message svelte-bvvs2r">No open pull requests</div>'),$C=F('<input class="pr-search svelte-bvvs2r" type="text" placeholder="Filter PRs by title, number, or branch..."/>'),ZC=F('<button class="pr-action-pill pr-conflict-pill svelte-bvvs2r" title="Open worktree and fix merge conflicts">Fix Conflicts</button>'),QC=F('<a class="pr-action-pill pr-merge-pill svelte-bvvs2r" target="_blank" rel="noopener noreferrer" title="Ready to merge on GitHub">Merge</a>'),JC=F("<button> </button>"),ek=F('<div class="pr-row svelte-bvvs2r"><div class="pr-row-left svelte-bvvs2r"><div class="pr-row-title-line svelte-bvvs2r"><span></span> <a class="pr-title-link svelte-bvvs2r" target="_blank" rel="noopener noreferrer"> </a></div> <div class="pr-row-meta svelte-bvvs2r"><span class="pr-num svelte-bvvs2r"> </span> <span class="pr-sep svelte-bvvs2r">·</span> <span class="pr-role svelte-bvvs2r"> </span> <span class="pr-sep svelte-bvvs2r">·</span> <span class="pr-time svelte-bvvs2r"> </span></div></div> <div class="pr-row-actions svelte-bvvs2r"><button class="pr-session-btn svelte-bvvs2r" title="Open session on this branch">+</button> <!> <!> <!></div></div>'),tk=F('<!> <div class="scroll-container svelte-bvvs2r"><div class="pr-list svelte-bvvs2r"></div></div>',1),ik=F('<div class="activity-row skeleton svelte-bvvs2r"><div class="skeleton-line skeleton-activity svelte-bvvs2r"></div></div>'),rk=F('<div class="scroll-container svelte-bvvs2r"><div class="activity-list svelte-bvvs2r"></div></div>'),sk=F('<div class="section-message svelte-bvvs2r">No recent commits (24h)</div>'),nk=F('<span class="commit-branch svelte-bvvs2r"> </span>'),ok=F('<div class="activity-row svelte-bvvs2r"><span class="commit-hash svelte-bvvs2r"> </span> <span class="commit-msg svelte-bvvs2r"> </span> <!> <span class="commit-time svelte-bvvs2r"> </span></div>'),ak=F('<div class="scroll-container svelte-bvvs2r"><div class="activity-list svelte-bvvs2r"></div></div>'),lk=F('<section class="dashboard-section dashboard-section--scroll svelte-bvvs2r"><div class="section-heading svelte-bvvs2r">OPEN PULL REQUESTS</div> <!></section> <section class="dashboard-section dashboard-section--scroll svelte-bvvs2r"><div class="section-heading svelte-bvvs2r">RECENT ACTIVITY</div> <!></section>',1),hk=F('<button class="cta-btn svelte-bvvs2r"> </button>'),ck=F('<div class="repo-dashboard svelte-bvvs2r"><!> <div class="cta-row svelte-bvvs2r"><button class="cta-btn svelte-bvvs2r">+ Start Session</button> <!></div></div>');function dk(e,t){ft(t,!0);let i=dr(t,"creatingWorktree",3,!1);const r=fl(()=>({queryKey:["dashboard",t.workspacePath],queryFn:()=>Mm(t.workspacePath),staleTime:6e4,refetchOnWindowFocus:!0}));let s=fe(()=>r.data),n=fe(()=>r.isLoading),o=fe(()=>r.isError);function l(M){return M.state!=="OPEN"?"dot dot-muted":M.reviewDecision==="CHANGES_REQUESTED"?"dot dot-error":"dot dot-success"}function h(M){const B=M.state==="OPEN"?"OPEN":M.state==="MERGED"?"MERGED":"CLOSED";return ad({commitsAhead:1,prState:B,ciFailing:0,ciPending:0,ciTotal:0,mergeable:M.mergeable??null,unresolvedCommentCount:0})}function c(M){return M.role==="author"?"by you":"review requested"}function u(M){return!M.branches||M.branches.length===0?"":"("+M.branches.join(", ")+")"}let d=H(""),f=fe(()=>a(s)?a(s).prs.length>5:!1),_=fe(()=>()=>{if(!a(s))return[];const M=a(d).toLowerCase().trim();return M?a(s).prs.filter(B=>B.title.toLowerCase().includes(M)||String(B.number).includes(M)||B.headRefName.toLowerCase().includes(M)):a(s).prs});var p=ck(),b=y(p);{var g=M=>{var B=qC();I(M,B)},S=M=>{var B=lk(),q=kt(B),Y=D(y(q),2);{var ne=ee=>{var ge=YC(),we=y(ge);Xt(we,20,()=>[1,2],Uo,(de,Ce)=>{var Te=jC();I(de,Te)}),I(ee,ge)},j=ee=>{var ge=VC();I(ee,ge)},N=ee=>{var ge=GC();I(ee,ge)},L=ee=>{var ge=XC();I(ee,ge)},R=ee=>{var ge=tk(),we=kt(ge);{var de=De=>{var ve=$C();zi(ve,()=>a(d),ye=>m(d,ye)),I(De,ve)};re(we,De=>{a(f)&&De(de)})}var Ce=D(we,2),Te=y(Ce);Xt(Te,21,()=>a(_)(),De=>De.number,(De,ve)=>{const ye=fe(()=>h(a(ve))),me=fe(()=>hv(a(ye).color)),Ie=fe(()=>cv(a(ye).color));var Fe=ek(),ze=y(Fe),Re=y(ze),Qe=y(Re),Z=D(Qe,2),ue=y(Z),A=D(Re,2),$=y(A),se=y($),J=D($,4),Se=y(J),le=D(J,4),Me=y(le),Oe=D(ze,2),z=y(Oe),G=D(z,2);{var pe=Pe=>{var be=ZC();V("click",be,()=>t.onFixConflicts(a(ve))),I(Pe,be)};re(G,Pe=>{a(ve).mergeable==="CONFLICTING"&&Pe(pe)})}var P=D(G,2);{var W=Pe=>{var be=QC();ce(()=>Ue(be,"href",a(ve).url)),I(Pe,be)};re(P,Pe=>{a(ve).mergeable==="MERGEABLE"&&a(ve).state==="OPEN"&&Pe(W)})}var he=D(P,2);{var ke=Pe=>{var be=JC();let Ee,$e;var it=y(be);ce(()=>{Ee=tt(be,1,"pr-action-pill svelte-bvvs2r",null,Ee,{"dark-text":a(Ie)}),Ue(be,"title",a(ye).label),$e=lo(be,"",$e,{"--pill-color":a(me)}),oe(it,a(ye).label)}),V("click",be,()=>t.onPrAction(a(ve))),I(Pe,be)};re(he,Pe=>{a(ye).type!=="none"&&a(ye).label&&Pe(ke)})}ce((Pe,be,Ee)=>{tt(Qe,1,Pe,"svelte-bvvs2r"),Ue(Z,"href",a(ve).url),oe(ue,a(ve).title),oe(se,`#${a(ve).number??""}`),oe(Se,be),oe(Me,Ee)},[()=>O_(l(a(ve))),()=>c(a(ve)),()=>wb(a(ve).updatedAt)]),V("click",z,()=>t.onOpenPrSession(a(ve))),I(De,Fe)}),I(ee,ge)};re(Y,ee=>{a(n)?ee(ne):a(o)?ee(j,1):a(s)&&!a(s).hasGhCli?ee(N,2):a(s)&&a(s).prs.length===0?ee(L,3):a(s)&&ee(R,4)})}var O=D(q,2),U=D(y(O),2);{var T=ee=>{var ge=rk(),we=y(ge);Xt(we,20,()=>[1,2,3],Uo,(de,Ce)=>{var Te=ik();I(de,Te)}),I(ee,ge)},E=ee=>{var ge=sk();I(ee,ge)},Q=ee=>{var ge=ak(),we=y(ge);Xt(we,21,()=>a(s).activity,de=>de.hash,(de,Ce)=>{var Te=ok(),De=y(Te),ve=y(De),ye=D(De,2),me=y(ye),Ie=D(ye,2);{var Fe=Qe=>{var Z=nk(),ue=y(Z);ce(A=>oe(ue,A),[()=>u(a(Ce))]),I(Qe,Z)};re(Ie,Qe=>{a(Ce).branches.length>0&&Qe(Fe)})}var ze=D(Ie,2),Re=y(ze);ce(()=>{oe(ve,a(Ce).shortHash),oe(me,a(Ce).message),oe(Re,a(Ce).timeAgo)}),I(de,Te)}),I(ee,ge)};re(U,ee=>{a(n)?ee(T):a(s)&&a(s).activity.length===0?ee(E,1):a(s)&&ee(Q,2)})}I(M,B)};re(b,M=>{a(s)&&!a(s).isGitRepo?M(g):M(S,!1)})}var x=D(b,2),C=y(x),w=D(C,2);{var k=M=>{var B=hk(),q=y(B);ce(()=>{B.disabled=i(),oe(q,i()?"Creating...":"+ New Worktree")}),V("click",B,function(...Y){var ne;(ne=t.onNewWorktree)==null||ne.apply(this,Y)}),I(M,B)};re(w,M=>{(!a(s)||a(s).isGitRepo)&&M(k)})}V("click",C,function(...M){var B;(B=t.onNewSession)==null||B.apply(this,M)}),I(e,p),_t()}vt(["click"]);var uk=F('<div class="empty-icon svelte-1luen49" aria-hidden="true"> </div>'),fk=F('<p class="empty-description svelte-1luen49"> </p>'),_k=F('<button class="empty-action svelte-1luen49"> </button>'),vk=F('<div class="empty-state svelte-1luen49"><!> <div class="empty-heading svelte-1luen49"> </div> <!> <!></div>');function pk(e,t){var i=vk(),r=y(i);{var s=d=>{var f=uk(),_=y(f);ce(()=>oe(_,t.icon)),I(d,f)};re(r,d=>{t.icon&&d(s)})}var n=D(r,2),o=y(n),l=D(n,2);{var h=d=>{var f=fk(),_=y(f);ce(()=>oe(_,t.description)),I(d,f)};re(l,d=>{t.description&&d(h)})}var c=D(l,2);{var u=d=>{var f=_k(),_=y(f);ce(()=>oe(_,t.actionLabel)),V("click",f,function(...p){var b;(b=t.onAction)==null||b.apply(this,p)}),I(d,f)};re(c,d=>{t.actionLabel&&t.onAction&&d(u)})}ce(()=>oe(o,t.heading)),I(e,i)}vt(["click"]);var gk=F("<button><!></button>"),mk=F("<button><!></button>"),bk=F('<div class="toolbar svelte-k7we1m" role="toolbar"><div class="toolbar-grid svelte-k7we1m"><!></div></div>');function yk(e,t){ft(t,!0),dr(t,"useTmux",3,!1);let i=dr(t,"inCopyMode",3,!1);const r=[{html:"Tab",key:" ",label:"Tab"},{html:"⇧Tab",key:"\x1B[Z",label:"Shift+Tab"},{html:"↑",key:"\x1B[A",label:"Up arrow",extraClass:"tb-arrow"},{html:"Esc",key:"\x1B",label:"Escape"},{html:"📷",id:"upload-image-btn",label:"Upload image"},{html:"^V",id:"paste-btn",label:"Paste from clipboard"},{html:"^C",key:"",label:"Ctrl+C"},{html:"←",key:"\x1B[D",label:"Left arrow",extraClass:"tb-arrow"},{html:"↓",key:"\x1B[B",label:"Down arrow",extraClass:"tb-arrow"},{html:"→",key:"\x1B[C",label:"Right arrow",extraClass:"tb-arrow"},{html:"⇧⏎",key:"\x1B[13;2u",label:"Shift+Enter (newline)",extraClass:"tb-newline"},{html:"⏎",key:"\r",label:"Enter",extraClass:"tb-enter"}],s=[{html:"Sel",key:" ",label:"Start selection"},{html:"w",key:"w",label:"Word forward"},{html:"b",key:"b",label:"Word backward"},{html:"←",key:"h",label:"Left",extraClass:"tb-arrow"},{html:"↓",key:"j",label:"Down",extraClass:"tb-arrow"},{html:"↑",key:"k",label:"Up",extraClass:"tb-arrow"},{html:"→",key:"l",label:"Right",extraClass:"tb-arrow"},{html:"$",key:"$",label:"End of line"},{html:"0",key:"0",label:"Start of line"},{html:"PgUp",key:"\x1B[5~",label:"Page up"},{html:"Copy",key:"\r",label:"Copy and exit",extraClass:"tb-enter",exitsCopyMode:!0},{html:"Exit",key:"q",label:"Cancel",exitsCopyMode:!0}];function n(d){var f;if(d.id==="upload-image-btn"){t.onUploadImage(),Kt&&t.onRefocusMobileInput();return}if(d.id==="paste-btn"){(f=navigator.clipboard)!=null&&f.readText?navigator.clipboard.readText().then(_=>{_&&t.onSendKey(_)}).catch(()=>{t.onUploadImage()}):t.onUploadImage(),Kt&&t.onRefocusMobileInput();return}d.key&&((d.key==="\r"||d.key==="\x1B[13;2u")&&t.onFlushComposedText(),t.onSendKey(d.key),(d.key==="\r"||d.key==="\x1B[13;2u")&&t.onClearInput(),Kt&&t.onRefocusMobileInput())}function o(d){var f;t.onSendKey(d.key),d.exitsCopyMode&&((f=t.onExitCopyMode)==null||f.call(t)),Kt&&t.onRefocusMobileInput()}function l(d){d.preventDefault();const f=d.target.closest("button");if(!f)return;if(i()){const p=s.find(b=>f.dataset.key===b.key);p&&o(p);return}const _=r.find(p=>p.id===f.id||p.key&&f.dataset.key===p.key);_&&n(_)}var h=Vr(),c=kt(h);{var u=d=>{var f=bk(),_=y(f),p=y(_);{var b=S=>{var x=Vr(),C=kt(x);Xt(C,17,()=>s,w=>w.label,(w,k)=>{var M=gk(),B=y(M);zd(B,()=>a(k).html),ce(()=>{tt(M,1,`tb-btn ${a(k).extraClass??""??""}`,"svelte-k7we1m"),Ue(M,"data-key",a(k).key),Ue(M,"aria-label",a(k).label)}),I(w,M)}),I(S,x)},g=S=>{var x=Vr(),C=kt(x);Xt(C,17,()=>r,w=>w.label,(w,k)=>{var M=mk(),B=y(M);zd(B,()=>a(k).html),ce(()=>{tt(M,1,`tb-btn ${a(k).extraClass??""??""}`,"svelte-k7we1m"),Ue(M,"id",a(k).id),Ue(M,"data-key",a(k).key),Ue(M,"aria-label",a(k).label)}),I(w,M)}),I(S,x)};re(p,S=>{i()?S(b):S(g,!1)})}V("mousedown",f,l),I(d,f)};re(c,d=>{Kt&&d(u)})}I(e,h),_t()}vt(["mousedown"]);var Sk=F('<div><button class="icon-btn svelte-wp0i5g" aria-label="Open sessions menu">☰</button> <span class="mobile-title svelte-wp0i5g"> </span></div>');function wk(e,t){let i=dr(t,"hidden",3,!1);var r=Sk();let s;var n=y(r),o=D(n,2),l=y(o);ce(()=>{s=tt(r,1,"mobile-header svelte-wp0i5g",null,s,{hidden:i()}),oe(l,t.title)}),V("click",n,function(...h){var c;(c=t.onMenuClick)==null||c.apply(this,h)}),I(e,r)}vt(["click"]);var Ck=F('<div class="update-toast-actions svelte-1trivgv"><button class="update-toast-btn svelte-1trivgv"> </button> <button class="update-toast-dismiss svelte-1trivgv" aria-label="Dismiss">×</button></div>'),kk=F('<div class="update-toast svelte-1trivgv"><div class="update-toast-content svelte-1trivgv"><span class="update-toast-text svelte-1trivgv"> </span> <!></div></div>');function xk(e,t){ft(t,!0);let i=H(!1),r=H(""),s=H("Update Now"),n=H(!1),o=H(!0);ho(async()=>{try{const f=await F_();f.updateAvailable&&(m(r,`Update available: v${f.current} → v${f.latest}`),m(s,"Update Now"),m(n,!1),m(o,!0),m(i,!0))}catch{}});async function l(){m(n,!0),m(s,"Updating…");try{(await W_()).restarting?(m(r,"Updated! Restarting server…"),m(o,!1),setTimeout(()=>{location.reload()},5e3)):(m(r,"Updated! Please restart the server manually."),m(o,!1))}catch{m(r,"Update failed. Please try again."),m(n,!1),m(s,"Retry"),m(o,!0)}}function h(){m(i,!1)}var c=Vr(),u=kt(c);{var d=f=>{var _=kk(),p=y(_),b=y(p),g=y(b),S=D(b,2);{var x=C=>{var w=Ck(),k=y(w),M=y(k),B=D(k,2);ce(()=>{k.disabled=a(n),oe(M,a(s))}),V("click",k,l),V("click",B,h),I(C,w)};re(S,C=>{a(o)&&C(x)})}ce(()=>oe(g,a(r))),I(f,_)};re(u,f=>{a(i)&&f(d)})}I(e,c),_t()}vt(["click"]);var Ek=F('<button class="image-toast-insert svelte-1y8sviv">Insert</button>'),Dk=F('<div class="image-toast svelte-1y8sviv"><div class="image-toast-content svelte-1y8sviv"><span class="image-toast-text svelte-1y8sviv"> </span> <div class="image-toast-actions svelte-1y8sviv"><!> <button class="image-toast-dismiss svelte-1y8sviv" aria-label="Dismiss">×</button></div></div></div>');function Tk(e,t){ft(t,!0);let i=H(!1),r=H(""),s=H(!1),n=H(null),o=null;function l(g,S,x){o&&(clearTimeout(o),o=null),m(r,g,!0),m(s,S,!0),m(n,x??null,!0),m(i,!0)}function h(){m(i,!1),m(n,null),o&&(clearTimeout(o),o=null)}function c(g){o&&clearTimeout(o),o=setTimeout(()=>{a(n)||h()},g)}function u(){a(n)&&ks(a(n)),h()}function d(){h()}var f={show:l,hide:h,autoDismiss:c},_=Vr(),p=kt(_);{var b=g=>{var S=Dk(),x=y(S),C=y(x),w=y(C),k=D(C,2),M=y(k);{var B=Y=>{var ne=Ek();V("click",ne,u),I(Y,ne)};re(M,Y=>{a(s)&&Y(B)})}var q=D(M,2);ce(()=>oe(w,a(r))),V("click",q,d),I(g,S)};re(p,g=>{a(i)&&g(b)})}return I(e,_),_t(f)}vt(["click"]);var Rk=F('<span class="dialog-title-repo svelte-thtd9b"> </span>'),Pk=F('<li class="branch-create-new svelte-thtd9b" role="option" aria-selected="false"> </li>'),Mk=F('<li role="option" aria-selected="false" class="svelte-thtd9b"> </li>'),Ak=F('<ul class="branch-dropdown svelte-thtd9b"><!> <!></ul>'),Ok=F('<div class="dialog-field svelte-thtd9b"><div class="dialog-label-row svelte-thtd9b"><label class="dialog-label svelte-thtd9b" for="ns-branch">Branch name</label> <button type="button" class="branch-refresh svelte-thtd9b" aria-label="Fetch latest remote branches" title="Fetch latest remote branches"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M20 12a8 8 0 0 1-13.66 5.66M4 12a8 8 0 0 1 13.66-5.66M17 3.5v4h-4M7 20.5v-4h4" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8"></path></svg></button></div> <div class="branch-input-wrap svelte-thtd9b"><input id="ns-branch" type="text" class="dialog-input svelte-thtd9b" placeholder="e.g. feat/my-feature" autocomplete="off"/> <!></div></div>'),Lk=F('<div class="dialog-field dialog-field--inline svelte-thtd9b"><input id="ns-continue" type="checkbox" class="dialog-checkbox svelte-thtd9b"/> <label for="ns-continue" class="dialog-label-inline svelte-thtd9b">Continue existing session</label></div>'),Ik=F('<dialog class="dialog svelte-thtd9b"><div class="dialog-content svelte-thtd9b"><h2 class="dialog-title svelte-thtd9b"> <!></h2> <div class="dialog-tabs svelte-thtd9b"><button>Repo Session</button> <button>Worktree</button></div> <div class="dialog-body svelte-thtd9b"><div class="dialog-field svelte-thtd9b"><label class="dialog-label svelte-thtd9b" for="ns-agent">Coding agent</label> <select id="ns-agent" class="dialog-select svelte-thtd9b"><option>Claude</option><option>Codex</option></select></div> <!> <!> <div class="dialog-field dialog-field--inline svelte-thtd9b"><input id="ns-yolo" type="checkbox" class="dialog-checkbox svelte-thtd9b"/> <label for="ns-yolo" class="dialog-label-inline svelte-thtd9b">Yolo mode (skip permission checks)</label></div> <div class="dialog-field dialog-field--inline svelte-thtd9b"><input id="ns-tmux" type="checkbox" class="dialog-checkbox svelte-thtd9b"/> <label for="ns-tmux" class="dialog-label-inline svelte-thtd9b">Launch in tmux</label></div> <div class="dialog-field svelte-thtd9b"><label class="dialog-label svelte-thtd9b" for="ns-args">Extra args (optional)</label> <input id="ns-args" type="text" class="dialog-input svelte-thtd9b" placeholder="e.g. --verbose" autocomplete="off"/></div></div> <div class="dialog-footer svelte-thtd9b"><button class="btn btn-ghost svelte-thtd9b">Cancel</button> <button class="btn btn-primary svelte-thtd9b"> </button></div></div></dialog>');function Bk(e,t){ft(t,!0);let i=dr(t,"preselectedRepo",3,null);const r=od();let s,n=H("repos"),o=H(""),l=H(""),h=H(""),c=H(""),u=H("claude"),d=H(!1),f=H(!1),_=H(!1),p=H(Ze([])),b=H(!1),g=H(!1),S=H(!1),x=H(!1),C=0,w=fe(()=>{if(!a(h).trim())return[];const P=a(h).toLowerCase();return a(p).filter(W=>W.toLowerCase().includes(P)).slice(0,10)}),k=fe(()=>a(p).some(P=>P===a(h)));async function M(P,W={}){const he=++C;if(P){W.preserveExisting||m(p,[],!0),W.refresh?m(S,!0):m(g,!0);try{const ke=await id(P,W.refresh?{refresh:!0}:{});if(he!==C||P!==a(o))return;m(p,ke,!0),a(h).trim()&&m(b,!0)}catch{if(he!==C||P!==a(o))return;W.preserveExisting||m(p,[],!0)}finally{he===C&&(m(g,!1),m(S,!1))}}}async function B(){!a(o)||a(S)||await M(a(o),{refresh:!0,preserveExisting:!0})}function q(){C+=1,m(h,""),m(p,[],!0),m(b,!1),m(g,!1),m(S,!1)}function Y(){m(b,a(h).trim().length>0)}function ne(P){m(h,P,!0),m(b,!1)}function j(){m(o,""),m(l,""),m(c,""),m(d,!1),m(f,!1),m(_,!1),q()}async function N(P,W){j(),m(n,"repos"),await av(),m(u,r.defaultAgent,!0),W!=null&&W.agent&&m(u,W.agent,!0),m(d,r.defaultYolo,!0),m(f,r.defaultContinue,!0),m(_,r.launchInTmux,!0),(W==null?void 0:W.yolo)!==void 0&&m(d,W.yolo,!0),(W==null?void 0:W.useTmux)!==void 0&&m(_,W.useTmux,!0);const he=P??i();he&&(m(o,he.path,!0),m(l,he.name,!0),W!=null&&W.branchName&&(m(n,"worktrees"),await M(he.path))),W!=null&&W.branchName&&m(h,W.branchName,!0),W!=null&&W.claudeArgs&&m(c,W.claudeArgs,!0),s.showModal()}function L(){s.close()}async function R(){var Pe,be;const P=a(o);if(!P||a(x))return;m(x,!0);const W=a(c).trim().split(/\s+/).filter(Boolean),he=Math.max(80,Math.floor((window.innerWidth-60)/8)),ke=Math.max(24,Math.floor((window.innerHeight-120)/17));try{let Ee;a(n)==="repos"?Ee=await B_({repoPath:P,repoName:a(l)||P.split("/").filter(Boolean).pop(),continue:a(f),yolo:a(d),claudeArgs:W.length>0?W:void 0,agent:a(u),useTmux:a(_),cols:he,rows:ke,allowMultiple:!0}):Ee=await ln({repoPath:P,repoName:a(l)||P.split("/").filter(Boolean).pop(),branchName:a(h).trim()||void 0,yolo:a(d),claudeArgs:W.length>0?W:void 0,agent:a(u),useTmux:a(_),cols:he,rows:ke}),s.close(),await Bt(),Ee!=null&&Ee.id&&((Pe=t.onSessionCreated)==null||Pe.call(t,Ee.id))}catch(Ee){if(Ee instanceof Error&&"sessionId"in Ee){const $e=Ee;s.close(),await Bt(),$e.sessionId&&((be=t.onSessionCreated)==null||be.call(t,$e.sessionId))}}finally{m(x,!1)}}function O(P){P.target===s&&s.close()}function U(P){a(b)&&P.key==="Escape"&&(m(b,!1),P.stopPropagation())}var T={open:N,close:L},E=Ik(),Q=y(E),ee=y(Q),ge=y(ee),we=D(ge);{var de=P=>{var W=Rk(),he=y(W);ce(()=>oe(he,`— ${a(l)??""}`)),I(P,W)};re(we,P=>{a(l)&&P(de)})}var Ce=D(ee,2),Te=y(Ce);let De;var ve=D(Te,2);let ye;var me=D(Ce,2),Ie=y(me),Fe=D(y(Ie),2),ze=y(Fe);ze.value=ze.__value="claude";var Re=D(ze);Re.value=Re.__value="codex";var Qe=D(Ie,2);{var Z=P=>{var W=Ok(),he=y(W),ke=D(y(he),2),Pe=y(ke);let be;var Ee=D(he,2),$e=y(Ee),it=D($e,2);{var Qt=Ne=>{var Ye=Ak(),nt=y(Ye);{var rt=Jt=>{var Si=Pk(),Or=y(Si);ce(fr=>oe(Or,`Create new: ${fr??""}`),[()=>a(h).trim()]),V("mousedown",Si,()=>ne(a(h).trim())),I(Jt,Si)},si=fe(()=>!a(k)&&a(h).trim());re(nt,Jt=>{a(si)&&Jt(rt)})}var yi=D(nt,2);Xt(yi,16,()=>a(w),Jt=>Jt,(Jt,Si)=>{var Or=Mk(),fr=y(Or);ce(()=>oe(fr,Si)),V("mousedown",Or,()=>ne(Si)),I(Jt,Or)}),I(Ne,Ye)},Be=fe(()=>a(b)&&(a(w).length>0||a(h).trim()&&!a(k)));re(it,Ne=>{a(Be)&&Ne(Qt)})}ce(()=>{ke.disabled=!a(o)||a(g)||a(S),be=tt(Pe,0,"svelte-thtd9b",null,be,{spinning:a(g)||a(S)})}),V("click",ke,B),V("input",$e,Y),ar("focus",$e,()=>{a(h).trim()&&m(b,!0)}),zi($e,()=>a(h),Ne=>m(h,Ne)),I(P,W)};re(Qe,P=>{a(n)==="worktrees"&&P(Z)})}var ue=D(Qe,2);{var A=P=>{var W=Lk(),he=y(W);rr(he,()=>a(f),ke=>m(f,ke)),I(P,W)};re(ue,P=>{a(n)==="repos"&&P(A)})}var $=D(ue,2),se=y($),J=D($,2),Se=y(J),le=D(J,2),Me=D(y(le),2),Oe=D(me,2),z=y(Oe),G=D(z,2),pe=y(G);return st(E,P=>s=P,()=>s),ce(()=>{oe(ge,`${a(n)==="repos"?"New Session":"New Worktree"} `),De=tt(Te,1,"dialog-tab svelte-thtd9b",null,De,{active:a(n)==="repos"}),ye=tt(ve,1,"dialog-tab svelte-thtd9b",null,ye,{active:a(n)==="worktrees"}),z.disabled=a(x),G.disabled=!a(o)||a(x),oe(pe,a(x)?"Creating...":a(n)==="repos"?"Start Session":"Create Worktree")}),V("click",E,O),V("keydown",E,U),V("click",Te,()=>{m(n,"repos")}),V("click",ve,()=>{m(n,"worktrees"),a(o)&&a(p).length===0&&M(a(o))}),Xa(Fe,()=>a(u),P=>m(u,P)),rr(se,()=>a(d),P=>m(d,P)),rr(Se,()=>a(_),P=>m(_,P)),zi(Me,()=>a(c),P=>m(c,P)),V("click",z,()=>s.close()),V("click",G,R),I(e,E),_t(T)}vt(["click","keydown","input","mousedown"]);var Nk=F('<p class="error-msg svelte-fdtoa4"> </p>'),Fk=F('<span class="version-status svelte-fdtoa4">Up to date</span>'),Wk=F('<div class="version-update-row svelte-fdtoa4"><span class="version-update-text svelte-fdtoa4"> </span> <button class="btn btn-primary btn-sm svelte-fdtoa4"> </button></div>'),Hk=F('<button class="btn btn-ghost btn-sm svelte-fdtoa4"> </button>'),zk=F('<p class="version-status-msg svelte-fdtoa4"> </p>'),Uk=F('<dialog class="dialog svelte-fdtoa4"><div class="dialog-content svelte-fdtoa4"><div class="dialog-header svelte-fdtoa4"><h2 class="dialog-title svelte-fdtoa4">Settings</h2> <button class="close-btn svelte-fdtoa4" aria-label="Close settings">✕</button></div> <div class="dialog-body svelte-fdtoa4"><!> <section class="settings-section svelte-fdtoa4"><h3 class="section-title svelte-fdtoa4">Default Coding Agent</h3> <p class="section-desc svelte-fdtoa4">CLI used when creating new sessions.</p> <select class="agent-select svelte-fdtoa4"><option>Claude</option><option>Codex</option></select></section> <section class="settings-section svelte-fdtoa4"><h3 class="section-title svelte-fdtoa4">Session Defaults</h3> <p class="section-desc svelte-fdtoa4">Default options for new sessions. Override per-session via Customize.</p> <div class="devtools-row svelte-fdtoa4"><input id="default-continue" type="checkbox" class="dialog-checkbox svelte-fdtoa4"/> <label for="default-continue" class="devtools-label svelte-fdtoa4">Continue existing session</label></div> <div class="devtools-row svelte-fdtoa4"><input id="default-yolo" type="checkbox" class="dialog-checkbox svelte-fdtoa4"/> <label for="default-yolo" class="devtools-label svelte-fdtoa4">YOLO mode (skip permission checks)</label></div> <div class="devtools-row svelte-fdtoa4"><input id="default-tmux" type="checkbox" class="dialog-checkbox svelte-fdtoa4"/> <label for="default-tmux" class="devtools-label svelte-fdtoa4">Launch in tmux</label></div> <div class="devtools-row svelte-fdtoa4"><input id="default-notifications" type="checkbox" class="dialog-checkbox svelte-fdtoa4"/> <label for="default-notifications" class="devtools-label svelte-fdtoa4">Enable notifications for new sessions</label></div></section> <section class="settings-section svelte-fdtoa4"><h3 class="section-title svelte-fdtoa4">Developer Tools</h3> <div class="devtools-row svelte-fdtoa4"><input id="devtools-toggle" type="checkbox" class="dialog-checkbox svelte-fdtoa4"/> <label for="devtools-toggle" class="devtools-label svelte-fdtoa4">Enable mobile debug panel</label></div></section> <section class="settings-section svelte-fdtoa4"><h3 class="section-title svelte-fdtoa4">Version</h3> <div class="version-row svelte-fdtoa4"><span class="version-current svelte-fdtoa4"><!></span> <!></div> <!> <!></section></div> <div class="dialog-footer svelte-fdtoa4"><button class="btn btn-ghost svelte-fdtoa4">Close</button></div></div></dialog>');function Kk(e,t){ft(t,!0);let i,r=H(!1);const s=od();let n=H(""),o=H(""),l=H(null),h=H(!1),c=H(!1),u=H(!1),d=H(!1),f=H("");async function _(){m(n,""),m(f,""),m(c,!1),m(d,!1),m(r,localStorage.getItem("devtools-enabled")==="true"),await av(),i.showModal(),w()}function p(){i.close()}async function b(){const P=s.defaultAgent;m(n,"");try{await Wm(s.defaultAgent)}catch{s.defaultAgent=P,m(n,"Failed to update default agent.")}}async function g(){const P=s.defaultContinue;m(n,"");try{await zm(s.defaultContinue)}catch{s.defaultContinue=P,m(n,"Failed to update continue default.")}}async function S(){const P=s.defaultYolo;m(n,"");try{await Km(s.defaultYolo)}catch{s.defaultYolo=P,m(n,"Failed to update yolo default.")}}async function x(){const P=s.launchInTmux;m(n,"");try{await jm(s.launchInTmux)}catch(W){s.launchInTmux=P,m(n,W instanceof Error?W.message:"Failed to update tmux setting.",!0)}}async function C(){const P=s.defaultNotifications;m(n,"");try{await Vm(s.defaultNotifications)}catch{s.defaultNotifications=P,m(n,"Failed to update notifications default.")}}async function w(){m(u,!0),m(f,"");try{const P=await F_();m(o,P.current,!0),m(l,P.latest,!0),m(h,P.updateAvailable,!0),m(c,!0)}catch{m(f,"Failed to check for updates.")}finally{m(u,!1)}}async function k(){m(d,!0),m(f,"");try{(await W_()).restarting?(m(f,"Updated! Restarting server…"),setTimeout(()=>{location.reload()},5e3)):m(f,"Updated! Please restart the server manually."),m(h,!1)}catch{m(f,"Update failed. Please try again."),m(d,!1)}}function M(){localStorage.setItem("devtools-enabled",a(r)?"true":"false"),window.dispatchEvent(new Event("devtools-changed"))}async function B(){i.close(),await Bt()}function q(P){P.target===i&&B()}var Y={open:_,close:p},ne=Uk(),j=y(ne),N=y(j),L=D(y(N),2),R=D(N,2),O=y(R);{var U=P=>{var W=Nk(),he=y(W);ce(()=>oe(he,a(n))),I(P,W)};re(O,P=>{a(n)&&P(U)})}var T=D(O,2),E=D(y(T),4),Q=y(E);Q.value=Q.__value="claude";var ee=D(Q);ee.value=ee.__value="codex";var ge=D(T,2),we=D(y(ge),4),de=y(we),Ce=D(we,2),Te=y(Ce),De=D(Ce,2),ve=y(De),ye=D(De,2),me=y(ye),Ie=D(ge,2),Fe=D(y(Ie),2),ze=y(Fe),Re=D(Ie,2),Qe=D(y(Re),2),Z=y(Qe),ue=y(Z);{var A=P=>{var W=an();ce(()=>oe(W,`v${a(o)??""}`)),I(P,W)},$=P=>{var W=an("...");I(P,W)};re(ue,P=>{a(o)?P(A):P($,!1)})}var se=D(Z,2);{var J=P=>{var W=Fk();I(P,W)};re(se,P=>{a(c)&&!a(h)&&!a(d)&&P(J)})}var Se=D(Qe,2);{var le=P=>{var W=Wk(),he=y(W),ke=y(he),Pe=D(he,2),be=y(Pe);ce(()=>{oe(ke,`v${a(o)??""} → v${a(l)??""}`),Pe.disabled=a(d),oe(be,a(d)?"Updating…":"Update Now")}),V("click",Pe,k),I(P,W)},Me=P=>{var W=Hk(),he=y(W);ce(()=>{W.disabled=a(u),oe(he,a(u)?"Checking…":"Check for updates")}),V("click",W,w),I(P,W)};re(Se,P=>{a(h)?P(le):a(c)||P(Me,1)})}var Oe=D(Se,2);{var z=P=>{var W=zk(),he=y(W);ce(()=>oe(he,a(f))),I(P,W)};re(Oe,P=>{a(f)&&P(z)})}var G=D(R,2),pe=y(G);return st(ne,P=>i=P,()=>i),V("click",ne,q),V("click",L,B),V("change",E,b),Xa(E,()=>s.defaultAgent,P=>s.defaultAgent=P),V("change",de,g),rr(de,()=>s.defaultContinue,P=>s.defaultContinue=P),V("change",Te,S),rr(Te,()=>s.defaultYolo,P=>s.defaultYolo=P),V("change",ve,x),rr(ve,()=>s.launchInTmux,P=>s.launchInTmux=P),V("change",me,C),rr(me,()=>s.defaultNotifications,P=>s.defaultNotifications=P),V("change",ze,M),rr(ze,()=>a(r),P=>m(r,P)),V("click",pe,B),I(e,ne),_t(Y)}vt(["click","change"]);var qk=F('<p class="confirm-msg svelte-15sco2n">Are you sure you want to delete the worktree <strong class="wt-name svelte-15sco2n"> </strong>?</p> <p class="wt-path svelte-15sco2n"> </p> <p class="warning-msg svelte-15sco2n">This action cannot be undone.</p>',1),jk=F('<p class="error-msg svelte-15sco2n"> </p>'),Yk=F('<dialog class="dialog svelte-15sco2n"><div class="dialog-content svelte-15sco2n"><h2 class="dialog-title svelte-15sco2n">Delete Worktree</h2> <div class="dialog-body svelte-15sco2n"><!> <!></div> <div class="dialog-footer svelte-15sco2n"><button class="btn btn-ghost svelte-15sco2n">Cancel</button> <button class="btn btn-danger svelte-15sco2n"> </button></div></div></dialog>');function Vk(e,t){ft(t,!0);let i,r=H(null),s=H(""),n=H(!1);function o(B){m(r,B,!0),m(s,""),m(n,!1),i.showModal()}function l(){i.close()}async function h(){if(!(!a(r)||a(n))){m(n,!0),m(s,""),Cn(a(r).path);try{await N_(a(r).path,a(r).repoPath),i.close(),await Bt()}catch(B){m(s,B instanceof Error?B.message:"Failed to delete worktree.",!0),m(n,!1)}finally{a(r)&&kn(a(r).path)}}}function c(){i.close()}function u(B){B.target===i&&i.close()}var d={open:o,close:l},f=Yk(),_=y(f),p=D(y(_),2),b=y(p);{var g=B=>{var q=qk(),Y=kt(q),ne=D(y(Y)),j=y(ne),N=D(Y,2),L=y(N);ce(()=>{oe(j,a(r).displayName||a(r).name),oe(L,a(r).path)}),I(B,q)};re(b,B=>{a(r)&&B(g)})}var S=D(b,2);{var x=B=>{var q=jk(),Y=y(q);ce(()=>oe(Y,a(s))),I(B,q)};re(S,B=>{a(s)&&B(x)})}var C=D(p,2),w=y(C),k=D(w,2),M=y(k);return st(f,B=>i=B,()=>i),ce(()=>{w.disabled=a(n),k.disabled=a(n),oe(M,a(n)?"Deleting...":"Delete")}),V("click",f,u),V("click",w,c),V("click",k,h),I(e,f),_t(d)}vt(["click"]);var Gk=F('<div class="loading-placeholder svelte-15gfcbp">Loading...</div>'),Xk=F('<div class="empty-placeholder svelte-15gfcbp"><!></div>'),$k=F('<span class="spinner svelte-15gfcbp">...</span>'),Zk=F("<span>▶</span>"),Qk=F('<button class="expand-btn svelte-15gfcbp"><!></button>'),Jk=F('<span class="expand-spacer svelte-15gfcbp"></span>'),ex=F('<span class="git-badge svelte-15gfcbp" aria-label="Git repository">git</span>'),tx=F('<div role="treeitem"><!> <input type="checkbox" class="node-checkbox svelte-15gfcbp"/> <span class="node-name svelte-15gfcbp"> </span> <!></div>'),ix=F('<div class="truncated-notice svelte-15gfcbp"> </div>'),rx=F("<!> <!>",1),sx=F('<div class="file-browser svelte-15gfcbp"><div class="filter-row svelte-15gfcbp"><input type="text" class="filter-input svelte-15gfcbp" placeholder="Filter..." aria-label="Filter directories" autocomplete="off" spellcheck="false"/></div> <div class="tree-container svelte-15gfcbp" role="tree" aria-label="File browser" tabindex="0"><!></div></div>');function nx(e,t){ft(t,!0);let i=dr(t,"selectedPaths",31,()=>Ze([])),r=H(Ze([])),s=H(""),n=H(-1),o=H(!0),l=H(null),h=H(void 0);ho(()=>{c()});async function c(){m(o,!0),m(l,null);try{const T=await Yd();m(r,T.entries.map(E=>u(E,0)),!0),T.truncated&&m(l,{shown:T.entries.length,total:T.total},!0)}catch{m(r,[],!0)}finally{m(o,!1)}}function u(T,E){return{name:T.name,path:T.path,isGitRepo:T.isGitRepo,hasChildren:T.hasChildren,children:null,expanded:!1,selected:!1,loading:!1,depth:E,truncatedInfo:null}}async function d(T){if(T.expanded){T.expanded=!1;return}if(T.children===null){T.loading=!0;try{const E=await Yd(T.path);T.children=E.entries.map(Q=>u(Q,T.depth+1)),T.truncatedInfo=E.truncated?{shown:E.entries.length,total:E.total}:null}catch{T.children=[]}finally{T.loading=!1}}T.expanded=!0}function f(T){T.selected=!T.selected,_()}function _(){i(p(a(r)))}function p(T){const E=[];for(const Q of T)Q.selected&&E.push(Q.path),Q.children&&E.push(...p(Q.children));return E}function b(T,E){return T.toLowerCase().includes(E.toLowerCase())}function g(T,E){var Q;return!!(!E||T.expanded||b(T.name,E)||(Q=T.children)!=null&&Q.some(ee=>g(ee,E)))}function S(T,E){const Q=[];for(const ee of T)g(ee,E)&&(Q.push(ee),ee.expanded&&ee.children&&Q.push(...S(ee.children,E)));return Q}let x=fe(()=>S(a(r),a(s)));function C(T){var Q;if(T.key==="ArrowDown"){T.preventDefault(),m(n,Math.min(a(n)+1,a(x).length-1),!0);return}if(T.key==="ArrowUp"){T.preventDefault(),m(n,Math.max(a(n)-1,0),!0);return}const E=a(n)>=0?a(x)[a(n)]:void 0;if(E){if(T.key==="ArrowRight"){if(T.preventDefault(),E.hasChildren&&!E.expanded)d(E);else if(E.expanded&&((Q=E.children)!=null&&Q.length)){const ee=a(x).indexOf(E.children[0]);ee>=0&&m(n,ee,!0)}return}if(T.key==="ArrowLeft"){if(T.preventDefault(),E.expanded)E.expanded=!1;else{const ee=E.depth-1;for(let ge=a(n)-1;ge>=0;ge--)if(a(x)[ge].depth===ee){m(n,ge,!0);break}}return}if(T.key===" "){T.preventDefault(),f(E);return}}}function w(T,E){const Q=E.target;Q.closest(".expand-btn")||Q.closest(".node-checkbox")||(T.hasChildren&&!T.expanded?d(T):f(T))}function k(){m(s,""),m(n,-1),M(a(r)),i([]),B(a(r))}function M(T){for(const E of T)E.selected=!1,E.children&&M(E.children)}function B(T){for(const E of T)E.expanded=!1,E.children&&B(E.children)}var q={reset:k},Y=sx(),ne=y(Y),j=y(ne),N=D(ne,2),L=y(N);{var R=T=>{var E=Gk();I(T,E)},O=T=>{var E=Xk(),Q=y(E);{var ee=we=>{var de=an();ce(()=>oe(de,`No matches for "${a(s)??""}"`)),I(we,de)},ge=we=>{var de=an("No directories found");I(we,de)};re(Q,we=>{a(s)?we(ee):we(ge,!1)})}I(T,E)},U=T=>{var E=rx(),Q=kt(E);Xt(Q,19,()=>a(x),we=>we.path,(we,de,Ce)=>{var Te=tx();let De;var ve=y(Te);{var ye=Z=>{var ue=Qk(),A=y(ue);{var $=J=>{var Se=$k();I(J,Se)},se=J=>{var Se=Zk();let le;ce(()=>le=tt(Se,1,"arrow svelte-15gfcbp",null,le,{expanded:a(de).expanded})),I(J,Se)};re(A,J=>{a(de).loading?J($):J(se,!1)})}ce(()=>Ue(ue,"aria-label",a(de).expanded?"Collapse":"Expand")),V("click",ue,()=>d(a(de))),I(Z,ue)},me=Z=>{var ue=Jk();I(Z,ue)};re(ve,Z=>{a(de).hasChildren?Z(ye):Z(me,!1)})}var Ie=D(ve,2),Fe=D(Ie,2),ze=y(Fe),Re=D(Fe,2);{var Qe=Z=>{var ue=ex();I(Z,ue)};re(Re,Z=>{a(de).isGitRepo&&Z(Qe)})}ce(()=>{De=tt(Te,1,"tree-row svelte-15gfcbp",null,De,{focused:a(Ce)===a(n),selected:a(de).selected}),lo(Te,`padding-left: ${12+a(de).depth*20}px`),Ue(Te,"aria-expanded",a(de).hasChildren?a(de).expanded:void 0),Ue(Te,"aria-selected",a(de).selected),Ue(Te,"aria-level",a(de).depth+1),bm(Ie,a(de).selected),Ue(Ie,"aria-label",`Select ${a(de).name??""}`),oe(ze,a(de).name)}),V("click",Te,Z=>w(a(de),Z)),V("change",Ie,()=>f(a(de))),V("click",Ie,Z=>Z.stopPropagation()),I(we,Te)});var ee=D(Q,2);{var ge=we=>{var de=ix(),Ce=y(de);ce(()=>oe(Ce,`Showing ${a(l).shown??""} of ${a(l).total??""} directories. Use the filter to narrow results.`)),I(we,de)};re(ee,we=>{a(l)&&we(ge)})}I(T,E)};re(L,T=>{a(o)?T(R):a(x).length===0?T(O,1):T(U,!1)})}return st(N,T=>m(h,T),()=>a(h)),zi(j,()=>a(s),T=>m(s,T)),V("keydown",N,C),I(e,Y),_t(q)}vt(["keydown","click","change"]);var ox=F('<p class="error-msg svelte-4yj2yx"> </p>'),ax=F('<dialog class="dialog svelte-4yj2yx"><div class="dialog-content svelte-4yj2yx"><div class="dialog-header svelte-4yj2yx"><h2 class="dialog-title svelte-4yj2yx">Add Workspace</h2> <button class="close-btn svelte-4yj2yx" aria-label="Close">✕</button></div> <div class="dialog-body svelte-4yj2yx"><p class="dialog-desc svelte-4yj2yx">Browse for folders on your machine. Git repos get PR tracking and branch management.</p> <!> <!></div> <div class="dialog-footer svelte-4yj2yx"><span class="selected-count svelte-4yj2yx"><!></span> <div class="footer-actions svelte-4yj2yx"><button class="btn btn-ghost svelte-4yj2yx">Cancel</button> <button class="btn btn-primary svelte-4yj2yx"><!></button></div></div></div></dialog>');function lx(e,t){ft(t,!0);let i,r=H(void 0),s=H(Ze([])),n=H(""),o=H(!1);function l(){var R;m(s,[],!0),m(n,""),m(o,!1),(R=a(r))==null||R.reset(),i.showModal()}function h(){i.close()}async function c(){if(a(s).length!==0){m(o,!0),m(n,"");try{const R=await Pm(a(s));if(R.errors.length>0&&R.added.length===0){m(n,R.errors.map(O=>`${O.path}: ${O.error}`).join("; "),!0),m(o,!1);return}R.added.length>0&&t.onWorkspacesAdded(R.added.map(O=>O.path)),R.errors.length>0&&console.warn("Some workspaces failed to add:",R.errors),h()}catch{m(n,"Failed to add workspaces.")}finally{m(o,!1)}}}function u(R){R.target===i&&h()}var d={open:l,close:h},f=ax(),_=y(f),p=y(_),b=D(y(p),2),g=D(p,2),S=D(y(g),2);st(nx(S,{get selectedPaths(){return a(s)},set selectedPaths(R){m(s,R,!0)}}),R=>m(r,R,!0),()=>a(r));var x=D(S,2);{var C=R=>{var O=ox(),U=y(O);ce(()=>oe(U,a(n))),I(R,O)};re(x,R=>{a(n)&&R(C)})}var w=D(g,2),k=y(w),M=y(k);{var B=R=>{var O=an();ce(()=>oe(O,`${a(s).length??""} selected`)),I(R,O)};re(M,R=>{a(s).length>0&&R(B)})}var q=D(k,2),Y=y(q),ne=D(Y,2),j=y(ne);{var N=R=>{var O=an("Adding...");I(R,O)},L=R=>{var O=an();ce(()=>oe(O,`Add Workspace${a(s).length>1?"s":""}`)),I(R,O)};re(j,R=>{a(o)?R(N):R(L,!1)})}return st(f,R=>i=R,()=>i),ce(()=>ne.disabled=a(s).length===0||a(o)),V("click",f,u),V("click",b,h),V("click",Y,h),V("click",ne,c),I(e,f),_t(d)}vt(["click"]);var hx=F('<p class="error-msg svelte-1n78dcx"> </p>'),cx=F("<option> </option>"),dx=F("<option> </option>"),ux=F('<textarea class="prompt-textarea svelte-1n78dcx" placeholder="e.g. focus on security, error handling"></textarea>'),fx=F('<textarea class="prompt-textarea svelte-1n78dcx" placeholder="e.g. include test plan section"></textarea>'),_x=F('<textarea class="prompt-textarea svelte-1n78dcx" placeholder="e.g. prefix with dy/, use conventional commits style"></textarea>'),vx=F('<textarea class="prompt-textarea svelte-1n78dcx" placeholder="e.g. use TypeScript, follow CLAUDE.md"></textarea>'),px=F('<span class="save-success svelte-1n78dcx">Saved</span>'),gx=F('<dialog class="dialog svelte-1n78dcx"><div class="dialog-content svelte-1n78dcx"><div class="dialog-header svelte-1n78dcx"><h2 class="dialog-title svelte-1n78dcx"><span class="gear-icon svelte-1n78dcx">⚙</span> </h2> <button class="close-btn svelte-1n78dcx" aria-label="Close settings">✕</button></div> <div class="dialog-body svelte-1n78dcx"><!> <section class="settings-section svelte-1n78dcx"><h3 class="section-label svelte-1n78dcx">GIT SETTINGS</h3> <div class="field-group svelte-1n78dcx"><label class="field-label svelte-1n78dcx" for="ws-default-branch">Branch new worktrees from</label> <select id="ws-default-branch" class="field-select svelte-1n78dcx"><option>-- auto --</option><!><!></select></div> <div class="field-group svelte-1n78dcx"><label class="field-label svelte-1n78dcx" for="ws-remote">Remote origin</label> <input id="ws-remote" type="text" class="field-input svelte-1n78dcx" placeholder="origin"/></div> <div class="field-group svelte-1n78dcx"><label class="field-label svelte-1n78dcx" for="ws-branch-prefix">Branch prefix</label> <input id="ws-branch-prefix" type="text" class="field-input svelte-1n78dcx" placeholder="e.g. dy/"/></div></section> <div class="divider svelte-1n78dcx"></div> <section class="settings-section svelte-1n78dcx"><h3 class="section-label svelte-1n78dcx">SESSION DEFAULTS</h3> <div class="inline-row svelte-1n78dcx"><label class="field-label svelte-1n78dcx" for="ws-agent">Default agent</label> <select id="ws-agent" class="field-select field-select-inline svelte-1n78dcx"><option>Claude</option><option>Codex</option></select></div> <div class="checkbox-row svelte-1n78dcx"><label class="checkbox-label svelte-1n78dcx"><input type="checkbox" class="dialog-checkbox svelte-1n78dcx"/> <span>Continue</span></label> <label class="checkbox-label svelte-1n78dcx"><input type="checkbox" class="dialog-checkbox svelte-1n78dcx"/> <span>YOLO</span></label> <label class="checkbox-label svelte-1n78dcx"><input type="checkbox" class="dialog-checkbox svelte-1n78dcx"/> <span>Tmux</span></label></div></section> <div class="divider svelte-1n78dcx"></div> <section class="settings-section svelte-1n78dcx"><h3 class="section-label svelte-1n78dcx">PROMPTS</h3> <div class="prompt-group svelte-1n78dcx"><button class="prompt-toggle svelte-1n78dcx"><span class="prompt-arrow svelte-1n78dcx"> </span> Code review preferences</button> <!></div> <div class="prompt-group svelte-1n78dcx"><button class="prompt-toggle svelte-1n78dcx"><span class="prompt-arrow svelte-1n78dcx"> </span> Create PR preferences</button> <!></div> <div class="prompt-group svelte-1n78dcx"><button class="prompt-toggle svelte-1n78dcx"><span class="prompt-arrow svelte-1n78dcx"> </span> Branch rename preferences</button> <!></div> <div class="prompt-group svelte-1n78dcx"><button class="prompt-toggle svelte-1n78dcx"><span class="prompt-arrow svelte-1n78dcx"> </span> General preferences</button> <!></div></section></div> <div class="dialog-footer svelte-1n78dcx"><button class="btn btn-danger svelte-1n78dcx">Remove Workspace</button> <div class="footer-right svelte-1n78dcx"><!> <button class="btn btn-primary svelte-1n78dcx"> </button></div></div></div></dialog>');function mx(e,t){ft(t,!0);let i,r=H(""),s=H(""),n=H(!1),o=H(""),l=H(!1),h=H(Ze([])),c=H(""),u=H(""),d=H(""),f=H("claude"),_=H(!1),p=H(!1),b=H(!1),g=H(""),S=H(""),x=H(""),C=H(""),w=H(!1),k=H(!1),M=H(!1),B=H(!1);async function q(te,Ve){m(r,te,!0),m(s,Ve,!0),m(o,""),m(l,!1),m(n,!1),m(c,""),m(u,""),m(d,""),m(f,"claude"),m(_,!1),m(p,!1),m(b,!1),m(g,""),m(S,""),m(x,""),m(C,""),i.showModal();try{const[yt,Jr]=await Promise.all([Th(te),id(te).catch(()=>[])]);m(h,Jr,!0),ne(yt)}catch{m(o,"Failed to load workspace settings.")}}function Y(){i.close()}function ne(te){m(c,te.defaultBranch??"",!0),m(u,te.remote??"",!0),m(d,te.branchPrefix??"",!0),m(f,te.defaultAgent??"claude",!0),m(_,te.defaultContinue??!1,!0),m(p,te.defaultYolo??!1,!0),m(b,te.launchInTmux??!1,!0),m(g,te.promptCodeReview??"",!0),m(S,te.promptCreatePr??"",!0),m(x,te.promptBranchRename??"",!0),m(C,te.promptGeneral??"",!0)}async function j(){m(n,!0),m(o,""),m(l,!1);try{const te={defaultAgent:a(f),defaultContinue:a(_),defaultYolo:a(p),launchInTmux:a(b)};a(c)&&(te.defaultBranch=a(c)),a(u)&&(te.remote=a(u)),a(d)&&(te.branchPrefix=a(d)),a(g)&&(te.promptCodeReview=a(g)),a(S)&&(te.promptCreatePr=a(S)),a(x)&&(te.promptBranchRename=a(x)),a(C)&&(te.promptGeneral=a(C)),await Xm(a(r),te),m(l,!0),setTimeout(()=>{m(l,!1)},2e3)}catch(te){m(o,te instanceof Error?te.message:"Failed to save settings.",!0)}finally{m(n,!1)}}function N(){i.close(),t.onRemoveWorkspace(a(r))}function L(te){te.target===i&&i.close()}var R={open:q,close:Y},O=gx(),U=y(O),T=y(U),E=y(T),Q=D(y(E)),ee=D(E,2),ge=D(T,2),we=y(ge);{var de=te=>{var Ve=hx(),yt=y(Ve);ce(()=>oe(yt,a(o))),I(te,Ve)};re(we,te=>{a(o)&&te(de)})}var Ce=D(we,2),Te=D(y(Ce),2),De=D(y(Te),2),ve=y(De);ve.value=ve.__value="";var ye=D(ve);Xt(ye,17,()=>a(h),Uo,(te,Ve)=>{var yt=cx(),Jr=y(yt),Pd={};ce(()=>{oe(Jr,a(Ve)),Pd!==(Pd=a(Ve))&&(yt.value=(yt.__value=a(Ve))??"")}),I(te,yt)});var me=D(ye);{var Ie=te=>{var Ve=dx(),yt=y(Ve),Jr={};ce(()=>{oe(yt,a(c)),Jr!==(Jr=a(c))&&(Ve.value=(Ve.__value=a(c))??"")}),I(te,Ve)},Fe=fe(()=>a(c)&&!a(h).includes(a(c)));re(me,te=>{a(Fe)&&te(Ie)})}var ze=D(Te,2),Re=D(y(ze),2),Qe=D(ze,2),Z=D(y(Qe),2),ue=D(Ce,4),A=D(y(ue),2),$=D(y(A),2),se=y($);se.value=se.__value="claude";var J=D(se);J.value=J.__value="codex";var Se=D(A,2),le=y(Se),Me=y(le),Oe=D(le,2),z=y(Oe),G=D(Oe,2),pe=y(G),P=D(ue,4),W=D(y(P),2),he=y(W),ke=y(he),Pe=y(ke),be=D(he,2);{var Ee=te=>{var Ve=ux();Ue(Ve,"rows",3),zi(Ve,()=>a(g),yt=>m(g,yt)),I(te,Ve)};re(be,te=>{a(w)&&te(Ee)})}var $e=D(W,2),it=y($e),Qt=y(it),Be=y(Qt),Ne=D(it,2);{var Ye=te=>{var Ve=fx();Ue(Ve,"rows",3),zi(Ve,()=>a(S),yt=>m(S,yt)),I(te,Ve)};re(Ne,te=>{a(k)&&te(Ye)})}var nt=D($e,2),rt=y(nt),si=y(rt),yi=y(si),Jt=D(rt,2);{var Si=te=>{var Ve=_x();Ue(Ve,"rows",3),zi(Ve,()=>a(x),yt=>m(x,yt)),I(te,Ve)};re(Jt,te=>{a(M)&&te(Si)})}var Or=D(nt,2),fr=y(Or),ma=y(fr),ba=y(ma),Nl=D(fr,2);{var ya=te=>{var Ve=vx();Ue(Ve,"rows",3),zi(Ve,()=>a(C),yt=>m(C,yt)),I(te,Ve)};re(Nl,te=>{a(B)&&te(ya)})}var Fl=D(ge,2),Sa=y(Fl),Wl=D(Sa,2),wa=y(Wl);{var Hl=te=>{var Ve=px();I(te,Ve)};re(wa,te=>{a(l)&&te(Hl)})}var je=D(wa,2),et=y(je);return st(O,te=>i=te,()=>i),ce(()=>{oe(Q,` ${a(s)??""}`),Ue(he,"aria-expanded",a(w)),oe(Pe,a(w)?"▾":"▸"),Ue(it,"aria-expanded",a(k)),oe(Be,a(k)?"▾":"▸"),Ue(rt,"aria-expanded",a(M)),oe(yi,a(M)?"▾":"▸"),Ue(fr,"aria-expanded",a(B)),oe(ba,a(B)?"▾":"▸"),je.disabled=a(n),oe(et,a(n)?"Saving…":"Save")}),V("click",O,L),V("click",ee,()=>i.close()),Xa(De,()=>a(c),te=>m(c,te)),zi(Re,()=>a(u),te=>m(u,te)),zi(Z,()=>a(d),te=>m(d,te)),Xa($,()=>a(f),te=>m(f,te)),rr(Me,()=>a(_),te=>m(_,te)),rr(z,()=>a(p),te=>m(p,te)),rr(pe,()=>a(b),te=>m(b,te)),V("click",he,()=>{m(w,!a(w))}),V("click",it,()=>{m(k,!a(k))}),V("click",rt,()=>{m(M,!a(M))}),V("click",fr,()=>{m(B,!a(B))}),V("click",Sa,N),V("click",je,j),I(e,O),_t(R)}vt(["click"]);var bx=F('<div class="sidebar-overlay svelte-13zv0lp"></div>'),yx=F("<!> <!> <!> <!>",1),Sx=F('<div class="main-app svelte-13zv0lp"><!> <!> <div class="terminal-area svelte-13zv0lp"><!> <!></div></div> <!> <!> <!> <!> <!> <!> <!>',1);function wx(e,t){ft(t,!0);const i=new Ep({defaultOptions:{queries:{staleTime:60*1e3,gcTime:600*1e3,refetchOnWindowFocus:!0}}}),r=H_(),s=rd(),n=nd(),o=od();function l(A,$){n.activeSessionId=A;const se=n.sessions.find(J=>J.id===A);se&&(s.activeWorkspacePath=se.repoPath),Zd(A),Di()}ub(l);let h=H(void 0),c=H(void 0),u=H(void 0),d=H(void 0),f=H(void 0),_=H(void 0),p=H(void 0),b=H(!1);ho(()=>{Qm();let A,$;if(Kt&&window.visualViewport){const Se=window.visualViewport;let le=null;const Me=()=>{const Oe=window.innerHeight-Se.height;m(b,Oe>50),a(p)&&(a(p).style.height=a(b)?Se.height+"px":""),window.scrollTo(0,0),le&&clearTimeout(le),le=setTimeout(()=>{var z;return(z=a(h))==null?void 0:z.fitTerm()},100)};Se.addEventListener("resize",Me),Se.addEventListener("scroll",Me),A=()=>{Se.removeEventListener("resize",Me),Se.removeEventListener("scroll",Me),le&&clearTimeout(le)}}const se=navigator.platform.toUpperCase().includes("MAC");let J;{const Se=le=>{var z;const Me=(z=document.activeElement)==null?void 0:z.tagName;if(!(Me==="INPUT"||Me==="TEXTAREA"||!(se?le.metaKey:le.ctrlKey))){if(le.key==="t"&&!le.shiftKey){le.preventDefault(),ne();return}if(le.key==="w"&&!le.shiftKey){le.preventDefault(),n.activeSessionId&&Q(n.activeSessionId);return}if(!le.shiftKey&&le.key>="1"&&le.key<="9"){const G=a(C);if(G.length===0)return;le.preventDefault();const pe=parseInt(le.key,10),P=pe===9?G[G.length-1]:G[pe-1];P&&Y(P.id);return}if(le.shiftKey&&le.key==="["){const G=a(C);if(G.length===0)return;le.preventDefault();const pe=G.findIndex(W=>W.id===n.activeSessionId),P=pe<=0?G[G.length-1]:G[pe-1];P&&Y(P.id);return}if(le.shiftKey&&le.key==="]"){const G=a(C);if(G.length===0)return;le.preventDefault();const pe=G.findIndex(W=>W.id===n.activeSessionId),P=pe===-1||pe===G.length-1?G[0]:G[pe+1];P&&Y(P.id);return}}};document.addEventListener("keydown",Se),J=()=>document.removeEventListener("keydown",Se)}if(Kt){let Me=0,Oe=0,z=!1;const G=W=>{const he=W.touches[0];he&&he.clientX<=30&&!s.sidebarOpen&&(Me=he.clientX,Oe=he.clientY,z=!0)},pe=W=>{if(!z)return;const he=W.touches[0];if(!he)return;const ke=he.clientX-Me,Pe=Math.abs(he.clientY-Oe);if(Pe>ke&&(Pe>8||ke>8)){z=!1;return}ke>=50&&(z=!1,Xd())},P=()=>{z=!1};document.addEventListener("touchstart",G,{passive:!0}),document.addEventListener("touchmove",pe,{passive:!0}),document.addEventListener("touchend",P),$=()=>{document.removeEventListener("touchstart",G),document.removeEventListener("touchmove",pe),document.removeEventListener("touchend",P)}}return()=>{J==null||J(),A==null||A(),$==null||$()}}),hr(()=>{r.authenticated&&Bt().then(()=>{const $=new URLSearchParams(window.location.search).get("session");$&&(window.history.replaceState({},"","/"),l($)),!n.activeSessionId&&!$&&n.sessions.length===1&&Y(n.sessions[0].id),!n.activeSessionId&&!$&&n.sessions.length===1&&Y(n.sessions[0].id);for(const se of n.sessions)_o(se.id,o.defaultNotifications);fb().then(()=>{_b(bb())})})}),hr(()=>{r.authenticated&&sv(A=>{A.type==="worktrees-changed"?Bt():A.type==="session-state-changed"&&A.sessionId&&A.state?gb(A.sessionId,A.state):A.type==="session-idle-changed"&&A.sessionId?mb(A.sessionId,A.idle??!1):A.type==="session-renamed"&&A.sessionId?pb(A.sessionId,A.branchName??"",A.displayName??""):A.type==="session-ended"&&(i.invalidateQueries({queryKey:["pr"]}),i.invalidateQueries({queryKey:["ci-status"]}))})});let g=fe(()=>s.activeWorkspacePath?n.workspaces.find(A=>A.path===s.activeWorkspacePath):void 0),S=fe(()=>s.activeWorkspacePath?tv(s.activeWorkspacePath):[]),x=fe(()=>n.activeSessionId?n.sessions.find(A=>A.id===n.activeSessionId):void 0),C=fe(()=>a(x)?a(S).filter(A=>A.repoPath===a(x).repoPath):a(S)),w=fe(()=>!!a(x)&&!!s.activeWorkspacePath&&(a(x).repoPath===s.activeWorkspacePath||a(x).repoPath.startsWith(s.activeWorkspacePath+"/"))),k=fe(()=>{var A,$;return((A=a(x))==null?void 0:A.displayName)||(($=a(g))==null?void 0:$.name)||"Claude Remote CLI"}),M=fe(()=>{var A;return((A=a(x))==null?void 0:A.useTmux)??!1}),B=H(!1),q=fe(()=>a(g)?a(w)?"session":"dashboard":"empty");function Y(A){var se;n.activeSessionId=A;const $=n.sessions.find(J=>J.id===A);if($){const J=n.workspaces.find(Se=>$.repoPath===Se.path||$.repoPath.startsWith(Se.path+"/"));s.activeWorkspacePath=(J==null?void 0:J.path)??$.repoPath}Zd(A),Di(),(se=a(h))==null||se.focusTerm(),yb(A)}function ne(A,$){var se,J;a(g)?(se=a(u))==null||se.open({name:a(g).name,path:a(g).path,root:""},$):(J=a(u))==null||J.open(void 0,$)}function j(A){var $,se;A?($=a(_))==null||$.open(A.path,A.name):(se=a(d))==null||se.open()}async function N(A){var se,J;const $=`new-worktree:${A.path}`;if(!Zi($)){Cn($);try{let Se=o.defaultYolo,le=o.defaultAgent,Me=o.launchInTmux;try{const pe=await Th(A.path);pe.defaultYolo!==void 0&&(Se=pe.defaultYolo),pe.defaultAgent&&(le=pe.defaultAgent),pe.launchInTmux!==void 0&&(Me=pe.launchInTmux)}catch{}const{branchName:Oe,worktreePath:z}=await Vl(A.path),G=await ln({repoPath:A.path,repoName:A.name,worktreePath:z,branchName:Oe,yolo:Se,agent:le,useTmux:Me,needsBranchRename:!0});await Bt(),n.activeSessionId=G.id,s.activeWorkspacePath=A.path,_o(G.id,o.defaultNotifications),Di(),(se=a(h))==null||se.focusTerm()}catch{(J=a(u))==null||J.open({name:A.name,path:A.path,root:""})}finally{kn($)}}}async function L(A){if(!a(g))return;const $=a(g).path,se=n.sessions.find(le=>le.branchName===A.headRefName&&le.repoPath.startsWith($)),J=n.worktrees.find(le=>le.branchName===A.headRefName&&le.repoPath===$);let Se=`Merge the branch "${A.baseRefName}" into this branch and resolve all merge conflicts. Use \`git merge ${A.baseRefName}\` and fix any conflicts in the working tree. After resolving, verify the build passes.`;try{const le=await Th($);le.promptFixConflicts&&(Se=le.promptFixConflicts.replace(/\{baseRefName\}/g,A.baseRefName).replace(/\{headRefName\}/g,A.headRefName))}catch{}try{let le,Me;if(se)le=se.repoPath,Me=se.branchName;else if(J)le=J.path,Me=J.branchName;else{const z=await Vl($,A.headRefName);le=z.worktreePath,Me=z.branchName}const Oe=await ln({repoPath:$,repoName:a(g).name,worktreePath:le,branchName:Me,allowMultiple:!0});await Bt(),n.activeSessionId=Oe.id,s.activeWorkspacePath=$,_o(Oe.id,o.defaultNotifications),Di(),setTimeout(()=>{ks(Se+"\r")},1500)}catch(le){console.error("Failed to start conflict resolution:",le)}}async function R(A,$){if(!a(g))return;const se=a(g).path,J=n.sessions.find(le=>le.branchName===A.headRefName&&le.repoPath.startsWith(se)),Se=n.worktrees.find(le=>le.branchName===A.headRefName&&le.repoPath===se);try{let le,Me;if(J)le=J.repoPath,Me=J.branchName;else if(Se)le=Se.path,Me=Se.branchName;else{const z=await Vl(se,A.headRefName);le=z.worktreePath,Me=z.branchName}const Oe=await ln({repoPath:se,repoName:a(g).name,worktreePath:le,branchName:Me,allowMultiple:!0});await Bt(),n.activeSessionId=Oe.id,s.activeWorkspacePath=se,_o(Oe.id,o.defaultNotifications),Di(),$&&setTimeout(()=>{ks($+"\r")},1500)}catch(le){console.error("Failed to open PR branch session:",le)}}function O(A){const $=A.state==="OPEN"?"OPEN":A.state==="MERGED"?"MERGED":"CLOSED",se=ad({commitsAhead:1,prState:$,ciFailing:0,ciPending:0,ciTotal:0,mergeable:A.mergeable??null,unresolvedCommentCount:0}),J=lv(se,{branchName:A.headRefName,baseBranch:A.baseRefName,prNumber:A.number});J&&R(A,J)}function U(A){R(A)}function T(A){var $;($=a(f))==null||$.open(A)}function E(A){var $;n.activeSessionId=A,_o(A,o.defaultNotifications),Di(),($=a(h))==null||$.focusTerm()}function Q(A){var $;if(fetch(`/sessions/${A}`,{method:"DELETE"}).then(()=>Bt()),n.activeSessionId===A){const se=a(C).filter(J=>J.id!==A);n.activeSessionId=(($=se[0])==null?void 0:$.id)??null}}function ee(A,$,se){var J,Se;(J=a(c))==null||J.show(A,$,se),$||(Se=a(c))==null||Se.autoDismiss(3e3)}function ge(A){ks(A)}function we(){}function de(){}function Ce(){const A=document.createElement("input");A.type="file",A.accept="image/*",A.onchange=()=>{var se,J;const $=(se=A.files)==null?void 0:se[0];$&&((J=a(h))==null||J.handleImageUpload($,$.type))},A.click()}function Te(){var A;(A=a(h))==null||A.focusTerm()}function De(A){m(B,A,!0)}function ve(){var A;(A=a(h))==null||A.exitCopyMode()}let ye=H(void 0);function me(){var A;(A=a(ye))==null||A.open()}async function Ie(A){await Bt(),A.length>0&&(s.activeWorkspacePath=A[0])}async function Fe(){const A=n.activeSessionId;if(!A)return;const $=n.sessions.find(se=>se.id===A);if($){if(await Bm(A),$.type==="worktree"){const se=n.workspaces.find(J=>$.repoPath===J.path||$.repoPath.startsWith(J.path+"/"));if(se&&$.repoPath!==se.path)try{await N_($.repoPath,se.path)}catch{}}n.activeSessionId=null,await Bt()}}var ze=Vr(),Re=kt(ze);{var Qe=A=>{},Z=A=>{Eb(A,{})},ue=A=>{yC(A,{get client(){return i},children:($,se)=>{var J=Sx(),Se=kt(J),le=y(Se);{var Me=Be=>{var Ne=bx();V("click",Ne,function(...Ye){Di==null||Di.apply(this,Ye)}),I(Be,Ne)};re(le,Be=>{s.sidebarOpen&&Be(Me)})}var Oe=D(le,2);wS(Oe,{onSelectSession:Y,onOpenSettings:j,onNewWorktree:N,onAddWorkspace:me,onDeleteSession:Q,onDeleteWorktree:T});var z=D(Oe,2),G=y(z);wk(G,{get title(){return a(k)},get onMenuClick(){return Xd},get hidden(){return a(b)}});var pe=D(G,2);{var P=Be=>{pk(Be,{heading:"Add a workspace to get started",description:"Point to any folder on your machine. Git repos get PR tracking and branch management.",actionLabel:"+ Add Workspace",onAction:me})},W=Be=>{{let Ne=fe(()=>s.activeWorkspacePath??""),Ye=fe(()=>{var rt;return((rt=a(g))==null?void 0:rt.name)??""}),nt=fe(()=>Zi(`new-worktree:${s.activeWorkspacePath??""}`));dk(Be,{get workspacePath(){return a(Ne)},get workspaceName(){return a(Ye)},get creatingWorktree(){return a(nt)},onNewSession:()=>ne(),onNewWorktree:()=>{a(g)&&N(a(g))},onFixConflicts:L,onPrAction:O,onOpenPrSession:U})}},he=Be=>{var Ne=yx(),Ye=kt(Ne);{let yi=fe(()=>s.activeWorkspacePath??""),Jt=fe(()=>{var Si;return((Si=a(x))==null?void 0:Si.branchName)??""});WC(Ye,{get workspacePath(){return a(yi)},get branchName(){return a(Jt)},get sessionId(){return n.activeSessionId},onArchive:Fe})}var nt=D(Ye,2);KC(nt,{get sessions(){return a(C)},get activeSessionId(){return n.activeSessionId},onSelectSession:Y,onCloseSession:Q,onNewSession:()=>ne(),onNewTerminal:()=>ne(void 0,{agent:"claude"})});var rt=D(nt,2);st(N1(rt,{get sessionId(){return n.activeSessionId},onImageUpload:ee,get useTmux(){return a(M)},onCopyModeChange:De}),yi=>m(h,yi,!0),()=>a(h));var si=D(rt,2);yk(si,{onSendKey:ge,onFlushComposedText:we,onClearInput:de,onUploadImage:Ce,onRefocusMobileInput:Te,get useTmux(){return a(M)},get inCopyMode(){return a(B)},onExitCopyMode:ve}),I(Be,Ne)};re(pe,Be=>{a(q)==="empty"?Be(P):a(q)==="dashboard"?Be(W,1):a(q)==="session"&&Be(he,2)})}st(Se,Be=>m(p,Be),()=>a(p));var ke=D(Se,2);st(Bk(ke,{onSessionCreated:E}),Be=>m(u,Be,!0),()=>a(u));var Pe=D(ke,2);st(Kk(Pe,{}),Be=>m(d,Be,!0),()=>a(d));var be=D(Pe,2);st(Vk(be,{}),Be=>m(f,Be,!0),()=>a(f));var Ee=D(be,2);st(lx(Ee,{onWorkspacesAdded:Ie}),Be=>m(ye,Be,!0),()=>a(ye));var $e=D(Ee,2);st(mx($e,{onRemoveWorkspace:async Be=>{await fetch("/workspaces",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:Be})}),await Bt(),s.activeWorkspacePath===Be&&(s.activeWorkspacePath=null)}}),Be=>m(_,Be,!0),()=>a(_));var it=D($e,2);xk(it,{});var Qt=D(it,2);st(Tk(Qt,{}),Be=>m(c,Be,!0),()=>a(c)),I($,J)},$$slots:{default:!0}})};re(Re,A=>{r.checking?A(Qe):r.authenticated?A(ue,!1):A(Z,1)})}I(e,ze),_t()}vt(["click"]);rm(wx,{target:document.getElementById("app")});
|
|
50
|
+
*/var K1=2,q1=1,j1=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(){var d;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:((d=this._terminal.options.overviewRuler)==null?void 0:d.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(i.getPropertyValue("height")),s=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},l=o.top+o.bottom,h=o.right+o.left,c=r-l,u=s-h-t;return{cols:Math.max(K1,Math.floor(u/e.css.cell.width)),rows:Math.max(q1,Math.floor(c/e.css.cell.height))}}},Y1=F('<div class="scroll-fabs svelte-5qgfij"><button class="scroll-fab svelte-5qgfij" data-dir="up" aria-label="Page up">▲</button> <button class="scroll-fab svelte-5qgfij" data-dir="down" aria-label="Page down">▼</button> <button class="scroll-fab scroll-fab-bottom svelte-5qgfij" data-dir="bottom" aria-label="Skip to bottom">↧</button></div>'),V1=F('<div><div class="terminal-container svelte-5qgfij" role="presentation"></div> <div class="terminal-scrollbar svelte-5qgfij" role="scrollbar" aria-orientation="vertical"><div class="terminal-scrollbar-thumb svelte-5qgfij" role="presentation"></div></div> <!></div>');function G1(e,t){_t(t,!0);let i=ur(t,"useTmux",3,!1),r=ur(t,"companionMode",3,!1),s,n=W(null),o,l=!1;function h(){return a(n)}function c(){var z;(z=a(n))==null||z.focus()}function u(){if(!a(n))return;const z=a(n).buffer.active,$=z.viewportY>=z.baseY,me=z.viewportY;o==null||o.fit(),$?a(n).scrollToBottom():a(n).scrollToLine(me),th(a(n).cols,a(n).rows),O()}fo(()=>{const z=new U1({cursorBlink:!0,fontSize:jt?12:14,fontFamily:"Menlo, monospace",scrollback:1e4,theme:{background:"#000000",foreground:"#d4d4d4",cursor:"#d4d4d4"}});if(o=new j1,z.loadAddon(o),z.open(s),jt){const P=s.querySelector(".xterm-viewport");P&&(P.style.touchAction="none",P.style.overflowY="hidden");const H=s.querySelector(".xterm-screen");if(H){H.addEventListener("wheel",we=>{we.stopImmediatePropagation(),we.preventDefault()},{capture:!0,passive:!1});const ce=we=>{z.modes.mouseTrackingMode!=="none"&&we.stopImmediatePropagation()};for(const we of["mousedown","mouseup","mousemove"])H.addEventListener(we,ce,{capture:!0})}}o.fit(),z.onData(P=>ks(P));{const P=/Mac|iPhone|iPad|iPod/.test(navigator.platform||"");z.attachCustomKeyEventHandler(H=>!P&&H.type==="keydown"&&H.ctrlKey&&!H.shiftKey&&!H.altKey&&!H.metaKey&&(H.key==="v"||H.key==="V")&&navigator.clipboard&&navigator.clipboard.read?(navigator.clipboard.read().then(ce=>{let we=null,Pe=null;for(const be of ce){for(const Ee of be.types)if(Ee.startsWith("image/")){Pe=Ee,we=be;break}if(we)break}we&&Pe?we.getType(Pe).then(be=>ge(be,Pe)):navigator.clipboard.readText().then(be=>{be&&z.paste(be)})}).catch(()=>{navigator.clipboard.readText&&navigator.clipboard.readText().then(ce=>{ce&&z.paste(ce)}).catch(()=>{})}),!1):!0)}z.parser.registerOscHandler(52,P=>{var we;const H=P.indexOf(";");if(H===-1)return!0;const ce=P.slice(H+1);if(!ce||ce==="?")return!0;try{const Pe=Uint8Array.from(atob(ce),Ee=>Ee.charCodeAt(0)),be=new TextDecoder("utf-8").decode(Pe);(we=navigator.clipboard)==null||we.writeText(be).catch(()=>{})}catch{}return!0}),z.onScroll(O),z.onWriteParsed(O);let $=null;const me=new ResizeObserver(()=>{$&&clearTimeout($),$=setTimeout(()=>{const P=z.buffer.active,H=P.viewportY>=P.baseY,ce=P.viewportY;o.fit(),H?z.scrollToBottom():z.scrollToLine(ce),th(z.cols,z.rows),O()},jt?150:0)});return me.observe(s),jt&&(document.addEventListener("touchmove",ue,{passive:!1}),document.addEventListener("touchend",Ce),document.addEventListener("touchcancel",Ce)),m(n,z,!0),()=>{$&&clearTimeout($),j&&clearTimeout(j),me.disconnect(),z.dispose(),m(n,null),S=!1,d=!1,jt&&(document.removeEventListener("touchmove",ue),document.removeEventListener("touchend",Ce),document.removeEventListener("touchcancel",Ce))}}),cr(()=>{t.sessionId&&a(n)&&!r()&&(a(n).write("\x1B[?1049l"),a(n).clear(),uv(t.sessionId,a(n),()=>{a(n)&&th(a(n).cols,a(n).rows)},()=>{}))});let d=!1,f=0,_=0,p=W(0),b=W(0),g=W(!1),S=!1,x=0,C=0,w=!1,k=0,M=0,B=W(!1),K=W(!1),j=null,se=0,Y=0;const N=500,L=10;let T=!1;function O(){T||(T=!0,requestAnimationFrame(U))}function U(){if(T=!1,!a(n))return;const z=a(n).buffer.active,$=z.baseY+a(n).rows,me=z.viewportY,P=ve;if(!P)return;const H=P.clientHeight;if($<=a(n).rows){m(g,!1);return}m(g,!0),m(p,Math.max(jt?44:20,a(n).rows/$*H),!0),m(b,me/($-a(n).rows)*(H-a(p)))}function R(z){if(!a(n)||!ve)return;const $=ve.getBoundingClientRect(),P=a(n).buffer.active.baseY+a(n).rows;if(P<=a(n).rows)return;const H=ve.clientHeight,ce=Math.max(jt?44:20,a(n).rows/P*H),we=H-ce,Pe=z-$.top-ce/2,be=Math.max(0,Math.min(1,Pe/we)),Ee=Math.round(be*(P-a(n).rows));a(n).scrollToLine(Ee)}function E(z){const $=z.touches[0];$&&(d=!0,f=$.clientY,_=a(b))}function J(){var z;a(K)&&(m(K,!1),(z=t.onCopyModeChange)==null||z.call(t,!1))}function te(){var me;if(j=null,S=!1,navigator.vibrate&&navigator.vibrate(50),i()){m(K,!0),(me=t.onCopyModeChange)==null||me.call(t,!0),ks("[");return}m(B,!0);const z=s.querySelector(".xterm-screen");z&&(z.style.userSelect="text",z.style.webkitUserSelect="text"),s.querySelectorAll("canvas").forEach(P=>{P.style.pointerEvents="none"});const $=s.querySelector(".xterm-rows");if($){const P=document.createRange();P.selectNodeContents($);const H=window.getSelection();H==null||H.removeAllRanges(),H==null||H.addRange(P)}}function pe(){var $;m(B,!1);const z=s.querySelector(".xterm-screen");z&&(z.style.userSelect="",z.style.webkitUserSelect=""),s.querySelectorAll("canvas").forEach(me=>{me.style.pointerEvents=""}),($=window.getSelection())==null||$.removeAllRanges()}function ke(z){var me;if(a(B)){const P=((me=window.getSelection())==null?void 0:me.toString())??"";P.trim().length>0&&(navigator.clipboard.writeText(P).catch(()=>{}),navigator.vibrate&&navigator.vibrate(30)),pe();return}if(a(K)||z.target.closest(".terminal-scrollbar")||z.target.closest(".scroll-fabs")||!a(n))return;const $=z.touches[0];$&&(x=$.clientY,M=$.clientY,C=a(n).buffer.active.viewportY,w=!1,k=0,S=!0,se=$.clientX,Y=$.clientY,j&&clearTimeout(j),j=setTimeout(()=>{te()},N))}function ue(z){const $=z.touches[0];if($){if(d){if(!a(n)||!ve)return;z.preventDefault();const me=$.clientY-f,H=a(n).buffer.active.baseY+a(n).rows;if(H<=a(n).rows)return;const ce=ve.clientHeight,we=Math.max(44,a(n).rows/H*ce),Pe=ce-we,Ee=Math.max(0,Math.min(Pe,_+me))/Pe,Qe=Math.round(Ee*(H-a(n).rows));a(n).scrollToLine(Qe);return}if(S&&a(n)&&!a(B)){if(j){const P=Math.abs($.clientX-se),H=Math.abs($.clientY-Y);(P>L||H>L)&&(clearTimeout(j),j=null)}if(a(n).rows===0||s.clientHeight===0)return;const me=x-$.clientY;if(Math.abs(me)>5){w=!0,z.preventDefault();const P=s.clientHeight/a(n).rows;if(a(n).buffer.active.type==="alternate"){const H=M-$.clientY;M=$.clientY;const ce=H/P;k+=ce;const we=Math.trunc(k);if(we!==0){k-=we;const Pe=we>0?65:64,be=Math.max(1,Math.round(a(n).cols/2)),Ee=Math.max(1,Math.round(a(n).rows/2)),Qe=`\x1B[<${Pe};${be};${Ee}M`,st=Math.min(Math.abs(we),5);for(let Et=0;Et<st;Et++)ks(Qe)}}else{const H=me/P,ce=a(n).buffer.active.baseY,we=Math.max(0,Math.min(ce,Math.round(C+H)));a(n).scrollToLine(we)}}}}}function Ce(){j&&(clearTimeout(j),j=null),d=!1,S=!1,w=!1,k=0}function De(z){z.target!==ye&&R(z.clientY)}function Te(z){var P,H,ce;z.preventDefault();const $=z.target.closest("button");if(!$)return;const me=$.dataset.dir;me==="up"?(P=a(n))==null||P.scrollPages(-1):me==="down"?(H=a(n))==null||H.scrollPages(1):me==="bottom"&&((ce=a(n))==null||ce.scrollToBottom())}let ve,ye;async function ge(z,$){var P;if(l||!t.sessionId)return;l=!0,(P=t.onImageUpload)==null||P.call(t,"Pasting image…",!1);const me=new FileReader;me.onload=async()=>{var ce,we,Pe;const H=me.result.split(",")[1];try{const be=await Gm(t.sessionId,H,$);be.clipboardSet?(ce=t.onImageUpload)==null||ce.call(t,"Image pasted",!1):(we=t.onImageUpload)==null||we.call(t,be.path,!0,be.path)}catch(be){const Ee=be instanceof Error?be.message:"Image upload failed";(Pe=t.onImageUpload)==null||Pe.call(t,Ee,!1)}finally{l=!1}},me.readAsDataURL(z)}function Oe(z){var $;if(($=z.clipboardData)!=null&&$.items){for(const me of z.clipboardData.items)if(me.type.startsWith("image/")){z.preventDefault(),z.stopPropagation();const P=me.getAsFile();P&&ge(P,me.type);return}}}let Ne=W(!1);function Ue(z){var $;($=z.dataTransfer)!=null&&$.types.includes("Files")&&(z.preventDefault(),m(Ne,!0))}function Re(){m(Ne,!1)}function Ze(z){var me;if(z.preventDefault(),m(Ne,!1),!((me=z.dataTransfer)!=null&&me.files.length))return;const $=z.dataTransfer.files[0];$.type.startsWith("image/")&&ge($,$.type)}function Z(z){var $;d||w||z.target.closest(".terminal-scrollbar")||a(B)||(($=a(n))==null||$.focus(),z.preventDefault())}var _e={getTerm:h,focusTerm:c,fitTerm:u,exitCopyMode:J,handleImageUpload:ge},A=V1();let Q;var ne=y(A);it(ne,z=>s=z,()=>s);var ee=D(ne,2);ze(ee,"aria-valuenow",0);var Se=y(ee);let he;it(Se,z=>ye=z,()=>ye),it(ee,z=>ve=z,()=>ve);var Me=D(ee,2);{var Le=z=>{var $=Y1();V("mousedown",$,Te),I(z,$)};re(Me,z=>{jt&&a(g)&&z(Le)})}return le(()=>{Q=tt(A,1,"terminal-wrapper svelte-5qgfij",null,Q,{"drag-over":a(Ne),"selection-mode":a(B)}),he=uo(Se,"",he,{display:a(g)?"block":"none",height:a(p)+"px",top:a(b)+"px"})}),V("touchstart",A,function(...z){var $;($=jt?ke:void 0)==null||$.apply(this,z)}),V("touchend",A,function(...z){var $;($=jt?Z:void 0)==null||$.apply(this,z)}),lr("paste",ne,Oe),lr("dragover",ne,Ue),lr("dragleave",ne,Re),lr("drop",ne,Ze),V("click",ee,De),V("touchstart",Se,E),I(e,A),vt(_e)}pt(["touchstart","touchend","click","mousedown"]);var ya=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},$1={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ls,Yc,Of,X1=(Of=class{constructor(){ie(this,ls,$1);ie(this,Yc,!1)}setTimeoutProvider(e){G(this,ls,e)}setTimeout(e,t){return v(this,ls).setTimeout(e,t)}clearTimeout(e){v(this,ls).clearTimeout(e)}setInterval(e,t){return v(this,ls).setInterval(e,t)}clearInterval(e){v(this,ls).clearInterval(e)}},ls=new WeakMap,Yc=new WeakMap,Of),qs=new X1;function Z1(e){setTimeout(e,0)}var lo=typeof window>"u"||"Deno"in globalThis;function Fi(){}function Q1(e,t){return typeof e=="function"?e(t):e}function Pc(e){return typeof e=="number"&&e>=0&&e!==1/0}function xp(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ds(e,t){return typeof e=="function"?e(t):e}function zi(e,t){return typeof e=="function"?e(t):e}function pf(e,t){const{type:i="all",exact:r,fetchStatus:s,predicate:n,queryKey:o,stale:l}=e;if(o){if(r){if(t.queryHash!==Rd(o,t.options))return!1}else if(!Qo(t.queryKey,o))return!1}if(i!=="all"){const h=t.isActive();if(i==="active"&&!h||i==="inactive"&&h)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||s&&s!==t.state.fetchStatus||n&&!n(t))}function gf(e,t){const{exact:i,status:r,predicate:s,mutationKey:n}=e;if(n){if(!t.options.mutationKey)return!1;if(i){if(Zo(t.options.mutationKey)!==Zo(n))return!1}else if(!Qo(t.options.mutationKey,n))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function Rd(e,t){return((t==null?void 0:t.queryKeyHashFn)||Zo)(e)}function Zo(e){return JSON.stringify(e,(t,i)=>Ac(i)?Object.keys(i).sort().reduce((r,s)=>(r[s]=i[s],r),{}):i)}function Qo(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(i=>Qo(e[i],t[i])):!1}var J1=Object.prototype.hasOwnProperty;function Ep(e,t,i=0){if(e===t)return e;if(i>500)return t;const r=mf(e)&&mf(t);if(!r&&!(Ac(e)&&Ac(t)))return t;const n=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),l=o.length,h=r?new Array(l):{};let c=0;for(let u=0;u<l;u++){const d=r?u:o[u],f=e[d],_=t[d];if(f===_){h[d]=f,(r?u<n:J1.call(e,d))&&c++;continue}if(f===null||_===null||typeof f!="object"||typeof _!="object"){h[d]=_;continue}const p=Ep(f,_,i+1);h[d]=p,p===f&&c++}return n===l&&c===n?e:h}function Mc(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(e[i]!==t[i])return!1;return!0}function mf(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ac(e){if(!bf(e))return!1;const t=e.constructor;if(t===void 0)return!0;const i=t.prototype;return!(!bf(i)||!i.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function bf(e){return Object.prototype.toString.call(e)==="[object Object]"}function eC(e){return new Promise(t=>{qs.setTimeout(t,e)})}function Oc(e,t,i){return typeof i.structuralSharing=="function"?i.structuralSharing(e,t):i.structuralSharing!==!1?Ep(e,t):t}function tC(e,t,i=0){const r=[...e,t];return i&&r.length>i?r.slice(1):r}function iC(e,t,i=0){const r=[t,...e];return i&&r.length>i?r.slice(0,-1):r}var Pd=Symbol();function Dp(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Pd?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function rC(e,t,i){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),r||(r=!0,s.aborted?i():s.addEventListener("abort",i,{once:!0})),s)}),e}var Xs,hs,zn,Lf,sC=(Lf=class extends ya{constructor(){super();ie(this,Xs);ie(this,hs);ie(this,zn);G(this,zn,t=>{if(!lo&&window.addEventListener){const i=()=>t();return window.addEventListener("visibilitychange",i,!1),()=>{window.removeEventListener("visibilitychange",i)}}})}onSubscribe(){v(this,hs)||this.setEventListener(v(this,zn))}onUnsubscribe(){var t;this.hasListeners()||((t=v(this,hs))==null||t.call(this),G(this,hs,void 0))}setEventListener(t){var i;G(this,zn,t),(i=v(this,hs))==null||i.call(this),G(this,hs,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){v(this,Xs)!==t&&(G(this,Xs,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(i=>{i(t)})}isFocused(){var t;return typeof v(this,Xs)=="boolean"?v(this,Xs):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Xs=new WeakMap,hs=new WeakMap,zn=new WeakMap,Lf),Md=new sC;function Lc(){let e,t;const i=new Promise((s,n)=>{e=s,t=n});i.status="pending",i.catch(()=>{});function r(s){Object.assign(i,s),delete i.resolve,delete i.reject}return i.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},i.reject=s=>{r({status:"rejected",reason:s}),t(s)},i}var nC=Z1;function oC(){let e=[],t=0,i=l=>{l()},r=l=>{l()},s=nC;const n=l=>{t?e.push(l):s(()=>{i(l)})},o=()=>{const l=e;e=[],l.length&&s(()=>{r(()=>{l.forEach(h=>{i(h)})})})};return{batch:l=>{let h;t++;try{h=l()}finally{t--,t||o()}return h},batchCalls:l=>(...h)=>{n(()=>{l(...h)})},schedule:n,setNotifyFunction:l=>{i=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{s=l}}}var ni=oC(),Un,cs,Kn,If,aC=(If=class extends ya{constructor(){super();ie(this,Un,!0);ie(this,cs);ie(this,Kn);G(this,Kn,t=>{if(!lo&&window.addEventListener){const i=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",r)}}})}onSubscribe(){v(this,cs)||this.setEventListener(v(this,Kn))}onUnsubscribe(){var t;this.hasListeners()||((t=v(this,cs))==null||t.call(this),G(this,cs,void 0))}setEventListener(t){var i;G(this,Kn,t),(i=v(this,cs))==null||i.call(this),G(this,cs,t(this.setOnline.bind(this)))}setOnline(t){v(this,Un)!==t&&(G(this,Un,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return v(this,Un)}},Un=new WeakMap,cs=new WeakMap,Kn=new WeakMap,If),_l=new aC;function lC(e){return Math.min(1e3*2**e,3e4)}function Tp(e){return(e??"online")==="online"?_l.isOnline():!0}var Ic=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Rp(e){let t=!1,i=0,r;const s=Lc(),n=()=>s.status!=="pending",o=b=>{var g;if(!n()){const S=new Ic(b);f(S),(g=e.onCancel)==null||g.call(e,S)}},l=()=>{t=!0},h=()=>{t=!1},c=()=>Md.isFocused()&&(e.networkMode==="always"||_l.isOnline())&&e.canRun(),u=()=>Tp(e.networkMode)&&e.canRun(),d=b=>{n()||(r==null||r(),s.resolve(b))},f=b=>{n()||(r==null||r(),s.reject(b))},_=()=>new Promise(b=>{var g;r=S=>{(n()||c())&&b(S)},(g=e.onPause)==null||g.call(e)}).then(()=>{var b;r=void 0,n()||(b=e.onContinue)==null||b.call(e)}),p=()=>{if(n())return;let b;const g=i===0?e.initialPromise:void 0;try{b=g??e.fn()}catch(S){b=Promise.reject(S)}Promise.resolve(b).then(d).catch(S=>{var M;if(n())return;const x=e.retry??(lo?0:3),C=e.retryDelay??lC,w=typeof C=="function"?C(i,S):C,k=x===!0||typeof x=="number"&&i<x||typeof x=="function"&&x(i,S);if(t||!k){f(S);return}i++,(M=e.onFail)==null||M.call(e,i,S),eC(w).then(()=>c()?void 0:_()).then(()=>{t?f(S):p()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:l,continueRetry:h,canStart:u,start:()=>(u()?p():_().then(p),s)}}var Zs,Bf,Pp=(Bf=class{constructor(){ie(this,Zs)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Pc(this.gcTime)&&G(this,Zs,qs.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(lo?1/0:300*1e3))}clearGcTimeout(){v(this,Zs)&&(qs.clearTimeout(v(this,Zs)),G(this,Zs,void 0))}},Zs=new WeakMap,Bf),Qs,qn,Bi,Js,It,ra,en,tr,Ir,Nf,hC=(Nf=class extends Pp{constructor(t){super();ie(this,tr);ie(this,Qs);ie(this,qn);ie(this,Bi);ie(this,Js);ie(this,It);ie(this,ra);ie(this,en);G(this,en,!1),G(this,ra,t.defaultOptions),this.setOptions(t.options),this.observers=[],G(this,Js,t.client),G(this,Bi,v(this,Js).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,G(this,Qs,Sf(this.options)),this.state=t.state??v(this,Qs),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=v(this,It))==null?void 0:t.promise}setOptions(t){if(this.options={...v(this,ra),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=Sf(this.options);i.data!==void 0&&(this.setState(yf(i.data,i.dataUpdatedAt)),G(this,Qs,i))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&v(this,Bi).remove(this)}setData(t,i){const r=Oc(this.state.data,t,this.options);return xe(this,tr,Ir).call(this,{data:r,type:"success",dataUpdatedAt:i==null?void 0:i.updatedAt,manual:i==null?void 0:i.manual}),r}setState(t,i){xe(this,tr,Ir).call(this,{type:"setState",state:t,setStateOptions:i})}cancel(t){var r,s;const i=(r=v(this,It))==null?void 0:r.promise;return(s=v(this,It))==null||s.cancel(t),i?i.then(Fi).catch(Fi):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(v(this,Qs))}isActive(){return this.observers.some(t=>zi(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Pd||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Ds(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!xp(this.state.dataUpdatedAt,t)}onFocus(){var i;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(i=v(this,It))==null||i.continue()}onOnline(){var i;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(i=v(this,It))==null||i.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),v(this,Bi).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(i=>i!==t),this.observers.length||(v(this,It)&&(v(this,en)?v(this,It).cancel({revert:!0}):v(this,It).cancelRetry()),this.scheduleGc()),v(this,Bi).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||xe(this,tr,Ir).call(this,{type:"invalidate"})}async fetch(t,i){var h,c,u,d,f,_,p,b,g,S,x,C;if(this.state.fetchStatus!=="idle"&&((h=v(this,It))==null?void 0:h.status())!=="rejected"){if(this.state.data!==void 0&&(i!=null&&i.cancelRefetch))this.cancel({silent:!0});else if(v(this,It))return v(this,It).continueRetry(),v(this,It).promise}if(t&&this.setOptions(t),!this.options.queryFn){const w=this.observers.find(k=>k.options.queryFn);w&&this.setOptions(w.options)}const r=new AbortController,s=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(G(this,en,!0),r.signal)})},n=()=>{const w=Dp(this.options,i),M=(()=>{const B={client:v(this,Js),queryKey:this.queryKey,meta:this.meta};return s(B),B})();return G(this,en,!1),this.options.persister?this.options.persister(w,M,this):w(M)},l=(()=>{const w={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:v(this,Js),state:this.state,fetchFn:n};return s(w),w})();(c=this.options.behavior)==null||c.onFetch(l,this),G(this,qn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=l.fetchOptions)==null?void 0:u.meta))&&xe(this,tr,Ir).call(this,{type:"fetch",meta:(d=l.fetchOptions)==null?void 0:d.meta}),G(this,It,Rp({initialPromise:i==null?void 0:i.initialPromise,fn:l.fetchFn,onCancel:w=>{w instanceof Ic&&w.revert&&this.setState({...v(this,qn),fetchStatus:"idle"}),r.abort()},onFail:(w,k)=>{xe(this,tr,Ir).call(this,{type:"failed",failureCount:w,error:k})},onPause:()=>{xe(this,tr,Ir).call(this,{type:"pause"})},onContinue:()=>{xe(this,tr,Ir).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const w=await v(this,It).start();if(w===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(w),(_=(f=v(this,Bi).config).onSuccess)==null||_.call(f,w,this),(b=(p=v(this,Bi).config).onSettled)==null||b.call(p,w,this.state.error,this),w}catch(w){if(w instanceof Ic){if(w.silent)return v(this,It).promise;if(w.revert){if(this.state.data===void 0)throw w;return this.state.data}}throw xe(this,tr,Ir).call(this,{type:"error",error:w}),(S=(g=v(this,Bi).config).onError)==null||S.call(g,w,this),(C=(x=v(this,Bi).config).onSettled)==null||C.call(x,this.state.data,w,this),w}finally{this.scheduleGc()}}},Qs=new WeakMap,qn=new WeakMap,Bi=new WeakMap,Js=new WeakMap,It=new WeakMap,ra=new WeakMap,en=new WeakMap,tr=new WeakSet,Ir=function(t){const i=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Mp(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...yf(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return G(this,qn,t.manual?s:void 0),s;case"error":const n=t.error;return{...r,error:n,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=i(this.state),ni.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),v(this,Bi).notify({query:this,type:"updated",action:t})})},Nf);function Mp(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Tp(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function yf(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Sf(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,i=t!==void 0,r=i?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:i?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:i?"success":"pending",fetchStatus:"idle"}}var fi,je,sa,ai,tn,jn,Wr,ds,na,Yn,Vn,rn,sn,us,Gn,Xe,Oo,Bc,Nc,Fc,Wc,Hc,zc,Uc,Ap,Ff,cC=(Ff=class extends ya{constructor(t,i){super();ie(this,Xe);ie(this,fi);ie(this,je);ie(this,sa);ie(this,ai);ie(this,tn);ie(this,jn);ie(this,Wr);ie(this,ds);ie(this,na);ie(this,Yn);ie(this,Vn);ie(this,rn);ie(this,sn);ie(this,us);ie(this,Gn,new Set);this.options=i,G(this,fi,t),G(this,ds,null),G(this,Wr,Lc()),this.bindMethods(),this.setOptions(i)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(v(this,je).addObserver(this),wf(v(this,je),this.options)?xe(this,Xe,Oo).call(this):this.updateResult(),xe(this,Xe,Wc).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Kc(v(this,je),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Kc(v(this,je),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,xe(this,Xe,Hc).call(this),xe(this,Xe,zc).call(this),v(this,je).removeObserver(this)}setOptions(t){const i=this.options,r=v(this,je);if(this.options=v(this,fi).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof zi(this.options.enabled,v(this,je))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");xe(this,Xe,Uc).call(this),v(this,je).setOptions(this.options),i._defaulted&&!Mc(this.options,i)&&v(this,fi).getQueryCache().notify({type:"observerOptionsUpdated",query:v(this,je),observer:this});const s=this.hasListeners();s&&Cf(v(this,je),r,this.options,i)&&xe(this,Xe,Oo).call(this),this.updateResult(),s&&(v(this,je)!==r||zi(this.options.enabled,v(this,je))!==zi(i.enabled,v(this,je))||Ds(this.options.staleTime,v(this,je))!==Ds(i.staleTime,v(this,je)))&&xe(this,Xe,Bc).call(this);const n=xe(this,Xe,Nc).call(this);s&&(v(this,je)!==r||zi(this.options.enabled,v(this,je))!==zi(i.enabled,v(this,je))||n!==v(this,us))&&xe(this,Xe,Fc).call(this,n)}getOptimisticResult(t){const i=v(this,fi).getQueryCache().build(v(this,fi),t),r=this.createResult(i,t);return uC(this,r)&&(G(this,ai,r),G(this,jn,this.options),G(this,tn,v(this,je).state)),r}getCurrentResult(){return v(this,ai)}trackResult(t,i){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),i==null||i(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&v(this,Wr).status==="pending"&&v(this,Wr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){v(this,Gn).add(t)}getCurrentQuery(){return v(this,je)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const i=v(this,fi).defaultQueryOptions(t),r=v(this,fi).getQueryCache().build(v(this,fi),i);return r.fetch().then(()=>this.createResult(r,i))}fetch(t){return xe(this,Xe,Oo).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),v(this,ai)))}createResult(t,i){var j;const r=v(this,je),s=this.options,n=v(this,ai),o=v(this,tn),l=v(this,jn),c=t!==r?t.state:v(this,sa),{state:u}=t;let d={...u},f=!1,_;if(i._optimisticResults){const se=this.hasListeners(),Y=!se&&wf(t,i),N=se&&Cf(t,r,i,s);(Y||N)&&(d={...d,...Mp(u.data,t.options)}),i._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:p,errorUpdatedAt:b,status:g}=d;_=d.data;let S=!1;if(i.placeholderData!==void 0&&_===void 0&&g==="pending"){let se;n!=null&&n.isPlaceholderData&&i.placeholderData===(l==null?void 0:l.placeholderData)?(se=n.data,S=!0):se=typeof i.placeholderData=="function"?i.placeholderData((j=v(this,Vn))==null?void 0:j.state.data,v(this,Vn)):i.placeholderData,se!==void 0&&(g="success",_=Oc(n==null?void 0:n.data,se,i),f=!0)}if(i.select&&_!==void 0&&!S)if(n&&_===(o==null?void 0:o.data)&&i.select===v(this,na))_=v(this,Yn);else try{G(this,na,i.select),_=i.select(_),_=Oc(n==null?void 0:n.data,_,i),G(this,Yn,_),G(this,ds,null)}catch(se){G(this,ds,se)}v(this,ds)&&(p=v(this,ds),_=v(this,Yn),b=Date.now(),g="error");const x=d.fetchStatus==="fetching",C=g==="pending",w=g==="error",k=C&&x,M=_!==void 0,K={status:g,fetchStatus:d.fetchStatus,isPending:C,isSuccess:g==="success",isError:w,isInitialLoading:k,isLoading:k,data:_,dataUpdatedAt:d.dataUpdatedAt,error:p,errorUpdatedAt:b,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>c.dataUpdateCount||d.errorUpdateCount>c.errorUpdateCount,isFetching:x,isRefetching:x&&!C,isLoadingError:w&&!M,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:w&&M,isStale:Ad(t,i),refetch:this.refetch,promise:v(this,Wr),isEnabled:zi(i.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const se=K.data!==void 0,Y=K.status==="error"&&!se,N=O=>{Y?O.reject(K.error):se&&O.resolve(K.data)},L=()=>{const O=G(this,Wr,K.promise=Lc());N(O)},T=v(this,Wr);switch(T.status){case"pending":t.queryHash===r.queryHash&&N(T);break;case"fulfilled":(Y||K.data!==T.value)&&L();break;case"rejected":(!Y||K.error!==T.reason)&&L();break}}return K}updateResult(){const t=v(this,ai),i=this.createResult(v(this,je),this.options);if(G(this,tn,v(this,je).state),G(this,jn,this.options),v(this,tn).data!==void 0&&G(this,Vn,v(this,je)),Mc(i,t))return;G(this,ai,i);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,n=typeof s=="function"?s():s;if(n==="all"||!n&&!v(this,Gn).size)return!0;const o=new Set(n??v(this,Gn));return this.options.throwOnError&&o.add("error"),Object.keys(v(this,ai)).some(l=>{const h=l;return v(this,ai)[h]!==t[h]&&o.has(h)})};xe(this,Xe,Ap).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&xe(this,Xe,Wc).call(this)}},fi=new WeakMap,je=new WeakMap,sa=new WeakMap,ai=new WeakMap,tn=new WeakMap,jn=new WeakMap,Wr=new WeakMap,ds=new WeakMap,na=new WeakMap,Yn=new WeakMap,Vn=new WeakMap,rn=new WeakMap,sn=new WeakMap,us=new WeakMap,Gn=new WeakMap,Xe=new WeakSet,Oo=function(t){xe(this,Xe,Uc).call(this);let i=v(this,je).fetch(this.options,t);return t!=null&&t.throwOnError||(i=i.catch(Fi)),i},Bc=function(){xe(this,Xe,Hc).call(this);const t=Ds(this.options.staleTime,v(this,je));if(lo||v(this,ai).isStale||!Pc(t))return;const r=xp(v(this,ai).dataUpdatedAt,t)+1;G(this,rn,qs.setTimeout(()=>{v(this,ai).isStale||this.updateResult()},r))},Nc=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(v(this,je)):this.options.refetchInterval)??!1},Fc=function(t){xe(this,Xe,zc).call(this),G(this,us,t),!(lo||zi(this.options.enabled,v(this,je))===!1||!Pc(v(this,us))||v(this,us)===0)&&G(this,sn,qs.setInterval(()=>{(this.options.refetchIntervalInBackground||Md.isFocused())&&xe(this,Xe,Oo).call(this)},v(this,us)))},Wc=function(){xe(this,Xe,Bc).call(this),xe(this,Xe,Fc).call(this,xe(this,Xe,Nc).call(this))},Hc=function(){v(this,rn)&&(qs.clearTimeout(v(this,rn)),G(this,rn,void 0))},zc=function(){v(this,sn)&&(qs.clearInterval(v(this,sn)),G(this,sn,void 0))},Uc=function(){const t=v(this,fi).getQueryCache().build(v(this,fi),this.options);if(t===v(this,je))return;const i=v(this,je);G(this,je,t),G(this,sa,t.state),this.hasListeners()&&(i==null||i.removeObserver(this),t.addObserver(this))},Ap=function(t){ni.batch(()=>{t.listeners&&this.listeners.forEach(i=>{i(v(this,ai))}),v(this,fi).getQueryCache().notify({query:v(this,je),type:"observerResultsUpdated"})})},Ff);function dC(e,t){return zi(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function wf(e,t){return dC(e,t)||e.state.data!==void 0&&Kc(e,t,t.refetchOnMount)}function Kc(e,t,i){if(zi(t.enabled,e)!==!1&&Ds(t.staleTime,e)!=="static"){const r=typeof i=="function"?i(e):i;return r==="always"||r!==!1&&Ad(e,t)}return!1}function Cf(e,t,i,r){return(e!==t||zi(r.enabled,e)===!1)&&(!i.suspense||e.state.status!=="error")&&Ad(e,i)}function Ad(e,t){return zi(t.enabled,e)!==!1&&e.isStaleByTime(Ds(t.staleTime,e))}function uC(e,t){return!Mc(e.getCurrentResult(),t)}function kf(e){return{onFetch:(t,i)=>{var u,d,f,_,p;const r=t.options,s=(f=(d=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:f.direction,n=((_=t.state.data)==null?void 0:_.pages)||[],o=((p=t.state.data)==null?void 0:p.pageParams)||[];let l={pages:[],pageParams:[]},h=0;const c=async()=>{let b=!1;const g=C=>{rC(C,()=>t.signal,()=>b=!0)},S=Dp(t.options,t.fetchOptions),x=async(C,w,k)=>{if(b)return Promise.reject();if(w==null&&C.pages.length)return Promise.resolve(C);const B=(()=>{const Y={client:t.client,queryKey:t.queryKey,pageParam:w,direction:k?"backward":"forward",meta:t.options.meta};return g(Y),Y})(),K=await S(B),{maxPages:j}=t.options,se=k?iC:tC;return{pages:se(C.pages,K,j),pageParams:se(C.pageParams,w,j)}};if(s&&n.length){const C=s==="backward",w=C?fC:xf,k={pages:n,pageParams:o},M=w(r,k);l=await x(k,M,C)}else{const C=e??n.length;do{const w=h===0?o[0]??r.initialPageParam:xf(r,l);if(h>0&&w==null)break;l=await x(l,w),h++}while(h<C)}return l};t.options.persister?t.fetchFn=()=>{var b,g;return(g=(b=t.options).persister)==null?void 0:g.call(b,c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},i)}:t.fetchFn=c}}}function xf(e,{pages:t,pageParams:i}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,i[r],i):void 0}function fC(e,{pages:t,pageParams:i}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,i[0],i):void 0}var oa,wr,ri,nn,Cr,ss,Wf,_C=(Wf=class extends Pp{constructor(t){super();ie(this,Cr);ie(this,oa);ie(this,wr);ie(this,ri);ie(this,nn);G(this,oa,t.client),this.mutationId=t.mutationId,G(this,ri,t.mutationCache),G(this,wr,[]),this.state=t.state||vC(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){v(this,wr).includes(t)||(v(this,wr).push(t),this.clearGcTimeout(),v(this,ri).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){G(this,wr,v(this,wr).filter(i=>i!==t)),this.scheduleGc(),v(this,ri).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){v(this,wr).length||(this.state.status==="pending"?this.scheduleGc():v(this,ri).remove(this))}continue(){var t;return((t=v(this,nn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,l,h,c,u,d,f,_,p,b,g,S,x,C,w,k,M,B;const i=()=>{xe(this,Cr,ss).call(this,{type:"continue"})},r={client:v(this,oa),meta:this.options.meta,mutationKey:this.options.mutationKey};G(this,nn,Rp({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(K,j)=>{xe(this,Cr,ss).call(this,{type:"failed",failureCount:K,error:j})},onPause:()=>{xe(this,Cr,ss).call(this,{type:"pause"})},onContinue:i,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>v(this,ri).canRun(this)}));const s=this.state.status==="pending",n=!v(this,nn).canStart();try{if(s)i();else{xe(this,Cr,ss).call(this,{type:"pending",variables:t,isPaused:n}),v(this,ri).config.onMutate&&await v(this,ri).config.onMutate(t,this,r);const j=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t,r));j!==this.state.context&&xe(this,Cr,ss).call(this,{type:"pending",context:j,variables:t,isPaused:n})}const K=await v(this,nn).start();return await((c=(h=v(this,ri).config).onSuccess)==null?void 0:c.call(h,K,t,this.state.context,this,r)),await((d=(u=this.options).onSuccess)==null?void 0:d.call(u,K,t,this.state.context,r)),await((_=(f=v(this,ri).config).onSettled)==null?void 0:_.call(f,K,null,this.state.variables,this.state.context,this,r)),await((b=(p=this.options).onSettled)==null?void 0:b.call(p,K,null,t,this.state.context,r)),xe(this,Cr,ss).call(this,{type:"success",data:K}),K}catch(K){try{await((S=(g=v(this,ri).config).onError)==null?void 0:S.call(g,K,t,this.state.context,this,r))}catch(j){Promise.reject(j)}try{await((C=(x=this.options).onError)==null?void 0:C.call(x,K,t,this.state.context,r))}catch(j){Promise.reject(j)}try{await((k=(w=v(this,ri).config).onSettled)==null?void 0:k.call(w,void 0,K,this.state.variables,this.state.context,this,r))}catch(j){Promise.reject(j)}try{await((B=(M=this.options).onSettled)==null?void 0:B.call(M,void 0,K,t,this.state.context,r))}catch(j){Promise.reject(j)}throw xe(this,Cr,ss).call(this,{type:"error",error:K}),K}finally{v(this,ri).runNext(this)}}},oa=new WeakMap,wr=new WeakMap,ri=new WeakMap,nn=new WeakMap,Cr=new WeakSet,ss=function(t){const i=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=i(this.state),ni.batch(()=>{v(this,wr).forEach(r=>{r.onMutationUpdate(t)}),v(this,ri).notify({mutation:this,type:"updated",action:t})})},Wf);function vC(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Hr,ir,aa,Hf,pC=(Hf=class extends ya{constructor(t={}){super();ie(this,Hr);ie(this,ir);ie(this,aa);this.config=t,G(this,Hr,new Set),G(this,ir,new Map),G(this,aa,0)}build(t,i,r){const s=new _C({client:t,mutationCache:this,mutationId:++xa(this,aa)._,options:t.defaultMutationOptions(i),state:r});return this.add(s),s}add(t){v(this,Hr).add(t);const i=Na(t);if(typeof i=="string"){const r=v(this,ir).get(i);r?r.push(t):v(this,ir).set(i,[t])}this.notify({type:"added",mutation:t})}remove(t){if(v(this,Hr).delete(t)){const i=Na(t);if(typeof i=="string"){const r=v(this,ir).get(i);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&v(this,ir).delete(i)}}this.notify({type:"removed",mutation:t})}canRun(t){const i=Na(t);if(typeof i=="string"){const r=v(this,ir).get(i),s=r==null?void 0:r.find(n=>n.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const i=Na(t);if(typeof i=="string"){const s=(r=v(this,ir).get(i))==null?void 0:r.find(n=>n!==t&&n.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ni.batch(()=>{v(this,Hr).forEach(t=>{this.notify({type:"removed",mutation:t})}),v(this,Hr).clear(),v(this,ir).clear()})}getAll(){return Array.from(v(this,Hr))}find(t){const i={exact:!0,...t};return this.getAll().find(r=>gf(i,r))}findAll(t={}){return this.getAll().filter(i=>gf(t,i))}notify(t){ni.batch(()=>{this.listeners.forEach(i=>{i(t)})})}resumePausedMutations(){const t=this.getAll().filter(i=>i.state.isPaused);return ni.batch(()=>Promise.all(t.map(i=>i.continue().catch(Fi))))}},Hr=new WeakMap,ir=new WeakMap,aa=new WeakMap,Hf);function Na(e){var t;return(t=e.options.scope)==null?void 0:t.id}var kr,zf,gC=(zf=class extends ya{constructor(t={}){super();ie(this,kr);this.config=t,G(this,kr,new Map)}build(t,i,r){const s=i.queryKey,n=i.queryHash??Rd(s,i);let o=this.get(n);return o||(o=new hC({client:t,queryKey:s,queryHash:n,options:t.defaultQueryOptions(i),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){v(this,kr).has(t.queryHash)||(v(this,kr).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const i=v(this,kr).get(t.queryHash);i&&(t.destroy(),i===t&&v(this,kr).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ni.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return v(this,kr).get(t)}getAll(){return[...v(this,kr).values()]}find(t){const i={exact:!0,...t};return this.getAll().find(r=>pf(i,r))}findAll(t={}){const i=this.getAll();return Object.keys(t).length>0?i.filter(r=>pf(t,r)):i}notify(t){ni.batch(()=>{this.listeners.forEach(i=>{i(t)})})}onFocus(){ni.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ni.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},kr=new WeakMap,zf),ut,fs,_s,$n,Xn,vs,Zn,Qn,Uf,Op=(Uf=class{constructor(e={}){ie(this,ut);ie(this,fs);ie(this,_s);ie(this,$n);ie(this,Xn);ie(this,vs);ie(this,Zn);ie(this,Qn);G(this,ut,e.queryCache||new gC),G(this,fs,e.mutationCache||new pC),G(this,_s,e.defaultOptions||{}),G(this,$n,new Map),G(this,Xn,new Map),G(this,vs,0)}mount(){xa(this,vs)._++,v(this,vs)===1&&(G(this,Zn,Md.subscribe(async e=>{e&&(await this.resumePausedMutations(),v(this,ut).onFocus())})),G(this,Qn,_l.subscribe(async e=>{e&&(await this.resumePausedMutations(),v(this,ut).onOnline())})))}unmount(){var e,t;xa(this,vs)._--,v(this,vs)===0&&((e=v(this,Zn))==null||e.call(this),G(this,Zn,void 0),(t=v(this,Qn))==null||t.call(this),G(this,Qn,void 0))}isFetching(e){return v(this,ut).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return v(this,fs).findAll({...e,status:"pending"}).length}getQueryData(e){var i;const t=this.defaultQueryOptions({queryKey:e});return(i=v(this,ut).get(t.queryHash))==null?void 0:i.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),i=v(this,ut).build(this,t),r=i.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&i.isStaleByTime(Ds(t.staleTime,i))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return v(this,ut).findAll(e).map(({queryKey:t,state:i})=>{const r=i.data;return[t,r]})}setQueryData(e,t,i){const r=this.defaultQueryOptions({queryKey:e}),s=v(this,ut).get(r.queryHash),n=s==null?void 0:s.state.data,o=Q1(t,n);if(o!==void 0)return v(this,ut).build(this,r).setData(o,{...i,manual:!0})}setQueriesData(e,t,i){return ni.batch(()=>v(this,ut).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,i)]))}getQueryState(e){var i;const t=this.defaultQueryOptions({queryKey:e});return(i=v(this,ut).get(t.queryHash))==null?void 0:i.state}removeQueries(e){const t=v(this,ut);ni.batch(()=>{t.findAll(e).forEach(i=>{t.remove(i)})})}resetQueries(e,t){const i=v(this,ut);return ni.batch(()=>(i.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const i={revert:!0,...t},r=ni.batch(()=>v(this,ut).findAll(e).map(s=>s.cancel(i)));return Promise.all(r).then(Fi).catch(Fi)}invalidateQueries(e,t={}){return ni.batch(()=>(v(this,ut).findAll(e).forEach(i=>{i.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const i={...t,cancelRefetch:t.cancelRefetch??!0},r=ni.batch(()=>v(this,ut).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let n=s.fetch(void 0,i);return i.throwOnError||(n=n.catch(Fi)),s.state.fetchStatus==="paused"?Promise.resolve():n}));return Promise.all(r).then(Fi)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const i=v(this,ut).build(this,t);return i.isStaleByTime(Ds(t.staleTime,i))?i.fetch(t):Promise.resolve(i.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Fi).catch(Fi)}fetchInfiniteQuery(e){return e.behavior=kf(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Fi).catch(Fi)}ensureInfiniteQueryData(e){return e.behavior=kf(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return _l.isOnline()?v(this,fs).resumePausedMutations():Promise.resolve()}getQueryCache(){return v(this,ut)}getMutationCache(){return v(this,fs)}getDefaultOptions(){return v(this,_s)}setDefaultOptions(e){G(this,_s,e)}setQueryDefaults(e,t){v(this,$n).set(Zo(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...v(this,$n).values()],i={};return t.forEach(r=>{Qo(e,r.queryKey)&&Object.assign(i,r.defaultOptions)}),i}setMutationDefaults(e,t){v(this,Xn).set(Zo(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...v(this,Xn).values()],i={};return t.forEach(r=>{Qo(e,r.mutationKey)&&Object.assign(i,r.defaultOptions)}),i}defaultQueryOptions(e){if(e._defaulted)return e;const t={...v(this,_s).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Rd(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Pd&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...v(this,_s).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){v(this,ut).clear(),v(this,fs).clear()}},ut=new WeakMap,fs=new WeakMap,_s=new WeakMap,$n=new WeakMap,Xn=new WeakMap,vs=new WeakMap,Zn=new WeakMap,Qn=new WeakMap,Uf);const Lp=Symbol("QueryClient"),mC=()=>{const e=Jf(Lp);if(!e)throw new Error("No QueryClient was found in Svelte context. Did you forget to wrap your component with QueryClientProvider?");return e},bC=e=>{Eg(Lp,e)},yC=Symbol("isRestoring"),SC=()=>{try{return Jf(yC)??{current:!1}}catch{return{current:!1}}};function wC(){return SC()}function CC(e){return mC()}var kC=["forEach","isDisjointFrom","isSubsetOf","isSupersetOf"],xC=["difference","intersection","symmetricDifference","union"],Ef=!1,Jn,rr,ps,ml,ho,Ip,Bp;const bl=class bl extends Set{constructor(i){super();ie(this,ho);ie(this,Jn,new Map);ie(this,rr,W(0));ie(this,ps,W(0));ie(this,ml,Yr||-1);if(i){for(var r of i)super.add(r);v(this,ps).v=super.size}Ef||xe(this,ho,Bp).call(this)}has(i){var r=super.has(i),s=v(this,Jn),n=s.get(i);if(n===void 0){if(!r)return a(v(this,rr)),!1;n=xe(this,ho,Ip).call(this,!0),s.set(i,n)}return a(n),r}add(i){return super.has(i)||(super.add(i),m(v(this,ps),super.size),Cs(v(this,rr))),this}delete(i){var r=super.delete(i),s=v(this,Jn),n=s.get(i);return n!==void 0&&(s.delete(i),m(n,!1)),r&&(m(v(this,ps),super.size),Cs(v(this,rr))),r}clear(){if(super.size!==0){super.clear();var i=v(this,Jn);for(var r of i.values())m(r,!1);i.clear(),m(v(this,ps),0),Cs(v(this,rr))}}keys(){return this.values()}values(){return a(v(this,rr)),super.values()}entries(){return a(v(this,rr)),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return a(v(this,ps))}};Jn=new WeakMap,rr=new WeakMap,ps=new WeakMap,ml=new WeakMap,ho=new WeakSet,Ip=function(i){return Yr===v(this,ml)?W(i):Ts(i)},Bp=function(){Ef=!0;var i=bl.prototype,r=Set.prototype;for(const s of kC)i[s]=function(...n){return a(v(this,rr)),r[s].apply(this,n)};for(const s of xC)i[s]=function(...n){a(v(this,rr));var o=r[s].apply(this,n);return new bl(o)}};let qc=bl;function EC(e){const t=Array.isArray(e)?[]:{},i=new qc,r=new Proxy(t,{set(n,o,l,h){if(i.delete(o),o in n)return Reflect.set(n,o,l,h);let c=W(l);return Object.defineProperty(n,o,{configurable:!0,enumerable:!0,get:()=>a(c)&&TC(a(c))?a(c)():a(c),set:u=>{m(c,u)}}),!0},has:(n,o)=>i.has(o)?!1:o in n,ownKeys(n){return Reflect.ownKeys(n).filter(o=>!i.has(o))},getOwnPropertyDescriptor(n,o){if(!i.has(o))return Reflect.getOwnPropertyDescriptor(n,o)},deleteProperty(n,o){return o in n?(n[o]=void 0,i.add(o),Array.isArray(n)&&n.length--,!0):!1}});function s(n){const o=Object.keys(r),l=Object.keys(n),h=o.filter(c=>!l.includes(c));for(const c of h)delete r[c];for(const c of l)r[c]=DC(()=>n[c])}return s(e),[r,s]}const Np=Symbol("LazyValue");function DC(e){return e[Np]=!0,e}function TC(e){return!!e[Np]}function RC(e,t){switch(e){case"post":cr(t);break;case"pre":tm(t);break}}const gh=(e,t,i)=>{let r=!1,s=Array.isArray(e)?[]:void 0;RC(t,()=>{const n=Array.isArray(e)?e.map(l=>l()):e();if(!r){r=!0,s=n;return}const o=Xr(()=>i(n,s));return s=n,o})};function PC(e,t,i){const r=de(()=>CC()),s=wC(),n=de(()=>{const u=a(r).defaultQueryOptions(e());return u._optimisticResults=s.current?"isRestoring":"optimistic",u});let o=W($e(new t(a(r),a(n))));gh(()=>a(r),"pre",()=>{m(o,new t(a(r),a(n)),!0)});function l(){const u=a(o).getOptimisticResult(a(n));return a(n).notifyOnChangeProps?u:a(o).trackResult(u)}const[h,c]=EC(l());return cr(()=>{const u=s.current?()=>{}:a(o).subscribe(()=>c(l()));return a(o).updateResult(),u}),gh(()=>a(n),"pre",()=>{a(o).setOptions(a(n))}),gh(()=>[a(n),a(o)],"pre",()=>{c(l())}),h}function vl(e,t){return PC(e,cC)}function MC(e,t){_t(t,!0);const i=ur(t,"client",19,()=>new Op);fo(()=>{i().mount()}),bC(i()),Om(()=>{i().unmount()});var r=Vr(),s=kt(r);ym(s,()=>t.children),I(e,r),vt()}var AC=F('<div class="branch-error svelte-1ogsozk"> </div>'),OC=F('<div class="branch-loading svelte-1ogsozk">Loading...</div>'),LC=F('<div class="branch-empty svelte-1ogsozk">No branches match</div>'),IC=F('<span class="branch-check svelte-1ogsozk">✓</span>'),BC=F('<span class="branch-check branch-check--empty svelte-1ogsozk"></span>'),NC=F('<span class="branch-spinner svelte-1ogsozk">…</span>'),FC=F('<li role="option"><!> <span class="branch-option-name svelte-1ogsozk"> </span> <!></li>'),WC=F('<ul class="branch-list svelte-1ogsozk"></ul>'),HC=F('<div class="branch-dropdown svelte-1ogsozk" role="listbox" tabindex="-1" aria-label="Branches"><div class="branch-filter-wrap svelte-1ogsozk"><input type="text" class="branch-filter svelte-1ogsozk" placeholder="Filter branches..." aria-label="Filter branches"/></div> <!> <!></div>'),zC=F('<div class="branch-switcher svelte-1ogsozk"><button class="branch-trigger svelte-1ogsozk" aria-label="Switch branch" aria-haspopup="listbox"><span class="branch-icon svelte-1ogsozk">⑂</span> <span class="branch-name svelte-1ogsozk"> </span> <svg class="branch-caret svelte-1ogsozk" width="10" height="6" viewBox="0 0 10 6" aria-hidden="true"><path d="M1 1l4 4 4-4" stroke="currentColor" fill="none" stroke-width="1.5" stroke-linecap="round"></path></svg></button> <!></div>');function UC(e,t){_t(t,!0);let i=W(!1),r=W(""),s=W(null),n=W(null),o=W(null),l=W(null);const h=vl(()=>({queryKey:["branches",t.workspacePath],queryFn:()=>od(t.workspacePath),staleTime:3e4,enabled:a(i)}));let c=de(()=>{const k=h.data??[];if(!a(r).trim())return k;const M=a(r).toLowerCase();return k.filter(B=>B.toLowerCase().includes(M))});function u(){m(i,!0),m(r,""),m(l,null),requestAnimationFrame(()=>{var k;return(k=a(n))==null?void 0:k.focus()})}function d(){m(i,!1),m(r,"")}async function f(k){if(k===t.currentBranch){d();return}m(o,k,!0),m(l,null);try{const M=await Ym(t.workspacePath,k);M.success?(d(),t.onSwitch(k)):m(l,M.error??"Failed to switch branch",!0)}catch{m(l,"Failed to switch branch")}finally{m(o,null)}}function _(k){a(i)&&a(s)&&document.contains(k.target)&&!a(s).contains(k.target)&&d()}function p(k){k.key==="Escape"&&a(i)&&(d(),k.stopPropagation())}var b=zC();lr("click",Xa,_);var g=y(b),S=D(y(g),2),x=y(S),C=D(g,2);{var w=k=>{var M=HC(),B=y(M),K=y(B);it(K,O=>m(n,O),()=>a(n));var j=D(B,2);{var se=O=>{var U=AC(),R=y(U);le(()=>oe(R,a(l))),I(O,U)};re(j,O=>{a(l)&&O(se)})}var Y=D(j,2);{var N=O=>{var U=OC();I(O,U)},L=O=>{var U=LC();I(O,U)},T=O=>{var U=WC();Zt(U,20,()=>a(c),R=>R,(R,E)=>{var J=FC();let te;var pe=y(J);{var ke=ye=>{var ge=IC();I(ye,ge)},ue=ye=>{var ge=BC();I(ye,ge)};re(pe,ye=>{E===t.currentBranch?ye(ke):ye(ue,!1)})}var Ce=D(pe,2),De=y(Ce),Te=D(Ce,2);{var ve=ye=>{var ge=NC();I(ye,ge)};re(Te,ye=>{a(o)===E&&ye(ve)})}le(()=>{te=tt(J,1,"branch-option svelte-1ogsozk",null,te,{"branch-current":E===t.currentBranch,"branch-switching":a(o)===E}),ze(J,"aria-selected",E===t.currentBranch),oe(De,E)}),V("mousedown",J,()=>f(E)),I(R,J)}),I(O,U)};re(Y,O=>{h.isLoading?O(N):a(c).length===0?O(L,1):O(T,!1)})}V("keydown",M,p),V("keydown",K,p),Ui(K,()=>a(r),O=>m(r,O)),I(k,M)};re(C,k=>{a(i)&&k(w)})}it(b,k=>m(s,k),()=>a(s)),le(()=>{ze(g,"aria-expanded",a(i)),oe(x,t.currentBranch)}),V("click",g,u),I(e,b),vt()}pt(["click","keydown","mousedown"]);var KC=F('<span class="target-branch svelte-1shtc4l" aria-label="target branch"><span class="target-sep svelte-1shtc4l">›</span> <span class="target-name svelte-1shtc4l"> </span></span>'),qC=F('<div class="bar-middle svelte-1shtc4l" aria-label="pull request"><a class="pr-link svelte-1shtc4l" target="_blank" rel="noopener noreferrer"> <svg class="pr-ext-icon svelte-1shtc4l" width="10" height="10" viewBox="0 0 10 10" aria-hidden="true"><path d="M1 9L9 1M9 1H4M9 1V6" stroke="currentColor" fill="none" stroke-width="1.5" stroke-linecap="round"></path></svg></a></div> <span class="diff-stats svelte-1shtc4l"><span class="diff-add svelte-1shtc4l"> </span> <span class="diff-del svelte-1shtc4l"> </span></span>',1),jC=F('<span class="bar-loading svelte-1shtc4l">…</span>'),YC=F('<button class="action-btn action-btn--secondary svelte-1shtc4l"> </button>'),VC=F("<button> </button>"),GC=F("<!> <!>",1),$C=F('<div><div class="bar-left svelte-1shtc4l"><!> <!></div> <!> <div class="bar-right svelte-1shtc4l"><!></div></div>');function XC(e,t){_t(t,!0);let i=W($e(t.branchName));cr(()=>{m(i,t.branchName,!0)}),cr(()=>{!t.branchName&&t.workspacePath&&jm(t.workspacePath).then(Y=>{Y&&m(i,Y,!0)})});const r=vl(()=>({queryKey:["pr",t.workspacePath,a(i)],queryFn:()=>qm(t.workspacePath,a(i)),staleTime:6e4,refetchOnWindowFocus:!0})),s=vl(()=>{var Y;return{queryKey:["ci-status",t.workspacePath,a(i)],queryFn:()=>Km(t.workspacePath,a(i)),staleTime:3e4,refetchOnWindowFocus:!0,enabled:((Y=r.data)==null?void 0:Y.state)==="OPEN"}});cr(()=>{t.sessionId&&(r.refetch(),s.refetch())});let n=de(()=>r.data??null),o=de(()=>s.data??null),l=de(()=>{var Y,N,L,T,O,U;return{commitsAhead:a(n)?1:0,prState:a(n)?a(n).isDraft?"DRAFT":a(n).state:null,ciPassing:((Y=a(o))==null?void 0:Y.passing)??0,ciFailing:((N=a(o))==null?void 0:N.failing)??0,ciPending:((L=a(o))==null?void 0:L.pending)??0,ciTotal:((T=a(o))==null?void 0:T.total)??0,mergeable:((O=a(n))==null?void 0:O.mergeable)??null,unresolvedCommentCount:((U=a(n))==null?void 0:U.unresolvedCommentCount)??0}}),h=de(()=>dd(a(l))),c=de(()=>Lb(a(h),a(l))),u=de(()=>pv(a(h).color)),d=de(()=>gv(a(h).color)),f=de(()=>a(h).type!=="none");function _(Y=a(h)){var T,O,U,R;const N={branchName:a(i),baseBranch:((T=a(n))==null?void 0:T.baseRefName)??"",prNumber:((O=a(n))==null?void 0:O.number)??0,unresolvedCommentCount:((U=a(n))==null?void 0:U.unresolvedCommentCount)??0},L=vv(Y,N);L!==null?t.sessionId&&ks(L+"\r"):(R=t.onArchive)==null||R.call(t)}function p(Y){m(i,Y,!0)}var b=$C();let g;var S=y(b),x=y(S);UC(x,{get workspacePath(){return t.workspacePath},get currentBranch(){return a(i)},onSwitch:p});var C=D(x,2);{var w=Y=>{var N=KC(),L=D(y(N),2),T=y(L);le(()=>oe(T,a(n).baseRefName)),I(Y,N)};re(C,Y=>{var N;(N=a(n))!=null&&N.baseRefName&&Y(w)})}var k=D(S,2);{var M=Y=>{var N=qC(),L=kt(N),T=y(L),O=y(T),U=D(L,2),R=y(U),E=y(R),J=D(R,2),te=y(J);le(()=>{ze(T,"href",a(n).url),ze(T,"aria-label",`PR #${a(n).number??""}: ${a(n).title??""}`),oe(O,`PR #${a(n).number??""} `),oe(E,`+${a(n).additions??""}`),oe(te,`-${a(n).deletions??""}`)}),I(Y,N)};re(k,Y=>{a(n)&&Y(M)})}var B=D(k,2),K=y(B);{var j=Y=>{var N=jC();I(Y,N)},se=Y=>{var N=GC(),L=kt(N);{var T=R=>{var E=YC(),J=y(E);le(()=>{ze(E,"aria-label",a(c).label),oe(J,a(c).label)}),V("click",E,()=>_(a(c))),I(R,E)};re(L,R=>{a(c)&&R(T)})}var O=D(L,2);{var U=R=>{var E=VC();let J,te;var pe=y(E);le(()=>{J=tt(E,1,"action-btn svelte-1shtc4l",null,J,{"action-btn--dark-text":a(d),"action-btn--disabled":a(h).type==="checks-running"}),E.disabled=a(h).type==="checks-running",ze(E,"aria-label",a(h).label),te=uo(E,"",te,{"--action-color":a(u)}),oe(pe,a(h).label)}),V("click",E,()=>_()),I(R,E)};re(O,R=>{a(f)&&R(U)})}I(Y,N)};re(K,Y=>{r.isLoading?Y(j):Y(se,!1)})}le(()=>{var Y,N;return g=tt(b,1,"pr-top-bar svelte-1shtc4l",null,g,{"bar-merged":((Y=a(n))==null?void 0:Y.state)==="MERGED","bar-conflicts":((N=a(n))==null?void 0:N.mergeable)==="CONFLICTING"})}),I(e,b),vt()}pt(["click"]);var ZC=F('<button role="tab"><span class="tab-icon svelte-3dfyyn" aria-hidden="true"> </span> <span class="tab-name svelte-3dfyyn"> </span> <span class="tab-close svelte-3dfyyn" role="button">×</span></button>'),QC=F('<div class="new-menu svelte-3dfyyn" role="menu" tabindex="-1"><button class="new-menu-item svelte-3dfyyn" role="menuitem"><span class="new-menu-icon svelte-3dfyyn">🤖</span> New Claude Session</button> <button class="new-menu-item svelte-3dfyyn" role="menuitem"><span class="new-menu-icon svelte-3dfyyn">🖥</span> New Terminal</button></div>'),JC=F('<div class="session-tab-bar svelte-3dfyyn" role="tablist" aria-label="Sessions"><div class="tabs-scroll svelte-3dfyyn"></div> <div class="new-btn-wrap svelte-3dfyyn"><button class="tab-new svelte-3dfyyn" aria-label="New session" aria-haspopup="menu">+</button> <!></div></div>');function ek(e,t){_t(t,!0);let i=W(!1),r=W(null);function s(x){return x.type==="terminal"?"🖥":"🤖"}function n(x,C){x.stopPropagation(),t.onCloseSession(C)}function o(x,C){(x.key==="Enter"||x.key===" ")&&(x.stopPropagation(),t.onCloseSession(C))}function l(){m(i,!a(i))}function h(){m(i,!1),t.onNewSession()}function c(){m(i,!1),t.onNewTerminal()}function u(x){var C;a(i)&&a(r)&&document.contains(x.target)&&!((C=a(r).closest(".new-btn-wrap"))!=null&&C.contains(x.target))&&m(i,!1)}function d(x){var C;x.key==="Escape"&&a(i)&&(m(i,!1),(C=a(r))==null||C.focus())}var f=JC();lr("click",Xa,u);var _=y(f);Zt(_,21,()=>t.sessions,x=>x.id,(x,C)=>{const w=de(()=>a(C).id===t.activeSessionId);var k=ZC();let M;var B=y(k),K=y(B),j=D(B,2),se=y(j),Y=D(j,2);le(N=>{M=tt(k,1,"tab svelte-3dfyyn",null,M,{"tab--active":a(w)}),ze(k,"aria-selected",a(w)),ze(k,"aria-label",a(C).displayName||a(C).id),ze(k,"tabindex",a(w)?0:-1),oe(K,N),oe(se,a(C).displayName||a(C).repoName||a(C).id),ze(Y,"aria-label",`Close ${(a(C).displayName||a(C).id)??""}`)},[()=>s(a(C))]),V("click",k,()=>t.onSelectSession(a(C).id)),V("click",Y,N=>n(N,a(C).id)),V("keydown",Y,N=>o(N,a(C).id)),I(x,k)});var p=D(_,2),b=y(p);it(b,x=>m(r,x),()=>a(r));var g=D(b,2);{var S=x=>{var C=QC(),w=y(C),k=D(w,2);V("keydown",C,d),V("click",w,h),V("click",k,c),I(x,C)};re(g,x=>{a(i)&&x(S)})}le(()=>ze(b,"aria-expanded",a(i))),V("click",b,l),V("keydown",b,d),I(e,f),vt()}pt(["click","keydown"]);var tk=F('<div class="non-git-notice svelte-bvvs2r"><span class="non-git-msg svelte-bvvs2r">Not a git repository</span></div>'),ik=F('<div class="pr-row skeleton svelte-bvvs2r"><div class="skeleton-line skeleton-title svelte-bvvs2r"></div> <div class="skeleton-line skeleton-meta svelte-bvvs2r"></div></div>'),rk=F('<div class="scroll-container svelte-bvvs2r"><div class="pr-list svelte-bvvs2r"></div></div>'),sk=F('<div class="section-message svelte-bvvs2r">Could not load pull requests</div>'),nk=F('<div class="section-message info svelte-bvvs2r">Install GitHub CLI for PR tracking — <a href="https://cli.github.com" target="_blank" rel="noopener noreferrer" class="svelte-bvvs2r">cli.github.com</a></div>'),ok=F('<div class="section-message svelte-bvvs2r">No open pull requests</div>'),ak=F('<input class="pr-search svelte-bvvs2r" type="text" placeholder="Filter PRs by title, number, or branch..."/>'),lk=F('<button class="pr-action-pill pr-conflict-pill svelte-bvvs2r" title="Open worktree and fix merge conflicts">Fix Conflicts</button>'),hk=F('<a class="pr-action-pill pr-merge-pill svelte-bvvs2r" target="_blank" rel="noopener noreferrer" title="Ready to merge on GitHub">Merge</a>'),ck=F("<button> </button>"),dk=F('<div class="pr-row svelte-bvvs2r"><div class="pr-row-left svelte-bvvs2r"><div class="pr-row-title-line svelte-bvvs2r"><span></span> <a class="pr-title-link svelte-bvvs2r" target="_blank" rel="noopener noreferrer"> </a></div> <div class="pr-row-meta svelte-bvvs2r"><span class="pr-num svelte-bvvs2r"> </span> <span class="pr-sep svelte-bvvs2r">·</span> <span class="pr-role svelte-bvvs2r"> </span> <span class="pr-sep svelte-bvvs2r">·</span> <span class="pr-time svelte-bvvs2r"> </span></div></div> <div class="pr-row-actions svelte-bvvs2r"><button class="pr-session-btn svelte-bvvs2r" title="Open session on this branch">+</button> <!> <!> <!></div></div>'),uk=F('<!> <div class="scroll-container svelte-bvvs2r"><div class="pr-list svelte-bvvs2r"></div></div>',1),fk=F('<div class="activity-row skeleton svelte-bvvs2r"><div class="skeleton-line skeleton-activity svelte-bvvs2r"></div></div>'),_k=F('<div class="scroll-container svelte-bvvs2r"><div class="activity-list svelte-bvvs2r"></div></div>'),vk=F('<div class="section-message svelte-bvvs2r">No recent commits (24h)</div>'),pk=F('<span class="commit-branch svelte-bvvs2r"> </span>'),gk=F('<div class="activity-row svelte-bvvs2r"><span class="commit-hash svelte-bvvs2r"> </span> <span class="commit-msg svelte-bvvs2r"> </span> <!> <span class="commit-time svelte-bvvs2r"> </span></div>'),mk=F('<div class="scroll-container svelte-bvvs2r"><div class="activity-list svelte-bvvs2r"></div></div>'),bk=F('<section class="dashboard-section dashboard-section--scroll svelte-bvvs2r"><div class="section-heading svelte-bvvs2r">OPEN PULL REQUESTS</div> <!></section> <section class="dashboard-section dashboard-section--scroll svelte-bvvs2r"><div class="section-heading svelte-bvvs2r">RECENT ACTIVITY</div> <!></section>',1),yk=F('<button class="cta-btn svelte-bvvs2r"> </button>'),Sk=F('<div class="repo-dashboard svelte-bvvs2r"><!> <div class="cta-row svelte-bvvs2r"><button class="cta-btn svelte-bvvs2r">+ Start Session</button> <!></div></div>');function wk(e,t){_t(t,!0);let i=ur(t,"creatingWorktree",3,!1);const r=vl(()=>({queryKey:["dashboard",t.workspacePath],queryFn:()=>Um(t.workspacePath),staleTime:6e4,refetchOnWindowFocus:!0}));let s=de(()=>r.data),n=de(()=>r.isLoading),o=de(()=>r.isError);function l(M){return M.state!=="OPEN"?"dot dot-muted":M.reviewDecision==="CHANGES_REQUESTED"?"dot dot-error":"dot dot-success"}function h(M){const B=M.state==="OPEN"?"OPEN":M.state==="MERGED"?"MERGED":"CLOSED";return dd({commitsAhead:1,prState:B,ciFailing:0,ciPending:0,ciTotal:0,mergeable:M.mergeable??null,unresolvedCommentCount:0})}function c(M){return M.role==="author"?"by you":"review requested"}function u(M){return!M.branches||M.branches.length===0?"":"("+M.branches.join(", ")+")"}let d=W(""),f=de(()=>a(s)?a(s).prs.length>5:!1),_=de(()=>()=>{if(!a(s))return[];const M=a(d).toLowerCase().trim();return M?a(s).prs.filter(B=>B.title.toLowerCase().includes(M)||String(B.number).includes(M)||B.headRefName.toLowerCase().includes(M)):a(s).prs});var p=Sk(),b=y(p);{var g=M=>{var B=tk();I(M,B)},S=M=>{var B=bk(),K=kt(B),j=D(y(K),2);{var se=te=>{var pe=rk(),ke=y(pe);Zt(ke,20,()=>[1,2],jo,(ue,Ce)=>{var De=ik();I(ue,De)}),I(te,pe)},Y=te=>{var pe=sk();I(te,pe)},N=te=>{var pe=nk();I(te,pe)},L=te=>{var pe=ok();I(te,pe)},T=te=>{var pe=uk(),ke=kt(pe);{var ue=Te=>{var ve=ak();Ui(ve,()=>a(d),ye=>m(d,ye)),I(Te,ve)};re(ke,Te=>{a(f)&&Te(ue)})}var Ce=D(ke,2),De=y(Ce);Zt(De,21,()=>a(_)(),Te=>Te.number,(Te,ve)=>{const ye=de(()=>h(a(ve))),ge=de(()=>pv(a(ye).color)),Oe=de(()=>gv(a(ye).color));var Ne=dk(),Ue=y(Ne),Re=y(Ue),Ze=y(Re),Z=D(Ze,2),_e=y(Z),A=D(Re,2),Q=y(A),ne=y(Q),ee=D(Q,4),Se=y(ee),he=D(ee,4),Me=y(he),Le=D(Ue,2),z=y(Le),$=D(z,2);{var me=Pe=>{var be=lk();V("click",be,()=>t.onFixConflicts(a(ve))),I(Pe,be)};re($,Pe=>{a(ve).mergeable==="CONFLICTING"&&Pe(me)})}var P=D($,2);{var H=Pe=>{var be=hk();le(()=>ze(be,"href",a(ve).url)),I(Pe,be)};re(P,Pe=>{a(ve).mergeable==="MERGEABLE"&&a(ve).state==="OPEN"&&Pe(H)})}var ce=D(P,2);{var we=Pe=>{var be=ck();let Ee,Qe;var st=y(be);le(()=>{Ee=tt(be,1,"pr-action-pill svelte-bvvs2r",null,Ee,{"dark-text":a(Oe)}),ze(be,"title",a(ye).label),Qe=uo(be,"",Qe,{"--pill-color":a(ge)}),oe(st,a(ye).label)}),V("click",be,()=>t.onPrAction(a(ve))),I(Pe,be)};re(ce,Pe=>{a(ye).type!=="none"&&a(ye).label&&Pe(we)})}le((Pe,be,Ee)=>{tt(Ze,1,Pe,"svelte-bvvs2r"),ze(Z,"href",a(ve).url),oe(_e,a(ve).title),oe(ne,`#${a(ve).number??""}`),oe(Se,be),oe(Me,Ee)},[()=>H_(l(a(ve))),()=>c(a(ve)),()=>Ob(a(ve).updatedAt)]),V("click",z,()=>t.onOpenPrSession(a(ve))),I(Te,Ne)}),I(te,pe)};re(j,te=>{a(n)?te(se):a(o)?te(Y,1):a(s)&&!a(s).hasGhCli?te(N,2):a(s)&&a(s).prs.length===0?te(L,3):a(s)&&te(T,4)})}var O=D(K,2),U=D(y(O),2);{var R=te=>{var pe=_k(),ke=y(pe);Zt(ke,20,()=>[1,2,3],jo,(ue,Ce)=>{var De=fk();I(ue,De)}),I(te,pe)},E=te=>{var pe=vk();I(te,pe)},J=te=>{var pe=mk(),ke=y(pe);Zt(ke,21,()=>a(s).activity,ue=>ue.hash,(ue,Ce)=>{var De=gk(),Te=y(De),ve=y(Te),ye=D(Te,2),ge=y(ye),Oe=D(ye,2);{var Ne=Ze=>{var Z=pk(),_e=y(Z);le(A=>oe(_e,A),[()=>u(a(Ce))]),I(Ze,Z)};re(Oe,Ze=>{a(Ce).branches.length>0&&Ze(Ne)})}var Ue=D(Oe,2),Re=y(Ue);le(()=>{oe(ve,a(Ce).shortHash),oe(ge,a(Ce).message),oe(Re,a(Ce).timeAgo)}),I(ue,De)}),I(te,pe)};re(U,te=>{a(n)?te(R):a(s)&&a(s).activity.length===0?te(E,1):a(s)&&te(J,2)})}I(M,B)};re(b,M=>{a(s)&&!a(s).isGitRepo?M(g):M(S,!1)})}var x=D(b,2),C=y(x),w=D(C,2);{var k=M=>{var B=yk(),K=y(B);le(()=>{B.disabled=i(),oe(K,i()?"Creating...":"+ New Worktree")}),V("click",B,function(...j){var se;(se=t.onNewWorktree)==null||se.apply(this,j)}),I(M,B)};re(w,M=>{(!a(s)||a(s).isGitRepo)&&M(k)})}V("click",C,function(...M){var B;(B=t.onNewSession)==null||B.apply(this,M)}),I(e,p),vt()}pt(["click"]);var Ck=F('<div class="empty-icon svelte-1luen49" aria-hidden="true"> </div>'),kk=F('<p class="empty-description svelte-1luen49"> </p>'),xk=F('<button class="empty-action svelte-1luen49"> </button>'),Ek=F('<div class="empty-state svelte-1luen49"><!> <div class="empty-heading svelte-1luen49"> </div> <!> <!></div>');function Dk(e,t){var i=Ek(),r=y(i);{var s=d=>{var f=Ck(),_=y(f);le(()=>oe(_,t.icon)),I(d,f)};re(r,d=>{t.icon&&d(s)})}var n=D(r,2),o=y(n),l=D(n,2);{var h=d=>{var f=kk(),_=y(f);le(()=>oe(_,t.description)),I(d,f)};re(l,d=>{t.description&&d(h)})}var c=D(l,2);{var u=d=>{var f=xk(),_=y(f);le(()=>oe(_,t.actionLabel)),V("click",f,function(...p){var b;(b=t.onAction)==null||b.apply(this,p)}),I(d,f)};re(c,d=>{t.actionLabel&&t.onAction&&d(u)})}le(()=>oe(o,t.heading)),I(e,i)}pt(["click"]);var Tk=F("<button><!></button>"),Rk=F("<button><!></button>"),Pk=F('<div class="toolbar svelte-k7we1m" role="toolbar"><div class="toolbar-grid svelte-k7we1m"><!></div></div>');function Mk(e,t){_t(t,!0),ur(t,"useTmux",3,!1);let i=ur(t,"inCopyMode",3,!1);const r=[{html:"Tab",key:" ",label:"Tab"},{html:"⇧Tab",key:"\x1B[Z",label:"Shift+Tab"},{html:"↑",key:"\x1B[A",label:"Up arrow",extraClass:"tb-arrow"},{html:"Esc",key:"\x1B",label:"Escape"},{html:"📷",id:"upload-image-btn",label:"Upload image"},{html:"^V",id:"paste-btn",label:"Paste from clipboard"},{html:"^C",key:"",label:"Ctrl+C"},{html:"←",key:"\x1B[D",label:"Left arrow",extraClass:"tb-arrow"},{html:"↓",key:"\x1B[B",label:"Down arrow",extraClass:"tb-arrow"},{html:"→",key:"\x1B[C",label:"Right arrow",extraClass:"tb-arrow"},{html:"⇧⏎",key:"\x1B[13;2u",label:"Shift+Enter (newline)",extraClass:"tb-newline"},{html:"⏎",key:"\r",label:"Enter",extraClass:"tb-enter"}],s=[{html:"Sel",key:" ",label:"Start selection"},{html:"w",key:"w",label:"Word forward"},{html:"b",key:"b",label:"Word backward"},{html:"←",key:"h",label:"Left",extraClass:"tb-arrow"},{html:"↓",key:"j",label:"Down",extraClass:"tb-arrow"},{html:"↑",key:"k",label:"Up",extraClass:"tb-arrow"},{html:"→",key:"l",label:"Right",extraClass:"tb-arrow"},{html:"$",key:"$",label:"End of line"},{html:"0",key:"0",label:"Start of line"},{html:"PgUp",key:"\x1B[5~",label:"Page up"},{html:"Copy",key:"\r",label:"Copy and exit",extraClass:"tb-enter",exitsCopyMode:!0},{html:"Exit",key:"q",label:"Cancel",exitsCopyMode:!0}];function n(d){var f;if(d.id==="upload-image-btn"){t.onUploadImage(),jt&&t.onRefocusMobileInput();return}if(d.id==="paste-btn"){(f=navigator.clipboard)!=null&&f.readText?navigator.clipboard.readText().then(_=>{_&&t.onSendKey(_)}).catch(()=>{t.onUploadImage()}):t.onUploadImage(),jt&&t.onRefocusMobileInput();return}d.key&&((d.key==="\r"||d.key==="\x1B[13;2u")&&t.onFlushComposedText(),t.onSendKey(d.key),(d.key==="\r"||d.key==="\x1B[13;2u")&&t.onClearInput(),jt&&t.onRefocusMobileInput())}function o(d){var f;t.onSendKey(d.key),d.exitsCopyMode&&((f=t.onExitCopyMode)==null||f.call(t)),jt&&t.onRefocusMobileInput()}function l(d){d.preventDefault();const f=d.target.closest("button");if(!f)return;if(i()){const p=s.find(b=>f.dataset.key===b.key);p&&o(p);return}const _=r.find(p=>p.id===f.id||p.key&&f.dataset.key===p.key);_&&n(_)}var h=Vr(),c=kt(h);{var u=d=>{var f=Pk(),_=y(f),p=y(_);{var b=S=>{var x=Vr(),C=kt(x);Zt(C,17,()=>s,w=>w.label,(w,k)=>{var M=Tk(),B=y(M);Yd(B,()=>a(k).html),le(()=>{tt(M,1,`tb-btn ${a(k).extraClass??""??""}`,"svelte-k7we1m"),ze(M,"data-key",a(k).key),ze(M,"aria-label",a(k).label)}),I(w,M)}),I(S,x)},g=S=>{var x=Vr(),C=kt(x);Zt(C,17,()=>r,w=>w.label,(w,k)=>{var M=Rk(),B=y(M);Yd(B,()=>a(k).html),le(()=>{tt(M,1,`tb-btn ${a(k).extraClass??""??""}`,"svelte-k7we1m"),ze(M,"id",a(k).id),ze(M,"data-key",a(k).key),ze(M,"aria-label",a(k).label)}),I(w,M)}),I(S,x)};re(p,S=>{i()?S(b):S(g,!1)})}V("mousedown",f,l),I(d,f)};re(c,d=>{jt&&d(u)})}I(e,h),vt()}pt(["mousedown"]);var Ak=F('<div><button class="icon-btn svelte-wp0i5g" aria-label="Open sessions menu">☰</button> <span class="mobile-title svelte-wp0i5g"> </span></div>');function Ok(e,t){let i=ur(t,"hidden",3,!1);var r=Ak();let s;var n=y(r),o=D(n,2),l=y(o);le(()=>{s=tt(r,1,"mobile-header svelte-wp0i5g",null,s,{hidden:i()}),oe(l,t.title)}),V("click",n,function(...h){var c;(c=t.onMenuClick)==null||c.apply(this,h)}),I(e,r)}pt(["click"]);var Lk=F('<div class="update-toast-actions svelte-1trivgv"><button class="update-toast-btn svelte-1trivgv"> </button> <button class="update-toast-dismiss svelte-1trivgv" aria-label="Dismiss">×</button></div>'),Ik=F('<div class="update-toast svelte-1trivgv"><div class="update-toast-content svelte-1trivgv"><span class="update-toast-text svelte-1trivgv"> </span> <!></div></div>');function Bk(e,t){_t(t,!0);let i=W(!1),r=W(""),s=W("Update Now"),n=W(!1),o=W(!0);fo(async()=>{try{const f=await j_();f.updateAvailable&&(m(r,`Update available: v${f.current} → v${f.latest}`),m(s,"Update Now"),m(n,!1),m(o,!0),m(i,!0))}catch{}});async function l(){m(n,!0),m(s,"Updating…");try{(await Y_()).restarting?(m(r,"Updated! Restarting server…"),m(o,!1),setTimeout(()=>{location.reload()},5e3)):(m(r,"Updated! Please restart the server manually."),m(o,!1))}catch{m(r,"Update failed. Please try again."),m(n,!1),m(s,"Retry"),m(o,!0)}}function h(){m(i,!1)}var c=Vr(),u=kt(c);{var d=f=>{var _=Ik(),p=y(_),b=y(p),g=y(b),S=D(b,2);{var x=C=>{var w=Lk(),k=y(w),M=y(k),B=D(k,2);le(()=>{k.disabled=a(n),oe(M,a(s))}),V("click",k,l),V("click",B,h),I(C,w)};re(S,C=>{a(o)&&C(x)})}le(()=>oe(g,a(r))),I(f,_)};re(u,f=>{a(i)&&f(d)})}I(e,c),vt()}pt(["click"]);var Nk=F('<button class="image-toast-insert svelte-1y8sviv">Insert</button>'),Fk=F('<div class="image-toast svelte-1y8sviv"><div class="image-toast-content svelte-1y8sviv"><span class="image-toast-text svelte-1y8sviv"> </span> <div class="image-toast-actions svelte-1y8sviv"><!> <button class="image-toast-dismiss svelte-1y8sviv" aria-label="Dismiss">×</button></div></div></div>');function Wk(e,t){_t(t,!0);let i=W(!1),r=W(""),s=W(!1),n=W(null),o=null;function l(g,S,x){o&&(clearTimeout(o),o=null),m(r,g,!0),m(s,S,!0),m(n,x??null,!0),m(i,!0)}function h(){m(i,!1),m(n,null),o&&(clearTimeout(o),o=null)}function c(g){o&&clearTimeout(o),o=setTimeout(()=>{a(n)||h()},g)}function u(){a(n)&&ks(a(n)),h()}function d(){h()}var f={show:l,hide:h,autoDismiss:c},_=Vr(),p=kt(_);{var b=g=>{var S=Fk(),x=y(S),C=y(x),w=y(C),k=D(C,2),M=y(k);{var B=j=>{var se=Nk();V("click",se,u),I(j,se)};re(M,j=>{a(s)&&j(B)})}var K=D(M,2);le(()=>oe(w,a(r))),V("click",K,d),I(g,S)};re(p,g=>{a(i)&&g(b)})}return I(e,_),vt(f)}pt(["click"]);var Hk=F('<span class="dialog-title-repo svelte-thtd9b"> </span>'),zk=F('<li class="branch-create-new svelte-thtd9b" role="option" aria-selected="false"> </li>'),Uk=F('<li role="option" aria-selected="false" class="svelte-thtd9b"> </li>'),Kk=F('<ul class="branch-dropdown svelte-thtd9b"><!> <!></ul>'),qk=F('<div class="dialog-field svelte-thtd9b"><div class="dialog-label-row svelte-thtd9b"><label class="dialog-label svelte-thtd9b" for="ns-branch">Branch name</label> <button type="button" class="branch-refresh svelte-thtd9b" aria-label="Fetch latest remote branches" title="Fetch latest remote branches"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M20 12a8 8 0 0 1-13.66 5.66M4 12a8 8 0 0 1 13.66-5.66M17 3.5v4h-4M7 20.5v-4h4" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8"></path></svg></button></div> <div class="branch-input-wrap svelte-thtd9b"><input id="ns-branch" type="text" class="dialog-input svelte-thtd9b" placeholder="e.g. feat/my-feature" autocomplete="off"/> <!></div></div>'),jk=F('<div class="dialog-field dialog-field--inline svelte-thtd9b"><input id="ns-continue" type="checkbox" class="dialog-checkbox svelte-thtd9b"/> <label for="ns-continue" class="dialog-label-inline svelte-thtd9b">Continue existing session</label></div>'),Yk=F('<dialog class="dialog svelte-thtd9b"><div class="dialog-content svelte-thtd9b"><h2 class="dialog-title svelte-thtd9b"> <!></h2> <div class="dialog-tabs svelte-thtd9b"><button>Repo Session</button> <button>Worktree</button></div> <div class="dialog-body svelte-thtd9b"><div class="dialog-field svelte-thtd9b"><label class="dialog-label svelte-thtd9b" for="ns-agent">Coding agent</label> <select id="ns-agent" class="dialog-select svelte-thtd9b"><option>Claude</option><option>Codex</option></select></div> <!> <!> <div class="dialog-field dialog-field--inline svelte-thtd9b"><input id="ns-yolo" type="checkbox" class="dialog-checkbox svelte-thtd9b"/> <label for="ns-yolo" class="dialog-label-inline svelte-thtd9b">Yolo mode (skip permission checks)</label></div> <div class="dialog-field dialog-field--inline svelte-thtd9b"><input id="ns-tmux" type="checkbox" class="dialog-checkbox svelte-thtd9b"/> <label for="ns-tmux" class="dialog-label-inline svelte-thtd9b">Launch in tmux</label></div> <div class="dialog-field svelte-thtd9b"><label class="dialog-label svelte-thtd9b" for="ns-args">Extra args (optional)</label> <input id="ns-args" type="text" class="dialog-input svelte-thtd9b" placeholder="e.g. --verbose" autocomplete="off"/></div></div> <div class="dialog-footer svelte-thtd9b"><button class="btn btn-ghost svelte-thtd9b">Cancel</button> <button class="btn btn-primary svelte-thtd9b"> </button></div></div></dialog>');function Vk(e,t){_t(t,!0);let i=ur(t,"preselectedRepo",3,null);const r=cd();let s,n=W("repos"),o=W(""),l=W(""),h=W(""),c=W(""),u=W("claude"),d=W(!1),f=W(!1),_=W(!1),p=W($e([])),b=W(!1),g=W(!1),S=W(!1),x=W(!1),C=0,w=de(()=>{if(!a(h).trim())return[];const P=a(h).toLowerCase();return a(p).filter(H=>H.toLowerCase().includes(P)).slice(0,10)}),k=de(()=>a(p).some(P=>P===a(h)));async function M(P,H={}){const ce=++C;if(P){H.preserveExisting||m(p,[],!0),H.refresh?m(S,!0):m(g,!0);try{const we=await od(P,H.refresh?{refresh:!0}:{});if(ce!==C||P!==a(o))return;m(p,we,!0),a(h).trim()&&m(b,!0)}catch{if(ce!==C||P!==a(o))return;H.preserveExisting||m(p,[],!0)}finally{ce===C&&(m(g,!1),m(S,!1))}}}async function B(){!a(o)||a(S)||await M(a(o),{refresh:!0,preserveExisting:!0})}function K(){C+=1,m(h,""),m(p,[],!0),m(b,!1),m(g,!1),m(S,!1)}function j(){m(b,a(h).trim().length>0)}function se(P){m(h,P,!0),m(b,!1)}function Y(){m(o,""),m(l,""),m(c,""),m(d,!1),m(f,!1),m(_,!1),K()}async function N(P,H){Y(),m(n,"repos"),await _v(),m(u,r.defaultAgent,!0),H!=null&&H.agent&&m(u,H.agent,!0),m(d,r.defaultYolo,!0),m(f,r.defaultContinue,!0),m(_,r.launchInTmux,!0),(H==null?void 0:H.yolo)!==void 0&&m(d,H.yolo,!0),(H==null?void 0:H.useTmux)!==void 0&&m(_,H.useTmux,!0);const ce=P??i();ce&&(m(o,ce.path,!0),m(l,ce.name,!0),H!=null&&H.branchName&&(m(n,"worktrees"),await M(ce.path))),H!=null&&H.branchName&&m(h,H.branchName,!0),H!=null&&H.claudeArgs&&m(c,H.claudeArgs,!0),s.showModal()}function L(){s.close()}async function T(){var Pe,be;const P=a(o);if(!P||a(x))return;m(x,!0);const H=a(c).trim().split(/\s+/).filter(Boolean),ce=Math.max(80,Math.floor((window.innerWidth-60)/8)),we=Math.max(24,Math.floor((window.innerHeight-120)/17));try{let Ee;a(n)==="repos"?Ee=await K_({repoPath:P,repoName:a(l)||P.split("/").filter(Boolean).pop(),continue:a(f),yolo:a(d),claudeArgs:H.length>0?H:void 0,agent:a(u),useTmux:a(_),cols:ce,rows:we,allowMultiple:!0}):Ee=await hn({repoPath:P,repoName:a(l)||P.split("/").filter(Boolean).pop(),branchName:a(h).trim()||void 0,yolo:a(d),claudeArgs:H.length>0?H:void 0,agent:a(u),useTmux:a(_),cols:ce,rows:we}),s.close(),await Ft(),Ee!=null&&Ee.id&&((Pe=t.onSessionCreated)==null||Pe.call(t,Ee.id))}catch(Ee){if(Ee instanceof Error&&"sessionId"in Ee){const Qe=Ee;s.close(),await Ft(),Qe.sessionId&&((be=t.onSessionCreated)==null||be.call(t,Qe.sessionId))}}finally{m(x,!1)}}function O(P){P.target===s&&s.close()}function U(P){a(b)&&P.key==="Escape"&&(m(b,!1),P.stopPropagation())}var R={open:N,close:L},E=Yk(),J=y(E),te=y(J),pe=y(te),ke=D(pe);{var ue=P=>{var H=Hk(),ce=y(H);le(()=>oe(ce,`— ${a(l)??""}`)),I(P,H)};re(ke,P=>{a(l)&&P(ue)})}var Ce=D(te,2),De=y(Ce);let Te;var ve=D(De,2);let ye;var ge=D(Ce,2),Oe=y(ge),Ne=D(y(Oe),2),Ue=y(Ne);Ue.value=Ue.__value="claude";var Re=D(Ue);Re.value=Re.__value="codex";var Ze=D(Oe,2);{var Z=P=>{var H=qk(),ce=y(H),we=D(y(ce),2),Pe=y(we);let be;var Ee=D(ce,2),Qe=y(Ee),st=D(Qe,2);{var Et=Fe=>{var Ye=Kk(),nt=y(Ye);{var ot=ei=>{var wi=zk(),Or=y(wi);le(Jr=>oe(Or,`Create new: ${Jr??""}`),[()=>a(h).trim()]),V("mousedown",wi,()=>se(a(h).trim())),I(ei,wi)},Lt=de(()=>!a(k)&&a(h).trim());re(nt,ei=>{a(Lt)&&ei(ot)})}var Si=D(nt,2);Zt(Si,16,()=>a(w),ei=>ei,(ei,wi)=>{var Or=Uk(),Jr=y(Or);le(()=>oe(Jr,wi)),V("mousedown",Or,()=>se(wi)),I(ei,Or)}),I(Fe,Ye)},Be=de(()=>a(b)&&(a(w).length>0||a(h).trim()&&!a(k)));re(st,Fe=>{a(Be)&&Fe(Et)})}le(()=>{we.disabled=!a(o)||a(g)||a(S),be=tt(Pe,0,"svelte-thtd9b",null,be,{spinning:a(g)||a(S)})}),V("click",we,B),V("input",Qe,j),lr("focus",Qe,()=>{a(h).trim()&&m(b,!0)}),Ui(Qe,()=>a(h),Fe=>m(h,Fe)),I(P,H)};re(Ze,P=>{a(n)==="worktrees"&&P(Z)})}var _e=D(Ze,2);{var A=P=>{var H=jk(),ce=y(H);sr(ce,()=>a(f),we=>m(f,we)),I(P,H)};re(_e,P=>{a(n)==="repos"&&P(A)})}var Q=D(_e,2),ne=y(Q),ee=D(Q,2),Se=y(ee),he=D(ee,2),Me=D(y(he),2),Le=D(ge,2),z=y(Le),$=D(z,2),me=y($);return it(E,P=>s=P,()=>s),le(()=>{oe(pe,`${a(n)==="repos"?"New Session":"New Worktree"} `),Te=tt(De,1,"dialog-tab svelte-thtd9b",null,Te,{active:a(n)==="repos"}),ye=tt(ve,1,"dialog-tab svelte-thtd9b",null,ye,{active:a(n)==="worktrees"}),z.disabled=a(x),$.disabled=!a(o)||a(x),oe(me,a(x)?"Creating...":a(n)==="repos"?"Start Session":"Create Worktree")}),V("click",E,O),V("keydown",E,U),V("click",De,()=>{m(n,"repos")}),V("click",ve,()=>{m(n,"worktrees"),a(o)&&a(p).length===0&&M(a(o))}),Za(Ne,()=>a(u),P=>m(u,P)),sr(ne,()=>a(d),P=>m(d,P)),sr(Se,()=>a(_),P=>m(_,P)),Ui(Me,()=>a(c),P=>m(c,P)),V("click",z,()=>s.close()),V("click",$,T),I(e,E),vt(R)}pt(["click","keydown","input","mousedown"]);var Gk=F('<p class="error-msg svelte-fdtoa4"> </p>'),$k=F('<span class="version-status svelte-fdtoa4">Up to date</span>'),Xk=F('<div class="version-update-row svelte-fdtoa4"><span class="version-update-text svelte-fdtoa4"> </span> <button class="btn btn-primary btn-sm svelte-fdtoa4"> </button></div>'),Zk=F('<button class="btn btn-ghost btn-sm svelte-fdtoa4"> </button>'),Qk=F('<p class="version-status-msg svelte-fdtoa4"> </p>'),Jk=F('<dialog class="dialog svelte-fdtoa4"><div class="dialog-content svelte-fdtoa4"><div class="dialog-header svelte-fdtoa4"><h2 class="dialog-title svelte-fdtoa4">Settings</h2> <button class="close-btn svelte-fdtoa4" aria-label="Close settings">✕</button></div> <div class="dialog-body svelte-fdtoa4"><!> <section class="settings-section svelte-fdtoa4"><h3 class="section-title svelte-fdtoa4">Default Coding Agent</h3> <p class="section-desc svelte-fdtoa4">CLI used when creating new sessions.</p> <select class="agent-select svelte-fdtoa4"><option>Claude</option><option>Codex</option></select></section> <section class="settings-section svelte-fdtoa4"><h3 class="section-title svelte-fdtoa4">Global Defaults</h3> <p class="section-desc svelte-fdtoa4">Default options for all workspaces. Override per-workspace in workspace settings.</p> <div class="devtools-row svelte-fdtoa4"><input id="default-continue" type="checkbox" class="dialog-checkbox svelte-fdtoa4"/> <label for="default-continue" class="devtools-label svelte-fdtoa4">Continue existing session</label></div> <div class="devtools-row svelte-fdtoa4"><input id="default-yolo" type="checkbox" class="dialog-checkbox svelte-fdtoa4"/> <label for="default-yolo" class="devtools-label svelte-fdtoa4">YOLO mode (skip permission checks)</label></div> <div class="devtools-row svelte-fdtoa4"><input id="default-tmux" type="checkbox" class="dialog-checkbox svelte-fdtoa4"/> <label for="default-tmux" class="devtools-label svelte-fdtoa4">Launch in tmux</label></div> <div class="devtools-row svelte-fdtoa4"><input id="default-notifications" type="checkbox" class="dialog-checkbox svelte-fdtoa4"/> <label for="default-notifications" class="devtools-label svelte-fdtoa4">Enable notifications for new sessions</label></div></section> <section class="settings-section svelte-fdtoa4"><h3 class="section-title svelte-fdtoa4">Developer Tools</h3> <div class="devtools-row svelte-fdtoa4"><input id="devtools-toggle" type="checkbox" class="dialog-checkbox svelte-fdtoa4"/> <label for="devtools-toggle" class="devtools-label svelte-fdtoa4">Enable mobile debug panel</label></div></section> <section class="settings-section svelte-fdtoa4"><h3 class="section-title svelte-fdtoa4">Version</h3> <div class="version-row svelte-fdtoa4"><span class="version-current svelte-fdtoa4"><!></span> <!></div> <!> <!></section></div> <div class="dialog-footer svelte-fdtoa4"><button class="btn btn-ghost svelte-fdtoa4">Close</button></div></div></dialog>');function ex(e,t){_t(t,!0);let i,r=W(!1);const s=cd();let n=W(""),o=W(""),l=W(null),h=W(!1),c=W(!1),u=W(!1),d=W(!1),f=W("");async function _(){m(n,""),m(f,""),m(c,!1),m(d,!1),m(r,localStorage.getItem("devtools-enabled")==="true"),await _v(),i.showModal(),w()}function p(){i.close()}async function b(){const P=s.defaultAgent;m(n,"");try{await Xm(s.defaultAgent)}catch{s.defaultAgent=P,m(n,"Failed to update default agent.")}}async function g(){const P=s.defaultContinue;m(n,"");try{await Qm(s.defaultContinue)}catch{s.defaultContinue=P,m(n,"Failed to update continue default.")}}async function S(){const P=s.defaultYolo;m(n,"");try{await eb(s.defaultYolo)}catch{s.defaultYolo=P,m(n,"Failed to update yolo default.")}}async function x(){const P=s.launchInTmux;m(n,"");try{await ib(s.launchInTmux)}catch(H){s.launchInTmux=P,m(n,H instanceof Error?H.message:"Failed to update tmux setting.",!0)}}async function C(){const P=s.defaultNotifications;m(n,"");try{await sb(s.defaultNotifications)}catch{s.defaultNotifications=P,m(n,"Failed to update notifications default.")}}async function w(){m(u,!0),m(f,"");try{const P=await j_();m(o,P.current,!0),m(l,P.latest,!0),m(h,P.updateAvailable,!0),m(c,!0)}catch{m(f,"Failed to check for updates.")}finally{m(u,!1)}}async function k(){m(d,!0),m(f,"");try{(await Y_()).restarting?(m(f,"Updated! Restarting server…"),setTimeout(()=>{location.reload()},5e3)):m(f,"Updated! Please restart the server manually."),m(h,!1)}catch{m(f,"Update failed. Please try again."),m(d,!1)}}function M(){localStorage.setItem("devtools-enabled",a(r)?"true":"false"),window.dispatchEvent(new Event("devtools-changed"))}async function B(){i.close(),await Ft()}function K(P){P.target===i&&B()}var j={open:_,close:p},se=Jk(),Y=y(se),N=y(Y),L=D(y(N),2),T=D(N,2),O=y(T);{var U=P=>{var H=Gk(),ce=y(H);le(()=>oe(ce,a(n))),I(P,H)};re(O,P=>{a(n)&&P(U)})}var R=D(O,2),E=D(y(R),4),J=y(E);J.value=J.__value="claude";var te=D(J);te.value=te.__value="codex";var pe=D(R,2),ke=D(y(pe),4),ue=y(ke),Ce=D(ke,2),De=y(Ce),Te=D(Ce,2),ve=y(Te),ye=D(Te,2),ge=y(ye),Oe=D(pe,2),Ne=D(y(Oe),2),Ue=y(Ne),Re=D(Oe,2),Ze=D(y(Re),2),Z=y(Ze),_e=y(Z);{var A=P=>{var H=ln();le(()=>oe(H,`v${a(o)??""}`)),I(P,H)},Q=P=>{var H=ln("...");I(P,H)};re(_e,P=>{a(o)?P(A):P(Q,!1)})}var ne=D(Z,2);{var ee=P=>{var H=$k();I(P,H)};re(ne,P=>{a(c)&&!a(h)&&!a(d)&&P(ee)})}var Se=D(Ze,2);{var he=P=>{var H=Xk(),ce=y(H),we=y(ce),Pe=D(ce,2),be=y(Pe);le(()=>{oe(we,`v${a(o)??""} → v${a(l)??""}`),Pe.disabled=a(d),oe(be,a(d)?"Updating…":"Update Now")}),V("click",Pe,k),I(P,H)},Me=P=>{var H=Zk(),ce=y(H);le(()=>{H.disabled=a(u),oe(ce,a(u)?"Checking…":"Check for updates")}),V("click",H,w),I(P,H)};re(Se,P=>{a(h)?P(he):a(c)||P(Me,1)})}var Le=D(Se,2);{var z=P=>{var H=Qk(),ce=y(H);le(()=>oe(ce,a(f))),I(P,H)};re(Le,P=>{a(f)&&P(z)})}var $=D(T,2),me=y($);return it(se,P=>i=P,()=>i),V("click",se,K),V("click",L,B),V("change",E,b),Za(E,()=>s.defaultAgent,P=>s.defaultAgent=P),V("change",ue,g),sr(ue,()=>s.defaultContinue,P=>s.defaultContinue=P),V("change",De,S),sr(De,()=>s.defaultYolo,P=>s.defaultYolo=P),V("change",ve,x),sr(ve,()=>s.launchInTmux,P=>s.launchInTmux=P),V("change",ge,C),sr(ge,()=>s.defaultNotifications,P=>s.defaultNotifications=P),V("change",Ue,M),sr(Ue,()=>a(r),P=>m(r,P)),V("click",me,B),I(e,se),vt(j)}pt(["click","change"]);var tx=F('<p class="confirm-msg svelte-15sco2n">Are you sure you want to delete the worktree <strong class="wt-name svelte-15sco2n"> </strong>?</p> <p class="wt-path svelte-15sco2n"> </p> <p class="warning-msg svelte-15sco2n">This action cannot be undone.</p>',1),ix=F('<p class="error-msg svelte-15sco2n"> </p>'),rx=F('<dialog class="dialog svelte-15sco2n"><div class="dialog-content svelte-15sco2n"><h2 class="dialog-title svelte-15sco2n">Delete Worktree</h2> <div class="dialog-body svelte-15sco2n"><!> <!></div> <div class="dialog-footer svelte-15sco2n"><button class="btn btn-ghost svelte-15sco2n">Cancel</button> <button class="btn btn-danger svelte-15sco2n"> </button></div></div></dialog>');function sx(e,t){_t(t,!0);let i,r=W(null),s=W(""),n=W(!1);function o(B){m(r,B,!0),m(s,""),m(n,!1),i.showModal()}function l(){i.close()}async function h(){if(!(!a(r)||a(n))){m(n,!0),m(s,""),En(a(r).path);try{await q_(a(r).path,a(r).repoPath),i.close(),await Ft()}catch(B){m(s,B instanceof Error?B.message:"Failed to delete worktree.",!0),m(n,!1)}finally{a(r)&&Dn(a(r).path)}}}function c(){i.close()}function u(B){B.target===i&&i.close()}var d={open:o,close:l},f=rx(),_=y(f),p=D(y(_),2),b=y(p);{var g=B=>{var K=tx(),j=kt(K),se=D(y(j)),Y=y(se),N=D(j,2),L=y(N);le(()=>{oe(Y,a(r).displayName||a(r).name),oe(L,a(r).path)}),I(B,K)};re(b,B=>{a(r)&&B(g)})}var S=D(b,2);{var x=B=>{var K=ix(),j=y(K);le(()=>oe(j,a(s))),I(B,K)};re(S,B=>{a(s)&&B(x)})}var C=D(p,2),w=y(C),k=D(w,2),M=y(k);return it(f,B=>i=B,()=>i),le(()=>{w.disabled=a(n),k.disabled=a(n),oe(M,a(n)?"Deleting...":"Delete")}),V("click",f,u),V("click",w,c),V("click",k,h),I(e,f),vt(d)}pt(["click"]);var nx=F('<div class="loading-placeholder svelte-15gfcbp">Loading...</div>'),ox=F('<div class="empty-placeholder svelte-15gfcbp"><!></div>'),ax=F('<span class="spinner svelte-15gfcbp">...</span>'),lx=F("<span>▶</span>"),hx=F('<button class="expand-btn svelte-15gfcbp"><!></button>'),cx=F('<span class="expand-spacer svelte-15gfcbp"></span>'),dx=F('<span class="git-badge svelte-15gfcbp" aria-label="Git repository">git</span>'),ux=F('<div role="treeitem"><!> <input type="checkbox" class="node-checkbox svelte-15gfcbp"/> <span class="node-name svelte-15gfcbp"> </span> <!></div>'),fx=F('<div class="truncated-notice svelte-15gfcbp"> </div>'),_x=F("<!> <!>",1),vx=F('<div class="file-browser svelte-15gfcbp"><div class="filter-row svelte-15gfcbp"><input type="text" class="filter-input svelte-15gfcbp" placeholder="Filter..." aria-label="Filter directories" autocomplete="off" spellcheck="false"/></div> <div class="tree-container svelte-15gfcbp" role="tree" aria-label="File browser" tabindex="0"><!></div></div>');function px(e,t){_t(t,!0);let i=ur(t,"selectedPaths",31,()=>$e([])),r=W($e([])),s=W(""),n=W(-1),o=W(!0),l=W(null),h=W(void 0);fo(()=>{c()});async function c(){m(o,!0),m(l,null);try{const R=await Zd();m(r,R.entries.map(E=>u(E,0)),!0),R.truncated&&m(l,{shown:R.entries.length,total:R.total},!0)}catch{m(r,[],!0)}finally{m(o,!1)}}function u(R,E){return{name:R.name,path:R.path,isGitRepo:R.isGitRepo,hasChildren:R.hasChildren,children:null,expanded:!1,selected:!1,loading:!1,depth:E,truncatedInfo:null}}async function d(R){if(R.expanded){R.expanded=!1;return}if(R.children===null){R.loading=!0;try{const E=await Zd(R.path);R.children=E.entries.map(J=>u(J,R.depth+1)),R.truncatedInfo=E.truncated?{shown:E.entries.length,total:E.total}:null}catch{R.children=[]}finally{R.loading=!1}}R.expanded=!0}function f(R){R.selected=!R.selected,_()}function _(){i(p(a(r)))}function p(R){const E=[];for(const J of R)J.selected&&E.push(J.path),J.children&&E.push(...p(J.children));return E}function b(R,E){return R.toLowerCase().includes(E.toLowerCase())}function g(R,E){var J;return!!(!E||R.expanded||b(R.name,E)||(J=R.children)!=null&&J.some(te=>g(te,E)))}function S(R,E){const J=[];for(const te of R)g(te,E)&&(J.push(te),te.expanded&&te.children&&J.push(...S(te.children,E)));return J}let x=de(()=>S(a(r),a(s)));function C(R){var J;if(R.key==="ArrowDown"){R.preventDefault(),m(n,Math.min(a(n)+1,a(x).length-1),!0);return}if(R.key==="ArrowUp"){R.preventDefault(),m(n,Math.max(a(n)-1,0),!0);return}const E=a(n)>=0?a(x)[a(n)]:void 0;if(E){if(R.key==="ArrowRight"){if(R.preventDefault(),E.hasChildren&&!E.expanded)d(E);else if(E.expanded&&((J=E.children)!=null&&J.length)){const te=a(x).indexOf(E.children[0]);te>=0&&m(n,te,!0)}return}if(R.key==="ArrowLeft"){if(R.preventDefault(),E.expanded)E.expanded=!1;else{const te=E.depth-1;for(let pe=a(n)-1;pe>=0;pe--)if(a(x)[pe].depth===te){m(n,pe,!0);break}}return}if(R.key===" "){R.preventDefault(),f(E);return}}}function w(R,E){const J=E.target;J.closest(".expand-btn")||J.closest(".node-checkbox")||(R.hasChildren&&!R.expanded?d(R):f(R))}function k(){m(s,""),m(n,-1),M(a(r)),i([]),B(a(r))}function M(R){for(const E of R)E.selected=!1,E.children&&M(E.children)}function B(R){for(const E of R)E.expanded=!1,E.children&&B(E.children)}var K={reset:k},j=vx(),se=y(j),Y=y(se),N=D(se,2),L=y(N);{var T=R=>{var E=nx();I(R,E)},O=R=>{var E=ox(),J=y(E);{var te=ke=>{var ue=ln();le(()=>oe(ue,`No matches for "${a(s)??""}"`)),I(ke,ue)},pe=ke=>{var ue=ln("No directories found");I(ke,ue)};re(J,ke=>{a(s)?ke(te):ke(pe,!1)})}I(R,E)},U=R=>{var E=_x(),J=kt(E);Zt(J,19,()=>a(x),ke=>ke.path,(ke,ue,Ce)=>{var De=ux();let Te;var ve=y(De);{var ye=Z=>{var _e=hx(),A=y(_e);{var Q=ee=>{var Se=ax();I(ee,Se)},ne=ee=>{var Se=lx();let he;le(()=>he=tt(Se,1,"arrow svelte-15gfcbp",null,he,{expanded:a(ue).expanded})),I(ee,Se)};re(A,ee=>{a(ue).loading?ee(Q):ee(ne,!1)})}le(()=>ze(_e,"aria-label",a(ue).expanded?"Collapse":"Expand")),V("click",_e,()=>d(a(ue))),I(Z,_e)},ge=Z=>{var _e=cx();I(Z,_e)};re(ve,Z=>{a(ue).hasChildren?Z(ye):Z(ge,!1)})}var Oe=D(ve,2),Ne=D(Oe,2),Ue=y(Ne),Re=D(Ne,2);{var Ze=Z=>{var _e=dx();I(Z,_e)};re(Re,Z=>{a(ue).isGitRepo&&Z(Ze)})}le(()=>{Te=tt(De,1,"tree-row svelte-15gfcbp",null,Te,{focused:a(Ce)===a(n),selected:a(ue).selected}),uo(De,`padding-left: ${12+a(ue).depth*20}px`),ze(De,"aria-expanded",a(ue).hasChildren?a(ue).expanded:void 0),ze(De,"aria-selected",a(ue).selected),ze(De,"aria-level",a(ue).depth+1),Pm(Oe,a(ue).selected),ze(Oe,"aria-label",`Select ${a(ue).name??""}`),oe(Ue,a(ue).name)}),V("click",De,Z=>w(a(ue),Z)),V("change",Oe,()=>f(a(ue))),V("click",Oe,Z=>Z.stopPropagation()),I(ke,De)});var te=D(J,2);{var pe=ke=>{var ue=fx(),Ce=y(ue);le(()=>oe(Ce,`Showing ${a(l).shown??""} of ${a(l).total??""} directories. Use the filter to narrow results.`)),I(ke,ue)};re(te,ke=>{a(l)&&ke(pe)})}I(R,E)};re(L,R=>{a(o)?R(T):a(x).length===0?R(O,1):R(U,!1)})}return it(N,R=>m(h,R),()=>a(h)),Ui(Y,()=>a(s),R=>m(s,R)),V("keydown",N,C),I(e,j),vt(K)}pt(["keydown","click","change"]);var gx=F('<p class="error-msg svelte-4yj2yx"> </p>'),mx=F('<dialog class="dialog svelte-4yj2yx"><div class="dialog-content svelte-4yj2yx"><div class="dialog-header svelte-4yj2yx"><h2 class="dialog-title svelte-4yj2yx">Add Workspace</h2> <button class="close-btn svelte-4yj2yx" aria-label="Close">✕</button></div> <div class="dialog-body svelte-4yj2yx"><p class="dialog-desc svelte-4yj2yx">Browse for folders on your machine. Git repos get PR tracking and branch management.</p> <!> <!></div> <div class="dialog-footer svelte-4yj2yx"><span class="selected-count svelte-4yj2yx"><!></span> <div class="footer-actions svelte-4yj2yx"><button class="btn btn-ghost svelte-4yj2yx">Cancel</button> <button class="btn btn-primary svelte-4yj2yx"><!></button></div></div></div></dialog>');function bx(e,t){_t(t,!0);let i,r=W(void 0),s=W($e([])),n=W(""),o=W(!1);function l(){var T;m(s,[],!0),m(n,""),m(o,!1),(T=a(r))==null||T.reset(),i.showModal()}function h(){i.close()}async function c(){if(a(s).length!==0){m(o,!0),m(n,"");try{const T=await zm(a(s));if(T.errors.length>0&&T.added.length===0){m(n,T.errors.map(O=>`${O.path}: ${O.error}`).join("; "),!0),m(o,!1);return}T.added.length>0&&t.onWorkspacesAdded(T.added.map(O=>O.path)),T.errors.length>0&&console.warn("Some workspaces failed to add:",T.errors),h()}catch{m(n,"Failed to add workspaces.")}finally{m(o,!1)}}}function u(T){T.target===i&&h()}var d={open:l,close:h},f=mx(),_=y(f),p=y(_),b=D(y(p),2),g=D(p,2),S=D(y(g),2);it(px(S,{get selectedPaths(){return a(s)},set selectedPaths(T){m(s,T,!0)}}),T=>m(r,T,!0),()=>a(r));var x=D(S,2);{var C=T=>{var O=gx(),U=y(O);le(()=>oe(U,a(n))),I(T,O)};re(x,T=>{a(n)&&T(C)})}var w=D(g,2),k=y(w),M=y(k);{var B=T=>{var O=ln();le(()=>oe(O,`${a(s).length??""} selected`)),I(T,O)};re(M,T=>{a(s).length>0&&T(B)})}var K=D(k,2),j=y(K),se=D(j,2),Y=y(se);{var N=T=>{var O=ln("Adding...");I(T,O)},L=T=>{var O=ln();le(()=>oe(O,`Add Workspace${a(s).length>1?"s":""}`)),I(T,O)};re(Y,T=>{a(o)?T(N):T(L,!1)})}return it(f,T=>i=T,()=>i),le(()=>se.disabled=a(s).length===0||a(o)),V("click",f,u),V("click",b,h),V("click",j,h),V("click",se,c),I(e,f),vt(d)}pt(["click"]);var yx=F('<p class="error-msg svelte-1n78dcx"> </p>'),Sx=F("<option> </option>"),wx=F("<option> </option>"),Cx=F('<span class="override-badge svelte-1n78dcx">overridden</span>'),kx=F('<textarea class="prompt-textarea svelte-1n78dcx" placeholder="e.g. focus on security, error handling"></textarea>'),xx=F('<textarea class="prompt-textarea svelte-1n78dcx" placeholder="e.g. include test plan section"></textarea>'),Ex=F('<textarea class="prompt-textarea svelte-1n78dcx" placeholder="e.g. prefix with dy/, use conventional commits style"></textarea>'),Dx=F('<textarea class="prompt-textarea svelte-1n78dcx" placeholder="e.g. use TypeScript, follow CLAUDE.md"></textarea>'),Tx=F('<button class="btn btn-ghost svelte-1n78dcx">Reset to Global</button>'),Rx=F('<span class="save-success svelte-1n78dcx">Saved</span>'),Px=F('<dialog class="dialog svelte-1n78dcx"><div class="dialog-content svelte-1n78dcx"><div class="dialog-header svelte-1n78dcx"><h2 class="dialog-title svelte-1n78dcx"><span class="gear-icon svelte-1n78dcx">⚙</span> </h2> <button class="close-btn svelte-1n78dcx" aria-label="Close settings">✕</button></div> <div class="dialog-body svelte-1n78dcx"><!> <section class="settings-section svelte-1n78dcx"><h3 class="section-label svelte-1n78dcx">GIT SETTINGS</h3> <div class="field-group svelte-1n78dcx"><label class="field-label svelte-1n78dcx" for="ws-default-branch">Branch new worktrees from</label> <select id="ws-default-branch" class="field-select svelte-1n78dcx"><option>-- auto --</option><!><!></select></div> <div class="field-group svelte-1n78dcx"><label class="field-label svelte-1n78dcx" for="ws-remote">Remote origin</label> <input id="ws-remote" type="text" class="field-input svelte-1n78dcx" placeholder="origin"/></div> <div class="field-group svelte-1n78dcx"><label class="field-label svelte-1n78dcx" for="ws-branch-prefix">Branch prefix</label> <input id="ws-branch-prefix" type="text" class="field-input svelte-1n78dcx" placeholder="e.g. dy/"/></div></section> <div class="divider svelte-1n78dcx"></div> <section class="settings-section svelte-1n78dcx"><h3 class="section-label svelte-1n78dcx">SESSION DEFAULTS <!></h3> <div class="inline-row svelte-1n78dcx"><label class="field-label svelte-1n78dcx" for="ws-agent">Default agent</label> <select id="ws-agent" class="field-select field-select-inline svelte-1n78dcx"><option>Claude</option><option>Codex</option></select></div> <div class="checkbox-row svelte-1n78dcx"><label class="checkbox-label svelte-1n78dcx"><input type="checkbox" class="dialog-checkbox svelte-1n78dcx"/> <span>Continue</span></label> <label class="checkbox-label svelte-1n78dcx"><input type="checkbox" class="dialog-checkbox svelte-1n78dcx"/> <span>YOLO</span></label> <label class="checkbox-label svelte-1n78dcx"><input type="checkbox" class="dialog-checkbox svelte-1n78dcx"/> <span>Tmux</span></label></div></section> <div class="divider svelte-1n78dcx"></div> <section class="settings-section svelte-1n78dcx"><h3 class="section-label svelte-1n78dcx">PROMPTS</h3> <div class="prompt-group svelte-1n78dcx"><button class="prompt-toggle svelte-1n78dcx"><span class="prompt-arrow svelte-1n78dcx"> </span> Code review preferences</button> <!></div> <div class="prompt-group svelte-1n78dcx"><button class="prompt-toggle svelte-1n78dcx"><span class="prompt-arrow svelte-1n78dcx"> </span> Create PR preferences</button> <!></div> <div class="prompt-group svelte-1n78dcx"><button class="prompt-toggle svelte-1n78dcx"><span class="prompt-arrow svelte-1n78dcx"> </span> Branch rename preferences</button> <!></div> <div class="prompt-group svelte-1n78dcx"><button class="prompt-toggle svelte-1n78dcx"><span class="prompt-arrow svelte-1n78dcx"> </span> General preferences</button> <!></div></section></div> <div class="dialog-footer svelte-1n78dcx"><button class="btn btn-danger svelte-1n78dcx">Remove Workspace</button> <div class="footer-right svelte-1n78dcx"><!> <!> <button class="btn btn-primary svelte-1n78dcx"> </button></div></div></div></dialog>');function Mx(e,t){_t(t,!0);let i,r=W(""),s=W(""),n=W(!1),o=W(""),l=W(!1),h=W($e([])),c=W(""),u=W(""),d=W(""),f=W("claude"),_=W(!1),p=W(!1),b=W(!1),g=W(""),S=W(""),x=W(""),C=W(""),w=W($e([])),k=W($e({})),M=W(!1),B=W(!1),K=W(!1),j=W(!1);async function se(X,Ke){m(r,X,!0),m(s,Ke,!0),m(o,""),m(l,!1),m(n,!1),m(c,""),m(u,""),m(d,""),m(f,"claude"),m(_,!1),m(p,!1),m(b,!1),m(g,""),m(S,""),m(x,""),m(C,""),i.showModal();try{const[ht,Cn]=await Promise.all([Qd(X),od(X).catch(()=>[])]);m(h,Cn,!0),N(ht.settings),m(k,{defaultAgent:ht.settings.defaultAgent,defaultContinue:ht.settings.defaultContinue,defaultYolo:ht.settings.defaultYolo,launchInTmux:ht.settings.launchInTmux},!0),m(w,ht.overridden,!0)}catch{m(o,"Failed to load workspace settings.")}}function Y(){i.close()}function N(X){m(c,X.defaultBranch??"",!0),m(u,X.remote??"",!0),m(d,X.branchPrefix??"",!0),m(f,X.defaultAgent??"claude",!0),m(_,X.defaultContinue??!1,!0),m(p,X.defaultYolo??!1,!0),m(b,X.launchInTmux??!1,!0),m(g,X.promptCodeReview??"",!0),m(S,X.promptCreatePr??"",!0),m(x,X.promptBranchRename??"",!0),m(C,X.promptGeneral??"",!0)}async function L(){m(n,!0),m(o,""),m(l,!1);try{const X={};a(f)!==a(k).defaultAgent&&(X.defaultAgent=a(f)),a(_)!==a(k).defaultContinue&&(X.defaultContinue=a(_)),a(p)!==a(k).defaultYolo&&(X.defaultYolo=a(p)),a(b)!==a(k).launchInTmux&&(X.launchInTmux=a(b)),a(c)&&(X.defaultBranch=a(c)),a(u)&&(X.remote=a(u)),a(d)&&(X.branchPrefix=a(d)),a(g)&&(X.promptCodeReview=a(g)),a(S)&&(X.promptCreatePr=a(S)),a(x)&&(X.promptBranchRename=a(x)),a(C)&&(X.promptGeneral=a(C)),Object.keys(X).length>0&&await Jd(a(r),X),m(l,!0),setTimeout(()=>{m(l,!1)},2e3)}catch(X){m(o,X instanceof Error?X.message:"Failed to save settings.",!0)}finally{m(n,!1)}}async function T(){m(n,!0),m(o,"");try{await Jd(a(r),{defaultAgent:null,defaultContinue:null,defaultYolo:null,launchInTmux:null});const X=await Qd(a(r));N(X.settings),m(k,{defaultAgent:X.settings.defaultAgent,defaultContinue:X.settings.defaultContinue,defaultYolo:X.settings.defaultYolo,launchInTmux:X.settings.launchInTmux},!0),m(w,X.overridden,!0),m(l,!0),setTimeout(()=>{m(l,!1)},2e3)}catch(X){m(o,X instanceof Error?X.message:"Failed to reset settings.",!0)}finally{m(n,!1)}}function O(){i.close(),t.onRemoveWorkspace(a(r))}function U(X){X.target===i&&i.close()}var R={open:se,close:Y},E=Px(),J=y(E),te=y(J),pe=y(te),ke=D(y(pe)),ue=D(pe,2),Ce=D(te,2),De=y(Ce);{var Te=X=>{var Ke=yx(),ht=y(Ke);le(()=>oe(ht,a(o))),I(X,Ke)};re(De,X=>{a(o)&&X(Te)})}var ve=D(De,2),ye=D(y(ve),2),ge=D(y(ye),2),Oe=y(ge);Oe.value=Oe.__value="";var Ne=D(Oe);Zt(Ne,17,()=>a(h),jo,(X,Ke)=>{var ht=Sx(),Cn=y(ht),Id={};le(()=>{oe(Cn,a(Ke)),Id!==(Id=a(Ke))&&(ht.value=(ht.__value=a(Ke))??"")}),I(X,ht)});var Ue=D(Ne);{var Re=X=>{var Ke=wx(),ht=y(Ke),Cn={};le(()=>{oe(ht,a(c)),Cn!==(Cn=a(c))&&(Ke.value=(Ke.__value=a(c))??"")}),I(X,Ke)},Ze=de(()=>a(c)&&!a(h).includes(a(c)));re(Ue,X=>{a(Ze)&&X(Re)})}var Z=D(ye,2),_e=D(y(Z),2),A=D(Z,2),Q=D(y(A),2),ne=D(ve,4),ee=y(ne),Se=D(y(ee));{var he=X=>{var Ke=Cx();I(X,Ke)},Me=de(()=>a(w).some(X=>["defaultAgent","defaultContinue","defaultYolo","launchInTmux"].includes(X)));re(Se,X=>{a(Me)&&X(he)})}var Le=D(ee,2),z=D(y(Le),2),$=y(z);$.value=$.__value="claude";var me=D($);me.value=me.__value="codex";var P=D(Le,2),H=y(P),ce=y(H),we=D(H,2),Pe=y(we),be=D(we,2),Ee=y(be),Qe=D(ne,4),st=D(y(Qe),2),Et=y(st),Be=y(Et),Fe=y(Be),Ye=D(Et,2);{var nt=X=>{var Ke=kx();ze(Ke,"rows",3),Ui(Ke,()=>a(g),ht=>m(g,ht)),I(X,Ke)};re(Ye,X=>{a(M)&&X(nt)})}var ot=D(st,2),Lt=y(ot),Si=y(Lt),ei=y(Si),wi=D(Lt,2);{var Or=X=>{var Ke=xx();ze(Ke,"rows",3),Ui(Ke,()=>a(S),ht=>m(S,ht)),I(X,Ke)};re(wi,X=>{a(B)&&X(Or)})}var Jr=D(ot,2),Ms=y(Jr),Sa=y(Ms),Wl=y(Sa),wa=D(Ms,2);{var Hl=X=>{var Ke=Ex();ze(Ke,"rows",3),Ui(Ke,()=>a(x),ht=>m(x,ht)),I(X,Ke)};re(wa,X=>{a(K)&&X(Hl)})}var zl=D(Jr,2),wn=y(zl),Ul=y(wn),Kl=y(Ul),Ve=D(wn,2);{var et=X=>{var Ke=Dx();ze(Ke,"rows",3),Ui(Ke,()=>a(C),ht=>m(C,ht)),I(X,Ke)};re(Ve,X=>{a(j)&&X(et)})}var ti=D(Ce,2),Ca=y(ti),ql=D(Ca,2),ka=y(ql);{var Fp=X=>{var Ke=Tx();le(()=>Ke.disabled=a(n)),V("click",Ke,T),I(X,Ke)},Wp=de(()=>a(w).some(X=>["defaultAgent","defaultContinue","defaultYolo","launchInTmux"].includes(X)));re(ka,X=>{a(Wp)&&X(Fp)})}var Ld=D(ka,2);{var Hp=X=>{var Ke=Rx();I(X,Ke)};re(Ld,X=>{a(l)&&X(Hp)})}var jl=D(Ld,2),zp=y(jl);return it(E,X=>i=X,()=>i),le(()=>{oe(ke,` ${a(s)??""}`),ze(Et,"aria-expanded",a(M)),oe(Fe,a(M)?"▾":"▸"),ze(Lt,"aria-expanded",a(B)),oe(ei,a(B)?"▾":"▸"),ze(Ms,"aria-expanded",a(K)),oe(Wl,a(K)?"▾":"▸"),ze(wn,"aria-expanded",a(j)),oe(Kl,a(j)?"▾":"▸"),jl.disabled=a(n),oe(zp,a(n)?"Saving…":"Save")}),V("click",E,U),V("click",ue,()=>i.close()),Za(ge,()=>a(c),X=>m(c,X)),Ui(_e,()=>a(u),X=>m(u,X)),Ui(Q,()=>a(d),X=>m(d,X)),Za(z,()=>a(f),X=>m(f,X)),sr(ce,()=>a(_),X=>m(_,X)),sr(Pe,()=>a(p),X=>m(p,X)),sr(Ee,()=>a(b),X=>m(b,X)),V("click",Et,()=>{m(M,!a(M))}),V("click",Lt,()=>{m(B,!a(B))}),V("click",Ms,()=>{m(K,!a(K))}),V("click",wn,()=>{m(j,!a(j))}),V("click",Ca,O),V("click",jl,L),I(e,E),vt(R)}pt(["click"]);var Ax=F('<div class="sidebar-overlay svelte-13zv0lp"></div>'),Ox=F("<!> <!> <!> <!>",1),Lx=F('<div class="main-app svelte-13zv0lp"><!> <!> <div class="terminal-area svelte-13zv0lp"><!> <!></div></div> <!> <!> <!> <!> <!> <!> <!>',1);function Ix(e,t){_t(t,!0);const i=new Op({defaultOptions:{queries:{staleTime:60*1e3,gcTime:600*1e3,refetchOnWindowFocus:!0}}}),r=V_(),s=ad(),n=hd(),o=cd();function l(A,Q){n.activeSessionId=A;const ne=n.sessions.find(ee=>ee.id===A);ne&&(s.activeWorkspacePath=ne.repoPath),su(A),Ti()}Cb(l);let h=W(void 0),c=W(void 0),u=W(void 0),d=W(void 0),f=W(void 0),_=W(void 0),p=W(void 0),b=W(!1);fo(()=>{hb();let A,Q;if(jt&&window.visualViewport){const Se=window.visualViewport;let he=null;const Me=()=>{const Le=window.innerHeight-Se.height;m(b,Le>50),a(p)&&(a(p).style.height=a(b)?Se.height+"px":""),window.scrollTo(0,0),he&&clearTimeout(he),he=setTimeout(()=>{var z;return(z=a(h))==null?void 0:z.fitTerm()},100)};Se.addEventListener("resize",Me),Se.addEventListener("scroll",Me),A=()=>{Se.removeEventListener("resize",Me),Se.removeEventListener("scroll",Me),he&&clearTimeout(he)}}const ne=navigator.platform.toUpperCase().includes("MAC");let ee;{const Se=he=>{var z;const Me=(z=document.activeElement)==null?void 0:z.tagName;if(!(Me==="INPUT"||Me==="TEXTAREA"||!(ne?he.metaKey:he.ctrlKey))){if(he.key==="t"&&!he.shiftKey){he.preventDefault(),se();return}if(he.key==="w"&&!he.shiftKey){he.preventDefault(),n.activeSessionId&&J(n.activeSessionId);return}if(!he.shiftKey&&he.key>="1"&&he.key<="9"){const $=a(C);if($.length===0)return;he.preventDefault();const me=parseInt(he.key,10),P=me===9?$[$.length-1]:$[me-1];P&&j(P.id);return}if(he.shiftKey&&he.key==="["){const $=a(C);if($.length===0)return;he.preventDefault();const me=$.findIndex(H=>H.id===n.activeSessionId),P=me<=0?$[$.length-1]:$[me-1];P&&j(P.id);return}if(he.shiftKey&&he.key==="]"){const $=a(C);if($.length===0)return;he.preventDefault();const me=$.findIndex(H=>H.id===n.activeSessionId),P=me===-1||me===$.length-1?$[0]:$[me+1];P&&j(P.id);return}}};document.addEventListener("keydown",Se),ee=()=>document.removeEventListener("keydown",Se)}if(jt){let Me=0,Le=0,z=!1;const $=H=>{const ce=H.touches[0];ce&&ce.clientX<=30&&!s.sidebarOpen&&(Me=ce.clientX,Le=ce.clientY,z=!0)},me=H=>{if(!z)return;const ce=H.touches[0];if(!ce)return;const we=ce.clientX-Me,Pe=Math.abs(ce.clientY-Le);if(Pe>we&&(Pe>8||we>8)){z=!1;return}we>=50&&(z=!1,iu())},P=()=>{z=!1};document.addEventListener("touchstart",$,{passive:!0}),document.addEventListener("touchmove",me,{passive:!0}),document.addEventListener("touchend",P),Q=()=>{document.removeEventListener("touchstart",$),document.removeEventListener("touchmove",me),document.removeEventListener("touchend",P)}}return()=>{ee==null||ee(),A==null||A(),Q==null||Q()}}),cr(()=>{r.authenticated&&Ft().then(()=>{const Q=new URLSearchParams(window.location.search).get("session");Q&&(window.history.replaceState({},"","/"),l(Q)),!n.activeSessionId&&!Q&&n.sessions.length===1&&j(n.sessions[0].id),!n.activeSessionId&&!Q&&n.sessions.length===1&&j(n.sessions[0].id);for(const ne of n.sessions)go(ne.id,o.defaultNotifications);kb().then(()=>{xb(Pb())})})}),cr(()=>{r.authenticated&&dv(A=>{A.type==="worktrees-changed"?Ft():A.type==="session-state-changed"&&A.sessionId&&A.state?Tb(A.sessionId,A.state):A.type==="session-idle-changed"&&A.sessionId?Rb(A.sessionId,A.idle??!1):A.type==="session-renamed"&&A.sessionId?Db(A.sessionId,A.branchName??"",A.displayName??""):A.type==="session-ended"&&(i.invalidateQueries({queryKey:["pr"]}),i.invalidateQueries({queryKey:["ci-status"]}))})});let g=de(()=>s.activeWorkspacePath?n.workspaces.find(A=>A.path===s.activeWorkspacePath):void 0),S=de(()=>s.activeWorkspacePath?lv(s.activeWorkspacePath):[]),x=de(()=>n.activeSessionId?n.sessions.find(A=>A.id===n.activeSessionId):void 0),C=de(()=>a(x)?a(S).filter(A=>A.repoPath===a(x).repoPath):a(S)),w=de(()=>!!a(x)&&!!s.activeWorkspacePath&&(a(x).repoPath===s.activeWorkspacePath||a(x).repoPath.startsWith(s.activeWorkspacePath+"/"))),k=de(()=>{var A,Q;return((A=a(x))==null?void 0:A.displayName)||((Q=a(g))==null?void 0:Q.name)||"Claude Remote CLI"}),M=de(()=>{var A;return((A=a(x))==null?void 0:A.useTmux)??!1}),B=W(!1),K=de(()=>a(g)?a(w)?"session":"dashboard":"empty");function j(A){var ne;n.activeSessionId=A;const Q=n.sessions.find(ee=>ee.id===A);if(Q){const ee=n.workspaces.find(Se=>Q.repoPath===Se.path||Q.repoPath.startsWith(Se.path+"/"));s.activeWorkspacePath=(ee==null?void 0:ee.path)??Q.repoPath}su(A),Ti(),(ne=a(h))==null||ne.focusTerm(),Mb(A)}function se(A,Q){var ne,ee;a(g)?(ne=a(u))==null||ne.open({name:a(g).name,path:a(g).path,root:""},Q):(ee=a(u))==null||ee.open(void 0,Q)}function Y(A){var Q,ne;A?(Q=a(_))==null||Q.open(A.path,A.name):(ne=a(d))==null||ne.open()}async function N(A){var ne,ee;const Q=`new-worktree:${A.path}`;if(!Qi(Q)){En(Q);try{const{branchName:Se,worktreePath:he}=await Ql(A.path),Me=await hn({repoPath:A.path,repoName:A.name,worktreePath:he,branchName:Se,needsBranchRename:!0});await Ft(),n.activeSessionId=Me.id,s.activeWorkspacePath=A.path,go(Me.id,o.defaultNotifications),Ti(),(ne=a(h))==null||ne.focusTerm()}catch{(ee=a(u))==null||ee.open({name:A.name,path:A.path,root:""})}finally{Dn(Q)}}}async function L(A){if(!a(g))return;const Q=a(g).path,ne=n.sessions.find(he=>he.branchName===A.headRefName&&he.repoPath.startsWith(Q)),ee=n.worktrees.find(he=>he.branchName===A.headRefName&&he.repoPath===Q);let Se=`Merge the branch "${A.baseRefName}" into this branch and resolve all merge conflicts. Use \`git merge ${A.baseRefName}\` and fix any conflicts in the working tree. After resolving, verify the build passes.`;try{const he=await ob(Q);he.promptFixConflicts&&(Se=he.promptFixConflicts.replace(/\{baseRefName\}/g,A.baseRefName).replace(/\{headRefName\}/g,A.headRefName))}catch{}try{let he,Me;if(ne)he=ne.repoPath,Me=ne.branchName;else if(ee)he=ee.path,Me=ee.branchName;else{const z=await Ql(Q,A.headRefName);he=z.worktreePath,Me=z.branchName}const Le=await hn({repoPath:Q,repoName:a(g).name,worktreePath:he,branchName:Me,allowMultiple:!0});await Ft(),n.activeSessionId=Le.id,s.activeWorkspacePath=Q,go(Le.id,o.defaultNotifications),Ti(),setTimeout(()=>{ks(Se+"\r")},1500)}catch(he){console.error("Failed to start conflict resolution:",he)}}async function T(A,Q){if(!a(g))return;const ne=a(g).path,ee=n.sessions.find(he=>he.branchName===A.headRefName&&he.repoPath.startsWith(ne)),Se=n.worktrees.find(he=>he.branchName===A.headRefName&&he.repoPath===ne);try{let he,Me;if(ee)he=ee.repoPath,Me=ee.branchName;else if(Se)he=Se.path,Me=Se.branchName;else{const z=await Ql(ne,A.headRefName);he=z.worktreePath,Me=z.branchName}const Le=await hn({repoPath:ne,repoName:a(g).name,worktreePath:he,branchName:Me,allowMultiple:!0});await Ft(),n.activeSessionId=Le.id,s.activeWorkspacePath=ne,go(Le.id,o.defaultNotifications),Ti(),Q&&setTimeout(()=>{ks(Q+"\r")},1500)}catch(he){console.error("Failed to open PR branch session:",he)}}function O(A){const Q=A.state==="OPEN"?"OPEN":A.state==="MERGED"?"MERGED":"CLOSED",ne=dd({commitsAhead:1,prState:Q,ciFailing:0,ciPending:0,ciTotal:0,mergeable:A.mergeable??null,unresolvedCommentCount:0}),ee=vv(ne,{branchName:A.headRefName,baseBranch:A.baseRefName,prNumber:A.number});ee&&T(A,ee)}function U(A){T(A)}function R(A){var Q;(Q=a(f))==null||Q.open(A)}function E(A){var Q;n.activeSessionId=A,go(A,o.defaultNotifications),Ti(),(Q=a(h))==null||Q.focusTerm()}function J(A){var Q;if(fetch(`/sessions/${A}`,{method:"DELETE"}).then(()=>Ft()),n.activeSessionId===A){const ne=a(C).filter(ee=>ee.id!==A);n.activeSessionId=((Q=ne[0])==null?void 0:Q.id)??null}}function te(A,Q,ne){var ee,Se;(ee=a(c))==null||ee.show(A,Q,ne),Q||(Se=a(c))==null||Se.autoDismiss(3e3)}function pe(A){ks(A)}function ke(){}function ue(){}function Ce(){const A=document.createElement("input");A.type="file",A.accept="image/*",A.onchange=()=>{var ne,ee;const Q=(ne=A.files)==null?void 0:ne[0];Q&&((ee=a(h))==null||ee.handleImageUpload(Q,Q.type))},A.click()}function De(){var A;(A=a(h))==null||A.focusTerm()}function Te(A){m(B,A,!0)}function ve(){var A;(A=a(h))==null||A.exitCopyMode()}let ye=W(void 0);function ge(){var A;(A=a(ye))==null||A.open()}async function Oe(A){await Ft(),A.length>0&&(s.activeWorkspacePath=A[0])}async function Ne(){const A=n.activeSessionId;if(!A)return;const Q=n.sessions.find(ne=>ne.id===A);if(Q){if(await Vm(A),Q.type==="worktree"){const ne=n.workspaces.find(ee=>Q.repoPath===ee.path||Q.repoPath.startsWith(ee.path+"/"));if(ne&&Q.repoPath!==ne.path)try{await q_(Q.repoPath,ne.path)}catch{}}n.activeSessionId=null,await Ft()}}var Ue=Vr(),Re=kt(Ue);{var Ze=A=>{},Z=A=>{Nb(A,{})},_e=A=>{MC(A,{get client(){return i},children:(Q,ne)=>{var ee=Lx(),Se=kt(ee),he=y(Se);{var Me=Be=>{var Fe=Ax();V("click",Fe,function(...Ye){Ti==null||Ti.apply(this,Ye)}),I(Be,Fe)};re(he,Be=>{s.sidebarOpen&&Be(Me)})}var Le=D(he,2);OS(Le,{onSelectSession:j,onOpenSettings:Y,onNewWorktree:N,onAddWorkspace:ge,onDeleteSession:J,onDeleteWorktree:R});var z=D(Le,2),$=y(z);Ok($,{get title(){return a(k)},get onMenuClick(){return iu},get hidden(){return a(b)}});var me=D($,2);{var P=Be=>{Dk(Be,{heading:"Add a workspace to get started",description:"Point to any folder on your machine. Git repos get PR tracking and branch management.",actionLabel:"+ Add Workspace",onAction:ge})},H=Be=>{{let Fe=de(()=>s.activeWorkspacePath??""),Ye=de(()=>{var ot;return((ot=a(g))==null?void 0:ot.name)??""}),nt=de(()=>Qi(`new-worktree:${s.activeWorkspacePath??""}`));wk(Be,{get workspacePath(){return a(Fe)},get workspaceName(){return a(Ye)},get creatingWorktree(){return a(nt)},onNewSession:()=>se(),onNewWorktree:()=>{a(g)&&N(a(g))},onFixConflicts:L,onPrAction:O,onOpenPrSession:U})}},ce=Be=>{var Fe=Ox(),Ye=kt(Fe);{let Si=de(()=>s.activeWorkspacePath??""),ei=de(()=>{var wi;return((wi=a(x))==null?void 0:wi.branchName)??""});XC(Ye,{get workspacePath(){return a(Si)},get branchName(){return a(ei)},get sessionId(){return n.activeSessionId},onArchive:Ne})}var nt=D(Ye,2);ek(nt,{get sessions(){return a(C)},get activeSessionId(){return n.activeSessionId},onSelectSession:j,onCloseSession:J,onNewSession:()=>se(),onNewTerminal:()=>se(void 0,{agent:"claude"})});var ot=D(nt,2);it(G1(ot,{get sessionId(){return n.activeSessionId},onImageUpload:te,get useTmux(){return a(M)},onCopyModeChange:Te}),Si=>m(h,Si,!0),()=>a(h));var Lt=D(ot,2);Mk(Lt,{onSendKey:pe,onFlushComposedText:ke,onClearInput:ue,onUploadImage:Ce,onRefocusMobileInput:De,get useTmux(){return a(M)},get inCopyMode(){return a(B)},onExitCopyMode:ve}),I(Be,Fe)};re(me,Be=>{a(K)==="empty"?Be(P):a(K)==="dashboard"?Be(H,1):a(K)==="session"&&Be(ce,2)})}it(Se,Be=>m(p,Be),()=>a(p));var we=D(Se,2);it(Vk(we,{onSessionCreated:E}),Be=>m(u,Be,!0),()=>a(u));var Pe=D(we,2);it(ex(Pe,{}),Be=>m(d,Be,!0),()=>a(d));var be=D(Pe,2);it(sx(be,{}),Be=>m(f,Be,!0),()=>a(f));var Ee=D(be,2);it(bx(Ee,{onWorkspacesAdded:Oe}),Be=>m(ye,Be,!0),()=>a(ye));var Qe=D(Ee,2);it(Mx(Qe,{onRemoveWorkspace:async Be=>{await fetch("/workspaces",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:Be})}),await Ft(),s.activeWorkspacePath===Be&&(s.activeWorkspacePath=null)}}),Be=>m(_,Be,!0),()=>a(_));var st=D(Qe,2);Bk(st,{});var Et=D(st,2);it(Wk(Et,{}),Be=>m(c,Be,!0),()=>a(c)),I(Q,ee)},$$slots:{default:!0}})};re(Re,A=>{r.checking?A(Ze):r.authenticated?A(_e,!1):A(Z,1)})}I(e,Ue),vt()}pt(["click"]);_m(Ix,{target:document.getElementById("app")});
|