smart-home-engine 1.14.4 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,232 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jsonMode-tUihOf0o.js","assets/monaco-langs-Dt8a9eeo.js","assets/monaco-langs-DyX1CsEw.css","assets/tsMode-9-rhcl9D.js"])))=>i.map(i=>d[i]);
2
+ var KF=Object.defineProperty;var BS=o=>{throw TypeError(o)};var ZF=(o,e,t)=>e in o?KF(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var kn=(o,e,t)=>ZF(o,typeof e!="symbol"?e+"":e,t),Yb=(o,e,t)=>e.has(o)||BS("Cannot "+t);var Se=(o,e,t)=>(Yb(o,e,"read from private field"),t?t.call(o):e.get(o)),bn=(o,e,t)=>e.has(o)?BS("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,t),Cn=(o,e,t,i)=>(Yb(o,e,"write to private field"),i?i.call(o,t):e.set(o,t),t),ts=(o,e,t)=>(Yb(o,e,"access private method"),t);import{_ as sA,m as oA,l as Ai,A as Do,C as qe,I as ss,D as yp,a as Cs,g as rA,M as ni,b as Ki,E as la,c as q,r as Vn,d as Rr,e as S,f as XF,h as Qn,R as En,S as $i,i as lo,j as Nr,k as Fn,n as hn,o as Le,p as Ct,K as Ds,q as vi,s as Rt,t as Ms,u as Q,v as vn,O as Ha,w as Fs,P as Bi,x as Qb,y as wp,z as aA,B as ml,F as ca,G as JC,H as Zs,U as jn,J as F0,L as Fi,N as yl,Q as YF,T as Co,V as e1,W as QF,X as lA,$ as mi,Y as Rn,Z as Bn,a0 as as,a1 as sn,a2 as er,a3 as kg,a4 as Tt,a5 as Zx,a6 as JF,a7 as e3,a8 as Ts,a9 as t3,aa as da,ab as Ao,ac as Ti,ad as cA,ae as is,af as i3,ag as n3,ah as yo,ai as af,aj as As,ak as H_,al as mo,am as qc,an as kw,ao as W_,ap as qs,aq as L0,ar as Gs,as as z_,at as V_,au as s3,av as Sp,aw as lf,ax as Tl,ay as o3,az as cf,aA as r3,aB as Bw,aC as a3,aD as l3,aE as FS,aF as bs,aG as vl,aH as vo,aI as an,aJ as fl,aK as c3,aL as ja,aM as Yo,aN as Vs,aO as ua,aP as Fw,aQ as Rs,aR as ms,aS as ym,aT as rn,aU as dA,aV as d3,aW as Lw,aX as j_,aY as Iw,aZ as Pw,a_ as Ld,a$ as u3,b0 as Tw,b1 as h3,b2 as Mw,b3 as Ml,b4 as Rl,b5 as I0,b6 as Bg,b7 as Oo,b8 as Dp,b9 as wm,ba as Jb,bb as qn,bc as Rw,bd as Ap,be as $_,bf as f3,bg as uA,bh as Fg,bi as P0,bj as Lg,bk as kp,bl as U_,bm as Pn,bn as Gc,bo as Bp,bp as g3,bq as p3,br as Nw,bs as x3,bt as Sm,bu as gr,bv as Ow,bw as T0,bx as Nl,by as df,bz as xn,bA as M0,bB as hA,bC as Fp,bD as m3,bE as Id,bF as di,bG as LS,bH as Xx,bI as fA,bJ as Wr,bK as sa,bL as Zn,bM as R0,bN as Fr,bO as N0,bP as rs,bQ as Ig,bR as Zu,bS as t1,bT as gA,bU as pA,bV as xA,bW as Hw,bX as Io,bY as Wn,bZ as Lp,b_ as mA,b$ as _l,c0 as q_,c1 as v3,c2 as zh,c3 as IS,c4 as Ip,c5 as vA,c6 as Vh,c7 as _3,c8 as yr,c9 as G_,ca as b3,cb as ko,cc as ha,cd as Pp,ce as Pg,cf as _A,cg as ur,ch as Tp,ci as K_,cj as C3,ck as E3,cl as y3,cm as uf,cn as $a,co as js,cp as w3,cq as Ww,cr as S3,cs as D3,ct as PS,cu as A3,cv as Mp,cw as wl,cx as i1,cy as Bu,cz as Sl,cA as k3,cB as Wa,cC as Lr,cD as Uo,cE as TS,cF as uo,cG as Rp,cH as Nc,cI as Ua,cJ as B3,cK as fa,cL as Tg,cM as Z_,cN as bA,cO as F3,cP as L3,cQ as zw,cR as I3,cS as Mg,cT as P3,cU as dc,cV as Rg,cW as MS,cX as T3,cY as M3,cZ as Ka,c_ as R3,c$ as Vw,d0 as CA,d1 as EA,d2 as yA,d3 as wA,d4 as N3,d5 as O3,d6 as SA,d7 as DA,d8 as H3,d9 as jw,da as W3,db as z3,dc as cs,dd as V3,de as $w,df as j3,dg as jh,dh as RS,di as $3,dj as U3,dk as q3,dl as G3,dm as K3,dn as Z3,dp as O0,dq as X_,dr as n1,ds as X3,dt as Y3,du as NS,dv as s1,dw as Q3,dx as OS,dy as eC,dz as J3,dA as AA,dB as e4,dC as kA,dD as o1,dE as t4,dF as i4,dG as n4,dH as BA,dI as FA,dJ as s4,dK as Dm,dL as LA,dM as Y_,dN as o4,dO as r4,dP as Oc,dQ as Uw,dR as a4,dS as HS,dT as WS,dU as l4,dV as $h,dW as IA,dX as c4,dY as d4,dZ as u4,d_ as h4,d$ as PA,e0 as TA,e1 as MA,e2 as RA,e3 as f4,e4 as za,e5 as zS,e6 as g4,e7 as Np,e8 as p4,e9 as $f,ea as NA,eb as VS,ec as Ng,ed as OA,ee as Am,ef as x4,eg as HA,eh as m4,ei as WA,ej as v4,ek as _4,el as zA,em as VA,en as Dl,eo as Q_,ep as b4,eq as jA,er as Qo,es as Pd,et as $A,eu as C4,ev as E4,ew as UA,ex as qA,ey as y4,ez as GA,eA as KA,eB as Og,eC as w4,eD as S4,eE as D4,eF as A4,eG as Pf,eH as jS,eI as k4,eJ as B4,eK as F4,eL as km,eM as eo,eN as L4,eO as r1,eP as Xu,eQ as I4,eR as ul,eS as P4,eT as T4,eU as ZA,eV as M4,eW as ag,eX as R4,eY as N4,eZ as O4,e_ as H4,e$ as $S,f0 as US,f1 as qS,f2 as Yu,f3 as qw,f4 as XA,f5 as a1,f6 as Yx,f7 as YA,f8 as Bm,f9 as W4,fa as z4,fb as V4,fc as j4,fd as Gw,fe as QA,ff as $4,fg as Fm,fh as JA,fi as ek,fj as U4,fk as q4,fl as G4,fm as K4,fn as Z4,fo as X4,fp as Y4,fq as Q4,fr as tk,fs as J4,ft as Lm,fu as ik,fv as eL,fw as nk,fx as tL,fy as sk,fz as ok,fA as iL,fB as GS,fC as rk,fD as KS,fE as nL,fF as tC,fG as ZS,fH as sL,fI as oL,fJ as rL,fK as Ia,fL as Hc,fM as aL,fN as XS,fO as Qx,fP as lL,fQ as gl,fR as J_,fS as l1,fT as cL,fU as ak,fV as lk,fW as ho,fX as YS,fY as px,fZ as Kw,f_ as dL,f$ as uL,g0 as hL,g1 as fL,g2 as gL,g3 as pL,g4 as xL,g5 as mL,g6 as QS,g7 as vL,g8 as _L,g9 as bL,ga as H0,gb as lg,gc as ck,gd as CL,ge as Zw,gf as Jx,gg as xx,gh as iC,gi as EL,gj as yL,gk as dk,gl as wL,gm as Xw,gn as SL,go as DL,gp as uk,gq as eb,gr as AL,gs as Im,gt as Yw,gu as Qw,gv as Jw,gw as hk,gx as fk,gy as gk,gz as pk,gA as xk,gB as mk,gC as vk,gD as JS,gE as _k,gF as vh,gG as kL,gH as BL,gI as FL,gJ as LL,gK as bk,gL as IL,gM as PL,gN as e8,gO as c1,gP as mc,gQ as TL,gR as ML,gS as RL,gT as NL,gU as OL,gV as HL,gW as t8,gX as e9,gY as d1,gZ as WL,g_ as u1,g$ as zL,h0 as VL,h1 as jL,h2 as $L,h3 as t9,h4 as Ck,h5 as i8,h6 as n8,h7 as UL,h8 as qL,h9 as GL,ha as s8,hb as nC,hc as KL,hd as ZL,he as XL,hf as sC,hg as Ek,hh as yk,hi as wk,hj as Sk,hk as Al,hl as Dk,hm as i9,hn as o8,ho as YL,hp as Ak,hq as QL,hr as JL,hs as tb,ht as ib,hu as Qu,hv as nb,hw as Op,hx as e7,hy as sb,hz as t7,hA as i7,hB as n7,hC as kk,hD as Tf,hE as s7,hF as o7,hG as r7,hH as a7,hI as Hp,hJ as l7,hK as Bk,hL as Fk,hM as Lk,hN as h1,hO as c7,hP as d7,hQ as u7,hR as h7,hS as f7,hT as f1,hU as g7,hV as p7,hW as x7,hX as m7,hY as v7,hZ as _7,h_ as b7,h$ as C7,i0 as Ik,i1 as E7,i2 as y7,i3 as w7,i4 as r8,i5 as S7,i6 as D7,i7 as md,i8 as zo,i9 as g1,ia as Pk,ib as A7,ic as k7}from"./monaco-langs-Dt8a9eeo.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const s of n)if(s.type==="childList")for(const r of s.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function t(n){const s={};return n.integrity&&(s.integrity=n.integrity),n.referrerPolicy&&(s.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?s.credentials="include":n.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(n){if(n.ep)return;n.ep=!0;const s=t(n);fetch(n.href,s)}})();const Tk=!1;var n9=Array.isArray,B7=Array.prototype.indexOf,Pm=Array.prototype.includes,ob=Array.from,F7=Object.defineProperty,a0=Object.getOwnPropertyDescriptor,L7=Object.getOwnPropertyDescriptors,I7=Object.prototype,P7=Array.prototype,Mk=Object.getPrototypeOf,a8=Object.isExtensible;const rb=()=>{};function T7(o){for(var e=0;e<o.length;e++)o[e]()}function Rk(){var o,e,t=new Promise((i,n)=>{o=i,e=n});return{promise:t,resolve:o,reject:e}}function M7(o,e,t=!1){return o===void 0?t?e():e:o}function l8(o,e){if(Array.isArray(o))return o;if(!(Symbol.iterator in o))return Array.from(o);const t=[];for(const i of o)if(t.push(i),t.length===e)break;return t}const po=2,W0=4,ab=8,Nk=1<<24,oa=16,aa=32,Wc=64,p1=128,Tr=512,to=1024,so=2048,qa=4096,To=8192,Mr=16384,hf=32768,x1=1<<25,z0=65536,Tm=1<<17,R7=1<<18,ff=1<<19,N7=1<<20,Ra=1<<25,Fu=65536,Mm=1<<21,l0=1<<22,vc=1<<23,Td=Symbol("$state"),O7=Symbol("legacy props"),H7=Symbol(""),em=Symbol("attributes"),m1=Symbol("class"),v1=Symbol("style"),Uf=Symbol("text"),tm=Symbol("form reset"),lb=new class extends Error{constructor(){super(...arguments);kn(this,"name","StaleReactionError");kn(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var tA;const W7=!!((tA=globalThis.document)!=null&&tA.contentType)&&globalThis.document.contentType.includes("xml");function Ok(o){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function z7(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function V7(o,e,t){throw new Error("https://svelte.dev/e/each_key_duplicate")}function j7(o){throw new Error("https://svelte.dev/e/effect_in_teardown")}function $7(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function U7(o){throw new Error("https://svelte.dev/e/effect_orphan")}function q7(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function G7(o){throw new Error("https://svelte.dev/e/props_invalid_value")}function K7(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Z7(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function X7(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Y7(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const Q7=1,J7=2,Hk=4,eI=8,tI=16,iI=1,nI=4,sI=8,oI=16,rI=1,aI=2,Js=Symbol("uninitialized"),Wk="http://www.w3.org/1999/xhtml",lI="http://www.w3.org/2000/svg",cI="http://www.w3.org/1998/Math/MathML";function dI(){console.warn("https://svelte.dev/e/derived_inert")}function uI(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function hI(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function zk(o){return o===this.v}function fI(o,e){return o!=o?e==e:o!==e||o!==null&&typeof o=="object"||typeof o=="function"}function Vk(o){return!fI(o,this.v)}let gI=!1,go=null;function V0(o){go=o}function $s(o,e=!1,t){go={p:go,i:!1,c:null,e:null,s:o,x:null,r:zn,l:null}}function Us(o){var e=go,t=e.e;if(t!==null){e.e=null;for(var i of t)d6(i)}return o!==void 0&&(e.x=o),e.i=!0,go=e.p,o??{}}function jk(){return!0}let Ed=[];function $k(){var o=Ed;Ed=[],T7(o)}function _c(o){if(Ed.length===0&&!dg){var e=Ed;queueMicrotask(()=>{e===Ed&&$k()})}Ed.push(o)}function pI(){for(;Ed.length>0;)$k()}function Uk(o){var e=zn;if(e===null)return Hn.f|=vc,o;if((e.f&hf)===0&&(e.f&W0)===0)throw o;uc(o,e)}function uc(o,e){for(;e!==null;){if((e.f&p1)!==0){if((e.f&hf)===0)throw o;try{e.b.error(o);return}catch(t){o=t}}e=e.parent}throw o}const xI=-7169;function Ws(o,e){o.f=o.f&xI|e}function s9(o){(o.f&Tr)!==0||o.deps===null?Ws(o,to):Ws(o,qa)}function qk(o){if(o!==null)for(const e of o)(e.f&po)===0||(e.f&Fu)===0||(e.f^=Fu,qk(e.deps))}function Gk(o,e,t){(o.f&so)!==0?e.add(o):(o.f&qa)!==0&&t.add(o),qk(o.deps),Ws(o,to)}let mx=!1;function mI(o){var e=mx;try{return mx=!1,[o(),mx]}finally{mx=e}}let oC=null,_h=null,on=null,cg=null,co=null,_1=null,dg=!1,rC=!1,Uh=null,im=null;var c8=0;let vI=1;var h0,ac,Dd,f0,g0,p0,al,x0,Vo,mp,ll,Zr,ka,m0,Ad,ds,b1,qf,C1,Kk,Zk,Mh,_I,Gf;const qv=class qv{constructor(){bn(this,ds);kn(this,"id",vI++);bn(this,h0,!1);kn(this,"linked",!0);bn(this,ac,null);bn(this,Dd,null);kn(this,"async_deriveds",new Map);kn(this,"current",new Map);kn(this,"previous",new Map);bn(this,f0,new Set);bn(this,g0,new Set);bn(this,p0,0);bn(this,al,new Map);bn(this,x0,null);bn(this,Vo,[]);bn(this,mp,[]);bn(this,ll,new Set);bn(this,Zr,new Set);bn(this,ka,new Map);bn(this,m0,new Set);kn(this,"is_fork",!1);bn(this,Ad,!1);_h===null?oC=_h=this:(Cn(_h,Dd,this),Cn(this,ac,_h)),_h=this}skip_effect(e){Se(this,ka).has(e)||Se(this,ka).set(e,{d:[],m:[]}),Se(this,m0).delete(e)}unskip_effect(e,t=i=>this.schedule(i)){var i=Se(this,ka).get(e);if(i){Se(this,ka).delete(e);for(var n of i.d)Ws(n,so),t(n);for(n of i.m)Ws(n,qa),t(n)}Se(this,m0).add(e)}capture(e,t,i=!1){e.v!==Js&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&vc)===0&&(this.current.set(e,[t,i]),co==null||co.set(e,t)),this.is_fork||(e.v=t)}activate(){on=this}deactivate(){on=null,co=null}flush(){try{rC=!0,on=this,ts(this,ds,qf).call(this)}finally{c8=0,_1=null,Uh=null,im=null,rC=!1,on=null,co=null,Md.clear()}}discard(){var e;for(const t of Se(this,g0))t(this);Se(this,g0).clear(),ts(this,ds,Gf).call(this),(e=Se(this,x0))==null||e.resolve()}register_created_effect(e){Se(this,mp).push(e)}increment(e,t){if(Cn(this,p0,Se(this,p0)+1),e){let i=Se(this,al).get(t)??0;Se(this,al).set(t,i+1)}}decrement(e,t){if(Cn(this,p0,Se(this,p0)-1),e){let i=Se(this,al).get(t)??0;i===1?Se(this,al).delete(t):Se(this,al).set(t,i-1)}Se(this,Ad)||(Cn(this,Ad,!0),_c(()=>{Cn(this,Ad,!1),this.linked&&this.flush()}))}transfer_effects(e,t){for(const i of e)Se(this,ll).add(i);for(const i of t)Se(this,Zr).add(i);e.clear(),t.clear()}oncommit(e){Se(this,f0).add(e)}ondiscard(e){Se(this,g0).add(e)}settled(){return(Se(this,x0)??Cn(this,x0,Rk())).promise}static ensure(){if(on===null){const e=on=new qv;!rC&&!dg&&_c(()=>{Se(e,h0)||e.flush()})}return on}apply(){{co=null;return}}schedule(e){var n;if(_1=e,(n=e.b)!=null&&n.is_pending&&(e.f&(W0|ab|Nk))!==0&&(e.f&hf)===0){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var i=t.f;if(Uh!==null&&t===zn&&(Hn===null||(Hn.f&po)===0))return;if((i&(Wc|aa))!==0){if((i&to)===0)return;t.f^=to}}Se(this,Vo).push(t)}};h0=new WeakMap,ac=new WeakMap,Dd=new WeakMap,f0=new WeakMap,g0=new WeakMap,p0=new WeakMap,al=new WeakMap,x0=new WeakMap,Vo=new WeakMap,mp=new WeakMap,ll=new WeakMap,Zr=new WeakMap,ka=new WeakMap,m0=new WeakMap,Ad=new WeakMap,ds=new WeakSet,b1=function(){if(this.is_fork)return!0;for(const i of Se(this,al).keys()){for(var e=i,t=!1;e.parent!==null;){if(Se(this,ka).has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1},qf=function(){var d,u,f,g;Cn(this,h0,!0),c8++>1e3&&(ts(this,ds,Gf).call(this),CI());for(const p of Se(this,ll))Se(this,Zr).delete(p),Ws(p,so),this.schedule(p);for(const p of Se(this,Zr))Ws(p,qa),this.schedule(p);const e=Se(this,Vo);Cn(this,Vo,[]),this.apply();var t=Uh=[],i=[],n=im=[];for(const p of e)try{ts(this,ds,C1).call(this,p,t,i)}catch(C){throw Qk(p),ts(this,ds,b1).call(this)||this.discard(),C}if(on=null,n.length>0){var s=qv.ensure();for(const p of n)s.schedule(p)}if(Uh=null,im=null,ts(this,ds,b1).call(this)){ts(this,ds,Mh).call(this,i),ts(this,ds,Mh).call(this,t);for(const[p,C]of Se(this,ka))Yk(p,C);n.length>0&&ts(d=on,ds,qf).call(d);return}const r=ts(this,ds,Kk).call(this);if(r){ts(this,ds,Mh).call(this,i),ts(this,ds,Mh).call(this,t),ts(u=r,ds,Zk).call(u,this);return}Se(this,ll).clear(),Se(this,Zr).clear();for(const p of Se(this,f0))p(this);Se(this,f0).clear(),cg=this,d8(i),d8(t),cg=null,(f=Se(this,x0))==null||f.resolve();var a=on;if(Se(this,p0)===0&&(Se(this,Vo).length===0||a!==null)&&ts(this,ds,Gf).call(this),Se(this,Vo).length>0)if(a!==null){const p=a;Se(p,Vo).push(...Se(this,Vo).filter(C=>!Se(p,Vo).includes(C)))}else a=this;a!==null&&ts(g=a,ds,qf).call(g)},C1=function(e,t,i){e.f^=to;for(var n=e.first;n!==null;){var s=n.f,r=(s&(aa|Wc))!==0,a=r&&(s&to)!==0,d=a||(s&To)!==0||Se(this,ka).has(n);if(!d&&n.fn!==null){r?n.f^=to:(s&W0)!==0?t.push(n):zp(n)&&((s&oa)!==0&&Se(this,Zr).add(n),$0(n));var u=n.first;if(u!==null){n=u;continue}}for(;n!==null;){var f=n.next;if(f!==null){n=f;break}n=n.parent}}},Kk=function(){for(var e=Se(this,ac);e!==null;){if(!e.is_fork){for(const[t,[,i]]of this.current)if(e.current.has(t)&&!i)return e}e=Se(e,ac)}return null},Zk=function(e){var i;for(const[n,s]of e.current)!this.previous.has(n)&&e.previous.has(n)&&this.previous.set(n,e.previous.get(n)),this.current.set(n,s);for(const[n,s]of e.async_deriveds){const r=this.async_deriveds.get(n);r&&s.promise.then(r.resolve).catch(r.reject)}this.transfer_effects(Se(e,ll),Se(e,Zr));const t=n=>{var s=n.reactions;if(s!==null)for(const d of s){var r=d.f;if((r&po)!==0)t(d);else{var a=d;r&(l0|oa)&&!this.async_deriveds.has(a)&&(Se(this,Zr).delete(a),Ws(a,so),this.schedule(a))}}};for(const n of this.current.keys())t(n);this.oncommit(()=>e.discard()),ts(i=e,ds,Gf).call(i),on=this,ts(this,ds,qf).call(this)},Mh=function(e){for(var t=0;t<e.length;t+=1)Gk(e[t],Se(this,ll),Se(this,Zr))},_I=function(){var f;for(let g=oC;g!==null;g=Se(g,Dd)){var e=g.id<this.id,t=[];for(const[p,[C,b]]of this.current){if(g.current.has(p)){var i=g.current.get(p)[0];if(e&&C!==i)g.current.set(p,[C,b]);else continue}t.push(p)}if(e)for(const[p,C]of this.async_deriveds){const b=g.async_deriveds.get(p);b&&C.promise.then(b.resolve).catch(b.reject)}if(Se(g,h0)){var n=[...g.current.keys()].filter(p=>!g.current.get(p)[1]&&!this.current.has(p));if(n.length===0)e&&g.discard();else if(t.length>0){if(e)for(const p of Se(this,m0))g.unskip_effect(p,C=>{var b;(C.f&(oa|l0))!==0?g.schedule(C):ts(b=g,ds,Mh).call(b,[C])});g.activate();var s=new Set,r=new Map;for(var a of t)Xk(a,n,s,r);r=new Map;var d=[...g.current].filter(([p,C])=>{const b=this.current.get(p);return b?b[0]!==C[0]||b[1]!==C[1]:!0}).map(([p])=>p);if(d.length>0)for(const p of Se(this,mp))(p.f&(Mr|To|Tm))===0&&o9(p,d,r)&&((p.f&(l0|oa))!==0?(Ws(p,so),g.schedule(p)):Se(g,ll).add(p));if(Se(g,Vo).length>0&&!Se(g,Ad)){g.apply();for(var u of Se(g,Vo))ts(f=g,ds,C1).call(f,u,[],[]);Cn(g,Vo,[])}g.deactivate()}}}},Gf=function(){if(this.linked){var e=Se(this,ac),t=Se(this,Dd);e===null?oC=t:Cn(e,Dd,t),t===null?_h=e:Cn(t,ac,e),this.linked=!1}};let Lu=qv;function bI(o){var e=dg;dg=!0;try{for(var t;;){if(pI(),on===null)return t;on.flush()}}finally{dg=e}}function CI(){try{q7()}catch(o){uc(o,_1)}}let qr=null;function d8(o){var e=o.length;if(e!==0){for(var t=0;t<e;){var i=o[t++];if((i.f&(Mr|To))===0&&zp(i)&&(qr=new Set,$0(i),i.deps===null&&i.first===null&&i.nodes===null&&i.teardown===null&&i.ac===null&&f6(i),(qr==null?void 0:qr.size)>0)){Md.clear();for(const n of qr){if((n.f&(Mr|To))!==0)continue;const s=[n];let r=n.parent;for(;r!==null;)qr.has(r)&&(qr.delete(r),s.push(r)),r=r.parent;for(let a=s.length-1;a>=0;a--){const d=s[a];(d.f&(Mr|To))===0&&$0(d)}}qr.clear()}}qr=null}}function Xk(o,e,t,i){if(!t.has(o)&&(t.add(o),o.reactions!==null))for(const n of o.reactions){const s=n.f;(s&po)!==0?Xk(n,e,t,i):(s&(l0|oa))!==0&&(s&so)===0&&o9(n,e,i)&&(Ws(n,so),r9(n))}}function o9(o,e,t){const i=t.get(o);if(i!==void 0)return i;if(o.deps!==null)for(const n of o.deps){if(Pm.call(e,n))return!0;if((n.f&po)!==0&&o9(n,e,t))return t.set(n,!0),!0}return t.set(o,!1),!1}function r9(o){on.schedule(o)}function Yk(o,e){if(!((o.f&aa)!==0&&(o.f&to)!==0)){(o.f&so)!==0?e.d.push(o):(o.f&qa)!==0&&e.m.push(o),Ws(o,to);for(var t=o.first;t!==null;)Yk(t,e),t=t.next}}function Qk(o){Ws(o,to);for(var e=o.first;e!==null;)Qk(e),e=e.next}function EI(o){let e=0,t=Iu(0),i;return()=>{d9()&&(c(t),db(()=>(e===0&&(i=Hl(()=>o(()=>ug(t)))),e+=1,()=>{_c(()=>{e-=1,e===0&&(i==null||i(),i=void 0,ug(t))})})))}}var yI=z0|ff;function wI(o,e,t,i){new SI(o,e,t,i)}var Sr,Aw,Dr,kd,jo,Ar,Fo,ar,cl,Bd,lc,v0,vp,_p,dl,Gv,zs,DI,AI,kI,E1,nm,sm,y1,w1;class SI{constructor(e,t,i,n){bn(this,zs);kn(this,"parent");kn(this,"is_pending",!1);kn(this,"transform_error");bn(this,Sr);bn(this,Aw,null);bn(this,Dr);bn(this,kd);bn(this,jo);bn(this,Ar,null);bn(this,Fo,null);bn(this,ar,null);bn(this,cl,null);bn(this,Bd,0);bn(this,lc,0);bn(this,v0,!1);bn(this,vp,new Set);bn(this,_p,new Set);bn(this,dl,null);bn(this,Gv,EI(()=>(Cn(this,dl,Iu(Se(this,Bd))),()=>{Cn(this,dl,null)})));var s;Cn(this,Sr,e),Cn(this,Dr,t),Cn(this,kd,r=>{var a=zn;a.b=this,a.f|=p1,i(r)}),this.parent=zn.b,this.transform_error=n??((s=this.parent)==null?void 0:s.transform_error)??(r=>r),Cn(this,jo,f9(()=>{ts(this,zs,E1).call(this)},yI))}defer_effect(e){Gk(e,Se(this,vp),Se(this,_p))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!Se(this,Dr).pending}update_pending_count(e,t){ts(this,zs,y1).call(this,e,t),Cn(this,Bd,Se(this,Bd)+e),!(!Se(this,dl)||Se(this,v0))&&(Cn(this,v0,!0),_c(()=>{Cn(this,v0,!1),Se(this,dl)&&j0(Se(this,dl),Se(this,Bd))}))}get_effect_pending(){return Se(this,Gv).call(this),c(Se(this,dl))}error(e){if(!Se(this,Dr).onerror&&!Se(this,Dr).failed)throw e;on!=null&&on.is_fork?(Se(this,Ar)&&on.skip_effect(Se(this,Ar)),Se(this,Fo)&&on.skip_effect(Se(this,Fo)),Se(this,ar)&&on.skip_effect(Se(this,ar)),on.oncommit(()=>{ts(this,zs,w1).call(this,e)})):ts(this,zs,w1).call(this,e)}}Sr=new WeakMap,Aw=new WeakMap,Dr=new WeakMap,kd=new WeakMap,jo=new WeakMap,Ar=new WeakMap,Fo=new WeakMap,ar=new WeakMap,cl=new WeakMap,Bd=new WeakMap,lc=new WeakMap,v0=new WeakMap,vp=new WeakMap,_p=new WeakMap,dl=new WeakMap,Gv=new WeakMap,zs=new WeakSet,DI=function(){try{Cn(this,Ar,kr(()=>Se(this,kd).call(this,Se(this,Sr))))}catch(e){this.error(e)}},AI=function(e){const t=Se(this,Dr).failed;t&&Cn(this,ar,kr(()=>{t(Se(this,Sr),()=>e,()=>()=>{})}))},kI=function(){const e=Se(this,Dr).pending;e&&(this.is_pending=!0,Cn(this,Fo,kr(()=>e(Se(this,Sr)))),_c(()=>{var t=Cn(this,cl,document.createDocumentFragment()),i=bl();t.append(i),Cn(this,Ar,ts(this,zs,sm).call(this,()=>kr(()=>Se(this,kd).call(this,i)))),Se(this,lc)===0&&(Se(this,Sr).before(t),Cn(this,cl,null),Nd(Se(this,Fo),()=>{Cn(this,Fo,null)}),ts(this,zs,nm).call(this,on))}))},E1=function(){try{if(this.is_pending=this.has_pending_snippet(),Cn(this,lc,0),Cn(this,Bd,0),Cn(this,Ar,kr(()=>{Se(this,kd).call(this,Se(this,Sr))})),Se(this,lc)>0){var e=Cn(this,cl,document.createDocumentFragment());p9(Se(this,Ar),e);const t=Se(this,Dr).pending;Cn(this,Fo,kr(()=>t(Se(this,Sr))))}else ts(this,zs,nm).call(this,on)}catch(t){this.error(t)}},nm=function(e){this.is_pending=!1,e.transfer_effects(Se(this,vp),Se(this,_p))},sm=function(e){var t=zn,i=Hn,n=go;Ga(Se(this,jo)),Or(Se(this,jo)),V0(Se(this,jo).ctx);try{return Lu.ensure(),e()}catch(s){return Uk(s),null}finally{Ga(t),Or(i),V0(n)}},y1=function(e,t){var i;if(!this.has_pending_snippet()){this.parent&&ts(i=this.parent,zs,y1).call(i,e,t);return}Cn(this,lc,Se(this,lc)+e),Se(this,lc)===0&&(ts(this,zs,nm).call(this,t),Se(this,Fo)&&Nd(Se(this,Fo),()=>{Cn(this,Fo,null)}),Se(this,cl)&&(Se(this,Sr).before(Se(this,cl)),Cn(this,cl,null)))},w1=function(e){Se(this,Ar)&&(Jo(Se(this,Ar)),Cn(this,Ar,null)),Se(this,Fo)&&(Jo(Se(this,Fo)),Cn(this,Fo,null)),Se(this,ar)&&(Jo(Se(this,ar)),Cn(this,ar,null));var t=Se(this,Dr).onerror;let i=Se(this,Dr).failed;var n=!1,s=!1;const r=()=>{if(n){hI();return}n=!0,s&&Y7(),Se(this,ar)!==null&&Nd(Se(this,ar),()=>{Cn(this,ar,null)}),ts(this,zs,sm).call(this,()=>{ts(this,zs,E1).call(this)})},a=d=>{try{s=!0,t==null||t(d,r),s=!1}catch(u){uc(u,Se(this,jo)&&Se(this,jo).parent)}i&&Cn(this,ar,ts(this,zs,sm).call(this,()=>{try{return kr(()=>{var u=zn;u.b=this,u.f|=p1,i(Se(this,Sr),()=>d,()=>r)})}catch(u){return uc(u,Se(this,jo).parent),null}}))};_c(()=>{var d;try{d=this.transform_error(e)}catch(u){uc(u,Se(this,jo)&&Se(this,jo).parent);return}d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(a,u=>uc(u,Se(this,jo)&&Se(this,jo).parent)):a(d)})};function BI(o,e,t,i){const n=Hg;var s=o.filter(p=>!p.settled);if(t.length===0&&s.length===0){i(e.map(n));return}var r=zn,a=FI(),d=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(p=>p.promise)):null;function u(p){if((r.f&Mr)===0){a();try{i(p)}catch(C){uc(C,r)}Rm()}}var f=Jk();if(t.length===0){d.then(()=>u(e.map(n))).finally(f);return}function g(){Promise.all(t.map(p=>LI(p))).then(p=>u([...e.map(n),...p])).catch(p=>uc(p,r)).finally(f)}d?d.then(()=>{a(),g(),Rm()}):g()}function FI(){var o=zn,e=Hn,t=go,i=on;return function(s=!0){Ga(o),Or(e),V0(t),s&&(o.f&Mr)===0&&(i==null||i.activate(),i==null||i.apply())}}function Rm(o=!0){Ga(null),Or(null),V0(null),o&&(on==null||on.deactivate())}function Jk(){var o=zn,e=o.b,t=on,i=!!(e!=null&&e.is_rendered());return e==null||e.update_pending_count(1,t),t.increment(i,o),()=>{e==null||e.update_pending_count(-1,t),t.decrement(i,o)}}function Hg(o){var e=po|so;return zn!==null&&(zn.f|=ff),{ctx:go,deps:null,effects:null,equals:zk,f:e,fn:o,reactions:null,rv:0,v:Js,wv:0,parent:zn,ac:null}}const vx=Symbol("obsolete");function LI(o,e,t){let i=zn;i===null&&z7();var n=void 0,s=Iu(Js),r=!Hn,a=new Set;return jI(()=>{var C,b;var d=zn,u=Rk();n=u.promise;try{Promise.resolve(o()).then(u.resolve,y=>{y!==lb&&u.reject(y)}).finally(Rm)}catch(y){u.reject(y),Rm()}var f=on;if(r){if((d.f&hf)!==0)var g=Jk();if((C=i.b)!=null&&C.is_rendered())(b=f.async_deriveds.get(d))==null||b.reject(vx);else for(const y of a.values())y.reject(vx);a.add(u),f.async_deriveds.set(d,u)}const p=(y,w=void 0)=>{g==null||g(),a.delete(u),w!==vx&&(f.activate(),w?(s.f|=vc,j0(s,w)):((s.f&vc)!==0&&(s.f^=vc),j0(s,y)),f.deactivate())};u.promise.then(p,y=>p(null,y||"unknown"))}),u9(()=>{for(const d of a)d.reject(vx)}),new Promise(d=>{function u(f){function g(){f===n?d(s):u(n)}f.then(g,g)}u(n)})}function Lt(o){const e=Hg(o);return x6(e),e}function a9(o){const e=Hg(o);return e.equals=Vk,e}function II(o){var e=o.effects;if(e!==null){o.effects=null;for(var t=0;t<e.length;t+=1)Jo(e[t])}}function l9(o){var e,t=zn,i=o.parent;if(!kl&&i!==null&&o.v!==Js&&(i.f&(Mr|To))!==0)return dI(),o.v;Ga(i);try{o.f&=~Fu,II(o),e=b6(o)}finally{Ga(t)}return e}function e6(o){var e=l9(o);if(!o.equals(e)&&(o.wv=v6(),(!(on!=null&&on.is_fork)||o.deps===null)&&(on!==null?(on.capture(o,e,!0),cg==null||cg.capture(o,e,!0)):o.v=e,o.deps===null))){Ws(o,to);return}kl||(co!==null?(d9()||on!=null&&on.is_fork)&&co.set(o,e):s9(o))}function PI(o){var e,t;if(o.effects!==null)for(const i of o.effects)(i.teardown||i.ac)&&((e=i.teardown)==null||e.call(i),(t=i.ac)==null||t.abort(lb),i.fn!==null&&(i.teardown=rb),i.ac=null,Wg(i,0),g9(i))}function t6(o){if(o.effects!==null)for(const e of o.effects)e.teardown&&e.fn!==null&&$0(e)}let Nm=new Set;const Md=new Map;let i6=!1;function Iu(o,e){var t={f:0,v:o,reactions:null,equals:zk,rv:0,wv:0};return t}function F(o,e){const t=Iu(o);return x6(t),t}function TI(o,e=!1,t=!0){const i=Iu(o);return e||(i.equals=Vk),i}function m(o,e,t=!1){Hn!==null&&(!ra||(Hn.f&Tm)!==0)&&jk()&&(Hn.f&(po|oa|l0|Tm))!==0&&(Va===null||!Va.has(o))&&X7();let i=t?Li(e):e;return j0(o,i,im)}function j0(o,e,t=null){if(!o.equals(e)){Md.set(o,kl?e:o.v);var i=Lu.ensure();if(i.capture(o,e),(o.f&po)!==0){const n=o;(o.f&so)!==0&&l9(n),co===null&&s9(n)}o.wv=v6(),n6(o,so,t),zn!==null&&(zn.f&to)!==0&&(zn.f&(aa|Wc))===0&&(wr===null?UI([o]):wr.push(o)),!i.is_fork&&Nm.size>0&&!i6&&MI()}return e}function MI(){i6=!1;for(const o of Nm){(o.f&to)!==0&&Ws(o,qa);let e;try{e=zp(o)}catch{e=!0}e&&$0(o)}Nm.clear()}function u8(o,e=1){var t=c(o),i=e===1?t++:t--;return m(o,t),i}function ug(o){m(o,o.v+1)}function n6(o,e,t){var i=o.reactions;if(i!==null)for(var n=i.length,s=0;s<n;s++){var r=i[s],a=r.f,d=(a&so)===0;if(d&&Ws(r,e),(a&Tm)!==0)Nm.add(r);else if((a&po)!==0){var u=r;co==null||co.delete(u),(a&Fu)===0&&(a&Tr&&(zn===null||(zn.f&Mm)===0)&&(r.f|=Fu),n6(u,qa,t))}else if(d){var f=r;(a&oa)!==0&&qr!==null&&qr.add(f),t!==null?t.push(f):r9(f)}}}function Li(o){if(typeof o!="object"||o===null||Td in o)return o;const e=Mk(o);if(e!==I7&&e!==P7)return o;var t=new Map,i=n9(o),n=F(0),s=Od,r=a=>{if(Od===s)return a();var d=Hn,u=Od;Or(null),p8(s);var f=a();return Or(d),p8(u),f};return i&&t.set("length",F(o.length)),new Proxy(o,{defineProperty(a,d,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&K7();var f=t.get(d);return f===void 0?r(()=>{var g=F(u.value);return t.set(d,g),g}):m(f,u.value,!0),!0},deleteProperty(a,d){var u=t.get(d);if(u===void 0){if(d in a){const f=r(()=>F(Js));t.set(d,f),ug(n)}}else m(u,Js),ug(n);return!0},get(a,d,u){var C;if(d===Td)return o;var f=t.get(d),g=d in a;if(f===void 0&&(!g||(C=a0(a,d))!=null&&C.writable)&&(f=r(()=>{var b=Li(g?a[d]:Js),y=F(b);return y}),t.set(d,f)),f!==void 0){var p=c(f);return p===Js?void 0:p}return Reflect.get(a,d,u)},getOwnPropertyDescriptor(a,d){var u=Reflect.getOwnPropertyDescriptor(a,d);if(u&&"value"in u){var f=t.get(d);f&&(u.value=c(f))}else if(u===void 0){var g=t.get(d),p=g==null?void 0:g.v;if(g!==void 0&&p!==Js)return{enumerable:!0,configurable:!0,value:p,writable:!0}}return u},has(a,d){var p;if(d===Td)return!0;var u=t.get(d),f=u!==void 0&&u.v!==Js||Reflect.has(a,d);if(u!==void 0||zn!==null&&(!f||(p=a0(a,d))!=null&&p.writable)){u===void 0&&(u=r(()=>{var C=f?Li(a[d]):Js,b=F(C);return b}),t.set(d,u));var g=c(u);if(g===Js)return!1}return f},set(a,d,u,f){var T;var g=t.get(d),p=d in a;if(i&&d==="length")for(var C=u;C<g.v;C+=1){var b=t.get(C+"");b!==void 0?m(b,Js):C in a&&(b=r(()=>F(Js)),t.set(C+"",b))}if(g===void 0)(!p||(T=a0(a,d))!=null&&T.writable)&&(g=r(()=>F(void 0)),m(g,Li(u)),t.set(d,g));else{p=g.v!==Js;var y=r(()=>Li(u));m(g,y)}var w=Reflect.getOwnPropertyDescriptor(a,d);if(w!=null&&w.set&&w.set.call(f,u),!p){if(i&&typeof d=="string"){var A=t.get("length"),I=Number(d);Number.isInteger(I)&&I>=A.v&&m(A,I+1)}ug(n)}return!0},ownKeys(a){c(n);var d=Reflect.ownKeys(a).filter(g=>{var p=t.get(g);return p===void 0||p.v!==Js});for(var[u,f]of t)f.v!==Js&&!(u in a)&&d.push(u);return d},setPrototypeOf(){Z7()}})}function h8(o){try{if(o!==null&&typeof o=="object"&&Td in o)return o[Td]}catch{}return o}function RI(o,e){return Object.is(h8(o),h8(e))}var Rd,s6,o6,r6,a6;function NI(){if(Rd===void 0){Rd=window,s6=document,o6=/Firefox/.test(navigator.userAgent);var o=Element.prototype,e=Node.prototype,t=Text.prototype;r6=a0(e,"firstChild").get,a6=a0(e,"nextSibling").get,a8(o)&&(o[m1]=void 0,o[em]=null,o[v1]=void 0,o.__e=void 0),a8(t)&&(t[Uf]=void 0)}}function bl(o=""){return document.createTextNode(o)}function Na(o){return r6.call(o)}function Wp(o){return a6.call(o)}function _(o,e){return Na(o)}function Et(o,e=!1){{var t=Na(o);return t instanceof Comment&&t.data===""?Wp(t):t}}function v(o,e=1,t=!1){let i=o;for(;e--;)i=Wp(i);return i}function OI(o){o.textContent=""}function l6(){return!1}function c6(o,e,t){return e==null||e===Wk?t?document.createElement(o,{is:t}):document.createElement(o):t?document.createElementNS(e,o,{is:t}):document.createElementNS(e,o)}let f8=!1;function HI(){f8||(f8=!0,document.addEventListener("reset",o=>{Promise.resolve().then(()=>{var e;if(!o.defaultPrevented)for(const t of o.target.elements)(e=t[tm])==null||e.call(t)})},{capture:!0}))}function cb(o){var e=Hn,t=zn;Or(null),Ga(null);try{return o()}finally{Or(e),Ga(t)}}function c9(o,e,t,i=t){o.addEventListener(e,()=>cb(t));const n=o[tm];n?o[tm]=()=>{n(),i(!0)}:o[tm]=()=>i(!0),HI()}function WI(o){zn===null&&(Hn===null&&U7(),$7()),kl&&j7()}function zI(o,e){var t=e.last;t===null?e.last=e.first=o:(t.next=o,o.prev=t,e.last=o)}function Ol(o,e){var t=zn;t!==null&&(t.f&To)!==0&&(o|=To);var i={ctx:go,deps:null,nodes:null,f:o|so|Tr,first:null,fn:e,last:null,next:null,parent:t,b:t&&t.b,prev:null,teardown:null,wv:0,ac:null};on==null||on.register_created_effect(i);var n=i;if((o&W0)!==0)Uh!==null?Uh.push(i):Lu.ensure().schedule(i);else if(e!==null){try{$0(i)}catch(r){throw Jo(i),r}n.deps===null&&n.teardown===null&&n.nodes===null&&n.first===n.last&&(n.f&ff)===0&&(n=n.first,(o&oa)!==0&&(o&z0)!==0&&n!==null&&(n.f|=z0))}if(n!==null&&(n.parent=t,t!==null&&zI(n,t),Hn!==null&&(Hn.f&po)!==0&&(o&Wc)===0)){var s=Hn;(s.effects??(s.effects=[])).push(n)}return i}function d9(){return Hn!==null&&!ra}function u9(o){const e=Ol(ab,null);return Ws(e,to),e.teardown=o,e}function Kn(o){WI();var e=zn.f,t=!Hn&&(e&aa)!==0&&go!==null&&!go.i;if(t){var i=go;(i.e??(i.e=[])).push(o)}else return d6(o)}function d6(o){return Ol(W0|N7,o)}function VI(o){Lu.ensure();const e=Ol(Wc|ff,o);return(t={})=>new Promise(i=>{t.outro?Nd(e,()=>{Jo(e),i(void 0)}):(Jo(e),i(void 0))})}function h9(o){return Ol(W0,o)}function jI(o){return Ol(l0|ff,o)}function db(o,e=0){return Ol(ab|e,o)}function z(o,e=[],t=[],i=[]){BI(i,e,t,n=>{Ol(ab,()=>o(...n.map(c)))})}function f9(o,e=0){var t=Ol(oa|e,o);return t}function kr(o){return Ol(aa|ff,o)}function u6(o){var e=o.teardown;if(e!==null){const t=kl,i=Hn;g8(!0),Or(null);try{e.call(null)}finally{g8(t),Or(i)}}}function g9(o,e=!1){var t=o.first;for(o.first=o.last=null;t!==null;){const n=t.ac;n!==null&&cb(()=>{n.abort(lb)});var i=t.next;(t.f&Wc)!==0?t.parent=null:Jo(t,e),t=i}}function $I(o){for(var e=o.first;e!==null;){var t=e.next;(e.f&aa)===0&&Jo(e),e=t}}function Jo(o,e=!0){var t=!1;(e||(o.f&R7)!==0)&&o.nodes!==null&&o.nodes.end!==null&&(h6(o.nodes.start,o.nodes.end),t=!0),Ws(o,x1),g9(o,e&&!t),Wg(o,0);var i=o.nodes&&o.nodes.t;if(i!==null)for(const s of i)s.stop();u6(o),o.f^=x1,o.f|=Mr;var n=o.parent;n!==null&&n.first!==null&&f6(o),o.next=o.prev=o.teardown=o.ctx=o.deps=o.fn=o.nodes=o.ac=o.b=null}function h6(o,e){for(;o!==null;){var t=o===e?null:Wp(o);o.remove(),o=t}}function f6(o){var e=o.parent,t=o.prev,i=o.next;t!==null&&(t.next=i),i!==null&&(i.prev=t),e!==null&&(e.first===o&&(e.first=i),e.last===o&&(e.last=t))}function Nd(o,e,t=!0){var i=[];g6(o,i,!0);var n=()=>{t&&Jo(o),e&&e()},s=i.length;if(s>0){var r=()=>--s||n();for(var a of i)a.out(r)}else n()}function g6(o,e,t){if((o.f&To)===0){o.f^=To;var i=o.nodes&&o.nodes.t;if(i!==null)for(const a of i)(a.is_global||t)&&e.push(a);for(var n=o.first;n!==null;){var s=n.next;if((n.f&Wc)===0){var r=(n.f&z0)!==0||(n.f&aa)!==0&&(o.f&oa)!==0;g6(n,e,r?t:!1)}n=s}}}function Om(o){p6(o,!0)}function p6(o,e){if((o.f&To)!==0){o.f^=To,(o.f&to)===0&&(Ws(o,so),Lu.ensure().schedule(o));for(var t=o.first;t!==null;){var i=t.next,n=(t.f&z0)!==0||(t.f&aa)!==0;p6(t,n?e:!1),t=i}var s=o.nodes&&o.nodes.t;if(s!==null)for(const r of s)(r.is_global||e)&&r.in()}}function p9(o,e){if(o.nodes)for(var t=o.nodes.start,i=o.nodes.end;t!==null;){var n=t===i?null:Wp(t);e.append(t),t=n}}let om=!1,kl=!1;function g8(o){kl=o}let Hn=null,ra=!1;function Or(o){Hn=o}let zn=null;function Ga(o){zn=o}let Va=null;function x6(o){Hn!==null&&(Va??(Va=new Set)).add(o)}let $o=null,or=0,wr=null;function UI(o){wr=o}let m6=1,yd=0,Od=yd;function p8(o){Od=o}function v6(){return++m6}function zp(o){var e=o.f;if((e&so)!==0)return!0;if(e&po&&(o.f&=~Fu),(e&qa)!==0){for(var t=o.deps,i=t.length,n=0;n<i;n++){var s=t[n];if(zp(s)&&e6(s),s.wv>o.wv)return!0}(e&Tr)!==0&&co===null&&Ws(o,to)}return!1}function _6(o,e,t=!0){var i=o.reactions;if(i!==null&&!(Va!==null&&Va.has(o)))for(var n=0;n<i.length;n++){var s=i[n];(s.f&po)!==0?_6(s,e,!1):e===s&&(t?Ws(s,so):(s.f&to)!==0&&Ws(s,qa),r9(s))}}function b6(o){var y;var e=$o,t=or,i=wr,n=Hn,s=Va,r=go,a=ra,d=Od,u=o.f;$o=null,or=0,wr=null,Hn=(u&(aa|Wc))===0?o:null,Va=null,V0(o.ctx),ra=!1,Od=++yd,o.ac!==null&&(cb(()=>{o.ac.abort(lb)}),o.ac=null);try{o.f|=Mm;var f=o.fn,g=f();o.f|=hf;var p=o.deps,C=on==null?void 0:on.is_fork;if($o!==null){var b;if(C||Wg(o,or),p!==null&&or>0)for(p.length=or+$o.length,b=0;b<$o.length;b++)p[or+b]=$o[b];else o.deps=p=$o;if(d9()&&(o.f&Tr)!==0)for(b=or;b<p.length;b++)((y=p[b]).reactions??(y.reactions=[])).push(o)}else!C&&p!==null&&or<p.length&&(Wg(o,or),p.length=or);if(jk()&&wr!==null&&!ra&&p!==null&&(o.f&(po|qa|so))===0)for(b=0;b<wr.length;b++)_6(wr[b],o);if(n!==null&&n!==o){if(yd++,n.deps!==null)for(let w=0;w<t;w+=1)n.deps[w].rv=yd;if(e!==null)for(const w of e)w.rv=yd;wr!==null&&(i===null?i=wr:i.push(...wr))}return(o.f&vc)!==0&&(o.f^=vc),g}catch(w){return Uk(w)}finally{o.f^=Mm,$o=e,or=t,wr=i,Hn=n,Va=s,V0(r),ra=a,Od=d}}function qI(o,e){let t=e.reactions;if(t!==null){var i=B7.call(t,o);if(i!==-1){var n=t.length-1;n===0?t=e.reactions=null:(t[i]=t[n],t.pop())}}if(t===null&&(e.f&po)!==0&&($o===null||!Pm.call($o,e))){var s=e;(s.f&Tr)!==0&&(s.f^=Tr,s.f&=~Fu),s.v!==Js&&s9(s),PI(s),Wg(s,0)}}function Wg(o,e){var t=o.deps;if(t!==null)for(var i=e;i<t.length;i++)qI(o,t[i])}function $0(o){var e=o.f;if((e&Mr)===0){Ws(o,to);var t=zn,i=om;zn=o,om=!0;try{(e&(oa|Nk))!==0?$I(o):g9(o),u6(o);var n=b6(o);o.teardown=typeof n=="function"?n:null,o.wv=m6;var s;Tk&&gI&&(o.f&so)!==0&&o.deps}finally{om=i,zn=t}}}async function hl(){await Promise.resolve(),bI()}function c(o){var e=o.f,t=(e&po)!==0;if(Hn!==null&&!ra){var i=zn!==null&&(zn.f&Mr)!==0;if(!i&&(Va===null||!Va.has(o))){var n=Hn.deps;if((Hn.f&Mm)!==0)o.rv<yd&&(o.rv=yd,$o===null&&n!==null&&n[or]===o?or++:$o===null?$o=[o]:$o.push(o));else{Hn.deps??(Hn.deps=[]),Pm.call(Hn.deps,o)||Hn.deps.push(o);var s=o.reactions;s===null?o.reactions=[Hn]:Pm.call(s,Hn)||s.push(Hn)}}}if(kl&&Md.has(o))return Md.get(o);if(t){var r=o;if(kl){var a=r.v;return((r.f&to)===0&&r.reactions!==null||E6(r))&&(a=l9(r)),Md.set(r,a),a}var d=(r.f&Tr)===0&&!ra&&Hn!==null&&(om||(Hn.f&Tr)!==0),u=(r.f&hf)===0;zp(r)&&(d&&(r.f|=Tr),e6(r)),d&&!u&&(t6(r),C6(r))}if(co!=null&&co.has(o))return co.get(o);if((o.f&vc)!==0)throw o.v;return o.v}function C6(o){if(o.f|=Tr,o.deps!==null)for(const e of o.deps)(e.reactions??(e.reactions=[])).push(o),(e.f&po)!==0&&(e.f&Tr)===0&&(t6(e),C6(e))}function E6(o){if(o.v===Js)return!0;if(o.deps===null)return!1;for(const e of o.deps)if(Md.has(e)||(e.f&po)!==0&&E6(e))return!0;return!1}function Hl(o){var e=ra;try{return ra=!0,o()}finally{ra=e}}const GI=["touchstart","touchmove"];function KI(o){return GI.includes(o)}const wd=Symbol("events"),y6=new Set,S1=new Set;function ZI(o,e,t,i={}){function n(s){if(i.capture||D1.call(e,s),!s.cancelBubble)return cb(()=>t==null?void 0:t.call(this,s))}return o.startsWith("pointer")||o.startsWith("touch")||o==="wheel"?_c(()=>{e.addEventListener(o,n,i)}):e.addEventListener(o,n,i),n}function xs(o,e,t,i,n){var s={capture:i,passive:n},r=ZI(o,e,t,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&u9(()=>{e.removeEventListener(o,r,s)})}function $(o,e,t){(e[wd]??(e[wd]={}))[o]=t}function Ys(o){for(var e=0;e<o.length;e++)y6.add(o[e]);for(var t of S1)t(o)}let x8=null;function D1(o){var y,w;var e=this,t=e.ownerDocument,i=o.type,n=((y=o.composedPath)==null?void 0:y.call(o))||[],s=n[0]||o.target;x8=o;var r=0,a=x8===o&&o[wd];if(a){var d=n.indexOf(a);if(d!==-1&&(e===document||e===window)){o[wd]=e;return}var u=n.indexOf(e);if(u===-1)return;d<=u&&(r=d)}if(s=n[r]||o.target,s!==e){F7(o,"currentTarget",{configurable:!0,get(){return s||t}});var f=Hn,g=zn;Or(null),Ga(null);try{for(var p,C=[];s!==null&&s!==e;){try{var b=(w=s[wd])==null?void 0:w[i];b!=null&&(!s.disabled||o.target===s)&&b.call(s,o)}catch(A){p?C.push(A):p=A}if(o.cancelBubble)break;r++,s=r<n.length?n[r]:null}if(p){for(let A of C)queueMicrotask(()=>{throw A});throw p}}finally{o[wd]=e,delete o.currentTarget,Or(f),Ga(g)}}}var iA;const aC=((iA=globalThis==null?void 0:globalThis.window)==null?void 0:iA.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:o=>o});function XI(o){return(aC==null?void 0:aC.createHTML(o))??o}function w6(o){var e=c6("template");return e.innerHTML=XI(o.replaceAll("<!>","<!---->")),e.content}function Pu(o,e){var t=zn;t.nodes===null&&(t.nodes={start:o,end:e,a:null,t:null})}function B(o,e){var t=(e&rI)!==0,i=(e&aI)!==0,n,s=!o.startsWith("<!>");return()=>{n===void 0&&(n=w6(s?o:"<!>"+o),t||(n=Na(n)));var r=i||o6?document.importNode(n,!0):n.cloneNode(!0);if(t){var a=Na(r),d=r.lastChild;Pu(a,d)}else Pu(r,r);return r}}function YI(o,e,t="svg"){var i=!o.startsWith("<!>"),n=`<${t}>${i?o:"<!>"+o}</${t}>`,s;return()=>{if(!s){var r=w6(n),a=Na(r);s=Na(a)}var d=s.cloneNode(!0);return Pu(d,d),d}}function S6(o,e){return YI(o,e,"svg")}function oo(o=""){{var e=bl(o+"");return Pu(e,e),e}}function Ss(){var o=document.createDocumentFragment(),e=document.createComment(""),t=bl();return o.append(e,t),Pu(e,t),o}function D(o,e){o!==null&&o.before(e)}function W(o,e){var t=e==null?"":typeof e=="object"?`${e}`:e;t!==(o[Uf]??(o[Uf]=o.nodeValue))&&(o[Uf]=t,o.nodeValue=`${t}`)}function QI(o,e){return JI(o,e)}const _x=new Map;function JI(o,{target:e,anchor:t,props:i={},events:n,context:s,intro:r=!0,transformError:a}){NI();var d=void 0,u=VI(()=>{var f=t??e.appendChild(bl());wI(f,{pending:()=>{}},C=>{$s({});var b=go;s&&(b.c=s),n&&(i.$$events=n),d=o(C,i)||{},Us()},a);var g=new Set,p=C=>{for(var b=0;b<C.length;b++){var y=C[b];if(!g.has(y)){g.add(y);var w=KI(y);for(const T of[e,document]){var A=_x.get(T);A===void 0&&(A=new Map,_x.set(T,A));var I=A.get(y);I===void 0?(T.addEventListener(y,D1,{passive:w}),A.set(y,1)):A.set(y,I+1)}}}};return p(ob(y6)),S1.add(p),()=>{var w;for(var C of g)for(const A of[e,document]){var b=_x.get(A),y=b.get(C);--y==0?(A.removeEventListener(C,D1),b.delete(C),b.size===0&&_x.delete(A)):b.set(C,y)}S1.delete(p),f!==t&&((w=f.parentNode)==null||w.removeChild(f))}});return eP.set(d,u),d}let eP=new WeakMap;var Xr,Ba,lr,Fd,bp,Cp,Kv;class tP{constructor(e,t=!0){kn(this,"anchor");bn(this,Xr,new Map);bn(this,Ba,new Map);bn(this,lr,new Map);bn(this,Fd,new Set);bn(this,bp,!0);bn(this,Cp,e=>{if(Se(this,Xr).has(e)){var t=Se(this,Xr).get(e),i=Se(this,Ba).get(t);if(i)Om(i),Se(this,Fd).delete(t);else{var n=Se(this,lr).get(t);n&&(Om(n.effect),Se(this,Ba).set(t,n.effect),Se(this,lr).delete(t),n.fragment.lastChild.remove(),this.anchor.before(n.fragment),i=n.effect)}for(const[s,r]of Se(this,Xr)){if(Se(this,Xr).delete(s),s===e)break;const a=Se(this,lr).get(r);a&&(Jo(a.effect),Se(this,lr).delete(r))}for(const[s,r]of Se(this,Ba)){if(s===t||Se(this,Fd).has(s))continue;const a=()=>{if(Array.from(Se(this,Xr).values()).includes(s)){var u=document.createDocumentFragment();p9(r,u),u.append(bl()),Se(this,lr).set(s,{effect:r,fragment:u})}else Jo(r);Se(this,Fd).delete(s),Se(this,Ba).delete(s)};Se(this,bp)||!i?(Se(this,Fd).add(s),Nd(r,a,!1)):a()}}});bn(this,Kv,e=>{Se(this,Xr).delete(e);const t=Array.from(Se(this,Xr).values());for(const[i,n]of Se(this,lr))t.includes(i)||(Jo(n.effect),Se(this,lr).delete(i))});this.anchor=e,Cn(this,bp,t)}ensure(e,t){var i=on,n=l6();if(t&&!Se(this,Ba).has(e)&&!Se(this,lr).has(e))if(n){var s=document.createDocumentFragment(),r=bl();s.append(r),Se(this,lr).set(e,{effect:kr(()=>t(r)),fragment:s})}else Se(this,Ba).set(e,kr(()=>t(this.anchor)));if(Se(this,Xr).set(i,e),n){for(const[a,d]of Se(this,Ba))a===e?i.unskip_effect(d):i.skip_effect(d);for(const[a,d]of Se(this,lr))a===e?i.unskip_effect(d.effect):i.skip_effect(d.effect);i.oncommit(Se(this,Cp)),i.ondiscard(Se(this,Kv))}else Se(this,Cp).call(this,i)}}Xr=new WeakMap,Ba=new WeakMap,lr=new WeakMap,Fd=new WeakMap,bp=new WeakMap,Cp=new WeakMap,Kv=new WeakMap;function H(o,e,t=!1){var i=new tP(o),n=t?z0:0;function s(r,a){i.ensure(r,a)}f9(()=>{var r=!1;e((a,d=0)=>{r=!0,s(d,a)}),r||s(-1,null)},n)}function Hi(o,e){return e}function iP(o,e,t){for(var i=[],n=e.length,s,r=e.length,a=0;a<n;a++){let g=e[a];Nd(g,()=>{if(s){if(s.pending.delete(g),s.done.add(g),s.pending.size===0){var p=o.outrogroups;A1(o,ob(s.done)),p.delete(s),p.size===0&&(o.outrogroups=null)}}else r-=1},!1)}if(r===0){var d=i.length===0&&t!==null;if(d){var u=t,f=u.parentNode;OI(f),f.append(u),o.items.clear()}A1(o,e,!d)}else s={pending:new Set(e),done:new Set},(o.outrogroups??(o.outrogroups=new Set)).add(s)}function A1(o,e,t=!0){var i;if(o.pending.size>0){i=new Set;for(const r of o.pending.values())for(const a of r)i.add(o.items.get(a).e)}for(var n=0;n<e.length;n++){var s=e[n];if(i!=null&&i.has(s)){s.f|=Ra;const r=document.createDocumentFragment();p9(s,r)}else Jo(e[n],t)}}var m8;function ti(o,e,t,i,n,s=null){var r=o,a=new Map,d=(e&Hk)!==0;if(d){var u=o;r=u.appendChild(bl())}var f=null,g=a9(()=>{var T=t();return n9(T)?T:T==null?[]:ob(T)}),p,C=new Map,b=!0;function y(T){(I.effect.f&Mr)===0&&(I.pending.delete(T),I.fallback=f,nP(I,p,r,e,i),f!==null&&(p.length===0?(f.f&Ra)===0?Om(f):(f.f^=Ra,Kf(f,null,r)):Nd(f,()=>{f=null})))}function w(T){I.pending.delete(T)}var A=f9(()=>{p=c(g);for(var T=p.length,R=new Set,P=on,V=l6(),j=0;j<T;j+=1){var J=p[j],ae=i(J,j),fe=b?null:a.get(ae);fe?(fe.v&&j0(fe.v,J),fe.i&&j0(fe.i,j),V&&P.unskip_effect(fe.e)):(fe=sP(a,b?r:m8??(m8=bl()),J,ae,j,n,e,t),b||(fe.e.f|=Ra),a.set(ae,fe)),R.add(ae)}if(T===0&&s&&!f&&(b?f=kr(()=>s(r)):(f=kr(()=>s(m8??(m8=bl()))),f.f|=Ra)),T>R.size&&V7(),!b)if(C.set(P,R),V){for(const[X,ce]of a)R.has(X)||P.skip_effect(ce.e);P.oncommit(y),P.ondiscard(w)}else y(P);c(g)}),I={effect:A,items:a,pending:C,outrogroups:null,fallback:f};b=!1}function Mf(o){for(;o!==null&&(o.f&aa)===0;)o=o.next;return o}function nP(o,e,t,i,n){var fe,X,ce,me,oe,le,Ae,Te,xe;var s=(i&eI)!==0,r=e.length,a=o.items,d=Mf(o.effect.first),u,f=null,g,p=[],C=[],b,y,w,A;if(s)for(A=0;A<r;A+=1)b=e[A],y=n(b,A),w=a.get(y).e,(w.f&Ra)===0&&((X=(fe=w.nodes)==null?void 0:fe.a)==null||X.measure(),(g??(g=new Set)).add(w));for(A=0;A<r;A+=1){if(b=e[A],y=n(b,A),w=a.get(y).e,o.outrogroups!==null)for(const Ne of o.outrogroups)Ne.pending.delete(w),Ne.done.delete(w);if((w.f&To)!==0&&(Om(w),s&&((me=(ce=w.nodes)==null?void 0:ce.a)==null||me.unfix(),(g??(g=new Set)).delete(w))),(w.f&Ra)!==0)if(w.f^=Ra,w===d)Kf(w,null,t);else{var I=f?f.next:d;w===o.effect.last&&(o.effect.last=w.prev),w.prev&&(w.prev.next=w.next),w.next&&(w.next.prev=w.prev),Kl(o,f,w),Kl(o,w,I),Kf(w,I,t),f=w,p=[],C=[],d=Mf(f.next);continue}if(w!==d){if(u!==void 0&&u.has(w)){if(p.length<C.length){var T=C[0],R;f=T.prev;var P=p[0],V=p[p.length-1];for(R=0;R<p.length;R+=1)Kf(p[R],T,t);for(R=0;R<C.length;R+=1)u.delete(C[R]);Kl(o,P.prev,V.next),Kl(o,f,P),Kl(o,V,T),d=T,f=V,A-=1,p=[],C=[]}else u.delete(w),Kf(w,d,t),Kl(o,w.prev,w.next),Kl(o,w,f===null?o.effect.first:f.next),Kl(o,f,w),f=w;continue}for(p=[],C=[];d!==null&&d!==w;)(u??(u=new Set)).add(d),C.push(d),d=Mf(d.next);if(d===null)continue}(w.f&Ra)===0&&p.push(w),f=w,d=Mf(w.next)}if(o.outrogroups!==null){for(const Ne of o.outrogroups)Ne.pending.size===0&&(A1(o,ob(Ne.done)),(oe=o.outrogroups)==null||oe.delete(Ne));o.outrogroups.size===0&&(o.outrogroups=null)}if(d!==null||u!==void 0){var j=[];if(u!==void 0)for(w of u)(w.f&To)===0&&j.push(w);for(;d!==null;)(d.f&To)===0&&d!==o.fallback&&j.push(d),d=Mf(d.next);var J=j.length;if(J>0){var ae=(i&Hk)!==0&&r===0?t:null;if(s){for(A=0;A<J;A+=1)(Ae=(le=j[A].nodes)==null?void 0:le.a)==null||Ae.measure();for(A=0;A<J;A+=1)(xe=(Te=j[A].nodes)==null?void 0:Te.a)==null||xe.fix()}iP(o,j,ae)}}s&&_c(()=>{var Ne,Ve;if(g!==void 0)for(w of g)(Ve=(Ne=w.nodes)==null?void 0:Ne.a)==null||Ve.apply()})}function sP(o,e,t,i,n,s,r,a){var d=(r&Q7)!==0?(r&tI)===0?TI(t,!1,!1):Iu(t):null,u=(r&J7)!==0?Iu(n):null;return{v:d,i:u,e:kr(()=>(s(e,d??t,u??n,a),()=>{o.delete(i)}))}}function Kf(o,e,t){if(o.nodes)for(var i=o.nodes.start,n=o.nodes.end,s=e&&(e.f&Ra)===0?e.nodes.start:t;i!==null;){var r=Wp(i);if(s.before(i),i===n)return;i=r}}function Kl(o,e,t){e===null?o.effect.first=t:e.next=t,t===null?o.effect.last=e:t.prev=e}function hc(o,e,t=!1,i=!1,n=!1,s=!1){var r=o,a="";if(t)var d=o;z(()=>{var u=zn;if(a!==(a=e()??"")){if(t){u.nodes=null,d.innerHTML=a,a!==""&&Pu(Na(d),d.lastChild);return}if(u.nodes!==null&&(h6(u.nodes.start,u.nodes.end),u.nodes=null),a!==""){var f=i?lI:n?cI:void 0,g=c6(i?"svg":n?"math":"template",f);g.innerHTML=a;var p=i||n?g:g.content;if(Pu(Na(p),p.lastChild),i||n)for(;Na(p);)r.before(Na(p));else r.before(p)}}})}function D6(o){var e,t,i="";if(typeof o=="string"||typeof o=="number")i+=o;else if(typeof o=="object")if(Array.isArray(o)){var n=o.length;for(e=0;e<n;e++)o[e]&&(t=D6(o[e]))&&(i&&(i+=" "),i+=t)}else for(t in o)o[t]&&(i&&(i+=" "),i+=t);return i}function oP(){for(var o,e,t=0,i="",n=arguments.length;t<n;t++)(o=arguments[t])&&(e=D6(o))&&(i&&(i+=" "),i+=e);return i}function hg(o){return typeof o=="object"?oP(o):o??""}const v8=[...`
3
+ \r\f \v\uFEFF`];function rP(o,e,t){var i=o==null?"":""+o;if(e&&(i=i?i+" "+e:e),t){for(var n of Object.keys(t))if(t[n])i=i?i+" "+n:n;else if(i.length)for(var s=n.length,r=0;(r=i.indexOf(n,r))>=0;){var a=r+s;(r===0||v8.includes(i[r-1]))&&(a===i.length||v8.includes(i[a]))?i=(r===0?"":i.substring(0,r))+i.substring(a+1):r=a}}return i===""?null:i}function _8(o,e=!1){var t=e?" !important;":";",i="";for(var n of Object.keys(o)){var s=o[n];s!=null&&s!==""&&(i+=" "+n+": "+s+t)}return i}function lC(o){return o[0]!=="-"||o[1]!=="-"?o.toLowerCase():o}function aP(o,e){if(e){var t="",i,n;if(Array.isArray(e)?(i=e[0],n=e[1]):i=e,o){o=String(o).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var s=!1,r=0,a=!1,d=[];i&&d.push(...Object.keys(i).map(lC)),n&&d.push(...Object.keys(n).map(lC));var u=0,f=-1;const y=o.length;for(var g=0;g<y;g++){var p=o[g];if(a?p==="/"&&o[g-1]==="*"&&(a=!1):s?s===p&&(s=!1):p==="/"&&o[g+1]==="*"?a=!0:p==='"'||p==="'"?s=p:p==="("?r++:p===")"&&r--,!a&&s===!1&&r===0){if(p===":"&&f===-1)f=g;else if(p===";"||g===y-1){if(f!==-1){var C=lC(o.substring(u,f).trim());if(!d.includes(C)){p!==";"&&g++;var b=o.substring(u,g).trim();t+=" "+b+";"}}u=g+1,f=-1}}}}return i&&(t+=_8(i)),n&&(t+=_8(n,!0)),t=t.trim(),t===""?null:t}return o==null?null:String(o)}function At(o,e,t,i,n,s){var r=o[m1];if(r!==t||r===void 0){var a=rP(t,i,s);a==null?o.removeAttribute("class"):e?o.className=a:o.setAttribute("class",a),o[m1]=t}else if(s&&n!==s)for(var d in s){var u=!!s[d];(n==null||u!==!!n[d])&&o.classList.toggle(d,u)}return s}function cC(o,e={},t,i){for(var n in t){var s=t[n];e[n]!==s&&(t[n]==null?o.style.removeProperty(n):o.style.setProperty(n,s,i))}}function qo(o,e,t,i){var n=o[v1];if(n!==e){var s=aP(e,i);s==null?o.removeAttribute("style"):o.style.cssText=s,o[v1]=e}else i&&(Array.isArray(i)?(cC(o,t==null?void 0:t[0],i[0]),cC(o,t==null?void 0:t[1],i[1],"important")):cC(o,t,i));return i}function Hm(o,e,t=!1){if(o.multiple){if(e==null)return;if(!n9(e))return uI();for(var i of o.options)i.selected=e.includes(fg(i));return}for(i of o.options){var n=fg(i);if(RI(n,e)){i.selected=!0;return}}(!t||e!==void 0)&&(o.selectedIndex=-1)}function k1(o){var e=new MutationObserver(()=>{Hm(o,o.__value)});e.observe(o,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),u9(()=>{e.disconnect()})}function Ls(o,e,t=e){var i=new WeakSet,n=!0;c9(o,"change",s=>{var r=s?"[selected]":":checked",a;if(o.multiple)a=[].map.call(o.querySelectorAll(r),fg);else{var d=o.querySelector(r)??o.querySelector("option:not([disabled])");a=d&&fg(d)}t(a),o.__value=a,on!==null&&i.add(on)}),h9(()=>{var s=e();if(o===document.activeElement){var r=on;if(i.has(r))return}if(Hm(o,s,n),n&&s===void 0){var a=o.querySelector(":checked");a!==null&&(s=fg(a),t(s))}o.__value=s,n=!1}),k1(o)}function fg(o){return"__value"in o?o.__value:o.value}const lP=Symbol("is custom element"),cP=Symbol("is html"),dP=W7?"progress":"PROGRESS";function B1(o,e){var t=x9(o);t.value===(t.value=e??void 0)||o.value===e&&(e!==0||o.nodeName!==dP)||(o.value=e??"")}function Zo(o,e){var t=x9(o);t.checked!==(t.checked=e??void 0)&&(o.checked=e)}function ln(o,e,t,i){var n=x9(o);n[e]!==(n[e]=t)&&(e==="loading"&&(o[H7]=t),t==null?o.removeAttribute(e):typeof t!="string"&&uP(o).includes(e)?o[e]=t:o.setAttribute(e,t))}function x9(o){return o[em]??(o[em]={[lP]:o.nodeName.includes("-"),[cP]:o.namespaceURI===Wk})}var b8=new Map;function uP(o){var e=o.getAttribute("is")||o.nodeName,t=b8.get(e);if(t)return t;b8.set(e,t=[]);for(var i,n=o,s=Element.prototype;s!==n;){i=L7(n);for(var r in i)i[r].set&&r!=="innerHTML"&&r!=="textContent"&&r!=="innerText"&&t.push(r);n=Mk(n)}return t}function zt(o,e,t=e){var i=new WeakSet;c9(o,"input",async n=>{var s=n?o.defaultValue:o.value;if(s=dC(o)?uC(s):s,t(s),on!==null&&i.add(on),await hl(),s!==(s=e())){var r=o.selectionStart,a=o.selectionEnd,d=o.value.length;if(o.value=s??"",a!==null){var u=o.value.length;r===a&&a===d&&u>d?(o.selectionStart=u,o.selectionEnd=u):(o.selectionStart=r,o.selectionEnd=Math.min(a,u))}}}),Hl(e)==null&&o.value&&(t(dC(o)?uC(o.value):o.value),on!==null&&i.add(on)),db(()=>{var n=e();if(o===document.activeElement){var s=on;if(i.has(s))return}dC(o)&&n===uC(o.value)||o.type==="date"&&!n&&!o.value||n!==o.value&&(o.value=n??"")})}function ws(o,e,t=e){c9(o,"change",i=>{var n=i?o.defaultChecked:o.checked;t(n)}),Hl(e)==null&&t(o.checked),db(()=>{var i=e();o.checked=!!i})}function dC(o){var e=o.type;return e==="number"||e==="range"}function uC(o){return o===""?null:+o}var cc,_0,Ep,Zv,A6;const Xv=class Xv{constructor(e){bn(this,Zv);bn(this,cc,new WeakMap);bn(this,_0);bn(this,Ep);Cn(this,Ep,e)}observe(e,t){var i=Se(this,cc).get(e)||new Set;return i.add(t),Se(this,cc).set(e,i),ts(this,Zv,A6).call(this).observe(e,Se(this,Ep)),()=>{var n=Se(this,cc).get(e);n.delete(t),n.size===0&&(Se(this,cc).delete(e),Se(this,_0).unobserve(e))}}};cc=new WeakMap,_0=new WeakMap,Ep=new WeakMap,Zv=new WeakSet,A6=function(){return Se(this,_0)??Cn(this,_0,new ResizeObserver(e=>{for(var t of e){Xv.entries.set(t.target,t);for(var i of Se(this,cc).get(t.target)||[])i(t)}}))},kn(Xv,"entries",new WeakMap);let F1=Xv;var hP=new F1({box:"border-box"});function fP(o,e,t){var i=hP.observe(o,()=>t(o[e]));h9(()=>(Hl(()=>t(o[e])),i))}function hC(o,e){return o===e||(o==null?void 0:o[Td])===e}function gs(o={},e,t,i){var n=go.r,s=zn;return h9(()=>{var r,a;return db(()=>{r=a,a=[],Hl(()=>{hC(t(...a),o)||(e(o,...a),r&&hC(t(...r),o)&&e(null,...r))})}),()=>{let d=s;for(;d!==n&&d.parent!==null&&d.parent.f&x1;)d=d.parent;const u=()=>{a&&hC(t(...a),o)&&e(null,...a)},f=d.teardown;d.teardown=()=>{u(),f==null||f()}}}),o}function Tu(o,e,t,i){var R;var n=!0,s=(t&sI)!==0,r=(t&oI)!==0,a=i,d=!0,u=void 0,f=()=>r&&n?(u??(u=Hg(i)),c(u)):(d&&(d=!1,a=r?Hl(i):i),a);let g;if(s){var p=Td in o||O7 in o;g=((R=a0(o,e))==null?void 0:R.set)??(p&&e in o?P=>o[e]=P:void 0)}var C,b=!1;s?[C,b]=mI(()=>o[e]):C=o[e],C===void 0&&i!==void 0&&(C=f(),g&&(G7(),g(C)));var y;if(y=()=>{var P=o[e];return P===void 0?f():(d=!0,P)},(t&nI)===0)return y;if(g){var w=o.$$legacy;return(function(P,V){return arguments.length>0?((!V||w||b)&&g(V?y():P),P):y()})}var A=!1,I=((t&iI)!==0?Hg:a9)(()=>(A=!1,y()));s&&c(I);var T=zn;return(function(P,V){if(arguments.length>0){const j=V?c(I):s?Li(P):P;return m(I,j),A=!0,a!==void 0&&(a=j),P}return kl&&A||(T.f&Mr)!==0?I.v:c(I)})}function Xs(o){go===null&&Ok(),Kn(()=>{const e=Hl(o);if(typeof e=="function")return e})}function Vp(o){go===null&&Ok(),Xs(()=>()=>Hl(o))}const gP="5";var nA;typeof window<"u"&&((nA=window.__svelte??(window.__svelte={})).v??(nA.v=new Set)).add(gP);/*!-----------------------------------------------------------------------------
4
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5
+ * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
6
+ * Released under the MIT license
7
+ * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
8
+ *-----------------------------------------------------------------------------*/var pP=Object.defineProperty,xP=Object.getOwnPropertyDescriptor,mP=Object.getOwnPropertyNames,vP=Object.prototype.hasOwnProperty,_P=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of mP(e))!vP.call(o,n)&&n!==t&&pP(o,n,{get:()=>e[n],enumerable:!(i=xP(e,n))||i.enumerable});return o},bP=(o,e,t)=>(_P(o,e,"default"),t),jp={};bP(jp,oA);var CP=class{constructor(e,t,i){this._onDidChange=new jp.Emitter,this._languageId=e,this.setDiagnosticsOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}},EP={validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:"warning",schemaValidation:"warning",comments:"error",trailingCommas:"error"},yP={documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0},k6=new CP("json",EP,yP),wP=()=>B6().then(o=>o.getWorker());jp.languages.json={jsonDefaults:k6,getWorker:wP};function B6(){return sA(()=>import("./jsonMode-tUihOf0o.js"),__vite__mapDeps([0,1,2]))}jp.languages.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]});jp.languages.onLanguage("json",()=>{B6().then(o=>o.setupMode(k6))});/*!-----------------------------------------------------------------------------
9
+ * Copyright (c) Microsoft Corporation. All rights reserved.
10
+ * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
11
+ * Released under the MIT license
12
+ * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
13
+ *-----------------------------------------------------------------------------*/var SP=Object.defineProperty,DP=Object.getOwnPropertyDescriptor,AP=Object.getOwnPropertyNames,kP=Object.prototype.hasOwnProperty,BP=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of AP(e))!kP.call(o,n)&&n!==t&&SP(o,n,{get:()=>e[n],enumerable:!(i=DP(e,n))||i.enumerable});return o},FP=(o,e,t)=>(BP(o,e,"default"),t),LP="5.4.5",U0={};FP(U0,oA);var F6=(o=>(o[o.None=0]="None",o[o.CommonJS=1]="CommonJS",o[o.AMD=2]="AMD",o[o.UMD=3]="UMD",o[o.System=4]="System",o[o.ES2015=5]="ES2015",o[o.ESNext=99]="ESNext",o))(F6||{}),L6=(o=>(o[o.None=0]="None",o[o.Preserve=1]="Preserve",o[o.React=2]="React",o[o.ReactNative=3]="ReactNative",o[o.ReactJSX=4]="ReactJSX",o[o.ReactJSXDev=5]="ReactJSXDev",o))(L6||{}),I6=(o=>(o[o.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",o[o.LineFeed=1]="LineFeed",o))(I6||{}),P6=(o=>(o[o.ES3=0]="ES3",o[o.ES5=1]="ES5",o[o.ES2015=2]="ES2015",o[o.ES2016=3]="ES2016",o[o.ES2017=4]="ES2017",o[o.ES2018=5]="ES2018",o[o.ES2019=6]="ES2019",o[o.ES2020=7]="ES2020",o[o.ESNext=99]="ESNext",o[o.JSON=100]="JSON",o[o.Latest=99]="Latest",o))(P6||{}),T6=(o=>(o[o.Classic=1]="Classic",o[o.NodeJs=2]="NodeJs",o))(T6||{}),M6=class{constructor(o,e,t,i,n){this._onDidChange=new U0.Emitter,this._onDidExtraLibsChange=new U0.Emitter,this._extraLibs=Object.create(null),this._removedExtraLibs=Object.create(null),this._eagerModelSync=!1,this.setCompilerOptions(o),this.setDiagnosticsOptions(e),this.setWorkerOptions(t),this.setInlayHintsOptions(i),this.setModeConfiguration(n),this._onDidExtraLibsChangeTimeout=-1}get onDidChange(){return this._onDidChange.event}get onDidExtraLibsChange(){return this._onDidExtraLibsChange.event}get modeConfiguration(){return this._modeConfiguration}get workerOptions(){return this._workerOptions}get inlayHintsOptions(){return this._inlayHintsOptions}getExtraLibs(){return this._extraLibs}addExtraLib(o,e){let t;if(typeof e>"u"?t=`ts:extralib-${Math.random().toString(36).substring(2,15)}`:t=e,this._extraLibs[t]&&this._extraLibs[t].content===o)return{dispose:()=>{}};let i=1;return this._removedExtraLibs[t]&&(i=this._removedExtraLibs[t]+1),this._extraLibs[t]&&(i=this._extraLibs[t].version+1),this._extraLibs[t]={content:o,version:i},this._fireOnDidExtraLibsChangeSoon(),{dispose:()=>{let n=this._extraLibs[t];n&&n.version===i&&(delete this._extraLibs[t],this._removedExtraLibs[t]=i,this._fireOnDidExtraLibsChangeSoon())}}}setExtraLibs(o){for(const e in this._extraLibs)this._removedExtraLibs[e]=this._extraLibs[e].version;if(this._extraLibs=Object.create(null),o&&o.length>0)for(const e of o){const t=e.filePath||`ts:extralib-${Math.random().toString(36).substring(2,15)}`,i=e.content;let n=1;this._removedExtraLibs[t]&&(n=this._removedExtraLibs[t]+1),this._extraLibs[t]={content:i,version:n}}this._fireOnDidExtraLibsChangeSoon()}_fireOnDidExtraLibsChangeSoon(){this._onDidExtraLibsChangeTimeout===-1&&(this._onDidExtraLibsChangeTimeout=window.setTimeout(()=>{this._onDidExtraLibsChangeTimeout=-1,this._onDidExtraLibsChange.fire(void 0)},0))}getCompilerOptions(){return this._compilerOptions}setCompilerOptions(o){this._compilerOptions=o||Object.create(null),this._onDidChange.fire(void 0)}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(o){this._diagnosticsOptions=o||Object.create(null),this._onDidChange.fire(void 0)}setWorkerOptions(o){this._workerOptions=o||Object.create(null),this._onDidChange.fire(void 0)}setInlayHintsOptions(o){this._inlayHintsOptions=o||Object.create(null),this._onDidChange.fire(void 0)}setMaximumWorkerIdleTime(o){}setEagerModelSync(o){this._eagerModelSync=o}getEagerModelSync(){return this._eagerModelSync}setModeConfiguration(o){this._modeConfiguration=o||Object.create(null),this._onDidChange.fire(void 0)}},IP=LP,R6={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,diagnostics:!0,documentRangeFormattingEdits:!0,signatureHelp:!0,onTypeFormattingEdits:!0,codeActions:!0,inlayHints:!0},N6=new M6({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},R6),O6=new M6({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},R6),PP=()=>ub().then(o=>o.getTypeScriptWorker()),TP=()=>ub().then(o=>o.getJavaScriptWorker());U0.languages.typescript={ModuleKind:F6,JsxEmit:L6,NewLineKind:I6,ScriptTarget:P6,ModuleResolutionKind:T6,typescriptVersion:IP,typescriptDefaults:N6,javascriptDefaults:O6,getTypeScriptWorker:PP,getJavaScriptWorker:TP};function ub(){return sA(()=>import("./tsMode-9-rhcl9D.js"),__vite__mapDeps([3,1,2]))}U0.languages.onLanguage("typescript",()=>ub().then(o=>o.setupTypeScript(N6)));U0.languages.onLanguage("javascript",()=>ub().then(o=>o.setupJavaScript(O6)));class MP extends Do{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:Ai("toggleCollapseUnchangedRegions","Toggle Collapse Unchanged Regions"),icon:Ki.map,toggled:qe.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:qe.has("isInDiffEditor"),menu:{when:qe.has("isInDiffEditor"),id:ni.EditorTitle,order:22,group:"navigation"}})}run(e,...t){const i=e.get(ss),n=!i.getValue("diffEditor.hideUnchangedRegions.enabled");i.updateValue("diffEditor.hideUnchangedRegions.enabled",n)}}class H6 extends Do{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:Ai("toggleShowMovedCodeBlocks","Toggle Show Moved Code Blocks"),precondition:qe.has("isInDiffEditor")})}run(e,...t){const i=e.get(ss),n=!i.getValue("diffEditor.experimental.showMoves");i.updateValue("diffEditor.experimental.showMoves",n)}}class W6 extends Do{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:Ai("toggleUseInlineViewWhenSpaceIsLimited","Toggle Use Inline View When Space Is Limited"),precondition:qe.has("isInDiffEditor")})}run(e,...t){const i=e.get(ss),n=!i.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");i.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",n)}}const $p=Ai("diffEditor","Diff Editor");class RP extends la{constructor(){super({id:"diffEditor.switchSide",title:Ai("switchSide","Switch Side"),icon:Ki.arrowSwap,precondition:qe.has("isInDiffEditor"),f1:!0,category:$p})}runEditorCommand(e,t,i){const n=gf(e);if(n instanceof yp){if(i&&i.dryRun)return{destinationSelection:n.mapToOtherSide().destinationSelection};n.switchSide()}}}class NP extends la{constructor(){super({id:"diffEditor.exitCompareMove",title:Ai("exitCompareMove","Exit Compare Move"),icon:Ki.close,precondition:q.comparingMovedCode,f1:!1,category:$p,keybinding:{weight:1e4,primary:9}})}runEditorCommand(e,t,...i){const n=gf(e);n instanceof yp&&n.exitCompareMove()}}class OP extends la{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:Ai("collapseAllUnchangedRegions","Collapse All Unchanged Regions"),icon:Ki.fold,precondition:qe.has("isInDiffEditor"),f1:!0,category:$p})}runEditorCommand(e,t,...i){const n=gf(e);n instanceof yp&&n.collapseAllUnchangedRegions()}}class HP extends la{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:Ai("showAllUnchangedRegions","Show All Unchanged Regions"),icon:Ki.unfold,precondition:qe.has("isInDiffEditor"),f1:!0,category:$p})}runEditorCommand(e,t,...i){const n=gf(e);n instanceof yp&&n.showAllUnchangedRegions()}}class L1 extends Do{constructor(){super({id:"diffEditor.revert",title:Ai("revert","Revert"),f1:!1,category:$p})}run(e,t){const i=WP(e,t.originalUri,t.modifiedUri);i instanceof yp&&i.revertRangeMappings(t.mapping.innerChanges??[])}}const z6=Ai("accessibleDiffViewer","Accessible Diff Viewer"),Yv=class Yv extends Do{constructor(){super({id:Yv.id,title:Ai("editor.action.accessibleDiffViewer.next","Go to Next Difference"),category:z6,precondition:qe.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(e){const t=gf(e);t==null||t.accessibleDiffViewerNext()}};Yv.id="editor.action.accessibleDiffViewer.next";let zg=Yv;const Qv=class Qv extends Do{constructor(){super({id:Qv.id,title:Ai("editor.action.accessibleDiffViewer.prev","Go to Previous Difference"),category:z6,precondition:qe.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(e){const t=gf(e);t==null||t.accessibleDiffViewerPrev()}};Qv.id="editor.action.accessibleDiffViewer.prev";let Wm=Qv;function WP(o,e,t){return o.get(Cs).listDiffEditors().find(s=>{var d,u;const r=s.getModifiedEditor(),a=s.getOriginalEditor();return r&&((d=r.getModel())==null?void 0:d.uri.toString())===t.toString()&&a&&((u=a.getModel())==null?void 0:u.uri.toString())===e.toString()})||null}function gf(o){const t=o.get(Cs).listDiffEditors(),i=rA();if(i)for(const n of t){const s=n.getContainerDomNode();if(zP(s,i))return n}return null}function zP(o,e){let t=e;for(;t;){if(t===o)return!0;t=t.parentElement}return!1}Vn(MP);Vn(H6);Vn(W6);Rr.appendMenuItem(ni.EditorTitle,{command:{id:new W6().desc.id,title:S("useInlineViewWhenSpaceIsLimited","Use Inline View When Space Is Limited"),toggled:qe.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:qe.has("isInDiffEditor")},order:11,group:"1_diff",when:qe.and(q.diffEditorRenderSideBySideInlineBreakpointReached,qe.has("isInDiffEditor"))});Rr.appendMenuItem(ni.EditorTitle,{command:{id:new H6().desc.id,title:S("showMoves","Show Moved Code Blocks"),icon:Ki.move,toggled:XF.create("config.diffEditor.experimental.showMoves",!0),precondition:qe.has("isInDiffEditor")},order:10,group:"1_diff",when:qe.has("isInDiffEditor")});Vn(L1);for(const o of[{icon:Ki.arrowRight,key:q.diffEditorInlineMode.toNegated()},{icon:Ki.discard,key:q.diffEditorInlineMode}])Rr.appendMenuItem(ni.DiffEditorHunkToolbar,{command:{id:new L1().desc.id,title:S("revertHunk","Revert Block"),icon:o.icon},when:qe.and(q.diffEditorModifiedWritable,o.key),order:5,group:"primary"}),Rr.appendMenuItem(ni.DiffEditorSelectionToolbar,{command:{id:new L1().desc.id,title:S("revertSelection","Revert Selection"),icon:o.icon},when:qe.and(q.diffEditorModifiedWritable,o.key),order:5,group:"primary"});Vn(RP);Vn(NP);Vn(OP);Vn(HP);Rr.appendMenuItem(ni.EditorTitle,{command:{id:zg.id,title:S("Open Accessible Diff Viewer","Open Accessible Diff Viewer"),precondition:qe.has("isInDiffEditor")},order:10,group:"2_diff",when:qe.and(q.accessibleDiffViewerVisible.negate(),qe.has("isInDiffEditor"))});Qn.registerCommandAlias("editor.action.diffReview.next",zg.id);Vn(zg);Qn.registerCommandAlias("editor.action.diffReview.prev",Wm.id);Vn(Wm);var VP=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},jP=function(o,e){return function(t,i){e(t,i,o)}},I1;const hb=new En("selectionAnchorSet",!1);var Vd;let zc=(Vd=class{static get(e){return e.getContribution(I1.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=hb.bindTo(t),this.modelChangeListener=e.onDidChangeModel(()=>this.selectionAnchorSetContextKey.reset())}setSelectionAnchor(){if(this.editor.hasModel()){const e=this.editor.getPosition();this.editor.changeDecorations(t=>{this.decorationId&&t.removeDecoration(this.decorationId),this.decorationId=t.addDecoration($i.fromPositions(e,e),{description:"selection-anchor",stickiness:1,hoverMessage:new lo().appendText(S("selectionAnchor","Selection Anchor")),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),Nr(S("anchorSet","Anchor set at {0}:{1}",e.lineNumber,e.column))}}goToSelectionAnchor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);e&&this.editor.setPosition(e.getStartPosition())}}selectFromAnchorToCursor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);if(e){const t=this.editor.getPosition();this.editor.setSelection($i.fromPositions(e.getStartPosition(),t)),this.cancelSelectionAnchor()}}}cancelSelectionAnchor(){if(this.decorationId){const e=this.decorationId;this.editor.changeDecorations(t=>{t.removeDecoration(e),this.decorationId=void 0}),this.selectionAnchorSetContextKey.set(!1)}}dispose(){this.cancelSelectionAnchor(),this.modelChangeListener.dispose()}},I1=Vd,Vd.ID="editor.contrib.selectionAnchorController",Vd);zc=I1=VP([jP(1,Fn)],zc);class $P extends Ct{constructor(){super({id:"editor.action.setSelectionAnchor",label:S("setSelectionAnchor","Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2080),weight:100}})}async run(e,t){var i;(i=zc.get(t))==null||i.setSelectionAnchor()}}class UP extends Ct{constructor(){super({id:"editor.action.goToSelectionAnchor",label:S("goToSelectionAnchor","Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:hb})}async run(e,t){var i;(i=zc.get(t))==null||i.goToSelectionAnchor()}}class qP extends Ct{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:S("selectFromAnchorToCursor","Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:hb,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2089),weight:100}})}async run(e,t){var i;(i=zc.get(t))==null||i.selectFromAnchorToCursor()}}class GP extends Ct{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:S("cancelSelectionAnchor","Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:hb,kbOpts:{kbExpr:q.editorTextFocus,primary:9,weight:100}})}async run(e,t){var i;(i=zc.get(t))==null||i.cancelSelectionAnchor()}}hn(zc.ID,zc,4);Le($P);Le(UP);Le(qP);Le(GP);const KP=vi("editorOverviewRuler.bracketMatchForeground","#A0A0A0",S("overviewRulerBracketMatchForeground","Overview ruler marker color for matching brackets."));class ZP extends Ct{constructor(){super({id:"editor.action.jumpToBracket",label:S("smartSelect.jumpBracket","Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:q.editorTextFocus,primary:3165,weight:100}})}run(e,t){var i;(i=Mu.get(t))==null||i.jumpToBracket()}}class XP extends Ct{constructor(){super({id:"editor.action.selectToBracket",label:S("smartSelect.selectToBracket","Select to Bracket"),alias:"Select to Bracket",precondition:void 0,metadata:{description:Ai("smartSelect.selectToBracketDescription","Select the text inside and including the brackets or curly braces"),args:[{name:"args",schema:{type:"object",properties:{selectBrackets:{type:"boolean",default:!0}}}}]}})}run(e,t,i){var s;let n=!0;i&&i.selectBrackets===!1&&(n=!1),(s=Mu.get(t))==null||s.selectToBracket(n)}}class YP extends Ct{constructor(){super({id:"editor.action.removeBrackets",label:S("smartSelect.removeBrackets","Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:q.editorTextFocus,primary:2561,weight:100}})}run(e,t){var i;(i=Mu.get(t))==null||i.removeBrackets(this.id)}}class QP{constructor(e,t,i){this.position=e,this.brackets=t,this.options=i}}const ic=class ic extends Rt{static get(e){return e.getContribution(ic.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new Ms(()=>this._updateBrackets(),50)),this._matchBrackets=this._editor.getOption(72),this._updateBracketsSoon.schedule(),this._register(e.onDidChangeCursorPosition(t=>{this._matchBrackets!=="never"&&this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelContent(t=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModel(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelLanguageConfiguration(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeConfiguration(t=>{t.hasChanged(72)&&(this._matchBrackets=this._editor.getOption(72),this._decorations.clear(),this._lastBracketsData=[],this._lastVersionId=0,this._updateBracketsSoon.schedule())})),this._register(e.onDidBlurEditorWidget(()=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidFocusEditorWidget(()=>{this._updateBracketsSoon.schedule()}))}jumpToBracket(){if(!this._editor.hasModel())return;const e=this._editor.getModel(),t=this._editor.getSelections().map(i=>{const n=i.getStartPosition(),s=e.bracketPairs.matchBracket(n);let r=null;if(s)s[0].containsPosition(n)&&!s[1].containsPosition(n)?r=s[1].getStartPosition():s[1].containsPosition(n)&&(r=s[0].getStartPosition());else{const a=e.bracketPairs.findEnclosingBrackets(n);if(a)r=a[1].getStartPosition();else{const d=e.bracketPairs.findNextBracket(n);d&&d.range&&(r=d.range.getStartPosition())}}return r?new $i(r.lineNumber,r.column,r.lineNumber,r.column):new $i(n.lineNumber,n.column,n.lineNumber,n.column)});this._editor.setSelections(t),this._editor.revealRange(t[0])}selectToBracket(e){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=[];this._editor.getSelections().forEach(n=>{const s=n.getStartPosition();let r=t.bracketPairs.matchBracket(s);if(!r&&(r=t.bracketPairs.findEnclosingBrackets(s),!r)){const u=t.bracketPairs.findNextBracket(s);u&&u.range&&(r=t.bracketPairs.matchBracket(u.range.getStartPosition()))}let a=null,d=null;if(r){r.sort(Q.compareRangesUsingStarts);const[u,f]=r;if(a=e?u.getStartPosition():u.getEndPosition(),d=e?f.getEndPosition():f.getStartPosition(),f.containsPosition(s)){const g=a;a=d,d=g}}a&&d&&i.push(new $i(a.lineNumber,a.column,d.lineNumber,d.column))}),i.length>0&&(this._editor.setSelections(i),this._editor.revealRange(i[0]))}removeBrackets(e){if(!this._editor.hasModel())return;const t=this._editor.getModel();this._editor.getSelections().forEach(i=>{const n=i.getPosition();let s=t.bracketPairs.matchBracket(n);s||(s=t.bracketPairs.findEnclosingBrackets(n)),s&&(this._editor.pushUndoStop(),this._editor.executeEdits(e,[{range:s[0],text:""},{range:s[1],text:""}]),this._editor.pushUndoStop())})}_updateBrackets(){if(this._matchBrackets==="never")return;this._recomputeBrackets();const e=[];let t=0;for(const i of this._lastBracketsData){const n=i.brackets;n&&(e[t++]={range:n[0],options:i.options},e[t++]={range:n[1],options:i.options})}this._decorations.set(e)}_recomputeBrackets(){if(!this._editor.hasModel()||!this._editor.hasWidgetFocus()){this._lastBracketsData=[],this._lastVersionId=0;return}const e=this._editor.getSelections();if(e.length>100){this._lastBracketsData=[],this._lastVersionId=0;return}const t=this._editor.getModel(),i=t.getVersionId();let n=[];this._lastVersionId===i&&(n=this._lastBracketsData);const s=[];let r=0;for(let g=0,p=e.length;g<p;g++){const C=e[g];C.isEmpty()&&(s[r++]=C.getStartPosition())}s.length>1&&s.sort(Bi.compare);const a=[];let d=0,u=0;const f=n.length;for(let g=0,p=s.length;g<p;g++){const C=s[g];for(;u<f&&n[u].position.isBefore(C);)u++;if(u<f&&n[u].position.equals(C))a[d++]=n[u];else{let b=t.bracketPairs.matchBracket(C,20),y=ic._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;!b&&this._matchBrackets==="always"&&(b=t.bracketPairs.findEnclosingBrackets(C,20),y=ic._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),a[d++]=new QP(C,b,y)}}this._lastBracketsData=a,this._lastVersionId=i}};ic.ID="editor.contrib.bracketMatchingController",ic._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=vn.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:Fs(KP),position:Ha.Center}}),ic._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=vn.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"});let Mu=ic;hn(Mu.ID,Mu,1);Le(XP);Le(ZP);Le(YP);Rr.appendMenuItem(ni.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:S({key:"miGoToBracket",comment:["&& denotes a mnemonic"]},"Go to &&Bracket")},order:2});class JP{constructor(e,t){this._selection=e,this._isMovingLeft=t}getEditOperations(e,t){if(this._selection.startLineNumber!==this._selection.endLineNumber||this._selection.isEmpty())return;const i=this._selection.startLineNumber,n=this._selection.startColumn,s=this._selection.endColumn;if(!(this._isMovingLeft&&n===1)&&!(!this._isMovingLeft&&s===e.getLineMaxColumn(i)))if(this._isMovingLeft){const r=new Q(i,n-1,i,n),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new Q(i,s,i,s),a)}else{const r=new Q(i,s,i,s+1),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new Q(i,n,i,n),a)}}computeCursorState(e,t){return this._isMovingLeft?new $i(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new $i(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class V6 extends Ct{constructor(e,t){super(t),this.left=e}run(e,t){if(!t.hasModel())return;const i=[],n=t.getSelections();for(const s of n)i.push(new JP(s,this.left));t.pushUndoStop(),t.executeCommands(this.id,i),t.pushUndoStop()}}class eT extends V6{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:S("caret.moveLeft","Move Selected Text Left"),alias:"Move Selected Text Left",precondition:q.writable})}}class tT extends V6{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:S("caret.moveRight","Move Selected Text Right"),alias:"Move Selected Text Right",precondition:q.writable})}}Le(eT);Le(tT);class iT extends Ct{constructor(){super({id:"editor.action.transposeLetters",label:S("transposeLetters.label","Transpose Letters"),alias:"Transpose Letters",precondition:q.writable,kbOpts:{kbExpr:q.textInputFocus,primary:0,mac:{primary:306},weight:100}})}run(e,t){if(!t.hasModel())return;const i=t.getModel(),n=[],s=t.getSelections();for(const r of s){if(!r.isEmpty())continue;const a=r.startLineNumber,d=r.startColumn,u=i.getLineMaxColumn(a);if(a===1&&(d===1||d===2&&u===2))continue;const f=d===u?r.getPosition():Qb.rightPosition(i,r.getPosition().lineNumber,r.getPosition().column),g=Qb.leftPosition(i,f),p=Qb.leftPosition(i,g),C=i.getValueInRange(Q.fromPositions(p,g)),b=i.getValueInRange(Q.fromPositions(g,f)),y=Q.fromPositions(p,f);n.push(new wp(y,b+C))}n.length>0&&(t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop())}}Le(iT);const fb=(function(){if(typeof crypto=="object"&&typeof crypto.randomUUID=="function")return crypto.randomUUID.bind(crypto);let o;typeof crypto=="object"&&typeof crypto.getRandomValues=="function"?o=crypto.getRandomValues.bind(crypto):o=function(i){for(let n=0;n<i.length;n++)i[n]=Math.floor(Math.random()*256);return i};const e=new Uint8Array(16),t=[];for(let i=0;i<256;i++)t.push(i.toString(16).padStart(2,"0"));return function(){o(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let n=0,s="";return s+=t[e[n++]],s+=t[e[n++]],s+=t[e[n++]],s+=t[e[n++]],s+="-",s+=t[e[n++]],s+=t[e[n++]],s+="-",s+=t[e[n++]],s+=t[e[n++]],s+="-",s+=t[e[n++]],s+=t[e[n++]],s+="-",s+=t[e[n++]],s+=t[e[n++]],s+=t[e[n++]],s+=t[e[n++]],s+=t[e[n++]],s+=t[e[n++]],s}})();function m9(o){return{asString:async()=>o,asFile:()=>{},value:typeof o=="string"?o:void 0}}function nT(o,e,t){const i={id:fb(),name:o,uri:e,data:t};return{asString:async()=>"",asFile:()=>i,value:void 0}}class j6{constructor(){this._entries=new Map}get size(){let e=0;for(const t of this._entries)e++;return e}has(e){return this._entries.has(this.toKey(e))}matches(e){const t=[...this._entries.keys()];return ml.some(this,([i,n])=>n.asFile())&&t.push("files"),U6(zm(e),t)}get(e){var t;return(t=this._entries.get(this.toKey(e)))==null?void 0:t[0]}append(e,t){const i=this._entries.get(e);i?i.push(t):this._entries.set(this.toKey(e),[t])}replace(e,t){this._entries.set(this.toKey(e),[t])}delete(e){this._entries.delete(this.toKey(e))}*[Symbol.iterator](){for(const[e,t]of this._entries)for(const i of t)yield[e,i]}toKey(e){return zm(e)}}function zm(o){return o.toLowerCase()}function $6(o,e){return U6(zm(o),e.map(zm))}function U6(o,e){if(o==="*/*")return e.length>0;if(e.includes(o))return!0;const t=o.match(/^([a-z]+)\/([a-z]+|\*)$/i);if(!t)return!1;const[i,n,s]=t;return s==="*"?e.some(r=>r.startsWith(n+"/")):!1}const gb=Object.freeze({create:o=>aA(o.map(e=>e.toString())).join(`\r
14
+ `),split:o=>o.split(`\r
15
+ `),parse:o=>gb.split(o).filter(e=>!e.startsWith("#"))}),wa=class wa{constructor(e){this.value=e}equals(e){return this.value===e.value}contains(e){return this.equals(e)||this.value===""||e.value.startsWith(this.value+wa.sep)}intersects(e){return this.contains(e)||e.contains(this)}append(...e){return new wa((this.value?[this.value,...e]:e).join(wa.sep))}};wa.sep=".",wa.None=new wa("@@none@@"),wa.Empty=new wa("");let ns=wa;const C8={EDITORS:"CodeEditors",FILES:"CodeFiles"};class sT{}const oT={DragAndDropContribution:"workbench.contributions.dragAndDrop"};ca.add(oT.DragAndDropContribution,new sT);const wg=class wg{constructor(){}static getInstance(){return wg.INSTANCE}hasData(e){return e&&e===this.proto}getData(e){if(this.hasData(e))return this.data}};wg.INSTANCE=new wg;let P1=wg;function q6(o){const e=new j6;for(const t of o.items){const i=t.type;if(t.kind==="string"){const n=new Promise(s=>t.getAsString(s));e.append(i,m9(n))}else if(t.kind==="file"){const n=t.getAsFile();n&&e.append(i,rT(n))}}return e}function rT(o){const e=o.path?jn.parse(o.path):void 0;return nT(o.name,e,async()=>new Uint8Array(await o.arrayBuffer()))}const aT=Object.freeze([C8.EDITORS,C8.FILES,JC.RESOURCES,JC.INTERNAL_URI_LIST]);function G6(o,e=!1){const t=q6(o),i=t.get(JC.INTERNAL_URI_LIST);if(i)t.replace(Zs.uriList,i);else if(e||!t.has(Zs.uriList)){const n=[];for(const s of o.items){const r=s.getAsFile();if(r){const a=r.path;try{a?n.push(jn.file(a).toString()):n.push(jn.parse(r.name,!0).toString())}catch{}}}n.length&&t.replace(Zs.uriList,m9(gb.create(n)))}for(const n of aT)t.delete(n);return t}var v9=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Vg=function(o,e){return function(t,i){e(t,i,o)}};class _9{async provideDocumentPasteEdits(e,t,i,n,s){const r=await this.getEdit(i,s);if(r)return{edits:[{insertText:r.insertText,title:r.title,kind:r.kind,handledMimeType:r.handledMimeType,yieldTo:r.yieldTo}],dispose(){}}}async provideDocumentDropEdits(e,t,i,n){const s=await this.getEdit(i,n);if(s)return{edits:[{insertText:s.insertText,title:s.title,kind:s.kind,handledMimeType:s.handledMimeType,yieldTo:s.yieldTo}],dispose(){}}}}const Sg=class Sg extends _9{constructor(){super(...arguments),this.kind=Sg.kind,this.dropMimeTypes=[Zs.text],this.pasteMimeTypes=[Zs.text]}async getEdit(e,t){const i=e.get(Zs.text);if(!i||e.has(Zs.uriList))return;const n=await i.asString();return{handledMimeType:Zs.text,title:S("text.label","Insert Plain Text"),insertText:n,kind:this.kind}}};Sg.id="text",Sg.kind=new ns("text.plain");let Ru=Sg;class K6 extends _9{constructor(){super(...arguments),this.kind=new ns("uri.absolute"),this.dropMimeTypes=[Zs.uriList],this.pasteMimeTypes=[Zs.uriList]}async getEdit(e,t){const i=await Z6(e);if(!i.length||t.isCancellationRequested)return;let n=0;const s=i.map(({uri:a,originalText:d})=>a.scheme===Co.file?a.fsPath:(n++,d)).join(" ");let r;return n>0?r=i.length>1?S("defaultDropProvider.uriList.uris","Insert Uris"):S("defaultDropProvider.uriList.uri","Insert Uri"):r=i.length>1?S("defaultDropProvider.uriList.paths","Insert Paths"):S("defaultDropProvider.uriList.path","Insert Path"),{handledMimeType:Zs.uriList,insertText:s,title:r,kind:this.kind}}}let Vm=class extends _9{constructor(e){super(),this._workspaceContextService=e,this.kind=new ns("uri.relative"),this.dropMimeTypes=[Zs.uriList],this.pasteMimeTypes=[Zs.uriList]}async getEdit(e,t){const i=await Z6(e);if(!i.length||t.isCancellationRequested)return;const n=yl(i.map(({uri:s})=>{const r=this._workspaceContextService.getWorkspaceFolder(s);return r?YF(r.uri,s):void 0}));if(n.length)return{handledMimeType:Zs.uriList,insertText:n.join(" "),title:i.length>1?S("defaultDropProvider.uriList.relativePaths","Insert Relative Paths"):S("defaultDropProvider.uriList.relativePath","Insert Relative Path"),kind:this.kind}}};Vm=v9([Vg(0,F0)],Vm);class lT{constructor(){this.kind=new ns("html"),this.pasteMimeTypes=["text/html"],this._yieldTo=[{mimeType:Zs.text}]}async provideDocumentPasteEdits(e,t,i,n,s){var d;if(n.triggerKind!==e1.PasteAs&&!((d=n.only)!=null&&d.contains(this.kind)))return;const r=i.get("text/html"),a=await(r==null?void 0:r.asString());if(!(!a||s.isCancellationRequested))return{dispose(){},edits:[{insertText:a,yieldTo:this._yieldTo,title:S("pasteHtmlLabel","Insert HTML"),kind:this.kind}]}}}async function Z6(o){const e=o.get(Zs.uriList);if(!e)return[];const t=await e.asString(),i=[];for(const n of gb.parse(t))try{i.push({uri:jn.parse(n),originalText:n})}catch{}return i}let T1=class extends Rt{constructor(e,t){super(),this._register(e.documentDropEditProvider.register("*",new Ru)),this._register(e.documentDropEditProvider.register("*",new K6)),this._register(e.documentDropEditProvider.register("*",new Vm(t)))}};T1=v9([Vg(0,Fi),Vg(1,F0)],T1);let M1=class extends Rt{constructor(e,t){super(),this._register(e.documentPasteEditProvider.register("*",new Ru)),this._register(e.documentPasteEditProvider.register("*",new K6)),this._register(e.documentPasteEditProvider.register("*",new Vm(t))),this._register(e.documentPasteEditProvider.register("*",new lT))}};M1=v9([Vg(0,Fi),Vg(1,F0)],M1);const br=class br{constructor(){this.value="",this.pos=0}static isDigitCharacter(e){return e>=48&&e<=57}static isVariableCharacter(e){return e===95||e>=97&&e<=122||e>=65&&e<=90}text(e){this.value=e,this.pos=0}tokenText(e){return this.value.substr(e.pos,e.len)}next(){if(this.pos>=this.value.length)return{type:14,pos:this.pos,len:0};const e=this.pos;let t=0,i=this.value.charCodeAt(e),n;if(n=br._table[i],typeof n=="number")return this.pos+=1,{type:n,pos:e,len:1};if(br.isDigitCharacter(i)){n=8;do t+=1,i=this.value.charCodeAt(e+t);while(br.isDigitCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}if(br.isVariableCharacter(i)){n=9;do i=this.value.charCodeAt(e+ ++t);while(br.isVariableCharacter(i)||br.isDigitCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}n=10;do t+=1,i=this.value.charCodeAt(e+t);while(!isNaN(i)&&typeof br._table[i]>"u"&&!br.isDigitCharacter(i)&&!br.isVariableCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}};br._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13};let R1=br;class pf{constructor(){this._children=[]}appendChild(e){return e instanceof Po&&this._children[this._children.length-1]instanceof Po?this._children[this._children.length-1].value+=e.value:(e.parent=this,this._children.push(e)),this}replace(e,t){const{parent:i}=e,n=i.children.indexOf(e),s=i.children.slice(0);s.splice(n,1,...t),i._children=s,(function r(a,d){for(const u of a)u.parent=d,r(u.children,u)})(t,i)}get children(){return this._children}get rightMostDescendant(){return this._children.length>0?this._children[this._children.length-1].rightMostDescendant:this}get snippet(){let e=this;for(;;){if(!e)return;if(e instanceof Up)return e;e=e.parent}}toString(){return this.children.reduce((e,t)=>e+t.toString(),"")}len(){return 0}}let Po=class X6 extends pf{constructor(e){super(),this.value=e}toString(){return this.value}len(){return this.value.length}clone(){return new X6(this.value)}};class Y6 extends pf{}class hr extends Y6{static compareByIndex(e,t){return e.index===t.index?0:e.isFinalTabstop?1:t.isFinalTabstop||e.index<t.index?-1:e.index>t.index?1:0}constructor(e){super(),this.index=e}get isFinalTabstop(){return this.index===0}get choice(){return this._children.length===1&&this._children[0]instanceof xf?this._children[0]:void 0}clone(){const e=new hr(this.index);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}class xf extends pf{constructor(){super(...arguments),this.options=[]}appendChild(e){return e instanceof Po&&(e.parent=this,this.options.push(e)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const e=new xf;return this.options.forEach(e.appendChild,e),e}}class b9 extends pf{constructor(){super(...arguments),this.regexp=new RegExp("")}resolve(e){const t=this;let i=!1,n=e.replace(this.regexp,function(){return i=!0,t._replace(Array.prototype.slice.call(arguments,0,-2))});return!i&&this._children.some(s=>s instanceof Yr&&!!s.elseValue)&&(n=this._replace([])),n}_replace(e){let t="";for(const i of this._children)if(i instanceof Yr){let n=e[i.index]||"";n=i.resolve(n),t+=n}else t+=i.toString();return t}toString(){return""}clone(){const e=new b9;return e.regexp=new RegExp(this.regexp.source,(this.regexp.ignoreCase?"i":"")+(this.regexp.global?"g":"")),e._children=this.children.map(t=>t.clone()),e}}class Yr extends pf{constructor(e,t,i,n){super(),this.index=e,this.shorthandName=t,this.ifValue=i,this.elseValue=n}resolve(e){return this.shorthandName==="upcase"?e?e.toLocaleUpperCase():"":this.shorthandName==="downcase"?e?e.toLocaleLowerCase():"":this.shorthandName==="capitalize"?e?e[0].toLocaleUpperCase()+e.substr(1):"":this.shorthandName==="pascalcase"?e?this._toPascalCase(e):"":this.shorthandName==="camelcase"?e?this._toCamelCase(e):"":e&&typeof this.ifValue=="string"?this.ifValue:!e&&typeof this.elseValue=="string"?this.elseValue:e||""}_toPascalCase(e){const t=e.match(/[a-z0-9]+/gi);return t?t.map(i=>i.charAt(0).toUpperCase()+i.substr(1)).join(""):e}_toCamelCase(e){const t=e.match(/[a-z0-9]+/gi);return t?t.map((i,n)=>n===0?i.charAt(0).toLowerCase()+i.substr(1):i.charAt(0).toUpperCase()+i.substr(1)).join(""):e}clone(){return new Yr(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class jg extends Y6{constructor(e){super(),this.name=e}resolve(e){let t=e.resolve(this);return this.transform&&(t=this.transform.resolve(t||"")),t!==void 0?(this._children=[new Po(t)],!0):!1}clone(){const e=new jg(this.name);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}function E8(o,e){const t=[...o];for(;t.length>0;){const i=t.shift();if(!e(i))break;t.unshift(...i.children)}}class Up extends pf{get placeholderInfo(){if(!this._placeholders){const e=[];let t;this.walk(function(i){return i instanceof hr&&(e.push(i),t=!t||t.index<i.index?i:t),!0}),this._placeholders={all:e,last:t}}return this._placeholders}get placeholders(){const{all:e}=this.placeholderInfo;return e}offset(e){let t=0,i=!1;return this.walk(n=>n===e?(i=!0,!1):(t+=n.len(),!0)),i?t:-1}fullLen(e){let t=0;return E8([e],i=>(t+=i.len(),!0)),t}enclosingPlaceholders(e){const t=[];let{parent:i}=e;for(;i;)i instanceof hr&&t.push(i),i=i.parent;return t}resolveVariables(e){return this.walk(t=>(t instanceof jg&&t.resolve(e)&&(this._placeholders=void 0),!0)),this}appendChild(e){return this._placeholders=void 0,super.appendChild(e)}replace(e,t){return this._placeholders=void 0,super.replace(e,t)}clone(){const e=new Up;return this._children=this.children.map(t=>t.clone()),e}walk(e){E8(this.children,e)}}class Nu{constructor(){this._scanner=new R1,this._token={type:14,pos:0,len:0}}static escape(e){return e.replace(/\$|}|\\/g,"\\$&")}static guessNeedsClipboard(e){return/\${?CLIPBOARD/.test(e)}parse(e,t,i){const n=new Up;return this.parseFragment(e,n),this.ensureFinalTabstop(n,i??!1,t??!1),n}parseFragment(e,t){const i=t.children.length;for(this._scanner.text(e),this._token=this._scanner.next();this._parse(t););const n=new Map,s=[];t.walk(d=>(d instanceof hr&&(d.isFinalTabstop?n.set(0,void 0):!n.has(d.index)&&d.children.length>0?n.set(d.index,d.children):s.push(d)),!0));const r=(d,u)=>{const f=n.get(d.index);if(!f)return;const g=new hr(d.index);g.transform=d.transform;for(const p of f){const C=p.clone();g.appendChild(C),C instanceof hr&&n.has(C.index)&&!u.has(C.index)&&(u.add(C.index),r(C,u),u.delete(C.index))}t.replace(d,[g])},a=new Set;for(const d of s)r(d,a);return t.children.slice(i)}ensureFinalTabstop(e,t,i){(t||i&&e.placeholders.length>0)&&(e.placeholders.find(s=>s.index===0)||e.appendChild(new hr(0)))}_accept(e,t){if(e===void 0||this._token.type===e){const i=t?this._scanner.tokenText(this._token):!0;return this._token=this._scanner.next(),i}return!1}_backTo(e){return this._scanner.pos=e.pos+e.len,this._token=e,!1}_until(e){const t=this._token;for(;this._token.type!==e;){if(this._token.type===14)return!1;if(this._token.type===5){const n=this._scanner.next();if(n.type!==0&&n.type!==4&&n.type!==5)return!1}this._token=this._scanner.next()}const i=this._scanner.value.substring(t.pos,this._token.pos).replace(/\\(\$|}|\\)/g,"$1");return this._token=this._scanner.next(),i}_parse(e){return this._parseEscaped(e)||this._parseTabstopOrVariableName(e)||this._parseComplexPlaceholder(e)||this._parseComplexVariable(e)||this._parseAnything(e)}_parseEscaped(e){let t;return(t=this._accept(5,!0))?(t=this._accept(0,!0)||this._accept(4,!0)||this._accept(5,!0)||t,e.appendChild(new Po(t)),!0):!1}_parseTabstopOrVariableName(e){let t;const i=this._token;return this._accept(0)&&(t=this._accept(9,!0)||this._accept(8,!0))?(e.appendChild(/^\d+$/.test(t)?new hr(Number(t)):new jg(t)),!0):this._backTo(i)}_parseComplexPlaceholder(e){let t;const i=this._token;if(!(this._accept(0)&&this._accept(3)&&(t=this._accept(8,!0))))return this._backTo(i);const s=new hr(Number(t));if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new Po("${"+t+":")),s.children.forEach(e.appendChild,e),!0}else if(s.index>0&&this._accept(7)){const r=new xf;for(;;){if(this._parseChoiceElement(r)){if(this._accept(2))continue;if(this._accept(7)&&(s.appendChild(r),this._accept(4)))return e.appendChild(s),!0}return this._backTo(i),!1}}else return this._accept(6)?this._parseTransform(s)?(e.appendChild(s),!0):(this._backTo(i),!1):this._accept(4)?(e.appendChild(s),!0):this._backTo(i)}_parseChoiceElement(e){const t=this._token,i=[];for(;!(this._token.type===2||this._token.type===7);){let n;if((n=this._accept(5,!0))?n=this._accept(2,!0)||this._accept(7,!0)||this._accept(5,!0)||n:n=this._accept(void 0,!0),!n)return this._backTo(t),!1;i.push(n)}return i.length===0?(this._backTo(t),!1):(e.appendChild(new Po(i.join(""))),!0)}_parseComplexVariable(e){let t;const i=this._token;if(!(this._accept(0)&&this._accept(3)&&(t=this._accept(9,!0))))return this._backTo(i);const s=new jg(t);if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new Po("${"+t+":")),s.children.forEach(e.appendChild,e),!0}else return this._accept(6)?this._parseTransform(s)?(e.appendChild(s),!0):(this._backTo(i),!1):this._accept(4)?(e.appendChild(s),!0):this._backTo(i)}_parseTransform(e){const t=new b9;let i="",n="";for(;!this._accept(6);){let s;if(s=this._accept(5,!0)){s=this._accept(6,!0)||s,i+=s;continue}if(this._token.type!==14){i+=this._accept(void 0,!0);continue}return!1}for(;!this._accept(6);){let s;if(s=this._accept(5,!0)){s=this._accept(5,!0)||this._accept(6,!0)||s,t.appendChild(new Po(s));continue}if(!(this._parseFormatString(t)||this._parseAnything(t)))return!1}for(;!this._accept(4);){if(this._token.type!==14){n+=this._accept(void 0,!0);continue}return!1}try{t.regexp=new RegExp(i,n)}catch{return!1}return e.transform=t,!0}_parseFormatString(e){const t=this._token;if(!this._accept(0))return!1;let i=!1;this._accept(3)&&(i=!0);const n=this._accept(8,!0);if(n)if(i){if(this._accept(4))return e.appendChild(new Yr(Number(n))),!0;if(!this._accept(1))return this._backTo(t),!1}else return e.appendChild(new Yr(Number(n))),!0;else return this._backTo(t),!1;if(this._accept(6)){const s=this._accept(9,!0);return!s||!this._accept(4)?(this._backTo(t),!1):(e.appendChild(new Yr(Number(n),s)),!0)}else if(this._accept(11)){const s=this._until(4);if(s)return e.appendChild(new Yr(Number(n),void 0,s,void 0)),!0}else if(this._accept(12)){const s=this._until(4);if(s)return e.appendChild(new Yr(Number(n),void 0,void 0,s)),!0}else if(this._accept(13)){const s=this._until(1);if(s){const r=this._until(4);if(r)return e.appendChild(new Yr(Number(n),void 0,s,r)),!0}}else{const s=this._until(4);if(s)return e.appendChild(new Yr(Number(n),void 0,void 0,s)),!0}return this._backTo(t),!1}_parseAnything(e){return this._token.type!==14?(e.appendChild(new Po(this._scanner.tokenText(this._token))),this._accept(void 0),!0):!1}}function Q6(o,e,t){var i,n;return(typeof t.insertText=="string"?t.insertText==="":t.insertText.snippet==="")?{edits:((i=t.additionalEdit)==null?void 0:i.edits)??[]}:{edits:[...e.map(s=>new QF(o,{range:s,text:typeof t.insertText=="string"?Nu.escape(t.insertText)+"$0":t.insertText.snippet,insertAsSnippet:!0})),...((n=t.additionalEdit)==null?void 0:n.edits)??[]]}}function J6(o){function e(r,a){return"mimeType"in r?r.mimeType===a.handledMimeType:!!a.kind&&r.kind.contains(a.kind)}const t=new Map;for(const r of o)for(const a of r.yieldTo??[])for(const d of o)if(d!==r&&e(a,d)){let u=t.get(r);u||(u=[],t.set(r,u)),u.push(d)}if(!t.size)return Array.from(o);const i=new Set,n=[];function s(r){if(!r.length)return[];const a=r[0];if(n.includes(a))return console.warn("Yield to cycle detected",a),r;if(i.has(a))return s(r.slice(1));let d=[];const u=t.get(a);return u&&(n.push(a),d=s(u),n.pop()),i.add(a),[...d,a,...s(r.slice(1))]}return s(Array.from(o))}var cT=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},dT=function(o,e){return function(t,i){e(t,i,o)}};const uT=vn.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:lA,inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}}),Jv=class Jv extends Rt{constructor(e,t,i,n,s){super(),this.typeId=e,this.editor=t,this.range=i,this.delegate=s,this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this.create(n),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this)}create(e){this.domNode=mi(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=e;const t=mi("span.icon");this.domNode.append(t),t.classList.add(...Rn.asClassNameArray(Ki.loading),"codicon-modifier-spin");const i=()=>{const n=this.editor.getOption(67);this.domNode.style.height=`${n}px`,this.domNode.style.width=`${Math.ceil(.8*n)}px`};i(),this._register(this.editor.onDidChangeConfiguration(n=>{(n.hasChanged(52)||n.hasChanged(67))&&i()})),this._register(Bn(this.domNode,as.CLICK,n=>{this.delegate.cancel()}))}getId(){return Jv.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:{lineNumber:this.range.startLineNumber,column:this.range.startColumn},preference:[0]}}dispose(){super.dispose(),this.editor.removeContentWidget(this)}};Jv.baseId="editor.widget.inlineProgressWidget";let N1=Jv,jm=class extends Rt{constructor(e,t,i){super(),this.id=e,this._editor=t,this._instantiationService=i,this._showDelay=500,this._showPromise=this._register(new er),this._currentWidget=this._register(new er),this._operationIdPool=0,this._currentDecorations=t.createDecorationsCollection()}dispose(){super.dispose(),this._currentDecorations.clear()}async showWhile(e,t,i,n,s){const r=this._operationIdPool++;this._currentOperation=r,this.clear(),this._showPromise.value=kg(()=>{const a=Q.fromPositions(e);this._currentDecorations.set([{range:a,options:uT}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(N1,this.id,this._editor,a,t,n))},s??this._showDelay);try{return await i}finally{this._currentOperation===r&&(this.clear(),this._currentOperation=void 0)}}clear(){this._showPromise.clear(),this._currentDecorations.clear(),this._currentWidget.clear()}};jm=cT([dT(2,sn)],jm);var hT=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},y8=function(o,e){return function(t,i){e(t,i,o)}},rm,Cc;let Mo=(Cc=class{static get(e){return e.getContribution(rm.ID)}constructor(e,t,i){this._openerService=i,this._messageWidget=new er,this._messageListeners=new Tt,this._mouseOverMessage=!1,this._editor=e,this._visible=rm.MESSAGE_VISIBLE.bindTo(t)}dispose(){var e;(e=this._message)==null||e.dispose(),this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}showMessage(e,t){Nr(Zx(e)?e.value:e),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._message=Zx(e)?JF(e,{actionHandler:{callback:n=>{this.closeMessage(),e3(this._openerService,n,Zx(e)?e.isTrusted:void 0)},disposables:this._messageListeners}}):void 0,this._messageWidget.value=new w8(this._editor,t,typeof e=="string"?e:this._message.element),this._messageListeners.add(Ts.debounce(this._editor.onDidBlurEditorText,(n,s)=>s,0)(()=>{this._mouseOverMessage||this._messageWidget.value&&t3(rA(),this._messageWidget.value.getDomNode())||this.closeMessage()})),this._messageListeners.add(this._editor.onDidChangeCursorPosition(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidDispose(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidChangeModel(()=>this.closeMessage())),this._messageListeners.add(Bn(this._messageWidget.value.getDomNode(),as.MOUSE_ENTER,()=>this._mouseOverMessage=!0,!0)),this._messageListeners.add(Bn(this._messageWidget.value.getDomNode(),as.MOUSE_LEAVE,()=>this._mouseOverMessage=!1,!0));let i;this._messageListeners.add(this._editor.onMouseMove(n=>{n.target.position&&(i?i.containsPosition(n.target.position)||this.closeMessage():i=new Q(t.lineNumber-3,1,n.target.position.lineNumber+3,1))}))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(w8.fadeOut(this._messageWidget.value))}},rm=Cc,Cc.ID="editor.contrib.messageController",Cc.MESSAGE_VISIBLE=new En("messageVisible",!1,S("messageVisible","Whether the editor is currently showing an inline message")),Cc);Mo=rm=hT([y8(1,Fn),y8(2,da)],Mo);const fT=Ao.bindToContribution(Mo.get);Ti(new fT({id:"leaveEditorMessage",precondition:Mo.MESSAGE_VISIBLE,handler:o=>o.closeMessage(),kbOpts:{weight:130,primary:9}}));let w8=class{static fadeOut(e){const t=()=>{e.dispose(),clearTimeout(i),e.getDomNode().removeEventListener("animationend",t)},i=setTimeout(t,110);return e.getDomNode().addEventListener("animationend",t),e.getDomNode().classList.add("fadeOut"),{dispose:t}}constructor(e,{lineNumber:t,column:i},n){this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._editor=e,this._editor.revealLinesInCenterIfOutsideViewport(t,t,0),this._position={lineNumber:t,column:i},this._domNode=document.createElement("div"),this._domNode.classList.add("monaco-editor-overlaymessage"),this._domNode.style.marginLeft="-6px";const s=document.createElement("div");s.classList.add("anchor","top"),this._domNode.appendChild(s);const r=document.createElement("div");typeof n=="string"?(r.classList.add("message"),r.textContent=n):(n.classList.add("message"),r.appendChild(n)),this._domNode.appendChild(r);const a=document.createElement("div");a.classList.add("anchor","below"),this._domNode.appendChild(a),this._editor.addContentWidget(this),this._domNode.classList.add("fadeIn")}dispose(){this._editor.removeContentWidget(this)}getId(){return"messageoverlay"}getDomNode(){return this._domNode}getPosition(){return{position:this._position,preference:[1,2],positionAffinity:1}}afterRender(e){this._domNode.classList.toggle("below",e===2)}};hn(Mo.ID,Mo,4);function fC(o,e){return e&&(o.stack||o.stacktrace)?S("stackTrace.format","{0}: {1}",D8(o),S8(o.stack)||S8(o.stacktrace)):D8(o)}function S8(o){return Array.isArray(o)?o.join(`
16
+ `):o}function D8(o){return o.code==="ERR_UNC_HOST_NOT_ALLOWED"?`${o.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`:typeof o.code=="string"&&typeof o.errno=="number"&&typeof o.syscall=="string"?S("nodeExceptionMessage","A system error occurred ({0})",o.message):o.message||S("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}function $m(o=null,e=!1){if(!o)return S("error.defaultMessage","An unknown error occurred. Please consult the log for more details.");if(Array.isArray(o)){const t=yl(o),i=$m(t[0],e);return t.length>1?S("error.moreErrors","{0} ({1} errors in total)",i,t.length):i}if(cA(o))return o;if(o.detail){const t=o.detail;if(t.error)return fC(t.error,e);if(t.exception)return fC(t.exception,e)}return o.stack?fC(o,e):o.message?o.message:S("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}var e5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},c0=function(o,e){return function(t,i){e(t,i,o)}},O1,jd;let H1=(jd=class extends Rt{constructor(e,t,i,n,s,r,a,d,u,f){super(),this.typeId=e,this.editor=t,this.showCommand=n,this.range=s,this.edits=r,this.onSelectNewEdit=a,this._contextMenuService=d,this._keybindingService=f,this.allowEditorOverflow=!0,this.suppressMouseDown=!0,this.create(),this.visibleContext=i.bindTo(u),this.visibleContext.set(!0),this._register(is(()=>this.visibleContext.reset())),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(is((()=>this.editor.removeContentWidget(this)))),this._register(this.editor.onDidChangeCursorPosition(g=>{s.containsPosition(g.position)||this.dispose()})),this._register(Ts.runAndSubscribe(f.onDidUpdateKeybindings,()=>{this._updateButtonTitle()}))}_updateButtonTitle(){var t;const e=(t=this._keybindingService.lookupKeybinding(this.showCommand.id))==null?void 0:t.getLabel();this.button.element.title=this.showCommand.label+(e?` (${e})`:"")}create(){this.domNode=mi(".post-edit-widget"),this.button=this._register(new i3(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(Bn(this.domNode,as.CLICK,()=>this.showSelector()))}getId(){return O1.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){this._contextMenuService.showContextMenu({getAnchor:()=>{const e=yo(this.button.element);return{x:e.left+e.width,y:e.top+e.height}},getActions:()=>this.edits.allEdits.map((e,t)=>n3({id:"",label:e.title,checked:t===this.edits.activeEditIndex,run:()=>{if(t!==this.edits.activeEditIndex)return this.onSelectNewEdit(t)}}))})}},O1=jd,jd.baseId="editor.widget.postEditWidget",jd);H1=O1=e5([c0(7,af),c0(8,Fn),c0(9,As)],H1);let Um=class extends Rt{constructor(e,t,i,n,s,r,a){super(),this._id=e,this._editor=t,this._visibleContext=i,this._showCommand=n,this._instantiationService=s,this._bulkEditService=r,this._notificationService=a,this._currentWidget=this._register(new er),this._register(Ts.any(t.onDidChangeModel,t.onDidChangeModelContent)(()=>this.clear()))}async applyEditAndShowIfNeeded(e,t,i,n,s){const r=this._editor.getModel();if(!r||!e.length)return;const a=t.allEdits.at(t.activeEditIndex);if(!a)return;const d=async w=>{const A=this._editor.getModel();A&&(await A.undo(),this.applyEditAndShowIfNeeded(e,{activeEditIndex:w,allEdits:t.allEdits},i,n,s))},u=(w,A)=>{qc(w)||(this._notificationService.error(A),i&&this.show(e[0],t,d))};let f;try{f=await n(a,s)}catch(w){return u(w,S("resolveError",`Error resolving edit '{0}':
17
+ {1}`,a.title,$m(w)))}if(s.isCancellationRequested)return;const g=Q6(r.uri,e,f),p=e[0],C=r.deltaDecorations([],[{range:p,options:{description:"paste-line-suffix",stickiness:0}}]);this._editor.focus();let b,y;try{b=await this._bulkEditService.apply(g,{editor:this._editor,token:s}),y=r.getDecorationRange(C[0])}catch(w){return u(w,S("applyError",`Error applying edit '{0}':
18
+ {1}`,a.title,$m(w)))}finally{r.deltaDecorations(C,[])}s.isCancellationRequested||i&&b.isApplied&&t.allEdits.length>1&&this.show(y??p,t,d)}show(e,t,i){this.clear(),this._editor.hasModel()&&(this._currentWidget.value=this._instantiationService.createInstance(H1,this._id,this._editor,this._visibleContext,this._showCommand,e,t,i))}clear(){this._currentWidget.clear()}tryShowSelector(){var e;(e=this._currentWidget.value)==null||e.showSelector()}};Um=e5([c0(4,sn),c0(5,H_),c0(6,mo)],Um);var gT=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},bh=function(o,e){return function(t,i){e(t,i,o)}},gd;const t5="editor.changePasteType",C9=new En("pasteWidgetVisible",!1,S("pasteWidgetVisible","Whether the paste widget is showing")),gC="application/vnd.code.copyMetadata";var $d;let Bl=($d=class extends Rt{static get(e){return e.getContribution(gd.ID)}constructor(e,t,i,n,s,r,a){super(),this._bulkEditService=i,this._clipboardService=n,this._languageFeaturesService=s,this._quickInputService=r,this._progressService=a,this._editor=e;const d=e.getContainerDomNode();this._register(Bn(d,"copy",u=>this.handleCopy(u))),this._register(Bn(d,"cut",u=>this.handleCopy(u))),this._register(Bn(d,"paste",u=>this.handlePaste(u),!0)),this._pasteProgressManager=this._register(new jm("pasteIntoEditor",e,t)),this._postPasteWidgetManager=this._register(t.createInstance(Um,"pasteIntoEditor",e,C9,{id:t5,label:S("postPasteWidgetTitle","Show paste options...")}))}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}pasteAs(e){this._editor.focus();try{this._pasteAsActionContext={preferred:e},kw().execCommand("paste")}finally{this._pasteAsActionContext=void 0}}clearWidgets(){this._postPasteWidgetManager.clear()}isPasteAsEnabled(){return this._editor.getOption(85).enabled}async finishedPaste(){await this._currentPasteOperation}handleCopy(e){var y,w,A,I;if(!this._editor.hasTextFocus()||((w=(y=this._clipboardService).clearInternalState)==null||w.call(y),!e.clipboardData||!this.isPasteAsEnabled()))return;const t=this._editor.getModel(),i=this._editor.getSelections();if(!t||!(i!=null&&i.length))return;const n=this._editor.getOption(37);let s=i;const r=i.length===1&&i[0].isEmpty();if(r){if(!n)return;s=[new Q(s[0].startLineNumber,1,s[0].startLineNumber,1+t.getLineLength(s[0].startLineNumber))]}const a=(A=this._editor._getViewModel())==null?void 0:A.getPlainTextToCopy(i,n,W_),u={multicursorText:Array.isArray(a)?a:null,pasteOnNewLine:r,mode:null},f=this._languageFeaturesService.documentPasteEditProvider.ordered(t).filter(T=>!!T.prepareDocumentPaste);if(!f.length){this.setCopyMetadata(e.clipboardData,{defaultPastePayload:u});return}const g=q6(e.clipboardData),p=f.flatMap(T=>T.copyMimeTypes??[]),C=fb();this.setCopyMetadata(e.clipboardData,{id:C,providerCopyMimeTypes:p,defaultPastePayload:u});const b=qs(async T=>{const R=yl(await Promise.all(f.map(async P=>{try{return await P.prepareDocumentPaste(t,s,g,T)}catch(V){console.error(V);return}})));R.reverse();for(const P of R)for(const[V,j]of P)g.replace(V,j);return g});(I=gd._currentCopyOperation)==null||I.dataTransferPromise.cancel(),gd._currentCopyOperation={handle:C,dataTransferPromise:b}}async handlePaste(e){var d,u,f;if(!e.clipboardData||!this._editor.hasTextFocus())return;(d=Mo.get(this._editor))==null||d.closeMessage(),(u=this._currentPasteOperation)==null||u.cancel(),this._currentPasteOperation=void 0;const t=this._editor.getModel(),i=this._editor.getSelections();if(!(i!=null&&i.length)||!t||this._editor.getOption(92)||!this.isPasteAsEnabled()&&!this._pasteAsActionContext)return;const n=this.fetchCopyMetadata(e),s=G6(e.clipboardData);s.delete(gC);const r=[...e.clipboardData.types,...(n==null?void 0:n.providerCopyMimeTypes)??[],Zs.uriList],a=this._languageFeaturesService.documentPasteEditProvider.ordered(t).filter(g=>{var C,b;const p=(C=this._pasteAsActionContext)==null?void 0:C.preferred;return p&&g.providedPasteEditKinds&&!this.providerMatchesPreference(g,p)?!1:(b=g.pasteMimeTypes)==null?void 0:b.some(y=>$6(y,r))});if(!a.length){(f=this._pasteAsActionContext)!=null&&f.preferred&&this.showPasteAsNoEditMessage(i,this._pasteAsActionContext.preferred);return}e.preventDefault(),e.stopImmediatePropagation(),this._pasteAsActionContext?this.showPasteAsPick(this._pasteAsActionContext.preferred,a,i,s,n):this.doPasteInline(a,i,s,n,e)}showPasteAsNoEditMessage(e,t){var i;(i=Mo.get(this._editor))==null||i.showMessage(S("pasteAsError","No paste edits for '{0}' found",t instanceof ns?t.value:t.providerId),e[0].getStartPosition())}doPasteInline(e,t,i,n,s){const r=this._editor;if(!r.hasModel())return;const a=new L0(r,3,void 0),d=qs(async u=>{const f=this._editor;if(!f.hasModel())return;const g=f.getModel(),p=new Tt,C=p.add(new Gs(u));p.add(a.token.onCancellationRequested(()=>C.cancel()));const b=C.token;try{if(await this.mergeInDataFromCopy(i,n,b),b.isCancellationRequested)return;const y=e.filter(I=>this.isSupportedPasteProvider(I,i));if(!y.length||y.length===1&&y[0]instanceof Ru)return this.applyDefaultPasteHandler(i,n,b,s);const w={triggerKind:e1.Automatic},A=await this.getPasteEdits(y,i,g,t,w,b);if(p.add(A),b.isCancellationRequested)return;if(A.edits.length===1&&A.edits[0].provider instanceof Ru)return this.applyDefaultPasteHandler(i,n,b,s);if(A.edits.length){const I=f.getOption(85).showPasteSelector==="afterPaste";return this._postPasteWidgetManager.applyEditAndShowIfNeeded(t,{activeEditIndex:0,allEdits:A.edits},I,(T,R)=>new Promise((P,V)=>{(async()=>{var j,J;try{const ae=(J=(j=T.provider).resolveDocumentPasteEdit)==null?void 0:J.call(j,T,R),fe=new z_,X=ae&&await this._pasteProgressManager.showWhile(t[0].getEndPosition(),S("resolveProcess","Resolving paste edit. Click to cancel"),Promise.race([fe.p,ae]),{cancel:()=>(fe.cancel(),V(new V_))},0);return X&&(T.additionalEdit=X.additionalEdit),P(T)}catch(ae){return V(ae)}})()}),b)}await this.applyDefaultPasteHandler(i,n,b,s)}finally{p.dispose(),this._currentPasteOperation===d&&(this._currentPasteOperation=void 0)}});this._pasteProgressManager.showWhile(t[0].getEndPosition(),S("pasteIntoEditorProgress","Running paste handlers. Click to cancel and do basic paste"),d,{cancel:async()=>{try{if(d.cancel(),a.token.isCancellationRequested)return;await this.applyDefaultPasteHandler(i,n,a.token,s)}finally{a.dispose()}}}).then(()=>{a.dispose()}),this._currentPasteOperation=d}showPasteAsPick(e,t,i,n,s){const r=qs(async a=>{const d=this._editor;if(!d.hasModel())return;const u=d.getModel(),f=new Tt,g=f.add(new L0(d,3,void 0,a));try{if(await this.mergeInDataFromCopy(n,s,g.token),g.token.isCancellationRequested)return;let p=t.filter(A=>this.isSupportedPasteProvider(A,n,e));e&&(p=p.filter(A=>this.providerMatchesPreference(A,e)));const C={triggerKind:e1.PasteAs,only:e&&e instanceof ns?e:void 0};let b=f.add(await this.getPasteEdits(p,n,u,i,C,g.token));if(g.token.isCancellationRequested)return;if(e&&(b={edits:b.edits.filter(A=>e instanceof ns?e.contains(A.kind):e.providerId===A.provider.id),dispose:b.dispose}),!b.edits.length){C.only&&this.showPasteAsNoEditMessage(i,C.only);return}let y;if(e)y=b.edits.at(0);else{const A=await this._quickInputService.pick(b.edits.map(I=>{var T;return{label:I.title,description:(T=I.kind)==null?void 0:T.value,edit:I}}),{placeHolder:S("pasteAsPickerPlaceholder","Select Paste Action")});y=A==null?void 0:A.edit}if(!y)return;const w=Q6(u.uri,i,y);await this._bulkEditService.apply(w,{editor:this._editor})}finally{f.dispose(),this._currentPasteOperation===r&&(this._currentPasteOperation=void 0)}});this._progressService.withProgress({location:10,title:S("pasteAsProgress","Running paste handlers")},()=>r)}setCopyMetadata(e,t){e.setData(gC,JSON.stringify(t))}fetchCopyMetadata(e){if(!e.clipboardData)return;const t=e.clipboardData.getData(gC);if(t)try{return JSON.parse(t)}catch{return}const[i,n]=s3.getTextData(e.clipboardData);if(n)return{defaultPastePayload:{mode:n.mode,multicursorText:n.multicursorText??null,pasteOnNewLine:!!n.isFromEmptySelection}}}async mergeInDataFromCopy(e,t,i){var n;if(t!=null&&t.id&&((n=gd._currentCopyOperation)==null?void 0:n.handle)===t.id){const s=await gd._currentCopyOperation.dataTransferPromise;if(i.isCancellationRequested)return;for(const[r,a]of s)e.replace(r,a)}if(!e.has(Zs.uriList)){const s=await this._clipboardService.readResources();if(i.isCancellationRequested)return;s.length&&e.append(Zs.uriList,m9(gb.create(s)))}}async getPasteEdits(e,t,i,n,s,r){const a=new Tt,d=await Sp(Promise.all(e.map(async f=>{var g,p;try{const C=await((g=f.provideDocumentPasteEdits)==null?void 0:g.call(f,i,n,t,s,r));return C&&a.add(C),(p=C==null?void 0:C.edits)==null?void 0:p.map(b=>({...b,provider:f}))}catch(C){qc(C)||console.error(C);return}})),r),u=yl(d??[]).flat().filter(f=>!s.only||s.only.contains(f.kind));return{edits:J6(u),dispose:()=>a.dispose()}}async applyDefaultPasteHandler(e,t,i,n){const s=e.get(Zs.text)??e.get("text"),r=await(s==null?void 0:s.asString())??"";if(i.isCancellationRequested)return;const a={clipboardEvent:n,text:r,pasteOnNewLine:(t==null?void 0:t.defaultPastePayload.pasteOnNewLine)??!1,multicursorText:(t==null?void 0:t.defaultPastePayload.multicursorText)??null,mode:null};this._editor.trigger("keyboard","paste",a)}isSupportedPasteProvider(e,t,i){var n;return(n=e.pasteMimeTypes)!=null&&n.some(s=>t.matches(s))?!i||this.providerMatchesPreference(e,i):!1}providerMatchesPreference(e,t){return t instanceof ns?e.providedPasteEditKinds?e.providedPasteEditKinds.some(i=>t.contains(i)):!0:e.id===t.providerId}},gd=$d,$d.ID="editor.contrib.copyPasteActionController",$d);Bl=gd=gT([bh(1,sn),bh(2,H_),bh(3,lf),bh(4,Fi),bh(5,Tl),bh(6,o3)],Bl);const Ou="9_cutcopypaste",pT=cf||document.queryCommandSupported("cut"),i5=cf||document.queryCommandSupported("copy"),xT=typeof navigator.clipboard>"u"||r3?document.queryCommandSupported("paste"):!0;function E9(o){return o.register(),o}const mT=pT?E9(new Bw({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:cf?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:ni.MenubarEditMenu,group:"2_ccp",title:S({key:"miCut",comment:["&& denotes a mnemonic"]},"Cu&&t"),order:1},{menuId:ni.EditorContext,group:Ou,title:S("actions.clipboard.cutLabel","Cut"),when:q.writable,order:1},{menuId:ni.CommandPalette,group:"",title:S("actions.clipboard.cutLabel","Cut"),order:1},{menuId:ni.SimpleEditorContext,group:Ou,title:S("actions.clipboard.cutLabel","Cut"),when:q.writable,order:1}]})):void 0,vT=i5?E9(new Bw({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:cf?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:ni.MenubarEditMenu,group:"2_ccp",title:S({key:"miCopy",comment:["&& denotes a mnemonic"]},"&&Copy"),order:2},{menuId:ni.EditorContext,group:Ou,title:S("actions.clipboard.copyLabel","Copy"),order:2},{menuId:ni.CommandPalette,group:"",title:S("actions.clipboard.copyLabel","Copy"),order:1},{menuId:ni.SimpleEditorContext,group:Ou,title:S("actions.clipboard.copyLabel","Copy"),order:2}]})):void 0;Rr.appendMenuItem(ni.MenubarEditMenu,{submenu:ni.MenubarCopy,title:Ai("copy as","Copy As"),group:"2_ccp",order:3});Rr.appendMenuItem(ni.EditorContext,{submenu:ni.EditorContextCopy,title:Ai("copy as","Copy As"),group:Ou,order:3});Rr.appendMenuItem(ni.EditorContext,{submenu:ni.EditorContextShare,title:Ai("share","Share"),group:"11_share",order:-1,when:qe.and(qe.notEquals("resourceScheme","output"),q.editorTextFocus)});Rr.appendMenuItem(ni.ExplorerContext,{submenu:ni.ExplorerContextShare,title:Ai("share","Share"),group:"11_share",order:-1});const pC=xT?E9(new Bw({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:cf?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:ni.MenubarEditMenu,group:"2_ccp",title:S({key:"miPaste",comment:["&& denotes a mnemonic"]},"&&Paste"),order:4},{menuId:ni.EditorContext,group:Ou,title:S("actions.clipboard.pasteLabel","Paste"),when:q.writable,order:4},{menuId:ni.CommandPalette,group:"",title:S("actions.clipboard.pasteLabel","Paste"),order:1},{menuId:ni.SimpleEditorContext,group:Ou,title:S("actions.clipboard.pasteLabel","Paste"),when:q.writable,order:4}]})):void 0;class _T extends Ct{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:S("actions.clipboard.copyWithSyntaxHighlightingLabel","Copy With Syntax Highlighting"),alias:"Copy With Syntax Highlighting",precondition:void 0,kbOpts:{kbExpr:q.textInputFocus,primary:0,weight:100}})}run(e,t){!t.hasModel()||!t.getOption(37)&&t.getSelection().isEmpty()||(FS.forceCopyWithSyntaxHighlighting=!0,t.focus(),t.getContainerDomNode().ownerDocument.execCommand("copy"),FS.forceCopyWithSyntaxHighlighting=!1)}}function n5(o,e){o&&(o.addImplementation(1e4,"code-editor",(t,i)=>{const n=t.get(Cs).getFocusedCodeEditor();if(n&&n.hasTextFocus()){const s=n.getOption(37),r=n.getSelection();return r&&r.isEmpty()&&!s||n.getContainerDomNode().ownerDocument.execCommand(e),!0}return!1}),o.addImplementation(0,"generic-dom",(t,i)=>(kw().execCommand(e),!0)))}n5(mT,"cut");n5(vT,"copy");pC&&(pC.addImplementation(1e4,"code-editor",(o,e)=>{var s;const t=o.get(Cs),i=o.get(lf),n=t.getFocusedCodeEditor();return n&&n.hasTextFocus()?n.getContainerDomNode().ownerDocument.execCommand("paste")?((s=Bl.get(n))==null?void 0:s.finishedPaste())??Promise.resolve():a3?(async()=>{const a=await i.readText();if(a!==""){const d=l3.INSTANCE.get(a);let u=!1,f=null,g=null;d&&(u=n.getOption(37)&&!!d.isFromEmptySelection,f=typeof d.multicursorText<"u"?d.multicursorText:null,g=d.mode),n.trigger("keyboard","paste",{text:a,pasteOnNewLine:u,multicursorText:f,mode:g})}})():!0:!1}),pC.addImplementation(0,"generic-dom",(o,e)=>(kw().execCommand("paste"),!0)));i5&&Le(_T);const Xn=new class{constructor(){this.QuickFix=new ns("quickfix"),this.Refactor=new ns("refactor"),this.RefactorExtract=this.Refactor.append("extract"),this.RefactorInline=this.Refactor.append("inline"),this.RefactorMove=this.Refactor.append("move"),this.RefactorRewrite=this.Refactor.append("rewrite"),this.Notebook=new ns("notebook"),this.Source=new ns("source"),this.SourceOrganizeImports=this.Source.append("organizeImports"),this.SourceFixAll=this.Source.append("fixAll"),this.SurroundWith=this.Refactor.append("surround")}};var Ho;(function(o){o.Refactor="refactor",o.RefactorPreview="refactor preview",o.Lightbulb="lightbulb",o.Default="other (default)",o.SourceAction="source action",o.QuickFix="quick fix action",o.FixAll="fix all",o.OrganizeImports="organize imports",o.AutoFix="auto fix",o.QuickFixHover="quick fix hover window",o.OnSave="save participants",o.ProblemsView="problems view"})(Ho||(Ho={}));function bT(o,e){return!(o.include&&!o.include.intersects(e)||o.excludes&&o.excludes.some(t=>s5(e,t,o.include))||!o.includeSourceActions&&Xn.Source.contains(e))}function CT(o,e){const t=e.kind?new ns(e.kind):void 0;return!(o.include&&(!t||!o.include.contains(t))||o.excludes&&t&&o.excludes.some(i=>s5(t,i,o.include))||!o.includeSourceActions&&t&&Xn.Source.contains(t)||o.onlyIncludePreferredActions&&!e.isPreferred)}function s5(o,e,t){return!(!e.contains(o)||t&&e.contains(t))}class Pa{static fromUser(e,t){return!e||typeof e!="object"?new Pa(t.kind,t.apply,!1):new Pa(Pa.getKindFromUser(e,t.kind),Pa.getApplyFromUser(e,t.apply),Pa.getPreferredUser(e))}static getApplyFromUser(e,t){switch(typeof e.apply=="string"?e.apply.toLowerCase():""){case"first":return"first";case"never":return"never";case"ifsingle":return"ifSingle";default:return t}}static getKindFromUser(e,t){return typeof e.kind=="string"?new ns(e.kind):t}static getPreferredUser(e){return typeof e.preferred=="boolean"?e.preferred:!1}constructor(e,t,i){this.kind=e,this.apply=t,this.preferred=i}}class ET{constructor(e,t,i){this.action=e,this.provider=t,this.highlightRange=i}async resolve(e){var t;if((t=this.provider)!=null&&t.resolveCodeAction&&!this.action.edit){let i;try{i=await this.provider.resolveCodeAction(this.action,e)}catch(n){bs(n)}i&&(this.action.edit=i.edit)}return this}}const o5="editor.action.codeAction",y9="editor.action.quickFix",r5="editor.action.autoFix",a5="editor.action.refactor",l5="editor.action.sourceAction",W1="editor.action.organizeImports",z1="editor.action.fixAll";class gg extends Rt{static codeActionsPreferredComparator(e,t){return e.isPreferred&&!t.isPreferred?-1:!e.isPreferred&&t.isPreferred?1:0}static codeActionsComparator({action:e},{action:t}){return e.isAI&&!t.isAI?1:!e.isAI&&t.isAI?-1:Yo(e.diagnostics)?Yo(t.diagnostics)?gg.codeActionsPreferredComparator(e,t):-1:Yo(t.diagnostics)?1:gg.codeActionsPreferredComparator(e,t)}constructor(e,t,i){super(),this.documentation=t,this._register(i),this.allActions=[...e].sort(gg.codeActionsComparator),this.validActions=this.allActions.filter(({action:n})=>!n.disabled)}get hasAutoFix(){return this.validActions.some(({action:e})=>!!e.kind&&Xn.QuickFix.contains(new ns(e.kind))&&!!e.isPreferred)}get hasAIFix(){return this.validActions.some(({action:e})=>!!e.isAI)}get allAIFixes(){return this.validActions.every(({action:e})=>!!e.isAI)}}const A8={actions:[],documentation:void 0};async function qh(o,e,t,i,n,s){var y;const r=i.filter||{},a={...r,excludes:[...r.excludes||[],Xn.Notebook]},d={only:(y=r.include)==null?void 0:y.value,trigger:i.type},u=new c3(e,s),f=i.type===2,g=yT(o,e,f?a:r),p=new Tt,C=g.map(async w=>{try{n.report(w);const A=await w.provideCodeActions(e,t,d,u.token);if(A&&p.add(A),u.token.isCancellationRequested)return A8;const I=((A==null?void 0:A.actions)||[]).filter(R=>R&&CT(r,R)),T=ST(w,I,r.include);return{actions:I.map(R=>new ET(R,w)),documentation:T}}catch(A){if(qc(A))throw A;return bs(A),A8}}),b=o.onDidChange(()=>{const w=o.all(e);ja(w,g)||u.cancel()});try{const w=await Promise.all(C),A=w.map(T=>T.actions).flat(),I=[...yl(w.map(T=>T.documentation)),...wT(o,e,i,A)];return new gg(A,I,p)}finally{b.dispose(),u.dispose()}}function yT(o,e,t){return o.all(e).filter(i=>i.providedCodeActionKinds?i.providedCodeActionKinds.some(n=>bT(t,new ns(n))):!0)}function*wT(o,e,t,i){var n,s,r;if(e&&i.length)for(const a of o.all(e))a._getAdditionalMenuItems&&(yield*(r=a._getAdditionalMenuItems)==null?void 0:r.call(a,{trigger:t.type,only:(s=(n=t.filter)==null?void 0:n.include)==null?void 0:s.value},i.map(d=>d.action)))}function ST(o,e,t){if(!o.documentation)return;const i=o.documentation.map(n=>({kind:new ns(n.kind),command:n.command}));if(t){let n;for(const s of i)s.kind.contains(t)&&(n?n.kind.contains(s.kind)&&(n=s):n=s);if(n)return n==null?void 0:n.command}for(const n of e)if(n.kind){for(const s of i)if(s.kind.contains(new ns(n.kind)))return s.command}}var Sd;(function(o){o.OnSave="onSave",o.FromProblemsView="fromProblemsView",o.FromCodeActions="fromCodeActions",o.FromAILightbulb="fromAILightbulb"})(Sd||(Sd={}));async function DT(o,e,t,i,n=an.None){var u;const s=o.get(H_),r=o.get(Vs),a=o.get(ua),d=o.get(mo);if(a.publicLog2("codeAction.applyCodeAction",{codeActionTitle:e.action.title,codeActionKind:e.action.kind,codeActionIsPreferred:!!e.action.isPreferred,reason:t}),await e.resolve(n),!n.isCancellationRequested&&!((u=e.action.edit)!=null&&u.edits.length&&!(await s.apply(e.action.edit,{editor:i==null?void 0:i.editor,label:e.action.title,quotableLabel:e.action.title,code:"undoredo.codeAction",respectAutoSaveConfig:t!==Sd.OnSave,showPreview:i==null?void 0:i.preview})).isApplied)&&e.action.command)try{await r.executeCommand(e.action.command.id,...e.action.command.arguments||[])}catch(f){const g=AT(f);d.error(typeof g=="string"?g:S("applyCodeActionFailed","An unknown error occurred while applying the code action"))}}function AT(o){return typeof o=="string"?o:o instanceof Error&&typeof o.message=="string"?o.message:void 0}Qn.registerCommand("_executeCodeActionProvider",async function(o,e,t,i,n){if(!(e instanceof jn))throw vl();const{codeActionProvider:s}=o.get(Fi),r=o.get(vo).getModel(e);if(!r)throw vl();const a=$i.isISelection(t)?$i.liftSelection(t):Q.isIRange(t)?r.validateRange(t):void 0;if(!a)throw vl();const d=typeof i=="string"?new ns(i):void 0,u=await qh(s,r,a,{type:1,triggerAction:Ho.Default,filter:{includeSourceActions:!0,include:d}},fl.None,an.None),f=[],g=Math.min(u.validActions.length,typeof n=="number"?n:0);for(let p=0;p<g;p++)f.push(u.validActions[p].resolve(an.None));try{return await Promise.all(f),u.validActions.map(p=>p.action)}finally{setTimeout(()=>u.dispose(),100)}});var kT=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},BT=function(o,e){return function(t,i){e(t,i,o)}},V1,Ud;let j1=(Ud=class{constructor(e){this.keybindingService=e}getResolver(){const e=new Fw(()=>this.keybindingService.getKeybindings().filter(t=>V1.codeActionCommands.indexOf(t.command)>=0).filter(t=>t.resolvedKeybinding).map(t=>{let i=t.commandArgs;return t.command===W1?i={kind:Xn.SourceOrganizeImports.value}:t.command===z1&&(i={kind:Xn.SourceFixAll.value}),{resolvedKeybinding:t.resolvedKeybinding,...Pa.fromUser(i,{kind:ns.None,apply:"never"})}}));return t=>{if(t.kind){const i=this.bestKeybindingForCodeAction(t,e.value);return i==null?void 0:i.resolvedKeybinding}}}bestKeybindingForCodeAction(e,t){if(!e.kind)return;const i=new ns(e.kind);return t.filter(n=>n.kind.contains(i)).filter(n=>n.preferred?e.isPreferred:!0).reduceRight((n,s)=>n?n.kind.contains(s.kind)?s:n:s,void 0)}},V1=Ud,Ud.codeActionCommands=[a5,o5,l5,W1,z1],Ud);j1=V1=kT([BT(0,As)],j1);vi("symbolIcon.arrayForeground",Rs,S("symbolIcon.arrayForeground","The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.booleanForeground",Rs,S("symbolIcon.booleanForeground","The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},S("symbolIcon.classForeground","The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.colorForeground",Rs,S("symbolIcon.colorForeground","The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.constantForeground",Rs,S("symbolIcon.constantForeground","The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},S("symbolIcon.constructorForeground","The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},S("symbolIcon.enumeratorForeground","The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},S("symbolIcon.enumeratorMemberForeground","The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},S("symbolIcon.eventForeground","The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},S("symbolIcon.fieldForeground","The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.fileForeground",Rs,S("symbolIcon.fileForeground","The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.folderForeground",Rs,S("symbolIcon.folderForeground","The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},S("symbolIcon.functionForeground","The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},S("symbolIcon.interfaceForeground","The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.keyForeground",Rs,S("symbolIcon.keyForeground","The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.keywordForeground",Rs,S("symbolIcon.keywordForeground","The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},S("symbolIcon.methodForeground","The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.moduleForeground",Rs,S("symbolIcon.moduleForeground","The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.namespaceForeground",Rs,S("symbolIcon.namespaceForeground","The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.nullForeground",Rs,S("symbolIcon.nullForeground","The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.numberForeground",Rs,S("symbolIcon.numberForeground","The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.objectForeground",Rs,S("symbolIcon.objectForeground","The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.operatorForeground",Rs,S("symbolIcon.operatorForeground","The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.packageForeground",Rs,S("symbolIcon.packageForeground","The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.propertyForeground",Rs,S("symbolIcon.propertyForeground","The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.referenceForeground",Rs,S("symbolIcon.referenceForeground","The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.snippetForeground",Rs,S("symbolIcon.snippetForeground","The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.stringForeground",Rs,S("symbolIcon.stringForeground","The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.structForeground",Rs,S("symbolIcon.structForeground","The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.textForeground",Rs,S("symbolIcon.textForeground","The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.typeParameterForeground",Rs,S("symbolIcon.typeParameterForeground","The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.unitForeground",Rs,S("symbolIcon.unitForeground","The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));vi("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},S("symbolIcon.variableForeground","The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));const c5=Object.freeze({kind:ns.Empty,title:S("codeAction.widget.id.more","More Actions...")}),FT=Object.freeze([{kind:Xn.QuickFix,title:S("codeAction.widget.id.quickfix","Quick Fix")},{kind:Xn.RefactorExtract,title:S("codeAction.widget.id.extract","Extract"),icon:Ki.wrench},{kind:Xn.RefactorInline,title:S("codeAction.widget.id.inline","Inline"),icon:Ki.wrench},{kind:Xn.RefactorRewrite,title:S("codeAction.widget.id.convert","Rewrite"),icon:Ki.wrench},{kind:Xn.RefactorMove,title:S("codeAction.widget.id.move","Move"),icon:Ki.wrench},{kind:Xn.SurroundWith,title:S("codeAction.widget.id.surround","Surround With"),icon:Ki.surroundWith},{kind:Xn.Source,title:S("codeAction.widget.id.source","Source Action"),icon:Ki.symbolFile},c5]);function LT(o,e,t){if(!e)return o.map(s=>{var r;return{kind:"action",item:s,group:c5,disabled:!!s.action.disabled,label:s.action.disabled||s.action.title,canPreview:!!((r=s.action.edit)!=null&&r.edits.length)}});const i=FT.map(s=>({group:s,actions:[]}));for(const s of o){const r=s.action.kind?new ns(s.action.kind):ns.None;for(const a of i)if(a.group.kind.contains(r)){a.actions.push(s);break}}const n=[];for(const s of i)if(s.actions.length){n.push({kind:"header",group:s.group});for(const r of s.actions){const a=s.group;n.push({kind:"action",item:r,group:r.action.isAI?{title:a.title,kind:a.kind,icon:Ki.sparkle}:a,label:r.action.title,disabled:!!r.action.disabled,keybinding:t(r.action)})}}return n}var IT=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},PT=function(o,e){return function(t,i){e(t,i,o)}},Rh;const k8=ms("gutter-lightbulb",Ki.lightBulb,S("gutterLightbulbWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor.")),B8=ms("gutter-lightbulb-auto-fix",Ki.lightbulbAutofix,S("gutterLightbulbAutoFixWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor and a quick fix is available.")),F8=ms("gutter-lightbulb-sparkle",Ki.lightbulbSparkle,S("gutterLightbulbAIFixWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix is available.")),L8=ms("gutter-lightbulb-aifix-auto-fix",Ki.lightbulbSparkleAutofix,S("gutterLightbulbAIFixAutoFixWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix and a quick fix is available.")),I8=ms("gutter-lightbulb-sparkle-filled",Ki.sparkleFilled,S("gutterLightbulbSparkleFilledWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix and a quick fix is available."));var Gr;(function(o){o.Hidden={type:0};class e{constructor(i,n,s,r){this.actions=i,this.trigger=n,this.editorPosition=s,this.widgetPosition=r,this.type=1}}o.Showing=e})(Gr||(Gr={}));var pl;let $g=(pl=class extends Rt{constructor(e,t){super(),this._editor=e,this._keybindingService=t,this._onClick=this._register(new rn),this.onClick=this._onClick.event,this._state=Gr.Hidden,this._gutterState=Gr.Hidden,this._iconClasses=[],this.lightbulbClasses=["codicon-"+k8.id,"codicon-"+L8.id,"codicon-"+B8.id,"codicon-"+F8.id,"codicon-"+I8.id],this.gutterDecoration=Rh.GUTTER_DECORATION,this._domNode=mi("div.lightBulbWidget"),this._domNode.role="listbox",this._register(dA.ignoreTarget(this._domNode)),this._editor.addContentWidget(this),this._register(this._editor.onDidChangeModelContent(i=>{const n=this._editor.getModel();(this.state.type!==1||!n||this.state.editorPosition.lineNumber>=n.getLineCount())&&this.hide(),(this.gutterState.type!==1||!n||this.gutterState.editorPosition.lineNumber>=n.getLineCount())&&this.gutterHide()})),this._register(d3(this._domNode,i=>{if(this.state.type!==1)return;this._editor.focus(),i.preventDefault();const{top:n,height:s}=yo(this._domNode),r=this._editor.getOption(67);let a=Math.floor(r/3);this.state.widgetPosition.position!==null&&this.state.widgetPosition.position.lineNumber<this.state.editorPosition.lineNumber&&(a+=r),this._onClick.fire({x:i.posx,y:n+s+a,actions:this.state.actions,trigger:this.state.trigger})})),this._register(Bn(this._domNode,"mouseenter",i=>{(i.buttons&1)===1&&this.hide()})),this._register(Ts.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{var i,n;this._preferredKbLabel=((i=this._keybindingService.lookupKeybinding(r5))==null?void 0:i.getLabel())??void 0,this._quickFixKbLabel=((n=this._keybindingService.lookupKeybinding(y9))==null?void 0:n.getLabel())??void 0,this._updateLightBulbTitleAndIcon()})),this._register(this._editor.onMouseDown(async i=>{if(!i.target.element||!this.lightbulbClasses.some(d=>i.target.element&&i.target.element.classList.contains(d))||this.gutterState.type!==1)return;this._editor.focus();const{top:n,height:s}=yo(i.target.element),r=this._editor.getOption(67);let a=Math.floor(r/3);this.gutterState.widgetPosition.position!==null&&this.gutterState.widgetPosition.position.lineNumber<this.gutterState.editorPosition.lineNumber&&(a+=r),this._onClick.fire({x:i.event.posx,y:n+s+a,actions:this.gutterState.actions,trigger:this.gutterState.trigger})}))}dispose(){super.dispose(),this._editor.removeContentWidget(this),this._gutterDecorationID&&this._removeGutterDecoration(this._gutterDecorationID)}getId(){return"LightBulbWidget"}getDomNode(){return this._domNode}getPosition(){return this._state.type===1?this._state.widgetPosition:null}update(e,t,i){if(e.validActions.length<=0)return this.gutterHide(),this.hide();if(!this._editor.hasTextFocus())return this.gutterHide(),this.hide();if(!this._editor.getOptions().get(65).enabled)return this.gutterHide(),this.hide();const r=this._editor.getModel();if(!r)return this.gutterHide(),this.hide();const{lineNumber:a,column:d}=r.validatePosition(i),u=r.getOptions().tabSize,f=this._editor.getOptions().get(50),g=r.getLineContent(a),p=Lw(g,u),C=f.spaceWidth*p>22,b=P=>P>2&&this._editor.getTopForLineNumber(P)===this._editor.getTopForLineNumber(P-1),y=this._editor.getLineDecorations(a);let w=!1;if(y)for(const P of y){const V=P.options.glyphMarginClassName;if(V&&!this.lightbulbClasses.some(j=>V.includes(j))){w=!0;break}}let A=a,I=1;if(!C){const P=V=>{const j=r.getLineContent(V);return/^\s*$|^\s+/.test(j)||j.length<=I};if(a>1&&!b(a-1)){const V=r.getLineCount(),j=a===V,J=a>1&&P(a-1),ae=!j&&P(a+1),fe=P(a),X=!ae&&!J;if(!ae&&!J&&!w)return this.gutterState=new Gr.Showing(e,t,i,{position:{lineNumber:A,column:I},preference:Rh._posPref}),this.renderGutterLightbub(),this.hide();J||j||J&&!fe?A-=1:(ae||X&&fe)&&(A+=1)}else if(a===1&&(a===r.getLineCount()||!P(a+1)&&!P(a)))if(this.gutterState=new Gr.Showing(e,t,i,{position:{lineNumber:A,column:I},preference:Rh._posPref}),w)this.gutterHide();else return this.renderGutterLightbub(),this.hide();else if(a<r.getLineCount()&&!b(a+1))A+=1;else if(d*f.spaceWidth<22)return this.hide();I=/^\S\s*$/.test(r.getLineContent(A))?2:1}this.state=new Gr.Showing(e,t,i,{position:{lineNumber:A,column:I},preference:Rh._posPref}),this._gutterDecorationID&&(this._removeGutterDecoration(this._gutterDecorationID),this.gutterHide());const T=e.validActions,R=e.validActions[0].action.kind;if(T.length!==1||!R){this._editor.layoutContentWidget(this);return}this._editor.layoutContentWidget(this)}hide(){this.state!==Gr.Hidden&&(this.state=Gr.Hidden,this._editor.layoutContentWidget(this))}gutterHide(){this.gutterState!==Gr.Hidden&&(this._gutterDecorationID&&this._removeGutterDecoration(this._gutterDecorationID),this.gutterState=Gr.Hidden)}get state(){return this._state}set state(e){this._state=e,this._updateLightBulbTitleAndIcon()}get gutterState(){return this._gutterState}set gutterState(e){this._gutterState=e,this._updateGutterLightBulbTitleAndIcon()}_updateLightBulbTitleAndIcon(){if(this._domNode.classList.remove(...this._iconClasses),this._iconClasses=[],this.state.type!==1)return;let e,t=!1;this.state.actions.allAIFixes?(e=Ki.sparkleFilled,this.state.actions.validActions.length===1&&(t=!0)):this.state.actions.hasAutoFix?this.state.actions.hasAIFix?e=Ki.lightbulbSparkleAutofix:e=Ki.lightbulbAutofix:this.state.actions.hasAIFix?e=Ki.lightbulbSparkle:e=Ki.lightBulb,this._updateLightbulbTitle(this.state.actions.hasAutoFix,t),this._iconClasses=Rn.asClassNameArray(e),this._domNode.classList.add(...this._iconClasses)}_updateGutterLightBulbTitleAndIcon(){if(this.gutterState.type!==1)return;let e,t=!1;this.gutterState.actions.allAIFixes?(e=I8,this.gutterState.actions.validActions.length===1&&(t=!0)):this.gutterState.actions.hasAutoFix?this.gutterState.actions.hasAIFix?e=L8:e=B8:this.gutterState.actions.hasAIFix?e=F8:e=k8,this._updateLightbulbTitle(this.gutterState.actions.hasAutoFix,t);const i=vn.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:Rn.asClassName(e),glyphMargin:{position:ym.Left},stickiness:1});this.gutterDecoration=i}renderGutterLightbub(){const e=this._editor.getSelection();e&&(this._gutterDecorationID===void 0?this._addGutterDecoration(e.startLineNumber):this._updateGutterDecoration(this._gutterDecorationID,e.startLineNumber))}_addGutterDecoration(e){this._editor.changeDecorations(t=>{this._gutterDecorationID=t.addDecoration(new Q(e,0,e,0),this.gutterDecoration)})}_removeGutterDecoration(e){this._editor.changeDecorations(t=>{t.removeDecoration(e),this._gutterDecorationID=void 0})}_updateGutterDecoration(e,t){this._editor.changeDecorations(i=>{i.changeDecoration(e,new Q(t,0,t,0)),i.changeDecorationOptions(e,this.gutterDecoration)})}_updateLightbulbTitle(e,t){this.state.type===1&&(t?this.title=S("codeActionAutoRun","Run: {0}",this.state.actions.validActions[0].action.title):e&&this._preferredKbLabel?this.title=S("preferredcodeActionWithKb","Show Code Actions. Preferred Quick Fix Available ({0})",this._preferredKbLabel):!e&&this._quickFixKbLabel?this.title=S("codeActionWithKb","Show Code Actions ({0})",this._quickFixKbLabel):e||(this.title=S("codeAction","Show Code Actions")))}set title(e){this._domNode.title=e}},Rh=pl,pl.GUTTER_DECORATION=vn.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:Rn.asClassName(Ki.lightBulb),glyphMargin:{position:ym.Left},stickiness:1}),pl.ID="editor.contrib.lightbulbWidget",pl._posPref=[0],pl);$g=Rh=IT([PT(1,As)],$g);var d5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},$1=function(o,e){return function(t,i){e(t,i,o)}};const u5="acceptSelectedCodeAction",h5="previewSelectedCodeAction";class TT{get templateId(){return"header"}renderTemplate(e){e.classList.add("group-header");const t=document.createElement("span");return e.append(t),{container:e,text:t}}renderElement(e,t,i){var n;i.text.textContent=((n=e.group)==null?void 0:n.title)??""}disposeTemplate(e){}}let U1=class{get templateId(){return"action"}constructor(e,t){this._supportsPreview=e,this._keybindingService=t}renderTemplate(e){e.classList.add(this.templateId);const t=document.createElement("div");t.className="icon",e.append(t);const i=document.createElement("span");i.className="title",e.append(i);const n=new Iw(e,Pw);return{container:e,icon:t,text:i,keybinding:n}}renderElement(e,t,i){var r,a,d;if((r=e.group)!=null&&r.icon?(i.icon.className=Rn.asClassName(e.group.icon),e.group.icon.color&&(i.icon.style.color=Ld(e.group.icon.color.id))):(i.icon.className=Rn.asClassName(Ki.lightBulb),i.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!e.item||!e.label)return;i.text.textContent=f5(e.label),i.keybinding.set(e.keybinding),u3(!!e.keybinding,i.keybinding.element);const n=(a=this._keybindingService.lookupKeybinding(u5))==null?void 0:a.getLabel(),s=(d=this._keybindingService.lookupKeybinding(h5))==null?void 0:d.getLabel();i.container.classList.toggle("option-disabled",e.disabled),e.disabled?i.container.title=e.label:n&&s?this._supportsPreview&&e.canPreview?i.container.title=S({key:"label-preview",comment:['placeholders are keybindings, e.g "F2 to Apply, Shift+F2 to Preview"']},"{0} to Apply, {1} to Preview",n,s):i.container.title=S({key:"label",comment:['placeholder is a keybinding, e.g "F2 to Apply"']},"{0} to Apply",n):i.container.title=""}disposeTemplate(e){e.keybinding.dispose()}};U1=d5([$1(1,As)],U1);class MT extends UIEvent{constructor(){super("acceptSelectedAction")}}class P8 extends UIEvent{constructor(){super("previewSelectedAction")}}function RT(o){if(o.kind==="action")return o.label}let q1=class extends Rt{constructor(e,t,i,n,s,r){super(),this._delegate=n,this._contextViewService=s,this._keybindingService=r,this._actionLineHeight=24,this._headerLineHeight=26,this.cts=this._register(new Gs),this.domNode=document.createElement("div"),this.domNode.classList.add("actionList");const a={getHeight:d=>d.kind==="header"?this._headerLineHeight:this._actionLineHeight,getTemplateId:d=>d.kind};this._list=this._register(new Tw(e,this.domNode,a,[new U1(t,this._keybindingService),new TT],{keyboardSupport:!1,typeNavigationEnabled:!0,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:RT},accessibilityProvider:{getAriaLabel:d=>{if(d.kind==="action"){let u=d.label?f5(d==null?void 0:d.label):"";return d.disabled&&(u=S({key:"customQuickFixWidget.labels",comment:["Action widget labels for accessibility."]},"{0}, Disabled Reason: {1}",u,d.disabled)),u}return null},getWidgetAriaLabel:()=>S({key:"customQuickFixWidget",comment:["An action widget option"]},"Action Widget"),getRole:d=>d.kind==="action"?"option":"separator",getWidgetRole:()=>"listbox"}})),this._list.style(h3),this._register(this._list.onMouseClick(d=>this.onListClick(d))),this._register(this._list.onMouseOver(d=>this.onListHover(d))),this._register(this._list.onDidChangeFocus(()=>this.onFocus())),this._register(this._list.onDidChangeSelection(d=>this.onListSelection(d))),this._allMenuItems=i,this._list.splice(0,this._list.length,this._allMenuItems),this._list.length&&this.focusNext()}focusCondition(e){return!e.disabled&&e.kind==="action"}hide(e){this._delegate.onHide(e),this.cts.cancel(),this._contextViewService.hideContextView()}layout(e){const t=this._allMenuItems.filter(d=>d.kind==="header").length,n=this._allMenuItems.length*this._actionLineHeight+t*this._headerLineHeight-t*this._actionLineHeight;this._list.layout(n);let s=e;if(this._allMenuItems.length>=50)s=380;else{const d=this._allMenuItems.map((u,f)=>{const g=this.domNode.ownerDocument.getElementById(this._list.getElementID(f));if(g){g.style.width="auto";const p=g.getBoundingClientRect().width;return g.style.width="",p}return 0});s=Math.max(...d,e)}const a=Math.min(n,this.domNode.ownerDocument.body.clientHeight*.7);return this._list.layout(a,s),this.domNode.style.height=`${a}px`,this._list.domFocus(),s}focusPrevious(){this._list.focusPrevious(1,!0,void 0,this.focusCondition)}focusNext(){this._list.focusNext(1,!0,void 0,this.focusCondition)}acceptSelected(e){const t=this._list.getFocus();if(t.length===0)return;const i=t[0],n=this._list.element(i);if(!this.focusCondition(n))return;const s=e?new P8:new MT;this._list.setSelection([i],s)}onListSelection(e){if(!e.elements.length)return;const t=e.elements[0];t.item&&this.focusCondition(t)?this._delegate.onSelect(t.item,e.browserEvent instanceof P8):this._list.setSelection([])}onFocus(){var n,s;const e=this._list.getFocus();if(e.length===0)return;const t=e[0],i=this._list.element(t);(s=(n=this._delegate).onFocus)==null||s.call(n,i.item)}async onListHover(e){const t=e.element;if(t&&t.item&&this.focusCondition(t)){if(this._delegate.onHover&&!t.disabled&&t.kind==="action"){const i=await this._delegate.onHover(t.item,this.cts.token);t.canPreview=i?i.canPreview:void 0}e.index&&this._list.splice(e.index,1,[t])}this._list.setFocus(typeof e.index=="number"?[e.index]:[])}onListClick(e){e.element&&this.focusCondition(e.element)&&this._list.setFocus([])}};q1=d5([$1(4,j_),$1(5,As)],q1);function f5(o){return o.replace(/\r\n|\r|\n/g," ")}var NT=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},xC=function(o,e){return function(t,i){e(t,i,o)}};vi("actionBar.toggledBackground",Mw,S("actionBar.toggledBackground","Background color for toggled action items in action bar."));const Hu={Visible:new En("codeActionMenuVisible",!1,S("codeActionMenuVisible","Whether the action widget list is visible"))},Ju=Ml("actionWidgetService");let Wu=class extends Rt{get isVisible(){return Hu.Visible.getValue(this._contextKeyService)||!1}constructor(e,t,i){super(),this._contextViewService=e,this._contextKeyService=t,this._instantiationService=i,this._list=this._register(new er)}show(e,t,i,n,s,r,a){const d=Hu.Visible.bindTo(this._contextKeyService),u=this._instantiationService.createInstance(q1,e,t,i,n);this._contextViewService.showContextView({getAnchor:()=>s,render:f=>(d.set(!0),this._renderWidget(f,u,a??[])),onHide:f=>{d.reset(),this._onWidgetClosed(f)}},r,!1)}acceptSelected(e){var t;(t=this._list.value)==null||t.acceptSelected(e)}focusPrevious(){var e,t;(t=(e=this._list)==null?void 0:e.value)==null||t.focusPrevious()}focusNext(){var e,t;(t=(e=this._list)==null?void 0:e.value)==null||t.focusNext()}hide(e){var t;(t=this._list.value)==null||t.hide(e),this._list.clear()}_renderWidget(e,t,i){var C;const n=document.createElement("div");if(n.classList.add("action-widget"),e.appendChild(n),this._list.value=t,this._list.value)n.appendChild(this._list.value.domNode);else throw new Error("List has no value");const s=new Tt,r=document.createElement("div"),a=e.appendChild(r);a.classList.add("context-view-block"),s.add(Bn(a,as.MOUSE_DOWN,b=>b.stopPropagation()));const d=document.createElement("div"),u=e.appendChild(d);u.classList.add("context-view-pointerBlock"),s.add(Bn(u,as.POINTER_MOVE,()=>u.remove())),s.add(Bn(u,as.MOUSE_DOWN,()=>u.remove()));let f=0;if(i.length){const b=this._createActionBar(".action-widget-action-bar",i);b&&(n.appendChild(b.getContainer().parentElement),s.add(b),f=b.getContainer().offsetWidth)}const g=(C=this._list.value)==null?void 0:C.layout(f);n.style.width=`${g}px`;const p=s.add(I0(e));return s.add(p.onDidBlur(()=>this.hide(!0))),s}_createActionBar(e,t){if(!t.length)return;const i=mi(e),n=new Bg(i);return n.push(t,{icon:!1,label:!0}),n}_onWidgetClosed(e){var t;(t=this._list.value)==null||t.hide(e)}};Wu=NT([xC(0,j_),xC(1,Fn),xC(2,sn)],Wu);Rl(Ju,Wu,1);const qp=1100;Vn(class extends Do{constructor(){super({id:"hideCodeActionWidget",title:Ai("hideCodeActionWidget.title","Hide action widget"),precondition:Hu.Visible,keybinding:{weight:qp,primary:9,secondary:[1033]}})}run(o){o.get(Ju).hide(!0)}});Vn(class extends Do{constructor(){super({id:"selectPrevCodeAction",title:Ai("selectPrevCodeAction.title","Select previous action"),precondition:Hu.Visible,keybinding:{weight:qp,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(o){const e=o.get(Ju);e instanceof Wu&&e.focusPrevious()}});Vn(class extends Do{constructor(){super({id:"selectNextCodeAction",title:Ai("selectNextCodeAction.title","Select next action"),precondition:Hu.Visible,keybinding:{weight:qp,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(o){const e=o.get(Ju);e instanceof Wu&&e.focusNext()}});Vn(class extends Do{constructor(){super({id:u5,title:Ai("acceptSelected.title","Accept selected action"),precondition:Hu.Visible,keybinding:{weight:qp,primary:3,secondary:[2137]}})}run(o){const e=o.get(Ju);e instanceof Wu&&e.acceptSelected()}});Vn(class extends Do{constructor(){super({id:h5,title:Ai("previewSelected.title","Preview selected action"),precondition:Hu.Visible,keybinding:{weight:qp,primary:2051}})}run(o){const e=o.get(Ju);e instanceof Wu&&e.acceptSelected(!0)}});const g5=new En("supportedCodeAction",""),T8="_typescript.applyFixAllCodeAction";class OT extends Rt{constructor(e,t,i,n=250){super(),this._editor=e,this._markerService=t,this._signalChange=i,this._delay=n,this._autoTriggerTimer=this._register(new Dp),this._register(this._markerService.onMarkerChanged(s=>this._onMarkerChanges(s))),this._register(this._editor.onDidChangeCursorPosition(()=>this._tryAutoTrigger()))}trigger(e){const t=this._getRangeOfSelectionUnlessWhitespaceEnclosed(e);this._signalChange(t?{trigger:e,selection:t}:void 0)}_onMarkerChanges(e){const t=this._editor.getModel();t&&e.some(i=>wm(i,t.uri))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet(()=>{this.trigger({type:2,triggerAction:Ho.Default})},this._delay)}_getRangeOfSelectionUnlessWhitespaceEnclosed(e){if(!this._editor.hasModel())return;const t=this._editor.getSelection();if(e.type===1)return t;const i=this._editor.getOption(65).enabled;if(i!==Jb.Off){{if(i===Jb.On)return t;if(i===Jb.OnCode){if(!t.isEmpty())return t;const s=this._editor.getModel(),{lineNumber:r,column:a}=t.getPosition(),d=s.getLineContent(r);if(d.length===0)return;if(a===1){if(/\s/.test(d[0]))return}else if(a===s.getLineMaxColumn(r)){if(/\s/.test(d[d.length-1]))return}else if(/\s/.test(d[a-2])&&/\s/.test(d[a-1]))return}}return t}}}var vd;(function(o){o.Empty={type:0};class e{constructor(i,n,s){this.trigger=i,this.position=n,this._cancellablePromise=s,this.type=1,this.actions=s.catch(r=>{if(qc(r))return p5;throw r})}cancel(){this._cancellablePromise.cancel()}}o.Triggered=e})(vd||(vd={}));const p5=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1});class HT extends Rt{constructor(e,t,i,n,s,r,a){super(),this._editor=e,this._registry=t,this._markerService=i,this._progressService=s,this._configurationService=r,this._telemetryService=a,this._codeActionOracle=this._register(new er),this._state=vd.Empty,this._onDidChangeState=this._register(new rn),this.onDidChangeState=this._onDidChangeState.event,this._disposed=!1,this._supportedCodeActions=g5.bindTo(n),this._register(this._editor.onDidChangeModel(()=>this._update())),this._register(this._editor.onDidChangeModelLanguage(()=>this._update())),this._register(this._registry.onDidChange(()=>this._update())),this._register(this._editor.onDidChangeConfiguration(d=>{d.hasChanged(65)&&this._update()})),this._update()}dispose(){this._disposed||(this._disposed=!0,super.dispose(),this.setState(vd.Empty,!0))}_settingEnabledNearbyQuickfixes(){var t;const e=(t=this._editor)==null?void 0:t.getModel();return this._configurationService?this._configurationService.getValue("editor.codeActionWidget.includeNearbyQuickFixes",{resource:e==null?void 0:e.uri}):!1}_update(){if(this._disposed)return;this._codeActionOracle.value=void 0,this.setState(vd.Empty);const e=this._editor.getModel();if(e&&this._registry.has(e)&&!this._editor.getOption(92)){const t=this._registry.all(e).flatMap(i=>i.providedCodeActionKinds??[]);this._supportedCodeActions.set(t.join(" ")),this._codeActionOracle.value=new OT(this._editor,this._markerService,i=>{var d;if(!i){this.setState(vd.Empty);return}const n=i.selection.getStartPosition(),s=qs(async u=>{var f,g,p,C,b,y,w,A,I,T;if(this._settingEnabledNearbyQuickfixes()&&i.trigger.type===1&&(i.trigger.triggerAction===Ho.QuickFix||(g=(f=i.trigger.filter)==null?void 0:f.include)!=null&&g.contains(Xn.QuickFix))){const R=await qh(this._registry,e,i.selection,i.trigger,fl.None,u),P=[...R.allActions];if(u.isCancellationRequested)return p5;const V=(p=R.validActions)==null?void 0:p.some(J=>J.action.kind?Xn.QuickFix.contains(new ns(J.action.kind)):!1),j=this._markerService.read({resource:e.uri});if(V){for(const J of R.validActions)(b=(C=J.action.command)==null?void 0:C.arguments)!=null&&b.some(ae=>typeof ae=="string"&&ae.includes(T8))&&(J.action.diagnostics=[...j.filter(ae=>ae.relatedInformation)]);return{validActions:R.validActions,allActions:P,documentation:R.documentation,hasAutoFix:R.hasAutoFix,hasAIFix:R.hasAIFix,allAIFixes:R.allAIFixes,dispose:()=>{R.dispose()}}}else if(!V&&j.length>0){const J=i.selection.getPosition();let ae=J,fe=Number.MAX_VALUE;const X=[...R.validActions];for(const me of j){const oe=me.endColumn,le=me.endLineNumber,Ae=me.startLineNumber;if(le===J.lineNumber||Ae===J.lineNumber){ae=new Bi(le,oe);const Te={type:i.trigger.type,triggerAction:i.trigger.triggerAction,filter:{include:(y=i.trigger.filter)!=null&&y.include?(w=i.trigger.filter)==null?void 0:w.include:Xn.QuickFix},autoApply:i.trigger.autoApply,context:{notAvailableMessage:((A=i.trigger.context)==null?void 0:A.notAvailableMessage)||"",position:ae}},xe=new $i(ae.lineNumber,ae.column,ae.lineNumber,ae.column),Ne=await qh(this._registry,e,xe,Te,fl.None,u);if(Ne.validActions.length!==0){for(const Ve of Ne.validActions)(T=(I=Ve.action.command)==null?void 0:I.arguments)!=null&&T.some(ve=>typeof ve=="string"&&ve.includes(T8))&&(Ve.action.diagnostics=[...j.filter(ve=>ve.relatedInformation)]);R.allActions.length===0&&P.push(...Ne.allActions),Math.abs(J.column-oe)<fe?X.unshift(...Ne.validActions):X.push(...Ne.validActions)}fe=Math.abs(J.column-oe)}}const ce=X.filter((me,oe,le)=>le.findIndex(Ae=>Ae.action.title===me.action.title)===oe);return ce.sort((me,oe)=>me.action.isPreferred&&!oe.action.isPreferred?-1:!me.action.isPreferred&&oe.action.isPreferred||me.action.isAI&&!oe.action.isAI?1:!me.action.isAI&&oe.action.isAI?-1:0),{validActions:ce,allActions:P,documentation:R.documentation,hasAutoFix:R.hasAutoFix,hasAIFix:R.hasAIFix,allAIFixes:R.allAIFixes,dispose:()=>{R.dispose()}}}}if(i.trigger.type===1){const R=new Oo,P=await qh(this._registry,e,i.selection,i.trigger,fl.None,u);return this._telemetryService&&this._telemetryService.publicLog2("codeAction.invokedDurations",{codeActions:P.validActions.length,duration:R.elapsed()}),P}return qh(this._registry,e,i.selection,i.trigger,fl.None,u)});i.trigger.type===1&&((d=this._progressService)==null||d.showWhile(s,250));const r=new vd.Triggered(i.trigger,n,s);let a=!1;this._state.type===1&&(a=this._state.trigger.type===1&&r.type===1&&r.trigger.type===2&&this._state.position!==r.position),a?setTimeout(()=>{this.setState(r)},500):this.setState(r)},void 0),this._codeActionOracle.value.trigger({type:2,triggerAction:Ho.Default})}else this._supportedCodeActions.reset()}trigger(e){var t;(t=this._codeActionOracle.value)==null||t.trigger(e)}setState(e,t){e!==this._state&&(this._state.type===1&&this._state.cancel(),this._state=e,!t&&!this._disposed&&this._onDidChangeState.fire(e))}}var WT=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},va=function(o,e){return function(t,i){e(t,i,o)}},Nh;const zT="quickfix-edit-highlight";var Ec;let q0=(Ec=class extends Rt{static get(e){return e.getContribution(Nh.ID)}constructor(e,t,i,n,s,r,a,d,u,f,g){super(),this._commandService=a,this._configurationService=d,this._actionWidgetService=u,this._instantiationService=f,this._telemetryService=g,this._activeCodeActions=this._register(new er),this._showDisabled=!1,this._disposed=!1,this._editor=e,this._model=this._register(new HT(this._editor,s.codeActionProvider,t,i,r,d,this._telemetryService)),this._register(this._model.onDidChangeState(p=>this.update(p))),this._lightBulbWidget=new Fw(()=>{const p=this._editor.getContribution($g.ID);return p&&this._register(p.onClick(C=>this.showCodeActionsFromLightbulb(C.actions,C))),p}),this._resolver=n.createInstance(j1),this._register(this._editor.onDidLayoutChange(()=>this._actionWidgetService.hide()))}dispose(){this._disposed=!0,super.dispose()}async showCodeActionsFromLightbulb(e,t){if(e.allAIFixes&&e.validActions.length===1){const i=e.validActions[0],n=i.action.command;n&&n.id==="inlineChat.start"&&n.arguments&&n.arguments.length>=1&&(n.arguments[0]={...n.arguments[0],autoSend:!1}),await this._applyCodeAction(i,!1,!1,Sd.FromAILightbulb);return}await this.showCodeActionList(e,t,{includeDisabledActions:!1,fromLightbulb:!0})}showCodeActions(e,t,i){return this.showCodeActionList(t,i,{includeDisabledActions:!1,fromLightbulb:!1})}manualTriggerAtCurrentPosition(e,t,i,n){var r;if(!this._editor.hasModel())return;(r=Mo.get(this._editor))==null||r.closeMessage();const s=this._editor.getPosition();this._trigger({type:1,triggerAction:t,filter:i,autoApply:n,context:{notAvailableMessage:e,position:s}})}_trigger(e){return this._model.trigger(e)}async _applyCodeAction(e,t,i,n){try{await this._instantiationService.invokeFunction(DT,e,n,{preview:i,editor:this._editor})}finally{t&&this._trigger({type:2,triggerAction:Ho.QuickFix,filter:{}})}}hideLightBulbWidget(){var e,t;(e=this._lightBulbWidget.rawValue)==null||e.hide(),(t=this._lightBulbWidget.rawValue)==null||t.gutterHide()}async update(e){var n,s,r,a,d;if(e.type!==1){this.hideLightBulbWidget();return}let t;try{t=await e.actions}catch(u){qn(u);return}if(this._disposed)return;const i=this._editor.getSelection();if((i==null?void 0:i.startLineNumber)===e.position.lineNumber)if((n=this._lightBulbWidget.value)==null||n.update(t,e.trigger,e.position),e.trigger.type===1){if((s=e.trigger.filter)!=null&&s.include){const f=this.tryGetValidActionToApply(e.trigger,t);if(f){try{this.hideLightBulbWidget(),await this._applyCodeAction(f,!1,!1,Sd.FromCodeActions)}finally{t.dispose()}return}if(e.trigger.context){const g=this.getInvalidActionThatWouldHaveBeenApplied(e.trigger,t);if(g&&g.action.disabled){(r=Mo.get(this._editor))==null||r.showMessage(g.action.disabled,e.trigger.context.position),t.dispose();return}}}const u=!!((a=e.trigger.filter)!=null&&a.include);if(e.trigger.context&&(!t.allActions.length||!u&&!t.validActions.length)){(d=Mo.get(this._editor))==null||d.showMessage(e.trigger.context.notAvailableMessage,e.trigger.context.position),this._activeCodeActions.value=t,t.dispose();return}this._activeCodeActions.value=t,this.showCodeActionList(t,this.toCoords(e.position),{includeDisabledActions:u,fromLightbulb:!1})}else this._actionWidgetService.isVisible?t.dispose():this._activeCodeActions.value=t}getInvalidActionThatWouldHaveBeenApplied(e,t){if(t.allActions.length&&(e.autoApply==="first"&&t.validActions.length===0||e.autoApply==="ifSingle"&&t.allActions.length===1))return t.allActions.find(({action:i})=>i.disabled)}tryGetValidActionToApply(e,t){if(t.validActions.length&&(e.autoApply==="first"&&t.validActions.length>0||e.autoApply==="ifSingle"&&t.validActions.length===1))return t.validActions[0]}async showCodeActionList(e,t,i){const n=this._editor.createDecorationsCollection(),s=this._editor.getDomNode();if(!s)return;const r=i.includeDisabledActions&&(this._showDisabled||e.validActions.length===0)?e.allActions:e.validActions;if(!r.length)return;const a=Bi.isIPosition(t)?this.toCoords(t):t,d={onSelect:async(u,f)=>{this._applyCodeAction(u,!0,!!f,i.fromLightbulb?Sd.FromAILightbulb:Sd.FromCodeActions),this._actionWidgetService.hide(!1),n.clear()},onHide:u=>{var f;(f=this._editor)==null||f.focus(),n.clear()},onHover:async(u,f)=>{var C;if(f.isCancellationRequested)return;let g=!1;const p=u.action.kind;if(p){const b=new ns(p);g=[Xn.RefactorExtract,Xn.RefactorInline,Xn.RefactorRewrite,Xn.RefactorMove,Xn.Source].some(w=>w.contains(b))}return{canPreview:g||!!((C=u.action.edit)!=null&&C.edits.length)}},onFocus:u=>{var f,g;if(u&&u.action){const p=u.action.ranges,C=u.action.diagnostics;if(n.clear(),p&&p.length>0){const b=C&&(C==null?void 0:C.length)>1?C.map(y=>({range:y,options:Nh.DECORATION})):p.map(y=>({range:y,options:Nh.DECORATION}));n.set(b)}else if(C&&C.length>0){const b=C.map(w=>({range:w,options:Nh.DECORATION}));n.set(b);const y=C[0];if(y.startLineNumber&&y.startColumn){const w=(g=(f=this._editor.getModel())==null?void 0:f.getWordAtPosition({lineNumber:y.startLineNumber,column:y.startColumn}))==null?void 0:g.word;P0(S("editingNewSelection","Context: {0} at line {1} and column {2}.",w,y.startLineNumber,y.startColumn))}}}else n.clear()}};this._actionWidgetService.show("codeActionWidget",!0,LT(r,this._shouldShowHeaders(),this._resolver.getResolver()),d,a,s,this._getActionBarActions(e,t,i))}toCoords(e){if(!this._editor.hasModel())return{x:0,y:0};this._editor.revealPosition(e,1),this._editor.render();const t=this._editor.getScrolledVisiblePosition(e),i=yo(this._editor.getDomNode()),n=i.left+t.left,s=i.top+t.top+t.height;return{x:n,y:s}}_shouldShowHeaders(){var t;const e=(t=this._editor)==null?void 0:t.getModel();return this._configurationService.getValue("editor.codeActionWidget.showHeaders",{resource:e==null?void 0:e.uri})}_getActionBarActions(e,t,i){if(i.fromLightbulb)return[];const n=e.documentation.map(s=>({id:s.id,label:s.title,tooltip:s.tooltip??"",class:void 0,enabled:!0,run:()=>this._commandService.executeCommand(s.id,...s.arguments??[])}));return i.includeDisabledActions&&e.validActions.length>0&&e.allActions.length!==e.validActions.length&&n.push(this._showDisabled?{id:"hideMoreActions",label:S("hideMoreActions","Hide Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(e,t,i))}:{id:"showMoreActions",label:S("showMoreActions","Show Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(e,t,i))}),n}},Nh=Ec,Ec.ID="editor.contrib.codeActionController",Ec.DECORATION=vn.register({description:"quickfix-highlight",className:zT}),Ec);q0=Nh=WT([va(1,Rw),va(2,Fn),va(3,sn),va(4,Fi),va(5,Ap),va(6,Vs),va(7,ss),va(8,Ju),va(9,sn),va(10,ua)],q0);$_((o,e)=>{((n,s)=>{s&&e.addRule(`.monaco-editor ${n} { background-color: ${s}; }`)})(".quickfix-edit-highlight",o.getColor(f3));const i=o.getColor(uA);i&&e.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${Fg(o.type)?"dotted":"solid"} ${i}; box-sizing: border-box; }`)});function Gp(o){return qe.regex(g5.keys()[0],new RegExp("(\\s|^)"+Lg(o.value)+"\\b"))}const w9={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:S("args.schema.kind","Kind of the code action to run.")},apply:{type:"string",description:S("args.schema.apply","Controls when the returned actions are applied."),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[S("args.schema.apply.first","Always apply the first returned code action."),S("args.schema.apply.ifSingle","Apply the first returned code action if it is the only one."),S("args.schema.apply.never","Do not apply the returned code actions.")]},preferred:{type:"boolean",default:!1,description:S("args.schema.preferred","Controls if only preferred code actions should be returned.")}}};function eh(o,e,t,i,n=Ho.Default){if(o.hasModel()){const s=q0.get(o);s==null||s.manualTriggerAtCurrentPosition(e,n,t,i)}}class VT extends Ct{constructor(){super({id:y9,label:S("quickfix.trigger.label","Quick Fix..."),alias:"Quick Fix...",precondition:qe.and(q.writable,q.hasCodeActionsProvider),kbOpts:{kbExpr:q.textInputFocus,primary:2137,weight:100}})}run(e,t){return eh(t,S("editor.action.quickFix.noneMessage","No code actions available"),void 0,void 0,Ho.QuickFix)}}class jT extends Ao{constructor(){super({id:o5,precondition:qe.and(q.writable,q.hasCodeActionsProvider),metadata:{description:"Trigger a code action",args:[{name:"args",schema:w9}]}})}runEditorCommand(e,t,i){const n=Pa.fromUser(i,{kind:ns.Empty,apply:"ifSingle"});return eh(t,typeof(i==null?void 0:i.kind)=="string"?n.preferred?S("editor.action.codeAction.noneMessage.preferred.kind","No preferred code actions for '{0}' available",i.kind):S("editor.action.codeAction.noneMessage.kind","No code actions for '{0}' available",i.kind):n.preferred?S("editor.action.codeAction.noneMessage.preferred","No preferred code actions available"):S("editor.action.codeAction.noneMessage","No code actions available"),{include:n.kind,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply)}}class $T extends Ct{constructor(){super({id:a5,label:S("refactor.label","Refactor..."),alias:"Refactor...",precondition:qe.and(q.writable,q.hasCodeActionsProvider),kbOpts:{kbExpr:q.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:qe.and(q.writable,Gp(Xn.Refactor))},metadata:{description:"Refactor...",args:[{name:"args",schema:w9}]}})}run(e,t,i){const n=Pa.fromUser(i,{kind:Xn.Refactor,apply:"never"});return eh(t,typeof(i==null?void 0:i.kind)=="string"?n.preferred?S("editor.action.refactor.noneMessage.preferred.kind","No preferred refactorings for '{0}' available",i.kind):S("editor.action.refactor.noneMessage.kind","No refactorings for '{0}' available",i.kind):n.preferred?S("editor.action.refactor.noneMessage.preferred","No preferred refactorings available"):S("editor.action.refactor.noneMessage","No refactorings available"),{include:Xn.Refactor.contains(n.kind)?n.kind:ns.None,onlyIncludePreferredActions:n.preferred},n.apply,Ho.Refactor)}}class UT extends Ct{constructor(){super({id:l5,label:S("source.label","Source Action..."),alias:"Source Action...",precondition:qe.and(q.writable,q.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:qe.and(q.writable,Gp(Xn.Source))},metadata:{description:"Source Action...",args:[{name:"args",schema:w9}]}})}run(e,t,i){const n=Pa.fromUser(i,{kind:Xn.Source,apply:"never"});return eh(t,typeof(i==null?void 0:i.kind)=="string"?n.preferred?S("editor.action.source.noneMessage.preferred.kind","No preferred source actions for '{0}' available",i.kind):S("editor.action.source.noneMessage.kind","No source actions for '{0}' available",i.kind):n.preferred?S("editor.action.source.noneMessage.preferred","No preferred source actions available"):S("editor.action.source.noneMessage","No source actions available"),{include:Xn.Source.contains(n.kind)?n.kind:ns.None,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply,Ho.SourceAction)}}class qT extends Ct{constructor(){super({id:W1,label:S("organizeImports.label","Organize Imports"),alias:"Organize Imports",precondition:qe.and(q.writable,Gp(Xn.SourceOrganizeImports)),kbOpts:{kbExpr:q.textInputFocus,primary:1581,weight:100}})}run(e,t){return eh(t,S("editor.action.organize.noneMessage","No organize imports action available"),{include:Xn.SourceOrganizeImports,includeSourceActions:!0},"ifSingle",Ho.OrganizeImports)}}class GT extends Ct{constructor(){super({id:z1,label:S("fixAll.label","Fix All"),alias:"Fix All",precondition:qe.and(q.writable,Gp(Xn.SourceFixAll))})}run(e,t){return eh(t,S("fixAll.noneMessage","No fix all action available"),{include:Xn.SourceFixAll,includeSourceActions:!0},"ifSingle",Ho.FixAll)}}class KT extends Ct{constructor(){super({id:r5,label:S("autoFix.label","Auto Fix..."),alias:"Auto Fix...",precondition:qe.and(q.writable,Gp(Xn.QuickFix)),kbOpts:{kbExpr:q.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(e,t){return eh(t,S("editor.action.autoFix.noneMessage","No auto fixes available"),{include:Xn.QuickFix,onlyIncludePreferredActions:!0},"ifSingle",Ho.AutoFix)}}hn(q0.ID,q0,3);hn($g.ID,$g,4);Le(VT);Le($T);Le(UT);Le(qT);Le(KT);Le(GT);Ti(new jT);ca.as(kp.Configuration).registerConfiguration({...U_,properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:5,description:S("showCodeActionHeaders","Enable/disable showing group headers in the Code Action menu."),default:!0}}});ca.as(kp.Configuration).registerConfiguration({...U_,properties:{"editor.codeActionWidget.includeNearbyQuickFixes":{type:"boolean",scope:5,description:S("includeNearbyQuickFixes","Enable/disable showing nearest Quick Fix within a line when not currently on a diagnostic."),default:!0}}});ca.as(kp.Configuration).registerConfiguration({...U_,properties:{"editor.codeActions.triggerOnFocusChange":{type:"boolean",scope:5,markdownDescription:S("triggerOnFocusChange","Enable triggering {0} when {1} is set to {2}. Code Actions must be set to {3} to be triggered for window and focus changes.","`#editor.codeActionsOnSave#`","`#files.autoSave#`","`afterDelay`","`always`"),default:!1}}});class G1{constructor(){this.lenses=[],this._disposables=new Tt}dispose(){this._disposables.dispose()}get isDisposed(){return this._disposables.isDisposed}add(e,t){this._disposables.add(e);for(const i of e.lenses)this.lenses.push({symbol:i,provider:t})}}async function x5(o,e,t){const i=o.ordered(e),n=new Map,s=new G1,r=i.map(async(a,d)=>{n.set(a,d);try{const u=await Promise.resolve(a.provideCodeLenses(e,t));u&&s.add(u,a)}catch(u){bs(u)}});return await Promise.all(r),s.lenses=s.lenses.sort((a,d)=>a.symbol.range.startLineNumber<d.symbol.range.startLineNumber?-1:a.symbol.range.startLineNumber>d.symbol.range.startLineNumber?1:n.get(a.provider)<n.get(d.provider)?-1:n.get(a.provider)>n.get(d.provider)?1:a.symbol.range.startColumn<d.symbol.range.startColumn?-1:a.symbol.range.startColumn>d.symbol.range.startColumn?1:0),s}Qn.registerCommand("_executeCodeLensProvider",function(o,...e){let[t,i]=e;Pn(jn.isUri(t)),Pn(typeof i=="number"||!i);const{codeLensProvider:n}=o.get(Fi),s=o.get(vo).getModel(t);if(!s)throw vl();const r=[],a=new Tt;return x5(n,s,an.None).then(d=>{a.add(d);const u=[];for(const f of d.lenses)i==null||f.symbol.command?r.push(f.symbol):i-- >0&&f.provider.resolveCodeLens&&u.push(Promise.resolve(f.provider.resolveCodeLens(s,f.symbol,an.None)).then(g=>r.push(g||f.symbol)));return Promise.all(u)}).then(()=>r).finally(()=>{setTimeout(()=>a.dispose(),100)})});var ZT=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},XT=function(o,e){return function(t,i){e(t,i,o)}};const m5=Ml("ICodeLensCache");class M8{constructor(e,t){this.lineCount=e,this.data=t}}let K1=class{constructor(e){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}},this._cache=new Bp(20,.75);const t="codelens/cache";g3(p3,()=>e.remove(t,1));const i="codelens/cache2",n=e.get(i,1,"{}");this._deserialize(n);const s=Ts.filter(e.onWillSaveState,r=>r.reason===Nw.SHUTDOWN);Ts.once(s)(r=>{e.store(i,this._serialize(),1,1)})}put(e,t){const i=t.lenses.map(r=>{var a;return{range:r.symbol.range,command:r.symbol.command&&{id:"",title:(a=r.symbol.command)==null?void 0:a.title}}}),n=new G1;n.add({lenses:i,dispose:()=>{}},this._fakeProvider);const s=new M8(e.getLineCount(),n);this._cache.set(e.uri.toString(),s)}get(e){const t=this._cache.get(e.uri.toString());return t&&t.lineCount===e.getLineCount()?t.data:void 0}delete(e){this._cache.delete(e.uri.toString())}_serialize(){const e=Object.create(null);for(const[t,i]of this._cache){const n=new Set;for(const s of i.data.lenses)n.add(s.symbol.range.startLineNumber);e[t]={lineCount:i.lineCount,lines:[...n.values()]}}return JSON.stringify(e)}_deserialize(e){try{const t=JSON.parse(e);for(const i in t){const n=t[i],s=[];for(const a of n.lines)s.push({range:new Q(a,1,a,11)});const r=new G1;r.add({lenses:s,dispose(){}},this._fakeProvider),this._cache.set(i,new M8(n.lineCount,r))}}catch{}}};K1=ZT([XT(0,Gc)],K1);Rl(m5,K1,1);class YT{constructor(e,t,i){this.afterColumn=1073741824,this.afterLineNumber=e,this.heightInPx=t,this._onHeight=i,this.suppressMouseDown=!0,this.domNode=document.createElement("div")}onComputedHeight(e){this._lastHeight===void 0?this._lastHeight=e:this._lastHeight!==e&&(this._lastHeight=e,this._onHeight())}isVisible(){return this._lastHeight!==0&&this.domNode.hasAttribute("monaco-visible-view-zone")}}const Dg=class Dg{constructor(e,t){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=e,this._id=`codelens.widget-${Dg._idPool++}`,this.updatePosition(t),this._domNode=document.createElement("span"),this._domNode.className="codelens-decoration"}withCommands(e,t){this._commands.clear();const i=[];let n=!1;for(let s=0;s<e.length;s++){const r=e[s];if(r&&(n=!0,r.command)){const a=x3(r.command.title.trim());if(r.command.id){const d=`c${Dg._idPool++}`;i.push(mi("a",{id:d,title:r.command.tooltip,role:"button"},...a)),this._commands.set(d,r.command)}else i.push(mi("span",{title:r.command.tooltip},...a));s+1<e.length&&i.push(mi("span",void 0," | "))}}n?(Sm(this._domNode,...i),this._isEmpty&&t&&this._domNode.classList.add("fadein"),this._isEmpty=!1):Sm(this._domNode,mi("span",void 0,"no commands"))}getCommand(e){return e.parentElement===this._domNode?this._commands.get(e.id):void 0}getId(){return this._id}getDomNode(){return this._domNode}updatePosition(e){const t=this._editor.getModel().getLineFirstNonWhitespaceColumn(e);this._widgetPosition={position:{lineNumber:e,column:t},preference:[1]}}getPosition(){return this._widgetPosition||null}};Dg._idPool=0;let Z1=Dg;class mC{constructor(){this._removeDecorations=[],this._addDecorations=[],this._addDecorationsCallbacks=[]}addDecoration(e,t){this._addDecorations.push(e),this._addDecorationsCallbacks.push(t)}removeDecoration(e){this._removeDecorations.push(e)}commit(e){const t=e.deltaDecorations(this._removeDecorations,this._addDecorations);for(let i=0,n=t.length;i<n;i++)this._addDecorationsCallbacks[i](t[i])}}const R8=vn.register({collapseOnReplaceEdit:!0,description:"codelens"});class N8{constructor(e,t,i,n,s,r){this._isDisposed=!1,this._editor=t,this._data=e,this._decorationIds=[];let a;const d=[];this._data.forEach((u,f)=>{u.symbol.command&&d.push(u.symbol),i.addDecoration({range:u.symbol.range,options:R8},g=>this._decorationIds[f]=g),a?a=Q.plusRange(a,u.symbol.range):a=Q.lift(u.symbol.range)}),this._viewZone=new YT(a.startLineNumber-1,s,r),this._viewZoneId=n.addZone(this._viewZone),d.length>0&&(this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(d,!1))}_createContentWidgetIfNecessary(){this._contentWidget?this._editor.layoutContentWidget(this._contentWidget):(this._contentWidget=new Z1(this._editor,this._viewZone.afterLineNumber+1),this._editor.addContentWidget(this._contentWidget))}dispose(e,t){this._decorationIds.forEach(e.removeDecoration,e),this._decorationIds=[],t==null||t.removeZone(this._viewZoneId),this._contentWidget&&(this._editor.removeContentWidget(this._contentWidget),this._contentWidget=void 0),this._isDisposed=!0}isDisposed(){return this._isDisposed}isValid(){return this._decorationIds.some((e,t)=>{const i=this._editor.getModel().getDecorationRange(e),n=this._data[t].symbol;return!!(i&&Q.isEmpty(n.range)===i.isEmpty())})}updateCodeLensSymbols(e,t){this._decorationIds.forEach(t.removeDecoration,t),this._decorationIds=[],this._data=e,this._data.forEach((i,n)=>{t.addDecoration({range:i.symbol.range,options:R8},s=>this._decorationIds[n]=s)})}updateHeight(e,t){this._viewZone.heightInPx=e,t.layoutZone(this._viewZoneId),this._contentWidget&&this._editor.layoutContentWidget(this._contentWidget)}computeIfNecessary(e){if(!this._viewZone.isVisible())return null;for(let t=0;t<this._decorationIds.length;t++){const i=e.getDecorationRange(this._decorationIds[t]);i&&(this._data[t].symbol.range=i)}return this._data}updateCommands(e){this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(e,!0);for(let t=0;t<this._data.length;t++){const i=e[t];if(i){const{symbol:n}=this._data[t];n.command=i.command||n.command}}}getCommand(e){var t;return(t=this._contentWidget)==null?void 0:t.getCommand(e)}getLineNumber(){const e=this._editor.getModel().getDecorationRange(this._decorationIds[0]);return e?e.startLineNumber:-1}update(e){if(this.isValid()){const t=this._editor.getModel().getDecorationRange(this._decorationIds[0]);t&&(this._viewZone.afterLineNumber=t.startLineNumber-1,e.layoutZone(this._viewZoneId),this._contentWidget&&(this._contentWidget.updatePosition(t.startLineNumber),this._editor.layoutContentWidget(this._contentWidget)))}}}var QT=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Rf=function(o,e){return function(t,i){e(t,i,o)}},b0;let Ug=(b0=class{constructor(e,t,i,n,s,r){this._editor=e,this._languageFeaturesService=t,this._commandService=n,this._notificationService=s,this._codeLensCache=r,this._disposables=new Tt,this._localToDispose=new Tt,this._lenses=[],this._oldCodeLensModels=new Tt,this._provideCodeLensDebounce=i.for(t.codeLensProvider,"CodeLensProvide",{min:250}),this._resolveCodeLensesDebounce=i.for(t.codeLensProvider,"CodeLensResolve",{min:250,salt:"resolve"}),this._resolveCodeLensesScheduler=new Ms(()=>this._resolveCodeLensesInViewport(),this._resolveCodeLensesDebounce.default()),this._disposables.add(this._editor.onDidChangeModel(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeConfiguration(a=>{(a.hasChanged(50)||a.hasChanged(19)||a.hasChanged(18))&&this._updateLensStyle(),a.hasChanged(17)&&this._onModelChange()})),this._disposables.add(t.codeLensProvider.onDidChange(this._onModelChange,this)),this._onModelChange(),this._updateLensStyle()}dispose(){var e;this._localDispose(),this._disposables.dispose(),this._oldCodeLensModels.dispose(),(e=this._currentCodeLensModel)==null||e.dispose()}_getLayoutInfo(){const e=Math.max(1.3,this._editor.getOption(67)/this._editor.getOption(52));let t=this._editor.getOption(19);return(!t||t<5)&&(t=this._editor.getOption(52)*.9|0),{fontSize:t,codeLensHeight:t*e|0}}_updateLensStyle(){const{codeLensHeight:e,fontSize:t}=this._getLayoutInfo(),i=this._editor.getOption(18),n=this._editor.getOption(50),{style:s}=this._editor.getContainerDomNode();s.setProperty("--vscode-editorCodeLens-lineHeight",`${e}px`),s.setProperty("--vscode-editorCodeLens-fontSize",`${t}px`),s.setProperty("--vscode-editorCodeLens-fontFeatureSettings",n.fontFeatureSettings),i&&(s.setProperty("--vscode-editorCodeLens-fontFamily",i),s.setProperty("--vscode-editorCodeLens-fontFamilyDefault",Ow.fontFamily)),this._editor.changeViewZones(r=>{for(const a of this._lenses)a.updateHeight(e,r)})}_localDispose(){var e,t,i;(e=this._getCodeLensModelPromise)==null||e.cancel(),this._getCodeLensModelPromise=void 0,(t=this._resolveCodeLensesPromise)==null||t.cancel(),this._resolveCodeLensesPromise=void 0,this._localToDispose.clear(),this._oldCodeLensModels.clear(),(i=this._currentCodeLensModel)==null||i.dispose()}_onModelChange(){this._localDispose();const e=this._editor.getModel();if(!e||!this._editor.getOption(17)||e.isTooLargeForTokenization())return;const t=this._codeLensCache.get(e);if(t&&this._renderCodeLensSymbols(t),!this._languageFeaturesService.codeLensProvider.has(e)){t&&kg(()=>{const n=this._codeLensCache.get(e);t===n&&(this._codeLensCache.delete(e),this._onModelChange())},30*1e3,this._localToDispose);return}for(const n of this._languageFeaturesService.codeLensProvider.all(e))if(typeof n.onDidChange=="function"){const s=n.onDidChange(()=>i.schedule());this._localToDispose.add(s)}const i=new Ms(()=>{var s;const n=Date.now();(s=this._getCodeLensModelPromise)==null||s.cancel(),this._getCodeLensModelPromise=qs(r=>x5(this._languageFeaturesService.codeLensProvider,e,r)),this._getCodeLensModelPromise.then(r=>{this._currentCodeLensModel&&this._oldCodeLensModels.add(this._currentCodeLensModel),this._currentCodeLensModel=r,this._codeLensCache.put(e,r);const a=this._provideCodeLensDebounce.update(e,Date.now()-n);i.delay=a,this._renderCodeLensSymbols(r),this._resolveCodeLensesInViewportSoon()},qn)},this._provideCodeLensDebounce.get(e));this._localToDispose.add(i),this._localToDispose.add(is(()=>this._resolveCodeLensesScheduler.cancel())),this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{var n;this._editor.changeDecorations(s=>{this._editor.changeViewZones(r=>{const a=[];let d=-1;this._lenses.forEach(f=>{!f.isValid()||d===f.getLineNumber()?a.push(f):(f.update(r),d=f.getLineNumber())});const u=new mC;a.forEach(f=>{f.dispose(u,r),this._lenses.splice(this._lenses.indexOf(f),1)}),u.commit(s)})}),i.schedule(),this._resolveCodeLensesScheduler.cancel(),(n=this._resolveCodeLensesPromise)==null||n.cancel(),this._resolveCodeLensesPromise=void 0})),this._localToDispose.add(this._editor.onDidFocusEditorText(()=>{i.schedule()})),this._localToDispose.add(this._editor.onDidBlurEditorText(()=>{i.cancel()})),this._localToDispose.add(this._editor.onDidScrollChange(n=>{n.scrollTopChanged&&this._lenses.length>0&&this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(this._editor.onDidLayoutChange(()=>{this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(is(()=>{if(this._editor.getModel()){const n=T0.capture(this._editor);this._editor.changeDecorations(s=>{this._editor.changeViewZones(r=>{this._disposeAllLenses(s,r)})}),n.restore(this._editor)}else this._disposeAllLenses(void 0,void 0)})),this._localToDispose.add(this._editor.onMouseDown(n=>{if(n.target.type!==9)return;let s=n.target.element;if((s==null?void 0:s.tagName)==="SPAN"&&(s=s.parentElement),(s==null?void 0:s.tagName)==="A")for(const r of this._lenses){const a=r.getCommand(s);if(a){this._commandService.executeCommand(a.id,...a.arguments||[]).catch(d=>this._notificationService.error(d));break}}})),i.schedule()}_disposeAllLenses(e,t){const i=new mC;for(const n of this._lenses)n.dispose(i,t);e&&i.commit(e),this._lenses.length=0}_renderCodeLensSymbols(e){if(!this._editor.hasModel())return;const t=this._editor.getModel().getLineCount(),i=[];let n;for(const a of e.lenses){const d=a.symbol.range.startLineNumber;d<1||d>t||(n&&n[n.length-1].symbol.range.startLineNumber===d?n.push(a):(n=[a],i.push(n)))}if(!i.length&&!this._lenses.length)return;const s=T0.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations(a=>{this._editor.changeViewZones(d=>{const u=new mC;let f=0,g=0;for(;g<i.length&&f<this._lenses.length;){const p=i[g][0].symbol.range.startLineNumber,C=this._lenses[f].getLineNumber();C<p?(this._lenses[f].dispose(u,d),this._lenses.splice(f,1)):C===p?(this._lenses[f].updateCodeLensSymbols(i[g],u),g++,f++):(this._lenses.splice(f,0,new N8(i[g],this._editor,u,d,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),f++,g++)}for(;f<this._lenses.length;)this._lenses[f].dispose(u,d),this._lenses.splice(f,1);for(;g<i.length;)this._lenses.push(new N8(i[g],this._editor,u,d,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),g++;u.commit(a)})}),s.restore(this._editor)}_resolveCodeLensesInViewportSoon(){this._editor.getModel()&&this._resolveCodeLensesScheduler.schedule()}_resolveCodeLensesInViewport(){var r;(r=this._resolveCodeLensesPromise)==null||r.cancel(),this._resolveCodeLensesPromise=void 0;const e=this._editor.getModel();if(!e)return;const t=[],i=[];if(this._lenses.forEach(a=>{const d=a.computeIfNecessary(e);d&&(t.push(d),i.push(a))}),t.length===0)return;const n=Date.now(),s=qs(a=>{const d=t.map((u,f)=>{const g=new Array(u.length),p=u.map((C,b)=>!C.symbol.command&&typeof C.provider.resolveCodeLens=="function"?Promise.resolve(C.provider.resolveCodeLens(e,C.symbol,a)).then(y=>{g[b]=y},bs):(g[b]=C.symbol,Promise.resolve(void 0)));return Promise.all(p).then(()=>{!a.isCancellationRequested&&!i[f].isDisposed()&&i[f].updateCommands(g)})});return Promise.all(d)});this._resolveCodeLensesPromise=s,this._resolveCodeLensesPromise.then(()=>{const a=this._resolveCodeLensesDebounce.update(e,Date.now()-n);this._resolveCodeLensesScheduler.delay=a,this._currentCodeLensModel&&this._codeLensCache.put(e,this._currentCodeLensModel),this._oldCodeLensModels.clear(),s===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)},a=>{qn(a),s===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)})}async getModel(){var e;return await this._getCodeLensModelPromise,await this._resolveCodeLensesPromise,(e=this._currentCodeLensModel)!=null&&e.isDisposed?void 0:this._currentCodeLensModel}},b0.ID="css.editor.codeLens",b0);Ug=QT([Rf(1,Fi),Rf(2,gr),Rf(3,Vs),Rf(4,mo),Rf(5,m5)],Ug);hn(Ug.ID,Ug,1);Le(class extends Ct{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:q.hasCodeLensProvider,label:S("showLensOnLine","Show CodeLens Commands For Current Line"),alias:"Show CodeLens Commands For Current Line"})}async run(e,t){if(!t.hasModel())return;const i=e.get(Tl),n=e.get(Vs),s=e.get(mo),r=t.getSelection().positionLineNumber,a=t.getContribution(Ug.ID);if(!a)return;const d=await a.getModel();if(!d)return;const u=[];for(const p of d.lenses)p.symbol.command&&p.symbol.range.startLineNumber===r&&u.push({label:p.symbol.command.title,command:p.symbol.command});if(u.length===0)return;const f=await i.pick(u,{canPickMany:!1,placeHolder:S("placeHolder","Select a command")});if(!f)return;let g=f.command;if(d.isDisposed){const p=await a.getModel(),C=p==null?void 0:p.lenses.find(b=>{var y;return b.symbol.range.startLineNumber===r&&((y=b.symbol.command)==null?void 0:y.title)===g.title});if(!C||!C.symbol.command)return;g=C.symbol.command}try{await n.executeCommand(g.id,...g.arguments||[])}catch(p){s.error(p)}}});var v5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},X1=function(o,e){return function(t,i){e(t,i,o)}};let qg=class{constructor(e){this._editorWorkerService=e}async provideDocumentColors(e,t){return this._editorWorkerService.computeDefaultDocumentColors(e.uri)}provideColorPresentations(e,t,i){const n=t.range,s=t.color,r=s.alpha,a=new xn(new M0(Math.round(255*s.red),Math.round(255*s.green),Math.round(255*s.blue),r)),d=r?xn.Format.CSS.formatRGB(a):xn.Format.CSS.formatRGBA(a),u=r?xn.Format.CSS.formatHSL(a):xn.Format.CSS.formatHSLA(a),f=r?xn.Format.CSS.formatHex(a):xn.Format.CSS.formatHexA(a),g=[];return g.push({label:d,textEdit:{range:n,text:d}}),g.push({label:u,textEdit:{range:n,text:u}}),g.push({label:f,textEdit:{range:n,text:f}}),g}};qg=v5([X1(0,Nl)],qg);let Y1=class extends Rt{constructor(e,t){super(),this._register(e.colorProvider.register("*",new qg(t)))}};Y1=v5([X1(0,Fi),X1(1,Nl)],Y1);df(Y1);async function _5(o,e,t,i=!0){return S9(new JT,o,e,t,i)}function b5(o,e,t,i){return Promise.resolve(t.provideColorPresentations(o,e,i))}class JT{constructor(){}async compute(e,t,i,n){const s=await e.provideDocumentColors(t,i);if(Array.isArray(s))for(const r of s)n.push({colorInfo:r,provider:e});return Array.isArray(s)}}class eM{constructor(){}async compute(e,t,i,n){const s=await e.provideDocumentColors(t,i);if(Array.isArray(s))for(const r of s)n.push({range:r.range,color:[r.color.red,r.color.green,r.color.blue,r.color.alpha]});return Array.isArray(s)}}class tM{constructor(e){this.colorInfo=e}async compute(e,t,i,n){const s=await e.provideColorPresentations(t,this.colorInfo,an.None);return Array.isArray(s)&&n.push(...s),Array.isArray(s)}}async function S9(o,e,t,i,n){let s=!1,r;const a=[],d=e.ordered(t);for(let u=d.length-1;u>=0;u--){const f=d[u];if(f instanceof qg)r=f;else try{await o.compute(f,t,i,a)&&(s=!0)}catch(g){bs(g)}}return s?a:r&&n?(await o.compute(r,t,i,a),a):[]}function C5(o,e){const{colorProvider:t}=o.get(Fi),i=o.get(vo).getModel(e);if(!i)throw vl();const n=o.get(ss).getValue("editor.defaultColorDecorators",{resource:e});return{model:i,colorProviderRegistry:t,isDefaultColorDecoratorsEnabled:n}}Qn.registerCommand("_executeDocumentColorProvider",function(o,...e){const[t]=e;if(!(t instanceof jn))throw vl();const{model:i,colorProviderRegistry:n,isDefaultColorDecoratorsEnabled:s}=C5(o,t);return S9(new eM,n,i,an.None,s)});Qn.registerCommand("_executeColorPresentationProvider",function(o,...e){const[t,i]=e,{uri:n,range:s}=i;if(!(n instanceof jn)||!Array.isArray(t)||t.length!==4||!Q.isIRange(s))throw vl();const{model:r,colorProviderRegistry:a,isDefaultColorDecoratorsEnabled:d}=C5(o,n),[u,f,g,p]=t;return S9(new tM({range:s,color:{red:u,green:f,blue:g,alpha:p}}),a,r,an.None,d)});var iM=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},vC=function(o,e){return function(t,i){e(t,i,o)}},Q1;const E5=Object.create({});var yc;let G0=(yc=class extends Rt{constructor(e,t,i,n){super(),this._editor=e,this._configurationService=t,this._languageFeaturesService=i,this._localToDispose=this._register(new Tt),this._decorationsIds=[],this._colorDatas=new Map,this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=new hA(this._editor),this._decoratorLimitReporter=new nM,this._colorDecorationClassRefs=this._register(new Tt),this._debounceInformation=n.for(i.colorProvider,"Document Colors",{min:Q1.RECOMPUTE_TIME}),this._register(e.onDidChangeModel(()=>{this._isColorDecoratorsEnabled=this.isEnabled(),this.updateColors()})),this._register(e.onDidChangeModelLanguage(()=>this.updateColors())),this._register(i.colorProvider.onDidChange(()=>this.updateColors())),this._register(e.onDidChangeConfiguration(s=>{const r=this._isColorDecoratorsEnabled;this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(148);const a=r!==this._isColorDecoratorsEnabled||s.hasChanged(21),d=s.hasChanged(148);(a||d)&&(this._isColorDecoratorsEnabled?this.updateColors():this.removeAllDecorations())})),this._timeoutTimer=null,this._computePromise=null,this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(148),this.updateColors()}isEnabled(){const e=this._editor.getModel();if(!e)return!1;const t=e.getLanguageId(),i=this._configurationService.getValue(t);if(i&&typeof i=="object"){const n=i.colorDecorators;if(n&&n.enable!==void 0&&!n.enable)return n.enable}return this._editor.getOption(20)}static get(e){return e.getContribution(this.ID)}dispose(){this.stop(),this.removeAllDecorations(),super.dispose()}updateColors(){if(this.stop(),!this._isColorDecoratorsEnabled)return;const e=this._editor.getModel();!e||!this._languageFeaturesService.colorProvider.has(e)||(this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{this._timeoutTimer||(this._timeoutTimer=new Dp,this._timeoutTimer.cancelAndSet(()=>{this._timeoutTimer=null,this.beginCompute()},this._debounceInformation.get(e)))})),this.beginCompute())}async beginCompute(){this._computePromise=qs(async e=>{const t=this._editor.getModel();if(!t)return[];const i=new Oo(!1),n=await _5(this._languageFeaturesService.colorProvider,t,e,this._isDefaultColorDecoratorsEnabled);return this._debounceInformation.update(t,i.elapsed()),n});try{const e=await this._computePromise;this.updateDecorations(e),this.updateColorDecorators(e),this._computePromise=null}catch(e){qn(e)}}stop(){this._timeoutTimer&&(this._timeoutTimer.cancel(),this._timeoutTimer=null),this._computePromise&&(this._computePromise.cancel(),this._computePromise=null),this._localToDispose.clear()}updateDecorations(e){const t=e.map(i=>({range:{startLineNumber:i.colorInfo.range.startLineNumber,startColumn:i.colorInfo.range.startColumn,endLineNumber:i.colorInfo.range.endLineNumber,endColumn:i.colorInfo.range.endColumn},options:vn.EMPTY}));this._editor.changeDecorations(i=>{this._decorationsIds=i.deltaDecorations(this._decorationsIds,t),this._colorDatas=new Map,this._decorationsIds.forEach((n,s)=>this._colorDatas.set(n,e[s]))})}updateColorDecorators(e){this._colorDecorationClassRefs.clear();const t=[],i=this._editor.getOption(21);for(let s=0;s<e.length&&t.length<i;s++){const{red:r,green:a,blue:d,alpha:u}=e[s].colorInfo.color,f=new M0(Math.round(r*255),Math.round(a*255),Math.round(d*255),u),g=`rgba(${f.r}, ${f.g}, ${f.b}, ${f.a})`,p=this._colorDecorationClassRefs.add(this._ruleFactory.createClassNameRef({backgroundColor:g}));t.push({range:{startLineNumber:e[s].colorInfo.range.startLineNumber,startColumn:e[s].colorInfo.range.startColumn,endLineNumber:e[s].colorInfo.range.endLineNumber,endColumn:e[s].colorInfo.range.endColumn},options:{description:"colorDetector",before:{content:lA,inlineClassName:`${p.className} colorpicker-color-decoration`,inlineClassNameAffectsLetterSpacing:!0,attachedData:E5}}})}const n=i<e.length?i:!1;this._decoratorLimitReporter.update(e.length,n),this._colorDecoratorIds.set(t)}removeAllDecorations(){this._editor.removeDecorations(this._decorationsIds),this._decorationsIds=[],this._colorDecoratorIds.clear(),this._colorDecorationClassRefs.clear()}getColorData(e){const t=this._editor.getModel();if(!t)return null;const i=t.getDecorationsInRange(Q.fromPositions(e,e)).filter(n=>this._colorDatas.has(n.id));return i.length===0?null:this._colorDatas.get(i[0].id)}isColorDecoration(e){return this._colorDecoratorIds.has(e)}},Q1=yc,yc.ID="editor.contrib.colorDetector",yc.RECOMPUTE_TIME=1e3,yc);G0=Q1=iM([vC(1,ss),vC(2,Fi),vC(3,gr)],G0);class nM{constructor(){this._onDidChange=new rn,this._computed=0,this._limited=!1}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}}hn(G0.ID,G0,1);class sM{get color(){return this._color}set color(e){this._color.equals(e)||(this._color=e,this._onDidChangeColor.fire(e))}get presentation(){return this.colorPresentations[this.presentationIndex]}get colorPresentations(){return this._colorPresentations}set colorPresentations(e){this._colorPresentations=e,this.presentationIndex>e.length-1&&(this.presentationIndex=0),this._onDidChangePresentation.fire(this.presentation)}constructor(e,t,i){this.presentationIndex=i,this._onColorFlushed=new rn,this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=new rn,this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=new rn,this.onDidChangePresentation=this._onDidChangePresentation.event,this.originalColor=e,this._color=e,this._colorPresentations=t}selectNextColorPresentation(){this.presentationIndex=(this.presentationIndex+1)%this.colorPresentations.length,this.flushColor(),this._onDidChangePresentation.fire(this.presentation)}guessColorPresentation(e,t){let i=-1;for(let n=0;n<this.colorPresentations.length;n++)if(t.toLowerCase()===this.colorPresentations[n].label){i=n;break}if(i===-1){const n=t.split("(")[0].toLowerCase();for(let s=0;s<this.colorPresentations.length;s++)if(this.colorPresentations[s].label.toLowerCase().startsWith(n)){i=s;break}}i!==-1&&i!==this.presentationIndex&&(this.presentationIndex=i,this._onDidChangePresentation.fire(this.presentation))}flushColor(){this._onColorFlushed.fire(this._color)}}const Ko=mi;class oM extends Rt{constructor(e,t,i,n=!1){super(),this.model=t,this.showingStandaloneColorPicker=n,this._closeButton=null,this._domNode=Ko(".colorpicker-header"),di(e,this._domNode),this._pickedColorNode=di(this._domNode,Ko(".picked-color")),di(this._pickedColorNode,Ko("span.codicon.codicon-color-mode")),this._pickedColorPresentation=di(this._pickedColorNode,document.createElement("span")),this._pickedColorPresentation.classList.add("picked-color-presentation");const s=S("clickToToggleColorOptions","Click to toggle color options (rgb/hsl/hex)");this._pickedColorNode.setAttribute("title",s),this._originalColorNode=di(this._domNode,Ko(".original-color")),this._originalColorNode.style.backgroundColor=xn.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=i.getColorTheme().getColor(LS)||xn.white,this._register(i.onDidColorThemeChange(r=>{this.backgroundColor=r.getColor(LS)||xn.white})),this._register(Bn(this._pickedColorNode,as.CLICK,()=>this.model.selectNextColorPresentation())),this._register(Bn(this._originalColorNode,as.CLICK,()=>{this.model.color=this.model.originalColor,this.model.flushColor()})),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this._register(t.onDidChangePresentation(this.onDidChangePresentation,this)),this._pickedColorNode.style.backgroundColor=xn.Format.CSS.format(t.color)||"",this._pickedColorNode.classList.toggle("light",t.color.rgba.a<.5?this.backgroundColor.isLighter():t.color.isLighter()),this.onDidChangeColor(this.model.color),this.showingStandaloneColorPicker&&(this._domNode.classList.add("standalone-colorpicker"),this._closeButton=this._register(new rM(this._domNode)))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(e){this._pickedColorNode.style.backgroundColor=xn.Format.CSS.format(e)||"",this._pickedColorNode.classList.toggle("light",e.rgba.a<.5?this.backgroundColor.isLighter():e.isLighter()),this.onDidChangePresentation()}onDidChangePresentation(){this._pickedColorPresentation.textContent=this.model.presentation?this.model.presentation.label:""}}class rM extends Rt{constructor(e){super(),this._onClicked=this._register(new rn),this.onClicked=this._onClicked.event,this._button=document.createElement("div"),this._button.classList.add("close-button"),di(e,this._button);const t=document.createElement("div");t.classList.add("close-button-inner-div"),di(this._button,t),di(t,Ko(".button"+Rn.asCSSSelector(ms("color-picker-close",Ki.close,S("closeIcon","Icon to close the color picker"))))).classList.add("close-icon"),this._register(Bn(this._button,as.CLICK,()=>{this._onClicked.fire()}))}}class aM extends Rt{constructor(e,t,i,n=!1){super(),this.model=t,this.pixelRatio=i,this._insertButton=null,this._domNode=Ko(".colorpicker-body"),di(e,this._domNode),this._saturationBox=new lM(this._domNode,this.model,this.pixelRatio),this._register(this._saturationBox),this._register(this._saturationBox.onDidChange(this.onDidSaturationValueChange,this)),this._register(this._saturationBox.onColorFlushed(this.flushColor,this)),this._opacityStrip=new cM(this._domNode,this.model,n),this._register(this._opacityStrip),this._register(this._opacityStrip.onDidChange(this.onDidOpacityChange,this)),this._register(this._opacityStrip.onColorFlushed(this.flushColor,this)),this._hueStrip=new dM(this._domNode,this.model,n),this._register(this._hueStrip),this._register(this._hueStrip.onDidChange(this.onDidHueChange,this)),this._register(this._hueStrip.onColorFlushed(this.flushColor,this)),n&&(this._insertButton=this._register(new uM(this._domNode)),this._domNode.classList.add("standalone-colorpicker"))}flushColor(){this.model.flushColor()}onDidSaturationValueChange({s:e,v:t}){const i=this.model.color.hsva;this.model.color=new xn(new Xx(i.h,e,t,i.a))}onDidOpacityChange(e){const t=this.model.color.hsva;this.model.color=new xn(new Xx(t.h,t.s,t.v,e))}onDidHueChange(e){const t=this.model.color.hsva,i=(1-e)*360;this.model.color=new xn(new Xx(i===360?0:i,t.s,t.v,t.a))}get domNode(){return this._domNode}get saturationBox(){return this._saturationBox}get enterButton(){return this._insertButton}layout(){this._saturationBox.layout(),this._opacityStrip.layout(),this._hueStrip.layout()}}class lM extends Rt{constructor(e,t,i){super(),this.model=t,this.pixelRatio=i,this._onDidChange=new rn,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new rn,this.onColorFlushed=this._onColorFlushed.event,this._domNode=Ko(".saturation-wrap"),di(e,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",di(this._domNode,this._canvas),this.selection=Ko(".saturation-selection"),di(this._domNode,this.selection),this.layout(),this._register(Bn(this._domNode,as.POINTER_DOWN,n=>this.onPointerDown(n))),this._register(this.model.onDidChangeColor(this.onDidChangeColor,this)),this.monitor=null}get domNode(){return this._domNode}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;this.monitor=this._register(new fA);const t=yo(this._domNode);e.target!==this.selection&&this.onDidChangePosition(e.offsetX,e.offsetY),this.monitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>this.onDidChangePosition(n.pageX-t.left,n.pageY-t.top),()=>null);const i=Bn(e.target.ownerDocument,as.POINTER_UP,()=>{this._onColorFlushed.fire(),i.dispose(),this.monitor&&(this.monitor.stopMonitoring(!0),this.monitor=null)},!0)}onDidChangePosition(e,t){const i=Math.max(0,Math.min(1,e/this.width)),n=Math.max(0,Math.min(1,1-t/this.height));this.paintSelection(i,n),this._onDidChange.fire({s:i,v:n})}layout(){this.width=this._domNode.offsetWidth,this.height=this._domNode.offsetHeight,this._canvas.width=this.width*this.pixelRatio,this._canvas.height=this.height*this.pixelRatio,this.paint();const e=this.model.color.hsva;this.paintSelection(e.s,e.v)}paint(){const e=this.model.color.hsva,t=new xn(new Xx(e.h,1,1,1)),i=this._canvas.getContext("2d"),n=i.createLinearGradient(0,0,this._canvas.width,0);n.addColorStop(0,"rgba(255, 255, 255, 1)"),n.addColorStop(.5,"rgba(255, 255, 255, 0.5)"),n.addColorStop(1,"rgba(255, 255, 255, 0)");const s=i.createLinearGradient(0,0,0,this._canvas.height);s.addColorStop(0,"rgba(0, 0, 0, 0)"),s.addColorStop(1,"rgba(0, 0, 0, 1)"),i.rect(0,0,this._canvas.width,this._canvas.height),i.fillStyle=xn.Format.CSS.format(t),i.fill(),i.fillStyle=n,i.fill(),i.fillStyle=s,i.fill()}paintSelection(e,t){this.selection.style.left=`${e*this.width}px`,this.selection.style.top=`${this.height-t*this.height}px`}onDidChangeColor(e){if(this.monitor&&this.monitor.isMonitoring())return;this.paint();const t=e.hsva;this.paintSelection(t.s,t.v)}}class y5 extends Rt{constructor(e,t,i=!1){super(),this.model=t,this._onDidChange=new rn,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new rn,this.onColorFlushed=this._onColorFlushed.event,i?(this.domNode=di(e,Ko(".standalone-strip")),this.overlay=di(this.domNode,Ko(".standalone-overlay"))):(this.domNode=di(e,Ko(".strip")),this.overlay=di(this.domNode,Ko(".overlay"))),this.slider=di(this.domNode,Ko(".slider")),this.slider.style.top="0px",this._register(Bn(this.domNode,as.POINTER_DOWN,n=>this.onPointerDown(n))),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this.layout()}layout(){this.height=this.domNode.offsetHeight-this.slider.offsetHeight;const e=this.getValue(this.model.color);this.updateSliderPosition(e)}onDidChangeColor(e){const t=this.getValue(e);this.updateSliderPosition(t)}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;const t=this._register(new fA),i=yo(this.domNode);this.domNode.classList.add("grabbing"),e.target!==this.slider&&this.onDidChangeTop(e.offsetY),t.startMonitoring(e.target,e.pointerId,e.buttons,s=>this.onDidChangeTop(s.pageY-i.top),()=>null);const n=Bn(e.target.ownerDocument,as.POINTER_UP,()=>{this._onColorFlushed.fire(),n.dispose(),t.stopMonitoring(!0),this.domNode.classList.remove("grabbing")},!0)}onDidChangeTop(e){const t=Math.max(0,Math.min(1,1-e/this.height));this.updateSliderPosition(t),this._onDidChange.fire(t)}updateSliderPosition(e){this.slider.style.top=`${(1-e)*this.height}px`}}class cM extends y5{constructor(e,t,i=!1){super(e,t,i),this.domNode.classList.add("opacity-strip"),this.onDidChangeColor(this.model.color)}onDidChangeColor(e){super.onDidChangeColor(e);const{r:t,g:i,b:n}=e.rgba,s=new xn(new M0(t,i,n,1)),r=new xn(new M0(t,i,n,0));this.overlay.style.background=`linear-gradient(to bottom, ${s} 0%, ${r} 100%)`}getValue(e){return e.hsva.a}}class dM extends y5{constructor(e,t,i=!1){super(e,t,i),this.domNode.classList.add("hue-strip")}getValue(e){return 1-e.hsva.h/360}}class uM extends Rt{constructor(e){super(),this._onClicked=this._register(new rn),this.onClicked=this._onClicked.event,this._button=di(e,document.createElement("button")),this._button.classList.add("insert-button"),this._button.textContent="Insert",this._register(Bn(this._button,as.CLICK,()=>{this._onClicked.fire()}))}get button(){return this._button}}class hM extends Fp{constructor(e,t,i,n,s=!1){super(),this.model=t,this.pixelRatio=i,this._register(m3.getInstance(Id(e)).onDidChange(()=>this.layout())),this._domNode=Ko(".colorpicker-widget"),e.appendChild(this._domNode),this.header=this._register(new oM(this._domNode,this.model,n,s)),this.body=this._register(new aM(this._domNode,this.model,this.pixelRatio,s))}layout(){this.body.layout()}get domNode(){return this._domNode}}class _C{constructor(e,t,i,n){this.priority=e,this.range=t,this.initialMousePosX=i,this.initialMousePosY=n,this.type=1}equals(e){return e.type===1&&this.range.equalsRange(e.range)}canAdoptVisibleHover(e,t){return e.type===1&&t.lineNumber===this.range.startLineNumber}}class am{constructor(e,t,i,n,s,r){this.priority=e,this.owner=t,this.range=i,this.initialMousePosX=n,this.initialMousePosY=s,this.supportsMarkerHover=r,this.type=2}equals(e){return e.type===2&&this.owner===e.owner}canAdoptVisibleHover(e,t){return e.type===2&&this.owner===e.owner}}class zu{constructor(e){this.renderedHoverParts=e}dispose(){for(const e of this.renderedHoverParts)e.dispose()}}const th=new class{constructor(){this._participants=[]}register(e){this._participants.push(e)}getAll(){return this._participants}};var w5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},S5=function(o,e){return function(t,i){e(t,i,o)}};class fM{constructor(e,t,i,n){this.owner=e,this.range=t,this.model=i,this.provider=n,this.forceShowAtRange=!0}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}let Gg=class{constructor(e,t){this._editor=e,this._themeService=t,this.hoverOrdinal=2}computeSync(e,t){return[]}computeAsync(e,t,i){return sa.fromPromise(this._computeAsync(e,t,i))}async _computeAsync(e,t,i){if(!this._editor.hasModel())return[];const n=G0.get(this._editor);if(!n)return[];for(const s of t){if(!n.isColorDecoration(s))continue;const r=n.getColorData(s.range.getStartPosition());if(r)return[await D5(this,this._editor.getModel(),r.colorInfo,r.provider)]}return[]}renderHoverParts(e,t){const i=A5(this,this._editor,this._themeService,t,e);if(!i)return new zu([]);this._colorPicker=i.colorPicker;const n={hoverPart:i.hoverPart,hoverElement:this._colorPicker.domNode,dispose(){i.disposables.dispose()}};return new zu([n])}handleResize(){var e;(e=this._colorPicker)==null||e.layout()}isColorPickerVisible(){return!!this._colorPicker}};Gg=w5([S5(1,Wr)],Gg);class gM{constructor(e,t,i,n){this.owner=e,this.range=t,this.model=i,this.provider=n}}let Kg=class{constructor(e,t){this._editor=e,this._themeService=t,this._color=null}async createColorHover(e,t,i){if(!this._editor.hasModel()||!G0.get(this._editor))return null;const s=await _5(i,this._editor.getModel(),an.None);let r=null,a=null;for(const g of s){const p=g.colorInfo;Q.containsRange(p.range,e.range)&&(r=p,a=g.provider)}const d=r??e,u=a??t,f=!!r;return{colorHover:await D5(this,this._editor.getModel(),d,u),foundInEditor:f}}async updateEditorModel(e){if(!this._editor.hasModel())return;const t=e.model;let i=new Q(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn);this._color&&(await lm(this._editor.getModel(),t,this._color,i,e),i=k5(this._editor,i,t))}renderHoverParts(e,t){return A5(this,this._editor,this._themeService,t,e)}set color(e){this._color=e}get color(){return this._color}};Kg=w5([S5(1,Wr)],Kg);async function D5(o,e,t,i){const n=e.getValueInRange(t.range),{red:s,green:r,blue:a,alpha:d}=t.color,u=new M0(Math.round(s*255),Math.round(r*255),Math.round(a*255),d),f=new xn(u),g=await b5(e,t,i,an.None),p=new sM(f,[],0);return p.colorPresentations=g||[],p.guessColorPresentation(f,n),o instanceof Gg?new fM(o,Q.lift(t.range),p,i):new gM(o,Q.lift(t.range),p,i)}function A5(o,e,t,i,n){if(i.length===0||!e.hasModel())return;if(n.setMinimumDimensions){const p=e.getOption(67)+8;n.setMinimumDimensions(new Zn(302,p))}const s=new Tt,r=i[0],a=e.getModel(),d=r.model,u=s.add(new hM(n.fragment,d,e.getOption(144),t,o instanceof Kg));let f=!1,g=new Q(r.range.startLineNumber,r.range.startColumn,r.range.endLineNumber,r.range.endColumn);if(o instanceof Kg){const p=r.model.color;o.color=p,lm(a,d,p,g,r),s.add(d.onColorFlushed(C=>{o.color=C}))}else s.add(d.onColorFlushed(async p=>{await lm(a,d,p,g,r),f=!0,g=k5(e,g,d)}));return s.add(d.onDidChangeColor(p=>{lm(a,d,p,g,r)})),s.add(e.onDidChangeModelContent(p=>{f?f=!1:(n.hide(),e.focus())})),{hoverPart:r,colorPicker:u,disposables:s}}function k5(o,e,t){const i=[],n=t.presentation.textEdit??{range:e,text:t.presentation.label,forceMoveMarkers:!1};i.push(n),t.presentation.additionalTextEdits&&i.push(...t.presentation.additionalTextEdits);const s=Q.lift(n.range),r=o.getModel()._setTrackedRange(null,s,3);return o.executeEdits("colorpicker",i),o.pushUndoStop(),o.getModel()._getTrackedRange(r)??s}async function lm(o,e,t,i,n){const s=await b5(o,{range:i,color:{red:t.rgba.r/255,green:t.rgba.g/255,blue:t.rgba.b/255,alpha:t.rgba.a}},n.provider,an.None);e.colorPresentations=s||[]}const B5="editor.action.showHover",pM="editor.action.showDefinitionPreviewHover",xM="editor.action.scrollUpHover",mM="editor.action.scrollDownHover",vM="editor.action.scrollLeftHover",_M="editor.action.scrollRightHover",bM="editor.action.pageUpHover",CM="editor.action.pageDownHover",EM="editor.action.goToTopHover",yM="editor.action.goToBottomHover",pb="editor.action.increaseHoverVerbosityLevel",wM=S({key:"increaseHoverVerbosityLevel",comment:["Label for action that will increase the hover verbosity level."]},"Increase Hover Verbosity Level"),xb="editor.action.decreaseHoverVerbosityLevel",SM=S({key:"decreaseHoverVerbosityLevel",comment:["Label for action that will decrease the hover verbosity level."]},"Decrease Hover Verbosity Level"),F5="editor.action.inlineSuggest.commit",L5="editor.action.inlineSuggest.showPrevious",I5="editor.action.inlineSuggest.showNext";var D9=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Br=function(o,e){return function(t,i){e(t,i,o)}},cm;let J1=class extends Rt{constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=Io(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).showToolbar==="always"),this.sessionPosition=void 0,this.position=Wn(this,n=>{var d,u;const s=(d=this.model.read(n))==null?void 0:d.primaryGhostText.read(n);if(!this.alwaysShowToolbar.read(n)||!s||s.parts.length===0)return this.sessionPosition=void 0,null;const r=s.parts[0].column;this.sessionPosition&&this.sessionPosition.lineNumber!==s.lineNumber&&(this.sessionPosition=void 0);const a=new Bi(s.lineNumber,Math.min(r,((u=this.sessionPosition)==null?void 0:u.column)??Number.MAX_SAFE_INTEGER));return this.sessionPosition=a,a}),this._register(Lp((n,s)=>{const r=this.model.read(n);if(!r||!this.alwaysShowToolbar.read(n))return;const a=mA((u,f)=>{const g=f.add(this.instantiationService.createInstance(K0,this.editor,!0,this.position,r.selectedInlineCompletionIndex,r.inlineCompletionsCount,r.activeCommands));return e.addContentWidget(g),f.add(is(()=>e.removeContentWidget(g))),f.add(rs(p=>{this.position.read(p)&&r.lastTriggerKind.read(p)!==_l.Explicit&&r.triggerExplicitly()})),g}),d=q_(this,(u,f)=>!!this.position.read(u)||!!f);s.add(rs(u=>{d.read(u)&&a.read(u)}))}))}};J1=D9([Br(2,sn)],J1);const DM=ms("inline-suggestion-hints-next",Ki.chevronRight,S("parameterHintsNextIcon","Icon for show next parameter hint.")),AM=ms("inline-suggestion-hints-previous",Ki.chevronLeft,S("parameterHintsPreviousIcon","Icon for show previous parameter hint."));var wc;let K0=(wc=class extends Rt{static get dropDownVisible(){return this._dropDownVisible}createCommandAction(e,t,i){const n=new R0(e,t,i,!0,()=>this._commandService.executeCommand(e)),s=this.keybindingService.lookupKeybinding(e,this._contextKeyService);let r=t;return s&&(r=S({key:"content",comment:["A label","A keybinding"]},"{0} ({1})",t,s.getLabel())),n.tooltip=r,n}constructor(e,t,i,n,s,r,a,d,u,f,g){super(),this.editor=e,this.withBorder=t,this._position=i,this._currentSuggestionIdx=n,this._suggestionCount=s,this._extraCommands=r,this._commandService=a,this.keybindingService=u,this._contextKeyService=f,this._menuService=g,this.id=`InlineSuggestionHintsContentWidget${cm.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Fr("div.inlineSuggestionsHints",{className:this.withBorder?".withBorder":""},[Fr("div@toolBar")]),this.previousAction=this.createCommandAction(L5,S("previous","Previous"),Rn.asClassName(AM)),this.availableSuggestionCountAction=new R0("inlineSuggestionHints.availableSuggestionCount","",void 0,!1),this.nextAction=this.createCommandAction(I5,S("next","Next"),Rn.asClassName(DM)),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(ni.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new Ms(()=>{this.availableSuggestionCountAction.label=""},100)),this.disableButtonsDebounced=this._register(new Ms(()=>{this.previousAction.enabled=this.nextAction.enabled=!1},100)),this.toolBar=this._register(d.createInstance(eE,this.nodes.toolBar,ni.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:p=>p.startsWith("primary")},actionViewItemProvider:(p,C)=>{if(p instanceof N0)return d.createInstance(BM,p,void 0);if(p===this.availableSuggestionCountAction){const b=new kM(void 0,p,{label:!0,icon:!1});return b.setClass("availableSuggestionCount"),b}},telemetrySource:"InlineSuggestionToolbar"})),this.toolBar.setPrependedPrimaryActions([this.previousAction,this.availableSuggestionCountAction,this.nextAction]),this._register(this.toolBar.onDidChangeDropdownVisibility(p=>{cm._dropDownVisible=p})),this._register(rs(p=>{this._position.read(p),this.editor.layoutContentWidget(this)})),this._register(rs(p=>{const C=this._suggestionCount.read(p),b=this._currentSuggestionIdx.read(p);C!==void 0?(this.clearAvailableSuggestionCountLabelDebounced.cancel(),this.availableSuggestionCountAction.label=`${b+1}/${C}`):this.clearAvailableSuggestionCountLabelDebounced.schedule(),C!==void 0&&C>1?(this.disableButtonsDebounced.cancel(),this.previousAction.enabled=this.nextAction.enabled=!0):this.disableButtonsDebounced.schedule()})),this._register(rs(p=>{const b=this._extraCommands.read(p).map(y=>({class:void 0,id:y.id,enabled:!0,tooltip:y.tooltip||"",label:y.title,run:w=>this._commandService.executeCommand(y.id)}));for(const[y,w]of this.inlineCompletionsActionsMenus.getActions())for(const A of w)A instanceof N0&&b.push(A);b.length>0&&b.unshift(new Ig),this.toolBar.setAdditionalSecondaryActions(b)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}},cm=wc,wc._dropDownVisible=!1,wc.id=0,wc);K0=cm=D9([Br(6,Vs),Br(7,sn),Br(8,As),Br(9,Fn),Br(10,Zu)],K0);class kM extends t1{constructor(){super(...arguments),this._className=void 0}setClass(e){this._className=e}render(e){super.render(e),this._className&&e.classList.add(this._className)}updateTooltip(){}}let BM=class extends gA{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=Fr("div.keybinding").root;this._register(new Iw(t,Pw,{disableTitle:!0,...pA})).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}updateTooltip(){}},eE=class extends xA{constructor(e,t,i,n,s,r,a,d,u){super(e,{resetMenu:t,...i},n,s,r,a,d,u),this.menuId=t,this.options2=i,this.menuService=n,this.contextKeyService=s,this.menu=this._store.add(this.menuService.createMenu(this.menuId,this.contextKeyService,{emitEventsForSubmenuChanges:!0})),this.additionalActions=[],this.prependedPrimaryActions=[],this._store.add(this.menu.onDidChange(()=>this.updateToolbar())),this.updateToolbar()}updateToolbar(){var i,n,s,r,a,d,u;const e=[],t=[];Hw(this.menu,(i=this.options2)==null?void 0:i.menuOptions,{primary:e,secondary:t},(s=(n=this.options2)==null?void 0:n.toolbarOptions)==null?void 0:s.primaryGroup,(a=(r=this.options2)==null?void 0:r.toolbarOptions)==null?void 0:a.shouldInlineSubmenu,(u=(d=this.options2)==null?void 0:d.toolbarOptions)==null?void 0:u.useSeparatorsInPrimaryActions),t.push(...this.additionalActions),e.unshift(...this.prependedPrimaryActions),this.setActions(e,t)}setPrependedPrimaryActions(e){ja(this.prependedPrimaryActions,e,(t,i)=>t===i)||(this.prependedPrimaryActions=e,this.updateToolbar())}setAdditionalSecondaryActions(e){ja(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};eE=D9([Br(3,Zu),Br(4,Fn),Br(5,af),Br(6,As),Br(7,Vs),Br(8,ua)],eE);function mb(o,e,t){const i=yo(o);return!(e<i.left||e>i.left+i.width||t<i.top||t>i.top+i.height)}let FM=class{constructor(e,t,i){this.value=e,this.isComplete=t,this.hasLoadingMessage=i}};class P5 extends Rt{constructor(e,t){super(),this._editor=e,this._computer=t,this._onResult=this._register(new rn),this.onResult=this._onResult.event,this._firstWaitScheduler=this._register(new Ms(()=>this._triggerAsyncComputation(),0)),this._secondWaitScheduler=this._register(new Ms(()=>this._triggerSyncComputation(),0)),this._loadingMessageScheduler=this._register(new Ms(()=>this._triggerLoadingMessage(),0)),this._state=0,this._asyncIterable=null,this._asyncIterableDone=!1,this._result=[]}dispose(){this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),super.dispose()}get _hoverTime(){return this._editor.getOption(60).delay}get _firstWaitTime(){return this._hoverTime/2}get _secondWaitTime(){return this._hoverTime-this._firstWaitTime}get _loadingMessageTime(){return 3*this._hoverTime}_setState(e,t=!0){this._state=e,t&&this._fireResult()}_triggerAsyncComputation(){this._setState(2),this._secondWaitScheduler.schedule(this._secondWaitTime),this._computer.computeAsync?(this._asyncIterableDone=!1,this._asyncIterable=v3(e=>this._computer.computeAsync(e)),(async()=>{try{for await(const e of this._asyncIterable)e&&(this._result.push(e),this._fireResult());this._asyncIterableDone=!0,(this._state===3||this._state===4)&&this._setState(0)}catch(e){qn(e)}})()):this._asyncIterableDone=!0}_triggerSyncComputation(){this._computer.computeSync&&(this._result=this._result.concat(this._computer.computeSync())),this._setState(this._asyncIterableDone?0:3)}_triggerLoadingMessage(){this._state===3&&this._setState(4)}_fireResult(){if(this._state===1||this._state===2)return;const e=this._state===0,t=this._state===4;this._onResult.fire(new FM(this._result.slice(0),e,t))}start(e){if(e===0)this._state===0&&(this._setState(1),this._firstWaitScheduler.schedule(this._firstWaitTime),this._loadingMessageScheduler.schedule(this._loadingMessageTime));else switch(this._state){case 0:this._triggerAsyncComputation(),this._secondWaitScheduler.cancel(),this._triggerSyncComputation();break;case 2:this._secondWaitScheduler.cancel(),this._triggerSyncComputation();break}}cancel(){this._firstWaitScheduler.cancel(),this._secondWaitScheduler.cancel(),this._loadingMessageScheduler.cancel(),this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),this._result=[],this._setState(0,!1)}}class A9{constructor(){this._onDidWillResize=new rn,this.onDidWillResize=this._onDidWillResize.event,this._onDidResize=new rn,this.onDidResize=this._onDidResize.event,this._sashListener=new Tt,this._size=new Zn(0,0),this._minSize=new Zn(0,0),this._maxSize=new Zn(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),this.domNode=document.createElement("div"),this._eastSash=new zh(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new zh(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new zh(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:IS.North}),this._southSash=new zh(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:IS.South}),this._northSash.orthogonalStartSash=this._westSash,this._northSash.orthogonalEndSash=this._eastSash,this._southSash.orthogonalStartSash=this._westSash,this._southSash.orthogonalEndSash=this._eastSash;let e,t=0,i=0;this._sashListener.add(Ts.any(this._northSash.onDidStart,this._eastSash.onDidStart,this._southSash.onDidStart,this._westSash.onDidStart)(()=>{e===void 0&&(this._onDidWillResize.fire(),e=this._size,t=0,i=0)})),this._sashListener.add(Ts.any(this._northSash.onDidEnd,this._eastSash.onDidEnd,this._southSash.onDidEnd,this._westSash.onDidEnd)(()=>{e!==void 0&&(e=void 0,t=0,i=0,this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(this._eastSash.onDidChange(n=>{e&&(i=n.currentX-n.startX,this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,east:!0}))})),this._sashListener.add(this._westSash.onDidChange(n=>{e&&(i=-(n.currentX-n.startX),this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,west:!0}))})),this._sashListener.add(this._northSash.onDidChange(n=>{e&&(t=-(n.currentY-n.startY),this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,north:!0}))})),this._sashListener.add(this._southSash.onDidChange(n=>{e&&(t=n.currentY-n.startY,this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,south:!0}))})),this._sashListener.add(Ts.any(this._eastSash.onDidReset,this._westSash.onDidReset)(n=>{this._preferredSize&&(this.layout(this._size.height,this._preferredSize.width),this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(Ts.any(this._northSash.onDidReset,this._southSash.onDidReset)(n=>{this._preferredSize&&(this.layout(this._preferredSize.height,this._size.width),this._onDidResize.fire({dimension:this._size,done:!0}))}))}dispose(){this._northSash.dispose(),this._southSash.dispose(),this._eastSash.dispose(),this._westSash.dispose(),this._sashListener.dispose(),this._onDidResize.dispose(),this._onDidWillResize.dispose(),this.domNode.remove()}enableSashes(e,t,i,n){this._northSash.state=e?3:0,this._eastSash.state=t?3:0,this._southSash.state=i?3:0,this._westSash.state=n?3:0}layout(e=this.size.height,t=this.size.width){const{height:i,width:n}=this._minSize,{height:s,width:r}=this._maxSize;e=Math.max(i,Math.min(s,e)),t=Math.max(n,Math.min(r,t));const a=new Zn(t,e);Zn.equals(a,this._size)||(this.domNode.style.height=e+"px",this.domNode.style.width=t+"px",this._size=a,this._northSash.layout(),this._eastSash.layout(),this._southSash.layout(),this._westSash.layout())}clearSashHoverState(){this._eastSash.clearSashHoverState(),this._westSash.clearSashHoverState(),this._northSash.clearSashHoverState(),this._southSash.clearSashHoverState()}get size(){return this._size}set maxSize(e){this._maxSize=e}get maxSize(){return this._maxSize}set minSize(e){this._minSize=e}get minSize(){return this._minSize}set preferredSize(e){this._preferredSize=e}get preferredSize(){return this._preferredSize}}const LM=30,IM=24;class PM extends Rt{constructor(e,t=new Zn(10,10)){super(),this._editor=e,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._resizableNode=this._register(new A9),this._contentPosition=null,this._isResizing=!1,this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=Zn.lift(t),this._resizableNode.layout(t.height,t.width),this._resizableNode.enableSashes(!0,!0,!0,!0),this._register(this._resizableNode.onDidResize(i=>{this._resize(new Zn(i.dimension.width,i.dimension.height)),i.done&&(this._isResizing=!1)})),this._register(this._resizableNode.onDidWillResize(()=>{this._isResizing=!0}))}get isResizing(){return this._isResizing}getDomNode(){return this._resizableNode.domNode}getPosition(){return this._contentPosition}get position(){var e;return(e=this._contentPosition)!=null&&e.position?Bi.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);return!t||!i?void 0:yo(t).top+i.top-LM}_availableVerticalSpaceBelow(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);if(!t||!i)return;const n=yo(t),s=Ip(t.ownerDocument.body),r=n.top+i.top+i.height;return s.height-r-IM}_findPositionPreference(e,t){const i=Math.min(this._availableVerticalSpaceBelow(t)??1/0,e),n=Math.min(this._availableVerticalSpaceAbove(t)??1/0,e),s=Math.min(Math.max(n,i),e),r=Math.min(e,s);let a;return this._editor.getOption(60).above?a=r<=n?1:2:a=r<=i?2:1,a===1?this._resizableNode.enableSashes(!0,!0,!1,!1):this._resizableNode.enableSashes(!1,!0,!0,!1),a}_resize(e){this._resizableNode.layout(e.height,e.width)}}var TM=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},bx=function(o,e){return function(t,i){e(t,i,o)}},Ea;const O8=30,MM=6;var Sc;let tE=(Sc=class extends PM{get isVisibleFromKeyboard(){var e;return((e=this._renderedHover)==null?void 0:e.source)===1}get isVisible(){return this._hoverVisibleKey.get()??!1}get isFocused(){return this._hoverFocusedKey.get()??!1}constructor(e,t,i,n,s){const r=e.getOption(67)+8,a=150,d=new Zn(a,r);super(e,d),this._configurationService=i,this._accessibilityService=n,this._keybindingService=s,this._hover=this._register(new vA),this._onDidResize=this._register(new rn),this.onDidResize=this._onDidResize.event,this._minimumSize=d,this._hoverVisibleKey=q.hoverVisible.bindTo(t),this._hoverFocusedKey=q.hoverFocused.bindTo(t),di(this._resizableNode.domNode,this._hover.containerDomNode),this._resizableNode.domNode.style.zIndex="50",this._register(this._editor.onDidLayoutChange(()=>{this.isVisible&&this._updateMaxDimensions()})),this._register(this._editor.onDidChangeConfiguration(f=>{f.hasChanged(50)&&this._updateFont()}));const u=this._register(I0(this._resizableNode.domNode));this._register(u.onDidFocus(()=>{this._hoverFocusedKey.set(!0)})),this._register(u.onDidBlur(()=>{this._hoverFocusedKey.set(!1)})),this._setRenderedHover(void 0),this._editor.addContentWidget(this)}dispose(){var e;super.dispose(),(e=this._renderedHover)==null||e.dispose(),this._editor.removeContentWidget(this)}getId(){return Ea.ID}static _applyDimensions(e,t,i){const n=typeof t=="number"?`${t}px`:t,s=typeof i=="number"?`${i}px`:i;e.style.width=n,e.style.height=s}_setContentsDomNodeDimensions(e,t){const i=this._hover.contentsDomNode;return Ea._applyDimensions(i,e,t)}_setContainerDomNodeDimensions(e,t){const i=this._hover.containerDomNode;return Ea._applyDimensions(i,e,t)}_setHoverWidgetDimensions(e,t){this._setContentsDomNodeDimensions(e,t),this._setContainerDomNodeDimensions(e,t),this._layoutContentWidget()}static _applyMaxDimensions(e,t,i){const n=typeof t=="number"?`${t}px`:t,s=typeof i=="number"?`${i}px`:i;e.style.maxWidth=n,e.style.maxHeight=s}_setHoverWidgetMaxDimensions(e,t){Ea._applyMaxDimensions(this._hover.contentsDomNode,e,t),Ea._applyMaxDimensions(this._hover.containerDomNode,e,t),this._hover.containerDomNode.style.setProperty("--vscode-hover-maxWidth",typeof e=="number"?`${e}px`:e),this._layoutContentWidget()}_setAdjustedHoverWidgetDimensions(e){this._setHoverWidgetMaxDimensions("none","none");const t=e.width,i=e.height;this._setHoverWidgetDimensions(t,i)}_updateResizableNodeMaxDimensions(){const e=this._findMaximumRenderingWidth()??1/0,t=this._findMaximumRenderingHeight()??1/0;this._resizableNode.maxSize=new Zn(e,t),this._setHoverWidgetMaxDimensions(e,t)}_resize(e){Ea._lastDimensions=new Zn(e.width,e.height),this._setAdjustedHoverWidgetDimensions(e),this._resizableNode.layout(e.height,e.width),this._updateResizableNodeMaxDimensions(),this._hover.scrollbar.scanDomNode(),this._editor.layoutContentWidget(this),this._onDidResize.fire()}_findAvailableSpaceVertically(){var t;const e=(t=this._renderedHover)==null?void 0:t.showAtPosition;if(e)return this._positionPreference===1?this._availableVerticalSpaceAbove(e):this._availableVerticalSpaceBelow(e)}_findMaximumRenderingHeight(){const e=this._findAvailableSpaceVertically();if(!e)return;let t=MM;return Array.from(this._hover.contentsDomNode.children).forEach(i=>{t+=i.clientHeight}),Math.min(e,t)}_isHoverTextOverflowing(){this._hover.containerDomNode.style.setProperty("--vscode-hover-whiteSpace","nowrap"),this._hover.containerDomNode.style.setProperty("--vscode-hover-sourceWhiteSpace","nowrap");const e=Array.from(this._hover.contentsDomNode.children).some(t=>t.scrollWidth>t.clientWidth);return this._hover.containerDomNode.style.removeProperty("--vscode-hover-whiteSpace"),this._hover.containerDomNode.style.removeProperty("--vscode-hover-sourceWhiteSpace"),e}_findMaximumRenderingWidth(){if(!this._editor||!this._editor.hasModel())return;const e=this._isHoverTextOverflowing(),t=typeof this._contentWidth>"u"?0:this._contentWidth-2;return e||this._hover.containerDomNode.clientWidth<t?Ip(this._hover.containerDomNode.ownerDocument.body).width-14:this._hover.containerDomNode.clientWidth+2}isMouseGettingCloser(e,t){if(!this._renderedHover)return!1;if(this._renderedHover.initialMousePosX===void 0||this._renderedHover.initialMousePosY===void 0)return this._renderedHover.initialMousePosX=e,this._renderedHover.initialMousePosY=t,!1;const i=yo(this.getDomNode());this._renderedHover.closestMouseDistance===void 0&&(this._renderedHover.closestMouseDistance=H8(this._renderedHover.initialMousePosX,this._renderedHover.initialMousePosY,i.left,i.top,i.width,i.height));const n=H8(e,t,i.left,i.top,i.width,i.height);return n>this._renderedHover.closestMouseDistance+4?!1:(this._renderedHover.closestMouseDistance=Math.min(this._renderedHover.closestMouseDistance,n),!0)}_setRenderedHover(e){var t;(t=this._renderedHover)==null||t.dispose(),this._renderedHover=e,this._hoverVisibleKey.set(!!e),this._hover.containerDomNode.classList.toggle("hidden",!e)}_updateFont(){const{fontSize:e,lineHeight:t}=this._editor.getOption(50),i=this._hover.contentsDomNode;i.style.fontSize=`${e}px`,i.style.lineHeight=`${t/e}`,Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(s=>this._editor.applyFontInfo(s))}_updateContent(e){const t=this._hover.contentsDomNode;t.style.paddingBottom="",t.textContent="",t.appendChild(e)}_layoutContentWidget(){this._editor.layoutContentWidget(this),this._hover.onContentsChanged()}_updateMaxDimensions(){const e=Math.max(this._editor.getLayoutInfo().height/4,250,Ea._lastDimensions.height),t=Math.max(this._editor.getLayoutInfo().width*.66,500,Ea._lastDimensions.width);this._setHoverWidgetMaxDimensions(t,e)}_render(e){this._setRenderedHover(e),this._updateFont(),this._updateContent(e.domNode),this._updateMaxDimensions(),this.onContentsChanged(),this._editor.render()}getPosition(){return this._renderedHover?{position:this._renderedHover.showAtPosition,secondaryPosition:this._renderedHover.showAtSecondaryPosition,positionAffinity:this._renderedHover.shouldAppearBeforeContent?3:void 0,preference:[this._positionPreference??1]}:null}show(e){var r;if(!this._editor||!this._editor.hasModel())return;this._render(e);const t=Vh(this._hover.containerDomNode),i=e.showAtPosition;this._positionPreference=this._findPositionPreference(t,i)??1,this.onContentsChanged(),e.shouldFocus&&this._hover.containerDomNode.focus(),this._onDidResize.fire();const s=this._hover.containerDomNode.ownerDocument.activeElement===this._hover.containerDomNode&&_3(this._configurationService.getValue("accessibility.verbosity.hover")===!0&&this._accessibilityService.isScreenReaderOptimized(),((r=this._keybindingService.lookupKeybinding("editor.action.accessibleView"))==null?void 0:r.getAriaLabel())??"");s&&(this._hover.contentsDomNode.ariaLabel=this._hover.contentsDomNode.textContent+", "+s)}hide(){if(!this._renderedHover)return;const e=this._renderedHover.shouldFocus||this._hoverFocusedKey.get();this._setRenderedHover(void 0),this._resizableNode.maxSize=new Zn(1/0,1/0),this._resizableNode.clearSashHoverState(),this._hoverFocusedKey.set(!1),this._editor.layoutContentWidget(this),e&&this._editor.focus()}_removeConstraintsRenderNormally(){const e=this._editor.getLayoutInfo();this._resizableNode.layout(e.height,e.width),this._setHoverWidgetDimensions("auto","auto")}setMinimumDimensions(e){this._minimumSize=new Zn(Math.max(this._minimumSize.width,e.width),Math.max(this._minimumSize.height,e.height)),this._updateMinimumWidth()}_updateMinimumWidth(){const e=typeof this._contentWidth>"u"?this._minimumSize.width:Math.min(this._contentWidth,this._minimumSize.width);this._resizableNode.minSize=new Zn(e,this._minimumSize.height)}onContentsChanged(){var n;this._removeConstraintsRenderNormally();const e=this._hover.containerDomNode;let t=Vh(e),i=yr(e);if(this._resizableNode.layout(t,i),this._setHoverWidgetDimensions(i,t),t=Vh(e),i=yr(e),this._contentWidth=i,this._updateMinimumWidth(),this._resizableNode.layout(t,i),(n=this._renderedHover)!=null&&n.showAtPosition){const s=Vh(this._hover.containerDomNode);this._positionPreference=this._findPositionPreference(s,this._renderedHover.showAtPosition)}this._layoutContentWidget()}focus(){this._hover.containerDomNode.focus()}scrollUp(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(50);this._hover.scrollbar.setScrollPosition({scrollTop:e-t.lineHeight})}scrollDown(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(50);this._hover.scrollbar.setScrollPosition({scrollTop:e+t.lineHeight})}scrollLeft(){const e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e-O8})}scrollRight(){const e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e+O8})}pageUp(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e-t})}pageDown(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e+t})}goToTop(){this._hover.scrollbar.setScrollPosition({scrollTop:0})}goToBottom(){this._hover.scrollbar.setScrollPosition({scrollTop:this._hover.scrollbar.getScrollDimensions().scrollHeight})}},Ea=Sc,Sc.ID="editor.contrib.resizableContentHoverWidget",Sc._lastDimensions=new Zn(0,0),Sc);tE=Ea=TM([bx(1,Fn),bx(2,ss),bx(3,G_),bx(4,As)],tE);function H8(o,e,t,i,n,s){const r=t+n/2,a=i+s/2,d=Math.max(Math.abs(o-r)-n/2,0),u=Math.max(Math.abs(e-a)-s/2,0);return Math.sqrt(d*d+u*u)}class qm{get anchor(){return this._anchor}set anchor(e){this._anchor=e}get shouldFocus(){return this._shouldFocus}set shouldFocus(e){this._shouldFocus=e}get source(){return this._source}set source(e){this._source=e}get insistOnKeepingHoverVisible(){return this._insistOnKeepingHoverVisible}set insistOnKeepingHoverVisible(e){this._insistOnKeepingHoverVisible=e}constructor(e,t){this._editor=e,this._participants=t,this._anchor=null,this._shouldFocus=!1,this._source=0,this._insistOnKeepingHoverVisible=!1}static _getLineDecorations(e,t){if(t.type!==1&&!t.supportsMarkerHover)return[];const i=e.getModel(),n=t.range.startLineNumber;if(n>i.getLineCount())return[];const s=i.getLineMaxColumn(n);return e.getLineDecorations(n).filter(r=>{if(r.options.isWholeLine)return!0;const a=r.range.startLineNumber===n?r.range.startColumn:1,d=r.range.endLineNumber===n?r.range.endColumn:s;if(r.options.showIfCollapsed){if(a>t.range.startColumn+1||t.range.endColumn-1>d)return!1}else if(a>t.range.startColumn||t.range.endColumn>d)return!1;return!0})}computeAsync(e){const t=this._anchor;if(!this._editor.hasModel()||!t)return sa.EMPTY;const i=qm._getLineDecorations(this._editor,t);return sa.merge(this._participants.map(n=>n.computeAsync?n.computeAsync(t,i,e):sa.EMPTY))}computeSync(){if(!this._editor.hasModel()||!this._anchor)return[];const e=qm._getLineDecorations(this._editor,this._anchor);let t=[];for(const i of this._participants)t=t.concat(i.computeSync(this._anchor,e));return yl(t)}}class T5{constructor(e,t,i){this.anchor=e,this.hoverParts=t,this.isComplete=i}filter(e){const t=this.hoverParts.filter(i=>i.isValidForHoverAnchor(e));return t.length===this.hoverParts.length?this:new RM(this,this.anchor,t,this.isComplete)}}class RM extends T5{constructor(e,t,i,n){super(t,i,n),this.original=e}filter(e){return this.original.filter(e)}}var NM=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},OM=function(o,e){return function(t,i){e(t,i,o)}};const W8=mi;let Gm=class extends Rt{get hasContent(){return this._hasContent}constructor(e){super(),this._keybindingService=e,this.actions=[],this._hasContent=!1,this.hoverElement=W8("div.hover-row.status-bar"),this.hoverElement.tabIndex=0,this.actionsElement=di(this.hoverElement,W8("div.actions"))}addAction(e){const t=this._keybindingService.lookupKeybinding(e.commandId),i=t?t.getLabel():null;this._hasContent=!0;const n=this._register(b3.render(this.actionsElement,e,i));return this.actions.push(n),n}append(e){const t=di(this.actionsElement,e);return this._hasContent=!0,t}};Gm=NM([OM(0,As)],Gm);class HM{constructor(e,t,i){this.provider=e,this.hover=t,this.ordinal=i}}async function WM(o,e,t,i,n){const s=await Promise.resolve(o.provideHover(t,i,n)).catch(bs);if(!(!s||!zM(s)))return new HM(o,s,e)}function k9(o,e,t,i,n=!1){const r=o.ordered(e,n).map((a,d)=>WM(a,d,e,t,i));return sa.fromPromises(r).coalesce()}function M5(o,e,t,i,n=!1){return k9(o,e,t,i,n).map(s=>s.hover).toPromise()}ko("_executeHoverProvider",(o,e,t)=>{const i=o.get(Fi);return M5(i.hoverProvider,e,t,an.None)});ko("_executeHoverProvider_recursive",(o,e,t)=>{const i=o.get(Fi);return M5(i.hoverProvider,e,t,an.None,!0)});function zM(o){const e=typeof o.range<"u",t=typeof o.contents<"u"&&o.contents&&o.contents.length>0;return e&&t}var VM=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},dd=function(o,e){return function(t,i){e(t,i,o)}};const Gh=mi,jM=ms("hover-increase-verbosity",Ki.add,S("increaseHoverVerbosity","Icon for increaseing hover verbosity.")),$M=ms("hover-decrease-verbosity",Ki.remove,S("decreaseHoverVerbosity","Icon for decreasing hover verbosity."));class Ir{constructor(e,t,i,n,s,r=void 0){this.owner=e,this.range=t,this.contents=i,this.isBeforeContent=n,this.ordinal=s,this.source=r}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}class R5{constructor(e,t,i){this.hover=e,this.hoverProvider=t,this.hoverPosition=i}supportsVerbosityAction(e){switch(e){case ur.Increase:return this.hover.canIncreaseVerbosity??!1;case ur.Decrease:return this.hover.canDecreaseVerbosity??!1}}}let Zg=class{constructor(e,t,i,n,s,r,a,d){this._editor=e,this._languageService=t,this._openerService=i,this._configurationService=n,this._languageFeaturesService=s,this._keybindingService=r,this._hoverService=a,this._commandService=d,this.hoverOrdinal=3}createLoadingMessage(e){return new Ir(this,e.range,[new lo().appendText(S("modesContentHover.loading","Loading..."))],!1,2e3)}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1)return[];const i=this._editor.getModel(),n=e.range.startLineNumber,s=i.getLineMaxColumn(n),r=[];let a=1e3;const d=i.getLineLength(n),u=i.getLanguageIdAtPosition(e.range.startLineNumber,e.range.startColumn),f=this._editor.getOption(118),g=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:u});let p=!1;f>=0&&d>f&&e.range.startColumn>=f&&(p=!0,r.push(new Ir(this,e.range,[{value:S("stopped rendering","Rendering paused for long line for performance reasons. This can be configured via `editor.stopRenderingLineAfter`.")}],!1,a++))),!p&&typeof g=="number"&&d>=g&&r.push(new Ir(this,e.range,[{value:S("too many characters","Tokenization is skipped for long lines for performance reasons. This can be configured via `editor.maxTokenizationLineLength`.")}],!1,a++));let C=!1;for(const b of t){const y=b.range.startLineNumber===n?b.range.startColumn:1,w=b.range.endLineNumber===n?b.range.endColumn:s,A=b.options.hoverMessage;if(!A||Pg(A))continue;b.options.beforeContentClassName&&(C=!0);const I=new Q(e.range.startLineNumber,y,e.range.startLineNumber,w);r.push(new Ir(this,I,_A(A),C,a++))}return r}computeAsync(e,t,i){if(!this._editor.hasModel()||e.type!==1)return sa.EMPTY;const n=this._editor.getModel(),s=this._languageFeaturesService.hoverProvider;return s.has(n)?this._getMarkdownHovers(s,n,e,i):sa.EMPTY}_getMarkdownHovers(e,t,i,n){const s=i.range.getStartPosition();return k9(e,t,s,n).filter(d=>!Pg(d.hover.contents)).map(d=>{const u=d.hover.range?Q.lift(d.hover.range):i.range,f=new R5(d.hover,d.provider,s);return new Ir(this,u,d.hover.contents,!1,d.ordinal,f)})}renderHoverParts(e,t){return this._renderedHoverParts=new UM(t,e.fragment,this,this._editor,this._languageService,this._openerService,this._commandService,this._keybindingService,this._hoverService,this._configurationService,e.onContentsChanged),this._renderedHoverParts}updateMarkdownHoverVerbosityLevel(e,t,i){var n;return Promise.resolve((n=this._renderedHoverParts)==null?void 0:n.updateMarkdownHoverPartVerbosityLevel(e,t,i))}};Zg=VM([dd(1,ha),dd(2,da),dd(3,ss),dd(4,Fi),dd(5,As),dd(6,Pp),dd(7,Vs)],Zg);class Cx{constructor(e,t,i){this.hoverPart=e,this.hoverElement=t,this.disposables=i}dispose(){this.disposables.dispose()}}class UM{constructor(e,t,i,n,s,r,a,d,u,f,g){this._hoverParticipant=i,this._editor=n,this._languageService=s,this._openerService=r,this._commandService=a,this._keybindingService=d,this._hoverService=u,this._configurationService=f,this._onFinishedRendering=g,this._ongoingHoverOperations=new Map,this._disposables=new Tt,this.renderedHoverParts=this._renderHoverParts(e,t,this._onFinishedRendering),this._disposables.add(is(()=>{this.renderedHoverParts.forEach(p=>{p.dispose()}),this._ongoingHoverOperations.forEach(p=>{p.tokenSource.dispose(!0)})}))}_renderHoverParts(e,t,i){return e.sort(Tp(n=>n.ordinal,K_)),e.map(n=>{const s=this._renderHoverPart(n,i);return t.appendChild(s.hoverElement),s})}_renderHoverPart(e,t){const i=this._renderMarkdownHover(e,t),n=i.hoverElement,s=e.source,r=new Tt;if(r.add(i),!s)return new Cx(e,n,r);const a=s.supportsVerbosityAction(ur.Increase),d=s.supportsVerbosityAction(ur.Decrease);if(!a&&!d)return new Cx(e,n,r);const u=Gh("div.verbosity-actions");return n.prepend(u),r.add(this._renderHoverExpansionAction(u,ur.Increase,a)),r.add(this._renderHoverExpansionAction(u,ur.Decrease,d)),new Cx(e,n,r)}_renderMarkdownHover(e,t){return N5(this._editor,e,this._languageService,this._openerService,t)}_renderHoverExpansionAction(e,t,i){const n=new Tt,s=t===ur.Increase,r=di(e,Gh(Rn.asCSSSelector(s?jM:$M)));r.tabIndex=0;const a=new C3("mouse",!1,{target:e,position:{hoverPosition:0}},this._configurationService,this._hoverService);if(n.add(this._hoverService.setupManagedHover(a,r,GM(this._keybindingService,t))),!i)return r.classList.add("disabled"),n;r.classList.add("enabled");const d=()=>this._commandService.executeCommand(t===ur.Increase?pb:xb);return n.add(new E3(r,d)),n.add(new y3(r,d,[3,10])),n}async updateMarkdownHoverPartVerbosityLevel(e,t,i=!0){const n=this._editor.getModel();if(!n)return;const s=this._getRenderedHoverPartAtIndex(t),r=s==null?void 0:s.hoverPart.source;if(!s||!(r!=null&&r.supportsVerbosityAction(e)))return;const a=await this._fetchHover(r,n,e);if(!a)return;const d=new R5(a,r.hoverProvider,r.hoverPosition),u=s.hoverPart,f=new Ir(this._hoverParticipant,u.range,a.contents,u.isBeforeContent,u.ordinal,d),g=this._renderHoverPart(f,this._onFinishedRendering);return this._replaceRenderedHoverPartAtIndex(t,g,f),i&&this._focusOnHoverPartWithIndex(t),{hoverPart:f,hoverElement:g.hoverElement}}async _fetchHover(e,t,i){let n=i===ur.Increase?1:-1;const s=e.hoverProvider,r=this._ongoingHoverOperations.get(s);r&&(r.tokenSource.cancel(),n+=r.verbosityDelta);const a=new Gs;this._ongoingHoverOperations.set(s,{verbosityDelta:n,tokenSource:a});const d={verbosityRequest:{verbosityDelta:n,previousHover:e.hover}};let u;try{u=await Promise.resolve(s.provideHover(t,e.hoverPosition,a.token,d))}catch(f){bs(f)}return a.dispose(),this._ongoingHoverOperations.delete(s),u}_replaceRenderedHoverPartAtIndex(e,t,i){if(e>=this.renderedHoverParts.length||e<0)return;const n=this.renderedHoverParts[e],s=n.hoverElement,r=t.hoverElement,a=Array.from(r.children);s.replaceChildren(...a);const d=new Cx(i,s,t.disposables);s.focus(),n.dispose(),this.renderedHoverParts[e]=d}_focusOnHoverPartWithIndex(e){this.renderedHoverParts[e].hoverElement.focus()}_getRenderedHoverPartAtIndex(e){return this.renderedHoverParts[e]}dispose(){this._disposables.dispose()}}function qM(o,e,t,i,n){e.sort(Tp(r=>r.ordinal,K_));const s=[];for(const r of e)s.push(N5(t,r,i,n,o.onContentsChanged));return new zu(s)}function N5(o,e,t,i,n){const s=new Tt,r=Gh("div.hover-row"),a=Gh("div.hover-row-contents");r.appendChild(a);const d=e.contents;for(const f of d){if(Pg(f))continue;const g=Gh("div.markdown-hover"),p=di(g,Gh("div.hover-contents")),C=s.add(new uf({editor:o},t,i));s.add(C.onDidRenderAsync(()=>{p.className="hover-contents code-hover-contents",n()}));const b=s.add(C.render(f));p.appendChild(b.element),a.appendChild(g)}return{hoverPart:e,hoverElement:r,dispose(){s.dispose()}}}function GM(o,e){switch(e){case ur.Increase:{const t=o.lookupKeybinding(pb);return t?S("increaseVerbosityWithKb","Increase Hover Verbosity ({0})",t.getLabel()):S("increaseVerbosity","Increase Hover Verbosity")}case ur.Decrease:{const t=o.lookupKeybinding(xb);return t?S("decreaseVerbosityWithKb","Decrease Hover Verbosity ({0})",t.getLabel()):S("decreaseVerbosity","Decrease Hover Verbosity")}}}function iE(o,e){return!!o[e]}class bC{constructor(e,t){this.target=e.target,this.isLeftClick=e.event.leftButton,this.isMiddleClick=e.event.middleButton,this.isRightClick=e.event.rightButton,this.hasTriggerModifier=iE(e.event,t.triggerModifier),this.hasSideBySideModifier=iE(e.event,t.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=e.event.detail<=1}}class z8{constructor(e,t){this.keyCodeIsTriggerKey=e.keyCode===t.triggerKey,this.keyCodeIsSideBySideKey=e.keyCode===t.triggerSideBySideKey,this.hasTriggerModifier=iE(e,t.triggerModifier)}}class Ex{constructor(e,t,i,n){this.triggerKey=e,this.triggerModifier=t,this.triggerSideBySideKey=i,this.triggerSideBySideModifier=n}equals(e){return this.triggerKey===e.triggerKey&&this.triggerModifier===e.triggerModifier&&this.triggerSideBySideKey===e.triggerSideBySideKey&&this.triggerSideBySideModifier===e.triggerSideBySideModifier}}function V8(o){return o==="altKey"?$a?new Ex(57,"metaKey",6,"altKey"):new Ex(5,"ctrlKey",6,"altKey"):$a?new Ex(6,"altKey",57,"metaKey"):new Ex(6,"altKey",5,"ctrlKey")}class vb extends Rt{constructor(e,t){super(),this._onMouseMoveOrRelevantKeyDown=this._register(new rn),this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event,this._onExecute=this._register(new rn),this.onExecute=this._onExecute.event,this._onCancel=this._register(new rn),this.onCancel=this._onCancel.event,this._editor=e,this._extractLineNumberFromMouseEvent=(t==null?void 0:t.extractLineNumberFromMouseEvent)??(i=>i.target.position?i.target.position.lineNumber:0),this._opts=V8(this._editor.getOption(78)),this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._register(this._editor.onDidChangeConfiguration(i=>{if(i.hasChanged(78)){const n=V8(this._editor.getOption(78));if(this._opts.equals(n))return;this._opts=n,this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._onCancel.fire()}})),this._register(this._editor.onMouseMove(i=>this._onEditorMouseMove(new bC(i,this._opts)))),this._register(this._editor.onMouseDown(i=>this._onEditorMouseDown(new bC(i,this._opts)))),this._register(this._editor.onMouseUp(i=>this._onEditorMouseUp(new bC(i,this._opts)))),this._register(this._editor.onKeyDown(i=>this._onEditorKeyDown(new z8(i,this._opts)))),this._register(this._editor.onKeyUp(i=>this._onEditorKeyUp(new z8(i,this._opts)))),this._register(this._editor.onMouseDrag(()=>this._resetHandler())),this._register(this._editor.onDidChangeCursorSelection(i=>this._onDidChangeCursorSelection(i))),this._register(this._editor.onDidChangeModel(i=>this._resetHandler())),this._register(this._editor.onDidChangeModelContent(()=>this._resetHandler())),this._register(this._editor.onDidScrollChange(i=>{(i.scrollTopChanged||i.scrollLeftChanged)&&this._resetHandler()}))}_onDidChangeCursorSelection(e){e.selection&&e.selection.startColumn!==e.selection.endColumn&&this._resetHandler()}_onEditorMouseMove(e){this._lastMouseMoveEvent=e,this._onMouseMoveOrRelevantKeyDown.fire([e,null])}_onEditorMouseDown(e){this._hasTriggerKeyOnMouseDown=e.hasTriggerModifier,this._lineNumberOnMouseDown=this._extractLineNumberFromMouseEvent(e)}_onEditorMouseUp(e){const t=this._extractLineNumberFromMouseEvent(e);this._hasTriggerKeyOnMouseDown&&this._lineNumberOnMouseDown&&this._lineNumberOnMouseDown===t&&this._onExecute.fire(e)}_onEditorKeyDown(e){this._lastMouseMoveEvent&&(e.keyCodeIsTriggerKey||e.keyCodeIsSideBySideKey&&e.hasTriggerModifier)?this._onMouseMoveOrRelevantKeyDown.fire([this._lastMouseMoveEvent,e]):e.hasTriggerModifier&&this._onCancel.fire()}_onEditorKeyUp(e){e.keyCodeIsTriggerKey&&this._onCancel.fire()}_resetHandler(){this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._onCancel.fire()}}class O5{constructor(e,t){this.range=e,this.direction=t}}class B9{constructor(e,t,i){this.hint=e,this.anchor=t,this.provider=i,this._isResolved=!1}with(e){const t=new B9(this.hint,e.anchor,this.provider);return t._isResolved=this._isResolved,t._currentResolve=this._currentResolve,t}async resolve(e){if(typeof this.provider.resolveInlayHint=="function"){if(this._currentResolve)return await this._currentResolve,e.isCancellationRequested?void 0:this.resolve(e);this._isResolved||(this._currentResolve=this._doResolve(e).finally(()=>this._currentResolve=void 0)),await this._currentResolve}}async _doResolve(e){try{const t=await Promise.resolve(this.provider.resolveInlayHint(this.hint,e));this.hint.tooltip=(t==null?void 0:t.tooltip)??this.hint.tooltip,this.hint.label=(t==null?void 0:t.label)??this.hint.label,this.hint.textEdits=(t==null?void 0:t.textEdits)??this.hint.textEdits,this._isResolved=!0}catch(t){bs(t),this._isResolved=!1}}}const i0=class i0{static async create(e,t,i,n){const s=[],r=e.ordered(t).reverse().map(a=>i.map(async d=>{try{const u=await a.provideInlayHints(t,d,n);(u!=null&&u.hints.length||a.onDidChangeInlayHints)&&s.push([u??i0._emptyInlayHintList,a])}catch(u){bs(u)}}));if(await Promise.all(r.flat()),n.isCancellationRequested||t.isDisposed())throw new V_;return new i0(i,s,t)}constructor(e,t,i){this._disposables=new Tt,this.ranges=e,this.provider=new Set;const n=[];for(const[s,r]of t){this._disposables.add(s),this.provider.add(r);for(const a of s.hints){const d=i.validatePosition(a.position);let u="before";const f=i0._getRangeAtPosition(i,d);let g;f.getStartPosition().isBefore(d)?(g=Q.fromPositions(f.getStartPosition(),d),u="after"):(g=Q.fromPositions(d,f.getEndPosition()),u="before"),n.push(new B9(a,new O5(g,u),r))}}this.items=n.sort((s,r)=>Bi.compare(s.hint.position,r.hint.position))}dispose(){this._disposables.dispose()}static _getRangeAtPosition(e,t){const i=t.lineNumber,n=e.getWordAtPosition(t);if(n)return new Q(i,n.startColumn,i,n.endColumn);e.tokenization.tokenizeIfCheap(i);const s=e.tokenization.getLineTokens(i),r=t.column-1,a=s.findTokenIndexAtOffset(r);let d=s.getStartOffset(a),u=s.getEndOffset(a);return u-d===1&&(d===r&&a>1?(d=s.getStartOffset(a-1),u=s.getEndOffset(a-1)):u===r&&a<s.getCount()-1&&(d=s.getStartOffset(a+1),u=s.getEndOffset(a+1))),new Q(i,d+1,i,u+1)}};i0._emptyInlayHintList=Object.freeze({dispose(){},hints:[]});let Km=i0;function KM(o){return jn.from({scheme:Co.command,path:o.id,query:o.arguments&&encodeURIComponent(JSON.stringify(o.arguments))}).toString()}var ZM=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},tl=function(o,e){return function(t,i){e(t,i,o)}};let Hr=class extends w3{constructor(e,t,i,n,s,r,a,d,u,f,g,p,C){super(e,{...n.getRawOptions(),overflowWidgetsDomNode:n.getOverflowWidgetsDomNode()},i,s,r,a,d,u,f,g,p,C),this._parentEditor=n,this._overwriteOptions=t,super.updateOptions(this._overwriteOptions),this._register(n.onDidChangeConfiguration(b=>this._onParentConfigurationChanged(b)))}getParentEditor(){return this._parentEditor}_onParentConfigurationChanged(e){super.updateOptions(this._parentEditor.getRawOptions()),super.updateOptions(this._overwriteOptions)}updateOptions(e){Ww(this._overwriteOptions,e,!0),super.updateOptions(this._overwriteOptions)}};Hr=ZM([tl(4,sn),tl(5,Cs),tl(6,Vs),tl(7,Fn),tl(8,Wr),tl(9,mo),tl(10,G_),tl(11,js),tl(12,Fi)],Hr);const j8=new xn(new M0(0,122,204)),XM={showArrow:!0,showFrame:!0,className:"",frameColor:j8,arrowColor:j8,keepEditorSelection:!1},YM="vs.editor.contrib.zoneWidget";class QM{constructor(e,t,i,n,s,r,a,d){this.id="",this.domNode=e,this.afterLineNumber=t,this.afterColumn=i,this.heightInLines=n,this.showInHiddenAreas=a,this.ordinal=d,this._onDomNodeTop=s,this._onComputedHeight=r}onDomNodeTop(e){this._onDomNodeTop(e)}onComputedHeight(e){this._onComputedHeight(e)}}class JM{constructor(e,t){this._id=e,this._domNode=t}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}}const e_=class e_{constructor(e){this._editor=e,this._ruleName=e_._IdGenerator.nextId(),this._decorations=this._editor.createDecorationsCollection(),this._color=null,this._height=-1}dispose(){this.hide(),PS(this._ruleName)}set color(e){this._color!==e&&(this._color=e,this._updateStyle())}set height(e){this._height!==e&&(this._height=e,this._updateStyle())}_updateStyle(){PS(this._ruleName),A3(`.monaco-editor ${this._ruleName}`,`border-style: solid; border-color: transparent; border-bottom-color: ${this._color}; border-width: ${this._height}px; bottom: -${this._height}px !important; margin-left: -${this._height}px; `)}show(e){e.column===1&&(e={lineNumber:e.lineNumber,column:2}),this._decorations.set([{range:Q.fromPositions(e),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}};e_._IdGenerator=new D3(".arrow-decoration-");let nE=e_;class eR{constructor(e,t={}){this._arrow=null,this._overlayWidget=null,this._resizeSash=null,this._viewZone=null,this._disposables=new Tt,this.container=null,this._isShowing=!1,this.editor=e,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=S3(t),Ww(this.options,XM,!1),this.domNode=document.createElement("div"),this.options.isAccessible||(this.domNode.setAttribute("aria-hidden","true"),this.domNode.setAttribute("role","presentation")),this._disposables.add(this.editor.onDidLayoutChange(i=>{const n=this._getWidth(i);this.domNode.style.width=n+"px",this.domNode.style.left=this._getLeft(i)+"px",this._onWidth(n)}))}dispose(){this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this._viewZone&&this.editor.changeViewZones(e=>{this._viewZone&&e.removeZone(this._viewZone.id),this._viewZone=null}),this._positionMarkerId.clear(),this._disposables.dispose()}create(){this.domNode.classList.add("zone-widget"),this.options.className&&this.domNode.classList.add(this.options.className),this.container=document.createElement("div"),this.container.classList.add("zone-widget-container"),this.domNode.appendChild(this.container),this.options.showArrow&&(this._arrow=new nE(this.editor),this._disposables.add(this._arrow)),this._fillContainer(this.container),this._initSash(),this._applyStyles()}style(e){e.frameColor&&(this.options.frameColor=e.frameColor),e.arrowColor&&(this.options.arrowColor=e.arrowColor),this._applyStyles()}_applyStyles(){if(this.container&&this.options.frameColor){const e=this.options.frameColor.toString();this.container.style.borderTopColor=e,this.container.style.borderBottomColor=e}if(this._arrow&&this.options.arrowColor){const e=this.options.arrowColor.toString();this._arrow.color=e}}_getWidth(e){return e.width-e.minimap.minimapWidth-e.verticalScrollbarWidth}_getLeft(e){return e.minimap.minimapWidth>0&&e.minimap.minimapLeft===0?e.minimap.minimapWidth:0}_onViewZoneTop(e){this.domNode.style.top=e+"px"}_onViewZoneHeight(e){var t;if(this.domNode.style.height=`${e}px`,this.container){const i=e-this._decoratingElementsHeight();this.container.style.height=`${i}px`;const n=this.editor.getLayoutInfo();this._doLayout(i,this._getWidth(n))}(t=this._resizeSash)==null||t.layout()}get position(){const e=this._positionMarkerId.getRange(0);if(e)return e.getStartPosition()}show(e,t){const i=Q.isIRange(e)?Q.lift(e):Q.fromPositions(e);this._isShowing=!0,this._showImpl(i,t),this._isShowing=!1,this._positionMarkerId.set([{range:i,options:vn.EMPTY}])}hide(){var e;this._viewZone&&(this.editor.changeViewZones(t=>{this._viewZone&&t.removeZone(this._viewZone.id)}),this._viewZone=null),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),(e=this._arrow)==null||e.hide(),this._positionMarkerId.clear()}_decoratingElementsHeight(){const e=this.editor.getOption(67);let t=0;if(this.options.showArrow){const i=Math.round(e/3);t+=2*i}if(this.options.showFrame){const i=Math.round(e/9);t+=2*i}return t}_showImpl(e,t){const i=e.getStartPosition(),n=this.editor.getLayoutInfo(),s=this._getWidth(n);this.domNode.style.width=`${s}px`,this.domNode.style.left=this._getLeft(n)+"px";const r=document.createElement("div");r.style.overflow="hidden";const a=this.editor.getOption(67);if(!this.options.allowUnlimitedHeight){const p=Math.max(12,this.editor.getLayoutInfo().height/a*.8);t=Math.min(t,p)}let d=0,u=0;if(this._arrow&&this.options.showArrow&&(d=Math.round(a/3),this._arrow.height=d,this._arrow.show(i)),this.options.showFrame&&(u=Math.round(a/9)),this.editor.changeViewZones(p=>{this._viewZone&&p.removeZone(this._viewZone.id),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this.domNode.style.top="-1000px",this._viewZone=new QM(r,i.lineNumber,i.column,t,C=>this._onViewZoneTop(C),C=>this._onViewZoneHeight(C),this.options.showInHiddenAreas,this.options.ordinal),this._viewZone.id=p.addZone(this._viewZone),this._overlayWidget=new JM(YM+this._viewZone.id,this.domNode),this.editor.addOverlayWidget(this._overlayWidget)}),this.container&&this.options.showFrame){const p=this.options.frameWidth?this.options.frameWidth:u;this.container.style.borderTopWidth=p+"px",this.container.style.borderBottomWidth=p+"px"}const f=t*a-this._decoratingElementsHeight();this.container&&(this.container.style.top=d+"px",this.container.style.height=f+"px",this.container.style.overflow="hidden"),this._doLayout(f,s),this.options.keepEditorSelection||this.editor.setSelection(e);const g=this.editor.getModel();if(g){const p=g.validateRange(new Q(e.startLineNumber,1,e.endLineNumber+1,1));this.revealRange(p,p.startLineNumber===g.getLineCount())}}revealRange(e,t){t?this.editor.revealLineNearTop(e.endLineNumber,0):this.editor.revealRange(e,0)}setCssClass(e,t){this.container&&(t&&this.container.classList.remove(t),this.container.classList.add(e))}_onWidth(e){}_doLayout(e,t){}_relayout(e){this._viewZone&&this._viewZone.heightInLines!==e&&this.editor.changeViewZones(t=>{this._viewZone&&(this._viewZone.heightInLines=e,t.layoutZone(this._viewZone.id))})}_initSash(){if(this._resizeSash)return;this._resizeSash=this._disposables.add(new zh(this.domNode,this,{orientation:1})),this.options.isResizeable||(this._resizeSash.state=0);let e;this._disposables.add(this._resizeSash.onDidStart(t=>{this._viewZone&&(e={startY:t.startY,heightInLines:this._viewZone.heightInLines})})),this._disposables.add(this._resizeSash.onDidEnd(()=>{e=void 0})),this._disposables.add(this._resizeSash.onDidChange(t=>{if(e){const i=(t.currentY-e.startY)/this.editor.getOption(67),n=i<0?Math.ceil(i):Math.floor(i),s=e.heightInLines+n;s>5&&s<35&&this._relayout(s)}}))}getHorizontalSashLeft(){return 0}getHorizontalSashTop(){return(this.domNode.style.height===null?0:parseInt(this.domNode.style.height))-this._decoratingElementsHeight()/2}getHorizontalSashWidth(){const e=this.editor.getLayoutInfo();return e.width-e.minimap.minimapWidth}}var H5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},W5=function(o,e){return function(t,i){e(t,i,o)}};const z5=Ml("IPeekViewService");Rl(z5,class{constructor(){this._widgets=new Map}addExclusiveWidget(o,e){const t=this._widgets.get(o);t&&(t.listener.dispose(),t.widget.dispose());const i=()=>{const n=this._widgets.get(o);n&&n.widget===e&&(n.listener.dispose(),this._widgets.delete(o))};this._widgets.set(o,{widget:e,listener:e.onDidClose(i)})}},1);var wo;(function(o){o.inPeekEditor=new En("inReferenceSearchEditor",!0,S("inReferenceSearchEditor","Whether the current code editor is embedded inside peek")),o.notInPeekEditor=o.inPeekEditor.toNegated()})(wo||(wo={}));var C0;let Zm=(C0=class{constructor(e,t){e instanceof Hr&&wo.inPeekEditor.bindTo(t)}dispose(){}},C0.ID="editor.contrib.referenceController",C0);Zm=H5([W5(1,Fn)],Zm);hn(Zm.ID,Zm,0);function tR(o){const e=o.get(Cs).getFocusedCodeEditor();return e instanceof Hr?e.getParentEditor():e}const iR={headerBackgroundColor:xn.white,primaryHeadingColor:xn.fromHex("#333333"),secondaryHeadingColor:xn.fromHex("#6c6c6cb3")};let Xm=class extends eR{constructor(e,t,i){super(e,t),this.instantiationService=i,this._onDidClose=new rn,this.onDidClose=this._onDidClose.event,Ww(this.options,iR,!1)}dispose(){this.disposed||(this.disposed=!0,super.dispose(),this._onDidClose.fire(this))}style(e){const t=this.options;e.headerBackgroundColor&&(t.headerBackgroundColor=e.headerBackgroundColor),e.primaryHeadingColor&&(t.primaryHeadingColor=e.primaryHeadingColor),e.secondaryHeadingColor&&(t.secondaryHeadingColor=e.secondaryHeadingColor),super.style(e)}_applyStyles(){super._applyStyles();const e=this.options;this._headElement&&e.headerBackgroundColor&&(this._headElement.style.backgroundColor=e.headerBackgroundColor.toString()),this._primaryHeading&&e.primaryHeadingColor&&(this._primaryHeading.style.color=e.primaryHeadingColor.toString()),this._secondaryHeading&&e.secondaryHeadingColor&&(this._secondaryHeading.style.color=e.secondaryHeadingColor.toString()),this._bodyElement&&e.frameColor&&(this._bodyElement.style.borderColor=e.frameColor.toString())}_fillContainer(e){this.setCssClass("peekview-widget"),this._headElement=mi(".head"),this._bodyElement=mi(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),e.appendChild(this._headElement),e.appendChild(this._bodyElement)}_fillHead(e,t){this._titleElement=mi(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),Sl(this._titleElement,"click",s=>this._onTitleClick(s))),di(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=mi("span.filename"),this._secondaryHeading=mi("span.dirname"),this._metaHeading=mi("span.meta"),di(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);const i=mi(".peekview-actions");di(this._headElement,i);const n=this._getActionBarOptions();this._actionbarWidget=new Bg(i,n),this._disposables.add(this._actionbarWidget),t||this._actionbarWidget.push(new R0("peekview.close",S("label.close","Close"),Rn.asClassName(Ki.close),!0,()=>(this.dispose(),Promise.resolve())),{label:!1,icon:!0})}_fillTitleIcon(e){}_getActionBarOptions(){return{actionViewItemProvider:k3.bind(void 0,this.instantiationService),orientation:0}}_onTitleClick(e){}setTitle(e,t){this._primaryHeading&&this._secondaryHeading&&(this._primaryHeading.innerText=e,this._primaryHeading.setAttribute("title",e),t?this._secondaryHeading.innerText=t:Wa(this._secondaryHeading))}setMetaTitle(e){this._metaHeading&&(e?(this._metaHeading.innerText=e,Lr(this._metaHeading)):Uo(this._metaHeading))}_doLayout(e,t){if(!this._isShowing&&e<0){this.dispose();return}const i=Math.ceil(this.editor.getOption(67)*1.2),n=Math.round(e-(i+2));this._doLayoutHead(i,t),this._doLayoutBody(n,t)}_doLayoutHead(e,t){this._headElement&&(this._headElement.style.height=`${e}px`,this._headElement.style.lineHeight=this._headElement.style.height)}_doLayoutBody(e,t){this._bodyElement&&(this._bodyElement.style.height=`${e}px`)}};Xm=H5([W5(2,sn)],Xm);const nR=vi("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:xn.black,hcLight:xn.white},S("peekViewTitleBackground","Background color of the peek view title area.")),V5=vi("peekViewTitleLabel.foreground",{dark:xn.white,light:xn.black,hcDark:xn.white,hcLight:Mp},S("peekViewTitleForeground","Color of the peek view title.")),j5=vi("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},S("peekViewTitleInfoForeground","Color of the peek view title info.")),sR=vi("peekView.border",{dark:i1,light:i1,hcDark:wl,hcLight:wl},S("peekViewBorder","Color of the peek view borders and arrow.")),oR=vi("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:xn.black,hcLight:xn.white},S("peekViewResultsBackground","Background color of the peek view result list."));vi("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:xn.white,hcLight:Mp},S("peekViewResultsMatchForeground","Foreground color for line nodes in the peek view result list."));vi("peekViewResult.fileForeground",{dark:xn.white,light:"#1E1E1E",hcDark:xn.white,hcLight:Mp},S("peekViewResultsFileForeground","Foreground color for file nodes in the peek view result list."));vi("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},S("peekViewResultsSelectionBackground","Background color of the selected entry in the peek view result list."));vi("peekViewResult.selectionForeground",{dark:xn.white,light:"#6C6C6C",hcDark:xn.white,hcLight:Mp},S("peekViewResultsSelectionForeground","Foreground color of the selected entry in the peek view result list."));const $5=vi("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:xn.black,hcLight:xn.white},S("peekViewEditorBackground","Background color of the peek view editor."));vi("peekViewEditorGutter.background",$5,S("peekViewEditorGutterBackground","Background color of the gutter in the peek view editor."));vi("peekViewEditorStickyScroll.background",$5,S("peekViewEditorStickScrollBackground","Background color of sticky scroll in the peek view editor."));vi("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},S("peekViewResultsMatchHighlight","Match highlight color in the peek view result list."));vi("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},S("peekViewEditorMatchHighlight","Match highlight color in the peek view editor."));vi("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:Bu,hcLight:Bu},S("peekViewEditorMatchHighlightBorder","Match highlight border in the peek view editor."));class Vc{constructor(e,t,i,n){this.isProviderFirst=e,this.parent=t,this.link=i,this._rangeCallback=n,this.id=B3.nextId()}get uri(){return this.link.uri}get range(){return this._range??this.link.targetSelectionRange??this.link.range}set range(e){this._range=e,this._rangeCallback(this)}get ariaMessage(){var t;const e=(t=this.parent.getPreview(this))==null?void 0:t.preview(this.range);return e?S({key:"aria.oneReference.preview",comment:["Placeholders are: 0: filename, 1:line number, 2: column number, 3: preview snippet of source code"]},"{0} in {1} on line {2} at column {3}",e.value,Ua(this.uri),this.range.startLineNumber,this.range.startColumn):S("aria.oneReference","in {0} on line {1} at column {2}",Ua(this.uri),this.range.startLineNumber,this.range.startColumn)}}class rR{constructor(e){this._modelReference=e}dispose(){this._modelReference.dispose()}preview(e,t=8){const i=this._modelReference.object.textEditorModel;if(!i)return;const{startLineNumber:n,startColumn:s,endLineNumber:r,endColumn:a}=e,d=i.getWordUntilPosition({lineNumber:n,column:s-t}),u=new Q(n,d.startColumn,n,s),f=new Q(r,a,r,1073741824),g=i.getValueInRange(u).replace(/^\s+/,""),p=i.getValueInRange(e),C=i.getValueInRange(f).replace(/\s+$/,"");return{value:g+p+C,highlight:{start:g.length,end:g.length+p.length}}}}class Xg{constructor(e,t){this.parent=e,this.uri=t,this.children=[],this._previews=new Nc}dispose(){uo(this._previews.values()),this._previews.clear()}getPreview(e){return this._previews.get(e.uri)}get ariaMessage(){const e=this.children.length;return e===1?S("aria.fileReferences.1","1 symbol in {0}, full path {1}",Ua(this.uri),this.uri.fsPath):S("aria.fileReferences.N","{0} symbols in {1}, full path {2}",e,Ua(this.uri),this.uri.fsPath)}async resolve(e){if(this._previews.size!==0)return this;for(const t of this.children)if(!this._previews.has(t.uri))try{const i=await e.createModelReference(t.uri);this._previews.set(t.uri,new rR(i))}catch(i){qn(i)}return this}}class Ro{constructor(e,t){this.groups=[],this.references=[],this._onDidChangeReferenceRange=new rn,this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event,this._links=e,this._title=t;const[i]=e;e.sort(Ro._compareReferences);let n;for(const s of e)if((!n||!TS.isEqual(n.uri,s.uri,!0))&&(n=new Xg(this,s.uri),this.groups.push(n)),n.children.length===0||Ro._compareReferences(s,n.children[n.children.length-1])!==0){const r=new Vc(i===s,n,s,a=>this._onDidChangeReferenceRange.fire(a));this.references.push(r),n.children.push(r)}}dispose(){uo(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new Ro(this._links,this._title)}get title(){return this._title}get isEmpty(){return this.groups.length===0}get ariaMessage(){return this.isEmpty?S("aria.result.0","No results found"):this.references.length===1?S("aria.result.1","Found 1 symbol in {0}",this.references[0].uri.fsPath):this.groups.length===1?S("aria.result.n1","Found {0} symbols in {1}",this.references.length,this.groups[0].uri.fsPath):S("aria.result.nm","Found {0} symbols in {1} files",this.references.length,this.groups.length)}nextOrPreviousReference(e,t){const{parent:i}=e;let n=i.children.indexOf(e);const s=i.children.length,r=i.parent.groups.length;return r===1||t&&n+1<s||!t&&n>0?(t?n=(n+1)%s:n=(n+s-1)%s,i.children[n]):(n=i.parent.groups.indexOf(i),t?(n=(n+1)%r,i.parent.groups[n].children[0]):(n=(n+r-1)%r,i.parent.groups[n].children[i.parent.groups[n].children.length-1]))}nearestReference(e,t){const i=this.references.map((n,s)=>({idx:s,prefixLen:Rp(n.uri.toString(),e.toString()),offsetDist:Math.abs(n.range.startLineNumber-t.lineNumber)*100+Math.abs(n.range.startColumn-t.column)})).sort((n,s)=>n.prefixLen>s.prefixLen?-1:n.prefixLen<s.prefixLen?1:n.offsetDist<s.offsetDist?-1:n.offsetDist>s.offsetDist?1:0)[0];if(i)return this.references[i.idx]}referenceAt(e,t){for(const i of this.references)if(i.uri.toString()===e.toString()&&Q.containsPosition(i.range,t))return i}firstReference(){for(const e of this.references)if(e.isProviderFirst)return e;return this.references[0]}static _compareReferences(e,t){return TS.compare(e.uri,t.uri)||Q.compareRangesUsingStarts(e.range,t.range)}}var _b=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},bb=function(o,e){return function(t,i){e(t,i,o)}},sE;let oE=class{constructor(e){this._resolverService=e}hasChildren(e){return e instanceof Ro||e instanceof Xg}getChildren(e){if(e instanceof Ro)return e.groups;if(e instanceof Xg)return e.resolve(this._resolverService).then(t=>t.children);throw new Error("bad tree")}};oE=_b([bb(0,fa)],oE);class aR{getHeight(){return 23}getTemplateId(e){return e instanceof Xg?Ym.id:Qm.id}}let rE=class{constructor(e){this._keybindingService=e}getKeyboardNavigationLabel(e){var t;if(e instanceof Vc){const i=(t=e.parent.getPreview(e))==null?void 0:t.preview(e.range);if(i)return i.value}return Ua(e.uri)}};rE=_b([bb(0,As)],rE);class lR{getId(e){return e instanceof Vc?e.id:e.uri}}let aE=class extends Rt{constructor(e,t){super(),this._labelService=t;const i=document.createElement("div");i.classList.add("reference-file"),this.file=this._register(new bA(i,{supportHighlights:!0})),this.badge=new F3(di(i,mi(".count")),{},L3),e.appendChild(i)}set(e,t){const i=zw(e.uri);this.file.setLabel(this._labelService.getUriBasenameLabel(e.uri),this._labelService.getUriLabel(i,{relative:!0}),{title:this._labelService.getUriLabel(e.uri),matches:t});const n=e.children.length;this.badge.setCount(n),n>1?this.badge.setTitleFormat(S("referencesCount","{0} references",n)):this.badge.setTitleFormat(S("referenceCount","{0} reference",n))}};aE=_b([bb(1,Tg)],aE);var qd;let Ym=(qd=class{constructor(e){this._instantiationService=e,this.templateId=sE.id}renderTemplate(e){return this._instantiationService.createInstance(aE,e)}renderElement(e,t,i){i.set(e.element,Z_(e.filterData))}disposeTemplate(e){e.dispose()}},sE=qd,qd.id="FileReferencesRenderer",qd);Ym=sE=_b([bb(0,sn)],Ym);class cR extends Rt{constructor(e){super(),this.label=this._register(new I3(e))}set(e,t){var n;const i=(n=e.parent.getPreview(e))==null?void 0:n.preview(e.range);if(!i||!i.value)this.label.set(`${Ua(e.uri)}:${e.range.startLineNumber+1}:${e.range.startColumn+1}`);else{const{value:s,highlight:r}=i;t&&!Mg.isDefault(t)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(s,Z_(t))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(s,[r]))}}}const t_=class t_{constructor(){this.templateId=t_.id}renderTemplate(e){return new cR(e)}renderElement(e,t,i){i.set(e.element,e.filterData)}disposeTemplate(e){e.dispose()}};t_.id="OneReferenceRenderer";let Qm=t_;class dR{getWidgetAriaLabel(){return S("treeAriaLabel","References")}getAriaLabel(e){return e.ariaMessage}}var uR=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ch=function(o,e){return function(t,i){e(t,i,o)}};const i_=class i_{constructor(e,t){this._editor=e,this._model=t,this._decorations=new Map,this._decorationIgnoreSet=new Set,this._callOnDispose=new Tt,this._callOnModelChange=new Tt,this._callOnDispose.add(this._editor.onDidChangeModel(()=>this._onModelChanged())),this._onModelChanged()}dispose(){this._callOnModelChange.dispose(),this._callOnDispose.dispose(),this.removeDecorations()}_onModelChanged(){this._callOnModelChange.clear();const e=this._editor.getModel();if(e){for(const t of this._model.references)if(t.uri.toString()===e.uri.toString()){this._addDecorations(t.parent);return}}}_addDecorations(e){if(!this._editor.hasModel())return;this._callOnModelChange.add(this._editor.getModel().onDidChangeDecorations(()=>this._onDecorationChanged()));const t=[],i=[];for(let n=0,s=e.children.length;n<s;n++){const r=e.children[n];this._decorationIgnoreSet.has(r.id)||r.uri.toString()===this._editor.getModel().uri.toString()&&(t.push({range:r.range,options:i_.DecorationOptions}),i.push(n))}this._editor.changeDecorations(n=>{const s=n.deltaDecorations([],t);for(let r=0;r<s.length;r++)this._decorations.set(s[r],e.children[i[r]])})}_onDecorationChanged(){const e=[],t=this._editor.getModel();if(t){for(const[i,n]of this._decorations){const s=t.getDecorationRange(i);if(!s)continue;let r=!1;if(!Q.equalsRange(s,n.range)){if(Q.spansMultipleLines(s))r=!0;else{const a=n.range.endColumn-n.range.startColumn,d=s.endColumn-s.startColumn;a!==d&&(r=!0)}r?(this._decorationIgnoreSet.add(n.id),e.push(i)):n.range=s}}for(let i=0,n=e.length;i<n;i++)this._decorations.delete(e[i]);this._editor.removeDecorations(e)}}removeDecorations(){this._editor.removeDecorations([...this._decorations.keys()]),this._decorations.clear()}};i_.DecorationOptions=vn.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"});let lE=i_;class hR{constructor(){this.ratio=.7,this.heightInLines=18}static fromJSON(e){let t,i;try{const n=JSON.parse(e);t=n.ratio,i=n.heightInLines}catch{}return{ratio:t||.7,heightInLines:i||18}}}class fR extends M3{}let cE=class extends Xm{constructor(e,t,i,n,s,r,a,d,u){super(e,{showFrame:!1,showArrow:!0,isResizeable:!0,isAccessible:!0,supportOnTitleClick:!0},r),this._defaultTreeKeyboardSupport=t,this.layoutData=i,this._textModelResolverService=s,this._instantiationService=r,this._peekViewService=a,this._uriLabel=d,this._keybindingService=u,this._disposeOnNewModel=new Tt,this._callOnDispose=new Tt,this._onDidSelectReference=new rn,this.onDidSelectReference=this._onDidSelectReference.event,this._dim=new Zn(0,0),this._isClosing=!1,this._applyTheme(n.getColorTheme()),this._callOnDispose.add(n.onDidColorThemeChange(this._applyTheme.bind(this))),this._peekViewService.addExclusiveWidget(e,this),this.create()}get isClosing(){return this._isClosing}dispose(){this._isClosing=!0,this.setModel(void 0),this._callOnDispose.dispose(),this._disposeOnNewModel.dispose(),uo(this._preview),uo(this._previewNotAvailableMessage),uo(this._tree),uo(this._previewModelReference),this._splitView.dispose(),super.dispose()}_applyTheme(e){const t=e.getColor(sR)||xn.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(nR)||xn.transparent,primaryHeadingColor:e.getColor(V5),secondaryHeadingColor:e.getColor(j5)})}show(e){super.show(e,this.layoutData.heightInLines||18)}focusOnReferenceTree(){this._tree.domFocus()}focusOnPreviewEditor(){this._preview.focus()}isPreviewEditorFocused(){return this._preview.hasTextFocus()}_onTitleClick(e){this._preview&&this._preview.getModel()&&this._onDidSelectReference.fire({element:this._getFocusedReference(),kind:e.ctrlKey||e.metaKey||e.altKey?"side":"open",source:"title"})}_fillBody(e){this.setCssClass("reference-zone-widget"),this._messageContainer=di(e,mi("div.messages")),Uo(this._messageContainer),this._splitView=new P3(e,{orientation:1}),this._previewContainer=di(e,mi("div.preview.inline"));const t={scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!0},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}};this._preview=this._instantiationService.createInstance(Hr,this._previewContainer,t,{},this.editor),Uo(this._previewContainer),this._previewNotAvailableMessage=this._instantiationService.createInstance(dc,S("missingPreviewMessage","no preview available"),Rg,dc.DEFAULT_CREATION_OPTIONS,null),this._treeContainer=di(e,mi("div.ref-tree.inline"));const i={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new dR,keyboardNavigationLabelProvider:this._instantiationService.createInstance(rE),identityProvider:new lR,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:oR}};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(Sl(this._treeContainer,"keydown",s=>{s.equals(9)&&(this._keybindingService.dispatchEvent(s,s.target),s.stopPropagation())},!0)),this._tree=this._instantiationService.createInstance(fR,"ReferencesWidget",this._treeContainer,new aR,[this._instantiationService.createInstance(Ym),this._instantiationService.createInstance(Qm)],this._instantiationService.createInstance(oE),i),this._splitView.addView({onDidChange:Ts.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:s=>{this._preview.layout({height:this._dim.height,width:s})}},MS.Distribute),this._splitView.addView({onDidChange:Ts.None,element:this._treeContainer,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:s=>{this._treeContainer.style.height=`${this._dim.height}px`,this._treeContainer.style.width=`${s}px`,this._tree.layout(this._dim.height,s)}},MS.Distribute),this._disposables.add(this._splitView.onDidSashChange(()=>{this._dim.width&&(this.layoutData.ratio=this._splitView.getViewSize(0)/this._dim.width)},void 0));const n=(s,r)=>{s instanceof Vc&&(r==="show"&&this._revealReference(s,!1),this._onDidSelectReference.fire({element:s,kind:r,source:"tree"}))};this._disposables.add(this._tree.onDidOpen(s=>{s.sideBySide?n(s.element,"side"):s.editorOptions.pinned?n(s.element,"goto"):n(s.element,"show")})),Uo(this._treeContainer)}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._dim=new Zn(t,e),this.layoutData.heightInLines=this._viewZone?this._viewZone.heightInLines:this.layoutData.heightInLines,this._splitView.layout(t),this._splitView.resizeView(0,t*this.layoutData.ratio)}setSelection(e){return this._revealReference(e,!0).then(()=>{this._model&&(this._tree.setSelection([e]),this._tree.setFocus([e]))})}setModel(e){return this._disposeOnNewModel.clear(),this._model=e,this._model?this._onNewModel():Promise.resolve()}_onNewModel(){return this._model?this._model.isEmpty?(this.setTitle(""),this._messageContainer.innerText=S("noResults","No results"),Lr(this._messageContainer),Promise.resolve(void 0)):(Uo(this._messageContainer),this._decorationsManager=new lE(this._preview,this._model),this._disposeOnNewModel.add(this._decorationsManager),this._disposeOnNewModel.add(this._model.onDidChangeReferenceRange(e=>this._tree.rerender(e))),this._disposeOnNewModel.add(this._preview.onMouseDown(e=>{const{event:t,target:i}=e;if(t.detail!==2)return;const n=this._getFocusedReference();n&&this._onDidSelectReference.fire({element:{uri:n.uri,range:i.range},kind:t.ctrlKey||t.metaKey||t.altKey?"side":"open",source:"editor"})})),this.container.classList.add("results-loaded"),Lr(this._treeContainer),Lr(this._previewContainer),this._splitView.layout(this._dim.width),this.focusOnReferenceTree(),this._tree.setInput(this._model.groups.length===1?this._model.groups[0]:this._model)):Promise.resolve(void 0)}_getFocusedReference(){const[e]=this._tree.getFocus();if(e instanceof Vc)return e;if(e instanceof Xg&&e.children.length>0)return e.children[0]}async revealReference(e){await this._revealReference(e,!1),this._onDidSelectReference.fire({element:e,kind:"goto",source:"tree"})}async _revealReference(e,t){if(this._revealedReference===e)return;this._revealedReference=e,e.uri.scheme!==Co.inMemory?this.setTitle(T3(e.uri),this._uriLabel.getUriLabel(zw(e.uri))):this.setTitle(S("peekView.alternateTitle","References"));const i=this._textModelResolverService.createModelReference(e.uri);this._tree.getInput()===e.parent?this._tree.reveal(e):(t&&this._tree.reveal(e.parent),await this._tree.expand(e.parent),this._tree.reveal(e));const n=await i;if(!this._model){n.dispose();return}uo(this._previewModelReference);const s=n.object;if(s){const r=this._preview.getModel()===s.textEditorModel?0:1,a=Q.lift(e.range).collapseToStart();this._previewModelReference=n,this._preview.setModel(s.textEditorModel),this._preview.setSelection(a),this._preview.revealRangeInCenter(a,r)}else this._preview.setModel(this._previewNotAvailableMessage),n.dispose()}};cE=uR([Ch(3,Wr),Ch(4,fa),Ch(5,sn),Ch(6,z5),Ch(7,Tg),Ch(8,As)],cE);var gR=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Eh=function(o,e){return function(t,i){e(t,i,o)}},dm;const ih=new En("referenceSearchVisible",!1,S("referenceSearchVisible","Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));var Gd;let Vu=(Gd=class{static get(e){return e.getContribution(dm.ID)}constructor(e,t,i,n,s,r,a,d){this._defaultTreeKeyboardSupport=e,this._editor=t,this._editorService=n,this._notificationService=s,this._instantiationService=r,this._storageService=a,this._configurationService=d,this._disposables=new Tt,this._requestIdPool=0,this._ignoreModelChangeEvent=!1,this._referenceSearchVisible=ih.bindTo(i)}dispose(){var e,t;this._referenceSearchVisible.reset(),this._disposables.dispose(),(e=this._widget)==null||e.dispose(),(t=this._model)==null||t.dispose(),this._widget=void 0,this._model=void 0}toggleWidget(e,t,i){let n;if(this._widget&&(n=this._widget.position),this.closeWidget(),n&&e.containsPosition(n))return;this._peekMode=i,this._referenceSearchVisible.set(!0),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>{this.closeWidget()})),this._disposables.add(this._editor.onDidChangeModel(()=>{this._ignoreModelChangeEvent||this.closeWidget()}));const s="peekViewLayout",r=hR.fromJSON(this._storageService.get(s,0,"{}"));this._widget=this._instantiationService.createInstance(cE,this._editor,this._defaultTreeKeyboardSupport,r),this._widget.setTitle(S("labelLoading","Loading...")),this._widget.show(e),this._disposables.add(this._widget.onDidClose(()=>{t.cancel(),this._widget?(this._storageService.store(s,JSON.stringify(this._widget.layoutData),0,1),this._widget.isClosing||this.closeWidget(),this._widget=void 0):this.closeWidget()})),this._disposables.add(this._widget.onDidSelectReference(d=>{const{element:u,kind:f}=d;if(u)switch(f){case"open":(d.source!=="editor"||!this._configurationService.getValue("editor.stablePeek"))&&this.openReference(u,!1,!1);break;case"side":this.openReference(u,!0,!1);break;case"goto":i?this._gotoReference(u,!0):this.openReference(u,!1,!0);break}}));const a=++this._requestIdPool;t.then(d=>{var u;if(a!==this._requestIdPool||!this._widget){d.dispose();return}return(u=this._model)==null||u.dispose(),this._model=d,this._widget.setModel(this._model).then(()=>{if(this._widget&&this._model&&this._editor.hasModel()){this._model.isEmpty?this._widget.setMetaTitle(""):this._widget.setMetaTitle(S("metaTitle.N","{0} ({1})",this._model.title,this._model.references.length));const f=this._editor.getModel().uri,g=new Bi(e.startLineNumber,e.startColumn),p=this._model.nearestReference(f,g);if(p)return this._widget.setSelection(p).then(()=>{this._widget&&this._editor.getOption(87)==="editor"&&this._widget.focusOnPreviewEditor()})}})},d=>{this._notificationService.error(d)})}changeFocusBetweenPreviewAndReferences(){this._widget&&(this._widget.isPreviewEditorFocused()?this._widget.focusOnReferenceTree():this._widget.focusOnPreviewEditor())}async goToNextOrPreviousReference(e){if(!this._editor.hasModel()||!this._model||!this._widget)return;const t=this._widget.position;if(!t)return;const i=this._model.nearestReference(this._editor.getModel().uri,t);if(!i)return;const n=this._model.nextOrPreviousReference(i,e),s=this._editor.hasTextFocus(),r=this._widget.isPreviewEditorFocused();await this._widget.setSelection(n),await this._gotoReference(n,!1),s?this._editor.focus():this._widget&&r&&this._widget.focusOnPreviewEditor()}async revealReference(e){!this._editor.hasModel()||!this._model||!this._widget||await this._widget.revealReference(e)}closeWidget(e=!0){var t,i;(t=this._widget)==null||t.dispose(),(i=this._model)==null||i.dispose(),this._referenceSearchVisible.reset(),this._disposables.clear(),this._widget=void 0,this._model=void 0,e&&this._editor.focus(),this._requestIdPool+=1}_gotoReference(e,t){var n;(n=this._widget)==null||n.hide(),this._ignoreModelChangeEvent=!0;const i=Q.lift(e.range).collapseToStart();return this._editorService.openCodeEditor({resource:e.uri,options:{selection:i,selectionSource:"code.jump",pinned:t}},this._editor).then(s=>{if(this._ignoreModelChangeEvent=!1,!s||!this._widget){this.closeWidget();return}if(this._editor===s)this._widget.show(i),this._widget.focusOnReferenceTree();else{const r=dm.get(s),a=this._model.clone();this.closeWidget(),s.focus(),r==null||r.toggleWidget(i,qs(d=>Promise.resolve(a)),this._peekMode??!1)}},s=>{this._ignoreModelChangeEvent=!1,qn(s)})}openReference(e,t,i){t||this.closeWidget();const{uri:n,range:s}=e;this._editorService.openCodeEditor({resource:n,options:{selection:s,selectionSource:"code.jump",pinned:i}},this._editor,t)}},dm=Gd,Gd.ID="editor.contrib.referencesController",Gd);Vu=dm=gR([Eh(2,Fn),Eh(3,Cs),Eh(4,mo),Eh(5,sn),Eh(6,Gc),Eh(7,ss)],Vu);function nh(o,e){const t=tR(o);if(!t)return;const i=Vu.get(t);i&&e(i)}Ka.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:Ds(2089,60),when:qe.or(ih,wo.inPeekEditor),handler(o){nh(o,e=>{e.changeFocusBetweenPreviewAndReferences()})}});Ka.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:qe.or(ih,wo.inPeekEditor),handler(o){nh(o,e=>{e.goToNextOrPreviousReference(!0)})}});Ka.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:qe.or(ih,wo.inPeekEditor),handler(o){nh(o,e=>{e.goToNextOrPreviousReference(!1)})}});Qn.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference");Qn.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference");Qn.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch");Qn.registerCommand("closeReferenceSearch",o=>nh(o,e=>e.closeWidget()));Ka.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:qe.and(wo.inPeekEditor,qe.not("config.editor.stablePeek"))});Ka.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:qe.and(ih,qe.not("config.editor.stablePeek"),qe.or(q.editorTextFocus,R3.negate()))});Ka.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:qe.and(ih,CA,EA.negate(),yA.negate()),handler(o){var i;const t=(i=o.get(Vw).lastFocusedList)==null?void 0:i.getFocus();Array.isArray(t)&&t[0]instanceof Vc&&nh(o,n=>n.revealReference(t[0]))}});Ka.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:qe.and(ih,CA,EA.negate(),yA.negate()),handler(o){var i;const t=(i=o.get(Vw).lastFocusedList)==null?void 0:i.getFocus();Array.isArray(t)&&t[0]instanceof Vc&&nh(o,n=>n.openReference(t[0],!0,!0))}});Qn.registerCommand("openReference",o=>{var i;const t=(i=o.get(Vw).lastFocusedList)==null?void 0:i.getFocus();Array.isArray(t)&&t[0]instanceof Vc&&nh(o,n=>n.openReference(t[0],!1,!0))});var U5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Zf=function(o,e){return function(t,i){e(t,i,o)}};const F9=new En("hasSymbols",!1,S("hasSymbols","Whether there are symbol locations that can be navigated via keyboard-only.")),Cb=Ml("ISymbolNavigationService");let dE=class{constructor(e,t,i,n){this._editorService=t,this._notificationService=i,this._keybindingService=n,this._currentModel=void 0,this._currentIdx=-1,this._ignoreEditorChange=!1,this._ctxHasSymbols=F9.bindTo(e)}reset(){var e,t;this._ctxHasSymbols.reset(),(e=this._currentState)==null||e.dispose(),(t=this._currentMessage)==null||t.dispose(),this._currentModel=void 0,this._currentIdx=-1}put(e){const t=e.parent.parent;if(t.references.length<=1){this.reset();return}this._currentModel=t,this._currentIdx=t.references.indexOf(e),this._ctxHasSymbols.set(!0),this._showMessage();const i=new uE(this._editorService),n=i.onDidChange(s=>{if(this._ignoreEditorChange)return;const r=this._editorService.getActiveCodeEditor();if(!r)return;const a=r.getModel(),d=r.getPosition();if(!a||!d)return;let u=!1,f=!1;for(const g of t.references)if(wm(g.uri,a.uri))u=!0,f=f||Q.containsPosition(g.range,d);else if(u)break;(!u||!f)&&this.reset()});this._currentState=wA(i,n)}revealNext(e){if(!this._currentModel)return Promise.resolve();this._currentIdx+=1,this._currentIdx%=this._currentModel.references.length;const t=this._currentModel.references[this._currentIdx];return this._showMessage(),this._ignoreEditorChange=!0,this._editorService.openCodeEditor({resource:t.uri,options:{selection:Q.collapseToStart(t.range),selectionRevealType:3}},e).finally(()=>{this._ignoreEditorChange=!1})}_showMessage(){var i;(i=this._currentMessage)==null||i.dispose();const e=this._keybindingService.lookupKeybinding("editor.gotoNextSymbolFromResult"),t=e?S("location.kb","Symbol {0} of {1}, {2} for next",this._currentIdx+1,this._currentModel.references.length,e.getLabel()):S("location","Symbol {0} of {1}",this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(t)}};dE=U5([Zf(0,Fn),Zf(1,Cs),Zf(2,mo),Zf(3,As)],dE);Rl(Cb,dE,1);Ti(new class extends Ao{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:F9,kbOpts:{weight:100,primary:70}})}runEditorCommand(o,e){return o.get(Cb).revealNext(e)}});Ka.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:F9,primary:9,handler(o){o.get(Cb).reset()}});let uE=class{constructor(e){this._listener=new Map,this._disposables=new Tt,this._onDidChange=new rn,this.onDidChange=this._onDidChange.event,this._disposables.add(e.onCodeEditorRemove(this._onDidRemoveEditor,this)),this._disposables.add(e.onCodeEditorAdd(this._onDidAddEditor,this)),e.listCodeEditors().forEach(this._onDidAddEditor,this)}dispose(){this._disposables.dispose(),this._onDidChange.dispose(),uo(this._listener.values())}_onDidAddEditor(e){this._listener.set(e,wA(e.onDidChangeCursorPosition(t=>this._onDidChange.fire({editor:e})),e.onDidChangeModelContent(t=>this._onDidChange.fire({editor:e}))))}_onDidRemoveEditor(e){var t;(t=this._listener.get(e))==null||t.dispose(),this._listener.delete(e)}};uE=U5([Zf(0,Cs)],uE);function hE(o,e){return e.uri.scheme===o.uri.scheme?!0:!N3(e.uri,Co.walkThroughSnippet,Co.vscodeChatCodeBlock,Co.vscodeChatCodeCompareBlock)}async function Kp(o,e,t,i,n){const r=t.ordered(o,i).map(d=>Promise.resolve(n(d,o,e)).then(void 0,u=>{bs(u)})),a=await Promise.all(r);return yl(a.flat()).filter(d=>hE(o,d))}function Zp(o,e,t,i,n){return Kp(e,t,o,i,(s,r,a)=>s.provideDefinition(r,a,n))}function L9(o,e,t,i,n){return Kp(e,t,o,i,(s,r,a)=>s.provideDeclaration(r,a,n))}function I9(o,e,t,i,n){return Kp(e,t,o,i,(s,r,a)=>s.provideImplementation(r,a,n))}function P9(o,e,t,i,n){return Kp(e,t,o,i,(s,r,a)=>s.provideTypeDefinition(r,a,n))}function Xp(o,e,t,i,n,s){return Kp(e,t,o,n,async(r,a,d)=>{var g,p;const u=(g=await r.provideReferences(a,d,{includeDeclaration:!0},s))==null?void 0:g.filter(C=>hE(a,C));if(!i||!u||u.length!==2)return u;const f=(p=await r.provideReferences(a,d,{includeDeclaration:!1},s))==null?void 0:p.filter(C=>hE(a,C));return f&&f.length===1?f:u})}async function Za(o){const e=await o(),t=new Ro(e,""),i=t.references.map(n=>n.link);return t.dispose(),i}ko("_executeDefinitionProvider",(o,e,t)=>{const i=o.get(Fi),n=Zp(i.definitionProvider,e,t,!1,an.None);return Za(()=>n)});ko("_executeDefinitionProvider_recursive",(o,e,t)=>{const i=o.get(Fi),n=Zp(i.definitionProvider,e,t,!0,an.None);return Za(()=>n)});ko("_executeTypeDefinitionProvider",(o,e,t)=>{const i=o.get(Fi),n=P9(i.typeDefinitionProvider,e,t,!1,an.None);return Za(()=>n)});ko("_executeTypeDefinitionProvider_recursive",(o,e,t)=>{const i=o.get(Fi),n=P9(i.typeDefinitionProvider,e,t,!0,an.None);return Za(()=>n)});ko("_executeDeclarationProvider",(o,e,t)=>{const i=o.get(Fi),n=L9(i.declarationProvider,e,t,!1,an.None);return Za(()=>n)});ko("_executeDeclarationProvider_recursive",(o,e,t)=>{const i=o.get(Fi),n=L9(i.declarationProvider,e,t,!0,an.None);return Za(()=>n)});ko("_executeReferenceProvider",(o,e,t)=>{const i=o.get(Fi),n=Xp(i.referenceProvider,e,t,!1,!1,an.None);return Za(()=>n)});ko("_executeReferenceProvider_recursive",(o,e,t)=>{const i=o.get(Fi),n=Xp(i.referenceProvider,e,t,!1,!0,an.None);return Za(()=>n)});ko("_executeImplementationProvider",(o,e,t)=>{const i=o.get(Fi),n=I9(i.implementationProvider,e,t,!1,an.None);return Za(()=>n)});ko("_executeImplementationProvider_recursive",(o,e,t)=>{const i=o.get(Fi),n=I9(i.implementationProvider,e,t,!0,an.None);return Za(()=>n)});Rr.appendMenuItem(ni.EditorContext,{submenu:ni.EditorContextPeek,title:S("peek.submenu","Peek"),group:"navigation",order:100});class Z0{static is(e){return!e||typeof e!="object"?!1:!!(e instanceof Z0||Bi.isIPosition(e.position)&&e.model)}constructor(e,t){this.model=e,this.position=t}}const Cr=class Cr extends la{static all(){return Cr._allSymbolNavigationCommands.values()}static _patchConfig(e){const t={...e,f1:!0};if(t.menu)for(const i of ml.wrap(t.menu))(i.id===ni.EditorContext||i.id===ni.EditorContextPeek)&&(i.when=qe.and(e.precondition,i.when));return t}constructor(e,t){super(Cr._patchConfig(t)),this.configuration=e,Cr._allSymbolNavigationCommands.set(t.id,this)}runEditorCommand(e,t,i,n){if(!t.hasModel())return Promise.resolve(void 0);const s=e.get(mo),r=e.get(Cs),a=e.get(Ap),d=e.get(Cb),u=e.get(Fi),f=e.get(sn),g=t.getModel(),p=t.getPosition(),C=Z0.is(i)?i:new Z0(g,p),b=new L0(t,5),y=Sp(this._getLocationModel(u,C.model,C.position,b.token),b.token).then(async w=>{var T;if(!w||b.token.isCancellationRequested)return;Nr(w.ariaMessage);let A;if(w.referenceAt(g.uri,p)){const R=this._getAlternativeCommand(t);!Cr._activeAlternativeCommands.has(R)&&Cr._allSymbolNavigationCommands.has(R)&&(A=Cr._allSymbolNavigationCommands.get(R))}const I=w.references.length;if(I===0){if(!this.configuration.muteMessage){const R=g.getWordAtPosition(p);(T=Mo.get(t))==null||T.showMessage(this._getNoResultFoundMessage(R),p)}}else if(I===1&&A)Cr._activeAlternativeCommands.add(this.desc.id),f.invokeFunction(R=>A.runEditorCommand(R,t,i,n).finally(()=>{Cr._activeAlternativeCommands.delete(this.desc.id)}));else return this._onResult(r,d,t,w,n)},w=>{s.error(w)}).finally(()=>{b.dispose()});return a.showWhile(y,250),y}async _onResult(e,t,i,n,s){const r=this._getGoToPreference(i);if(!(i instanceof Hr)&&(this.configuration.openInPeek||r==="peek"&&n.references.length>1))this._openInPeek(i,n,s);else{const a=n.firstReference(),d=n.references.length>1&&r==="gotoAndPeek",u=await this._openReference(i,e,a,this.configuration.openToSide,!d);d&&u?this._openInPeek(u,n,s):n.dispose(),r==="goto"&&t.put(a)}}async _openReference(e,t,i,n,s){let r;if(O3(i)&&(r=i.targetSelectionRange),r||(r=i.range),!r)return;const a=await t.openCodeEditor({resource:i.uri,options:{selection:Q.collapseToStart(r),selectionRevealType:3,selectionSource:"code.jump"}},e,n);if(a){if(s){const d=a.getModel(),u=a.createDecorationsCollection([{range:r,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout(()=>{a.getModel()===d&&u.clear()},350)}return a}}_openInPeek(e,t,i){const n=Vu.get(e);n&&e.hasModel()?n.toggleWidget(i??e.getSelection(),qs(s=>Promise.resolve(t)),this.configuration.openInPeek):t.dispose()}};Cr._allSymbolNavigationCommands=new Map,Cr._activeAlternativeCommands=new Set;let Fl=Cr;class Yp extends Fl{async _getLocationModel(e,t,i,n){return new Ro(await Zp(e.definitionProvider,t,i,!1,n),S("def.title","Definitions"))}_getNoResultFoundMessage(e){return e&&e.word?S("noResultWord","No definition found for '{0}'",e.word):S("generic.noResults","No definition found")}_getAlternativeCommand(e){return e.getOption(58).alternativeDefinitionCommand}_getGoToPreference(e){return e.getOption(58).multipleDefinitions}}var Dc;Vn((Dc=class extends Yp{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Dc.id,title:{...Ai("actions.goToDecl.label","Go to Definition"),mnemonicTitle:S({key:"miGotoDefinition",comment:["&& denotes a mnemonic"]},"Go to &&Definition")},precondition:q.hasDefinitionProvider,keybinding:[{when:q.editorTextFocus,primary:70,weight:100},{when:qe.and(q.editorTextFocus,SA),primary:2118,weight:100}],menu:[{id:ni.EditorContext,group:"navigation",order:1.1},{id:ni.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),Qn.registerCommandAlias("editor.action.goToDeclaration",Dc.id)}},Dc.id="editor.action.revealDefinition",Dc));var Ac;Vn((Ac=class extends Yp{constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:Ac.id,title:Ai("actions.goToDeclToSide.label","Open Definition to the Side"),precondition:qe.and(q.hasDefinitionProvider,q.isInEmbeddedEditor.toNegated()),keybinding:[{when:q.editorTextFocus,primary:Ds(2089,70),weight:100},{when:qe.and(q.editorTextFocus,SA),primary:Ds(2089,2118),weight:100}]}),Qn.registerCommandAlias("editor.action.openDeclarationToTheSide",Ac.id)}},Ac.id="editor.action.revealDefinitionAside",Ac));var kc;Vn((kc=class extends Yp{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:kc.id,title:Ai("actions.previewDecl.label","Peek Definition"),precondition:qe.and(q.hasDefinitionProvider,wo.notInPeekEditor,q.isInEmbeddedEditor.toNegated()),keybinding:{when:q.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:ni.EditorContextPeek,group:"peek",order:2}}),Qn.registerCommandAlias("editor.action.previewDeclaration",kc.id)}},kc.id="editor.action.peekDefinition",kc));class q5 extends Fl{async _getLocationModel(e,t,i,n){return new Ro(await L9(e.declarationProvider,t,i,!1,n),S("decl.title","Declarations"))}_getNoResultFoundMessage(e){return e&&e.word?S("decl.noResultWord","No declaration found for '{0}'",e.word):S("decl.generic.noResults","No declaration found")}_getAlternativeCommand(e){return e.getOption(58).alternativeDeclarationCommand}_getGoToPreference(e){return e.getOption(58).multipleDeclarations}}var Kd;Vn((Kd=class extends q5{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Kd.id,title:{...Ai("actions.goToDeclaration.label","Go to Declaration"),mnemonicTitle:S({key:"miGotoDeclaration",comment:["&& denotes a mnemonic"]},"Go to &&Declaration")},precondition:qe.and(q.hasDeclarationProvider,q.isInEmbeddedEditor.toNegated()),menu:[{id:ni.EditorContext,group:"navigation",order:1.3},{id:ni.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}_getNoResultFoundMessage(e){return e&&e.word?S("decl.noResultWord","No declaration found for '{0}'",e.word):S("decl.generic.noResults","No declaration found")}},Kd.id="editor.action.revealDeclaration",Kd));Vn(class extends q5{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:Ai("actions.peekDecl.label","Peek Declaration"),precondition:qe.and(q.hasDeclarationProvider,wo.notInPeekEditor,q.isInEmbeddedEditor.toNegated()),menu:{id:ni.EditorContextPeek,group:"peek",order:3}})}});class G5 extends Fl{async _getLocationModel(e,t,i,n){return new Ro(await P9(e.typeDefinitionProvider,t,i,!1,n),S("typedef.title","Type Definitions"))}_getNoResultFoundMessage(e){return e&&e.word?S("goToTypeDefinition.noResultWord","No type definition found for '{0}'",e.word):S("goToTypeDefinition.generic.noResults","No type definition found")}_getAlternativeCommand(e){return e.getOption(58).alternativeTypeDefinitionCommand}_getGoToPreference(e){return e.getOption(58).multipleTypeDefinitions}}var Zd;Vn((Zd=class extends G5{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Zd.ID,title:{...Ai("actions.goToTypeDefinition.label","Go to Type Definition"),mnemonicTitle:S({key:"miGotoTypeDefinition",comment:["&& denotes a mnemonic"]},"Go to &&Type Definition")},precondition:q.hasTypeDefinitionProvider,keybinding:{when:q.editorTextFocus,primary:0,weight:100},menu:[{id:ni.EditorContext,group:"navigation",order:1.4},{id:ni.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}},Zd.ID="editor.action.goToTypeDefinition",Zd));var Xd;Vn((Xd=class extends G5{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Xd.ID,title:Ai("actions.peekTypeDefinition.label","Peek Type Definition"),precondition:qe.and(q.hasTypeDefinitionProvider,wo.notInPeekEditor,q.isInEmbeddedEditor.toNegated()),menu:{id:ni.EditorContextPeek,group:"peek",order:4}})}},Xd.ID="editor.action.peekTypeDefinition",Xd));class K5 extends Fl{async _getLocationModel(e,t,i,n){return new Ro(await I9(e.implementationProvider,t,i,!1,n),S("impl.title","Implementations"))}_getNoResultFoundMessage(e){return e&&e.word?S("goToImplementation.noResultWord","No implementation found for '{0}'",e.word):S("goToImplementation.generic.noResults","No implementation found")}_getAlternativeCommand(e){return e.getOption(58).alternativeImplementationCommand}_getGoToPreference(e){return e.getOption(58).multipleImplementations}}var Yd;Vn((Yd=class extends K5{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Yd.ID,title:{...Ai("actions.goToImplementation.label","Go to Implementations"),mnemonicTitle:S({key:"miGotoImplementation",comment:["&& denotes a mnemonic"]},"Go to &&Implementations")},precondition:q.hasImplementationProvider,keybinding:{when:q.editorTextFocus,primary:2118,weight:100},menu:[{id:ni.EditorContext,group:"navigation",order:1.45},{id:ni.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}},Yd.ID="editor.action.goToImplementation",Yd));var Qd;Vn((Qd=class extends K5{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Qd.ID,title:Ai("actions.peekImplementation.label","Peek Implementations"),precondition:qe.and(q.hasImplementationProvider,wo.notInPeekEditor,q.isInEmbeddedEditor.toNegated()),keybinding:{when:q.editorTextFocus,primary:3142,weight:100},menu:{id:ni.EditorContextPeek,group:"peek",order:5}})}},Qd.ID="editor.action.peekImplementation",Qd));class Z5 extends Fl{_getNoResultFoundMessage(e){return e?S("references.no","No references found for '{0}'",e.word):S("references.noGeneric","No references found")}_getAlternativeCommand(e){return e.getOption(58).alternativeReferenceCommand}_getGoToPreference(e){return e.getOption(58).multipleReferences}}Vn(class extends Z5{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{...Ai("goToReferences.label","Go to References"),mnemonicTitle:S({key:"miGotoReference",comment:["&& denotes a mnemonic"]},"Go to &&References")},precondition:qe.and(q.hasReferenceProvider,wo.notInPeekEditor,q.isInEmbeddedEditor.toNegated()),keybinding:{when:q.editorTextFocus,primary:1094,weight:100},menu:[{id:ni.EditorContext,group:"navigation",order:1.45},{id:ni.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}async _getLocationModel(e,t,i,n){return new Ro(await Xp(e.referenceProvider,t,i,!0,!1,n),S("ref.title","References"))}});Vn(class extends Z5{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:Ai("references.action.label","Peek References"),precondition:qe.and(q.hasReferenceProvider,wo.notInPeekEditor,q.isInEmbeddedEditor.toNegated()),menu:{id:ni.EditorContextPeek,group:"peek",order:6}})}async _getLocationModel(e,t,i,n){return new Ro(await Xp(e.referenceProvider,t,i,!1,!1,n),S("ref.title","References"))}});class pR extends Fl{constructor(e,t,i){super(e,{id:"editor.action.goToLocation",title:Ai("label.generic","Go to Any Symbol"),precondition:qe.and(wo.notInPeekEditor,q.isInEmbeddedEditor.toNegated())}),this._references=t,this._gotoMultipleBehaviour=i}async _getLocationModel(e,t,i,n){return new Ro(this._references,S("generic.title","Locations"))}_getNoResultFoundMessage(e){return e&&S("generic.noResult","No results for '{0}'",e.word)||""}_getGoToPreference(e){return this._gotoMultipleBehaviour??e.getOption(58).multipleReferences}_getAlternativeCommand(){return""}}Qn.registerCommand({id:"editor.action.goToLocations",metadata:{description:"Go to locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:jn},{name:"position",description:"The position at which to start",constraint:Bi.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto`"},{name:"noResultsMessage",description:"Human readable message that shows when locations is empty."}]},handler:async(o,e,t,i,n,s,r)=>{Pn(jn.isUri(e)),Pn(Bi.isIPosition(t)),Pn(Array.isArray(i)),Pn(typeof n>"u"||typeof n=="string"),Pn(typeof r>"u"||typeof r=="boolean");const a=o.get(Cs),d=await a.openCodeEditor({resource:e},a.getFocusedCodeEditor());if(DA(d))return d.setPosition(t),d.revealPositionInCenterIfOutsideViewport(t,0),d.invokeWithinContext(u=>{const f=new class extends pR{_getNoResultFoundMessage(g){return s||super._getNoResultFoundMessage(g)}}({muteMessage:!s,openInPeek:!!r,openToSide:!1},i,n);u.get(sn).invokeFunction(f.run.bind(f),d)})}});Qn.registerCommand({id:"editor.action.peekLocations",metadata:{description:"Peek locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:jn},{name:"position",description:"The position at which to start",constraint:Bi.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto`"}]},handler:async(o,e,t,i,n)=>{o.get(Vs).executeCommand("editor.action.goToLocations",e,t,i,n,void 0,!0)}});Qn.registerCommand({id:"editor.action.findReferences",handler:(o,e,t)=>{Pn(jn.isUri(e)),Pn(Bi.isIPosition(t));const i=o.get(Fi),n=o.get(Cs);return n.openCodeEditor({resource:e},n.getFocusedCodeEditor()).then(s=>{if(!DA(s)||!s.hasModel())return;const r=Vu.get(s);if(!r)return;const a=qs(u=>Xp(i.referenceProvider,s.getModel(),Bi.lift(t),!1,!1,u).then(f=>new Ro(f,S("ref.title","References")))),d=new Q(t.lineNumber,t.column,t.lineNumber,t.column);return Promise.resolve(r.toggleWidget(d,a,!1))})}});Qn.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");async function xR(o,e,t,i){const n=o.get(fa),s=o.get(af),r=o.get(Vs),a=o.get(sn),d=o.get(mo);if(await i.item.resolve(an.None),!i.part.location)return;const u=i.part.location,f=[],g=new Set(Rr.getMenuItems(ni.EditorContext).map(C=>H3(C)?C.command.id:fb()));for(const C of Fl.all())g.has(C.desc.id)&&f.push(new R0(C.desc.id,N0.label(C.desc,{renderShortTitle:!0}),void 0,!0,async()=>{const b=await n.createModelReference(u.uri);try{const y=new Z0(b.object.textEditorModel,Q.getStartPosition(u.range)),w=i.item.anchor.range;await a.invokeFunction(C.runEditorCommand.bind(C),e,y,w)}finally{b.dispose()}}));if(i.part.command){const{command:C}=i.part;f.push(new Ig),f.push(new R0(C.id,C.title,void 0,!0,async()=>{try{await r.executeCommand(C.id,...C.arguments??[])}catch(b){d.notify({severity:jw.Error,source:i.item.provider.displayName,message:b})}}))}const p=e.getOption(128);s.showContextMenu({domForShadowRoot:p?e.getDomNode()??void 0:void 0,getAnchor:()=>{const C=yo(t);return{x:C.left,y:C.top+C.height+8}},getActions:()=>f,onHide:()=>{e.focus()},autoSelectFirstItem:!0})}async function X5(o,e,t,i){const s=await o.get(fa).createModelReference(i.uri);await t.invokeWithinContext(async r=>{const a=e.hasSideBySideModifier,d=r.get(Fn),u=wo.inPeekEditor.getValue(d),f=!a&&t.getOption(89)&&!u;return new Yp({openToSide:a,openInPeek:f,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(r,new Z0(s.object.textEditorModel,Q.getStartPosition(i.range)),Q.lift(i.range))}),s.dispose()}var mR=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},yh=function(o,e){return function(t,i){e(t,i,o)}},Oh;class Jm{constructor(){this._entries=new Bp(50)}get(e){const t=Jm._key(e);return this._entries.get(t)}set(e,t){const i=Jm._key(e);this._entries.set(i,t)}static _key(e){return`${e.uri.toString()}/${e.getVersionId()}`}}const Y5=Ml("IInlayHintsCache");Rl(Y5,Jm,1);class fE{constructor(e,t){this.item=e,this.index=t}get part(){const e=this.item.hint.label;return typeof e=="string"?{label:e}:e[this.index]}}class vR{constructor(e,t){this.part=e,this.hasTriggerModifier=t}}var xl;let Yg=(xl=class{static get(e){return e.getContribution(Oh.ID)??void 0}constructor(e,t,i,n,s,r,a){this._editor=e,this._languageFeaturesService=t,this._inlayHintsCache=n,this._commandService=s,this._notificationService=r,this._instaService=a,this._disposables=new Tt,this._sessionDisposables=new Tt,this._decorationsMetadata=new Map,this._ruleFactory=new hA(this._editor),this._activeRenderMode=0,this._debounceInfo=i.for(t.inlayHintsProvider,"InlayHint",{min:25}),this._disposables.add(t.inlayHintsProvider.onDidChange(()=>this._update())),this._disposables.add(e.onDidChangeModel(()=>this._update())),this._disposables.add(e.onDidChangeModelLanguage(()=>this._update())),this._disposables.add(e.onDidChangeConfiguration(d=>{d.hasChanged(142)&&this._update()})),this._update()}dispose(){this._sessionDisposables.dispose(),this._removeAllDecorations(),this._disposables.dispose()}_update(){this._sessionDisposables.clear(),this._removeAllDecorations();const e=this._editor.getOption(142);if(e.enabled==="off")return;const t=this._editor.getModel();if(!t||!this._languageFeaturesService.inlayHintsProvider.has(t))return;if(e.enabled==="on")this._activeRenderMode=0;else{let a,d;e.enabled==="onUnlessPressed"?(a=0,d=1):(a=1,d=0),this._activeRenderMode=a,this._sessionDisposables.add(W3.getInstance().event(u=>{if(!this._editor.hasModel())return;const f=u.altKey&&u.ctrlKey&&!(u.shiftKey||u.metaKey)?d:a;if(f!==this._activeRenderMode){this._activeRenderMode=f;const g=this._editor.getModel(),p=this._copyInlayHintsWithCurrentAnchor(g);this._updateHintsDecorators([g.getFullModelRange()],p),r.schedule(0)}}))}const i=this._inlayHintsCache.get(t);i&&this._updateHintsDecorators([t.getFullModelRange()],i),this._sessionDisposables.add(is(()=>{t.isDisposed()||this._cacheHintsForFastRestore(t)}));let n;const s=new Set,r=new Ms(async()=>{const a=Date.now();n==null||n.dispose(!0),n=new Gs;const d=t.onWillDispose(()=>n==null?void 0:n.cancel());try{const u=n.token,f=await Km.create(this._languageFeaturesService.inlayHintsProvider,t,this._getHintsRanges(),u);if(r.delay=this._debounceInfo.update(t,Date.now()-a),u.isCancellationRequested){f.dispose();return}for(const g of f.provider)typeof g.onDidChangeInlayHints=="function"&&!s.has(g)&&(s.add(g),this._sessionDisposables.add(g.onDidChangeInlayHints(()=>{r.isScheduled()||r.schedule()})));this._sessionDisposables.add(f),this._updateHintsDecorators(f.ranges,f.items),this._cacheHintsForFastRestore(t)}catch(u){qn(u)}finally{n.dispose(),d.dispose()}},this._debounceInfo.get(t));this._sessionDisposables.add(r),this._sessionDisposables.add(is(()=>n==null?void 0:n.dispose(!0))),r.schedule(0),this._sessionDisposables.add(this._editor.onDidScrollChange(a=>{(a.scrollTopChanged||!r.isScheduled())&&r.schedule()})),this._sessionDisposables.add(this._editor.onDidChangeModelContent(a=>{n==null||n.cancel();const d=Math.max(r.delay,1250);r.schedule(d)})),this._sessionDisposables.add(this._installDblClickGesture(()=>r.schedule(0))),this._sessionDisposables.add(this._installLinkGesture()),this._sessionDisposables.add(this._installContextMenu())}_installLinkGesture(){const e=new Tt,t=e.add(new vb(this._editor)),i=new Tt;return e.add(i),e.add(t.onMouseMoveOrRelevantKeyDown(n=>{const[s]=n,r=this._getInlayHintLabelPart(s),a=this._editor.getModel();if(!r||!a){i.clear();return}const d=new Gs;i.add(is(()=>d.dispose(!0))),r.item.resolve(d.token),this._activeInlayHintPart=r.part.command||r.part.location?new vR(r,s.hasTriggerModifier):void 0;const u=a.validatePosition(r.item.hint.position).lineNumber,f=new Q(u,1,u,a.getLineMaxColumn(u)),g=this._getInlineHintsForRange(f);this._updateHintsDecorators([f],g),i.add(is(()=>{this._activeInlayHintPart=void 0,this._updateHintsDecorators([f],g)}))})),e.add(t.onCancel(()=>i.clear())),e.add(t.onExecute(async n=>{const s=this._getInlayHintLabelPart(n);if(s){const r=s.part;r.location?this._instaService.invokeFunction(X5,n,this._editor,r.location):z3.is(r.command)&&await this._invokeCommand(r.command,s.item)}})),e}_getInlineHintsForRange(e){const t=new Set;for(const i of this._decorationsMetadata.values())e.containsRange(i.item.anchor.range)&&t.add(i.item);return Array.from(t)}_installDblClickGesture(e){return this._editor.onMouseUp(async t=>{if(t.event.detail!==2)return;const i=this._getInlayHintLabelPart(t);if(i&&(t.event.preventDefault(),await i.item.resolve(an.None),Yo(i.item.hint.textEdits))){const n=i.item.hint.textEdits.map(s=>cs.replace(Q.lift(s.range),s.text));this._editor.executeEdits("inlayHint.default",n),e()}})}_installContextMenu(){return this._editor.onContextMenu(async e=>{if(!V3(e.event.target))return;const t=this._getInlayHintLabelPart(e);t&&await this._instaService.invokeFunction(xR,this._editor,e.event.target,t)})}_getInlayHintLabelPart(e){var i;if(e.target.type!==6)return;const t=(i=e.target.detail.injectedText)==null?void 0:i.options;if(t instanceof $w&&(t==null?void 0:t.attachedData)instanceof fE)return t.attachedData}async _invokeCommand(e,t){try{await this._commandService.executeCommand(e.id,...e.arguments??[])}catch(i){this._notificationService.notify({severity:jw.Error,source:t.provider.displayName,message:i})}}_cacheHintsForFastRestore(e){const t=this._copyInlayHintsWithCurrentAnchor(e);this._inlayHintsCache.set(e,t)}_copyInlayHintsWithCurrentAnchor(e){const t=new Map;for(const[i,n]of this._decorationsMetadata){if(t.has(n.item))continue;const s=e.getDecorationRange(i);if(s){const r=new O5(s,n.item.anchor.direction),a=n.item.with({anchor:r});t.set(n.item,a)}}return Array.from(t.values())}_getHintsRanges(){const t=this._editor.getModel(),i=this._editor.getVisibleRangesPlusViewportAboveBelow(),n=[];for(const s of i.sort(Q.compareRangesUsingStarts)){const r=t.validateRange(new Q(s.startLineNumber-30,s.startColumn,s.endLineNumber+30,s.endColumn));n.length===0||!Q.areIntersectingOrTouching(n[n.length-1],r)?n.push(r):n[n.length-1]=Q.plusRange(n[n.length-1],r)}return n}_updateHintsDecorators(e,t){var b,y;const i=[],n=(w,A,I,T,R)=>{const P={content:I,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:A.className,cursorStops:T,attachedData:R};i.push({item:w,classNameRef:A,decoration:{range:w.anchor.range,options:{description:"InlayHint",showIfCollapsed:w.anchor.range.isEmpty(),collapseOnReplaceEdit:!w.anchor.range.isEmpty(),stickiness:0,[w.anchor.direction]:this._activeRenderMode===0?P:void 0}}})},s=(w,A)=>{const I=this._ruleFactory.createClassNameRef({width:`${r/3|0}px`,display:"inline-block"});n(w,I," ",A?jh.Right:jh.None)},{fontSize:r,fontFamily:a,padding:d,isUniform:u}=this._getLayoutInfo(),f="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(f,a);let g={line:0,totalLen:0};for(const w of t){if(g.line!==w.anchor.range.startLineNumber&&(g={line:w.anchor.range.startLineNumber,totalLen:0}),g.totalLen>Oh._MAX_LABEL_LEN)continue;w.hint.paddingLeft&&s(w,!1);const A=typeof w.hint.label=="string"?[{label:w.hint.label}]:w.hint.label;for(let I=0;I<A.length;I++){const T=A[I],R=I===0,P=I===A.length-1,V={fontSize:`${r}px`,fontFamily:`var(${f}), ${Ow.fontFamily}`,verticalAlign:u?"baseline":"middle",unicodeBidi:"isolate"};Yo(w.hint.textEdits)&&(V.cursor="default"),this._fillInColors(V,w.hint),(T.command||T.location)&&((b=this._activeInlayHintPart)==null?void 0:b.part.item)===w&&this._activeInlayHintPart.part.index===I&&(V.textDecoration="underline",this._activeInlayHintPart.hasTriggerModifier&&(V.color=Fs(j3),V.cursor="pointer")),d&&(R&&P?(V.padding=`1px ${Math.max(1,r/4)|0}px`,V.borderRadius=`${r/4|0}px`):R?(V.padding=`1px 0 1px ${Math.max(1,r/4)|0}px`,V.borderRadius=`${r/4|0}px 0 0 ${r/4|0}px`):P?(V.padding=`1px ${Math.max(1,r/4)|0}px 1px 0`,V.borderRadius=`0 ${r/4|0}px ${r/4|0}px 0`):V.padding="1px 0 1px 0");let j=T.label;g.totalLen+=j.length;let J=!1;const ae=g.totalLen-Oh._MAX_LABEL_LEN;if(ae>0&&(j=j.slice(0,-ae)+"…",J=!0),n(w,this._ruleFactory.createClassNameRef(V),_R(j),P&&!w.hint.paddingRight?jh.Right:jh.None,new fE(w,I)),J)break}if(w.hint.paddingRight&&s(w,!0),i.length>Oh._MAX_DECORATORS)break}const p=[];for(const[w,A]of this._decorationsMetadata){const I=(y=this._editor.getModel())==null?void 0:y.getDecorationRange(w);I&&e.some(T=>T.containsRange(I))&&(p.push(w),A.classNameRef.dispose(),this._decorationsMetadata.delete(w))}const C=T0.capture(this._editor);this._editor.changeDecorations(w=>{const A=w.deltaDecorations(p,i.map(I=>I.decoration));for(let I=0;I<A.length;I++){const T=i[I];this._decorationsMetadata.set(A[I],T)}}),C.restore(this._editor)}_fillInColors(e,t){t.kind===RS.Parameter?(e.backgroundColor=Fs($3),e.color=Fs(U3)):t.kind===RS.Type?(e.backgroundColor=Fs(q3),e.color=Fs(G3)):(e.backgroundColor=Fs(K3),e.color=Fs(Z3))}_getLayoutInfo(){const e=this._editor.getOption(142),t=e.padding,i=this._editor.getOption(52),n=this._editor.getOption(49);let s=e.fontSize;(!s||s<5||s>i)&&(s=i);const r=e.fontFamily||n;return{fontSize:s,fontFamily:r,padding:t,isUniform:!t&&r===n&&s===i}}_removeAllDecorations(){this._editor.removeDecorations(Array.from(this._decorationsMetadata.keys()));for(const e of this._decorationsMetadata.values())e.classNameRef.dispose();this._decorationsMetadata.clear()}},Oh=xl,xl.ID="editor.contrib.InlayHints",xl._MAX_DECORATORS=1500,xl._MAX_LABEL_LEN=43,xl);Yg=Oh=mR([yh(1,Fi),yh(2,gr),yh(3,Y5),yh(4,Vs),yh(5,mo),yh(6,sn)],Yg);function _R(o){return o.replace(/[ \t]/g," ")}Qn.registerCommand("_executeInlayHintProvider",async(o,...e)=>{const[t,i]=e;Pn(jn.isUri(t)),Pn(Q.isIRange(i));const{inlayHintsProvider:n}=o.get(Fi),s=await o.get(fa).createModelReference(t);try{const r=await Km.create(n,s.object.textEditorModel,[Q.lift(i)],an.None),a=r.items.map(d=>d.hint);return setTimeout(()=>r.dispose(),0),a}finally{s.dispose()}});var bR=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Zl=function(o,e){return function(t,i){e(t,i,o)}};class $8 extends am{constructor(e,t,i,n){super(10,t,e.item.anchor.range,i,n,!0),this.part=e}}let ev=class extends Zg{constructor(e,t,i,n,s,r,a,d,u){super(e,t,i,r,d,n,s,u),this._resolverService=a,this.hoverOrdinal=6}suggestHoverAnchor(e){var n;if(!Yg.get(this._editor)||e.target.type!==6)return null;const i=(n=e.target.detail.injectedText)==null?void 0:n.options;return i instanceof $w&&i.attachedData instanceof fE?new $8(i.attachedData,this,e.event.posx,e.event.posy):null}computeSync(){return[]}computeAsync(e,t,i){return e instanceof $8?new sa(async n=>{const{part:s}=e;if(await s.item.resolve(i),i.isCancellationRequested)return;let r;typeof s.item.hint.tooltip=="string"?r=new lo().appendText(s.item.hint.tooltip):s.item.hint.tooltip&&(r=s.item.hint.tooltip),r&&n.emitOne(new Ir(this,e.range,[r],!1,0)),Yo(s.item.hint.textEdits)&&n.emitOne(new Ir(this,e.range,[new lo().appendText(S("hint.dbl","Double-click to insert"))],!1,10001));let a;if(typeof s.part.tooltip=="string"?a=new lo().appendText(s.part.tooltip):s.part.tooltip&&(a=s.part.tooltip),a&&n.emitOne(new Ir(this,e.range,[a],!1,1)),s.part.location||s.part.command){let u;const g=this._editor.getOption(78)==="altKey"?$a?S("links.navigate.kb.meta.mac","cmd + click"):S("links.navigate.kb.meta","ctrl + click"):$a?S("links.navigate.kb.alt.mac","option + click"):S("links.navigate.kb.alt","alt + click");s.part.location&&s.part.command?u=new lo().appendText(S("hint.defAndCommand","Go to Definition ({0}), right click for more",g)):s.part.location?u=new lo().appendText(S("hint.def","Go to Definition ({0})",g)):s.part.command&&(u=new lo(`[${S("hint.cmd","Execute Command")}](${KM(s.part.command)} "${s.part.command.title}") (${g})`,{isTrusted:!0})),u&&n.emitOne(new Ir(this,e.range,[u],!1,1e4))}const d=await this._resolveInlayHintLabelPartHover(s,i);for await(const u of d)n.emitOne(u)}):sa.EMPTY}async _resolveInlayHintLabelPartHover(e,t){if(!e.part.location)return sa.EMPTY;const{uri:i,range:n}=e.part.location,s=await this._resolverService.createModelReference(i);try{const r=s.object.textEditorModel;return this._languageFeaturesService.hoverProvider.has(r)?k9(this._languageFeaturesService.hoverProvider,r,new Bi(n.startLineNumber,n.startColumn),t).filter(a=>!Pg(a.hover.contents)).map(a=>new Ir(this,e.item.anchor.range,a.hover.contents,!1,2+a.ordinal)):sa.EMPTY}finally{s.dispose()}}};ev=bR([Zl(1,ha),Zl(2,da),Zl(3,As),Zl(4,Pp),Zl(5,ss),Zl(6,fa),Zl(7,Fi),Zl(8,Vs)],ev);class T9 extends Rt{constructor(e,t,i,n,s,r){super();const a=t.anchor,d=t.hoverParts;this._renderedHoverParts=this._register(new gE(e,i,d,r,s));const{showAtPosition:u,showAtSecondaryPosition:f}=T9.computeHoverPositions(e,a.range,d);this.shouldAppearBeforeContent=d.some(g=>g.isBeforeContent),this.showAtPosition=u,this.showAtSecondaryPosition=f,this.initialMousePosX=a.initialMousePosX,this.initialMousePosY=a.initialMousePosY,this.shouldFocus=n.shouldFocus,this.source=n.source}get domNode(){return this._renderedHoverParts.domNode}get domNodeHasChildren(){return this._renderedHoverParts.domNodeHasChildren}get focusedHoverPartIndex(){return this._renderedHoverParts.focusedHoverPartIndex}async updateHoverVerbosityLevel(e,t,i){this._renderedHoverParts.updateHoverVerbosityLevel(e,t,i)}isColorPickerVisible(){return this._renderedHoverParts.isColorPickerVisible()}static computeHoverPositions(e,t,i){let n=1;if(e.hasModel()){const f=e._getViewModel(),g=f.coordinatesConverter,p=g.convertModelRangeToViewRange(t),C=f.getLineMinColumn(p.startLineNumber),b=new Bi(p.startLineNumber,C);n=g.convertViewPositionToModelPosition(b).column}const s=t.startLineNumber;let r=t.startColumn,a;for(const f of i){const g=f.range,p=g.startLineNumber===s,C=g.endLineNumber===s;if(p&&C){const y=g.startColumn,w=Math.min(r,y);r=Math.max(w,n)}f.forceShowAtRange&&(a=g)}let d,u;if(a){const f=a.getStartPosition();d=f,u=f}else d=t.getStartPosition(),u=new Bi(s,r);return{showAtPosition:d,showAtSecondaryPosition:u}}}class CR{constructor(e,t){this._statusBar=t,e.appendChild(this._statusBar.hoverElement)}get hoverElement(){return this._statusBar.hoverElement}get actions(){return this._statusBar.actions}dispose(){this._statusBar.dispose()}}const n_=class n_ extends Rt{constructor(e,t,i,n,s){super(),this._renderedParts=[],this._focusedHoverPartIndex=-1,this._context=s,this._fragment=document.createDocumentFragment(),this._register(this._renderParts(t,i,s,n)),this._register(this._registerListenersOnRenderedParts()),this._register(this._createEditorDecorations(e,i)),this._updateMarkdownAndColorParticipantInfo(t)}_createEditorDecorations(e,t){if(t.length===0)return Rt.None;let i=t[0].range;for(const s of t){const r=s.range;i=Q.plusRange(i,r)}const n=e.createDecorationsCollection();return n.set([{range:i,options:n_._DECORATION_OPTIONS}]),is(()=>{n.clear()})}_renderParts(e,t,i,n){const s=new Gm(n),r={fragment:this._fragment,statusBar:s,...i},a=new Tt;for(const u of e){const f=this._renderHoverPartsForParticipant(t,u,r);a.add(f);for(const g of f.renderedHoverParts)this._renderedParts.push({type:"hoverPart",participant:u,hoverPart:g.hoverPart,hoverElement:g.hoverElement})}const d=this._renderStatusBar(this._fragment,s);return d&&(a.add(d),this._renderedParts.push({type:"statusBar",hoverElement:d.hoverElement,actions:d.actions})),is(()=>{a.dispose()})}_renderHoverPartsForParticipant(e,t,i){const n=e.filter(r=>r.owner===t);return n.length>0?t.renderHoverParts(i,n):new zu([])}_renderStatusBar(e,t){if(t.hasContent)return new CR(e,t)}_registerListenersOnRenderedParts(){const e=new Tt;return this._renderedParts.forEach((t,i)=>{const n=t.hoverElement;n.tabIndex=0,e.add(Bn(n,as.FOCUS_IN,s=>{s.stopPropagation(),this._focusedHoverPartIndex=i})),e.add(Bn(n,as.FOCUS_OUT,s=>{s.stopPropagation(),this._focusedHoverPartIndex=-1}))}),e}_updateMarkdownAndColorParticipantInfo(e){const t=e.find(i=>i instanceof Zg&&!(i instanceof ev));t&&(this._markdownHoverParticipant=t),this._colorHoverParticipant=e.find(i=>i instanceof Gg)}async updateHoverVerbosityLevel(e,t,i){if(!this._markdownHoverParticipant)return;const n=this._normalizedIndexToMarkdownHoverIndexRange(this._markdownHoverParticipant,t);if(n===void 0)return;const s=await this._markdownHoverParticipant.updateMarkdownHoverVerbosityLevel(e,n,i);s&&(this._renderedParts[t]={type:"hoverPart",participant:this._markdownHoverParticipant,hoverPart:s.hoverPart,hoverElement:s.hoverElement},this._context.onContentsChanged())}isColorPickerVisible(){var e;return((e=this._colorHoverParticipant)==null?void 0:e.isColorPickerVisible())??!1}_normalizedIndexToMarkdownHoverIndexRange(e,t){const i=this._renderedParts[t];if(!i||i.type!=="hoverPart"||!(i.participant===e))return;const s=this._renderedParts.findIndex(r=>r.type==="hoverPart"&&r.participant===e);if(s===-1)throw new O0;return t-s}get domNode(){return this._fragment}get domNodeHasChildren(){return this._fragment.hasChildNodes()}get focusedHoverPartIndex(){return this._focusedHoverPartIndex}};n_._DECORATION_OPTIONS=vn.register({description:"content-hover-highlight",className:"hoverHighlight"});let gE=n_;var ER=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},U8=function(o,e){return function(t,i){e(t,i,o)}};let pE=class extends Rt{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._currentResult=null,this._onContentsChanged=this._register(new rn),this.onContentsChanged=this._onContentsChanged.event,this._contentHoverWidget=this._register(this._instantiationService.createInstance(tE,this._editor)),this._participants=this._initializeHoverParticipants(),this._computer=new qm(this._editor,this._participants),this._hoverOperation=this._register(new P5(this._editor,this._computer)),this._registerListeners()}_initializeHoverParticipants(){const e=[];for(const t of th.getAll()){const i=this._instantiationService.createInstance(t,this._editor);e.push(i)}return e.sort((t,i)=>t.hoverOrdinal-i.hoverOrdinal),this._register(this._contentHoverWidget.onDidResize(()=>{this._participants.forEach(t=>{var i;return(i=t.handleResize)==null?void 0:i.call(t)})})),e}_registerListeners(){this._register(this._hoverOperation.onResult(t=>{if(!this._computer.anchor)return;const i=t.hasLoadingMessage?this._addLoadingMessage(t.value):t.value;this._withResult(new T5(this._computer.anchor,i,t.isComplete))}));const e=this._contentHoverWidget.getDomNode();this._register(Sl(e,"keydown",t=>{t.equals(9)&&this.hide()})),this._register(Sl(e,"mouseleave",t=>{this._onMouseLeave(t)})),this._register(X_.onDidChange(()=>{this._contentHoverWidget.position&&this._currentResult&&this._setCurrentResult(this._currentResult)}))}_startShowingOrUpdateHover(e,t,i,n,s){if(!(this._contentHoverWidget.position&&this._currentResult))return e?(this._startHoverOperationIfNecessary(e,t,i,n,!1),!0):!1;const a=this._editor.getOption(60).sticky,d=s&&this._contentHoverWidget.isMouseGettingCloser(s.event.posx,s.event.posy);return a&&d?(e&&this._startHoverOperationIfNecessary(e,t,i,n,!0),!0):e?this._currentResult.anchor.equals(e)?!0:e.canAdoptVisibleHover(this._currentResult.anchor,this._contentHoverWidget.position)?(this._setCurrentResult(this._currentResult.filter(e)),this._startHoverOperationIfNecessary(e,t,i,n,!1),!0):(this._setCurrentResult(null),this._startHoverOperationIfNecessary(e,t,i,n,!1),!0):(this._setCurrentResult(null),!1)}_startHoverOperationIfNecessary(e,t,i,n,s){this._computer.anchor&&this._computer.anchor.equals(e)||(this._hoverOperation.cancel(),this._computer.anchor=e,this._computer.shouldFocus=n,this._computer.source=i,this._computer.insistOnKeepingHoverVisible=s,this._hoverOperation.start(t))}_setCurrentResult(e){let t=e;if(this._currentResult===t)return;t&&t.hoverParts.length===0&&(t=null),this._currentResult=t,this._currentResult?this._showHover(this._currentResult):this._hideHover()}_addLoadingMessage(e){if(!this._computer.anchor)return e;for(const t of this._participants){if(!t.createLoadingMessage)continue;const i=t.createLoadingMessage(this._computer.anchor);if(i)return e.slice(0).concat([i])}return e}_withResult(e){if(this._contentHoverWidget.position&&this._currentResult&&this._currentResult.isComplete||this._setCurrentResult(e),!e.isComplete)return;const n=e.hoverParts.length===0,s=this._computer.insistOnKeepingHoverVisible;n&&s||this._setCurrentResult(e)}_showHover(e){const t=this._getHoverContext();this._renderedContentHover=new T9(this._editor,e,this._participants,this._computer,t,this._keybindingService),this._renderedContentHover.domNodeHasChildren?this._contentHoverWidget.show(this._renderedContentHover):this._renderedContentHover.dispose()}_hideHover(){this._contentHoverWidget.hide()}_getHoverContext(){return{hide:()=>{this.hide()},onContentsChanged:()=>{this._onContentsChanged.fire(),this._contentHoverWidget.onContentsChanged()},setMinimumDimensions:n=>{this._contentHoverWidget.setMinimumDimensions(n)}}}showsOrWillShow(e){if(this._contentHoverWidget.isResizing)return!0;const i=this._findHoverAnchorCandidates(e);if(!(i.length>0))return this._startShowingOrUpdateHover(null,0,0,!1,e);const s=i[0];return this._startShowingOrUpdateHover(s,0,0,!1,e)}_findHoverAnchorCandidates(e){const t=[];for(const n of this._participants){if(!n.suggestHoverAnchor)continue;const s=n.suggestHoverAnchor(e);s&&t.push(s)}const i=e.target;switch(i.type){case 6:{t.push(new _C(0,i.range,e.event.posx,e.event.posy));break}case 7:{const n=this._editor.getOption(50).typicalHalfwidthCharacterWidth/2;if(!(!i.detail.isAfterLines&&typeof i.detail.horizontalDistanceToText=="number"&&i.detail.horizontalDistanceToText<n))break;t.push(new _C(0,i.range,e.event.posx,e.event.posy));break}}return t.sort((n,s)=>s.priority-n.priority),t}_onMouseLeave(e){const t=this._editor.getDomNode();(!t||!mb(t,e.x,e.y))&&this.hide()}startShowingAtRange(e,t,i,n){this._startShowingOrUpdateHover(new _C(0,e,void 0,void 0),t,i,n,null)}async updateHoverVerbosityLevel(e,t,i){var n;(n=this._renderedContentHover)==null||n.updateHoverVerbosityLevel(e,t,i)}focusedHoverPartIndex(){var e;return((e=this._renderedContentHover)==null?void 0:e.focusedHoverPartIndex)??-1}containsNode(e){return e?this._contentHoverWidget.getDomNode().contains(e):!1}focus(){this._contentHoverWidget.focus()}scrollUp(){this._contentHoverWidget.scrollUp()}scrollDown(){this._contentHoverWidget.scrollDown()}scrollLeft(){this._contentHoverWidget.scrollLeft()}scrollRight(){this._contentHoverWidget.scrollRight()}pageUp(){this._contentHoverWidget.pageUp()}pageDown(){this._contentHoverWidget.pageDown()}goToTop(){this._contentHoverWidget.goToTop()}goToBottom(){this._contentHoverWidget.goToBottom()}hide(){this._computer.anchor=null,this._hoverOperation.cancel(),this._setCurrentResult(null)}getDomNode(){return this._contentHoverWidget.getDomNode()}get isColorPickerVisible(){var e;return((e=this._renderedContentHover)==null?void 0:e.isColorPickerVisible())??!1}get isVisibleFromKeyboard(){return this._contentHoverWidget.isVisibleFromKeyboard}get isVisible(){return this._contentHoverWidget.isVisible}get isFocused(){return this._contentHoverWidget.isFocused}get isResizing(){return this._contentHoverWidget.isResizing}get widget(){return this._contentHoverWidget}};pE=ER([U8(1,sn),U8(2,As)],pE);var yR=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},q8=function(o,e){return function(t,i){e(t,i,o)}},xE,Jd;let ro=(Jd=class extends Rt{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._onHoverContentsChanged=this._register(new rn),this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new Tt,this._hoverState={mouseDown:!1,activatedByDecoratorClick:!1},this._reactToEditorMouseMoveRunner=this._register(new Ms(()=>this._reactToEditorMouseMove(this._mouseMoveEvent),0)),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(60)&&(this._unhookListeners(),this._hookListeners())}))}static get(e){return e.getContribution(xE.ID)}_hookListeners(){const e=this._editor.getOption(60);this._hoverSettings={enabled:e.enabled,sticky:e.sticky,hidingDelay:e.hidingDelay},e.enabled?(this._listenersStore.add(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))):(this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))),this._listenersStore.add(this._editor.onMouseLeave(t=>this._onEditorMouseLeave(t))),this._listenersStore.add(this._editor.onDidChangeModel(()=>{this._cancelScheduler(),this._hideWidgets()})),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange(t=>this._onEditorScrollChanged(t)))}_unhookListeners(){this._listenersStore.clear()}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_onEditorScrollChanged(e){(e.scrollTopChanged||e.scrollLeftChanged)&&this._hideWidgets()}_onEditorMouseDown(e){this._hoverState.mouseDown=!0,!this._shouldNotHideCurrentHoverWidget(e)&&this._hideWidgets()}_shouldNotHideCurrentHoverWidget(e){return this._isMouseOnContentHoverWidget(e)||this._isContentWidgetResizing()}_isMouseOnContentHoverWidget(e){var i;const t=(i=this._contentWidget)==null?void 0:i.getDomNode();return t?mb(t,e.event.posx,e.event.posy):!1}_onEditorMouseUp(){this._hoverState.mouseDown=!1}_onEditorMouseLeave(e){this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._cancelScheduler(),this._shouldNotHideCurrentHoverWidget(e))||this._hideWidgets()}_shouldNotRecomputeCurrentHoverWidget(e){const t=this._hoverSettings.sticky,i=(r,a)=>{const d=this._isMouseOnContentHoverWidget(r);return a&&d},n=r=>{var u;const a=this._isMouseOnContentHoverWidget(r),d=((u=this._contentWidget)==null?void 0:u.isColorPickerVisible)??!1;return a&&d},s=(r,a)=>{var d,u,f,g;return(a&&((u=this._contentWidget)==null?void 0:u.containsNode((d=r.event.browserEvent.view)==null?void 0:d.document.activeElement))&&!((g=(f=r.event.browserEvent.view)==null?void 0:f.getSelection())!=null&&g.isCollapsed))??!1};return i(e,t)||n(e)||s(e,t)}_onEditorMouseMove(e){var a,d,u,f;if(this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._mouseMoveEvent=e,(a=this._contentWidget)!=null&&a.isFocused||(d=this._contentWidget)!=null&&d.isResizing))return;const t=this._hoverSettings.sticky;if(t&&((u=this._contentWidget)!=null&&u.isVisibleFromKeyboard))return;if(this._shouldNotRecomputeCurrentHoverWidget(e)){this._reactToEditorMouseMoveRunner.cancel();return}const n=this._hoverSettings.hidingDelay;if(((f=this._contentWidget)==null?void 0:f.isVisible)&&t&&n>0){this._reactToEditorMouseMoveRunner.isScheduled()||this._reactToEditorMouseMoveRunner.schedule(n);return}this._reactToEditorMouseMove(e)}_reactToEditorMouseMove(e){var d;if(!e)return;const i=(d=e.target.element)==null?void 0:d.classList.contains("colorpicker-color-decoration"),n=this._editor.getOption(149),s=this._hoverSettings.enabled,r=this._hoverState.activatedByDecoratorClick;if(i&&(n==="click"&&!r||n==="hover"&&!s||n==="clickAndHover"&&!s&&!r)||!i&&!s&&!r){this._hideWidgets();return}this._tryShowHoverWidget(e)||this._hideWidgets()}_tryShowHoverWidget(e){return this._getOrCreateContentWidget().showsOrWillShow(e)}_onKeyDown(e){var n;if(!this._editor.hasModel())return;const t=this._keybindingService.softDispatch(e,this._editor.getDomNode()),i=t.kind===1||t.kind===2&&(t.commandId===B5||t.commandId===pb||t.commandId===xb)&&((n=this._contentWidget)==null?void 0:n.isVisible);e.keyCode===5||e.keyCode===6||e.keyCode===57||e.keyCode===4||i||this._hideWidgets()}_hideWidgets(){var e,t;this._hoverState.mouseDown&&((e=this._contentWidget)!=null&&e.isColorPickerVisible)||K0.dropDownVisible||(this._hoverState.activatedByDecoratorClick=!1,(t=this._contentWidget)==null||t.hide())}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance(pE,this._editor),this._listenersStore.add(this._contentWidget.onContentsChanged(()=>this._onHoverContentsChanged.fire()))),this._contentWidget}showContentHover(e,t,i,n,s=!1){this._hoverState.activatedByDecoratorClick=s,this._getOrCreateContentWidget().startShowingAtRange(e,t,i,n)}_isContentWidgetResizing(){var e;return((e=this._contentWidget)==null?void 0:e.widget.isResizing)||!1}focusedHoverPartIndex(){return this._getOrCreateContentWidget().focusedHoverPartIndex()}updateHoverVerbosityLevel(e,t,i){this._getOrCreateContentWidget().updateHoverVerbosityLevel(e,t,i)}focus(){var e;(e=this._contentWidget)==null||e.focus()}scrollUp(){var e;(e=this._contentWidget)==null||e.scrollUp()}scrollDown(){var e;(e=this._contentWidget)==null||e.scrollDown()}scrollLeft(){var e;(e=this._contentWidget)==null||e.scrollLeft()}scrollRight(){var e;(e=this._contentWidget)==null||e.scrollRight()}pageUp(){var e;(e=this._contentWidget)==null||e.pageUp()}pageDown(){var e;(e=this._contentWidget)==null||e.pageDown()}goToTop(){var e;(e=this._contentWidget)==null||e.goToTop()}goToBottom(){var e;(e=this._contentWidget)==null||e.goToBottom()}get isColorPickerVisible(){var e;return(e=this._contentWidget)==null?void 0:e.isColorPickerVisible}get isHoverVisible(){var e;return(e=this._contentWidget)==null?void 0:e.isVisible}dispose(){var e;super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),(e=this._contentWidget)==null||e.dispose()}},xE=Jd,Jd.ID="editor.contrib.contentHover",Jd);ro=xE=yR([q8(1,sn),q8(2,As)],ro);const yS=class yS extends Rt{constructor(e){super(),this._editor=e,this._register(e.onMouseDown(t=>this.onMouseDown(t)))}dispose(){super.dispose()}onMouseDown(e){const t=this._editor.getOption(149);if(t!=="click"&&t!=="clickAndHover")return;const i=e.target;if(i.type!==6||!i.detail.injectedText||i.detail.injectedText.options.attachedData!==E5||!i.range)return;const n=this._editor.getContribution(ro.ID);if(n&&!n.isColorPickerVisible){const s=new Q(i.range.startLineNumber,i.range.startColumn+1,i.range.endLineNumber,i.range.endColumn+1);n.showContentHover(s,1,0,!1,!0)}}};yS.ID="editor.contrib.colorContribution";let tv=yS;hn(tv.ID,tv,2);th.register(Gg);var Q5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Kh=function(o,e){return function(t,i){e(t,i,o)}},mE,vE,eu;let ju=(eu=class extends Rt{constructor(e,t,i){super(),this._editor=e,this._instantiationService=i,this._standaloneColorPickerWidget=null,this._standaloneColorPickerVisible=q.standaloneColorPickerVisible.bindTo(t),this._standaloneColorPickerFocused=q.standaloneColorPickerFocused.bindTo(t)}showOrFocus(){var e;this._editor.hasModel()&&(this._standaloneColorPickerVisible.get()?this._standaloneColorPickerFocused.get()||(e=this._standaloneColorPickerWidget)==null||e.focus():this._standaloneColorPickerWidget=this._instantiationService.createInstance(_E,this._editor,this._standaloneColorPickerVisible,this._standaloneColorPickerFocused))}hide(){var e;this._standaloneColorPickerFocused.set(!1),this._standaloneColorPickerVisible.set(!1),(e=this._standaloneColorPickerWidget)==null||e.hide(),this._editor.focus()}insertColor(){var e;(e=this._standaloneColorPickerWidget)==null||e.updateEditor(),this.hide()}static get(e){return e.getContribution(mE.ID)}},mE=eu,eu.ID="editor.contrib.standaloneColorPickerController",eu);ju=mE=Q5([Kh(1,Fn),Kh(2,sn)],ju);hn(ju.ID,ju,1);const G8=8,wR=22;var tu;let _E=(tu=class extends Rt{constructor(e,t,i,n,s,r,a){var g;super(),this._editor=e,this._standaloneColorPickerVisible=t,this._standaloneColorPickerFocused=i,this._keybindingService=s,this._languageFeaturesService=r,this._editorWorkerService=a,this.allowEditorOverflow=!0,this._position=void 0,this._body=document.createElement("div"),this._colorHover=null,this._selectionSetInEditor=!1,this._onResult=this._register(new rn),this.onResult=this._onResult.event,this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=n.createInstance(Kg,this._editor),this._position=(g=this._editor._getViewModel())==null?void 0:g.getPrimaryCursorState().modelState.position;const d=this._editor.getSelection(),u=d?{startLineNumber:d.startLineNumber,startColumn:d.startColumn,endLineNumber:d.endLineNumber,endColumn:d.endColumn}:{startLineNumber:0,endLineNumber:0,endColumn:0,startColumn:0},f=this._register(I0(this._body));this._register(f.onDidBlur(p=>{this.hide()})),this._register(f.onDidFocus(p=>{this.focus()})),this._register(this._editor.onDidChangeCursorPosition(()=>{this._selectionSetInEditor?this._selectionSetInEditor=!1:this.hide()})),this._register(this._editor.onMouseMove(p=>{var b;const C=(b=p.target.element)==null?void 0:b.classList;C&&C.contains("colorpicker-color-decoration")&&this.hide()})),this._register(this.onResult(p=>{this._render(p.value,p.foundInEditor)})),this._start(u),this._body.style.zIndex="50",this._editor.addContentWidget(this)}updateEditor(){this._colorHover&&this._standaloneColorPickerParticipant.updateEditorModel(this._colorHover)}getId(){return vE.ID}getDomNode(){return this._body}getPosition(){if(!this._position)return null;const e=this._editor.getOption(60).above;return{position:this._position,secondaryPosition:this._position,preference:e?[1,2]:[2,1],positionAffinity:2}}hide(){this.dispose(),this._standaloneColorPickerVisible.set(!1),this._standaloneColorPickerFocused.set(!1),this._editor.removeContentWidget(this),this._editor.focus()}focus(){this._standaloneColorPickerFocused.set(!0),this._body.focus()}async _start(e){const t=await this._computeAsync(e);t&&this._onResult.fire(new SR(t.result,t.foundInEditor))}async _computeAsync(e){if(!this._editor.hasModel())return null;const t={range:e,color:{red:0,green:0,blue:0,alpha:1}},i=await this._standaloneColorPickerParticipant.createColorHover(t,new qg(this._editorWorkerService),this._languageFeaturesService.colorProvider);return i?{result:i.colorHover,foundInEditor:i.foundInEditor}:null}_render(e,t){const i=document.createDocumentFragment(),n=this._register(new Gm(this._keybindingService)),s={fragment:i,statusBar:n,onContentsChanged:()=>{},hide:()=>this.hide()};this._colorHover=e;const r=this._standaloneColorPickerParticipant.renderHoverParts(s,[e]);if(!r)return;this._register(r.disposables);const a=r.colorPicker;this._body.classList.add("standalone-colorpicker-body"),this._body.style.maxHeight=Math.max(this._editor.getLayoutInfo().height/4,250)+"px",this._body.style.maxWidth=Math.max(this._editor.getLayoutInfo().width*.66,500)+"px",this._body.tabIndex=0,this._body.appendChild(i),a.layout();const d=a.body,u=d.saturationBox.domNode.clientWidth,f=d.domNode.clientWidth-u-wR-G8,g=a.body.enterButton;g==null||g.onClicked(()=>{this.updateEditor(),this.hide()});const p=a.header,C=p.pickedColorNode;C.style.width=u+G8+"px";const b=p.originalColorNode;b.style.width=f+"px";const y=a.header.closeButton;y==null||y.onClicked(()=>{this.hide()}),t&&(g&&(g.button.textContent="Replace"),this._selectionSetInEditor=!0,this._editor.setSelection(e.range)),this._editor.layoutContentWidget(this)}},vE=tu,tu.ID="editor.contrib.standaloneColorPickerWidget",tu);_E=vE=Q5([Kh(3,sn),Kh(4,As),Kh(5,Fi),Kh(6,Nl)],_E);class SR{constructor(e,t){this.value=e,this.foundInEditor=t}}class DR extends la{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{...Ai("showOrFocusStandaloneColorPicker","Show or Focus Standalone Color Picker"),mnemonicTitle:S({key:"mishowOrFocusStandaloneColorPicker",comment:["&& denotes a mnemonic"]},"&&Show or Focus Standalone Color Picker")},precondition:void 0,menu:[{id:ni.CommandPalette}],metadata:{description:Ai("showOrFocusStandaloneColorPickerDescription","Show or focus a standalone color picker which uses the default color provider. It displays hex/rgb/hsl colors.")}})}runEditorCommand(e,t){var i;(i=ju.get(t))==null||i.showOrFocus()}}class AR extends Ct{constructor(){super({id:"editor.action.hideColorPicker",label:S({key:"hideColorPicker",comment:["Action that hides the color picker"]},"Hide the Color Picker"),alias:"Hide the Color Picker",precondition:q.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100},metadata:{description:Ai("hideColorPickerDescription","Hide the standalone color picker.")}})}run(e,t){var i;(i=ju.get(t))==null||i.hide()}}class kR extends Ct{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:S({key:"insertColorWithStandaloneColorPicker",comment:["Action that inserts color with standalone color picker"]},"Insert Color with Standalone Color Picker"),alias:"Insert Color with Standalone Color Picker",precondition:q.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100},metadata:{description:Ai("insertColorWithStandaloneColorPickerDescription","Insert hex/rgb/hsl colors with the focused standalone color picker.")}})}run(e,t){var i;(i=ju.get(t))==null||i.insertColor()}}Le(AR);Le(kR);Vn(DR);class fc{constructor(e,t,i){this.languageConfigurationService=i,this._selection=e,this._insertSpace=t,this._usedEndToken=null}static _haystackHasNeedleAtOffset(e,t,i){if(i<0)return!1;const n=t.length,s=e.length;if(i+n>s)return!1;for(let r=0;r<n;r++){const a=e.charCodeAt(i+r),d=t.charCodeAt(r);if(a!==d&&!(a>=65&&a<=90&&a+32===d)&&!(d>=65&&d<=90&&d+32===a))return!1}return!0}_createOperationsForBlockComment(e,t,i,n,s,r){const a=e.startLineNumber,d=e.startColumn,u=e.endLineNumber,f=e.endColumn,g=s.getLineContent(a),p=s.getLineContent(u);let C=g.lastIndexOf(t,d-1+t.length),b=p.indexOf(i,f-1-i.length);if(C!==-1&&b!==-1)if(a===u)g.substring(C+t.length,b).indexOf(i)>=0&&(C=-1,b=-1);else{const w=g.substring(C+t.length),A=p.substring(0,b);(w.indexOf(i)>=0||A.indexOf(i)>=0)&&(C=-1,b=-1)}let y;C!==-1&&b!==-1?(n&&C+t.length<g.length&&g.charCodeAt(C+t.length)===32&&(t=t+" "),n&&b>0&&p.charCodeAt(b-1)===32&&(i=" "+i,b-=1),y=fc._createRemoveBlockCommentOperations(new Q(a,C+t.length+1,u,b+1),t,i)):(y=fc._createAddBlockCommentOperations(e,t,i,this._insertSpace),this._usedEndToken=y.length===1?i:null);for(const w of y)r.addTrackedEditOperation(w.range,w.text)}static _createRemoveBlockCommentOperations(e,t,i){const n=[];return Q.isEmpty(e)?n.push(cs.delete(new Q(e.startLineNumber,e.startColumn-t.length,e.endLineNumber,e.endColumn+i.length))):(n.push(cs.delete(new Q(e.startLineNumber,e.startColumn-t.length,e.startLineNumber,e.startColumn))),n.push(cs.delete(new Q(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn+i.length)))),n}static _createAddBlockCommentOperations(e,t,i,n){const s=[];return Q.isEmpty(e)?s.push(cs.replace(new Q(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),t+" "+i)):(s.push(cs.insert(new Bi(e.startLineNumber,e.startColumn),t+(n?" ":""))),s.push(cs.insert(new Bi(e.endLineNumber,e.endColumn),(n?" ":"")+i))),s}getEditOperations(e,t){const i=this._selection.startLineNumber,n=this._selection.startColumn;e.tokenization.tokenizeIfCheap(i);const s=e.getLanguageIdAtPosition(i,n),r=this.languageConfigurationService.getLanguageConfiguration(s).comments;!r||!r.blockCommentStartToken||!r.blockCommentEndToken||this._createOperationsForBlockComment(this._selection,r.blockCommentStartToken,r.blockCommentEndToken,this._insertSpace,e,t)}computeCursorState(e,t){const i=t.getInverseEditOperations();if(i.length===2){const n=i[0],s=i[1];return new $i(n.range.endLineNumber,n.range.endColumn,s.range.startLineNumber,s.range.startColumn)}else{const n=i[0].range,s=this._usedEndToken?-this._usedEndToken.length-1:0;return new $i(n.endLineNumber,n.endColumn+s,n.endLineNumber,n.endColumn+s)}}}class sl{constructor(e,t,i,n,s,r,a){this.languageConfigurationService=e,this._selection=t,this._indentSize=i,this._type=n,this._insertSpace=s,this._selectionId=null,this._deltaColumn=0,this._moveEndPositionDown=!1,this._ignoreEmptyLines=r,this._ignoreFirstLine=a||!1}static _gatherPreflightCommentStrings(e,t,i,n){e.tokenization.tokenizeIfCheap(t);const s=e.getLanguageIdAtPosition(t,1),r=n.getLanguageConfiguration(s).comments,a=r?r.lineCommentToken:null;if(!a)return null;const d=[];for(let u=0,f=i-t+1;u<f;u++)d[u]={ignore:!1,commentStr:a,commentStrOffset:0,commentStrLength:a.length};return d}static _analyzeLines(e,t,i,n,s,r,a,d){let u=!0,f;e===0?f=!0:e===1?f=!1:f=!0;for(let g=0,p=n.length;g<p;g++){const C=n[g],b=s+g;if(b===s&&a){C.ignore=!0;continue}const y=i.getLineContent(b),w=n1(y);if(w===-1){C.ignore=r,C.commentStrOffset=y.length;continue}if(u=!1,C.ignore=!1,C.commentStrOffset=w,f&&!fc._haystackHasNeedleAtOffset(y,C.commentStr,w)&&(e===0?f=!1:e===1||(C.ignore=!0)),f&&t){const A=w+C.commentStrLength;A<y.length&&y.charCodeAt(A)===32&&(C.commentStrLength+=1)}}if(e===0&&u){f=!1;for(let g=0,p=n.length;g<p;g++)n[g].ignore=!1}return{supported:!0,shouldRemoveComments:f,lines:n}}static _gatherPreflightData(e,t,i,n,s,r,a,d){const u=sl._gatherPreflightCommentStrings(i,n,s,d);return u===null?{supported:!1}:sl._analyzeLines(e,t,i,u,n,r,a,d)}_executeLineComments(e,t,i,n){let s;i.shouldRemoveComments?s=sl._createRemoveLineCommentsOperations(i.lines,n.startLineNumber):(sl._normalizeInsertionPoint(e,i.lines,n.startLineNumber,this._indentSize),s=this._createAddLineCommentsOperations(i.lines,n.startLineNumber));const r=new Bi(n.positionLineNumber,n.positionColumn);for(let a=0,d=s.length;a<d;a++)t.addEditOperation(s[a].range,s[a].text),Q.isEmpty(s[a].range)&&Q.getStartPosition(s[a].range).equals(r)&&e.getLineContent(r.lineNumber).length+1===r.column&&(this._deltaColumn=(s[a].text||"").length);this._selectionId=t.trackSelection(n)}_attemptRemoveBlockComment(e,t,i,n){let s=t.startLineNumber,r=t.endLineNumber;const a=n.length+Math.max(e.getLineFirstNonWhitespaceColumn(t.startLineNumber),t.startColumn);let d=e.getLineContent(s).lastIndexOf(i,a-1),u=e.getLineContent(r).indexOf(n,t.endColumn-1-i.length);return d!==-1&&u===-1&&(u=e.getLineContent(s).indexOf(n,d+i.length),r=s),d===-1&&u!==-1&&(d=e.getLineContent(r).lastIndexOf(i,u),s=r),t.isEmpty()&&(d===-1||u===-1)&&(d=e.getLineContent(s).indexOf(i),d!==-1&&(u=e.getLineContent(s).indexOf(n,d+i.length))),d!==-1&&e.getLineContent(s).charCodeAt(d+i.length)===32&&(i+=" "),u!==-1&&e.getLineContent(r).charCodeAt(u-1)===32&&(n=" "+n,u-=1),d!==-1&&u!==-1?fc._createRemoveBlockCommentOperations(new Q(s,d+i.length+1,r,u+1),i,n):null}_executeBlockComment(e,t,i){e.tokenization.tokenizeIfCheap(i.startLineNumber);const n=e.getLanguageIdAtPosition(i.startLineNumber,1),s=this.languageConfigurationService.getLanguageConfiguration(n).comments;if(!s||!s.blockCommentStartToken||!s.blockCommentEndToken)return;const r=s.blockCommentStartToken,a=s.blockCommentEndToken;let d=this._attemptRemoveBlockComment(e,i,r,a);if(!d){if(i.isEmpty()){const u=e.getLineContent(i.startLineNumber);let f=n1(u);f===-1&&(f=u.length),d=fc._createAddBlockCommentOperations(new Q(i.startLineNumber,f+1,i.startLineNumber,u.length+1),r,a,this._insertSpace)}else d=fc._createAddBlockCommentOperations(new Q(i.startLineNumber,e.getLineFirstNonWhitespaceColumn(i.startLineNumber),i.endLineNumber,e.getLineMaxColumn(i.endLineNumber)),r,a,this._insertSpace);d.length===1&&(this._deltaColumn=r.length+1)}this._selectionId=t.trackSelection(i);for(const u of d)t.addEditOperation(u.range,u.text)}getEditOperations(e,t){let i=this._selection;if(this._moveEndPositionDown=!1,i.startLineNumber===i.endLineNumber&&this._ignoreFirstLine){t.addEditOperation(new Q(i.startLineNumber,e.getLineMaxColumn(i.startLineNumber),i.startLineNumber+1,1),i.startLineNumber===e.getLineCount()?"":`
19
+ `),this._selectionId=t.trackSelection(i);return}i.startLineNumber<i.endLineNumber&&i.endColumn===1&&(this._moveEndPositionDown=!0,i=i.setEndPosition(i.endLineNumber-1,e.getLineMaxColumn(i.endLineNumber-1)));const n=sl._gatherPreflightData(this._type,this._insertSpace,e,i.startLineNumber,i.endLineNumber,this._ignoreEmptyLines,this._ignoreFirstLine,this.languageConfigurationService);return n.supported?this._executeLineComments(e,t,n,i):this._executeBlockComment(e,t,i)}computeCursorState(e,t){let i=t.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(i=i.setEndPosition(i.endLineNumber+1,1)),new $i(i.selectionStartLineNumber,i.selectionStartColumn+this._deltaColumn,i.positionLineNumber,i.positionColumn+this._deltaColumn)}static _createRemoveLineCommentsOperations(e,t){const i=[];for(let n=0,s=e.length;n<s;n++){const r=e[n];r.ignore||i.push(cs.delete(new Q(t+n,r.commentStrOffset+1,t+n,r.commentStrOffset+r.commentStrLength+1)))}return i}_createAddLineCommentsOperations(e,t){const i=[],n=this._insertSpace?" ":"";for(let s=0,r=e.length;s<r;s++){const a=e[s];a.ignore||i.push(cs.insert(new Bi(t+s,a.commentStrOffset+1),a.commentStr+n))}return i}static nextVisibleColumn(e,t,i,n){return i?e+(t-e%t):e+n}static _normalizeInsertionPoint(e,t,i,n){let s=1073741824,r,a;for(let d=0,u=t.length;d<u;d++){if(t[d].ignore)continue;const f=e.getLineContent(i+d);let g=0;for(let p=0,C=t[d].commentStrOffset;g<s&&p<C;p++)g=sl.nextVisibleColumn(g,n,f.charCodeAt(p)===9,1);g<s&&(s=g)}s=Math.floor(s/n)*n;for(let d=0,u=t.length;d<u;d++){if(t[d].ignore)continue;const f=e.getLineContent(i+d);let g=0;for(r=0,a=t[d].commentStrOffset;g<s&&r<a;r++)g=sl.nextVisibleColumn(g,n,f.charCodeAt(r)===9,1);g>s?t[d].commentStrOffset=r-1:t[d].commentStrOffset=r}}}class M9 extends Ct{constructor(e,t){super(t),this._type=e}run(e,t){const i=e.get(js);if(!t.hasModel())return;const n=t.getModel(),s=[],r=n.getOptions(),a=t.getOption(23),d=t.getSelections().map((f,g)=>({selection:f,index:g,ignoreFirstLine:!1}));d.sort((f,g)=>Q.compareRangesUsingStarts(f.selection,g.selection));let u=d[0];for(let f=1;f<d.length;f++){const g=d[f];u.selection.endLineNumber===g.selection.startLineNumber&&(u.index<g.index?g.ignoreFirstLine=!0:(u.ignoreFirstLine=!0,u=g))}for(const f of d)s.push(new sl(i,f.selection,r.indentSize,this._type,a.insertSpace,a.ignoreEmptyLines,f.ignoreFirstLine));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class BR extends M9{constructor(){super(0,{id:"editor.action.commentLine",label:S("comment.line","Toggle Line Comment"),alias:"Toggle Line Comment",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:ni.MenubarEditMenu,group:"5_insert",title:S({key:"miToggleLineComment",comment:["&& denotes a mnemonic"]},"&&Toggle Line Comment"),order:1}})}}class FR extends M9{constructor(){super(1,{id:"editor.action.addCommentLine",label:S("comment.line.add","Add Line Comment"),alias:"Add Line Comment",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2081),weight:100}})}}class LR extends M9{constructor(){super(2,{id:"editor.action.removeCommentLine",label:S("comment.line.remove","Remove Line Comment"),alias:"Remove Line Comment",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2099),weight:100}})}}class IR extends Ct{constructor(){super({id:"editor.action.blockComment",label:S("comment.block","Toggle Block Comment"),alias:"Toggle Block Comment",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:ni.MenubarEditMenu,group:"5_insert",title:S({key:"miToggleBlockComment",comment:["&& denotes a mnemonic"]},"Toggle &&Block Comment"),order:2}})}run(e,t){const i=e.get(js);if(!t.hasModel())return;const n=t.getOption(23),s=[],r=t.getSelections();for(const a of r)s.push(new fc(a,n.insertSpace,i));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}Le(BR);Le(FR);Le(LR);Le(IR);var PR=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ud=function(o,e){return function(t,i){e(t,i,o)}},bE,iu;let X0=(iu=class{static get(e){return e.getContribution(bE.ID)}constructor(e,t,i,n,s,r,a,d){this._contextMenuService=t,this._contextViewService=i,this._contextKeyService=n,this._keybindingService=s,this._menuService=r,this._configurationService=a,this._workspaceContextService=d,this._toDispose=new Tt,this._contextMenuIsBeingShownCount=0,this._editor=e,this._toDispose.add(this._editor.onContextMenu(u=>this._onContextMenu(u))),this._toDispose.add(this._editor.onMouseWheel(u=>{if(this._contextMenuIsBeingShownCount>0){const f=this._contextViewService.getContextViewElement(),g=u.srcElement;g.shadowRoot&&X3(f)===g.shadowRoot||this._contextViewService.hideContextView()}})),this._toDispose.add(this._editor.onKeyDown(u=>{this._editor.getOption(24)&&u.keyCode===58&&(u.preventDefault(),u.stopPropagation(),this.showContextMenu())}))}_onContextMenu(e){if(!this._editor.hasModel())return;if(!this._editor.getOption(24)){this._editor.focus(),e.target.position&&!this._editor.getSelection().containsPosition(e.target.position)&&this._editor.setPosition(e.target.position);return}if(e.target.type===12||e.target.type===6&&e.target.detail.injectedText)return;if(e.event.preventDefault(),e.event.stopPropagation(),e.target.type===11)return this._showScrollbarContextMenu(e.event);if(e.target.type!==6&&e.target.type!==7&&e.target.type!==1)return;if(this._editor.focus(),e.target.position){let i=!1;for(const n of this._editor.getSelections())if(n.containsPosition(e.target.position)){i=!0;break}i||this._editor.setPosition(e.target.position)}let t=null;e.target.type!==1&&(t=e.event),this.showContextMenu(t)}showContextMenu(e){if(!this._editor.getOption(24)||!this._editor.hasModel())return;const t=this._getMenuActions(this._editor.getModel(),this._editor.contextMenuId);t.length>0&&this._doShowContextMenu(t,e)}_getMenuActions(e,t){const i=[],n=this._menuService.getMenuActions(t,this._contextKeyService,{arg:e.uri});for(const s of n){const[,r]=s;let a=0;for(const d of r)if(d instanceof Y3){const u=this._getMenuActions(e,d.item.submenu);u.length>0&&(i.push(new NS(d.id,d.label,u)),a++)}else i.push(d),a++;a&&i.push(new Ig)}return i.length&&i.pop(),i}_doShowContextMenu(e,t=null){if(!this._editor.hasModel())return;const i=this._editor.getOption(60);this._editor.updateOptions({hover:{enabled:!1}});let n=t;if(!n){this._editor.revealPosition(this._editor.getPosition(),1),this._editor.render();const r=this._editor.getScrolledVisiblePosition(this._editor.getPosition()),a=yo(this._editor.getDomNode()),d=a.left+r.left,u=a.top+r.top+r.height;n={x:d,y:u}}const s=this._editor.getOption(128)&&!s1;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:s?this._editor.getOverflowWidgetsDomNode()??this._editor.getDomNode():void 0,getAnchor:()=>n,getActions:()=>e,getActionViewItem:r=>{const a=this._keybindingFor(r);if(a)return new t1(r,r,{label:!0,keybinding:a.getLabel(),isMenu:!0});const d=r;return typeof d.getActionViewItem=="function"?d.getActionViewItem():new t1(r,r,{icon:!0,label:!0,isMenu:!0})},getKeyBinding:r=>this._keybindingFor(r),onHide:r=>{this._contextMenuIsBeingShownCount--,this._editor.updateOptions({hover:i})}})}_showScrollbarContextMenu(e){if(!this._editor.hasModel()||Q3(this._workspaceContextService.getWorkspace()))return;const t=this._editor.getOption(73);let i=0;const n=u=>({id:`menu-action-${++i}`,label:u.label,tooltip:"",class:void 0,enabled:typeof u.enabled>"u"?!0:u.enabled,checked:u.checked,run:u.run}),s=(u,f)=>new NS(`menu-action-${++i}`,u,f,void 0),r=(u,f,g,p,C)=>{if(!f)return n({label:u,enabled:f,run:()=>{}});const b=w=>()=>{this._configurationService.updateValue(g,w)},y=[];for(const w of C)y.push(n({label:w.label,checked:p===w.value,run:b(w.value)}));return s(u,y)},a=[];a.push(n({label:S("context.minimap.minimap","Minimap"),checked:t.enabled,run:()=>{this._configurationService.updateValue("editor.minimap.enabled",!t.enabled)}})),a.push(new Ig),a.push(n({label:S("context.minimap.renderCharacters","Render Characters"),enabled:t.enabled,checked:t.renderCharacters,run:()=>{this._configurationService.updateValue("editor.minimap.renderCharacters",!t.renderCharacters)}})),a.push(r(S("context.minimap.size","Vertical size"),t.enabled,"editor.minimap.size",t.size,[{label:S("context.minimap.size.proportional","Proportional"),value:"proportional"},{label:S("context.minimap.size.fill","Fill"),value:"fill"},{label:S("context.minimap.size.fit","Fit"),value:"fit"}])),a.push(r(S("context.minimap.slider","Slider"),t.enabled,"editor.minimap.showSlider",t.showSlider,[{label:S("context.minimap.slider.mouseover","Mouse Over"),value:"mouseover"},{label:S("context.minimap.slider.always","Always"),value:"always"}]));const d=this._editor.getOption(128)&&!s1;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:d?this._editor.getDomNode():void 0,getAnchor:()=>e,getActions:()=>a,onHide:u=>{this._contextMenuIsBeingShownCount--,this._editor.focus()}})}_keybindingFor(e){return this._keybindingService.lookupKeybinding(e.id)}dispose(){this._contextMenuIsBeingShownCount>0&&this._contextViewService.hideContextView(),this._toDispose.dispose()}},bE=iu,iu.ID="editor.contrib.contextmenu",iu);X0=bE=PR([ud(1,af),ud(2,j_),ud(3,Fn),ud(4,As),ud(5,Zu),ud(6,ss),ud(7,F0)],X0);class TR extends Ct{constructor(){super({id:"editor.action.showContextMenu",label:S("action.showContextMenu.label","Show Editor Context Menu"),alias:"Show Editor Context Menu",precondition:void 0,kbOpts:{kbExpr:q.textInputFocus,primary:1092,weight:100}})}run(e,t){var i;(i=X0.get(t))==null||i.showContextMenu()}}hn(X0.ID,X0,2);Le(TR);class CC{constructor(e){this.selections=e}equals(e){const t=this.selections.length,i=e.selections.length;if(t!==i)return!1;for(let n=0;n<t;n++)if(!this.selections[n].equalsSelection(e.selections[n]))return!1;return!0}}class EC{constructor(e,t,i){this.cursorState=e,this.scrollTop=t,this.scrollLeft=i}}const s_=class s_ extends Rt{static get(e){return e.getContribution(s_.ID)}constructor(e){super(),this._editor=e,this._isCursorUndoRedo=!1,this._undoStack=[],this._redoStack=[],this._register(e.onDidChangeModel(t=>{this._undoStack=[],this._redoStack=[]})),this._register(e.onDidChangeModelContent(t=>{this._undoStack=[],this._redoStack=[]})),this._register(e.onDidChangeCursorSelection(t=>{if(this._isCursorUndoRedo||!t.oldSelections||t.oldModelVersionId!==t.modelVersionId)return;const i=new CC(t.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(i)||(this._undoStack.push(new EC(i,e.getScrollTop(),e.getScrollLeft())),this._redoStack=[],this._undoStack.length>50&&this._undoStack.shift())}))}cursorUndo(){!this._editor.hasModel()||this._undoStack.length===0||(this._redoStack.push(new EC(new CC(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._undoStack.pop()))}cursorRedo(){!this._editor.hasModel()||this._redoStack.length===0||(this._undoStack.push(new EC(new CC(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._redoStack.pop()))}_applyState(e){this._isCursorUndoRedo=!0,this._editor.setSelections(e.cursorState.selections),this._editor.setScrollPosition({scrollTop:e.scrollTop,scrollLeft:e.scrollLeft}),this._isCursorUndoRedo=!1}};s_.ID="editor.contrib.cursorUndoRedoController";let Y0=s_;class MR extends Ct{constructor(){super({id:"cursorUndo",label:S("cursor.undo","Cursor Undo"),alias:"Cursor Undo",precondition:void 0,kbOpts:{kbExpr:q.textInputFocus,primary:2099,weight:100}})}run(e,t,i){var n;(n=Y0.get(t))==null||n.cursorUndo()}}class RR extends Ct{constructor(){super({id:"cursorRedo",label:S("cursor.redo","Cursor Redo"),alias:"Cursor Redo",precondition:void 0})}run(e,t,i){var n;(n=Y0.get(t))==null||n.cursorRedo()}}hn(Y0.ID,Y0,0);Le(MR);Le(RR);class NR{constructor(e,t,i){this.selection=e,this.targetPosition=t,this.copy=i,this.targetSelection=null}getEditOperations(e,t){const i=e.getValueInRange(this.selection);if(this.copy||t.addEditOperation(this.selection,null),t.addEditOperation(new Q(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column),i),this.selection.containsPosition(this.targetPosition)&&!(this.copy&&(this.selection.getEndPosition().equals(this.targetPosition)||this.selection.getStartPosition().equals(this.targetPosition)))){this.targetSelection=this.selection;return}if(this.copy){this.targetSelection=new $i(this.targetPosition.lineNumber,this.targetPosition.column,this.selection.endLineNumber-this.selection.startLineNumber+this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}if(this.targetPosition.lineNumber>this.selection.endLineNumber){this.targetSelection=new $i(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}if(this.targetPosition.lineNumber<this.selection.endLineNumber){this.targetSelection=new $i(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber+this.selection.endLineNumber-this.selection.startLineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}this.selection.endColumn<=this.targetPosition.column?this.targetSelection=new $i(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column-this.selection.endColumn+this.selection.startColumn:this.targetPosition.column-this.selection.endColumn+this.selection.startColumn,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column:this.selection.endColumn):this.targetSelection=new $i(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column+this.selection.endColumn-this.selection.startColumn)}computeCursorState(e,t){return this.targetSelection}}function wh(o){return $a?o.altKey:o.ctrlKey}const nc=class nc extends Rt{constructor(e){super(),this._editor=e,this._dndDecorationIds=this._editor.createDecorationsCollection(),this._register(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._register(this._editor.onMouseUp(t=>this._onEditorMouseUp(t))),this._register(this._editor.onMouseDrag(t=>this._onEditorMouseDrag(t))),this._register(this._editor.onMouseDrop(t=>this._onEditorMouseDrop(t))),this._register(this._editor.onMouseDropCanceled(()=>this._onEditorMouseDropCanceled())),this._register(this._editor.onKeyDown(t=>this.onEditorKeyDown(t))),this._register(this._editor.onKeyUp(t=>this.onEditorKeyUp(t))),this._register(this._editor.onDidBlurEditorWidget(()=>this.onEditorBlur())),this._register(this._editor.onDidBlurEditorText(()=>this.onEditorBlur())),this._mouseDown=!1,this._modifierPressed=!1,this._dragSelection=null}onEditorBlur(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1}onEditorKeyDown(e){!this._editor.getOption(35)||this._editor.getOption(22)||(wh(e)&&(this._modifierPressed=!0),this._mouseDown&&wh(e)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(e){!this._editor.getOption(35)||this._editor.getOption(22)||(wh(e)&&(this._modifierPressed=!1),this._mouseDown&&e.keyCode===nc.TRIGGER_KEY_VALUE&&this._editor.updateOptions({mouseStyle:"default"}))}_onEditorMouseDown(e){this._mouseDown=!0}_onEditorMouseUp(e){this._mouseDown=!1,this._editor.updateOptions({mouseStyle:"text"})}_onEditorMouseDrag(e){const t=e.target;if(this._dragSelection===null){const n=(this._editor.getSelections()||[]).filter(s=>t.position&&s.containsPosition(t.position));if(n.length===1)this._dragSelection=n[0];else return}wh(e.event)?this._editor.updateOptions({mouseStyle:"copy"}):this._editor.updateOptions({mouseStyle:"default"}),t.position&&(this._dragSelection.containsPosition(t.position)?this._removeDecoration():this.showAt(t.position))}_onEditorMouseDropCanceled(){this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}_onEditorMouseDrop(e){if(e.target&&(this._hitContent(e.target)||this._hitMargin(e.target))&&e.target.position){const t=new Bi(e.target.position.lineNumber,e.target.position.column);if(this._dragSelection===null){let i=null;if(e.event.shiftKey){const n=this._editor.getSelection();if(n){const{selectionStartLineNumber:s,selectionStartColumn:r}=n;i=[new $i(s,r,t.lineNumber,t.column)]}}else i=(this._editor.getSelections()||[]).map(n=>n.containsPosition(t)?new $i(t.lineNumber,t.column,t.lineNumber,t.column):n);this._editor.setSelections(i||[],"mouse",3)}else(!this._dragSelection.containsPosition(t)||(wh(e.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(t)||this._dragSelection.getStartPosition().equals(t)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(nc.ID,new NR(this._dragSelection,t,wh(e.event)||this._modifierPressed)),this._editor.pushUndoStop())}this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}showAt(e){this._dndDecorationIds.set([{range:new Q(e.lineNumber,e.column,e.lineNumber,e.column),options:nc._DECORATION_OPTIONS}]),this._editor.revealPosition(e,1)}_removeDecoration(){this._dndDecorationIds.clear()}_hitContent(e){return e.type===6||e.type===7}_hitMargin(e){return e.type===2||e.type===3||e.type===4}dispose(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1,super.dispose()}};nc.ID="editor.contrib.dragAndDrop",nc.TRIGGER_KEY_VALUE=$a?6:5,nc._DECORATION_OPTIONS=vn.register({description:"dnd-target",className:"dnd-target"});let iv=nc;hn(iv.ID,iv,2);hn(Bl.ID,Bl,0);df(M1);Ti(new class extends Ao{constructor(){super({id:t5,precondition:C9,kbOpts:{weight:100,primary:2137}})}runEditorCommand(o,e){var t;return(t=Bl.get(e))==null?void 0:t.changePasteType()}});Ti(new class extends Ao{constructor(){super({id:"editor.hidePasteWidget",precondition:C9,kbOpts:{weight:100,primary:9}})}runEditorCommand(o,e){var t;(t=Bl.get(e))==null||t.clearWidgets()}});var nu;Le((nu=class extends Ct{constructor(){super({id:"editor.action.pasteAs",label:S("pasteAs","Paste As..."),alias:"Paste As...",precondition:q.writable,metadata:{description:"Paste as",args:[{name:"args",schema:nu.argsSchema}]}})}run(e,t,i){var s;let n=typeof(i==null?void 0:i.kind)=="string"?i.kind:void 0;return!n&&i&&(n=typeof i.id=="string"?i.id:void 0),(s=Bl.get(t))==null?void 0:s.pasteAs(n?new ns(n):void 0)}},nu.argsSchema={type:"object",properties:{kind:{type:"string",description:S("pasteAs.kind","The kind of the paste edit to try applying. If not provided or there are multiple edits for this kind, the editor will show a picker.")}}},nu));Le(class extends Ct{constructor(){super({id:"editor.action.pasteAsText",label:S("pasteAsText","Paste as Text"),alias:"Paste as Text",precondition:q.writable})}run(o,e){var t;return(t=Bl.get(e))==null?void 0:t.pasteAs({providerId:Ru.id})}});class OR{constructor(){this._dragOperations=new Map}removeDragOperationTransfer(e){if(e&&this._dragOperations.has(e)){const t=this._dragOperations.get(e);return this._dragOperations.delete(e),t}}}class K8{constructor(e){this.identifier=e}}const J5=Ml("treeViewsDndService");Rl(J5,OR,1);var HR=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},yx=function(o,e){return function(t,i){e(t,i,o)}},CE;const eB="editor.experimental.dropIntoEditor.defaultProvider",tB="editor.changeDropType",R9=new En("dropWidgetVisible",!1,S("dropWidgetVisible","Whether the drop widget is showing"));var su;let Q0=(su=class extends Rt{static get(e){return e.getContribution(CE.ID)}constructor(e,t,i,n,s){super(),this._configService=i,this._languageFeaturesService=n,this._treeViewsDragAndDropService=s,this.treeItemsTransfer=P1.getInstance(),this._dropProgressManager=this._register(t.createInstance(jm,"dropIntoEditor",e)),this._postDropWidgetManager=this._register(t.createInstance(Um,"dropIntoEditor",e,R9,{id:tB,label:S("postDropWidgetTitle","Show drop options...")})),this._register(e.onDropIntoEditor(r=>this.onDropIntoEditor(e,r.position,r.event)))}clearWidgets(){this._postDropWidgetManager.clear()}changeDropType(){this._postDropWidgetManager.tryShowSelector()}async onDropIntoEditor(e,t,i){var s;if(!i.dataTransfer||!e.hasModel())return;(s=this._currentOperation)==null||s.cancel(),e.focus(),e.setPosition(t);const n=qs(async r=>{const a=new Tt,d=a.add(new L0(e,1,void 0,r));try{const u=await this.extractDataTransferData(i);if(u.size===0||d.token.isCancellationRequested)return;const f=e.getModel();if(!f)return;const g=this._languageFeaturesService.documentDropEditProvider.ordered(f).filter(C=>C.dropMimeTypes?C.dropMimeTypes.some(b=>u.matches(b)):!0),p=a.add(await this.getDropEdits(g,f,t,u,d));if(d.token.isCancellationRequested)return;if(p.edits.length){const C=this.getInitialActiveEditIndex(f,p.edits),b=e.getOption(36).showDropSelector==="afterDrop";await this._postDropWidgetManager.applyEditAndShowIfNeeded([Q.fromPositions(t)],{activeEditIndex:C,allEdits:p.edits},b,async y=>y,r)}}finally{a.dispose(),this._currentOperation===n&&(this._currentOperation=void 0)}});this._dropProgressManager.showWhile(t,S("dropIntoEditorProgress","Running drop handlers. Click to cancel"),n,{cancel:()=>n.cancel()}),this._currentOperation=n}async getDropEdits(e,t,i,n,s){const r=new Tt,a=await Sp(Promise.all(e.map(async u=>{try{const f=await u.provideDocumentDropEdits(t,i,n,s.token);return f&&r.add(f),f==null?void 0:f.edits.map(g=>({...g,providerId:u.id}))}catch(f){console.error(f)}})),s.token),d=yl(a??[]).flat();return{edits:J6(d),dispose:()=>r.dispose()}}getInitialActiveEditIndex(e,t){const i=this._configService.getValue(eB,{resource:e.uri});for(const[n,s]of Object.entries(i)){const r=new ns(s),a=t.findIndex(d=>r.value===d.providerId&&d.handledMimeType&&$6(n,[d.handledMimeType]));if(a>=0)return a}return 0}async extractDataTransferData(e){if(!e.dataTransfer)return new j6;const t=G6(e.dataTransfer);if(this.treeItemsTransfer.hasData(K8.prototype)){const i=this.treeItemsTransfer.getData(K8.prototype);if(Array.isArray(i))for(const n of i){const s=await this._treeViewsDragAndDropService.removeDragOperationTransfer(n.identifier);if(s)for(const[r,a]of s)t.replace(r,a)}}return t}},CE=su,su.ID="editor.contrib.dropIntoEditorController",su);Q0=CE=HR([yx(1,sn),yx(2,ss),yx(3,Fi),yx(4,J5)],Q0);hn(Q0.ID,Q0,2);df(T1);Ti(new class extends Ao{constructor(){super({id:tB,precondition:R9,kbOpts:{weight:100,primary:2137}})}runEditorCommand(o,e,t){var i;(i=Q0.get(e))==null||i.changeDropType()}});Ti(new class extends Ao{constructor(){super({id:"editor.hideDropWidget",precondition:R9,kbOpts:{weight:100,primary:9}})}runEditorCommand(o,e,t){var i;(i=Q0.get(e))==null||i.clearWidgets()}});ca.as(kp.Configuration).registerConfiguration({...U_,properties:{[eB]:{type:"object",scope:5,description:S("defaultProviderDescription","Configures the default drop provider to use for content of a given mime type."),default:{},additionalProperties:{type:"string"}}}});const no=class no{constructor(e){this._editor=e,this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null,this._startPosition=this._editor.getPosition()}dispose(){this._editor.removeDecorations(this._allDecorations()),this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}reset(){this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}getCount(){return this._decorations.length}getFindScope(){return this._findScopeDecorationIds[0]?this._editor.getModel().getDecorationRange(this._findScopeDecorationIds[0]):null}getFindScopes(){if(this._findScopeDecorationIds.length){const e=this._findScopeDecorationIds.map(t=>this._editor.getModel().getDecorationRange(t)).filter(t=>!!t);if(e.length)return e}return null}getStartPosition(){return this._startPosition}setStartPosition(e){this._startPosition=e,this.setCurrentFindMatch(null)}_getDecorationIndex(e){const t=this._decorations.indexOf(e);return t>=0?t+1:1}getDecorationRangeAt(e){const t=e<this._decorations.length?this._decorations[e]:null;return t?this._editor.getModel().getDecorationRange(t):null}getCurrentMatchesPosition(e){const t=this._editor.getModel().getDecorationsInRange(e);for(const i of t){const n=i.options;if(n===no._FIND_MATCH_DECORATION||n===no._CURRENT_FIND_MATCH_DECORATION)return this._getDecorationIndex(i.id)}return 0}setCurrentFindMatch(e){let t=null,i=0;if(e)for(let n=0,s=this._decorations.length;n<s;n++){const r=this._editor.getModel().getDecorationRange(this._decorations[n]);if(e.equalsRange(r)){t=this._decorations[n],i=n+1;break}}return(this._highlightedDecorationId!==null||t!==null)&&this._editor.changeDecorations(n=>{if(this._highlightedDecorationId!==null&&(n.changeDecorationOptions(this._highlightedDecorationId,no._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),t!==null&&(this._highlightedDecorationId=t,n.changeDecorationOptions(this._highlightedDecorationId,no._CURRENT_FIND_MATCH_DECORATION)),this._rangeHighlightDecorationId!==null&&(n.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),t!==null){let s=this._editor.getModel().getDecorationRange(t);if(s.startLineNumber!==s.endLineNumber&&s.endColumn===1){const r=s.endLineNumber-1,a=this._editor.getModel().getLineMaxColumn(r);s=new Q(s.startLineNumber,s.startColumn,r,a)}this._rangeHighlightDecorationId=n.addDecoration(s,no._RANGE_HIGHLIGHT_DECORATION)}}),i}set(e,t){this._editor.changeDecorations(i=>{let n=no._FIND_MATCH_DECORATION;const s=[];if(e.length>1e3){n=no._FIND_MATCH_NO_OVERVIEW_DECORATION;const a=this._editor.getModel().getLineCount(),u=this._editor.getLayoutInfo().height/a,f=Math.max(2,Math.ceil(3/u));let g=e[0].range.startLineNumber,p=e[0].range.endLineNumber;for(let C=1,b=e.length;C<b;C++){const y=e[C].range;p+f>=y.startLineNumber?y.endLineNumber>p&&(p=y.endLineNumber):(s.push({range:new Q(g,1,p,1),options:no._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),g=y.startLineNumber,p=y.endLineNumber)}s.push({range:new Q(g,1,p,1),options:no._FIND_MATCH_ONLY_OVERVIEW_DECORATION})}const r=new Array(e.length);for(let a=0,d=e.length;a<d;a++)r[a]={range:e[a].range,options:n};this._decorations=i.deltaDecorations(this._decorations,r),this._overviewRulerApproximateDecorations=i.deltaDecorations(this._overviewRulerApproximateDecorations,s),this._rangeHighlightDecorationId&&(i.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),this._findScopeDecorationIds.length&&(this._findScopeDecorationIds.forEach(a=>i.removeDecoration(a)),this._findScopeDecorationIds=[]),t!=null&&t.length&&(this._findScopeDecorationIds=t.map(a=>i.addDecoration(a,no._FIND_SCOPE_DECORATION)))})}matchBeforePosition(e){if(this._decorations.length===0)return null;for(let t=this._decorations.length-1;t>=0;t--){const i=this._decorations[t],n=this._editor.getModel().getDecorationRange(i);if(!(!n||n.endLineNumber>e.lineNumber)){if(n.endLineNumber<e.lineNumber)return n;if(!(n.endColumn>e.column))return n}}return this._editor.getModel().getDecorationRange(this._decorations[this._decorations.length-1])}matchAfterPosition(e){if(this._decorations.length===0)return null;for(let t=0,i=this._decorations.length;t<i;t++){const n=this._decorations[t],s=this._editor.getModel().getDecorationRange(n);if(!(!s||s.startLineNumber<e.lineNumber)){if(s.startLineNumber>e.lineNumber)return s;if(!(s.startColumn<e.column))return s}}return this._editor.getModel().getDecorationRange(this._decorations[0])}_allDecorations(){let e=[];return e=e.concat(this._decorations),e=e.concat(this._overviewRulerApproximateDecorations),this._findScopeDecorationIds.length&&e.push(...this._findScopeDecorationIds),this._rangeHighlightDecorationId&&e.push(this._rangeHighlightDecorationId),e}};no._CURRENT_FIND_MATCH_DECORATION=vn.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",inlineClassName:"currentFindMatchInline",showIfCollapsed:!0,overviewRuler:{color:Fs(eC),position:Ha.Center},minimap:{color:Fs(OS),position:1}}),no._FIND_MATCH_DECORATION=vn.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",inlineClassName:"findMatchInline",showIfCollapsed:!0,overviewRuler:{color:Fs(eC),position:Ha.Center},minimap:{color:Fs(OS),position:1}}),no._FIND_MATCH_NO_OVERVIEW_DECORATION=vn.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0}),no._FIND_MATCH_ONLY_OVERVIEW_DECORATION=vn.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:Fs(eC),position:Ha.Center}}),no._RANGE_HIGHLIGHT_DECORATION=vn.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0}),no._FIND_SCOPE_DECORATION=vn.register({description:"find-scope",className:"findScope",isWholeLine:!0});let EE=no;class WR{constructor(e,t,i){this._editorSelection=e,this._ranges=t,this._replaceStrings=i,this._trackedEditorSelectionId=null}getEditOperations(e,t){if(this._ranges.length>0){const i=[];for(let r=0;r<this._ranges.length;r++)i.push({range:this._ranges[r],text:this._replaceStrings[r]});i.sort((r,a)=>Q.compareRangesUsingStarts(r.range,a.range));const n=[];let s=i[0];for(let r=1;r<i.length;r++)s.range.endLineNumber===i[r].range.startLineNumber&&s.range.endColumn===i[r].range.startColumn?(s.range=s.range.plusRange(i[r].range),s.text=s.text+i[r].text):(n.push(s),s=i[r]);n.push(s);for(const r of n)t.addEditOperation(r.range,r.text)}this._trackedEditorSelectionId=t.trackSelection(this._editorSelection)}computeCursorState(e,t){return t.getTrackedSelection(this._trackedEditorSelectionId)}}function iB(o,e){if(o&&o[0]!==""){const t=Z8(o,e,"-"),i=Z8(o,e,"_");return t&&!i?X8(o,e,"-"):!t&&i?X8(o,e,"_"):o[0].toUpperCase()===o[0]?e.toUpperCase():o[0].toLowerCase()===o[0]?e.toLowerCase():J3(o[0][0])&&e.length>0?e[0].toUpperCase()+e.substr(1):o[0][0].toUpperCase()!==o[0][0]&&e.length>0?e[0].toLowerCase()+e.substr(1):e}else return e}function Z8(o,e,t){return o[0].indexOf(t)!==-1&&e.indexOf(t)!==-1&&o[0].split(t).length===e.split(t).length}function X8(o,e,t){const i=e.split(t),n=o[0].split(t);let s="";return i.forEach((r,a)=>{s+=iB([n[a]],r)+t}),s.slice(0,-1)}class Y8{constructor(e){this.staticValue=e,this.kind=0}}class zR{constructor(e){this.pieces=e,this.kind=1}}class J0{static fromStaticValue(e){return new J0([Hd.staticValue(e)])}get hasReplacementPatterns(){return this._state.kind===1}constructor(e){!e||e.length===0?this._state=new Y8(""):e.length===1&&e[0].staticValue!==null?this._state=new Y8(e[0].staticValue):this._state=new zR(e)}buildReplaceString(e,t){if(this._state.kind===0)return t?iB(e,this._state.staticValue):this._state.staticValue;let i="";for(let n=0,s=this._state.pieces.length;n<s;n++){const r=this._state.pieces[n];if(r.staticValue!==null){i+=r.staticValue;continue}let a=J0._substitute(r.matchIndex,e);if(r.caseOps!==null&&r.caseOps.length>0){const d=[],u=r.caseOps.length;let f=0;for(let g=0,p=a.length;g<p;g++){if(f>=u){d.push(a.slice(g));break}switch(r.caseOps[f]){case"U":d.push(a[g].toUpperCase());break;case"u":d.push(a[g].toUpperCase()),f++;break;case"L":d.push(a[g].toLowerCase());break;case"l":d.push(a[g].toLowerCase()),f++;break;default:d.push(a[g])}}a=d.join("")}i+=a}return i}static _substitute(e,t){if(t===null)return"";if(e===0)return t[0];let i="";for(;e>0;){if(e<t.length)return(t[e]||"")+i;i=String(e%10)+i,e=Math.floor(e/10)}return"$"+i}}class Hd{static staticValue(e){return new Hd(e,-1,null)}static caseOps(e,t){return new Hd(null,e,t)}constructor(e,t,i){this.staticValue=e,this.matchIndex=t,!i||i.length===0?this.caseOps=null:this.caseOps=i.slice(0)}}class VR{constructor(e){this._source=e,this._lastCharIndex=0,this._result=[],this._resultLen=0,this._currentStaticPiece=""}emitUnchanged(e){this._emitStatic(this._source.substring(this._lastCharIndex,e)),this._lastCharIndex=e}emitStatic(e,t){this._emitStatic(e),this._lastCharIndex=t}_emitStatic(e){e.length!==0&&(this._currentStaticPiece+=e)}emitMatchIndex(e,t,i){this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=Hd.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=Hd.caseOps(e,i),this._lastCharIndex=t}finalize(){return this.emitUnchanged(this._source.length),this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=Hd.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new J0(this._result)}}function jR(o){if(!o||o.length===0)return new J0(null);const e=[],t=new VR(o);for(let i=0,n=o.length;i<n;i++){const s=o.charCodeAt(i);if(s===92){if(i++,i>=n)break;const r=o.charCodeAt(i);switch(r){case 92:t.emitUnchanged(i-1),t.emitStatic("\\",i+1);break;case 110:t.emitUnchanged(i-1),t.emitStatic(`
20
+ `,i+1);break;case 116:t.emitUnchanged(i-1),t.emitStatic(" ",i+1);break;case 117:case 85:case 108:case 76:t.emitUnchanged(i-1),t.emitStatic("",i+1),e.push(String.fromCharCode(r));break}continue}if(s===36){if(i++,i>=n)break;const r=o.charCodeAt(i);if(r===36){t.emitUnchanged(i-1),t.emitStatic("$",i+1);continue}if(r===48||r===38){t.emitUnchanged(i-1),t.emitMatchIndex(0,i+1,e),e.length=0;continue}if(49<=r&&r<=57){let a=r-48;if(i+1<n){const d=o.charCodeAt(i+1);if(48<=d&&d<=57){i++,a=a*10+(d-48),t.emitUnchanged(i-2),t.emitMatchIndex(a,i+1,e),e.length=0;continue}}t.emitUnchanged(i-1),t.emitMatchIndex(a,i+1,e),e.length=0;continue}}}return t.finalize()}const Wl=new En("findWidgetVisible",!1);Wl.toNegated();const Eb=new En("findInputFocussed",!1),N9=new En("replaceInputFocussed",!1),wx={primary:545,mac:{primary:2593}},Sx={primary:565,mac:{primary:2613}},Dx={primary:560,mac:{primary:2608}},Ax={primary:554,mac:{primary:2602}},kx={primary:558,mac:{primary:2606}},Un={StartFindAction:"actions.find",StartFindWithSelection:"actions.findWithSelection",StartFindWithArgs:"editor.actions.findWithArgs",NextMatchFindAction:"editor.action.nextMatchFindAction",PreviousMatchFindAction:"editor.action.previousMatchFindAction",GoToMatchFindAction:"editor.action.goToMatchFindAction",NextSelectionMatchFindAction:"editor.action.nextSelectionMatchFindAction",PreviousSelectionMatchFindAction:"editor.action.previousSelectionMatchFindAction",StartFindReplaceAction:"editor.action.startFindReplaceAction",CloseFindWidgetCommand:"closeFindWidget",ToggleCaseSensitiveCommand:"toggleFindCaseSensitive",ToggleWholeWordCommand:"toggleFindWholeWord",ToggleRegexCommand:"toggleFindRegex",ToggleSearchScopeCommand:"toggleFindInSelection",TogglePreserveCaseCommand:"togglePreserveCase",ReplaceOneAction:"editor.action.replaceOne",ReplaceAllAction:"editor.action.replaceAll",SelectAllMatchesAction:"editor.action.selectAllMatches"},gc=19999,$R=240;class pg{constructor(e,t){this._toDispose=new Tt,this._editor=e,this._state=t,this._isDisposed=!1,this._startSearchingTimer=new Dp,this._decorations=new EE(e),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new Ms(()=>{if(this._editor.hasModel())return this.research(!1)},100),this._toDispose.add(this._updateDecorationsScheduler),this._toDispose.add(this._editor.onDidChangeCursorPosition(i=>{(i.reason===3||i.reason===5||i.reason===6)&&this._decorations.setStartPosition(this._editor.getPosition())})),this._ignoreModelContentChanged=!1,this._toDispose.add(this._editor.onDidChangeModelContent(i=>{this._ignoreModelContentChanged||(i.isFlush&&this._decorations.reset(),this._decorations.setStartPosition(this._editor.getPosition()),this._updateDecorationsScheduler.schedule())})),this._toDispose.add(this._state.onFindReplaceStateChange(i=>this._onStateChanged(i))),this.research(!1,this._state.searchScope)}dispose(){this._isDisposed=!0,uo(this._startSearchingTimer),this._toDispose.dispose()}_onStateChanged(e){this._isDisposed||this._editor.hasModel()&&(e.searchString||e.isReplaceRevealed||e.isRegex||e.wholeWord||e.matchCase||e.searchScope)&&(this._editor.getModel().isTooLargeForSyncing()?(this._startSearchingTimer.cancel(),this._startSearchingTimer.setIfNotSet(()=>{e.searchScope?this.research(e.moveCursor,this._state.searchScope):this.research(e.moveCursor)},$R)):e.searchScope?this.research(e.moveCursor,this._state.searchScope):this.research(e.moveCursor))}static _getSearchRange(e,t){return t||e.getFullModelRange()}research(e,t){let i=null;typeof t<"u"?t!==null&&(Array.isArray(t)?i=t:i=[t]):i=this._decorations.getFindScopes(),i!==null&&(i=i.map(a=>{if(a.startLineNumber!==a.endLineNumber){let d=a.endLineNumber;return a.endColumn===1&&(d=d-1),new Q(a.startLineNumber,1,d,this._editor.getModel().getLineMaxColumn(d))}return a}));const n=this._findMatches(i,!1,gc);this._decorations.set(n,i);const s=this._editor.getSelection();let r=this._decorations.getCurrentMatchesPosition(s);if(r===0&&n.length>0){const a=AA(n.map(d=>d.range),d=>Q.compareRangesUsingStarts(d,s)>=0);r=a>0?a-1+1:r}this._state.changeMatchInfo(r,this._decorations.getCount(),void 0),e&&this._editor.getOption(41).cursorMoveOnType&&this._moveToNextMatch(this._decorations.getStartPosition())}_hasMatches(){return this._state.matchesCount>0}_cannotFind(){if(!this._hasMatches()){const e=this._decorations.getFindScope();return e&&this._editor.revealRangeInCenterIfOutsideViewport(e,0),!0}return!1}_setCurrentFindMatch(e){const t=this._decorations.setCurrentFindMatch(e);this._state.changeMatchInfo(t,this._decorations.getCount(),e),this._editor.setSelection(e),this._editor.revealRangeInCenterIfOutsideViewport(e,0)}_prevSearchPosition(e){const t=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0);let{lineNumber:i,column:n}=e;const s=this._editor.getModel();return t||n===1?(i===1?i=s.getLineCount():i--,n=s.getLineMaxColumn(i)):n--,new Bi(i,n)}_moveToPrevMatch(e,t=!1){if(!this._state.canNavigateBack()){const f=this._decorations.matchAfterPosition(e);f&&this._setCurrentFindMatch(f);return}if(this._decorations.getCount()<gc){let f=this._decorations.matchBeforePosition(e);f&&f.isEmpty()&&f.getStartPosition().equals(e)&&(e=this._prevSearchPosition(e),f=this._decorations.matchBeforePosition(e)),f&&this._setCurrentFindMatch(f);return}if(this._cannotFind())return;const i=this._decorations.getFindScope(),n=pg._getSearchRange(this._editor.getModel(),i);n.getEndPosition().isBefore(e)&&(e=n.getEndPosition()),e.isBefore(n.getStartPosition())&&(e=n.getEndPosition());const{lineNumber:s,column:r}=e,a=this._editor.getModel();let d=new Bi(s,r),u=a.findPreviousMatch(this._state.searchString,d,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null,!1);if(u&&u.range.isEmpty()&&u.range.getStartPosition().equals(d)&&(d=this._prevSearchPosition(d),u=a.findPreviousMatch(this._state.searchString,d,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null,!1)),!!u){if(!t&&!n.containsRange(u.range))return this._moveToPrevMatch(u.range.getStartPosition(),!0);this._setCurrentFindMatch(u.range)}}moveToPrevMatch(){this._moveToPrevMatch(this._editor.getSelection().getStartPosition())}_nextSearchPosition(e){const t=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0);let{lineNumber:i,column:n}=e;const s=this._editor.getModel();return t||n===s.getLineMaxColumn(i)?(i===s.getLineCount()?i=1:i++,n=1):n++,new Bi(i,n)}_moveToNextMatch(e){if(!this._state.canNavigateForward()){const i=this._decorations.matchBeforePosition(e);i&&this._setCurrentFindMatch(i);return}if(this._decorations.getCount()<gc){let i=this._decorations.matchAfterPosition(e);i&&i.isEmpty()&&i.getStartPosition().equals(e)&&(e=this._nextSearchPosition(e),i=this._decorations.matchAfterPosition(e)),i&&this._setCurrentFindMatch(i);return}const t=this._getNextMatch(e,!1,!0);t&&this._setCurrentFindMatch(t.range)}_getNextMatch(e,t,i,n=!1){if(this._cannotFind())return null;const s=this._decorations.getFindScope(),r=pg._getSearchRange(this._editor.getModel(),s);r.getEndPosition().isBefore(e)&&(e=r.getStartPosition()),e.isBefore(r.getStartPosition())&&(e=r.getStartPosition());const{lineNumber:a,column:d}=e,u=this._editor.getModel();let f=new Bi(a,d),g=u.findNextMatch(this._state.searchString,f,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null,t);return i&&g&&g.range.isEmpty()&&g.range.getStartPosition().equals(f)&&(f=this._nextSearchPosition(f),g=u.findNextMatch(this._state.searchString,f,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null,t)),g?!n&&!r.containsRange(g.range)?this._getNextMatch(g.range.getEndPosition(),t,i,!0):g:null}moveToNextMatch(){this._moveToNextMatch(this._editor.getSelection().getEndPosition())}_moveToMatch(e){const t=this._decorations.getDecorationRangeAt(e);t&&this._setCurrentFindMatch(t)}moveToMatch(e){this._moveToMatch(e)}_getReplacePattern(){return this._state.isRegex?jR(this._state.replaceString):J0.fromStaticValue(this._state.replaceString)}replace(){if(!this._hasMatches())return;const e=this._getReplacePattern(),t=this._editor.getSelection(),i=this._getNextMatch(t.getStartPosition(),!0,!1);if(i)if(t.equalsRange(i.range)){const n=e.buildReplaceString(i.matches,this._state.preserveCase),s=new wp(t,n);this._executeEditorCommand("replace",s),this._decorations.setStartPosition(new Bi(t.startLineNumber,t.startColumn+n.length)),this.research(!0)}else this._decorations.setStartPosition(this._editor.getPosition()),this._setCurrentFindMatch(i.range)}_findMatches(e,t,i){const n=(e||[null]).map(s=>pg._getSearchRange(this._editor.getModel(),s));return this._editor.getModel().findMatches(this._state.searchString,n,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null,t,i)}replaceAll(){if(!this._hasMatches())return;const e=this._decorations.getFindScopes();e===null&&this._state.matchesCount>=gc?this._largeReplaceAll():this._regularReplaceAll(e),this.research(!1)}_largeReplaceAll(){const t=new e4(this._state.searchString,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null).parseSearchRequest();if(!t)return;let i=t.regex;if(!i.multiline){let g="mu";i.ignoreCase&&(g+="i"),i.global&&(g+="g"),i=new RegExp(i.source,g)}const n=this._editor.getModel(),s=n.getValue(1),r=n.getFullModelRange(),a=this._getReplacePattern();let d;const u=this._state.preserveCase;a.hasReplacementPatterns||u?d=s.replace(i,function(){return a.buildReplaceString(arguments,u)}):d=s.replace(i,a.buildReplaceString(null,u));const f=new kA(r,d,this._editor.getSelection());this._executeEditorCommand("replaceAll",f)}_regularReplaceAll(e){const t=this._getReplacePattern(),i=this._findMatches(e,t.hasReplacementPatterns||this._state.preserveCase,1073741824),n=[];for(let r=0,a=i.length;r<a;r++)n[r]=t.buildReplaceString(i[r].matches,this._state.preserveCase);const s=new WR(this._editor.getSelection(),i.map(r=>r.range),n);this._executeEditorCommand("replaceAll",s)}selectAllMatches(){if(!this._hasMatches())return;const e=this._decorations.getFindScopes();let i=this._findMatches(e,!1,1073741824).map(s=>new $i(s.range.startLineNumber,s.range.startColumn,s.range.endLineNumber,s.range.endColumn));const n=this._editor.getSelection();for(let s=0,r=i.length;s<r;s++)if(i[s].equalsRange(n)){i=[n].concat(i.slice(0,s)).concat(i.slice(s+1));break}this._editor.setSelections(i)}_executeEditorCommand(e,t){try{this._ignoreModelContentChanged=!0,this._editor.pushUndoStop(),this._editor.executeCommand(e,t),this._editor.pushUndoStop()}finally{this._ignoreModelContentChanged=!1}}}const o_=class o_ extends Fp{constructor(e,t,i){super(),this._hideSoon=this._register(new Ms(()=>this._hide(),2e3)),this._isVisible=!1,this._editor=e,this._state=t,this._keybindingService=i,this._domNode=document.createElement("div"),this._domNode.className="findOptionsWidget",this._domNode.style.display="none",this._domNode.style.top="10px",this._domNode.style.zIndex="12",this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true");const n={inputActiveOptionBorder:Ld(FA),inputActiveOptionForeground:Ld(BA),inputActiveOptionBackground:Ld(Mw)},s=this._register(o1());this.caseSensitive=this._register(new t4({appendTitle:this._keybindingLabelFor(Un.ToggleCaseSensitiveCommand),isChecked:this._state.matchCase,hoverDelegate:s,...n})),this._domNode.appendChild(this.caseSensitive.domNode),this._register(this.caseSensitive.onChange(()=>{this._state.change({matchCase:this.caseSensitive.checked},!1)})),this.wholeWords=this._register(new i4({appendTitle:this._keybindingLabelFor(Un.ToggleWholeWordCommand),isChecked:this._state.wholeWord,hoverDelegate:s,...n})),this._domNode.appendChild(this.wholeWords.domNode),this._register(this.wholeWords.onChange(()=>{this._state.change({wholeWord:this.wholeWords.checked},!1)})),this.regex=this._register(new n4({appendTitle:this._keybindingLabelFor(Un.ToggleRegexCommand),isChecked:this._state.isRegex,hoverDelegate:s,...n})),this._domNode.appendChild(this.regex.domNode),this._register(this.regex.onChange(()=>{this._state.change({isRegex:this.regex.checked},!1)})),this._editor.addOverlayWidget(this),this._register(this._state.onFindReplaceStateChange(r=>{let a=!1;r.isRegex&&(this.regex.checked=this._state.isRegex,a=!0),r.wholeWord&&(this.wholeWords.checked=this._state.wholeWord,a=!0),r.matchCase&&(this.caseSensitive.checked=this._state.matchCase,a=!0),!this._state.isRevealed&&a&&this._revealTemporarily()})),this._register(Bn(this._domNode,as.MOUSE_LEAVE,r=>this._onMouseLeave())),this._register(Bn(this._domNode,"mouseover",r=>this._onMouseOver()))}_keybindingLabelFor(e){const t=this._keybindingService.lookupKeybinding(e);return t?` (${t.getLabel()})`:""}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return o_.ID}getDomNode(){return this._domNode}getPosition(){return{preference:0}}highlightFindOptions(){this._revealTemporarily()}_revealTemporarily(){this._show(),this._hideSoon.schedule()}_onMouseLeave(){this._hideSoon.schedule()}_onMouseOver(){this._hideSoon.cancel()}_show(){this._isVisible||(this._isVisible=!0,this._domNode.style.display="block")}_hide(){this._isVisible&&(this._isVisible=!1,this._domNode.style.display="none")}};o_.ID="editor.contrib.findOptionsWidget";let yE=o_;function Bx(o,e){return o===1?!0:o===2?!1:e}class UR extends Rt{get searchString(){return this._searchString}get replaceString(){return this._replaceString}get isRevealed(){return this._isRevealed}get isReplaceRevealed(){return this._isReplaceRevealed}get isRegex(){return Bx(this._isRegexOverride,this._isRegex)}get wholeWord(){return Bx(this._wholeWordOverride,this._wholeWord)}get matchCase(){return Bx(this._matchCaseOverride,this._matchCase)}get preserveCase(){return Bx(this._preserveCaseOverride,this._preserveCase)}get actualIsRegex(){return this._isRegex}get actualWholeWord(){return this._wholeWord}get actualMatchCase(){return this._matchCase}get actualPreserveCase(){return this._preserveCase}get searchScope(){return this._searchScope}get matchesPosition(){return this._matchesPosition}get matchesCount(){return this._matchesCount}get currentMatch(){return this._currentMatch}constructor(){super(),this._onFindReplaceStateChange=this._register(new rn),this.onFindReplaceStateChange=this._onFindReplaceStateChange.event,this._searchString="",this._replaceString="",this._isRevealed=!1,this._isReplaceRevealed=!1,this._isRegex=!1,this._isRegexOverride=0,this._wholeWord=!1,this._wholeWordOverride=0,this._matchCase=!1,this._matchCaseOverride=0,this._preserveCase=!1,this._preserveCaseOverride=0,this._searchScope=null,this._matchesPosition=0,this._matchesCount=0,this._currentMatch=null,this._loop=!0,this._isSearching=!1,this._filters=null}changeMatchInfo(e,t,i){const n={moveCursor:!1,updateHistory:!1,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1};let s=!1;t===0&&(e=0),e>t&&(e=t),this._matchesPosition!==e&&(this._matchesPosition=e,n.matchesPosition=!0,s=!0),this._matchesCount!==t&&(this._matchesCount=t,n.matchesCount=!0,s=!0),typeof i<"u"&&(Q.equalsRange(this._currentMatch,i)||(this._currentMatch=i,n.currentMatch=!0,s=!0)),s&&this._onFindReplaceStateChange.fire(n)}change(e,t,i=!0){var f;const n={moveCursor:t,updateHistory:i,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1};let s=!1;const r=this.isRegex,a=this.wholeWord,d=this.matchCase,u=this.preserveCase;typeof e.searchString<"u"&&this._searchString!==e.searchString&&(this._searchString=e.searchString,n.searchString=!0,s=!0),typeof e.replaceString<"u"&&this._replaceString!==e.replaceString&&(this._replaceString=e.replaceString,n.replaceString=!0,s=!0),typeof e.isRevealed<"u"&&this._isRevealed!==e.isRevealed&&(this._isRevealed=e.isRevealed,n.isRevealed=!0,s=!0),typeof e.isReplaceRevealed<"u"&&this._isReplaceRevealed!==e.isReplaceRevealed&&(this._isReplaceRevealed=e.isReplaceRevealed,n.isReplaceRevealed=!0,s=!0),typeof e.isRegex<"u"&&(this._isRegex=e.isRegex),typeof e.wholeWord<"u"&&(this._wholeWord=e.wholeWord),typeof e.matchCase<"u"&&(this._matchCase=e.matchCase),typeof e.preserveCase<"u"&&(this._preserveCase=e.preserveCase),typeof e.searchScope<"u"&&((f=e.searchScope)!=null&&f.every(g=>{var p;return(p=this._searchScope)==null?void 0:p.some(C=>!Q.equalsRange(C,g))})||(this._searchScope=e.searchScope,n.searchScope=!0,s=!0)),typeof e.loop<"u"&&this._loop!==e.loop&&(this._loop=e.loop,n.loop=!0,s=!0),typeof e.isSearching<"u"&&this._isSearching!==e.isSearching&&(this._isSearching=e.isSearching,n.isSearching=!0,s=!0),typeof e.filters<"u"&&(this._filters?this._filters.update(e.filters):this._filters=e.filters,n.filters=!0,s=!0),this._isRegexOverride=typeof e.isRegexOverride<"u"?e.isRegexOverride:0,this._wholeWordOverride=typeof e.wholeWordOverride<"u"?e.wholeWordOverride:0,this._matchCaseOverride=typeof e.matchCaseOverride<"u"?e.matchCaseOverride:0,this._preserveCaseOverride=typeof e.preserveCaseOverride<"u"?e.preserveCaseOverride:0,r!==this.isRegex&&(s=!0,n.isRegex=!0),a!==this.wholeWord&&(s=!0,n.wholeWord=!0),d!==this.matchCase&&(s=!0,n.matchCase=!0),u!==this.preserveCase&&(s=!0,n.preserveCase=!0),s&&this._onFindReplaceStateChange.fire(n)}canNavigateBack(){return this.canNavigateInLoop()||this.matchesPosition!==1}canNavigateForward(){return this.canNavigateInLoop()||this.matchesPosition<this.matchesCount}canNavigateInLoop(){return this._loop||this.matchesCount>=gc}}const qR=S("defaultLabel","input"),GR=S("label.preserveCaseToggle","Preserve Case");class KR extends LA{constructor(e){super({icon:Ki.preserveCase,title:GR+e.appendTitle,isChecked:e.isChecked,hoverDelegate:e.hoverDelegate??Y_("element"),inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}class ZR extends Fp{constructor(e,t,i,n){super(),this._showOptionButtons=i,this.fixFocusOnOptionClickEnabled=!0,this.cachedOptionsWidth=0,this._onDidOptionChange=this._register(new rn),this.onDidOptionChange=this._onDidOptionChange.event,this._onKeyDown=this._register(new rn),this.onKeyDown=this._onKeyDown.event,this._onMouseDown=this._register(new rn),this._onInput=this._register(new rn),this._onKeyUp=this._register(new rn),this._onPreserveCaseKeyDown=this._register(new rn),this.onPreserveCaseKeyDown=this._onPreserveCaseKeyDown.event,this.contextViewProvider=t,this.placeholder=n.placeholder||"",this.validation=n.validation,this.label=n.label||qR;const s=n.appendPreserveCaseLabel||"",r=n.history||[],a=!!n.flexibleHeight,d=!!n.flexibleWidth,u=n.flexibleMaxHeight;this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new s4(this.domNode,this.contextViewProvider,{ariaLabel:this.label||"",placeholder:this.placeholder||"",validationOptions:{validation:this.validation},history:r,showHistoryHint:n.showHistoryHint,flexibleHeight:a,flexibleWidth:d,flexibleMaxHeight:u,inputBoxStyles:n.inputBoxStyles})),this.preserveCase=this._register(new KR({appendTitle:s,isChecked:!1,...n.toggleStyles})),this._register(this.preserveCase.onChange(p=>{this._onDidOptionChange.fire(p),!p&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.preserveCase.onKeyDown(p=>{this._onPreserveCaseKeyDown.fire(p)})),this._showOptionButtons?this.cachedOptionsWidth=this.preserveCase.width():this.cachedOptionsWidth=0;const f=[this.preserveCase.domNode];this.onkeydown(this.domNode,p=>{if(p.equals(15)||p.equals(17)||p.equals(9)){const C=f.indexOf(this.domNode.ownerDocument.activeElement);if(C>=0){let b=-1;p.equals(17)?b=(C+1)%f.length:p.equals(15)&&(C===0?b=f.length-1:b=C-1),p.equals(9)?(f[C].blur(),this.inputBox.focus()):b>=0&&f[b].focus(),Dm.stop(p,!0)}}});const g=document.createElement("div");g.className="controls",g.style.display=this._showOptionButtons?"block":"none",g.appendChild(this.preserveCase.domNode),this.domNode.appendChild(g),e==null||e.appendChild(this.domNode),this.onkeydown(this.inputBox.inputElement,p=>this._onKeyDown.fire(p)),this.onkeyup(this.inputBox.inputElement,p=>this._onKeyUp.fire(p)),this.oninput(this.inputBox.inputElement,p=>this._onInput.fire()),this.onmousedown(this.inputBox.inputElement,p=>this._onMouseDown.fire(p))}enable(){this.domNode.classList.remove("disabled"),this.inputBox.enable(),this.preserveCase.enable()}disable(){this.domNode.classList.add("disabled"),this.inputBox.disable(),this.preserveCase.disable()}setEnabled(e){e?this.enable():this.disable()}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getPreserveCase(){return this.preserveCase.checked}setPreserveCase(e){this.preserveCase.checked=e}focusOnPreserve(){this.preserveCase.focus()}validate(){var e;(e=this.inputBox)==null||e.validate()}set width(e){this.inputBox.paddingRight=this.cachedOptionsWidth,this.domNode.style.width=e+"px"}dispose(){super.dispose()}}var nB=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},sB=function(o,e){return function(t,i){e(t,i,o)}};const O9=new En("suggestWidgetVisible",!1,S("suggestWidgetVisible","Whether suggestion are visible")),H9="historyNavigationWidgetFocus",oB="historyNavigationForwardsEnabled",rB="historyNavigationBackwardsEnabled";let Cl;const Fx=[];function aB(o,e){if(Fx.includes(e))throw new Error("Cannot register the same widget multiple times");Fx.push(e);const t=new Tt,i=new En(H9,!1).bindTo(o),n=new En(oB,!0).bindTo(o),s=new En(rB,!0).bindTo(o),r=()=>{i.set(!0),Cl=e},a=()=>{i.set(!1),Cl===e&&(Cl=void 0)};return r4(e.element)&&r(),t.add(e.onDidFocus(()=>r())),t.add(e.onDidBlur(()=>a())),t.add(is(()=>{Fx.splice(Fx.indexOf(e),1),a()})),{historyNavigationForwardsEnablement:n,historyNavigationBackwardsEnablement:s,dispose(){t.dispose()}}}let wE=class extends o4{constructor(e,t,i,n){super(e,t,i);const s=this._register(n.createScoped(this.inputBox.element));this._register(aB(s,this.inputBox))}};wE=nB([sB(3,Fn)],wE);let SE=class extends ZR{constructor(e,t,i,n,s=!1){super(e,t,s,i);const r=this._register(n.createScoped(this.inputBox.element));this._register(aB(r,this.inputBox))}};SE=nB([sB(3,Fn)],SE);Ka.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:qe.and(qe.has(H9),qe.equals(rB,!0),qe.not("isComposing"),O9.isEqualTo(!1)),primary:16,secondary:[528],handler:o=>{Cl==null||Cl.showPreviousValue()}});Ka.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:qe.and(qe.has(H9),qe.equals(oB,!0),qe.not("isComposing"),O9.isEqualTo(!1)),primary:18,secondary:[530],handler:o=>{Cl==null||Cl.showNextValue()}});function Q8(o){var e,t;return((e=o.lookupKeybinding("history.showPrevious"))==null?void 0:e.getElectronAccelerator())==="Up"&&((t=o.lookupKeybinding("history.showNext"))==null?void 0:t.getElectronAccelerator())==="Down"}const J8=ms("find-collapsed",Ki.chevronRight,S("findCollapsedIcon","Icon to indicate that the editor find widget is collapsed.")),eD=ms("find-expanded",Ki.chevronDown,S("findExpandedIcon","Icon to indicate that the editor find widget is expanded.")),XR=ms("find-selection",Ki.selection,S("findSelectionIcon","Icon for 'Find in Selection' in the editor find widget.")),YR=ms("find-replace",Ki.replace,S("findReplaceIcon","Icon for 'Replace' in the editor find widget.")),QR=ms("find-replace-all",Ki.replaceAll,S("findReplaceAllIcon","Icon for 'Replace All' in the editor find widget.")),JR=ms("find-previous-match",Ki.arrowUp,S("findPreviousMatchIcon","Icon for 'Find Previous' in the editor find widget.")),eN=ms("find-next-match",Ki.arrowDown,S("findNextMatchIcon","Icon for 'Find Next' in the editor find widget.")),tN=S("label.findDialog","Find / Replace"),iN=S("label.find","Find"),nN=S("placeholder.find","Find"),sN=S("label.previousMatchButton","Previous Match"),oN=S("label.nextMatchButton","Next Match"),rN=S("label.toggleSelectionFind","Find in Selection"),aN=S("label.closeButton","Close"),lN=S("label.replace","Replace"),cN=S("placeholder.replace","Replace"),dN=S("label.replaceButton","Replace"),uN=S("label.replaceAllButton","Replace All"),hN=S("label.toggleReplaceButton","Toggle Replace"),fN=S("title.matchesCountLimit","Only the first {0} results are highlighted, but all find operations work on the entire text.",gc),gN=S("label.matchesLocation","{0} of {1}"),tD=S("label.noResults","No results"),_a=419,pN=275,xN=pN-54;let Nf=69;const mN=33,iD="ctrlEnterReplaceAll.windows.donotask",nD=$a?256:2048;class yC{constructor(e){this.afterLineNumber=e,this.heightInPx=mN,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}}function sD(o,e,t){const i=!!e.match(/\n/);if(t&&i&&t.selectionStart>0){o.stopPropagation();return}}function oD(o,e,t){const i=!!e.match(/\n/);if(t&&i&&t.selectionEnd<t.value.length){o.stopPropagation();return}}const r_=class r_ extends Fp{constructor(e,t,i,n,s,r,a,d,u,f){super(),this._hoverService=f,this._cachedHeight=null,this._revealTimeouts=[],this._codeEditor=e,this._controller=t,this._state=i,this._contextViewProvider=n,this._keybindingService=s,this._contextKeyService=r,this._storageService=d,this._notificationService=u,this._ctrlEnterReplaceAllWarningPrompted=!!d.getBoolean(iD,0),this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._updateHistoryDelayer=new Oc(500),this._register(is(()=>this._updateHistoryDelayer.cancel())),this._register(this._state.onFindReplaceStateChange(g=>this._onStateChanged(g))),this._buildDomNode(),this._updateButtons(),this._tryUpdateWidgetWidth(),this._findInput.inputBox.layout(),this._register(this._codeEditor.onDidChangeConfiguration(g=>{if(g.hasChanged(92)&&(this._codeEditor.getOption(92)&&this._state.change({isReplaceRevealed:!1},!1),this._updateButtons()),g.hasChanged(146)&&this._tryUpdateWidgetWidth(),g.hasChanged(2)&&this.updateAccessibilitySupport(),g.hasChanged(41)){const p=this._codeEditor.getOption(41).loop;this._state.change({loop:p},!1);const C=this._codeEditor.getOption(41).addExtraSpaceOnTop;C&&!this._viewZone&&(this._viewZone=new yC(0),this._showViewZone()),!C&&this._viewZone&&this._removeViewZone()}})),this.updateAccessibilitySupport(),this._register(this._codeEditor.onDidChangeCursorSelection(()=>{this._isVisible&&this._updateToggleSelectionFindButton()})),this._register(this._codeEditor.onDidFocusEditorWidget(async()=>{if(this._isVisible){const g=await this._controller.getGlobalBufferTerm();g&&g!==this._state.searchString&&(this._state.change({searchString:g},!1),this._findInput.select())}})),this._findInputFocused=Eb.bindTo(r),this._findFocusTracker=this._register(I0(this._findInput.inputBox.inputElement)),this._register(this._findFocusTracker.onDidFocus(()=>{this._findInputFocused.set(!0),this._updateSearchScope()})),this._register(this._findFocusTracker.onDidBlur(()=>{this._findInputFocused.set(!1)})),this._replaceInputFocused=N9.bindTo(r),this._replaceFocusTracker=this._register(I0(this._replaceInput.inputBox.inputElement)),this._register(this._replaceFocusTracker.onDidFocus(()=>{this._replaceInputFocused.set(!0),this._updateSearchScope()})),this._register(this._replaceFocusTracker.onDidBlur(()=>{this._replaceInputFocused.set(!1)})),this._codeEditor.addOverlayWidget(this),this._codeEditor.getOption(41).addExtraSpaceOnTop&&(this._viewZone=new yC(0)),this._register(this._codeEditor.onDidChangeModel(()=>{this._isVisible&&(this._viewZoneId=void 0)})),this._register(this._codeEditor.onDidScrollChange(g=>{if(g.scrollTopChanged){this._layoutViewZone();return}setTimeout(()=>{this._layoutViewZone()},0)}))}getId(){return r_.ID}getDomNode(){return this._domNode}getPosition(){return this._isVisible?{preference:0}:null}_onStateChanged(e){if(e.searchString){try{this._ignoreChangeEvent=!0,this._findInput.setValue(this._state.searchString)}finally{this._ignoreChangeEvent=!1}this._updateButtons()}if(e.replaceString&&(this._replaceInput.inputBox.value=this._state.replaceString),e.isRevealed&&(this._state.isRevealed?this._reveal():this._hide(!0)),e.isReplaceRevealed&&(this._state.isReplaceRevealed?!this._codeEditor.getOption(92)&&!this._isReplaceVisible&&(this._isReplaceVisible=!0,this._replaceInput.width=yr(this._findInput.domNode),this._updateButtons(),this._replaceInput.inputBox.layout()):this._isReplaceVisible&&(this._isReplaceVisible=!1,this._updateButtons())),(e.isRevealed||e.isReplaceRevealed)&&(this._state.isRevealed||this._state.isReplaceRevealed)&&this._tryUpdateHeight()&&this._showViewZone(),e.isRegex&&this._findInput.setRegex(this._state.isRegex),e.wholeWord&&this._findInput.setWholeWords(this._state.wholeWord),e.matchCase&&this._findInput.setCaseSensitive(this._state.matchCase),e.preserveCase&&this._replaceInput.setPreserveCase(this._state.preserveCase),e.searchScope&&(this._state.searchScope?this._toggleSelectionFind.checked=!0:this._toggleSelectionFind.checked=!1,this._updateToggleSelectionFindButton()),e.searchString||e.matchesCount||e.matchesPosition){const t=this._state.searchString.length>0&&this._state.matchesCount===0;this._domNode.classList.toggle("no-results",t),this._updateMatchesCount(),this._updateButtons()}(e.searchString||e.currentMatch)&&this._layoutViewZone(),e.updateHistory&&this._delayedUpdateHistory(),e.loop&&this._updateButtons()}_delayedUpdateHistory(){this._updateHistoryDelayer.trigger(this._updateHistory.bind(this)).then(void 0,qn)}_updateHistory(){this._state.searchString&&this._findInput.inputBox.addToHistory(),this._state.replaceString&&this._replaceInput.inputBox.addToHistory()}_updateMatchesCount(){var t;this._matchesCount.style.minWidth=Nf+"px",this._state.matchesCount>=gc?this._matchesCount.title=fN:this._matchesCount.title="",(t=this._matchesCount.firstChild)==null||t.remove();let e;if(this._state.matchesCount>0){let i=String(this._state.matchesCount);this._state.matchesCount>=gc&&(i+="+");let n=String(this._state.matchesPosition);n==="0"&&(n="?"),e=Uw(gN,n,i)}else e=tD;this._matchesCount.appendChild(document.createTextNode(e)),Nr(this._getAriaLabel(e,this._state.currentMatch,this._state.searchString)),Nf=Math.max(Nf,this._matchesCount.clientWidth)}_getAriaLabel(e,t,i){if(e===tD)return i===""?S("ariaSearchNoResultEmpty","{0} found",e):S("ariaSearchNoResult","{0} found for '{1}'",e,i);if(t){const n=S("ariaSearchNoResultWithLineNum","{0} found for '{1}', at {2}",e,i,t.startLineNumber+":"+t.startColumn),s=this._codeEditor.getModel();return s&&t.startLineNumber<=s.getLineCount()&&t.startLineNumber>=1?`${s.getLineContent(t.startLineNumber)}, ${n}`:n}return S("ariaSearchNoResultWithLineNumNoCurrentMatch","{0} found for '{1}'",e,i)}_updateToggleSelectionFindButton(){const e=this._codeEditor.getSelection(),t=e?e.startLineNumber!==e.endLineNumber||e.startColumn!==e.endColumn:!1,i=this._toggleSelectionFind.checked;this._isVisible&&(i||t)?this._toggleSelectionFind.enable():this._toggleSelectionFind.disable()}_updateButtons(){this._findInput.setEnabled(this._isVisible),this._replaceInput.setEnabled(this._isVisible&&this._isReplaceVisible),this._updateToggleSelectionFindButton(),this._closeBtn.setEnabled(this._isVisible);const e=this._state.searchString.length>0,t=!!this._state.matchesCount;this._prevBtn.setEnabled(this._isVisible&&e&&t&&this._state.canNavigateBack()),this._nextBtn.setEnabled(this._isVisible&&e&&t&&this._state.canNavigateForward()),this._replaceBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._replaceAllBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._domNode.classList.toggle("replaceToggled",this._isReplaceVisible),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible);const i=!this._codeEditor.getOption(92);this._toggleReplaceBtn.setEnabled(this._isVisible&&i)}_reveal(){if(this._revealTimeouts.forEach(e=>{clearTimeout(e)}),this._revealTimeouts=[],!this._isVisible){this._isVisible=!0;const e=this._codeEditor.getSelection();switch(this._codeEditor.getOption(41).autoFindInSelection){case"always":this._toggleSelectionFind.checked=!0;break;case"never":this._toggleSelectionFind.checked=!1;break;case"multiline":{const i=!!e&&e.startLineNumber!==e.endLineNumber;this._toggleSelectionFind.checked=i;break}}this._tryUpdateWidgetWidth(),this._updateButtons(),this._revealTimeouts.push(setTimeout(()=>{this._domNode.classList.add("visible"),this._domNode.setAttribute("aria-hidden","false")},0)),this._revealTimeouts.push(setTimeout(()=>{this._findInput.validate()},200)),this._codeEditor.layoutOverlayWidget(this);let t=!0;if(this._codeEditor.getOption(41).seedSearchStringFromSelection&&e){const i=this._codeEditor.getDomNode();if(i){const n=yo(i),s=this._codeEditor.getScrolledVisiblePosition(e.getStartPosition()),r=n.left+(s?s.left:0),a=s?s.top:0;if(this._viewZone&&a<this._viewZone.heightInPx){e.endLineNumber>e.startLineNumber&&(t=!1);const d=a4(this._domNode).left;r>d&&(t=!1);const u=this._codeEditor.getScrolledVisiblePosition(e.getEndPosition());n.left+(u?u.left:0)>d&&(t=!1)}}}this._showViewZone(t)}}_hide(e){this._revealTimeouts.forEach(t=>{clearTimeout(t)}),this._revealTimeouts=[],this._isVisible&&(this._isVisible=!1,this._updateButtons(),this._domNode.classList.remove("visible"),this._domNode.setAttribute("aria-hidden","true"),this._findInput.clearMessage(),e&&this._codeEditor.focus(),this._codeEditor.layoutOverlayWidget(this),this._removeViewZone())}_layoutViewZone(e){if(!this._codeEditor.getOption(41).addExtraSpaceOnTop){this._removeViewZone();return}if(!this._isVisible)return;const i=this._viewZone;this._viewZoneId!==void 0||!i||this._codeEditor.changeViewZones(n=>{i.heightInPx=this._getHeight(),this._viewZoneId=n.addZone(i),this._codeEditor.setScrollTop(e||this._codeEditor.getScrollTop()+i.heightInPx)})}_showViewZone(e=!0){if(!this._isVisible||!this._codeEditor.getOption(41).addExtraSpaceOnTop)return;this._viewZone===void 0&&(this._viewZone=new yC(0));const i=this._viewZone;this._codeEditor.changeViewZones(n=>{if(this._viewZoneId!==void 0){const s=this._getHeight();if(s===i.heightInPx)return;const r=s-i.heightInPx;i.heightInPx=s,n.layoutZone(this._viewZoneId),e&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+r);return}else{let s=this._getHeight();if(s-=this._codeEditor.getOption(84).top,s<=0)return;i.heightInPx=s,this._viewZoneId=n.addZone(i),e&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+s)}})}_removeViewZone(){this._codeEditor.changeViewZones(e=>{this._viewZoneId!==void 0&&(e.removeZone(this._viewZoneId),this._viewZoneId=void 0,this._viewZone&&(this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()-this._viewZone.heightInPx),this._viewZone=void 0))})}_tryUpdateWidgetWidth(){if(!this._isVisible||!this._domNode.isConnected)return;const e=this._codeEditor.getLayoutInfo();if(e.contentWidth<=0){this._domNode.classList.add("hiddenEditor");return}else this._domNode.classList.contains("hiddenEditor")&&this._domNode.classList.remove("hiddenEditor");const i=e.width,n=e.minimap.minimapWidth;let s=!1,r=!1,a=!1;if(this._resized&&yr(this._domNode)>_a){this._domNode.style.maxWidth=`${i-28-n-15}px`,this._replaceInput.width=yr(this._findInput.domNode);return}if(_a+28+n>=i&&(r=!0),_a+28+n-Nf>=i&&(a=!0),_a+28+n-Nf>=i+50&&(s=!0),this._domNode.classList.toggle("collapsed-find-widget",s),this._domNode.classList.toggle("narrow-find-widget",a),this._domNode.classList.toggle("reduced-find-widget",r),!a&&!s&&(this._domNode.style.maxWidth=`${i-28-n-15}px`),this._findInput.layout({collapsedFindWidget:s,narrowFindWidget:a,reducedFindWidget:r}),this._resized){const d=this._findInput.inputBox.element.clientWidth;d>0&&(this._replaceInput.width=d)}else this._isReplaceVisible&&(this._replaceInput.width=yr(this._findInput.domNode))}_getHeight(){let e=0;return e+=4,e+=this._findInput.inputBox.height+2,this._isReplaceVisible&&(e+=4,e+=this._replaceInput.inputBox.height+2),e+=4,e}_tryUpdateHeight(){const e=this._getHeight();return this._cachedHeight!==null&&this._cachedHeight===e?!1:(this._cachedHeight=e,this._domNode.style.height=`${e}px`,!0)}focusFindInput(){this._findInput.select(),this._findInput.focus()}focusReplaceInput(){this._replaceInput.select(),this._replaceInput.focus()}highlightFindOptions(){this._findInput.highlightFindOptions()}_updateSearchScope(){if(this._codeEditor.hasModel()&&this._toggleSelectionFind.checked){const e=this._codeEditor.getSelections();e.map(t=>{t.endColumn===1&&t.endLineNumber>t.startLineNumber&&(t=t.setEndPosition(t.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(t.endLineNumber-1)));const i=this._state.currentMatch;return t.startLineNumber!==t.endLineNumber&&!Q.equalsRange(t,i)?t:null}).filter(t=>!!t),e.length&&this._state.change({searchScope:e},!0)}}_onFindInputMouseDown(e){e.middleButton&&e.stopPropagation()}_onFindInputKeyDown(e){if(e.equals(nD|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{this._findInput.inputBox.insertAtCursor(`
21
+ `),e.preventDefault();return}if(e.equals(2)){this._isReplaceVisible?this._replaceInput.focus():this._findInput.focusOnCaseSensitive(),e.preventDefault();return}if(e.equals(2066)){this._codeEditor.focus(),e.preventDefault();return}if(e.equals(16))return sD(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"));if(e.equals(18))return oD(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"))}_onReplaceInputKeyDown(e){if(e.equals(nD|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{W_&&cf&&!this._ctrlEnterReplaceAllWarningPrompted&&(this._notificationService.info(S("ctrlEnter.keybindingChanged","Ctrl+Enter now inserts line break instead of replacing all. You can modify the keybinding for editor.action.replaceAll to override this behavior.")),this._ctrlEnterReplaceAllWarningPrompted=!0,this._storageService.store(iD,!0,0,0)),this._replaceInput.inputBox.insertAtCursor(`
22
+ `),e.preventDefault();return}if(e.equals(2)){this._findInput.focusOnCaseSensitive(),e.preventDefault();return}if(e.equals(1026)){this._findInput.focus(),e.preventDefault();return}if(e.equals(2066)){this._codeEditor.focus(),e.preventDefault();return}if(e.equals(16))return sD(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"));if(e.equals(18))return oD(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"))}getVerticalSashLeft(e){return 0}_keybindingLabelFor(e){const t=this._keybindingService.lookupKeybinding(e);return t?` (${t.getLabel()})`:""}_buildDomNode(){this._findInput=this._register(new wE(null,this._contextViewProvider,{width:xN,label:iN,placeholder:nN,appendCaseSensitiveLabel:this._keybindingLabelFor(Un.ToggleCaseSensitiveCommand),appendWholeWordsLabel:this._keybindingLabelFor(Un.ToggleWholeWordCommand),appendRegexLabel:this._keybindingLabelFor(Un.ToggleRegexCommand),validation:f=>{if(f.length===0||!this._findInput.getRegex())return null;try{return new RegExp(f,"gu"),null}catch(g){return{content:g.message}}},flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showCommonFindToggles:!0,showHistoryHint:()=>Q8(this._keybindingService),inputBoxStyles:WS,toggleStyles:HS},this._contextKeyService)),this._findInput.setRegex(!!this._state.isRegex),this._findInput.setCaseSensitive(!!this._state.matchCase),this._findInput.setWholeWords(!!this._state.wholeWord),this._register(this._findInput.onKeyDown(f=>this._onFindInputKeyDown(f))),this._register(this._findInput.inputBox.onDidChange(()=>{this._ignoreChangeEvent||this._state.change({searchString:this._findInput.getValue()},!0)})),this._register(this._findInput.onDidOptionChange(()=>{this._state.change({isRegex:this._findInput.getRegex(),wholeWord:this._findInput.getWholeWords(),matchCase:this._findInput.getCaseSensitive()},!0)})),this._register(this._findInput.onCaseSensitiveKeyDown(f=>{f.equals(1026)&&this._isReplaceVisible&&(this._replaceInput.focus(),f.preventDefault())})),this._register(this._findInput.onRegexKeyDown(f=>{f.equals(2)&&this._isReplaceVisible&&(this._replaceInput.focusOnPreserve(),f.preventDefault())})),this._register(this._findInput.inputBox.onDidHeightChange(f=>{this._tryUpdateHeight()&&this._showViewZone()})),l4&&this._register(this._findInput.onMouseDown(f=>this._onFindInputMouseDown(f))),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._updateMatchesCount();const i=this._register(o1());this._prevBtn=this._register(new Sh({label:sN+this._keybindingLabelFor(Un.PreviousMatchFindAction),icon:JR,hoverDelegate:i,onTrigger:()=>{$h(this._codeEditor.getAction(Un.PreviousMatchFindAction)).run().then(void 0,qn)}},this._hoverService)),this._nextBtn=this._register(new Sh({label:oN+this._keybindingLabelFor(Un.NextMatchFindAction),icon:eN,hoverDelegate:i,onTrigger:()=>{$h(this._codeEditor.getAction(Un.NextMatchFindAction)).run().then(void 0,qn)}},this._hoverService));const n=document.createElement("div");n.className="find-part",n.appendChild(this._findInput.domNode);const s=document.createElement("div");s.className="find-actions",n.appendChild(s),s.appendChild(this._matchesCount),s.appendChild(this._prevBtn.domNode),s.appendChild(this._nextBtn.domNode),this._toggleSelectionFind=this._register(new LA({icon:XR,title:rN+this._keybindingLabelFor(Un.ToggleSearchScopeCommand),isChecked:!1,hoverDelegate:i,inputActiveOptionBackground:Ld(Mw),inputActiveOptionBorder:Ld(FA),inputActiveOptionForeground:Ld(BA)})),this._register(this._toggleSelectionFind.onChange(()=>{if(this._toggleSelectionFind.checked){if(this._codeEditor.hasModel()){let f=this._codeEditor.getSelections();f=f.map(g=>(g.endColumn===1&&g.endLineNumber>g.startLineNumber&&(g=g.setEndPosition(g.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(g.endLineNumber-1))),g.isEmpty()?null:g)).filter(g=>!!g),f.length&&this._state.change({searchScope:f},!0)}}else this._state.change({searchScope:null},!0)})),s.appendChild(this._toggleSelectionFind.domNode),this._closeBtn=this._register(new Sh({label:aN+this._keybindingLabelFor(Un.CloseFindWidgetCommand),icon:IA,hoverDelegate:i,onTrigger:()=>{this._state.change({isRevealed:!1,searchScope:null},!1)},onKeyDown:f=>{f.equals(2)&&this._isReplaceVisible&&(this._replaceBtn.isEnabled()?this._replaceBtn.focus():this._codeEditor.focus(),f.preventDefault())}},this._hoverService)),this._replaceInput=this._register(new SE(null,void 0,{label:lN,placeholder:cN,appendPreserveCaseLabel:this._keybindingLabelFor(Un.TogglePreserveCaseCommand),history:[],flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>Q8(this._keybindingService),inputBoxStyles:WS,toggleStyles:HS},this._contextKeyService,!0)),this._replaceInput.setPreserveCase(!!this._state.preserveCase),this._register(this._replaceInput.onKeyDown(f=>this._onReplaceInputKeyDown(f))),this._register(this._replaceInput.inputBox.onDidChange(()=>{this._state.change({replaceString:this._replaceInput.inputBox.value},!1)})),this._register(this._replaceInput.inputBox.onDidHeightChange(f=>{this._isReplaceVisible&&this._tryUpdateHeight()&&this._showViewZone()})),this._register(this._replaceInput.onDidOptionChange(()=>{this._state.change({preserveCase:this._replaceInput.getPreserveCase()},!0)})),this._register(this._replaceInput.onPreserveCaseKeyDown(f=>{f.equals(2)&&(this._prevBtn.isEnabled()?this._prevBtn.focus():this._nextBtn.isEnabled()?this._nextBtn.focus():this._toggleSelectionFind.enabled?this._toggleSelectionFind.focus():this._closeBtn.isEnabled()&&this._closeBtn.focus(),f.preventDefault())}));const r=this._register(o1());this._replaceBtn=this._register(new Sh({label:dN+this._keybindingLabelFor(Un.ReplaceOneAction),icon:YR,hoverDelegate:r,onTrigger:()=>{this._controller.replace()},onKeyDown:f=>{f.equals(1026)&&(this._closeBtn.focus(),f.preventDefault())}},this._hoverService)),this._replaceAllBtn=this._register(new Sh({label:uN+this._keybindingLabelFor(Un.ReplaceAllAction),icon:QR,hoverDelegate:r,onTrigger:()=>{this._controller.replaceAll()}},this._hoverService));const a=document.createElement("div");a.className="replace-part",a.appendChild(this._replaceInput.domNode);const d=document.createElement("div");d.className="replace-actions",a.appendChild(d),d.appendChild(this._replaceBtn.domNode),d.appendChild(this._replaceAllBtn.domNode),this._toggleReplaceBtn=this._register(new Sh({label:hN,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=yr(this._findInput.domNode),this._replaceInput.inputBox.layout()),this._showViewZone()}},this._hoverService)),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible),this._domNode=document.createElement("div"),this._domNode.className="editor-widget find-widget",this._domNode.setAttribute("aria-hidden","true"),this._domNode.ariaLabel=tN,this._domNode.role="dialog",this._domNode.style.width=`${_a}px`,this._domNode.appendChild(this._toggleReplaceBtn.domNode),this._domNode.appendChild(n),this._domNode.appendChild(this._closeBtn.domNode),this._domNode.appendChild(a),this._resizeSash=this._register(new zh(this._domNode,this,{orientation:0,size:2})),this._resized=!1;let u=_a;this._register(this._resizeSash.onDidStart(()=>{u=yr(this._domNode)})),this._register(this._resizeSash.onDidChange(f=>{this._resized=!0;const g=u+f.startX-f.currentX;if(g<_a)return;const p=parseFloat(c4(this._domNode).maxWidth)||0;g>p||(this._domNode.style.width=`${g}px`,this._isReplaceVisible&&(this._replaceInput.width=yr(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())})),this._register(this._resizeSash.onDidReset(()=>{const f=yr(this._domNode);if(f<_a)return;let g=_a;if(!this._resized||f===_a){const p=this._codeEditor.getLayoutInfo();g=p.width-28-p.minimap.minimapWidth-15,this._resized=!0}this._domNode.style.width=`${g}px`,this._isReplaceVisible&&(this._replaceInput.width=yr(this._findInput.domNode)),this._findInput.inputBox.layout()}))}updateAccessibilitySupport(){const e=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(e!==2)}};r_.ID="editor.contrib.findWidget";let DE=r_;class Sh extends Fp{constructor(e,t){super(),this._opts=e;let i="button";this._opts.className&&(i=i+" "+this._opts.className),this._opts.icon&&(i=i+" "+Rn.asClassName(this._opts.icon)),this._domNode=document.createElement("div"),this._domNode.tabIndex=0,this._domNode.className=i,this._domNode.setAttribute("role","button"),this._domNode.setAttribute("aria-label",this._opts.label),this._register(t.setupManagedHover(e.hoverDelegate??Y_("element"),this._domNode,this._opts.label)),this.onclick(this._domNode,n=>{this._opts.onTrigger(),n.preventDefault()}),this.onkeydown(this._domNode,n=>{var s,r;if(n.equals(10)||n.equals(3)){this._opts.onTrigger(),n.preventDefault();return}(r=(s=this._opts).onKeyDown)==null||r.call(s,n)})}get domNode(){return this._domNode}isEnabled(){return this._domNode.tabIndex>=0}focus(){this._domNode.focus()}setEnabled(e){this._domNode.classList.toggle("disabled",!e),this._domNode.setAttribute("aria-disabled",String(!e)),this._domNode.tabIndex=e?0:-1}setExpanded(e){this._domNode.setAttribute("aria-expanded",String(!!e)),e?(this._domNode.classList.remove(...Rn.asClassNameArray(J8)),this._domNode.classList.add(...Rn.asClassNameArray(eD))):(this._domNode.classList.remove(...Rn.asClassNameArray(eD)),this._domNode.classList.add(...Rn.asClassNameArray(J8)))}}$_((o,e)=>{const t=o.getColor(uA);t&&e.addRule(`.monaco-editor .findMatch { border: 1px ${Fg(o.type)?"dotted":"solid"} ${t}; box-sizing: border-box; }`);const i=o.getColor(d4);i&&e.addRule(`.monaco-editor .findScope { border: 1px ${Fg(o.type)?"dashed":"solid"} ${i}; }`);const n=o.getColor(wl);n&&e.addRule(`.monaco-editor .find-widget { border: 1px solid ${n}; }`);const s=o.getColor(u4);s&&e.addRule(`.monaco-editor .findMatchInline { color: ${s}; }`);const r=o.getColor(h4);r&&e.addRule(`.monaco-editor .currentFindMatchInline { color: ${r}; }`)});var lB=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},cr=function(o,e){return function(t,i){e(t,i,o)}},AE;const vN=524288;function kE(o,e="single",t=!1){if(!o.hasModel())return null;const i=o.getSelection();if(e==="single"&&i.startLineNumber===i.endLineNumber||e==="multiple"){if(i.isEmpty()){const n=o.getConfiguredWordAtPosition(i.getStartPosition());if(n&&t===!1)return n.word}else if(o.getModel().getValueLengthInRange(i)<vN)return o.getModel().getValueInRange(i)}return null}var ou;let So=(ou=class extends Rt{get editor(){return this._editor}static get(e){return e.getContribution(AE.ID)}constructor(e,t,i,n,s,r){super(),this._editor=e,this._findWidgetVisible=Wl.bindTo(t),this._contextKeyService=t,this._storageService=i,this._clipboardService=n,this._notificationService=s,this._hoverService=r,this._updateHistoryDelayer=new Oc(500),this._state=this._register(new UR),this.loadQueryState(),this._register(this._state.onFindReplaceStateChange(a=>this._onStateChanged(a))),this._model=null,this._register(this._editor.onDidChangeModel(()=>{const a=this._editor.getModel()&&this._state.isRevealed;this.disposeModel(),this._state.change({searchScope:null,matchCase:this._storageService.getBoolean("editor.matchCase",1,!1),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,!1),isRegex:this._storageService.getBoolean("editor.isRegex",1,!1),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,!1)},!1),a&&this._start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!1,updateSearchScope:!1,loop:this._editor.getOption(41).loop})}))}dispose(){this.disposeModel(),super.dispose()}disposeModel(){this._model&&(this._model.dispose(),this._model=null)}_onStateChanged(e){this.saveQueryState(e),e.isRevealed&&(this._state.isRevealed?this._findWidgetVisible.set(!0):(this._findWidgetVisible.reset(),this.disposeModel())),e.searchString&&this.setGlobalBufferTerm(this._state.searchString)}saveQueryState(e){e.isRegex&&this._storageService.store("editor.isRegex",this._state.actualIsRegex,1,1),e.wholeWord&&this._storageService.store("editor.wholeWord",this._state.actualWholeWord,1,1),e.matchCase&&this._storageService.store("editor.matchCase",this._state.actualMatchCase,1,1),e.preserveCase&&this._storageService.store("editor.preserveCase",this._state.actualPreserveCase,1,1)}loadQueryState(){this._state.change({matchCase:this._storageService.getBoolean("editor.matchCase",1,this._state.matchCase),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,this._state.wholeWord),isRegex:this._storageService.getBoolean("editor.isRegex",1,this._state.isRegex),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,this._state.preserveCase)},!1)}isFindInputFocused(){return!!Eb.getValue(this._contextKeyService)}getState(){return this._state}closeFindWidget(){this._state.change({isRevealed:!1,searchScope:null},!1),this._editor.focus()}toggleCaseSensitive(){this._state.change({matchCase:!this._state.matchCase},!1),this._state.isRevealed||this.highlightFindOptions()}toggleWholeWords(){this._state.change({wholeWord:!this._state.wholeWord},!1),this._state.isRevealed||this.highlightFindOptions()}toggleRegex(){this._state.change({isRegex:!this._state.isRegex},!1),this._state.isRevealed||this.highlightFindOptions()}togglePreserveCase(){this._state.change({preserveCase:!this._state.preserveCase},!1),this._state.isRevealed||this.highlightFindOptions()}toggleSearchScope(){if(this._state.searchScope)this._state.change({searchScope:null},!0);else if(this._editor.hasModel()){let e=this._editor.getSelections();e=e.map(t=>(t.endColumn===1&&t.endLineNumber>t.startLineNumber&&(t=t.setEndPosition(t.endLineNumber-1,this._editor.getModel().getLineMaxColumn(t.endLineNumber-1))),t.isEmpty()?null:t)).filter(t=>!!t),e.length&&this._state.change({searchScope:e},!0)}}setSearchString(e){this._state.isRegex&&(e=Lg(e)),this._state.change({searchString:e},!1)}highlightFindOptions(e=!1){}async _start(e,t){if(this.disposeModel(),!this._editor.hasModel())return;const i={...t,isRevealed:!0};if(e.seedSearchStringFromSelection==="single"){const n=kE(this._editor,e.seedSearchStringFromSelection,e.seedSearchStringFromNonEmptySelection);n&&(this._state.isRegex?i.searchString=Lg(n):i.searchString=n)}else if(e.seedSearchStringFromSelection==="multiple"&&!e.updateSearchScope){const n=kE(this._editor,e.seedSearchStringFromSelection);n&&(i.searchString=n)}if(!i.searchString&&e.seedSearchStringFromGlobalClipboard){const n=await this.getGlobalBufferTerm();if(!this._editor.hasModel())return;n&&(i.searchString=n)}if(e.forceRevealReplace||i.isReplaceRevealed?i.isReplaceRevealed=!0:this._findWidgetVisible.get()||(i.isReplaceRevealed=!1),e.updateSearchScope){const n=this._editor.getSelections();n.some(s=>!s.isEmpty())&&(i.searchScope=n)}i.loop=e.loop,this._state.change(i,!1),this._model||(this._model=new pg(this._editor,this._state))}start(e,t){return this._start(e,t)}moveToNextMatch(){return this._model?(this._model.moveToNextMatch(),!0):!1}moveToPrevMatch(){return this._model?(this._model.moveToPrevMatch(),!0):!1}goToMatch(e){return this._model?(this._model.moveToMatch(e),!0):!1}replace(){return this._model?(this._model.replace(),!0):!1}replaceAll(){var e;return this._model?(e=this._editor.getModel())!=null&&e.isTooLargeForHeapOperation()?(this._notificationService.warn(S("too.large.for.replaceall","The file is too large to perform a replace all operation.")),!1):(this._model.replaceAll(),!0):!1}selectAllMatches(){return this._model?(this._model.selectAllMatches(),this._editor.focus(),!0):!1}async getGlobalBufferTerm(){return this._editor.getOption(41).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()?this._clipboardService.readFindText():""}setGlobalBufferTerm(e){this._editor.getOption(41).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()&&this._clipboardService.writeFindText(e)}},AE=ou,ou.ID="editor.contrib.findController",ou);So=AE=lB([cr(1,Fn),cr(2,Gc),cr(3,lf),cr(4,mo),cr(5,Pp)],So);let BE=class extends So{constructor(e,t,i,n,s,r,a,d,u){super(e,i,a,d,r,u),this._contextViewService=t,this._keybindingService=n,this._themeService=s,this._widget=null,this._findOptionsWidget=null}async _start(e,t){this._widget||this._createFindWidget();const i=this._editor.getSelection();let n=!1;switch(this._editor.getOption(41).autoFindInSelection){case"always":n=!0;break;case"never":n=!1;break;case"multiline":{n=!!i&&i.startLineNumber!==i.endLineNumber;break}}e.updateSearchScope=e.updateSearchScope||n,await super._start(e,t),this._widget&&(e.shouldFocus===2?this._widget.focusReplaceInput():e.shouldFocus===1&&this._widget.focusFindInput())}highlightFindOptions(e=!1){this._widget||this._createFindWidget(),this._state.isRevealed&&!e?this._widget.highlightFindOptions():this._findOptionsWidget.highlightFindOptions()}_createFindWidget(){this._widget=this._register(new DE(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._themeService,this._storageService,this._notificationService,this._hoverService)),this._findOptionsWidget=this._register(new yE(this._editor,this._state,this._keybindingService))}};BE=lB([cr(1,j_),cr(2,Fn),cr(3,As),cr(4,Wr),cr(5,mo),cr(6,Gc),cr(7,lf),cr(8,Pp)],BE);const _N=PA(new TA({id:Un.StartFindAction,label:S("startFindAction","Find"),alias:"Find",precondition:qe.or(q.focus,qe.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:ni.MenubarEditMenu,group:"3_find",title:S({key:"miFind",comment:["&& denotes a mnemonic"]},"&&Find"),order:1}}));_N.addImplementation(0,(o,e,t)=>{const i=So.get(e);return i?i.start({forceRevealReplace:!1,seedSearchStringFromSelection:e.getOption(41).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:e.getOption(41).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:e.getOption(41).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(41).loop}):!1});const bN={description:"Open a new In-Editor Find Widget.",args:[{name:"Open a new In-Editor Find Widget args",schema:{properties:{searchString:{type:"string"},replaceString:{type:"string"},isRegex:{type:"boolean"},matchWholeWord:{type:"boolean"},isCaseSensitive:{type:"boolean"},preserveCase:{type:"boolean"},findInSelection:{type:"boolean"}}}}]};class CN extends Ct{constructor(){super({id:Un.StartFindWithArgs,label:S("startFindWithArgsAction","Find With Arguments"),alias:"Find With Arguments",precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},metadata:bN})}async run(e,t,i){const n=So.get(t);if(n){const s=i?{searchString:i.searchString,replaceString:i.replaceString,isReplaceRevealed:i.replaceString!==void 0,isRegex:i.isRegex,wholeWord:i.matchWholeWord,matchCase:i.isCaseSensitive,preserveCase:i.preserveCase}:{};await n.start({forceRevealReplace:!1,seedSearchStringFromSelection:n.getState().searchString.length===0&&t.getOption(41).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:t.getOption(41).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:!0,shouldFocus:1,shouldAnimate:!0,updateSearchScope:(i==null?void 0:i.findInSelection)||!1,loop:t.getOption(41).loop},s),n.setGlobalBufferTerm(n.getState().searchString)}}}class EN extends Ct{constructor(){super({id:Un.StartFindWithSelection,label:S("startFindWithSelectionAction","Find With Selection"),alias:"Find With Selection",precondition:void 0,kbOpts:{kbExpr:null,primary:0,mac:{primary:2083},weight:100}})}async run(e,t){const i=So.get(t);i&&(await i.start({forceRevealReplace:!1,seedSearchStringFromSelection:"multiple",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(41).loop}),i.setGlobalBufferTerm(i.getState().searchString))}}class cB extends Ct{async run(e,t){const i=So.get(t);i&&!this._run(i)&&(await i.start({forceRevealReplace:!1,seedSearchStringFromSelection:i.getState().searchString.length===0&&t.getOption(41).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:t.getOption(41).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:!0,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(41).loop}),this._run(i))}}class yN extends cB{constructor(){super({id:Un.NextMatchFindAction,label:S("findNextMatchAction","Find Next"),alias:"Find Next",precondition:void 0,kbOpts:[{kbExpr:q.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:qe.and(q.focus,Eb),primary:3,weight:100}]})}_run(e){return e.moveToNextMatch()?(e.editor.pushUndoStop(),!0):!1}}class wN extends cB{constructor(){super({id:Un.PreviousMatchFindAction,label:S("findPreviousMatchAction","Find Previous"),alias:"Find Previous",precondition:void 0,kbOpts:[{kbExpr:q.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:qe.and(q.focus,Eb),primary:1027,weight:100}]})}_run(e){return e.moveToPrevMatch()}}class SN extends Ct{constructor(){super({id:Un.GoToMatchFindAction,label:S("findMatchAction.goToMatch","Go to Match..."),alias:"Go to Match...",precondition:Wl}),this._highlightDecorations=[]}run(e,t,i){const n=So.get(t);if(!n)return;const s=n.getState().matchesCount;if(s<1){e.get(mo).notify({severity:jw.Warning,message:S("findMatchAction.noResults","No matches. Try searching for something else.")});return}const r=e.get(Tl),a=new Tt,d=a.add(r.createInputBox());d.placeholder=S("findMatchAction.inputPlaceHolder","Type a number to go to a specific match (between 1 and {0})",s);const u=g=>{const p=parseInt(g);if(isNaN(p))return;const C=n.getState().matchesCount;if(p>0&&p<=C)return p-1;if(p<0&&p>=-C)return C+p},f=g=>{const p=u(g);if(typeof p=="number"){d.validationMessage=void 0,n.goToMatch(p);const C=n.getState().currentMatch;C&&this.addDecorations(t,C)}else d.validationMessage=S("findMatchAction.inputValidationMessage","Please type a number between 1 and {0}",n.getState().matchesCount),this.clearDecorations(t)};a.add(d.onDidChangeValue(g=>{f(g)})),a.add(d.onDidAccept(()=>{const g=u(d.value);typeof g=="number"?(n.goToMatch(g),d.hide()):d.validationMessage=S("findMatchAction.inputValidationMessage","Please type a number between 1 and {0}",n.getState().matchesCount)})),a.add(d.onDidHide(()=>{this.clearDecorations(t),a.dispose()})),d.show()}clearDecorations(e){e.changeDecorations(t=>{this._highlightDecorations=t.deltaDecorations(this._highlightDecorations,[])})}addDecorations(e,t){e.changeDecorations(i=>{this._highlightDecorations=i.deltaDecorations(this._highlightDecorations,[{range:t,options:{description:"find-match-quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:t,options:{description:"find-match-quick-access-range-highlight-overview",overviewRuler:{color:Fs(MA),position:Ha.Full}}}])})}}class dB extends Ct{async run(e,t){const i=So.get(t);if(!i)return;const n=kE(t,"single",!1);n&&i.setSearchString(n),this._run(i)||(await i.start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(41).loop}),this._run(i))}}class DN extends dB{constructor(){super({id:Un.NextSelectionMatchFindAction,label:S("nextSelectionMatchFindAction","Find Next Selection"),alias:"Find Next Selection",precondition:void 0,kbOpts:{kbExpr:q.focus,primary:2109,weight:100}})}_run(e){return e.moveToNextMatch()}}class AN extends dB{constructor(){super({id:Un.PreviousSelectionMatchFindAction,label:S("previousSelectionMatchFindAction","Find Previous Selection"),alias:"Find Previous Selection",precondition:void 0,kbOpts:{kbExpr:q.focus,primary:3133,weight:100}})}_run(e){return e.moveToPrevMatch()}}const kN=PA(new TA({id:Un.StartFindReplaceAction,label:S("startReplace","Replace"),alias:"Replace",precondition:qe.or(q.focus,qe.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:ni.MenubarEditMenu,group:"3_find",title:S({key:"miReplace",comment:["&& denotes a mnemonic"]},"&&Replace"),order:2}}));kN.addImplementation(0,(o,e,t)=>{if(!e.hasModel()||e.getOption(92))return!1;const i=So.get(e);if(!i)return!1;const n=e.getSelection(),s=i.isFindInputFocused(),r=!n.isEmpty()&&n.startLineNumber===n.endLineNumber&&e.getOption(41).seedSearchStringFromSelection!=="never"&&!s,a=s||r?2:1;return i.start({forceRevealReplace:!0,seedSearchStringFromSelection:r?"single":"none",seedSearchStringFromNonEmptySelection:e.getOption(41).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:e.getOption(41).seedSearchStringFromSelection!=="never",shouldFocus:a,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(41).loop})});hn(So.ID,BE,0);Le(CN);Le(EN);Le(yN);Le(wN);Le(SN);Le(DN);Le(AN);const ga=Ao.bindToContribution(So.get);Ti(new ga({id:Un.CloseFindWidgetCommand,precondition:Wl,handler:o=>o.closeFindWidget(),kbOpts:{weight:105,kbExpr:qe.and(q.focus,qe.not("isComposing")),primary:9,secondary:[1033]}}));Ti(new ga({id:Un.ToggleCaseSensitiveCommand,precondition:void 0,handler:o=>o.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:q.focus,primary:wx.primary,mac:wx.mac,win:wx.win,linux:wx.linux}}));Ti(new ga({id:Un.ToggleWholeWordCommand,precondition:void 0,handler:o=>o.toggleWholeWords(),kbOpts:{weight:105,kbExpr:q.focus,primary:Sx.primary,mac:Sx.mac,win:Sx.win,linux:Sx.linux}}));Ti(new ga({id:Un.ToggleRegexCommand,precondition:void 0,handler:o=>o.toggleRegex(),kbOpts:{weight:105,kbExpr:q.focus,primary:Dx.primary,mac:Dx.mac,win:Dx.win,linux:Dx.linux}}));Ti(new ga({id:Un.ToggleSearchScopeCommand,precondition:void 0,handler:o=>o.toggleSearchScope(),kbOpts:{weight:105,kbExpr:q.focus,primary:Ax.primary,mac:Ax.mac,win:Ax.win,linux:Ax.linux}}));Ti(new ga({id:Un.TogglePreserveCaseCommand,precondition:void 0,handler:o=>o.togglePreserveCase(),kbOpts:{weight:105,kbExpr:q.focus,primary:kx.primary,mac:kx.mac,win:kx.win,linux:kx.linux}}));Ti(new ga({id:Un.ReplaceOneAction,precondition:Wl,handler:o=>o.replace(),kbOpts:{weight:105,kbExpr:q.focus,primary:3094}}));Ti(new ga({id:Un.ReplaceOneAction,precondition:Wl,handler:o=>o.replace(),kbOpts:{weight:105,kbExpr:qe.and(q.focus,N9),primary:3}}));Ti(new ga({id:Un.ReplaceAllAction,precondition:Wl,handler:o=>o.replaceAll(),kbOpts:{weight:105,kbExpr:q.focus,primary:2563}}));Ti(new ga({id:Un.ReplaceAllAction,precondition:Wl,handler:o=>o.replaceAll(),kbOpts:{weight:105,kbExpr:qe.and(q.focus,N9),primary:void 0,mac:{primary:2051}}}));Ti(new ga({id:Un.SelectAllMatchesAction,precondition:Wl,handler:o=>o.selectAllMatches(),kbOpts:{weight:105,kbExpr:q.focus,primary:515}}));const BN={0:" ",1:"u",2:"r"},rD=65535,Qr=16777215,aD=4278190080;class wC{constructor(e){const t=Math.ceil(e/32);this._states=new Uint32Array(t)}get(e){const t=e/32|0,i=e%32;return(this._states[t]&1<<i)!==0}set(e,t){const i=e/32|0,n=e%32,s=this._states[i];t?this._states[i]=s|1<<n:this._states[i]=s&~(1<<n)}}class Go{constructor(e,t,i){if(e.length!==t.length||e.length>rD)throw new Error("invalid startIndexes or endIndexes size");this._startIndexes=e,this._endIndexes=t,this._collapseStates=new wC(e.length),this._userDefinedStates=new wC(e.length),this._recoveredStates=new wC(e.length),this._types=i,this._parentsComputed=!1}ensureParentIndices(){if(!this._parentsComputed){this._parentsComputed=!0;const e=[],t=(i,n)=>{const s=e[e.length-1];return this.getStartLineNumber(s)<=i&&this.getEndLineNumber(s)>=n};for(let i=0,n=this._startIndexes.length;i<n;i++){const s=this._startIndexes[i],r=this._endIndexes[i];if(s>Qr||r>Qr)throw new Error("startLineNumber or endLineNumber must not exceed "+Qr);for(;e.length>0&&!t(s,r);)e.pop();const a=e.length>0?e[e.length-1]:-1;e.push(i),this._startIndexes[i]=s+((a&255)<<24),this._endIndexes[i]=r+((a&65280)<<16)}}}get length(){return this._startIndexes.length}getStartLineNumber(e){return this._startIndexes[e]&Qr}getEndLineNumber(e){return this._endIndexes[e]&Qr}getType(e){return this._types?this._types[e]:void 0}hasTypes(){return!!this._types}isCollapsed(e){return this._collapseStates.get(e)}setCollapsed(e,t){this._collapseStates.set(e,t)}isUserDefined(e){return this._userDefinedStates.get(e)}setUserDefined(e,t){return this._userDefinedStates.set(e,t)}isRecovered(e){return this._recoveredStates.get(e)}setRecovered(e,t){return this._recoveredStates.set(e,t)}getSource(e){return this.isUserDefined(e)?1:this.isRecovered(e)?2:0}setSource(e,t){t===1?(this.setUserDefined(e,!0),this.setRecovered(e,!1)):t===2?(this.setUserDefined(e,!1),this.setRecovered(e,!0)):(this.setUserDefined(e,!1),this.setRecovered(e,!1))}setCollapsedAllOfType(e,t){let i=!1;if(this._types)for(let n=0;n<this._types.length;n++)this._types[n]===e&&(this.setCollapsed(n,t),i=!0);return i}toRegion(e){return new FN(this,e)}getParentIndex(e){this.ensureParentIndices();const t=((this._startIndexes[e]&aD)>>>24)+((this._endIndexes[e]&aD)>>>16);return t===rD?-1:t}contains(e,t){return this.getStartLineNumber(e)<=t&&this.getEndLineNumber(e)>=t}findIndex(e){let t=0,i=this._startIndexes.length;if(i===0)return-1;for(;t<i;){const n=Math.floor((t+i)/2);e<this.getStartLineNumber(n)?i=n:t=n+1}return t-1}findRange(e){let t=this.findIndex(e);if(t>=0){if(this.getEndLineNumber(t)>=e)return t;for(t=this.getParentIndex(t);t!==-1;){if(this.contains(t,e))return t;t=this.getParentIndex(t)}}return-1}toString(){const e=[];for(let t=0;t<this.length;t++)e[t]=`[${BN[this.getSource(t)]}${this.isCollapsed(t)?"+":"-"}] ${this.getStartLineNumber(t)}/${this.getEndLineNumber(t)}`;return e.join(", ")}toFoldRange(e){return{startLineNumber:this._startIndexes[e]&Qr,endLineNumber:this._endIndexes[e]&Qr,type:this._types?this._types[e]:void 0,isCollapsed:this.isCollapsed(e),source:this.getSource(e)}}static fromFoldRanges(e){const t=e.length,i=new Uint32Array(t),n=new Uint32Array(t);let s=[],r=!1;for(let d=0;d<t;d++){const u=e[d];i[d]=u.startLineNumber,n[d]=u.endLineNumber,s.push(u.type),u.type&&(r=!0)}r||(s=void 0);const a=new Go(i,n,s);for(let d=0;d<t;d++)e[d].isCollapsed&&a.setCollapsed(d,!0),a.setSource(d,e[d].source);return a}static sanitizeAndMerge(e,t,i,n){i=i??Number.MAX_VALUE;const s=(w,A)=>Array.isArray(w)?(I=>I<A?w[I]:void 0):(I=>I<A?w.toFoldRange(I):void 0),r=s(e,e.length),a=s(t,t.length);let d=0,u=0,f=r(0),g=a(0);const p=[];let C,b=0;const y=[];for(;f||g;){let w;if(g&&(!f||f.startLineNumber>=g.startLineNumber))f&&f.startLineNumber===g.startLineNumber?(g.source===1?w=g:(w=f,w.isCollapsed=g.isCollapsed&&(f.endLineNumber===g.endLineNumber||!(n!=null&&n.startsInside(f.startLineNumber+1,f.endLineNumber+1))),w.source=0),f=r(++d)):(w=g,g.isCollapsed&&g.source===0&&(w.source=2)),g=a(++u);else{let A=u,I=g;for(;;){if(!I||I.startLineNumber>f.endLineNumber){w=f;break}if(I.source===1&&I.endLineNumber>f.endLineNumber)break;I=a(++A)}f=r(++d)}if(w){for(;C&&C.endLineNumber<w.startLineNumber;)C=p.pop();w.endLineNumber>w.startLineNumber&&w.startLineNumber>b&&w.endLineNumber<=i&&(!C||C.endLineNumber>=w.endLineNumber)&&(y.push(w),b=w.startLineNumber,C&&p.push(C),C=w)}}return y}}class FN{constructor(e,t){this.ranges=e,this.index=t}get startLineNumber(){return this.ranges.getStartLineNumber(this.index)}get endLineNumber(){return this.ranges.getEndLineNumber(this.index)}get regionIndex(){return this.index}get parentIndex(){return this.ranges.getParentIndex(this.index)}get isCollapsed(){return this.ranges.isCollapsed(this.index)}containedBy(e){return e.startLineNumber<=this.startLineNumber&&e.endLineNumber>=this.endLineNumber}containsLine(e){return this.startLineNumber<=e&&e<=this.endLineNumber}}class LN{get regions(){return this._regions}get textModel(){return this._textModel}constructor(e,t){this._updateEventEmitter=new rn,this.onDidChange=this._updateEventEmitter.event,this._textModel=e,this._decorationProvider=t,this._regions=new Go(new Uint32Array(0),new Uint32Array(0)),this._editorDecorationIds=[]}toggleCollapseState(e){if(!e.length)return;e=e.sort((i,n)=>i.regionIndex-n.regionIndex);const t={};this._decorationProvider.changeDecorations(i=>{let n=0,s=-1,r=-1;const a=d=>{for(;n<d;){const u=this._regions.getEndLineNumber(n),f=this._regions.isCollapsed(n);if(u<=s){const g=this.regions.getSource(n)!==0;i.changeDecorationOptions(this._editorDecorationIds[n],this._decorationProvider.getDecorationOption(f,u<=r,g))}f&&u>r&&(r=u),n++}};for(const d of e){const u=d.regionIndex,f=this._editorDecorationIds[u];if(f&&!t[f]){t[f]=!0,a(u);const g=!this._regions.isCollapsed(u);this._regions.setCollapsed(u,g),s=Math.max(s,this._regions.getEndLineNumber(u))}}a(this._regions.length)}),this._updateEventEmitter.fire({model:this,collapseStateChanged:e})}removeManualRanges(e){const t=new Array,i=n=>{for(const s of e)if(!(s.startLineNumber>n.endLineNumber||n.startLineNumber>s.endLineNumber))return!0;return!1};for(let n=0;n<this._regions.length;n++){const s=this._regions.toFoldRange(n);(s.source===0||!i(s))&&t.push(s)}this.updatePost(Go.fromFoldRanges(t))}update(e,t){const i=this._currentFoldedOrManualRanges(t),n=Go.sanitizeAndMerge(e,i,this._textModel.getLineCount(),t);this.updatePost(Go.fromFoldRanges(n))}updatePost(e){const t=[];let i=-1;for(let n=0,s=e.length;n<s;n++){const r=e.getStartLineNumber(n),a=e.getEndLineNumber(n),d=e.isCollapsed(n),u=e.getSource(n)!==0,f={startLineNumber:r,startColumn:this._textModel.getLineMaxColumn(r),endLineNumber:a,endColumn:this._textModel.getLineMaxColumn(a)+1};t.push({range:f,options:this._decorationProvider.getDecorationOption(d,a<=i,u)}),d&&a>i&&(i=a)}this._decorationProvider.changeDecorations(n=>this._editorDecorationIds=n.deltaDecorations(this._editorDecorationIds,t)),this._regions=e,this._updateEventEmitter.fire({model:this})}_currentFoldedOrManualRanges(e){const t=[];for(let i=0,n=this._regions.length;i<n;i++){let s=this.regions.isCollapsed(i);const r=this.regions.getSource(i);if(s||r!==0){const a=this._regions.toFoldRange(i),d=this._textModel.getDecorationRange(this._editorDecorationIds[i]);d&&(s&&(e!=null&&e.startsInside(d.startLineNumber+1,d.endLineNumber))&&(s=!1),t.push({startLineNumber:d.startLineNumber,endLineNumber:d.endLineNumber,type:a.type,isCollapsed:s,source:r}))}}return t}getMemento(){const e=this._currentFoldedOrManualRanges(),t=[],i=this._textModel.getLineCount();for(let n=0,s=e.length;n<s;n++){const r=e[n];if(r.startLineNumber>=r.endLineNumber||r.startLineNumber<1||r.endLineNumber>i)continue;const a=this._getLinesChecksum(r.startLineNumber+1,r.endLineNumber);t.push({startLineNumber:r.startLineNumber,endLineNumber:r.endLineNumber,isCollapsed:r.isCollapsed,source:r.source,checksum:a})}return t.length>0?t:void 0}applyMemento(e){if(!Array.isArray(e))return;const t=[],i=this._textModel.getLineCount();for(const s of e){if(s.startLineNumber>=s.endLineNumber||s.startLineNumber<1||s.endLineNumber>i)continue;const r=this._getLinesChecksum(s.startLineNumber+1,s.endLineNumber);(!s.checksum||r===s.checksum)&&t.push({startLineNumber:s.startLineNumber,endLineNumber:s.endLineNumber,type:void 0,isCollapsed:s.isCollapsed??!0,source:s.source??0})}const n=Go.sanitizeAndMerge(this._regions,t,i);this.updatePost(Go.fromFoldRanges(n))}_getLinesChecksum(e,t){return RA(this._textModel.getLineContent(e)+this._textModel.getLineContent(t))%1e6}dispose(){this._decorationProvider.removeDecorations(this._editorDecorationIds)}getAllRegionsAtLine(e,t){const i=[];if(this._regions){let n=this._regions.findRange(e),s=1;for(;n>=0;){const r=this._regions.toRegion(n);(!t||t(r,s))&&i.push(r),s++,n=r.parentIndex}}return i}getRegionAtLine(e){if(this._regions){const t=this._regions.findRange(e);if(t>=0)return this._regions.toRegion(t)}return null}getRegionsInside(e,t){const i=[],n=e?e.regionIndex+1:0,s=e?e.endLineNumber:Number.MAX_VALUE;if(t&&t.length===2){const r=[];for(let a=n,d=this._regions.length;a<d;a++){const u=this._regions.toRegion(a);if(this._regions.getStartLineNumber(a)<s){for(;r.length>0&&!u.containedBy(r[r.length-1]);)r.pop();r.push(u),t(u,r.length)&&i.push(u)}else break}}else for(let r=n,a=this._regions.length;r<a;r++){const d=this._regions.toRegion(r);if(this._regions.getStartLineNumber(r)<s)(!t||t(d))&&i.push(d);else break}return i}}function W9(o,e,t){const i=[];for(const n of t){const s=o.getRegionAtLine(n);if(s){const r=!s.isCollapsed;if(i.push(s),e>1){const a=o.getRegionsInside(s,(d,u)=>d.isCollapsed!==r&&u<e);i.push(...a)}}}o.toggleCollapseState(i)}function mf(o,e,t=Number.MAX_VALUE,i){const n=[];if(i&&i.length>0)for(const s of i){const r=o.getRegionAtLine(s);if(r&&(r.isCollapsed!==e&&n.push(r),t>1)){const a=o.getRegionsInside(r,(d,u)=>d.isCollapsed!==e&&u<t);n.push(...a)}}else{const s=o.getRegionsInside(null,(r,a)=>r.isCollapsed!==e&&a<t);n.push(...s)}o.toggleCollapseState(n)}function uB(o,e,t,i){const n=[];for(const s of i){const r=o.getAllRegionsAtLine(s,(a,d)=>a.isCollapsed!==e&&d<=t);n.push(...r)}o.toggleCollapseState(n)}function IN(o,e,t){const i=[];for(const n of t){const s=o.getAllRegionsAtLine(n,r=>r.isCollapsed!==e);s.length>0&&i.push(s[0])}o.toggleCollapseState(i)}function PN(o,e,t,i){const n=(r,a)=>a===e&&r.isCollapsed!==t&&!i.some(d=>r.containsLine(d)),s=o.getRegionsInside(null,n);o.toggleCollapseState(s)}function hB(o,e,t){const i=[];for(const r of t){const a=o.getAllRegionsAtLine(r,void 0);a.length>0&&i.push(a[0])}const n=r=>i.every(a=>!a.containedBy(r)&&!r.containedBy(a))&&r.isCollapsed!==e,s=o.getRegionsInside(null,n);o.toggleCollapseState(s)}function z9(o,e,t){const i=o.textModel,n=o.regions,s=[];for(let r=n.length-1;r>=0;r--)if(t!==n.isCollapsed(r)){const a=n.getStartLineNumber(r);e.test(i.getLineContent(a))&&s.push(n.toRegion(r))}o.toggleCollapseState(s)}function V9(o,e,t){const i=o.regions,n=[];for(let s=i.length-1;s>=0;s--)t!==i.isCollapsed(s)&&e===i.getType(s)&&n.push(i.toRegion(s));o.toggleCollapseState(n)}function TN(o,e){let t=null;const i=e.getRegionAtLine(o);if(i!==null&&(t=i.startLineNumber,o===t)){const n=i.parentIndex;n!==-1?t=e.regions.getStartLineNumber(n):t=null}return t}function MN(o,e){let t=e.getRegionAtLine(o);if(t!==null&&t.startLineNumber===o){if(o!==t.startLineNumber)return t.startLineNumber;{const i=t.parentIndex;let n=0;for(i!==-1&&(n=e.regions.getStartLineNumber(t.parentIndex));t!==null;)if(t.regionIndex>0){if(t=e.regions.toRegion(t.regionIndex-1),t.startLineNumber<=n)return null;if(t.parentIndex===i)return t.startLineNumber}else return null}}else if(e.regions.length>0)for(t=e.regions.toRegion(e.regions.length-1);t!==null;){if(t.startLineNumber<o)return t.startLineNumber;t.regionIndex>0?t=e.regions.toRegion(t.regionIndex-1):t=null}return null}function RN(o,e){let t=e.getRegionAtLine(o);if(t!==null&&t.startLineNumber===o){const i=t.parentIndex;let n=0;if(i!==-1)n=e.regions.getEndLineNumber(t.parentIndex);else{if(e.regions.length===0)return null;n=e.regions.getEndLineNumber(e.regions.length-1)}for(;t!==null;)if(t.regionIndex<e.regions.length){if(t=e.regions.toRegion(t.regionIndex+1),t.startLineNumber>=n)return null;if(t.parentIndex===i)return t.startLineNumber}else return null}else if(e.regions.length>0)for(t=e.regions.toRegion(0);t!==null;){if(t.startLineNumber>o)return t.startLineNumber;t.regionIndex<e.regions.length?t=e.regions.toRegion(t.regionIndex+1):t=null}return null}class NN{get onDidChange(){return this._updateEventEmitter.event}get hiddenRanges(){return this._hiddenRanges}constructor(e){this._updateEventEmitter=new rn,this._hasLineChanges=!1,this._foldingModel=e,this._foldingModelListener=e.onDidChange(t=>this.updateHiddenRanges()),this._hiddenRanges=[],e.regions.length&&this.updateHiddenRanges()}notifyChangeModelContent(e){this._hiddenRanges.length&&!this._hasLineChanges&&(this._hasLineChanges=e.changes.some(t=>t.range.endLineNumber!==t.range.startLineNumber||f4(t.text)[0]!==0))}updateHiddenRanges(){let e=!1;const t=[];let i=0,n=0,s=Number.MAX_VALUE,r=-1;const a=this._foldingModel.regions;for(;i<a.length;i++){if(!a.isCollapsed(i))continue;const d=a.getStartLineNumber(i)+1,u=a.getEndLineNumber(i);s<=d&&u<=r||(!e&&n<this._hiddenRanges.length&&this._hiddenRanges[n].startLineNumber===d&&this._hiddenRanges[n].endLineNumber===u?(t.push(this._hiddenRanges[n]),n++):(e=!0,t.push(new Q(d,1,u,1))),s=d,r=u)}(this._hasLineChanges||e||n<this._hiddenRanges.length)&&this.applyHiddenRanges(t)}applyHiddenRanges(e){this._hiddenRanges=e,this._hasLineChanges=!1,this._updateEventEmitter.fire(e)}hasRanges(){return this._hiddenRanges.length>0}isHidden(e){return lD(this._hiddenRanges,e)!==null}adjustSelections(e){let t=!1;const i=this._foldingModel.textModel;let n=null;const s=r=>((!n||!ON(r,n))&&(n=lD(this._hiddenRanges,r)),n?n.startLineNumber-1:null);for(let r=0,a=e.length;r<a;r++){let d=e[r];const u=s(d.startLineNumber);u&&(d=d.setStartPosition(u,i.getLineMaxColumn(u)),t=!0);const f=s(d.endLineNumber);f&&(d=d.setEndPosition(f,i.getLineMaxColumn(f)),t=!0),e[r]=d}return t}dispose(){this.hiddenRanges.length>0&&(this._hiddenRanges=[],this._updateEventEmitter.fire(this._hiddenRanges)),this._foldingModelListener&&(this._foldingModelListener.dispose(),this._foldingModelListener=null)}}function ON(o,e){return o>=e.startLineNumber&&o<=e.endLineNumber}function lD(o,e){const t=AA(o,i=>e<i.startLineNumber)-1;return t>=0&&o[t].endLineNumber>=e?o[t]:null}const HN=5e3,WN="indent";class j9{constructor(e,t,i){this.editorModel=e,this.languageConfigurationService=t,this.foldingRangesLimit=i,this.id=WN}dispose(){}compute(e){const t=this.languageConfigurationService.getLanguageConfiguration(this.editorModel.getLanguageId()).foldingRules,i=t&&!!t.offSide,n=t&&t.markers;return Promise.resolve(jN(this.editorModel,i,n,this.foldingRangesLimit))}}let zN=class{constructor(e){this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=e}insertFirst(e,t,i){if(e>Qr||t>Qr)return;const n=this._length;this._startIndexes[n]=e,this._endIndexes[n]=t,this._length++,i<1e3&&(this._indentOccurrences[i]=(this._indentOccurrences[i]||0)+1)}toIndentRanges(e){const t=this._foldingRangesLimit.limit;if(this._length<=t){this._foldingRangesLimit.update(this._length,!1);const i=new Uint32Array(this._length),n=new Uint32Array(this._length);for(let s=this._length-1,r=0;s>=0;s--,r++)i[r]=this._startIndexes[s],n[r]=this._endIndexes[s];return new Go(i,n)}else{this._foldingRangesLimit.update(this._length,t);let i=0,n=this._indentOccurrences.length;for(let d=0;d<this._indentOccurrences.length;d++){const u=this._indentOccurrences[d];if(u){if(u+i>t){n=d;break}i+=u}}const s=e.getOptions().tabSize,r=new Uint32Array(t),a=new Uint32Array(t);for(let d=this._length-1,u=0;d>=0;d--){const f=this._startIndexes[d],g=e.getLineContent(f),p=Lw(g,s);(p<n||p===n&&i++<t)&&(r[u]=f,a[u]=this._endIndexes[d],u++)}return new Go(r,a)}}};const VN={limit:HN,update:()=>{}};function jN(o,e,t,i=VN){const n=o.getOptions().tabSize,s=new zN(i);let r;t&&(r=new RegExp(`(${t.start.source})|(?:${t.end.source})`));const a=[],d=o.getLineCount()+1;a.push({indent:-1,endAbove:d,line:d});for(let u=o.getLineCount();u>0;u--){const f=o.getLineContent(u),g=Lw(f,n);let p=a[a.length-1];if(g===-1){e&&(p.endAbove=u);continue}let C;if(r&&(C=f.match(r)))if(C[1]){let b=a.length-1;for(;b>0&&a[b].indent!==-2;)b--;if(b>0){a.length=b+1,p=a[b],s.insertFirst(u,p.line,g),p.line=u,p.indent=g,p.endAbove=u;continue}}else{a.push({indent:-2,endAbove:u,line:u});continue}if(p.indent>g){do a.pop(),p=a[a.length-1];while(p.indent>g);const b=p.endAbove-1;b-u>=1&&s.insertFirst(u,b,g)}p.indent===g?p.endAbove=u:a.push({indent:g,endAbove:u,line:u})}return s.toIndentRanges(o)}const $N=vi("editor.foldBackground",{light:za(zS,.3),dark:za(zS,.3),hcDark:null,hcLight:null},S("foldBackgroundBackground","Background color behind folded ranges. The color must not be opaque so as not to hide underlying decorations."),!0);vi("editor.foldPlaceholderForeground",{light:"#808080",dark:"#808080",hcDark:null,hcLight:null},S("collapsedTextColor","Color of the collapsed text after the first line of a folded range."));vi("editorGutter.foldingControlForeground",g4,S("editorGutter.foldingControlForeground","Color of the folding control in the editor gutter."));const nv=ms("folding-expanded",Ki.chevronDown,S("foldingExpandedIcon","Icon for expanded ranges in the editor glyph margin.")),sv=ms("folding-collapsed",Ki.chevronRight,S("foldingCollapsedIcon","Icon for collapsed ranges in the editor glyph margin.")),cD=ms("folding-manual-collapsed",sv,S("foldingManualCollapedIcon","Icon for manually collapsed ranges in the editor glyph margin.")),dD=ms("folding-manual-expanded",nv,S("foldingManualExpandedIcon","Icon for manually expanded ranges in the editor glyph margin.")),SC={color:Fs($N),position:1},Dh=S("linesCollapsed","Click to expand the range."),Lx=S("linesExpanded","Click to collapse the range."),_s=class _s{constructor(e){this.editor=e,this.showFoldingControls="mouseover",this.showFoldingHighlights=!0}getDecorationOption(e,t,i){return t?_s.HIDDEN_RANGE_DECORATION:this.showFoldingControls==="never"?e?this.showFoldingHighlights?_s.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:_s.NO_CONTROLS_COLLAPSED_RANGE_DECORATION:_s.NO_CONTROLS_EXPANDED_RANGE_DECORATION:e?i?this.showFoldingHighlights?_s.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:_s.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?_s.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:_s.COLLAPSED_VISUAL_DECORATION:this.showFoldingControls==="mouseover"?i?_s.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:_s.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:i?_s.MANUALLY_EXPANDED_VISUAL_DECORATION:_s.EXPANDED_VISUAL_DECORATION}changeDecorations(e){return this.editor.changeDecorations(e)}removeDecorations(e){this.editor.removeDecorations(e)}};_s.COLLAPSED_VISUAL_DECORATION=vn.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:Dh,firstLineDecorationClassName:Rn.asClassName(sv)}),_s.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=vn.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:SC,isWholeLine:!0,linesDecorationsTooltip:Dh,firstLineDecorationClassName:Rn.asClassName(sv)}),_s.MANUALLY_COLLAPSED_VISUAL_DECORATION=vn.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:Dh,firstLineDecorationClassName:Rn.asClassName(cD)}),_s.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=vn.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:SC,isWholeLine:!0,linesDecorationsTooltip:Dh,firstLineDecorationClassName:Rn.asClassName(cD)}),_s.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=vn.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:Dh}),_s.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=vn.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:SC,isWholeLine:!0,linesDecorationsTooltip:Dh}),_s.EXPANDED_VISUAL_DECORATION=vn.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+Rn.asClassName(nv),linesDecorationsTooltip:Lx}),_s.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=vn.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:Rn.asClassName(nv),linesDecorationsTooltip:Lx}),_s.MANUALLY_EXPANDED_VISUAL_DECORATION=vn.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+Rn.asClassName(dD),linesDecorationsTooltip:Lx}),_s.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=vn.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:Rn.asClassName(dD),linesDecorationsTooltip:Lx}),_s.NO_CONTROLS_EXPANDED_RANGE_DECORATION=vn.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0}),_s.HIDDEN_RANGE_DECORATION=vn.register({description:"folding-hidden-range-decoration",stickiness:1});let FE=_s;const UN={},qN="syntax";class $9{constructor(e,t,i,n,s){this.editorModel=e,this.providers=t,this.handleFoldingRangesChange=i,this.foldingRangesLimit=n,this.fallbackRangeProvider=s,this.id=qN,this.disposables=new Tt,s&&this.disposables.add(s);for(const r of t)typeof r.onDidChange=="function"&&this.disposables.add(r.onDidChange(i))}compute(e){return GN(this.providers,this.editorModel,e).then(t=>{var i;return t?ZN(t,this.foldingRangesLimit):((i=this.fallbackRangeProvider)==null?void 0:i.compute(e))??null})}dispose(){this.disposables.dispose()}}function GN(o,e,t){let i=null;const n=o.map((s,r)=>Promise.resolve(s.provideFoldingRanges(e,UN,t)).then(a=>{if(!t.isCancellationRequested&&Array.isArray(a)){Array.isArray(i)||(i=[]);const d=e.getLineCount();for(const u of a)u.start>0&&u.end>u.start&&u.end<=d&&i.push({start:u.start,end:u.end,rank:r,kind:u.kind})}},bs));return Promise.all(n).then(s=>i)}class KN{constructor(e){this._startIndexes=[],this._endIndexes=[],this._nestingLevels=[],this._nestingLevelCounts=[],this._types=[],this._length=0,this._foldingRangesLimit=e}add(e,t,i,n){if(e>Qr||t>Qr)return;const s=this._length;this._startIndexes[s]=e,this._endIndexes[s]=t,this._nestingLevels[s]=n,this._types[s]=i,this._length++,n<30&&(this._nestingLevelCounts[n]=(this._nestingLevelCounts[n]||0)+1)}toIndentRanges(){const e=this._foldingRangesLimit.limit;if(this._length<=e){this._foldingRangesLimit.update(this._length,!1);const t=new Uint32Array(this._length),i=new Uint32Array(this._length);for(let n=0;n<this._length;n++)t[n]=this._startIndexes[n],i[n]=this._endIndexes[n];return new Go(t,i,this._types)}else{this._foldingRangesLimit.update(this._length,e);let t=0,i=this._nestingLevelCounts.length;for(let a=0;a<this._nestingLevelCounts.length;a++){const d=this._nestingLevelCounts[a];if(d){if(d+t>e){i=a;break}t+=d}}const n=new Uint32Array(e),s=new Uint32Array(e),r=[];for(let a=0,d=0;a<this._length;a++){const u=this._nestingLevels[a];(u<i||u===i&&t++<e)&&(n[d]=this._startIndexes[a],s[d]=this._endIndexes[a],r[d]=this._types[a],d++)}return new Go(n,s,r)}}}function ZN(o,e){const t=o.sort((r,a)=>{let d=r.start-a.start;return d===0&&(d=r.rank-a.rank),d}),i=new KN(e);let n;const s=[];for(const r of t)if(!n)n=r,i.add(r.start,r.end,r.kind&&r.kind.value,s.length);else if(r.start>n.start)if(r.end<=n.end)s.push(n),n=r,i.add(r.start,r.end,r.kind&&r.kind.value,s.length);else{if(r.start>n.end){do n=s.pop();while(n&&r.start>n.end);n&&s.push(n),n=r}i.add(r.start,r.end,r.kind&&r.kind.value,s.length)}return i.toIndentRanges()}var XN=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Of=function(o,e){return function(t,i){e(t,i,o)}},pd;const Qs=new En("foldingEnabled",!1);var ru;let jc=(ru=class extends Rt{static get(e){return e.getContribution(pd.ID)}static getFoldingRangeProviders(e,t){var n;const i=e.foldingRangeProvider.ordered(t);return((n=pd._foldingRangeSelector)==null?void 0:n.call(pd,i,t))??i}constructor(e,t,i,n,s,r){super(),this.contextKeyService=t,this.languageConfigurationService=i,this.languageFeaturesService=r,this.localToDispose=this._register(new Tt),this.editor=e,this._foldingLimitReporter=new fB(e);const a=this.editor.getOptions();this._isEnabled=a.get(43),this._useFoldingProviders=a.get(44)!=="indentation",this._unfoldOnClickAfterEndOfLine=a.get(48),this._restoringViewState=!1,this._currentModelHasFoldedImports=!1,this._foldingImportsByDefault=a.get(46),this.updateDebounceInfo=s.for(r.foldingRangeProvider,"Folding",{min:200}),this.foldingModel=null,this.hiddenRangeModel=null,this.rangeProvider=null,this.foldingRegionPromise=null,this.foldingModelPromise=null,this.updateScheduler=null,this.cursorChangedScheduler=null,this.mouseDownInfo=null,this.foldingDecorationProvider=new FE(e),this.foldingDecorationProvider.showFoldingControls=a.get(111),this.foldingDecorationProvider.showFoldingHighlights=a.get(45),this.foldingEnabled=Qs.bindTo(this.contextKeyService),this.foldingEnabled.set(this._isEnabled),this._register(this.editor.onDidChangeModel(()=>this.onModelChanged())),this._register(this.editor.onDidChangeConfiguration(d=>{if(d.hasChanged(43)&&(this._isEnabled=this.editor.getOptions().get(43),this.foldingEnabled.set(this._isEnabled),this.onModelChanged()),d.hasChanged(47)&&this.onModelChanged(),d.hasChanged(111)||d.hasChanged(45)){const u=this.editor.getOptions();this.foldingDecorationProvider.showFoldingControls=u.get(111),this.foldingDecorationProvider.showFoldingHighlights=u.get(45),this.triggerFoldingModelChanged()}d.hasChanged(44)&&(this._useFoldingProviders=this.editor.getOptions().get(44)!=="indentation",this.onFoldingStrategyChanged()),d.hasChanged(48)&&(this._unfoldOnClickAfterEndOfLine=this.editor.getOptions().get(48)),d.hasChanged(46)&&(this._foldingImportsByDefault=this.editor.getOptions().get(46))})),this.onModelChanged()}saveViewState(){const e=this.editor.getModel();if(!e||!this._isEnabled||e.isTooLargeForTokenization())return{};if(this.foldingModel){const t=this.foldingModel.getMemento(),i=this.rangeProvider?this.rangeProvider.id:void 0;return{collapsedRegions:t,lineCount:e.getLineCount(),provider:i,foldedImports:this._currentModelHasFoldedImports}}}restoreViewState(e){const t=this.editor.getModel();if(!(!t||!this._isEnabled||t.isTooLargeForTokenization()||!this.hiddenRangeModel)&&e&&(this._currentModelHasFoldedImports=!!e.foldedImports,e.collapsedRegions&&e.collapsedRegions.length>0&&this.foldingModel)){this._restoringViewState=!0;try{this.foldingModel.applyMemento(e.collapsedRegions)}finally{this._restoringViewState=!1}}}onModelChanged(){this.localToDispose.clear();const e=this.editor.getModel();!this._isEnabled||!e||e.isTooLargeForTokenization()||(this._currentModelHasFoldedImports=!1,this.foldingModel=new LN(e,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new NN(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange(t=>this.onHiddenRangesChanges(t))),this.updateScheduler=new Oc(this.updateDebounceInfo.get(e)),this.cursorChangedScheduler=new Ms(()=>this.revealCursor(),200),this.localToDispose.add(this.cursorChangedScheduler),this.localToDispose.add(this.languageFeaturesService.foldingRangeProvider.onDidChange(()=>this.onFoldingStrategyChanged())),this.localToDispose.add(this.editor.onDidChangeModelLanguageConfiguration(()=>this.onFoldingStrategyChanged())),this.localToDispose.add(this.editor.onDidChangeModelContent(t=>this.onDidChangeModelContent(t))),this.localToDispose.add(this.editor.onDidChangeCursorPosition(()=>this.onCursorPositionChanged())),this.localToDispose.add(this.editor.onMouseDown(t=>this.onEditorMouseDown(t))),this.localToDispose.add(this.editor.onMouseUp(t=>this.onEditorMouseUp(t))),this.localToDispose.add({dispose:()=>{var t,i;this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),(t=this.updateScheduler)==null||t.cancel(),this.updateScheduler=null,this.foldingModel=null,this.foldingModelPromise=null,this.hiddenRangeModel=null,this.cursorChangedScheduler=null,(i=this.rangeProvider)==null||i.dispose(),this.rangeProvider=null}}),this.triggerFoldingModelChanged())}onFoldingStrategyChanged(){var e;(e=this.rangeProvider)==null||e.dispose(),this.rangeProvider=null,this.triggerFoldingModelChanged()}getRangeProvider(e){if(this.rangeProvider)return this.rangeProvider;const t=new j9(e,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=t,this._useFoldingProviders&&this.foldingModel){const i=pd.getFoldingRangeProviders(this.languageFeaturesService,e);i.length>0&&(this.rangeProvider=new $9(e,i,()=>this.triggerFoldingModelChanged(),this._foldingLimitReporter,t))}return this.rangeProvider}getFoldingModel(){return this.foldingModelPromise}onDidChangeModelContent(e){var t;(t=this.hiddenRangeModel)==null||t.notifyChangeModelContent(e),this.triggerFoldingModelChanged()}triggerFoldingModelChanged(){this.updateScheduler&&(this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),this.foldingModelPromise=this.updateScheduler.trigger(()=>{const e=this.foldingModel;if(!e)return null;const t=new Oo,i=this.getRangeProvider(e.textModel),n=this.foldingRegionPromise=qs(s=>i.compute(s));return n.then(s=>{if(s&&n===this.foldingRegionPromise){let r;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){const u=s.setCollapsedAllOfType(Np.Imports.value,!0);u&&(r=T0.capture(this.editor),this._currentModelHasFoldedImports=u)}const a=this.editor.getSelections();e.update(s,YN(a)),r==null||r.restore(this.editor);const d=this.updateDebounceInfo.update(e.textModel,t.elapsed());this.updateScheduler&&(this.updateScheduler.defaultDelay=d)}return e})}).then(void 0,e=>(qn(e),null)))}onHiddenRangesChanges(e){if(this.hiddenRangeModel&&e.length&&!this._restoringViewState){const t=this.editor.getSelections();t&&this.hiddenRangeModel.adjustSelections(t)&&this.editor.setSelections(t)}this.editor.setHiddenAreas(e,this)}onCursorPositionChanged(){this.hiddenRangeModel&&this.hiddenRangeModel.hasRanges()&&this.cursorChangedScheduler.schedule()}revealCursor(){const e=this.getFoldingModel();e&&e.then(t=>{if(t){const i=this.editor.getSelections();if(i&&i.length>0){const n=[];for(const s of i){const r=s.selectionStartLineNumber;this.hiddenRangeModel&&this.hiddenRangeModel.isHidden(r)&&n.push(...t.getAllRegionsAtLine(r,a=>a.isCollapsed&&r>a.startLineNumber))}n.length&&(t.toggleCollapseState(n),this.reveal(i[0].getPosition()))}}}).then(void 0,qn)}onEditorMouseDown(e){if(this.mouseDownInfo=null,!this.hiddenRangeModel||!e.target||!e.target.range||!e.event.leftButton&&!e.event.middleButton)return;const t=e.target.range;let i=!1;switch(e.target.type){case 4:{const n=e.target.detail,s=e.target.element.offsetLeft;if(n.offsetX-s<4)return;i=!0;break}case 7:{if(this._unfoldOnClickAfterEndOfLine&&this.hiddenRangeModel.hasRanges()&&!e.target.detail.isAfterLines)break;return}case 6:{if(this.hiddenRangeModel.hasRanges()){const n=this.editor.getModel();if(n&&t.startColumn===n.getLineMaxColumn(t.startLineNumber))break}return}default:return}this.mouseDownInfo={lineNumber:t.startLineNumber,iconClicked:i}}onEditorMouseUp(e){const t=this.foldingModel;if(!t||!this.mouseDownInfo||!e.target)return;const i=this.mouseDownInfo.lineNumber,n=this.mouseDownInfo.iconClicked,s=e.target.range;if(!s||s.startLineNumber!==i)return;if(n){if(e.target.type!==4)return}else{const a=this.editor.getModel();if(!a||s.startColumn!==a.getLineMaxColumn(i))return}const r=t.getRegionAtLine(i);if(r&&r.startLineNumber===i){const a=r.isCollapsed;if(n||a){const d=e.event.altKey;let u=[];if(d){const f=p=>!p.containedBy(r)&&!r.containedBy(p),g=t.getRegionsInside(null,f);for(const p of g)p.isCollapsed&&u.push(p);u.length===0&&(u=g)}else{const f=e.event.middleButton||e.event.shiftKey;if(f)for(const g of t.getRegionsInside(r))g.isCollapsed===a&&u.push(g);(a||!f||u.length===0)&&u.push(r)}t.toggleCollapseState(u),this.reveal({lineNumber:i,column:1})}}}reveal(e){this.editor.revealPositionInCenterIfOutsideViewport(e,0)}},pd=ru,ru.ID="editor.contrib.folding",ru);jc=pd=XN([Of(1,Fn),Of(2,js),Of(3,mo),Of(4,gr),Of(5,Fi)],jc);class fB{constructor(e){this.editor=e,this._onDidChange=new rn,this._computed=0,this._limited=!1}get limit(){return this.editor.getOptions().get(47)}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}}class io extends Ct{runEditorCommand(e,t,i){const n=e.get(js),s=jc.get(t);if(!s)return;const r=s.getFoldingModel();if(r)return this.reportTelemetry(e,t),r.then(a=>{if(a){this.invoke(s,a,t,i,n);const d=t.getSelection();d&&s.reveal(d.getStartPosition())}})}getSelectedLines(e){const t=e.getSelections();return t?t.map(i=>i.startLineNumber):[]}getLineNumbers(e,t){return e&&e.selectionLines?e.selectionLines.map(i=>i+1):this.getSelectedLines(t)}run(e,t){}}function YN(o){return!o||o.length===0?{startsInside:()=>!1}:{startsInside(e,t){for(const i of o){const n=i.startLineNumber;if(n>=e&&n<=t)return!0}return!1}}}function gB(o){if(!$f(o)){if(!NA(o))return!1;const e=o;if(!$f(e.levels)&&!VS(e.levels)||!$f(e.direction)&&!cA(e.direction)||!$f(e.selectionLines)&&(!Array.isArray(e.selectionLines)||!e.selectionLines.every(VS)))return!1}return!0}class QN extends io{constructor(){super({id:"editor.unfold",label:S("unfoldAction.label","Unfold"),alias:"Unfold",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:3166,mac:{primary:2654},weight:100},metadata:{description:"Unfold the content in the editor",args:[{name:"Unfold editor argument",description:`Property-value pairs that can be passed through this argument:
23
+ * 'levels': Number of levels to unfold. If not set, defaults to 1.
24
+ * 'direction': If 'up', unfold given number of levels up otherwise unfolds down.
25
+ * 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the unfold action to. If not set, the active selection(s) will be used.
26
+ `,constraint:gB,schema:{type:"object",properties:{levels:{type:"number",default:1},direction:{type:"string",enum:["up","down"],default:"down"},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(e,t,i,n){const s=n&&n.levels||1,r=this.getLineNumbers(n,i);n&&n.direction==="up"?uB(t,!1,s,r):mf(t,!1,s,r)}}class JN extends io{constructor(){super({id:"editor.unfoldRecursively",label:S("unFoldRecursivelyAction.label","Unfold Recursively"),alias:"Unfold Recursively",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2142),weight:100}})}invoke(e,t,i,n){mf(t,!1,Number.MAX_VALUE,this.getSelectedLines(i))}}class eO extends io{constructor(){super({id:"editor.fold",label:S("foldAction.label","Fold"),alias:"Fold",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:3164,mac:{primary:2652},weight:100},metadata:{description:"Fold the content in the editor",args:[{name:"Fold editor argument",description:`Property-value pairs that can be passed through this argument:
27
+ * 'levels': Number of levels to fold.
28
+ * 'direction': If 'up', folds given number of levels up otherwise folds down.
29
+ * 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the fold action to. If not set, the active selection(s) will be used.
30
+ If no levels or direction is set, folds the region at the locations or if already collapsed, the first uncollapsed parent instead.
31
+ `,constraint:gB,schema:{type:"object",properties:{levels:{type:"number"},direction:{type:"string",enum:["up","down"]},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(e,t,i,n){const s=this.getLineNumbers(n,i),r=n&&n.levels,a=n&&n.direction;typeof r!="number"&&typeof a!="string"?IN(t,!0,s):a==="up"?uB(t,!0,r||1,s):mf(t,!0,r||1,s)}}class tO extends io{constructor(){super({id:"editor.toggleFold",label:S("toggleFoldAction.label","Toggle Fold"),alias:"Toggle Fold",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2090),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);W9(t,1,n)}}class iO extends io{constructor(){super({id:"editor.foldRecursively",label:S("foldRecursivelyAction.label","Fold Recursively"),alias:"Fold Recursively",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2140),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);mf(t,!0,Number.MAX_VALUE,n)}}class nO extends io{constructor(){super({id:"editor.toggleFoldRecursively",label:S("toggleFoldRecursivelyAction.label","Toggle Fold Recursively"),alias:"Toggle Fold Recursively",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,3114),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);W9(t,Number.MAX_VALUE,n)}}class sO extends io{constructor(){super({id:"editor.foldAllBlockComments",label:S("foldAllBlockComments.label","Fold All Block Comments"),alias:"Fold All Block Comments",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2138),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())V9(t,Np.Comment.value,!0);else{const r=i.getModel();if(!r)return;const a=s.getLanguageConfiguration(r.getLanguageId()).comments;if(a&&a.blockCommentStartToken){const d=new RegExp("^\\s*"+Lg(a.blockCommentStartToken));z9(t,d,!0)}}}}class oO extends io{constructor(){super({id:"editor.foldAllMarkerRegions",label:S("foldAllMarkerRegions.label","Fold All Regions"),alias:"Fold All Regions",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2077),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())V9(t,Np.Region.value,!0);else{const r=i.getModel();if(!r)return;const a=s.getLanguageConfiguration(r.getLanguageId()).foldingRules;if(a&&a.markers&&a.markers.start){const d=new RegExp(a.markers.start);z9(t,d,!0)}}}}class rO extends io{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:S("unfoldAllMarkerRegions.label","Unfold All Regions"),alias:"Unfold All Regions",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2078),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())V9(t,Np.Region.value,!1);else{const r=i.getModel();if(!r)return;const a=s.getLanguageConfiguration(r.getLanguageId()).foldingRules;if(a&&a.markers&&a.markers.start){const d=new RegExp(a.markers.start);z9(t,d,!1)}}}}class aO extends io{constructor(){super({id:"editor.foldAllExcept",label:S("foldAllExcept.label","Fold All Except Selected"),alias:"Fold All Except Selected",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2136),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);hB(t,!0,n)}}class lO extends io{constructor(){super({id:"editor.unfoldAllExcept",label:S("unfoldAllExcept.label","Unfold All Except Selected"),alias:"Unfold All Except Selected",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2134),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);hB(t,!1,n)}}class cO extends io{constructor(){super({id:"editor.foldAll",label:S("foldAllAction.label","Fold All"),alias:"Fold All",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2069),weight:100}})}invoke(e,t,i){mf(t,!0)}}class dO extends io{constructor(){super({id:"editor.unfoldAll",label:S("unfoldAllAction.label","Unfold All"),alias:"Unfold All",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2088),weight:100}})}invoke(e,t,i){mf(t,!1)}}const n0=class n0 extends io{getFoldingLevel(){return parseInt(this.id.substr(n0.ID_PREFIX.length))}invoke(e,t,i){PN(t,this.getFoldingLevel(),!0,this.getSelectedLines(i))}};n0.ID_PREFIX="editor.foldLevel",n0.ID=e=>n0.ID_PREFIX+e;let ov=n0;class uO extends io{constructor(){super({id:"editor.gotoParentFold",label:S("gotoParentFold.label","Go to Parent Fold"),alias:"Go to Parent Fold",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);if(n.length>0){const s=TN(n[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class hO extends io{constructor(){super({id:"editor.gotoPreviousFold",label:S("gotoPreviousFold.label","Go to Previous Folding Range"),alias:"Go to Previous Folding Range",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);if(n.length>0){const s=MN(n[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class fO extends io{constructor(){super({id:"editor.gotoNextFold",label:S("gotoNextFold.label","Go to Next Folding Range"),alias:"Go to Next Folding Range",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);if(n.length>0){const s=RN(n[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class gO extends io{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:S("createManualFoldRange.label","Create Folding Range from Selection"),alias:"Create Folding Range from Selection",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2135),weight:100}})}invoke(e,t,i){var r;const n=[],s=i.getSelections();if(s){for(const a of s){let d=a.endLineNumber;a.endColumn===1&&--d,d>a.startLineNumber&&(n.push({startLineNumber:a.startLineNumber,endLineNumber:d,type:void 0,isCollapsed:!0,source:1}),i.setSelection({startLineNumber:a.startLineNumber,startColumn:1,endLineNumber:a.startLineNumber,endColumn:1}))}if(n.length>0){n.sort((d,u)=>d.startLineNumber-u.startLineNumber);const a=Go.sanitizeAndMerge(t.regions,n,(r=i.getModel())==null?void 0:r.getLineCount());t.updatePost(Go.fromFoldRanges(a))}}}}class pO extends io{constructor(){super({id:"editor.removeManualFoldingRanges",label:S("removeManualFoldingRanges.label","Remove Manual Folding Ranges"),alias:"Remove Manual Folding Ranges",precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2137),weight:100}})}invoke(e,t,i){const n=i.getSelections();if(n){const s=[];for(const r of n){const{startLineNumber:a,endLineNumber:d}=r;s.push(d>=a?{startLineNumber:a,endLineNumber:d}:{endLineNumber:d,startLineNumber:a})}t.removeManualRanges(s),e.triggerFoldingModelChanged()}}}hn(jc.ID,jc,0);Le(QN);Le(JN);Le(eO);Le(iO);Le(nO);Le(cO);Le(dO);Le(sO);Le(oO);Le(rO);Le(aO);Le(lO);Le(tO);Le(uO);Le(hO);Le(fO);Le(gO);Le(pO);for(let o=1;o<=7;o++)p4(new ov({id:ov.ID(o),label:S("foldLevelAction.label","Fold Level {0}",o),alias:`Fold Level ${o}`,precondition:Qs,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2048|21+o),weight:100}}));Qn.registerCommand("_executeFoldingRangeProvider",async function(o,...e){const[t]=e;if(!(t instanceof jn))throw vl();const i=o.get(Fi),n=o.get(vo).getModel(t);if(!n)throw vl();const s=o.get(ss);if(!s.getValue("editor.folding",{resource:t}))return[];const r=o.get(js),a=s.getValue("editor.foldingStrategy",{resource:t}),d={get limit(){return s.getValue("editor.foldingMaximumRegions",{resource:t})},update:(C,b)=>{}},u=new j9(n,r,d);let f=u;if(a!=="indentation"){const C=jc.getFoldingRangeProviders(i,n);C.length&&(f=new $9(n,C,()=>{},d,u))}const g=await f.compute(an.None),p=[];try{if(g)for(let C=0;C<g.length;C++){const b=g.getType(C);p.push({start:g.getStartLineNumber(C),end:g.getEndLineNumber(C),kind:b?Np.fromValue(b):void 0})}return p}finally{f.dispose()}});class xO extends Ct{constructor(){super({id:"editor.action.fontZoomIn",label:S("EditorFontZoomIn.label","Increase Editor Font Size"),alias:"Increase Editor Font Size",precondition:void 0})}run(e,t){Ng.setZoomLevel(Ng.getZoomLevel()+1)}}class mO extends Ct{constructor(){super({id:"editor.action.fontZoomOut",label:S("EditorFontZoomOut.label","Decrease Editor Font Size"),alias:"Decrease Editor Font Size",precondition:void 0})}run(e,t){Ng.setZoomLevel(Ng.getZoomLevel()-1)}}class vO extends Ct{constructor(){super({id:"editor.action.fontZoomReset",label:S("EditorFontZoomReset.label","Reset Editor Font Size"),alias:"Reset Editor Font Size",precondition:void 0})}run(e,t){Ng.setZoomLevel(0)}}Le(xO);Le(mO);Le(vO);var pB=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},xg=function(o,e){return function(t,i){e(t,i,o)}},E0;let rv=(E0=class{constructor(e,t,i,n){this._editor=e,this._languageFeaturesService=t,this._workerService=i,this._accessibilitySignalService=n,this._disposables=new Tt,this._sessionDisposables=new Tt,this._disposables.add(t.onTypeFormattingEditProvider.onDidChange(this._update,this)),this._disposables.add(e.onDidChangeModel(()=>this._update())),this._disposables.add(e.onDidChangeModelLanguage(()=>this._update())),this._disposables.add(e.onDidChangeConfiguration(s=>{s.hasChanged(56)&&this._update()})),this._update()}dispose(){this._disposables.dispose(),this._sessionDisposables.dispose()}_update(){if(this._sessionDisposables.clear(),!this._editor.getOption(56)||!this._editor.hasModel())return;const e=this._editor.getModel(),[t]=this._languageFeaturesService.onTypeFormattingEditProvider.ordered(e);if(!t||!t.autoFormatTriggerCharacters)return;const i=new Am;for(const n of t.autoFormatTriggerCharacters)i.add(n.charCodeAt(0));this._sessionDisposables.add(this._editor.onDidType(n=>{const s=n.charCodeAt(n.length-1);i.has(s)&&this._trigger(String.fromCharCode(s))}))}_trigger(e){if(!this._editor.hasModel()||this._editor.getSelections().length>1||!this._editor.getSelection().isEmpty())return;const t=this._editor.getModel(),i=this._editor.getPosition(),n=new Gs,s=this._editor.onDidChangeModelContent(r=>{if(r.isFlush){n.cancel(),s.dispose();return}for(let a=0,d=r.changes.length;a<d;a++)if(r.changes[a].range.endLineNumber<=i.lineNumber){n.cancel(),s.dispose();return}});x4(this._workerService,this._languageFeaturesService,t,i,e,t.getFormattingOptions(),n.token).then(r=>{n.token.isCancellationRequested||Yo(r)&&(this._accessibilitySignalService.playSignal(HA.format,{userGesture:!1}),m4.execute(this._editor,r,!0))}).finally(()=>{s.dispose()})}},E0.ID="editor.contrib.autoFormat",E0);rv=pB([xg(1,Fi),xg(2,Nl),xg(3,OA)],rv);var y0;let av=(y0=class{constructor(e,t,i){this.editor=e,this._languageFeaturesService=t,this._instantiationService=i,this._callOnDispose=new Tt,this._callOnModel=new Tt,this._callOnDispose.add(e.onDidChangeConfiguration(()=>this._update())),this._callOnDispose.add(e.onDidChangeModel(()=>this._update())),this._callOnDispose.add(e.onDidChangeModelLanguage(()=>this._update())),this._callOnDispose.add(t.documentRangeFormattingEditProvider.onDidChange(this._update,this))}dispose(){this._callOnDispose.dispose(),this._callOnModel.dispose()}_update(){this._callOnModel.clear(),this.editor.getOption(55)&&this.editor.hasModel()&&this._languageFeaturesService.documentRangeFormattingEditProvider.has(this.editor.getModel())&&this._callOnModel.add(this.editor.onDidPaste(({range:e})=>this._trigger(e)))}_trigger(e){this.editor.hasModel()&&(this.editor.getSelections().length>1||this._instantiationService.invokeFunction(WA,this.editor,e,2,fl.None,an.None,!1).catch(qn))}},y0.ID="editor.contrib.formatOnPaste",y0);av=pB([xg(1,Fi),xg(2,sn)],av);class _O extends Ct{constructor(){super({id:"editor.action.formatDocument",label:S("formatDocument.label","Format Document"),alias:"Format Document",precondition:qe.and(q.notInCompositeEditor,q.writable,q.hasDocumentFormattingProvider),kbOpts:{kbExpr:q.editorTextFocus,primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:"1_modification",order:1.3}})}async run(e,t){if(t.hasModel()){const i=e.get(sn);await e.get(Ap).showWhile(i.invokeFunction(v4,t,1,fl.None,an.None,!0),250)}}}class bO extends Ct{constructor(){super({id:"editor.action.formatSelection",label:S("formatSelection.label","Format Selection"),alias:"Format Selection",precondition:qe.and(q.writable,q.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2084),weight:100},contextMenuOpts:{when:q.hasNonEmptySelection,group:"1_modification",order:1.31}})}async run(e,t){if(!t.hasModel())return;const i=e.get(sn),n=t.getModel(),s=t.getSelections().map(a=>a.isEmpty()?new Q(a.startLineNumber,1,a.startLineNumber,n.getLineMaxColumn(a.startLineNumber)):a);await e.get(Ap).showWhile(i.invokeFunction(WA,t,s,1,fl.None,an.None,!0),250)}}hn(rv.ID,rv,2);hn(av.ID,av,2);Le(_O);Le(bO);Qn.registerCommand("editor.action.format",async o=>{const e=o.get(Cs).getFocusedCodeEditor();if(!e||!e.hasModel())return;const t=o.get(Vs);e.getSelection().isEmpty()?await t.executeCommand("editor.action.formatDocument"):await t.executeCommand("editor.action.formatSelection")});var CO=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},DC=function(o,e){return function(t,i){e(t,i,o)}};class Zh{remove(){var e;(e=this.parent)==null||e.children.delete(this.id)}static findId(e,t){let i;typeof e=="string"?i=`${t.id}/${e}`:(i=`${t.id}/${e.name}`,t.children.get(i)!==void 0&&(i=`${t.id}/${e.name}_${e.range.startLineNumber}_${e.range.startColumn}`));let n=i;for(let s=0;t.children.get(n)!==void 0;s++)n=`${i}_${s}`;return n}static empty(e){return e.children.size===0}}class LE extends Zh{constructor(e,t,i){super(),this.id=e,this.parent=t,this.symbol=i,this.children=new Map}}class xB extends Zh{constructor(e,t,i,n){super(),this.id=e,this.parent=t,this.label=i,this.order=n,this.children=new Map}}class rl extends Zh{static create(e,t,i){const n=new Gs(i),s=new rl(t.uri),r=e.ordered(t),a=r.map((u,f)=>{const g=Zh.findId(`provider_${f}`,s),p=new xB(g,s,u.displayName??"Unknown Outline Provider",f);return Promise.resolve(u.provideDocumentSymbols(t,n.token)).then(C=>{for(const b of C||[])rl._makeOutlineElement(b,p);return p},C=>(bs(C),p)).then(C=>{Zh.empty(C)?C.remove():s._groups.set(g,C)})}),d=e.onDidChange(()=>{const u=e.ordered(t);ja(u,r)||n.cancel()});return Promise.all(a).then(()=>n.token.isCancellationRequested&&!i.isCancellationRequested?rl.create(e,t,i):s._compact()).finally(()=>{n.dispose(),d.dispose(),n.dispose()})}static _makeOutlineElement(e,t){const i=Zh.findId(e,t),n=new LE(i,t,e);if(e.children)for(const s of e.children)rl._makeOutlineElement(s,n);t.children.set(n.id,n)}constructor(e){super(),this.uri=e,this.id="root",this.parent=void 0,this._groups=new Map,this.children=new Map,this.id="root",this.parent=void 0}_compact(){let e=0;for(const[t,i]of this._groups)i.children.size===0?this._groups.delete(t):e+=1;if(e!==1)this.children=this._groups;else{const t=ml.first(this._groups.values());for(const[,i]of t.children)i.parent=this,this.children.set(i.id,i)}return this}getTopLevelSymbols(){const e=[];for(const t of this.children.values())t instanceof LE?e.push(t.symbol):e.push(...ml.map(t.children.values(),i=>i.symbol));return e.sort((t,i)=>Q.compareRangesUsingStarts(t.range,i.range))}asListOfDocumentSymbols(){const e=this.getTopLevelSymbols(),t=[];return rl._flattenDocumentSymbols(t,e,""),t.sort((i,n)=>Bi.compare(Q.getStartPosition(i.range),Q.getStartPosition(n.range))||Bi.compare(Q.getEndPosition(n.range),Q.getEndPosition(i.range)))}static _flattenDocumentSymbols(e,t,i){for(const n of t)e.push({kind:n.kind,tags:n.tags,name:n.name,detail:n.detail,containerName:n.containerName||i,range:n.range,selectionRange:n.selectionRange,children:void 0}),n.children&&rl._flattenDocumentSymbols(e,n.children,n.name)}}const Qp=Ml("IOutlineModelService");let IE=class{constructor(e,t,i){this._languageFeaturesService=e,this._disposables=new Tt,this._cache=new Bp(10,.7),this._debounceInformation=t.for(e.documentSymbolProvider,"DocumentSymbols",{min:350}),this._disposables.add(i.onModelRemoved(n=>{this._cache.delete(n.id)}))}dispose(){this._disposables.dispose()}async getOrCreate(e,t){const i=this._languageFeaturesService.documentSymbolProvider,n=i.ordered(e);let s=this._cache.get(e.id);if(!s||s.versionId!==e.getVersionId()||!ja(s.provider,n)){const a=new Gs;s={versionId:e.getVersionId(),provider:n,promiseCnt:0,source:a,promise:rl.create(i,e,a.token),model:void 0},this._cache.set(e.id,s);const d=Date.now();s.promise.then(u=>{s.model=u,this._debounceInformation.update(e,Date.now()-d)}).catch(u=>{this._cache.delete(e.id)})}if(s.model)return s.model;s.promiseCnt+=1;const r=t.onCancellationRequested(()=>{--s.promiseCnt===0&&(s.source.cancel(),this._cache.delete(e.id))});try{return await s.promise}finally{r.dispose()}}};IE=CO([DC(0,Fi),DC(1,gr),DC(2,vo)],IE);Rl(Qp,IE,1);Qn.registerCommand("_executeDocumentSymbolProvider",async function(o,...e){const[t]=e;Pn(jn.isUri(t));const i=o.get(Qp),s=await o.get(fa).createModelReference(t);try{return(await i.getOrCreate(s.object.textEditorModel,an.None)).getTopLevelSymbols()}finally{s.dispose()}});const Sa=class Sa extends Rt{constructor(e,t){super(),this.contextKeyService=e,this.model=t,this.inlineCompletionVisible=Sa.inlineSuggestionVisible.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentation=Sa.inlineSuggestionHasIndentation.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentationLessThanTabSize=Sa.inlineSuggestionHasIndentationLessThanTabSize.bindTo(this.contextKeyService),this.suppressSuggestions=Sa.suppressSuggestions.bindTo(this.contextKeyService),this._register(rs(i=>{const n=this.model.read(i),s=n==null?void 0:n.state.read(i),r=!!(s!=null&&s.inlineCompletion)&&(s==null?void 0:s.primaryGhostText)!==void 0&&!(s!=null&&s.primaryGhostText.isEmpty());this.inlineCompletionVisible.set(r),s!=null&&s.primaryGhostText&&(s!=null&&s.inlineCompletion)&&this.suppressSuggestions.set(s.inlineCompletion.inlineCompletion.source.inlineCompletions.suppressSuggestions)})),this._register(rs(i=>{const n=this.model.read(i);let s=!1,r=!0;const a=n==null?void 0:n.primaryGhostText.read(i);if(n!=null&&n.selectedSuggestItem&&a&&a.parts.length>0){const{column:d,lines:u}=a.parts[0],f=u[0],g=n.textModel.getLineIndentColumn(a.lineNumber);if(d<=g){let C=n1(f);C===-1&&(C=f.length-1),s=C>0;const b=n.textModel.getOptions().tabSize;r=_4.visibleColumnFromColumn(f,C+1,b)<b}}this.inlineCompletionSuggestsIndentation.set(s),this.inlineCompletionSuggestsIndentationLessThanTabSize.set(r)}))}};Sa.inlineSuggestionVisible=new En("inlineSuggestionVisible",!1,S("inlineSuggestionVisible","Whether an inline suggestion is visible")),Sa.inlineSuggestionHasIndentation=new En("inlineSuggestionHasIndentation",!1,S("inlineSuggestionHasIndentation","Whether the inline suggestion starts with whitespace")),Sa.inlineSuggestionHasIndentationLessThanTabSize=new En("inlineSuggestionHasIndentationLessThanTabSize",!0,S("inlineSuggestionHasIndentationLessThanTabSize","Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab")),Sa.suppressSuggestions=new En("inlineSuggestionSuppressSuggestions",void 0,S("suppressSuggestions","Whether suggestions should be suppressed for the current suggestion"));let No=Sa;function EO(o){const e=new Tt,t=e.add(zA());return e.add(rs(i=>{t.setStyle(o.read(i))})),e}class Qg{constructor(e,t){this.lineNumber=e,this.parts=t}equals(e){return this.lineNumber===e.lineNumber&&this.parts.length===e.parts.length&&this.parts.every((t,i)=>t.equals(e.parts[i]))}renderForScreenReader(e){if(this.parts.length===0)return"";const t=this.parts[this.parts.length-1],i=e.substr(0,t.column-1);return new VA([...this.parts.map(s=>new Dl(Q.fromPositions(new Bi(1,s.column)),s.lines.join(`
32
+ `)))]).applyToString(i).substring(this.parts[0].column-1)}isEmpty(){return this.parts.every(e=>e.lines.length===0)}get lineCount(){return 1+this.parts.reduce((e,t)=>e+t.lines.length-1,0)}}class lv{constructor(e,t,i){this.column=e,this.text=t,this.preview=i,this.lines=Q_(this.text)}equals(e){return this.column===e.column&&this.lines.length===e.lines.length&&this.lines.every((t,i)=>t===e.lines[i])}}class PE{constructor(e,t,i,n=0){this.lineNumber=e,this.columnRange=t,this.text=i,this.additionalReservedLineCount=n,this.parts=[new lv(this.columnRange.endColumnExclusive,this.text,!1)],this.newLines=Q_(this.text)}renderForScreenReader(e){return this.newLines.join(`
33
+ `)}get lineCount(){return this.newLines.length}isEmpty(){return this.parts.every(e=>e.lines.length===0)}equals(e){return this.lineNumber===e.lineNumber&&this.columnRange.equals(e.columnRange)&&this.newLines.length===e.newLines.length&&this.newLines.every((t,i)=>t===e.newLines[i])&&this.additionalReservedLineCount===e.additionalReservedLineCount}}function uD(o,e){return ja(o,e,mB)}function mB(o,e){return o===e?!0:!o||!e?!1:o instanceof Qg&&e instanceof Qg||o instanceof PE&&e instanceof PE?o.equals(e):!1}const yO=[];function wO(){return yO}class vB{constructor(e,t){if(this.startColumn=e,this.endColumnExclusive=t,e>t)throw new O0(`startColumn ${e} cannot be after endColumnExclusive ${t}`)}toRange(e){return new Q(e,this.startColumn,e,this.endColumnExclusive)}equals(e){return this.startColumn===e.startColumn&&this.endColumnExclusive===e.endColumnExclusive}}function _B(o,e){const t=new Tt,i=o.createDecorationsCollection();return t.add(b4({debugName:()=>`Apply decorations from ${e.debugName}`},n=>{const s=e.read(n);i.set(s)})),t.add({dispose:()=>{i.clear()}}),t}function SO(o,e){return new Bi(o.lineNumber+e.lineNumber-1,e.lineNumber===1?o.column+e.column-1:e.column)}function hD(o,e){return new Bi(o.lineNumber-e.lineNumber+1,o.lineNumber-e.lineNumber===0?o.column-e.column+1:o.column)}var DO=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},AO=function(o,e){return function(t,i){e(t,i,o)}};const fD="ghost-text";let TE=class extends Rt{constructor(e,t,i){super(),this.editor=e,this.model=t,this.languageService=i,this.isDisposed=Qo(this,!1),this.currentTextModel=Io(this,this.editor.onDidChangeModel,()=>this.editor.getModel()),this.uiState=Wn(this,n=>{if(this.isDisposed.read(n))return;const s=this.currentTextModel.read(n);if(s!==this.model.targetTextModel.read(n))return;const r=this.model.ghostText.read(n);if(!r)return;const a=r instanceof PE?r.columnRange:void 0,d=[],u=[];function f(y,w){if(u.length>0){const A=u[u.length-1];w&&A.decorations.push(new Og(A.content.length+1,A.content.length+1+y[0].length,w,0)),A.content+=y[0],y=y.slice(1)}for(const A of y)u.push({content:A,decorations:w?[new Og(1,A.length+1,w,0)]:[]})}const g=s.getLineContent(r.lineNumber);let p,C=0;for(const y of r.parts){let w=y.lines;p===void 0?(d.push({column:y.column,text:w[0],preview:y.preview}),w=w.slice(1)):f([g.substring(C,y.column-1)],void 0),w.length>0&&(f(w,fD),p===void 0&&y.column<=g.length&&(p=y.column)),C=y.column-1}p!==void 0&&f([g.substring(C)],void 0);const b=p!==void 0?new vB(p,g.length+1):void 0;return{replacedRange:a,inlineTexts:d,additionalLines:u,hiddenRange:b,lineNumber:r.lineNumber,additionalReservedLineCount:this.model.minReservedLineCount.read(n),targetTextModel:s}}),this.decorations=Wn(this,n=>{const s=this.uiState.read(n);if(!s)return[];const r=[];s.replacedRange&&r.push({range:s.replacedRange.toRange(s.lineNumber),options:{inlineClassName:"inline-completion-text-to-replace",description:"GhostTextReplacement"}}),s.hiddenRange&&r.push({range:s.hiddenRange.toRange(s.lineNumber),options:{inlineClassName:"ghost-text-hidden",description:"ghost-text-hidden"}});for(const a of s.inlineTexts)r.push({range:Q.fromPositions(new Bi(s.lineNumber,a.column)),options:{description:fD,after:{content:a.text,inlineClassName:a.preview?"ghost-text-decoration-preview":"ghost-text-decoration",cursorStops:jh.Left},showIfCollapsed:!0}});return r}),this.additionalLinesWidget=this._register(new kO(this.editor,this.languageService.languageIdCodec,Wn(n=>{const s=this.uiState.read(n);return s?{lineNumber:s.lineNumber,additionalLines:s.additionalLines,minReservedLineCount:s.additionalReservedLineCount,targetTextModel:s.targetTextModel}:void 0}))),this._register(is(()=>{this.isDisposed.set(!0,void 0)})),this._register(_B(this.editor,this.decorations))}ownsViewZone(e){return this.additionalLinesWidget.viewZoneId===e}};TE=DO([AO(2,ha)],TE);class kO extends Rt{get viewZoneId(){return this._viewZoneId}constructor(e,t,i){super(),this.editor=e,this.languageIdCodec=t,this.lines=i,this._viewZoneId=void 0,this.editorOptionsChanged=Pd("editorOptionChanged",Ts.filter(this.editor.onDidChangeConfiguration,n=>n.hasChanged(33)||n.hasChanged(118)||n.hasChanged(100)||n.hasChanged(95)||n.hasChanged(51)||n.hasChanged(50)||n.hasChanged(67))),this._register(rs(n=>{const s=this.lines.read(n);this.editorOptionsChanged.read(n),s?this.updateLines(s.lineNumber,s.additionalLines,s.minReservedLineCount):this.clear()}))}dispose(){super.dispose(),this.clear()}clear(){this.editor.changeViewZones(e=>{this._viewZoneId&&(e.removeZone(this._viewZoneId),this._viewZoneId=void 0)})}updateLines(e,t,i){const n=this.editor.getModel();if(!n)return;const{tabSize:s}=n.getOptions();this.editor.changeViewZones(r=>{this._viewZoneId&&(r.removeZone(this._viewZoneId),this._viewZoneId=void 0);const a=Math.max(t.length,i);if(a>0){const d=document.createElement("div");BO(d,s,t,this.editor.getOptions(),this.languageIdCodec),this._viewZoneId=r.addZone({afterLineNumber:e,heightInLines:a,domNode:d,afterColumnAffinity:1})}})}}function BO(o,e,t,i,n){const s=i.get(33),r=i.get(118),a="none",d=i.get(95),u=i.get(51),f=i.get(50),g=i.get(67),p=new $A(1e4);p.appendString('<div class="suggest-preview-text">');for(let y=0,w=t.length;y<w;y++){const A=t[y],I=A.content;p.appendString('<div class="view-line'),p.appendString('" style="top:'),p.appendString(String(y*g)),p.appendString('px;width:1000000px;">');const T=KA(I),R=C4(I),P=E4.createEmpty(I,n);UA(new qA(f.isMonospace&&!s,f.canUseHalfwidthRightwardsArrow,I,!1,T,R,0,P,A.decorations,e,0,f.spaceWidth,f.middotWidth,f.wsmiddotWidth,r,a,d,u!==y4.OFF,null),p),p.appendString("</div>")}p.appendString("</div>"),GA(o,f);const C=p.build(),b=gD?gD.createHTML(C):C;o.innerHTML=b}const gD=jA("editorGhostText",{createHTML:o=>o});function FO(o,e){const t=new A4,i=new S4(t,u=>e.getLanguageConfiguration(u)),n=new w4(new LO([o]),i),s=D4(n,[],void 0,!0);let r="";const a=o.getLineContent();function d(u,f){if(u.kind===2)if(d(u.openingBracket,f),f=Pf(f,u.openingBracket.length),u.child&&(d(u.child,f),f=Pf(f,u.child.length)),u.closingBracket)d(u.closingBracket,f),f=Pf(f,u.closingBracket.length);else{const p=i.getSingleLanguageBracketTokens(u.openingBracket.languageId).findClosingTokenText(u.openingBracket.bracketIds);r+=p}else if(u.kind!==3){if(u.kind===0||u.kind===1)r+=a.substring(jS(f),jS(Pf(f,u.length)));else if(u.kind===4)for(const g of u.children)d(g,f),f=Pf(f,g.length)}}return d(s,k4),r}class LO{constructor(e){this.lines=e,this.tokenization={getLineTokens:t=>this.lines[t-1]}}getLineCount(){return this.lines.length}getLineLength(e){return this.lines[e-1].getLineContent().length}}async function bB(o,e,t,i,n=an.None,s){const r=e instanceof Bi?TO(e,t):e,a=o.all(t),d=new B4;for(const A of a)A.groupId&&d.add(A.groupId,A);function u(A){if(!A.yieldsToGroupIds)return[];const I=[];for(const T of A.yieldsToGroupIds||[]){const R=d.get(T);for(const P of R)I.push(P)}return I}const f=new Map,g=new Set;function p(A,I){if(I=[...I,A],g.has(A))return I;g.add(A);try{const T=u(A);for(const R of T){const P=p(R,I);if(P)return P}}finally{g.delete(A)}}function C(A){const I=f.get(A);if(I)return I;const T=p(A,[]);T&&bs(new Error(`Inline completions: cyclic yield-to dependency detected. Path: ${T.map(P=>P.toString?P.toString():""+P).join(" -> ")}`));const R=new z_;return f.set(A,R.p),(async()=>{var P;if(!T){const V=u(A);for(const j of V){const J=await C(j);if(J&&J.items.length>0)return}}try{return e instanceof Bi?await A.provideInlineCompletions(t,e,i,n):await((P=A.provideInlineEdits)==null?void 0:P.call(A,t,e,i,n))}catch(V){bs(V);return}})().then(P=>R.complete(P),P=>R.error(P)),R.p}const b=await Promise.all(a.map(async A=>({provider:A,completions:await C(A)}))),y=new Map,w=[];for(const A of b){const I=A.completions;if(!I)continue;const T=new PO(I,A.provider);w.push(T);for(const R of I.items){const P=cv.from(R,T,r,t,s);y.set(P.hash(),P)}}return new IO(Array.from(y.values()),new Set(y.keys()),w)}class IO{constructor(e,t,i){this.completions=e,this.hashs=t,this.providerResults=i}has(e){return this.hashs.has(e.hash())}dispose(){for(const e of this.providerResults)e.removeRef()}}class PO{constructor(e,t){this.inlineCompletions=e,this.provider=t,this.refCount=1}addRef(){this.refCount++}removeRef(){this.refCount--,this.refCount===0&&this.provider.freeInlineCompletions(this.inlineCompletions)}}class cv{static from(e,t,i,n,s){let r,a,d=e.range?Q.lift(e.range):i;if(typeof e.insertText=="string"){if(r=e.insertText,s&&e.completeBracketPairs){r=pD(r,d.getStartPosition(),n,s);const u=r.length-e.insertText.length;u!==0&&(d=new Q(d.startLineNumber,d.startColumn,d.endLineNumber,d.endColumn+u))}a=void 0}else if("snippet"in e.insertText){const u=e.insertText.snippet.length;if(s&&e.completeBracketPairs){e.insertText.snippet=pD(e.insertText.snippet,d.getStartPosition(),n,s);const g=e.insertText.snippet.length-u;g!==0&&(d=new Q(d.startLineNumber,d.startColumn,d.endLineNumber,d.endColumn+g))}const f=new Nu().parse(e.insertText.snippet);f.children.length===1&&f.children[0]instanceof Po?(r=f.children[0].value,a=void 0):(r=f.toString(),a={snippet:e.insertText.snippet,range:d})}else F4(e.insertText);return new cv(r,e.command,d,r,a,e.additionalTextEdits||wO(),e,t)}constructor(e,t,i,n,s,r,a,d){this.filterText=e,this.command=t,this.range=i,this.insertText=n,this.snippetInfo=s,this.additionalTextEdits=r,this.sourceInlineCompletion=a,this.source=d,e=e.replace(/\r\n|\r/g,`
34
+ `),n=e.replace(/\r\n|\r/g,`
35
+ `)}withRange(e){return new cv(this.filterText,this.command,e,this.insertText,this.snippetInfo,this.additionalTextEdits,this.sourceInlineCompletion,this.source)}hash(){return JSON.stringify({insertText:this.insertText,range:this.range.toString()})}toSingleTextEdit(){return new Dl(this.range,this.insertText)}}function TO(o,e){const t=e.getWordAtPosition(o),i=e.getLineMaxColumn(o.lineNumber);return t?new Q(o.lineNumber,t.startColumn,o.lineNumber,i):Q.fromPositions(o,o.with(void 0,i))}function pD(o,e,t,i){const s=t.getLineContent(e.lineNumber).substring(0,e.column-1)+o,r=t.tokenization.tokenizeLineWithEdit(e,s.length-(e.column-1),o),a=r==null?void 0:r.sliceAndInflate(e.column-1,s.length,0);return a?FO(a,i):o}function Wd(o,e,t){const i=t?o.range.intersectRanges(t):o.range;if(!i)return o;const n=e.getValueInRange(i,1),s=Rp(n,o.text),r=km.ofText(n.substring(0,s)).addToPosition(o.range.getStartPosition()),a=o.text.substring(s),d=Q.fromPositions(r,o.range.getEndPosition());return new Dl(d,a)}function CB(o,e){return o.text.startsWith(e.text)&&MO(o.range,e.range)}function xD(o,e,t,i,n=0){let s=Wd(o,e);if(s.range.endLineNumber!==s.range.startLineNumber)return;const r=e.getLineContent(s.range.startLineNumber),a=eo(r).length;if(s.range.startColumn-1<=a){const b=eo(s.text).length,y=r.substring(s.range.startColumn-1,a),[w,A]=[s.range.getStartPosition(),s.range.getEndPosition()],I=w.column+y.length<=A.column?w.delta(0,y.length):A,T=Q.fromPositions(I,A),R=s.text.startsWith(y)?s.text.substring(y.length):s.text.substring(b);s=new Dl(T,R)}const u=e.getValueInRange(s.range),f=RO(u,s.text);if(!f)return;const g=s.range.startLineNumber,p=new Array;if(t==="prefix"){const b=f.filter(y=>y.originalLength===0);if(b.length>1||b.length===1&&b[0].originalStart!==u.length)return}const C=s.text.length-n;for(const b of f){const y=s.range.startColumn+b.originalStart+b.originalLength;if(t==="subwordSmart"&&i&&i.lineNumber===s.range.startLineNumber&&y<i.column||b.originalLength>0)return;if(b.modifiedLength===0)continue;const w=b.modifiedStart+b.modifiedLength,A=Math.max(b.modifiedStart,Math.min(w,C)),I=s.text.substring(b.modifiedStart,A),T=s.text.substring(A,Math.max(b.modifiedStart,w));I.length>0&&p.push(new lv(y,I,!1)),T.length>0&&p.push(new lv(y,T,!0))}return new Qg(g,p)}function MO(o,e){return e.getStartPosition().equals(o.getStartPosition())&&e.getEndPosition().isBeforeOrEqual(o.getEndPosition())}let ba;function RO(o,e){if((ba==null?void 0:ba.originalValue)===o&&(ba==null?void 0:ba.newValue)===e)return ba==null?void 0:ba.changes;{let t=vD(o,e,!0);if(t){const i=mD(t);if(i>0){const n=vD(o,e,!1);n&&mD(n)<i&&(t=n)}}return ba={originalValue:o,newValue:e,changes:t},t}}function mD(o){let e=0;for(const t of o)e+=t.originalLength;return e}function vD(o,e,t){if(o.length>5e3||e.length>5e3)return;function i(u){let f=0;for(let g=0,p=u.length;g<p;g++){const C=u.charCodeAt(g);C>f&&(f=C)}return f}const n=Math.max(i(o),i(e));function s(u){if(u<0)throw new Error("unexpected");return n+u+1}function r(u){let f=0,g=0;const p=new Int32Array(u.length);for(let C=0,b=u.length;C<b;C++)if(t&&u[C]==="("){const y=g*100+f;p[C]=s(2*y),f++}else if(t&&u[C]===")"){f=Math.max(f-1,0);const y=g*100+f;p[C]=s(2*y+1),f===0&&g++}else p[C]=u.charCodeAt(C);return p}const a=r(o),d=r(e);return new L4({getElements:()=>a},{getElements:()=>d}).ComputeDiff(!1).changes}var NO=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},_D=function(o,e){return function(t,i){e(t,i,o)}};let ME=class extends Rt{constructor(e,t,i,n,s){super(),this.textModel=e,this.versionId=t,this._debounceValue=i,this.languageFeaturesService=n,this.languageConfigurationService=s,this._updateOperation=this._register(new er),this.inlineCompletions=r1("inlineCompletions",void 0),this.suggestWidgetInlineCompletions=r1("suggestWidgetInlineCompletions",void 0),this._register(this.textModel.onDidChangeContent(()=>{this._updateOperation.clear()}))}fetch(e,t,i){var f,g;const n=new HO(e,t,this.textModel.getVersionId()),s=t.selectedSuggestionInfo?this.suggestWidgetInlineCompletions:this.inlineCompletions;if((f=this._updateOperation.value)!=null&&f.request.satisfies(n))return this._updateOperation.value.promise;if((g=s.get())!=null&&g.request.satisfies(n))return Promise.resolve(!0);const r=!!this._updateOperation.value;this._updateOperation.clear();const a=new Gs,d=(async()=>{if((r||t.triggerKind===_l.Automatic)&&await OO(this._debounceValue.get(this.textModel),a.token),a.token.isCancellationRequested||this._store.isDisposed||this.textModel.getVersionId()!==n.versionId)return!1;const C=new Date,b=await bB(this.languageFeaturesService.inlineCompletionsProvider,e,this.textModel,t,a.token,this.languageConfigurationService);if(a.token.isCancellationRequested||this._store.isDisposed||this.textModel.getVersionId()!==n.versionId)return!1;const y=new Date;this._debounceValue.update(this.textModel,y.getTime()-C.getTime());const w=new zO(b,n,this.textModel,this.versionId);if(i){const A=i.toInlineCompletion(void 0);i.canBeReused(this.textModel,e)&&!b.has(A)&&w.prepend(i.inlineCompletion,A.range,!0)}return this._updateOperation.clear(),Xu(A=>{s.set(w,A)}),!0})(),u=new WO(n,a,d);return this._updateOperation.value=u,d}clear(e){this._updateOperation.clear(),this.inlineCompletions.set(void 0,e),this.suggestWidgetInlineCompletions.set(void 0,e)}clearSuggestWidgetInlineCompletions(e){var t;(t=this._updateOperation.value)!=null&&t.request.context.selectedSuggestionInfo&&this._updateOperation.clear(),this.suggestWidgetInlineCompletions.set(void 0,e)}cancelUpdate(){this._updateOperation.clear()}};ME=NO([_D(3,Fi),_D(4,js)],ME);function OO(o,e){return new Promise(t=>{let i;const n=setTimeout(()=>{i&&i.dispose(),t()},o);e&&(i=e.onCancellationRequested(()=>{clearTimeout(n),i&&i.dispose(),t()}))})}class HO{constructor(e,t,i){this.position=e,this.context=t,this.versionId=i}satisfies(e){return this.position.equals(e.position)&&I4(this.context.selectedSuggestionInfo,e.context.selectedSuggestionInfo,T4())&&(e.context.triggerKind===_l.Automatic||this.context.triggerKind===_l.Explicit)&&this.versionId===e.versionId}}class WO{constructor(e,t,i){this.request=e,this.cancellationTokenSource=t,this.promise=i}dispose(){this.cancellationTokenSource.cancel()}}class zO{get inlineCompletions(){return this._inlineCompletions}constructor(e,t,i,n){this.inlineCompletionProviderResult=e,this.request=t,this._textModel=i,this._versionId=n,this._refCount=1,this._prependedInlineCompletionItems=[];const s=i.deltaDecorations([],e.completions.map(r=>({range:r.range,options:{description:"inline-completion-tracking-range"}})));this._inlineCompletions=e.completions.map((r,a)=>new bD(r,s[a],this._textModel,this._versionId))}clone(){return this._refCount++,this}dispose(){if(this._refCount--,this._refCount===0){setTimeout(()=>{this._textModel.isDisposed()||this._textModel.deltaDecorations(this._inlineCompletions.map(e=>e.decorationId),[])},0),this.inlineCompletionProviderResult.dispose();for(const e of this._prependedInlineCompletionItems)e.source.removeRef()}}prepend(e,t,i){i&&e.source.addRef();const n=this._textModel.deltaDecorations([],[{range:t,options:{description:"inline-completion-tracking-range"}}])[0];this._inlineCompletions.unshift(new bD(e,n,this._textModel,this._versionId)),this._prependedInlineCompletionItems.push(e)}}class bD{get forwardStable(){return this.inlineCompletion.source.inlineCompletions.enableForwardStability??!1}constructor(e,t,i,n){this.inlineCompletion=e,this.decorationId=t,this._textModel=i,this._modelVersion=n,this.semanticId=JSON.stringify([this.inlineCompletion.filterText,this.inlineCompletion.insertText,this.inlineCompletion.range.getStartPosition().toString()]),this._updatedRange=ul({owner:this,equalsFn:Q.equalsRange},s=>(this._modelVersion.read(s),this._textModel.getDecorationRange(this.decorationId)))}toInlineCompletion(e){return this.inlineCompletion.withRange(this._updatedRange.read(e)??AC)}toSingleTextEdit(e){return new Dl(this._updatedRange.read(e)??AC,this.inlineCompletion.insertText)}isVisible(e,t,i){const n=Wd(this._toFilterTextReplacement(i),e),s=this._updatedRange.read(i);if(!s||!this.inlineCompletion.range.getStartPosition().equals(s.getStartPosition())||t.lineNumber!==n.range.startLineNumber)return!1;const r=e.getValueInRange(n.range,1),a=n.text,d=Math.max(0,t.column-n.range.startColumn);let u=a.substring(0,d),f=a.substring(d),g=r.substring(0,d),p=r.substring(d);const C=e.getLineIndentColumn(n.range.startLineNumber);return n.range.startColumn<=C&&(g=g.trimStart(),g.length===0&&(p=p.trimStart()),u=u.trimStart(),u.length===0&&(f=f.trimStart())),u.startsWith(g)&&!!P4(p,f)}canBeReused(e,t){const i=this._updatedRange.read(void 0);return!!i&&i.containsPosition(t)&&this.isVisible(e,t,void 0)&&km.ofRange(i).isGreaterThanOrEqualTo(km.ofRange(this.inlineCompletion.range))}_toFilterTextReplacement(e){return new Dl(this._updatedRange.read(e)??AC,this.inlineCompletion.filterText)}}const AC=new Q(1,1,1,1),Gi={Visible:O9,HasFocusedSuggestion:new En("suggestWidgetHasFocusedSuggestion",!1,S("suggestWidgetHasSelection","Whether any suggestion is focused")),DetailsVisible:new En("suggestWidgetDetailsVisible",!1,S("suggestWidgetDetailsVisible","Whether suggestion details are visible")),MultipleSuggestions:new En("suggestWidgetMultipleSuggestions",!1,S("suggestWidgetMultipleSuggestions","Whether there are multiple suggestions to pick from")),MakesTextEdit:new En("suggestionMakesTextEdit",!0,S("suggestionMakesTextEdit","Whether inserting the current suggestion yields in a change or has everything already been typed")),AcceptSuggestionsOnEnter:new En("acceptSuggestionOnEnter",!0,S("acceptSuggestionOnEnter","Whether suggestions are inserted when pressing Enter")),HasInsertAndReplaceRange:new En("suggestionHasInsertAndReplaceRange",!1,S("suggestionHasInsertAndReplaceRange","Whether the current suggestion has insert and replace behaviour")),InsertMode:new En("suggestionInsertMode",void 0,{type:"string",description:S("suggestionInsertMode","Whether the default behaviour is to insert or replace")}),CanResolve:new En("suggestionCanResolve",!1,S("suggestionCanResolve","Whether the current suggestion supports to resolve further details"))},bc=new ni("suggestWidgetStatusBar");class VO{constructor(e,t,i,n){var s;this.position=e,this.completion=t,this.container=i,this.provider=n,this.isInvalid=!1,this.score=Mg.Default,this.distance=0,this.textLabel=typeof t.label=="string"?t.label:(s=t.label)==null?void 0:s.label,this.labelLow=this.textLabel.toLowerCase(),this.isInvalid=!this.textLabel,this.sortTextLow=t.sortText&&t.sortText.toLowerCase(),this.filterTextLow=t.filterText&&t.filterText.toLowerCase(),this.extensionId=t.extensionId,Q.isIRange(t.range)?(this.editStart=new Bi(t.range.startLineNumber,t.range.startColumn),this.editInsertEnd=new Bi(t.range.endLineNumber,t.range.endColumn),this.editReplaceEnd=new Bi(t.range.endLineNumber,t.range.endColumn),this.isInvalid=this.isInvalid||Q.spansMultipleLines(t.range)||t.range.startLineNumber!==e.lineNumber):(this.editStart=new Bi(t.range.insert.startLineNumber,t.range.insert.startColumn),this.editInsertEnd=new Bi(t.range.insert.endLineNumber,t.range.insert.endColumn),this.editReplaceEnd=new Bi(t.range.replace.endLineNumber,t.range.replace.endColumn),this.isInvalid=this.isInvalid||Q.spansMultipleLines(t.range.insert)||Q.spansMultipleLines(t.range.replace)||t.range.insert.startLineNumber!==e.lineNumber||t.range.replace.startLineNumber!==e.lineNumber||t.range.insert.startColumn!==t.range.replace.startColumn),typeof n.resolveCompletionItem!="function"&&(this._resolveCache=Promise.resolve(),this._resolveDuration=0)}get isResolved(){return this._resolveDuration!==void 0}get resolveDuration(){return this._resolveDuration!==void 0?this._resolveDuration:-1}async resolve(e){if(!this._resolveCache){const t=e.onCancellationRequested(()=>{this._resolveCache=void 0,this._resolveDuration=void 0}),i=new Oo(!0);this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,e)).then(n=>{Object.assign(this.completion,n),this._resolveDuration=i.elapsed()},n=>{qc(n)&&(this._resolveCache=void 0,this._resolveDuration=void 0)}).finally(()=>{t.dispose()})}return this._resolveCache}}const a_=class a_{constructor(e=2,t=new Set,i=new Set,n=new Map,s=!0){this.snippetSortOrder=e,this.kindFilter=t,this.providerFilter=i,this.providerItemsToReuse=n,this.showDeprecated=s}};a_.default=new a_;let Jg=a_;class jO{constructor(e,t,i,n){this.items=e,this.needsClipboard=t,this.durations=i,this.disposable=n}}async function U9(o,e,t,i=Jg.default,n={triggerKind:0},s=an.None){const r=new Oo;t=t.clone();const a=e.getWordAtPosition(t),d=a?new Q(t.lineNumber,a.startColumn,t.lineNumber,a.endColumn):Q.fromPositions(t),u={replace:d,insert:d.setEndPosition(t.lineNumber,t.column)},f=[],g=new Tt,p=[];let C=!1;const b=(w,A,I)=>{var R;let T=!1;if(!A)return T;for(const P of A.suggestions)if(!i.kindFilter.has(P.kind)){if(!i.showDeprecated&&((R=P==null?void 0:P.tags)!=null&&R.includes(1)))continue;P.range||(P.range=u),P.sortText||(P.sortText=typeof P.label=="string"?P.label:P.label.label),!C&&P.insertTextRules&&P.insertTextRules&4&&(C=Nu.guessNeedsClipboard(P.insertText)),f.push(new VO(t,P,A,w)),T=!0}return ZA(A)&&g.add(A),p.push({providerName:w._debugDisplayName??"unknown_provider",elapsedProvider:A.duration??-1,elapsedOverall:I.elapsed()}),T},y=(async()=>{})();for(const w of o.orderedGroups(e)){let A=!1;if(await Promise.all(w.map(async I=>{if(i.providerItemsToReuse.has(I)){const T=i.providerItemsToReuse.get(I);T.forEach(R=>f.push(R)),A=A||T.length>0;return}if(!(i.providerFilter.size>0&&!i.providerFilter.has(I)))try{const T=new Oo,R=await I.provideCompletionItems(e,t,n,s);A=b(I,R,T)||A}catch(T){bs(T)}})),A||s.isCancellationRequested)break}return await y,s.isCancellationRequested?(g.dispose(),Promise.reject(new V_)):new jO(f.sort(qO(i.snippetSortOrder)),C,{entries:p,elapsed:r.elapsed()},g)}function q9(o,e){if(o.sortTextLow&&e.sortTextLow){if(o.sortTextLow<e.sortTextLow)return-1;if(o.sortTextLow>e.sortTextLow)return 1}return o.textLabel<e.textLabel?-1:o.textLabel>e.textLabel?1:o.completion.kind-e.completion.kind}function $O(o,e){if(o.completion.kind!==e.completion.kind){if(o.completion.kind===27)return-1;if(e.completion.kind===27)return 1}return q9(o,e)}function UO(o,e){if(o.completion.kind!==e.completion.kind){if(o.completion.kind===27)return 1;if(e.completion.kind===27)return-1}return q9(o,e)}const yb=new Map;yb.set(0,$O);yb.set(2,UO);yb.set(1,q9);function qO(o){return yb.get(o)}Qn.registerCommand("_executeCompletionItemProvider",async(o,...e)=>{const[t,i,n,s]=e;Pn(jn.isUri(t)),Pn(Bi.isIPosition(i)),Pn(typeof n=="string"||!n),Pn(typeof s=="number"||!s);const{completionProvider:r}=o.get(Fi),a=await o.get(fa).createModelReference(t);try{const d={incomplete:!1,suggestions:[]},u=[],f=a.object.textEditorModel.validatePosition(i),g=await U9(r,a.object.textEditorModel,f,void 0,{triggerCharacter:n??void 0,triggerKind:n?1:0});for(const p of g.items)u.length<(s??0)&&u.push(p.resolve(an.None)),d.incomplete=d.incomplete||p.container.incomplete,d.suggestions.push(p.completion);try{return await Promise.all(u),d}finally{setTimeout(()=>g.disposable.dispose(),100)}}finally{a.dispose()}});function GO(o,e){var t;(t=o.getContribution("editor.contrib.suggestController"))==null||t.triggerSuggest(new Set().add(e),void 0,!0)}class Xh{static isAllOff(e){return e.other==="off"&&e.comments==="off"&&e.strings==="off"}static isAllOn(e){return e.other==="on"&&e.comments==="on"&&e.strings==="on"}static valueFor(e,t){switch(t){case 1:return e.comments;case 2:return e.strings;default:return e.other}}}function CD(o,e=W_){return M4(o,e)?o.charAt(0).toUpperCase()+o.slice(1):o}var KO=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ZO=function(o,e){return function(t,i){e(t,i,o)}};class ED{constructor(e){this._delegates=e}resolve(e){for(const t of this._delegates){const i=t.resolve(e);if(i!==void 0)return i}}}class yD{constructor(e,t,i,n){this._model=e,this._selection=t,this._selectionIdx=i,this._overtypingCapturer=n}resolve(e){const{name:t}=e;if(t==="SELECTION"||t==="TM_SELECTED_TEXT"){let i=this._model.getValueInRange(this._selection)||void 0,n=this._selection.startLineNumber!==this._selection.endLineNumber;if(!i&&this._overtypingCapturer){const s=this._overtypingCapturer.getLastOvertypedInfo(this._selectionIdx);s&&(i=s.value,n=s.multiline)}if(i&&n&&e.snippet){const s=this._model.getLineContent(this._selection.startLineNumber),r=eo(s,0,this._selection.startColumn-1);let a=r;e.snippet.walk(u=>u===e?!1:(u instanceof Po&&(a=eo(Q_(u.value).pop())),!0));const d=Rp(a,r);i=i.replace(/(\r\n|\r|\n)(.*)/g,(u,f,g)=>`${f}${a.substr(d)}${g}`)}return i}else{if(t==="TM_CURRENT_LINE")return this._model.getLineContent(this._selection.positionLineNumber);if(t==="TM_CURRENT_WORD"){const i=this._model.getWordAtPosition({lineNumber:this._selection.positionLineNumber,column:this._selection.positionColumn});return i&&i.word||void 0}else{if(t==="TM_LINE_INDEX")return String(this._selection.positionLineNumber-1);if(t==="TM_LINE_NUMBER")return String(this._selection.positionLineNumber);if(t==="CURSOR_INDEX")return String(this._selectionIdx);if(t==="CURSOR_NUMBER")return String(this._selectionIdx+1)}}}}class wD{constructor(e,t){this._labelService=e,this._model=t}resolve(e){const{name:t}=e;if(t==="TM_FILENAME")return ag(this._model.uri.fsPath);if(t==="TM_FILENAME_BASE"){const i=ag(this._model.uri.fsPath),n=i.lastIndexOf(".");return n<=0?i:i.slice(0,n)}else{if(t==="TM_DIRECTORY")return R4(this._model.uri.fsPath)==="."?"":this._labelService.getUriLabel(zw(this._model.uri));if(t==="TM_FILEPATH")return this._labelService.getUriLabel(this._model.uri);if(t==="RELATIVE_FILEPATH")return this._labelService.getUriLabel(this._model.uri,{relative:!0,noPrefix:!0})}}}class SD{constructor(e,t,i,n){this._readClipboardText=e,this._selectionIdx=t,this._selectionCount=i,this._spread=n}resolve(e){if(e.name!=="CLIPBOARD")return;const t=this._readClipboardText();if(t){if(this._spread){const i=t.split(/\r\n|\n|\r/).filter(n=>!N4(n));if(i.length===this._selectionCount)return i[this._selectionIdx]}return t}}}let dv=class{constructor(e,t,i){this._model=e,this._selection=t,this._languageConfigurationService=i}resolve(e){const{name:t}=e,i=this._model.getLanguageIdAtPosition(this._selection.selectionStartLineNumber,this._selection.selectionStartColumn),n=this._languageConfigurationService.getLanguageConfiguration(i).comments;if(n){if(t==="LINE_COMMENT")return n.lineCommentToken||void 0;if(t==="BLOCK_COMMENT_START")return n.blockCommentStartToken||void 0;if(t==="BLOCK_COMMENT_END")return n.blockCommentEndToken||void 0}}};dv=KO([ZO(2,js)],dv);const Da=class Da{constructor(){this._date=new Date}resolve(e){const{name:t}=e;if(t==="CURRENT_YEAR")return String(this._date.getFullYear());if(t==="CURRENT_YEAR_SHORT")return String(this._date.getFullYear()).slice(-2);if(t==="CURRENT_MONTH")return String(this._date.getMonth().valueOf()+1).padStart(2,"0");if(t==="CURRENT_DATE")return String(this._date.getDate().valueOf()).padStart(2,"0");if(t==="CURRENT_HOUR")return String(this._date.getHours().valueOf()).padStart(2,"0");if(t==="CURRENT_MINUTE")return String(this._date.getMinutes().valueOf()).padStart(2,"0");if(t==="CURRENT_SECOND")return String(this._date.getSeconds().valueOf()).padStart(2,"0");if(t==="CURRENT_DAY_NAME")return Da.dayNames[this._date.getDay()];if(t==="CURRENT_DAY_NAME_SHORT")return Da.dayNamesShort[this._date.getDay()];if(t==="CURRENT_MONTH_NAME")return Da.monthNames[this._date.getMonth()];if(t==="CURRENT_MONTH_NAME_SHORT")return Da.monthNamesShort[this._date.getMonth()];if(t==="CURRENT_SECONDS_UNIX")return String(Math.floor(this._date.getTime()/1e3));if(t==="CURRENT_TIMEZONE_OFFSET"){const i=this._date.getTimezoneOffset(),n=i>0?"-":"+",s=Math.trunc(Math.abs(i/60)),r=s<10?"0"+s:s,a=Math.abs(i)-s*60,d=a<10?"0"+a:a;return n+r+":"+d}}};Da.dayNames=[S("Sunday","Sunday"),S("Monday","Monday"),S("Tuesday","Tuesday"),S("Wednesday","Wednesday"),S("Thursday","Thursday"),S("Friday","Friday"),S("Saturday","Saturday")],Da.dayNamesShort=[S("SundayShort","Sun"),S("MondayShort","Mon"),S("TuesdayShort","Tue"),S("WednesdayShort","Wed"),S("ThursdayShort","Thu"),S("FridayShort","Fri"),S("SaturdayShort","Sat")],Da.monthNames=[S("January","January"),S("February","February"),S("March","March"),S("April","April"),S("May","May"),S("June","June"),S("July","July"),S("August","August"),S("September","September"),S("October","October"),S("November","November"),S("December","December")],Da.monthNamesShort=[S("JanuaryShort","Jan"),S("FebruaryShort","Feb"),S("MarchShort","Mar"),S("AprilShort","Apr"),S("MayShort","May"),S("JuneShort","Jun"),S("JulyShort","Jul"),S("AugustShort","Aug"),S("SeptemberShort","Sep"),S("OctoberShort","Oct"),S("NovemberShort","Nov"),S("DecemberShort","Dec")];let uv=Da;class DD{constructor(e){this._workspaceService=e}resolve(e){if(!this._workspaceService)return;const t=O4(this._workspaceService.getWorkspace());if(!H4(t)){if(e.name==="WORKSPACE_NAME")return this._resolveWorkspaceName(t);if(e.name==="WORKSPACE_FOLDER")return this._resoveWorkspacePath(t)}}_resolveWorkspaceName(e){if($S(e))return ag(e.uri.path);let t=ag(e.configPath.path);return t.endsWith(US)&&(t=t.substr(0,t.length-US.length-1)),t}_resoveWorkspacePath(e){if($S(e))return CD(e.uri.fsPath);const t=ag(e.configPath.path);let i=e.configPath.fsPath;return i.endsWith(t)&&(i=i.substr(0,i.length-t.length-1)),i?CD(i):"/"}}class AD{resolve(e){const{name:t}=e;if(t==="RANDOM")return Math.random().toString().slice(-6);if(t==="RANDOM_HEX")return Math.random().toString(16).slice(-6);if(t==="UUID")return fb()}}var XO=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},YO=function(o,e){return function(t,i){e(t,i,o)}},Ur;const Er=class Er{constructor(e,t,i){this._editor=e,this._snippet=t,this._snippetLineLeadingWhitespace=i,this._offset=-1,this._nestingLevel=1,this._placeholderGroups=qS(t.placeholders,hr.compareByIndex),this._placeholderGroupsIdx=-1}initialize(e){this._offset=e.newPosition}dispose(){this._placeholderDecorations&&this._editor.removeDecorations([...this._placeholderDecorations.values()]),this._placeholderGroups.length=0}_initDecorations(){if(this._offset===-1)throw new Error("Snippet not initialized!");if(this._placeholderDecorations)return;this._placeholderDecorations=new Map;const e=this._editor.getModel();this._editor.changeDecorations(t=>{for(const i of this._snippet.placeholders){const n=this._snippet.offset(i),s=this._snippet.fullLen(i),r=Q.fromPositions(e.getPositionAt(this._offset+n),e.getPositionAt(this._offset+n+s)),a=i.isFinalTabstop?Er._decor.inactiveFinal:Er._decor.inactive,d=t.addDecoration(r,a);this._placeholderDecorations.set(i,d)}})}move(e){if(!this._editor.hasModel())return[];if(this._initDecorations(),this._placeholderGroupsIdx>=0){const n=[];for(const s of this._placeholderGroups[this._placeholderGroupsIdx])if(s.transform){const r=this._placeholderDecorations.get(s),a=this._editor.getModel().getDecorationRange(r),d=this._editor.getModel().getValueInRange(a),u=s.transform.resolve(d).split(/\r\n|\r|\n/);for(let f=1;f<u.length;f++)u[f]=this._editor.getModel().normalizeIndentation(this._snippetLineLeadingWhitespace+u[f]);n.push(cs.replace(a,u.join(this._editor.getModel().getEOL())))}n.length>0&&this._editor.executeEdits("snippet.placeholderTransform",n)}let t=!1;e===!0&&this._placeholderGroupsIdx<this._placeholderGroups.length-1?(this._placeholderGroupsIdx+=1,t=!0):e===!1&&this._placeholderGroupsIdx>0&&(this._placeholderGroupsIdx-=1,t=!0);const i=this._editor.getModel().changeDecorations(n=>{const s=new Set,r=[];for(const a of this._placeholderGroups[this._placeholderGroupsIdx]){const d=this._placeholderDecorations.get(a),u=this._editor.getModel().getDecorationRange(d);r.push(new $i(u.startLineNumber,u.startColumn,u.endLineNumber,u.endColumn)),t=t&&this._hasPlaceholderBeenCollapsed(a),n.changeDecorationOptions(d,a.isFinalTabstop?Er._decor.activeFinal:Er._decor.active),s.add(a);for(const f of this._snippet.enclosingPlaceholders(a)){const g=this._placeholderDecorations.get(f);n.changeDecorationOptions(g,f.isFinalTabstop?Er._decor.activeFinal:Er._decor.active),s.add(f)}}for(const[a,d]of this._placeholderDecorations)s.has(a)||n.changeDecorationOptions(d,a.isFinalTabstop?Er._decor.inactiveFinal:Er._decor.inactive);return r});return t?this.move(e):i??[]}_hasPlaceholderBeenCollapsed(e){let t=e;for(;t;){if(t instanceof hr){const i=this._placeholderDecorations.get(t);if(this._editor.getModel().getDecorationRange(i).isEmpty()&&t.toString().length>0)return!0}t=t.parent}return!1}get isAtFirstPlaceholder(){return this._placeholderGroupsIdx<=0||this._placeholderGroups.length===0}get isAtLastPlaceholder(){return this._placeholderGroupsIdx===this._placeholderGroups.length-1}get hasPlaceholder(){return this._snippet.placeholders.length>0}get isTrivialSnippet(){if(this._snippet.placeholders.length===0)return!0;if(this._snippet.placeholders.length===1){const[e]=this._snippet.placeholders;if(e.isFinalTabstop&&this._snippet.rightMostDescendant===e)return!0}return!1}computePossibleSelections(){const e=new Map;for(const t of this._placeholderGroups){let i;for(const n of t){if(n.isFinalTabstop)break;i||(i=[],e.set(n.index,i));const s=this._placeholderDecorations.get(n),r=this._editor.getModel().getDecorationRange(s);if(!r){e.delete(n.index);break}i.push(r)}}return e}get activeChoice(){if(!this._placeholderDecorations)return;const e=this._placeholderGroups[this._placeholderGroupsIdx][0];if(!(e!=null&&e.choice))return;const t=this._placeholderDecorations.get(e);if(!t)return;const i=this._editor.getModel().getDecorationRange(t);if(i)return{range:i,choice:e.choice}}get hasChoice(){let e=!1;return this._snippet.walk(t=>(e=t instanceof xf,!e)),e}merge(e){const t=this._editor.getModel();this._nestingLevel*=10,this._editor.changeDecorations(i=>{for(const n of this._placeholderGroups[this._placeholderGroupsIdx]){const s=e.shift();console.assert(s._offset!==-1),console.assert(!s._placeholderDecorations);const r=s._snippet.placeholderInfo.last.index;for(const d of s._snippet.placeholderInfo.all)d.isFinalTabstop?d.index=n.index+(r+1)/this._nestingLevel:d.index=n.index+d.index/this._nestingLevel;this._snippet.replace(n,s._snippet.children);const a=this._placeholderDecorations.get(n);i.removeDecoration(a),this._placeholderDecorations.delete(n);for(const d of s._snippet.placeholders){const u=s._snippet.offset(d),f=s._snippet.fullLen(d),g=Q.fromPositions(t.getPositionAt(s._offset+u),t.getPositionAt(s._offset+u+f)),p=i.addDecoration(g,Er._decor.inactive);this._placeholderDecorations.set(d,p)}}this._placeholderGroups=qS(this._snippet.placeholders,hr.compareByIndex)})}};Er._decor={active:vn.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:vn.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:vn.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:vn.register({description:"snippet-placeholder-4",stickiness:1,className:"finish-snippet-placeholder"})};let hv=Er;const kD={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let fv=Ur=class{static adjustWhitespace(e,t,i,n,s){const r=e.getLineContent(t.lineNumber),a=eo(r,0,t.column-1);let d;return n.walk(u=>{if(!(u instanceof Po)||u.parent instanceof xf||s&&!s.has(u))return!0;const f=u.value.split(/\r\n|\r|\n/);if(i){const p=n.offset(u);if(p===0)f[0]=e.normalizeIndentation(f[0]);else{d=d??n.toString();const C=d.charCodeAt(p-1);(C===10||C===13)&&(f[0]=e.normalizeIndentation(a+f[0]))}for(let C=1;C<f.length;C++)f[C]=e.normalizeIndentation(a+f[C])}const g=f.join(e.getEOL());return g!==u.value&&(u.parent.replace(u,[new Po(g)]),d=void 0),!0}),a}static adjustSelection(e,t,i,n){if(i!==0||n!==0){const{positionLineNumber:s,positionColumn:r}=t,a=r-i,d=r+n,u=e.validateRange({startLineNumber:s,startColumn:a,endLineNumber:s,endColumn:d});t=$i.createWithDirection(u.startLineNumber,u.startColumn,u.endLineNumber,u.endColumn,t.getDirection())}return t}static createEditsAndSnippetsFromSelections(e,t,i,n,s,r,a,d,u){const f=[],g=[];if(!e.hasModel())return{edits:f,snippets:g};const p=e.getModel(),C=e.invokeWithinContext(R=>R.get(F0)),b=e.invokeWithinContext(R=>new wD(R.get(Tg),p)),y=()=>a,w=p.getValueInRange(Ur.adjustSelection(p,e.getSelection(),i,0)),A=p.getValueInRange(Ur.adjustSelection(p,e.getSelection(),0,n)),I=p.getLineFirstNonWhitespaceColumn(e.getSelection().positionLineNumber),T=e.getSelections().map((R,P)=>({selection:R,idx:P})).sort((R,P)=>Q.compareRangesUsingStarts(R.selection,P.selection));for(const{selection:R,idx:P}of T){let V=Ur.adjustSelection(p,R,i,0),j=Ur.adjustSelection(p,R,0,n);w!==p.getValueInRange(V)&&(V=R),A!==p.getValueInRange(j)&&(j=R);const J=R.setStartPosition(V.startLineNumber,V.startColumn).setEndPosition(j.endLineNumber,j.endColumn),ae=new Nu().parse(t,!0,s),fe=J.getStartPosition(),X=Ur.adjustWhitespace(p,fe,r||P>0&&I!==p.getLineFirstNonWhitespaceColumn(R.positionLineNumber),ae);ae.resolveVariables(new ED([b,new SD(y,P,T.length,e.getOption(79)==="spread"),new yD(p,R,P,d),new dv(p,R,u),new uv,new DD(C),new AD])),f[P]=cs.replace(J,ae.toString()),f[P].identifier={major:P,minor:0},f[P]._isTracked=!0,g[P]=new hv(e,ae,X)}return{edits:f,snippets:g}}static createEditsAndSnippetsFromEdits(e,t,i,n,s,r,a){if(!e.hasModel()||t.length===0)return{edits:[],snippets:[]};const d=[],u=e.getModel(),f=new Nu,g=new Up,p=new ED([e.invokeWithinContext(b=>new wD(b.get(Tg),u)),new SD(()=>s,0,e.getSelections().length,e.getOption(79)==="spread"),new yD(u,e.getSelection(),0,r),new dv(u,e.getSelection(),a),new uv,new DD(e.invokeWithinContext(b=>b.get(F0))),new AD]);t=t.sort((b,y)=>Q.compareRangesUsingStarts(b.range,y.range));let C=0;for(let b=0;b<t.length;b++){const{range:y,template:w}=t[b];if(b>0){const P=t[b-1].range,V=Q.fromPositions(P.getEndPosition(),y.getStartPosition()),j=new Po(u.getValueInRange(V));g.appendChild(j),C+=j.value.length}const A=f.parseFragment(w,g);Ur.adjustWhitespace(u,y.getStartPosition(),!0,g,new Set(A)),g.resolveVariables(p);const I=g.toString(),T=I.slice(C);C=I.length;const R=cs.replace(y,T);R.identifier={major:b,minor:0},R._isTracked=!0,d.push(R)}return f.ensureFinalTabstop(g,i,!0),{edits:d,snippets:[new hv(e,g,"")]}}constructor(e,t,i=kD,n){this._editor=e,this._template=t,this._options=i,this._languageConfigurationService=n,this._templateMerges=[],this._snippets=[]}dispose(){uo(this._snippets)}_logInfo(){return`template="${this._template}", merged_templates="${this._templateMerges.join(" -> ")}"`}insert(){if(!this._editor.hasModel())return;const{edits:e,snippets:t}=typeof this._template=="string"?Ur.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):Ur.createEditsAndSnippetsFromEdits(this._editor,this._template,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService);this._snippets=t,this._editor.executeEdits("snippet",e,i=>{const n=i.filter(s=>!!s.identifier);for(let s=0;s<t.length;s++)t[s].initialize(n[s].textChange);return this._snippets[0].hasPlaceholder?this._move(!0):n.map(s=>$i.fromPositions(s.range.getEndPosition()))}),this._editor.revealRange(this._editor.getSelections()[0])}merge(e,t=kD){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,e]);const{edits:i,snippets:n}=Ur.createEditsAndSnippetsFromSelections(this._editor,e,t.overwriteBefore,t.overwriteAfter,!0,t.adjustWhitespace,t.clipboardText,t.overtypingCapturer,this._languageConfigurationService);this._editor.executeEdits("snippet",i,s=>{const r=s.filter(d=>!!d.identifier);for(let d=0;d<n.length;d++)n[d].initialize(r[d].textChange);const a=n[0].isTrivialSnippet;if(!a){for(const d of this._snippets)d.merge(n);console.assert(n.length===0)}return this._snippets[0].hasPlaceholder&&!a?this._move(void 0):r.map(d=>$i.fromPositions(d.range.getEndPosition()))})}next(){const e=this._move(!0);this._editor.setSelections(e),this._editor.revealPositionInCenterIfOutsideViewport(e[0].getPosition())}prev(){const e=this._move(!1);this._editor.setSelections(e),this._editor.revealPositionInCenterIfOutsideViewport(e[0].getPosition())}_move(e){const t=[];for(const i of this._snippets){const n=i.move(e);t.push(...n)}return t}get isAtFirstPlaceholder(){return this._snippets[0].isAtFirstPlaceholder}get isAtLastPlaceholder(){return this._snippets[0].isAtLastPlaceholder}get hasPlaceholder(){return this._snippets[0].hasPlaceholder}get hasChoice(){return this._snippets[0].hasChoice}get activeChoice(){return this._snippets[0].activeChoice}isSelectionWithinPlaceholders(){if(!this.hasPlaceholder)return!1;const e=this._editor.getSelections();if(e.length<this._snippets.length)return!1;const t=new Map;for(const i of this._snippets){const n=i.computePossibleSelections();if(t.size===0)for(const[s,r]of n){r.sort(Q.compareRangesUsingStarts);for(const a of e)if(r[0].containsRange(a)){t.set(s,[]);break}}if(t.size===0)return!1;t.forEach((s,r)=>{s.push(...n.get(r))})}e.sort(Q.compareRangesUsingStarts);for(const[i,n]of t){if(n.length!==e.length){t.delete(i);continue}n.sort(Q.compareRangesUsingStarts);for(let s=0;s<n.length;s++)if(!n[s].containsRange(e[s])){t.delete(i);continue}}return t.size>0}};fv=Ur=XO([YO(3,js)],fv);var QO=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ix=function(o,e){return function(t,i){e(t,i,o)}},Hh;const BD={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};var Ta;let xo=(Ta=class{static get(e){return e.getContribution(Hh.ID)}constructor(e,t,i,n,s){this._editor=e,this._logService=t,this._languageFeaturesService=i,this._languageConfigurationService=s,this._snippetListener=new Tt,this._modelVersionId=-1,this._inSnippet=Hh.InSnippetMode.bindTo(n),this._hasNextTabstop=Hh.HasNextTabstop.bindTo(n),this._hasPrevTabstop=Hh.HasPrevTabstop.bindTo(n)}dispose(){var e;this._inSnippet.reset(),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),(e=this._session)==null||e.dispose(),this._snippetListener.dispose()}insert(e,t){try{this._doInsert(e,typeof t>"u"?BD:{...BD,...t})}catch(i){this.cancel(),this._logService.error(i),this._logService.error("snippet_error"),this._logService.error("insert_template=",e),this._logService.error("existing_template=",this._session?this._session._logInfo():"<no_session>")}}_doInsert(e,t){var i;if(this._editor.hasModel()){if(this._snippetListener.clear(),t.undoStopBefore&&this._editor.getModel().pushStackElement(),this._session&&typeof e!="string"&&this.cancel(),this._session?(Pn(typeof e=="string"),this._session.merge(e,t)):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new fv(this._editor,e,t,this._languageConfigurationService),this._session.insert()),t.undoStopAfter&&this._editor.getModel().pushStackElement(),(i=this._session)!=null&&i.hasChoice){const n={_debugDisplayName:"snippetChoiceCompletions",provideCompletionItems:(f,g)=>{if(!this._session||f!==this._editor.getModel()||!Bi.equals(this._editor.getPosition(),g))return;const{activeChoice:p}=this._session;if(!p||p.choice.options.length===0)return;const C=f.getValueInRange(p.range),b=!!p.choice.options.find(w=>w.value===C),y=[];for(let w=0;w<p.choice.options.length;w++){const A=p.choice.options[w];y.push({kind:13,label:A.value,insertText:A.value,sortText:"a".repeat(w+1),range:p.range,filterText:b?`${C}_${A.value}`:void 0,command:{id:"jumpToNextSnippetPlaceholder",title:S("next","Go to next placeholder...")}})}return{suggestions:y}}},s=this._editor.getModel();let r,a=!1;const d=()=>{r==null||r.dispose(),a=!1},u=()=>{a||(r=this._languageFeaturesService.completionProvider.register({language:s.getLanguageId(),pattern:s.uri.fsPath,scheme:s.uri.scheme,exclusive:!0},n),this._snippetListener.add(r),a=!0)};this._choiceCompletions={provider:n,enable:u,disable:d}}this._updateState(),this._snippetListener.add(this._editor.onDidChangeModelContent(n=>n.isFlush&&this.cancel())),this._snippetListener.add(this._editor.onDidChangeModel(()=>this.cancel())),this._snippetListener.add(this._editor.onDidChangeCursorSelection(()=>this._updateState()))}}_updateState(){if(!(!this._session||!this._editor.hasModel())){if(this._modelVersionId===this._editor.getModel().getAlternativeVersionId())return this.cancel();if(!this._session.hasPlaceholder)return this.cancel();if(this._session.isAtLastPlaceholder||!this._session.isSelectionWithinPlaceholders())return this._editor.getModel().pushStackElement(),this.cancel();this._inSnippet.set(!0),this._hasPrevTabstop.set(!this._session.isAtFirstPlaceholder),this._hasNextTabstop.set(!this._session.isAtLastPlaceholder),this._handleChoice()}}_handleChoice(){var t;if(!this._session||!this._editor.hasModel()){this._currentChoice=void 0;return}const{activeChoice:e}=this._session;if(!e||!this._choiceCompletions){(t=this._choiceCompletions)==null||t.disable(),this._currentChoice=void 0;return}this._currentChoice!==e.choice&&(this._currentChoice=e.choice,this._choiceCompletions.enable(),queueMicrotask(()=>{GO(this._editor,this._choiceCompletions.provider)}))}finish(){for(;this._inSnippet.get();)this.next()}cancel(e=!1){var t;this._inSnippet.reset(),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),this._snippetListener.clear(),this._currentChoice=void 0,(t=this._session)==null||t.dispose(),this._session=void 0,this._modelVersionId=-1,e&&this._editor.setSelections([this._editor.getSelection()])}prev(){var e;(e=this._session)==null||e.prev(),this._updateState()}next(){var e;(e=this._session)==null||e.next(),this._updateState()}isInSnippet(){return!!this._inSnippet.get()}},Hh=Ta,Ta.ID="snippetController2",Ta.InSnippetMode=new En("inSnippetMode",!1,S("inSnippetMode","Whether the editor in current in snippet mode")),Ta.HasNextTabstop=new En("hasNextTabstop",!1,S("hasNextTabstop","Whether there is a next tab stop when in snippet mode")),Ta.HasPrevTabstop=new En("hasPrevTabstop",!1,S("hasPrevTabstop","Whether there is a previous tab stop when in snippet mode")),Ta);xo=Hh=QO([Ix(1,Yu),Ix(2,Fi),Ix(3,Fn),Ix(4,js)],xo);hn(xo.ID,xo,4);const wb=Ao.bindToContribution(xo.get);Ti(new wb({id:"jumpToNextSnippetPlaceholder",precondition:qe.and(xo.InSnippetMode,xo.HasNextTabstop),handler:o=>o.next(),kbOpts:{weight:130,kbExpr:q.textInputFocus,primary:2}}));Ti(new wb({id:"jumpToPrevSnippetPlaceholder",precondition:qe.and(xo.InSnippetMode,xo.HasPrevTabstop),handler:o=>o.prev(),kbOpts:{weight:130,kbExpr:q.textInputFocus,primary:1026}}));Ti(new wb({id:"leaveSnippet",precondition:xo.InSnippetMode,handler:o=>o.cancel(!0),kbOpts:{weight:130,kbExpr:q.textInputFocus,primary:9,secondary:[1033]}}));Ti(new wb({id:"acceptSnippet",precondition:xo.InSnippetMode,handler:o=>o.finish()}));var JO=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},kC=function(o,e){return function(t,i){e(t,i,o)}};let RE=class extends Rt{get isAcceptingPartially(){return this._isAcceptingPartially}constructor(e,t,i,n,s,r,a,d,u,f,g,p){super(),this.textModel=e,this.selectedSuggestItem=t,this._textModelVersionId=i,this._positions=n,this._debounceValue=s,this._suggestPreviewEnabled=r,this._suggestPreviewMode=a,this._inlineSuggestMode=d,this._enabled=u,this._instantiationService=f,this._commandService=g,this._languageConfigurationService=p,this._source=this._register(this._instantiationService.createInstance(ME,this.textModel,this._textModelVersionId,this._debounceValue)),this._isActive=Qo(this,!1),this._forceUpdateExplicitlySignal=qw(this),this._selectedInlineCompletionId=Qo(this,void 0),this._primaryPosition=Wn(this,b=>this._positions.read(b)[0]??new Bi(1,1)),this._isAcceptingPartially=!1,this._preserveCurrentCompletionReasons=new Set([ol.Redo,ol.Undo,ol.AcceptWord]),this._fetchInlineCompletionsPromise=XA({owner:this,createEmptyChangeSummary:()=>({preserveCurrentCompletion:!1,inlineCompletionTriggerKind:_l.Automatic}),handleChange:(b,y)=>(b.didChange(this._textModelVersionId)&&this._preserveCurrentCompletionReasons.has(this._getReason(b.change))?y.preserveCurrentCompletion=!0:b.didChange(this._forceUpdateExplicitlySignal)&&(y.inlineCompletionTriggerKind=_l.Explicit),!0)},(b,y)=>{if(this._forceUpdateExplicitlySignal.read(b),!(this._enabled.read(b)&&this.selectedSuggestItem.read(b)||this._isActive.read(b))){this._source.cancelUpdate();return}this._textModelVersionId.read(b);const A=this._source.suggestWidgetInlineCompletions.get(),I=this.selectedSuggestItem.read(b);if(A&&!I){const j=this._source.inlineCompletions.get();Xu(J=>{(!j||A.request.versionId>j.request.versionId)&&this._source.inlineCompletions.set(A.clone(),J),this._source.clearSuggestWidgetInlineCompletions(J)})}const T=this._primaryPosition.read(b),R={triggerKind:y.inlineCompletionTriggerKind,selectedSuggestionInfo:I==null?void 0:I.toSelectedSuggestionInfo()},P=this.selectedInlineCompletion.get(),V=y.preserveCurrentCompletion||P!=null&&P.forwardStable?P:void 0;return this._source.fetch(T,R,V)}),this._filteredInlineCompletionItems=ul({owner:this,equalsFn:a1()},b=>{const y=this._source.inlineCompletions.read(b);if(!y)return[];const w=this._primaryPosition.read(b);return y.inlineCompletions.filter(I=>I.isVisible(this.textModel,w,b))}),this.selectedInlineCompletionIndex=Wn(this,b=>{const y=this._selectedInlineCompletionId.read(b),w=this._filteredInlineCompletionItems.read(b),A=this._selectedInlineCompletionId===void 0?-1:w.findIndex(I=>I.semanticId===y);return A===-1?(this._selectedInlineCompletionId.set(void 0,void 0),0):A}),this.selectedInlineCompletion=Wn(this,b=>{const y=this._filteredInlineCompletionItems.read(b),w=this.selectedInlineCompletionIndex.read(b);return y[w]}),this.activeCommands=ul({owner:this,equalsFn:a1()},b=>{var y;return((y=this.selectedInlineCompletion.read(b))==null?void 0:y.inlineCompletion.source.inlineCompletions.commands)??[]}),this.lastTriggerKind=this._source.inlineCompletions.map(this,b=>b==null?void 0:b.request.context.triggerKind),this.inlineCompletionsCount=Wn(this,b=>{if(this.lastTriggerKind.read(b)===_l.Explicit)return this._filteredInlineCompletionItems.read(b).length}),this.state=ul({owner:this,equalsFn:(b,y)=>!b||!y?b===y:uD(b.ghostTexts,y.ghostTexts)&&b.inlineCompletion===y.inlineCompletion&&b.suggestItem===y.suggestItem},b=>{const y=this.textModel,w=this.selectedSuggestItem.read(b);if(w){const A=Wd(w.toSingleTextEdit(),y),I=this._computeAugmentation(A,b);if(!this._suggestPreviewEnabled.read(b)&&!I)return;const R=(I==null?void 0:I.edit)??A,P=I?I.edit.text.length-A.text.length:0,V=this._suggestPreviewMode.read(b),j=this._positions.read(b),J=[R,...BC(this.textModel,j,R)],ae=J.map((X,ce)=>xD(X,y,V,j[ce],P)).filter(Yx),fe=ae[0]??new Qg(R.range.endLineNumber,[]);return{edits:J,primaryGhostText:fe,ghostTexts:ae,inlineCompletion:I==null?void 0:I.completion,suggestItem:w}}else{if(!this._isActive.read(b))return;const A=this.selectedInlineCompletion.read(b);if(!A)return;const I=A.toSingleTextEdit(b),T=this._inlineSuggestMode.read(b),R=this._positions.read(b),P=[I,...BC(this.textModel,R,I)],V=P.map((j,J)=>xD(j,y,T,R[J],0)).filter(Yx);return V[0]?{edits:P,primaryGhostText:V[0],ghostTexts:V,inlineCompletion:A,suggestItem:void 0}:void 0}}),this.ghostTexts=ul({owner:this,equalsFn:uD},b=>{const y=this.state.read(b);if(y)return y.ghostTexts}),this.primaryGhostText=ul({owner:this,equalsFn:mB},b=>{const y=this.state.read(b);if(y)return y==null?void 0:y.primaryGhostText}),this._register(YA(this._fetchInlineCompletionsPromise));let C;this._register(rs(b=>{var A,I;const y=this.state.read(b),w=y==null?void 0:y.inlineCompletion;if((w==null?void 0:w.semanticId)!==(C==null?void 0:C.semanticId)&&(C=w,w)){const T=w.inlineCompletion,R=T.source;(I=(A=R.provider).handleItemDidShow)==null||I.call(A,R.inlineCompletions,T.sourceInlineCompletion,T.insertText)}}))}_getReason(e){return e!=null&&e.isUndoing?ol.Undo:e!=null&&e.isRedoing?ol.Redo:this.isAcceptingPartially?ol.AcceptWord:ol.Other}async trigger(e){this._isActive.set(!0,e),await this._fetchInlineCompletionsPromise.get()}async triggerExplicitly(e){Bm(e,t=>{this._isActive.set(!0,t),this._forceUpdateExplicitlySignal.trigger(t)}),await this._fetchInlineCompletionsPromise.get()}stop(e){Bm(e,t=>{this._isActive.set(!1,t),this._source.clear(t)})}_computeAugmentation(e,t){const i=this.textModel,n=this._source.suggestWidgetInlineCompletions.read(t),s=n?n.inlineCompletions:[this.selectedInlineCompletion.read(t)].filter(Yx);return W4(s,a=>{let d=a.toSingleTextEdit(t);return d=Wd(d,i,Q.fromPositions(d.range.getStartPosition(),e.range.getEndPosition())),CB(d,e)?{completion:a,edit:d}:void 0})}async _deltaSelectedInlineCompletionIndex(e){await this.triggerExplicitly();const t=this._filteredInlineCompletionItems.get()||[];if(t.length>0){const i=(this.selectedInlineCompletionIndex.get()+e+t.length)%t.length;this._selectedInlineCompletionId.set(t[i].semanticId,void 0)}else this._selectedInlineCompletionId.set(void 0,void 0)}async next(){await this._deltaSelectedInlineCompletionIndex(1)}async previous(){await this._deltaSelectedInlineCompletionIndex(-1)}async accept(e){var n;if(e.getModel()!==this.textModel)throw new O0;const t=this.state.get();if(!t||t.primaryGhostText.isEmpty()||!t.inlineCompletion)return;const i=t.inlineCompletion.toInlineCompletion(void 0);if(i.command&&i.source.addRef(),e.pushUndoStop(),i.snippetInfo)e.executeEdits("inlineSuggestion.accept",[cs.replace(i.range,""),...i.additionalTextEdits]),e.setPosition(i.snippetInfo.range.getStartPosition(),"inlineCompletionAccept"),(n=xo.get(e))==null||n.insert(i.snippetInfo.snippet,{undoStopBefore:!1});else{const s=t.edits,r=FD(s).map(a=>$i.fromPositions(a));e.executeEdits("inlineSuggestion.accept",[...s.map(a=>cs.replace(a.range,a.text)),...i.additionalTextEdits]),e.setSelections(r,"inlineCompletionAccept")}this.stop(),i.command&&(await this._commandService.executeCommand(i.command.id,...i.command.arguments||[]).then(void 0,bs),i.source.removeRef())}async acceptNextWord(e){await this._acceptNext(e,(t,i)=>{const n=this.textModel.getLanguageIdAtPosition(t.lineNumber,t.column),s=this._languageConfigurationService.getLanguageConfiguration(n),r=new RegExp(s.wordDefinition.source,s.wordDefinition.flags.replace("g","")),a=i.match(r);let d=0;a&&a.index!==void 0?a.index===0?d=a[0].length:d=a.index:d=i.length;const f=/\s+/g.exec(i);return f&&f.index!==void 0&&f.index+f[0].length<d&&(d=f.index+f[0].length),d},0)}async acceptNextLine(e){await this._acceptNext(e,(t,i)=>{const n=i.match(/\n/);return n&&n.index!==void 0?n.index+1:i.length},1)}async _acceptNext(e,t,i){if(e.getModel()!==this.textModel)throw new O0;const n=this.state.get();if(!n||n.primaryGhostText.isEmpty()||!n.inlineCompletion)return;const s=n.primaryGhostText,r=n.inlineCompletion.toInlineCompletion(void 0);if(r.snippetInfo||r.filterText!==r.insertText){await this.accept(e);return}const a=s.parts[0],d=new Bi(s.lineNumber,a.column),u=a.text,f=t(d,u);if(f===u.length&&s.parts.length===1){this.accept(e);return}const g=u.substring(0,f),p=this._positions.get(),C=p[0];r.source.addRef();try{this._isAcceptingPartially=!0;try{e.pushUndoStop();const b=Q.fromPositions(C,d),y=e.getModel().getValueInRange(b)+g,w=new Dl(b,y),A=[w,...BC(this.textModel,p,w)],I=FD(A).map(T=>$i.fromPositions(T));e.executeEdits("inlineSuggestion.accept",A.map(T=>cs.replace(T.range,T.text))),e.setSelections(I,"inlineCompletionPartialAccept"),e.revealPositionInCenterIfOutsideViewport(e.getPosition(),1)}finally{this._isAcceptingPartially=!1}if(r.source.provider.handlePartialAccept){const b=Q.fromPositions(r.range.getStartPosition(),km.ofText(g).addToPosition(d)),y=e.getModel().getValueInRange(b,1);r.source.provider.handlePartialAccept(r.source.inlineCompletions,r.sourceInlineCompletion,y.length,{kind:i})}}finally{r.source.removeRef()}}handleSuggestAccepted(e){var s,r;const t=Wd(e.toSingleTextEdit(),this.textModel),i=this._computeAugmentation(t,void 0);if(!i)return;const n=i.completion.inlineCompletion;(r=(s=n.source.provider).handlePartialAccept)==null||r.call(s,n.source.inlineCompletions,n.sourceInlineCompletion,t.text.length,{kind:2})}};RE=JO([kC(9,sn),kC(10,Vs),kC(11,js)],RE);var ol;(function(o){o[o.Undo=0]="Undo",o[o.Redo=1]="Redo",o[o.AcceptWord=2]="AcceptWord",o[o.Other=3]="Other"})(ol||(ol={}));function BC(o,e,t){if(e.length===1)return[];const i=e[0],n=e.slice(1),s=t.range.getStartPosition(),r=t.range.getEndPosition(),a=o.getValueInRange(Q.fromPositions(i,r)),d=hD(i,s);if(d.lineNumber<1)return qn(new O0(`positionWithinTextEdit line number should be bigger than 0.
36
+ Invalid subtraction between ${i.toString()} and ${s.toString()}`)),[];const u=eH(t.text,d);return n.map(f=>{const g=SO(hD(f,s),r),p=o.getValueInRange(Q.fromPositions(f,g)),C=Rp(a,p),b=Q.fromPositions(f,f.delta(0,C));return new Dl(b,u)})}function eH(o,e){let t="";const i=V4(o);for(let n=e.lineNumber-1;n<i.length;n++)t+=i[n].substring(n===e.lineNumber-1?e.column-1:0);return t}function FD(o){const e=z4.createSortPermutation(o,Tp(s=>s.range,Q.compareRangesUsingStarts)),i=new VA(e.apply(o)).getNewRanges();return e.inverse().apply(i).map(s=>s.getEndPosition())}var tH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},LD=function(o,e){return function(t,i){e(t,i,o)}},Xf;class G9{constructor(e){this.name=e}select(e,t,i){if(i.length===0)return 0;const n=i[0].score[0];for(let s=0;s<i.length;s++){const{score:r,completion:a}=i[s];if(r[0]!==n)break;if(a.preselect)return s}return 0}}class ID extends G9{constructor(){super("first")}memorize(e,t,i){}toJSON(){}fromJSON(){}}class iH extends G9{constructor(){super("recentlyUsed"),this._cache=new Bp(300,.66),this._seq=0}memorize(e,t,i){const n=`${e.getLanguageId()}/${i.textLabel}`;this._cache.set(n,{touch:this._seq++,type:i.completion.kind,insertText:i.completion.insertText})}select(e,t,i){if(i.length===0)return 0;const n=e.getLineContent(t.lineNumber).substr(t.column-10,t.column-1);if(/\s$/.test(n))return super.select(e,t,i);const s=i[0].score[0];let r=-1,a=-1,d=-1;for(let u=0;u<i.length&&i[u].score[0]===s;u++){const f=`${e.getLanguageId()}/${i[u].textLabel}`,g=this._cache.peek(f);if(g&&g.touch>d&&g.type===i[u].completion.kind&&g.insertText===i[u].completion.insertText&&(d=g.touch,a=u),i[u].completion.preselect&&r===-1)return r=u}return a!==-1?a:r!==-1?r:0}toJSON(){return this._cache.toJSON()}fromJSON(e){this._cache.clear();const t=0;for(const[i,n]of e)n.touch=t,n.type=typeof n.type=="number"?n.type:Gw.fromString(n.type),this._cache.set(i,n);this._seq=this._cache.size}}class nH extends G9{constructor(){super("recentlyUsedByPrefix"),this._trie=j4.forStrings(),this._seq=0}memorize(e,t,i){const{word:n}=e.getWordUntilPosition(t),s=`${e.getLanguageId()}/${n}`;this._trie.set(s,{type:i.completion.kind,insertText:i.completion.insertText,touch:this._seq++})}select(e,t,i){const{word:n}=e.getWordUntilPosition(t);if(!n)return super.select(e,t,i);const s=`${e.getLanguageId()}/${n}`;let r=this._trie.get(s);if(r||(r=this._trie.findSubstr(s)),r)for(let a=0;a<i.length;a++){const{kind:d,insertText:u}=i[a].completion;if(d===r.type&&u===r.insertText)return a}return super.select(e,t,i)}toJSON(){const e=[];return this._trie.forEach((t,i)=>e.push([i,t])),e.sort((t,i)=>-(t[1].touch-i[1].touch)).forEach((t,i)=>t[1].touch=i),e.slice(0,200)}fromJSON(e){if(this._trie.clear(),e.length>0){this._seq=e[0][1].touch+1;for(const[t,i]of e)i.type=typeof i.type=="number"?i.type:Gw.fromString(i.type),this._trie.set(t,i)}}}var Bc;let NE=(Bc=class{constructor(e,t){this._storageService=e,this._configService=t,this._disposables=new Tt,this._persistSoon=new Ms(()=>this._saveState(),500),this._disposables.add(e.onWillSaveState(i=>{i.reason===Nw.SHUTDOWN&&this._saveState()}))}dispose(){this._disposables.dispose(),this._persistSoon.dispose()}memorize(e,t,i){this._withStrategy(e,t).memorize(e,t,i),this._persistSoon.schedule()}select(e,t,i){return this._withStrategy(e,t).select(e,t,i)}_withStrategy(e,t){var n;const i=this._configService.getValue("editor.suggestSelection",{overrideIdentifier:e.getLanguageIdAtPosition(t.lineNumber,t.column),resource:e.uri});if(((n=this._strategy)==null?void 0:n.name)!==i){this._saveState();const s=Xf._strategyCtors.get(i)||ID;this._strategy=new s;try{const a=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,d=this._storageService.get(`${Xf._storagePrefix}/${i}`,a);d&&this._strategy.fromJSON(JSON.parse(d))}catch{}}return this._strategy}_saveState(){if(this._strategy){const t=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,i=JSON.stringify(this._strategy);this._storageService.store(`${Xf._storagePrefix}/${this._strategy.name}`,i,t,1)}}},Xf=Bc,Bc._strategyCtors=new Map([["recentlyUsedByPrefix",nH],["recentlyUsed",iH],["first",ID]]),Bc._storagePrefix="suggest/memories",Bc);NE=Xf=tH([LD(0,Gc),LD(1,ss)],NE);const Sb=Ml("ISuggestMemories");Rl(Sb,NE,1);var sH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},oH=function(o,e){return function(t,i){e(t,i,o)}},OE,au;let gv=(au=class{constructor(e,t){this._editor=e,this._enabled=!1,this._ckAtEnd=OE.AtEnd.bindTo(t),this._configListener=this._editor.onDidChangeConfiguration(i=>i.hasChanged(124)&&this._update()),this._update()}dispose(){var e;this._configListener.dispose(),(e=this._selectionListener)==null||e.dispose(),this._ckAtEnd.reset()}_update(){const e=this._editor.getOption(124)==="on";if(this._enabled!==e)if(this._enabled=e,this._enabled){const t=()=>{if(!this._editor.hasModel()){this._ckAtEnd.set(!1);return}const i=this._editor.getModel(),n=this._editor.getSelection(),s=i.getWordAtPosition(n.getStartPosition());if(!s){this._ckAtEnd.set(!1);return}this._ckAtEnd.set(s.endColumn===n.getStartPosition().column)};this._selectionListener=this._editor.onDidChangeCursorSelection(t),t()}else this._selectionListener&&(this._ckAtEnd.reset(),this._selectionListener.dispose(),this._selectionListener=void 0)}},OE=au,au.AtEnd=new En("atEndOfWord",!1),au);gv=OE=sH([oH(1,Fn)],gv);var rH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},aH=function(o,e){return function(t,i){e(t,i,o)}},Yf,lu;let ef=(lu=class{constructor(e,t){this._editor=e,this._index=0,this._ckOtherSuggestions=Yf.OtherSuggestions.bindTo(t)}dispose(){this.reset()}reset(){var e;this._ckOtherSuggestions.reset(),(e=this._listener)==null||e.dispose(),this._model=void 0,this._acceptNext=void 0,this._ignore=!1}set({model:e,index:t},i){if(e.items.length===0){this.reset();return}if(Yf._moveIndex(!0,e,t)===t){this.reset();return}this._acceptNext=i,this._model=e,this._index=t,this._listener=this._editor.onDidChangeCursorPosition(()=>{this._ignore||this.reset()}),this._ckOtherSuggestions.set(!0)}static _moveIndex(e,t,i){let n=i;for(let s=t.items.length;s>0&&(n=(n+t.items.length+(e?1:-1))%t.items.length,!(n===i||!t.items[n].completion.additionalTextEdits));s--);return n}next(){this._move(!0)}prev(){this._move(!1)}_move(e){if(this._model)try{this._ignore=!0,this._index=Yf._moveIndex(e,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}},Yf=lu,lu.OtherSuggestions=new En("hasOtherSuggestions",!1),lu);ef=Yf=rH([aH(1,Fn)],ef);class lH{constructor(e,t,i,n){this._disposables=new Tt,this._disposables.add(i.onDidSuggest(s=>{s.completionModel.items.length===0&&this.reset()})),this._disposables.add(i.onDidCancel(s=>{this.reset()})),this._disposables.add(t.onDidShow(()=>this._onItem(t.getFocusedItem()))),this._disposables.add(t.onDidFocus(this._onItem,this)),this._disposables.add(t.onDidHide(this.reset,this)),this._disposables.add(e.onWillType(s=>{if(this._active&&!t.isFrozen()&&i.state!==0){const r=s.charCodeAt(s.length-1);this._active.acceptCharacters.has(r)&&e.getOption(0)&&n(this._active.item)}}))}_onItem(e){if(!e||!Yo(e.item.completion.commitCharacters)){this.reset();return}if(this._active&&this._active.item.item===e.item)return;const t=new Am;for(const i of e.item.completion.commitCharacters)i.length>0&&t.add(i.charCodeAt(0));this._active={acceptCharacters:t,item:e}}reset(){this._active=void 0}dispose(){this._disposables.dispose()}}const rr=class rr{async provideSelectionRanges(e,t){const i=[];for(const n of t){const s=[];i.push(s);const r=new Map;await new Promise(a=>rr._bracketsRightYield(a,0,e,n,r)),await new Promise(a=>rr._bracketsLeftYield(a,0,e,n,r,s))}return i}static _bracketsRightYield(e,t,i,n,s){const r=new Map,a=Date.now();for(;;){if(t>=rr._maxRounds){e();break}if(!n){e();break}const d=i.bracketPairs.findNextBracket(n);if(!d){e();break}if(Date.now()-a>rr._maxDuration){setTimeout(()=>rr._bracketsRightYield(e,t+1,i,n,s));break}if(d.bracketInfo.isOpeningBracket){const f=d.bracketInfo.bracketText,g=r.has(f)?r.get(f):0;r.set(f,g+1)}else{const f=d.bracketInfo.getOpeningBrackets()[0].bracketText;let g=r.has(f)?r.get(f):0;if(g-=1,r.set(f,Math.max(0,g)),g<0){let p=s.get(f);p||(p=new QA,s.set(f,p)),p.push(d.range)}}n=d.range.getEndPosition()}}static _bracketsLeftYield(e,t,i,n,s,r){const a=new Map,d=Date.now();for(;;){if(t>=rr._maxRounds&&s.size===0){e();break}if(!n){e();break}const u=i.bracketPairs.findPrevBracket(n);if(!u){e();break}if(Date.now()-d>rr._maxDuration){setTimeout(()=>rr._bracketsLeftYield(e,t+1,i,n,s,r));break}if(u.bracketInfo.isOpeningBracket){const g=u.bracketInfo.bracketText;let p=a.has(g)?a.get(g):0;if(p-=1,a.set(g,Math.max(0,p)),p<0){const C=s.get(g);if(C){const b=C.shift();C.size===0&&s.delete(g);const y=Q.fromPositions(u.range.getEndPosition(),b.getStartPosition()),w=Q.fromPositions(u.range.getStartPosition(),b.getEndPosition());r.push({range:y}),r.push({range:w}),rr._addBracketLeading(i,w,r)}}}else{const g=u.bracketInfo.getOpeningBrackets()[0].bracketText,p=a.has(g)?a.get(g):0;a.set(g,p+1)}n=u.range.getStartPosition()}}static _addBracketLeading(e,t,i){if(t.startLineNumber===t.endLineNumber)return;const n=t.startLineNumber,s=e.getLineFirstNonWhitespaceColumn(n);s!==0&&s!==t.startColumn&&(i.push({range:Q.fromPositions(new Bi(n,s),t.getEndPosition())}),i.push({range:Q.fromPositions(new Bi(n,1),t.getEndPosition())}));const r=n-1;if(r>0){const a=e.getLineFirstNonWhitespaceColumn(r);a===t.startColumn&&a!==e.getLineLastNonWhitespaceColumn(r)&&(i.push({range:Q.fromPositions(new Bi(r,a),t.getEndPosition())}),i.push({range:Q.fromPositions(new Bi(r,1),t.getEndPosition())}))}}};rr._maxDuration=30,rr._maxRounds=2;let pv=rr;const Aa=class Aa{static async create(e,t){if(!t.getOption(119).localityBonus||!t.hasModel())return Aa.None;const i=t.getModel(),n=t.getPosition();if(!e.canComputeWordRanges(i.uri))return Aa.None;const[s]=await new pv().provideSelectionRanges(i,[n]);if(s.length===0)return Aa.None;const r=await e.computeWordRanges(i.uri,s[0].range);if(!r)return Aa.None;const a=i.getWordUntilPosition(n);return delete r[a.word],new class extends Aa{distance(d,u){if(!n.equals(t.getPosition()))return 0;if(u.kind===17)return 2<<20;const f=typeof u.label=="string"?u.label:u.label.label,g=r[f];if($4(g))return 2<<20;const p=Fm(g,Q.fromPositions(d),Q.compareRangesUsingStarts),C=p>=0?g[p]:g[Math.max(0,~p-1)];let b=s.length;for(const y of s){if(!Q.containsRange(y.range,C))break;b-=1}return b}}}};Aa.None=new class extends Aa{distance(){return 0}};let xv=Aa,PD=class{constructor(e,t){this.leadingLineContent=e,this.characterCountDelta=t}};class oc{constructor(e,t,i,n,s,r,a=JA.default,d=void 0){this.clipboardText=d,this._snippetCompareFn=oc._compareCompletionItems,this._items=e,this._column=t,this._wordDistance=n,this._options=s,this._refilterKind=1,this._lineContext=i,this._fuzzyScoreOptions=a,r==="top"?this._snippetCompareFn=oc._compareCompletionItemsSnippetsUp:r==="bottom"&&(this._snippetCompareFn=oc._compareCompletionItemsSnippetsDown)}get lineContext(){return this._lineContext}set lineContext(e){(this._lineContext.leadingLineContent!==e.leadingLineContent||this._lineContext.characterCountDelta!==e.characterCountDelta)&&(this._refilterKind=this._lineContext.characterCountDelta<e.characterCountDelta&&this._filteredItems?2:1,this._lineContext=e)}get items(){return this._ensureCachedState(),this._filteredItems}getItemsByProvider(){return this._ensureCachedState(),this._itemsByProvider}getIncompleteProvider(){this._ensureCachedState();const e=new Set;for(const[t,i]of this.getItemsByProvider())i.length>0&&i[0].container.incomplete&&e.add(t);return e}get stats(){return this._ensureCachedState(),this._stats}_ensureCachedState(){this._refilterKind!==0&&this._createCachedState()}_createCachedState(){this._itemsByProvider=new Map;const e=[],{leadingLineContent:t,characterCountDelta:i}=this._lineContext;let n="",s="";const r=this._refilterKind===1?this._items:this._filteredItems,a=[],d=!this._options.filterGraceful||r.length>2e3?ek:U4;for(let u=0;u<r.length;u++){const f=r[u];if(f.isInvalid)continue;const g=this._itemsByProvider.get(f.provider);g?g.push(f):this._itemsByProvider.set(f.provider,[f]);const p=f.position.column-f.editStart.column,C=p+i-(f.position.column-this._column);if(n.length!==C&&(n=C===0?"":t.slice(-C),s=n.toLowerCase()),f.word=n,C===0)f.score=Mg.Default;else{let b=0;for(;b<p;){const y=n.charCodeAt(b);if(y===32||y===9)b+=1;else break}if(b>=C)f.score=Mg.Default;else if(typeof f.completion.filterText=="string"){const y=d(n,s,b,f.completion.filterText,f.filterTextLow,0,this._fuzzyScoreOptions);if(!y)continue;q4(f.completion.filterText,f.textLabel)===0?f.score=y:(f.score=G4(n,s,b,f.textLabel,f.labelLow,0),f.score[0]=y[0])}else{const y=d(n,s,b,f.textLabel,f.labelLow,0,this._fuzzyScoreOptions);if(!y)continue;f.score=y}}f.idx=u,f.distance=this._wordDistance.distance(f.position,f.completion),a.push(f),e.push(f.textLabel.length)}this._filteredItems=a.sort(this._snippetCompareFn),this._refilterKind=0,this._stats={pLabelLen:e.length?K4(e.length-.85,e,(u,f)=>u-f):0}}static _compareCompletionItems(e,t){return e.score[0]>t.score[0]?-1:e.score[0]<t.score[0]?1:e.distance<t.distance?-1:e.distance>t.distance?1:e.idx<t.idx?-1:e.idx>t.idx?1:0}static _compareCompletionItemsSnippetsDown(e,t){if(e.completion.kind!==t.completion.kind){if(e.completion.kind===27)return 1;if(t.completion.kind===27)return-1}return oc._compareCompletionItems(e,t)}static _compareCompletionItemsSnippetsUp(e,t){if(e.completion.kind!==t.completion.kind){if(e.completion.kind===27)return-1;if(t.completion.kind===27)return 1}return oc._compareCompletionItems(e,t)}}var cH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Xl=function(o,e){return function(t,i){e(t,i,o)}},HE;class hd{static shouldAutoTrigger(e){if(!e.hasModel())return!1;const t=e.getModel(),i=e.getPosition();t.tokenization.tokenizeIfCheap(i.lineNumber);const n=t.getWordAtPosition(i);return!(!n||n.endColumn!==i.column&&n.startColumn+1!==i.column||!isNaN(Number(n.word)))}constructor(e,t,i){this.leadingLineContent=e.getLineContent(t.lineNumber).substr(0,t.column-1),this.leadingWord=e.getWordUntilPosition(t),this.lineNumber=t.lineNumber,this.column=t.column,this.triggerOptions=i}}function dH(o,e,t){if(!e.getContextKeyValue(No.inlineSuggestionVisible.key))return!0;const i=e.getContextKeyValue(No.suppressSuggestions.key);return i!==void 0?!i:!o.getOption(62).suppressSuggestions}function uH(o,e,t){if(!e.getContextKeyValue("inlineSuggestionVisible"))return!0;const i=e.getContextKeyValue(No.suppressSuggestions.key);return i!==void 0?!i:!o.getOption(62).suppressSuggestions}let mv=HE=class{constructor(e,t,i,n,s,r,a,d,u){this._editor=e,this._editorWorkerService=t,this._clipboardService=i,this._telemetryService=n,this._logService=s,this._contextKeyService=r,this._configurationService=a,this._languageFeaturesService=d,this._envService=u,this._toDispose=new Tt,this._triggerCharacterListener=new Tt,this._triggerQuickSuggest=new Dp,this._triggerState=void 0,this._completionDisposables=new Tt,this._onDidCancel=new rn,this._onDidTrigger=new rn,this._onDidSuggest=new rn,this.onDidCancel=this._onDidCancel.event,this.onDidTrigger=this._onDidTrigger.event,this.onDidSuggest=this._onDidSuggest.event,this._telemetryGate=0,this._currentSelection=this._editor.getSelection()||new $i(1,1,1,1),this._toDispose.add(this._editor.onDidChangeModel(()=>{this._updateTriggerCharacters(),this.cancel()})),this._toDispose.add(this._editor.onDidChangeModelLanguage(()=>{this._updateTriggerCharacters(),this.cancel()})),this._toDispose.add(this._editor.onDidChangeConfiguration(()=>{this._updateTriggerCharacters()})),this._toDispose.add(this._languageFeaturesService.completionProvider.onDidChange(()=>{this._updateTriggerCharacters(),this._updateActiveSuggestSession()}));let f=!1;this._toDispose.add(this._editor.onDidCompositionStart(()=>{f=!0})),this._toDispose.add(this._editor.onDidCompositionEnd(()=>{f=!1,this._onCompositionEnd()})),this._toDispose.add(this._editor.onDidChangeCursorSelection(g=>{f||this._onCursorChange(g)})),this._toDispose.add(this._editor.onDidChangeModelContent(()=>{!f&&this._triggerState!==void 0&&this._refilterCompletionItems()})),this._updateTriggerCharacters()}dispose(){uo(this._triggerCharacterListener),uo([this._onDidCancel,this._onDidSuggest,this._onDidTrigger,this._triggerQuickSuggest]),this._toDispose.dispose(),this._completionDisposables.dispose(),this.cancel()}_updateTriggerCharacters(){if(this._triggerCharacterListener.clear(),this._editor.getOption(92)||!this._editor.hasModel()||!this._editor.getOption(122))return;const e=new Map;for(const i of this._languageFeaturesService.completionProvider.all(this._editor.getModel()))for(const n of i.triggerCharacters||[]){let s=e.get(n);s||(s=new Set,e.set(n,s)),s.add(i)}const t=i=>{var r;if(!uH(this._editor,this._contextKeyService,this._configurationService)||hd.shouldAutoTrigger(this._editor))return;if(!i){const a=this._editor.getPosition();i=this._editor.getModel().getLineContent(a.lineNumber).substr(0,a.column-1)}let n="";X4(i.charCodeAt(i.length-1))?Y4(i.charCodeAt(i.length-2))&&(n=i.substr(i.length-2)):n=i.charAt(i.length-1);const s=e.get(n);if(s){const a=new Map;if(this._completionModel)for(const[d,u]of this._completionModel.getItemsByProvider())s.has(d)||a.set(d,u);this.trigger({auto:!0,triggerKind:1,triggerCharacter:n,retrigger:!!this._completionModel,clipboardText:(r=this._completionModel)==null?void 0:r.clipboardText,completionOptions:{providerFilter:s,providerItemsToReuse:a}})}};this._triggerCharacterListener.add(this._editor.onDidType(t)),this._triggerCharacterListener.add(this._editor.onDidCompositionEnd(()=>t()))}get state(){return this._triggerState?this._triggerState.auto?2:1:0}cancel(e=!1){var t;this._triggerState!==void 0&&(this._triggerQuickSuggest.cancel(),(t=this._requestToken)==null||t.cancel(),this._requestToken=void 0,this._triggerState=void 0,this._completionModel=void 0,this._context=void 0,this._onDidCancel.fire({retrigger:e}))}clear(){this._completionDisposables.clear()}_updateActiveSuggestSession(){this._triggerState!==void 0&&(!this._editor.hasModel()||!this._languageFeaturesService.completionProvider.has(this._editor.getModel())?this.cancel():this.trigger({auto:this._triggerState.auto,retrigger:!0}))}_onCursorChange(e){if(!this._editor.hasModel())return;const t=this._currentSelection;if(this._currentSelection=this._editor.getSelection(),!e.selection.isEmpty()||e.reason!==0&&e.reason!==3||e.source!=="keyboard"&&e.source!=="deleteLeft"){this.cancel();return}this._triggerState===void 0&&e.reason===0?(t.containsRange(this._currentSelection)||t.getEndPosition().isBeforeOrEqual(this._currentSelection.getPosition()))&&this._doTriggerQuickSuggest():this._triggerState!==void 0&&e.reason===3&&this._refilterCompletionItems()}_onCompositionEnd(){this._triggerState===void 0?this._doTriggerQuickSuggest():this._refilterCompletionItems()}_doTriggerQuickSuggest(){var e;Xh.isAllOff(this._editor.getOption(90))||this._editor.getOption(119).snippetsPreventQuickSuggestions&&((e=xo.get(this._editor))!=null&&e.isInSnippet())||(this.cancel(),this._triggerQuickSuggest.cancelAndSet(()=>{if(this._triggerState!==void 0||!hd.shouldAutoTrigger(this._editor)||!this._editor.hasModel()||!this._editor.hasWidgetFocus())return;const t=this._editor.getModel(),i=this._editor.getPosition(),n=this._editor.getOption(90);if(!Xh.isAllOff(n)){if(!Xh.isAllOn(n)){t.tokenization.tokenizeIfCheap(i.lineNumber);const s=t.tokenization.getLineTokens(i.lineNumber),r=s.getStandardTokenType(s.findTokenIndexAtOffset(Math.max(i.column-1-1,0)));if(Xh.valueFor(n,r)!=="on")return}dH(this._editor,this._contextKeyService,this._configurationService)&&this._languageFeaturesService.completionProvider.has(t)&&this.trigger({auto:!0})}},this._editor.getOption(91)))}_refilterCompletionItems(){Pn(this._editor.hasModel()),Pn(this._triggerState!==void 0);const e=this._editor.getModel(),t=this._editor.getPosition(),i=new hd(e,t,{...this._triggerState,refilter:!0});this._onNewContext(i)}trigger(e){var p,C,b;if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=new hd(t,this._editor.getPosition(),e);this.cancel(e.retrigger),this._triggerState=e,this._onDidTrigger.fire({auto:e.auto,shy:e.shy??!1,position:this._editor.getPosition()}),this._context=i;let n={triggerKind:e.triggerKind??0};e.triggerCharacter&&(n={triggerKind:1,triggerCharacter:e.triggerCharacter}),this._requestToken=new Gs;const s=this._editor.getOption(113);let r=1;switch(s){case"top":r=0;break;case"bottom":r=2;break}const{itemKind:a,showDeprecated:d}=HE.createSuggestFilter(this._editor),u=new Jg(r,((p=e.completionOptions)==null?void 0:p.kindFilter)??a,(C=e.completionOptions)==null?void 0:C.providerFilter,(b=e.completionOptions)==null?void 0:b.providerItemsToReuse,d),f=xv.create(this._editorWorkerService,this._editor),g=U9(this._languageFeaturesService.completionProvider,t,this._editor.getPosition(),u,n,this._requestToken.token);Promise.all([g,f]).then(async([y,w])=>{var P;if((P=this._requestToken)==null||P.dispose(),!this._editor.hasModel())return;let A=e==null?void 0:e.clipboardText;if(!A&&y.needsClipboard&&(A=await this._clipboardService.readText()),this._triggerState===void 0)return;const I=this._editor.getModel(),T=new hd(I,this._editor.getPosition(),e),R={...JA.default,firstMatchCanBeWeak:!this._editor.getOption(119).matchOnWordStartOnly};if(this._completionModel=new oc(y.items,this._context.column,{leadingLineContent:T.leadingLineContent,characterCountDelta:T.column-this._context.column},w,this._editor.getOption(119),this._editor.getOption(113),R,A),this._completionDisposables.add(y.disposable),this._onNewContext(T),this._reportDurationsTelemetry(y.durations),!this._envService.isBuilt||this._envService.isExtensionDevelopment)for(const V of y.items)V.isInvalid&&this._logService.warn(`[suggest] did IGNORE invalid completion item from ${V.provider._debugDisplayName}`,V.completion)}).catch(qn)}_reportDurationsTelemetry(e){this._telemetryGate++%230===0&&setTimeout(()=>{this._telemetryService.publicLog2("suggest.durations.json",{data:JSON.stringify(e)}),this._logService.debug("suggest.durations.json",e)})}static createSuggestFilter(e){const t=new Set;e.getOption(113)==="none"&&t.add(27);const n=e.getOption(119);return n.showMethods||t.add(0),n.showFunctions||t.add(1),n.showConstructors||t.add(2),n.showFields||t.add(3),n.showVariables||t.add(4),n.showClasses||t.add(5),n.showStructs||t.add(6),n.showInterfaces||t.add(7),n.showModules||t.add(8),n.showProperties||t.add(9),n.showEvents||t.add(10),n.showOperators||t.add(11),n.showUnits||t.add(12),n.showValues||t.add(13),n.showConstants||t.add(14),n.showEnums||t.add(15),n.showEnumMembers||t.add(16),n.showKeywords||t.add(17),n.showWords||t.add(18),n.showColors||t.add(19),n.showFiles||t.add(20),n.showReferences||t.add(21),n.showColors||t.add(22),n.showFolders||t.add(23),n.showTypeParameters||t.add(24),n.showSnippets||t.add(27),n.showUsers||t.add(25),n.showIssues||t.add(26),{itemKind:t,showDeprecated:n.showDeprecated}}_onNewContext(e){if(this._context){if(e.lineNumber!==this._context.lineNumber){this.cancel();return}if(eo(e.leadingLineContent)!==eo(this._context.leadingLineContent)){this.cancel();return}if(e.column<this._context.column){e.leadingWord.word?this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0}):this.cancel();return}if(this._completionModel){if(e.leadingWord.word.length!==0&&e.leadingWord.startColumn>this._context.leadingWord.startColumn){if(hd.shouldAutoTrigger(this._editor)&&this._context){const i=this._completionModel.getItemsByProvider();this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerItemsToReuse:i}})}return}if(e.column>this._context.column&&this._completionModel.getIncompleteProvider().size>0&&e.leadingWord.word.length!==0){const t=new Map,i=new Set;for(const[n,s]of this._completionModel.getItemsByProvider())s.length>0&&s[0].container.incomplete?i.add(n):t.set(n,s);this.trigger({auto:this._context.triggerOptions.auto,triggerKind:2,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerFilter:i,providerItemsToReuse:t}})}else{const t=this._completionModel.lineContext;let i=!1;if(this._completionModel.lineContext={leadingLineContent:e.leadingLineContent,characterCountDelta:e.column-this._context.column},this._completionModel.items.length===0){const n=hd.shouldAutoTrigger(this._editor);if(!this._context){this.cancel();return}if(n&&this._context.leadingWord.endColumn<e.leadingWord.startColumn){this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0});return}if(this._context.triggerOptions.auto){this.cancel();return}else if(this._completionModel.lineContext=t,i=this._completionModel.items.length>0,i&&e.leadingWord.word.length===0){this.cancel();return}}this._onDidSuggest.fire({completionModel:this._completionModel,triggerOptions:e.triggerOptions,isFrozen:i})}}}}};mv=HE=cH([Xl(1,Nl),Xl(2,lf),Xl(3,ua),Xl(4,Yu),Xl(5,Fn),Xl(6,ss),Xl(7,Fi),Xl(8,Z4)],mv);const l_=class l_{constructor(e,t){this._disposables=new Tt,this._lastOvertyped=[],this._locked=!1,this._disposables.add(e.onWillType(()=>{if(this._locked||!e.hasModel())return;const i=e.getSelections(),n=i.length;let s=!1;for(let a=0;a<n;a++)if(!i[a].isEmpty()){s=!0;break}if(!s){this._lastOvertyped.length!==0&&(this._lastOvertyped.length=0);return}this._lastOvertyped=[];const r=e.getModel();for(let a=0;a<n;a++){const d=i[a];if(r.getValueLengthInRange(d)>l_._maxSelectionLength)return;this._lastOvertyped[a]={value:r.getValueInRange(d),multiline:d.startLineNumber!==d.endLineNumber}}})),this._disposables.add(t.onDidTrigger(i=>{this._locked=!0})),this._disposables.add(t.onDidCancel(i=>{this._locked=!1}))}getLastOvertypedInfo(e){if(e>=0&&e<this._lastOvertyped.length)return this._lastOvertyped[e]}dispose(){this._disposables.dispose()}};l_._maxSelectionLength=51200;let WE=l_;var hH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},FC=function(o,e){return function(t,i){e(t,i,o)}};let zE=class{constructor(e,t,i,n,s){this._menuId=t,this._menuService=n,this._contextKeyService=s,this._menuDisposables=new Tt,this.element=di(e,mi(".suggest-status-bar"));const r=(a=>a instanceof N0?i.createInstance(Q4,a,{useComma:!0}):void 0);this._leftActions=new Bg(this.element,{actionViewItemProvider:r}),this._rightActions=new Bg(this.element,{actionViewItemProvider:r}),this._leftActions.domNode.classList.add("left"),this._rightActions.domNode.classList.add("right")}dispose(){this._menuDisposables.dispose(),this._leftActions.dispose(),this._rightActions.dispose(),this.element.remove()}show(){const e=this._menuService.createMenu(this._menuId,this._contextKeyService),t=()=>{const i=[],n=[];for(const[s,r]of e.getActions())s==="left"?i.push(...r):n.push(...r);this._leftActions.clear(),this._leftActions.push(i),this._rightActions.clear(),this._rightActions.push(n)};this._menuDisposables.add(e.onDidChange(()=>t())),this._menuDisposables.add(e)}hide(){this._menuDisposables.clear()}};zE=hH([FC(2,sn),FC(3,Zu),FC(4,Fn)],zE);var fH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},gH=function(o,e){return function(t,i){e(t,i,o)}};function K9(o){return!!o&&!!(o.completion.documentation||o.completion.detail&&o.completion.detail!==o.completion.label)}let VE=class{constructor(e,t){this._editor=e,this._onDidClose=new rn,this.onDidClose=this._onDidClose.event,this._onDidChangeContents=new rn,this.onDidChangeContents=this._onDidChangeContents.event,this._disposables=new Tt,this._renderDisposeable=new Tt,this._borderWidth=1,this._size=new Zn(330,0),this.domNode=mi(".suggest-details"),this.domNode.classList.add("no-docs"),this._markdownRenderer=t.createInstance(uf,{editor:e}),this._body=mi(".body"),this._scrollbar=new tk(this._body,{alwaysConsumeMouseWheel:!0}),di(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=di(this._body,mi(".header")),this._close=di(this._header,mi("span"+Rn.asCSSSelector(Ki.close))),this._close.title=S("details.close","Close"),this._type=di(this._header,mi("p.type")),this._docs=di(this._body,mi("p.docs")),this._configureFont(),this._disposables.add(this._editor.onDidChangeConfiguration(i=>{i.hasChanged(50)&&this._configureFont()}))}dispose(){this._disposables.dispose(),this._renderDisposeable.dispose()}_configureFont(){const e=this._editor.getOptions(),t=e.get(50),i=t.getMassagedFontFamily(),n=e.get(120)||t.fontSize,s=e.get(121)||t.lineHeight,r=t.fontWeight,a=`${n}px`,d=`${s}px`;this.domNode.style.fontSize=a,this.domNode.style.lineHeight=`${s/n}`,this.domNode.style.fontWeight=r,this.domNode.style.fontFeatureSettings=t.fontFeatureSettings,this._type.style.fontFamily=i,this._close.style.height=d,this._close.style.width=d}getLayoutInfo(){const e=this._editor.getOption(121)||this._editor.getOption(50).lineHeight,t=this._borderWidth,i=t*2;return{lineHeight:e,borderWidth:t,borderHeight:i,verticalPadding:22,horizontalPadding:14}}renderLoading(){this._type.textContent=S("loading","Loading..."),this._docs.textContent="",this.domNode.classList.remove("no-docs","no-type"),this.layout(this.size.width,this.getLayoutInfo().lineHeight*2),this._onDidChangeContents.fire(this)}renderItem(e,t){var s;this._renderDisposeable.clear();let{detail:i,documentation:n}=e.completion;if(t){let r="";r+=`score: ${e.score[0]}
37
+ `,r+=`prefix: ${e.word??"(no prefix)"}
38
+ `,r+=`word: ${e.completion.filterText?e.completion.filterText+" (filterText)":e.textLabel}
39
+ `,r+=`distance: ${e.distance} (localityBonus-setting)
40
+ `,r+=`index: ${e.idx}, based on ${e.completion.sortText&&`sortText: "${e.completion.sortText}"`||"label"}
41
+ `,r+=`commit_chars: ${(s=e.completion.commitCharacters)==null?void 0:s.join("")}
42
+ `,n=new lo().appendCodeblock("empty",r),i=`Provider: ${e.provider._debugDisplayName}`}if(!t&&!K9(e)){this.clearContents();return}if(this.domNode.classList.remove("no-docs","no-type"),i){const r=i.length>1e5?`${i.substr(0,1e5)}…`:i;this._type.textContent=r,this._type.title=r,Lr(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gmi.test(r))}else Wa(this._type),this._type.title="",Uo(this._type),this.domNode.classList.add("no-type");if(Wa(this._docs),typeof n=="string")this._docs.classList.remove("markdown-docs"),this._docs.textContent=n;else if(n){this._docs.classList.add("markdown-docs"),Wa(this._docs);const r=this._markdownRenderer.render(n);this._docs.appendChild(r.element),this._renderDisposeable.add(r),this._renderDisposeable.add(this._markdownRenderer.onDidRenderAsync(()=>{this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}))}this.domNode.style.userSelect="text",this.domNode.tabIndex=-1,this._close.onmousedown=r=>{r.preventDefault(),r.stopPropagation()},this._close.onclick=r=>{r.preventDefault(),r.stopPropagation(),this._onDidClose.fire()},this._body.scrollTop=0,this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}clearContents(){this.domNode.classList.add("no-docs"),this._type.textContent="",this._docs.textContent=""}get isEmpty(){return this.domNode.classList.contains("no-docs")}get size(){return this._size}layout(e,t){const i=new Zn(e,t);Zn.equals(i,this._size)||(this._size=i,J4(this.domNode,e,t)),this._scrollbar.scanDomNode()}scrollDown(e=8){this._body.scrollTop+=e}scrollUp(e=8){this._body.scrollTop-=e}scrollTop(){this._body.scrollTop=0}scrollBottom(){this._body.scrollTop=this._body.scrollHeight}pageDown(){this.scrollDown(80)}pageUp(){this.scrollUp(80)}set borderWidth(e){this._borderWidth=e}get borderWidth(){return this._borderWidth}};VE=fH([gH(1,sn)],VE);class pH{constructor(e,t){this.widget=e,this._editor=t,this.allowEditorOverflow=!0,this._disposables=new Tt,this._added=!1,this._preferAlignAtTop=!0,this._resizable=new A9,this._resizable.domNode.classList.add("suggest-details-container"),this._resizable.domNode.appendChild(e.domNode),this._resizable.enableSashes(!1,!0,!0,!1);let i,n,s=0,r=0;this._disposables.add(this._resizable.onDidWillResize(()=>{i=this._topLeft,n=this._resizable.size})),this._disposables.add(this._resizable.onDidResize(a=>{if(i&&n){this.widget.layout(a.dimension.width,a.dimension.height);let d=!1;a.west&&(r=n.width-a.dimension.width,d=!0),a.north&&(s=n.height-a.dimension.height,d=!0),d&&this._applyTopLeft({top:i.top+s,left:i.left+r})}a.done&&(i=void 0,n=void 0,s=0,r=0,this._userSize=a.dimension)})),this._disposables.add(this.widget.onDidChangeContents(()=>{this._anchorBox&&this._placeAtAnchor(this._anchorBox,this._userSize??this.widget.size,this._preferAlignAtTop)}))}dispose(){this._resizable.dispose(),this._disposables.dispose(),this.hide()}getId(){return"suggest.details"}getDomNode(){return this._resizable.domNode}getPosition(){return this._topLeft?{preference:this._topLeft}:null}show(){this._added||(this._editor.addOverlayWidget(this),this._added=!0)}hide(e=!1){this._resizable.clearSashHoverState(),this._added&&(this._editor.removeOverlayWidget(this),this._added=!1,this._anchorBox=void 0,this._topLeft=void 0),e&&(this._userSize=void 0,this.widget.clearContents())}placeAtAnchor(e,t){const i=e.getBoundingClientRect();this._anchorBox=i,this._preferAlignAtTop=t,this._placeAtAnchor(this._anchorBox,this._userSize??this.widget.size,t)}_placeAtAnchor(e,t,i){const n=Ip(this.getDomNode().ownerDocument.body),s=this.widget.getLayoutInfo(),r=new Zn(220,2*s.lineHeight),a=e.top,d=(function(){const P=n.width-(e.left+e.width+s.borderWidth+s.horizontalPadding),V=-s.borderWidth+e.left+e.width,j=new Zn(P,n.height-e.top-s.borderHeight-s.verticalPadding),J=j.with(void 0,e.top+e.height-s.borderHeight-s.verticalPadding);return{top:a,left:V,fit:P-t.width,maxSizeTop:j,maxSizeBottom:J,minSize:r.with(Math.min(P,r.width))}})(),u=(function(){const P=e.left-s.borderWidth-s.horizontalPadding,V=Math.max(s.horizontalPadding,e.left-t.width-s.borderWidth),j=new Zn(P,n.height-e.top-s.borderHeight-s.verticalPadding),J=j.with(void 0,e.top+e.height-s.borderHeight-s.verticalPadding);return{top:a,left:V,fit:P-t.width,maxSizeTop:j,maxSizeBottom:J,minSize:r.with(Math.min(P,r.width))}})(),f=(function(){const P=e.left,V=-s.borderWidth+e.top+e.height,j=new Zn(e.width-s.borderHeight,n.height-e.top-e.height-s.verticalPadding);return{top:V,left:P,fit:j.height-t.height,maxSizeBottom:j,maxSizeTop:j,minSize:r.with(j.width)}})(),g=[d,u,f],p=g.find(P=>P.fit>=0)??g.sort((P,V)=>V.fit-P.fit)[0],C=e.top+e.height-s.borderHeight;let b,y=t.height;const w=Math.max(p.maxSizeTop.height,p.maxSizeBottom.height);y>w&&(y=w);let A;i?y<=p.maxSizeTop.height?(b=!0,A=p.maxSizeTop):(b=!1,A=p.maxSizeBottom):y<=p.maxSizeBottom.height?(b=!1,A=p.maxSizeBottom):(b=!0,A=p.maxSizeTop);let{top:I,left:T}=p;!b&&y>e.height&&(I=C-y);const R=this._editor.getDomNode();if(R){const P=R.getBoundingClientRect();I-=P.top,T-=P.left}this._applyTopLeft({left:T,top:I}),this._resizable.enableSashes(!b,p===d,b,p!==d),this._resizable.minSize=p.minSize,this._resizable.maxSize=A,this._resizable.layout(y,Math.min(A.width,t.width)),this.widget.layout(this._resizable.size.width,this._resizable.size.height)}_applyTopLeft(e){this._topLeft=e,this._editor.layoutOverlayWidget(this)}}var Oa;(function(o){o[o.FILE=0]="FILE",o[o.FOLDER=1]="FOLDER",o[o.ROOT_FOLDER=2]="ROOT_FOLDER"})(Oa||(Oa={}));const xH=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function Px(o,e,t,i,n){if(Rn.isThemeIcon(n))return[`codicon-${n.id}`,"predefined-file-icon"];if(jn.isUri(n))return[];const s=i===Oa.ROOT_FOLDER?["rootfolder-icon"]:i===Oa.FOLDER?["folder-icon"]:["file-icon"];if(t){let r;if(t.scheme===Co.data)r=Lm.parseMetaData(t).get(Lm.META_DATA_LABEL);else{const a=t.path.match(xH);a?(r=Tx(a[2].toLowerCase()),a[1]&&s.push(`${Tx(a[1].toLowerCase())}-name-dir-icon`)):r=Tx(t.authority.toLowerCase())}if(i===Oa.ROOT_FOLDER)s.push(`${r}-root-name-folder-icon`);else if(i===Oa.FOLDER)s.push(`${r}-name-folder-icon`);else{if(r){if(s.push(`${r}-name-file-icon`),s.push("name-file-icon"),r.length<=255){const d=r.split(".");for(let u=1;u<d.length;u++)s.push(`${d.slice(u).join(".")}-ext-file-icon`)}s.push("ext-file-icon")}const a=mH(o,e,t);a&&s.push(`${Tx(a)}-lang-file-icon`)}}return s}function mH(o,e,t){if(!t)return null;let i=null;if(t.scheme===Co.data){const s=Lm.parseMetaData(t).get(Lm.META_DATA_MIME);s&&(i=e.getLanguageIdByMimeType(s))}else{const n=o.getModel(t);n&&(i=n.getLanguageId())}return i&&i!==Rg?i:e.guessLanguageIdByFilepathOrFirstLine(t)}function Tx(o){return o.replace(/[\s]/g,"/")}var vH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},LC=function(o,e){return function(t,i){e(t,i,o)}};function EB(o){return`suggest-aria-id:${o}`}const _H=ms("suggest-more-info",Ki.chevronRight,S("suggestMoreInfoIcon","Icon for more information in the suggest widget."));var ta;const bH=new(ta=class{extract(e,t){if(e.textLabel.match(ta._regexStrict))return t[0]=e.textLabel,!0;if(e.completion.detail&&e.completion.detail.match(ta._regexStrict))return t[0]=e.completion.detail,!0;if(e.completion.documentation){const i=typeof e.completion.documentation=="string"?e.completion.documentation:e.completion.documentation.value,n=ta._regexRelaxed.exec(i);if(n&&(n.index===0||n.index+n[0].length===i.length))return t[0]=n[0],!0}return!1}},ta._regexRelaxed=/(#([\da-fA-F]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1|0?\.\d+)\)|(rgb|hsl)\(\s*\d{1,3}%?(\s*,\s*\d{1,3}%?){2}\s*\))/,ta._regexStrict=new RegExp(`^${ta._regexRelaxed.source}$`,"i"),ta);let jE=class{constructor(e,t,i,n){this._editor=e,this._modelService=t,this._languageService=i,this._themeService=n,this._onDidToggleDetails=new rn,this.onDidToggleDetails=this._onDidToggleDetails.event,this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(e){const t=new Tt,i=e;i.classList.add("show-file-icons");const n=di(e,mi(".icon")),s=di(n,mi("span.colorspan")),r=di(e,mi(".contents")),a=di(r,mi(".main")),d=di(a,mi(".icon-label.codicon")),u=di(a,mi("span.left")),f=di(a,mi("span.right")),g=new bA(u,{supportHighlights:!0,supportIcons:!0});t.add(g);const p=di(u,mi("span.signature-label")),C=di(u,mi("span.qualifier-label")),b=di(f,mi("span.details-label")),y=di(f,mi("span.readMore"+Rn.asCSSSelector(_H)));return y.title=S("readMore","Read More"),{root:i,left:u,right:f,icon:n,colorspan:s,iconLabel:g,iconContainer:d,parametersLabel:p,qualifierLabel:C,detailsLabel:b,readMore:y,disposables:t,configureFont:()=>{const A=this._editor.getOptions(),I=A.get(50),T=I.getMassagedFontFamily(),R=I.fontFeatureSettings,P=A.get(120)||I.fontSize,V=A.get(121)||I.lineHeight,j=I.fontWeight,J=I.letterSpacing,ae=`${P}px`,fe=`${V}px`,X=`${J}px`;i.style.fontSize=ae,i.style.fontWeight=j,i.style.letterSpacing=X,a.style.fontFamily=T,a.style.fontFeatureSettings=R,a.style.lineHeight=fe,n.style.height=fe,n.style.width=fe,y.style.height=fe,y.style.width=fe}}}renderElement(e,t,i){i.configureFont();const{completion:n}=e;i.root.id=EB(t),i.colorspan.style.backgroundColor="";const s={labelEscapeNewLines:!0,matches:Z_(e.score)},r=[];if(n.kind===19&&bH.extract(e,r))i.icon.className="icon customcolor",i.iconContainer.className="icon hide",i.colorspan.style.backgroundColor=r[0];else if(n.kind===20&&this._themeService.getFileIconTheme().hasFileIcons){i.icon.className="icon hide",i.iconContainer.className="icon hide";const a=Px(this._modelService,this._languageService,jn.from({scheme:"fake",path:e.textLabel}),Oa.FILE),d=Px(this._modelService,this._languageService,jn.from({scheme:"fake",path:n.detail}),Oa.FILE);s.extraClasses=a.length>d.length?a:d}else n.kind===23&&this._themeService.getFileIconTheme().hasFolderIcons?(i.icon.className="icon hide",i.iconContainer.className="icon hide",s.extraClasses=[Px(this._modelService,this._languageService,jn.from({scheme:"fake",path:e.textLabel}),Oa.FOLDER),Px(this._modelService,this._languageService,jn.from({scheme:"fake",path:n.detail}),Oa.FOLDER)].flat()):(i.icon.className="icon hide",i.iconContainer.className="",i.iconContainer.classList.add("suggest-icon",...Rn.asClassNameArray(Gw.toIcon(n.kind))));n.tags&&n.tags.indexOf(1)>=0&&(s.extraClasses=(s.extraClasses||[]).concat(["deprecated"]),s.matches=[]),i.iconLabel.setLabel(e.textLabel,void 0,s),typeof n.label=="string"?(i.parametersLabel.textContent="",i.detailsLabel.textContent=IC(n.detail||""),i.root.classList.add("string-label")):(i.parametersLabel.textContent=IC(n.label.detail||""),i.detailsLabel.textContent=IC(n.label.description||""),i.root.classList.remove("string-label")),this._editor.getOption(119).showInlineDetails?Lr(i.detailsLabel):Uo(i.detailsLabel),K9(e)?(i.right.classList.add("can-expand-details"),Lr(i.readMore),i.readMore.onmousedown=a=>{a.stopPropagation(),a.preventDefault()},i.readMore.onclick=a=>{a.stopPropagation(),a.preventDefault(),this._onDidToggleDetails.fire()}):(i.right.classList.remove("can-expand-details"),Uo(i.readMore),i.readMore.onmousedown=null,i.readMore.onclick=null)}disposeTemplate(e){e.disposables.dispose()}};jE=vH([LC(1,vo),LC(2,ha),LC(3,Wr)],jE);function IC(o){return o.replace(/\r\n|\r|\n/g,"")}var CH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Mx=function(o,e){return function(t,i){e(t,i,o)}},Wh;vi("editorSuggestWidget.background",ik,S("editorSuggestWidgetBackground","Background color of the suggest widget."));vi("editorSuggestWidget.border",eL,S("editorSuggestWidgetBorder","Border color of the suggest widget."));const EH=vi("editorSuggestWidget.foreground",Mp,S("editorSuggestWidgetForeground","Foreground color of the suggest widget."));vi("editorSuggestWidget.selectedForeground",nk,S("editorSuggestWidgetSelectedForeground","Foreground color of the selected entry in the suggest widget."));vi("editorSuggestWidget.selectedIconForeground",tL,S("editorSuggestWidgetSelectedIconForeground","Icon foreground color of the selected entry in the suggest widget."));const yH=vi("editorSuggestWidget.selectedBackground",sk,S("editorSuggestWidgetSelectedBackground","Background color of the selected entry in the suggest widget."));vi("editorSuggestWidget.highlightForeground",ok,S("editorSuggestWidgetHighlightForeground","Color of the match highlights in the suggest widget."));vi("editorSuggestWidget.focusHighlightForeground",iL,S("editorSuggestWidgetFocusHighlightForeground","Color of the match highlights in the suggest widget when an item is focused."));vi("editorSuggestWidgetStatus.foreground",za(EH,.5),S("editorSuggestWidgetStatusForeground","Foreground color of the suggest widget status."));class wH{constructor(e,t){this._service=e,this._key=`suggestWidget.size/${t.getEditorType()}/${t instanceof Hr}`}restore(){const e=this._service.get(this._key,0)??"";try{const t=JSON.parse(e);if(Zn.is(t))return Zn.lift(t)}catch{}}store(e){this._service.store(this._key,JSON.stringify(e),0,1)}reset(){this._service.remove(this._key,0)}}var Fc;let $E=(Fc=class{constructor(e,t,i,n,s){this.editor=e,this._storageService=t,this._state=0,this._isAuto=!1,this._pendingLayout=new er,this._pendingShowDetails=new er,this._ignoreFocusEvents=!1,this._forceRenderingAbove=!1,this._explainMode=!1,this._showTimeout=new Dp,this._disposables=new Tt,this._onDidSelect=new GS,this._onDidFocus=new GS,this._onDidHide=new rn,this._onDidShow=new rn,this.onDidSelect=this._onDidSelect.event,this.onDidFocus=this._onDidFocus.event,this.onDidHide=this._onDidHide.event,this.onDidShow=this._onDidShow.event,this._onDetailsKeydown=new rn,this.onDetailsKeyDown=this._onDetailsKeydown.event,this.element=new A9,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new SH(this,e),this._persistedSize=new wH(t,e);class r{constructor(C,b,y=!1,w=!1){this.persistedSize=C,this.currentSize=b,this.persistHeight=y,this.persistWidth=w}}let a;this._disposables.add(this.element.onDidWillResize(()=>{this._contentWidget.lockPreference(),a=new r(this._persistedSize.restore(),this.element.size)})),this._disposables.add(this.element.onDidResize(p=>{var C,b;if(this._resize(p.dimension.width,p.dimension.height),a&&(a.persistHeight=a.persistHeight||!!p.north||!!p.south,a.persistWidth=a.persistWidth||!!p.east||!!p.west),!!p.done){if(a){const{itemHeight:y,defaultSize:w}=this.getLayoutInfo(),A=Math.round(y/2);let{width:I,height:T}=this.element.size;(!a.persistHeight||Math.abs(a.currentSize.height-T)<=A)&&(T=((C=a.persistedSize)==null?void 0:C.height)??w.height),(!a.persistWidth||Math.abs(a.currentSize.width-I)<=A)&&(I=((b=a.persistedSize)==null?void 0:b.width)??w.width),this._persistedSize.store(new Zn(I,T))}this._contentWidget.unlockPreference(),a=void 0}})),this._messageElement=di(this.element.domNode,mi(".message")),this._listElement=di(this.element.domNode,mi(".tree"));const d=this._disposables.add(s.createInstance(VE,this.editor));d.onDidClose(this.toggleDetails,this,this._disposables),this._details=new pH(d,this.editor);const u=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(119).showIcons);u();const f=s.createInstance(jE,this.editor);this._disposables.add(f),this._disposables.add(f.onDidToggleDetails(()=>this.toggleDetails())),this._list=new Tw("SuggestWidget",this._listElement,{getHeight:p=>this.getLayoutInfo().itemHeight,getTemplateId:p=>"suggestion"},[f],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>"option",getWidgetAriaLabel:()=>S("suggest","Suggest"),getWidgetRole:()=>"listbox",getAriaLabel:p=>{let C=p.textLabel;if(typeof p.completion.label!="string"){const{detail:A,description:I}=p.completion.label;A&&I?C=S("label.full","{0} {1}, {2}",C,A,I):A?C=S("label.detail","{0} {1}",C,A):I&&(C=S("label.desc","{0}, {1}",C,I))}if(!p.isResolved||!this._isDetailsVisible())return C;const{documentation:b,detail:y}=p.completion,w=Uw("{0}{1}",y||"",b?typeof b=="string"?b:b.value:"");return S("ariaCurrenttSuggestionReadDetails","{0}, docs: {1}",C,w)}}}),this._list.style(rk({listInactiveFocusBackground:yH,listInactiveFocusOutline:Bu})),this._status=s.createInstance(zE,this.element.domNode,bc);const g=()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(119).showStatusBar);g(),this._disposables.add(n.onDidColorThemeChange(p=>this._onThemeChange(p))),this._onThemeChange(n.getColorTheme()),this._disposables.add(this._list.onMouseDown(p=>this._onListMouseDownOrTap(p))),this._disposables.add(this._list.onTap(p=>this._onListMouseDownOrTap(p))),this._disposables.add(this._list.onDidChangeSelection(p=>this._onListSelection(p))),this._disposables.add(this._list.onDidChangeFocus(p=>this._onListFocus(p))),this._disposables.add(this.editor.onDidChangeCursorSelection(()=>this._onCursorSelectionChanged())),this._disposables.add(this.editor.onDidChangeConfiguration(p=>{p.hasChanged(119)&&(g(),u()),this._completionModel&&(p.hasChanged(50)||p.hasChanged(120)||p.hasChanged(121))&&this._list.splice(0,this._list.length,this._completionModel.items)})),this._ctxSuggestWidgetVisible=Gi.Visible.bindTo(i),this._ctxSuggestWidgetDetailsVisible=Gi.DetailsVisible.bindTo(i),this._ctxSuggestWidgetMultipleSuggestions=Gi.MultipleSuggestions.bindTo(i),this._ctxSuggestWidgetHasFocusedSuggestion=Gi.HasFocusedSuggestion.bindTo(i),this._disposables.add(Sl(this._details.widget.domNode,"keydown",p=>{this._onDetailsKeydown.fire(p)})),this._disposables.add(this.editor.onMouseDown(p=>this._onEditorMouseDown(p)))}dispose(){var e;this._details.widget.dispose(),this._details.dispose(),this._list.dispose(),this._status.dispose(),this._disposables.dispose(),(e=this._loadingTimeout)==null||e.dispose(),this._pendingLayout.dispose(),this._pendingShowDetails.dispose(),this._showTimeout.dispose(),this._contentWidget.dispose(),this.element.dispose()}_onEditorMouseDown(e){this._details.widget.domNode.contains(e.target.element)?this._details.widget.domNode.focus():this.element.domNode.contains(e.target.element)&&this.editor.focus()}_onCursorSelectionChanged(){this._state!==0&&this._contentWidget.layout()}_onListMouseDownOrTap(e){typeof e.element>"u"||typeof e.index>"u"||(e.browserEvent.preventDefault(),e.browserEvent.stopPropagation(),this._select(e.element,e.index))}_onListSelection(e){e.elements.length&&this._select(e.elements[0],e.indexes[0])}_select(e,t){const i=this._completionModel;i&&(this._onDidSelect.fire({item:e,index:t,model:i}),this.editor.focus())}_onThemeChange(e){this._details.widget.borderWidth=Fg(e.type)?2:1}_onListFocus(e){var n;if(this._ignoreFocusEvents)return;if(!e.elements.length){this._currentSuggestionDetails&&(this._currentSuggestionDetails.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=void 0),this.editor.setAriaOptions({activeDescendant:void 0}),this._ctxSuggestWidgetHasFocusedSuggestion.set(!1);return}if(!this._completionModel)return;this._ctxSuggestWidgetHasFocusedSuggestion.set(!0);const t=e.elements[0],i=e.indexes[0];t!==this._focusedItem&&((n=this._currentSuggestionDetails)==null||n.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=t,this._list.reveal(i),this._currentSuggestionDetails=qs(async s=>{const r=kg(()=>{this._isDetailsVisible()&&this.showDetails(!0)},250),a=s.onCancellationRequested(()=>r.dispose());try{return await t.resolve(s)}finally{r.dispose(),a.dispose()}}),this._currentSuggestionDetails.then(()=>{i>=this._list.length||t!==this._list.element(i)||(this._ignoreFocusEvents=!0,this._list.splice(i,1,[t]),this._list.setFocus([i]),this._ignoreFocusEvents=!1,this._isDetailsVisible()?this.showDetails(!1):this.element.domNode.classList.remove("docs-side"),this.editor.setAriaOptions({activeDescendant:EB(i)}))}).catch(qn)),this._onDidFocus.fire({item:t,index:i,model:this._completionModel})}_setState(e){if(this._state!==e)switch(this._state=e,this.element.domNode.classList.toggle("frozen",e===4),this.element.domNode.classList.remove("message"),e){case 0:Uo(this._messageElement,this._listElement,this._status.element),this._details.hide(!0),this._status.hide(),this._contentWidget.hide(),this._ctxSuggestWidgetVisible.reset(),this._ctxSuggestWidgetMultipleSuggestions.reset(),this._ctxSuggestWidgetHasFocusedSuggestion.reset(),this._showTimeout.cancel(),this.element.domNode.classList.remove("visible"),this._list.splice(0,this._list.length),this._focusedItem=void 0,this._cappedHeight=void 0,this._explainMode=!1;break;case 1:this.element.domNode.classList.add("message"),this._messageElement.textContent=Wh.LOADING_MESSAGE,Uo(this._listElement,this._status.element),Lr(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,P0(Wh.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=Wh.NO_SUGGESTIONS_MESSAGE,Uo(this._listElement,this._status.element),Lr(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,P0(Wh.NO_SUGGESTIONS_MESSAGE);break;case 3:Uo(this._messageElement),Lr(this._listElement,this._status.element),this._show();break;case 4:Uo(this._messageElement),Lr(this._listElement,this._status.element),this._show();break;case 5:Uo(this._messageElement),Lr(this._listElement,this._status.element),this._details.show(),this._show();break}}_show(){this._status.show(),this._contentWidget.show(),this._layout(this._persistedSize.restore()),this._ctxSuggestWidgetVisible.set(!0),this._showTimeout.cancelAndSet(()=>{this.element.domNode.classList.add("visible"),this._onDidShow.fire(this)},100)}showTriggered(e,t){this._state===0&&(this._contentWidget.setPosition(this.editor.getPosition()),this._isAuto=!!e,this._isAuto||(this._loadingTimeout=kg(()=>this._setState(1),t)))}showSuggestions(e,t,i,n,s){var d,u;if(this._contentWidget.setPosition(this.editor.getPosition()),(d=this._loadingTimeout)==null||d.dispose(),(u=this._currentSuggestionDetails)==null||u.cancel(),this._currentSuggestionDetails=void 0,this._completionModel!==e&&(this._completionModel=e),i&&this._state!==2&&this._state!==0){this._setState(4);return}const r=this._completionModel.items.length,a=r===0;if(this._ctxSuggestWidgetMultipleSuggestions.set(r>1),a){this._setState(n?0:2),this._completionModel=void 0;return}this._focusedItem=void 0,this._onDidFocus.pause(),this._onDidSelect.pause();try{this._list.splice(0,this._list.length,this._completionModel.items),this._setState(i?4:3),this._list.reveal(t,0),this._list.setFocus(s?[]:[t])}finally{this._onDidFocus.resume(),this._onDidSelect.resume()}this._pendingLayout.value=KS(Id(this.element.domNode),()=>{this._pendingLayout.clear(),this._layout(this.element.size),this._details.widget.domNode.classList.remove("focused")})}focusSelected(){this._list.length>0&&this._list.setFocus([0])}selectNextPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageDown(),!0;case 1:return!this._isAuto;default:return this._list.focusNextPage(),!0}}selectNext(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusNext(1,!0),!0}}selectLast(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollBottom(),!0;case 1:return!this._isAuto;default:return this._list.focusLast(),!0}}selectPreviousPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageUp(),!0;case 1:return!this._isAuto;default:return this._list.focusPreviousPage(),!0}}selectPrevious(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusPrevious(1,!0),!1}}selectFirst(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollTop(),!0;case 1:return!this._isAuto;default:return this._list.focusFirst(),!0}}getFocusedItem(){if(this._state!==0&&this._state!==2&&this._state!==1&&this._completionModel&&this._list.getFocus().length>0)return{item:this._list.getFocusedElements()[0],index:this._list.getFocus()[0],model:this._completionModel}}toggleDetailsFocus(){this._state===5?(this._setState(3),this._details.widget.domNode.classList.remove("focused")):this._state===3&&this._isDetailsVisible()&&(this._setState(5),this._details.widget.domNode.classList.add("focused"))}toggleDetails(){this._isDetailsVisible()?(this._pendingShowDetails.clear(),this._ctxSuggestWidgetDetailsVisible.set(!1),this._setDetailsVisible(!1),this._details.hide(),this.element.domNode.classList.remove("shows-details")):(K9(this._list.getFocusedElements()[0])||this._explainMode)&&(this._state===3||this._state===5||this._state===4)&&(this._ctxSuggestWidgetDetailsVisible.set(!0),this._setDetailsVisible(!0),this.showDetails(!1))}showDetails(e){this._pendingShowDetails.value=KS(Id(this.element.domNode),()=>{this._pendingShowDetails.clear(),this._details.show(),e?this._details.widget.renderLoading():this._details.widget.renderItem(this._list.getFocusedElements()[0],this._explainMode),this._details.widget.isEmpty?this._details.hide():(this._positionDetails(),this.element.domNode.classList.add("shows-details")),this.editor.focus()})}toggleExplainMode(){this._list.getFocusedElements()[0]&&(this._explainMode=!this._explainMode,this._isDetailsVisible()?this.showDetails(!1):this.toggleDetails())}resetPersistedSize(){this._persistedSize.reset()}hideWidget(){var i;this._pendingLayout.clear(),this._pendingShowDetails.clear(),(i=this._loadingTimeout)==null||i.dispose(),this._setState(0),this._onDidHide.fire(this),this.element.clearSashHoverState();const e=this._persistedSize.restore(),t=Math.ceil(this.getLayoutInfo().itemHeight*4.3);e&&e.height<t&&this._persistedSize.store(e.with(void 0,t))}isFrozen(){return this._state===4}_afterRender(e){if(e===null){this._isDetailsVisible()&&this._details.hide();return}this._state===2||this._state===1||(this._isDetailsVisible()&&!this._details.widget.isEmpty&&this._details.show(),this._positionDetails())}_layout(e){var r,a;if(!this.editor.hasModel()||!this.editor.getDomNode())return;const t=Ip(this.element.domNode.ownerDocument.body),i=this.getLayoutInfo();e||(e=i.defaultSize);let n=e.height,s=e.width;if(this._status.element.style.height=`${i.itemHeight}px`,this._state===2||this._state===1)n=i.itemHeight+i.borderHeight,s=i.defaultSize.width/2,this.element.enableSashes(!1,!1,!1,!1),this.element.minSize=this.element.maxSize=new Zn(s,n),this._contentWidget.setPreference(2);else{const d=t.width-i.borderHeight-2*i.horizontalPadding;s>d&&(s=d);const u=this._completionModel?this._completionModel.stats.pLabelLen*i.typicalHalfwidthCharacterWidth:s,f=i.statusBarHeight+this._list.contentHeight+i.borderHeight,g=i.itemHeight+i.statusBarHeight,p=yo(this.editor.getDomNode()),C=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),b=p.top+C.top+C.height,y=Math.min(t.height-b-i.verticalPadding,f),w=p.top+C.top-i.verticalPadding,A=Math.min(w,f);let I=Math.min(Math.max(A,y)+i.borderHeight,f);n===((r=this._cappedHeight)==null?void 0:r.capped)&&(n=this._cappedHeight.wanted),n<g&&(n=g),n>I&&(n=I),n>y||this._forceRenderingAbove&&w>150?(this._contentWidget.setPreference(1),this.element.enableSashes(!0,!0,!1,!1),I=A):(this._contentWidget.setPreference(2),this.element.enableSashes(!1,!0,!0,!1),I=y),this.element.preferredSize=new Zn(u,i.defaultSize.height),this.element.maxSize=new Zn(d,I),this.element.minSize=new Zn(220,g),this._cappedHeight=n===f?{wanted:((a=this._cappedHeight)==null?void 0:a.wanted)??e.height,capped:n}:void 0}this._resize(s,n)}_resize(e,t){const{width:i,height:n}=this.element.maxSize;e=Math.min(i,e),t=Math.min(n,t);const{statusBarHeight:s}=this.getLayoutInfo();this._list.layout(t-s,e),this._listElement.style.height=`${t-s}px`,this.element.layout(t,e),this._contentWidget.layout(),this._positionDetails()}_positionDetails(){var e;this._isDetailsVisible()&&this._details.placeAtAnchor(this.element.domNode,((e=this._contentWidget.getPosition())==null?void 0:e.preference[0])===2)}getLayoutInfo(){const e=this.editor.getOption(50),t=nL(this.editor.getOption(121)||e.lineHeight,8,1e3),i=!this.editor.getOption(119).showStatusBar||this._state===2||this._state===1?0:t,n=this._details.widget.borderWidth,s=2*n;return{itemHeight:t,statusBarHeight:i,borderWidth:n,borderHeight:s,typicalHalfwidthCharacterWidth:e.typicalHalfwidthCharacterWidth,verticalPadding:22,horizontalPadding:14,defaultSize:new Zn(430,i+12*t+s)}}_isDetailsVisible(){return this._storageService.getBoolean("expandSuggestionDocs",0,!1)}_setDetailsVisible(e){this._storageService.store("expandSuggestionDocs",e,0,0)}forceRenderingAbove(){this._forceRenderingAbove||(this._forceRenderingAbove=!0,this._layout(this._persistedSize.restore()))}stopForceRenderingAbove(){this._forceRenderingAbove=!1}},Wh=Fc,Fc.LOADING_MESSAGE=S("suggestWidget.loading","Loading..."),Fc.NO_SUGGESTIONS_MESSAGE=S("suggestWidget.noSuggestions","No suggestions."),Fc);$E=Wh=CH([Mx(1,Gc),Mx(2,Fn),Mx(3,Wr),Mx(4,sn)],$E);class SH{constructor(e,t){this._widget=e,this._editor=t,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._preferenceLocked=!1,this._added=!1,this._hidden=!1}dispose(){this._added&&(this._added=!1,this._editor.removeContentWidget(this))}getId(){return"editor.widget.suggestWidget"}getDomNode(){return this._widget.element.domNode}show(){this._hidden=!1,this._added||(this._added=!0,this._editor.addContentWidget(this))}hide(){this._hidden||(this._hidden=!0,this.layout())}layout(){this._editor.layoutContentWidget(this)}getPosition(){return this._hidden||!this._position||!this._preference?null:{position:this._position,preference:[this._preference]}}beforeRender(){const{height:e,width:t}=this._widget.element.size,{borderWidth:i,horizontalPadding:n}=this._widget.getLayoutInfo();return new Zn(t+2*i+n,e+2*i)}afterRender(e){this._widget._afterRender(e)}setPreference(e){this._preferenceLocked||(this._preference=e)}lockPreference(){this._preferenceLocked=!0}unlockPreference(){this._preferenceLocked=!1}setPosition(e){this._position=e}}var DH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ah=function(o,e){return function(t,i){e(t,i,o)}},UE;class AH{constructor(e,t){if(this._model=e,this._position=t,this._decorationOptions=vn.register({description:"suggest-line-suffix",stickiness:1}),e.getLineMaxColumn(t.lineNumber)!==t.column){const n=e.getOffsetAt(t),s=e.getPositionAt(n+1);e.changeDecorations(r=>{this._marker&&r.removeDecoration(this._marker),this._marker=r.addDecoration(Q.fromPositions(t,s),this._decorationOptions)})}}dispose(){this._marker&&!this._model.isDisposed()&&this._model.changeDecorations(e=>{e.removeDecoration(this._marker),this._marker=void 0})}delta(e){if(this._model.isDisposed()||this._position.lineNumber!==e.lineNumber)return 0;if(this._marker){const t=this._model.getDecorationRange(this._marker);return this._model.getOffsetAt(t.getStartPosition())-this._model.getOffsetAt(e)}else return this._model.getLineMaxColumn(e.lineNumber)-e.column}}var cu;let Pr=(cu=class{static get(e){return e.getContribution(UE.ID)}constructor(e,t,i,n,s,r,a){this._memoryService=t,this._commandService=i,this._contextKeyService=n,this._instantiationService=s,this._logService=r,this._telemetryService=a,this._lineSuffix=new er,this._toDispose=new Tt,this._selectors=new kH(g=>g.priority),this._onWillInsertSuggestItem=new rn,this.onWillInsertSuggestItem=this._onWillInsertSuggestItem.event,this.editor=e,this.model=s.createInstance(mv,this.editor),this._selectors.register({priority:0,select:(g,p,C)=>this._memoryService.select(g,p,C)});const d=Gi.InsertMode.bindTo(n);d.set(e.getOption(119).insertMode),this._toDispose.add(this.model.onDidTrigger(()=>d.set(e.getOption(119).insertMode))),this.widget=this._toDispose.add(new tC(Id(e.getDomNode()),()=>{const g=this._instantiationService.createInstance($E,this.editor);this._toDispose.add(g),this._toDispose.add(g.onDidSelect(w=>this._insertSuggestion(w,0),this));const p=new lH(this.editor,g,this.model,w=>this._insertSuggestion(w,2));this._toDispose.add(p);const C=Gi.MakesTextEdit.bindTo(this._contextKeyService),b=Gi.HasInsertAndReplaceRange.bindTo(this._contextKeyService),y=Gi.CanResolve.bindTo(this._contextKeyService);return this._toDispose.add(is(()=>{C.reset(),b.reset(),y.reset()})),this._toDispose.add(g.onDidFocus(({item:w})=>{const A=this.editor.getPosition(),I=w.editStart.column,T=A.column;let R=!0;this.editor.getOption(1)==="smart"&&this.model.state===2&&!w.completion.additionalTextEdits&&!(w.completion.insertTextRules&4)&&T-I===w.completion.insertText.length&&(R=this.editor.getModel().getValueInRange({startLineNumber:A.lineNumber,startColumn:I,endLineNumber:A.lineNumber,endColumn:T})!==w.completion.insertText),C.set(R),b.set(!Bi.equals(w.editInsertEnd,w.editReplaceEnd)),y.set(!!w.provider.resolveCompletionItem||!!w.completion.documentation||w.completion.detail!==w.completion.label)})),this._toDispose.add(g.onDetailsKeyDown(w=>{if(w.toKeyCodeChord().equals(new ZS(!0,!1,!1,!1,33))||$a&&w.toKeyCodeChord().equals(new ZS(!1,!1,!1,!0,33))){w.stopPropagation();return}w.toKeyCodeChord().isModifierKey()||this.editor.focus()})),g})),this._overtypingCapturer=this._toDispose.add(new tC(Id(e.getDomNode()),()=>this._toDispose.add(new WE(this.editor,this.model)))),this._alternatives=this._toDispose.add(new tC(Id(e.getDomNode()),()=>this._toDispose.add(new ef(this.editor,this._contextKeyService)))),this._toDispose.add(s.createInstance(gv,e)),this._toDispose.add(this.model.onDidTrigger(g=>{this.widget.value.showTriggered(g.auto,g.shy?250:50),this._lineSuffix.value=new AH(this.editor.getModel(),g.position)})),this._toDispose.add(this.model.onDidSuggest(g=>{if(g.triggerOptions.shy)return;let p=-1;for(const b of this._selectors.itemsOrderedByPriorityDesc)if(p=b.select(this.editor.getModel(),this.editor.getPosition(),g.completionModel.items),p!==-1)break;if(p===-1&&(p=0),this.model.state===0)return;let C=!1;if(g.triggerOptions.auto){const b=this.editor.getOption(119);b.selectionMode==="never"||b.selectionMode==="always"?C=b.selectionMode==="never":b.selectionMode==="whenTriggerCharacter"?C=g.triggerOptions.triggerKind!==1:b.selectionMode==="whenQuickSuggestion"&&(C=g.triggerOptions.triggerKind===1&&!g.triggerOptions.refilter)}this.widget.value.showSuggestions(g.completionModel,p,g.isFrozen,g.triggerOptions.auto,C)})),this._toDispose.add(this.model.onDidCancel(g=>{g.retrigger||this.widget.value.hideWidget()})),this._toDispose.add(this.editor.onDidBlurEditorWidget(()=>{this.model.cancel(),this.model.clear()}));const u=Gi.AcceptSuggestionsOnEnter.bindTo(n),f=()=>{const g=this.editor.getOption(1);u.set(g==="on"||g==="smart")};this._toDispose.add(this.editor.onDidChangeConfiguration(()=>f())),f()}dispose(){this._alternatives.dispose(),this._toDispose.dispose(),this.widget.dispose(),this.model.dispose(),this._lineSuffix.dispose(),this._onWillInsertSuggestItem.dispose()}_insertSuggestion(e,t){if(!e||!e.item){this._alternatives.value.reset(),this.model.cancel(),this.model.clear();return}if(!this.editor.hasModel())return;const i=xo.get(this.editor);if(!i)return;this._onWillInsertSuggestItem.fire({item:e.item});const n=this.editor.getModel(),s=n.getAlternativeVersionId(),{item:r}=e,a=[],d=new Gs;t&1||this.editor.pushUndoStop();const u=this.getOverwriteInfo(r,!!(t&8));this._memoryService.memorize(n,this.editor.getPosition(),r);const f=r.isResolved;let g=-1,p=-1;if(Array.isArray(r.completion.additionalTextEdits)){this.model.cancel();const b=T0.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",r.completion.additionalTextEdits.map(y=>{let w=Q.lift(y.range);if(w.startLineNumber===r.position.lineNumber&&w.startColumn>r.position.column){const A=this.editor.getPosition().column-r.position.column,I=A,T=Q.spansMultipleLines(w)?0:A;w=new Q(w.startLineNumber,w.startColumn+I,w.endLineNumber,w.endColumn+T)}return cs.replaceMove(w,y.text)})),b.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!f){const b=new Oo;let y;const w=n.onDidChangeContent(R=>{if(R.isFlush){d.cancel(),w.dispose();return}for(const P of R.changes){const V=Q.getEndPosition(P.range);(!y||Bi.isBefore(V,y))&&(y=V)}}),A=t;t|=2;let I=!1;const T=this.editor.onWillType(()=>{T.dispose(),I=!0,A&2||this.editor.pushUndoStop()});a.push(r.resolve(d.token).then(()=>{if(!r.completion.additionalTextEdits||d.token.isCancellationRequested)return;if(y&&r.completion.additionalTextEdits.some(P=>Bi.isBefore(y,Q.getStartPosition(P.range))))return!1;I&&this.editor.pushUndoStop();const R=T0.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map(P=>cs.replaceMove(Q.lift(P.range),P.text))),R.restoreRelativeVerticalPositionOfCursor(this.editor),(I||!(A&2))&&this.editor.pushUndoStop(),!0}).then(R=>{this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)",b.elapsed(),R),p=R===!0?1:R===!1?0:-2}).finally(()=>{w.dispose(),T.dispose()}))}let{insertText:C}=r.completion;if(r.completion.insertTextRules&4||(C=Nu.escape(C)),this.model.cancel(),i.insert(C,{overwriteBefore:u.overwriteBefore,overwriteAfter:u.overwriteAfter,undoStopBefore:!1,undoStopAfter:!1,adjustWhitespace:!(r.completion.insertTextRules&1),clipboardText:e.model.clipboardText,overtypingCapturer:this._overtypingCapturer.value}),t&2||this.editor.pushUndoStop(),r.completion.command)if(r.completion.command.id===vv.id)this.model.trigger({auto:!0,retrigger:!0});else{const b=new Oo;a.push(this._commandService.executeCommand(r.completion.command.id,...r.completion.command.arguments?[...r.completion.command.arguments]:[]).catch(y=>{r.completion.extensionId?bs(y):qn(y)}).finally(()=>{g=b.elapsed()}))}t&4&&this._alternatives.value.set(e,b=>{for(d.cancel();n.canUndo();){s!==n.getAlternativeVersionId()&&n.undo(),this._insertSuggestion(b,3|(t&8?8:0));break}}),this._alertCompletionItem(r),Promise.all(a).finally(()=>{this._reportSuggestionAcceptedTelemetry(r,n,f,g,p,e.index,e.model.items),this.model.clear(),d.dispose()})}_reportSuggestionAcceptedTelemetry(e,t,i,n,s,r,a){var p;if(Math.floor(Math.random()*100)===0)return;const d=new Map;for(let C=0;C<Math.min(30,a.length);C++){const b=a[C].textLabel;d.has(b)?d.get(b).push(C):d.set(b,[C])}const u=d.get(e.textLabel),g=u&&u.length>1?u[0]:-1;this._telemetryService.publicLog2("suggest.acceptedSuggestion",{extensionId:((p=e.extensionId)==null?void 0:p.value)??"unknown",providerId:e.provider._debugDisplayName??"unknown",kind:e.completion.kind,basenameHash:RA(Ua(t.uri)).toString(16),languageId:t.getLanguageId(),fileExtension:sL(t.uri),resolveInfo:e.provider.resolveCompletionItem?i?1:0:-1,resolveDuration:e.resolveDuration,commandDuration:n,additionalEditsAsync:s,index:r,firstIndex:g})}getOverwriteInfo(e,t){Pn(this.editor.hasModel());let i=this.editor.getOption(119).insertMode==="replace";t&&(i=!i);const n=e.position.column-e.editStart.column,s=(i?e.editReplaceEnd.column:e.editInsertEnd.column)-e.position.column,r=this.editor.getPosition().column-e.position.column,a=this._lineSuffix.value?this._lineSuffix.value.delta(this.editor.getPosition()):0;return{overwriteBefore:n+r,overwriteAfter:s+a}}_alertCompletionItem(e){if(Yo(e.completion.additionalTextEdits)){const t=S("aria.alert.snippet","Accepting '{0}' made {1} additional edits",e.textLabel,e.completion.additionalTextEdits.length);Nr(t)}}triggerSuggest(e,t,i){this.editor.hasModel()&&(this.model.trigger({auto:t??!1,completionOptions:{providerFilter:e,kindFilter:i?new Set:void 0}}),this.editor.revealPosition(this.editor.getPosition(),0),this.editor.focus())}triggerSuggestAndAcceptBest(e){if(!this.editor.hasModel())return;const t=this.editor.getPosition(),i=()=>{t.equals(this.editor.getPosition())&&this._commandService.executeCommand(e.fallback)},n=s=>{if(s.completion.insertTextRules&4||s.completion.additionalTextEdits)return!0;const r=this.editor.getPosition(),a=s.editStart.column,d=r.column;return d-a!==s.completion.insertText.length?!0:this.editor.getModel().getValueInRange({startLineNumber:r.lineNumber,startColumn:a,endLineNumber:r.lineNumber,endColumn:d})!==s.completion.insertText};Ts.once(this.model.onDidTrigger)(s=>{const r=[];Ts.any(this.model.onDidTrigger,this.model.onDidCancel)(()=>{uo(r),i()},void 0,r),this.model.onDidSuggest(({completionModel:a})=>{if(uo(r),a.items.length===0){i();return}const d=this._memoryService.select(this.editor.getModel(),this.editor.getPosition(),a.items),u=a.items[d];if(!n(u)){i();return}this.editor.pushUndoStop(),this._insertSuggestion({index:d,item:u,model:a},7)},void 0,r)}),this.model.trigger({auto:!1,shy:!0}),this.editor.revealPosition(t,0),this.editor.focus()}acceptSelectedSuggestion(e,t){const i=this.widget.value.getFocusedItem();let n=0;e&&(n|=4),t&&(n|=8),this._insertSuggestion(i,n)}acceptNextSuggestion(){this._alternatives.value.next()}acceptPrevSuggestion(){this._alternatives.value.prev()}cancelSuggestWidget(){this.model.cancel(),this.model.clear(),this.widget.value.hideWidget()}focusSuggestion(){this.widget.value.focusSelected()}selectNextSuggestion(){this.widget.value.selectNext()}selectNextPageSuggestion(){this.widget.value.selectNextPage()}selectLastSuggestion(){this.widget.value.selectLast()}selectPrevSuggestion(){this.widget.value.selectPrevious()}selectPrevPageSuggestion(){this.widget.value.selectPreviousPage()}selectFirstSuggestion(){this.widget.value.selectFirst()}toggleSuggestionDetails(){this.widget.value.toggleDetails()}toggleExplainMode(){this.widget.value.toggleExplainMode()}toggleSuggestionFocus(){this.widget.value.toggleDetailsFocus()}resetWidgetSize(){this.widget.value.resetPersistedSize()}forceRenderingAbove(){this.widget.value.forceRenderingAbove()}stopForceRenderingAbove(){this.widget.isInitialized&&this.widget.value.stopForceRenderingAbove()}registerSelector(e){return this._selectors.register(e)}},UE=cu,cu.ID="editor.contrib.suggestController",cu);Pr=UE=DH([Ah(1,Sb),Ah(2,Vs),Ah(3,Fn),Ah(4,sn),Ah(5,Yu),Ah(6,ua)],Pr);class kH{constructor(e){this.prioritySelector=e,this._items=new Array}register(e){if(this._items.indexOf(e)!==-1)throw new Error("Value is already registered");return this._items.push(e),this._items.sort((t,i)=>this.prioritySelector(i)-this.prioritySelector(t)),{dispose:()=>{const t=this._items.indexOf(e);t>=0&&this._items.splice(t,1)}}}get itemsOrderedByPriorityDesc(){return this._items}}const c_=class c_ extends Ct{constructor(){super({id:c_.id,label:S("suggest.trigger.label","Trigger Suggest"),alias:"Trigger Suggest",precondition:qe.and(q.writable,q.hasCompletionItemProvider,Gi.Visible.toNegated()),kbOpts:{kbExpr:q.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(e,t,i){const n=Pr.get(t);if(!n)return;let s;i&&typeof i=="object"&&i.auto===!0&&(s=!0),n.triggerSuggest(void 0,s,void 0)}};c_.id="editor.action.triggerSuggest";let vv=c_;hn(Pr.ID,Pr,2);Le(vv);const tr=190,_o=Ao.bindToContribution(Pr.get);Ti(new _o({id:"acceptSelectedSuggestion",precondition:qe.and(Gi.Visible,Gi.HasFocusedSuggestion),handler(o){o.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:qe.and(Gi.Visible,q.textInputFocus),weight:tr},{primary:3,kbExpr:qe.and(Gi.Visible,q.textInputFocus,Gi.AcceptSuggestionsOnEnter,Gi.MakesTextEdit),weight:tr}],menuOpts:[{menuId:bc,title:S("accept.insert","Insert"),group:"left",order:1,when:Gi.HasInsertAndReplaceRange.toNegated()},{menuId:bc,title:S("accept.insert","Insert"),group:"left",order:1,when:qe.and(Gi.HasInsertAndReplaceRange,Gi.InsertMode.isEqualTo("insert"))},{menuId:bc,title:S("accept.replace","Replace"),group:"left",order:1,when:qe.and(Gi.HasInsertAndReplaceRange,Gi.InsertMode.isEqualTo("replace"))}]}));Ti(new _o({id:"acceptAlternativeSelectedSuggestion",precondition:qe.and(Gi.Visible,q.textInputFocus,Gi.HasFocusedSuggestion),kbOpts:{weight:tr,kbExpr:q.textInputFocus,primary:1027,secondary:[1026]},handler(o){o.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:bc,group:"left",order:2,when:qe.and(Gi.HasInsertAndReplaceRange,Gi.InsertMode.isEqualTo("insert")),title:S("accept.replace","Replace")},{menuId:bc,group:"left",order:2,when:qe.and(Gi.HasInsertAndReplaceRange,Gi.InsertMode.isEqualTo("replace")),title:S("accept.insert","Insert")}]}));Qn.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion");Ti(new _o({id:"hideSuggestWidget",precondition:Gi.Visible,handler:o=>o.cancelSuggestWidget(),kbOpts:{weight:tr,kbExpr:q.textInputFocus,primary:9,secondary:[1033]}}));Ti(new _o({id:"selectNextSuggestion",precondition:qe.and(Gi.Visible,qe.or(Gi.MultipleSuggestions,Gi.HasFocusedSuggestion.negate())),handler:o=>o.selectNextSuggestion(),kbOpts:{weight:tr,kbExpr:q.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}}));Ti(new _o({id:"selectNextPageSuggestion",precondition:qe.and(Gi.Visible,qe.or(Gi.MultipleSuggestions,Gi.HasFocusedSuggestion.negate())),handler:o=>o.selectNextPageSuggestion(),kbOpts:{weight:tr,kbExpr:q.textInputFocus,primary:12,secondary:[2060]}}));Ti(new _o({id:"selectLastSuggestion",precondition:qe.and(Gi.Visible,qe.or(Gi.MultipleSuggestions,Gi.HasFocusedSuggestion.negate())),handler:o=>o.selectLastSuggestion()}));Ti(new _o({id:"selectPrevSuggestion",precondition:qe.and(Gi.Visible,qe.or(Gi.MultipleSuggestions,Gi.HasFocusedSuggestion.negate())),handler:o=>o.selectPrevSuggestion(),kbOpts:{weight:tr,kbExpr:q.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}}));Ti(new _o({id:"selectPrevPageSuggestion",precondition:qe.and(Gi.Visible,qe.or(Gi.MultipleSuggestions,Gi.HasFocusedSuggestion.negate())),handler:o=>o.selectPrevPageSuggestion(),kbOpts:{weight:tr,kbExpr:q.textInputFocus,primary:11,secondary:[2059]}}));Ti(new _o({id:"selectFirstSuggestion",precondition:qe.and(Gi.Visible,qe.or(Gi.MultipleSuggestions,Gi.HasFocusedSuggestion.negate())),handler:o=>o.selectFirstSuggestion()}));Ti(new _o({id:"focusSuggestion",precondition:qe.and(Gi.Visible,Gi.HasFocusedSuggestion.negate()),handler:o=>o.focusSuggestion(),kbOpts:{weight:tr,kbExpr:q.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}}));Ti(new _o({id:"focusAndAcceptSuggestion",precondition:qe.and(Gi.Visible,Gi.HasFocusedSuggestion.negate()),handler:o=>{o.focusSuggestion(),o.acceptSelectedSuggestion(!0,!1)}}));Ti(new _o({id:"toggleSuggestionDetails",precondition:qe.and(Gi.Visible,Gi.HasFocusedSuggestion),handler:o=>o.toggleSuggestionDetails(),kbOpts:{weight:tr,kbExpr:q.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:bc,group:"right",order:1,when:qe.and(Gi.DetailsVisible,Gi.CanResolve),title:S("detail.more","Show Less")},{menuId:bc,group:"right",order:1,when:qe.and(Gi.DetailsVisible.toNegated(),Gi.CanResolve),title:S("detail.less","Show More")}]}));Ti(new _o({id:"toggleExplainMode",precondition:Gi.Visible,handler:o=>o.toggleExplainMode(),kbOpts:{weight:100,primary:2138}}));Ti(new _o({id:"toggleSuggestionFocus",precondition:Gi.Visible,handler:o=>o.toggleSuggestionFocus(),kbOpts:{weight:tr,kbExpr:q.textInputFocus,primary:2570,mac:{primary:778}}}));Ti(new _o({id:"insertBestCompletion",precondition:qe.and(q.textInputFocus,qe.equals("config.editor.tabCompletion","on"),gv.AtEnd,Gi.Visible.toNegated(),ef.OtherSuggestions.toNegated(),xo.InSnippetMode.toNegated()),handler:(o,e)=>{o.triggerSuggestAndAcceptBest(NA(e)?{fallback:"tab",...e}:{fallback:"tab"})},kbOpts:{weight:tr,primary:2}}));Ti(new _o({id:"insertNextSuggestion",precondition:qe.and(q.textInputFocus,qe.equals("config.editor.tabCompletion","on"),ef.OtherSuggestions,Gi.Visible.toNegated(),xo.InSnippetMode.toNegated()),handler:o=>o.acceptNextSuggestion(),kbOpts:{weight:tr,kbExpr:q.textInputFocus,primary:2}}));Ti(new _o({id:"insertPrevSuggestion",precondition:qe.and(q.textInputFocus,qe.equals("config.editor.tabCompletion","on"),ef.OtherSuggestions,Gi.Visible.toNegated(),xo.InSnippetMode.toNegated()),handler:o=>o.acceptPrevSuggestion(),kbOpts:{weight:tr,kbExpr:q.textInputFocus,primary:1026}}));Le(class extends Ct{constructor(){super({id:"editor.action.resetSuggestSize",label:S("suggest.reset.label","Reset Suggest Widget Size"),alias:"Reset Suggest Widget Size",precondition:void 0})}run(o,e){var t;(t=Pr.get(e))==null||t.resetWidgetSize()}});class BH extends Rt{get selectedItem(){return this._currentSuggestItemInfo}constructor(e,t,i){super(),this.editor=e,this.suggestControllerPreselector=t,this.onWillAccept=i,this.isSuggestWidgetVisible=!1,this.isShiftKeyPressed=!1,this._isActive=!1,this._currentSuggestItemInfo=void 0,this._onDidSelectedItemChange=this._register(new rn),this.onDidSelectedItemChange=this._onDidSelectedItemChange.event,this._register(e.onKeyDown(s=>{s.shiftKey&&!this.isShiftKeyPressed&&(this.isShiftKeyPressed=!0,this.update(this._isActive))})),this._register(e.onKeyUp(s=>{s.shiftKey&&this.isShiftKeyPressed&&(this.isShiftKeyPressed=!1,this.update(this._isActive))}));const n=Pr.get(this.editor);if(n){this._register(n.registerSelector({priority:100,select:(a,d,u)=>{const f=this.editor.getModel();if(!f)return-1;const g=this.suggestControllerPreselector(),p=g?Wd(g,f):void 0;if(!p)return-1;const C=Bi.lift(d),b=u.map((w,A)=>{const I=mg.fromSuggestion(n,f,C,w,this.isShiftKeyPressed),T=Wd(I.toSingleTextEdit(),f),R=CB(p,T);return{index:A,valid:R,prefixLength:T.text.length,suggestItem:w}}).filter(w=>w&&w.valid&&w.prefixLength>0),y=oL(b,Tp(w=>w.prefixLength,K_));return y?y.index:-1}}));let s=!1;const r=()=>{s||(s=!0,this._register(n.widget.value.onDidShow(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})),this._register(n.widget.value.onDidHide(()=>{this.isSuggestWidgetVisible=!1,this.update(!1)})),this._register(n.widget.value.onDidFocus(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})))};this._register(Ts.once(n.model.onDidTrigger)(a=>{r()})),this._register(n.onWillInsertSuggestItem(a=>{const d=this.editor.getPosition(),u=this.editor.getModel();if(!d||!u)return;const f=mg.fromSuggestion(n,u,d,a.item,this.isShiftKeyPressed);this.onWillAccept(f)}))}this.update(this._isActive)}update(e){const t=this.getSuggestItemInfo();(this._isActive!==e||!FH(this._currentSuggestItemInfo,t))&&(this._isActive=e,this._currentSuggestItemInfo=t,this._onDidSelectedItemChange.fire())}getSuggestItemInfo(){const e=Pr.get(this.editor);if(!e||!this.isSuggestWidgetVisible)return;const t=e.widget.value.getFocusedItem(),i=this.editor.getPosition(),n=this.editor.getModel();if(!(!t||!i||!n))return mg.fromSuggestion(e,n,i,t.item,this.isShiftKeyPressed)}stopForceRenderingAbove(){const e=Pr.get(this.editor);e==null||e.stopForceRenderingAbove()}forceRenderingAbove(){const e=Pr.get(this.editor);e==null||e.forceRenderingAbove()}}class mg{static fromSuggestion(e,t,i,n,s){let{insertText:r}=n.completion,a=!1;if(n.completion.insertTextRules&4){const u=new Nu().parse(r);u.children.length<100&&fv.adjustWhitespace(t,i,!0,u),r=u.toString(),a=!0}const d=e.getOverwriteInfo(n,s);return new mg(Q.fromPositions(i.delta(0,-d.overwriteBefore),i.delta(0,Math.max(d.overwriteAfter,0))),r,n.completion.kind,a)}constructor(e,t,i,n){this.range=e,this.insertText=t,this.completionItemKind=i,this.isSnippetText=n}equals(e){return this.range.equalsRange(e.range)&&this.insertText===e.insertText&&this.completionItemKind===e.completionItemKind&&this.isSnippetText===e.isSnippetText}toSelectedSuggestionInfo(){return new rL(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}toSingleTextEdit(){return new Dl(this.range,this.insertText)}}function FH(o,e){return o===e?!0:!o||!e?!1:o.equals(e)}var LH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},il=function(o,e){return function(t,i){e(t,i,o)}},qE,du;let fr=(du=class extends Rt{static get(e){return e.getContribution(qE.ID)}constructor(e,t,i,n,s,r,a,d,u,f){super(),this.editor=e,this._instantiationService=t,this._contextKeyService=i,this._configurationService=n,this._commandService=s,this._debounceService=r,this._languageFeaturesService=a,this._accessibilitySignalService=d,this._keybindingService=u,this._accessibilityService=f,this._editorObs=Ia(this.editor),this._positions=Wn(this,p=>{var C;return((C=this._editorObs.selections.read(p))==null?void 0:C.map(b=>b.getEndPosition()))??[new Bi(1,1)]}),this._suggestWidgetAdaptor=this._register(new BH(this.editor,()=>{var p,C;return this._editorObs.forceUpdate(),(C=(p=this.model.get())==null?void 0:p.selectedInlineCompletion.get())==null?void 0:C.toSingleTextEdit(void 0)},p=>this._editorObs.forceUpdate(C=>{var b;(b=this.model.get())==null||b.handleSuggestAccepted(p)}))),this._suggestWidgetSelectedItem=Io(this,p=>this._suggestWidgetAdaptor.onDidSelectedItemChange(()=>{this._editorObs.forceUpdate(C=>p(void 0))}),()=>this._suggestWidgetAdaptor.selectedItem),this._enabledInConfig=Io(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).enabled),this._isScreenReaderEnabled=Io(this,this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this._editorDictationInProgress=Io(this,this._contextKeyService.onDidChangeContext,()=>this._contextKeyService.getContext(this.editor.getDomNode()).getValue("editorDictation.inProgress")===!0),this._enabled=Wn(this,p=>this._enabledInConfig.read(p)&&(!this._isScreenReaderEnabled.read(p)||!this._editorDictationInProgress.read(p))),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineCompletionsDebounce",{min:50,max:50}),this.model=Hc(this,p=>{if(this._editorObs.isReadonly.read(p))return;const C=this._editorObs.model.read(p);return C?this._instantiationService.createInstance(RE,C,this._suggestWidgetSelectedItem,this._editorObs.versionId,this._positions,this._debounceValue,Io(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(119).preview),Io(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(119).previewMode),Io(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).mode),this._enabled):void 0}).recomputeInitiallyAndOnChange(this._store),this._ghostTexts=Wn(this,p=>{const C=this.model.read(p);return(C==null?void 0:C.ghostTexts.read(p))??[]}),this._stablizedGhostTexts=IH(this._ghostTexts,this._store),this._ghostTextWidgets=aL(this,this._stablizedGhostTexts,(p,C)=>C.add(this._instantiationService.createInstance(TE,this.editor,{ghostText:p,minReservedLineCount:gl(0),targetTextModel:this.model.map(b=>b==null?void 0:b.textModel)}))).recomputeInitiallyAndOnChange(this._store),this._playAccessibilitySignal=qw(this),this._fontFamily=Io(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).fontFamily),this._register(new No(this._contextKeyService,this.model)),this._register(XS(this._editorObs.onDidType,(p,C)=>{var b;this._enabled.get()&&((b=this.model.get())==null||b.trigger())})),this._register(this._commandService.onDidExecuteCommand(p=>{new Set([Qx.Tab.id,Qx.DeleteLeft.id,Qx.DeleteRight.id,F5,"acceptSelectedSuggestion"]).has(p.commandId)&&e.hasTextFocus()&&this._enabled.get()&&this._editorObs.forceUpdate(b=>{var y;(y=this.model.get())==null||y.trigger(b)})})),this._register(XS(this._editorObs.selections,(p,C)=>{var b;C.some(y=>y.reason===3||y.source==="api")&&((b=this.model.get())==null||b.stop())})),this._register(this.editor.onDidBlurEditorWidget(()=>{this._contextKeyService.getContextKeyValue("accessibleViewIsShown")||this._configurationService.getValue("editor.inlineSuggest.keepOnBlur")||e.getOption(62).keepOnBlur||K0.dropDownVisible||Xu(p=>{var C;(C=this.model.get())==null||C.stop(p)})})),this._register(rs(p=>{var b;const C=(b=this.model.read(p))==null?void 0:b.state.read(p);C!=null&&C.suggestItem?C.primaryGhostText.lineCount>=2&&this._suggestWidgetAdaptor.forceRenderingAbove():this._suggestWidgetAdaptor.stopForceRenderingAbove()})),this._register(is(()=>{this._suggestWidgetAdaptor.stopForceRenderingAbove()}));const g=q_(this,(p,C)=>{var w;const b=this.model.read(p),y=b==null?void 0:b.state.read(p);return this._suggestWidgetSelectedItem.get()?C:(w=y==null?void 0:y.inlineCompletion)==null?void 0:w.semanticId});this._register(lL(Wn(p=>(this._playAccessibilitySignal.read(p),g.read(p),{})),async(p,C,b)=>{const y=this.model.get(),w=y==null?void 0:y.state.get();if(!w||!y)return;const A=y.textModel.getLineContent(w.primaryGhostText.lineNumber);await J_(50,l1(b)),await cL(this._suggestWidgetSelectedItem,$f,()=>!1,l1(b)),await this._accessibilitySignalService.playSignal(HA.inlineSuggestion),this.editor.getOption(8)&&this._provideScreenReaderUpdate(w.primaryGhostText.renderForScreenReader(A))})),this._register(new J1(this.editor,this.model,this._instantiationService)),this._register(EO(Wn(p=>{const C=this._fontFamily.read(p);return C===""||C==="default"?"":`
43
+ .monaco-editor .ghost-text-decoration,
44
+ .monaco-editor .ghost-text-decoration-preview,
45
+ .monaco-editor .ghost-text {
46
+ font-family: ${C};
47
+ }`}))),this._register(this._configurationService.onDidChangeConfiguration(p=>{p.affectsConfiguration("accessibility.verbosity.inlineCompletions")&&this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})})),this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})}playAccessibilitySignal(e){this._playAccessibilitySignal.trigger(e)}_provideScreenReaderUpdate(e){const t=this._contextKeyService.getContextKeyValue("accessibleViewIsShown"),i=this._keybindingService.lookupKeybinding("editor.action.accessibleView");let n;!t&&i&&this.editor.getOption(150)&&(n=S("showAccessibleViewHint","Inspect this in the accessible view ({0})",i.getAriaLabel())),Nr(n?e+", "+n:e)}shouldShowHoverAt(e){var i;const t=(i=this.model.get())==null?void 0:i.primaryGhostText.get();return t?t.parts.some(n=>e.containsPosition(new Bi(t.lineNumber,n.column))):!1}shouldShowHoverAtViewZone(e){var t;return((t=this._ghostTextWidgets.get()[0])==null?void 0:t.ownsViewZone(e))??!1}},qE=du,du.ID="editor.contrib.inlineCompletionsController",du);fr=qE=LH([il(1,sn),il(2,Fn),il(3,ss),il(4,Vs),il(5,gr),il(6,Fi),il(7,OA),il(8,As),il(9,G_)],fr);function IH(o,e){const t=Qo("result",[]),i=[];return e.add(rs(n=>{const s=o.read(n);Xu(r=>{if(s.length!==i.length){i.length=s.length;for(let a=0;a<i.length;a++)i[a]||(i[a]=Qo("item",s[a]));t.set([...i],r)}i.forEach((a,d)=>a.set(s[d],r))})})),t}const d_=class d_ extends Ct{constructor(){super({id:d_.ID,label:S("action.inlineSuggest.showNext","Show Next Inline Suggestion"),alias:"Show Next Inline Suggestion",precondition:qe.and(q.writable,No.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}async run(e,t){var n;const i=fr.get(t);(n=i==null?void 0:i.model.get())==null||n.next()}};d_.ID=I5;let GE=d_;const u_=class u_ extends Ct{constructor(){super({id:u_.ID,label:S("action.inlineSuggest.showPrevious","Show Previous Inline Suggestion"),alias:"Show Previous Inline Suggestion",precondition:qe.and(q.writable,No.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}async run(e,t){var n;const i=fr.get(t);(n=i==null?void 0:i.model.get())==null||n.previous()}};u_.ID=L5;let KE=u_;class PH extends Ct{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:S("action.inlineSuggest.trigger","Trigger Inline Suggestion"),alias:"Trigger Inline Suggestion",precondition:q.writable})}async run(e,t){const i=fr.get(t);await ak(async n=>{var s;await((s=i==null?void 0:i.model.get())==null?void 0:s.triggerExplicitly(n)),i==null||i.playAccessibilitySignal(n)})}}class TH extends Ct{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:S("action.inlineSuggest.acceptNextWord","Accept Next Word Of Inline Suggestion"),alias:"Accept Next Word Of Inline Suggestion",precondition:qe.and(q.writable,No.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:qe.and(q.writable,No.inlineSuggestionVisible)},menuOpts:[{menuId:ni.InlineSuggestionToolbar,title:S("acceptWord","Accept Word"),group:"primary",order:2}]})}async run(e,t){var n;const i=fr.get(t);await((n=i==null?void 0:i.model.get())==null?void 0:n.acceptNextWord(i.editor))}}class MH extends Ct{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:S("action.inlineSuggest.acceptNextLine","Accept Next Line Of Inline Suggestion"),alias:"Accept Next Line Of Inline Suggestion",precondition:qe.and(q.writable,No.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:ni.InlineSuggestionToolbar,title:S("acceptLine","Accept Line"),group:"secondary",order:2}]})}async run(e,t){var n;const i=fr.get(t);await((n=i==null?void 0:i.model.get())==null?void 0:n.acceptNextLine(i.editor))}}class RH extends Ct{constructor(){super({id:F5,label:S("action.inlineSuggest.accept","Accept Inline Suggestion"),alias:"Accept Inline Suggestion",precondition:No.inlineSuggestionVisible,menuOpts:[{menuId:ni.InlineSuggestionToolbar,title:S("accept","Accept"),group:"primary",order:1}],kbOpts:{primary:2,weight:200,kbExpr:qe.and(No.inlineSuggestionVisible,q.tabMovesFocus.toNegated(),No.inlineSuggestionHasIndentationLessThanTabSize,Gi.Visible.toNegated(),q.hoverFocused.toNegated())}})}async run(e,t){var n;const i=fr.get(t);i&&((n=i.model.get())==null||n.accept(i.editor),i.editor.focus())}}const h_=class h_ extends Ct{constructor(){super({id:h_.ID,label:S("action.inlineSuggest.hide","Hide Inline Suggestion"),alias:"Hide Inline Suggestion",precondition:No.inlineSuggestionVisible,kbOpts:{weight:100,primary:9}})}async run(e,t){const i=fr.get(t);Xu(n=>{var s;(s=i==null?void 0:i.model.get())==null||s.stop(n)})}};h_.ID="editor.action.inlineSuggest.hide";let ZE=h_;const f_=class f_ extends Do{constructor(){super({id:f_.ID,title:S("action.inlineSuggest.alwaysShowToolbar","Always Show Toolbar"),f1:!1,precondition:void 0,menu:[{id:ni.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:qe.equals("config.editor.inlineSuggest.showToolbar","always")})}async run(e,t){const i=e.get(ss),s=i.getValue("editor.inlineSuggest.showToolbar")==="always"?"onHover":"always";i.updateValue("editor.inlineSuggest.showToolbar",s)}};f_.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar";let XE=f_;var NH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Hf=function(o,e){return function(t,i){e(t,i,o)}};class OH{constructor(e,t,i){this.owner=e,this.range=t,this.controller=i}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}let YE=class{constructor(e,t,i,n,s,r){this._editor=e,this._languageService=t,this._openerService=i,this.accessibilityService=n,this._instantiationService=s,this._telemetryService=r,this.hoverOrdinal=4}suggestHoverAnchor(e){const t=fr.get(this._editor);if(!t)return null;const i=e.target;if(i.type===8){const n=i.detail;if(t.shouldShowHoverAtViewZone(n.viewZoneId))return new am(1e3,this,Q.fromPositions(this._editor.getModel().validatePosition(n.positionBefore||n.position)),e.event.posx,e.event.posy,!1)}return i.type===7&&t.shouldShowHoverAt(i.range)?new am(1e3,this,i.range,e.event.posx,e.event.posy,!1):i.type===6&&i.detail.mightBeForeignElement&&t.shouldShowHoverAt(i.range)?new am(1e3,this,i.range,e.event.posx,e.event.posy,!1):null}computeSync(e,t){if(this._editor.getOption(62).showToolbar!=="onHover")return[];const i=fr.get(this._editor);return i&&i.shouldShowHoverAt(e.range)?[new OH(this,e.range,i)]:[]}renderHoverParts(e,t){const i=new Tt,n=t[0];this._telemetryService.publicLog2("inlineCompletionHover.shown"),this.accessibilityService.isScreenReaderOptimized()&&!this._editor.getOption(8)&&i.add(this.renderScreenReaderText(e,n));const s=n.controller.model.get(),r=this._instantiationService.createInstance(K0,this._editor,!1,gl(null),s.selectedInlineCompletionIndex,s.inlineCompletionsCount,s.activeCommands),a=r.getDomNode();e.fragment.appendChild(a),s.triggerExplicitly(),i.add(r);const d={hoverPart:n,hoverElement:a,dispose(){i.dispose()}};return new zu([d])}renderScreenReaderText(e,t){const i=new Tt,n=mi,s=n("div.hover-row.markdown-hover"),r=di(s,n("div.hover-contents",{"aria-live":"assertive"})),a=i.add(new uf({editor:this._editor},this._languageService,this._openerService)),d=u=>{i.add(a.onDidRenderAsync(()=>{r.className="hover-contents code-hover-contents",e.onContentsChanged()}));const f=S("inlineSuggestionFollows","Suggestion:"),g=i.add(a.render(new lo().appendText(f).appendCodeblock("text",u)));r.replaceChildren(g.element)};return i.add(rs(u=>{var g;const f=(g=t.controller.model.read(u))==null?void 0:g.primaryGhostText.read(u);if(f){const p=this._editor.getModel().getLineContent(f.lineNumber);d(f.renderForScreenReader(p))}else Sm(r)})),e.fragment.appendChild(s),i}};YE=NH([Hf(1,ha),Hf(2,da),Hf(3,G_),Hf(4,sn),Hf(5,ua)],YE);class HH{}const Db=new class{constructor(){this._implementations=[]}register(e){return this._implementations.push(e),{dispose:()=>{const t=this._implementations.indexOf(e);t!==-1&&this._implementations.splice(t,1)}}}getImplementations(){return this._implementations}};hn(fr.ID,fr,3);Le(PH);Le(GE);Le(KE);Le(TH);Le(MH);Le(RH);Le(ZE);Vn(XE);th.register(YE);Db.register(new HH);var WH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},PC=function(o,e){return function(t,i){e(t,i,o)}},Qf,Lc;let ep=(Lc=class{constructor(e,t,i,n){this.textModelResolverService=t,this.languageService=i,this.languageFeaturesService=n,this.toUnhook=new Tt,this.toUnhookForKeyboard=new Tt,this.currentWordAtPosition=null,this.previousPromise=null,this.editor=e,this.linkDecorations=this.editor.createDecorationsCollection();const s=new vb(e);this.toUnhook.add(s),this.toUnhook.add(s.onMouseMoveOrRelevantKeyDown(([r,a])=>{this.startFindDefinitionFromMouse(r,a??void 0)})),this.toUnhook.add(s.onExecute(r=>{this.isEnabled(r)&&this.gotoDefinition(r.target.position,r.hasSideBySideModifier).catch(a=>{qn(a)}).finally(()=>{this.removeLinkDecorations()})})),this.toUnhook.add(s.onCancel(()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null}))}static get(e){return e.getContribution(Qf.ID)}async startFindDefinitionFromCursor(e){await this.startFindDefinition(e),this.toUnhookForKeyboard.add(this.editor.onDidChangeCursorPosition(()=>{this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear()})),this.toUnhookForKeyboard.add(this.editor.onKeyDown(t=>{t&&(this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear())}))}startFindDefinitionFromMouse(e,t){if(e.target.type===9&&this.linkDecorations.length>0)return;if(!this.editor.hasModel()||!this.isEnabled(e,t)){this.currentWordAtPosition=null,this.removeLinkDecorations();return}const i=e.target.position;this.startFindDefinition(i)}async startFindDefinition(e){var r;this.toUnhookForKeyboard.clear();const t=e?(r=this.editor.getModel())==null?void 0:r.getWordAtPosition(e):null;if(!t){this.currentWordAtPosition=null,this.removeLinkDecorations();return}if(this.currentWordAtPosition&&this.currentWordAtPosition.startColumn===t.startColumn&&this.currentWordAtPosition.endColumn===t.endColumn&&this.currentWordAtPosition.word===t.word)return;this.currentWordAtPosition=t;const i=new lk(this.editor,15);this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=qs(a=>this.findDefinition(e,a));let n;try{n=await this.previousPromise}catch(a){qn(a);return}if(!n||!n.length||!i.validate(this.editor)){this.removeLinkDecorations();return}const s=n[0].originSelectionRange?Q.lift(n[0].originSelectionRange):new Q(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn);if(n.length>1){let a=s;for(const{originSelectionRange:d}of n)d&&(a=Q.plusRange(a,d));this.addDecoration(a,new lo().appendText(S("multipleResults","Click to show {0} definitions.",n.length)))}else{const a=n[0];if(!a.uri)return;this.textModelResolverService.createModelReference(a.uri).then(d=>{if(!d.object||!d.object.textEditorModel){d.dispose();return}const{object:{textEditorModel:u}}=d,{startLineNumber:f}=a.range;if(f<1||f>u.getLineCount()){d.dispose();return}const g=this.getPreviewValue(u,f,a),p=this.languageService.guessLanguageIdByFilepathOrFirstLine(u.uri);this.addDecoration(s,g?new lo().appendCodeblock(p||"",g):void 0),d.dispose()})}}getPreviewValue(e,t,i){let n=i.range;return n.endLineNumber-n.startLineNumber>=Qf.MAX_SOURCE_PREVIEW_LINES&&(n=this.getPreviewRangeBasedOnIndentation(e,t)),this.stripIndentationFromPreviewRange(e,t,n)}stripIndentationFromPreviewRange(e,t,i){let s=e.getLineFirstNonWhitespaceColumn(t);for(let a=t+1;a<i.endLineNumber;a++){const d=e.getLineFirstNonWhitespaceColumn(a);s=Math.min(s,d)}return e.getValueInRange(i).replace(new RegExp(`^\\s{${s-1}}`,"gm"),"").trim()}getPreviewRangeBasedOnIndentation(e,t){const i=e.getLineFirstNonWhitespaceColumn(t),n=Math.min(e.getLineCount(),t+Qf.MAX_SOURCE_PREVIEW_LINES);let s=t+1;for(;s<n;s++){const r=e.getLineFirstNonWhitespaceColumn(s);if(i===r)break}return new Q(t,1,s+1,1)}addDecoration(e,t){const i={range:e,options:{description:"goto-definition-link",inlineClassName:"goto-definition-link",hoverMessage:t}};this.linkDecorations.set([i])}removeLinkDecorations(){this.linkDecorations.clear()}isEnabled(e,t){var i;return this.editor.hasModel()&&e.isLeftClick&&e.isNoneOrSingleMouseDown&&e.target.type===6&&!(((i=e.target.detail.injectedText)==null?void 0:i.options)instanceof $w)&&(e.hasTriggerModifier||(t?t.keyCodeIsTriggerKey:!1))&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(e,t){const i=this.editor.getModel();return i?Zp(this.languageFeaturesService.definitionProvider,i,e,!1,t):Promise.resolve(null)}gotoDefinition(e,t){return this.editor.setPosition(e),this.editor.invokeWithinContext(i=>{const n=!t&&this.editor.getOption(89)&&!this.isInPeekEditor(i);return new Yp({openToSide:t,openInPeek:n,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(i)})}isInPeekEditor(e){const t=e.get(Fn);return wo.inPeekEditor.getValue(t)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}},Qf=Lc,Lc.ID="editor.contrib.gotodefinitionatposition",Lc.MAX_SOURCE_PREVIEW_LINES=8,Lc);ep=Qf=WH([PC(1,fa),PC(2,ha),PC(3,Fi)],ep);hn(ep.ID,ep,2);var yB=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},_v=function(o,e){return function(t,i){e(t,i,o)}};class TD{constructor(e,t,i){this.marker=e,this.index=t,this.total=i}}let QE=class{constructor(e,t,i){this._markerService=t,this._configService=i,this._onDidChange=new rn,this.onDidChange=this._onDidChange.event,this._dispoables=new Tt,this._markers=[],this._nextIdx=-1,jn.isUri(e)?this._resourceFilter=a=>a.toString()===e.toString():e&&(this._resourceFilter=e);const n=this._configService.getValue("problems.sortOrder"),s=(a,d)=>{let u=YS(a.resource.toString(),d.resource.toString());return u===0&&(n==="position"?u=Q.compareRangesUsingStarts(a,d)||ho.compare(a.severity,d.severity):u=ho.compare(a.severity,d.severity)||Q.compareRangesUsingStarts(a,d)),u},r=()=>{this._markers=this._markerService.read({resource:jn.isUri(e)?e:void 0,severities:ho.Error|ho.Warning|ho.Info}),typeof e=="function"&&(this._markers=this._markers.filter(a=>this._resourceFilter(a.resource))),this._markers.sort(s)};r(),this._dispoables.add(t.onMarkerChanged(a=>{(!this._resourceFilter||a.some(d=>this._resourceFilter(d)))&&(r(),this._nextIdx=-1,this._onDidChange.fire())}))}dispose(){this._dispoables.dispose(),this._onDidChange.dispose()}matches(e){return!this._resourceFilter&&!e?!0:!this._resourceFilter||!e?!1:this._resourceFilter(e)}get selected(){const e=this._markers[this._nextIdx];return e&&new TD(e,this._nextIdx+1,this._markers.length)}_initIdx(e,t,i){let n=!1,s=this._markers.findIndex(r=>r.resource.toString()===e.uri.toString());s<0&&(s=Fm(this._markers,{resource:e.uri},(r,a)=>YS(r.resource.toString(),a.resource.toString())),s<0&&(s=~s));for(let r=s;r<this._markers.length;r++){let a=Q.lift(this._markers[r]);if(a.isEmpty()){const d=e.getWordAtPosition(a.getStartPosition());d&&(a=new Q(a.startLineNumber,d.startColumn,a.startLineNumber,d.endColumn))}if(t&&(a.containsPosition(t)||t.isBeforeOrEqual(a.getStartPosition()))){this._nextIdx=r,n=!0;break}if(this._markers[r].resource.toString()!==e.uri.toString())break}n||(this._nextIdx=i?0:this._markers.length-1),this._nextIdx<0&&(this._nextIdx=this._markers.length-1)}resetIndex(){this._nextIdx=-1}move(e,t,i){if(this._markers.length===0)return!1;const n=this._nextIdx;return this._nextIdx===-1?this._initIdx(t,i,e):e?this._nextIdx=(this._nextIdx+1)%this._markers.length:e||(this._nextIdx=(this._nextIdx-1+this._markers.length)%this._markers.length),n!==this._nextIdx}find(e,t){let i=this._markers.findIndex(n=>n.resource.toString()===e.toString());if(!(i<0)){for(;i<this._markers.length;i++)if(Q.containsPosition(this._markers[i],t))return new TD(this._markers[i],i+1,this._markers.length)}}};QE=yB([_v(1,Rw),_v(2,ss)],QE);const wB=Ml("IMarkerNavigationService");let JE=class{constructor(e,t){this._markerService=e,this._configService=t,this._provider=new QA}getMarkerList(e){for(const t of this._provider){const i=t.getMarkerList(e);if(i)return i}return new QE(e,this._markerService,this._configService)}};JE=yB([_v(0,Rw),_v(1,ss)],JE);Rl(wB,JE,1);var ey;(function(o){function e(t){switch(t){case px.Ignore:return"severity-ignore "+Rn.asClassName(Ki.info);case px.Info:return Rn.asClassName(Ki.info);case px.Warning:return Rn.asClassName(Ki.warning);case px.Error:return Rn.asClassName(Ki.error);default:return""}}o.className=e})(ey||(ey={}));var zH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},kh=function(o,e){return function(t,i){e(t,i,o)}},ty;class VH{constructor(e,t,i,n,s){this._openerService=n,this._labelService=s,this._lines=0,this._longestLineLength=0,this._relatedDiagnostics=new WeakMap,this._disposables=new Tt,this._editor=t;const r=document.createElement("div");r.className="descriptioncontainer",this._messageBlock=document.createElement("div"),this._messageBlock.classList.add("message"),this._messageBlock.setAttribute("aria-live","assertive"),this._messageBlock.setAttribute("role","alert"),r.appendChild(this._messageBlock),this._relatedBlock=document.createElement("div"),r.appendChild(this._relatedBlock),this._disposables.add(Sl(this._relatedBlock,"click",a=>{a.preventDefault();const d=this._relatedDiagnostics.get(a.target);d&&i(d)})),this._scrollable=new xL(r,{horizontal:1,vertical:1,useShadows:!1,horizontalScrollbarSize:6,verticalScrollbarSize:6}),e.appendChild(this._scrollable.getDomNode()),this._disposables.add(this._scrollable.onScroll(a=>{r.style.left=`-${a.scrollLeft}px`,r.style.top=`-${a.scrollTop}px`})),this._disposables.add(this._scrollable)}dispose(){uo(this._disposables)}update(e){const{source:t,message:i,relatedInformation:n,code:s}=e;let r=((t==null?void 0:t.length)||0)+2;s&&(typeof s=="string"?r+=s.length:r+=s.value.length);const a=Q_(i);this._lines=a.length,this._longestLineLength=0;for(const p of a)this._longestLineLength=Math.max(p.length+r,this._longestLineLength);Wa(this._messageBlock),this._messageBlock.setAttribute("aria-label",this.getAriaLabel(e)),this._editor.applyFontInfo(this._messageBlock);let d=this._messageBlock;for(const p of a)d=document.createElement("div"),d.innerText=p,p===""&&(d.style.height=this._messageBlock.style.lineHeight),this._messageBlock.appendChild(d);if(t||s){const p=document.createElement("span");if(p.classList.add("details"),d.appendChild(p),t){const C=document.createElement("span");C.innerText=t,C.classList.add("source"),p.appendChild(C)}if(s)if(typeof s=="string"){const C=document.createElement("span");C.innerText=`(${s})`,C.classList.add("code"),p.appendChild(C)}else{this._codeLink=mi("a.code-link"),this._codeLink.setAttribute("href",`${s.target.toString()}`),this._codeLink.onclick=b=>{this._openerService.open(s.target,{allowCommands:!0}),b.preventDefault(),b.stopPropagation()};const C=di(this._codeLink,mi("span"));C.innerText=s.value,p.appendChild(this._codeLink)}}if(Wa(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),Yo(n)){const p=this._relatedBlock.appendChild(document.createElement("div"));p.style.paddingTop=`${Math.floor(this._editor.getOption(67)*.66)}px`,this._lines+=1;for(const C of n){const b=document.createElement("div"),y=document.createElement("a");y.classList.add("filename"),y.innerText=`${this._labelService.getUriBasenameLabel(C.resource)}(${C.startLineNumber}, ${C.startColumn}): `,y.title=this._labelService.getUriLabel(C.resource),this._relatedDiagnostics.set(y,C);const w=document.createElement("span");w.innerText=C.message,b.appendChild(y),b.appendChild(w),this._lines+=1,p.appendChild(b)}}const u=this._editor.getOption(50),f=Math.ceil(u.typicalFullwidthCharacterWidth*this._longestLineLength*.75),g=u.lineHeight*this._lines;this._scrollable.setScrollDimensions({scrollWidth:f,scrollHeight:g})}layout(e,t){this._scrollable.getDomNode().style.height=`${e}px`,this._scrollable.getDomNode().style.width=`${t}px`,this._scrollable.setScrollDimensions({width:t,height:e})}getHeightInLines(){return Math.min(17,this._lines)}getAriaLabel(e){let t="";switch(e.severity){case ho.Error:t=S("Error","Error");break;case ho.Warning:t=S("Warning","Warning");break;case ho.Info:t=S("Info","Info");break;case ho.Hint:t=S("Hint","Hint");break}let i=S("marker aria","{0} at {1}. ",t,e.startLineNumber+":"+e.startColumn);const n=this._editor.getModel();return n&&e.startLineNumber<=n.getLineCount()&&e.startLineNumber>=1&&(i=`${n.getLineContent(e.startLineNumber)}, ${i}`),i}}var uu;let tp=(uu=class extends Xm{constructor(e,t,i,n,s,r,a){super(e,{showArrow:!0,showFrame:!0,isAccessible:!0,frameWidth:1},s),this._themeService=t,this._openerService=i,this._menuService=n,this._contextKeyService=r,this._labelService=a,this._callOnDispose=new Tt,this._onDidSelectRelatedInformation=new rn,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=ho.Warning,this._backgroundColor=xn.white,this._applyTheme(t.getColorTheme()),this._callOnDispose.add(t.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(e){this._backgroundColor=e.getColor(qH);let t=iy,i=jH;this._severity===ho.Warning?(t=um,i=$H):this._severity===ho.Info&&(t=ny,i=UH);const n=e.getColor(t),s=e.getColor(i);this.style({arrowColor:n,frameColor:n,headerBackgroundColor:s,primaryHeadingColor:e.getColor(V5),secondaryHeadingColor:e.getColor(j5)})}_applyStyles(){this._parentContainer&&(this._parentContainer.style.backgroundColor=this._backgroundColor?this._backgroundColor.toString():""),super._applyStyles()}dispose(){this._callOnDispose.dispose(),super.dispose()}_fillHead(e){super._fillHead(e),this._disposables.add(this._actionbarWidget.actionRunner.onWillRun(n=>this.editor.focus()));const t=[],i=this._menuService.getMenuActions(ty.TitleMenu,this._contextKeyService);Hw(i,t),this._actionbarWidget.push(t,{label:!1,icon:!0,index:0})}_fillTitleIcon(e){this._icon=di(e,mi(""))}_fillBody(e){this._parentContainer=e,e.classList.add("marker-widget"),this._parentContainer.tabIndex=0,this._parentContainer.setAttribute("role","tooltip"),this._container=document.createElement("div"),e.appendChild(this._container),this._message=new VH(this._container,this.editor,t=>this._onDidSelectRelatedInformation.fire(t),this._openerService,this._labelService),this._disposables.add(this._message)}show(){throw new Error("call showAtMarker")}showAtMarker(e,t,i){this._container.classList.remove("stale"),this._message.update(e),this._severity=e.severity,this._applyTheme(this._themeService.getColorTheme());const n=Q.lift(e),s=this.editor.getPosition(),r=s&&n.containsPosition(s)?s:n.getStartPosition();super.show(r,this.computeRequiredHeight());const a=this.editor.getModel();if(a){const d=i>1?S("problems","{0} of {1} problems",t,i):S("change","{0} of {1} problem",t,i);this.setTitle(Ua(a.uri),d)}this._icon.className=`codicon ${ey.className(ho.toSeverity(this._severity))}`,this.editor.revealPositionNearTop(r,0),this.editor.focus()}updateMarker(e){this._container.classList.remove("stale"),this._message.update(e)}showStale(){this._container.classList.add("stale"),this._relayout()}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._heightInPixel=e,this._message.layout(e,t),this._container.style.height=`${e}px`}_onWidth(e){this._message.layout(this._heightInPixel,e)}_relayout(){super._relayout(this.computeRequiredHeight())}computeRequiredHeight(){return 3+this._message.getHeightInLines()}},ty=uu,uu.TitleMenu=new ni("gotoErrorTitleMenu"),uu);tp=ty=zH([kh(1,Wr),kh(2,da),kh(3,Zu),kh(4,sn),kh(5,Fn),kh(6,Tg)],tp);const MD=Kw(uL,dL),RD=Kw(fL,hL),ND=Kw(i1,gL),iy=vi("editorMarkerNavigationError.background",{dark:MD,light:MD,hcDark:wl,hcLight:wl},S("editorMarkerNavigationError","Editor marker navigation widget error color.")),jH=vi("editorMarkerNavigationError.headerBackground",{dark:za(iy,.1),light:za(iy,.1),hcDark:null,hcLight:null},S("editorMarkerNavigationErrorHeaderBackground","Editor marker navigation widget error heading background.")),um=vi("editorMarkerNavigationWarning.background",{dark:RD,light:RD,hcDark:wl,hcLight:wl},S("editorMarkerNavigationWarning","Editor marker navigation widget warning color.")),$H=vi("editorMarkerNavigationWarning.headerBackground",{dark:za(um,.1),light:za(um,.1),hcDark:"#0C141F",hcLight:za(um,.2)},S("editorMarkerNavigationWarningBackground","Editor marker navigation widget warning heading background.")),ny=vi("editorMarkerNavigationInfo.background",{dark:ND,light:ND,hcDark:wl,hcLight:wl},S("editorMarkerNavigationInfo","Editor marker navigation widget info color.")),UH=vi("editorMarkerNavigationInfo.headerBackground",{dark:za(ny,.1),light:za(ny,.1),hcDark:null,hcLight:null},S("editorMarkerNavigationInfoHeaderBackground","Editor marker navigation widget info heading background.")),qH=vi("editorMarkerNavigation.background",pL,S("editorMarkerNavigationBackground","Editor marker navigation widget background."));var GH=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Rx=function(o,e){return function(t,i){e(t,i,o)}},Jf,hu;let $u=(hu=class{static get(e){return e.getContribution(Jf.ID)}constructor(e,t,i,n,s){this._markerNavigationService=t,this._contextKeyService=i,this._editorService=n,this._instantiationService=s,this._sessionDispoables=new Tt,this._editor=e,this._widgetVisible=SB.bindTo(this._contextKeyService)}dispose(){this._cleanUp(),this._sessionDispoables.dispose()}_cleanUp(){this._widgetVisible.reset(),this._sessionDispoables.clear(),this._widget=void 0,this._model=void 0}_getOrCreateModel(e){if(this._model&&this._model.matches(e))return this._model;let t=!1;return this._model&&(t=!0,this._cleanUp()),this._model=this._markerNavigationService.getMarkerList(e),t&&this._model.move(!0,this._editor.getModel(),this._editor.getPosition()),this._widget=this._instantiationService.createInstance(tp,this._editor),this._widget.onDidClose(()=>this.close(),this,this._sessionDispoables),this._widgetVisible.set(!0),this._sessionDispoables.add(this._model),this._sessionDispoables.add(this._widget),this._sessionDispoables.add(this._editor.onDidChangeCursorPosition(i=>{var n,s,r;(!((n=this._model)!=null&&n.selected)||!Q.containsPosition((s=this._model)==null?void 0:s.selected.marker,i.position))&&((r=this._model)==null||r.resetIndex())})),this._sessionDispoables.add(this._model.onDidChange(()=>{if(!this._widget||!this._widget.position||!this._model)return;const i=this._model.find(this._editor.getModel().uri,this._widget.position);i?this._widget.updateMarker(i.marker):this._widget.showStale()})),this._sessionDispoables.add(this._widget.onDidSelectRelatedInformation(i=>{this._editorService.openCodeEditor({resource:i.resource,options:{pinned:!0,revealIfOpened:!0,selection:Q.lift(i).collapseToStart()}},this._editor),this.close(!1)})),this._sessionDispoables.add(this._editor.onDidChangeModel(()=>this._cleanUp())),this._model}close(e=!0){this._cleanUp(),e&&this._editor.focus()}showAtMarker(e){if(this._editor.hasModel()){const t=this._getOrCreateModel(this._editor.getModel().uri);t.resetIndex(),t.move(!0,this._editor.getModel(),new Bi(e.startLineNumber,e.startColumn)),t.selected&&this._widget.showAtMarker(t.selected.marker,t.selected.index,t.selected.total)}}async nagivate(e,t){var i,n;if(this._editor.hasModel()){const s=this._getOrCreateModel(t?void 0:this._editor.getModel().uri);if(s.move(e,this._editor.getModel(),this._editor.getPosition()),!s.selected)return;if(s.selected.marker.resource.toString()!==this._editor.getModel().uri.toString()){this._cleanUp();const r=await this._editorService.openCodeEditor({resource:s.selected.marker.resource,options:{pinned:!1,revealIfOpened:!0,selectionRevealType:2,selection:s.selected.marker}},this._editor);r&&((i=Jf.get(r))==null||i.close(),(n=Jf.get(r))==null||n.nagivate(e,t))}else this._widget.showAtMarker(s.selected.marker,s.selected.index,s.selected.total)}}},Jf=hu,hu.ID="editor.contrib.markerController",hu);$u=Jf=GH([Rx(1,wB),Rx(2,Fn),Rx(3,Cs),Rx(4,sn)],$u);class Ab extends Ct{constructor(e,t,i){super(i),this._next=e,this._multiFile=t}async run(e,t){var i;t.hasModel()&&((i=$u.get(t))==null||i.nagivate(this._next,this._multiFile))}}const bd=class bd extends Ab{constructor(){super(!0,!1,{id:bd.ID,label:bd.LABEL,alias:"Go to Next Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:q.focus,primary:578,weight:100},menuOpts:{menuId:tp.TitleMenu,title:bd.LABEL,icon:ms("marker-navigation-next",Ki.arrowDown,S("nextMarkerIcon","Icon for goto next marker.")),group:"navigation",order:1}})}};bd.ID="editor.action.marker.next",bd.LABEL=S("markerAction.next.label","Go to Next Problem (Error, Warning, Info)");let bv=bd;const Cd=class Cd extends Ab{constructor(){super(!1,!1,{id:Cd.ID,label:Cd.LABEL,alias:"Go to Previous Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:q.focus,primary:1602,weight:100},menuOpts:{menuId:tp.TitleMenu,title:Cd.LABEL,icon:ms("marker-navigation-previous",Ki.arrowUp,S("previousMarkerIcon","Icon for goto previous marker.")),group:"navigation",order:2}})}};Cd.ID="editor.action.marker.prev",Cd.LABEL=S("markerAction.previous.label","Go to Previous Problem (Error, Warning, Info)");let sy=Cd;class KH extends Ab{constructor(){super(!0,!0,{id:"editor.action.marker.nextInFiles",label:S("markerAction.nextInFiles.label","Go to Next Problem in Files (Error, Warning, Info)"),alias:"Go to Next Problem in Files (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:q.focus,primary:66,weight:100},menuOpts:{menuId:ni.MenubarGoMenu,title:S({key:"miGotoNextProblem",comment:["&& denotes a mnemonic"]},"Next &&Problem"),group:"6_problem_nav",order:1}})}}class ZH extends Ab{constructor(){super(!1,!0,{id:"editor.action.marker.prevInFiles",label:S("markerAction.previousInFiles.label","Go to Previous Problem in Files (Error, Warning, Info)"),alias:"Go to Previous Problem in Files (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:q.focus,primary:1090,weight:100},menuOpts:{menuId:ni.MenubarGoMenu,title:S({key:"miGotoPreviousProblem",comment:["&& denotes a mnemonic"]},"Previous &&Problem"),group:"6_problem_nav",order:2}})}}hn($u.ID,$u,4);Le(bv);Le(sy);Le(KH);Le(ZH);const SB=new En("markersNavigationVisible",!1),XH=Ao.bindToContribution($u.get);Ti(new XH({id:"closeMarkersNavigation",precondition:SB,handler:o=>o.close(),kbOpts:{weight:150,kbExpr:q.focus,primary:9,secondary:[1033]}}));var Kr;(function(o){o.NoAutoFocus="noAutoFocus",o.FocusIfVisible="focusIfVisible",o.AutoFocusImmediately="autoFocusImmediately"})(Kr||(Kr={}));class YH extends Ct{constructor(){super({id:B5,label:S({key:"showOrFocusHover",comment:["Label for action that will trigger the showing/focusing of a hover in the editor.","If the hover is not visible, it will show the hover.","This allows for users to show the hover without using the mouse."]},"Show or Focus Hover"),metadata:{description:Ai("showOrFocusHoverDescription","Show or focus the editor hover which shows documentation, references, and other content for a symbol at the current cursor position."),args:[{name:"args",schema:{type:"object",properties:{focus:{description:"Controls if and when the hover should take focus upon being triggered by this action.",enum:[Kr.NoAutoFocus,Kr.FocusIfVisible,Kr.AutoFocusImmediately],enumDescriptions:[S("showOrFocusHover.focus.noAutoFocus","The hover will not automatically take focus."),S("showOrFocusHover.focus.focusIfVisible","The hover will take focus only if it is already visible."),S("showOrFocusHover.focus.autoFocusImmediately","The hover will automatically take focus when it appears.")],default:Kr.FocusIfVisible}}}}]},alias:"Show or Focus Hover",precondition:void 0,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2087),weight:100}})}run(e,t,i){if(!t.hasModel())return;const n=ro.get(t);if(!n)return;const s=i==null?void 0:i.focus;let r=Kr.FocusIfVisible;Object.values(Kr).includes(s)?r=s:typeof s=="boolean"&&s&&(r=Kr.AutoFocusImmediately);const a=u=>{const f=t.getPosition(),g=new Q(f.lineNumber,f.column,f.lineNumber,f.column);n.showContentHover(g,1,1,u)},d=t.getOption(2)===2;n.isHoverVisible?r!==Kr.NoAutoFocus?n.focus():a(d):a(d||r===Kr.AutoFocusImmediately)}}class QH extends Ct{constructor(){super({id:pM,label:S({key:"showDefinitionPreviewHover",comment:["Label for action that will trigger the showing of definition preview hover in the editor.","This allows for users to show the definition preview hover without using the mouse."]},"Show Definition Preview Hover"),alias:"Show Definition Preview Hover",precondition:void 0,metadata:{description:Ai("showDefinitionPreviewHoverDescription","Show the definition preview hover in the editor.")}})}run(e,t){const i=ro.get(t);if(!i)return;const n=t.getPosition();if(!n)return;const s=new Q(n.lineNumber,n.column,n.lineNumber,n.column),r=ep.get(t);if(!r)return;r.startFindDefinitionFromCursor(n).then(()=>{i.showContentHover(s,1,1,!0)})}}class JH extends Ct{constructor(){super({id:xM,label:S({key:"scrollUpHover",comment:["Action that allows to scroll up in the hover widget with the up arrow when the hover widget is focused."]},"Scroll Up Hover"),alias:"Scroll Up Hover",precondition:q.hoverFocused,kbOpts:{kbExpr:q.hoverFocused,primary:16,weight:100},metadata:{description:Ai("scrollUpHoverDescription","Scroll up the editor hover.")}})}run(e,t){const i=ro.get(t);i&&i.scrollUp()}}class eW extends Ct{constructor(){super({id:mM,label:S({key:"scrollDownHover",comment:["Action that allows to scroll down in the hover widget with the up arrow when the hover widget is focused."]},"Scroll Down Hover"),alias:"Scroll Down Hover",precondition:q.hoverFocused,kbOpts:{kbExpr:q.hoverFocused,primary:18,weight:100},metadata:{description:Ai("scrollDownHoverDescription","Scroll down the editor hover.")}})}run(e,t){const i=ro.get(t);i&&i.scrollDown()}}class tW extends Ct{constructor(){super({id:vM,label:S({key:"scrollLeftHover",comment:["Action that allows to scroll left in the hover widget with the left arrow when the hover widget is focused."]},"Scroll Left Hover"),alias:"Scroll Left Hover",precondition:q.hoverFocused,kbOpts:{kbExpr:q.hoverFocused,primary:15,weight:100},metadata:{description:Ai("scrollLeftHoverDescription","Scroll left the editor hover.")}})}run(e,t){const i=ro.get(t);i&&i.scrollLeft()}}class iW extends Ct{constructor(){super({id:_M,label:S({key:"scrollRightHover",comment:["Action that allows to scroll right in the hover widget with the right arrow when the hover widget is focused."]},"Scroll Right Hover"),alias:"Scroll Right Hover",precondition:q.hoverFocused,kbOpts:{kbExpr:q.hoverFocused,primary:17,weight:100},metadata:{description:Ai("scrollRightHoverDescription","Scroll right the editor hover.")}})}run(e,t){const i=ro.get(t);i&&i.scrollRight()}}class nW extends Ct{constructor(){super({id:bM,label:S({key:"pageUpHover",comment:["Action that allows to page up in the hover widget with the page up command when the hover widget is focused."]},"Page Up Hover"),alias:"Page Up Hover",precondition:q.hoverFocused,kbOpts:{kbExpr:q.hoverFocused,primary:11,secondary:[528],weight:100},metadata:{description:Ai("pageUpHoverDescription","Page up the editor hover.")}})}run(e,t){const i=ro.get(t);i&&i.pageUp()}}class sW extends Ct{constructor(){super({id:CM,label:S({key:"pageDownHover",comment:["Action that allows to page down in the hover widget with the page down command when the hover widget is focused."]},"Page Down Hover"),alias:"Page Down Hover",precondition:q.hoverFocused,kbOpts:{kbExpr:q.hoverFocused,primary:12,secondary:[530],weight:100},metadata:{description:Ai("pageDownHoverDescription","Page down the editor hover.")}})}run(e,t){const i=ro.get(t);i&&i.pageDown()}}class oW extends Ct{constructor(){super({id:EM,label:S({key:"goToTopHover",comment:["Action that allows to go to the top of the hover widget with the home command when the hover widget is focused."]},"Go To Top Hover"),alias:"Go To Bottom Hover",precondition:q.hoverFocused,kbOpts:{kbExpr:q.hoverFocused,primary:14,secondary:[2064],weight:100},metadata:{description:Ai("goToTopHoverDescription","Go to the top of the editor hover.")}})}run(e,t){const i=ro.get(t);i&&i.goToTop()}}class rW extends Ct{constructor(){super({id:yM,label:S({key:"goToBottomHover",comment:["Action that allows to go to the bottom in the hover widget with the end command when the hover widget is focused."]},"Go To Bottom Hover"),alias:"Go To Bottom Hover",precondition:q.hoverFocused,kbOpts:{kbExpr:q.hoverFocused,primary:13,secondary:[2066],weight:100},metadata:{description:Ai("goToBottomHoverDescription","Go to the bottom of the editor hover.")}})}run(e,t){const i=ro.get(t);i&&i.goToBottom()}}class aW extends Ct{constructor(){super({id:pb,label:wM,alias:"Increase Hover Verbosity Level",precondition:q.hoverVisible})}run(e,t,i){const n=ro.get(t);if(!n)return;const s=(i==null?void 0:i.index)!==void 0?i.index:n.focusedHoverPartIndex();n.updateHoverVerbosityLevel(ur.Increase,s,i==null?void 0:i.focus)}}class lW extends Ct{constructor(){super({id:xb,label:SM,alias:"Decrease Hover Verbosity Level",precondition:q.hoverVisible})}run(e,t,i){var r;const n=ro.get(t);if(!n)return;const s=(i==null?void 0:i.index)!==void 0?i.index:n.focusedHoverPartIndex();(r=ro.get(t))==null||r.updateHoverVerbosityLevel(ur.Decrease,s,i==null?void 0:i.focus)}}var cW=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},TC=function(o,e){return function(t,i){e(t,i,o)}};const _r=mi;class dW{constructor(e,t,i){this.owner=e,this.range=t,this.marker=i}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}const OD={type:1,filter:{include:Xn.QuickFix},triggerAction:Ho.QuickFixHover};let oy=class{constructor(e,t,i,n){this._editor=e,this._markerDecorationsService=t,this._openerService=i,this._languageFeaturesService=n,this.hoverOrdinal=1,this.recentMarkerCodeActionsInfo=void 0}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1&&!e.supportsMarkerHover)return[];const i=this._editor.getModel(),n=e.range.startLineNumber,s=i.getLineMaxColumn(n),r=[];for(const a of t){const d=a.range.startLineNumber===n?a.range.startColumn:1,u=a.range.endLineNumber===n?a.range.endColumn:s,f=this._markerDecorationsService.getMarker(i.uri,a);if(!f)continue;const g=new Q(e.range.startLineNumber,d,e.range.startLineNumber,u);r.push(new dW(this,g,f))}return r}renderHoverParts(e,t){if(!t.length)return new zu([]);const i=new Tt,n=[];t.forEach(r=>{const a=this._renderMarkerHover(r);e.fragment.appendChild(a.hoverElement),n.push(a)});const s=t.length===1?t[0]:t.sort((r,a)=>ho.compare(r.marker.severity,a.marker.severity))[0];return this.renderMarkerStatusbar(e,s,i),new zu(n)}_renderMarkerHover(e){const t=new Tt,i=_r("div.hover-row"),n=di(i,_r("div.marker.hover-contents")),{source:s,message:r,code:a,relatedInformation:d}=e.marker;this._editor.applyFontInfo(n);const u=di(n,_r("span"));if(u.style.whiteSpace="pre-wrap",u.innerText=r,s||a)if(a&&typeof a!="string"){const g=_r("span");if(s){const y=di(g,_r("span"));y.innerText=s}const p=di(g,_r("a.code-link"));p.setAttribute("href",a.target.toString()),t.add(Bn(p,"click",y=>{this._openerService.open(a.target,{allowCommands:!0}),y.preventDefault(),y.stopPropagation()}));const C=di(p,_r("span"));C.innerText=a.value;const b=di(n,g);b.style.opacity="0.6",b.style.paddingLeft="6px"}else{const g=di(n,_r("span"));g.style.opacity="0.6",g.style.paddingLeft="6px",g.innerText=s&&a?`${s}(${a})`:s||`(${a})`}if(Yo(d))for(const{message:g,resource:p,startLineNumber:C,startColumn:b}of d){const y=di(n,_r("div"));y.style.marginTop="8px";const w=di(y,_r("a"));w.innerText=`${Ua(p)}(${C}, ${b}): `,w.style.cursor="pointer",t.add(Bn(w,"click",I=>{if(I.stopPropagation(),I.preventDefault(),this._openerService){const T={selection:{startLineNumber:C,startColumn:b}};this._openerService.open(p,{fromUserGesture:!0,editorOptions:T}).catch(qn)}}));const A=di(y,_r("span"));A.innerText=g,this._editor.applyFontInfo(A)}return{hoverPart:e,hoverElement:i,dispose:()=>t.dispose()}}renderMarkerStatusbar(e,t,i){if(t.marker.severity===ho.Error||t.marker.severity===ho.Warning||t.marker.severity===ho.Info){const n=$u.get(this._editor);n&&e.statusBar.addAction({label:S("view problem","View Problem"),commandId:bv.ID,run:()=>{e.hide(),n.showAtMarker(t.marker),this._editor.focus()}})}if(!this._editor.getOption(92)){const n=e.statusBar.append(_r("div"));this.recentMarkerCodeActionsInfo&&(QS.makeKey(this.recentMarkerCodeActionsInfo.marker)===QS.makeKey(t.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||(n.textContent=S("noQuickFixes","No quick fixes available")):this.recentMarkerCodeActionsInfo=void 0);const s=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?Rt.None:kg(()=>n.textContent=S("checkingForQuickFixes","Checking for quick fixes..."),200,i);n.textContent||(n.textContent=" ");const r=this.getCodeActions(t.marker);i.add(is(()=>r.cancel())),r.then(a=>{if(s.dispose(),this.recentMarkerCodeActionsInfo={marker:t.marker,hasCodeActions:a.validActions.length>0},!this.recentMarkerCodeActionsInfo.hasCodeActions){a.dispose(),n.textContent=S("noQuickFixes","No quick fixes available");return}n.style.display="none";let d=!1;i.add(is(()=>{d||a.dispose()})),e.statusBar.addAction({label:S("quick fixes","Quick Fix..."),commandId:y9,run:u=>{d=!0;const f=q0.get(this._editor),g=yo(u);e.hide(),f==null||f.showCodeActions(OD,a,{x:g.left,y:g.top,width:g.width,height:g.height})}})},qn)}}getCodeActions(e){return qs(t=>qh(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new Q(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),OD,fl.None,t))}};oy=cW([TC(1,mL),TC(2,da),TC(3,Fi)],oy);class uW{get lineNumber(){return this._lineNumber}set lineNumber(e){this._lineNumber=e}get lane(){return this._laneOrLine}set lane(e){this._laneOrLine=e}constructor(e){this._editor=e,this._lineNumber=-1,this._laneOrLine=ym.Center}computeSync(){var s;const e=r=>({value:r}),t=this._editor.getLineDecorations(this._lineNumber),i=[],n=this._laneOrLine==="lineNo";if(!t)return i;for(const r of t){const a=((s=r.options.glyphMargin)==null?void 0:s.position)??ym.Center;if(!n&&a!==this._laneOrLine)continue;const d=n?r.options.lineNumberHoverMessage:r.options.glyphMarginHoverMessage;!d||Pg(d)||i.push(..._A(d).map(e))}return i}}var hW=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},HD=function(o,e){return function(t,i){e(t,i,o)}},ry;const WD=mi;var fu;let ay=(fu=class extends Rt{constructor(e,t,i){super(),this._renderDisposeables=this._register(new Tt),this._editor=e,this._isVisible=!1,this._messages=[],this._hover=this._register(new vA),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._markdownRenderer=this._register(new uf({editor:this._editor},t,i)),this._computer=new uW(this._editor),this._hoverOperation=this._register(new P5(this._editor,this._computer)),this._register(this._hoverOperation.onResult(n=>{this._withResult(n.value)})),this._register(this._editor.onDidChangeModelDecorations(()=>this._onModelDecorationsChanged())),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(50)&&this._updateFont()})),this._register(Sl(this._hover.containerDomNode,"mouseleave",n=>{this._onMouseLeave(n)})),this._editor.addOverlayWidget(this)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return ry.ID}getDomNode(){return this._hover.containerDomNode}getPosition(){return null}_updateFont(){Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(t=>this._editor.applyFontInfo(t))}_onModelDecorationsChanged(){this._isVisible&&(this._hoverOperation.cancel(),this._hoverOperation.start(0))}showsOrWillShow(e){const t=e.target;return t.type===2&&t.detail.glyphMarginLane?(this._startShowingAt(t.position.lineNumber,t.detail.glyphMarginLane),!0):t.type===3?(this._startShowingAt(t.position.lineNumber,"lineNo"),!0):!1}_startShowingAt(e,t){this._computer.lineNumber===e&&this._computer.lane===t||(this._hoverOperation.cancel(),this.hide(),this._computer.lineNumber=e,this._computer.lane=t,this._hoverOperation.start(0))}hide(){this._computer.lineNumber=-1,this._hoverOperation.cancel(),this._isVisible&&(this._isVisible=!1,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible))}_withResult(e){this._messages=e,this._messages.length>0?this._renderMessages(this._computer.lineNumber,this._messages):this.hide()}_renderMessages(e,t){this._renderDisposeables.clear();const i=document.createDocumentFragment();for(const n of t){const s=WD("div.hover-row.markdown-hover"),r=di(s,WD("div.hover-contents")),a=this._renderDisposeables.add(this._markdownRenderer.render(n.value));r.appendChild(a.element),i.appendChild(s)}this._updateContents(i),this._showAt(e)}_updateContents(e){this._hover.contentsDomNode.textContent="",this._hover.contentsDomNode.appendChild(e),this._updateFont()}_showAt(e){this._isVisible||(this._isVisible=!0,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible));const t=this._editor.getLayoutInfo(),i=this._editor.getTopForLineNumber(e),n=this._editor.getScrollTop(),s=this._editor.getOption(67),r=this._hover.containerDomNode.clientHeight,a=i-n-(r-s)/2,d=t.glyphMarginLeft+t.glyphMarginWidth+(this._computer.lane==="lineNo"?t.lineNumbersWidth:0);this._hover.containerDomNode.style.left=`${d}px`,this._hover.containerDomNode.style.top=`${Math.max(Math.round(a),0)}px`}_onMouseLeave(e){const t=this._editor.getDomNode();(!t||!mb(t,e.x,e.y))&&this.hide()}},ry=fu,fu.ID="editor.contrib.modesGlyphHoverWidget",fu);ay=ry=hW([HD(1,ha),HD(2,da)],ay);var fW=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},gW=function(o,e){return function(t,i){e(t,i,o)}},w0;let Cv=(w0=class extends Rt{constructor(e,t){super(),this._editor=e,this._instantiationService=t,this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new Tt,this._hoverState={mouseDown:!1},this._reactToEditorMouseMoveRunner=this._register(new Ms(()=>this._reactToEditorMouseMove(this._mouseMoveEvent),0)),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration(i=>{i.hasChanged(60)&&(this._unhookListeners(),this._hookListeners())}))}_hookListeners(){const e=this._editor.getOption(60);this._hoverSettings={enabled:e.enabled,sticky:e.sticky,hidingDelay:e.hidingDelay},e.enabled?(this._listenersStore.add(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))):(this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))),this._listenersStore.add(this._editor.onMouseLeave(t=>this._onEditorMouseLeave(t))),this._listenersStore.add(this._editor.onDidChangeModel(()=>{this._cancelScheduler(),this._hideWidgets()})),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange(t=>this._onEditorScrollChanged(t)))}_unhookListeners(){this._listenersStore.clear()}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_onEditorScrollChanged(e){(e.scrollTopChanged||e.scrollLeftChanged)&&this._hideWidgets()}_onEditorMouseDown(e){this._hoverState.mouseDown=!0,!this._isMouseOnMarginHoverWidget(e)&&this._hideWidgets()}_isMouseOnMarginHoverWidget(e){var i;const t=(i=this._glyphWidget)==null?void 0:i.getDomNode();return t?mb(t,e.event.posx,e.event.posy):!1}_onEditorMouseUp(){this._hoverState.mouseDown=!1}_onEditorMouseLeave(e){this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._cancelScheduler(),this._isMouseOnMarginHoverWidget(e))||this._hideWidgets()}_shouldNotRecomputeCurrentHoverWidget(e){const t=this._hoverSettings.sticky,i=this._isMouseOnMarginHoverWidget(e);return t&&i}_onEditorMouseMove(e){if(this.shouldKeepOpenOnEditorMouseMoveOrLeave)return;if(this._mouseMoveEvent=e,this._shouldNotRecomputeCurrentHoverWidget(e)){this._reactToEditorMouseMoveRunner.cancel();return}this._reactToEditorMouseMove(e)}_reactToEditorMouseMove(e){!e||this._tryShowHoverWidget(e)||this._hideWidgets()}_tryShowHoverWidget(e){return this._getOrCreateGlyphWidget().showsOrWillShow(e)}_onKeyDown(e){this._editor.hasModel()&&(e.keyCode===5||e.keyCode===6||e.keyCode===57||e.keyCode===4||this._hideWidgets())}_hideWidgets(){var e;(e=this._glyphWidget)==null||e.hide()}_getOrCreateGlyphWidget(){return this._glyphWidget||(this._glyphWidget=this._instantiationService.createInstance(ay,this._editor)),this._glyphWidget}dispose(){var e;super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),(e=this._glyphWidget)==null||e.dispose()}},w0.ID="editor.contrib.marginHover",w0);Cv=fW([gW(1,sn)],Cv);class pW{}class xW{}class mW{}hn(ro.ID,ro,2);hn(Cv.ID,Cv,2);Le(YH);Le(QH);Le(JH);Le(eW);Le(tW);Le(iW);Le(nW);Le(sW);Le(oW);Le(rW);Le(aW);Le(lW);th.register(Zg);th.register(oy);$_((o,e)=>{const t=o.getColor(vL);t&&(e.addRule(`.monaco-editor .monaco-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${t.transparent(.5)}; }`),e.addRule(`.monaco-editor .monaco-hover hr { border-top: 1px solid ${t.transparent(.5)}; }`),e.addRule(`.monaco-editor .monaco-hover hr { border-bottom: 0px solid ${t.transparent(.5)}; }`))});Db.register(new pW);Db.register(new xW);Db.register(new mW);function Lo(o,e){let t=0;for(let i=0;i<o.length;i++)o.charAt(i)===" "?t+=e:t++;return t}function vg(o,e,t){o=o<0?0:o;let i="";if(!t){const n=Math.floor(o/e);o=o%e;for(let s=0;s<n;s++)i+=" "}for(let n=0;n<o;n++)i+=" ";return i}function DB(o,e,t,i){if(o.getLineCount()===1&&o.getLineMaxColumn(1)===1)return[];const n=e.getLanguageConfiguration(o.getLanguageId()).indentRulesSupport;if(!n)return[];const s=new _L(o,n,e);for(i=Math.min(i,o.getLineCount());t<=i&&s.shouldIgnore(t);)t++;if(t>i-1)return[];const{tabSize:r,indentSize:a,insertSpaces:d}=o.getOptions(),u=(y,w)=>(w=w||1,H0.shiftIndent(y,y.length+w,r,a,d)),f=(y,w)=>(w=w||1,H0.unshiftIndent(y,y.length+w,r,a,d)),g=[],p=o.getLineContent(t);let C=eo(p),b=C;s.shouldIncrease(t)?(b=u(b),C=u(C)):s.shouldIndentNextLine(t)&&(b=u(b)),t++;for(let y=t;y<=i;y++){if(vW(o,y))continue;const w=o.getLineContent(y),A=eo(w),I=b;s.shouldDecrease(y,I)&&(b=f(b),C=f(C)),A!==b&&g.push(cs.replaceMove(new $i(y,1,y,A.length+1),bL(b,a,d))),!s.shouldIgnore(y)&&(s.shouldIncrease(y,I)?(C=u(C),b=C):s.shouldIndentNextLine(y,I)?b=u(b):b=C)}return g}function vW(o,e){return o.tokenization.isCheapToTokenize(e)?o.tokenization.getLineTokens(e).getStandardTokenType(0)===2:!1}var _W=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},bW=function(o,e){return function(t,i){e(t,i,o)}};const g_=class g_ extends Ct{constructor(){super({id:g_.ID,label:S("indentationToSpaces","Convert Indentation to Spaces"),alias:"Convert Indentation to Spaces",precondition:q.writable,metadata:{description:Ai("indentationToSpacesDescription","Convert the tab indentation to spaces.")}})}run(e,t){const i=t.getModel();if(!i)return;const n=i.getOptions(),s=t.getSelection();if(!s)return;const r=new SW(s,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!0})}};g_.ID="editor.action.indentationToSpaces";let ly=g_;const p_=class p_ extends Ct{constructor(){super({id:p_.ID,label:S("indentationToTabs","Convert Indentation to Tabs"),alias:"Convert Indentation to Tabs",precondition:q.writable,metadata:{description:Ai("indentationToTabsDescription","Convert the spaces indentation to tabs.")}})}run(e,t){const i=t.getModel();if(!i)return;const n=i.getOptions(),s=t.getSelection();if(!s)return;const r=new DW(s,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!1})}};p_.ID="editor.action.indentationToTabs";let cy=p_;class Z9 extends Ct{constructor(e,t,i){super(i),this.insertSpaces=e,this.displaySizeOnly=t}run(e,t){const i=e.get(Tl),n=e.get(vo),s=t.getModel();if(!s)return;const r=n.getCreationOptions(s.getLanguageId(),s.uri,s.isForSimpleWidget),a=s.getOptions(),d=[1,2,3,4,5,6,7,8].map(f=>({id:f.toString(),label:f.toString(),description:f===r.tabSize&&f===a.tabSize?S("configuredTabSize","Configured Tab Size"):f===r.tabSize?S("defaultTabSize","Default Tab Size"):f===a.tabSize?S("currentTabSize","Current Tab Size"):void 0})),u=Math.min(s.getOptions().tabSize-1,7);setTimeout(()=>{i.pick(d,{placeHolder:S({key:"selectTabWidth",comment:["Tab corresponds to the tab key"]},"Select Tab Size for Current File"),activeItem:d[u]}).then(f=>{if(f&&s&&!s.isDisposed()){const g=parseInt(f.label,10);this.displaySizeOnly?s.updateOptions({tabSize:g}):s.updateOptions({tabSize:g,indentSize:g,insertSpaces:this.insertSpaces})}})},50)}}const x_=class x_ extends Z9{constructor(){super(!1,!1,{id:x_.ID,label:S("indentUsingTabs","Indent Using Tabs"),alias:"Indent Using Tabs",precondition:void 0,metadata:{description:Ai("indentUsingTabsDescription","Use indentation with tabs.")}})}};x_.ID="editor.action.indentUsingTabs";let dy=x_;const m_=class m_ extends Z9{constructor(){super(!0,!1,{id:m_.ID,label:S("indentUsingSpaces","Indent Using Spaces"),alias:"Indent Using Spaces",precondition:void 0,metadata:{description:Ai("indentUsingSpacesDescription","Use indentation with spaces.")}})}};m_.ID="editor.action.indentUsingSpaces";let uy=m_;const v_=class v_ extends Z9{constructor(){super(!0,!0,{id:v_.ID,label:S("changeTabDisplaySize","Change Tab Display Size"),alias:"Change Tab Display Size",precondition:void 0,metadata:{description:Ai("changeTabDisplaySizeDescription","Change the space size equivalent of the tab.")}})}};v_.ID="editor.action.changeTabDisplaySize";let hy=v_;const __=class __ extends Ct{constructor(){super({id:__.ID,label:S("detectIndentation","Detect Indentation from Content"),alias:"Detect Indentation from Content",precondition:void 0,metadata:{description:Ai("detectIndentationDescription","Detect the indentation from content.")}})}run(e,t){const i=e.get(vo),n=t.getModel();if(!n)return;const s=i.getCreationOptions(n.getLanguageId(),n.uri,n.isForSimpleWidget);n.detectIndentation(s.insertSpaces,s.tabSize)}};__.ID="editor.action.detectIndentation";let fy=__;class CW extends Ct{constructor(){super({id:"editor.action.reindentlines",label:S("editor.reindentlines","Reindent Lines"),alias:"Reindent Lines",precondition:q.writable,metadata:{description:Ai("editor.reindentlinesDescription","Reindent the lines of the editor.")}})}run(e,t){const i=e.get(js),n=t.getModel();if(!n)return;const s=DB(n,i,1,n.getLineCount());s.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,s),t.pushUndoStop())}}class EW extends Ct{constructor(){super({id:"editor.action.reindentselectedlines",label:S("editor.reindentselectedlines","Reindent Selected Lines"),alias:"Reindent Selected Lines",precondition:q.writable,metadata:{description:Ai("editor.reindentselectedlinesDescription","Reindent the selected lines of the editor.")}})}run(e,t){const i=e.get(js),n=t.getModel();if(!n)return;const s=t.getSelections();if(s===null)return;const r=[];for(const a of s){let d=a.startLineNumber,u=a.endLineNumber;if(d!==u&&a.endColumn===1&&u--,d===1){if(d===u)continue}else d--;const f=DB(n,i,d,u);r.push(...f)}r.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,r),t.pushUndoStop())}}class yW{constructor(e,t){this._initialSelection=t,this._edits=[],this._selectionId=null;for(const i of e)i.range&&typeof i.text=="string"&&this._edits.push(i)}getEditOperations(e,t){for(const n of this._edits)t.addEditOperation(Q.lift(n.range),n.text);let i=!1;Array.isArray(this._edits)&&this._edits.length===1&&this._initialSelection.isEmpty()&&(this._edits[0].range.startColumn===this._initialSelection.endColumn&&this._edits[0].range.startLineNumber===this._initialSelection.endLineNumber?(i=!0,this._selectionId=t.trackSelection(this._initialSelection,!0)):this._edits[0].range.endColumn===this._initialSelection.startColumn&&this._edits[0].range.endLineNumber===this._initialSelection.startLineNumber&&(i=!0,this._selectionId=t.trackSelection(this._initialSelection,!1))),i||(this._selectionId=t.trackSelection(this._initialSelection))}computeCursorState(e,t){return t.getTrackedSelection(this._selectionId)}}var S0;let Ev=(S0=class{constructor(e,t){this.editor=e,this._languageConfigurationService=t,this.callOnDispose=new Tt,this.callOnModel=new Tt,this.callOnDispose.add(e.onDidChangeConfiguration(()=>this.update())),this.callOnDispose.add(e.onDidChangeModel(()=>this.update())),this.callOnDispose.add(e.onDidChangeModelLanguage(()=>this.update()))}update(){this.callOnModel.clear(),!(this.editor.getOption(12)<4||this.editor.getOption(55))&&this.editor.hasModel()&&this.callOnModel.add(this.editor.onDidPaste(({range:e})=>{this.trigger(e)}))}trigger(e){const t=this.editor.getSelections();if(t===null||t.length>1)return;const i=this.editor.getModel();if(!i||this.rangeContainsOnlyWhitespaceCharacters(i,e)||wW(i,e)||!i.tokenization.isCheapToTokenize(e.getStartPosition().lineNumber))return;const s=this.editor.getOption(12),{tabSize:r,indentSize:a,insertSpaces:d}=i.getOptions(),u=[],f={shiftIndent:b=>H0.shiftIndent(b,b.length+1,r,a,d),unshiftIndent:b=>H0.unshiftIndent(b,b.length+1,r,a,d)};let g=e.startLineNumber;for(;g<=e.endLineNumber;){if(this.shouldIgnoreLine(i,g)){g++;continue}break}if(g>e.endLineNumber)return;let p=i.getLineContent(g);if(!/\S/.test(p.substring(0,e.startColumn-1))){const b=lg(s,i,i.getLanguageId(),g,f,this._languageConfigurationService);if(b!==null){const y=eo(p),w=Lo(b,r),A=Lo(y,r);if(w!==A){const I=vg(w,r,d);u.push({range:new Q(g,1,g,y.length+1),text:I}),p=I+p.substring(y.length)}else{const I=ck(i,g,this._languageConfigurationService);if(I===0||I===8)return}}}const C=g;for(;g<e.endLineNumber;){if(!/\S/.test(i.getLineContent(g+1))){g++;continue}break}if(g!==e.endLineNumber){const y=lg(s,{tokenization:{getLineTokens:w=>i.tokenization.getLineTokens(w),getLanguageId:()=>i.getLanguageId(),getLanguageIdAtPosition:(w,A)=>i.getLanguageIdAtPosition(w,A)},getLineContent:w=>w===C?p:i.getLineContent(w)},i.getLanguageId(),g+1,f,this._languageConfigurationService);if(y!==null){const w=Lo(y,r),A=Lo(eo(i.getLineContent(g+1)),r);if(w!==A){const I=w-A;for(let T=g+1;T<=e.endLineNumber;T++){const R=i.getLineContent(T),P=eo(R),j=Lo(P,r)+I,J=vg(j,r,d);J!==P&&u.push({range:new Q(T,1,T,P.length+1),text:J})}}}}if(u.length>0){this.editor.pushUndoStop();const b=new yW(u,this.editor.getSelection());this.editor.executeCommand("autoIndentOnPaste",b),this.editor.pushUndoStop()}}rangeContainsOnlyWhitespaceCharacters(e,t){const i=s=>s.trim().length===0;let n=!0;if(t.startLineNumber===t.endLineNumber){const r=e.getLineContent(t.startLineNumber).substring(t.startColumn-1,t.endColumn-1);n=i(r)}else for(let s=t.startLineNumber;s<=t.endLineNumber;s++){const r=e.getLineContent(s);if(s===t.startLineNumber){const a=r.substring(t.startColumn-1);n=i(a)}else if(s===t.endLineNumber){const a=r.substring(0,t.endColumn-1);n=i(a)}else n=e.getLineFirstNonWhitespaceColumn(s)===0;if(!n)break}return n}shouldIgnoreLine(e,t){e.tokenization.forceTokenization(t);const i=e.getLineFirstNonWhitespaceColumn(t);if(i===0)return!0;const n=e.tokenization.getLineTokens(t);if(n.getCount()>0){const s=n.findTokenIndexAtOffset(i);if(s>=0&&n.getStandardTokenType(s)===1)return!0}return!1}dispose(){this.callOnDispose.dispose(),this.callOnModel.dispose()}},S0.ID="editor.contrib.autoIndentOnPaste",S0);Ev=_W([bW(1,js)],Ev);function wW(o,e){const t=i=>CL(o,i)===2;return t(e.getStartPosition())||t(e.getEndPosition())}function AB(o,e,t,i){if(o.getLineCount()===1&&o.getLineMaxColumn(1)===1)return;let n="";for(let r=0;r<t;r++)n+=" ";const s=new RegExp(n,"gi");for(let r=1,a=o.getLineCount();r<=a;r++){let d=o.getLineFirstNonWhitespaceColumn(r);if(d===0&&(d=o.getLineMaxColumn(r)),d===1)continue;const u=new Q(r,1,r,d),f=o.getValueInRange(u),g=i?f.replace(/\t/ig,n):f.replace(s," ");e.addEditOperation(u,g)}}class SW{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),AB(e,t,this.tabSize,!0)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}class DW{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),AB(e,t,this.tabSize,!1)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}hn(Ev.ID,Ev,2);Le(ly);Le(cy);Le(dy);Le(uy);Le(hy);Le(fy);Le(CW);Le(EW);hn(Yg.ID,Yg,1);th.register(ev);class AW{constructor(e,t,i){this._editRange=e,this._originalSelection=t,this._text=i}getEditOperations(e,t){t.addTrackedEditOperation(this._editRange,this._text)}computeCursorState(e,t){const n=t.getInverseEditOperations()[0].range;return this._originalSelection.isEmpty()?new $i(n.endLineNumber,Math.min(this._originalSelection.positionColumn,n.endColumn),n.endLineNumber,Math.min(this._originalSelection.positionColumn,n.endColumn)):new $i(n.endLineNumber,n.endColumn-this._text.length,n.endLineNumber,n.endColumn)}}var kW=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},BW=function(o,e){return function(t,i){e(t,i,o)}},hm,Ic;let tf=(Ic=class{static get(e){return e.getContribution(hm.ID)}constructor(e,t){this.editor=e,this.editorWorkerService=t,this.decorations=this.editor.createDecorationsCollection()}dispose(){}run(e,t){var d;(d=this.currentRequest)==null||d.cancel();const i=this.editor.getSelection(),n=this.editor.getModel();if(!n||!i)return;let s=i;if(s.startLineNumber!==s.endLineNumber)return;const r=new lk(this.editor,5),a=n.uri;return this.editorWorkerService.canNavigateValueSet(a)?(this.currentRequest=qs(u=>this.editorWorkerService.navigateValueSet(a,s,t)),this.currentRequest.then(u=>{var b;if(!u||!u.range||!u.value||!r.validate(this.editor))return;const f=Q.lift(u.range);let g=u.range;const p=u.value.length-(s.endColumn-s.startColumn);g={startLineNumber:g.startLineNumber,startColumn:g.startColumn,endLineNumber:g.endLineNumber,endColumn:g.startColumn+u.value.length},p>1&&(s=new $i(s.startLineNumber,s.startColumn,s.endLineNumber,s.endColumn+p-1));const C=new AW(f,s,u.value);this.editor.pushUndoStop(),this.editor.executeCommand(e,C),this.editor.pushUndoStop(),this.decorations.set([{range:g,options:hm.DECORATION}]),(b=this.decorationRemover)==null||b.cancel(),this.decorationRemover=J_(350),this.decorationRemover.then(()=>this.decorations.clear()).catch(qn)}).catch(qn)):Promise.resolve(void 0)}},hm=Ic,Ic.ID="editor.contrib.inPlaceReplaceController",Ic.DECORATION=vn.register({description:"in-place-replace",className:"valueSetReplacement"}),Ic);tf=hm=kW([BW(1,Nl)],tf);class FW extends Ct{constructor(){super({id:"editor.action.inPlaceReplace.up",label:S("InPlaceReplaceAction.previous.label","Replace with Previous Value"),alias:"Replace with Previous Value",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:3159,weight:100}})}run(e,t){const i=tf.get(t);return i?i.run(this.id,!1):Promise.resolve(void 0)}}class LW extends Ct{constructor(){super({id:"editor.action.inPlaceReplace.down",label:S("InPlaceReplaceAction.next.label","Replace with Next Value"),alias:"Replace with Next Value",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:3161,weight:100}})}run(e,t){const i=tf.get(t);return i?i.run(this.id,!0):Promise.resolve(void 0)}}hn(tf.ID,tf,4);Le(FW);Le(LW);class IW extends Ct{constructor(){super({id:"expandLineSelection",label:S("expandLineSelection","Expand Line Selection"),alias:"Expand Line Selection",precondition:void 0,kbOpts:{weight:0,kbExpr:q.textInputFocus,primary:2090}})}run(e,t,i){if(i=i||{},!t.hasModel())return;const n=t._getViewModel();n.model.pushStackElement(),n.setCursorStates(i.source,3,Zw.expandLineSelection(n,n.getCursorStates())),n.revealAllCursors(i.source,!0)}}Le(IW);class PW{constructor(e,t,i){this._selection=e,this._cursors=t,this._selectionId=null,this._trimInRegexesAndStrings=i}getEditOperations(e,t){const i=TW(e,this._cursors,this._trimInRegexesAndStrings);for(let n=0,s=i.length;n<s;n++){const r=i[n];t.addEditOperation(r.range,r.text)}this._selectionId=t.trackSelection(this._selection)}computeCursorState(e,t){return t.getTrackedSelection(this._selectionId)}}function TW(o,e,t){e.sort((a,d)=>a.lineNumber===d.lineNumber?a.column-d.column:a.lineNumber-d.lineNumber);for(let a=e.length-2;a>=0;a--)e[a].lineNumber===e[a+1].lineNumber&&e.splice(a,1);const i=[];let n=0,s=0;const r=e.length;for(let a=1,d=o.getLineCount();a<=d;a++){const u=o.getLineContent(a),f=u.length+1;let g=0;if(s<r&&e[s].lineNumber===a&&(g=e[s].column,s++,g===f)||u.length===0)continue;const p=Jx(u);let C=0;if(p===-1)C=1;else if(p!==u.length-1)C=p+2;else continue;if(!t){if(!o.tokenization.hasAccurateTokensForLine(a))continue;const b=o.tokenization.getLineTokens(a),y=b.getStandardTokenType(b.findTokenIndexAtOffset(C));if(y===2||y===3)continue}C=Math.max(g,C),i[n++]=cs.delete(new Q(a,C,a,f))}return i}class kB{constructor(e,t,i){this._selection=e,this._isCopyingDown=t,this._noop=i||!1,this._selectionDirection=0,this._selectionId=null,this._startLineNumberDelta=0,this._endLineNumberDelta=0}getEditOperations(e,t){let i=this._selection;this._startLineNumberDelta=0,this._endLineNumberDelta=0,i.startLineNumber<i.endLineNumber&&i.endColumn===1&&(this._endLineNumberDelta=1,i=i.setEndPosition(i.endLineNumber-1,e.getLineMaxColumn(i.endLineNumber-1)));const n=[];for(let r=i.startLineNumber;r<=i.endLineNumber;r++)n.push(e.getLineContent(r));const s=n.join(`
48
+ `);s===""&&this._isCopyingDown&&(this._startLineNumberDelta++,this._endLineNumberDelta++),this._noop?t.addEditOperation(new Q(i.endLineNumber,e.getLineMaxColumn(i.endLineNumber),i.endLineNumber+1,1),i.endLineNumber===e.getLineCount()?"":`
49
+ `):this._isCopyingDown?t.addEditOperation(new Q(i.startLineNumber,1,i.startLineNumber,1),s+`
50
+ `):t.addEditOperation(new Q(i.endLineNumber,e.getLineMaxColumn(i.endLineNumber),i.endLineNumber,e.getLineMaxColumn(i.endLineNumber)),`
51
+ `+s),this._selectionId=t.trackSelection(i),this._selectionDirection=this._selection.getDirection()}computeCursorState(e,t){let i=t.getTrackedSelection(this._selectionId);if(this._startLineNumberDelta!==0||this._endLineNumberDelta!==0){let n=i.startLineNumber,s=i.startColumn,r=i.endLineNumber,a=i.endColumn;this._startLineNumberDelta!==0&&(n=n+this._startLineNumberDelta,s=1),this._endLineNumberDelta!==0&&(r=r+this._endLineNumberDelta,a=1),i=$i.createWithDirection(n,s,r,a,this._selectionDirection)}return i}}var MW=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},RW=function(o,e){return function(t,i){e(t,i,o)}};let gy=class{constructor(e,t,i,n){this._languageConfigurationService=n,this._selection=e,this._isMovingDown=t,this._autoIndent=i,this._selectionId=null,this._moveEndLineSelectionShrink=!1}getEditOperations(e,t){const i=()=>e.getLanguageId(),n=(g,p)=>e.getLanguageIdAtPosition(g,p),s=e.getLineCount();if(this._isMovingDown&&this._selection.endLineNumber===s){this._selectionId=t.trackSelection(this._selection);return}if(!this._isMovingDown&&this._selection.startLineNumber===1){this._selectionId=t.trackSelection(this._selection);return}this._moveEndPositionDown=!1;let r=this._selection;r.startLineNumber<r.endLineNumber&&r.endColumn===1&&(this._moveEndPositionDown=!0,r=r.setEndPosition(r.endLineNumber-1,e.getLineMaxColumn(r.endLineNumber-1)));const{tabSize:a,indentSize:d,insertSpaces:u}=e.getOptions(),f=this.buildIndentConverter(a,d,u);if(r.startLineNumber===r.endLineNumber&&e.getLineMaxColumn(r.startLineNumber)===1){const g=r.startLineNumber,p=this._isMovingDown?g+1:g-1;e.getLineMaxColumn(p)===1?t.addEditOperation(new Q(1,1,1,1),null):(t.addEditOperation(new Q(g,1,g,1),e.getLineContent(p)),t.addEditOperation(new Q(p,1,p,e.getLineMaxColumn(p)),null)),r=new $i(p,1,p,1)}else{let g,p;if(this._isMovingDown){g=r.endLineNumber+1,p=e.getLineContent(g),t.addEditOperation(new Q(g-1,e.getLineMaxColumn(g-1),g,e.getLineMaxColumn(g)),null);let C=p;if(this.shouldAutoIndent(e,r)){const b=this.matchEnterRule(e,f,a,g,r.startLineNumber-1);if(b!==null){const w=eo(e.getLineContent(g)),A=b+Lo(w,a);C=vg(A,a,u)+this.trimStart(p)}else{const w={tokenization:{getLineTokens:I=>I===r.startLineNumber?e.tokenization.getLineTokens(g):e.tokenization.getLineTokens(I),getLanguageId:i,getLanguageIdAtPosition:n},getLineContent:I=>I===r.startLineNumber?e.getLineContent(g):e.getLineContent(I)},A=lg(this._autoIndent,w,e.getLanguageIdAtPosition(g,1),r.startLineNumber,f,this._languageConfigurationService);if(A!==null){const I=eo(e.getLineContent(g)),T=Lo(A,a),R=Lo(I,a);T!==R&&(C=vg(T,a,u)+this.trimStart(p))}}t.addEditOperation(new Q(r.startLineNumber,1,r.startLineNumber,1),C+`
52
+ `);const y=this.matchEnterRuleMovingDown(e,f,a,r.startLineNumber,g,C);if(y!==null)y!==0&&this.getIndentEditsOfMovingBlock(e,t,r,a,u,y);else{const w={tokenization:{getLineTokens:I=>I===r.startLineNumber?e.tokenization.getLineTokens(g):I>=r.startLineNumber+1&&I<=r.endLineNumber+1?e.tokenization.getLineTokens(I-1):e.tokenization.getLineTokens(I),getLanguageId:i,getLanguageIdAtPosition:n},getLineContent:I=>I===r.startLineNumber?C:I>=r.startLineNumber+1&&I<=r.endLineNumber+1?e.getLineContent(I-1):e.getLineContent(I)},A=lg(this._autoIndent,w,e.getLanguageIdAtPosition(g,1),r.startLineNumber+1,f,this._languageConfigurationService);if(A!==null){const I=eo(e.getLineContent(r.startLineNumber)),T=Lo(A,a),R=Lo(I,a);if(T!==R){const P=T-R;this.getIndentEditsOfMovingBlock(e,t,r,a,u,P)}}}}else t.addEditOperation(new Q(r.startLineNumber,1,r.startLineNumber,1),C+`
53
+ `)}else if(g=r.startLineNumber-1,p=e.getLineContent(g),t.addEditOperation(new Q(g,1,g+1,1),null),t.addEditOperation(new Q(r.endLineNumber,e.getLineMaxColumn(r.endLineNumber),r.endLineNumber,e.getLineMaxColumn(r.endLineNumber)),`
54
+ `+p),this.shouldAutoIndent(e,r)){const C={tokenization:{getLineTokens:y=>y===g?e.tokenization.getLineTokens(r.startLineNumber):e.tokenization.getLineTokens(y),getLanguageId:i,getLanguageIdAtPosition:n},getLineContent:y=>y===g?e.getLineContent(r.startLineNumber):e.getLineContent(y)},b=this.matchEnterRule(e,f,a,r.startLineNumber,r.startLineNumber-2);if(b!==null)b!==0&&this.getIndentEditsOfMovingBlock(e,t,r,a,u,b);else{const y=lg(this._autoIndent,C,e.getLanguageIdAtPosition(r.startLineNumber,1),g,f,this._languageConfigurationService);if(y!==null){const w=eo(e.getLineContent(r.startLineNumber)),A=Lo(y,a),I=Lo(w,a);if(A!==I){const T=A-I;this.getIndentEditsOfMovingBlock(e,t,r,a,u,T)}}}}}this._selectionId=t.trackSelection(r)}buildIndentConverter(e,t,i){return{shiftIndent:n=>H0.shiftIndent(n,n.length+1,e,t,i),unshiftIndent:n=>H0.unshiftIndent(n,n.length+1,e,t,i)}}parseEnterResult(e,t,i,n,s){if(s){let r=s.indentation;s.indentAction===xx.None||s.indentAction===xx.Indent?r=s.indentation+s.appendText:s.indentAction===xx.IndentOutdent?r=s.indentation:s.indentAction===xx.Outdent&&(r=t.unshiftIndent(s.indentation)+s.appendText);const a=e.getLineContent(n);if(this.trimStart(a).indexOf(this.trimStart(r))>=0){const d=eo(e.getLineContent(n));let u=eo(r);const f=ck(e,n,this._languageConfigurationService);f!==null&&f&2&&(u=t.unshiftIndent(u));const g=Lo(u,i),p=Lo(d,i);return g-p}}return null}matchEnterRuleMovingDown(e,t,i,n,s,r){if(Jx(r)>=0){const a=e.getLineMaxColumn(s),d=iC(this._autoIndent,e,new Q(s,a,s,a),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,d)}else{let a=n-1;for(;a>=1;){const f=e.getLineContent(a);if(Jx(f)>=0)break;a--}if(a<1||n>e.getLineCount())return null;const d=e.getLineMaxColumn(a),u=iC(this._autoIndent,e,new Q(a,d,a,d),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,u)}}matchEnterRule(e,t,i,n,s,r){let a=s;for(;a>=1;){let f;if(a===s&&r!==void 0?f=r:f=e.getLineContent(a),Jx(f)>=0)break;a--}if(a<1||n>e.getLineCount())return null;const d=e.getLineMaxColumn(a),u=iC(this._autoIndent,e,new Q(a,d,a,d),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,u)}trimStart(e){return e.replace(/^\s+/,"")}shouldAutoIndent(e,t){if(this._autoIndent<4||!e.tokenization.isCheapToTokenize(t.startLineNumber))return!1;const i=e.getLanguageIdAtPosition(t.startLineNumber,1),n=e.getLanguageIdAtPosition(t.endLineNumber,1);return!(i!==n||this._languageConfigurationService.getLanguageConfiguration(i).indentRulesSupport===null)}getIndentEditsOfMovingBlock(e,t,i,n,s,r){for(let a=i.startLineNumber;a<=i.endLineNumber;a++){const d=e.getLineContent(a),u=eo(d),g=Lo(u,n)+r,p=vg(g,n,s);p!==u&&(t.addEditOperation(new Q(a,1,a,u.length+1),p),a===i.endLineNumber&&i.endColumn<=u.length+1&&p===""&&(this._moveEndLineSelectionShrink=!0))}}computeCursorState(e,t){let i=t.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(i=i.setEndPosition(i.endLineNumber+1,1)),this._moveEndLineSelectionShrink&&i.startLineNumber<i.endLineNumber&&(i=i.setEndPosition(i.endLineNumber,2)),i}};gy=MW([RW(3,js)],gy);const s0=class s0{static getCollator(){return s0._COLLATOR||(s0._COLLATOR=new Intl.Collator),s0._COLLATOR}constructor(e,t){this.selection=e,this.descending=t,this.selectionId=null}getEditOperations(e,t){const i=NW(e,this.selection,this.descending);i&&t.addEditOperation(i.range,i.text),this.selectionId=t.trackSelection(this.selection)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}static canRun(e,t,i){if(e===null)return!1;const n=BB(e,t,i);if(!n)return!1;for(let s=0,r=n.before.length;s<r;s++)if(n.before[s]!==n.after[s])return!0;return!1}};s0._COLLATOR=null;let ip=s0;function BB(o,e,t){const i=e.startLineNumber;let n=e.endLineNumber;if(e.endColumn===1&&n--,i>=n)return null;const s=[];for(let a=i;a<=n;a++)s.push(o.getLineContent(a));let r=s.slice(0);return r.sort(ip.getCollator().compare),t===!0&&(r=r.reverse()),{startLineNumber:i,endLineNumber:n,before:s,after:r}}function NW(o,e,t){const i=BB(o,e,t);return i?cs.replace(new Q(i.startLineNumber,1,i.endLineNumber,o.getLineMaxColumn(i.endLineNumber)),i.after.join(`
55
+ `)):null}class FB extends Ct{constructor(e,t){super(t),this.down=e}run(e,t){if(!t.hasModel())return;const i=t.getSelections().map((r,a)=>({selection:r,index:a,ignore:!1}));i.sort((r,a)=>Q.compareRangesUsingStarts(r.selection,a.selection));let n=i[0];for(let r=1;r<i.length;r++){const a=i[r];n.selection.endLineNumber===a.selection.startLineNumber&&(n.index<a.index?a.ignore=!0:(n.ignore=!0,n=a))}const s=[];for(const r of i)s.push(new kB(r.selection,this.down,r.ignore));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class OW extends FB{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:S("lines.copyUp","Copy Line Up"),alias:"Copy Line Up",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:ni.MenubarSelectionMenu,group:"2_line",title:S({key:"miCopyLinesUp",comment:["&& denotes a mnemonic"]},"&&Copy Line Up"),order:1}})}}class HW extends FB{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:S("lines.copyDown","Copy Line Down"),alias:"Copy Line Down",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:ni.MenubarSelectionMenu,group:"2_line",title:S({key:"miCopyLinesDown",comment:["&& denotes a mnemonic"]},"Co&&py Line Down"),order:2}})}}class WW extends Ct{constructor(){super({id:"editor.action.duplicateSelection",label:S("duplicateSelection","Duplicate Selection"),alias:"Duplicate Selection",precondition:q.writable,menuOpts:{menuId:ni.MenubarSelectionMenu,group:"2_line",title:S({key:"miDuplicateSelection",comment:["&& denotes a mnemonic"]},"&&Duplicate Selection"),order:5}})}run(e,t,i){if(!t.hasModel())return;const n=[],s=t.getSelections(),r=t.getModel();for(const a of s)if(a.isEmpty())n.push(new kB(a,!0));else{const d=new $i(a.endLineNumber,a.endColumn,a.endLineNumber,a.endColumn);n.push(new EL(d,r.getValueInRange(a)))}t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}class LB extends Ct{constructor(e,t){super(t),this.down=e}run(e,t){const i=e.get(js),n=[],s=t.getSelections()||[],r=t.getOption(12);for(const a of s)n.push(new gy(a,this.down,r,i));t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}class zW extends LB{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:S("lines.moveUp","Move Line Up"),alias:"Move Line Up",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:ni.MenubarSelectionMenu,group:"2_line",title:S({key:"miMoveLinesUp",comment:["&& denotes a mnemonic"]},"Mo&&ve Line Up"),order:3}})}}class VW extends LB{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:S("lines.moveDown","Move Line Down"),alias:"Move Line Down",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:ni.MenubarSelectionMenu,group:"2_line",title:S({key:"miMoveLinesDown",comment:["&& denotes a mnemonic"]},"Move &&Line Down"),order:4}})}}class IB extends Ct{constructor(e,t){super(t),this.descending=e}run(e,t){if(!t.hasModel())return;const i=t.getModel();let n=t.getSelections();n.length===1&&n[0].isEmpty()&&(n=[new $i(1,1,i.getLineCount(),i.getLineMaxColumn(i.getLineCount()))]);for(const r of n)if(!ip.canRun(t.getModel(),r,this.descending))return;const s=[];for(let r=0,a=n.length;r<a;r++)s[r]=new ip(n[r],this.descending);t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class jW extends IB{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:S("lines.sortAscending","Sort Lines Ascending"),alias:"Sort Lines Ascending",precondition:q.writable})}}class $W extends IB{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:S("lines.sortDescending","Sort Lines Descending"),alias:"Sort Lines Descending",precondition:q.writable})}}class UW extends Ct{constructor(){super({id:"editor.action.removeDuplicateLines",label:S("lines.deleteDuplicates","Delete Duplicate Lines"),alias:"Delete Duplicate Lines",precondition:q.writable})}run(e,t){if(!t.hasModel())return;const i=t.getModel();if(i.getLineCount()===1&&i.getLineMaxColumn(1)===1)return;const n=[],s=[];let r=0,a=!0,d=t.getSelections();d.length===1&&d[0].isEmpty()&&(d=[new $i(1,1,i.getLineCount(),i.getLineMaxColumn(i.getLineCount()))],a=!1);for(const u of d){const f=new Set,g=[];for(let y=u.startLineNumber;y<=u.endLineNumber;y++){const w=i.getLineContent(y);f.has(w)||(g.push(w),f.add(w))}const p=new $i(u.startLineNumber,1,u.endLineNumber,i.getLineMaxColumn(u.endLineNumber)),C=u.startLineNumber-r,b=new $i(C,1,C+g.length-1,g[g.length-1].length);n.push(cs.replace(p,g.join(`
56
+ `))),s.push(b),r+=u.endLineNumber-u.startLineNumber+1-g.length}t.pushUndoStop(),t.executeEdits(this.id,n,a?s:void 0),t.pushUndoStop()}}const b_=class b_ extends Ct{constructor(){super({id:b_.ID,label:S("lines.trimTrailingWhitespace","Trim Trailing Whitespace"),alias:"Trim Trailing Whitespace",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:Ds(2089,2102),weight:100}})}run(e,t,i){let n=[];i.reason==="auto-save"&&(n=(t.getSelections()||[]).map(f=>new Bi(f.positionLineNumber,f.positionColumn)));const s=t.getSelection();if(s===null)return;const r=e.get(ss),a=t.getModel(),d=r.getValue("files.trimTrailingWhitespaceInRegexAndStrings",{overrideIdentifier:a==null?void 0:a.getLanguageId(),resource:a==null?void 0:a.uri}),u=new PW(s,n,d);t.pushUndoStop(),t.executeCommands(this.id,[u]),t.pushUndoStop()}};b_.ID="editor.action.trimTrailingWhitespace";let py=b_;class qW extends Ct{constructor(){super({id:"editor.action.deleteLines",label:S("lines.delete","Delete Line"),alias:"Delete Line",precondition:q.writable,kbOpts:{kbExpr:q.textInputFocus,primary:3113,weight:100}})}run(e,t){if(!t.hasModel())return;const i=this._getLinesToRemove(t),n=t.getModel();if(n.getLineCount()===1&&n.getLineMaxColumn(1)===1)return;let s=0;const r=[],a=[];for(let d=0,u=i.length;d<u;d++){const f=i[d];let g=f.startLineNumber,p=f.endLineNumber,C=1,b=n.getLineMaxColumn(p);p<n.getLineCount()?(p+=1,b=1):g>1&&(g-=1,C=n.getLineMaxColumn(g)),r.push(cs.replace(new $i(g,C,p,b),"")),a.push(new $i(g-s,f.positionColumn,g-s,f.positionColumn)),s+=f.endLineNumber-f.startLineNumber+1}t.pushUndoStop(),t.executeEdits(this.id,r,a),t.pushUndoStop()}_getLinesToRemove(e){const t=e.getSelections().map(s=>{let r=s.endLineNumber;return s.startLineNumber<s.endLineNumber&&s.endColumn===1&&(r-=1),{startLineNumber:s.startLineNumber,selectionStartColumn:s.selectionStartColumn,endLineNumber:r,positionColumn:s.positionColumn}});t.sort((s,r)=>s.startLineNumber===r.startLineNumber?s.endLineNumber-r.endLineNumber:s.startLineNumber-r.startLineNumber);const i=[];let n=t[0];for(let s=1;s<t.length;s++)n.endLineNumber+1>=t[s].startLineNumber?n.endLineNumber=t[s].endLineNumber:(i.push(n),n=t[s]);return i.push(n),i}}class GW extends Ct{constructor(){super({id:"editor.action.indentLines",label:S("lines.indent","Indent Line"),alias:"Indent Line",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:2142,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,yL.indent(i.cursorConfig,t.getModel(),t.getSelections())),t.pushUndoStop())}}class KW extends Ct{constructor(){super({id:"editor.action.outdentLines",label:S("lines.outdent","Outdent Line"),alias:"Outdent Line",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:2140,weight:100}})}run(e,t){Qx.Outdent.runEditorCommand(e,t,null)}}class ZW extends Ct{constructor(){super({id:"editor.action.insertLineBefore",label:S("lines.insertBefore","Insert Line Above"),alias:"Insert Line Above",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:3075,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,dk.lineInsertBefore(i.cursorConfig,t.getModel(),t.getSelections())))}}class XW extends Ct{constructor(){super({id:"editor.action.insertLineAfter",label:S("lines.insertAfter","Insert Line Below"),alias:"Insert Line Below",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:2051,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,dk.lineInsertAfter(i.cursorConfig,t.getModel(),t.getSelections())))}}class PB extends Ct{run(e,t){if(!t.hasModel())return;const i=t.getSelection(),n=this._getRangesToDelete(t),s=[];for(let d=0,u=n.length-1;d<u;d++){const f=n[d],g=n[d+1];Q.intersectRanges(f,g)===null?s.push(f):n[d+1]=Q.plusRange(f,g)}s.push(n[n.length-1]);const r=this._getEndCursorState(i,s),a=s.map(d=>cs.replace(d,""));t.pushUndoStop(),t.executeEdits(this.id,a,r),t.pushUndoStop()}}class YW extends PB{constructor(){super({id:"deleteAllLeft",label:S("lines.deleteAllLeft","Delete All Left"),alias:"Delete All Left",precondition:q.writable,kbOpts:{kbExpr:q.textInputFocus,primary:0,mac:{primary:2049},weight:100}})}_getEndCursorState(e,t){let i=null;const n=[];let s=0;return t.forEach(r=>{let a;if(r.endColumn===1&&s>0){const d=r.startLineNumber-s;a=new $i(d,r.startColumn,d,r.startColumn)}else a=new $i(r.startLineNumber,r.startColumn,r.startLineNumber,r.startColumn);s+=r.endLineNumber-r.startLineNumber,r.intersectRanges(e)?i=a:n.push(a)}),i&&n.unshift(i),n}_getRangesToDelete(e){const t=e.getSelections();if(t===null)return[];let i=t;const n=e.getModel();return n===null?[]:(i.sort(Q.compareRangesUsingStarts),i=i.map(s=>{if(s.isEmpty())if(s.startColumn===1){const r=Math.max(1,s.startLineNumber-1),a=s.startLineNumber===1?1:n.getLineLength(r)+1;return new Q(r,a,s.startLineNumber,1)}else return new Q(s.startLineNumber,1,s.startLineNumber,s.startColumn);else return new Q(s.startLineNumber,1,s.endLineNumber,s.endColumn)}),i)}}class QW extends PB{constructor(){super({id:"deleteAllRight",label:S("lines.deleteAllRight","Delete All Right"),alias:"Delete All Right",precondition:q.writable,kbOpts:{kbExpr:q.textInputFocus,primary:0,mac:{primary:297,secondary:[2068]},weight:100}})}_getEndCursorState(e,t){let i=null;const n=[];for(let s=0,r=t.length,a=0;s<r;s++){const d=t[s],u=new $i(d.startLineNumber-a,d.startColumn,d.startLineNumber-a,d.startColumn);d.intersectRanges(e)?i=u:n.push(u)}return i&&n.unshift(i),n}_getRangesToDelete(e){const t=e.getModel();if(t===null)return[];const i=e.getSelections();if(i===null)return[];const n=i.map(s=>{if(s.isEmpty()){const r=t.getLineMaxColumn(s.startLineNumber);return s.startColumn===r?new Q(s.startLineNumber,s.startColumn,s.startLineNumber+1,1):new Q(s.startLineNumber,s.startColumn,s.startLineNumber,r)}return s});return n.sort(Q.compareRangesUsingStarts),n}}class JW extends Ct{constructor(){super({id:"editor.action.joinLines",label:S("lines.joinLines","Join Lines"),alias:"Join Lines",precondition:q.writable,kbOpts:{kbExpr:q.editorTextFocus,primary:0,mac:{primary:296},weight:100}})}run(e,t){const i=t.getSelections();if(i===null)return;let n=t.getSelection();if(n===null)return;i.sort(Q.compareRangesUsingStarts);const s=[],r=i.reduce((p,C)=>p.isEmpty()?p.endLineNumber===C.startLineNumber?(n.equalsSelection(p)&&(n=C),C):C.startLineNumber>p.endLineNumber+1?(s.push(p),C):new $i(p.startLineNumber,p.startColumn,C.endLineNumber,C.endColumn):C.startLineNumber>p.endLineNumber?(s.push(p),C):new $i(p.startLineNumber,p.startColumn,C.endLineNumber,C.endColumn));s.push(r);const a=t.getModel();if(a===null)return;const d=[],u=[];let f=n,g=0;for(let p=0,C=s.length;p<C;p++){const b=s[p],y=b.startLineNumber,w=1;let A=0,I,T;const R=a.getLineLength(b.endLineNumber)-b.endColumn;if(b.isEmpty()||b.startLineNumber===b.endLineNumber){const j=b.getStartPosition();j.lineNumber<a.getLineCount()?(I=y+1,T=a.getLineMaxColumn(I)):(I=j.lineNumber,T=a.getLineMaxColumn(j.lineNumber))}else I=b.endLineNumber,T=a.getLineMaxColumn(I);let P=a.getLineContent(y);for(let j=y+1;j<=I;j++){const J=a.getLineContent(j),ae=a.getLineFirstNonWhitespaceColumn(j);if(ae>=1){let fe=!0;P===""&&(fe=!1),fe&&(P.charAt(P.length-1)===" "||P.charAt(P.length-1)===" ")&&(fe=!1,P=P.replace(/[\s\uFEFF\xA0]+$/g," "));const X=J.substr(ae-1);P+=(fe?" ":"")+X,fe?A=X.length+1:A=X.length}else A=0}const V=new Q(y,w,I,T);if(!V.isEmpty()){let j;b.isEmpty()?(d.push(cs.replace(V,P)),j=new $i(V.startLineNumber-g,P.length-A+1,y-g,P.length-A+1)):b.startLineNumber===b.endLineNumber?(d.push(cs.replace(V,P)),j=new $i(b.startLineNumber-g,b.startColumn,b.endLineNumber-g,b.endColumn)):(d.push(cs.replace(V,P)),j=new $i(b.startLineNumber-g,b.startColumn,b.startLineNumber-g,P.length-R)),Q.intersectRanges(V,n)!==null?f=j:u.push(j)}g+=V.endLineNumber-V.startLineNumber}u.unshift(f),t.pushUndoStop(),t.executeEdits(this.id,d,u),t.pushUndoStop()}}class ez extends Ct{constructor(){super({id:"editor.action.transpose",label:S("editor.transpose","Transpose Characters around the Cursor"),alias:"Transpose Characters around the Cursor",precondition:q.writable})}run(e,t){const i=t.getSelections();if(i===null)return;const n=t.getModel();if(n===null)return;const s=[];for(let r=0,a=i.length;r<a;r++){const d=i[r];if(!d.isEmpty())continue;const u=d.getStartPosition(),f=n.getLineMaxColumn(u.lineNumber);if(u.column>=f){if(u.lineNumber===n.getLineCount())continue;const g=new Q(u.lineNumber,Math.max(1,u.column-1),u.lineNumber+1,1),p=n.getValueInRange(g).split("").reverse().join("");s.push(new wp(new $i(u.lineNumber,Math.max(1,u.column-1),u.lineNumber+1,1),p))}else{const g=new Q(u.lineNumber,Math.max(1,u.column-1),u.lineNumber,u.column+1),p=n.getValueInRange(g).split("").reverse().join("");s.push(new kA(g,p,new $i(u.lineNumber,u.column+1,u.lineNumber,u.column+1)))}}t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class sh extends Ct{run(e,t){const i=t.getSelections();if(i===null)return;const n=t.getModel();if(n===null)return;const s=t.getOption(132),r=[];for(const a of i)if(a.isEmpty()){const d=a.getStartPosition(),u=t.getConfiguredWordAtPosition(d);if(!u)continue;const f=new Q(d.lineNumber,u.startColumn,d.lineNumber,u.endColumn),g=n.getValueInRange(f);r.push(cs.replace(f,this._modifyText(g,s)))}else{const d=n.getValueInRange(a);r.push(cs.replace(a,this._modifyText(d,s)))}t.pushUndoStop(),t.executeEdits(this.id,r),t.pushUndoStop()}}class tz extends sh{constructor(){super({id:"editor.action.transformToUppercase",label:S("editor.transformToUppercase","Transform to Uppercase"),alias:"Transform to Uppercase",precondition:q.writable})}_modifyText(e,t){return e.toLocaleUpperCase()}}class iz extends sh{constructor(){super({id:"editor.action.transformToLowercase",label:S("editor.transformToLowercase","Transform to Lowercase"),alias:"Transform to Lowercase",precondition:q.writable})}_modifyText(e,t){return e.toLocaleLowerCase()}}class El{constructor(e,t){this._pattern=e,this._flags=t,this._actual=null,this._evaluated=!1}get(){if(!this._evaluated){this._evaluated=!0;try{this._actual=new RegExp(this._pattern,this._flags)}catch{}}return this._actual}isSupported(){return this.get()!==null}}const C_=class C_ extends sh{constructor(){super({id:"editor.action.transformToTitlecase",label:S("editor.transformToTitlecase","Transform to Title Case"),alias:"Transform to Title Case",precondition:q.writable})}_modifyText(e,t){const i=C_.titleBoundary.get();return i?e.toLocaleLowerCase().replace(i,n=>n.toLocaleUpperCase()):e}};C_.titleBoundary=new El("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu");let yv=C_;const o0=class o0 extends sh{constructor(){super({id:"editor.action.transformToSnakecase",label:S("editor.transformToSnakecase","Transform to Snake Case"),alias:"Transform to Snake Case",precondition:q.writable})}_modifyText(e,t){const i=o0.caseBoundary.get(),n=o0.singleLetters.get();return!i||!n?e:e.replace(i,"$1_$2").replace(n,"$1_$2$3").toLocaleLowerCase()}};o0.caseBoundary=new El("(\\p{Ll})(\\p{Lu})","gmu"),o0.singleLetters=new El("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu");let _g=o0;const E_=class E_ extends sh{constructor(){super({id:"editor.action.transformToCamelcase",label:S("editor.transformToCamelcase","Transform to Camel Case"),alias:"Transform to Camel Case",precondition:q.writable})}_modifyText(e,t){const i=E_.wordBoundary.get();if(!i)return e;const n=e.split(i);return n.shift()+n.map(r=>r.substring(0,1).toLocaleUpperCase()+r.substring(1)).join("")}};E_.wordBoundary=new El("[_\\s-]","gm");let wv=E_;const r0=class r0 extends sh{constructor(){super({id:"editor.action.transformToPascalcase",label:S("editor.transformToPascalcase","Transform to Pascal Case"),alias:"Transform to Pascal Case",precondition:q.writable})}_modifyText(e,t){const i=r0.wordBoundary.get(),n=r0.wordBoundaryToMaintain.get();return!i||!n?e:e.split(n).map(a=>a.split(i)).flat().map(a=>a.substring(0,1).toLocaleUpperCase()+a.substring(1)).join("")}};r0.wordBoundary=new El("[_\\s-]","gm"),r0.wordBoundaryToMaintain=new El("(?<=\\.)","gm");let Sv=r0;const sc=class sc extends sh{static isSupported(){return[this.caseBoundary,this.singleLetters,this.underscoreBoundary].every(t=>t.isSupported())}constructor(){super({id:"editor.action.transformToKebabcase",label:S("editor.transformToKebabcase","Transform to Kebab Case"),alias:"Transform to Kebab Case",precondition:q.writable})}_modifyText(e,t){const i=sc.caseBoundary.get(),n=sc.singleLetters.get(),s=sc.underscoreBoundary.get();return!i||!n||!s?e:e.replace(s,"$1-$3").replace(i,"$1-$2").replace(n,"$1-$2").toLocaleLowerCase()}};sc.caseBoundary=new El("(\\p{Ll})(\\p{Lu})","gmu"),sc.singleLetters=new El("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu"),sc.underscoreBoundary=new El("(\\S)(_)(\\S)","gm");let Dv=sc;Le(OW);Le(HW);Le(WW);Le(zW);Le(VW);Le(jW);Le($W);Le(UW);Le(py);Le(qW);Le(GW);Le(KW);Le(ZW);Le(XW);Le(YW);Le(QW);Le(JW);Le(ez);Le(tz);Le(iz);_g.caseBoundary.isSupported()&&_g.singleLetters.isSupported()&&Le(_g);wv.wordBoundary.isSupported()&&Le(wv);Sv.wordBoundary.isSupported()&&Le(Sv);yv.titleBoundary.isSupported()&&Le(yv);Dv.isSupported()&&Le(Dv);var nz=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Nx=function(o,e){return function(t,i){e(t,i,o)}},fm;const TB=new En("LinkedEditingInputVisible",!1),sz="linked-editing-decoration";var Pc;let nf=(Pc=class extends Rt{static get(e){return e.getContribution(fm.ID)}constructor(e,t,i,n,s){super(),this.languageConfigurationService=n,this._syncRangesToken=0,this._localToDispose=this._register(new Tt),this._editor=e,this._providers=i.linkedEditingRangeProvider,this._enabled=!1,this._visibleContextKey=TB.bindTo(t),this._debounceInformation=s.for(this._providers,"Linked Editing",{max:200}),this._currentDecorations=this._editor.createDecorationsCollection(),this._languageWordPattern=null,this._currentWordPattern=null,this._ignoreChangeEvent=!1,this._localToDispose=this._register(new Tt),this._rangeUpdateTriggerPromise=null,this._rangeSyncTriggerPromise=null,this._currentRequestCts=null,this._currentRequestPosition=null,this._currentRequestModelVersion=null,this._register(this._editor.onDidChangeModel(()=>this.reinitialize(!0))),this._register(this._editor.onDidChangeConfiguration(r=>{(r.hasChanged(70)||r.hasChanged(94))&&this.reinitialize(!1)})),this._register(this._providers.onDidChange(()=>this.reinitialize(!1))),this._register(this._editor.onDidChangeModelLanguage(()=>this.reinitialize(!0))),this.reinitialize(!0)}reinitialize(e){const t=this._editor.getModel(),i=t!==null&&(this._editor.getOption(70)||this._editor.getOption(94))&&this._providers.has(t);if(i===this._enabled&&!e||(this._enabled=i,this.clearRanges(),this._localToDispose.clear(),!i||t===null))return;this._localToDispose.add(Ts.runAndSubscribe(t.onDidChangeLanguageConfiguration,()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(t.getLanguageId()).getWordDefinition()}));const n=new Oc(this._debounceInformation.get(t)),s=()=>{this._rangeUpdateTriggerPromise=n.trigger(()=>this.updateRanges(),this._debounceDuration??this._debounceInformation.get(t))},r=new Oc(0),a=d=>{this._rangeSyncTriggerPromise=r.trigger(()=>this._syncRanges(d))};this._localToDispose.add(this._editor.onDidChangeCursorPosition(()=>{s()})),this._localToDispose.add(this._editor.onDidChangeModelContent(d=>{if(!this._ignoreChangeEvent&&this._currentDecorations.length>0){const u=this._currentDecorations.getRange(0);if(u&&d.changes.every(f=>u.intersectRanges(f.range))){a(this._syncRangesToken);return}}s()})),this._localToDispose.add({dispose:()=>{n.dispose(),r.dispose()}}),this.updateRanges()}_syncRanges(e){if(!this._editor.hasModel()||e!==this._syncRangesToken||this._currentDecorations.length===0)return;const t=this._editor.getModel(),i=this._currentDecorations.getRange(0);if(!i||i.startLineNumber!==i.endLineNumber)return this.clearRanges();const n=t.getValueInRange(i);if(this._currentWordPattern){const r=n.match(this._currentWordPattern);if((r?r[0].length:0)!==n.length)return this.clearRanges()}const s=[];for(let r=1,a=this._currentDecorations.length;r<a;r++){const d=this._currentDecorations.getRange(r);if(d)if(d.startLineNumber!==d.endLineNumber)s.push({range:d,text:n});else{let u=t.getValueInRange(d),f=n,g=d.startColumn,p=d.endColumn;const C=Rp(u,f);g+=C,u=u.substr(C),f=f.substr(C);const b=wL(u,f);p-=b,u=u.substr(0,u.length-b),f=f.substr(0,f.length-b),(g!==p||f.length!==0)&&s.push({range:new Q(d.startLineNumber,g,d.endLineNumber,p),text:f})}}if(s.length!==0)try{this._editor.popUndoStop(),this._ignoreChangeEvent=!0;const r=this._editor._getViewModel().getPrevEditOperationType();this._editor.executeEdits("linkedEditing",s),this._editor._getViewModel().setPrevEditOperationType(r)}finally{this._ignoreChangeEvent=!1}}dispose(){this.clearRanges(),super.dispose()}clearRanges(){this._visibleContextKey.set(!1),this._currentDecorations.clear(),this._currentRequestCts&&(this._currentRequestCts.cancel(),this._currentRequestCts=null,this._currentRequestPosition=null)}async updateRanges(e=!1){if(!this._editor.hasModel()){this.clearRanges();return}const t=this._editor.getPosition();if(!this._enabled&&!e||this._editor.getSelections().length>1){this.clearRanges();return}const i=this._editor.getModel(),n=i.getVersionId();if(this._currentRequestPosition&&this._currentRequestModelVersion===n){if(t.equals(this._currentRequestPosition))return;if(this._currentDecorations.length>0){const r=this._currentDecorations.getRange(0);if(r&&r.containsPosition(t))return}}this.clearRanges(),this._currentRequestPosition=t,this._currentRequestModelVersion=n;const s=this._currentRequestCts=new Gs;try{const r=new Oo(!1),a=await MB(this._providers,i,t,s.token);if(this._debounceInformation.update(i,r.elapsed()),s!==this._currentRequestCts||(this._currentRequestCts=null,n!==i.getVersionId()))return;let d=[];a!=null&&a.ranges&&(d=a.ranges),this._currentWordPattern=(a==null?void 0:a.wordPattern)||this._languageWordPattern;let u=!1;for(let g=0,p=d.length;g<p;g++)if(Q.containsPosition(d[g],t)){if(u=!0,g!==0){const C=d[g];d.splice(g,1),d.unshift(C)}break}if(!u){this.clearRanges();return}const f=d.map(g=>({range:g,options:fm.DECORATION}));this._visibleContextKey.set(!0),this._currentDecorations.set(f),this._syncRangesToken++}catch(r){qc(r)||qn(r),(this._currentRequestCts===s||!this._currentRequestCts)&&this.clearRanges()}}},fm=Pc,Pc.ID="editor.contrib.linkedEditing",Pc.DECORATION=vn.register({description:"linked-editing",stickiness:0,className:sz}),Pc);nf=fm=nz([Nx(1,Fn),Nx(2,Fi),Nx(3,js),Nx(4,gr)],nf);class oz extends Ct{constructor(){super({id:"editor.action.linkedEditing",label:S("linkedEditing.label","Start Linked Editing"),alias:"Start Linked Editing",precondition:qe.and(q.writable,q.hasRenameProvider),kbOpts:{kbExpr:q.editorTextFocus,primary:3132,weight:100}})}runCommand(e,t){const i=e.get(Cs),[n,s]=Array.isArray(t)&&t||[void 0,void 0];return jn.isUri(n)&&Bi.isIPosition(s)?i.openCodeEditor({resource:n},i.getActiveCodeEditor()).then(r=>{r&&(r.setPosition(s),r.invokeWithinContext(a=>(this.reportTelemetry(a,r),this.run(a,r))))},qn):super.runCommand(e,t)}run(e,t){const i=nf.get(t);return i?Promise.resolve(i.updateRanges(!0)):Promise.resolve()}}const rz=Ao.bindToContribution(nf.get);Ti(new rz({id:"cancelLinkedEditingInput",precondition:TB,handler:o=>o.clearRanges(),kbOpts:{kbExpr:q.editorTextFocus,weight:199,primary:9,secondary:[1033]}}));function MB(o,e,t,i){const n=o.ordered(e);return Xw(n.map(s=>async()=>{try{return await s.provideLinkedEditingRanges(e,t,i)}catch(r){bs(r);return}}),s=>!!s&&Yo(s==null?void 0:s.ranges))}vi("editor.linkedEditingBackground",{dark:xn.fromHex("#f00").transparent(.3),light:xn.fromHex("#f00").transparent(.3),hcDark:xn.fromHex("#f00").transparent(.3),hcLight:xn.white},S("editorLinkedEditingBackground","Background color when the editor auto renames on type."));ko("_executeLinkedEditingProvider",(o,e,t)=>{const{linkedEditingRangeProvider:i}=o.get(Fi);return MB(i,e,t,an.None)});hn(nf.ID,nf,1);Le(oz);let az=class{constructor(e,t){this._link=e,this._provider=t}toJSON(){return{range:this.range,url:this.url,tooltip:this.tooltip}}get range(){return this._link.range}get url(){return this._link.url}get tooltip(){return this._link.tooltip}async resolve(e){return this._link.url?this._link.url:typeof this._provider.resolveLink=="function"?Promise.resolve(this._provider.resolveLink(this._link,e)).then(t=>(this._link=t||this._link,this._link.url?this.resolve(e):Promise.reject(new Error("missing")))):Promise.reject(new Error("missing"))}};class Av{constructor(e){this._disposables=new Tt;let t=[];for(const[i,n]of e){const s=i.links.map(r=>new az(r,n));t=Av._union(t,s),ZA(i)&&this._disposables.add(i)}this.links=t}dispose(){this._disposables.dispose(),this.links.length=0}static _union(e,t){const i=[];let n,s,r,a;for(n=0,r=0,s=e.length,a=t.length;n<s&&r<a;){const d=e[n],u=t[r];if(Q.areIntersectingOrTouching(d.range,u.range)){n++;continue}Q.compareRangesUsingStarts(d.range,u.range)<0?(i.push(d),n++):(i.push(u),r++)}for(;n<s;n++)i.push(e[n]);for(;r<a;r++)i.push(t[r]);return i}}function RB(o,e,t){const i=[],n=o.ordered(e).reverse().map((s,r)=>Promise.resolve(s.provideLinks(e,t)).then(a=>{a&&(i[r]=[a,s])},bs));return Promise.all(n).then(()=>{const s=new Av(yl(i));return t.isCancellationRequested?(s.dispose(),new Av([])):s})}Qn.registerCommand("_executeLinkProvider",async(o,...e)=>{let[t,i]=e;Pn(t instanceof jn),typeof i!="number"&&(i=0);const{linkProvider:n}=o.get(Fi),s=o.get(vo).getModel(t);if(!s)return[];const r=await RB(n,s,an.None);if(!r)return[];for(let d=0;d<Math.min(i,r.links.length);d++)await r.links[d].resolve(an.None);const a=r.links.slice(0);return r.dispose(),a});var lz=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ox=function(o,e){return function(t,i){e(t,i,o)}},xy,gu;let np=(gu=class extends Rt{static get(e){return e.getContribution(xy.ID)}constructor(e,t,i,n,s){super(),this.editor=e,this.openerService=t,this.notificationService=i,this.languageFeaturesService=n,this.providers=this.languageFeaturesService.linkProvider,this.debounceInformation=s.for(this.providers,"Links",{min:1e3,max:4e3}),this.computeLinks=this._register(new Ms(()=>this.computeLinksNow(),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;const r=this._register(new vb(e));this._register(r.onMouseMoveOrRelevantKeyDown(([a,d])=>{this._onEditorMouseMove(a,d)})),this._register(r.onExecute(a=>{this.onEditorMouseUp(a)})),this._register(r.onCancel(a=>{this.cleanUpActiveLinkDecoration()})),this._register(e.onDidChangeConfiguration(a=>{a.hasChanged(71)&&(this.updateDecorations([]),this.stop(),this.computeLinks.schedule(0))})),this._register(e.onDidChangeModelContent(a=>{this.editor.hasModel()&&this.computeLinks.schedule(this.debounceInformation.get(this.editor.getModel()))})),this._register(e.onDidChangeModel(a=>{this.currentOccurrences={},this.activeLinkDecorationId=null,this.stop(),this.computeLinks.schedule(0)})),this._register(e.onDidChangeModelLanguage(a=>{this.stop(),this.computeLinks.schedule(0)})),this._register(this.providers.onDidChange(a=>{this.stop(),this.computeLinks.schedule(0)})),this.computeLinks.schedule(0)}async computeLinksNow(){if(!this.editor.hasModel()||!this.editor.getOption(71))return;const e=this.editor.getModel();if(!e.isTooLargeForSyncing()&&this.providers.has(e)){this.activeLinksList&&(this.activeLinksList.dispose(),this.activeLinksList=null),this.computePromise=qs(t=>RB(this.providers,e,t));try{const t=new Oo(!1);if(this.activeLinksList=await this.computePromise,this.debounceInformation.update(e,t.elapsed()),e.isDisposed())return;this.updateDecorations(this.activeLinksList.links)}catch(t){qn(t)}finally{this.computePromise=null}}}updateDecorations(e){const t=this.editor.getOption(78)==="altKey",i=[],n=Object.keys(this.currentOccurrences);for(const r of n){const a=this.currentOccurrences[r];i.push(a.decorationId)}const s=[];if(e)for(const r of e)s.push(d0.decoration(r,t));this.editor.changeDecorations(r=>{const a=r.deltaDecorations(i,s);this.currentOccurrences={},this.activeLinkDecorationId=null;for(let d=0,u=a.length;d<u;d++){const f=new d0(e[d],a[d]);this.currentOccurrences[f.decorationId]=f}})}_onEditorMouseMove(e,t){const i=this.editor.getOption(78)==="altKey";if(this.isEnabled(e,t)){this.cleanUpActiveLinkDecoration();const n=this.getLinkOccurrence(e.target.position);n&&this.editor.changeDecorations(s=>{n.activate(s,i),this.activeLinkDecorationId=n.decorationId})}else this.cleanUpActiveLinkDecoration()}cleanUpActiveLinkDecoration(){const e=this.editor.getOption(78)==="altKey";if(this.activeLinkDecorationId){const t=this.currentOccurrences[this.activeLinkDecorationId];t&&this.editor.changeDecorations(i=>{t.deactivate(i,e)}),this.activeLinkDecorationId=null}}onEditorMouseUp(e){if(!this.isEnabled(e))return;const t=this.getLinkOccurrence(e.target.position);t&&this.openLinkOccurrence(t,e.hasSideBySideModifier,!0)}openLinkOccurrence(e,t,i=!1){if(!this.openerService)return;const{link:n}=e;n.resolve(an.None).then(s=>{if(typeof s=="string"&&this.editor.hasModel()){const r=this.editor.getModel().uri;if(r.scheme===Co.file&&s.startsWith(`${Co.file}:`)){const a=jn.parse(s);if(a.scheme===Co.file){const d=SL(a);let u=null;d.startsWith("/./")||d.startsWith("\\.\\")?u=`.${d.substr(1)}`:(d.startsWith("//./")||d.startsWith("\\\\.\\"))&&(u=`.${d.substr(2)}`),u&&(s=DL(r,u))}}}return this.openerService.open(s,{openToSide:t,fromUserGesture:i,allowContributedOpeners:!0,allowCommands:!0,fromWorkspace:!0})},s=>{const r=s instanceof Error?s.message:s;r==="invalid"?this.notificationService.warn(S("invalid.url","Failed to open this link because it is not well-formed: {0}",n.url.toString())):r==="missing"?this.notificationService.warn(S("missing.url","Failed to open this link because its target is missing.")):qn(s)})}getLinkOccurrence(e){if(!this.editor.hasModel()||!e)return null;const t=this.editor.getModel().getDecorationsInRange({startLineNumber:e.lineNumber,startColumn:e.column,endLineNumber:e.lineNumber,endColumn:e.column},0,!0);for(const i of t){const n=this.currentOccurrences[i.id];if(n)return n}return null}isEnabled(e,t){return!!(e.target.type===6&&(e.hasTriggerModifier||t&&t.keyCodeIsTriggerKey))}stop(){var e;this.computeLinks.cancel(),this.activeLinksList&&((e=this.activeLinksList)==null||e.dispose(),this.activeLinksList=null),this.computePromise&&(this.computePromise.cancel(),this.computePromise=null)}dispose(){super.dispose(),this.stop()}},xy=gu,gu.ID="editor.linkDetector",gu);np=xy=lz([Ox(1,da),Ox(2,mo),Ox(3,Fi),Ox(4,gr)],np);const zD={general:vn.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),active:vn.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"})};class d0{static decoration(e,t){return{range:e.range,options:d0._getOptions(e,t,!1)}}static _getOptions(e,t,i){const n={...i?zD.active:zD.general};return n.hoverMessage=cz(e,t),n}constructor(e,t){this.link=e,this.decorationId=t}activate(e,t){e.changeDecorationOptions(this.decorationId,d0._getOptions(this.link,t,!0))}deactivate(e,t){e.changeDecorationOptions(this.decorationId,d0._getOptions(this.link,t,!1))}}function cz(o,e){const t=o.url&&/^command:/i.test(o.url.toString()),i=o.tooltip?o.tooltip:t?S("links.navigate.executeCmd","Execute command"):S("links.navigate.follow","Follow link"),n=e?$a?S("links.navigate.kb.meta.mac","cmd + click"):S("links.navigate.kb.meta","ctrl + click"):$a?S("links.navigate.kb.alt.mac","option + click"):S("links.navigate.kb.alt","alt + click");if(o.url){let s="";if(/^command:/i.test(o.url.toString())){const a=o.url.toString().match(/^command:([^?#]+)/);if(a){const d=a[1];s=S("tooltip.explanation","Execute command {0}",d)}}return new lo("",!0).appendLink(o.url.toString(!0).replace(/ /g,"%20"),i,s).appendMarkdown(` (${n})`)}else return new lo().appendText(`${i} (${n})`)}class dz extends Ct{constructor(){super({id:"editor.action.openLink",label:S("label","Open Link"),alias:"Open Link",precondition:void 0})}run(e,t){const i=np.get(t);if(!i||!t.hasModel())return;const n=t.getSelections();for(const s of n){const r=i.getLinkOccurrence(s.getEndPosition());r&&i.openLinkOccurrence(r,!1)}}}hn(np.ID,np,1);Le(dz);const wS=class wS extends Rt{constructor(e){super(),this._editor=e,this._register(this._editor.onMouseDown(t=>{const i=this._editor.getOption(118);i>=0&&t.target.type===6&&t.target.position.column>=i&&this._editor.updateOptions({stopRenderingLineAfter:-1})}))}};wS.ID="editor.contrib.longLinesHelper";let kv=wS;hn(kv.ID,kv,2);const uz=vi("editor.wordHighlightBackground",{dark:"#575757B8",light:"#57575740",hcDark:null,hcLight:null},S("wordHighlight","Background color of a symbol during read-access, like reading a variable. The color must not be opaque so as not to hide underlying decorations."),!0);vi("editor.wordHighlightStrongBackground",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},S("wordHighlightStrong","Background color of a symbol during write-access, like writing to a variable. The color must not be opaque so as not to hide underlying decorations."),!0);vi("editor.wordHighlightTextBackground",uz,S("wordHighlightText","Background color of a textual occurrence for a symbol. The color must not be opaque so as not to hide underlying decorations."),!0);const hz=vi("editor.wordHighlightBorder",{light:null,dark:null,hcDark:Bu,hcLight:Bu},S("wordHighlightBorder","Border color of a symbol during read-access, like reading a variable."));vi("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:Bu,hcLight:Bu},S("wordHighlightStrongBorder","Border color of a symbol during write-access, like writing to a variable."));vi("editor.wordHighlightTextBorder",hz,S("wordHighlightTextBorder","Border color of a textual occurrence for a symbol."));const fz=vi("editorOverviewRuler.wordHighlightForeground","#A0A0A0CC",S("overviewRulerWordHighlightForeground","Overview ruler marker color for symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),gz=vi("editorOverviewRuler.wordHighlightStrongForeground","#C0A0C0CC",S("overviewRulerWordHighlightStrongForeground","Overview ruler marker color for write-access symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),pz=vi("editorOverviewRuler.wordHighlightTextForeground",uk,S("overviewRulerWordHighlightTextForeground","Overview ruler marker color of a textual occurrence for a symbol. The color must not be opaque so as not to hide underlying decorations."),!0),xz=vn.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:Fs(gz),position:Ha.Center},minimap:{color:Fs(eb),position:1}}),mz=vn.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:Fs(pz),position:Ha.Center},minimap:{color:Fs(eb),position:1}}),vz=vn.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:Fs(uk),position:Ha.Center},minimap:{color:Fs(eb),position:1}}),_z=vn.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),bz=vn.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:Fs(fz),position:Ha.Center},minimap:{color:Fs(eb),position:1}});function Cz(o){return o===Im.Write?xz:o===Im.Text?mz:bz}function Ez(o){return o?_z:vz}$_((o,e)=>{const t=o.getColor(AL);t&&e.addRule(`.monaco-editor .selectionHighlight { background-color: ${t.transparent(.5)}; }`)});var yz=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},wz=function(o,e){return function(t,i){e(t,i,o)}},my;function Kc(o,e){const t=e.filter(i=>!o.find(n=>n.equals(i)));if(t.length>=1){const i=t.map(s=>`line ${s.viewState.position.lineNumber} column ${s.viewState.position.column}`).join(", "),n=t.length===1?S("cursorAdded","Cursor added: {0}",i):S("cursorsAdded","Cursors added: {0}",i);P0(n)}}class Sz extends Ct{constructor(){super({id:"editor.action.insertCursorAbove",label:S("mutlicursor.insertAbove","Add Cursor Above"),alias:"Add Cursor Above",precondition:void 0,kbOpts:{kbExpr:q.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:ni.MenubarSelectionMenu,group:"3_multi",title:S({key:"miInsertCursorAbove",comment:["&& denotes a mnemonic"]},"&&Add Cursor Above"),order:2}})}run(e,t,i){if(!t.hasModel())return;let n=!0;i&&i.logicalLine===!1&&(n=!1);const s=t._getViewModel();if(s.cursorConfig.readOnly)return;s.model.pushStackElement();const r=s.getCursorStates();s.setCursorStates(i.source,3,Zw.addCursorUp(s,r,n)),s.revealTopMostCursor(i.source),Kc(r,s.getCursorStates())}}class Dz extends Ct{constructor(){super({id:"editor.action.insertCursorBelow",label:S("mutlicursor.insertBelow","Add Cursor Below"),alias:"Add Cursor Below",precondition:void 0,kbOpts:{kbExpr:q.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:ni.MenubarSelectionMenu,group:"3_multi",title:S({key:"miInsertCursorBelow",comment:["&& denotes a mnemonic"]},"A&&dd Cursor Below"),order:3}})}run(e,t,i){if(!t.hasModel())return;let n=!0;i&&i.logicalLine===!1&&(n=!1);const s=t._getViewModel();if(s.cursorConfig.readOnly)return;s.model.pushStackElement();const r=s.getCursorStates();s.setCursorStates(i.source,3,Zw.addCursorDown(s,r,n)),s.revealBottomMostCursor(i.source),Kc(r,s.getCursorStates())}}class Az extends Ct{constructor(){super({id:"editor.action.insertCursorAtEndOfEachLineSelected",label:S("mutlicursor.insertAtEndOfEachLineSelected","Add Cursors to Line Ends"),alias:"Add Cursors to Line Ends",precondition:void 0,kbOpts:{kbExpr:q.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:ni.MenubarSelectionMenu,group:"3_multi",title:S({key:"miInsertCursorAtEndOfEachLineSelected",comment:["&& denotes a mnemonic"]},"Add C&&ursors to Line Ends"),order:4}})}getCursorsForSelection(e,t,i){if(!e.isEmpty()){for(let n=e.startLineNumber;n<e.endLineNumber;n++){const s=t.getLineMaxColumn(n);i.push(new $i(n,s,n,s))}e.endColumn>1&&i.push(new $i(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn))}}run(e,t){if(!t.hasModel())return;const i=t.getModel(),n=t.getSelections(),s=t._getViewModel(),r=s.getCursorStates(),a=[];n.forEach(d=>this.getCursorsForSelection(d,i,a)),a.length>0&&t.setSelections(a),Kc(r,s.getCursorStates())}}class kz extends Ct{constructor(){super({id:"editor.action.addCursorsToBottom",label:S("mutlicursor.addCursorsToBottom","Add Cursors To Bottom"),alias:"Add Cursors To Bottom",precondition:void 0})}run(e,t){if(!t.hasModel())return;const i=t.getSelections(),n=t.getModel().getLineCount(),s=[];for(let d=i[0].startLineNumber;d<=n;d++)s.push(new $i(d,i[0].startColumn,d,i[0].endColumn));const r=t._getViewModel(),a=r.getCursorStates();s.length>0&&t.setSelections(s),Kc(a,r.getCursorStates())}}class Bz extends Ct{constructor(){super({id:"editor.action.addCursorsToTop",label:S("mutlicursor.addCursorsToTop","Add Cursors To Top"),alias:"Add Cursors To Top",precondition:void 0})}run(e,t){if(!t.hasModel())return;const i=t.getSelections(),n=[];for(let a=i[0].startLineNumber;a>=1;a--)n.push(new $i(a,i[0].startColumn,a,i[0].endColumn));const s=t._getViewModel(),r=s.getCursorStates();n.length>0&&t.setSelections(n),Kc(r,s.getCursorStates())}}class Hx{constructor(e,t,i){this.selections=e,this.revealRange=t,this.revealScrollType=i}}class sp{static create(e,t){if(!e.hasModel())return null;const i=t.getState();if(!e.hasTextFocus()&&i.isRevealed&&i.searchString.length>0)return new sp(e,t,!1,i.searchString,i.wholeWord,i.matchCase,null);let n=!1,s,r;const a=e.getSelections();a.length===1&&a[0].isEmpty()?(n=!0,s=!0,r=!0):(s=i.wholeWord,r=i.matchCase);const d=e.getSelection();let u,f=null;if(d.isEmpty()){const g=e.getConfiguredWordAtPosition(d.getStartPosition());if(!g)return null;u=g.word,f=new $i(d.startLineNumber,g.startColumn,d.startLineNumber,g.endColumn)}else u=e.getModel().getValueInRange(d).replace(/\r\n/g,`
57
+ `);return new sp(e,t,n,u,s,r,f)}constructor(e,t,i,n,s,r,a){this._editor=e,this.findController=t,this.isDisconnectedFromFindController=i,this.searchText=n,this.wholeWord=s,this.matchCase=r,this.currentMatch=a}addSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;const e=this._getNextMatch();if(!e)return null;const t=this._editor.getSelections();return new Hx(t.concat(e),e,0)}moveSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;const e=this._getNextMatch();if(!e)return null;const t=this._editor.getSelections();return new Hx(t.slice(0,t.length-1).concat(e),e,0)}_getNextMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const n=this.currentMatch;return this.currentMatch=null,n}this.findController.highlightFindOptions();const e=this._editor.getSelections(),t=e[e.length-1],i=this._editor.getModel().findNextMatch(this.searchText,t.getEndPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(132):null,!1);return i?new $i(i.range.startLineNumber,i.range.startColumn,i.range.endLineNumber,i.range.endColumn):null}addSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;const e=this._getPreviousMatch();if(!e)return null;const t=this._editor.getSelections();return new Hx(t.concat(e),e,0)}moveSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;const e=this._getPreviousMatch();if(!e)return null;const t=this._editor.getSelections();return new Hx(t.slice(0,t.length-1).concat(e),e,0)}_getPreviousMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const n=this.currentMatch;return this.currentMatch=null,n}this.findController.highlightFindOptions();const e=this._editor.getSelections(),t=e[e.length-1],i=this._editor.getModel().findPreviousMatch(this.searchText,t.getStartPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(132):null,!1);return i?new $i(i.range.startLineNumber,i.range.startColumn,i.range.endLineNumber,i.range.endColumn):null}selectAll(e){if(!this._editor.hasModel())return[];this.findController.highlightFindOptions();const t=this._editor.getModel();return e?t.findMatches(this.searchText,e,!1,this.matchCase,this.wholeWord?this._editor.getOption(132):null,!1,1073741824):t.findMatches(this.searchText,!0,!1,this.matchCase,this.wholeWord?this._editor.getOption(132):null,!1,1073741824)}}const y_=class y_ extends Rt{static get(e){return e.getContribution(y_.ID)}constructor(e){super(),this._sessionDispose=this._register(new Tt),this._editor=e,this._ignoreSelectionChange=!1,this._session=null}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(e){if(!this._session){const t=sp.create(this._editor,e);if(!t)return;this._session=t;const i={searchString:this._session.searchText};this._session.isDisconnectedFromFindController&&(i.wholeWordOverride=1,i.matchCaseOverride=1,i.isRegexOverride=2),e.getState().change(i,!1),this._sessionDispose.add(this._editor.onDidChangeCursorSelection(n=>{this._ignoreSelectionChange||this._endSession()})),this._sessionDispose.add(this._editor.onDidBlurEditorText(()=>{this._endSession()})),this._sessionDispose.add(e.getState().onFindReplaceStateChange(n=>{(n.matchCase||n.wholeWord)&&this._endSession()}))}}_endSession(){if(this._sessionDispose.clear(),this._session&&this._session.isDisconnectedFromFindController){const e={wholeWordOverride:0,matchCaseOverride:0,isRegexOverride:0};this._session.findController.getState().change(e,!1)}this._session=null}_setSelections(e){this._ignoreSelectionChange=!0,this._editor.setSelections(e),this._ignoreSelectionChange=!1}_expandEmptyToWord(e,t){if(!t.isEmpty())return t;const i=this._editor.getConfiguredWordAtPosition(t.getStartPosition());return i?new $i(t.startLineNumber,i.startColumn,t.startLineNumber,i.endColumn):t}_applySessionResult(e){e&&(this._setSelections(e.selections),e.revealRange&&this._editor.revealRangeInCenterIfOutsideViewport(e.revealRange,e.revealScrollType))}getSession(e){return this._session}addSelectionToNextFindMatch(e){if(this._editor.hasModel()){if(!this._session){const t=this._editor.getSelections();if(t.length>1){const n=e.getState().matchCase;if(!NB(this._editor.getModel(),t,n)){const r=this._editor.getModel(),a=[];for(let d=0,u=t.length;d<u;d++)a[d]=this._expandEmptyToWord(r,t[d]);this._editor.setSelections(a);return}}}this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.addSelectionToNextFindMatch())}}addSelectionToPreviousFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.addSelectionToPreviousFindMatch())}moveSelectionToNextFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.moveSelectionToNextFindMatch())}moveSelectionToPreviousFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.moveSelectionToPreviousFindMatch())}selectAll(e){if(!this._editor.hasModel())return;let t=null;const i=e.getState();if(i.isRevealed&&i.searchString.length>0&&i.isRegex){const n=this._editor.getModel();i.searchScope?t=n.findMatches(i.searchString,i.searchScope,i.isRegex,i.matchCase,i.wholeWord?this._editor.getOption(132):null,!1,1073741824):t=n.findMatches(i.searchString,!0,i.isRegex,i.matchCase,i.wholeWord?this._editor.getOption(132):null,!1,1073741824)}else{if(this._beginSessionIfNeeded(e),!this._session)return;t=this._session.selectAll(i.searchScope)}if(t.length>0){const n=this._editor.getSelection();for(let s=0,r=t.length;s<r;s++){const a=t[s];if(a.range.intersectRanges(n)){t[s]=t[0],t[0]=a;break}}this._setSelections(t.map(s=>new $i(s.range.startLineNumber,s.range.startColumn,s.range.endLineNumber,s.range.endColumn)))}}};y_.ID="editor.contrib.multiCursorController";let sf=y_;class vf extends Ct{run(e,t){const i=sf.get(t);if(!i)return;const n=t._getViewModel();if(n){const s=n.getCursorStates(),r=So.get(t);if(r)this._run(i,r);else{const a=e.get(sn).createInstance(So,t);this._run(i,a),a.dispose()}Kc(s,n.getCursorStates())}}}class Fz extends vf{constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:S("addSelectionToNextFindMatch","Add Selection To Next Find Match"),alias:"Add Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:q.focus,primary:2082,weight:100},menuOpts:{menuId:ni.MenubarSelectionMenu,group:"3_multi",title:S({key:"miAddSelectionToNextFindMatch",comment:["&& denotes a mnemonic"]},"Add &&Next Occurrence"),order:5}})}_run(e,t){e.addSelectionToNextFindMatch(t)}}class Lz extends vf{constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:S("addSelectionToPreviousFindMatch","Add Selection To Previous Find Match"),alias:"Add Selection To Previous Find Match",precondition:void 0,menuOpts:{menuId:ni.MenubarSelectionMenu,group:"3_multi",title:S({key:"miAddSelectionToPreviousFindMatch",comment:["&& denotes a mnemonic"]},"Add P&&revious Occurrence"),order:6}})}_run(e,t){e.addSelectionToPreviousFindMatch(t)}}class Iz extends vf{constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:S("moveSelectionToNextFindMatch","Move Last Selection To Next Find Match"),alias:"Move Last Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:q.focus,primary:Ds(2089,2082),weight:100}})}_run(e,t){e.moveSelectionToNextFindMatch(t)}}class Pz extends vf{constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:S("moveSelectionToPreviousFindMatch","Move Last Selection To Previous Find Match"),alias:"Move Last Selection To Previous Find Match",precondition:void 0})}_run(e,t){e.moveSelectionToPreviousFindMatch(t)}}class Tz extends vf{constructor(){super({id:"editor.action.selectHighlights",label:S("selectAllOccurrencesOfFindMatch","Select All Occurrences of Find Match"),alias:"Select All Occurrences of Find Match",precondition:void 0,kbOpts:{kbExpr:q.focus,primary:3114,weight:100},menuOpts:{menuId:ni.MenubarSelectionMenu,group:"3_multi",title:S({key:"miSelectHighlights",comment:["&& denotes a mnemonic"]},"Select All &&Occurrences"),order:7}})}_run(e,t){e.selectAll(t)}}class Mz extends vf{constructor(){super({id:"editor.action.changeAll",label:S("changeAll.label","Change All Occurrences"),alias:"Change All Occurrences",precondition:qe.and(q.writable,q.editorTextFocus),kbOpts:{kbExpr:q.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(e,t){e.selectAll(t)}}class Rz{constructor(e,t,i,n,s){this._model=e,this._searchText=t,this._matchCase=i,this._wordSeparators=n,this._modelVersionId=this._model.getVersionId(),this._cachedFindMatches=null,s&&this._model===s._model&&this._searchText===s._searchText&&this._matchCase===s._matchCase&&this._wordSeparators===s._wordSeparators&&this._modelVersionId===s._modelVersionId&&(this._cachedFindMatches=s._cachedFindMatches)}findMatches(){return this._cachedFindMatches===null&&(this._cachedFindMatches=this._model.findMatches(this._searchText,!0,!1,this._matchCase,this._wordSeparators,!1).map(e=>e.range),this._cachedFindMatches.sort(Q.compareRangesUsingStarts)),this._cachedFindMatches}}var pu;let Bv=(pu=class extends Rt{constructor(e,t){super(),this._languageFeaturesService=t,this.editor=e,this._isEnabled=e.getOption(109),this._decorations=e.createDecorationsCollection(),this.updateSoon=this._register(new Ms(()=>this._update(),300)),this.state=null,this._register(e.onDidChangeConfiguration(n=>{this._isEnabled=e.getOption(109)})),this._register(e.onDidChangeCursorSelection(n=>{this._isEnabled&&(n.selection.isEmpty()?n.reason===3?(this.state&&this._setState(null),this.updateSoon.schedule()):this._setState(null):this._update())})),this._register(e.onDidChangeModel(n=>{this._setState(null)})),this._register(e.onDidChangeModelContent(n=>{this._isEnabled&&this.updateSoon.schedule()}));const i=So.get(e);i&&this._register(i.getState().onFindReplaceStateChange(n=>{this._update()})),this.updateSoon.schedule()}_update(){this._setState(my._createState(this.state,this._isEnabled,this.editor))}static _createState(e,t,i){if(!t||!i.hasModel())return null;const n=i.getSelection();if(n.startLineNumber!==n.endLineNumber)return null;const s=sf.get(i);if(!s)return null;const r=So.get(i);if(!r)return null;let a=s.getSession(r);if(!a){const f=i.getSelections();if(f.length>1){const p=r.getState().matchCase;if(!NB(i.getModel(),f,p))return null}a=sp.create(i,r)}if(!a||a.currentMatch||/^[ \t]+$/.test(a.searchText)||a.searchText.length>200)return null;const d=r.getState(),u=d.matchCase;if(d.isRevealed){let f=d.searchString;u||(f=f.toLowerCase());let g=a.searchText;if(u||(g=g.toLowerCase()),f===g&&a.matchCase===d.matchCase&&a.wholeWord===d.wholeWord&&!d.isRegex)return null}return new Rz(i.getModel(),a.searchText,a.matchCase,a.wholeWord?i.getOption(132):null,e)}_setState(e){if(this.state=e,!this.state){this._decorations.clear();return}if(!this.editor.hasModel())return;const t=this.editor.getModel();if(t.isTooLargeForTokenization())return;const i=this.state.findMatches(),n=this.editor.getSelections();n.sort(Q.compareRangesUsingStarts);const s=[];for(let u=0,f=0,g=i.length,p=n.length;u<g;){const C=i[u];if(f>=p)s.push(C),u++;else{const b=Q.compareRangesUsingStarts(C,n[f]);b<0?((n[f].isEmpty()||!Q.areIntersecting(C,n[f]))&&s.push(C),u++):(b>0||u++,f++)}}const r=this.editor.getOption(81)!=="off",a=this._languageFeaturesService.documentHighlightProvider.has(t)&&r,d=s.map(u=>({range:u,options:Ez(a)}));this._decorations.set(d)}dispose(){this._setState(null),super.dispose()}},my=pu,pu.ID="editor.contrib.selectionHighlighter",pu);Bv=my=yz([wz(1,Fi)],Bv);function NB(o,e,t){const i=VD(o,e[0],!t);for(let n=1,s=e.length;n<s;n++){const r=e[n];if(r.isEmpty())return!1;const a=VD(o,r,!t);if(i!==a)return!1}return!0}function VD(o,e,t){const i=o.getValueInRange(e);return t?i.toLowerCase():i}class Nz extends Ct{constructor(){super({id:"editor.action.focusNextCursor",label:S("mutlicursor.focusNextCursor","Focus Next Cursor"),metadata:{description:S("mutlicursor.focusNextCursor.description","Focuses the next cursor"),args:[]},alias:"Focus Next Cursor",precondition:void 0})}run(e,t,i){if(!t.hasModel())return;const n=t._getViewModel();if(n.cursorConfig.readOnly)return;n.model.pushStackElement();const s=Array.from(n.getCursorStates()),r=s.shift();r&&(s.push(r),n.setCursorStates(i.source,3,s),n.revealPrimaryCursor(i.source,!0),Kc(s,n.getCursorStates()))}}class Oz extends Ct{constructor(){super({id:"editor.action.focusPreviousCursor",label:S("mutlicursor.focusPreviousCursor","Focus Previous Cursor"),metadata:{description:S("mutlicursor.focusPreviousCursor.description","Focuses the previous cursor"),args:[]},alias:"Focus Previous Cursor",precondition:void 0})}run(e,t,i){if(!t.hasModel())return;const n=t._getViewModel();if(n.cursorConfig.readOnly)return;n.model.pushStackElement();const s=Array.from(n.getCursorStates()),r=s.pop();r&&(s.unshift(r),n.setCursorStates(i.source,3,s),n.revealPrimaryCursor(i.source,!0),Kc(s,n.getCursorStates()))}}hn(sf.ID,sf,4);hn(Bv.ID,Bv,1);Le(Sz);Le(Dz);Le(Az);Le(Fz);Le(Lz);Le(Iz);Le(Pz);Le(Tz);Le(Mz);Le(kz);Le(Bz);Le(Nz);Le(Oz);const Hz="editor.action.inlineEdit.accept",Wz="editor.action.inlineEdit.reject",zz="editor.action.inlineEdit.jumpTo",Vz="editor.action.inlineEdit.jumpBack";var jz=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},$z=function(o,e){return function(t,i){e(t,i,o)}};const MC="inline-edit";let vy=class extends Rt{constructor(e,t,i){super(),this.editor=e,this.model=t,this.languageService=i,this.isDisposed=Qo(this,!1),this.currentTextModel=Io(this,this.editor.onDidChangeModel,()=>this.editor.getModel()),this.uiState=Wn(this,n=>{var I;if(this.isDisposed.read(n))return;const s=this.currentTextModel.read(n);if(s!==this.model.targetTextModel.read(n))return;const r=this.model.ghostText.read(n);if(!r)return;let a=(I=this.model.range)==null?void 0:I.read(n);a&&a.startLineNumber===a.endLineNumber&&a.startColumn===a.endColumn&&(a=void 0);const d=(a?a.startLineNumber===a.endLineNumber:!0)&&r.parts.length===1&&r.parts[0].lines.length===1,u=r.parts.length===1&&r.parts[0].lines.every(T=>T.length===0),f=[],g=[];function p(T,R){if(g.length>0){const P=g[g.length-1];R&&P.decorations.push(new Og(P.content.length+1,P.content.length+1+T[0].length,R,0)),P.content+=T[0],T=T.slice(1)}for(const P of T)g.push({content:P,decorations:R?[new Og(1,P.length+1,R,0)]:[]})}const C=s.getLineContent(r.lineNumber);let b,y=0;if(!u&&(d||!a)){for(const T of r.parts){let R=T.lines;a&&!d&&(p(R,MC),R=[]),b===void 0?(f.push({column:T.column,text:R[0],preview:T.preview}),R=R.slice(1)):p([C.substring(y,T.column-1)],void 0),R.length>0&&(p(R,MC),b===void 0&&T.column<=C.length&&(b=T.column)),y=T.column-1}b!==void 0&&p([C.substring(y)],void 0)}const w=b!==void 0?new vB(b,C.length+1):void 0,A=d||!a?r.lineNumber:a.endLineNumber-1;return{inlineTexts:f,additionalLines:g,hiddenRange:w,lineNumber:A,additionalReservedLineCount:this.model.minReservedLineCount.read(n),targetTextModel:s,range:a,isSingleLine:d,isPureRemove:u}}),this.decorations=Wn(this,n=>{const s=this.uiState.read(n);if(!s)return[];const r=[];if(s.hiddenRange&&r.push({range:s.hiddenRange.toRange(s.lineNumber),options:{inlineClassName:"inline-edit-hidden",description:"inline-edit-hidden"}}),s.range){const a=[];if(s.isSingleLine)a.push(s.range);else if(!s.isPureRemove){const d=s.range.endLineNumber-s.range.startLineNumber;for(let u=0;u<d;u++){const f=s.range.startLineNumber+u,g=s.targetTextModel.getLineFirstNonWhitespaceColumn(f),p=s.targetTextModel.getLineLastNonWhitespaceColumn(f),C=new Q(f,g,f,p);a.push(C)}}for(const d of a)r.push({range:d,options:Yw})}if(s.range&&!s.isSingleLine&&s.isPureRemove){const a=new Q(s.range.startLineNumber,1,s.range.endLineNumber-1,1);r.push({range:a,options:Qw})}for(const a of s.inlineTexts)r.push({range:Q.fromPositions(new Bi(s.lineNumber,a.column)),options:{description:MC,after:{content:a.text,inlineClassName:a.preview?"inline-edit-decoration-preview":"inline-edit-decoration",cursorStops:jh.Left},showIfCollapsed:!0}});return r}),this._register(is(()=>{this.isDisposed.set(!0,void 0)})),this._register(_B(this.editor,this.decorations))}};vy=jz([$z(2,ha)],vy);var X9=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Fa=function(o,e){return function(t,i){e(t,i,o)}},gm;let _y=class extends Rt{constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=Io(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).showToolbar==="always"),this.sessionPosition=void 0,this.position=Wn(this,n=>{var d,u;const s=(d=this.model.read(n))==null?void 0:d.model.ghostText.read(n);if(!this.alwaysShowToolbar.read(n)||!s||s.parts.length===0)return this.sessionPosition=void 0,null;const r=s.parts[0].column;this.sessionPosition&&this.sessionPosition.lineNumber!==s.lineNumber&&(this.sessionPosition=void 0);const a=new Bi(s.lineNumber,Math.min(r,((u=this.sessionPosition)==null?void 0:u.column)??Number.MAX_SAFE_INTEGER));return this.sessionPosition=a,a}),this._register(Lp((n,s)=>{if(!this.model.read(n)||!this.alwaysShowToolbar.read(n))return;const a=s.add(this.instantiationService.createInstance(by,this.editor,!0,this.position));e.addContentWidget(a),s.add(is(()=>e.removeContentWidget(a)))}))}};_y=X9([Fa(2,sn)],_y);var Tc;let by=(Tc=class extends Rt{constructor(e,t,i,n,s,r){super(),this.editor=e,this.withBorder=t,this._position=i,this._contextKeyService=s,this._menuService=r,this.id=`InlineEditHintsContentWidget${gm.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Fr("div.inlineEditHints",{className:this.withBorder?".withBorder":""},[Fr("div@toolBar")]),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(ni.InlineEditActions,this._contextKeyService)),this.toolBar=this._register(n.createInstance(Cy,this.nodes.toolBar,this.editor,ni.InlineEditToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:a=>a.startsWith("primary")},actionViewItemProvider:(a,d)=>{if(a instanceof N0)return n.createInstance(Uz,a,void 0)},telemetrySource:"InlineEditToolbar"})),this._register(this.toolBar.onDidChangeDropdownVisibility(a=>{gm._dropDownVisible=a})),this._register(rs(a=>{this._position.read(a),this.editor.layoutContentWidget(this)})),this._register(rs(a=>{const d=[];for(const[u,f]of this.inlineCompletionsActionsMenus.getActions())for(const g of f)g instanceof N0&&d.push(g);d.length>0&&d.unshift(new Ig),this.toolBar.setAdditionalSecondaryActions(d)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}},gm=Tc,Tc._dropDownVisible=!1,Tc.id=0,Tc);by=gm=X9([Fa(3,sn),Fa(4,Fn),Fa(5,Zu)],by);class Uz extends gA{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=Fr("div.keybinding").root;this._register(new Iw(t,Pw,{disableTitle:!0,...pA})).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add("inlineEditStatusBarItemLabel")}}updateTooltip(){}}let Cy=class extends xA{constructor(e,t,i,n,s,r,a,d,u,f){super(e,{resetMenu:i,...n},s,r,a,d,u,f),this.editor=t,this.menuId=i,this.options2=n,this.menuService=s,this.contextKeyService=r,this.menu=this._store.add(this.menuService.createMenu(this.menuId,this.contextKeyService,{emitEventsForSubmenuChanges:!0})),this.additionalActions=[],this.prependedPrimaryActions=[],this._store.add(this.menu.onDidChange(()=>this.updateToolbar())),this._store.add(this.editor.onDidChangeCursorPosition(()=>this.updateToolbar())),this.updateToolbar()}updateToolbar(){var i,n,s,r,a,d,u;const e=[],t=[];Hw(this.menu,(i=this.options2)==null?void 0:i.menuOptions,{primary:e,secondary:t},(s=(n=this.options2)==null?void 0:n.toolbarOptions)==null?void 0:s.primaryGroup,(a=(r=this.options2)==null?void 0:r.toolbarOptions)==null?void 0:a.shouldInlineSubmenu,(u=(d=this.options2)==null?void 0:d.toolbarOptions)==null?void 0:u.useSeparatorsInPrimaryActions),t.push(...this.additionalActions),e.unshift(...this.prependedPrimaryActions),this.setActions(e,t)}setAdditionalSecondaryActions(e){ja(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};Cy=X9([Fa(4,Zu),Fa(5,Fn),Fa(6,af),Fa(7,As),Fa(8,Vs),Fa(9,ua)],Cy);var OB=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},pm=function(o,e){return function(t,i){e(t,i,o)}},eg,Ey;function*qz(o,e,t=1){e===void 0&&([e,o]=[o,0]);for(let i=o;i<e;i+=t)yield i}function RC(o){var i;const e=((i=o[0].match(/^\s*/))==null?void 0:i[0])??"",t=e.length;return{text:o.map(n=>n.replace(new RegExp("^"+e),"")),shift:t}}var xu;let yy=(xu=class extends Rt{static _createUniqueUri(){return jn.from({scheme:"inline-edit-widget",path:new Date().toString()+String(eg._modelId++)})}constructor(e,t,i,n,s){super(),this._editor=e,this._model=t,this._instantiationService=i,this._diffProviderFactoryService=n,this._modelService=s,this._position=Wn(this,r=>{const a=this._model.read(r);if(!a||a.text.length===0||a.range.startLineNumber===a.range.endLineNumber&&!(a.range.startColumn===a.range.endColumn&&a.range.startColumn===1))return null;const d=this._editor.getModel();if(!d)return null;const u=Array.from(qz(a.range.startLineNumber,a.range.endLineNumber+1)),f=u.map(y=>d.getLineLastNonWhitespaceColumn(y)),g=Math.max(...f),p=u[f.indexOf(g)],C=new Bi(p,g);return{top:a.range.startLineNumber,left:C}}),this._text=Wn(this,r=>{const a=this._model.read(r);if(!a)return{text:"",shift:0};const d=RC(a.text.split(`
58
+ `));return{text:d.text.join(`
59
+ `),shift:d.shift}}),this._originalModel=Hc(()=>this._modelService.createModel("",null,eg._createUniqueUri())).keepObserved(this._store),this._modifiedModel=Hc(()=>this._modelService.createModel("",null,eg._createUniqueUri())).keepObserved(this._store),this._diff=Wn(this,r=>{var a,d;return(d=(a=this._diffPromise.read(r))==null?void 0:a.promiseResult.read(r))==null?void 0:d.data}),this._diffPromise=Wn(this,r=>{const a=this._model.read(r);if(!a)return;const d=this._editor.getModel();if(!d)return;const u=RC(d.getValueInRange(a.range).split(`
60
+ `)).text.join(`
61
+ `),f=RC(a.text.split(`
62
+ `)).text.join(`
63
+ `);this._originalModel.get().setValue(u),this._modifiedModel.get().setValue(f);const g=this._diffProviderFactoryService.createDiffProvider({diffAlgorithm:"advanced"});return hk.fromFn(async()=>{const p=await g.computeDiff(this._originalModel.get(),this._modifiedModel.get(),{computeMoves:!1,ignoreTrimWhitespace:!1,maxComputationTimeMs:1e3},an.None);if(!p.identical)return p.changes})}),this._register(Lp((r,a)=>{if(!this._model.read(r)||this._position.get()===null)return;const u=a.add(this._instantiationService.createInstance(wy,this._editor,this._position,this._text.map(f=>f.text),this._text.map(f=>f.shift),this._diff));e.addOverlayWidget(u),a.add(is(()=>e.removeOverlayWidget(u)))}))}},eg=xu,xu._modelId=0,xu);yy=eg=OB([pm(2,sn),pm(3,Jw),pm(4,vo)],yy);var mu;let wy=(mu=class extends Rt{constructor(e,t,i,n,s,r){var a;super(),this._editor=e,this._position=t,this._text=i,this._shift=n,this._diff=s,this._instantiationService=r,this.id=`InlineEditSideBySideContentWidget${Ey.id++}`,this.allowEditorOverflow=!1,this._nodes=mi("div.inlineEditSideBySide",void 0),this._scrollChanged=Pd("editor.onDidScrollChange",this._editor.onDidScrollChange),this._previewEditor=this._register(this._instantiationService.createInstance(Hr,this._nodes,{glyphMargin:!1,lineNumbers:"off",minimap:{enabled:!1},guides:{indentation:!1,bracketPairs:!1,bracketPairsHorizontal:!1,highlightActiveIndentation:!1},folding:!1,selectOnLineNumbers:!1,selectionHighlight:!1,columnSelection:!1,overviewRulerBorder:!1,overviewRulerLanes:0,lineDecorationsWidth:0,lineNumbersMinChars:0,scrollbar:{vertical:"hidden",horizontal:"hidden",alwaysConsumeMouseWheel:!1,handleMouseWheel:!1},readOnly:!0,wordWrap:"off",wordWrapOverride1:"off",wordWrapOverride2:"off",wrappingIndent:"none",wrappingStrategy:void 0},{contributions:[],isSimpleWidget:!0},this._editor)),this._previewEditorObs=Ia(this._previewEditor),this._editorObs=Ia(this._editor),this._previewTextModel=this._register(this._instantiationService.createInstance(dc,"",((a=this._editor.getModel())==null?void 0:a.getLanguageId())??Rg,dc.DEFAULT_CREATION_OPTIONS,null)),this._setText=Wn(d=>{const u=this._text.read(d);u&&this._previewTextModel.setValue(u)}).recomputeInitiallyAndOnChange(this._store),this._decorations=Wn(this,d=>{this._setText.read(d);const u=this._position.read(d);if(!u)return{org:[],mod:[]};const f=this._diff.read(d);if(!f)return{org:[],mod:[]};const g=[],p=[];if(f.length===1&&f[0].innerChanges[0].modifiedRange.equalsRange(this._previewTextModel.getFullModelRange()))return{org:[],mod:[]};const C=this._shift.get(),b=y=>new Q(y.startLineNumber+u.top-1,y.startColumn+C,y.endLineNumber+u.top-1,y.endColumn+C);for(const y of f)if(y.original.isEmpty||g.push({range:b(y.original.toInclusiveRange()),options:Qw}),y.modified.isEmpty||p.push({range:y.modified.toInclusiveRange(),options:fk}),y.modified.isEmpty||y.original.isEmpty)y.original.isEmpty||g.push({range:b(y.original.toInclusiveRange()),options:gk}),y.modified.isEmpty||p.push({range:y.modified.toInclusiveRange(),options:pk});else for(const w of y.innerChanges||[])y.original.contains(w.originalRange.startLineNumber)&&g.push({range:b(w.originalRange),options:w.originalRange.isEmpty()?xk:Yw}),y.modified.contains(w.modifiedRange.startLineNumber)&&p.push({range:w.modifiedRange,options:w.modifiedRange.isEmpty()?mk:vk});return{org:g,mod:p}}),this._originalDecorations=Wn(this,d=>this._decorations.read(d).org),this._modifiedDecorations=Wn(this,d=>this._decorations.read(d).mod),this._previewEditor.setModel(this._previewTextModel),this._register(this._editorObs.setDecorations(this._originalDecorations)),this._register(this._previewEditorObs.setDecorations(this._modifiedDecorations)),this._register(rs(d=>{const u=this._previewEditorObs.contentWidth.read(d),f=this._text.read(d).split(`
64
+ `).length-1,g=this._editor.getOption(67)*f;u<=0||this._previewEditor.layout({height:g,width:u})})),this._register(rs(d=>{this._position.read(d),this._editor.layoutOverlayWidget(this)})),this._register(rs(d=>{this._scrollChanged.read(d),this._position.read(d)&&this._editor.layoutOverlayWidget(this)}))}getId(){return this.id}getDomNode(){return this._nodes}getPosition(){const e=this._position.get();if(!e)return null;const t=this._editor.getLayoutInfo(),i=this._editor.getScrolledVisiblePosition(new Bi(e.top,1));if(!i)return null;const n=i.top-1,s=this._editor.getOffsetForColumn(e.left.lineNumber,e.left.column);return{preference:{left:t.contentLeft+s+10,top:n}}}},Ey=mu,mu.id=0,mu);wy=Ey=OB([pm(5,sn)],wy);var Gz=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},fd=function(o,e){return function(t,i){e(t,i,o)}},tg,dr;let fo=(dr=class extends Rt{static get(e){return e.getContribution(tg.ID)}constructor(e,t,i,n,s,r,a,d){super(),this.editor=e,this.instantiationService=t,this.contextKeyService=i,this.languageFeaturesService=n,this._commandService=s,this._configurationService=r,this._diffProviderFactoryService=a,this._modelService=d,this._isVisibleContext=tg.inlineEditVisibleContext.bindTo(this.contextKeyService),this._isCursorAtInlineEditContext=tg.cursorAtInlineEditContext.bindTo(this.contextKeyService),this._currentEdit=Qo(this,void 0),this._currentWidget=Hc(this._currentEdit,b=>{const y=this._currentEdit.read(b);if(!y)return;const w=y.range.endLineNumber,A=y.range.endColumn,I=y.text.endsWith(`
65
+ `)&&!(y.range.startLineNumber===y.range.endLineNumber&&y.range.startColumn===y.range.endColumn)?y.text.slice(0,-1):y.text,T=new Qg(w,[new lv(A,I,!1)]),R=y.range.startLineNumber===y.range.endLineNumber&&T.parts.length===1&&T.parts[0].lines.length===1,P=y.text==="";return!R&&!P?void 0:this.instantiationService.createInstance(vy,this.editor,{ghostText:gl(T),minReservedLineCount:gl(0),targetTextModel:gl(this.editor.getModel()??void 0),range:gl(y.range)})}),this._isAccepting=Qo(this,!1),this._enabled=Io(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).enabled),this._fontFamily=Io(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).fontFamily);const u=Pd("InlineEditController.modelContentChangedSignal",e.onDidChangeModelContent);this._register(rs(b=>{this._enabled.read(b)&&(u.read(b),!this._isAccepting.read(b)&&this.getInlineEdit(e,!0))}));const f=Io(this,e.onDidChangeCursorPosition,()=>e.getPosition());this._register(rs(b=>{if(!this._enabled.read(b))return;const y=f.read(b);y&&this.checkCursorPosition(y)})),this._register(rs(b=>{const y=this._currentEdit.read(b);if(this._isCursorAtInlineEditContext.set(!1),!y){this._isVisibleContext.set(!1);return}this._isVisibleContext.set(!0);const w=e.getPosition();w&&this.checkCursorPosition(w)}));const g=Pd("InlineEditController.editorBlurSignal",e.onDidBlurEditorWidget);this._register(rs(async b=>{var y;this._enabled.read(b)&&(g.read(b),!(this._configurationService.getValue("editor.experimentalInlineEdit.keepOnBlur")||e.getOption(63).keepOnBlur)&&((y=this._currentRequestCts)==null||y.dispose(!0),this._currentRequestCts=void 0,await this.clear(!1)))}));const p=Pd("InlineEditController.editorFocusSignal",e.onDidFocusEditorText);this._register(rs(b=>{this._enabled.read(b)&&(p.read(b),this.getInlineEdit(e,!0))}));const C=this._register(zA());this._register(rs(b=>{const y=this._fontFamily.read(b);C.setStyle(y===""||y==="default"?"":`
66
+ .monaco-editor .inline-edit-decoration,
67
+ .monaco-editor .inline-edit-decoration-preview,
68
+ .monaco-editor .inline-edit {
69
+ font-family: ${y};
70
+ }`)})),this._register(new _y(this.editor,this._currentWidget,this.instantiationService)),this._register(new yy(this.editor,this._currentEdit,this.instantiationService,this._diffProviderFactoryService,this._modelService))}checkCursorPosition(e){if(!this._currentEdit){this._isCursorAtInlineEditContext.set(!1);return}const t=this._currentEdit.get();if(!t){this._isCursorAtInlineEditContext.set(!1);return}this._isCursorAtInlineEditContext.set(Q.containsPosition(t.range,e))}validateInlineEdit(e,t){var i;if(t.text.includes(`
71
+ `)&&t.range.startLineNumber!==t.range.endLineNumber&&t.range.startColumn!==t.range.endColumn){if(t.range.startColumn!==1)return!1;const s=t.range.endLineNumber,r=t.range.endColumn,a=((i=e.getModel())==null?void 0:i.getLineLength(s))??0;if(r!==a+1)return!1}return!0}async fetchInlineEdit(e,t){this._currentRequestCts&&this._currentRequestCts.dispose(!0);const i=e.getModel();if(!i)return;const n=i.getVersionId(),s=this.languageFeaturesService.inlineEditProvider.all(i);if(s.length===0)return;const r=s[0];this._currentRequestCts=new Gs;const a=this._currentRequestCts.token,d=t?JS.Automatic:JS.Invoke;if(t&&await Kz(50,a),a.isCancellationRequested||i.isDisposed()||i.getVersionId()!==n)return;const f=await r.provideInlineEdit(i,{triggerKind:d},a);if(f&&!(a.isCancellationRequested||i.isDisposed()||i.getVersionId()!==n)&&this.validateInlineEdit(e,f))return f}async getInlineEdit(e,t){this._isCursorAtInlineEditContext.set(!1),await this.clear();const i=await this.fetchInlineEdit(e,t);i&&this._currentEdit.set(i,void 0)}async trigger(){await this.getInlineEdit(this.editor,!1)}async jumpBack(){this._jumpBackPosition&&(this.editor.setPosition(this._jumpBackPosition),this.editor.revealPositionInCenterIfOutsideViewport(this._jumpBackPosition))}async accept(){this._isAccepting.set(!0,void 0);const e=this._currentEdit.get();if(!e)return;let t=e.text;e.text.startsWith(`
72
+ `)&&(t=e.text.substring(1)),this.editor.pushUndoStop(),this.editor.executeEdits("acceptCurrent",[cs.replace(Q.lift(e.range),t)]),e.accepted&&await this._commandService.executeCommand(e.accepted.id,...e.accepted.arguments||[]).then(void 0,bs),this.freeEdit(e),Xu(i=>{this._currentEdit.set(void 0,i),this._isAccepting.set(!1,i)})}jumpToCurrent(){var i;this._jumpBackPosition=(i=this.editor.getSelection())==null?void 0:i.getStartPosition();const e=this._currentEdit.get();if(!e)return;const t=Bi.lift({lineNumber:e.range.startLineNumber,column:e.range.startColumn});this.editor.setPosition(t),this.editor.revealPositionInCenterIfOutsideViewport(t)}async clear(e=!0){const t=this._currentEdit.get();t&&(t!=null&&t.rejected)&&e&&await this._commandService.executeCommand(t.rejected.id,...t.rejected.arguments||[]).then(void 0,bs),t&&this.freeEdit(t),this._currentEdit.set(void 0,void 0)}freeEdit(e){const t=this.editor.getModel();if(!t)return;const i=this.languageFeaturesService.inlineEditProvider.all(t);i.length!==0&&i[0].freeInlineEdit(e)}},tg=dr,dr.ID="editor.contrib.inlineEditController",dr.inlineEditVisibleKey="inlineEditVisible",dr.inlineEditVisibleContext=new En(dr.inlineEditVisibleKey,!1),dr.cursorAtInlineEditKey="cursorAtInlineEdit",dr.cursorAtInlineEditContext=new En(dr.cursorAtInlineEditKey,!1),dr);fo=tg=Gz([fd(1,sn),fd(2,Fn),fd(3,Fi),fd(4,Vs),fd(5,ss),fd(6,Jw),fd(7,vo)],fo);function Kz(o,e){return new Promise(t=>{let i;const n=setTimeout(()=>{i&&i.dispose(),t()},o);e&&(i=e.onCancellationRequested(()=>{clearTimeout(n),i&&i.dispose(),t()}))})}let Zz=class extends Ct{constructor(){super({id:Hz,label:"Accept Inline Edit",alias:"Accept Inline Edit",precondition:qe.and(q.writable,fo.inlineEditVisibleContext),kbOpts:[{weight:101,primary:2,kbExpr:qe.and(q.writable,fo.inlineEditVisibleContext,fo.cursorAtInlineEditContext)}],menuOpts:[{menuId:ni.InlineEditToolbar,title:"Accept",group:"primary",order:1}]})}async run(e,t){const i=fo.get(t);await(i==null?void 0:i.accept())}};class Xz extends Ct{constructor(){const e=qe.and(q.writable,qe.not(fo.inlineEditVisibleKey));super({id:"editor.action.inlineEdit.trigger",label:"Trigger Inline Edit",alias:"Trigger Inline Edit",precondition:e,kbOpts:{weight:101,primary:2646,kbExpr:e}})}async run(e,t){const i=fo.get(t);i==null||i.trigger()}}class Yz extends Ct{constructor(){const e=qe.and(q.writable,fo.inlineEditVisibleContext,qe.not(fo.cursorAtInlineEditKey));super({id:zz,label:"Jump to Inline Edit",alias:"Jump to Inline Edit",precondition:e,kbOpts:{weight:101,primary:2646,kbExpr:e},menuOpts:[{menuId:ni.InlineEditToolbar,title:"Jump To Edit",group:"primary",order:3,when:e}]})}async run(e,t){const i=fo.get(t);i==null||i.jumpToCurrent()}}class Qz extends Ct{constructor(){const e=qe.and(q.writable,fo.cursorAtInlineEditContext);super({id:Vz,label:"Jump Back from Inline Edit",alias:"Jump Back from Inline Edit",precondition:e,kbOpts:{weight:110,primary:2646,kbExpr:e},menuOpts:[{menuId:ni.InlineEditToolbar,title:"Jump Back",group:"primary",order:3,when:e}]})}async run(e,t){const i=fo.get(t);i==null||i.jumpBack()}}class Jz extends Ct{constructor(){const e=qe.and(q.writable,fo.inlineEditVisibleContext);super({id:Wz,label:"Reject Inline Edit",alias:"Reject Inline Edit",precondition:e,kbOpts:{weight:100,primary:9,kbExpr:e},menuOpts:[{menuId:ni.InlineEditToolbar,title:"Reject",group:"secondary",order:2}]})}async run(e,t){const i=fo.get(t);await(i==null?void 0:i.clear())}}Le(Zz);Le(Jz);Le(Yz);Le(Qz);Le(Xz);hn(fo.ID,fo,3);const eV="editor.action.inlineEdits.accept",tV="editor.action.inlineEdits.showPrevious",iV="editor.action.inlineEdits.showNext",of=new En("inlineEditsVisible",!1,S("inlineEditsVisible","Whether an inline edit is visible")),nV=new En("inlineEditsIsPinned",!1,S("isPinned","Whether an inline edit is visible")),SS=class SS extends Rt{constructor(e){super(),this._editor=e,this._editorObs=Ia(this._editor),this._placeholderText=this._editorObs.getOption(88),this._state=ul({owner:this,equalsFn:_k},t=>{const i=this._placeholderText.read(t);if(i&&this._editorObs.valueIsEmpty.read(t))return{placeholder:i}}),this._shouldViewBeAlive=sV(this,t=>{var i;return((i=this._state.read(t))==null?void 0:i.placeholder)!==void 0}),this._view=mA((t,i)=>{if(!this._shouldViewBeAlive.read(t))return;const n=Fr("div.editorPlaceholder");i.add(rs(s=>{const r=this._state.read(s),a=(r==null?void 0:r.placeholder)!==void 0;n.root.style.display=a?"block":"none",n.root.innerText=(r==null?void 0:r.placeholder)??""})),i.add(rs(s=>{const r=this._editorObs.layoutInfo.read(s);n.root.style.left=`${r.contentLeft}px`,n.root.style.width=r.contentWidth-r.verticalScrollbarWidth+"px",n.root.style.top=`${this._editor.getTopForLineNumber(0)}px`})),i.add(rs(s=>{n.root.style.fontFamily=this._editorObs.getOption(49).read(s),n.root.style.fontSize=this._editorObs.getOption(52).read(s)+"px",n.root.style.lineHeight=this._editorObs.getOption(67).read(s)+"px"})),i.add(this._editorObs.createOverlayWidget({allowEditorOverflow:!1,minContentWidthInPx:gl(0),position:gl(null),domNode:n.root}))}),this._view.recomputeInitiallyAndOnChange(this._store)}};SS.ID="editor.contrib.placeholderText";let op=SS;function sV(o,e){return q_(o,(t,i)=>i===!0?!0:e(t))}var oV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},rV=function(o,e){return function(t,i){e(t,i,o)}};class aV{constructor(e,t,i){this.range=e,this.newLines=t,this.changes=i}}let Sy=class extends Rt{constructor(e,t,i,n){super(),this._editor=e,this._edit=t,this._userPrompt=i,this._instantiationService=n,this._editorObs=Ia(this._editor),this._elements=Fr("div.inline-edits-widget",{style:{position:"absolute",overflow:"visible",top:"0px",left:"0px"}},[Fr("div@editorContainer",{style:{position:"absolute",top:"0px",left:"0px",width:"500px",height:"500px"}},[Fr("div.toolbar@toolbar",{style:{position:"absolute",top:"-25px",left:"0px"}}),Fr("div.promptEditor@promptEditor",{style:{position:"absolute",top:"-25px",left:"80px",width:"300px",height:"22px"}}),Fr("div.preview@editor",{style:{position:"absolute",top:"0px",left:"0px"}})]),vh("svg",{style:{overflow:"visible",pointerEvents:"none"}},[vh("defs",[vh("linearGradient",{id:"Gradient2",x1:"0",y1:"0",x2:"1",y2:"0"},[vh("stop",{offset:"0%",class:"gradient-stop"}),vh("stop",{offset:"100%",class:"gradient-stop"})])]),vh("path@path",{d:"",fill:"url(#Gradient2)"})])]),this._previewTextModel=this._register(this._instantiationService.createInstance(dc,"",Rg,dc.DEFAULT_CREATION_OPTIONS,null)),this._setText=Wn(r=>{const a=this._edit.read(r);a&&this._previewTextModel.setValue(a.newLines.join(`
73
+ `))}).recomputeInitiallyAndOnChange(this._store),this._promptTextModel=this._register(this._instantiationService.createInstance(dc,"",Rg,dc.DEFAULT_CREATION_OPTIONS,null)),this._promptEditor=this._register(this._instantiationService.createInstance(Hr,this._elements.promptEditor,{glyphMargin:!1,lineNumbers:"off",minimap:{enabled:!1},guides:{indentation:!1,bracketPairs:!1,bracketPairsHorizontal:!1,highlightActiveIndentation:!1},folding:!1,selectOnLineNumbers:!1,selectionHighlight:!1,columnSelection:!1,overviewRulerBorder:!1,overviewRulerLanes:0,lineDecorationsWidth:0,lineNumbersMinChars:0,placeholder:"Describe the change you want...",fontFamily:kL},{contributions:BL.getSomeEditorContributions([Pr.ID,op.ID,X0.ID]),isSimpleWidget:!0},this._editor)),this._previewEditor=this._register(this._instantiationService.createInstance(Hr,this._elements.editor,{glyphMargin:!1,lineNumbers:"off",minimap:{enabled:!1},guides:{indentation:!1,bracketPairs:!1,bracketPairsHorizontal:!1,highlightActiveIndentation:!1},folding:!1,selectOnLineNumbers:!1,selectionHighlight:!1,columnSelection:!1,overviewRulerBorder:!1,overviewRulerLanes:0,lineDecorationsWidth:0,lineNumbersMinChars:0},{contributions:[]},this._editor)),this._previewEditorObs=Ia(this._previewEditor),this._decorations=Wn(this,r=>{var f;this._setText.read(r);const a=(f=this._edit.read(r))==null?void 0:f.changes;if(!a)return[];const d=[],u=[];if(a.length===1&&a[0].innerChanges[0].modifiedRange.equalsRange(this._previewTextModel.getFullModelRange()))return[];for(const g of a)if(g.original.isEmpty||d.push({range:g.original.toInclusiveRange(),options:Qw}),g.modified.isEmpty||u.push({range:g.modified.toInclusiveRange(),options:fk}),g.modified.isEmpty||g.original.isEmpty)g.original.isEmpty||d.push({range:g.original.toInclusiveRange(),options:gk}),g.modified.isEmpty||u.push({range:g.modified.toInclusiveRange(),options:pk});else for(const p of g.innerChanges||[])g.original.contains(p.originalRange.startLineNumber)&&d.push({range:p.originalRange,options:p.originalRange.isEmpty()?xk:Yw}),g.modified.contains(p.modifiedRange.startLineNumber)&&u.push({range:p.modifiedRange,options:p.modifiedRange.isEmpty()?mk:vk});return u}),this._layout1=Wn(this,r=>{const a=this._editor.getModel(),d=this._edit.read(r);if(!d)return null;const u=d.range;let f=0;for(let C=u.startLineNumber;C<u.endLineNumberExclusive;C++){const b=a.getLineMaxColumn(C),y=this._editor.getOffsetForColumn(C,b);f=Math.max(f,y)}return{left:this._editor.getLayoutInfo().contentLeft+f}}),this._layout=Wn(this,r=>{const a=this._edit.read(r);if(!a)return null;const d=a.range,u=this._editorObs.scrollLeft.read(r),f=this._layout1.read(r).left+20-u,g=this._editor.getTopForLineNumber(d.startLineNumber)-this._editorObs.scrollTop.read(r),p=this._editor.getTopForLineNumber(d.endLineNumberExclusive)-this._editorObs.scrollTop.read(r),C=new Yh(f,g),b=new Yh(f,p),y=p-g,w=50,A=this._editor.getOption(67)*a.newLines.length,I=y-A,T=new Yh(f+w,g+I/2),R=new Yh(f+w,p-I/2);return{topCode:C,bottomCode:b,codeHeight:y,topEdit:T,bottomEdit:R,editHeight:A}});const s=Wn(this,r=>this._edit.read(r)!==void 0||this._userPrompt.read(r)!==void 0);this._register(FL(this._elements.root,{display:Wn(this,r=>s.read(r)?"block":"none")})),this._register(LL(this._editor.getDomNode(),this._elements.root)),this._register(Ia(e).createOverlayWidget({domNode:this._elements.root,position:gl(null),allowEditorOverflow:!1,minContentWidthInPx:Wn(r=>{var u;const a=(u=this._layout1.read(r))==null?void 0:u.left;if(a===void 0)return 0;const d=this._previewEditorObs.contentWidth.read(r);return a+d})})),this._previewEditor.setModel(this._previewTextModel),this._register(this._previewEditorObs.setDecorations(this._decorations)),this._register(rs(r=>{const a=this._layout.read(r);if(!a)return;const{topCode:d,bottomCode:u,topEdit:f,bottomEdit:g,editHeight:p}=a,C=10,b=0,y=40,w=new cV().moveTo(d).lineTo(d.deltaX(C)).curveTo(d.deltaX(C+y),f.deltaX(-y-b),f.deltaX(-b)).lineTo(f).lineTo(g).lineTo(g.deltaX(-b)).curveTo(g.deltaX(-y-b),u.deltaX(C+y),u.deltaX(C)).lineTo(u).build();this._elements.path.setAttribute("d",w),this._elements.editorContainer.style.top=`${f.y}px`,this._elements.editorContainer.style.left=`${f.x}px`,this._elements.editorContainer.style.height=`${p}px`;const A=this._previewEditorObs.contentWidth.read(r);this._previewEditor.layout({height:p,width:A})})),this._promptEditor.setModel(this._promptTextModel),this._promptEditor.layout(),this._register(dV(lV(this._userPrompt,r=>r??"",r=>r),Ia(this._promptEditor).value)),this._register(rs(r=>{const a=Ia(this._promptEditor).isFocused.read(r);this._elements.root.classList.toggle("focused",a)}))}};Sy=oV([rV(3,sn)],Sy);function lV(o,e,t){return bk(void 0,i=>e(o.read(i)),(i,n)=>o.set(t(i),n))}class Yh{constructor(e,t){this.x=e,this.y=t}deltaX(e){return new Yh(this.x+e,this.y)}}class cV{constructor(){this._data=""}moveTo(e){return this._data+=`M ${e.x} ${e.y} `,this}lineTo(e){return this._data+=`L ${e.x} ${e.y} `,this}curveTo(e,t,i){return this._data+=`C ${e.x} ${e.y} ${t.x} ${t.y} ${i.x} ${i.y} `,this}build(){return this._data}}function dV(o,e){const t=new Tt;return t.add(rs(i=>{const n=o.read(i);e.set(n,void 0)})),t.add(rs(i=>{const n=e.read(i);o.set(n,void 0)})),t}var uV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},NC=function(o,e){return function(t,i){e(t,i,o)}},ig,vu;let Dy=(vu=class extends Rt{static _createUniqueUri(){return jn.from({scheme:"inline-edits",path:new Date().toString()+String(ig._modelId++)})}constructor(e,t,i,n,s,r,a){super(),this.textModel=e,this._textModelVersionId=t,this._selection=i,this._debounceValue=n,this.languageFeaturesService=s,this._diffProviderFactoryService=r,this._modelService=a,this._forceUpdateExplicitlySignal=qw(this),this._selectedInlineCompletionId=Qo(this,void 0),this._isActive=Qo(this,!1),this._originalModel=Hc(()=>this._modelService.createModel("",null,ig._createUniqueUri())).keepObserved(this._store),this._modifiedModel=Hc(()=>this._modelService.createModel("",null,ig._createUniqueUri())).keepObserved(this._store),this._pinnedRange=new fV(this.textModel,this._textModelVersionId),this.isPinned=this._pinnedRange.range.map(d=>!!d),this.userPrompt=Qo(this,void 0),this.inlineEdit=Wn(this,d=>{var u,f;return(f=(u=this._inlineEdit.read(d))==null?void 0:u.promiseResult.read(d))==null?void 0:f.data}),this._inlineEdit=Wn(this,d=>{const u=this.selectedInlineEdit.read(d);if(!u)return;const f=u.inlineCompletion.range;if(u.inlineCompletion.insertText.trim()==="")return;let g=u.inlineCompletion.insertText.split(/\r\n|\r|\n/);function p(w){var I;const A=((I=w[0].match(/^\s*/))==null?void 0:I[0])??"";return w.map(T=>T.replace(new RegExp("^"+A),""))}g=p(g);let b=this.textModel.getValueInRange(f).split(/\r\n|\r|\n/);b=p(b),this._originalModel.get().setValue(b.join(`
74
+ `)),this._modifiedModel.get().setValue(g.join(`
75
+ `));const y=this._diffProviderFactoryService.createDiffProvider({diffAlgorithm:"advanced"});return hk.fromFn(async()=>{const w=await y.computeDiff(this._originalModel.get(),this._modifiedModel.get(),{computeMoves:!1,ignoreTrimWhitespace:!1,maxComputationTimeMs:1e3},an.None);if(!w.identical)return new aV(IL.fromRangeInclusive(f),p(g),w.changes)})}),this._fetchStore=this._register(new Tt),this._inlineEditsFetchResult=r1(this,void 0),this._inlineEdits=ul({owner:this,equalsFn:_k},d=>{var u;return((u=this._inlineEditsFetchResult.read(d))==null?void 0:u.completions.map(f=>new hV(f)))??[]}),this._fetchInlineEditsPromise=XA({owner:this,createEmptyChangeSummary:()=>({inlineCompletionTriggerKind:_l.Automatic}),handleChange:(d,u)=>(d.didChange(this._forceUpdateExplicitlySignal)&&(u.inlineCompletionTriggerKind=_l.Explicit),!0)},async(d,u)=>{this._fetchStore.clear(),this._forceUpdateExplicitlySignal.read(d),this._textModelVersionId.read(d);function f(y,w){return w(y)}const g=this._pinnedRange.range.read(d)??f(this._selection.read(d),y=>y.isEmpty()?void 0:y);if(!g){this._inlineEditsFetchResult.set(void 0,void 0),this.userPrompt.set(void 0,void 0);return}const p={triggerKind:u.inlineCompletionTriggerKind,selectedSuggestionInfo:void 0,userPrompt:this.userPrompt.read(d)},C=l1(this._fetchStore);await J_(200,C);const b=await bB(this.languageFeaturesService.inlineCompletionsProvider,g,this.textModel,p,C);C.isCancellationRequested||this._inlineEditsFetchResult.set(b,void 0)}),this._filteredInlineEditItems=ul({owner:this,equalsFn:a1()},d=>this._inlineEdits.read(d)),this.selectedInlineCompletionIndex=Wn(this,d=>{const u=this._selectedInlineCompletionId.read(d),f=this._filteredInlineEditItems.read(d),g=this._selectedInlineCompletionId===void 0?-1:f.findIndex(p=>p.semanticId===u);return g===-1?(this._selectedInlineCompletionId.set(void 0,void 0),0):g}),this.selectedInlineEdit=Wn(this,d=>{const u=this._filteredInlineEditItems.read(d),f=this.selectedInlineCompletionIndex.read(d);return u[f]}),this._register(YA(this._fetchInlineEditsPromise))}async triggerExplicitly(e){Bm(e,t=>{this._isActive.set(!0,t),this._forceUpdateExplicitlySignal.trigger(t)}),await this._fetchInlineEditsPromise.get()}stop(e){Bm(e,t=>{this.userPrompt.set(void 0,t),this._isActive.set(!1,t),this._inlineEditsFetchResult.set(void 0,t),this._pinnedRange.setRange(void 0,t)})}async _deltaSelectedInlineCompletionIndex(e){await this.triggerExplicitly();const t=this._filteredInlineEditItems.get()||[];if(t.length>0){const i=(this.selectedInlineCompletionIndex.get()+e+t.length)%t.length;this._selectedInlineCompletionId.set(t[i].semanticId,void 0)}else this._selectedInlineCompletionId.set(void 0,void 0)}async next(){await this._deltaSelectedInlineCompletionIndex(1)}async previous(){await this._deltaSelectedInlineCompletionIndex(-1)}async accept(e){if(e.getModel()!==this.textModel)throw new O0;const t=this.selectedInlineEdit.get();t&&(e.pushUndoStop(),e.executeEdits("inlineSuggestion.accept",[t.inlineCompletion.toSingleTextEdit().toSingleEditOperation()]),this.stop())}},ig=vu,vu._modelId=0,vu);Dy=ig=uV([NC(4,Fi),NC(5,Jw),NC(6,vo)],Dy);class hV{constructor(e){this.inlineCompletion=e,this.semanticId=this.inlineCompletion.hash()}}class fV extends Rt{constructor(e,t){super(),this._textModel=e,this._versionId=t,this._decorations=Qo(this,[]),this.range=Wn(this,i=>{this._versionId.read(i);const n=this._decorations.read(i)[0];return n?this._textModel.getDecorationRange(n)??null:null}),this._register(is(()=>{this._textModel.deltaDecorations(this._decorations.get(),[])}))}setRange(e,t){this._decorations.set(this._textModel.deltaDecorations(this._decorations.get(),e?[{range:e,options:{description:"trackedRange"}}]:[]),t)}}var gV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Wf=function(o,e){return function(t,i){e(t,i,o)}},Ay,_u;let Ll=(_u=class extends Rt{static get(e){return e.getContribution(Ay.ID)}constructor(e,t,i,n,s,r){super(),this.editor=e,this._instantiationService=t,this._contextKeyService=i,this._debounceService=n,this._languageFeaturesService=s,this._configurationService=r,this._enabled=PL("editor.inlineEdits.enabled",!1,this._configurationService),this._editorObs=Ia(this.editor),this._selection=Wn(this,a=>this._editorObs.cursorSelection.read(a)??new $i(1,1,1,1)),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineEditsDebounce",{min:50,max:50}),this.model=Hc(this,a=>{if(!this._enabled.read(a)||this._editorObs.isReadonly.read(a))return;const d=this._editorObs.model.read(a);return d?this._instantiationService.createInstance(c1(Dy,a),d,this._editorObs.versionId,this._selection,this._debounceValue):void 0}),this._hadInlineEdit=q_(this,(a,d)=>{var u;return d||((u=this.model.read(a))==null?void 0:u.inlineEdit.read(a))!==void 0}),this._widget=Hc(this,a=>{if(this._hadInlineEdit.read(a))return this._instantiationService.createInstance(c1(Sy,a),this.editor,this.model.map((d,u)=>d==null?void 0:d.inlineEdit.read(u)),pV(d=>{var u;return((u=this.model.read(d))==null?void 0:u.userPrompt)??Qo("empty","")}))}),this._register(e8(of,this._contextKeyService,a=>{var d;return!!((d=this.model.read(a))!=null&&d.inlineEdit.read(a))})),this._register(e8(nV,this._contextKeyService,a=>{var d;return!!((d=this.model.read(a))!=null&&d.isPinned.read(a))})),this.model.recomputeInitiallyAndOnChange(this._store),this._widget.recomputeInitiallyAndOnChange(this._store)}},Ay=_u,_u.ID="editor.contrib.inlineEditsController",_u);Ll=Ay=gV([Wf(1,sn),Wf(2,Fn),Wf(3,gr),Wf(4,Fi),Wf(5,ss)],Ll);function pV(o){return bk(void 0,e=>o(e).read(e),(e,t)=>{o(void 0).set(e,t)})}function Jp(o){return{label:o.value,alias:o.original}}const w_=class w_ extends Ct{constructor(){super({id:w_.ID,...Jp(Ai("action.inlineEdits.showNext","Show Next Inline Edit")),precondition:qe.and(q.writable,of),kbOpts:{weight:100,primary:606}})}async run(e,t){var n;const i=Ll.get(t);(n=i==null?void 0:i.model.get())==null||n.next()}};w_.ID=iV;let ky=w_;const S_=class S_ extends Ct{constructor(){super({id:S_.ID,...Jp(Ai("action.inlineEdits.showPrevious","Show Previous Inline Edit")),precondition:qe.and(q.writable,of),kbOpts:{weight:100,primary:604}})}async run(e,t){var n;const i=Ll.get(t);(n=i==null?void 0:i.model.get())==null||n.previous()}};S_.ID=tV;let By=S_;class xV extends Ct{constructor(){super({id:"editor.action.inlineEdits.trigger",...Jp(Ai("action.inlineEdits.trigger","Trigger Inline Edit")),precondition:q.writable})}async run(e,t){const i=Ll.get(t);await ak(async n=>{var s;await((s=i==null?void 0:i.model.get())==null?void 0:s.triggerExplicitly(n))})}}class mV extends Ct{constructor(){super({id:eV,...Jp(Ai("action.inlineEdits.accept","Accept Inline Edit")),precondition:of,menuOpts:{menuId:ni.InlineEditsActions,title:S("inlineEditsActions","Accept Inline Edit"),group:"primary",order:1,icon:Ki.check},kbOpts:{primary:2058,weight:2e4,kbExpr:of}})}async run(e,t){var n;t instanceof Hr&&(t=t.getParentEditor());const i=Ll.get(t);i&&((n=i.model.get())==null||n.accept(i.editor),i.editor.focus())}}const D_=class D_ extends Ct{constructor(){super({id:D_.ID,...Jp(Ai("action.inlineEdits.hide","Hide Inline Edit")),precondition:of,kbOpts:{weight:100,primary:9}})}async run(e,t){const i=Ll.get(t);Xu(n=>{var s;(s=i==null?void 0:i.model.get())==null||s.stop(n)})}};D_.ID="editor.action.inlineEdits.hide";let Fy=D_;hn(Ll.ID,Ll,3);Le(xV);Le(ky);Le(By);Le(mV);Le(Fy);const Uu={Visible:new En("parameterHintsVisible",!1),MultipleSignatures:new En("parameterHintsMultipleSignatures",!1)};async function HB(o,e,t,i,n){const s=o.ordered(e);for(const r of s)try{const a=await r.provideSignatureHelp(e,t,n,i);if(a)return a}catch(a){bs(a)}}Qn.registerCommand("_executeSignatureHelpProvider",async(o,...e)=>{const[t,i,n]=e;Pn(jn.isUri(t)),Pn(Bi.isIPosition(i)),Pn(typeof n=="string"||!n);const s=o.get(Fi),r=await o.get(fa).createModelReference(t);try{const a=await HB(s.signatureHelpProvider,r.object.textEditorModel,Bi.lift(i),{triggerKind:mc.Invoke,isRetrigger:!1,triggerCharacter:n},an.None);return a?(setTimeout(()=>a.dispose(),0),a.value):void 0}finally{r.dispose()}});var tc;(function(o){o.Default={type:0};class e{constructor(n,s){this.request=n,this.previouslyActiveHints=s,this.type=2}}o.Pending=e;class t{constructor(n){this.hints=n,this.type=1}}o.Active=t})(tc||(tc={}));const A_=class A_ extends Rt{constructor(e,t,i=A_.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new rn),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=tc.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new er),this.triggerChars=new Am,this.retriggerChars=new Am,this.triggerId=0,this.editor=e,this.providers=t,this.throttledDelayer=new Oc(i),this._register(this.editor.onDidBlurEditorWidget(()=>this.cancel())),this._register(this.editor.onDidChangeConfiguration(()=>this.onEditorConfigurationChange())),this._register(this.editor.onDidChangeModel(n=>this.onModelChanged())),this._register(this.editor.onDidChangeModelLanguage(n=>this.onModelChanged())),this._register(this.editor.onDidChangeCursorSelection(n=>this.onCursorChange(n))),this._register(this.editor.onDidChangeModelContent(n=>this.onModelContentChange())),this._register(this.providers.onDidChange(this.onModelChanged,this)),this._register(this.editor.onDidType(n=>this.onDidType(n))),this.onEditorConfigurationChange(),this.onModelChanged()}get state(){return this._state}set state(e){this._state.type===2&&this._state.request.cancel(),this._state=e}cancel(e=!1){this.state=tc.Default,this.throttledDelayer.cancel(),e||this._onChangedHints.fire(void 0)}trigger(e,t){const i=this.editor.getModel();if(!i||!this.providers.has(i))return;const n=++this.triggerId;this._pendingTriggers.push(e),this.throttledDelayer.trigger(()=>this.doTrigger(n),t).catch(qn)}next(){if(this.state.type!==1)return;const e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,i=t%e===e-1,n=this.editor.getOption(86).cycle;if((e<2||i)&&!n){this.cancel();return}this.updateActiveSignature(i&&n?0:t+1)}previous(){if(this.state.type!==1)return;const e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,i=t===0,n=this.editor.getOption(86).cycle;if((e<2||i)&&!n){this.cancel();return}this.updateActiveSignature(i&&n?e-1:t-1)}updateActiveSignature(e){this.state.type===1&&(this.state=new tc.Active({...this.state.hints,activeSignature:e}),this._onChangedHints.fire(this.state.hints))}async doTrigger(e){const t=this.state.type===1||this.state.type===2,i=this.getLastActiveHints();if(this.cancel(!0),this._pendingTriggers.length===0)return!1;const n=this._pendingTriggers.reduce(vV);this._pendingTriggers=[];const s={triggerKind:n.triggerKind,triggerCharacter:n.triggerCharacter,isRetrigger:t,activeSignatureHelp:i};if(!this.editor.hasModel())return!1;const r=this.editor.getModel(),a=this.editor.getPosition();this.state=new tc.Pending(qs(d=>HB(this.providers,r,a,s,d)),i);try{const d=await this.state.request;return e!==this.triggerId?(d==null||d.dispose(),!1):!d||!d.value.signatures||d.value.signatures.length===0?(d==null||d.dispose(),this._lastSignatureHelpResult.clear(),this.cancel(),!1):(this.state=new tc.Active(d.value),this._lastSignatureHelpResult.value=d,this._onChangedHints.fire(this.state.hints),!0)}catch(d){return e===this.triggerId&&(this.state=tc.Default),qn(d),!1}}getLastActiveHints(){switch(this.state.type){case 1:return this.state.hints;case 2:return this.state.previouslyActiveHints;default:return}}get isTriggered(){return this.state.type===1||this.state.type===2||this.throttledDelayer.isTriggered()}onModelChanged(){this.cancel(),this.triggerChars.clear(),this.retriggerChars.clear();const e=this.editor.getModel();if(e)for(const t of this.providers.ordered(e)){for(const i of t.signatureHelpTriggerCharacters||[])if(i.length){const n=i.charCodeAt(0);this.triggerChars.add(n),this.retriggerChars.add(n)}for(const i of t.signatureHelpRetriggerCharacters||[])i.length&&this.retriggerChars.add(i.charCodeAt(0))}}onDidType(e){if(!this.triggerOnType)return;const t=e.length-1,i=e.charCodeAt(t);(this.triggerChars.has(i)||this.isTriggered&&this.retriggerChars.has(i))&&this.trigger({triggerKind:mc.TriggerCharacter,triggerCharacter:e.charAt(t)})}onCursorChange(e){e.source==="mouse"?this.cancel():this.isTriggered&&this.trigger({triggerKind:mc.ContentChange})}onModelContentChange(){this.isTriggered&&this.trigger({triggerKind:mc.ContentChange})}onEditorConfigurationChange(){this.triggerOnType=this.editor.getOption(86).enabled,this.triggerOnType||this.cancel()}dispose(){this.cancel(!0),super.dispose()}};A_.DEFAULT_DELAY=120;let Ly=A_;function vV(o,e){switch(e.triggerKind){case mc.Invoke:return e;case mc.ContentChange:return o;case mc.TriggerCharacter:default:return e}}var _V=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Wx=function(o,e){return function(t,i){e(t,i,o)}},Iy;const Wo=mi,bV=ms("parameter-hints-next",Ki.chevronDown,S("parameterHintsNextIcon","Icon for show next parameter hint.")),CV=ms("parameter-hints-previous",Ki.chevronUp,S("parameterHintsPreviousIcon","Icon for show previous parameter hint."));var bu;let Py=(bu=class extends Rt{constructor(e,t,i,n,s,r){super(),this.editor=e,this.model=t,this.telemetryService=r,this.renderDisposeables=this._register(new Tt),this.visible=!1,this.announcedLabel=null,this.allowEditorOverflow=!0,this.markdownRenderer=this._register(new uf({editor:e},s,n)),this.keyVisible=Uu.Visible.bindTo(i),this.keyMultipleSignatures=Uu.MultipleSignatures.bindTo(i)}createParameterHintDOMNodes(){const e=Wo(".editor-widget.parameter-hints-widget"),t=di(e,Wo(".phwrapper"));t.tabIndex=-1;const i=di(t,Wo(".controls")),n=di(i,Wo(".button"+Rn.asCSSSelector(CV))),s=di(i,Wo(".overloads")),r=di(i,Wo(".button"+Rn.asCSSSelector(bV)));this._register(Bn(n,"click",p=>{Dm.stop(p),this.previous()})),this._register(Bn(r,"click",p=>{Dm.stop(p),this.next()}));const a=Wo(".body"),d=new tk(a,{alwaysConsumeMouseWheel:!0});this._register(d),t.appendChild(d.getDomNode());const u=di(a,Wo(".signature")),f=di(a,Wo(".docs"));e.style.userSelect="text",this.domNodes={element:e,signature:u,overloads:s,docs:f,scrollbar:d},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection(p=>{this.visible&&this.editor.layoutContentWidget(this)}));const g=()=>{if(!this.domNodes)return;const p=this.editor.getOption(50),C=this.domNodes.element;C.style.fontSize=`${p.fontSize}px`,C.style.lineHeight=`${p.lineHeight/p.fontSize}`,C.style.setProperty("--vscode-parameterHintsWidget-editorFontFamily",p.fontFamily),C.style.setProperty("--vscode-parameterHintsWidget-editorFontFamilyDefault",Ow.fontFamily)};g(),this._register(Ts.chain(this.editor.onDidChangeConfiguration.bind(this.editor),p=>p.filter(C=>C.hasChanged(50)))(g)),this._register(this.editor.onDidLayoutChange(p=>this.updateMaxHeight())),this.updateMaxHeight()}show(){this.visible||(this.domNodes||this.createParameterHintDOMNodes(),this.keyVisible.set(!0),this.visible=!0,setTimeout(()=>{var e;(e=this.domNodes)==null||e.element.classList.add("visible")},100),this.editor.layoutContentWidget(this))}hide(){var e;this.renderDisposeables.clear(),this.visible&&(this.keyVisible.reset(),this.visible=!1,this.announcedLabel=null,(e=this.domNodes)==null||e.element.classList.remove("visible"),this.editor.layoutContentWidget(this))}getPosition(){return this.visible?{position:this.editor.getPosition(),preference:[1,2]}:null}render(e){if(this.renderDisposeables.clear(),!this.domNodes)return;const t=e.signatures.length>1;this.domNodes.element.classList.toggle("multiple",t),this.keyMultipleSignatures.set(t),this.domNodes.signature.innerText="",this.domNodes.docs.innerText="";const i=e.signatures[e.activeSignature];if(!i)return;const n=di(this.domNodes.signature,Wo(".code")),s=i.parameters.length>0,r=i.activeParameter??e.activeParameter;if(s)this.renderParameters(n,i,r);else{const u=di(n,Wo("span"));u.textContent=i.label}const a=i.parameters[r];if(a!=null&&a.documentation){const u=Wo("span.documentation");if(typeof a.documentation=="string")u.textContent=a.documentation;else{const f=this.renderMarkdownDocs(a.documentation);u.appendChild(f.element)}di(this.domNodes.docs,Wo("p",{},u))}if(i.documentation!==void 0)if(typeof i.documentation=="string")di(this.domNodes.docs,Wo("p",{},i.documentation));else{const u=this.renderMarkdownDocs(i.documentation);di(this.domNodes.docs,u.element)}const d=this.hasDocs(i,a);if(this.domNodes.signature.classList.toggle("has-docs",d),this.domNodes.docs.classList.toggle("empty",!d),this.domNodes.overloads.textContent=String(e.activeSignature+1).padStart(e.signatures.length.toString().length,"0")+"/"+e.signatures.length,a){let u="";const f=i.parameters[r];Array.isArray(f.label)?u=i.label.substring(f.label[0],f.label[1]):u=f.label,f.documentation&&(u+=typeof f.documentation=="string"?`, ${f.documentation}`:`, ${f.documentation.value}`),i.documentation&&(u+=typeof i.documentation=="string"?`, ${i.documentation}`:`, ${i.documentation.value}`),this.announcedLabel!==u&&(Nr(S("hint","{0}, hint",u)),this.announcedLabel=u)}this.editor.layoutContentWidget(this),this.domNodes.scrollbar.scanDomNode()}renderMarkdownDocs(e){const t=new Oo,i=this.renderDisposeables.add(this.markdownRenderer.render(e,{asyncRenderCallback:()=>{var s;(s=this.domNodes)==null||s.scrollbar.scanDomNode()}}));i.element.classList.add("markdown-docs");const n=t.elapsed();return n>300&&this.telemetryService.publicLog2("parameterHints.parseMarkdown",{renderDuration:n}),i}hasDocs(e,t){return!!(t&&typeof t.documentation=="string"&&$h(t.documentation).length>0||t&&typeof t.documentation=="object"&&$h(t.documentation).value.length>0||e.documentation&&typeof e.documentation=="string"&&$h(e.documentation).length>0||e.documentation&&typeof e.documentation=="object"&&$h(e.documentation.value).length>0)}renderParameters(e,t,i){const[n,s]=this.getParameterLabelOffsets(t,i),r=document.createElement("span");r.textContent=t.label.substring(0,n);const a=document.createElement("span");a.textContent=t.label.substring(n,s),a.className="parameter active";const d=document.createElement("span");d.textContent=t.label.substring(s),di(e,r,a,d)}getParameterLabelOffsets(e,t){const i=e.parameters[t];if(i){if(Array.isArray(i.label))return i.label;if(i.label.length){const n=new RegExp(`(\\W|^)${Lg(i.label)}(?=\\W|$)`,"g");n.test(e.label);const s=n.lastIndex-i.label.length;return s>=0?[s,n.lastIndex]:[0,0]}else return[0,0]}else return[0,0]}next(){this.editor.focus(),this.model.next()}previous(){this.editor.focus(),this.model.previous()}getDomNode(){return this.domNodes||this.createParameterHintDOMNodes(),this.domNodes.element}getId(){return Iy.ID}updateMaxHeight(){if(!this.domNodes)return;const t=`${Math.max(this.editor.getLayoutInfo().height/4,250)}px`;this.domNodes.element.style.maxHeight=t;const i=this.domNodes.element.getElementsByClassName("phwrapper");i.length&&(i[0].style.maxHeight=t)}},Iy=bu,bu.ID="editor.widget.parameterHintsWidget",bu);Py=Iy=_V([Wx(2,Fn),Wx(3,da),Wx(4,ha),Wx(5,ua)],Py);vi("editorHoverWidget.highlightForeground",ok,S("editorHoverWidgetHighlightForeground","Foreground color of the active item in the parameter hint."));var EV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},jD=function(o,e){return function(t,i){e(t,i,o)}},Ty,Cu;let rf=(Cu=class extends Rt{static get(e){return e.getContribution(Ty.ID)}constructor(e,t,i){super(),this.editor=e,this.model=this._register(new Ly(e,i.signatureHelpProvider)),this._register(this.model.onChangedHints(n=>{var s;n?(this.widget.value.show(),this.widget.value.render(n)):(s=this.widget.rawValue)==null||s.hide()})),this.widget=new Fw(()=>this._register(t.createInstance(Py,this.editor,this.model)))}cancel(){this.model.cancel()}previous(){var e;(e=this.widget.rawValue)==null||e.previous()}next(){var e;(e=this.widget.rawValue)==null||e.next()}trigger(e){this.model.trigger(e,0)}},Ty=Cu,Cu.ID="editor.controller.parameterHints",Cu);rf=Ty=EV([jD(1,sn),jD(2,Fi)],rf);class yV extends Ct{constructor(){super({id:"editor.action.triggerParameterHints",label:S("parameterHints.trigger.label","Trigger Parameter Hints"),alias:"Trigger Parameter Hints",precondition:q.hasSignatureHelpProvider,kbOpts:{kbExpr:q.editorTextFocus,primary:3082,weight:100}})}run(e,t){const i=rf.get(t);i==null||i.trigger({triggerKind:mc.Invoke})}}hn(rf.ID,rf,2);Le(yV);const Y9=175,Q9=Ao.bindToContribution(rf.get);Ti(new Q9({id:"closeParameterHints",precondition:Uu.Visible,handler:o=>o.cancel(),kbOpts:{weight:Y9,kbExpr:q.focus,primary:9,secondary:[1033]}}));Ti(new Q9({id:"showPrevParameterHint",precondition:qe.and(Uu.Visible,Uu.MultipleSignatures),handler:o=>o.previous(),kbOpts:{weight:Y9,kbExpr:q.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}}));Ti(new Q9({id:"showNextParameterHint",precondition:qe.and(Uu.Visible,Uu.MultipleSignatures),handler:o=>o.next(),kbOpts:{weight:Y9,kbExpr:q.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var wV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},SV=function(o,e){return function(t,i){e(t,i,o)}};class DV{constructor(e){this.instantiationService=e}init(...e){}}function AV(o,e){return class extends e{constructor(){super(...arguments),this._autorun=void 0}init(...i){this._autorun=Lp((n,s)=>{const r=c1(o(),n);s.add(this.instantiationService.createInstance(r,...i))})}dispose(){var i;(i=this._autorun)==null||i.dispose()}}}function kV(o){return TL()?AV(o,My):o()}let My=class extends DV{constructor(e,t){super(t),this.init(e)}};My=wV([SV(1,sn)],My);hn(op.ID,kV(()=>op),0);vi("editor.placeholder.foreground",ML,S("placeholderForeground","Foreground color of the placeholder text in the editor."));var BV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},zx=function(o,e){return function(t,i){e(t,i,o)}};const _f=new En("renameInputVisible",!1,S("renameInputVisible","Whether the rename input widget is visible"));new En("renameInputFocused",!1,S("renameInputFocused","Whether the rename input widget is focused"));let Ry=class{constructor(e,t,i,n,s,r){this._editor=e,this._acceptKeybindings=t,this._themeService=i,this._keybindingService=n,this._logService=r,this.allowEditorOverflow=!0,this._disposables=new Tt,this._visibleContextKey=_f.bindTo(s),this._isEditingRenameCandidate=!1,this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,this._candidates=new Set,this._beforeFirstInputFieldEditSW=new Oo,this._inputWithButton=new FV,this._disposables.add(this._inputWithButton),this._editor.addContentWidget(this),this._disposables.add(this._editor.onDidChangeConfiguration(a=>{a.hasChanged(50)&&this._updateFont()})),this._disposables.add(i.onDidColorThemeChange(this._updateStyles,this))}dispose(){this._disposables.dispose(),this._editor.removeContentWidget(this)}getId(){return"__renameInputWidget"}getDomNode(){return this._domNode||(this._domNode=document.createElement("div"),this._domNode.className="monaco-editor rename-box",this._domNode.appendChild(this._inputWithButton.domNode),this._renameCandidateListView=this._disposables.add(new J9(this._domNode,{fontInfo:this._editor.getOption(50),onFocusChange:e=>{this._inputWithButton.input.value=e,this._isEditingRenameCandidate=!1},onSelectionChange:()=>{this._isEditingRenameCandidate=!1,this.acceptInput(!1)}})),this._disposables.add(this._inputWithButton.onDidInputChange(()=>{var e,t,i;((e=this._renameCandidateListView)==null?void 0:e.focusedCandidate)!==void 0&&(this._isEditingRenameCandidate=!0),this._timeBeforeFirstInputFieldEdit??(this._timeBeforeFirstInputFieldEdit=this._beforeFirstInputFieldEditSW.elapsed()),((t=this._renameCandidateProvidersCts)==null?void 0:t.token.isCancellationRequested)===!1&&this._renameCandidateProvidersCts.cancel(),(i=this._renameCandidateListView)==null||i.clearFocus()})),this._label=document.createElement("div"),this._label.className="rename-label",this._domNode.appendChild(this._label),this._updateFont(),this._updateStyles(this._themeService.getColorTheme())),this._domNode}_updateStyles(e){if(!this._domNode)return;const t=e.getColor(RL),i=e.getColor(NL);this._domNode.style.backgroundColor=String(e.getColor(ik)??""),this._domNode.style.boxShadow=t?` 0 0 8px 2px ${t}`:"",this._domNode.style.border=i?`1px solid ${i}`:"",this._domNode.style.color=String(e.getColor(OL)??"");const n=e.getColor(HL);this._inputWithButton.domNode.style.backgroundColor=String(e.getColor(t8)??""),this._inputWithButton.input.style.backgroundColor=String(e.getColor(t8)??""),this._inputWithButton.domNode.style.borderWidth=n?"1px":"0px",this._inputWithButton.domNode.style.borderStyle=n?"solid":"none",this._inputWithButton.domNode.style.borderColor=(n==null?void 0:n.toString())??"none"}_updateFont(){if(this._domNode===void 0)return;Pn(this._label!==void 0,"RenameWidget#_updateFont: _label must not be undefined given _domNode is defined"),this._editor.applyFontInfo(this._inputWithButton.input);const e=this._editor.getOption(50);this._label.style.fontSize=`${this._computeLabelFontSize(e.fontSize)}px`}_computeLabelFontSize(e){return e*.8}getPosition(){if(!this._visible||!this._editor.hasModel()||!this._editor.getDomNode())return null;const e=Ip(this.getDomNode().ownerDocument.body),t=yo(this._editor.getDomNode()),i=this._getTopForPosition();this._nPxAvailableAbove=i+t.top,this._nPxAvailableBelow=e.height-this._nPxAvailableAbove;const n=this._editor.getOption(67),{totalHeight:s}=rp.getLayoutInfo({lineHeight:n}),r=this._nPxAvailableBelow>s*6?[2,1]:[1,2];return{position:this._position,preference:r}}beforeRender(){var i,n;const[e,t]=this._acceptKeybindings;return this._label.innerText=S({key:"label",comment:['placeholders are keybindings, e.g "F2 to Rename, Shift+F2 to Preview"']},"{0} to Rename, {1} to Preview",(i=this._keybindingService.lookupKeybinding(e))==null?void 0:i.getLabel(),(n=this._keybindingService.lookupKeybinding(t))==null?void 0:n.getLabel()),this._domNode.style.minWidth="200px",null}afterRender(e){if(e===null){this.cancelInput(!0,"afterRender (because position is null)");return}if(!this._editor.hasModel()||!this._editor.getDomNode())return;Pn(this._renameCandidateListView),Pn(this._nPxAvailableAbove!==void 0),Pn(this._nPxAvailableBelow!==void 0);const t=Vh(this._inputWithButton.domNode),i=Vh(this._label);let n;e===2?n=this._nPxAvailableBelow:n=this._nPxAvailableAbove,this._renameCandidateListView.layout({height:n-i-t,width:yr(this._inputWithButton.domNode)})}acceptInput(e){var t;this._trace("invoking acceptInput"),(t=this._currentAcceptInput)==null||t.call(this,e)}cancelInput(e,t){var i;(i=this._currentCancelInput)==null||i.call(this,e)}focusNextRenameSuggestion(){var e;(e=this._renameCandidateListView)!=null&&e.focusNext()||(this._inputWithButton.input.value=this._currentName)}focusPreviousRenameSuggestion(){var e;(e=this._renameCandidateListView)!=null&&e.focusPrevious()||(this._inputWithButton.input.value=this._currentName)}getInput(e,t,i,n,s){const{start:r,end:a}=this._getSelection(e,t);this._renameCts=s;const d=new Tt;this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,n===void 0?this._inputWithButton.button.style.display="none":(this._inputWithButton.button.style.display="flex",this._requestRenameCandidatesOnce=n,this._requestRenameCandidates(t,!1),d.add(Bn(this._inputWithButton.button,"click",()=>this._requestRenameCandidates(t,!0))),d.add(Bn(this._inputWithButton.button,as.KEY_DOWN,f=>{const g=new e9(f);(g.equals(3)||g.equals(10))&&(g.stopPropagation(),g.preventDefault(),this._requestRenameCandidates(t,!0))}))),this._isEditingRenameCandidate=!1,this._domNode.classList.toggle("preview",i),this._position=new Bi(e.startLineNumber,e.startColumn),this._currentName=t,this._inputWithButton.input.value=t,this._inputWithButton.input.setAttribute("selectionStart",r.toString()),this._inputWithButton.input.setAttribute("selectionEnd",a.toString()),this._inputWithButton.input.size=Math.max((e.endColumn-e.startColumn)*1.1,20),this._beforeFirstInputFieldEditSW.reset(),d.add(is(()=>{this._renameCts=void 0,s.dispose(!0)})),d.add(is(()=>{this._renameCandidateProvidersCts!==void 0&&(this._renameCandidateProvidersCts.dispose(!0),this._renameCandidateProvidersCts=void 0)})),d.add(is(()=>this._candidates.clear()));const u=new z_;return u.p.finally(()=>{d.dispose(),this._hide()}),this._currentCancelInput=f=>{var g;return this._trace("invoking _currentCancelInput"),this._currentAcceptInput=void 0,this._currentCancelInput=void 0,(g=this._renameCandidateListView)==null||g.clearCandidates(),u.complete(f),!0},this._currentAcceptInput=f=>{this._trace("invoking _currentAcceptInput"),Pn(this._renameCandidateListView!==void 0);const g=this._renameCandidateListView.nCandidates;let p,C;const b=this._renameCandidateListView.focusedCandidate;if(b!==void 0?(this._trace("using new name from renameSuggestion"),p=b,C={k:"renameSuggestion"}):(this._trace("using new name from inputField"),p=this._inputWithButton.input.value,C=this._isEditingRenameCandidate?{k:"userEditedRenameSuggestion"}:{k:"inputField"}),p===t||p.trim().length===0){this.cancelInput(!0,"_currentAcceptInput (because newName === value || newName.trim().length === 0)");return}this._currentAcceptInput=void 0,this._currentCancelInput=void 0,this._renameCandidateListView.clearCandidates(),u.complete({newName:p,wantsPreview:i&&f,stats:{source:C,nRenameSuggestions:g,timeBeforeFirstInputFieldEdit:this._timeBeforeFirstInputFieldEdit,nRenameSuggestionsInvocations:this._nRenameSuggestionsInvocations,hadAutomaticRenameSuggestionsInvocation:this._hadAutomaticRenameSuggestionsInvocation}})},d.add(s.token.onCancellationRequested(()=>this.cancelInput(!0,"cts.token.onCancellationRequested"))),d.add(this._editor.onDidBlurEditorWidget(()=>{var f;return this.cancelInput(!((f=this._domNode)!=null&&f.ownerDocument.hasFocus()),"editor.onDidBlurEditorWidget")})),this._show(),u.p}_requestRenameCandidates(e,t){if(this._requestRenameCandidatesOnce!==void 0&&(this._renameCandidateProvidersCts!==void 0&&this._renameCandidateProvidersCts.dispose(!0),Pn(this._renameCts),this._inputWithButton.buttonState!=="stop")){this._renameCandidateProvidersCts=new Gs;const i=t?d1.Invoke:d1.Automatic,n=this._requestRenameCandidatesOnce(i,this._renameCandidateProvidersCts.token);if(n.length===0){this._inputWithButton.setSparkleButton();return}t||(this._hadAutomaticRenameSuggestionsInvocation=!0),this._nRenameSuggestionsInvocations+=1,this._inputWithButton.setStopButton(),this._updateRenameCandidates(n,e,this._renameCts.token)}}_getSelection(e,t){Pn(this._editor.hasModel());const i=this._editor.getSelection();let n=0,s=t.length;return!Q.isEmpty(i)&&!Q.spansMultipleLines(i)&&Q.containsRange(e,i)&&(n=Math.max(0,i.startColumn-e.startColumn),s=Math.min(e.endColumn,i.endColumn)-e.startColumn),{start:n,end:s}}_show(){this._trace("invoking _show"),this._editor.revealLineInCenterIfOutsideViewport(this._position.lineNumber,0),this._visible=!0,this._visibleContextKey.set(!0),this._editor.layoutContentWidget(this),setTimeout(()=>{this._inputWithButton.input.focus(),this._inputWithButton.input.setSelectionRange(parseInt(this._inputWithButton.input.getAttribute("selectionStart")),parseInt(this._inputWithButton.input.getAttribute("selectionEnd")))},100)}async _updateRenameCandidates(e,t,i){const n=(...u)=>this._trace("_updateRenameCandidates",...u);n("start");const s=await Sp(Promise.allSettled(e),i);if(this._inputWithButton.setSparkleButton(),s===void 0){n("returning early - received updateRenameCandidates results - undefined");return}const r=s.flatMap(u=>u.status==="fulfilled"&&Yx(u.value)?u.value:[]);n(`received updateRenameCandidates results - total (unfiltered) ${r.length} candidates.`);const a=aA(r,u=>u.newSymbolName);n(`distinct candidates - ${a.length} candidates.`);const d=a.filter(({newSymbolName:u})=>u.trim().length>0&&u!==this._inputWithButton.input.value&&u!==t&&!this._candidates.has(u));if(n(`valid distinct candidates - ${r.length} candidates.`),d.forEach(u=>this._candidates.add(u.newSymbolName)),d.length<1){n("returning early - no valid distinct candidates");return}n("setting candidates"),this._renameCandidateListView.setCandidates(d),n("asking editor to re-layout"),this._editor.layoutContentWidget(this)}_hide(){this._trace("invoked _hide"),this._visible=!1,this._visibleContextKey.reset(),this._editor.layoutContentWidget(this)}_getTopForPosition(){const e=this._editor.getVisibleRanges();let t;return e.length>0?t=e[0].startLineNumber:(this._logService.warn("RenameWidget#_getTopForPosition: this should not happen - visibleRanges is empty"),t=Math.max(1,this._position.lineNumber-5)),this._editor.getTopForLineNumber(this._position.lineNumber)-this._editor.getTopForLineNumber(t)}_trace(...e){this._logService.trace("RenameWidget",...e)}};Ry=BV([zx(2,Wr),zx(3,As),zx(4,Fn),zx(5,Yu)],Ry);class J9{constructor(e,t){this._disposables=new Tt,this._availableHeight=0,this._minimumWidth=0,this._lineHeight=t.fontInfo.lineHeight,this._typicalHalfwidthCharacterWidth=t.fontInfo.typicalHalfwidthCharacterWidth,this._listContainer=document.createElement("div"),this._listContainer.className="rename-box rename-candidate-list-container",e.appendChild(this._listContainer),this._listWidget=J9._createListWidget(this._listContainer,this._candidateViewHeight,t.fontInfo),this._listWidget.onDidChangeFocus(i=>{i.elements.length===1&&t.onFocusChange(i.elements[0].newSymbolName)},this._disposables),this._listWidget.onDidChangeSelection(i=>{i.elements.length===1&&t.onSelectionChange()},this._disposables),this._disposables.add(this._listWidget.onDidBlur(i=>{this._listWidget.setFocus([])})),this._listWidget.style(rk({listInactiveFocusForeground:nk,listInactiveFocusBackground:sk}))}dispose(){this._listWidget.dispose(),this._disposables.dispose()}layout({height:e,width:t}){this._availableHeight=e,this._minimumWidth=t}setCandidates(e){this._listWidget.splice(0,0,e);const t=this._pickListHeight(this._listWidget.length),i=this._pickListWidth(e);this._listWidget.layout(t,i),this._listContainer.style.height=`${t}px`,this._listContainer.style.width=`${i}px`,P0(S("renameSuggestionsReceivedAria","Received {0} rename suggestions",e.length))}clearCandidates(){this._listContainer.style.height="0px",this._listContainer.style.width="0px",this._listWidget.splice(0,this._listWidget.length,[])}get nCandidates(){return this._listWidget.length}get focusedCandidate(){if(this._listWidget.length===0)return;const e=this._listWidget.getSelectedElements()[0];if(e!==void 0)return e.newSymbolName;const t=this._listWidget.getFocusedElements()[0];if(t!==void 0)return t.newSymbolName}focusNext(){if(this._listWidget.length===0)return!1;const e=this._listWidget.getFocus();if(e.length===0)return this._listWidget.focusFirst(),this._listWidget.reveal(0),!0;if(e[0]===this._listWidget.length-1)return this._listWidget.setFocus([]),this._listWidget.reveal(0),!1;{this._listWidget.focusNext();const t=this._listWidget.getFocus()[0];return this._listWidget.reveal(t),!0}}focusPrevious(){if(this._listWidget.length===0)return!1;const e=this._listWidget.getFocus();if(e.length===0){this._listWidget.focusLast();const t=this._listWidget.getFocus()[0];return this._listWidget.reveal(t),!0}else{if(e[0]===0)return this._listWidget.setFocus([]),!1;{this._listWidget.focusPrevious();const t=this._listWidget.getFocus()[0];return this._listWidget.reveal(t),!0}}}clearFocus(){this._listWidget.setFocus([])}get _candidateViewHeight(){const{totalHeight:e}=rp.getLayoutInfo({lineHeight:this._lineHeight});return e}_pickListHeight(e){const t=this._candidateViewHeight*e;return Math.min(t,this._availableHeight,this._candidateViewHeight*7)}_pickListWidth(e){const t=Math.ceil(Math.max(...e.map(n=>n.newSymbolName.length))*this._typicalHalfwidthCharacterWidth);return Math.max(this._minimumWidth,25+t+10)}static _createListWidget(e,t,i){const n=new class{getTemplateId(r){return"candidate"}getHeight(r){return t}},s=new class{constructor(){this.templateId="candidate"}renderTemplate(r){return new rp(r,i)}renderElement(r,a,d){d.populate(r)}disposeTemplate(r){r.dispose()}};return new Tw("NewSymbolNameCandidates",e,n,[s],{keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!1})}}class FV{constructor(){this._onDidInputChange=new rn,this.onDidInputChange=this._onDidInputChange.event,this._disposables=new Tt}get domNode(){return this._domNode||(this._domNode=document.createElement("div"),this._domNode.className="rename-input-with-button",this._domNode.style.display="flex",this._domNode.style.flexDirection="row",this._domNode.style.alignItems="center",this._inputNode=document.createElement("input"),this._inputNode.className="rename-input",this._inputNode.type="text",this._inputNode.style.border="none",this._inputNode.setAttribute("aria-label",S("renameAriaLabel","Rename input. Type new name and press Enter to commit.")),this._domNode.appendChild(this._inputNode),this._buttonNode=document.createElement("div"),this._buttonNode.className="rename-suggestions-button",this._buttonNode.setAttribute("tabindex","0"),this._buttonGenHoverText=S("generateRenameSuggestionsButton","Generate new name suggestions"),this._buttonCancelHoverText=S("cancelRenameSuggestionsButton","Cancel"),this._buttonHover=WL().setupManagedHover(Y_("element"),this._buttonNode,this._buttonGenHoverText),this._disposables.add(this._buttonHover),this._domNode.appendChild(this._buttonNode),this._disposables.add(Bn(this.input,as.INPUT,()=>this._onDidInputChange.fire())),this._disposables.add(Bn(this.input,as.KEY_DOWN,e=>{const t=new e9(e);(t.keyCode===15||t.keyCode===17)&&this._onDidInputChange.fire()})),this._disposables.add(Bn(this.input,as.CLICK,()=>this._onDidInputChange.fire())),this._disposables.add(Bn(this.input,as.FOCUS,()=>{this.domNode.style.outlineWidth="1px",this.domNode.style.outlineStyle="solid",this.domNode.style.outlineOffset="-1px",this.domNode.style.outlineColor="var(--vscode-focusBorder)"})),this._disposables.add(Bn(this.input,as.BLUR,()=>{this.domNode.style.outline="none"}))),this._domNode}get input(){return Pn(this._inputNode),this._inputNode}get button(){return Pn(this._buttonNode),this._buttonNode}get buttonState(){return this._buttonState}setSparkleButton(){var e;this._buttonState="sparkle",this._sparkleIcon??(this._sparkleIcon=u1(Ki.sparkle)),Wa(this.button),this.button.appendChild(this._sparkleIcon),this.button.setAttribute("aria-label","Generating new name suggestions"),(e=this._buttonHover)==null||e.update(this._buttonGenHoverText),this.input.focus()}setStopButton(){var e;this._buttonState="stop",this._stopIcon??(this._stopIcon=u1(Ki.primitiveSquare)),Wa(this.button),this.button.appendChild(this._stopIcon),this.button.setAttribute("aria-label","Cancel generating new name suggestions"),(e=this._buttonHover)==null||e.update(this._buttonCancelHoverText),this.input.focus()}dispose(){this._disposables.dispose()}}const Ag=class Ag{constructor(e,t){this._domNode=document.createElement("div"),this._domNode.className="rename-box rename-candidate",this._domNode.style.display="flex",this._domNode.style.columnGap="5px",this._domNode.style.alignItems="center",this._domNode.style.height=`${t.lineHeight}px`,this._domNode.style.padding=`${Ag._PADDING}px`;const i=document.createElement("div");i.style.display="flex",i.style.alignItems="center",i.style.width=i.style.height=`${t.lineHeight*.8}px`,this._domNode.appendChild(i),this._icon=u1(Ki.sparkle),this._icon.style.display="none",i.appendChild(this._icon),this._label=document.createElement("div"),GA(this._label,t),this._domNode.appendChild(this._label),e.appendChild(this._domNode)}populate(e){this._updateIcon(e),this._updateLabel(e)}_updateIcon(e){var i;const t=!!((i=e.tags)!=null&&i.includes(zL.AIGenerated));this._icon.style.display=t?"inherit":"none"}_updateLabel(e){this._label.innerText=e.newSymbolName}static getLayoutInfo({lineHeight:e}){return{totalHeight:e+Ag._PADDING*2}}dispose(){}};Ag._PADDING=2;let rp=Ag;var LV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Yl=function(o,e){return function(t,i){e(t,i,o)}},Ny;class eS{constructor(e,t,i){this.model=e,this.position=t,this._providerRenameIdx=0,this._providers=i.ordered(e)}hasProvider(){return this._providers.length>0}async resolveRenameLocation(e){const t=[];for(this._providerRenameIdx=0;this._providerRenameIdx<this._providers.length;this._providerRenameIdx++){const n=this._providers[this._providerRenameIdx];if(!n.resolveRenameLocation)break;const s=await n.resolveRenameLocation(this.model,this.position,e);if(s){if(s.rejectReason){t.push(s.rejectReason);continue}return s}}this._providerRenameIdx=0;const i=this.model.getWordAtPosition(this.position);return i?{range:new Q(this.position.lineNumber,i.startColumn,this.position.lineNumber,i.endColumn),text:i.word,rejectReason:t.length>0?t.join(`
76
+ `):void 0}:{range:Q.fromPositions(this.position),text:"",rejectReason:t.length>0?t.join(`
77
+ `):void 0}}async provideRenameEdits(e,t){return this._provideRenameEdits(e,this._providerRenameIdx,[],t)}async _provideRenameEdits(e,t,i,n){const s=this._providers[t];if(!s)return{edits:[],rejectReason:i.join(`
78
+ `)};const r=await s.provideRenameEdits(this.model,this.position,e,n);if(r){if(r.rejectReason)return this._provideRenameEdits(e,t+1,i.concat(r.rejectReason),n)}else return this._provideRenameEdits(e,t+1,i.concat(S("no result","No result.")),n);return r}}async function IV(o,e,t,i){const n=new eS(e,t,o),s=await n.resolveRenameLocation(an.None);return s!=null&&s.rejectReason?{edits:[],rejectReason:s.rejectReason}:n.provideRenameEdits(i,an.None)}var Eu;let $c=(Eu=class{static get(e){return e.getContribution(Ny.ID)}constructor(e,t,i,n,s,r,a,d,u){this.editor=e,this._instaService=t,this._notificationService=i,this._bulkEditService=n,this._progressService=s,this._logService=r,this._configService=a,this._languageFeaturesService=d,this._telemetryService=u,this._disposableStore=new Tt,this._cts=new Gs,this._renameWidget=this._disposableStore.add(this._instaService.createInstance(Ry,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}async run(){var b,y;const e=this._logService.trace.bind(this._logService,"[rename]");if(this._cts.dispose(!0),this._cts=new Gs,!this.editor.hasModel()){e("editor has no model");return}const t=this.editor.getPosition(),i=new eS(this.editor.getModel(),t,this._languageFeaturesService.renameProvider);if(!i.hasProvider()){e("skeleton has no provider");return}const n=new L0(this.editor,5,void 0,this._cts.token);let s;try{e("resolving rename location");const w=i.resolveRenameLocation(n.token);this._progressService.showWhile(w,250),s=await w,e("resolved rename location")}catch(w){w instanceof V_?e("resolve rename location cancelled",JSON.stringify(w,null," ")):(e("resolve rename location failed",w instanceof Error?w:JSON.stringify(w,null," ")),(typeof w=="string"||Zx(w))&&((b=Mo.get(this.editor))==null||b.showMessage(w||S("resolveRenameLocationFailed","An unknown error occurred while resolving rename location"),t)));return}finally{n.dispose()}if(!s){e("returning early - no loc");return}if(s.rejectReason){e(`returning early - rejected with reason: ${s.rejectReason}`,s.rejectReason),(y=Mo.get(this.editor))==null||y.showMessage(s.rejectReason,t);return}if(n.token.isCancellationRequested){e("returning early - cts1 cancelled");return}const r=new L0(this.editor,5,s.range,this._cts.token),a=this.editor.getModel(),d=this._languageFeaturesService.newSymbolNamesProvider.all(a),u=await Promise.all(d.map(async w=>[w,await w.supportsAutomaticNewSymbolNamesTriggerKind??!1])),f=(w,A)=>{let I=u.slice();return w===d1.Automatic&&(I=I.filter(([T,R])=>R)),I.map(([T])=>T.provideNewSymbolNames(a,s.range,w,A))};e("creating rename input field and awaiting its result");const g=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),p=await this._renameWidget.getInput(s.range,s.text,g,d.length>0?f:void 0,r);if(e("received response from rename input field"),d.length>0&&this._reportTelemetry(d.length,a.getLanguageId(),p),typeof p=="boolean"){e(`returning early - rename input field response - ${p}`),p&&this.editor.focus(),r.dispose();return}this.editor.focus(),e("requesting rename edits");const C=Sp(i.provideRenameEdits(p.newName,r.token),r.token).then(async w=>{if(!w){e("returning early - no rename edits result");return}if(!this.editor.hasModel()){e("returning early - no model after rename edits are provided");return}if(w.rejectReason){e(`returning early - rejected with reason: ${w.rejectReason}`),this._notificationService.info(w.rejectReason);return}this.editor.setSelection(Q.fromPositions(this.editor.getSelection().getPosition())),e("applying edits"),this._bulkEditService.apply(w,{editor:this.editor,showPreview:p.wantsPreview,label:S("label","Renaming '{0}' to '{1}'",s==null?void 0:s.text,p.newName),code:"undoredo.rename",quotableLabel:S("quotableLabel","Renaming {0} to {1}",s==null?void 0:s.text,p.newName),respectAutoSaveConfig:!0}).then(A=>{e("edits applied"),A.ariaSummary&&Nr(S("aria","Successfully renamed '{0}' to '{1}'. Summary: {2}",s.text,p.newName,A.ariaSummary))}).catch(A=>{e(`error when applying edits ${JSON.stringify(A,null," ")}`),this._notificationService.error(S("rename.failedApply","Rename failed to apply edits")),this._logService.error(A)})},w=>{e("error when providing rename edits",JSON.stringify(w,null," ")),this._notificationService.error(S("rename.failed","Rename failed to compute edits")),this._logService.error(w)}).finally(()=>{r.dispose()});return e("returning rename operation"),this._progressService.showWhile(C,250),C}acceptRenameInput(e){this._renameWidget.acceptInput(e)}cancelRenameInput(){this._renameWidget.cancelInput(!0,"cancelRenameInput command")}focusNextRenameSuggestion(){this._renameWidget.focusNextRenameSuggestion()}focusPreviousRenameSuggestion(){this._renameWidget.focusPreviousRenameSuggestion()}_reportTelemetry(e,t,i){const n=typeof i=="boolean"?{kind:"cancelled",languageId:t,nRenameSuggestionProviders:e}:{kind:"accepted",languageId:t,nRenameSuggestionProviders:e,source:i.stats.source.k,nRenameSuggestions:i.stats.nRenameSuggestions,timeBeforeFirstInputFieldEdit:i.stats.timeBeforeFirstInputFieldEdit,wantsPreview:i.wantsPreview,nRenameSuggestionsInvocations:i.stats.nRenameSuggestionsInvocations,hadAutomaticRenameSuggestionsInvocation:i.stats.hadAutomaticRenameSuggestionsInvocation};this._telemetryService.publicLog2("renameInvokedEvent",n)}},Ny=Eu,Eu.ID="editor.contrib.renameController",Eu);$c=Ny=LV([Yl(1,sn),Yl(2,mo),Yl(3,H_),Yl(4,Ap),Yl(5,Yu),Yl(6,VL),Yl(7,Fi),Yl(8,ua)],$c);class PV extends Ct{constructor(){super({id:"editor.action.rename",label:S("rename.label","Rename Symbol"),alias:"Rename Symbol",precondition:qe.and(q.writable,q.hasRenameProvider),kbOpts:{kbExpr:q.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(e,t){const i=e.get(Cs),[n,s]=Array.isArray(t)&&t||[void 0,void 0];return jn.isUri(n)&&Bi.isIPosition(s)?i.openCodeEditor({resource:n},i.getActiveCodeEditor()).then(r=>{r&&(r.setPosition(s),r.invokeWithinContext(a=>(this.reportTelemetry(a,r),this.run(a,r))))},qn):super.runCommand(e,t)}run(e,t){const i=e.get(Yu),n=$c.get(t);return n?(i.trace("[RenameAction] got controller, running..."),n.run()):(i.trace("[RenameAction] returning early - controller missing"),Promise.resolve())}}hn($c.ID,$c,4);Le(PV);const tS=Ao.bindToContribution($c.get);Ti(new tS({id:"acceptRenameInput",precondition:_f,handler:o=>o.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:qe.and(q.focus,qe.not("isComposing")),primary:3}}));Ti(new tS({id:"acceptRenameInputWithPreview",precondition:qe.and(_f,qe.has("config.editor.rename.enablePreview")),handler:o=>o.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:qe.and(q.focus,qe.not("isComposing")),primary:2051}}));Ti(new tS({id:"cancelRenameInput",precondition:_f,handler:o=>o.cancelRenameInput(),kbOpts:{weight:199,kbExpr:q.focus,primary:9,secondary:[1033]}}));Vn(class extends Do{constructor(){super({id:"focusNextRenameSuggestion",title:{...Ai("focusNextRenameSuggestion","Focus Next Rename Suggestion")},precondition:_f,keybinding:[{primary:18,weight:199}]})}run(e){const t=e.get(Cs).getFocusedCodeEditor();if(!t)return;const i=$c.get(t);i&&i.focusNextRenameSuggestion()}});Vn(class extends Do{constructor(){super({id:"focusPreviousRenameSuggestion",title:{...Ai("focusPreviousRenameSuggestion","Focus Previous Rename Suggestion")},precondition:_f,keybinding:[{primary:16,weight:199}]})}run(e){const t=e.get(Cs).getFocusedCodeEditor();if(!t)return;const i=$c.get(t);i&&i.focusPreviousRenameSuggestion()}});ko("_executeDocumentRenameProvider",function(o,e,t,...i){const[n]=i;Pn(typeof n=="string");const{renameProvider:s}=o.get(Fi);return IV(s,e,t,n)});ko("_executePrepareRename",async function(o,e,t){const{renameProvider:i}=o.get(Fi),s=await new eS(e,t,i).resolveRenameLocation(an.None);if(s!=null&&s.rejectReason)throw new Error(s.rejectReason);return s});ca.as(kp.Configuration).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:5,description:S("enablePreview","Enable/disable the ability to preview changes before renaming"),default:!0,type:"boolean"}}});var TV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},$D=function(o,e){return function(t,i){e(t,i,o)}},D0;let Fv=(D0=class extends Rt{constructor(e,t,i){super(),this.editor=e,this.languageConfigurationService=t,this.editorWorkerService=i,this.decorations=this.editor.createDecorationsCollection(),this.options=this.createOptions(e.getOption(73)),this.computePromise=null,this.currentOccurrences={},this._register(e.onDidChangeModel(n=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(73)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(e.onDidChangeModelLanguage(n=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(73)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(t.onDidChange(n=>{var r;const s=(r=this.editor.getModel())==null?void 0:r.getLanguageId();s&&n.affects(s)&&(this.currentOccurrences={},this.options=this.createOptions(e.getOption(73)),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(e.onDidChangeConfiguration(n=>{this.options&&!n.hasChanged(73)||(this.options=this.createOptions(e.getOption(73)),this.updateDecorations([]),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(this.editor.onDidChangeModelContent(n=>{this.computeSectionHeaders.schedule()})),this._register(e.onDidChangeModelTokens(n=>{this.computeSectionHeaders.isScheduled()||this.computeSectionHeaders.schedule(1e3)})),this.computeSectionHeaders=this._register(new Ms(()=>{this.findSectionHeaders()},250)),this.computeSectionHeaders.schedule(0)}createOptions(e){if(!e||!this.editor.hasModel())return;const t=this.editor.getModel().getLanguageId();if(!t)return;const i=this.languageConfigurationService.getLanguageConfiguration(t).comments,n=this.languageConfigurationService.getLanguageConfiguration(t).foldingRules;if(!(!i&&!(n!=null&&n.markers)))return{foldingRules:n,findMarkSectionHeaders:e.showMarkSectionHeaders,findRegionSectionHeaders:e.showRegionSectionHeaders}}findSectionHeaders(){var i,n;if(!this.editor.hasModel()||!((i=this.options)!=null&&i.findMarkSectionHeaders)&&!((n=this.options)!=null&&n.findRegionSectionHeaders))return;const e=this.editor.getModel();if(e.isDisposed()||e.isTooLargeForSyncing())return;const t=e.getVersionId();this.editorWorkerService.findSectionHeaders(e.uri,this.options).then(s=>{e.isDisposed()||e.getVersionId()!==t||this.updateDecorations(s)})}updateDecorations(e){const t=this.editor.getModel();t&&(e=e.filter(s=>{if(!s.shouldBeInComments)return!0;const r=t.validateRange(s.range),a=t.tokenization.getLineTokens(r.startLineNumber),d=a.findTokenIndexAtOffset(r.startColumn-1),u=a.getStandardTokenType(d);return a.getLanguageId(d)===t.getLanguageId()&&u===1}));const i=Object.values(this.currentOccurrences).map(s=>s.decorationId),n=e.map(s=>MV(s));this.editor.changeDecorations(s=>{const r=s.deltaDecorations(i,n);this.currentOccurrences={};for(let a=0,d=r.length;a<d;a++){const u={sectionHeader:e[a],decorationId:r[a]};this.currentOccurrences[u.decorationId]=u}})}stop(){this.computeSectionHeaders.cancel(),this.computePromise&&(this.computePromise.cancel(),this.computePromise=null)}dispose(){super.dispose(),this.stop(),this.decorations.clear()}},D0.ID="editor.sectionHeaderDetector",D0);Fv=TV([$D(1,js),$D(2,Nl)],Fv);function MV(o){return{range:o.range,options:vn.createDynamic({description:"section-header",stickiness:3,collapseOnReplaceEdit:!0,minimap:{color:void 0,position:1,sectionHeaderStyle:o.hasSeparatorLine?2:1,sectionHeaderText:o.text}})}}hn(Fv.ID,Fv,1);function RV(o){for(let e=0,t=o.length;e<t;e+=4){const i=o[e+0],n=o[e+1],s=o[e+2],r=o[e+3];o[e+0]=r,o[e+1]=s,o[e+2]=n,o[e+3]=i}}function NV(o){const e=new Uint8Array(o.buffer,o.byteOffset,o.length*4);return jL()||RV(e),$L.wrap(e)}function WB(o){const e=new Uint32Array(OV(o));let t=0;if(e[t++]=o.id,o.type==="full")e[t++]=1,e[t++]=o.data.length,e.set(o.data,t),t+=o.data.length;else{e[t++]=2,e[t++]=o.deltas.length;for(const i of o.deltas)e[t++]=i.start,e[t++]=i.deleteCount,i.data?(e[t++]=i.data.length,e.set(i.data,t),t+=i.data.length):e[t++]=0}return NV(e)}function OV(o){let e=0;if(e+=2,o.type==="full")e+=1+o.data.length;else{e+=1,e+=3*o.deltas.length;for(const t of o.deltas)t.data&&(e+=t.data.length)}return e}function kb(o){return o&&!!o.data}function zB(o){return o&&Array.isArray(o.edits)}class HV{constructor(e,t,i){this.provider=e,this.tokens=t,this.error=i}}function VB(o,e){return o.has(e)}function WV(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:[]}async function jB(o,e,t,i,n){const s=WV(o,e),r=await Promise.all(s.map(async a=>{let d,u=null;try{d=await a.provideDocumentSemanticTokens(e,a===t?i:null,n)}catch(f){u=f,d=null}return(!d||!kb(d)&&!zB(d))&&(d=null),new HV(a,d,u)}));for(const a of r){if(a.error)throw a.error;if(a.tokens)return a}return r.length>0?r[0]:null}function zV(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:null}class VV{constructor(e,t){this.provider=e,this.tokens=t}}function jV(o,e){return o.has(e)}function $B(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:[]}async function iS(o,e,t,i){const n=$B(o,e),s=await Promise.all(n.map(async r=>{let a;try{a=await r.provideDocumentRangeSemanticTokens(e,t,i)}catch(d){bs(d),a=null}return(!a||!kb(a))&&(a=null),new VV(r,a)}));for(const r of s)if(r.tokens)return r;return s.length>0?s[0]:null}Qn.registerCommand("_provideDocumentSemanticTokensLegend",async(o,...e)=>{const[t]=e;Pn(t instanceof jn);const i=o.get(vo).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=o.get(Fi),s=zV(n,i);return s?s[0].getLegend():o.get(Vs).executeCommand("_provideDocumentRangeSemanticTokensLegend",t)});Qn.registerCommand("_provideDocumentSemanticTokens",async(o,...e)=>{const[t]=e;Pn(t instanceof jn);const i=o.get(vo).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=o.get(Fi);if(!VB(n,i))return o.get(Vs).executeCommand("_provideDocumentRangeSemanticTokens",t,i.getFullModelRange());const s=await jB(n,i,null,null,an.None);if(!s)return;const{provider:r,tokens:a}=s;if(!a||!kb(a))return;const d=WB({id:0,type:"full",data:a.data});return a.resultId&&r.releaseDocumentSemanticTokens(a.resultId),d});Qn.registerCommand("_provideDocumentRangeSemanticTokensLegend",async(o,...e)=>{const[t,i]=e;Pn(t instanceof jn);const n=o.get(vo).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=o.get(Fi),r=$B(s,n);if(r.length===0)return;if(r.length===1)return r[0].getLegend();if(!i||!Q.isIRange(i))return console.warn("provideDocumentRangeSemanticTokensLegend might be out-of-sync with provideDocumentRangeSemanticTokens unless a range argument is passed in"),r[0].getLegend();const a=await iS(s,n,Q.lift(i),an.None);if(a)return a.provider.getLegend()});Qn.registerCommand("_provideDocumentRangeSemanticTokens",async(o,...e)=>{const[t,i]=e;Pn(t instanceof jn),Pn(Q.isIRange(i));const n=o.get(vo).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=o.get(Fi),r=await iS(s,n,Q.lift(i),an.None);if(!(!r||!r.tokens))return WB({id:0,type:"full",data:r.tokens.data})});const nS="editor.semanticHighlighting";function xm(o,e,t){var n;const i=(n=t.getValue(nS,{overrideIdentifier:o.getLanguageId(),resource:o.uri}))==null?void 0:n.enabled;return typeof i=="boolean"?i:e.getColorTheme().semanticHighlighting}var UB=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},La=function(o,e){return function(t,i){e(t,i,o)}},ec;let Oy=class extends Rt{constructor(e,t,i,n,s,r){super(),this._watchers=Object.create(null);const a=f=>{this._watchers[f.uri.toString()]=new Hy(f,e,i,s,r)},d=(f,g)=>{g.dispose(),delete this._watchers[f.uri.toString()]},u=()=>{for(const f of t.getModels()){const g=this._watchers[f.uri.toString()];xm(f,i,n)?g||a(f):g&&d(f,g)}};t.getModels().forEach(f=>{xm(f,i,n)&&a(f)}),this._register(t.onModelAdded(f=>{xm(f,i,n)&&a(f)})),this._register(t.onModelRemoved(f=>{const g=this._watchers[f.uri.toString()];g&&d(f,g)})),this._register(n.onDidChangeConfiguration(f=>{f.affectsConfiguration(nS)&&u()})),this._register(i.onDidColorThemeChange(u))}dispose(){for(const e of Object.values(this._watchers))e.dispose();super.dispose()}};Oy=UB([La(0,t9),La(1,vo),La(2,Wr),La(3,ss),La(4,gr),La(5,Fi)],Oy);var Mc;let Hy=(Mc=class extends Rt{constructor(e,t,i,n,s){super(),this._semanticTokensStylingService=t,this._isDisposed=!1,this._model=e,this._provider=s.documentSemanticTokensProvider,this._debounceInformation=n.for(this._provider,"DocumentSemanticTokens",{min:ec.REQUEST_MIN_DELAY,max:ec.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new Ms(()=>this._fetchDocumentSemanticTokensNow(),ec.REQUEST_MIN_DELAY)),this._currentDocumentResponse=null,this._currentDocumentRequestCancellationTokenSource=null,this._documentProvidersChangeListeners=[],this._providersChangedDuringRequest=!1,this._register(this._model.onDidChangeContent(()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(this._model.onDidChangeAttached(()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(this._model.onDidChangeLanguage(()=>{this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(0)}));const r=()=>{uo(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[];for(const a of this._provider.all(e))typeof a.onDidChange=="function"&&this._documentProvidersChangeListeners.push(a.onDidChange(()=>{if(this._currentDocumentRequestCancellationTokenSource){this._providersChangedDuringRequest=!0;return}this._fetchDocumentSemanticTokens.schedule(0)}))};r(),this._register(this._provider.onDidChange(()=>{r(),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(i.onDidColorThemeChange(a=>{this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._fetchDocumentSemanticTokens.schedule(0)}dispose(){this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),uo(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[],this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!VB(this._provider,this._model)){this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1);return}if(!this._model.isAttachedToEditor())return;const e=new Gs,t=this._currentDocumentResponse?this._currentDocumentResponse.provider:null,i=this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,n=jB(this._provider,this._model,t,i,e.token);this._currentDocumentRequestCancellationTokenSource=e,this._providersChangedDuringRequest=!1;const s=[],r=this._model.onDidChangeContent(d=>{s.push(d)}),a=new Oo(!1);n.then(d=>{if(this._debounceInformation.update(this._model,a.elapsed()),this._currentDocumentRequestCancellationTokenSource=null,r.dispose(),!d)this._setDocumentSemanticTokens(null,null,null,s);else{const{provider:u,tokens:f}=d,g=this._semanticTokensStylingService.getStyling(u);this._setDocumentSemanticTokens(u,f||null,g,s)}},d=>{d&&(qc(d)||typeof d.message=="string"&&d.message.indexOf("busy")!==-1)||qn(d),this._currentDocumentRequestCancellationTokenSource=null,r.dispose(),(s.length>0||this._providersChangedDuringRequest)&&(this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model)))})}static _copy(e,t,i,n,s){s=Math.min(s,i.length-n,e.length-t);for(let r=0;r<s;r++)i[n+r]=e[t+r]}_setDocumentSemanticTokens(e,t,i,n){const s=this._currentDocumentResponse,r=()=>{(n.length>0||this._providersChangedDuringRequest)&&!this._fetchDocumentSemanticTokens.isScheduled()&&this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))};if(this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._isDisposed){e&&t&&e.releaseDocumentSemanticTokens(t.resultId);return}if(!e||!i){this._model.tokenization.setSemanticTokens(null,!1);return}if(!t){this._model.tokenization.setSemanticTokens(null,!0),r();return}if(zB(t)){if(!s){this._model.tokenization.setSemanticTokens(null,!0);return}if(t.edits.length===0)t={resultId:t.resultId,data:s.data};else{let a=0;for(const p of t.edits)a+=(p.data?p.data.length:0)-p.deleteCount;const d=s.data,u=new Uint32Array(d.length+a);let f=d.length,g=u.length;for(let p=t.edits.length-1;p>=0;p--){const C=t.edits[p];if(C.start>d.length){i.warnInvalidEditStart(s.resultId,t.resultId,p,C.start,d.length),this._model.tokenization.setSemanticTokens(null,!0);return}const b=f-(C.start+C.deleteCount);b>0&&(ec._copy(d,f-b,u,g-b,b),g-=b),C.data&&(ec._copy(C.data,0,u,g-C.data.length,C.data.length),g-=C.data.length),f=C.start}f>0&&ec._copy(d,0,u,0,f),t={resultId:t.resultId,data:u}}}if(kb(t)){this._currentDocumentResponse=new $V(e,t.resultId,t.data);const a=Ck(t,i,this._model.getLanguageId());if(n.length>0)for(const d of n)for(const u of a)for(const f of d.changes)u.applyEdit(f.range,f.text);this._model.tokenization.setSemanticTokens(a,!0)}else this._model.tokenization.setSemanticTokens(null,!0);r()}},ec=Mc,Mc.REQUEST_MIN_DELAY=300,Mc.REQUEST_MAX_DELAY=2e3,Mc);Hy=ec=UB([La(1,t9),La(2,Wr),La(3,gr),La(4,Fi)],Hy);class $V{constructor(e,t,i){this.provider=e,this.resultId=t,this.data=i}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}df(Oy);var UV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},zf=function(o,e){return function(t,i){e(t,i,o)}},A0;let Lv=(A0=class extends Rt{constructor(e,t,i,n,s,r){super(),this._semanticTokensStylingService=t,this._themeService=i,this._configurationService=n,this._editor=e,this._provider=r.documentRangeSemanticTokensProvider,this._debounceInformation=s.for(this._provider,"DocumentRangeSemanticTokens",{min:100,max:500}),this._tokenizeViewport=this._register(new Ms(()=>this._tokenizeViewportNow(),100)),this._outstandingRequests=[];const a=()=>{this._editor.hasModel()&&this._tokenizeViewport.schedule(this._debounceInformation.get(this._editor.getModel()))};this._register(this._editor.onDidScrollChange(()=>{a()})),this._register(this._editor.onDidChangeModel(()=>{this._cancelAll(),a()})),this._register(this._editor.onDidChangeModelContent(d=>{this._cancelAll(),a()})),this._register(this._provider.onDidChange(()=>{this._cancelAll(),a()})),this._register(this._configurationService.onDidChangeConfiguration(d=>{d.affectsConfiguration(nS)&&(this._cancelAll(),a())})),this._register(this._themeService.onDidColorThemeChange(()=>{this._cancelAll(),a()})),a()}_cancelAll(){for(const e of this._outstandingRequests)e.cancel();this._outstandingRequests=[]}_removeOutstandingRequest(e){for(let t=0,i=this._outstandingRequests.length;t<i;t++)if(this._outstandingRequests[t]===e){this._outstandingRequests.splice(t,1);return}}_tokenizeViewportNow(){if(!this._editor.hasModel())return;const e=this._editor.getModel();if(e.tokenization.hasCompleteSemanticTokens())return;if(!xm(e,this._themeService,this._configurationService)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}if(!jV(this._provider,e)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}const t=this._editor.getVisibleRangesPlusViewportAboveBelow();this._outstandingRequests=this._outstandingRequests.concat(t.map(i=>this._requestRange(e,i)))}_requestRange(e,t){const i=e.getVersionId(),n=qs(r=>Promise.resolve(iS(this._provider,e,t,r))),s=new Oo(!1);return n.then(r=>{if(this._debounceInformation.update(e,s.elapsed()),!r||!r.tokens||e.isDisposed()||e.getVersionId()!==i)return;const{provider:a,tokens:d}=r,u=this._semanticTokensStylingService.getStyling(a);e.tokenization.setPartialSemanticTokens(t,Ck(d,u,e.getLanguageId()))}).then(()=>this._removeOutstandingRequest(n),()=>this._removeOutstandingRequest(n)),n}},A0.ID="editor.contrib.viewportSemanticTokens",A0);Lv=UV([zf(1,t9),zf(2,Wr),zf(3,ss),zf(4,gr),zf(5,Fi)],Lv);hn(Lv.ID,Lv,1);class qV{constructor(e=!0){this.selectSubwords=e}provideSelectionRanges(e,t){const i=[];for(const n of t){const s=[];i.push(s),this.selectSubwords&&this._addInWordRanges(s,e,n),this._addWordRanges(s,e,n),this._addWhitespaceLine(s,e,n),s.push({range:e.getFullModelRange()})}return i}_addInWordRanges(e,t,i){const n=t.getWordAtPosition(i);if(!n)return;const{word:s,startColumn:r}=n,a=i.column-r;let d=a,u=a,f=0;for(;d>=0;d--){const g=s.charCodeAt(d);if(d!==a&&(g===95||g===45))break;if(i8(g)&&n8(f))break;f=g}for(d+=1;u<s.length;u++){const g=s.charCodeAt(u);if(n8(g)&&i8(f))break;if(g===95||g===45)break;f=g}d<u&&e.push({range:new Q(i.lineNumber,r+d,i.lineNumber,r+u)})}_addWordRanges(e,t,i){const n=t.getWordAtPosition(i);n&&e.push({range:new Q(i.lineNumber,n.startColumn,i.lineNumber,n.endColumn)})}_addWhitespaceLine(e,t,i){t.getLineLength(i.lineNumber)>0&&t.getLineFirstNonWhitespaceColumn(i.lineNumber)===0&&t.getLineLastNonWhitespaceColumn(i.lineNumber)===0&&e.push({range:new Q(i.lineNumber,1,i.lineNumber,t.getLineMaxColumn(i.lineNumber))})}}var GV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},KV=function(o,e){return function(t,i){e(t,i,o)}},Wy;class sS{constructor(e,t){this.index=e,this.ranges=t}mov(e){const t=this.index+(e?1:-1);if(t<0||t>=this.ranges.length)return this;const i=new sS(t,this.ranges);return i.ranges[t].equalsRange(this.ranges[this.index])?i.mov(e):i}}var yu;let ap=(yu=class{static get(e){return e.getContribution(Wy.ID)}constructor(e,t){this._editor=e,this._languageFeaturesService=t,this._ignoreSelection=!1}dispose(){var e;(e=this._selectionListener)==null||e.dispose()}async run(e){if(!this._editor.hasModel())return;const t=this._editor.getSelections(),i=this._editor.getModel();if(this._state||await GB(this._languageFeaturesService.selectionRangeProvider,i,t.map(s=>s.getPosition()),this._editor.getOption(114),an.None).then(s=>{var r;if(!(!Yo(s)||s.length!==t.length)&&!(!this._editor.hasModel()||!ja(this._editor.getSelections(),t,(a,d)=>a.equalsSelection(d)))){for(let a=0;a<s.length;a++)s[a]=s[a].filter(d=>d.containsPosition(t[a].getStartPosition())&&d.containsPosition(t[a].getEndPosition())),s[a].unshift(t[a]);this._state=s.map(a=>new sS(0,a)),(r=this._selectionListener)==null||r.dispose(),this._selectionListener=this._editor.onDidChangeCursorPosition(()=>{var a;this._ignoreSelection||((a=this._selectionListener)==null||a.dispose(),this._state=void 0)})}}),!this._state)return;this._state=this._state.map(s=>s.mov(e));const n=this._state.map(s=>$i.fromPositions(s.ranges[s.index].getStartPosition(),s.ranges[s.index].getEndPosition()));this._ignoreSelection=!0;try{this._editor.setSelections(n)}finally{this._ignoreSelection=!1}}},Wy=yu,yu.ID="editor.contrib.smartSelectController",yu);ap=Wy=GV([KV(1,Fi)],ap);class qB extends Ct{constructor(e,t){super(t),this._forward=e}async run(e,t){const i=ap.get(t);i&&await i.run(this._forward)}}class ZV extends qB{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:S("smartSelect.expand","Expand Selection"),alias:"Expand Selection",precondition:void 0,kbOpts:{kbExpr:q.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:ni.MenubarSelectionMenu,group:"1_basic",title:S({key:"miSmartSelectGrow",comment:["&& denotes a mnemonic"]},"&&Expand Selection"),order:2}})}}Qn.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand");class XV extends qB{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:S("smartSelect.shrink","Shrink Selection"),alias:"Shrink Selection",precondition:void 0,kbOpts:{kbExpr:q.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:ni.MenubarSelectionMenu,group:"1_basic",title:S({key:"miSmartSelectShrink",comment:["&& denotes a mnemonic"]},"&&Shrink Selection"),order:3}})}}hn(ap.ID,ap,4);Le(ZV);Le(XV);async function GB(o,e,t,i,n){const s=o.all(e).concat(new qV(i.selectSubwords));s.length===1&&s.unshift(new pv);const r=[],a=[];for(const d of s)r.push(Promise.resolve(d.provideSelectionRanges(e,t,n)).then(u=>{if(Yo(u)&&u.length===t.length)for(let f=0;f<t.length;f++){a[f]||(a[f]=[]);for(const g of u[f])Q.isIRange(g.range)&&Q.containsPosition(g.range,t[f])&&a[f].push(Q.lift(g.range))}},bs));return await Promise.all(r),a.map(d=>{if(d.length===0)return[];d.sort((p,C)=>Bi.isBefore(p.getStartPosition(),C.getStartPosition())?1:Bi.isBefore(C.getStartPosition(),p.getStartPosition())||Bi.isBefore(p.getEndPosition(),C.getEndPosition())?-1:Bi.isBefore(C.getEndPosition(),p.getEndPosition())?1:0);const u=[];let f;for(const p of d)(!f||Q.containsRange(p,f)&&!Q.equalsRange(p,f))&&(u.push(p),f=p);if(!i.selectLeadingAndTrailingWhitespace)return u;const g=[u[0]];for(let p=1;p<u.length;p++){const C=u[p-1],b=u[p];if(b.startLineNumber!==C.startLineNumber||b.endLineNumber!==C.endLineNumber){const y=new Q(C.startLineNumber,e.getLineFirstNonWhitespaceColumn(C.startLineNumber),C.endLineNumber,e.getLineLastNonWhitespaceColumn(C.endLineNumber));y.containsRange(C)&&!y.equalsRange(C)&&b.containsRange(y)&&!b.equalsRange(y)&&g.push(y);const w=new Q(C.startLineNumber,1,C.endLineNumber,e.getLineMaxColumn(C.endLineNumber));w.containsRange(C)&&!w.equalsRange(y)&&b.containsRange(w)&&!b.equalsRange(w)&&g.push(w)}g.push(b)}return g})}Qn.registerCommand("_executeSelectionRangeProvider",async function(o,...e){const[t,i]=e;Pn(jn.isUri(t));const n=o.get(Fi).selectionRangeProvider,s=await o.get(fa).createModelReference(t);try{return GB(n,s.object.textEditorModel,i,{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},an.None)}finally{s.dispose()}});const YV=Object.freeze({View:Ai("view","View"),Help:Ai("help","Help"),Test:Ai("test","Test"),File:Ai("file","File"),Preferences:Ai("preferences","Preferences"),Developer:Ai({key:"developer",comment:["A developer on Code itself or someone diagnosing issues in Code"]},"Developer")});class bg{constructor(e,t,i,n=null){this.startLineNumbers=e,this.endLineNumbers=t,this.lastLineRelativePosition=i,this.showEndForLine=n}equals(e){return!!e&&this.lastLineRelativePosition===e.lastLineRelativePosition&&this.showEndForLine===e.showEndForLine&&ja(this.startLineNumbers,e.startLineNumbers)&&ja(this.endLineNumbers,e.endLineNumbers)}static get Empty(){return new bg([],[],0)}}const UD=jA("stickyScrollViewLayer",{createHTML:o=>o}),OC="data-sticky-line-index",qD="data-sticky-is-line",QV="data-sticky-is-line-number",GD="data-sticky-is-folding-icon";class JV extends Rt{constructor(e){super(),this._editor=e,this._foldingIconStore=new Tt,this._rootDomNode=document.createElement("div"),this._lineNumbersDomNode=document.createElement("div"),this._linesDomNodeScrollable=document.createElement("div"),this._linesDomNode=document.createElement("div"),this._lineHeight=this._editor.getOption(67),this._renderedStickyLines=[],this._lineNumbers=[],this._lastLineRelativePosition=0,this._minContentWidthInPx=0,this._isOnGlyphMargin=!1,this._lineNumbersDomNode.className="sticky-widget-line-numbers",this._lineNumbersDomNode.setAttribute("role","none"),this._linesDomNode.className="sticky-widget-lines",this._linesDomNode.setAttribute("role","list"),this._linesDomNodeScrollable.className="sticky-widget-lines-scrollable",this._linesDomNodeScrollable.appendChild(this._linesDomNode),this._rootDomNode.className="sticky-widget",this._rootDomNode.classList.toggle("peek",e instanceof Hr),this._rootDomNode.appendChild(this._lineNumbersDomNode),this._rootDomNode.appendChild(this._linesDomNodeScrollable);const t=()=>{this._linesDomNode.style.left=this._editor.getOption(116).scrollWithEditor?`-${this._editor.getScrollLeft()}px`:"0px"};this._register(this._editor.onDidChangeConfiguration(i=>{i.hasChanged(116)&&t(),i.hasChanged(67)&&(this._lineHeight=this._editor.getOption(67))})),this._register(this._editor.onDidScrollChange(i=>{i.scrollLeftChanged&&t(),i.scrollWidthChanged&&this._updateWidgetWidth()})),this._register(this._editor.onDidChangeModel(()=>{t(),this._updateWidgetWidth()})),this._register(this._foldingIconStore),t(),this._register(this._editor.onDidLayoutChange(i=>{this._updateWidgetWidth()})),this._updateWidgetWidth()}get lineNumbers(){return this._lineNumbers}get lineNumberCount(){return this._lineNumbers.length}getRenderedStickyLine(e){return this._renderedStickyLines.find(t=>t.lineNumber===e)}getCurrentLines(){return this._lineNumbers}setState(e,t,i){if(i===void 0&&(!this._previousState&&!e||this._previousState&&this._previousState.equals(e)))return;const n=this._isWidgetHeightZero(e),s=n?void 0:e,r=n?0:this._findLineToRebuildWidgetFrom(e,i);this._renderRootNode(s,t,r),this._previousState=e}_isWidgetHeightZero(e){if(!e)return!0;const t=e.startLineNumbers.length*this._lineHeight+e.lastLineRelativePosition;if(t>0){this._lastLineRelativePosition=e.lastLineRelativePosition;const i=[...e.startLineNumbers];e.showEndForLine!==null&&(i[e.showEndForLine]=e.endLineNumbers[e.showEndForLine]),this._lineNumbers=i}else this._lastLineRelativePosition=0,this._lineNumbers=[];return t===0}_findLineToRebuildWidgetFrom(e,t){if(!e||!this._previousState)return 0;if(t!==void 0)return t;const i=this._previousState,n=e.startLineNumbers.findIndex(s=>!i.startLineNumbers.includes(s));return n===-1?0:n}_updateWidgetWidth(){const e=this._editor.getLayoutInfo(),t=e.contentLeft;this._lineNumbersDomNode.style.width=`${t}px`,this._linesDomNodeScrollable.style.setProperty("--vscode-editorStickyScroll-scrollableWidth",`${this._editor.getScrollWidth()-e.verticalScrollbarWidth}px`),this._rootDomNode.style.width=`${e.width-e.verticalScrollbarWidth}px`}_clearStickyLinesFromLine(e){this._foldingIconStore.clear();for(let t=e;t<this._renderedStickyLines.length;t++){const i=this._renderedStickyLines[t];i.lineNumberDomNode.remove(),i.lineDomNode.remove()}this._renderedStickyLines=this._renderedStickyLines.slice(0,e),this._rootDomNode.style.display="none"}_useFoldingOpacityTransition(e){this._lineNumbersDomNode.style.setProperty("--vscode-editorStickyScroll-foldingOpacityTransition",`opacity ${e?.5:0}s`)}_setFoldingIconsVisibility(e){for(const t of this._renderedStickyLines){const i=t.foldingIcon;i&&i.setVisible(e?!0:i.isCollapsed)}}async _renderRootNode(e,t,i){if(this._clearStickyLinesFromLine(i),!e)return;for(const a of this._renderedStickyLines)this._updateTopAndZIndexOfStickyLine(a);const n=this._editor.getLayoutInfo(),s=this._lineNumbers.slice(i);for(const[a,d]of s.entries()){const u=this._renderChildNode(a+i,d,t,n);u&&(this._linesDomNode.appendChild(u.lineDomNode),this._lineNumbersDomNode.appendChild(u.lineNumberDomNode),this._renderedStickyLines.push(u))}t&&(this._setFoldingHoverListeners(),this._useFoldingOpacityTransition(!this._isOnGlyphMargin));const r=this._lineNumbers.length*this._lineHeight+this._lastLineRelativePosition;this._rootDomNode.style.display="block",this._lineNumbersDomNode.style.height=`${r}px`,this._linesDomNodeScrollable.style.height=`${r}px`,this._rootDomNode.style.height=`${r}px`,this._rootDomNode.style.marginLeft="0px",this._minContentWidthInPx=Math.max(...this._renderedStickyLines.map(a=>a.scrollWidth))+n.verticalScrollbarWidth,this._editor.layoutOverlayWidget(this)}_setFoldingHoverListeners(){this._editor.getOption(111)==="mouseover"&&(this._foldingIconStore.add(Bn(this._lineNumbersDomNode,as.MOUSE_ENTER,()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)})),this._foldingIconStore.add(Bn(this._lineNumbersDomNode,as.MOUSE_LEAVE,()=>{this._isOnGlyphMargin=!1,this._useFoldingOpacityTransition(!0),this._setFoldingIconsVisibility(!1)})))}_renderChildNode(e,t,i,n){const s=this._editor._getViewModel();if(!s)return;const r=s.coordinatesConverter.convertModelPositionToViewPosition(new Bi(t,1)).lineNumber,a=s.getViewLineRenderingData(r),d=this._editor.getOption(68);let u;try{u=Og.filter(a.inlineDecorations,r,a.minColumn,a.maxColumn)}catch{u=[]}const f=new qA(!0,!0,a.content,a.continuesWithWrappedLine,a.isBasicASCII,a.containsRTL,0,a.tokens,u,a.tabSize,a.startVisibleColumn,1,1,1,500,"none",!0,!0,null),g=new $A(2e3),p=UA(f,g);let C;UD?C=UD.createHTML(g.build()):C=g.build();const b=document.createElement("span");b.setAttribute(OC,String(e)),b.setAttribute(qD,""),b.setAttribute("role","listitem"),b.tabIndex=0,b.className="sticky-line-content",b.classList.add(`stickyLine${t}`),b.style.lineHeight=`${this._lineHeight}px`,b.innerHTML=C;const y=document.createElement("span");y.setAttribute(OC,String(e)),y.setAttribute(QV,""),y.className="sticky-line-number",y.style.lineHeight=`${this._lineHeight}px`;const w=n.contentLeft;y.style.width=`${w}px`;const A=document.createElement("span");d.renderType===1||d.renderType===3&&t%10===0?A.innerText=t.toString():d.renderType===2&&(A.innerText=Math.abs(t-this._editor.getPosition().lineNumber).toString()),A.className="sticky-line-number-inner",A.style.lineHeight=`${this._lineHeight}px`,A.style.width=`${n.lineNumbersWidth}px`,A.style.paddingLeft=`${n.lineNumbersLeft}px`,y.appendChild(A);const I=this._renderFoldingIconForLine(i,t);I&&y.appendChild(I.domNode),this._editor.applyFontInfo(b),this._editor.applyFontInfo(A),y.style.lineHeight=`${this._lineHeight}px`,b.style.lineHeight=`${this._lineHeight}px`,y.style.height=`${this._lineHeight}px`,b.style.height=`${this._lineHeight}px`;const T=new ej(e,t,b,y,I,p.characterMapping,b.scrollWidth);return this._updateTopAndZIndexOfStickyLine(T)}_updateTopAndZIndexOfStickyLine(e){var f;const t=e.index,i=e.lineDomNode,n=e.lineNumberDomNode,s=t===this._lineNumbers.length-1,r="0",a="1";i.style.zIndex=s?r:a,n.style.zIndex=s?r:a;const d=`${t*this._lineHeight+this._lastLineRelativePosition+((f=e.foldingIcon)!=null&&f.isCollapsed?1:0)}px`,u=`${t*this._lineHeight}px`;return i.style.top=s?d:u,n.style.top=s?d:u,e}_renderFoldingIconForLine(e,t){const i=this._editor.getOption(111);if(!e||i==="never")return;const n=e.regions,s=n.findRange(t),r=n.getStartLineNumber(s);if(!(t===r))return;const d=n.isCollapsed(s),u=new tj(d,r,n.getEndLineNumber(s),this._lineHeight);return u.setVisible(this._isOnGlyphMargin?!0:d||i==="always"),u.domNode.setAttribute(GD,""),u}getId(){return"editor.contrib.stickyScrollWidget"}getDomNode(){return this._rootDomNode}getPosition(){return{preference:2,stackOridinal:10}}getMinContentWidthInPx(){return this._minContentWidthInPx}focusLineWithIndex(e){0<=e&&e<this._renderedStickyLines.length&&this._renderedStickyLines[e].lineDomNode.focus()}getEditorPositionFromNode(e){if(!e||e.children.length>0)return null;const t=this._getRenderedStickyLineFromChildDomNode(e);if(!t)return null;const i=UL(t.characterMapping,e,0);return new Bi(t.lineNumber,i)}getLineNumberFromChildDomNode(e){var t;return((t=this._getRenderedStickyLineFromChildDomNode(e))==null?void 0:t.lineNumber)??null}_getRenderedStickyLineFromChildDomNode(e){const t=this.getLineIndexFromChildDomNode(e);return t===null||t<0||t>=this._renderedStickyLines.length?null:this._renderedStickyLines[t]}getLineIndexFromChildDomNode(e){const t=this._getAttributeValue(e,OC);return t?parseInt(t,10):null}isInStickyLine(e){return this._getAttributeValue(e,qD)!==void 0}isInFoldingIconDomNode(e){return this._getAttributeValue(e,GD)!==void 0}_getAttributeValue(e,t){for(;e&&e!==this._rootDomNode;){const i=e.getAttribute(t);if(i!==null)return i;e=e.parentElement}}}class ej{constructor(e,t,i,n,s,r,a){this.index=e,this.lineNumber=t,this.lineDomNode=i,this.lineNumberDomNode=n,this.foldingIcon=s,this.characterMapping=r,this.scrollWidth=a}}class tj{constructor(e,t,i,n){this.isCollapsed=e,this.foldingStartLine=t,this.foldingEndLine=i,this.dimension=n,this.domNode=document.createElement("div"),this.domNode.style.width=`${n}px`,this.domNode.style.height=`${n}px`,this.domNode.className=Rn.asClassName(e?sv:nv)}setVisible(e){this.domNode.style.cursor=e?"pointer":"default",this.domNode.style.opacity=e?"1":"0"}}class Cg{constructor(e,t){this.startLineNumber=e,this.endLineNumber=t}}class Iv{constructor(e,t,i){this.range=e,this.children=t,this.parent=i}}class KB{constructor(e,t,i,n){this.uri=e,this.version=t,this.element=i,this.outlineProviderId=n}}var Bb=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},lp=function(o,e){return function(t,i){e(t,i,o)}},Eg;(function(o){o.OUTLINE_MODEL="outlineModel",o.FOLDING_PROVIDER_MODEL="foldingProviderModel",o.INDENTATION_MODEL="indentationModel"})(Eg||(Eg={}));var pc;(function(o){o[o.VALID=0]="VALID",o[o.INVALID=1]="INVALID",o[o.CANCELED=2]="CANCELED"})(pc||(pc={}));let zy=class extends Rt{constructor(e,t,i,n){switch(super(),this._editor=e,this._modelProviders=[],this._modelPromise=null,this._updateScheduler=this._register(new Oc(300)),this._updateOperation=this._register(new Tt),this._editor.getOption(116).defaultModel){case Eg.OUTLINE_MODEL:this._modelProviders.push(new Vy(this._editor,n));case Eg.FOLDING_PROVIDER_MODEL:this._modelProviders.push(new $y(this._editor,t,n));case Eg.INDENTATION_MODEL:this._modelProviders.push(new jy(this._editor,i));break}}dispose(){this._modelProviders.forEach(e=>e.dispose()),this._updateOperation.clear(),this._cancelModelPromise(),super.dispose()}_cancelModelPromise(){this._modelPromise&&(this._modelPromise.cancel(),this._modelPromise=null)}async update(e){return this._updateOperation.clear(),this._updateOperation.add({dispose:()=>{this._cancelModelPromise(),this._updateScheduler.cancel()}}),this._cancelModelPromise(),await this._updateScheduler.trigger(async()=>{for(const t of this._modelProviders){const{statusPromise:i,modelPromise:n}=t.computeStickyModel(e);this._modelPromise=n;const s=await i;if(this._modelPromise!==n)return null;switch(s){case pc.CANCELED:return this._updateOperation.clear(),null;case pc.VALID:return t.stickyModel}}return null}).catch(t=>(qn(t),null))}};zy=Bb([lp(2,sn),lp(3,Fi)],zy);class ZB extends Rt{constructor(e){super(),this._editor=e,this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,pc.INVALID}computeStickyModel(e){if(e.isCancellationRequested||!this.isProviderValid())return{statusPromise:this._invalid(),modelPromise:null};const t=qs(i=>this.createModelFromProvider(i));return{statusPromise:t.then(i=>this.isModelValid(i)?e.isCancellationRequested?pc.CANCELED:(this._stickyModel=this.createStickyModel(e,i),pc.VALID):this._invalid()).then(void 0,i=>(qn(i),pc.CANCELED)),modelPromise:t}}isModelValid(e){return!0}isProviderValid(){return!0}}let Vy=class extends ZB{constructor(e,t){super(e),this._languageFeaturesService=t}createModelFromProvider(e){return rl.create(this._languageFeaturesService.documentSymbolProvider,this._editor.getModel(),e)}createStickyModel(e,t){var r;const{stickyOutlineElement:i,providerID:n}=this._stickyModelFromOutlineModel(t,(r=this._stickyModel)==null?void 0:r.outlineProviderId),s=this._editor.getModel();return new KB(s.uri,s.getVersionId(),i,n)}isModelValid(e){return e&&e.children.size>0}_stickyModelFromOutlineModel(e,t){let i;if(ml.first(e.children.values())instanceof xB){const a=ml.find(e.children.values(),d=>d.id===t);if(a)i=a.children;else{let d="",u=-1,f;for(const[g,p]of e.children.entries()){const C=this._findSumOfRangesOfGroup(p);C>u&&(f=p,u=C,d=p.id)}t=d,i=f.children}}else i=e.children;const n=[],s=Array.from(i.values()).sort((a,d)=>{const u=new Cg(a.symbol.range.startLineNumber,a.symbol.range.endLineNumber),f=new Cg(d.symbol.range.startLineNumber,d.symbol.range.endLineNumber);return this._comparator(u,f)});for(const a of s)n.push(this._stickyModelFromOutlineElement(a,a.symbol.selectionRange.startLineNumber));return{stickyOutlineElement:new Iv(void 0,n,void 0),providerID:t}}_stickyModelFromOutlineElement(e,t){const i=[];for(const s of e.children.values())if(s.symbol.selectionRange.startLineNumber!==s.symbol.range.endLineNumber)if(s.symbol.selectionRange.startLineNumber!==t)i.push(this._stickyModelFromOutlineElement(s,s.symbol.selectionRange.startLineNumber));else for(const r of s.children.values())i.push(this._stickyModelFromOutlineElement(r,s.symbol.selectionRange.startLineNumber));i.sort((s,r)=>this._comparator(s.range,r.range));const n=new Cg(e.symbol.selectionRange.startLineNumber,e.symbol.range.endLineNumber);return new Iv(n,i,void 0)}_comparator(e,t){return e.startLineNumber!==t.startLineNumber?e.startLineNumber-t.startLineNumber:t.endLineNumber-e.endLineNumber}_findSumOfRangesOfGroup(e){let t=0;for(const i of e.children.values())t+=this._findSumOfRangesOfGroup(i);return e instanceof LE?t+e.symbol.range.endLineNumber-e.symbol.selectionRange.startLineNumber:t}};Vy=Bb([lp(1,Fi)],Vy);class XB extends ZB{constructor(e){super(e),this._foldingLimitReporter=new fB(e)}createStickyModel(e,t){const i=this._fromFoldingRegions(t),n=this._editor.getModel();return new KB(n.uri,n.getVersionId(),i,void 0)}isModelValid(e){return e!==null}_fromFoldingRegions(e){const t=e.length,i=[],n=new Iv(void 0,[],void 0);for(let s=0;s<t;s++){const r=e.getParentIndex(s);let a;r!==-1?a=i[r]:a=n;const d=new Iv(new Cg(e.getStartLineNumber(s),e.getEndLineNumber(s)+1),[],a);a.children.push(d),i.push(d)}return n}}let jy=class extends XB{constructor(e,t){super(e),this._languageConfigurationService=t,this.provider=this._register(new j9(e.getModel(),this._languageConfigurationService,this._foldingLimitReporter))}async createModelFromProvider(e){return this.provider.compute(e)}};jy=Bb([lp(1,js)],jy);let $y=class extends XB{constructor(e,t,i){super(e),this._languageFeaturesService=i;const n=jc.getFoldingRangeProviders(this._languageFeaturesService,e.getModel());n.length>0&&(this.provider=this._register(new $9(e.getModel(),n,t,this._foldingLimitReporter,void 0)))}isProviderValid(){return this.provider!==void 0}async createModelFromProvider(e){var t;return((t=this.provider)==null?void 0:t.compute(e))??null}};$y=Bb([lp(2,Fi)],$y);var ij=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},KD=function(o,e){return function(t,i){e(t,i,o)}};class nj{constructor(e,t,i){this.startLineNumber=e,this.endLineNumber=t,this.nestingDepth=i}}let Uy=class extends Rt{constructor(e,t,i){super(),this._languageFeaturesService=t,this._languageConfigurationService=i,this._onDidChangeStickyScroll=this._register(new rn),this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event,this._model=null,this._cts=null,this._stickyModelProvider=null,this._editor=e,this._sessionStore=this._register(new Tt),this._updateSoon=this._register(new Ms(()=>this.update(),50)),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(116)&&this.readConfiguration()})),this.readConfiguration()}readConfiguration(){this._sessionStore.clear(),this._editor.getOption(116).enabled&&(this._sessionStore.add(this._editor.onDidChangeModel(()=>{this._model=null,this.updateStickyModelProvider(),this._onDidChangeStickyScroll.fire(),this.update()})),this._sessionStore.add(this._editor.onDidChangeHiddenAreas(()=>this.update())),this._sessionStore.add(this._editor.onDidChangeModelContent(()=>this._updateSoon.schedule())),this._sessionStore.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>this.update())),this._sessionStore.add(is(()=>{var t;(t=this._stickyModelProvider)==null||t.dispose(),this._stickyModelProvider=null})),this.updateStickyModelProvider(),this.update())}getVersionId(){var e;return(e=this._model)==null?void 0:e.version}updateStickyModelProvider(){var t;(t=this._stickyModelProvider)==null||t.dispose(),this._stickyModelProvider=null;const e=this._editor;e.hasModel()&&(this._stickyModelProvider=new zy(e,()=>this._updateSoon.schedule(),this._languageConfigurationService,this._languageFeaturesService))}async update(){var e;(e=this._cts)==null||e.dispose(!0),this._cts=new Gs,await this.updateStickyModel(this._cts.token),this._onDidChangeStickyScroll.fire()}async updateStickyModel(e){if(!this._editor.hasModel()||!this._stickyModelProvider||this._editor.getModel().isTooLargeForTokenization()){this._model=null;return}const t=await this._stickyModelProvider.update(e);e.isCancellationRequested||(this._model=t)}updateIndex(e){return e===-1?e=0:e<0&&(e=-e-2),e}getCandidateStickyLinesIntersectingFromStickyModel(e,t,i,n,s){if(t.children.length===0)return;let r=s;const a=[];for(let f=0;f<t.children.length;f++){const g=t.children[f];g.range&&a.push(g.range.startLineNumber)}const d=this.updateIndex(Fm(a,e.startLineNumber,(f,g)=>f-g)),u=this.updateIndex(Fm(a,e.startLineNumber+n,(f,g)=>f-g));for(let f=d;f<=u;f++){const g=t.children[f];if(!g)return;if(g.range){const p=g.range.startLineNumber,C=g.range.endLineNumber;e.startLineNumber<=C+1&&p-1<=e.endLineNumber&&p!==r&&(r=p,i.push(new nj(p,C-1,n+1)),this.getCandidateStickyLinesIntersectingFromStickyModel(e,g,i,n+1,p))}else this.getCandidateStickyLinesIntersectingFromStickyModel(e,g,i,n,s)}}getCandidateStickyLinesIntersecting(e){var n,s;if(!((n=this._model)!=null&&n.element))return[];let t=[];this.getCandidateStickyLinesIntersectingFromStickyModel(e,this._model.element,t,0,-1);const i=(s=this._editor._getViewModel())==null?void 0:s.getHiddenAreas();if(i)for(const r of i)t=t.filter(a=>!(a.startLineNumber>=r.startLineNumber&&a.endLineNumber<=r.endLineNumber+1));return t}};Uy=ij([KD(1,Fi),KD(2,js)],Uy);var sj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Bh=function(o,e){return function(t,i){e(t,i,o)}},qy,wu;let Il=(wu=class extends Rt{constructor(e,t,i,n,s,r,a){super(),this._editor=e,this._contextMenuService=t,this._languageFeaturesService=i,this._instaService=n,this._contextKeyService=a,this._sessionStore=new Tt,this._maxStickyLines=Number.MAX_SAFE_INTEGER,this._candidateDefinitionsLength=-1,this._focusedStickyElementIndex=-1,this._enabled=!1,this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1,this._endLineNumbers=[],this._stickyScrollWidget=new JV(this._editor),this._stickyLineCandidateProvider=new Uy(this._editor,i,s),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=bg.Empty,this._onDidResize(),this._readConfiguration();const d=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeConfiguration(f=>{this._readConfigurationChange(f)})),this._register(Bn(d,as.CONTEXT_MENU,async f=>{this._onContextMenu(Id(d),f)})),this._stickyScrollFocusedContextKey=q.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=q.stickyScrollVisible.bindTo(this._contextKeyService);const u=this._register(I0(d));this._register(u.onDidBlur(f=>{this._positionRevealed===!1&&d.clientHeight===0?(this._focusedStickyElementIndex=-1,this.focus()):this._disposeFocusStickyScrollStore()})),this._register(u.onDidFocus(f=>{this.focus()})),this._registerMouseListeners(),this._register(Bn(d,as.MOUSE_DOWN,f=>{this._onMouseDown=!0}))}static get(e){return e.getContribution(qy.ID)}_disposeFocusStickyScrollStore(){var e;this._stickyScrollFocusedContextKey.set(!1),(e=this._focusDisposableStore)==null||e.dispose(),this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1}focus(){if(this._onMouseDown){this._onMouseDown=!1,this._editor.focus();return}this._stickyScrollFocusedContextKey.get()!==!0&&(this._focused=!0,this._focusDisposableStore=new Tt,this._stickyScrollFocusedContextKey.set(!0),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumbers.length-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}focusNext(){this._focusedStickyElementIndex<this._stickyScrollWidget.lineNumberCount-1&&this._focusNav(!0)}focusPrevious(){this._focusedStickyElementIndex>0&&this._focusNav(!1)}selectEditor(){this._editor.focus()}_focusNav(e){this._focusedStickyElementIndex=e?this._focusedStickyElementIndex+1:this._focusedStickyElementIndex-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex)}goToFocused(){const e=this._stickyScrollWidget.lineNumbers;this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:e[this._focusedStickyElementIndex],column:1})}_revealPosition(e){this._reveaInEditor(e,()=>this._editor.revealPosition(e))}_revealLineInCenterIfOutsideViewport(e){this._reveaInEditor(e,()=>this._editor.revealLineInCenterIfOutsideViewport(e.lineNumber,0))}_reveaInEditor(e,t){this._focused&&this._disposeFocusStickyScrollStore(),this._positionRevealed=!0,t(),this._editor.setSelection(Q.fromPositions(e)),this._editor.focus()}_registerMouseListeners(){const e=this._register(new Tt),t=this._register(new vb(this._editor,{extractLineNumberFromMouseEvent:s=>{const r=this._stickyScrollWidget.getEditorPositionFromNode(s.target.element);return r?r.lineNumber:0}})),i=s=>{if(!this._editor.hasModel()||s.target.type!==12||s.target.detail!==this._stickyScrollWidget.getId())return null;const r=s.target.element;if(!r||r.innerText!==r.innerHTML)return null;const a=this._stickyScrollWidget.getEditorPositionFromNode(r);return a?{range:new Q(a.lineNumber,a.column,a.lineNumber,a.column+r.innerText.length),textElement:r}:null},n=this._stickyScrollWidget.getDomNode();this._register(Sl(n,as.CLICK,s=>{if(s.ctrlKey||s.altKey||s.metaKey||!s.leftButton)return;if(s.shiftKey){const u=this._stickyScrollWidget.getLineIndexFromChildDomNode(s.target);if(u===null)return;const f=new Bi(this._endLineNumbers[u],1);this._revealLineInCenterIfOutsideViewport(f);return}if(this._stickyScrollWidget.isInFoldingIconDomNode(s.target)){const u=this._stickyScrollWidget.getLineNumberFromChildDomNode(s.target);this._toggleFoldingRegionForLine(u);return}if(!this._stickyScrollWidget.isInStickyLine(s.target))return;let d=this._stickyScrollWidget.getEditorPositionFromNode(s.target);if(!d){const u=this._stickyScrollWidget.getLineNumberFromChildDomNode(s.target);if(u===null)return;d=new Bi(u,1)}this._revealPosition(d)})),this._register(Sl(n,as.MOUSE_MOVE,s=>{if(s.shiftKey){const r=this._stickyScrollWidget.getLineIndexFromChildDomNode(s.target);if(r===null||this._showEndForLine!==null&&this._showEndForLine===r)return;this._showEndForLine=r,this._renderStickyScroll();return}this._showEndForLine!==void 0&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._register(Bn(n,as.MOUSE_LEAVE,s=>{this._showEndForLine!==void 0&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._register(t.onMouseMoveOrRelevantKeyDown(([s,r])=>{const a=i(s);if(!a||!s.hasTriggerModifier||!this._editor.hasModel()){e.clear();return}const{range:d,textElement:u}=a;if(!d.equalsRange(this._stickyRangeProjectedOnEditor))this._stickyRangeProjectedOnEditor=d,e.clear();else if(u.style.textDecoration==="underline")return;const f=new Gs;e.add(is(()=>f.dispose(!0)));let g;Zp(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new Bi(d.startLineNumber,d.startColumn+1),!1,f.token).then((p=>{if(!f.token.isCancellationRequested)if(p.length!==0){this._candidateDefinitionsLength=p.length;const C=u;g!==C?(e.clear(),g=C,g.style.textDecoration="underline",e.add(is(()=>{g.style.textDecoration="none"}))):g||(g=C,g.style.textDecoration="underline",e.add(is(()=>{g.style.textDecoration="none"})))}else e.clear()}))})),this._register(t.onCancel(()=>{e.clear()})),this._register(t.onExecute(async s=>{if(s.target.type!==12||s.target.detail!==this._stickyScrollWidget.getId())return;const r=this._stickyScrollWidget.getEditorPositionFromNode(s.target.element);r&&(!this._editor.hasModel()||!this._stickyRangeProjectedOnEditor||(this._candidateDefinitionsLength>1&&(this._focused&&this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:r.lineNumber,column:1})),this._instaService.invokeFunction(X5,s,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor})))}))}_onContextMenu(e,t){const i=new qL(e,t);this._contextMenuService.showContextMenu({menuId:ni.StickyScrollContext,getAnchor:()=>i})}_toggleFoldingRegionForLine(e){if(!this._foldingModel||e===null)return;const t=this._stickyScrollWidget.getRenderedStickyLine(e),i=t==null?void 0:t.foldingIcon;if(!i)return;W9(this._foldingModel,Number.MAX_VALUE,[e]),i.isCollapsed=!i.isCollapsed;const n=(i.isCollapsed?this._editor.getTopForLineNumber(i.foldingEndLine):this._editor.getTopForLineNumber(i.foldingStartLine))-this._editor.getOption(67)*t.index+1;this._editor.setScrollTop(n),this._renderStickyScroll(e)}_readConfiguration(){const e=this._editor.getOption(116);if(e.enabled===!1){this._editor.removeOverlayWidget(this._stickyScrollWidget),this._sessionStore.clear(),this._enabled=!1;return}else e.enabled&&!this._enabled&&(this._editor.addOverlayWidget(this._stickyScrollWidget),this._sessionStore.add(this._editor.onDidScrollChange(i=>{i.scrollTopChanged&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._sessionStore.add(this._editor.onDidLayoutChange(()=>this._onDidResize())),this._sessionStore.add(this._editor.onDidChangeModelTokens(i=>this._onTokensChange(i))),this._sessionStore.add(this._stickyLineCandidateProvider.onDidChangeStickyScroll(()=>{this._showEndForLine=void 0,this._renderStickyScroll()})),this._enabled=!0);this._editor.getOption(68).renderType===2&&this._sessionStore.add(this._editor.onDidChangeCursorPosition(()=>{this._showEndForLine=void 0,this._renderStickyScroll(0)}))}_readConfigurationChange(e){(e.hasChanged(116)||e.hasChanged(73)||e.hasChanged(67)||e.hasChanged(111)||e.hasChanged(68))&&this._readConfiguration(),e.hasChanged(68)&&this._renderStickyScroll(0)}_needsUpdate(e){const t=this._stickyScrollWidget.getCurrentLines();for(const i of t)for(const n of e.ranges)if(i>=n.fromLineNumber&&i<=n.toLineNumber)return!0;return!1}_onTokensChange(e){this._needsUpdate(e)&&this._renderStickyScroll(0)}_onDidResize(){const t=this._editor.getLayoutInfo().height/this._editor.getOption(67);this._maxStickyLines=Math.round(t*.25)}async _renderStickyScroll(e){const t=this._editor.getModel();if(!t||t.isTooLargeForTokenization()){this._resetState();return}const i=this._updateAndGetMinRebuildFromLine(e),n=this._stickyLineCandidateProvider.getVersionId();if(n===void 0||n===t.getVersionId())if(!this._focused)await this._updateState(i);else if(this._focusedStickyElementIndex===-1)await this._updateState(i),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1,this._focusedStickyElementIndex!==-1&&this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);else{const r=this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];await this._updateState(i),this._stickyScrollWidget.lineNumberCount===0?this._focusedStickyElementIndex=-1:(this._stickyScrollWidget.lineNumbers.includes(r)||(this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1),this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}}_updateAndGetMinRebuildFromLine(e){if(e!==void 0){const t=this._minRebuildFromLine!==void 0?this._minRebuildFromLine:1/0;this._minRebuildFromLine=Math.min(e,t)}return this._minRebuildFromLine}async _updateState(e){var i;this._minRebuildFromLine=void 0,this._foldingModel=await((i=jc.get(this._editor))==null?void 0:i.getFoldingModel())??void 0,this._widgetState=this.findScrollWidgetState();const t=this._widgetState.startLineNumbers.length>0;this._stickyScrollVisibleContextKey.set(t),this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,e)}async _resetState(){this._minRebuildFromLine=void 0,this._foldingModel=void 0,this._widgetState=bg.Empty,this._stickyScrollVisibleContextKey.set(!1),this._stickyScrollWidget.setState(void 0,void 0)}findScrollWidgetState(){const e=this._editor.getOption(67),t=Math.min(this._maxStickyLines,this._editor.getOption(116).maxLineCount),i=this._editor.getScrollTop();let n=0;const s=[],r=[],a=this._editor.getVisibleRanges();if(a.length!==0){const d=new Cg(a[0].startLineNumber,a[a.length-1].endLineNumber),u=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(d);for(const f of u){const g=f.startLineNumber,p=f.endLineNumber,C=f.nestingDepth;if(p-g>0){const b=(C-1)*e,y=C*e,w=this._editor.getBottomForLineNumber(g)-i,A=this._editor.getTopForLineNumber(p)-i,I=this._editor.getBottomForLineNumber(p)-i;if(b>A&&b<=I){s.push(g),r.push(p+1),n=I-y;break}else y>w&&y<=I&&(s.push(g),r.push(p+1));if(s.length===t)break}}}return this._endLineNumbers=r,new bg(s,r,n,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}},qy=wu,wu.ID="store.contrib.stickyScrollController",wu);Il=qy=sj([Bh(1,af),Bh(2,Fi),Bh(3,sn),Bh(4,js),Bh(5,gr),Bh(6,Fn)],Il);class oj extends Do{constructor(){super({id:"editor.action.toggleStickyScroll",title:{...Ai("toggleEditorStickyScroll","Toggle Editor Sticky Scroll"),mnemonicTitle:S({key:"mitoggleStickyScroll",comment:["&& denotes a mnemonic"]},"&&Toggle Editor Sticky Scroll")},metadata:{description:Ai("toggleEditorStickyScroll.description","Toggle/enable the editor sticky scroll which shows the nested scopes at the top of the viewport")},category:YV.View,toggled:{condition:qe.equals("config.editor.stickyScroll.enabled",!0),title:S("stickyScroll","Sticky Scroll"),mnemonicTitle:S({key:"miStickyScroll",comment:["&& denotes a mnemonic"]},"&&Sticky Scroll")},menu:[{id:ni.CommandPalette},{id:ni.MenubarAppearanceMenu,group:"4_editor",order:3},{id:ni.StickyScrollContext}]})}async run(e){const t=e.get(ss),i=!t.getValue("editor.stickyScroll.enabled");return t.updateValue("editor.stickyScroll.enabled",i)}}const Fb=100;class rj extends la{constructor(){super({id:"editor.action.focusStickyScroll",title:{...Ai("focusStickyScroll","Focus on the editor sticky scroll"),mnemonicTitle:S({key:"mifocusStickyScroll",comment:["&& denotes a mnemonic"]},"&&Focus Sticky Scroll")},precondition:qe.and(qe.has("config.editor.stickyScroll.enabled"),q.stickyScrollVisible),menu:[{id:ni.CommandPalette}]})}runEditorCommand(e,t){var i;(i=Il.get(t))==null||i.focus()}}class aj extends la{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:Ai("selectNextStickyScrollLine.title","Select the next editor sticky scroll line"),precondition:q.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:Fb,primary:18}})}runEditorCommand(e,t){var i;(i=Il.get(t))==null||i.focusNext()}}class lj extends la{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:Ai("selectPreviousStickyScrollLine.title","Select the previous sticky scroll line"),precondition:q.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:Fb,primary:16}})}runEditorCommand(e,t){var i;(i=Il.get(t))==null||i.focusPrevious()}}class cj extends la{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:Ai("goToFocusedStickyScrollLine.title","Go to the focused sticky scroll line"),precondition:q.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:Fb,primary:3}})}runEditorCommand(e,t){var i;(i=Il.get(t))==null||i.goToFocused()}}class dj extends la{constructor(){super({id:"editor.action.selectEditor",title:Ai("selectEditor.title","Select Editor"),precondition:q.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:Fb,primary:9}})}runEditorCommand(e,t){var i;(i=Il.get(t))==null||i.selectEditor()}}hn(Il.ID,Il,1);Vn(oj);Vn(rj);Vn(lj);Vn(aj);Vn(cj);Vn(dj);var YB=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ng=function(o,e){return function(t,i){e(t,i,o)}};class uj{constructor(e,t,i,n,s,r){this.range=e,this.insertText=t,this.filterText=i,this.additionalTextEdits=n,this.command=s,this.completion=r}}let Gy=class extends GL{constructor(e,t,i,n,s,r){super(s.disposable),this.model=e,this.line=t,this.word=i,this.completionModel=n,this._suggestMemoryService=r}canBeReused(e,t,i){return this.model===e&&this.line===t&&this.word.word.length>0&&this.word.startColumn===i.startColumn&&this.word.endColumn<i.endColumn&&this.completionModel.getIncompleteProvider().size===0}get items(){const e=[],{items:t}=this.completionModel,i=this._suggestMemoryService.select(this.model,{lineNumber:this.line,column:this.word.endColumn+this.completionModel.lineContext.characterCountDelta},t),n=ml.slice(t,i),s=ml.slice(t,0,i);let r=5;for(const a of ml.concat(n,s)){if(a.score===Mg.Default)continue;const d=new Q(a.editStart.lineNumber,a.editStart.column,a.editInsertEnd.lineNumber,a.editInsertEnd.column+this.completionModel.lineContext.characterCountDelta),u=a.completion.insertTextRules&&a.completion.insertTextRules&4?{snippet:a.completion.insertText}:a.completion.insertText;e.push(new uj(d,u,a.filterTextLow??a.labelLow,a.completion.additionalTextEdits,a.completion.command,a)),r-->=0&&a.resolve(an.None)}return e}};Gy=YB([ng(5,Sb)],Gy);let Ky=class extends Rt{constructor(e,t,i,n){super(),this._languageFeatureService=e,this._clipboardService=t,this._suggestMemoryService=i,this._editorService=n,this._store.add(e.inlineCompletionsProvider.register("*",this))}async provideInlineCompletions(e,t,i,n){var C;if(i.selectedSuggestionInfo)return;let s;for(const b of this._editorService.listCodeEditors())if(b.getModel()===e){s=b;break}if(!s)return;const r=s.getOption(90);if(Xh.isAllOff(r))return;e.tokenization.tokenizeIfCheap(t.lineNumber);const a=e.tokenization.getLineTokens(t.lineNumber),d=a.getStandardTokenType(a.findTokenIndexAtOffset(Math.max(t.column-1-1,0)));if(Xh.valueFor(r,d)!=="inline")return;let u=e.getWordAtPosition(t),f;if(u!=null&&u.word||(f=this._getTriggerCharacterInfo(e,t)),!(u!=null&&u.word)&&!f||(u||(u=e.getWordUntilPosition(t)),u.endColumn!==t.column))return;let g;const p=e.getValueInRange(new Q(t.lineNumber,1,t.lineNumber,t.column));if(!f&&((C=this._lastResult)!=null&&C.canBeReused(e,t.lineNumber,u))){const b=new PD(p,t.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=b,this._lastResult.acquire(),g=this._lastResult}else{const b=await U9(this._languageFeatureService.completionProvider,e,t,new Jg(void 0,mv.createSuggestFilter(s).itemKind,f==null?void 0:f.providers),f&&{triggerKind:1,triggerCharacter:f.ch},n);let y;b.needsClipboard&&(y=await this._clipboardService.readText());const w=new oc(b.items,t.column,new PD(p,0),xv.None,s.getOption(119),s.getOption(113),{boostFullMatch:!1,firstMatchCanBeWeak:!1},y);g=new Gy(e,t.lineNumber,u,w,b,this._suggestMemoryService)}return this._lastResult=g,g}handleItemDidShow(e,t){t.completion.resolve(an.None)}freeInlineCompletions(e){e.release()}_getTriggerCharacterInfo(e,t){var s;const i=e.getValueInRange(Q.fromPositions({lineNumber:t.lineNumber,column:t.column-1},t)),n=new Set;for(const r of this._languageFeatureService.completionProvider.all(e))(s=r.triggerCharacters)!=null&&s.includes(i)&&n.add(r);if(n.size!==0)return{providers:n,ch:i}}};Ky=YB([ng(0,Fi),ng(1,lf),ng(2,Sb),ng(3,Cs)],Ky);df(Ky);class hj extends Ct{constructor(){super({id:"editor.action.forceRetokenize",label:S("forceRetokenize","Developer: Force Retokenize"),alias:"Developer: Force Retokenize",precondition:void 0})}run(e,t){if(!t.hasModel())return;const i=t.getModel();i.tokenization.resetTokenization();const n=new Oo;i.tokenization.forceTokenization(i.getLineCount()),n.stop(),console.log(`tokenization took ${n.elapsed()}`)}}Le(hj);const k_=class k_ extends Do{constructor(){super({id:k_.ID,title:Ai({key:"toggle.tabMovesFocus",comment:["Turn on/off use of tab key for moving focus around VS Code"]},"Toggle Tab Key Moves Focus"),precondition:void 0,keybinding:{primary:2091,mac:{primary:1323},weight:100},metadata:{description:Ai("tabMovesFocusDescriptions","Determines whether the tab key moves focus around the workbench or inserts the tab character in the current editor. This is also called tab trapping, tab navigation, or tab focus mode.")},f1:!0})}run(){const t=!s8.getTabFocusMode();s8.setTabFocusMode(t),t?Nr(S("toggle.tabMovesFocus.on","Pressing Tab will now move focus to the next focusable element")):Nr(S("toggle.tabMovesFocus.off","Pressing Tab will now insert the tab character"))}};k_.ID="editor.action.toggleTabFocusMode";let Zy=k_;Vn(Zy);var fj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ZD=function(o,e){return function(t,i){e(t,i,o)}};let Xy=class extends Rt{get enabled(){return this._enabled}set enabled(e){e?(this.el.setAttribute("aria-disabled","false"),this.el.tabIndex=0,this.el.style.pointerEvents="auto",this.el.style.opacity="1",this.el.style.cursor="pointer",this._enabled=!1):(this.el.setAttribute("aria-disabled","true"),this.el.tabIndex=-1,this.el.style.pointerEvents="none",this.el.style.opacity="0.4",this.el.style.cursor="default",this._enabled=!0),this._enabled=e}constructor(e,t,i={},n,s){super(),this._link=t,this._hoverService=n,this._enabled=!0,this.el=di(e,mi("a.monaco-link",{tabIndex:t.tabIndex??0,href:t.href},t.label)),this.hoverDelegate=i.hoverDelegate??Y_("mouse"),this.setTooltip(t.title),this.el.setAttribute("role","button");const r=this._register(new nC(this.el,"click")),a=this._register(new nC(this.el,"keypress")),d=Ts.chain(a.event,g=>g.map(p=>new e9(p)).filter(p=>p.keyCode===3)),u=this._register(new nC(this.el,KL.Tap)).event;this._register(dA.addTarget(this.el));const f=Ts.any(r.event,d,u);this._register(f(g=>{this.enabled&&(Dm.stop(g,!0),i!=null&&i.opener?i.opener(this._link.href):s.open(this._link.href,{allowCommands:!0}))})),this.enabled=!0}setTooltip(e){this.hoverDelegate.showNativeHover?this.el.title=e??"":!this.hover&&e?this.hover=this._register(this._hoverService.setupManagedHover(this.hoverDelegate,this.el,e)):this.hover&&this.hover.update(e)}};Xy=fj([ZD(3,Pp),ZD(4,da)],Xy);var QB=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},JB=function(o,e){return function(t,i){e(t,i,o)}};const gj=26;let Yy=class extends Rt{constructor(e,t){super(),this._editor=e,this.instantiationService=t,this.banner=this._register(this.instantiationService.createInstance(Qy))}hide(){this._editor.setBanner(null,0),this.banner.clear()}show(e){this.banner.show({...e,onClose:()=>{var t;this.hide(),(t=e.onClose)==null||t.call(e)}}),this._editor.setBanner(this.banner.element,gj)}};Yy=QB([JB(1,sn)],Yy);let Qy=class extends Rt{constructor(e){super(),this.instantiationService=e,this.markdownRenderer=this.instantiationService.createInstance(uf,{}),this.element=mi("div.editor-banner"),this.element.tabIndex=0}getAriaLabel(e){if(e.ariaLabel)return e.ariaLabel;if(typeof e.message=="string")return e.message}getBannerMessage(e){if(typeof e=="string"){const t=mi("span");return t.innerText=e,t}return this.markdownRenderer.render(e).element}clear(){Wa(this.element)}show(e){Wa(this.element);const t=this.getAriaLabel(e);t&&this.element.setAttribute("aria-label",t);const i=di(this.element,mi("div.icon-container"));i.setAttribute("aria-hidden","true"),e.icon&&i.appendChild(mi(`div${Rn.asCSSSelector(e.icon)}`));const n=di(this.element,mi("div.message-container"));if(n.setAttribute("aria-hidden","true"),n.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=di(this.element,mi("div.message-actions-container")),e.actions)for(const r of e.actions)this._register(this.instantiationService.createInstance(Xy,this.messageActionsContainer,{...r,tabIndex:-1},{}));const s=di(this.element,mi("div.action-container"));this.actionBar=this._register(new Bg(s)),this.actionBar.push(this._register(new R0("banner.close","Close Banner",Rn.asClassName(IA),!0,()=>{typeof e.onClose=="function"&&e.onClose()})),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};Qy=QB([JB(0,sn)],Qy);var oS=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},u0=function(o,e){return function(t,i){e(t,i,o)}};const pj=ms("extensions-warning-message",Ki.warning,S("warningIcon","Icon shown with a warning message in the extensions editor."));var k0;let cp=(k0=class extends Rt{constructor(e,t,i,n){super(),this._editor=e,this._editorWorkerService=t,this._workspaceTrustService=i,this._highlighter=null,this._bannerClosed=!1,this._updateState=s=>{if(s&&s.hasMore){if(this._bannerClosed)return;const r=Math.max(s.ambiguousCharacterCount,s.nonBasicAsciiCharacterCount,s.invisibleCharacterCount);let a;if(s.nonBasicAsciiCharacterCount>=r)a={message:S("unicodeHighlighting.thisDocumentHasManyNonBasicAsciiUnicodeCharacters","This document contains many non-basic ASCII unicode characters"),command:new up};else if(s.ambiguousCharacterCount>=r)a={message:S("unicodeHighlighting.thisDocumentHasManyAmbiguousUnicodeCharacters","This document contains many ambiguous unicode characters"),command:new qu};else if(s.invisibleCharacterCount>=r)a={message:S("unicodeHighlighting.thisDocumentHasManyInvisibleUnicodeCharacters","This document contains many invisible unicode characters"),command:new dp};else throw new Error("Unreachable");this._bannerController.show({id:"unicodeHighlightBanner",message:a.message,icon:pj,actions:[{label:a.command.shortLabel,href:`command:${a.command.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(n.createInstance(Yy,e)),this._register(this._editor.onDidChangeModel(()=>{this._bannerClosed=!1,this._updateHighlighter()})),this._options=e.getOption(126),this._register(i.onDidChangeTrust(s=>{this._updateHighlighter()})),this._register(e.onDidChangeConfiguration(s=>{s.hasChanged(126)&&(this._options=e.getOption(126),this._updateHighlighter())})),this._updateHighlighter()}dispose(){this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),super.dispose()}_updateHighlighter(){if(this._updateState(null),this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),!this._editor.hasModel())return;const e=xj(this._workspaceTrustService.isWorkspaceTrusted(),this._options);if([e.nonBasicASCII,e.ambiguousCharacters,e.invisibleCharacters].every(i=>i===!1))return;const t={nonBasicASCII:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments,includeStrings:e.includeStrings,allowedCodePoints:Object.keys(e.allowedCharacters).map(i=>i.codePointAt(0)),allowedLocales:Object.keys(e.allowedLocales).map(i=>i==="_os"?new Intl.NumberFormat().resolvedOptions().locale:i==="_vscode"?ZL:i)};this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?this._highlighter=new Jy(this._editor,t,this._updateState,this._editorWorkerService):this._highlighter=new mj(this._editor,t,this._updateState)}getDecorationInfo(e){return this._highlighter?this._highlighter.getDecorationInfo(e):null}},k0.ID="editor.contrib.unicodeHighlighter",k0);cp=oS([u0(1,Nl),u0(2,XL),u0(3,sn)],cp);function xj(o,e){return{nonBasicASCII:e.nonBasicASCII===sC?!o:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments===sC?!o:e.includeComments,includeStrings:e.includeStrings===sC?!o:e.includeStrings,allowedCharacters:e.allowedCharacters,allowedLocales:e.allowedLocales}}let Jy=class extends Rt{constructor(e,t,i,n){super(),this._editor=e,this._options=t,this._updateState=i,this._editorWorkerService=n,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new Ms(()=>this._update(),250)),this._register(this._editor.onDidChangeModelContent(()=>{this._updateSoon.schedule()})),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII()){this._decorations.clear();return}const e=this._model.getVersionId();this._editorWorkerService.computedUnicodeHighlights(this._model.uri,this._options).then(t=>{if(this._model.isDisposed()||this._model.getVersionId()!==e)return;this._updateState(t);const i=[];if(!t.hasMore)for(const n of t.ranges)i.push({range:n,options:Pv.instance.getDecorationFromOptions(this._options)});this._decorations.set(i)})}getDecorationInfo(e){if(!this._decorations.has(e))return null;const t=this._editor.getModel();if(!Ek(t,e))return null;const i=t.getValueInRange(e.range);return{reason:tF(i,this._options),inComment:wk(t,e),inString:yk(t,e)}}};Jy=oS([u0(3,Nl)],Jy);class mj extends Rt{constructor(e,t,i){super(),this._editor=e,this._options=t,this._updateState=i,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new Ms(()=>this._update(),250)),this._register(this._editor.onDidLayoutChange(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidScrollChange(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidChangeHiddenAreas(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidChangeModelContent(()=>{this._updateSoon.schedule()})),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII()){this._decorations.clear();return}const e=this._editor.getVisibleRanges(),t=[],i={ranges:[],ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0,hasMore:!1};for(const n of e){const s=Sk.computeUnicodeHighlights(this._model,this._options,n);for(const r of s.ranges)i.ranges.push(r);i.ambiguousCharacterCount+=i.ambiguousCharacterCount,i.invisibleCharacterCount+=i.invisibleCharacterCount,i.nonBasicAsciiCharacterCount+=i.nonBasicAsciiCharacterCount,i.hasMore=i.hasMore||s.hasMore}if(!i.hasMore)for(const n of i.ranges)t.push({range:n,options:Pv.instance.getDecorationFromOptions(this._options)});this._updateState(i),this._decorations.set(t)}getDecorationInfo(e){if(!this._decorations.has(e))return null;const t=this._editor.getModel(),i=t.getValueInRange(e.range);return Ek(t,e)?{reason:tF(i,this._options),inComment:wk(t,e),inString:yk(t,e)}:null}}const eF=S("unicodeHighlight.configureUnicodeHighlightOptions","Configure Unicode Highlight Options");let ew=class{constructor(e,t,i){this._editor=e,this._languageService=t,this._openerService=i,this.hoverOrdinal=5}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1)return[];const i=this._editor.getModel(),n=this._editor.getContribution(cp.ID);if(!n)return[];const s=[],r=new Set;let a=300;for(const d of t){const u=n.getDecorationInfo(d);if(!u)continue;const g=i.getValueInRange(d.range).codePointAt(0),p=HC(g);let C;switch(u.reason.kind){case 0:{KA(u.reason.confusableWith)?C=S("unicodeHighlight.characterIsAmbiguousASCII","The character {0} could be confused with the ASCII character {1}, which is more common in source code.",p,HC(u.reason.confusableWith.codePointAt(0))):C=S("unicodeHighlight.characterIsAmbiguous","The character {0} could be confused with the character {1}, which is more common in source code.",p,HC(u.reason.confusableWith.codePointAt(0)));break}case 1:C=S("unicodeHighlight.characterIsInvisible","The character {0} is invisible.",p);break;case 2:C=S("unicodeHighlight.characterIsNonBasicAscii","The character {0} is not a basic ASCII character.",p);break}if(r.has(C))continue;r.add(C);const b={codePoint:g,reason:u.reason,inComment:u.inComment,inString:u.inString},y=S("unicodeHighlight.adjustSettings","Adjust settings"),w=`command:${Tv.ID}?${encodeURIComponent(JSON.stringify(b))}`,A=new lo("",!0).appendMarkdown(C).appendText(" ").appendLink(w,y,eF);s.push(new Ir(this,d.range,[A],!1,a++))}return s}renderHoverParts(e,t){return qM(e,t,this._editor,this._languageService,this._openerService)}};ew=oS([u0(1,ha),u0(2,da)],ew);function tw(o){return`U+${o.toString(16).padStart(4,"0")}`}function HC(o){let e=`\`${tw(o)}\``;return Dk.isInvisibleCharacter(o)||(e+=` "${`${vj(o)}`}"`),e}function vj(o){return o===96?"`` ` ``":"`"+String.fromCodePoint(o)+"`"}function tF(o,e){return Sk.computeUnicodeHighlightReason(o,e)}const B_=class B_{constructor(){this.map=new Map}getDecorationFromOptions(e){return this.getDecoration(!e.includeComments,!e.includeStrings)}getDecoration(e,t){const i=`${e}${t}`;let n=this.map.get(i);return n||(n=vn.createDynamic({description:"unicode-highlight",stickiness:1,className:"unicode-highlight",showIfCollapsed:!0,overviewRuler:null,minimap:null,hideInCommentTokens:e,hideInStringTokens:t}),this.map.set(i,n)),n}};B_.instance=new B_;let Pv=B_;class _j extends Ct{constructor(){super({id:qu.ID,label:S("action.unicodeHighlight.disableHighlightingInComments","Disable highlighting of characters in comments"),alias:"Disable highlighting of characters in comments",precondition:void 0}),this.shortLabel=S("unicodeHighlight.disableHighlightingInComments.shortLabel","Disable Highlight In Comments")}async run(e,t,i){const n=e==null?void 0:e.get(ss);n&&this.runAction(n)}async runAction(e){await e.updateValue(Al.includeComments,!1,2)}}class bj extends Ct{constructor(){super({id:qu.ID,label:S("action.unicodeHighlight.disableHighlightingInStrings","Disable highlighting of characters in strings"),alias:"Disable highlighting of characters in strings",precondition:void 0}),this.shortLabel=S("unicodeHighlight.disableHighlightingInStrings.shortLabel","Disable Highlight In Strings")}async run(e,t,i){const n=e==null?void 0:e.get(ss);n&&this.runAction(n)}async runAction(e){await e.updateValue(Al.includeStrings,!1,2)}}const F_=class F_ extends Ct{constructor(){super({id:F_.ID,label:S("action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters","Disable highlighting of ambiguous characters"),alias:"Disable highlighting of ambiguous characters",precondition:void 0}),this.shortLabel=S("unicodeHighlight.disableHighlightingOfAmbiguousCharacters.shortLabel","Disable Ambiguous Highlight")}async run(e,t,i){const n=e==null?void 0:e.get(ss);n&&this.runAction(n)}async runAction(e){await e.updateValue(Al.ambiguousCharacters,!1,2)}};F_.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters";let qu=F_;const L_=class L_ extends Ct{constructor(){super({id:L_.ID,label:S("action.unicodeHighlight.disableHighlightingOfInvisibleCharacters","Disable highlighting of invisible characters"),alias:"Disable highlighting of invisible characters",precondition:void 0}),this.shortLabel=S("unicodeHighlight.disableHighlightingOfInvisibleCharacters.shortLabel","Disable Invisible Highlight")}async run(e,t,i){const n=e==null?void 0:e.get(ss);n&&this.runAction(n)}async runAction(e){await e.updateValue(Al.invisibleCharacters,!1,2)}};L_.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters";let dp=L_;const I_=class I_ extends Ct{constructor(){super({id:I_.ID,label:S("action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters","Disable highlighting of non basic ASCII characters"),alias:"Disable highlighting of non basic ASCII characters",precondition:void 0}),this.shortLabel=S("unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters.shortLabel","Disable Non ASCII Highlight")}async run(e,t,i){const n=e==null?void 0:e.get(ss);n&&this.runAction(n)}async runAction(e){await e.updateValue(Al.nonBasicASCII,!1,2)}};I_.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters";let up=I_;const P_=class P_ extends Ct{constructor(){super({id:P_.ID,label:S("action.unicodeHighlight.showExcludeOptions","Show Exclude Options"),alias:"Show Exclude Options",precondition:void 0})}async run(e,t,i){const{codePoint:n,reason:s,inString:r,inComment:a}=i,d=String.fromCodePoint(n),u=e.get(Tl),f=e.get(ss);function g(b){return Dk.isInvisibleCharacter(b)?S("unicodeHighlight.excludeInvisibleCharFromBeingHighlighted","Exclude {0} (invisible character) from being highlighted",tw(b)):S("unicodeHighlight.excludeCharFromBeingHighlighted","Exclude {0} from being highlighted",`${tw(b)} "${d}"`)}const p=[];if(s.kind===0)for(const b of s.notAmbiguousInLocales)p.push({label:S("unicodeHighlight.allowCommonCharactersInLanguage",'Allow unicode characters that are more common in the language "{0}".',b),run:async()=>{Ej(f,[b])}});if(p.push({label:g(n),run:()=>Cj(f,[n])}),a){const b=new _j;p.push({label:b.label,run:async()=>b.runAction(f)})}else if(r){const b=new bj;p.push({label:b.label,run:async()=>b.runAction(f)})}if(s.kind===0){const b=new qu;p.push({label:b.label,run:async()=>b.runAction(f)})}else if(s.kind===1){const b=new dp;p.push({label:b.label,run:async()=>b.runAction(f)})}else if(s.kind===2){const b=new up;p.push({label:b.label,run:async()=>b.runAction(f)})}else yj(s);const C=await u.pick(p,{title:eF});C&&await C.run()}};P_.ID="editor.action.unicodeHighlight.showExcludeOptions";let Tv=P_;async function Cj(o,e){const t=o.getValue(Al.allowedCharacters);let i;typeof t=="object"&&t?i=t:i={};for(const n of e)i[String.fromCodePoint(n)]=!0;await o.updateValue(Al.allowedCharacters,i,2)}async function Ej(o,e){var n;const t=(n=o.inspect(Al.allowedLocales).user)==null?void 0:n.value;let i;typeof t=="object"&&t?i=Object.assign({},t):i={};for(const s of e)i[s]=!0;await o.updateValue(Al.allowedLocales,i,2)}function yj(o){throw new Error(`Unexpected value: ${o}`)}Le(qu);Le(dp);Le(up);Le(Tv);hn(cp.ID,cp,1);th.register(ew);var wj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},XD=function(o,e){return function(t,i){e(t,i,o)}};const iF="ignoreUnusualLineTerminators";function Sj(o,e,t){o.setModelProperty(e.uri,iF,t)}function Dj(o,e){return o.getModelProperty(e.uri,iF)}var B0;let Mv=(B0=class extends Rt{constructor(e,t,i){super(),this._editor=e,this._dialogService=t,this._codeEditorService=i,this._isPresentingDialog=!1,this._config=this._editor.getOption(127),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(127)&&(this._config=this._editor.getOption(127),this._checkForUnusualLineTerminators())})),this._register(this._editor.onDidChangeModel(()=>{this._checkForUnusualLineTerminators()})),this._register(this._editor.onDidChangeModelContent(n=>{n.isUndoing||this._checkForUnusualLineTerminators()})),this._checkForUnusualLineTerminators()}async _checkForUnusualLineTerminators(){if(this._config==="off"||!this._editor.hasModel())return;const e=this._editor.getModel();if(!e.mightContainUnusualLineTerminators()||Dj(this._codeEditorService,e)===!0||this._editor.getOption(92))return;if(this._config==="auto"){e.removeUnusualLineTerminators(this._editor.getSelections());return}if(this._isPresentingDialog)return;let i;try{this._isPresentingDialog=!0,i=await this._dialogService.confirm({title:S("unusualLineTerminators.title","Unusual Line Terminators"),message:S("unusualLineTerminators.message","Detected unusual line terminators"),detail:S("unusualLineTerminators.detail","The file '{0}' contains one or more unusual line terminator characters, like Line Separator (LS) or Paragraph Separator (PS).\n\nIt is recommended to remove them from the file. This can be configured via `editor.unusualLineTerminators`.",Ua(e.uri)),primaryButton:S({key:"unusualLineTerminators.fix",comment:["&& denotes a mnemonic"]},"&&Remove Unusual Line Terminators"),cancelButton:S("unusualLineTerminators.ignore","Ignore")})}finally{this._isPresentingDialog=!1}if(!i.confirmed){Sj(this._codeEditorService,e,!0);return}e.removeUnusualLineTerminators(this._editor.getSelections())}},B0.ID="editor.contrib.unusualLineTerminatorsDetector",B0);Mv=wj([XD(1,i9),XD(2,Cs)],Mv);hn(Mv.ID,Mv,1);var Aj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},kj=function(o,e){return function(t,i){e(t,i,o)}};class YD{constructor(){this.selector={language:"*"}}provideDocumentHighlights(e,t,i){const n=[],s=e.getWordAtPosition({lineNumber:t.lineNumber,column:t.column});return s?e.isDisposed()?void 0:e.findMatches(s.word,!0,!1,!0,o8,!1).map(a=>({range:a.range,kind:Im.Text})):Promise.resolve(n)}provideMultiDocumentHighlights(e,t,i,n){const s=new Nc,r=e.getWordAtPosition({lineNumber:t.lineNumber,column:t.column});if(!r)return Promise.resolve(s);for(const a of[e,...i]){if(a.isDisposed())continue;const u=a.findMatches(r.word,!0,!1,!0,o8,!1).map(f=>({range:f.range,kind:Im.Text}));u&&s.set(a.uri,u)}return s}}let iw=class extends Rt{constructor(e){super(),this._register(e.documentHighlightProvider.register("*",new YD)),this._register(e.multiDocumentHighlightProvider.register("*",new YD))}};iw=Aj([kj(0,Fi)],iw);var nF=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},mm=function(o,e){return function(t,i){e(t,i,o)}},fs,nw;const rS=new En("hasWordHighlights",!1);function sF(o,e,t,i){const n=o.ordered(e);return Xw(n.map(s=>()=>Promise.resolve(s.provideDocumentHighlights(e,t,i)).then(void 0,bs)),s=>s!=null).then(s=>{if(s){const r=new Nc;return r.set(e.uri,s),r}return new Nc})}function Bj(o,e,t,i,n,s){const r=o.ordered(e);return Xw(r.map(a=>()=>{const d=s.filter(u=>QL(u)).filter(u=>JL(a.selector,u.uri,u.getLanguageId(),!0,void 0,void 0)>0);return Promise.resolve(a.provideMultiDocumentHighlights(e,t,d,n)).then(void 0,bs)}),a=>a!=null)}class oF{constructor(e,t,i){this._model=e,this._selection=t,this._wordSeparators=i,this._wordRange=this._getCurrentWordRange(e,t),this._result=null}get result(){return this._result||(this._result=qs(e=>this._compute(this._model,this._selection,this._wordSeparators,e))),this._result}_getCurrentWordRange(e,t){const i=e.getWordAtPosition(t.getPosition());return i?new Q(t.startLineNumber,i.startColumn,t.startLineNumber,i.endColumn):null}isValid(e,t,i){const n=t.startLineNumber,s=t.startColumn,r=t.endColumn,a=this._getCurrentWordRange(e,t);let d=!!(this._wordRange&&this._wordRange.equalsRange(a));for(let u=0,f=i.length;!d&&u<f;u++){const g=i.getRange(u);g&&g.startLineNumber===n&&g.startColumn<=s&&g.endColumn>=r&&(d=!0)}return d}cancel(){this.result.cancel()}}class Fj extends oF{constructor(e,t,i,n){super(e,t,i),this._providers=n}_compute(e,t,i,n){return sF(this._providers,e,t.getPosition(),n).then(s=>s||new Nc)}}class Lj extends oF{constructor(e,t,i,n,s){super(e,t,i),this._providers=n,this._otherModels=s}_compute(e,t,i,n){return Bj(this._providers,e,t.getPosition(),i,n,this._otherModels).then(s=>s||new Nc)}}function Ij(o,e,t,i,n){return new Fj(e,t,n,o)}function Pj(o,e,t,i,n,s){return new Lj(e,t,n,o,s)}ko("_executeDocumentHighlights",async(o,e,t)=>{const i=o.get(Fi),n=await sF(i.documentHighlightProvider,e,t,an.None);return n==null?void 0:n.get(e.uri)});var Rc;let sw=(Rc=class{constructor(e,t,i,n,s){this.toUnhook=new Tt,this.workerRequestTokenId=0,this.workerRequestCompleted=!1,this.workerRequestValue=new Nc,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,this.runDelayer=this.toUnhook.add(new Oc(50)),this.editor=e,this.providers=t,this.multiDocumentProviders=i,this.codeEditorService=s,this._hasWordHighlights=rS.bindTo(n),this._ignorePositionChangeEvent=!1,this.occurrencesHighlight=this.editor.getOption(81),this.model=this.editor.getModel(),this.toUnhook.add(e.onDidChangeCursorPosition(r=>{this._ignorePositionChangeEvent||this.occurrencesHighlight!=="off"&&this.runDelayer.trigger(()=>{this._onPositionChanged(r)})})),this.toUnhook.add(e.onDidFocusEditorText(r=>{this.occurrencesHighlight!=="off"&&(this.workerRequest||this.runDelayer.trigger(()=>{this._run()}))})),this.toUnhook.add(e.onDidChangeModelContent(r=>{YL(this.model.uri,"output")||this._stopAll()})),this.toUnhook.add(e.onDidChangeModel(r=>{!r.newModelUrl&&r.oldModelUrl?this._stopSingular():fs.query&&this._run()})),this.toUnhook.add(e.onDidChangeConfiguration(r=>{var d,u;const a=this.editor.getOption(81);if(this.occurrencesHighlight!==a)switch(this.occurrencesHighlight=a,a){case"off":this._stopAll();break;case"singleFile":this._stopAll((u=(d=fs.query)==null?void 0:d.modelInfo)==null?void 0:u.model);break;case"multiFile":fs.query&&this._run(!0);break;default:console.warn("Unknown occurrencesHighlight setting value:",a);break}})),this.decorations=this.editor.createDecorationsCollection(),this.workerRequestTokenId=0,this.workerRequest=null,this.workerRequestCompleted=!1,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,fs.query&&this._run()}hasDecorations(){return this.decorations.length>0}restore(){this.occurrencesHighlight!=="off"&&(this.runDelayer.cancel(),this._run())}_getSortedHighlights(){return this.decorations.getRanges().sort(Q.compareRangesUsingStarts)}moveNext(){const e=this._getSortedHighlights(),i=(e.findIndex(s=>s.containsPosition(this.editor.getPosition()))+1)%e.length,n=e[i];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(n.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(n);const s=this._getWord();if(s){const r=this.editor.getModel().getLineContent(n.startLineNumber);Nr(`${r}, ${i+1} of ${e.length} for '${s.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}moveBack(){const e=this._getSortedHighlights(),i=(e.findIndex(s=>s.containsPosition(this.editor.getPosition()))-1+e.length)%e.length,n=e[i];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(n.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(n);const s=this._getWord();if(s){const r=this.editor.getModel().getLineContent(n.startLineNumber);Nr(`${r}, ${i+1} of ${e.length} for '${s.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}_removeSingleDecorations(){if(!this.editor.hasModel())return;const e=fs.storedDecorationIDs.get(this.editor.getModel().uri);e&&(this.editor.removeDecorations(e),fs.storedDecorationIDs.delete(this.editor.getModel().uri),this.decorations.length>0&&(this.decorations.clear(),this._hasWordHighlights.set(!1)))}_removeAllDecorations(e){const t=this.codeEditorService.listCodeEditors(),i=[];for(const n of t){if(!n.hasModel()||wm(n.getModel().uri,e==null?void 0:e.uri))continue;const s=fs.storedDecorationIDs.get(n.getModel().uri);if(!s)continue;n.removeDecorations(s),i.push(n.getModel().uri);const r=Uc.get(n);r!=null&&r.wordHighlighter&&r.wordHighlighter.decorations.length>0&&(r.wordHighlighter.decorations.clear(),r.wordHighlighter.workerRequest=null,r.wordHighlighter._hasWordHighlights.set(!1))}for(const n of i)fs.storedDecorationIDs.delete(n)}_stopSingular(){var e,t,i,n;this._removeSingleDecorations(),this.editor.hasTextFocus()&&(((e=this.editor.getModel())==null?void 0:e.uri.scheme)!==Co.vscodeNotebookCell&&((i=(t=fs.query)==null?void 0:t.modelInfo)==null?void 0:i.model.uri.scheme)!==Co.vscodeNotebookCell?(fs.query=null,this._run()):(n=fs.query)!=null&&n.modelInfo&&(fs.query.modelInfo=null)),this.renderDecorationsTimer!==-1&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1),this.workerRequest!==null&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_stopAll(e){this._removeAllDecorations(e),this.renderDecorationsTimer!==-1&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1),this.workerRequest!==null&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_onPositionChanged(e){var t;if(this.occurrencesHighlight==="off"){this._stopAll();return}if(e.reason!==3&&((t=this.editor.getModel())==null?void 0:t.uri.scheme)!==Co.vscodeNotebookCell){this._stopAll();return}this._run()}_getWord(){const e=this.editor.getSelection(),t=e.startLineNumber,i=e.startColumn;return this.model.isDisposed()?null:this.model.getWordAtPosition({lineNumber:t,column:i})}getOtherModelsToHighlight(e){if(!e)return[];if(e.uri.scheme===Co.vscodeNotebookCell){const s=[],r=this.codeEditorService.listCodeEditors();for(const a of r){const d=a.getModel();d&&d!==e&&d.uri.scheme===Co.vscodeNotebookCell&&s.push(d)}return s}const i=[],n=this.codeEditorService.listCodeEditors();for(const s of n){if(!Ak(s))continue;const r=s.getModel();r&&e===r.modified&&i.push(r.modified)}if(i.length)return i;if(this.occurrencesHighlight==="singleFile")return[];for(const s of n){const r=s.getModel();r&&r!==e&&i.push(r)}return i}_run(e){var n,s;let t;if(this.editor.hasTextFocus()){const r=this.editor.getSelection();if(!r||r.startLineNumber!==r.endLineNumber){fs.query=null,this._stopAll();return}const a=r.startColumn,d=r.endColumn,u=this._getWord();if(!u||u.startColumn>a||u.endColumn<d){fs.query=null,this._stopAll();return}t=this.workerRequest&&this.workerRequest.isValid(this.model,r,this.decorations),fs.query={modelInfo:{model:this.model,selection:r},word:u}}else if(!fs.query){this._stopAll();return}if(this.lastCursorPositionChangeTime=new Date().getTime(),t)this.workerRequestCompleted&&this.renderDecorationsTimer!==-1&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1,this._beginRenderDecorations());else if(wm(this.editor.getModel().uri,(n=fs.query.modelInfo)==null?void 0:n.model.uri)){if(!e){const d=this.decorations.getRanges();for(const u of d)if(u.containsPosition(this.editor.getPosition()))return}this._stopAll(e?this.model:void 0);const r=++this.workerRequestTokenId;this.workerRequestCompleted=!1;const a=this.getOtherModelsToHighlight(this.editor.getModel());if(!fs.query||!fs.query.modelInfo||fs.query.modelInfo.model.isDisposed())return;this.workerRequest=this.computeWithModel(fs.query.modelInfo.model,fs.query.modelInfo.selection,fs.query.word,a),(s=this.workerRequest)==null||s.result.then(d=>{r===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=d||[],this._beginRenderDecorations())},qn)}}computeWithModel(e,t,i,n){return n.length?Pj(this.multiDocumentProviders,e,t,i,this.editor.getOption(132),n):Ij(this.providers,e,t,i,this.editor.getOption(132))}_beginRenderDecorations(){const e=new Date().getTime(),t=this.lastCursorPositionChangeTime+250;e>=t?(this.renderDecorationsTimer=-1,this.renderDecorations()):this.renderDecorationsTimer=setTimeout(()=>{this.renderDecorations()},t-e)}renderDecorations(){var t,i,n;this.renderDecorationsTimer=-1;const e=this.codeEditorService.listCodeEditors();for(const s of e){const r=Uc.get(s);if(!r)continue;const a=[],d=(t=s.getModel())==null?void 0:t.uri;if(d&&this.workerRequestValue.has(d)){const u=fs.storedDecorationIDs.get(d),f=this.workerRequestValue.get(d);if(f)for(const p of f)p.range&&a.push({range:p.range,options:Cz(p.kind)});let g=[];s.changeDecorations(p=>{g=p.deltaDecorations(u??[],a)}),fs.storedDecorationIDs=fs.storedDecorationIDs.set(d,g),a.length>0&&((i=r.wordHighlighter)==null||i.decorations.set(a),(n=r.wordHighlighter)==null||n._hasWordHighlights.set(!0))}}}dispose(){this._stopSingular(),this.toUnhook.dispose()}},fs=Rc,Rc.storedDecorationIDs=new Nc,Rc.query=null,Rc);sw=fs=nF([mm(4,Cs)],sw);var Su;let Uc=(Su=class extends Rt{static get(e){return e.getContribution(nw.ID)}constructor(e,t,i,n){super(),this._wordHighlighter=null;const s=()=>{e.hasModel()&&!e.getModel().isTooLargeForTokenization()&&(this._wordHighlighter=new sw(e,i.documentHighlightProvider,i.multiDocumentHighlightProvider,t,n))};this._register(e.onDidChangeModel(r=>{this._wordHighlighter&&(this._wordHighlighter.dispose(),this._wordHighlighter=null),s()})),s()}get wordHighlighter(){return this._wordHighlighter}saveViewState(){return!!(this._wordHighlighter&&this._wordHighlighter.hasDecorations())}moveNext(){var e;(e=this._wordHighlighter)==null||e.moveNext()}moveBack(){var e;(e=this._wordHighlighter)==null||e.moveBack()}restoreViewState(e){this._wordHighlighter&&e&&this._wordHighlighter.restore()}dispose(){this._wordHighlighter&&(this._wordHighlighter.dispose(),this._wordHighlighter=null),super.dispose()}},nw=Su,Su.ID="editor.contrib.wordHighlighter",Su);Uc=nw=nF([mm(1,Fn),mm(2,Fi),mm(3,Cs)],Uc);class rF extends Ct{constructor(e,t){super(t),this._isNext=e}run(e,t){const i=Uc.get(t);i&&(this._isNext?i.moveNext():i.moveBack())}}class Tj extends rF{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:S("wordHighlight.next.label","Go to Next Symbol Highlight"),alias:"Go to Next Symbol Highlight",precondition:rS,kbOpts:{kbExpr:q.editorTextFocus,primary:65,weight:100}})}}class Mj extends rF{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:S("wordHighlight.previous.label","Go to Previous Symbol Highlight"),alias:"Go to Previous Symbol Highlight",precondition:rS,kbOpts:{kbExpr:q.editorTextFocus,primary:1089,weight:100}})}}class Rj extends Ct{constructor(){super({id:"editor.action.wordHighlight.trigger",label:S("wordHighlight.trigger.label","Trigger Symbol Highlight"),alias:"Trigger Symbol Highlight",precondition:void 0,kbOpts:{kbExpr:q.editorTextFocus,primary:0,weight:100}})}run(e,t,i){const n=Uc.get(t);n&&n.restoreViewState(!0)}}hn(Uc.ID,Uc,0);Le(Tj);Le(Mj);Le(Rj);df(iw);class Lb extends Ao{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){if(!t.hasModel())return;const n=Qu(t.getOption(132),t.getOption(131)),s=t.getModel(),r=t.getSelections(),a=r.length>1,d=r.map(u=>{const f=new Bi(u.positionLineNumber,u.positionColumn),g=this._move(n,s,f,this._wordNavigationType,a);return this._moveTo(u,g,this._inSelectionMode)});if(s.pushStackElement(),t._getViewModel().setCursorStates("moveWordCommand",3,d.map(u=>e7.fromModelSelection(u))),d.length===1){const u=new Bi(d[0].positionLineNumber,d[0].positionColumn);t.revealPosition(u,0)}}_moveTo(e,t,i){return i?new $i(e.selectionStartLineNumber,e.selectionStartColumn,t.lineNumber,t.column):new $i(t.lineNumber,t.column,t.lineNumber,t.column)}}class Zc extends Lb{_move(e,t,i,n,s){return Op.moveWordLeft(e,t,i,n,s)}}class Xc extends Lb{_move(e,t,i,n,s){return Op.moveWordRight(e,t,i,n)}}class Nj extends Zc{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}class Oj extends Zc{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}class Hj extends Zc{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:qe.and(q.textInputFocus,(e=qe.and(tb,ib))==null?void 0:e.negate()),primary:2063,mac:{primary:527},weight:100}})}}class Wj extends Zc{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}class zj extends Zc{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}class Vj extends Zc{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:qe.and(q.textInputFocus,(e=qe.and(tb,ib))==null?void 0:e.negate()),primary:3087,mac:{primary:1551},weight:100}})}}class jj extends Zc{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(e,t,i,n,s){return super._move(Qu(nb.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class $j extends Zc{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(e,t,i,n,s){return super._move(Qu(nb.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class Uj extends Xc{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}class qj extends Xc{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:qe.and(q.textInputFocus,(e=qe.and(tb,ib))==null?void 0:e.negate()),primary:2065,mac:{primary:529},weight:100}})}}class Gj extends Xc{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}class Kj extends Xc{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}class Zj extends Xc{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:qe.and(q.textInputFocus,(e=qe.and(tb,ib))==null?void 0:e.negate()),primary:3089,mac:{primary:1553},weight:100}})}}class Xj extends Xc{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}class Yj extends Xc{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(e,t,i,n,s){return super._move(Qu(nb.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class Qj extends Xc{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(e,t,i,n,s){return super._move(Qu(nb.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class Ib extends Ao{constructor(e){super(e),this._whitespaceHeuristics=e.whitespaceHeuristics,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){const n=e.get(js);if(!t.hasModel())return;const s=Qu(t.getOption(132),t.getOption(131)),r=t.getModel(),a=t.getSelections(),d=t.getOption(6),u=t.getOption(11),f=n.getLanguageConfiguration(r.getLanguageId()).getAutoClosingPairs(),g=t._getViewModel(),p=a.map(C=>{const b=this._delete({wordSeparators:s,model:r,selection:C,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:t.getOption(9),autoClosingBrackets:d,autoClosingQuotes:u,autoClosingPairs:f,autoClosedCharacters:g.getCursorAutoClosedCharacters()},this._wordNavigationType);return new wp(b,"")});t.pushUndoStop(),t.executeCommands(this.id,p),t.pushUndoStop()}}class aS extends Ib{_delete(e,t){const i=Op.deleteWordLeft(e,t);return i||new Q(1,1,1,1)}}class lS extends Ib{_delete(e,t){const i=Op.deleteWordRight(e,t);if(i)return i;const n=e.model.getLineCount(),s=e.model.getLineMaxColumn(n);return new Q(n,s,n,s)}}class Jj extends aS{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:q.writable})}}class e$ extends aS{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:q.writable})}}class t$ extends aS{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:q.writable,kbOpts:{kbExpr:q.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}class i$ extends lS{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:q.writable})}}class n$ extends lS{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:q.writable})}}class s$ extends lS{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:q.writable,kbOpts:{kbExpr:q.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}class o$ extends Ct{constructor(){super({id:"deleteInsideWord",precondition:q.writable,label:S("deleteInsideWord","Delete Word"),alias:"Delete Word"})}run(e,t,i){if(!t.hasModel())return;const n=Qu(t.getOption(132),t.getOption(131)),s=t.getModel(),a=t.getSelections().map(d=>{const u=Op.deleteInsideWord(n,s,d);return new wp(u,"")});t.pushUndoStop(),t.executeCommands(this.id,a),t.pushUndoStop()}}Ti(new Nj);Ti(new Oj);Ti(new Hj);Ti(new Wj);Ti(new zj);Ti(new Vj);Ti(new Uj);Ti(new qj);Ti(new Gj);Ti(new Kj);Ti(new Zj);Ti(new Xj);Ti(new jj);Ti(new $j);Ti(new Yj);Ti(new Qj);Ti(new Jj);Ti(new e$);Ti(new t$);Ti(new i$);Ti(new n$);Ti(new s$);Le(o$);class r$ extends Ib{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:q.writable,kbOpts:{kbExpr:q.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(e,t){const i=sb.deleteWordPartLeft(e);return i||new Q(1,1,1,1)}}class a$ extends Ib{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:q.writable,kbOpts:{kbExpr:q.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(e,t){const i=sb.deleteWordPartRight(e);if(i)return i;const n=e.model.getLineCount(),s=e.model.getLineMaxColumn(n);return new Q(n,s,n,s)}}class aF extends Lb{_move(e,t,i,n,s){return sb.moveWordPartLeft(e,t,i,s)}}class l$ extends aF{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:q.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}Qn.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft");class c$ extends aF{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:q.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}Qn.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class lF extends Lb{_move(e,t,i,n,s){return sb.moveWordPartRight(e,t,i)}}class d$ extends lF{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:q.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}class u$ extends lF{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:q.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}}Ti(new r$);Ti(new a$);Ti(new l$);Ti(new c$);Ti(new d$);Ti(new u$);const DS=class DS extends Rt{constructor(e){super(),this.editor=e,this._register(this.editor.onDidAttemptReadOnlyEdit(()=>this._onDidAttemptReadOnlyEdit()))}_onDidAttemptReadOnlyEdit(){const e=Mo.get(this.editor);if(e&&this.editor.hasModel()){let t=this.editor.getOptions().get(93);t||(this.editor.isSimpleWidget?t=new lo(S("editor.simple.readonly","Cannot edit in read-only input")):t=new lo(S("editor.readonly","Cannot edit in read-only editor"))),e.showMessage(t,this.editor.getPosition())}}};DS.ID="editor.contrib.readOnlyMessageController";let Rv=DS;hn(Rv.ID,Rv,2);var h$=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},QD=function(o,e){return function(t,i){e(t,i,o)}};let ow=class extends Rt{constructor(e,t,i){super(),this._textModel=e,this._languageFeaturesService=t,this._outlineModelService=i,this._currentModel=Qo(this,void 0);const n=Pd("documentSymbolProvider.onDidChange",this._languageFeaturesService.documentSymbolProvider.onDidChange),s=Pd("_textModel.onDidChangeContent",Ts.debounce(r=>this._textModel.onDidChangeContent(r),()=>{},100));this._register(Lp(async(r,a)=>{n.read(r),s.read(r);const d=a.add(new n7),u=await this._outlineModelService.getOrCreate(this._textModel,d.token);a.isDisposed||this._currentModel.set(u,void 0)}))}getBreadcrumbItems(e,t){const i=this._currentModel.read(t);if(!i)return[];const n=i.asListOfDocumentSymbols().filter(s=>e.contains(s.range.startLineNumber)&&!e.contains(s.range.endLineNumber));return n.sort(i7(Tp(s=>s.range.endLineNumber-s.range.startLineNumber,K_))),n.map(s=>({name:s.name,kind:s.kind,startLineNumber:s.range.startLineNumber}))}};ow=h$([QD(1,Fi),QD(2,Qp)],ow);t7.setBreadcrumbsSourceFactory((o,e)=>e.createInstance(ow,o));const AS=class AS extends Rt{constructor(e){super(),this.editor=e,this.widget=null,s1&&(this._register(e.onDidChangeConfiguration(()=>this.update())),this.update())}update(){const e=!this.editor.getOption(92);!this.widget&&e?this.widget=new rw(this.editor):this.widget&&!e&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&(this.widget.dispose(),this.widget=null)}};AS.ID="editor.contrib.iPadShowKeyboard";let Nv=AS;const T_=class T_ extends Rt{constructor(e){super(),this.editor=e,this._domNode=document.createElement("textarea"),this._domNode.className="iPadShowKeyboard",this._register(Bn(this._domNode,"touchstart",t=>{this.editor.focus()})),this._register(Bn(this._domNode,"focus",t=>{this.editor.focus()})),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return T_.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}};T_.ID="editor.contrib.ShowKeyboardWidget";let rw=T_;hn(Nv.ID,Nv,3);var f$=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},JD=function(o,e){return function(t,i){e(t,i,o)}},aw,Du;let hp=(Du=class extends Rt{static get(e){return e.getContribution(aw.ID)}constructor(e,t,i){super(),this._editor=e,this._languageService=i,this._widget=null,this._register(this._editor.onDidChangeModel(n=>this.stop())),this._register(this._editor.onDidChangeModelLanguage(n=>this.stop())),this._register(X_.onDidChange(n=>this.stop())),this._register(this._editor.onKeyUp(n=>n.keyCode===9&&this.stop()))}dispose(){this.stop(),super.dispose()}launch(){this._widget||this._editor.hasModel()&&(this._widget=new lw(this._editor,this._languageService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}},aw=Du,Du.ID="editor.contrib.inspectTokens",Du);hp=aw=f$([JD(1,kk),JD(2,ha)],hp);class g$ extends Ct{constructor(){super({id:"editor.action.inspectTokens",label:a7.inspectTokensAction,alias:"Developer: Inspect Tokens",precondition:void 0})}run(e,t){const i=hp.get(t);i==null||i.launch()}}function p$(o){let e="";for(let t=0,i=o.length;t<i;t++){const n=o.charCodeAt(t);switch(n){case 9:e+="→";break;case 32:e+="·";break;default:e+=String.fromCharCode(n)}}return e}function x$(o,e){const t=X_.get(e);if(t)return t;const i=o.encodeLanguageId(e);return{getInitialState:()=>s7,tokenize:(n,s,r)=>r7(e,r),tokenizeEncoded:(n,s,r)=>o7(i,r)}}const M_=class M_ extends Rt{constructor(e,t){super(),this.allowEditorOverflow=!0,this._editor=e,this._languageService=t,this._model=this._editor.getModel(),this._domNode=document.createElement("div"),this._domNode.className="tokens-inspect-widget",this._tokenizationSupport=x$(this._languageService.languageIdCodec,this._model.getLanguageId()),this._compute(this._editor.getPosition()),this._register(this._editor.onDidChangeCursorPosition(i=>this._compute(this._editor.getPosition()))),this._editor.addContentWidget(this)}dispose(){this._editor.removeContentWidget(this),super.dispose()}getId(){return M_._ID}_compute(e){const t=this._getTokensAtLine(e.lineNumber);let i=0;for(let d=t.tokens1.length-1;d>=0;d--){const u=t.tokens1[d];if(e.column-1>=u.offset){i=d;break}}let n=0;for(let d=t.tokens2.length>>>1;d>=0;d--)if(e.column-1>=t.tokens2[d<<1]){n=d;break}const s=this._model.getLineContent(e.lineNumber);let r="";if(i<t.tokens1.length){const d=t.tokens1[i].offset,u=i+1<t.tokens1.length?t.tokens1[i+1].offset:s.length;r=s.substring(d,u)}Sm(this._domNode,mi("h2.tm-token",void 0,p$(r),mi("span.tm-token-length",void 0,`${r.length} ${r.length===1?"char":"chars"}`))),di(this._domNode,mi("hr.tokens-inspect-separator",{style:"clear:both"}));const a=(n<<1)+1<t.tokens2.length?this._decodeMetadata(t.tokens2[(n<<1)+1]):null;di(this._domNode,mi("table.tm-metadata-table",void 0,mi("tbody",void 0,mi("tr",void 0,mi("td.tm-metadata-key",void 0,"language"),mi("td.tm-metadata-value",void 0,`${a?a.languageId:"-?-"}`)),mi("tr",void 0,mi("td.tm-metadata-key",void 0,"token type"),mi("td.tm-metadata-value",void 0,`${a?this._tokenTypeToString(a.tokenType):"-?-"}`)),mi("tr",void 0,mi("td.tm-metadata-key",void 0,"font style"),mi("td.tm-metadata-value",void 0,`${a?this._fontStyleToString(a.fontStyle):"-?-"}`)),mi("tr",void 0,mi("td.tm-metadata-key",void 0,"foreground"),mi("td.tm-metadata-value",void 0,`${a?xn.Format.CSS.formatHex(a.foreground):"-?-"}`)),mi("tr",void 0,mi("td.tm-metadata-key",void 0,"background"),mi("td.tm-metadata-value",void 0,`${a?xn.Format.CSS.formatHex(a.background):"-?-"}`))))),di(this._domNode,mi("hr.tokens-inspect-separator")),i<t.tokens1.length&&di(this._domNode,mi("span.tm-token-type",void 0,t.tokens1[i].type)),this._editor.layoutContentWidget(this)}_decodeMetadata(e){const t=X_.getColorMap(),i=Tf.getLanguageId(e),n=Tf.getTokenType(e),s=Tf.getFontStyle(e),r=Tf.getForeground(e),a=Tf.getBackground(e);return{languageId:this._languageService.languageIdCodec.decodeLanguageId(i),tokenType:n,fontStyle:s,foreground:t[r],background:t[a]}}_tokenTypeToString(e){switch(e){case 0:return"Other";case 1:return"Comment";case 2:return"String";case 3:return"RegEx";default:return"??"}}_fontStyleToString(e){let t="";return e&1&&(t+="italic "),e&2&&(t+="bold "),e&4&&(t+="underline "),e&8&&(t+="strikethrough "),t.length===0&&(t="---"),t}_getTokensAtLine(e){const t=this._getStateBeforeLine(e),i=this._tokenizationSupport.tokenize(this._model.getLineContent(e),!0,t),n=this._tokenizationSupport.tokenizeEncoded(this._model.getLineContent(e),!0,t);return{startState:t,tokens1:i.tokens,tokens2:n.tokens,endState:i.endState}}_getStateBeforeLine(e){let t=this._tokenizationSupport.getInitialState();for(let i=1;i<e;i++)t=this._tokenizationSupport.tokenize(this._model.getLineContent(i),!0,t).endState;return t}getDomNode(){return this._domNode}getPosition(){return{position:this._editor.getPosition(),preference:[2,1]}}};M_._ID="editor.contrib.inspectTokensWidget";let lw=M_;hn(hp.ID,hp,4);Le(g$);var m$=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},e2=function(o,e){return function(t,i){e(t,i,o)}},sg,Au;let cw=(Au=class{constructor(e,t){this.quickInputService=e,this.keybindingService=t,this.registry=ca.as(Hp.Quickaccess)}provide(e){const t=new Tt;return t.add(e.onDidAccept(()=>{const[i]=e.selectedItems;i&&this.quickInputService.quickAccess.show(i.prefix,{preserveValue:!0})})),t.add(e.onDidChangeValue(i=>{const n=this.registry.getQuickAccessProvider(i.substr(sg.PREFIX.length));n&&n.prefix&&n.prefix!==sg.PREFIX&&this.quickInputService.quickAccess.show(n.prefix,{preserveValue:!0})})),e.items=this.getQuickAccessProviders().filter(i=>i.prefix!==sg.PREFIX),t}getQuickAccessProviders(){return this.registry.getQuickAccessProviders().sort((t,i)=>t.prefix.localeCompare(i.prefix)).flatMap(t=>this.createPicks(t))}createPicks(e){return e.helpEntries.map(t=>{const i=t.prefix||e.prefix,n=i||"…";return{prefix:i,label:n,keybinding:t.commandId?this.keybindingService.lookupKeybinding(t.commandId):void 0,ariaLabel:S("helpPickAriaLabel","{0}, {1}",n,t.description),description:t.description}})}},sg=Au,Au.PREFIX="?",Au);cw=sg=m$([e2(0,Tl),e2(1,As)],cw);ca.as(Hp.Quickaccess).registerQuickAccessProvider({ctor:cw,prefix:"",helpEntries:[{description:l7.helpQuickAccessActionLabel}]});class cF{constructor(e){this.options=e,this.rangeHighlightDecorationId=void 0}provide(e,t,i){var r;const n=new Tt;e.canAcceptInBackground=!!((r=this.options)!=null&&r.canAcceptInBackground),e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;const s=n.add(new er);return s.value=this.doProvide(e,t,i),n.add(this.onDidActiveTextEditorControlChange(()=>{s.value=void 0,s.value=this.doProvide(e,t)})),n}doProvide(e,t,i){const n=new Tt,s=this.activeTextEditorControl;if(s&&this.canProvideWithTextEditor(s)){const r={editor:s},a=Bk(s);if(a){let d=s.saveViewState()??void 0;n.add(a.onDidChangeCursorPosition(()=>{d=s.saveViewState()??void 0})),r.restoreViewState=()=>{d&&s===this.activeTextEditorControl&&s.restoreViewState(d)},n.add(Fk(t.onCancellationRequested)(()=>{var u;return(u=r.restoreViewState)==null?void 0:u.call(r)}))}n.add(is(()=>this.clearDecorations(s))),n.add(this.provideWithTextEditor(r,e,t,i))}else n.add(this.provideWithoutTextEditor(e,t));return n}canProvideWithTextEditor(e){return!0}gotoLocation({editor:e},t){e.setSelection(t.range,"code.jump"),e.revealRangeInCenter(t.range,0),t.preserveFocus||e.focus();const i=e.getModel();i&&"getLineContent"in i&&P0(`${i.getLineContent(t.range.startLineNumber)}`)}getModel(e){var t;return Ak(e)?(t=e.getModel())==null?void 0:t.modified:e.getModel()}addDecorations(e,t){e.changeDecorations(i=>{const n=[];this.rangeHighlightDecorationId&&(n.push(this.rangeHighlightDecorationId.overviewRulerDecorationId),n.push(this.rangeHighlightDecorationId.rangeHighlightId),this.rangeHighlightDecorationId=void 0);const s=[{range:t,options:{description:"quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:t,options:{description:"quick-access-range-highlight-overview",overviewRuler:{color:Fs(MA),position:Ha.Full}}}],[r,a]=i.deltaDecorations(n,s);this.rangeHighlightDecorationId={rangeHighlightId:r,overviewRulerDecorationId:a}})}clearDecorations(e){const t=this.rangeHighlightDecorationId;t&&(e.changeDecorations(i=>{i.deltaDecorations([t.overviewRulerDecorationId,t.rangeHighlightId],[])}),this.rangeHighlightDecorationId=void 0)}}const R_=class R_ extends cF{constructor(){super({canAcceptInBackground:!0})}provideWithoutTextEditor(e){const t=S("cannotRunGotoLine","Open a text editor first to go to a line.");return e.items=[{label:t}],e.ariaLabel=t,Rt.None}provideWithTextEditor(e,t,i){const n=e.editor,s=new Tt;s.add(t.onDidAccept(d=>{const[u]=t.selectedItems;if(u){if(!this.isValidLineNumber(n,u.lineNumber))return;this.gotoLocation(e,{range:this.toRange(u.lineNumber,u.column),keyMods:t.keyMods,preserveFocus:d.inBackground}),d.inBackground||t.hide()}}));const r=()=>{const d=this.parsePosition(n,t.value.trim().substr(R_.PREFIX.length)),u=this.getPickLabel(n,d.lineNumber,d.column);if(t.items=[{lineNumber:d.lineNumber,column:d.column,label:u}],t.ariaLabel=u,!this.isValidLineNumber(n,d.lineNumber)){this.clearDecorations(n);return}const f=this.toRange(d.lineNumber,d.column);n.revealRangeInCenter(f,0),this.addDecorations(n,f)};r(),s.add(t.onDidChangeValue(()=>r()));const a=Bk(n);return a&&a.getOptions().get(68).renderType===2&&(a.updateOptions({lineNumbers:"on"}),s.add(is(()=>a.updateOptions({lineNumbers:"relative"})))),s}toRange(e=1,t=1){return{startLineNumber:e,startColumn:t,endLineNumber:e,endColumn:t}}parsePosition(e,t){const i=t.split(/,|:|#/).map(s=>parseInt(s,10)).filter(s=>!isNaN(s)),n=this.lineCount(e)+1;return{lineNumber:i[0]>0?i[0]:n+i[0],column:i[1]}}getPickLabel(e,t,i){if(this.isValidLineNumber(e,t))return this.isValidColumn(e,t,i)?S("gotoLineColumnLabel","Go to line {0} and character {1}.",t,i):S("gotoLineLabel","Go to line {0}.",t);const n=e.getPosition()||{lineNumber:1,column:1},s=this.lineCount(e);return s>1?S("gotoLineLabelEmptyWithLimit","Current Line: {0}, Character: {1}. Type a line number between 1 and {2} to navigate to.",n.lineNumber,n.column,s):S("gotoLineLabelEmpty","Current Line: {0}, Character: {1}. Type a line number to navigate to.",n.lineNumber,n.column)}isValidLineNumber(e,t){return!t||typeof t!="number"?!1:t>0&&t<=this.lineCount(e)}isValidColumn(e,t,i){if(!i||typeof i!="number")return!1;const n=this.getModel(e);if(!n)return!1;const s={lineNumber:t,column:i};return n.validatePosition(s).equals(s)}lineCount(e){var t;return((t=this.getModel(e))==null?void 0:t.getLineCount())??0}};R_.PREFIX=":";let dw=R_;var v$=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},_$=function(o,e){return function(t,i){e(t,i,o)}};let fp=class extends dw{constructor(e){super(),this.editorService=e,this.onDidActiveTextEditorControlChange=Ts.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};fp=v$([_$(0,Cs)],fp);var ku;let dF=(ku=class extends Ct{constructor(){super({id:ku.ID,label:Lk.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:q.focus,primary:2085,mac:{primary:293},weight:100}})}run(e){e.get(Tl).quickAccess.show(fp.PREFIX)}},ku.ID="editor.action.gotoLine",ku);Le(dF);ca.as(Hp.Quickaccess).registerQuickAccessProvider({ctor:fp,prefix:fp.PREFIX,helpEntries:[{description:Lk.gotoLineActionLabel,commandId:dF.ID}]});const uF=[void 0,[]];function WC(o,e,t=0,i=0){const n=e;return n.values&&n.values.length>1?b$(o,n.values,t,i):hF(o,e,t,i)}function b$(o,e,t,i){let n=0;const s=[];for(const r of e){const[a,d]=hF(o,r,t,i);if(typeof a!="number")return uF;n+=a,s.push(...d)}return[n,C$(s)]}function hF(o,e,t,i){const n=ek(e.original,e.originalLowercase,t,o,o.toLowerCase(),i,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return n?[n[0],Z_(n)]:uF}function C$(o){const e=o.sort((n,s)=>n.start-s.start),t=[];let i;for(const n of e)!i||!E$(i,n)?(i=n,t.push(n)):(i.start=Math.min(i.start,n.start),i.end=Math.max(i.end,n.end));return t}function E$(o,e){return!(o.end<e.start||e.end<o.start)}function t2(o){return o.startsWith('"')&&o.endsWith('"')}const fF=" ";function uw(o){typeof o!="string"&&(o="");const e=o.toLowerCase(),{pathNormalized:t,normalized:i,normalizedLowercase:n}=i2(o),s=t.indexOf(h1)>=0,r=t2(o);let a;const d=o.split(fF);if(d.length>1)for(const u of d){const f=t2(u),{pathNormalized:g,normalized:p,normalizedLowercase:C}=i2(u);p&&(a||(a=[]),a.push({original:u,originalLowercase:u.toLowerCase(),pathNormalized:g,normalized:p,normalizedLowercase:C,expectContiguousMatch:f}))}return{original:o,originalLowercase:e,pathNormalized:t,normalized:i,normalizedLowercase:n,values:a,containsPathSeparator:s,expectContiguousMatch:r}}function i2(o){let e;W_?e=o.replace(/\//g,h1):e=o.replace(/\\/g,h1);const t=c7(e).replace(/\s|"/g,"");return{pathNormalized:e,normalized:t,normalizedLowercase:t.toLowerCase()}}function n2(o){return Array.isArray(o)?uw(o.map(e=>e.original).join(fF)):uw(o.original)}var y$=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},s2=function(o,e){return function(t,i){e(t,i,o)}},vm,ia;let zd=(ia=class extends cF{constructor(e,t,i=Object.create(null)){super(i),this._languageFeaturesService=e,this._outlineModelService=t,this.options=i,this.options.canAcceptInBackground=!0}provideWithoutTextEditor(e){return this.provideLabelPick(e,S("cannotRunGotoSymbolWithoutEditor","To go to a symbol, first open a text editor with symbol information.")),Rt.None}provideWithTextEditor(e,t,i,n){const s=e.editor,r=this.getModel(s);return r?this._languageFeaturesService.documentSymbolProvider.has(r)?this.doProvideWithEditorSymbols(e,r,t,i,n):this.doProvideWithoutEditorSymbols(e,r,t,i):Rt.None}doProvideWithoutEditorSymbols(e,t,i,n){const s=new Tt;return this.provideLabelPick(i,S("cannotRunGotoSymbolWithoutSymbolProvider","The active text editor does not provide symbol information.")),(async()=>!await this.waitForLanguageSymbolRegistry(t,s)||n.isCancellationRequested||s.add(this.doProvideWithEditorSymbols(e,t,i,n)))(),s}provideLabelPick(e,t){e.items=[{label:t,index:0,kind:14}],e.ariaLabel=t}async waitForLanguageSymbolRegistry(e,t){if(this._languageFeaturesService.documentSymbolProvider.has(e))return!0;const i=new z_,n=t.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>{this._languageFeaturesService.documentSymbolProvider.has(e)&&(n.dispose(),i.complete(!0))}));return t.add(is(()=>i.complete(!1))),i.p}doProvideWithEditorSymbols(e,t,i,n,s){var g;const r=e.editor,a=new Tt;a.add(i.onDidAccept(p=>{var b;const[C]=i.selectedItems;C&&C.range&&(this.gotoLocation(e,{range:C.range.selection,keyMods:i.keyMods,preserveFocus:p.inBackground}),(b=s==null?void 0:s.handleAccept)==null||b.call(s,C),p.inBackground||i.hide())})),a.add(i.onDidTriggerItemButton(({item:p})=>{p&&p.range&&(this.gotoLocation(e,{range:p.range.selection,keyMods:i.keyMods,forceSideBySide:!0}),i.hide())}));const d=this.getDocumentSymbols(t,n);let u;const f=async p=>{u==null||u.dispose(!0),i.busy=!1,u=new Gs(n),i.busy=!0;try{const C=uw(i.value.substr(vm.PREFIX.length).trim()),b=await this.doGetSymbolPicks(d,C,void 0,u.token,t);if(n.isCancellationRequested)return;if(b.length>0){if(i.items=b,p&&C.original.length===0){const y=f7(b,w=>!!(w.type!=="separator"&&w.range&&Q.containsPosition(w.range.decoration,p)));y&&(i.activeItems=[y])}}else C.original.length>0?this.provideLabelPick(i,S("noMatchingSymbolResults","No matching editor symbols")):this.provideLabelPick(i,S("noSymbolResults","No editor symbols"))}finally{n.isCancellationRequested||(i.busy=!1)}};return a.add(i.onDidChangeValue(()=>f(void 0))),f((g=r.getSelection())==null?void 0:g.getPosition()),a.add(i.onDidChangeActive(()=>{const[p]=i.activeItems;p&&p.range&&(r.revealRangeInCenter(p.range.selection,0),this.addDecorations(r,p.range.decoration))})),a}async doGetSymbolPicks(e,t,i,n,s){var w,A;const r=await e;if(n.isCancellationRequested)return[];const a=t.original.indexOf(vm.SCOPE_PREFIX)===0,d=a?1:0;let u,f;t.values&&t.values.length>1?(u=n2(t.values[0]),f=n2(t.values.slice(1))):u=t;let g;const p=(A=(w=this.options)==null?void 0:w.openSideBySideDirection)==null?void 0:A.call(w);p&&(g=[{iconClass:p==="right"?Rn.asClassName(Ki.splitHorizontal):Rn.asClassName(Ki.splitVertical),tooltip:p==="right"?S("openToSide","Open to the Side"):S("openToBottom","Open to the Bottom")}]);const C=[];for(let I=0;I<r.length;I++){const T=r[I],R=d7(T.name),P=`$(${u7.toIcon(T.kind).id}) ${R}`,V=P.length-R.length;let j=T.containerName;i!=null&&i.extraContainerLabel&&(j?j=`${i.extraContainerLabel} • ${j}`:j=i.extraContainerLabel);let J,ae,fe,X;if(t.original.length>d){let me=!1;if(u!==t&&([J,ae]=WC(P,{...t,values:void 0},d,V),typeof J=="number"&&(me=!0)),typeof J!="number"&&([J,ae]=WC(P,u,d,V),typeof J!="number"))continue;if(!me&&f){if(j&&f.original.length>0&&([fe,X]=WC(j,f)),typeof fe!="number")continue;typeof J=="number"&&(J+=fe)}}const ce=T.tags&&T.tags.indexOf(1)>=0;C.push({index:I,kind:T.kind,score:J,label:P,ariaLabel:h7(T.name,T.kind),description:j,highlights:ce?void 0:{label:ae,description:X},range:{selection:Q.collapseToStart(T.selectionRange),decoration:T.range},uri:s.uri,symbolName:R,strikethrough:ce,buttons:g})}const b=C.sort((I,T)=>a?this.compareByKindAndScore(I,T):this.compareByScore(I,T));let y=[];if(a){let P=function(){T&&typeof I=="number"&&R>0&&(T.label=Uw(VC[I]||zC,R))},I,T,R=0;for(const V of b)I!==V.kind?(P(),I=V.kind,R=1,T={type:"separator"},y.push(T)):R++,y.push(V);P()}else b.length>0&&(y=[{label:S("symbols","symbols ({0})",C.length),type:"separator"},...b]);return y}compareByScore(e,t){if(typeof e.score!="number"&&typeof t.score=="number")return 1;if(typeof e.score=="number"&&typeof t.score!="number")return-1;if(typeof e.score=="number"&&typeof t.score=="number"){if(e.score>t.score)return-1;if(e.score<t.score)return 1}return e.index<t.index?-1:e.index>t.index?1:0}compareByKindAndScore(e,t){const i=VC[e.kind]||zC,n=VC[t.kind]||zC,s=i.localeCompare(n);return s===0?this.compareByScore(e,t):s}async getDocumentSymbols(e,t){const i=await this._outlineModelService.getOrCreate(e,t);return t.isCancellationRequested?[]:i.asListOfDocumentSymbols()}},vm=ia,ia.PREFIX="@",ia.SCOPE_PREFIX=":",ia.PREFIX_BY_CATEGORY=`${ia.PREFIX}${ia.SCOPE_PREFIX}`,ia);zd=vm=y$([s2(0,Fi),s2(1,Qp)],zd);const zC=S("property","properties ({0})"),VC={5:S("method","methods ({0})"),11:S("function","functions ({0})"),8:S("_constructor","constructors ({0})"),12:S("variable","variables ({0})"),4:S("class","classes ({0})"),22:S("struct","structs ({0})"),23:S("event","events ({0})"),24:S("operator","operators ({0})"),10:S("interface","interfaces ({0})"),2:S("namespace","namespaces ({0})"),3:S("package","packages ({0})"),25:S("typeParameter","type parameters ({0})"),1:S("modules","modules ({0})"),6:S("property","properties ({0})"),9:S("enum","enumerations ({0})"),21:S("enumMember","enumeration members ({0})"),14:S("string","strings ({0})"),0:S("file","files ({0})"),17:S("array","arrays ({0})"),15:S("number","numbers ({0})"),16:S("boolean","booleans ({0})"),18:S("object","objects ({0})"),19:S("key","keys ({0})"),7:S("field","fields ({0})"),13:S("constant","constants ({0})")};var w$=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},jC=function(o,e){return function(t,i){e(t,i,o)}};let hw=class extends zd{constructor(e,t,i){super(t,i),this.editorService=e,this.onDidActiveTextEditorControlChange=Ts.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};hw=w$([jC(0,Cs),jC(1,Fi),jC(2,Qp)],hw);const N_=class N_ extends Ct{constructor(){super({id:N_.ID,label:f1.quickOutlineActionLabel,alias:"Go to Symbol...",precondition:q.hasDocumentSymbolProvider,kbOpts:{kbExpr:q.focus,primary:3117,weight:100},contextMenuOpts:{group:"navigation",order:3}})}run(e){e.get(Tl).quickAccess.show(zd.PREFIX,{itemActivation:g7.NONE})}};N_.ID="editor.action.quickOutline";let Ov=N_;Le(Ov);ca.as(Hp.Quickaccess).registerQuickAccessProvider({ctor:hw,prefix:zd.PREFIX,helpEntries:[{description:f1.quickOutlineActionLabel,prefix:zd.PREFIX,commandId:Ov.ID},{description:f1.quickOutlineByCategoryActionLabel,prefix:zd.PREFIX_BY_CATEGORY}]});function S$(o){const e=new Map;for(const t of o)e.set(t,(e.get(t)??0)+1);return e}class yg{constructor(){this.chunkCount=0,this.chunkOccurrences=new Map,this.documents=new Map}calculateScores(e,t){const i=this.computeEmbedding(e),n=new Map,s=[];for(const[r,a]of this.documents){if(t.isCancellationRequested)return[];for(const d of a.chunks){const u=this.computeSimilarityScore(d,i,n);u>0&&s.push({key:r,score:u})}}return s}static termFrequencies(e){return S$(yg.splitTerms(e))}static*splitTerms(e){const t=i=>i.toLowerCase();for(const[i]of e.matchAll(new RegExp("\\b\\p{Letter}[\\p{Letter}\\d]{2,}\\b","gu"))){yield t(i);const n=i.replace(/([a-z])([A-Z])/g,"$1 $2").split(/\s+/g);if(n.length>1)for(const s of n)s.length>2&&new RegExp("\\p{Letter}{3,}","gu").test(s)&&(yield t(s))}}updateDocuments(e){for(const{key:t}of e)this.deleteDocument(t);for(const t of e){const i=[];for(const n of t.textChunks){const s=yg.termFrequencies(n);for(const r of s.keys())this.chunkOccurrences.set(r,(this.chunkOccurrences.get(r)??0)+1);i.push({text:n,tf:s})}this.chunkCount+=i.length,this.documents.set(t.key,{chunks:i})}return this}deleteDocument(e){const t=this.documents.get(e);if(t){this.documents.delete(e),this.chunkCount-=t.chunks.length;for(const i of t.chunks)for(const n of i.tf.keys()){const s=this.chunkOccurrences.get(n);if(typeof s=="number"){const r=s-1;r<=0?this.chunkOccurrences.delete(n):this.chunkOccurrences.set(n,r)}}}}computeSimilarityScore(e,t,i){let n=0;for(const[s,r]of Object.entries(t)){const a=e.tf.get(s);if(!a)continue;let d=i.get(s);typeof d!="number"&&(d=this.computeIdf(s),i.set(s,d));const u=a*d;n+=u*r}return n}computeEmbedding(e){const t=yg.termFrequencies(e);return this.computeTfidf(t)}computeIdf(e){const t=this.chunkOccurrences.get(e)??0;return t>0?Math.log((this.chunkCount+1)/t):0}computeTfidf(e){const t=Object.create(null);for(const[i,n]of e){const s=this.computeIdf(i);s>0&&(t[i]=n*s)}return t}}function D$(o){var i;const e=o.slice(0);e.sort((n,s)=>s.score-n.score);const t=((i=e[0])==null?void 0:i.score)??0;if(t>0)for(const n of e)n.score/=t;return e}var Qh;(function(o){o[o.NO_ACTION=0]="NO_ACTION",o[o.CLOSE_PICKER=1]="CLOSE_PICKER",o[o.REFRESH_PICKER=2]="REFRESH_PICKER",o[o.REMOVE_ITEM=3]="REMOVE_ITEM"})(Qh||(Qh={}));function $C(o){return Array.isArray(o.items)}function o2(o){const e=o;return!!e.picks&&e.additionalPicks instanceof Promise}class A$ extends Rt{constructor(e,t){super(),this.prefix=e,this.options=t}provide(e,t,i){var u;const n=new Tt;e.canAcceptInBackground=!!((u=this.options)!=null&&u.canAcceptInBackground),e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;let s;const r=n.add(new er),a=async()=>{var w;const f=r.value=new Tt;s==null||s.dispose(!0),e.busy=!1,s=new Gs(t);const g=s.token;let p=e.value.substring(this.prefix.length);(w=this.options)!=null&&w.shouldSkipTrimPickFilter||(p=p.trim());const C=this._getPicks(p,f,g,i),b=(A,I)=>{var P;let T,R;if($C(A)?(T=A.items,R=A.active):T=A,T.length===0){if(I)return!1;(p.length>0||e.hideInput)&&((P=this.options)!=null&&P.noResultsPick)&&(p7(this.options.noResultsPick)?T=[this.options.noResultsPick(p)]:T=[this.options.noResultsPick])}return e.items=T,R&&(e.activeItems=[R]),!0},y=async A=>{let I=!1,T=!1;await Promise.all([(async()=>{typeof A.mergeDelay=="number"&&(await J_(A.mergeDelay),g.isCancellationRequested)||T||(I=b(A.picks,!0))})(),(async()=>{e.busy=!0;try{const R=await A.additionalPicks;if(g.isCancellationRequested)return;let P,V;$C(A.picks)?(P=A.picks.items,V=A.picks.active):P=A.picks;let j,J;if($C(R)?(j=R.items,J=R.active):j=R,j.length>0||!I){let ae;if(!V&&!J){const fe=e.activeItems[0];fe&&P.indexOf(fe)!==-1&&(ae=fe)}b({items:[...P,...j],active:V||J||ae})}}finally{g.isCancellationRequested||(e.busy=!1),T=!0}})()])};if(C!==null)if(o2(C))await y(C);else if(!(C instanceof Promise))b(C);else{e.busy=!0;try{const A=await C;if(g.isCancellationRequested)return;o2(A)?await y(A):b(A)}finally{g.isCancellationRequested||(e.busy=!1)}}};n.add(e.onDidChangeValue(()=>a())),a(),n.add(e.onDidAccept(f=>{var p;if(i!=null&&i.handleAccept){f.inBackground||e.hide(),(p=i.handleAccept)==null||p.call(i,e.activeItems[0]);return}const[g]=e.selectedItems;typeof(g==null?void 0:g.accept)=="function"&&(f.inBackground||e.hide(),g.accept(e.keyMods,f))}));const d=async(f,g)=>{var C;if(typeof g.trigger!="function")return;const p=((C=g.buttons)==null?void 0:C.indexOf(f))??-1;if(p>=0){const b=g.trigger(p,e.keyMods),y=typeof b=="number"?b:await b;if(t.isCancellationRequested)return;switch(y){case Qh.NO_ACTION:break;case Qh.CLOSE_PICKER:e.hide();break;case Qh.REFRESH_PICKER:a();break;case Qh.REMOVE_ITEM:{const w=e.items.indexOf(g);if(w!==-1){const A=e.items.slice(),I=A.splice(w,1),T=e.activeItems.filter(P=>P!==I[0]),R=e.keepScrollPosition;e.keepScrollPosition=!0,e.items=A,T&&(e.activeItems=T),e.keepScrollPosition=R}break}}}};return n.add(e.onDidTriggerItemButton(({button:f,item:g})=>d(f,g))),n.add(e.onDidTriggerSeparatorButton(({button:f,separator:g})=>d(f,g))),n}}var gF=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},rc=function(o,e){return function(t,i){e(t,i,o)}},xd,ys,Ma;let fw=(Ma=class extends A${constructor(e,t,i,n,s,r){super(xd.PREFIX,e),this.instantiationService=t,this.keybindingService=i,this.commandService=n,this.telemetryService=s,this.dialogService=r,this.commandsHistory=this._register(this.instantiationService.createInstance(gw)),this.options=e}async _getPicks(e,t,i,n){var C,b;const s=await this.getCommandPicks(i);if(i.isCancellationRequested)return[];const r=Fk(()=>{const y=new yg;y.updateDocuments(s.map(A=>({key:A.commandId,textChunks:[this.getTfIdfChunk(A)]})));const w=y.calculateScores(e,i);return D$(w).filter(A=>A.score>xd.TFIDF_THRESHOLD).slice(0,xd.TFIDF_MAX_RESULTS)}),a=[];for(const y of s){const w=xd.WORD_FILTER(e,y.label)??void 0,A=y.commandAlias?xd.WORD_FILTER(e,y.commandAlias)??void 0:void 0;if(w||A)y.highlights={label:w,detail:this.options.showAlias?A:void 0},a.push(y);else if(e===y.commandId)a.push(y);else if(e.length>=3){const I=r();if(i.isCancellationRequested)return[];const T=I.find(R=>R.key===y.commandId);T&&(y.tfIdfScore=T.score,a.push(y))}}const d=new Map;for(const y of a){const w=d.get(y.label);w?(y.description=y.commandId,w.description=w.commandId):d.set(y.label,y)}a.sort((y,w)=>{if(y.tfIdfScore&&w.tfIdfScore)return y.tfIdfScore===w.tfIdfScore?y.label.localeCompare(w.label):w.tfIdfScore-y.tfIdfScore;if(y.tfIdfScore)return 1;if(w.tfIdfScore)return-1;const A=this.commandsHistory.peek(y.commandId),I=this.commandsHistory.peek(w.commandId);if(A&&I)return A>I?-1:1;if(A)return-1;if(I)return 1;if(this.options.suggestedCommandIds){const T=this.options.suggestedCommandIds.has(y.commandId),R=this.options.suggestedCommandIds.has(w.commandId);if(T&&R)return 0;if(T)return-1;if(R)return 1}return y.label.localeCompare(w.label)});const u=[];let f=!1,g=!0,p=!!this.options.suggestedCommandIds;for(let y=0;y<a.length;y++){const w=a[y];y===0&&this.commandsHistory.peek(w.commandId)&&(u.push({type:"separator",label:S("recentlyUsed","recently used")}),f=!0),g&&w.tfIdfScore!==void 0&&(u.push({type:"separator",label:S("suggested","similar commands")}),g=!1),p&&w.tfIdfScore===void 0&&!this.commandsHistory.peek(w.commandId)&&((C=this.options.suggestedCommandIds)!=null&&C.has(w.commandId))&&(u.push({type:"separator",label:S("commonlyUsed","commonly used")}),f=!0,p=!1),f&&w.tfIdfScore===void 0&&!this.commandsHistory.peek(w.commandId)&&!((b=this.options.suggestedCommandIds)!=null&&b.has(w.commandId))&&(u.push({type:"separator",label:S("morecCommands","other commands")}),f=!1),u.push(this.toCommandPick(w,n))}return this.hasAdditionalCommandPicks(e,i)?{picks:u,additionalPicks:(async()=>{var A;const y=await this.getAdditionalCommandPicks(s,a,e,i);if(i.isCancellationRequested)return[];const w=y.map(I=>this.toCommandPick(I,n));return g&&((A=w[0])==null?void 0:A.type)!=="separator"&&w.unshift({type:"separator",label:S("suggested","similar commands")}),w})()}:u}toCommandPick(e,t){if(e.type==="separator")return e;const i=this.keybindingService.lookupKeybinding(e.commandId),n=i?S("commandPickAriaLabelWithKeybinding","{0}, {1}",e.label,i.getAriaLabel()):e.label;return{...e,ariaLabel:n,detail:this.options.showAlias&&e.commandAlias!==e.label?e.commandAlias:void 0,keybinding:i,accept:async()=>{var s;this.commandsHistory.push(e.commandId),this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.commandId,from:(t==null?void 0:t.from)??"quick open"});try{(s=e.args)!=null&&s.length?await this.commandService.executeCommand(e.commandId,...e.args):await this.commandService.executeCommand(e.commandId)}catch(r){qc(r)||this.dialogService.error(S("canNotRun","Command '{0}' resulted in an error",e.label),$m(r))}}}}getTfIdfChunk({label:e,commandAlias:t,commandDescription:i}){let n=e;return t&&t!==e&&(n+=` - ${t}`),i&&i.value!==e&&(n+=` - ${i.value===i.original?i.value:`${i.value} (${i.original})`}`),n}},xd=Ma,Ma.PREFIX=">",Ma.TFIDF_THRESHOLD=.5,Ma.TFIDF_MAX_RESULTS=5,Ma.WORD_FILTER=x7(_7,v7,m7),Ma);fw=xd=gF([rc(1,sn),rc(2,As),rc(3,Vs),rc(4,ua),rc(5,i9)],fw);var na;let gw=(na=class extends Rt{constructor(e,t,i){super(),this.storageService=e,this.configurationService=t,this.logService=i,this.configuredCommandsHistoryLength=0,this.updateConfiguration(),this.load(),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.updateConfiguration(e))),this._register(this.storageService.onWillSaveState(e=>{e.reason===Nw.SHUTDOWN&&this.saveState()}))}updateConfiguration(e){e&&!e.affectsConfiguration("workbench.commandPalette.history")||(this.configuredCommandsHistoryLength=ys.getConfiguredCommandHistoryLength(this.configurationService),ys.cache&&ys.cache.limit!==this.configuredCommandsHistoryLength&&(ys.cache.limit=this.configuredCommandsHistoryLength,ys.hasChanges=!0))}load(){const e=this.storageService.get(ys.PREF_KEY_CACHE,0);let t;if(e)try{t=JSON.parse(e)}catch(n){this.logService.error(`[CommandsHistory] invalid data: ${n}`)}const i=ys.cache=new Bp(this.configuredCommandsHistoryLength,1);if(t){let n;t.usesLRU?n=t.entries:n=t.entries.sort((s,r)=>s.value-r.value),n.forEach(s=>i.set(s.key,s.value))}ys.counter=this.storageService.getNumber(ys.PREF_KEY_COUNTER,0,ys.counter)}push(e){ys.cache&&(ys.cache.set(e,ys.counter++),ys.hasChanges=!0)}peek(e){var t;return(t=ys.cache)==null?void 0:t.peek(e)}saveState(){if(!ys.cache||!ys.hasChanges)return;const e={usesLRU:!0,entries:[]};ys.cache.forEach((t,i)=>e.entries.push({key:i,value:t})),this.storageService.store(ys.PREF_KEY_CACHE,JSON.stringify(e),0,0),this.storageService.store(ys.PREF_KEY_COUNTER,ys.counter,0,0),ys.hasChanges=!1}static getConfiguredCommandHistoryLength(e){var n,s;const i=(s=(n=e.getValue().workbench)==null?void 0:n.commandPalette)==null?void 0:s.history;return typeof i=="number"?i:ys.DEFAULT_COMMANDS_HISTORY_LENGTH}},ys=na,na.DEFAULT_COMMANDS_HISTORY_LENGTH=50,na.PREF_KEY_CACHE="commandPalette.mru.cache",na.PREF_KEY_COUNTER="commandPalette.mru.counter",na.counter=1,na.hasChanges=!1,na);gw=ys=gF([rc(0,Gc),rc(1,ss),rc(2,Yu)],gw);class k$ extends fw{constructor(e,t,i,n,s,r){super(e,t,i,n,s,r)}getCodeEditorCommandPicks(){var i;const e=this.activeTextEditorControl;if(!e)return[];const t=[];for(const n of e.getSupportedActions()){let s;(i=n.metadata)!=null&&i.description&&(b7(n.metadata.description)?s=n.metadata.description:s={original:n.metadata.description,value:n.metadata.description}),t.push({commandId:n.id,commandAlias:n.alias,commandDescription:s,label:C7(n.label)||n.id})}return t}}var B$=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Fh=function(o,e){return function(t,i){e(t,i,o)}};let gp=class extends k${get activeTextEditorControl(){return this.codeEditorService.getFocusedCodeEditor()??void 0}constructor(e,t,i,n,s,r){super({showAlias:!1},e,i,n,s,r),this.codeEditorService=t}async getCommandPicks(){return this.getCodeEditorCommandPicks()}hasAdditionalCommandPicks(){return!1}async getAdditionalCommandPicks(){return[]}};gp=B$([Fh(0,sn),Fh(1,Cs),Fh(2,As),Fh(3,Vs),Fh(4,ua),Fh(5,i9)],gp);const O_=class O_ extends Ct{constructor(){super({id:O_.ID,label:Ik.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:q.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(e){e.get(Tl).quickAccess.show(gp.PREFIX)}};O_.ID="editor.action.quickCommand";let Hv=O_;Le(Hv);ca.as(Hp.Quickaccess).registerQuickAccessProvider({ctor:gp,prefix:gp.PREFIX,helpEntries:[{description:Ik.quickCommandHelp,commandId:Hv.ID}]});var F$=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Lh=function(o,e){return function(t,i){e(t,i,o)}};let pw=class extends Vu{constructor(e,t,i,n,s,r,a){super(!0,e,t,i,n,s,r,a)}};pw=F$([Lh(1,Fn),Lh(2,Cs),Lh(3,mo),Lh(4,sn),Lh(5,Gc),Lh(6,ss)],pw);hn(Vu.ID,pw,4);class L$ extends Ct{constructor(){super({id:"editor.action.toggleHighContrast",label:E7.toggleHighContrast,alias:"Toggle High Contrast Theme",precondition:void 0}),this._originalThemeName=null}run(e,t){const i=e.get(kk),n=i.getColorTheme();Fg(n.type)?(i.setTheme(this._originalThemeName||(r8(n.type)?y7:w7)),this._originalThemeName=null):(i.setTheme(r8(n.type)?S7:D7),this._originalThemeName=n.themeName)}}Le(L$);const pF="she-theme";function I$(){return localStorage.getItem(pF)??"system"}function P$(o){localStorage.setItem(pF,o);const e=document.documentElement;o==="system"?e.removeAttribute("data-theme"):e.setAttribute("data-theme",o),window.dispatchEvent(new CustomEvent("she:theme-changed"))}function Jh(){const o=document.documentElement.getAttribute("data-theme");return o==="light"?"vs":o==="dark"||window.matchMedia("(prefers-color-scheme: dark)").matches?"vs-dark":"vs"}let xw=null;function T$(o){xw=o}function M$(o={}){return{"Content-Type":"application/json",...o}}async function $t(o,e,t){const i=await fetch(e,{method:o,headers:M$(),body:t!==void 0?JSON.stringify(t):void 0});if(i.status===401)throw xw&&xw(),new Error("Unauthorized");if(!i.ok){const n=await i.json().catch(()=>({error:i.statusText}));throw new Error(n.error??i.statusText)}return i.json()}async function R$(){return await(await fetch("/she/auth/mode")).json()}async function N$(o){const e=await fetch("/she/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:o})});if(!e.ok){const t=await e.json().catch(()=>({error:e.statusText}));throw new Error(t.error??"Login failed")}}async function O$(){await fetch("/she/auth/logout",{method:"POST"})}async function H$(o,e,t,i){const n=await fetch("/she/auth/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:o,password:e,proxyHeader:t,proxyLogoutUrl:i})});if(!n.ok){const s=await n.json().catch(()=>({error:n.statusText}));throw new Error(s.error??"Setup failed")}}function W$(){return $t("GET","/she/scripts/tree")}function Vx(o){return $t("GET",`/she/scripts/${o}`)}function Ql(o,e){return $t("PUT",`/she/scripts/${o}`,{content:e})}function r2(o,e={}){const t=new URLSearchParams({q:o});return e.regex&&t.set("regex","true"),e.caseSensitive&&t.set("caseSensitive","true"),e.mode&&t.set("mode",e.mode),$t("GET",`/she/scripts/search?${t}`)}function jx(o){return $t("DELETE",`/she/scripts/${o}`)}function a2(o,e){return $t("POST",`/she/scripts/${o}/rename`,{newPath:e})}function z$(o){return $t("POST","/she/scripts/mkdir",{path:o})}function V$(){return $t("GET","/she/git/status")}function e0(){return $t("GET","/she/status")}function xF(){return $t("POST","/she/restart")}function j$(){return $t("POST","/she/update")}function $$(){return $t("POST","/she/check-update")}function U$(o,e){return $t("POST","/she/git/commit",{path:o,message:e})}function l2(o,e){return $t("POST","/she/git/commit",{files:o,message:e})}function c2(o){return $t("POST","/she/git/commit",{message:o})}function $x(o){return $t("POST","/she/git/push",{remote:o})}function q$(o,e){return $t("GET",`/she/git/log?path=${encodeURIComponent(o)}&limit=${e}`)}function G$(o,e){return $t("GET",`/she/git/show?hash=${encodeURIComponent(o)}&path=${encodeURIComponent(e)}`)}function Pl(){return $t("GET","/she/config")}function pp(o){return $t("PUT","/she/config",o)}function oh(o){return o.split("/").map(encodeURIComponent).join("/")}function mF(){return $t("GET","/she/db/docs")}function K$(o){return $t("GET",`/she/db/docs/${oh(o)}`)}function d2(o,e){return $t("PUT",`/she/db/docs/${oh(o)}`,e)}function Z$(o){return $t("DELETE",`/she/db/docs/${oh(o)}`)}function vF(){return $t("GET","/she/db/views")}function X$(o){return $t("GET",`/she/db/views/${oh(o)}`)}function u2(o,e){return $t("PUT",`/she/db/views/${oh(o)}`,e)}function Y$(o){return $t("DELETE",`/she/db/views/${oh(o)}`)}function Q$(){return $t("GET","/she/deps")}function J$(o){return $t("GET",`/she/deps/search?q=${encodeURIComponent(o)}`)}function eU(o,e){return $t("POST","/she/deps/install",{name:o,version:null})}function tU(o){return $t("POST","/she/deps/remove",{name:o})}function iU(o){return $t("POST","/she/deps/update",{name:o})}function _F(){return $t("GET","/she/deps/outdated")}function nU(){return $t("POST","/she/deps/check-outdated")}function sU(){return $t("GET","/she/ai/conversations")}function h2(o){return $t("GET",`/she/ai/conversations/${encodeURIComponent(o)}`)}function oU(o,e,t){return $t("PUT",`/she/ai/conversations/${encodeURIComponent(o)}`,{title:e,messages:t})}function rU(o){return $t("DELETE",`/she/ai/conversations/${encodeURIComponent(o)}`)}function UC(o){return $t("GET",`/she/db/views/${oh(o)}/result`)}function cS(){return $t("GET","/she/matter/devices")}function _m(o){return $t("GET",`/she/matter/devices/${o}`)}function aU(o){return $t("POST","/she/matter/commission",o)}function lU(o){return $t("DELETE",`/she/matter/devices/${o}`)}function cU(o,e,t,i,n){return $t("POST",`/she/matter/devices/${o}/command`,{endpointId:e,clusterName:t,command:i,args:n})}function bF(){return $t("GET","/she/mqtt/state")}function f2(o,e,t=!1,i=0){return $t("POST","/she/mqtt/publish",{topic:o,payload:e,retain:t,qos:i})}function CF(){return $t("GET","/she/ai/config")}function EF(){return $t("GET","/she/ai/models")}function mw(o){return $t("GET",`/she/ai/model-info?model=${encodeURIComponent(o)}`)}function yF(o){return $t("POST","/she/ai/prompt",o)}async function wF(o,e,t,i){const s=await fetch("/she/ai/chat/stream",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o),signal:t});if(!s.ok){const u=await s.json().catch(()=>({error:s.statusText}));throw new Error(u.error??s.statusText)}const r=s.body.getReader(),a=new TextDecoder;let d="";try{for(;;){const{done:u,value:f}=await r.read();if(u)break;d+=a.decode(f,{stream:!0});const g=d.split(`
79
+ `);d=g.pop()??"";for(const p of g){if(!p.startsWith("data: "))continue;const C=p.slice(6).trim();if(C==="[DONE]")return;try{const b=JSON.parse(C);if(b.error)throw new Error(b.error);if(b.type==="tool_call"||b.type==="tool_result"){i==null||i({type:b.type,name:b.name??"",args:b.args,content:b.content});continue}b.token&&e(b.token)}catch(b){if(b instanceof SyntaxError)continue;throw b}}}}finally{r.releaseLock()}}function Pb(){return $t("GET","/she/broker/status")}function dU(){return $t("GET","/she/broker/local/check")}function uU(){return $t("GET","/she/broker/ip-addresses")}function dS(){return $t("GET","/she/broker/config")}function hU(o=500){return $t("GET",`/she/broker/logs?limit=${o}`)}function SF(o){return $t("PUT","/she/broker/config",o)}function DF(){return $t("POST","/she/broker/reload")}function fU(){return $t("POST","/she/broker/restart")}function gU(){return $t("POST","/she/broker/wizard/deactivate")}function pU(){return $t("POST","/she/broker/wizard/reinit")}function xU(){return $t("GET","/she/broker/wizard/diagnose")}function mU(){return $t("GET","/she/broker/users")}function vU(o,e){return $t("POST","/she/broker/users",{username:o,password:e})}function _U(o){return $t("DELETE",`/she/broker/users/${encodeURIComponent(o)}`)}function bU(o,e){return $t("PUT",`/she/broker/users/${encodeURIComponent(o)}/password`,{password:e})}function CU(o,e){return $t("POST",`/she/broker/users/${encodeURIComponent(o)}/roles`,{rolename:e})}function EU(o,e){return $t("DELETE",`/she/broker/users/${encodeURIComponent(o)}/roles/${encodeURIComponent(e)}`)}function AF(){return $t("GET","/she/broker/roles")}function yU(o){return $t("POST","/she/broker/roles",{rolename:o})}function wU(o){return $t("DELETE",`/she/broker/roles/${encodeURIComponent(o)}`)}function SU(o,e){return $t("POST",`/she/broker/roles/${encodeURIComponent(o)}/acls`,e)}function DU(o,e,t){return $t("DELETE",`/she/broker/roles/${encodeURIComponent(o)}/acls`,{acltype:e,topic:t})}function AU(){return $t("GET","/she/broker/groups")}function kU(o){return $t("POST","/she/broker/groups",{groupname:o})}function BU(o){return $t("DELETE",`/she/broker/groups/${encodeURIComponent(o)}`)}function g2(o,e){return $t("POST",`/she/broker/groups/${encodeURIComponent(o)}/clients`,{username:e})}function p2(o,e){return $t("DELETE",`/she/broker/groups/${encodeURIComponent(o)}/clients/${encodeURIComponent(e)}`)}function FU(o,e){return $t("POST",`/she/broker/groups/${encodeURIComponent(o)}/roles`,{rolename:e})}function LU(o,e){return $t("DELETE",`/she/broker/groups/${encodeURIComponent(o)}/roles/${encodeURIComponent(e)}`)}function IU(){return $t("GET","/she/broker/acl-defaults")}function PU(o){return $t("PUT","/she/broker/acl-defaults",{acls:o})}function TU(o){return $t("GET",`/she/broker/acl-check?${new URLSearchParams({topic:o})}`)}function MU(){return $t("GET","/she/broker/anonymous-group")}function RU(o){return $t("PUT","/she/broker/anonymous-group",{groupname:o})}function NU(){return $t("GET","/she/broker/ca/server")}function OU(o){return $t("POST","/she/broker/ca/server/generate",o)}function HU(o){return $t("POST","/she/broker/ca/server/csr",o)}function qC(o){return $t("POST","/she/broker/ca/server/import",o)}function WU(){return $t("GET","/she/broker/ca/trusted")}function zU(o){return $t("POST","/she/broker/ca/trusted",{pem:o})}function VU(o){return $t("DELETE",`/she/broker/ca/trusted/${encodeURIComponent(o)}`)}function jU(o){return $t("GET",`/she/broker/fs/complete?path=${encodeURIComponent(o)}`)}function $U(o){return $t("POST","/she/broker/ca/server/pathlink",o)}function UU(o){return $t("POST","/she/broker/ca/trusted/addpath",{path:o})}const qU=2e3,bm=[],GU=500,Cm=[];function kF(){return bm.slice()}function KU(){return Cm.slice()}let xc=null;const Wv=new Set,t0=new Map;let vw=null;function xp(){let o=Wv.size;for(const e of t0.values())o+=e.size;return o}function ZU(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/she/ws`}function uS(){if(xc)return;const o=ZU(),e=new WebSocket(o);xc=e,e.onmessage=t=>{try{const i=JSON.parse(t.data);if(i.type==="log"){const s={level:i.level,msg:i.msg,ts:i.ts};bm.length>=qU&&bm.shift(),bm.push(s),Wv.forEach(r=>r(s))}if(i.type==="brokerLog"){const s={level:i.level,msg:i.msg,ts:i.ts};Cm.length>=GU&&Cm.shift(),Cm.push(s)}const n=t0.get(i.type);n&&n.forEach(s=>s(i))}catch{}},e.onclose=()=>{xc===e&&(xc=null),xp()>0&&(vw=setTimeout(uS,3e3))},e.onerror=()=>{e.close()}}function BF(){vw&&clearTimeout(vw),xc==null||xc.close(),xc=null}function hS(o){return Wv.add(o),xp()===1&&uS(),()=>{Wv.delete(o),xp()===0&&BF()}}function Xo(o,e){return t0.has(o)||t0.set(o,new Set),t0.get(o).add(e),xp()===1&&uS(),()=>{var t;(t=t0.get(o))==null||t.delete(e),xp()===0&&BF()}}var XU=B('<button class="cancel svelte-1eh8v5n">Cancel</button>'),YU=B('<div class="backdrop svelte-1eh8v5n" role="presentation"></div> <div class="dialog svelte-1eh8v5n" role="dialog" aria-modal="true"><p class="svelte-1eh8v5n"> </p> <div class="actions svelte-1eh8v5n"><!> <button> </button></div></div>',1);function Yc(o,e){$s(e,!0);let t=F(!1),i=F(""),n=F("Confirm"),s=F(!1),r=F(!1),a=null;function d(y,w){return m(i,y,!0),m(n,(w==null?void 0:w.confirm)??(w!=null&&w.alert?"OK":"Confirm"),!0),m(s,(w==null?void 0:w.danger)??!1,!0),m(r,(w==null?void 0:w.alert)??!1,!0),m(t,!0),new Promise(A=>a=A)}function u(y){m(t,!1),a==null||a(y),a=null}function f(y){c(t)&&(y.key==="Escape"&&u(!1),y.key==="Enter"&&u(!0))}var g={show:d},p=Ss();xs("keydown",Rd,f);var C=Et(p);{var b=y=>{var w=YU(),A=Et(w),I=v(A,2),T=_(I),R=_(T),P=v(T,2),V=_(P);{var j=X=>{var ce=XU();$("click",ce,()=>u(!1)),D(X,ce)};H(V,X=>{c(r)||X(j)})}var J=v(V,2);let ae;var fe=_(J);z(()=>{W(R,c(i)),ae=At(J,1,"svelte-1eh8v5n",null,ae,{danger:c(s)}),W(fe,c(n))}),$("click",A,()=>u(!1)),$("click",J,()=>u(!0)),D(y,w)};H(C,y=>{c(t)&&y(b)})}return D(o,p),Us(g)}Ys(["click"]);var QU=B('<div class="backdrop svelte-1vi95tb" role="presentation"></div> <div class="dialog svelte-1vi95tb" role="dialog" aria-modal="true"><p class="svelte-1vi95tb"> </p> <input class="svelte-1vi95tb"/> <div class="actions svelte-1vi95tb"><button class="cancel svelte-1vi95tb">Cancel</button> <button class="svelte-1vi95tb"> </button></div></div>',1);function JU(o,e){$s(e,!0);let t=F(!1),i=F(""),n=F(""),s=F("OK"),r=F(""),a=null,d=F(void 0);function u(A,I){return m(i,A,!0),m(n,(I==null?void 0:I.placeholder)??"",!0),m(s,(I==null?void 0:I.confirm)??"OK",!0),m(r,(I==null?void 0:I.initial)??"",!0),m(t,!0),setTimeout(()=>{if(c(d)){c(d).focus();const T=c(d).value.length;c(d).setSelectionRange(T,T)}},0),new Promise(T=>a=T)}function f(){const A=c(r).trim();A&&(m(t,!1),a==null||a(A),a=null,m(r,""))}function g(){m(t,!1),a==null||a(null),a=null,m(r,"")}function p(A){c(t)&&A.key==="Escape"&&(A.stopPropagation(),g())}var C={show:u},b=Ss();xs("keydown",Rd,p);var y=Et(b);{var w=A=>{var I=QU(),T=Et(I),R=v(T,2),P=_(R),V=_(P),j=v(P,2);gs(j,ce=>m(d,ce),()=>c(d));var J=v(j,2),ae=_(J),fe=v(ae,2),X=_(fe);z(ce=>{W(V,c(i)),ln(j,"placeholder",c(n)),fe.disabled=ce,W(X,c(s))},[()=>!c(r).trim()]),$("click",T,g),$("keydown",j,ce=>{ce.key==="Enter"&&(ce.preventDefault(),f())}),zt(j,()=>c(r),ce=>m(r,ce)),$("click",ae,g),$("click",fe,f),D(A,I)};H(y,A=>{c(t)&&A(w)})}return D(o,b),Us(C)}Ys(["click","keydown"]);function fS(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var GC,x2;function eq(){if(x2)return GC;x2=1;function o(K){return K instanceof Map?K.clear=K.delete=K.set=function(){throw new Error("map is read-only")}:K instanceof Set&&(K.add=K.clear=K.delete=function(){throw new Error("set is read-only")}),Object.freeze(K),Object.getOwnPropertyNames(K).forEach(De=>{const Qe=K[De],it=typeof Qe;(it==="object"||it==="function")&&!Object.isFrozen(Qe)&&o(Qe)}),K}class e{constructor(De){De.data===void 0&&(De.data={}),this.data=De.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(K){return K.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function i(K,...De){const Qe=Object.create(null);for(const it in K)Qe[it]=K[it];return De.forEach(function(it){for(const Gt in it)Qe[Gt]=it[Gt]}),Qe}const n="</span>",s=K=>!!K.scope,r=(K,{prefix:De})=>{if(K.startsWith("language:"))return K.replace("language:","language-");if(K.includes(".")){const Qe=K.split(".");return[`${De}${Qe.shift()}`,...Qe.map((it,Gt)=>`${it}${"_".repeat(Gt+1)}`)].join(" ")}return`${De}${K}`};class a{constructor(De,Qe){this.buffer="",this.classPrefix=Qe.classPrefix,De.walk(this)}addText(De){this.buffer+=t(De)}openNode(De){if(!s(De))return;const Qe=r(De.scope,{prefix:this.classPrefix});this.span(Qe)}closeNode(De){s(De)&&(this.buffer+=n)}value(){return this.buffer}span(De){this.buffer+=`<span class="${De}">`}}const d=(K={})=>{const De={children:[]};return Object.assign(De,K),De};class u{constructor(){this.rootNode=d(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(De){this.top.children.push(De)}openNode(De){const Qe=d({scope:De});this.add(Qe),this.stack.push(Qe)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(De){return this.constructor._walk(De,this.rootNode)}static _walk(De,Qe){return typeof Qe=="string"?De.addText(Qe):Qe.children&&(De.openNode(Qe),Qe.children.forEach(it=>this._walk(De,it)),De.closeNode(Qe)),De}static _collapse(De){typeof De!="string"&&De.children&&(De.children.every(Qe=>typeof Qe=="string")?De.children=[De.children.join("")]:De.children.forEach(Qe=>{u._collapse(Qe)}))}}class f extends u{constructor(De){super(),this.options=De}addText(De){De!==""&&this.add(De)}startScope(De){this.openNode(De)}endScope(){this.closeNode()}__addSublanguage(De,Qe){const it=De.root;Qe&&(it.scope=`language:${Qe}`),this.add(it)}toHTML(){return new a(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function g(K){return K?typeof K=="string"?K:K.source:null}function p(K){return y("(?=",K,")")}function C(K){return y("(?:",K,")*")}function b(K){return y("(?:",K,")?")}function y(...K){return K.map(Qe=>g(Qe)).join("")}function w(K){const De=K[K.length-1];return typeof De=="object"&&De.constructor===Object?(K.splice(K.length-1,1),De):{}}function A(...K){return"("+(w(K).capture?"":"?:")+K.map(it=>g(it)).join("|")+")"}function I(K){return new RegExp(K.toString()+"|").exec("").length-1}function T(K,De){const Qe=K&&K.exec(De);return Qe&&Qe.index===0}const R=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function P(K,{joinWith:De}){let Qe=0;return K.map(it=>{Qe+=1;const Gt=Qe;let li=g(it),vt="";for(;li.length>0;){const ft=R.exec(li);if(!ft){vt+=li;break}vt+=li.substring(0,ft.index),li=li.substring(ft.index+ft[0].length),ft[0][0]==="\\"&&ft[1]?vt+="\\"+String(Number(ft[1])+Gt):(vt+=ft[0],ft[0]==="("&&Qe++)}return vt}).map(it=>`(${it})`).join(De)}const V=/\b\B/,j="[a-zA-Z]\\w*",J="[a-zA-Z_]\\w*",ae="\\b\\d+(\\.\\d+)?",fe="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",X="\\b(0b[01]+)",ce="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",me=(K={})=>{const De=/^#![ ]*\//;return K.binary&&(K.begin=y(De,/.*\b/,K.binary,/\b.*/)),i({scope:"meta",begin:De,end:/$/,relevance:0,"on:begin":(Qe,it)=>{Qe.index!==0&&it.ignoreMatch()}},K)},oe={begin:"\\\\[\\s\\S]",relevance:0},le={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[oe]},Ae={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[oe]},Te={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},xe=function(K,De,Qe={}){const it=i({scope:"comment",begin:K,end:De,contains:[]},Qe);it.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const Gt=A("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return it.contains.push({begin:y(/[ ]+/,"(",Gt,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),it},Ne=xe("//","$"),Ve=xe("/\\*","\\*/"),ve=xe("#","$"),mt={scope:"number",begin:ae,relevance:0},Mt={scope:"number",begin:fe,relevance:0},ot={scope:"number",begin:X,relevance:0},yt={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[oe,{begin:/\[/,end:/\]/,relevance:0,contains:[oe]}]},be={scope:"title",begin:j,relevance:0},Nt={scope:"title",begin:J,relevance:0},si={begin:"\\.\\s*"+J,relevance:0};var tt=Object.freeze({__proto__:null,APOS_STRING_MODE:le,BACKSLASH_ESCAPE:oe,BINARY_NUMBER_MODE:ot,BINARY_NUMBER_RE:X,COMMENT:xe,C_BLOCK_COMMENT_MODE:Ve,C_LINE_COMMENT_MODE:Ne,C_NUMBER_MODE:Mt,C_NUMBER_RE:fe,END_SAME_AS_BEGIN:function(K){return Object.assign(K,{"on:begin":(De,Qe)=>{Qe.data._beginMatch=De[1]},"on:end":(De,Qe)=>{Qe.data._beginMatch!==De[1]&&Qe.ignoreMatch()}})},HASH_COMMENT_MODE:ve,IDENT_RE:j,MATCH_NOTHING_RE:V,METHOD_GUARD:si,NUMBER_MODE:mt,NUMBER_RE:ae,PHRASAL_WORDS_MODE:Te,QUOTE_STRING_MODE:Ae,REGEXP_MODE:yt,RE_STARTERS_RE:ce,SHEBANG:me,TITLE_MODE:be,UNDERSCORE_IDENT_RE:J,UNDERSCORE_TITLE_MODE:Nt});function wt(K,De){K.input[K.index-1]==="."&&De.ignoreMatch()}function Yt(K,De){K.className!==void 0&&(K.scope=K.className,delete K.className)}function fi(K,De){De&&K.beginKeywords&&(K.begin="\\b("+K.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",K.__beforeBegin=wt,K.keywords=K.keywords||K.beginKeywords,delete K.beginKeywords,K.relevance===void 0&&(K.relevance=0))}function oi(K,De){Array.isArray(K.illegal)&&(K.illegal=A(...K.illegal))}function ki(K,De){if(K.match){if(K.begin||K.end)throw new Error("begin & end are not supported with match");K.begin=K.match,delete K.match}}function _i(K,De){K.relevance===void 0&&(K.relevance=1)}const Ze=(K,De)=>{if(!K.beforeMatch)return;if(K.starts)throw new Error("beforeMatch cannot be used with starts");const Qe=Object.assign({},K);Object.keys(K).forEach(it=>{delete K[it]}),K.keywords=Qe.keywords,K.begin=y(Qe.beforeMatch,p(Qe.begin)),K.starts={relevance:0,contains:[Object.assign(Qe,{endsParent:!0})]},K.relevance=0,delete Qe.beforeMatch},Ee=["of","and","for","in","not","or","if","then","parent","list","value"],ii="keyword";function Ci(K,De,Qe=ii){const it=Object.create(null);return typeof K=="string"?Gt(Qe,K.split(" ")):Array.isArray(K)?Gt(Qe,K):Object.keys(K).forEach(function(li){Object.assign(it,Ci(K[li],De,li))}),it;function Gt(li,vt){De&&(vt=vt.map(ft=>ft.toLowerCase())),vt.forEach(function(ft){const Y=ft.split("|");it[Y[0]]=[li,Jt(Y[0],Y[1])]})}}function Jt(K,De){return De?Number(De):zi(K)?0:1}function zi(K){return Ee.includes(K.toLowerCase())}const Ji={},Ii=K=>{console.error(K)},wn=(K,...De)=>{console.log(`WARN: ${K}`,...De)},cn=(K,De)=>{Ji[`${K}/${De}`]||(console.log(`Deprecated as of ${K}. ${De}`),Ji[`${K}/${De}`]=!0)},pn=new Error;function fn(K,De,{key:Qe}){let it=0;const Gt=K[Qe],li={},vt={};for(let ft=1;ft<=De.length;ft++)vt[ft+it]=Gt[ft],li[ft+it]=!0,it+=I(De[ft-1]);K[Qe]=vt,K[Qe]._emit=li,K[Qe]._multi=!0}function pt(K){if(Array.isArray(K.begin)){if(K.skip||K.excludeBegin||K.returnBegin)throw Ii("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),pn;if(typeof K.beginScope!="object"||K.beginScope===null)throw Ii("beginScope must be object"),pn;fn(K,K.begin,{key:"beginScope"}),K.begin=P(K.begin,{joinWith:""})}}function Ut(K){if(Array.isArray(K.end)){if(K.skip||K.excludeEnd||K.returnEnd)throw Ii("skip, excludeEnd, returnEnd not compatible with endScope: {}"),pn;if(typeof K.endScope!="object"||K.endScope===null)throw Ii("endScope must be object"),pn;fn(K,K.end,{key:"endScope"}),K.end=P(K.end,{joinWith:""})}}function Ni(K){K.scope&&typeof K.scope=="object"&&K.scope!==null&&(K.beginScope=K.scope,delete K.scope)}function qi(K){Ni(K),typeof K.beginScope=="string"&&(K.beginScope={_wrap:K.beginScope}),typeof K.endScope=="string"&&(K.endScope={_wrap:K.endScope}),pt(K),Ut(K)}function gi(K){function De(vt,ft){return new RegExp(g(vt),"m"+(K.case_insensitive?"i":"")+(K.unicodeRegex?"u":"")+(ft?"g":""))}class Qe{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(ft,Y){Y.position=this.position++,this.matchIndexes[this.matchAt]=Y,this.regexes.push([Y,ft]),this.matchAt+=I(ft)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const ft=this.regexes.map(Y=>Y[1]);this.matcherRe=De(P(ft,{joinWith:"|"}),!0),this.lastIndex=0}exec(ft){this.matcherRe.lastIndex=this.lastIndex;const Y=this.matcherRe.exec(ft);if(!Y)return null;const Re=Y.findIndex((ye,ci)=>ci>0&&ye!==void 0),dt=this.matchIndexes[Re];return Y.splice(0,Re),Object.assign(Y,dt)}}class it{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(ft){if(this.multiRegexes[ft])return this.multiRegexes[ft];const Y=new Qe;return this.rules.slice(ft).forEach(([Re,dt])=>Y.addRule(Re,dt)),Y.compile(),this.multiRegexes[ft]=Y,Y}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(ft,Y){this.rules.push([ft,Y]),Y.type==="begin"&&this.count++}exec(ft){const Y=this.getMatcher(this.regexIndex);Y.lastIndex=this.lastIndex;let Re=Y.exec(ft);if(this.resumingScanAtSamePosition()&&!(Re&&Re.index===this.lastIndex)){const dt=this.getMatcher(0);dt.lastIndex=this.lastIndex+1,Re=dt.exec(ft)}return Re&&(this.regexIndex+=Re.position+1,this.regexIndex===this.count&&this.considerAll()),Re}}function Gt(vt){const ft=new it;return vt.contains.forEach(Y=>ft.addRule(Y.begin,{rule:Y,type:"begin"})),vt.terminatorEnd&&ft.addRule(vt.terminatorEnd,{type:"end"}),vt.illegal&&ft.addRule(vt.illegal,{type:"illegal"}),ft}function li(vt,ft){const Y=vt;if(vt.isCompiled)return Y;[Yt,ki,qi,Ze].forEach(dt=>dt(vt,ft)),K.compilerExtensions.forEach(dt=>dt(vt,ft)),vt.__beforeBegin=null,[fi,oi,_i].forEach(dt=>dt(vt,ft)),vt.isCompiled=!0;let Re=null;return typeof vt.keywords=="object"&&vt.keywords.$pattern&&(vt.keywords=Object.assign({},vt.keywords),Re=vt.keywords.$pattern,delete vt.keywords.$pattern),Re=Re||/\w+/,vt.keywords&&(vt.keywords=Ci(vt.keywords,K.case_insensitive)),Y.keywordPatternRe=De(Re,!0),ft&&(vt.begin||(vt.begin=/\B|\b/),Y.beginRe=De(Y.begin),!vt.end&&!vt.endsWithParent&&(vt.end=/\B|\b/),vt.end&&(Y.endRe=De(Y.end)),Y.terminatorEnd=g(Y.end)||"",vt.endsWithParent&&ft.terminatorEnd&&(Y.terminatorEnd+=(vt.end?"|":"")+ft.terminatorEnd)),vt.illegal&&(Y.illegalRe=De(vt.illegal)),vt.contains||(vt.contains=[]),vt.contains=[].concat(...vt.contains.map(function(dt){return Ui(dt==="self"?vt:dt)})),vt.contains.forEach(function(dt){li(dt,Y)}),vt.starts&&li(vt.starts,ft),Y.matcher=Gt(Y),Y}if(K.compilerExtensions||(K.compilerExtensions=[]),K.contains&&K.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return K.classNameAliases=i(K.classNameAliases||{}),li(K)}function Wi(K){return K?K.endsWithParent||Wi(K.starts):!1}function Ui(K){return K.variants&&!K.cachedVariants&&(K.cachedVariants=K.variants.map(function(De){return i(K,{variants:null},De)})),K.cachedVariants?K.cachedVariants:Wi(K)?i(K,{starts:K.starts?i(K.starts):null}):Object.isFrozen(K)?i(K):K}var tn="11.11.1";class yi extends Error{constructor(De,Qe){super(De),this.name="HTMLInjectionError",this.html=Qe}}const Vi=t,ze=i,qt=Symbol("nomatch"),wi=7,ji=function(K){const De=Object.create(null),Qe=Object.create(null),it=[];let Gt=!0;const li="Could not find the language '{}', did you forget to load/include a language module?",vt={disableAutodetect:!0,name:"Plain text",contains:[]};let ft={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:f};function Y(U){return ft.noHighlightRe.test(U)}function Re(U){let M=U.className+" ";M+=U.parentNode?U.parentNode.className:"";const O=ft.languageDetectRe.exec(M);if(O){const ee=Xt(O[1]);return ee||(wn(li.replace("{}",O[1])),wn("Falling back to no-highlight mode for this block.",U)),ee?O[1]:"no-highlight"}return M.split(/\s+/).find(ee=>Y(ee)||Xt(ee))}function dt(U,M,O){let ee="",ne="";typeof M=="object"?(ee=U,O=M.ignoreIllegals,ne=M.language):(cn("10.7.0","highlight(lang, code, ...args) has been deprecated."),cn("10.7.0",`Please use highlight(code, options) instead.
80
+ https://github.com/highlightjs/highlight.js/issues/2277`),ne=U,ee=M),O===void 0&&(O=!0);const se={code:ee,language:ne};Ot("before:highlight",se);const re=se.result?se.result:ye(se.language,se.code,O);return re.code=se.code,Ot("after:highlight",re),re}function ye(U,M,O,ee){const ne=Object.create(null);function se(ge,$e){return ge.keywords[$e]}function re(){if(!nt.keywords){He.addText(Fe);return}let ge=0;nt.keywordPatternRe.lastIndex=0;let $e=nt.keywordPatternRe.exec(Fe),_t="";for(;$e;){_t+=Fe.substring(ge,$e.index);const Wt=Oe.case_insensitive?$e[0].toLowerCase():$e[0],bt=se(nt,Wt);if(bt){const[pi,Di]=bt;if(He.addText(_t),_t="",ne[Wt]=(ne[Wt]||0)+1,ne[Wt]<=wi&&(Je+=Di),pi.startsWith("_"))_t+=$e[0];else{const Xi=Oe.classNameAliases[pi]||pi;Ce($e[0],Xi)}}else _t+=$e[0];ge=nt.keywordPatternRe.lastIndex,$e=nt.keywordPatternRe.exec(Fe)}_t+=Fe.substring(ge),He.addText(_t)}function Ie(){if(Fe==="")return;let ge=null;if(typeof nt.subLanguage=="string"){if(!De[nt.subLanguage]){He.addText(Fe);return}ge=ye(nt.subLanguage,Fe,!0,ue[nt.subLanguage]),ue[nt.subLanguage]=ge._top}else ge=It(Fe,nt.subLanguage.length?nt.subLanguage:null);nt.relevance>0&&(Je+=ge.relevance),He.__addSublanguage(ge._emitter,ge.language)}function We(){nt.subLanguage!=null?Ie():re(),Fe=""}function Ce(ge,$e){ge!==""&&(He.startScope($e),He.addText(ge),He.endScope())}function Pe(ge,$e){let _t=1;const Wt=$e.length-1;for(;_t<=Wt;){if(!ge._emit[_t]){_t++;continue}const bt=Oe.classNameAliases[ge[_t]]||ge[_t],pi=$e[_t];bt?Ce(pi,bt):(Fe=pi,re(),Fe=""),_t++}}function Me(ge,$e){return ge.scope&&typeof ge.scope=="string"&&He.openNode(Oe.classNameAliases[ge.scope]||ge.scope),ge.beginScope&&(ge.beginScope._wrap?(Ce(Fe,Oe.classNameAliases[ge.beginScope._wrap]||ge.beginScope._wrap),Fe=""):ge.beginScope._multi&&(Pe(ge.beginScope,$e),Fe="")),nt=Object.create(ge,{parent:{value:nt}}),nt}function at(ge,$e,_t){let Wt=T(ge.endRe,_t);if(Wt){if(ge["on:end"]){const bt=new e(ge);ge["on:end"]($e,bt),bt.isMatchIgnored&&(Wt=!1)}if(Wt){for(;ge.endsParent&&ge.parent;)ge=ge.parent;return ge}}if(ge.endsWithParent)return at(ge.parent,$e,_t)}function Qt(ge){return nt.matcher.regexIndex===0?(Fe+=ge[0],1):(et=!0,0)}function Z(ge){const $e=ge[0],_t=ge.rule,Wt=new e(_t),bt=[_t.__beforeBegin,_t["on:begin"]];for(const pi of bt)if(pi&&(pi(ge,Wt),Wt.isMatchIgnored))return Qt($e);return _t.skip?Fe+=$e:(_t.excludeBegin&&(Fe+=$e),We(),!_t.returnBegin&&!_t.excludeBegin&&(Fe=$e)),Me(_t,ge),_t.returnBegin?0:$e.length}function de(ge){const $e=ge[0],_t=M.substring(ge.index),Wt=at(nt,ge,_t);if(!Wt)return qt;const bt=nt;nt.endScope&&nt.endScope._wrap?(We(),Ce($e,nt.endScope._wrap)):nt.endScope&&nt.endScope._multi?(We(),Pe(nt.endScope,ge)):bt.skip?Fe+=$e:(bt.returnEnd||bt.excludeEnd||(Fe+=$e),We(),bt.excludeEnd&&(Fe=$e));do nt.scope&&He.closeNode(),!nt.skip&&!nt.subLanguage&&(Je+=nt.relevance),nt=nt.parent;while(nt!==Wt.parent);return Wt.starts&&Me(Wt.starts,ge),bt.returnEnd?0:$e.length}function Ue(){const ge=[];for(let $e=nt;$e!==Oe;$e=$e.parent)$e.scope&&ge.unshift($e.scope);ge.forEach($e=>He.openNode($e))}let Ft={};function we(ge,$e){const _t=$e&&$e[0];if(Fe+=ge,_t==null)return We(),0;if(Ft.type==="begin"&&$e.type==="end"&&Ft.index===$e.index&&_t===""){if(Fe+=M.slice($e.index,$e.index+1),!Gt){const Wt=new Error(`0 width match regex (${U})`);throw Wt.languageName=U,Wt.badRule=Ft.rule,Wt}return 1}if(Ft=$e,$e.type==="begin")return Z($e);if($e.type==="illegal"&&!O){const Wt=new Error('Illegal lexeme "'+_t+'" for mode "'+(nt.scope||"<unnamed>")+'"');throw Wt.mode=nt,Wt}else if($e.type==="end"){const Wt=de($e);if(Wt!==qt)return Wt}if($e.type==="illegal"&&_t==="")return Fe+=`
81
+ `,1;if(Ke>1e5&&Ke>$e.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Fe+=_t,_t.length}const Oe=Xt(U);if(!Oe)throw Ii(li.replace("{}",U)),new Error('Unknown language: "'+U+'"');const St=gi(Oe);let ut="",nt=ee||St;const ue={},He=new ft.__emitter(ft);Ue();let Fe="",Je=0,ht=0,Ke=0,et=!1;try{if(Oe.__emitTokens)Oe.__emitTokens(M,He);else{for(nt.matcher.considerAll();;){Ke++,et?et=!1:nt.matcher.considerAll(),nt.matcher.lastIndex=ht;const ge=nt.matcher.exec(M);if(!ge)break;const $e=M.substring(ht,ge.index),_t=we($e,ge);ht=ge.index+_t}we(M.substring(ht))}return He.finalize(),ut=He.toHTML(),{language:U,value:ut,relevance:Je,illegal:!1,_emitter:He,_top:nt}}catch(ge){if(ge.message&&ge.message.includes("Illegal"))return{language:U,value:Vi(M),illegal:!0,relevance:0,_illegalBy:{message:ge.message,index:ht,context:M.slice(ht-100,ht+100),mode:ge.mode,resultSoFar:ut},_emitter:He};if(Gt)return{language:U,value:Vi(M),illegal:!1,relevance:0,errorRaised:ge,_emitter:He,_top:nt};throw ge}}function ci(U){const M={value:Vi(U),illegal:!1,relevance:0,_top:vt,_emitter:new ft.__emitter(ft)};return M._emitter.addText(U),M}function It(U,M){M=M||ft.languages||Object.keys(De);const O=ci(U),ee=M.filter(Xt).filter(Ge).map(We=>ye(We,U,!1));ee.unshift(O);const ne=ee.sort((We,Ce)=>{if(We.relevance!==Ce.relevance)return Ce.relevance-We.relevance;if(We.language&&Ce.language){if(Xt(We.language).supersetOf===Ce.language)return 1;if(Xt(Ce.language).supersetOf===We.language)return-1}return 0}),[se,re]=ne,Ie=se;return Ie.secondBest=re,Ie}function ie(U,M,O){const ee=M&&Qe[M]||O;U.classList.add("hljs"),U.classList.add(`language-${ee}`)}function Ye(U){let M=null;const O=Re(U);if(Y(O))return;if(Ot("before:highlightElement",{el:U,language:O}),U.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",U);return}if(U.children.length>0&&(ft.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(U)),ft.throwUnescapedHTML))throw new yi("One of your code blocks includes unescaped HTML.",U.innerHTML);M=U;const ee=M.textContent,ne=O?dt(ee,{language:O,ignoreIllegals:!0}):It(ee);U.innerHTML=ne.value,U.dataset.highlighted="yes",ie(U,O,ne.language),U.result={language:ne.language,re:ne.relevance,relevance:ne.relevance},ne.secondBest&&(U.secondBest={language:ne.secondBest.language,relevance:ne.secondBest.relevance}),Ot("after:highlightElement",{el:U,result:ne,text:ee})}function kt(U){ft=ze(ft,U)}const Pt=()=>{je(),cn("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Bt(){je(),cn("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Be=!1;function je(){function U(){je()}if(document.readyState==="loading"){Be||window.addEventListener("DOMContentLoaded",U,!1),Be=!0;return}document.querySelectorAll(ft.cssSelector).forEach(Ye)}function Kt(U,M){let O=null;try{O=M(K)}catch(ee){if(Ii("Language definition for '{}' could not be registered.".replace("{}",U)),Gt)Ii(ee);else throw ee;O=vt}O.name||(O.name=U),De[U]=O,O.rawDefinition=M.bind(null,K),O.aliases&&pe(O.aliases,{languageName:U})}function ri(U){delete De[U];for(const M of Object.keys(Qe))Qe[M]===U&&delete Qe[M]}function ui(){return Object.keys(De)}function Xt(U){return U=(U||"").toLowerCase(),De[U]||De[Qe[U]]}function pe(U,{languageName:M}){typeof U=="string"&&(U=[U]),U.forEach(O=>{Qe[O.toLowerCase()]=M})}function Ge(U){const M=Xt(U);return M&&!M.disableAutodetect}function rt(U){U["before:highlightBlock"]&&!U["before:highlightElement"]&&(U["before:highlightElement"]=M=>{U["before:highlightBlock"](Object.assign({block:M.el},M))}),U["after:highlightBlock"]&&!U["after:highlightElement"]&&(U["after:highlightElement"]=M=>{U["after:highlightBlock"](Object.assign({block:M.el},M))})}function lt(U){rt(U),it.push(U)}function Vt(U){const M=it.indexOf(U);M!==-1&&it.splice(M,1)}function Ot(U,M){const O=U;it.forEach(function(ee){ee[O]&&ee[O](M)})}function bi(U){return cn("10.7.0","highlightBlock will be removed entirely in v12.0"),cn("10.7.0","Please use highlightElement now."),Ye(U)}Object.assign(K,{highlight:dt,highlightAuto:It,highlightAll:je,highlightElement:Ye,highlightBlock:bi,configure:kt,initHighlighting:Pt,initHighlightingOnLoad:Bt,registerLanguage:Kt,unregisterLanguage:ri,listLanguages:ui,getLanguage:Xt,registerAliases:pe,autoDetection:Ge,inherit:ze,addPlugin:lt,removePlugin:Vt}),K.debugMode=function(){Gt=!1},K.safeMode=function(){Gt=!0},K.versionString=tn,K.regex={concat:y,lookahead:p,either:A,optional:b,anyNumberOfTimes:C};for(const U in tt)typeof tt[U]=="object"&&o(tt[U]);return Object.assign(K,tt),K},Si=ji({});return Si.newInstance=()=>ji({}),GC=Si,Si.HighlightJS=Si,Si.default=Si,GC}var tq=eq();const zv=fS(tq),m2="[A-Za-z$_][0-9A-Za-z$_]*",iq=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],nq=["true","false","null","undefined","NaN","Infinity"],FF=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],LF=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],IF=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],sq=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],oq=[].concat(IF,FF,LF);function PF(o){const e=o.regex,t=(xe,{after:Ne})=>{const Ve="</"+xe[0].slice(1);return xe.input.indexOf(Ve,Ne)!==-1},i=m2,n={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,r={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(xe,Ne)=>{const Ve=xe[0].length+xe.index,ve=xe.input[Ve];if(ve==="<"||ve===","){Ne.ignoreMatch();return}ve===">"&&(t(xe,{after:Ve})||Ne.ignoreMatch());let mt;const Mt=xe.input.substring(Ve);if(mt=Mt.match(/^\s*=/)){Ne.ignoreMatch();return}if((mt=Mt.match(/^\s+extends\s+/))&&mt.index===0){Ne.ignoreMatch();return}}},a={$pattern:m2,keyword:iq,literal:nq,built_in:oq,"variable.language":sq},d="[0-9](_?[0-9])*",u=`\\.(${d})`,f="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",g={className:"number",variants:[{begin:`(\\b(${f})((${u})|\\.)?|(${u}))[eE][+-]?(${d})\\b`},{begin:`\\b(${f})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},p={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},C={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[o.BACKSLASH_ESCAPE,p],subLanguage:"xml"}},b={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[o.BACKSLASH_ESCAPE,p],subLanguage:"css"}},y={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[o.BACKSLASH_ESCAPE,p],subLanguage:"graphql"}},w={className:"string",begin:"`",end:"`",contains:[o.BACKSLASH_ESCAPE,p]},I={className:"comment",variants:[o.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:i+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),o.C_BLOCK_COMMENT_MODE,o.C_LINE_COMMENT_MODE]},T=[o.APOS_STRING_MODE,o.QUOTE_STRING_MODE,C,b,y,w,{match:/\$\d+/},g];p.contains=T.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(T)});const R=[].concat(I,p.contains),P=R.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(R)}]),V={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:P},j={variants:[{match:[/class/,/\s+/,i,/\s+/,/extends/,/\s+/,e.concat(i,"(",e.concat(/\./,i),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,i],scope:{1:"keyword",3:"title.class"}}]},J={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...FF,...LF]}},ae={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},fe={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[V],illegal:/%/},X={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function ce(xe){return e.concat("(?!",xe.join("|"),")")}const me={match:e.concat(/\b/,ce([...IF,"super","import"].map(xe=>`${xe}\\s*\\(`)),i,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},oe={begin:e.concat(/\./,e.lookahead(e.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},le={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},V]},Ae="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+o.UNDERSCORE_IDENT_RE+")\\s*=>",Te={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(Ae)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[V]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:P,CLASS_REFERENCE:J},illegal:/#(?![$_A-z])/,contains:[o.SHEBANG({label:"shebang",binary:"node",relevance:5}),ae,o.APOS_STRING_MODE,o.QUOTE_STRING_MODE,C,b,y,w,I,{match:/\$\d+/},g,J,{scope:"attr",match:i+e.lookahead(":"),relevance:0},Te,{begin:"("+o.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[I,o.REGEXP_MODE,{className:"function",begin:Ae,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:o.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:P}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:n.begin,end:n.end},{match:s},{begin:r.begin,"on:begin":r.isTrulyOpeningTag,end:r.end}],subLanguage:"xml",contains:[{begin:r.begin,end:r.end,skip:!0,contains:["self"]}]}]},fe,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+o.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[V,o.inherit(o.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},oe,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[V]},me,X,j,le,{match:/\$[(.]/}]}}function gS(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var rh=gS();function TF(o){rh=o}var _d={exec:()=>null};function Ih(o){let e=[];return t=>{let i=Math.max(0,Math.min(3,t-1)),n=e[i];return n||(n=o(i),e[i]=n),n}}function Yn(o,e=""){let t=typeof o=="string"?o:o.source,i={replace:(n,s)=>{let r=typeof s=="string"?s:s.source;return r=r.replace(Eo.caret,"$1"),t=t.replace(n,r),i},getRegex:()=>new RegExp(t,e)};return i}var rq=((o="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+o)}catch{return!1}})(),Eo={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:o=>new RegExp(`^( {0,3}${o})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Ih(o=>new RegExp(`^ {0,${o}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Ih(o=>new RegExp(`^ {0,${o}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Ih(o=>new RegExp(`^ {0,${o}}(?:\`\`\`|~~~)`)),headingBeginRegex:Ih(o=>new RegExp(`^ {0,${o}}#`)),htmlBeginRegex:Ih(o=>new RegExp(`^ {0,${o}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Ih(o=>new RegExp(`^ {0,${o}}>`))},aq=/^(?:[ \t]*(?:\n|$))+/,lq=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,cq=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ex=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,dq=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,pS=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,MF=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,RF=Yn(MF).replace(/bull/g,pS).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),uq=Yn(MF).replace(/bull/g,pS).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),xS=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,hq=/^[^\n]+/,mS=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,fq=Yn(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",mS).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),gq=Yn(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,pS).getRegex(),Tb="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",vS=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,pq=Yn("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",vS).replace("tag",Tb).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),NF=Yn(xS).replace("hr",ex).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Tb).getRegex(),xq=Yn(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",NF).getRegex(),_S={blockquote:xq,code:lq,def:fq,fences:cq,heading:dq,hr:ex,html:pq,lheading:RF,list:gq,newline:aq,paragraph:NF,table:_d,text:hq},v2=Yn("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ex).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Tb).getRegex(),mq={..._S,lheading:uq,table:v2,paragraph:Yn(xS).replace("hr",ex).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",v2).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Tb).getRegex()},vq={..._S,html:Yn(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",vS).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:_d,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Yn(xS).replace("hr",ex).replace("heading",` *#{1,6} *[^
82
+ ]`).replace("lheading",RF).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},_q=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,bq=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,OF=/^( {2,}|\\)\n(?!\s*$)/,Cq=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,bf=/[\p{P}\p{S}]/u,Mb=/[\s\p{P}\p{S}]/u,bS=/[^\s\p{P}\p{S}]/u,Eq=Yn(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Mb).getRegex(),HF=/(?!~)[\p{P}\p{S}]/u,yq=/(?!~)[\s\p{P}\p{S}]/u,wq=/(?:[^\s\p{P}\p{S}]|~)/u,Sq=Yn(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",rq?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),WF=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Dq=Yn(WF,"u").replace(/punct/g,bf).getRegex(),Aq=Yn(WF,"u").replace(/punct/g,HF).getRegex(),zF="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",kq=Yn(zF,"gu").replace(/notPunctSpace/g,bS).replace(/punctSpace/g,Mb).replace(/punct/g,bf).getRegex(),Bq=Yn(zF,"gu").replace(/notPunctSpace/g,wq).replace(/punctSpace/g,yq).replace(/punct/g,HF).getRegex(),Fq=Yn("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,bS).replace(/punctSpace/g,Mb).replace(/punct/g,bf).getRegex(),Lq=Yn(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,bf).getRegex(),Iq="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Pq=Yn(Iq,"gu").replace(/notPunctSpace/g,bS).replace(/punctSpace/g,Mb).replace(/punct/g,bf).getRegex(),Tq=Yn(/\\(punct)/,"gu").replace(/punct/g,bf).getRegex(),Mq=Yn(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Rq=Yn(vS).replace("(?:-->|$)","-->").getRegex(),Nq=Yn("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Rq).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Vv=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Oq=Yn(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Vv).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),VF=Yn(/^!?\[(label)\]\[(ref)\]/).replace("label",Vv).replace("ref",mS).getRegex(),jF=Yn(/^!?\[(ref)\](?:\[\])?/).replace("ref",mS).getRegex(),Hq=Yn("reflink|nolink(?!\\()","g").replace("reflink",VF).replace("nolink",jF).getRegex(),_2=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,CS={_backpedal:_d,anyPunctuation:Tq,autolink:Mq,blockSkip:Sq,br:OF,code:bq,del:_d,delLDelim:_d,delRDelim:_d,emStrongLDelim:Dq,emStrongRDelimAst:kq,emStrongRDelimUnd:Fq,escape:_q,link:Oq,nolink:jF,punctuation:Eq,reflink:VF,reflinkSearch:Hq,tag:Nq,text:Cq,url:_d},Wq={...CS,link:Yn(/^!?\[(label)\]\((.*?)\)/).replace("label",Vv).getRegex(),reflink:Yn(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Vv).getRegex()},_w={...CS,emStrongRDelimAst:Bq,emStrongLDelim:Aq,delLDelim:Lq,delRDelim:Pq,url:Yn(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",_2).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Yn(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",_2).getRegex()},zq={..._w,br:Yn(OF).replace("{2,}","*").getRegex(),text:Yn(_w.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ux={normal:_S,gfm:mq,pedantic:vq},Vf={normal:CS,gfm:_w,breaks:zq,pedantic:Wq},Vq={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},b2=o=>Vq[o];function ya(o,e){if(e){if(Eo.escapeTest.test(o))return o.replace(Eo.escapeReplace,b2)}else if(Eo.escapeTestNoEncode.test(o))return o.replace(Eo.escapeReplaceNoEncode,b2);return o}function C2(o){try{o=encodeURI(o).replace(Eo.percentDecode,"%")}catch{return null}return o}function E2(o,e){var s;let t=o.replace(Eo.findPipe,(r,a,d)=>{let u=!1,f=a;for(;--f>=0&&d[f]==="\\";)u=!u;return u?"|":" |"}),i=t.split(Eo.splitPipe),n=0;if(i[0].trim()||i.shift(),i.length>0&&!((s=i.at(-1))!=null&&s.trim())&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;n<i.length;n++)i[n]=i[n].trim().replace(Eo.slashPipe,"|");return i}function Jl(o,e,t){let i=o.length;if(i===0)return"";let n=0;for(;n<i&&o.charAt(i-n-1)===e;)n++;return o.slice(0,i-n)}function y2(o){let e=o.split(`
83
+ `),t=e.length-1;for(;t>=0&&Eo.blankLine.test(e[t]);)t--;return e.length-t<=2?o:e.slice(0,t+1).join(`
84
+ `)}function jq(o,e){if(o.indexOf(e[1])===-1)return-1;let t=0;for(let i=0;i<o.length;i++)if(o[i]==="\\")i++;else if(o[i]===e[0])t++;else if(o[i]===e[1]&&(t--,t<0))return i;return t>0?-2:-1}function $q(o,e=0){let t=e,i="";for(let n of o)if(n===" "){let s=4-t%4;i+=" ".repeat(s),t+=s}else i+=n,t++;return i}function w2(o,e,t,i,n){let s=e.href,r=e.title||null,a=o[1].replace(n.other.outputLinkReplace,"$1");i.state.inLink=!0;let d={type:o[0].charAt(0)==="!"?"image":"link",raw:t,href:s,title:r,text:a,tokens:i.inlineTokens(a)};return i.state.inLink=!1,d}function Uq(o,e,t){let i=o.match(t.other.indentCodeCompensation);if(i===null)return e;let n=i[1];return e.split(`
85
+ `).map(s=>{let r=s.match(t.other.beginningSpace);if(r===null)return s;let[a]=r;return a.length>=n.length?s.slice(n.length):s}).join(`
86
+ `)}var jv=class{constructor(o){kn(this,"options");kn(this,"rules");kn(this,"lexer");this.options=o||rh}space(o){let e=this.rules.block.newline.exec(o);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(o){let e=this.rules.block.code.exec(o);if(e){let t=this.options.pedantic?e[0]:y2(e[0]),i=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:i}}}fences(o){let e=this.rules.block.fences.exec(o);if(e){let t=e[0],i=Uq(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:i}}}heading(o){let e=this.rules.block.heading.exec(o);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let i=Jl(t,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(t=i.trim())}return{type:"heading",raw:Jl(e[0],`
87
+ `),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(o){let e=this.rules.block.hr.exec(o);if(e)return{type:"hr",raw:Jl(e[0],`
88
+ `)}}blockquote(o){let e=this.rules.block.blockquote.exec(o);if(e){let t=Jl(e[0],`
89
+ `).split(`
90
+ `),i="",n="",s=[];for(;t.length>0;){let r=!1,a=[],d;for(d=0;d<t.length;d++)if(this.rules.other.blockquoteStart.test(t[d]))a.push(t[d]),r=!0;else if(!r)a.push(t[d]);else break;t=t.slice(d);let u=a.join(`
91
+ `),f=u.replace(this.rules.other.blockquoteSetextReplace,`
92
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
93
+ ${u}`:u,n=n?`${n}
94
+ ${f}`:f;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(f,s,!0),this.lexer.state.top=g,t.length===0)break;let p=s.at(-1);if((p==null?void 0:p.type)==="code")break;if((p==null?void 0:p.type)==="blockquote"){let C=p,b=C.raw+`
95
+ `+t.join(`
96
+ `),y=this.blockquote(b);s[s.length-1]=y,i=i.substring(0,i.length-C.raw.length)+y.raw,n=n.substring(0,n.length-C.text.length)+y.text;break}else if((p==null?void 0:p.type)==="list"){let C=p,b=C.raw+`
97
+ `+t.join(`
98
+ `),y=this.list(b);s[s.length-1]=y,i=i.substring(0,i.length-p.raw.length)+y.raw,n=n.substring(0,n.length-C.raw.length)+y.raw,t=b.substring(s.at(-1).raw.length).split(`
99
+ `);continue}}return{type:"blockquote",raw:i,tokens:s,text:n}}}list(o){let e=this.rules.block.list.exec(o);if(e){let t=e[1].trim(),i=t.length>1,n={type:"list",raw:"",ordered:i,start:i?+t.slice(0,-1):"",loose:!1,items:[]};t=i?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=i?t:"[*+-]");let s=this.rules.other.listItemRegex(t),r=!1;for(;o;){let d=!1,u="",f="";if(!(e=s.exec(o))||this.rules.block.hr.test(o))break;u=e[0],o=o.substring(u.length);let g=$q(e[2].split(`
100
+ `,1)[0],e[1].length),p=o.split(`
101
+ `,1)[0],C=!g.trim(),b=0;if(this.options.pedantic?(b=2,f=g.trimStart()):C?b=e[1].length+1:(b=g.search(this.rules.other.nonSpaceChar),b=b>4?1:b,f=g.slice(b),b+=e[1].length),C&&this.rules.other.blankLine.test(p)&&(u+=p+`
102
+ `,o=o.substring(p.length+1),d=!0),!d){let y=this.rules.other.nextBulletRegex(b),w=this.rules.other.hrRegex(b),A=this.rules.other.fencesBeginRegex(b),I=this.rules.other.headingBeginRegex(b),T=this.rules.other.htmlBeginRegex(b),R=this.rules.other.blockquoteBeginRegex(b);for(;o;){let P=o.split(`
103
+ `,1)[0],V;if(p=P,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),V=p):V=p.replace(this.rules.other.tabCharGlobal," "),A.test(p)||I.test(p)||T.test(p)||R.test(p)||y.test(p)||w.test(p))break;if(V.search(this.rules.other.nonSpaceChar)>=b||!p.trim())f+=`
104
+ `+V.slice(b);else{if(C||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||A.test(g)||I.test(g)||w.test(g))break;f+=`
105
+ `+p}C=!p.trim(),u+=P+`
106
+ `,o=o.substring(P.length+1),g=V.slice(b)}}n.loose||(r?n.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(r=!0)),n.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(f),loose:!1,text:f,tokens:[]}),n.raw+=u}let a=n.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;n.raw=n.raw.trimEnd();for(let d of n.items){this.lexer.state.top=!1,d.tokens=this.lexer.blockTokens(d.text,[]);let u=d.tokens[0];if(d.task&&((u==null?void 0:u.type)==="text"||(u==null?void 0:u.type)==="paragraph")){d.text=d.text.replace(this.rules.other.listReplaceTask,""),u.raw=u.raw.replace(this.rules.other.listReplaceTask,""),u.text=u.text.replace(this.rules.other.listReplaceTask,"");for(let g=this.lexer.inlineQueue.length-1;g>=0;g--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)){this.lexer.inlineQueue[g].src=this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask,"");break}let f=this.rules.other.listTaskCheckbox.exec(d.raw);if(f){let g={type:"checkbox",raw:f[0]+" ",checked:f[0]!=="[ ]"};d.checked=g.checked,n.loose?d.tokens[0]&&["paragraph","text"].includes(d.tokens[0].type)&&"tokens"in d.tokens[0]&&d.tokens[0].tokens?(d.tokens[0].raw=g.raw+d.tokens[0].raw,d.tokens[0].text=g.raw+d.tokens[0].text,d.tokens[0].tokens.unshift(g)):d.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):d.tokens.unshift(g)}}else d.task&&(d.task=!1);if(!n.loose){let f=d.tokens.filter(p=>p.type==="space"),g=f.length>0&&f.some(p=>this.rules.other.anyLine.test(p.raw));n.loose=g}}if(n.loose)for(let d of n.items){d.loose=!0;for(let u of d.tokens)u.type==="text"&&(u.type="paragraph")}return n}}html(o){let e=this.rules.block.html.exec(o);if(e){let t=y2(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(o){let e=this.rules.block.def.exec(o);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:Jl(e[0],`
107
+ `),href:i,title:n}}}table(o){var r;let e=this.rules.block.table.exec(o);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=E2(e[1]),i=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=(r=e[3])!=null&&r.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
108
+ `):[],s={type:"table",raw:Jl(e[0],`
109
+ `),header:[],align:[],rows:[]};if(t.length===i.length){for(let a of i)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a<t.length;a++)s.header.push({text:t[a],tokens:this.lexer.inline(t[a]),header:!0,align:s.align[a]});for(let a of n)s.rows.push(E2(a,s.header.length).map((d,u)=>({text:d,tokens:this.lexer.inline(d),header:!1,align:s.align[u]})));return s}}lheading(o){let e=this.rules.block.lheading.exec(o);if(e){let t=e[1].trim();return{type:"heading",raw:Jl(e[0],`
110
+ `),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(o){let e=this.rules.block.paragraph.exec(o);if(e){let t=e[1].charAt(e[1].length-1)===`
111
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(o){let e=this.rules.block.text.exec(o);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(o){let e=this.rules.inline.escape.exec(o);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(o){let e=this.rules.inline.tag.exec(o);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(o){let e=this.rules.inline.link.exec(o);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let s=Jl(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=jq(e[2],"()");if(s===-2)return;if(s>-1){let r=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,r).trim(),e[3]=""}}let i=e[2],n="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(i);s&&(i=s[1],n=s[3])}else n=e[3]?e[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?i=i.slice(1):i=i.slice(1,-1)),w2(e,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(o,e){let t;if((t=this.rules.inline.reflink.exec(o))||(t=this.rules.inline.nolink.exec(o))){let i=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=e[i.toLowerCase()];if(!n){let s=t[0].charAt(0);return{type:"text",raw:s,text:s}}return w2(t,n,t[0],this.lexer,this.rules)}}emStrong(o,e,t=""){let i=this.rules.inline.emStrongLDelim.exec(o);if(!(!i||!i[1]&&!i[2]&&!i[3]&&!i[4]||i[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[3])||!t||this.rules.inline.punctuation.exec(t))){let n=[...i[0]].length-1,s,r,a=n,d=0,u=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*o.length+n);(i=u.exec(e))!==null;){if(s=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!s)continue;if(r=[...s].length,i[3]||i[4]){a+=r;continue}else if((i[5]||i[6])&&n%3&&!((n+r)%3)){d+=r;continue}if(a-=r,a>0)continue;r=Math.min(r,r+a+d);let f=[...i[0]][0].length,g=o.slice(0,n+i.index+f+r);if(Math.min(n,r)%2){let C=g.slice(1,-1);return{type:"em",raw:g,text:C,tokens:this.lexer.inlineTokens(C)}}let p=g.slice(2,-2);return{type:"strong",raw:g,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(o){let e=this.rules.inline.code.exec(o);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(t),n=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return i&&n&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(o){let e=this.rules.inline.br.exec(o);if(e)return{type:"br",raw:e[0]}}del(o,e,t=""){let i=this.rules.inline.delLDelim.exec(o);if(i&&(!i[1]||!t||this.rules.inline.punctuation.exec(t))){let n=[...i[0]].length-1,s,r,a=n,d=this.rules.inline.delRDelim;for(d.lastIndex=0,e=e.slice(-1*o.length+n);(i=d.exec(e))!==null;){if(s=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!s||(r=[...s].length,r!==n))continue;if(i[3]||i[4]){a+=r;continue}if(a-=r,a>0)continue;r=Math.min(r,r+a);let u=[...i[0]][0].length,f=o.slice(0,n+i.index+u+r),g=f.slice(n,-n);return{type:"del",raw:f,text:g,tokens:this.lexer.inlineTokens(g)}}}}autolink(o){let e=this.rules.inline.autolink.exec(o);if(e){let t,i;return e[2]==="@"?(t=e[1],i="mailto:"+t):(t=e[1],i=t),{type:"link",raw:e[0],text:t,href:i,tokens:[{type:"text",raw:t,text:t}]}}}url(o){var t;let e;if(e=this.rules.inline.url.exec(o)){let i,n;if(e[2]==="@")i=e[0],n="mailto:"+i;else{let s;do s=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(s!==e[0]);i=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:i,href:n,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(o){let e=this.rules.inline.text.exec(o);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},Jr=class bw{constructor(e){kn(this,"tokens");kn(this,"options");kn(this,"state");kn(this,"inlineQueue");kn(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||rh,this.options.tokenizer=this.options.tokenizer||new jv,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Eo,block:Ux.normal,inline:Vf.normal};this.options.pedantic?(t.block=Ux.pedantic,t.inline=Vf.pedantic):this.options.gfm&&(t.block=Ux.gfm,this.options.breaks?t.inline=Vf.breaks:t.inline=Vf.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ux,inline:Vf}}static lex(e,t){return new bw(t).lex(e)}static lexInline(e,t){return new bw(t).inlineTokens(e)}lex(e){e=e.replace(Eo.carriageReturn,`
112
+ `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let i=this.inlineQueue[t];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],i=!1){var s,r,a;this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(Eo.tabCharGlobal," ").replace(Eo.spaceLine,""));let n=1/0;for(;e;){if(e.length<n)n=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let d;if((r=(s=this.options.extensions)==null?void 0:s.block)!=null&&r.some(f=>(d=f.call({lexer:this},e,t))?(e=e.substring(d.raw.length),t.push(d),!0):!1))continue;if(d=this.tokenizer.space(e)){e=e.substring(d.raw.length);let f=t.at(-1);d.raw.length===1&&f!==void 0?f.raw+=`
113
+ `:t.push(d);continue}if(d=this.tokenizer.code(e)){e=e.substring(d.raw.length);let f=t.at(-1);(f==null?void 0:f.type)==="paragraph"||(f==null?void 0:f.type)==="text"?(f.raw+=(f.raw.endsWith(`
114
+ `)?"":`
115
+ `)+d.raw,f.text+=`
116
+ `+d.text,this.inlineQueue.at(-1).src=f.text):t.push(d);continue}if(d=this.tokenizer.fences(e)){e=e.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.heading(e)){e=e.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.hr(e)){e=e.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.blockquote(e)){e=e.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.list(e)){e=e.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.html(e)){e=e.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.def(e)){e=e.substring(d.raw.length);let f=t.at(-1);(f==null?void 0:f.type)==="paragraph"||(f==null?void 0:f.type)==="text"?(f.raw+=(f.raw.endsWith(`
117
+ `)?"":`
118
+ `)+d.raw,f.text+=`
119
+ `+d.raw,this.inlineQueue.at(-1).src=f.text):this.tokens.links[d.tag]||(this.tokens.links[d.tag]={href:d.href,title:d.title},t.push(d));continue}if(d=this.tokenizer.table(e)){e=e.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.lheading(e)){e=e.substring(d.raw.length),t.push(d);continue}let u=e;if((a=this.options.extensions)!=null&&a.startBlock){let f=1/0,g=e.slice(1),p;this.options.extensions.startBlock.forEach(C=>{p=C.call({lexer:this},g),typeof p=="number"&&p>=0&&(f=Math.min(f,p))}),f<1/0&&f>=0&&(u=e.substring(0,f+1))}if(this.state.top&&(d=this.tokenizer.paragraph(u))){let f=t.at(-1);i&&(f==null?void 0:f.type)==="paragraph"?(f.raw+=(f.raw.endsWith(`
120
+ `)?"":`
121
+ `)+d.raw,f.text+=`
122
+ `+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=f.text):t.push(d),i=u.length!==e.length,e=e.substring(d.raw.length);continue}if(d=this.tokenizer.text(e)){e=e.substring(d.raw.length);let f=t.at(-1);(f==null?void 0:f.type)==="text"?(f.raw+=(f.raw.endsWith(`
123
+ `)?"":`
124
+ `)+d.raw,f.text+=`
125
+ `+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=f.text):t.push(d);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var u,f,g,p,C;this.tokenizer.lexer=this;let i=e,n=null;if(this.tokens.links){let b=Object.keys(this.tokens.links);if(b.length>0)for(;(n=this.tokenizer.rules.inline.reflinkSearch.exec(i))!==null;)b.includes(n[0].slice(n[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(n=this.tokenizer.rules.inline.anyPunctuation.exec(i))!==null;)i=i.slice(0,n.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(n=this.tokenizer.rules.inline.blockSkip.exec(i))!==null;)s=n[2]?n[2].length:0,i=i.slice(0,n.index+s)+"["+"a".repeat(n[0].length-s-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=((f=(u=this.options.hooks)==null?void 0:u.emStrongMask)==null?void 0:f.call({lexer:this},i))??i;let r=!1,a="",d=1/0;for(;e;){if(e.length<d)d=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(a=""),r=!1;let b;if((p=(g=this.options.extensions)==null?void 0:g.inline)!=null&&p.some(w=>(b=w.call({lexer:this},e,t))?(e=e.substring(b.raw.length),t.push(b),!0):!1))continue;if(b=this.tokenizer.escape(e)){e=e.substring(b.raw.length),t.push(b);continue}if(b=this.tokenizer.tag(e)){e=e.substring(b.raw.length),t.push(b);continue}if(b=this.tokenizer.link(e)){e=e.substring(b.raw.length),t.push(b);continue}if(b=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(b.raw.length);let w=t.at(-1);b.type==="text"&&(w==null?void 0:w.type)==="text"?(w.raw+=b.raw,w.text+=b.text):t.push(b);continue}if(b=this.tokenizer.emStrong(e,i,a)){e=e.substring(b.raw.length),t.push(b);continue}if(b=this.tokenizer.codespan(e)){e=e.substring(b.raw.length),t.push(b);continue}if(b=this.tokenizer.br(e)){e=e.substring(b.raw.length),t.push(b);continue}if(b=this.tokenizer.del(e,i,a)){e=e.substring(b.raw.length),t.push(b);continue}if(b=this.tokenizer.autolink(e)){e=e.substring(b.raw.length),t.push(b);continue}if(!this.state.inLink&&(b=this.tokenizer.url(e))){e=e.substring(b.raw.length),t.push(b);continue}let y=e;if((C=this.options.extensions)!=null&&C.startInline){let w=1/0,A=e.slice(1),I;this.options.extensions.startInline.forEach(T=>{I=T.call({lexer:this},A),typeof I=="number"&&I>=0&&(w=Math.min(w,I))}),w<1/0&&w>=0&&(y=e.substring(0,w+1))}if(b=this.tokenizer.inlineText(y)){e=e.substring(b.raw.length),b.raw.slice(-1)!=="_"&&(a=b.raw.slice(-1)),r=!0;let w=t.at(-1);(w==null?void 0:w.type)==="text"?(w.raw+=b.raw,w.text+=b.text):t.push(b);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},$v=class{constructor(o){kn(this,"options");kn(this,"parser");this.options=o||rh}space(o){return""}code({text:o,lang:e,escaped:t}){var s;let i=(s=(e||"").match(Eo.notSpaceStart))==null?void 0:s[0],n=o.replace(Eo.endingNewline,"")+`
126
+ `;return i?'<pre><code class="language-'+ya(i)+'">'+(t?n:ya(n,!0))+`</code></pre>
127
+ `:"<pre><code>"+(t?n:ya(n,!0))+`</code></pre>
128
+ `}blockquote({tokens:o}){return`<blockquote>
129
+ ${this.parser.parse(o)}</blockquote>
130
+ `}html({text:o}){return o}def(o){return""}heading({tokens:o,depth:e}){return`<h${e}>${this.parser.parseInline(o)}</h${e}>
131
+ `}hr(o){return`<hr>
132
+ `}list(o){let e=o.ordered,t=o.start,i="";for(let r=0;r<o.items.length;r++){let a=o.items[r];i+=this.listitem(a)}let n=e?"ol":"ul",s=e&&t!==1?' start="'+t+'"':"";return"<"+n+s+`>
133
+ `+i+"</"+n+`>
134
+ `}listitem(o){return`<li>${this.parser.parse(o.tokens)}</li>
135
+ `}checkbox({checked:o}){return"<input "+(o?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:o}){return`<p>${this.parser.parseInline(o)}</p>
136
+ `}table(o){let e="",t="";for(let n=0;n<o.header.length;n++)t+=this.tablecell(o.header[n]);e+=this.tablerow({text:t});let i="";for(let n=0;n<o.rows.length;n++){let s=o.rows[n];t="";for(let r=0;r<s.length;r++)t+=this.tablecell(s[r]);i+=this.tablerow({text:t})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
137
+ <thead>
138
+ `+e+`</thead>
139
+ `+i+`</table>
140
+ `}tablerow({text:o}){return`<tr>
141
+ ${o}</tr>
142
+ `}tablecell(o){let e=this.parser.parseInline(o.tokens),t=o.header?"th":"td";return(o.align?`<${t} align="${o.align}">`:`<${t}>`)+e+`</${t}>
143
+ `}strong({tokens:o}){return`<strong>${this.parser.parseInline(o)}</strong>`}em({tokens:o}){return`<em>${this.parser.parseInline(o)}</em>`}codespan({text:o}){return`<code>${ya(o,!0)}</code>`}br(o){return"<br>"}del({tokens:o}){return`<del>${this.parser.parseInline(o)}</del>`}link({href:o,title:e,tokens:t}){let i=this.parser.parseInline(t),n=C2(o);if(n===null)return i;o=n;let s='<a href="'+o+'"';return e&&(s+=' title="'+ya(e)+'"'),s+=">"+i+"</a>",s}image({href:o,title:e,text:t,tokens:i}){i&&(t=this.parser.parseInline(i,this.parser.textRenderer));let n=C2(o);if(n===null)return ya(t);o=n;let s=`<img src="${o}" alt="${ya(t)}"`;return e&&(s+=` title="${ya(e)}"`),s+=">",s}text(o){return"tokens"in o&&o.tokens?this.parser.parseInline(o.tokens):"escaped"in o&&o.escaped?o.text:ya(o.text)}},ES=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},ea=class Cw{constructor(e){kn(this,"options");kn(this,"renderer");kn(this,"textRenderer");this.options=e||rh,this.options.renderer=this.options.renderer||new $v,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ES}static parse(e,t){return new Cw(t).parse(e)}static parseInline(e,t){return new Cw(t).parseInline(e)}parse(e){var i,n;this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let r=e[s];if((n=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&n[r.type]){let d=r,u=this.options.extensions.renderers[d.type].call({parser:this},d);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(d.type)){t+=u||"";continue}}let a=r;switch(a.type){case"space":{t+=this.renderer.space(a);break}case"hr":{t+=this.renderer.hr(a);break}case"heading":{t+=this.renderer.heading(a);break}case"code":{t+=this.renderer.code(a);break}case"table":{t+=this.renderer.table(a);break}case"blockquote":{t+=this.renderer.blockquote(a);break}case"list":{t+=this.renderer.list(a);break}case"checkbox":{t+=this.renderer.checkbox(a);break}case"html":{t+=this.renderer.html(a);break}case"def":{t+=this.renderer.def(a);break}case"paragraph":{t+=this.renderer.paragraph(a);break}case"text":{t+=this.renderer.text(a);break}default:{let d='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return t}parseInline(e,t=this.renderer){var n,s;this.renderer.parser=this;let i="";for(let r=0;r<e.length;r++){let a=e[r];if((s=(n=this.options.extensions)==null?void 0:n.renderers)!=null&&s[a.type]){let u=this.options.extensions.renderers[a.type].call({parser:this},a);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){i+=u||"";continue}}let d=a;switch(d.type){case"escape":{i+=t.text(d);break}case"html":{i+=t.html(d);break}case"link":{i+=t.link(d);break}case"image":{i+=t.image(d);break}case"checkbox":{i+=t.checkbox(d);break}case"strong":{i+=t.strong(d);break}case"em":{i+=t.em(d);break}case"codespan":{i+=t.codespan(d);break}case"br":{i+=t.br(d);break}case"del":{i+=t.del(d);break}case"text":{i+=t.text(d);break}default:{let u='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return i}},Kx,og=(Kx=class{constructor(o){kn(this,"options");kn(this,"block");this.options=o||rh}preprocess(o){return o}postprocess(o){return o}processAllTokens(o){return o}emStrongMask(o){return o}provideLexer(o=this.block){return o?Jr.lex:Jr.lexInline}provideParser(o=this.block){return o?ea.parse:ea.parseInline}},kn(Kx,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),kn(Kx,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Kx),qq=class{constructor(...o){kn(this,"defaults",gS());kn(this,"options",this.setOptions);kn(this,"parse",this.parseMarkdown(!0));kn(this,"parseInline",this.parseMarkdown(!1));kn(this,"Parser",ea);kn(this,"Renderer",$v);kn(this,"TextRenderer",ES);kn(this,"Lexer",Jr);kn(this,"Tokenizer",jv);kn(this,"Hooks",og);this.use(...o)}walkTokens(o,e){var i,n;let t=[];for(let s of o)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let r=s;for(let a of r.header)t=t.concat(this.walkTokens(a.tokens,e));for(let a of r.rows)for(let d of a)t=t.concat(this.walkTokens(d.tokens,e));break}case"list":{let r=s;t=t.concat(this.walkTokens(r.items,e));break}default:{let r=s;(n=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&n[r.type]?this.defaults.extensions.childTokens[r.type].forEach(a=>{let d=r[a].flat(1/0);t=t.concat(this.walkTokens(d,e))}):r.tokens&&(t=t.concat(this.walkTokens(r.tokens,e)))}}return t}use(...o){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return o.forEach(t=>{let i={...t};if(i.async=this.defaults.async||i.async||!1,t.extensions&&(t.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let s=e.renderers[n.name];s?e.renderers[n.name]=function(...r){let a=n.renderer.apply(this,r);return a===!1&&(a=s.apply(this,r)),a}:e.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[n.level];s?s.unshift(n.tokenizer):e[n.level]=[n.tokenizer],n.start&&(n.level==="block"?e.startBlock?e.startBlock.push(n.start):e.startBlock=[n.start]:n.level==="inline"&&(e.startInline?e.startInline.push(n.start):e.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(e.childTokens[n.name]=n.childTokens)}),i.extensions=e),t.renderer){let n=this.defaults.renderer||new $v(this.defaults);for(let s in t.renderer){if(!(s in n))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let r=s,a=t.renderer[r],d=n[r];n[r]=(...u)=>{let f=a.apply(n,u);return f===!1&&(f=d.apply(n,u)),f||""}}i.renderer=n}if(t.tokenizer){let n=this.defaults.tokenizer||new jv(this.defaults);for(let s in t.tokenizer){if(!(s in n))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let r=s,a=t.tokenizer[r],d=n[r];n[r]=(...u)=>{let f=a.apply(n,u);return f===!1&&(f=d.apply(n,u)),f}}i.tokenizer=n}if(t.hooks){let n=this.defaults.hooks||new og;for(let s in t.hooks){if(!(s in n))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let r=s,a=t.hooks[r],d=n[r];og.passThroughHooks.has(s)?n[r]=u=>{if(this.defaults.async&&og.passThroughHooksRespectAsync.has(s))return(async()=>{let g=await a.call(n,u);return d.call(n,g)})();let f=a.call(n,u);return d.call(n,f)}:n[r]=(...u)=>{if(this.defaults.async)return(async()=>{let g=await a.apply(n,u);return g===!1&&(g=await d.apply(n,u)),g})();let f=a.apply(n,u);return f===!1&&(f=d.apply(n,u)),f}}i.hooks=n}if(t.walkTokens){let n=this.defaults.walkTokens,s=t.walkTokens;i.walkTokens=function(r){let a=[];return a.push(s.call(this,r)),n&&(a=a.concat(n.call(this,r))),a}}this.defaults={...this.defaults,...i}}),this}setOptions(o){return this.defaults={...this.defaults,...o},this}lexer(o,e){return Jr.lex(o,e??this.defaults)}parser(o,e){return ea.parse(o,e??this.defaults)}parseMarkdown(o){return(e,t)=>{let i={...t},n={...this.defaults,...i},s=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&i.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=o),n.async)return(async()=>{let r=n.hooks?await n.hooks.preprocess(e):e,a=await(n.hooks?await n.hooks.provideLexer(o):o?Jr.lex:Jr.lexInline)(r,n),d=n.hooks?await n.hooks.processAllTokens(a):a;n.walkTokens&&await Promise.all(this.walkTokens(d,n.walkTokens));let u=await(n.hooks?await n.hooks.provideParser(o):o?ea.parse:ea.parseInline)(d,n);return n.hooks?await n.hooks.postprocess(u):u})().catch(s);try{n.hooks&&(e=n.hooks.preprocess(e));let r=(n.hooks?n.hooks.provideLexer(o):o?Jr.lex:Jr.lexInline)(e,n);n.hooks&&(r=n.hooks.processAllTokens(r)),n.walkTokens&&this.walkTokens(r,n.walkTokens);let a=(n.hooks?n.hooks.provideParser(o):o?ea.parse:ea.parseInline)(r,n);return n.hooks&&(a=n.hooks.postprocess(a)),a}catch(r){return s(r)}}}onError(o,e){return t=>{if(t.message+=`
144
+ Please report this to https://github.com/markedjs/marked.`,o){let i="<p>An error occurred:</p><pre>"+ya(t.message+"",!0)+"</pre>";return e?Promise.resolve(i):i}if(e)return Promise.reject(t);throw t}}},Gu=new qq;function os(o,e){return Gu.parse(o,e)}os.options=os.setOptions=function(o){return Gu.setOptions(o),os.defaults=Gu.defaults,TF(os.defaults),os};os.getDefaults=gS;os.defaults=rh;os.use=function(...o){return Gu.use(...o),os.defaults=Gu.defaults,TF(os.defaults),os};os.walkTokens=function(o,e){return Gu.walkTokens(o,e)};os.parseInline=Gu.parseInline;os.Parser=ea;os.parser=ea.parse;os.Renderer=$v;os.TextRenderer=ES;os.Lexer=Jr;os.lexer=Jr.lex;os.Tokenizer=jv;os.Hooks=og;os.parse=os;os.options;os.setOptions;os.use;os.walkTokens;os.parseInline;ea.parse;Jr.lex;var Gq=B('<span class="chat-model svelte-10ayso4"><!></span>'),Kq=B('<button class="clear-btn svelte-10ayso4" title="New conversation">+</button>'),Zq=B('<p class="history-empty svelte-10ayso4">No saved conversations.</p>'),Xq=B('<li><button class="history-load svelte-10ayso4"> </button> <button class="history-del svelte-10ayso4" title="Delete">✕</button></li>'),Yq=B('<ul class="history-list svelte-10ayso4"></ul>'),Qq=B('<div class="history-panel svelte-10ayso4"><div class="history-hdr svelte-10ayso4"><span class="svelte-10ayso4">Conversations</span> <button class="new-conv-btn svelte-10ayso4">+ New</button></div> <!></div>'),Jq=B('<div class="unconfigured svelte-10ayso4">Configure an AI provider in the <strong class="svelte-10ayso4">Config</strong> tab to use the AI assistant.</div>'),eG=B('Chatting in context of <code class="svelte-10ayso4"> </code>',1),tG=B('<button class="chip svelte-10ayso4"> </button>'),iG=B('<div class="suggestions svelte-10ayso4"><p class="suggestions-hint svelte-10ayso4"><!></p> <!></div>'),nG=B('<div class="msg-content user-text svelte-10ayso4"> </div>'),S2=B('<span class="tool-args svelte-10ayso4"> </span>'),D2=B('<div class="tool-event tool-call svelte-10ayso4"><span class="tool-icon svelte-10ayso4">🔧</span> <span class="tool-name svelte-10ayso4"> </span> <!></div>'),A2=B('<div class="tool-event tool-result svelte-10ayso4"><span class="tool-icon svelte-10ayso4">✓</span> <span class="tool-name svelte-10ayso4"> </span></div>'),k2=B('<div class="tool-events svelte-10ayso4"></div>'),B2=B('<div class="text-block svelte-10ayso4"></div>'),sG=B('<button class="create-btn svelte-10ayso4">Save as new file…</button>'),oG=B('<span class="auto-badge svelte-10ayso4" title="Auto-applying AI code to this script in this session">auto ✓</span>'),rG=B('<button class="apply-auto-btn svelte-10ayso4" title="Apply and always apply for this script in this session">always</button>'),aG=B('<button class="apply-btn svelte-10ayso4">Apply</button> <!>',1),lG=B('<button class="expand-btn svelte-10ayso4"> </button>'),cG=B('<div class="code-block svelte-10ayso4"><div class="code-header svelte-10ayso4"><span class="code-lang svelte-10ayso4"> </span> <div class="code-actions svelte-10ayso4"><button class="svelte-10ayso4">Copy</button> <!></div></div> <div><pre class="svelte-10ayso4"><code class="hljs svelte-10ayso4"></code></pre> <!></div></div>'),dG=B('<!> <div class="msg-content svelte-10ayso4"></div>',1),uG=B("<div><!></div>"),hG=B('<div class="message assistant svelte-10ayso4"><div class="msg-content svelte-10ayso4"><span class="status-shimmer svelte-10ayso4"> </span></div></div>'),fG=B('<div class="code-block svelte-10ayso4"><div class="code-header svelte-10ayso4"><span class="code-lang svelte-10ayso4"> </span></div> <pre class="svelte-10ayso4"><code class="hljs svelte-10ayso4"></code></pre></div>'),gG=B('<div class="message assistant streaming svelte-10ayso4"><div class="msg-content svelte-10ayso4"></div></div>'),pG=B('<div class="chat-error svelte-10ayso4"> </div>'),xG=B('<span class="ctx-indicator svelte-10ayso4"><svg width="12" height="12" viewBox="0 0 12 12" class="svelte-10ayso4"><circle cx="6" cy="6" r="5" fill="none" stroke="var(--border-sub)" stroke-width="2" class="svelte-10ayso4"></circle><circle cx="6" cy="6" r="5" fill="none" stroke-width="2" stroke-dashoffset="7.85" stroke-linecap="round" class="svelte-10ayso4"></circle></svg></span>'),mG=B('<span><span> </span> <span class="chip-name svelte-10ayso4"> </span> <button class="chip-remove svelte-10ayso4"> </button></span>'),vG=B('<span class="file-chip svelte-10ayso4"><span> </span> <span class="chip-name svelte-10ayso4"> </span> <button class="chip-remove svelte-10ayso4" title="Remove from context">×</button></span>'),_G=B('<button class="stop-btn svelte-10ayso4" title="Stop generation">■</button>'),bG=B('<button class="send-btn svelte-10ayso4">↑</button>'),CG=B('<option class="svelte-10ayso4"> </option>'),EG=B('<select class="model-select svelte-10ayso4"></select>'),yG=B('<span class="model-name svelte-10ayso4"> </span>'),wG=B('<button class="info-btn svelte-10ayso4" title="Model info">ℹ</button>'),SG=B('<div class="model-bar svelte-10ayso4"><span class="model-provider svelte-10ayso4"> </span> <!> <!></div>'),DG=B('<p class="info-status svelte-10ayso4">Loading…</p>'),AG=B('<p class="info-status info-err svelte-10ayso4"> </p>'),kG=B('<dt class="svelte-10ayso4">Ollama version</dt><dd class="svelte-10ayso4"> </dd>',1),BG=B('<dt class="svelte-10ayso4">Family</dt><dd class="svelte-10ayso4"> </dd>',1),FG=B('<dt class="svelte-10ayso4">Parameters</dt><dd class="svelte-10ayso4"> </dd>',1),LG=B('<dt class="svelte-10ayso4">Quantization</dt><dd class="svelte-10ayso4"> </dd>',1),IG=B('<dt class="svelte-10ayso4">Format</dt><dd class="svelte-10ayso4"> </dd>',1),PG=B('<div class="running-model svelte-10ayso4"> </div>'),TG=B('<dt class="svelte-10ayso4">Loaded</dt> <dd class="svelte-10ayso4"></dd>',1),MG=B('<dt class="svelte-10ayso4">Loaded</dt><dd class="dim svelte-10ayso4">Not in memory</dd>',1),RG=B('<dl class="svelte-10ayso4"><!> <!> <!> <!> <!> <!></dl>'),NG=B('<div class="info-overlay svelte-10ayso4"><div class="info-popup svelte-10ayso4"><div class="info-popup-header svelte-10ayso4"><span class="svelte-10ayso4"> </span> <button title="Close" class="svelte-10ayso4">✕</button></div> <div class="info-popup-body svelte-10ayso4"><!></div></div></div>'),OG=B('<div class="chat-panel svelte-10ayso4"><div class="chat-header svelte-10ayso4"><span class="chat-title svelte-10ayso4">AI Assistant</span> <!> <button title="Conversation history"><svg width="13" height="13" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" class="svelte-10ayso4"><circle cx="8" cy="8" r="6" class="svelte-10ayso4"></circle><polyline points="8,5 8,8 10,10" class="svelte-10ayso4"></polyline></svg></button> <!></div> <!> <div class="messages svelte-10ayso4"><!> <!> <!> <!> <!></div> <!> <div class="context-row svelte-10ayso4"><label title="Include she API reference in context" class="svelte-10ayso4"><input type="checkbox" class="svelte-10ayso4"/><span class="checkmark svelte-10ayso4"></span> she API</label> <label title="Let the AI query MQTT state, sheDB documents and Matter devices on demand. Disables real-time streaming." class="svelte-10ayso4"><input type="checkbox" class="svelte-10ayso4"/><span class="checkmark svelte-10ayso4"></span> 😎 Agent</label> <span class="req-size svelte-10ayso4"> <!></span></div> <div class="files-row svelte-10ayso4"><!> <!> <button class="add-file-btn svelte-10ayso4" title="Attach file to context">+</button> <input type="file" multiple="" class="file-input-hidden svelte-10ayso4"/></div> <div><div><textarea rows="3" class="svelte-10ayso4"></textarea></div> <!></div> <!></div> <!>',1);function HG(o,e){$s(e,!0),zv.registerLanguage("javascript",PF),os.use({breaks:!0,gfm:!0});let t=Tu(e,"currentScript",3,null),i=Tu(e,"extraFiles",31,()=>Li([])),n=F(Li([])),s=F(null),r=F(""),a=F(!1),d=F(""),u=F(null);const f="she:conversationId";function g(){return crypto.randomUUID().replace(/-/g,"").slice(0,16)}let p=F(Li(localStorage.getItem(f)??g())),C=F(Li([])),b=F(!1);Kn(()=>{localStorage.setItem(f,c(p))});let y=F(Li([])),w=F(Li(localStorage.getItem("she:selectedModel")??"")),A=F(null);const I=Lt(()=>{var Z;return c(A)!==null&&((Z=t())==null?void 0:Z.path)===c(A)});let T=F(Li(new Set)),R=F(!1),P=F(null),V=F(!1),j=F(""),J=F(0),ae=null,fe=F(0);const X=["[core] reticulating splines…","[io] calibrating the flux capacitor…","[net] pinging the oracle (no response)…","[gpu] overclocking the neurons…","[fs] loading sarcasm module v4.2…","[mem] defragmenting the embedding space…","[sched] running gradient descent into madness…","[net] synchronizing with the hive mind…","[model] tickling the transformer…","[io] consulting rubber duck debugger…","[core] solving P=NP as a warmup…","[gpu] burning GPU cycles for warmth…","[mem] compressing knowledge into tensors…","[net] asking my inner voice (busy)…","[fs] mining opinions from the void…","[core] summoning attention heads…","[io] tokenizing the vibes…","[sched] hallucinating thoughtfully…","[net] traversing the knowledge graph…","[model] manifesting an answer…"];let ce=F(!0),me=F(!0),oe=F(!0),le=F(!1),Ae,Te=F(Li([])),xe,Ne;const Ve=Lt(()=>({apiref:c(ce),tools:c(me)})),ve=Lt(()=>{var Z;return((Z=c(u))==null?void 0:Z.configured)??!1}),mt=Lt(()=>{var Z;return c(ve)||!!((Z=c(u))!=null&&Z.provider)&&!!c(w)}),Mt=Lt(()=>c(J)+new TextEncoder().encode(c(r)).length),ot=Lt(()=>c(oe)?t():null);Kn(()=>{var de;const Z=(de=t())==null?void 0:de.path;m(oe,!0),c(A)!==null&&Z!==c(A)&&m(A,null)}),Kn(()=>{var Ft;if(!c(I))return;const Z=c(n).at(-1);if(!Z||Z.role!=="assistant")return;const Ue=be(Z.content).find(we=>we.type==="code"&&ki(we.lang));if(Ue){const we=_i(Ue.text);(Ft=e.onApply)==null||Ft.call(e,we?we.code:Ue.text)}});async function yt(){try{const Z=await CF();m(u,Z,!0),Z.configured&&!c(w)&&m(w,Z.model,!0)}catch{}}Kn(()=>(window.addEventListener("she:config-changed",yt),()=>window.removeEventListener("she:config-changed",yt))),Kn(()=>{c(w)&&localStorage.setItem("she:selectedModel",c(w))}),Kn(()=>{var Z;(Z=c(u))!=null&&Z.provider&&EF().then(de=>{m(y,de.models,!0),!c(w)&&de.models.length>0&&m(w,de.models[0],!0)}).catch(()=>{})}),Kn(()=>{c(w),m(P,null),m(j,"")}),Kn(()=>{var de,Ue;if(((de=c(u))==null?void 0:de.provider)!=="ollama")return;const Z=c(w)||((Ue=c(u))==null?void 0:Ue.model);!Z||c(P)||mw(Z).then(Ft=>{m(P,Ft,!0)}).catch(()=>{})}),Kn(()=>{if(!c(a))return;m(fe,Math.floor(Math.random()*X.length),!0);const Z=setInterval(()=>{m(fe,(c(fe)+1)%X.length)},1e4);return()=>clearInterval(Z)}),Kn(()=>{var Z;Ne&&(c(n).length+(((Z=c(s))==null?void 0:Z.length)??0),requestAnimationFrame(()=>{Ne&&(Ne.scrollTop=Ne.scrollHeight)}))}),Kn(()=>{const Z=c(Ve),de=c(ot),Ue=i();c(mt)&&yF({context:Z,currentScript:de??null,extraFiles:Ue.length>0?Ue:void 0}).then(Ft=>{m(J,new TextEncoder().encode(Ft.prompt).length,!0)}).catch(()=>{})});function be(Z){const de=Z.replace(/(\n|^)(\/{2} @[a-z-]+:[^\n]+)\n(```\w*)\n/g,`$1$3
145
+ $2
146
+ `),Ue=[],Ft=/```(\w*)\n([\s\S]*?)```/g;let we=0,Oe;for(;(Oe=Ft.exec(de))!==null;)Oe.index>we&&Ue.push({type:"text",text:de.slice(we,Oe.index)}),Ue.push({type:"code",lang:Oe[1]||"text",text:Oe[2].trimEnd()}),we=Oe.index+Oe[0].length;return we<de.length&&Ue.push({type:"text",text:de.slice(we)}),Ue}const Nt=15;function si(Z){return Z.split(`
147
+ `).length>Nt}function Xe(Z){const de=new Set(c(T));de.has(Z)?de.delete(Z):de.add(Z),m(T,de,!0)}function tt(Z,de){if(ki(de))try{return zv.highlight(Z,{language:"javascript"}).value}catch{}return Z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function wt(Z){return os.parse(Z)}function Yt(Z){const de=Z.replace(/(\n|^)(\/{2} @[a-z-]+:[^\n]+)\n(```\w*)\n/g,`$1$3
148
+ $2
149
+ `),Ue=[],Ft=/```(\w*)\n([\s\S]*?)```/g;let we=0,Oe;for(;(Oe=Ft.exec(de))!==null;)Oe.index>we&&Ue.push({type:"text",text:de.slice(we,Oe.index)}),Ue.push({type:"code",lang:Oe[1]||"text",text:Oe[2].trimEnd()}),we=Oe.index+Oe[0].length;const St=de.slice(we),ut=St.match(/```(\w*)\n([\s\S]*)$/);return ut?(ut.index>0&&Ue.push({type:"text",text:St.slice(0,ut.index)}),Ue.push({type:"code",lang:ut[1]||"text",text:ut[2]})):St&&Ue.push({type:"text",text:St}),Ue}function fi(Z){navigator.clipboard.writeText(Z).catch(()=>{})}function oi(Z,de=!1){var Ue;de&&t()&&m(A,t().path,!0),(Ue=e.onApply)==null||Ue.call(e,Z)}function ki(Z){return!Z||Z==="js"||Z==="javascript"}function _i(Z){const de=Z.match(/^\/\/ @new-file:\s*(\S+\.js)[ \t]*\n/);return de?{filename:de[1],code:Z.slice(de[0].length)}:null}function Ze(Z){return Z>=1e9?`${(Z/1e9).toFixed(1)} GB`:Z>=1e6?`${(Z/1e6).toFixed(0)} MB`:Z>=1024?`${(Z/1024).toFixed(1)} kB`:`${Z} B`}async function Ee(){if(m(R,!0),!(c(P)||c(V))){m(V,!0),m(j,"");try{m(P,await mw(c(w)||c(u).model),!0)}catch(Z){m(j,Z.message,!0)}m(V,!1)}}function ii(Z){const de=Z.match(/\.([^.]+)$/);return de?de[1].toUpperCase():"?"}function Ci(Z){switch(Z){case"SH":case"BASH":return"$";case"MD":case"MARKDOWN":return"⇓";case"JSON":case"JSONC":return"{}";default:return Z}}function Jt(Z){i(i().filter((de,Ue)=>Ue!==Z))}function zi(){Ae.click()}async function Ji(Z){if(!(!Z||Z.length===0))for(const de of Array.from(Z)){const Ue=await de.text();i([...i(),{name:de.name,content:Ue}])}}function Ii(Z){const de=Z.target;Ji(de.files),de.value=""}function wn(Z){var de;Z.preventDefault(),m(le,!1),Ji(((de=Z.dataTransfer)==null?void 0:de.files)??null)}function cn(Z){var de;(de=Z.dataTransfer)!=null&&de.types.includes("Files")&&(Z.preventDefault(),m(le,!0))}function pn(){m(le,!1)}async function fn(){try{m(C,await sU(),!0)}catch{}}async function pt(){var de;if(c(n).length===0)return;const Z=((de=c(n).find(Ue=>Ue.role==="user"))==null?void 0:de.content.slice(0,80))??c(p);try{await oU(c(p),Z,c(n)),await fn()}catch{}}async function Ut(Z){try{const de=await h2(Z);m(n,de.messages,!0),m(p,Z,!0),m(b,!1),m(d,"")}catch{}}async function Ni(Z){try{await rU(Z),await fn(),Z===c(p)&&qi()}catch{}}function qi(){m(n,[],!0),m(d,""),m(p,g(),!0),m(b,!1)}Xs(async()=>{yt();try{const Z=await h2(c(p));m(n,Z.messages,!0)}catch{}await fn()});async function gi(){const Z=c(r).trim();if(!Z||c(a))return;m(r,""),m(d,""),m(a,!0);const de={role:"user",content:Z};m(n,[...c(n),de],!0),ae=new AbortController,m(Te,[],!0);try{await wF({messages:c(n),currentScript:c(ot),context:c(Ve),modelOverride:c(w)||void 0,extraFiles:i().length>0?i():void 0},Ue=>{m(s,(c(s)??"")+Ue)},ae.signal,Ue=>{m(Te,[...c(Te),Ue],!0)}),m(n,[...c(n),{role:"assistant",content:c(s)??"",toolEvents:c(Te).length>0?[...c(Te)]:void 0}],!0),m(Te,[],!0)}catch(Ue){if(Ue.name==="AbortError"){const Ft=c(s);Ft&&Ft.trim()&&m(n,[...c(n),{role:"assistant",content:Ft+`
150
+
151
+ *[stopped]*`,toolEvents:c(Te).length>0?[...c(Te)]:void 0}],!0)}else m(d,Ue.message,!0)}finally{ae=null,m(s,null),m(Te,[],!0),m(a,!1),pt()}}function Wi(){ae==null||ae.abort()}function Ui(Z){Z.key==="Enter"&&!Z.shiftKey&&(Z.preventDefault(),gi())}function tn(){qi()}const yi=["Explain what this script does","Add error handling","Add a 30-minute schedule before sunrise","Write a new script that forwards MQTT topic A to topic B","Write a new script that turns lights on at sunset"];function Vi(Z){m(r,Z,!0),xe==null||xe.focus()}var ze=OG(),qt=Et(ze),wi=_(qt),ji=v(_(wi),2);{var Si=Z=>{var de=Gq(),Ue=_(de);{var Ft=St=>{var ut=oo();z(()=>W(ut,`${c(u).provider??""} · ${(c(w)||c(u).model)??""}`)),D(St,ut)},we=St=>{var ut=oo();z(()=>W(ut,`${c(u).provider??""} · pick a model below`)),D(St,ut)},Oe=St=>{var ut=oo("Not configured");D(St,ut)};H(Ue,St=>{c(mt)?St(Ft):c(u).provider?St(we,1):St(Oe,-1)})}z(()=>ln(de,"title",`Provider: ${c(u).provider??""}`)),D(Z,de)};H(ji,Z=>{c(u)&&Z(Si)})}var K=v(ji,2);let De;var Qe=v(K,2);{var it=Z=>{var de=Kq();$("click",de,tn),D(Z,de)};H(Qe,Z=>{c(n).length>0&&Z(it)})}var Gt=v(wi,2);{var li=Z=>{var de=Qq(),Ue=_(de),Ft=v(_(Ue),2),we=v(Ue,2);{var Oe=ut=>{var nt=Zq();D(ut,nt)},St=ut=>{var nt=Yq();ti(nt,21,()=>c(C),ue=>ue.id,(ue,He)=>{var Fe=Xq();let Je;var ht=_(Fe),Ke=_(ht),et=v(ht,2);z(()=>{Je=At(Fe,1,"history-item svelte-10ayso4",null,Je,{"history-active":c(He).id===c(p)}),ln(ht,"title",c(He).id),W(Ke,c(He).title||c(He).id)}),$("click",ht,()=>Ut(c(He).id)),$("click",et,()=>Ni(c(He).id)),D(ue,Fe)}),D(ut,nt)};H(we,ut=>{c(C).length===0?ut(Oe):ut(St,-1)})}$("click",Ft,qi),D(Z,de)};H(Gt,Z=>{c(b)&&Z(li)})}var vt=v(Gt,2),ft=_(vt);{var Y=Z=>{var de=Jq();D(Z,de)},Re=Z=>{var de=iG(),Ue=_(de),Ft=_(Ue);{var we=ut=>{var nt=eG(),ue=v(Et(nt)),He=_(ue);z(Fe=>W(He,Fe),[()=>t().path.split("/").pop()]),D(ut,nt)},Oe=ut=>{var nt=oo("No script open. Ask a general she scripting question.");D(ut,nt)};H(Ft,ut=>{t()?ut(we):ut(Oe,-1)})}var St=v(Ue,2);ti(St,17,()=>yi,Hi,(ut,nt)=>{var ue=tG(),He=_(ue);z(()=>W(He,c(nt))),$("click",ue,()=>Vi(c(nt))),D(ut,ue)}),D(Z,de)};H(ft,Z=>{c(ve)?c(n).length===0&&c(s)===null&&Z(Re,1):Z(Y)})}var dt=v(ft,2);ti(dt,17,()=>c(n),Hi,(Z,de,Ue)=>{var Ft=uG(),we=_(Ft);{var Oe=ut=>{var nt=nG(),ue=_(nt);z(()=>W(ue,c(de).content)),D(ut,nt)},St=ut=>{const nt=Lt(()=>be(c(de).content));var ue=dG(),He=Et(ue);{var Fe=ht=>{var Ke=k2();ti(Ke,21,()=>c(de).toolEvents,Hi,(et,ge)=>{var $e=Ss(),_t=Et($e);{var Wt=pi=>{var Di=D2(),Xi=v(_(Di),2),Mi=_(Xi),ai=v(Xi,2);{var Ht=jt=>{var Zt=S2(),hi=_(Zt);z(nn=>W(hi,nn),[()=>Object.entries(c(ge).args).map(([nn,dn])=>`${nn}=${JSON.stringify(dn)}`).join(", ")]),D(jt,Zt)},Dt=Lt(()=>c(ge).args&&Object.keys(c(ge).args).length>0);H(ai,jt=>{c(Dt)&&jt(Ht)})}z(jt=>W(Mi,jt),[()=>c(ge).name.replace(/_/g," ")]),D(pi,Di)},bt=pi=>{var Di=A2(),Xi=v(_(Di),2),Mi=_(Xi);z(ai=>W(Mi,ai),[()=>c(ge).name.replace(/_/g," ")]),D(pi,Di)};H(_t,pi=>{c(ge).type==="tool_call"?pi(Wt):pi(bt,-1)})}D(et,$e)}),D(ht,Ke)};H(He,ht=>{var Ke;(Ke=c(de).toolEvents)!=null&&Ke.length&&ht(Fe)})}var Je=v(He,2);ti(Je,21,()=>c(nt),Hi,(ht,Ke,et)=>{var ge=Ss(),$e=Et(ge);{var _t=bt=>{var pi=B2();hc(pi,()=>wt(c(Ke).text),!0),D(bt,pi)},Wt=bt=>{const pi=Lt(()=>ki(c(Ke).lang)?_i(c(Ke).text):null),Di=Lt(()=>c(pi)?c(pi).code:c(Ke).text),Xi=Lt(()=>`${Ue}:${et}`),Mi=Lt(()=>si(c(Di))),ai=Lt(()=>c(T).has(c(Xi)));var Ht=cG(),Dt=_(Ht),jt=_(Dt),Zt=_(jt),hi=v(jt,2),nn=_(hi),dn=v(nn,2);{var Ln=Gn=>{var vs=sG();$("click",vs,()=>e.onCreateFile(c(pi).filename,c(pi).code)),D(Gn,vs)},Oi=Gn=>{var vs=aG(),ir=Et(vs),zr=v(ir,2);{var Xa=pr=>{var Vr=oG();D(pr,Vr)},zl=pr=>{var Vr=rG();$("click",Vr,()=>oi(c(Ke).text,!0)),D(pr,Vr)};H(zr,pr=>{c(I)?pr(Xa):pr(zl,-1)})}$("click",ir,()=>oi(c(Ke).text)),D(Gn,vs)},Dn=Lt(()=>ki(c(Ke).lang)&&t());H(dn,Gn=>{c(pi)&&e.onCreateFile?Gn(Ln):c(Dn)&&Gn(Oi,1)})}var Jn=v(Dt,2);let In;var es=_(Jn),Zi=_(es);hc(Zi,()=>tt(c(Di),c(Ke).lang??""),!0);var Is=v(es,2);{var Tn=Gn=>{var vs=lG(),ir=_(vs);z(()=>W(ir,c(ai)?"▲ collapse":"▼ expand")),$("click",vs,()=>Xe(c(Xi))),D(Gn,vs)};H(Is,Gn=>{c(Mi)&&Gn(Tn)})}z(()=>{W(Zt,c(pi)?`new: ${c(pi).filename}`:c(Ke).lang),In=At(Jn,1,"code-body svelte-10ayso4",null,In,{collapsed:c(Mi)&&!c(ai)})}),$("click",nn,()=>fi(c(Di))),D(bt,Ht)};H($e,bt=>{c(Ke).type==="text"?bt(_t):bt(Wt,-1)})}D(ht,ge)}),D(ut,ue)};H(we,ut=>{c(de).role==="user"?ut(Oe):ut(St,-1)})}z(()=>At(Ft,1,`message ${c(de).role??""}`,"svelte-10ayso4")),D(Z,Ft)});var ye=v(dt,2);{var ci=Z=>{var de=k2();ti(de,21,()=>c(Te),Hi,(Ue,Ft)=>{var we=Ss(),Oe=Et(we);{var St=nt=>{var ue=D2(),He=v(_(ue),2),Fe=_(He),Je=v(He,2);{var ht=et=>{var ge=S2(),$e=_(ge);z(_t=>W($e,_t),[()=>Object.entries(c(Ft).args).map(([_t,Wt])=>`${_t}=${JSON.stringify(Wt)}`).join(", ")]),D(et,ge)},Ke=Lt(()=>c(Ft).args&&Object.keys(c(Ft).args).length>0);H(Je,et=>{c(Ke)&&et(ht)})}z(et=>W(Fe,et),[()=>c(Ft).name.replace(/_/g," ")]),D(nt,ue)},ut=nt=>{var ue=A2(),He=v(_(ue),2),Fe=_(He);z(Je=>W(Fe,Je),[()=>c(Ft).name.replace(/_/g," ")]),D(nt,ue)};H(Oe,nt=>{c(Ft).type==="tool_call"?nt(St):nt(ut,-1)})}D(Ue,we)}),D(Z,de)};H(ye,Z=>{c(Te).length>0&&Z(ci)})}var It=v(ye,2);{var ie=Z=>{var de=hG(),Ue=_(de),Ft=_(Ue),we=_(Ft);z(()=>W(we,X[c(fe)])),D(Z,de)};H(It,Z=>{c(a)&&c(s)===null&&c(Te).length===0&&Z(ie)})}var Ye=v(It,2);{var kt=Z=>{var de=gG(),Ue=_(de);ti(Ue,21,()=>Yt(c(s)),Hi,(Ft,we)=>{var Oe=Ss(),St=Et(Oe);{var ut=ue=>{var He=B2();hc(He,()=>wt(c(we).text),!0),D(ue,He)},nt=ue=>{var He=fG(),Fe=_(He),Je=_(Fe),ht=_(Je),Ke=v(Fe,2),et=_(Ke);hc(et,()=>tt(c(we).text,c(we).lang??""),!0),z(()=>W(ht,c(we).lang)),D(ue,He)};H(St,ue=>{c(we).type==="text"?ue(ut):ue(nt,-1)})}D(Ft,Oe)}),D(Z,de)};H(Ye,Z=>{c(s)!==null&&Z(kt)})}gs(vt,Z=>Ne=Z,()=>Ne);var Pt=v(vt,2);{var Bt=Z=>{var de=pG(),Ue=_(de);z(()=>W(Ue,c(d))),D(Z,de)};H(Pt,Z=>{c(d)&&Z(Bt)})}var Be=v(Pt,2),je=_(Be),Kt=_(je),ri=v(je,2),ui=_(ri),Xt=v(ri,2),pe=_(Xt),Ge=v(pe);{var rt=Z=>{const de=Lt(()=>Math.min(100,Math.round(c(Mt)/4/c(P).contextLength*100)));var Ue=xG(),Ft=_(Ue),we=v(_(Ft));z((Oe,St)=>{ln(Ue,"title",`~${c(de)??""}% of ${Oe??""} token context window used`),ln(we,"stroke",c(de)>80?"var(--fg-err)":c(de)>50?"var(--fg-warn)":"var(--fg-ok)"),ln(we,"stroke-dasharray",`${St??""} 31.4`)},[()=>c(P).contextLength.toLocaleString(),()=>(c(de)/100*31.4).toFixed(1)]),D(Z,Ue)};H(Ge,Z=>{var de;(de=c(P))!=null&&de.contextLength&&Z(rt)})}var lt=v(Be,2),Vt=_(lt);{var Ot=Z=>{const de=Lt(()=>ii(t().path.split("/").pop()??t().path));var Ue=mG();let Ft;var we=_(Ue),Oe=_(we),St=v(we,2),ut=_(St),nt=v(St,2),ue=_(nt);z((He,Fe)=>{Ft=At(Ue,1,"file-chip svelte-10ayso4",null,Ft,{inactive:!c(oe)}),At(we,1,`badge badge-${He??""}`,"svelte-10ayso4"),W(Oe,Fe),W(ut,t().path),ln(nt,"title",c(oe)?"Remove from context":"Re-add to context"),W(ue,c(oe)?"×":"+")},[()=>c(de).toLowerCase(),()=>Ci(c(de))]),$("click",nt,()=>m(oe,!c(oe))),D(Z,Ue)};H(Vt,Z=>{t()&&Z(Ot)})}var bi=v(Vt,2);ti(bi,17,i,Hi,(Z,de,Ue)=>{const Ft=Lt(()=>ii(c(de).name));var we=vG(),Oe=_(we),St=_(Oe),ut=v(Oe,2),nt=_(ut),ue=v(ut,2);z((He,Fe)=>{At(Oe,1,`badge badge-${He??""}`,"svelte-10ayso4"),W(St,Fe),W(nt,c(de).name)},[()=>c(Ft).toLowerCase(),()=>Ci(c(Ft))]),$("click",ue,()=>Jt(Ue)),D(Z,we)});var U=v(bi,2),M=v(U,2);gs(M,Z=>Ae=Z,()=>Ae);var O=v(lt,2);let ee;var ne=_(O);let se;var re=_(ne);gs(re,Z=>xe=Z,()=>xe);var Ie=v(ne,2);{var We=Z=>{var de=_G();$("click",de,Wi),D(Z,de)},Ce=Z=>{var de=bG();z(Ue=>de.disabled=Ue,[()=>!c(r).trim()||!c(mt)]),$("click",de,gi),D(Z,de)};H(Ie,Z=>{c(a)?Z(We):Z(Ce,-1)})}var Pe=v(O,2);{var Me=Z=>{var de=SG(),Ue=_(de),Ft=_(Ue),we=v(Ue,2);{var Oe=ue=>{var He=EG();ti(He,21,()=>c(y),Hi,(Fe,Je)=>{var ht=CG(),Ke=_(ht),et={};z(()=>{W(Ke,c(Je)),et!==(et=c(Je))&&(ht.value=(ht.__value=c(Je))??"")}),D(Fe,ht)}),z(()=>He.disabled=c(a)),Ls(He,()=>c(w),Fe=>m(w,Fe)),D(ue,He)},St=ue=>{var He=yG(),Fe=_(He);z(()=>W(Fe,c(w)||c(u).model)),D(ue,He)};H(we,ue=>{c(y).length>0?ue(Oe):ue(St,-1)})}var ut=v(we,2);{var nt=ue=>{var He=wG();$("click",He,Ee),D(ue,He)};H(ut,ue=>{c(u).provider==="ollama"&&ue(nt)})}z(()=>W(Ft,c(u).provider)),D(Z,de)};H(Pe,Z=>{var de;(de=c(u))!=null&&de.provider&&(c(ve)||c(y).length>0)&&Z(Me)})}var at=v(qt,2);{var Qt=Z=>{var de=NG(),Ue=_(de),Ft=_(Ue),we=_(Ft),Oe=_(we),St=v(we,2),ut=v(Ft,2),nt=_(ut);{var ue=Je=>{var ht=DG();D(Je,ht)},He=Je=>{var ht=AG(),Ke=_(ht);z(()=>W(Ke,c(j))),D(Je,ht)},Fe=Je=>{var ht=RG(),Ke=_(ht);{var et=Dt=>{var jt=kG(),Zt=v(Et(jt)),hi=_(Zt);z(()=>W(hi,c(P).version)),D(Dt,jt)};H(Ke,Dt=>{c(P).version&&Dt(et)})}var ge=v(Ke,2);{var $e=Dt=>{var jt=BG(),Zt=v(Et(jt)),hi=_(Zt);z(()=>W(hi,c(P).details.family)),D(Dt,jt)};H(ge,Dt=>{var jt;(jt=c(P).details)!=null&&jt.family&&Dt($e)})}var _t=v(ge,2);{var Wt=Dt=>{var jt=FG(),Zt=v(Et(jt)),hi=_(Zt);z(()=>W(hi,c(P).details.parameter_size)),D(Dt,jt)};H(_t,Dt=>{var jt;(jt=c(P).details)!=null&&jt.parameter_size&&Dt(Wt)})}var bt=v(_t,2);{var pi=Dt=>{var jt=LG(),Zt=v(Et(jt)),hi=_(Zt);z(()=>W(hi,c(P).details.quantization_level)),D(Dt,jt)};H(bt,Dt=>{var jt;(jt=c(P).details)!=null&&jt.quantization_level&&Dt(pi)})}var Di=v(bt,2);{var Xi=Dt=>{var jt=IG(),Zt=v(Et(jt)),hi=_(Zt);z(()=>W(hi,c(P).details.format)),D(Dt,jt)};H(Di,Dt=>{var jt;(jt=c(P).details)!=null&&jt.format&&Dt(Xi)})}var Mi=v(Di,2);{var ai=Dt=>{var jt=TG(),Zt=v(Et(jt),2);ti(Zt,21,()=>c(P).running,Hi,(hi,nn)=>{var dn=PG(),Ln=_(dn);z(Oi=>W(Ln,`${c(nn).name??""} · ${Oi??""} VRAM`),[()=>Ze(c(nn).size_vram)]),D(hi,dn)}),D(Dt,jt)},Ht=Dt=>{var jt=MG();D(Dt,jt)};H(Mi,Dt=>{c(P).running&&c(P).running.length>0?Dt(ai):c(P).running!==null&&Dt(Ht,1)})}D(Je,ht)};H(nt,Je=>{c(V)?Je(ue):c(j)?Je(He,1):c(P)&&Je(Fe,2)})}z(()=>{var Je;return W(Oe,`Ollama · ${(c(w)||((Je=c(u))==null?void 0:Je.model))??""}`)}),$("click",de,()=>m(R,!1)),$("click",Ue,Je=>Je.stopPropagation()),$("click",St,()=>m(R,!1)),D(Z,de)};H(at,Z=>{c(R)&&Z(Qt)})}z(Z=>{De=At(K,1,"icon-hdr-btn svelte-10ayso4",null,De,{active:c(b)}),W(pe,Z),ee=At(O,1,"input-row svelte-10ayso4",null,ee,{"drag-over":c(le)}),se=At(ne,1,"textarea-wrap svelte-10ayso4",null,se,{loading:c(a)}),ln(re,"placeholder",c(mt)?"Ask anything… (Enter to send, Shift+Enter for newline, drag & drop files to add context)":c(ve)?"Select a model above to start chatting":"AI not configured"),re.disabled=c(a)||!c(mt)},[()=>Ze(c(Mt))]),$("click",K,()=>m(b,!c(b))),ws(Kt,()=>c(ce),Z=>m(ce,Z)),ws(ui,()=>c(me),Z=>m(me,Z)),$("click",U,zi),$("change",M,Ii),xs("dragover",O,cn),xs("dragleave",O,pn),xs("drop",O,wn),$("keydown",re,Ui),zt(re,()=>c(r),Z=>m(r,Z)),D(o,ze),Us()}Ys(["click","change","keydown"]);const WG={OnOff:["onOff","globalSceneControl","onTime","offWaitTime"],LevelControl:["currentLevel","remainingTime","minLevel","maxLevel","currentFrequency","onOffTransitionTime","onLevel"],ColorControl:["currentHue","currentSaturation","remainingTime","currentX","currentY","colorTemperatureMireds","colorMode","colorTempPhysicalMinMireds","colorTempPhysicalMaxMireds"],BasicInformation:["vendorName","vendorId","productName","productId","nodeLabel","location","softwareVersion","softwareVersionString","serialNumber"],Identify:["identifyTime","identifyType"],Groups:["nameSupport"],OccupancySensing:["occupancy","occupancySensorType"],IlluminanceMeasurement:["measuredValue","minMeasuredValue","maxMeasuredValue","tolerance","lightSensorType"],TemperatureMeasurement:["measuredValue","minMeasuredValue","maxMeasuredValue","tolerance"],RelativeHumidityMeasurement:["measuredValue","minMeasuredValue","maxMeasuredValue","tolerance"],PressureMeasurement:["measuredValue","minMeasuredValue","maxMeasuredValue"],Thermostat:["localTemperature","outdoorTemperature","occupiedCoolingSetpoint","occupiedHeatingSetpoint","unoccupiedCoolingSetpoint","unoccupiedHeatingSetpoint","minHeatSetpointLimit","maxHeatSetpointLimit","systemMode","thermostatRunningMode","occupancy"],DoorLock:["lockState","lockType","actuatorEnabled","doorState"],WindowCovering:["type","currentPositionLiftPercent100ths","currentPositionTiltPercent100ths","operationalStatus","targetPositionLiftPercent100ths","targetPositionTiltPercent100ths","endProductType","mode"],FanControl:["fanMode","fanModeSequence","percentSetting","percentCurrent","speedMax","speedSetting","speedCurrent"],Descriptor:["deviceTypeList","serverList","clientList","partsList"],PowerSource:["status","order","description","wiredCurrentType","wiredMaximumCurrent","batteryVoltage","batteryPercentRemaining","batChargeLevel"],Switch:["numberOfPositions","currentPosition","multiPressMax"],BooleanState:["stateValue"],FlowMeasurement:["measuredValue","minMeasuredValue","maxMeasuredValue"]},zG={OnOff:["on","off","toggle"],LevelControl:["moveToLevel","move","step","stop","moveToLevelWithOnOff","moveWithOnOff","stepWithOnOff","stopWithOnOff"],ColorControl:["moveToHue","moveHue","stepHue","moveToSaturation","moveSaturation","stepSaturation","moveToHueAndSaturation","moveToColor","moveColor","stepColor","moveToColorTemperature","moveColorTemperature","stepColorTemperature"],Identify:["identify","triggerEffect"],Groups:["addGroup","viewGroup","getGroupMembership","removeGroup","removeAllGroups","addGroupIfIdentifying"],Thermostat:["setpointRaiseLower","setWeeklySchedule","getWeeklySchedule","clearWeeklySchedule"],DoorLock:["lockDoor","unlockDoor","unlockWithTimeout"],WindowCovering:["upOrOpen","downOrClose","stopMotion","goToLiftValue","goToLiftPercentage","goToTiltValue","goToTiltPercentage"],FanControl:[]};let Ew=[],yw=[],ww=[];const Uv=new Map;let $F=[];const Sw=new Map,Dw=new Map;async function F2(){try{Ew=(await bF()).map(e=>e.topic)}catch{}}async function L2(){try{const[o,e]=await Promise.all([mF(),vF()]);yw=o,ww=e}catch{}}async function I2(){try{const o=await cS();$F=o.map(e=>e.nodeId),Sw.clear(),Dw.clear();for(const e of o)e.name&&(Sw.set(e.nodeId,e.name),Dw.set(e.name,e.nodeId));await Promise.all(o.map(async e=>{if(!Uv.has(e.nodeId))try{Uv.set(e.nodeId,await _m(e.nodeId))}catch{}}))}catch{}}function VG(o){const e=/(?:she\.mqtt\.(?:sub|pub|get|set|link|age|getProp|or|and|max|min|timer)|she\.(?:getValue|setValue|getProp))\s*\([^)]*?['"]([^'"]*)\s*$/,t=o.match(e);if(t)return{type:"mqtt",prefix:t[1]};const i=/she\.db\.sub\s*\([^)]*?['"]([^'"]*)\s*$/,n=o.match(i);if(n)return{type:"db",prefix:n[1],includeViews:!0};const s=/she\.db\.(?:get|set|extend|delete|prop|query)\s*\([^)]*?['"]([^'"]*)\s*$/,r=o.match(s);if(r)return{type:"db",prefix:r[1],includeViews:!1};const a=/she\.matter\.(?:sub|get|send|on)\s*\(\s*(.*)\s*$/,d=o.match(a);if(d){const u=d[1],f=jG(u),g=$G(u);if(f===0)return{type:"matter-nodeId",prefix:g};if(f===1){const p=Ph(u,0);if(p)return{type:"matter-endpointId",nodeId:p}}if(f===2){const p=Ph(u,0),C=P2(u,1)??Ph(u,1);if(p&&C!==null)return{type:"matter-cluster",nodeId:p,endpointId:C}}if(f>=3){const p=Ph(u,0),C=P2(u,1)??Ph(u,1),b=Ph(u,2),y=/she\.matter\.send\s*\(/.test(o);if(p&&C!==null&&b)return{type:"matter-attr",nodeId:p,endpointId:C,cluster:b,isSend:y}}}return null}function jG(o){let e=0,t=0,i=!1,n="";for(const s of o){if(i){s===n&&(i=!1);continue}if(s==='"'||s==="'"){i=!0,n=s;continue}if(s==="("||s==="["||s==="{"){e++;continue}if(s===")"||s==="]"||s==="}"){e--;continue}s===","&&e===0&&t++}return t}function $G(o){const e=o.match(/['"]([^'"]*)\s*$/);return e?e[1]:""}function Ph(o,e){var s;const i=(s=UF(o)[e])==null?void 0:s.trim();if(!i)return null;const n=i.match(/^['"](.*)['"]$/);return n?n[1]:null}function P2(o,e){var s;const i=(s=UF(o)[e])==null?void 0:s.trim();if(!i)return null;const n=parseInt(i,10);return isNaN(n)?null:n}function UF(o){const e=[];let t="",i=0,n=!1,s="";for(const r of o){if(n){r===s&&(n=!1),t+=r;continue}if(r==='"'||r==="'"){n=!0,s=r,t+=r;continue}if(r==="("||r==="["||r==="{"){i++,t+=r;continue}if(r===")"||r==="]"||r==="}"){i--,t+=r;continue}if(r===","&&i===0){e.push(t),t="";continue}t+=r}return e.push(t),e}const Ku=md.CompletionItemKind;function UG(o,e){return(e?Ew.filter(i=>i.startsWith(e)):Ew).map(i=>({label:i,kind:Ku.Value,insertText:i,range:o,detail:"MQTT topic",sortText:"0"+i}))}function qG(o,e,t){const i=t?[...yw,...ww]:yw;return(e?i.filter(s=>s.startsWith(e)):i).map(s=>({label:s,kind:Ku.Value,insertText:s,range:o,detail:ww.includes(s)?"sheDB view":"sheDB document",sortText:"0"+s}))}function GG(o,e){return $F.map(t=>{const i=Sw.get(t)??t;return e&&!i.startsWith(e)&&!t.startsWith(e)?null:{label:i,kind:Ku.Value,insertText:i,range:o,detail:i!==t?`Node ID: ${t}`:"Matter node",sortText:"0"+i}}).filter(Boolean)}function qF(o){return Dw.get(o)??o}function KG(o,e){if(typeof e=="number")return o.endpoints.find(i=>i.endpointId===e);const t=parseInt(e,10);return isNaN(t)?o.endpoints.find(i=>i.name===e):o.endpoints.find(i=>i.endpointId===t)}function ZG(o,e){const t=Uv.get(qF(e));return t?t.endpoints.map(i=>{const n=i.name??String(i.endpointId),s=i.clusters.map(r=>r.name).join(", ");return{label:n,kind:Ku.Value,insertText:n,range:o,detail:i.name?`Endpoint ${i.endpointId} — ${s}`:`Clusters: ${s}`,sortText:"0"+String(i.endpointId).padStart(4,"0")}}):[]}function XG(o,e,t){const i=Uv.get(qF(e));if(!i)return[];const n=KG(i,t);return n?n.clusters.map(s=>({label:s.name,kind:Ku.Value,insertText:s.name,range:o,detail:"Matter cluster",sortText:"0"+s.name})):[]}function YG(o,e,t){return(t?zG[e]??[]:WG[e]??[]).map(n=>({label:n,kind:t?Ku.Function:Ku.Property,insertText:n,range:o,detail:t?`${e} command`:`${e} attribute`,sortText:"0"+n}))}let T2=!1;function QG(){T2||(T2=!0,F2(),L2(),I2(),setInterval(F2,15e3),setInterval(L2,1e4),setInterval(I2,6e4),md.registerCompletionItemProvider("javascript",{triggerCharacters:["'",'"',"(",","," "],provideCompletionItems(o,e){const t=o.getValueInRange({startLineNumber:e.lineNumber,startColumn:1,endLineNumber:e.lineNumber,endColumn:e.column}),i=VG(t);if(!i)return null;const n=o.getWordUntilPosition(e),s=Math.max(t.lastIndexOf("'"),t.lastIndexOf('"')),r=s>=0?s+2:n.startColumn,a={startLineNumber:e.lineNumber,endLineNumber:e.lineNumber,startColumn:r,endColumn:e.column};switch(i.type){case"mqtt":return{suggestions:UG(a,i.prefix)};case"db":return{suggestions:qG(a,i.prefix,i.includeViews)};case"matter-nodeId":return{suggestions:GG(a,i.prefix)};case"matter-endpointId":return{suggestions:ZG(a,i.nodeId)};case"matter-cluster":return{suggestions:XG(a,i.nodeId,i.endpointId)};case"matter-attr":return{suggestions:YG(a,i.cluster,i.isSend)};default:return null}}}))}var JG=B('<button class="svelte-1pyfjii">New file here</button> <button class="svelte-1pyfjii">New subfolder here</button> <hr class="svelte-1pyfjii"/> <button class="svelte-1pyfjii">Rename folder…</button> <button class="danger svelte-1pyfjii">Delete folder…</button>',1),eK=B('<button class="svelte-1pyfjii">Show git history</button>'),tK=B('<button class="svelte-1pyfjii">Open</button> <button class="svelte-1pyfjii">Rename…</button> <button class="svelte-1pyfjii">Add to AI context</button> <!> <hr class="svelte-1pyfjii"/> <button class="danger svelte-1pyfjii">Delete</button>',1),iK=B('<div class="ctx-backdrop svelte-1pyfjii" role="presentation"></div> <div class="ctx-menu svelte-1pyfjii"><!></div>',1),nK=B('<div class="lib-tip-float svelte-1pyfjii">Library directory — files here are not auto-loaded as scripts</div>'),M2=B('<span class="git-mod svelte-1pyfjii" title="Uncommitted changes">M</span>'),sK=B('<ul class="tree-children svelte-1pyfjii"></ul>'),oK=B('<li class="tree-dir svelte-1pyfjii"><div role="treeitem" tabindex="-1" draggable="true"><button>›</button> <span role="button" tabindex="0"> </span> <!> <label class="lib-label svelte-1pyfjii" title="Library directory — files here are not auto-loaded as scripts"><input type="checkbox" class="svelte-1pyfjii"/> <span class="lib-checkmark svelte-1pyfjii"></span> <svg width="11" height="11" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 3h8a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H3V3z"></path><line x1="3" y1="12" x2="13" y2="12"></line><line x1="6" y1="3" x2="6" y2="12"></line></svg></label> <label class="dis-label svelte-1pyfjii" title="Disable — scripts in this folder will not be executed"><input type="checkbox" class="svelte-1pyfjii"/> <span class="dis-checkmark svelte-1pyfjii"></span> <svg width="11" height="11" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"><circle cx="8" cy="8" r="6"></circle><line x1="3.8" y1="12.2" x2="12.2" y2="3.8"></line></svg></label></div> <!></li>'),rK=B('<span class="dirty-dot svelte-1pyfjii">●</span>'),aK=B('<span class="run-dot svelte-1pyfjii" title="Running">●</span>'),lK=B('<span class="err-dot svelte-1pyfjii">●</span>'),cK=B('<label><input type="checkbox" class="svelte-1pyfjii"/> <span class="dis-checkmark svelte-1pyfjii"></span> <svg width="11" height="11" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"><circle cx="8" cy="8" r="6"></circle><line x1="3.8" y1="12.2" x2="12.2" y2="3.8"></line></svg></label>'),dK=B('<span class="dis-spacer svelte-1pyfjii"></span>'),uK=B('<li draggable="true"><div class="file-row svelte-1pyfjii"><button><span> </span> <span class="fname svelte-1pyfjii"> </span> <!><!> <!> <!></button> <!></div></li>'),hK=B('<div class="err svelte-1pyfjii"> </div>'),fK=B('<button title="Case sensitive">Aa</button> <button title="Use regex">.*</button> <button title="Replace">⇄</button>',1),gK=B('<div class="search-input-row svelte-1pyfjii"><input placeholder="Replace with…" class="svelte-1pyfjii"/> <button class="svelte-1pyfjii"> </button></div>'),pK=B('<div class="search-status svelte-1pyfjii">Searching…</div>'),xK=B('<div class="search-status search-err svelte-1pyfjii"> </div>'),mK=B('<div class="search-status svelte-1pyfjii">No results.</div>'),vK=B('<div class="search-status search-trunc svelte-1pyfjii">Showing first 500 matches.</div>'),_K=B('<button class="search-match-row svelte-1pyfjii"><span class="search-lnum svelte-1pyfjii"> </span> <span class="search-preview svelte-1pyfjii"> </span></button>'),bK=B('<div class="search-file-group svelte-1pyfjii"><button class="search-file-btn svelte-1pyfjii"><span class="search-fname svelte-1pyfjii"> </span> <span class="search-fcount svelte-1pyfjii"> </span></button> <!></div>'),KC=B("<!> <!>",1),CK=B('<div class="search-status svelte-1pyfjii">No files found.</div>'),EK=B('<div class="search-status search-trunc svelte-1pyfjii">Showing first 200 results.</div>'),yK=B('<button class="search-match-row search-file-result svelte-1pyfjii"><span class="search-preview svelte-1pyfjii"> </span></button>'),wK=B('<label class="replace-item svelte-1pyfjii"><input type="checkbox" class="svelte-1pyfjii"/> <span class="replace-checkmark svelte-1pyfjii"></span> <span class="replace-item-path svelte-1pyfjii"> </span> <span class="replace-item-n svelte-1pyfjii"> </span></label>'),SK=B('<div class="replace-confirm svelte-1pyfjii"><div class="replace-confirm-hdr svelte-1pyfjii"><span> </span> <div class="replace-confirm-btns svelte-1pyfjii"><button class="svelte-1pyfjii">Apply</button> <button class="svelte-1pyfjii">Cancel</button></div></div> <div class="replace-confirm-list svelte-1pyfjii"></div></div>'),DK=B('<div class="search-panel svelte-1pyfjii"><div class="search-mode-bar svelte-1pyfjii"><button>Text</button> <button>Files</button> <button class="search-close-btn svelte-1pyfjii" title="Close">×</button></div> <div class="search-input-row svelte-1pyfjii"><input class="svelte-1pyfjii"/> <!></div> <!> <div class="search-results svelte-1pyfjii"><!></div> <!></div>'),AK=B('<div class="history-empty svelte-1pyfjii">Loading…</div>'),kK=B('<div class="history-empty svelte-1pyfjii">No commits found.</div>'),BK=B('<button class="history-row svelte-1pyfjii"><span class="history-subject svelte-1pyfjii"> </span> <span class="history-meta svelte-1pyfjii"> </span></button>'),FK=B('<button class="history-load-more svelte-1pyfjii"> </button>'),LK=B('<div class="history-panel svelte-1pyfjii"><div class="history-resize-handle svelte-1pyfjii" role="separator"></div> <div class="history-hdr svelte-1pyfjii"><span class="history-title svelte-1pyfjii"> </span> <button class="history-close svelte-1pyfjii">✕</button></div> <div class="history-body svelte-1pyfjii"><!></div></div>'),IK=B('<span class="tab-dirty svelte-1pyfjii">●</span>'),PK=B('<div role="tab" tabindex="0"><span class="tab-label svelte-1pyfjii"> </span> <!> <button class="tab-close svelte-1pyfjii" title="Close">×</button></div>'),TK=B('<div class="tab-bar-wrap svelte-1pyfjii"><button class="tab-scroll-btn svelte-1pyfjii" aria-label="Scroll tabs left">‹</button> <div class="tab-bar svelte-1pyfjii" role="tablist"></div> <button class="tab-scroll-btn svelte-1pyfjii" aria-label="Scroll tabs right">›</button></div>'),MK=B('<li class="changes-item svelte-1pyfjii"><label class="changes-cb-wrap svelte-1pyfjii"><input type="checkbox" class="changes-check svelte-1pyfjii"/> <span class="changes-checkmark svelte-1pyfjii"></span></label> <span class="changes-status svelte-1pyfjii"> </span> <span class="changes-file svelte-1pyfjii"> </span></li>'),RK=B('<div class="changes-err svelte-1pyfjii"> </div>'),NK=B('<div class="changes-backdrop svelte-1pyfjii" role="presentation"></div> <div class="changes-popup svelte-1pyfjii"><div class="changes-popup-hdr svelte-1pyfjii">Uncommitted changes</div> <ul class="changes-list svelte-1pyfjii"></ul> <div class="changes-commit-row svelte-1pyfjii"><input class="changes-msg-input svelte-1pyfjii" type="text" placeholder="Commit message…"/> <button class="changes-commit-btn svelte-1pyfjii"> </button></div> <!></div>',1),OK=B('<div class="changes-wrap svelte-1pyfjii"><button class="git-changes svelte-1pyfjii"> </button> <!></div>'),HK=B('<div class="changes-backdrop svelte-1pyfjii" role="presentation"></div> <div class="changes-popup svelte-1pyfjii"><div class="changes-popup-hdr svelte-1pyfjii"> </div> <div class="changes-commit-row svelte-1pyfjii"><button class="changes-commit-btn svelte-1pyfjii">Push</button></div></div>',1),WK=B('<div class="changes-wrap svelte-1pyfjii"><button class="git-ahead svelte-1pyfjii"> </button> <!></div>'),zK=B('<span class="git-behind svelte-1pyfjii"> </span>'),VK=B('<span class="git-status svelte-1pyfjii"><span class="git-branch svelte-1pyfjii"> </span> <!> <!> <!></span>'),jK=B('<div class="split-backdrop svelte-1pyfjii" role="presentation"></div> <div class="split-menu svelte-1pyfjii"><button class="svelte-1pyfjii">Save</button> <button class="svelte-1pyfjii">Save &amp; Commit</button></div>',1),$K=B('<button class="danger svelte-1pyfjii">Delete</button>'),UK=B(`<div class="welcome svelte-1pyfjii"><div class="welcome-inner svelte-1pyfjii"><div class="welcome-logo svelte-1pyfjii">she</div> <p class="welcome-sub svelte-1pyfjii">Smart Home Engine — a scriptable smart home automation engine</p> <div class="welcome-hint svelte-1pyfjii"><strong>Quick start:</strong> click <kbd class="svelte-1pyfjii">+ File</kbd> in the sidebar to create your first script,
152
+ or click an existing file to open it. Scripts run in a sandboxed VM with access to the <code class="svelte-1pyfjii">she</code> object for MQTT, scheduling, and more.</div> <div class="welcome-links svelte-1pyfjii"><a href="https://github.com/hobbyquaker/she" target="_blank" rel="noopener" class="svelte-1pyfjii">GitHub</a> <span class="svelte-1pyfjii">·</span> <a href="https://github.com/hobbyquaker/she/blob/main/doc/sandbox-api.md" target="_blank" rel="noopener" class="svelte-1pyfjii">API reference</a> <span class="svelte-1pyfjii">·</span> <a href="https://github.com/hobbyquaker/she/blob/main/README.md#Documentation" target="_blank" rel="noopener" class="svelte-1pyfjii">Documentation</a></div> <div class="welcome-shortcuts svelte-1pyfjii"><div class="welcome-shortcuts-title svelte-1pyfjii">Keyboard shortcuts</div> <div class="welcome-shortcuts-grid svelte-1pyfjii"><span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Ctrl</kbd><kbd class="svelte-1pyfjii">S</kbd></span><span class="svelte-1pyfjii">Save</span> <span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Ctrl</kbd><kbd class="svelte-1pyfjii">F</kbd></span><span class="svelte-1pyfjii">Find</span> <span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Ctrl</kbd><kbd class="svelte-1pyfjii">H</kbd></span><span class="svelte-1pyfjii">Find &amp; Replace</span> <span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Ctrl</kbd><kbd class="svelte-1pyfjii">G</kbd></span><span class="svelte-1pyfjii">Go to line</span> <span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Ctrl</kbd><kbd class="svelte-1pyfjii">Z</kbd></span><span class="svelte-1pyfjii">Undo</span> <span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Ctrl</kbd><kbd class="svelte-1pyfjii">Shift</kbd><kbd class="svelte-1pyfjii">Z</kbd></span><span class="svelte-1pyfjii">Redo</span> <span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Ctrl</kbd><kbd class="svelte-1pyfjii">/</kbd></span><span class="svelte-1pyfjii">Toggle comment</span> <span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Alt</kbd><kbd class="svelte-1pyfjii">↑ / ↓</kbd></span><span class="svelte-1pyfjii">Move line up / down</span></div></div></div></div>`),qK=B('<button class="svelte-1pyfjii">Always accept in this session</button>'),GK=B('<button class="svelte-1pyfjii">Disable auto-accept</button>'),KK=B('<div class="split-backdrop svelte-1pyfjii" role="presentation"></div> <div class="split-menu svelte-1pyfjii"><!></div>',1),ZK=B('<div class="diff-overlay svelte-1pyfjii"><div class="diff-bar svelte-1pyfjii"><span class="diff-title svelte-1pyfjii">Proposed changes — <em class="svelte-1pyfjii"> </em></span> <div class="diff-actions svelte-1pyfjii"><div class="split-wrap svelte-1pyfjii"><div class="split-btn accept-split svelte-1pyfjii"><button class="split-main svelte-1pyfjii"> </button> <button class="split-arrow svelte-1pyfjii" aria-label="Accept options">▾</button></div> <!></div> <button class="discard-btn svelte-1pyfjii">Discard</button></div></div> <div class="diff-container svelte-1pyfjii"></div></div>'),XK=B('<div class="history-diff-notice svelte-1pyfjii">Binary file — diff not available.</div>'),YK=B('<div class="diff-container svelte-1pyfjii"></div>'),QK=B('<div class="diff-overlay svelte-1pyfjii"><div class="diff-bar svelte-1pyfjii"><span class="diff-title svelte-1pyfjii">Commit <code> </code> → current — <em class="svelte-1pyfjii"> </em></span> <div class="diff-actions svelte-1pyfjii"><button class="discard-btn svelte-1pyfjii">Close</button></div></div> <!></div>'),JK=B('<div class="log-resize-handle svelte-1pyfjii" role="separator"></div>'),eZ=B('<span class="log-file svelte-1pyfjii"> </span>'),tZ=B("<option> </option>"),iZ=B('<select class="log-filter-level svelte-1pyfjii"></select> <input class="log-filter-text svelte-1pyfjii" type="search" placeholder="Filter…"/> <label class="log-filter-regex svelte-1pyfjii" title="Interpret filter as a regular expression"><input type="checkbox" class="svelte-1pyfjii"/> <span class="log-filter-checkmark svelte-1pyfjii"></span> Regex</label> <button class="log-clear svelte-1pyfjii">Clear</button>',1),nZ=B('<div><span class="ts svelte-1pyfjii"> </span> <span class="lvl svelte-1pyfjii"> </span> <span class="msg svelte-1pyfjii"> </span></div>'),sZ=B('<span class="log-empty svelte-1pyfjii">No log output for this script.</span>'),oZ=B('<div class="log-body svelte-1pyfjii"><!> <!></div>'),rZ=B('<div class="chat-resize-handle svelte-1pyfjii" role="separator"></div> <div class="chat-container svelte-1pyfjii"><!></div>',1),aZ=B('<!> <!> <!> <!> <div class="layout svelte-1pyfjii"><aside class="svelte-1pyfjii"><div class="toolbar svelte-1pyfjii"><button title="New script" class="svelte-1pyfjii">+ File</button> <button title="New folder" class="svelte-1pyfjii">+ Folder</button> <button title="Find in files / Find files (Ctrl+Shift+F)">&#x2315;</button> <button title="Refresh" class="refresh svelte-1pyfjii">↻</button></div> <!> <!> <ul class="tree svelte-1pyfjii"><li role="presentation"></li> <!></ul> <!></aside> <div class="sidebar-resize-handle svelte-1pyfjii" role="separator"></div> <div class="editor-area svelte-1pyfjii"><!> <div class="editor-toolbar svelte-1pyfjii"><span class="filename svelte-1pyfjii"> </span> <!> <div class="split-wrap svelte-1pyfjii"><div class="split-btn svelte-1pyfjii"><button class="split-main svelte-1pyfjii"> </button> <button class="split-arrow svelte-1pyfjii" aria-label="Save options">▾</button></div> <!></div> <!> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"><line x1="5.5" y1="5" x2="4" y2="2.5"></line><line x1="10.5" y1="5" x2="12" y2="2.5"></line><path d="M3 11 V7 A5 3.5 0 0 0 13 7 V11 Z" stroke-linejoin="round"></path><circle cx="6" cy="8.2" r="0.7" fill="currentColor" stroke="none"></circle><circle cx="10" cy="8.2" r="0.7" fill="currentColor" stroke="none"></circle></svg> AI</button></div> <div class="editor-body svelte-1pyfjii"><div class="editor-left svelte-1pyfjii"><div class="editor-stack svelte-1pyfjii"><div class="editor-container svelte-1pyfjii"></div> <!> <!> <!></div> <div><!> <div class="log-header svelte-1pyfjii"><button class="log-toggle svelte-1pyfjii"> <!></button> <!></div> <!></div></div> <!></div></div></div>',1);function lZ(o,e){$s(e,!0);let t=F(Li([])),i=F(Li({})),n=F(null),s=F(null),r=F(null),a=F(null),d=F(Li([])),u=F(null),f=F(!1),g=F(""),p=F(!1),C=F(!0),b=F(null),y=F(!1),w=F(!1),A=F(null),I=F(Li([])),T=F(!1),R=F(30),P=F(void 0),V=null,j=null,J=null,ae=F(!1),fe=F(""),X=F(!1),ce=F(void 0),me=F(Li(new Set));const oe=new Set;let le=F(Li(new Set)),Ae=F(Li([])),Te=F(!1),xe=F("text"),Ne=F(""),Ve=F(!1),ve=F(!1),mt=F(!1),Mt=F(""),ot=F(Li([])),yt=F(Li([])),be=F(!1),Nt=F(!1),si=F(""),Xe=F(void 0),tt=F(Li([])),wt=F(!1),Yt=F(!1),fi=null,oi=F(void 0),ki=F(!1),_i=F(!1),Ze=null;function Ee(){c(oi)&&(m(ki,c(oi).scrollLeft>0),m(_i,c(oi).scrollLeft+c(oi).clientWidth<c(oi).scrollWidth-1))}function ii(G){var he;(he=c(oi))==null||he.scrollBy({left:G*200,behavior:"smooth"})}function Ci(G="text"){m(Te,!0),m(xe,G,!0),hl().then(()=>{var he;return(he=c(Xe))==null?void 0:he.focus()})}function Jt(){m(Te,!1),m(Ne,""),m(ot,[],!0),m(yt,[],!0),m(be,!1),m(si,""),m(mt,!1),m(wt,!1)}function zi(){fi&&clearTimeout(fi),fi=setTimeout(Ji,300)}async function Ji(){const G=c(Ne).trim();if(!G){m(ot,[],!0),m(yt,[],!0),m(be,!1),m(si,"");return}m(Nt,!0),m(si,"");try{if(c(xe)==="files"){const he=await r2(G,{mode:"files"});m(yt,he.results,!0),m(be,he.truncated,!0)}else{const he=await r2(G,{regex:c(ve),caseSensitive:c(Ve)});m(ot,he.results,!0),m(be,he.truncated,!0)}}catch(he){m(si,he.message||"Search failed",!0)}finally{m(Nt,!1)}}async function Ii(G,he){await St(G),ze&&(ze.revealLineInCenter(he.line),ze.setPosition({lineNumber:he.line,column:he.col}),ze.focus())}function wn(G){return G.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async function cn(){if(!c(Ne).trim()||!c(ot).length)return;m(Yt,!0);const G=[],he="g"+(c(Ve)?"":"i");for(const ct of c(ot))try{const gt=await Vx(ct.path),st=c(ve)?new RegExp(c(Ne),he):new RegExp(wn(c(Ne)),he),ei=gt.content.replace(st,c(Mt));ei!==gt.content&&G.push({path:ct.path,checked:!0,original:gt.content,replaced:ei,changes:ct.matches.length})}catch{}m(tt,G,!0),m(Yt,!1),m(wt,!0)}async function pn(){for(const G of c(tt).filter(he=>he.checked))try{await Ql(G.path,G.replaced);const he=c(d).find(ct=>ct.path===G.path);he!=null&&he.model&&(he.model.setValue(G.replaced),he.savedContent=G.replaced,he.dirty=!1)}catch{}m(wt,!1),await Ji()}function fn(G){G.ctrlKey&&G.shiftKey&&G.key==="F"&&(G.preventDefault(),c(Te)&&c(xe)==="text"?Jt():Ci("text"))}Kn(()=>{c(oi)&&(Ze==null||Ze.disconnect(),Ze=new ResizeObserver(Ee),Ze.observe(c(oi)),Ee())});let pt=F("all"),Ut=F(""),Ni=F(!1);const qi=["all","debug","info","warn","error"],gi={debug:0,info:1,warn:2,error:3};function Wi(G){if(c(pt)!=="all"&&gi[G.level]<gi[c(pt)])return!1;if(!c(Ut))return!0;if(c(Ni))try{return new RegExp(c(Ut),"i").test(G.msg)}catch{}return G.msg.toLowerCase().includes(c(Ut).toLowerCase())}let Ui=F(null);function tn(G){const he=G.currentTarget.getBoundingClientRect();m(Ui,{x:he.left,y:he.top},!0)}function yi(){m(Ui,null)}let Vi,ze,qt,wi=!1,ji=null,Si=null,K=!1,De=!1,Qe=F(!1),it=F(null),Gt=F(!1),li=F(!1),vt=F(void 0),ft=null,Y=null,Re=null,dt=F(Li(parseInt(localStorage.getItem("she-scripts-sidebar-width")??"220",10))),ye=F(Li(parseInt(localStorage.getItem("she-scripts-log-height")??"130",10))),ci=F(Li(parseInt(localStorage.getItem("she-scripts-chat-width")??"340",10))),It=F(Li(parseInt(localStorage.getItem("she-scripts-history-height")??"220",10))),ie=!1,Ye=0,kt=0,Pt=!1,Bt=0,Be=0,je=!1,Kt=0,ri=0,ui=!1,Xt=0,pe=0;const Ge=Lt(()=>{var G;return c(u)&&c(re)?{path:c(u),content:((G=c(re).model)==null?void 0:G.getValue())??c(re).savedContent}:null}),rt=Lt(()=>{var G;return new Set(((G=c(b))==null?void 0:G.changes.map(he=>he.file))??[])}),lt=Lt(()=>{const G=new Set;for(const he of c(rt)){const ct=he.split("/");for(let gt=1;gt<ct.length;gt++)G.add(ct.slice(0,gt).join("/"))}return G});let Vt=F(!1),Ot=F(!1),bi=F(""),U=F(!1),M=F(""),O=F(Li(new Set));async function ee(){var G;if(!(!c(bi).trim()||c(O).size===0)){m(U,!0),m(M,"");try{const he=c(b).changes.filter(ct=>c(O).has(ct.file)).map(ct=>ct.file);if(he.length===c(b).changes.length?await c2(c(bi).trim()):await l2(he,c(bi).trim()),c(w))try{await $x()}catch{}m(bi,""),await ue(),(G=c(b))!=null&&G.changes.length?m(O,new Set(c(b).changes.map(ct=>ct.file)),!0):m(Vt,!1)}catch(he){m(M,he.message,!0)}finally{m(U,!1)}}}let ne,se,re=Lt(()=>c(d).find(G=>G.path===c(u))??null);const Ie="she-tabs",We="she-active-tab",Ce="she-log-open",Pe="she-chat-open";let Me=Tu(e,"active",3,!0);Kn(()=>{De&&(localStorage.setItem(Ie,JSON.stringify(c(d).map(G=>G.path))),c(u)?localStorage.setItem(We,c(u)):localStorage.removeItem(We))}),Kn(()=>{De&&localStorage.setItem(Pe,String(c(Qe)))}),Kn(()=>{Me()&&ze&&ze.layout()});const at=`
153
+ declare const she: {
154
+ log(...args: any[]): void;
155
+ info(...args: any[]): void;
156
+ debug(...args: any[]): void;
157
+ warn(...args: any[]): void;
158
+ error(...args: any[]): void;
159
+ now(): number;
160
+ /** Schedule with a cron string, Date, node-schedule literal, array of any of those,
161
+ * or a suncalc event name ('sunrise', 'sunset', 'dawn', 'dusk', …) for solar scheduling.
162
+ * opts.shift (seconds) offsets solar events; opts.random adds a random delay. */
163
+ schedule(pattern: string | Date | object | (string | Date | object)[], opts?: { shift?: number; random?: number }, cb?: () => void): void;
164
+ mqtt: {
165
+ sub(topic: string | string[], opts?: any, cb?: (topic: string, val: any, obj: any, prev: any, msg: any) => void): void;
166
+ pub(topic: string | string[], payload: any, opts?: { qos?: number; retain?: boolean }): void;
167
+ get(topic: string): any;
168
+ getProp(topic: string, ...prop: string[]): any;
169
+ link(source: string | string[], target: string | string[], value?: any): void;
170
+ age(topic: string): number;
171
+ or(srcs: string[], target: string | ((topic: string | null, val: 0 | 1) => void)): void;
172
+ and(srcs: string[], target: string | ((topic: string | null, val: 0 | 1) => void)): void;
173
+ max(srcs: string[], target: string | ((topic: string | null, val: number) => void)): void;
174
+ min(srcs: string[], target: string | ((topic: string | null, val: number) => void)): void;
175
+ timer(src: string | string[], ms: number, target: string | ((topic: string | null, val: 0 | 1) => void)): void;
176
+ };
177
+ http: {
178
+ fetch(url: string, opts?: RequestInit): Promise<any>;
179
+ sub(path: string, callback: (body: any, req: { params: any; query: any; headers: any }) => any): void;
180
+ };
181
+ api: {
182
+ get(path: string, handler: (req: any) => any): void;
183
+ post(path: string, handler: (req: any, body: any) => any): void;
184
+ put(path: string, handler: (req: any, body: any) => any): void;
185
+ delete(path: string, handler: (req: any) => any): void;
186
+ };
187
+ db: {
188
+ get(id: string): any;
189
+ set(id: string, doc: object): void;
190
+ extend(id: string, partial: object): void;
191
+ delete(id: string): void;
192
+ prop(id: string, method: 'set' | 'create' | 'del', prop: string, val?: any): void;
193
+ sub(pattern: string, callback: (id: string, doc: any) => void): void;
194
+ query(filter: string | null, mapFn: Function, reduceFn?: Function): any[];
195
+ };
196
+ matter: {
197
+ sub(nodeId: string, endpointId: number, cluster: string, attr: string, cb: (val: any, old: any) => void): number;
198
+ unsub(listenerId: number): void;
199
+ get(nodeId: string, endpointId: number, cluster: string, attr: string): Promise<any>;
200
+ send(nodeId: string, endpointId: number, cluster: string, command: string, args?: object): Promise<any>;
201
+ on(nodeId: string, endpointId: number, cluster: string, event: string, cb: (val: any) => void): number;
202
+ };
203
+ influx: {
204
+ query(fluxQuery: string): Promise<any[]>;
205
+ write(measurement: string, fields: object, tags?: object, timestamp?: number | Date): Promise<void>;
206
+ getLast(topic: string, n: number): Promise<Array<{ ts: number; val: any }>>;
207
+ getRange(topic: string, from: number | string | Date, to: number | string | Date): Promise<Array<{ ts: number; val: any }>>;
208
+ };
209
+ elastic: {
210
+ search(index: string, query: object): Promise<{ hits: any[]; total: number }>;
211
+ get(index: string, id: string): Promise<object | null>;
212
+ index(index: string, doc: object, id?: string): Promise<{ id: string }>;
213
+ find(index: string, field: string, text: string, size?: number): Promise<any[]>;
214
+ };
215
+ };
216
+ `;function Qt(G){c(d).some(he=>he.dirty)&&G.preventDefault()}Xs(async()=>{var ei,Ri;window.addEventListener("beforeunload",Qt),m(C,localStorage.getItem(Ce)!=="false"),m(Qe,localStorage.getItem(Pe)==="true"),md.typescript.javascriptDefaults.addExtraLib(at,"she-api.d.ts"),md.typescript.javascriptDefaults.setCompilerOptions({target:md.typescript.ScriptTarget.ES2022,allowNonTsExtensions:!0,checkJs:!0}),md.typescript.javascriptDefaults.setDiagnosticsOptions({noSyntaxValidation:!1,noSemanticValidation:!0}),QG(),qt=zo.createModel("","javascript"),ze=zo.create(Vi,{model:qt,theme:Jh(),automaticLayout:!0,minimap:{enabled:!1},fontSize:14,lineNumbers:"on",scrollBeyondLastLine:!1}),ze.addCommand(g1.CtrlCmd|g1.Shift|Pk.KeyF,()=>{c(Te)&&c(xe)==="text"?Jt():Ci("text")}),(ei=ze.getDomNode())==null||ei.addEventListener("keydown",Pi=>{(Pi.ctrlKey||Pi.metaKey)&&Pi.key==="s"&&(Pi.preventDefault(),Fe())}),ze.onDidChangeModelContent(()=>{if(wi)return;const Pi=c(d).find(Yi=>Yi.path===c(u));Pi&&(Pi.dirty=ze.getValue()!==Pi.savedContent),Tn&&clearTimeout(Tn),Tn=setTimeout(Gn,600)}),ji=hS(Pi=>{const Yi=Pi.msg.match(/^([^:\n]+\.js):\s/);if(!Yi)return;const Qi=Yi[1];if(Pi.level==="error")oe.add(Qi),c(me).has(Qi)||m(me,new Set([...c(me),Qi]),!0);else if(oe.has(Qi)){oe.delete(Qi);const un=new Set(c(me));un.delete(Qi),m(me,un,!0)}const gn=c(d).find(un=>un.path===Qi);gn&&(gn.logEntries=[...gn.logEntries.slice(-199),Pi],gn.path===c(u)&&c(C)&&c(ce)&&hl().then(()=>{c(ce)&&(c(ce).scrollTop=c(ce).scrollHeight)}))}),Si=Xo("script:running",Pi=>{const Yi=Pi.path;if(Pi.running)m(le,new Set([...c(le),Yi]),!0);else{const Qi=new Set(c(le));Qi.delete(Yi),m(le,Qi,!0)}}),await Z(),ue();try{const Pi=await Pl();typeof Pi.gitAutoCommit=="boolean"&&m(y,Pi.gitAutoCommit,!0),typeof Pi.gitAutoPush=="boolean"&&m(w,Pi.gitAutoPush,!0)}catch{}try{const Pi=await getDaemonStatus();m(le,new Set(Pi.runningScripts??[]),!0)}catch{}const G=JSON.parse(localStorage.getItem(Ie)??"[]"),he=localStorage.getItem(We);for(const Pi of G)await Oe(Pi,!1);const ct=he&&c(d).some(Pi=>Pi.path===he)?he:((Ri=c(d)[0])==null?void 0:Ri.path)??null;ct&&await ut(ct),De=!0;const gt=()=>zo.setTheme(Jh()),st=window.matchMedia("(prefers-color-scheme: dark)");return window.addEventListener("she:theme-changed",gt),st.addEventListener("change",gt),()=>{window.removeEventListener("she:theme-changed",gt),st.removeEventListener("change",gt)}}),Vp(()=>{var G;window.removeEventListener("beforeunload",Qt),Ze==null||Ze.disconnect(),Tn&&clearTimeout(Tn),ji==null||ji(),Si==null||Si();for(const he of c(d))(G=he.model)==null||G.dispose();qt==null||qt.dispose(),ze==null||ze.dispose()});async function Z(){try{if(m(t,await W$(),!0),!K){let he=function(ct){for(const gt of ct)gt.type==="dir"&&(G[gt.path]=!0,gt.children&&he(gt.children))};K=!0;const G={};he(c(t)),m(i,G,!0)}m(g,"")}catch(G){m(g,G.message,!0)}}function de(G){c(i)[G]=!c(i)[G]}function Ue(G){switch(G){case"SH":case"BASH":return"$";case"MD":case"MARKDOWN":return"⇓";case"JSON":case"JSONC":return"{}";default:return G}}async function Ft(G,he){try{he?await Ql(`${G}/.shelib`,""):await jx(`${G}/.shelib`),await Z(),await He("all",he?`lib ${G}`:`unlib ${G}`)}catch(ct){m(g,ct.message,!0)}}async function we(G,he){const ct=G.split("/").pop(),gt=G.includes("/")?G.slice(0,G.lastIndexOf("/")):"",st=gt?`${gt}/.shedisable-${ct}`:`.shedisable-${ct}`;try{he?await Ql(st,""):await jx(st),await Z(),await He("all",he?`disable ${G}`:`enable ${G}`)}catch(ei){m(g,ei.message,!0)}}async function Oe(G,he=!0){var ct;if(c(d).some(gt=>gt.path===G)){he&&await ut(G);return}try{const{content:gt}=await Vx(G),st=A7.parse(`file:///she-scripts/${encodeURIComponent(G)}`);(ct=zo.getModel(st))==null||ct.dispose();const ei=zo.createModel(gt,Is(G),st);m(d,[...c(d),{path:G,dirty:!1,savedContent:gt,model:ei,logEntries:[]}],!0),he&&await ut(G)}catch(gt){m(g,gt.message,!0)}}async function St(G){await Oe(G,!0)}async function ut(G){var ct,gt;const he=c(d).find(st=>st.path===G);he!=null&&he.model&&(bt(),m(it,null),m(u,G,!0),wi=!0,ze.setModel(he.model),wi=!1,Gn(),await hl(),(gt=(ct=c(oi))==null?void 0:ct.querySelector(`[data-tab-path="${CSS.escape(G)}"]`))==null||gt.scrollIntoView({inline:"nearest",block:"nearest"}),Ee())}async function nt(G){var gt;const he=c(d).find(st=>st.path===G);if(!he||he.dirty&&!await ne.show(`Discard unsaved changes to ${G}?`,{confirm:"Discard"}))return;const ct=c(d).findIndex(st=>st.path===G);if((gt=he.model)==null||gt.dispose(),m(d,c(d).filter(st=>st.path!==G),!0),c(u)===G){const st=c(d)[ct]??c(d)[ct-1]??null;st?await ut(st.path):(m(u,null),ze.setModel(qt))}}async function ue(){try{m(b,await V$(),!0)}catch{m(b,null)}}async function He(G,he){if(c(b))try{if(G==="all"?await c2(he):await l2(G,he),c(w))try{await $x()}catch{}await ue()}catch{}}async function Fe(){if(!c(u))return;const G=c(d).find(he=>he.path===c(u));if(G){m(f,!0);try{const he=ze.getValue();await Ql(c(u),he),G.savedContent=he,G.dirty=!1,m(g,""),c(y)?await He([c(u)],`update ${c(u)}`):ue()}catch(he){m(g,he.message,!0)}finally{m(f,!1)}}}async function Je(){if(!c(u)||(await Fe(),c(g)))return;const G=await se.show("Commit message:",{initial:`update ${c(u)}`,placeholder:"Update script",confirm:"Commit"});if(G)try{if(await U$(c(u),G),c(w))try{await $x()}catch{}ue()}catch(he){m(g,"Git: "+he.message)}}async function ht(){m(p,!1);try{await $x(),await ue(),m(g,"")}catch(G){m(g,"Git push: "+G.message)}}function Ke(G){const he=Date.now()-new Date(G).getTime(),ct=Math.floor(he/1e3);if(ct<60)return"just now";const gt=Math.floor(ct/60);if(gt<60)return`${gt}m ago`;const st=Math.floor(gt/60);if(st<24)return`${st}h ago`;const ei=Math.floor(st/24);if(ei<30)return`${ei}d ago`;const Ri=Math.floor(ei/30);return Ri<12?`${Ri}mo ago`:`${Math.floor(Ri/12)}y ago`}async function et(G){Mi(),m(A,G,!0),m(I,[],!0),m(R,30),await ge()}async function ge(){if(c(A)){m(T,!0);try{m(I,await q$(c(A).path,c(R)),!0)}catch{}finally{m(T,!1)}}}async function $e(){m(R,c(R)+30),await ge()}function _t(){m(A,null),m(I,[],!0),bt()}async function Wt(G){if(!c(A))return;bt(),await St(c(A).path);let he;try{he=await G$(G.hash,c(A).path)}catch{return}if(m(fe,G.hash,!0),m(X,he.binary,!0),m(ae,!0),he.binary||he.content===null)return;let ct="";const gt=c(d).find(ei=>ei.path===c(A).path);if(gt!=null&&gt.model)ct=gt.model.getValue();else try{ct=(await Vx(c(A).path)).content}catch{}if(await hl(),!c(P))return;const st=Is(c(A).path);j=zo.createModel(he.content,st),J=zo.createModel(ct,st),V=zo.createDiffEditor(c(P),{theme:Jh(),readOnly:!0,renderSideBySide:!0,automaticLayout:!0,minimap:{enabled:!1},fontSize:13,scrollBeyondLastLine:!1}),V.setModel({original:j,modified:J})}function bt(){m(ae,!1),m(X,!1),V==null||V.dispose(),V=null,j==null||j.dispose(),j=null,J==null||J.dispose(),J=null}async function pi(){const G=c(n)?`${c(n)}/`:"",he=await se.show("New script name:",{placeholder:G?`${G}myscript.js`:"myscript.js",initial:G,confirm:"Create"});if(!he)return;const ct=he.endsWith(".js")?`/* global she */
217
+ 'use strict';
218
+
219
+ `:"";await Ql(he,ct),await Z(),await Oe(he,!0)}async function Di(){const G=c(n)?`${c(n)}/`:"",he=await se.show("New folder name:",{placeholder:G?`${G}subfolder`:"myfolder",initial:G,confirm:"Create"});he&&(await z$(he),c(i)[he]=!0,await Z())}function Xi(G,he){G.preventDefault();const ct=180,gt=200,st=Math.min(G.clientX,window.innerWidth-ct),ei=Math.min(G.clientY,window.innerHeight-gt);m(s,{x:st,y:ei,entry:he},!0)}function Mi(){m(s,null)}async function ai(G){Mi(),m(n,G,!0),c(i)[G]=!0,await pi()}async function Ht(G){Mi(),m(n,G,!0),await Di()}async function Dt(G){Mi();const he=G.path.includes("/")?G.path.slice(0,G.path.lastIndexOf("/")+1):"",ct=await se.show(G.type==="dir"?"Rename folder:":"Rename script:",{initial:G.name,placeholder:G.name,confirm:"Rename"});if(!ct||ct===G.name)return;const gt=he+ct;try{await a2(G.path,gt);const st=c(d).find(ei=>ei.path===G.path);st&&(st.path=gt,c(u)===G.path&&m(u,gt)),await Z(),await He("all",`rename ${G.path} → ${gt}`)}catch(st){m(g,st.message,!0)}}function jt(G){if(!G.children)return 0;let he=0;for(const ct of G.children)he++,ct.type==="dir"&&(he+=jt(ct));return he}async function Zt(G){Mi();let he=`Delete ${G.type==="dir"?"folder":"file"} "${G.path}"?`;if(G.type==="dir"){const ct=jt(G);ct>0&&(he+=` This will also delete ${ct} item${ct===1?"":"s"} inside.`)}if(await ne.show(he,{confirm:"Delete",danger:!0})){if(G.type==="dir")for(const ct of[...c(d)])ct.path.startsWith(G.path+"/")&&await nt(ct.path);else await nt(G.path);await jx(G.path),await Z(),await He("all",`delete ${G.path}`)}}async function hi(G){Mi();const{content:he}=await Vx(G.path);c(Ae).some(ct=>ct.name===G.path)||m(Ae,[...c(Ae),{name:G.path,content:he}],!0),m(Qe,!0)}function nn(G,he){var ct;m(r,he,!0),(ct=G.dataTransfer)==null||ct.setData("text/plain",he)}function dn(G,he){if(G.preventDefault(),c(r)&&(c(r)===he||he.startsWith(c(r)+"/"))){G.dataTransfer&&(G.dataTransfer.dropEffect="none"),m(a,null);return}G.dataTransfer&&(G.dataTransfer.dropEffect="move"),m(a,he,!0)}function Ln(){m(a,null)}async function Oi(G,he){var Ri,Pi,Yi;G.preventDefault(),m(a,null);const ct=Array.from(((Ri=G.dataTransfer)==null?void 0:Ri.items)??[]).filter(Qi=>Qi.kind==="file");if(ct.length>0&&!c(r)){for(const Qi of ct){const gn=(Pi=Qi.webkitGetAsEntry)==null?void 0:Pi.call(Qi);gn&&await Dn(gn,he,!0)}await Z();return}const gt=c(r)??((Yi=G.dataTransfer)==null?void 0:Yi.getData("text/plain"));if(m(r,null),!gt||gt===he||he.startsWith(gt+"/"))return;const st=gt.split("/").pop(),ei=he?`${he}/${st}`:st;if(ei!==gt)try{await a2(gt,ei);for(const Qi of c(d))if(Qi.path===gt)c(u)===gt&&m(u,ei,!0),Qi.path=ei;else if(Qi.path.startsWith(gt+"/")){const gn=ei+Qi.path.slice(gt.length);c(u)===Qi.path&&m(u,gn),Qi.path=gn}await Z(),await He("all",`rename ${gt} → ${ei}`)}catch(Qi){m(g,Qi.message,!0)}}async function Dn(G,he,ct){if(G.isFile){const st=await(await new Promise((Ri,Pi)=>G.file(Ri,Pi))).text(),ei=he?`${he}/${G.name}`:G.name;await Ql(ei,st),ct&&G.name.endsWith(".js")&&await we(ei,!0)}else if(G.isDirectory){const gt=G.createReader();let st=[],ei;do ei=await new Promise((Ri,Pi)=>gt.readEntries(Ri,Pi)),st=[...st,...ei];while(ei.length>0);for(const Ri of st)await Dn(Ri,he?`${he}/${G.name}`:G.name,!1);if(ct){const Ri=he?`${he}/${G.name}`:G.name;await we(Ri,!0)}}}async function Jn(){if(!c(u)||!await ne.show(`Delete ${c(u)}?`,{confirm:"Delete",danger:!0}))return;const G=c(u);await nt(G),await jx(G),await Z(),await He("all",`delete ${G}`)}function In(){c(re)&&(c(re).logEntries=[])}function es(){m(C,!c(C)),localStorage.setItem(Ce,String(c(C)))}function Zi(G){return new Date(G).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Is(G){var gt;const he=((gt=G.split(".").pop())==null?void 0:gt.toLowerCase())??"";return{js:"javascript",mjs:"javascript",cjs:"javascript",ts:"typescript",tsx:"typescript",json:"json",jsonc:"json",md:"markdown",markdown:"markdown",yaml:"yaml",yml:"yaml",sh:"shell",bash:"shell",css:"css",html:"html",xml:"xml",ini:"ini",toml:"ini"}[he]??"plaintext"}let Tn=null;async function Gn(){const G=c(d).find(ct=>ct.path===c(u));if(!(G!=null&&G.model))return;const he=G.model;try{const ei=(await(await(await md.typescript.getJavaScriptWorker())(he.uri)).getSyntacticDiagnostics(he.uri.toString())).map(Ri=>{const Pi=he.getPositionAt(Ri.start??0),Yi=he.getPositionAt((Ri.start??0)+(Ri.length??0));return{severity:k7.Error,startLineNumber:Pi.lineNumber,startColumn:Pi.column,endLineNumber:Yi.lineNumber,endColumn:Yi.column,message:typeof Ri.messageText=="string"?Ri.messageText:JSON.stringify(Ri.messageText),source:"she-syntax"}});if(zo.setModelMarkers(he,"she-syntax",ei),c(u)){if(ei.length>0)oe.add(c(u)),c(me).has(c(u))||m(me,new Set([...c(me),c(u)]),!0);else if(oe.has(c(u))){oe.delete(c(u));const Ri=new Set(c(me));Ri.delete(c(u)),m(me,Ri,!0)}}}catch{}}function vs(G){ie=!0,Ye=G.clientX,kt=c(dt),G.preventDefault()}function ir(G){Pt=!0,Bt=G.clientY,Be=c(ye),G.preventDefault()}function zr(G){je=!0,Kt=G.clientX,ri=c(ci),G.preventDefault()}function Xa(G){ui=!0,Xt=G.clientY,pe=c(It),G.preventDefault()}function zl(G){ie&&m(dt,Math.max(140,Math.min(500,kt+G.clientX-Ye)),!0),Pt&&m(ye,Math.max(60,Math.min(500,Be-(G.clientY-Bt))),!0),je&&m(ci,Math.max(200,Math.min(700,ri-(G.clientX-Kt))),!0),ui&&m(It,Math.max(80,Math.min(600,pe-(G.clientY-Xt))),!0)}function pr(){ie&&(ie=!1,localStorage.setItem("she-scripts-sidebar-width",String(c(dt)))),Pt&&(Pt=!1,localStorage.setItem("she-scripts-log-height",String(c(ye)))),je&&(je=!1,localStorage.setItem("she-scripts-chat-width",String(c(ci)))),ui&&(ui=!1,localStorage.setItem("she-scripts-history-height",String(c(It))))}function Vr(G){(G.ctrlKey||G.metaKey)&&G.key==="s"&&(G.preventDefault(),Fe()),G.key==="Escape"&&(m(p,!1),m(s,null),m(Ot,!1))}async function Qc(G,he){const ct=await se.show("Save new script as:",{placeholder:"myscript.js",initial:G,confirm:"Create"});if(ct)try{await Ql(ct,he),await Z(),await Oe(ct,!0)}catch(gt){m(g,gt.message,!0)}}async function Ps(G){var ct,gt;if(c(Gt)&&c(u)){m(it,G,!0),await ao();return}if(m(it,G,!0),await hl(),!c(vt))return;Y==null||Y.dispose(),Re==null||Re.dispose(),ft==null||ft.dispose();const he=((gt=(ct=c(re))==null?void 0:ct.model)==null?void 0:gt.getValue())??"";Y=zo.createModel(he,"javascript"),Re=zo.createModel(G,"javascript"),ft=zo.createDiffEditor(c(vt),{theme:Jh(),readOnly:!0,renderSideBySide:!0,automaticLayout:!0,minimap:{enabled:!1},fontSize:13,scrollBeyondLastLine:!1}),ft.setModel({original:Y,modified:Re})}Kn(()=>{c(u),m(Gt,!1),m(li,!1)});async function ao(){if(c(it)===null||!c(u))return;const G=c(it);m(it,null);const he=c(d).find(ct=>ct.path===c(u));he!=null&&he.model&&(wi=!0,he.model.setValue(G),wi=!1,he.dirty=!1,he.savedContent=G);try{await Ql(c(u),G),m(g,""),c(y)?await He([c(u)],`update ${c(u)}`):ue()}catch(ct){m(g,ct.message,!0)}Vl()}function ah(){m(it,null),Vl()}function Vl(){ft==null||ft.dispose(),ft=null,Y==null||Y.dispose(),Y=null,Re==null||Re.dispose(),Re=null}var nr=aZ();xs("keydown",Rd,Vr),xs("mousemove",Rd,zl),xs("mouseup",Rd,pr);var Jc=Et(nr);gs(Yc(Jc,{}),G=>ne=G,()=>ne);var jl=v(Jc,2);gs(JU(jl,{}),G=>se=G,()=>se);var Ya=v(jl,2);{var Cf=G=>{var he=iK(),ct=Et(he),gt=v(ct,2);let st;var ei=_(gt);{var Ri=Yi=>{var Qi=JG(),gn=Et(Qi),un=v(gn,2),Sn=v(un,4),yn=v(Sn,2);$("click",gn,()=>ai(c(s).entry.path)),$("click",un,()=>Ht(c(s).entry.path)),$("click",Sn,()=>Dt(c(s).entry)),$("click",yn,()=>Zt(c(s).entry)),D(Yi,Qi)},Pi=Yi=>{var Qi=tK(),gn=Et(Qi),un=v(gn,2),Sn=v(un,2),yn=v(Sn,2);{var An=_n=>{var $n=eK();$("click",$n,()=>et(c(s).entry)),D(_n,$n)};H(yn,_n=>{c(b)&&_n(An)})}var us=v(yn,4);$("click",gn,()=>St(c(s).entry.path)),$("click",un,()=>Dt(c(s).entry)),$("click",Sn,()=>hi(c(s).entry)),$("click",us,()=>Zt(c(s).entry)),D(Yi,Qi)};H(ei,Yi=>{c(s).entry.type==="dir"?Yi(Ri):Yi(Pi,-1)})}z(()=>st=qo(gt,"",st,{left:`${c(s).x??""}px`,top:`${c(s).y??""}px`})),$("click",ct,Mi),$("contextmenu",ct,Yi=>{Yi.preventDefault(),Mi()}),D(G,he)};H(Ya,G=>{c(s)&&G(Cf)})}var ed=v(Ya,2);{var lh=G=>{var he=nK();let ct;z(()=>ct=qo(he,"",ct,{left:`${c(Ui).x??""}px`,top:`${c(Ui).y-4}px`})),D(G,he)};H(ed,G=>{c(Ui)&&G(lh)})}var td=v(ed,2),id=_(td);let $l;{const G=(gt,st=rb,ei)=>{let Ri=a9(()=>M7(ei==null?void 0:ei(),!1));var Pi=Ss(),Yi=Et(Pi);{var Qi=un=>{var Sn=oK(),yn=_(Sn);let An;var us=_(yn);let _n;var $n=v(us,2);let Ns;var bo=_($n),Os=v($n,2);{var ks=x=>{var E=M2();D(x,E)},hs=Lt(()=>c(rt).has(st().path)||c(lt).has(st().path));H(Os,x=>{c(hs)&&x(ks)})}var ls=v(Os,2),Ks=_(ls),Mn=v(ls,2),ps=_(Mn),l=v(yn,2);{var h=x=>{var E=sK();ti(E,21,()=>st().children,k=>k.path,(k,N)=>{G(k,()=>c(N),()=>st().disabled||c(Ri))}),D(x,E)};H(l,x=>{c(i)[st().path]&&st().children&&x(h)})}z(()=>{An=At(yn,1,"dir-row svelte-1pyfjii",null,An,{"dir-selected":c(n)===st().path,"drag-target":c(a)===st().path}),ln(yn,"aria-selected",c(n)===st().path),_n=At(us,1,"chevron svelte-1pyfjii",null,_n,{open:c(i)[st().path]}),Ns=At($n,1,"dir-name svelte-1pyfjii",null,Ns,{lib:st().lib}),W(bo,st().name),Zo(Ks,st().lib),Zo(ps,st().disabled)}),xs("dragstart",yn,x=>nn(x,st().path)),xs("dragover",yn,x=>dn(x,st().path)),xs("dragleave",yn,Ln),xs("drop",yn,x=>Oi(x,st().path)),$("contextmenu",yn,x=>Xi(x,st())),$("click",us,()=>de(st().path)),$("click",$n,()=>{m(n,st().path,!0),c(i)[st().path]=!0}),$("keydown",$n,x=>x.key==="Enter"&&m(n,st().path,!0)),xs("mouseenter",ls,tn),xs("mouseleave",ls,yi),$("change",Ks,()=>Ft(st().path,!st().lib)),$("change",ps,()=>we(st().path,!st().disabled)),D(un,Sn)},gn=un=>{const Sn=Lt(()=>c(me).has(st().path)),yn=Lt(()=>c(rt).has(st().path)),An=Lt(()=>c(d).some(Ei=>Ei.path===st().path&&Ei.dirty)),us=Lt(()=>(st().name.split(".").pop()??"txt").toUpperCase()),_n=Lt(()=>st().name.endsWith(".js"));var $n=uK();let Ns;var bo=_($n),Os=_(bo);let ks;var hs=_(Os);let ls;var Ks=_(hs),Mn=v(hs,2),ps=_(Mn),l=v(Mn,2);{var h=Ei=>{var mn=M2();D(Ei,mn)};H(l,Ei=>{c(yn)&&Ei(h)})}var x=v(l);{var E=Ei=>{var mn=rK();D(Ei,mn)};H(x,Ei=>{c(An)&&Ei(E)})}var k=v(x,2);{var N=Ei=>{var mn=aK();D(Ei,mn)},te=Lt(()=>c(_n)&&c(le).has(st().path)&&!c(Sn));H(k,Ei=>{c(te)&&Ei(N)})}var _e=v(k,2);{var ke=Ei=>{var mn=lK();D(Ei,mn)};H(_e,Ei=>{c(Sn)&&Ei(ke)})}var xt=v(Os,2);{var xi=Ei=>{var mn=cK();let Nn;var Es=_(mn);z(()=>{Nn=At(mn,1,"dis-label svelte-1pyfjii",null,Nn,{"dis-locked":c(Ri)}),ln(mn,"title",c(Ri)?"Disabled by parent directory":"Disable — this script will not be executed"),Zo(Es,st().disabled),Es.disabled=c(Ri)}),$("change",Es,()=>we(st().path,!st().disabled)),D(Ei,mn)},en=Ei=>{var mn=dK();D(Ei,mn)};H(xt,Ei=>{c(_n)?Ei(xi):Ei(en,-1)})}z((Ei,mn,Nn)=>{Ns=At($n,1,"tree-file svelte-1pyfjii",null,Ns,Ei),ks=At(Os,1,"svelte-1pyfjii",null,ks,{lib:st().lib,dis:st().disabled,err:c(Sn)}),ls=At(hs,1,`badge badge-${mn??""}`,"svelte-1pyfjii",ls,{"badge-shelib":st().lib}),W(Ks,Nn),W(ps,st().name)},[()=>({active:c(d).some(Ei=>Ei.path===st().path),"active-tab":st().path===c(u)}),()=>c(us).toLowerCase(),()=>Ue(c(us))]),xs("dragstart",$n,Ei=>nn(Ei,st().path)),$("contextmenu",$n,Ei=>Xi(Ei,st())),$("click",Os,()=>St(st().path)),D(un,$n)};H(Yi,un=>{st().type==="dir"?un(Qi):un(gn,-1)})}D(gt,Pi)};var pa=_(id),Ef=_(pa),yf=v(Ef,2),Ul=v(yf,2);let he;var Qa=v(Ul,2),tx=v(pa,2);{var nd=gt=>{var st=hK(),ei=_(st);z(()=>W(ei,c(g))),D(gt,st)};H(tx,gt=>{c(g)&&gt(nd)})}var Bo=v(tx,2);{var ix=gt=>{var st=DK(),ei=_(st),Ri=_(ei);let Pi;var Yi=v(Ri,2);let Qi;var gn=v(Yi,2),un=v(ei,2),Sn=_(un);gs(Sn,Mn=>m(Xe,Mn),()=>c(Xe));var yn=v(Sn,2);{var An=Mn=>{var ps=fK(),l=Et(ps);let h;var x=v(l,2);let E;var k=v(x,2);let N;z(()=>{h=At(l,1,"svelte-1pyfjii",null,h,{active:c(Ve)}),E=At(x,1,"svelte-1pyfjii",null,E,{active:c(ve)}),N=At(k,1,"svelte-1pyfjii",null,N,{active:c(mt)})}),$("click",l,()=>{m(Ve,!c(Ve)),zi()}),$("click",x,()=>{m(ve,!c(ve)),zi()}),$("click",k,()=>m(mt,!c(mt))),D(Mn,ps)};H(yn,Mn=>{c(xe)==="text"&&Mn(An)})}var us=v(un,2);{var _n=Mn=>{var ps=gK(),l=_(ps),h=v(l,2),x=_(h);z(E=>{h.disabled=E,W(x,c(Yt)?"…":"Preview")},[()=>!c(Ne).trim()||c(ot).length===0||c(Yt)]),zt(l,()=>c(Mt),E=>m(Mt,E)),$("click",h,cn),D(Mn,ps)};H(us,Mn=>{c(xe)==="text"&&c(mt)&&Mn(_n)})}var $n=v(us,2),Ns=_($n);{var bo=Mn=>{var ps=pK();D(Mn,ps)},Os=Mn=>{var ps=xK(),l=_(ps);z(()=>W(l,c(si))),D(Mn,ps)},ks=Mn=>{var ps=Ss(),l=Et(ps);{var h=E=>{var k=Ss(),N=Et(k);{var te=ke=>{var xt=mK();D(ke,xt)},_e=ke=>{var xt=KC(),xi=Et(xt);{var en=mn=>{var Nn=vK();D(mn,Nn)};H(xi,mn=>{c(be)&&mn(en)})}var Ei=v(xi,2);ti(Ei,17,()=>c(ot),Hi,(mn,Nn)=>{var Es=bK(),Hs=_(Es),$r=_(Hs),jb=_($r),$b=v($r,2),Ub=_($b),gx=v(Hs,2);ti(gx,17,()=>c(Nn).matches,Hi,(qb,mh)=>{var Bs=_K(),cd=_(Bs),Gb=_(cd),Kb=v(cd,2),Zb=_(Kb);z(()=>{W(Gb,c(mh).line),W(Zb,c(mh).preview)}),$("click",Bs,()=>Ii(c(Nn).path,c(mh))),D(qb,Bs)}),z(()=>{W(jb,c(Nn).path),W(Ub,c(Nn).matches.length)}),$("click",Hs,()=>St(c(Nn).path)),D(mn,Es)}),D(ke,xt)};H(N,ke=>{c(ot).length===0?ke(te):ke(_e,-1)})}D(E,k)},x=E=>{var k=Ss(),N=Et(k);{var te=ke=>{var xt=CK();D(ke,xt)},_e=ke=>{var xt=KC(),xi=Et(xt);{var en=mn=>{var Nn=EK();D(mn,Nn)};H(xi,mn=>{c(be)&&mn(en)})}var Ei=v(xi,2);ti(Ei,17,()=>c(yt),Hi,(mn,Nn)=>{var Es=yK(),Hs=_(Es),$r=_(Hs);z(()=>W($r,c(Nn))),$("click",Es,()=>St(c(Nn))),D(mn,Es)}),D(ke,xt)};H(N,ke=>{c(yt).length===0?ke(te):ke(_e,-1)})}D(E,k)};H(l,E=>{c(xe)==="text"?E(h):E(x,-1)})}D(Mn,ps)},hs=Lt(()=>c(Ne).trim());H(Ns,Mn=>{c(Nt)?Mn(bo):c(si)?Mn(Os,1):c(hs)&&Mn(ks,2)})}var ls=v($n,2);{var Ks=Mn=>{var ps=SK(),l=_(ps),h=_(l),x=_(h),E=v(h,2),k=_(E),N=v(k,2),te=v(l,2);ti(te,21,()=>c(tt),Hi,(_e,ke,xt)=>{var xi=wK(),en=_(xi),Ei=v(en,4),mn=_(Ei),Nn=v(Ei,2),Es=_(Nn);z(()=>{W(mn,c(ke).path),W(Es,`${c(ke).changes??""}×`)}),ws(en,()=>c(ke).checked,Hs=>c(ke).checked=Hs),D(_e,xi)}),z((_e,ke)=>{W(x,`Replace in ${_e??""} file(s)`),k.disabled=ke},[()=>c(tt).filter(_e=>_e.checked).length,()=>c(tt).filter(_e=>_e.checked).length===0]),$("click",k,pn),$("click",N,()=>m(wt,!1)),D(Mn,ps)};H(ls,Mn=>{c(wt)&&Mn(Ks)})}z(()=>{Pi=At(Ri,1,"svelte-1pyfjii",null,Pi,{active:c(xe)==="text"}),Qi=At(Yi,1,"svelte-1pyfjii",null,Qi,{active:c(xe)==="files"}),ln(Sn,"placeholder",c(xe)==="text"?"Find in files…":"Find files…")}),$("click",Ri,()=>{m(xe,"text"),zi()}),$("click",Yi,()=>{m(xe,"files"),zi()}),$("click",gn,Jt),$("input",Sn,zi),$("keydown",Sn,Mn=>Mn.key==="Escape"&&Jt()),zt(Sn,()=>c(Ne),Mn=>m(Ne,Mn)),D(gt,st)};H(Bo,gt=>{c(Te)&&gt(ix)})}var wf=v(Bo,2),sd=_(wf);let ct;var Sf=v(sd,2);ti(Sf,17,()=>c(t),gt=>gt.path,(gt,st)=>{G(gt,()=>c(st))});var Df=v(wf,2);{var Rb=gt=>{var st=LK();let ei;var Ri=_(st),Pi=v(Ri,2),Yi=_(Pi),Qi=_(Yi),gn=v(Yi,2),un=v(Pi,2),Sn=_(un);{var yn=_n=>{var $n=AK();D(_n,$n)},An=_n=>{var $n=kK();D(_n,$n)},us=_n=>{var $n=KC(),Ns=Et($n);ti(Ns,17,()=>c(I),ks=>ks.hash,(ks,hs)=>{var ls=BK(),Ks=_(ls),Mn=_(Ks),ps=v(Ks,2),l=_(ps);z((h,x)=>{W(Mn,c(hs).subject),W(l,`${h??""} · ${x??""}`)},[()=>c(hs).hash.slice(0,7),()=>Ke(c(hs).date)]),$("click",ls,()=>Wt(c(hs))),D(ks,ls)});var bo=v(Ns,2);{var Os=ks=>{var hs=FK(),ls=_(hs);z(()=>{hs.disabled=c(T),W(ls,c(T)?"Loading…":"Load more")}),$("click",hs,$e),D(ks,hs)};H(bo,ks=>{c(I).length>=c(R)&&ks(Os)})}D(_n,$n)};H(Sn,_n=>{c(T)&&c(I).length===0?_n(yn):c(I).length===0?_n(An,1):_n(us,-1)})}z(()=>{ei=qo(st,"",ei,{height:`${c(It)??""}px`}),ln(Yi,"title",c(A).path),W(Qi,`History: ${c(A).name??""}`)}),$("mousedown",Ri,Xa),$("click",gn,_t),D(gt,st)};H(Df,gt=>{c(A)&&gt(Rb)})}z(()=>{he=At(Ul,1,"search-toggle svelte-1pyfjii",null,he,{active:c(Te)}),ct=At(sd,1,"tree-root-drop svelte-1pyfjii",null,ct,{"drag-target":c(a)===""})}),$("click",Ef,pi),$("click",yf,Di),$("click",Ul,()=>c(Te)?Jt():Ci("text")),$("click",Qa,Z),xs("dragover",sd,gt=>dn(gt,"")),xs("dragleave",sd,Ln),xs("drop",sd,gt=>Oi(gt,""))}var nx=v(id,2),sx=v(nx,2),ox=_(sx);{var sr=G=>{var he=TK(),ct=_(he),gt=v(ct,2);ti(gt,21,()=>c(d),ei=>ei.path,(ei,Ri)=>{var Pi=PK();let Yi;var Qi=_(Pi),gn=_(Qi),un=v(Qi,2);{var Sn=An=>{var us=IK();D(An,us)};H(un,An=>{c(Ri).dirty&&An(Sn)})}var yn=v(un,2);z(An=>{Yi=At(Pi,1,"tab svelte-1pyfjii",null,Yi,{active:c(Ri).path===c(u)}),ln(Pi,"data-tab-path",c(Ri).path),W(gn,An)},[()=>c(Ri).path.split("/").pop()]),$("click",Pi,()=>ut(c(Ri).path)),$("keydown",Pi,An=>An.key==="Enter"&&ut(c(Ri).path)),$("click",yn,An=>{An.stopPropagation(),nt(c(Ri).path)}),D(ei,Pi)}),gs(gt,ei=>m(oi,ei),()=>c(oi));var st=v(gt,2);z(()=>{ct.disabled=!c(ki),st.disabled=!c(_i)}),$("click",ct,()=>ii(-1)),xs("scroll",gt,Ee),xs("wheel",gt,ei=>{ei.preventDefault(),c(oi).scrollLeft+=ei.deltaY,Ee()}),$("click",st,()=>ii(1)),D(G,he)};H(ox,G=>{c(d).length>0&&G(sr)})}var Ja=v(ox,2),rx=_(Ja),jr=_(rx),ax=v(rx,2);{var ql=G=>{var he=VK(),ct=_(he),gt=_(ct),st=v(ct,2);{var ei=gn=>{var un=OK(),Sn=_(un),yn=_(Sn),An=v(Sn,2);{var us=_n=>{var $n=NK(),Ns=Et($n),bo=v(Ns,2),Os=v(_(bo),2);ti(Os,21,()=>c(b).changes,Hi,(l,h)=>{var x=MK(),E=_(x),k=_(E),N=v(E,2),te=_(N),_e=v(N,2),ke=_(_e);z(xt=>{Zo(k,xt),W(te,c(h).status),W(ke,c(h).file)},[()=>c(O).has(c(h).file)]),$("change",k,()=>{const xt=new Set(c(O));xt.has(c(h).file)?xt.delete(c(h).file):xt.add(c(h).file),m(O,xt,!0)}),D(l,x)});var ks=v(Os,2),hs=_(ks),ls=v(hs,2),Ks=_(ls),Mn=v(ks,2);{var ps=l=>{var h=RK(),x=_(h);z(()=>W(x,c(M))),D(l,h)};H(Mn,l=>{c(M)&&l(ps)})}z(l=>{var h;ls.disabled=l,W(Ks,c(U)?"…":c(O).size===((h=c(b))==null?void 0:h.changes.length)?"Commit all":`Commit ${c(O).size}`)},[()=>!c(bi).trim()||c(U)||c(O).size===0]),$("click",Ns,()=>m(Vt,!1)),$("keydown",hs,l=>l.key==="Enter"&&ee()),zt(hs,()=>c(bi),l=>m(bi,l)),$("click",ls,ee),D(_n,$n)};H(An,_n=>{c(Vt)&&_n(us)})}z(()=>{ln(Sn,"title",`${c(b).changes.length??""} uncommitted change(s) — click to view`),W(yn,`✎${c(b).changes.length??""}`)}),$("click",Sn,()=>{c(Vt)||m(O,new Set(c(b).changes.map(_n=>_n.file)),!0),m(Vt,!c(Vt)),m(M,"")}),D(gn,un)};H(st,gn=>{c(b).changes.length>0&&gn(ei)})}var Ri=v(st,2);{var Pi=gn=>{var un=WK(),Sn=_(un),yn=_(Sn),An=v(Sn,2);{var us=_n=>{var $n=HK(),Ns=Et($n),bo=v(Ns,2),Os=_(bo),ks=_(Os),hs=v(Os,2),ls=_(hs);z(()=>W(ks,`${c(b).ahead??""} unpushed commit(s)`)),$("click",Ns,()=>m(Ot,!1)),$("click",ls,()=>{m(Ot,!1),ht()}),D(_n,$n)};H(An,_n=>{c(Ot)&&_n(us)})}z(()=>{ln(Sn,"title",`${c(b).ahead??""} commit(s) ahead of upstream — click to push`),W(yn,`↑${c(b).ahead??""}`)}),$("click",Sn,()=>m(Ot,!c(Ot))),D(gn,un)};H(Ri,gn=>{c(b).ahead>0&&gn(Pi)})}var Yi=v(Ri,2);{var Qi=gn=>{var un=zK(),Sn=_(un);z(()=>{ln(un,"title",`${c(b).behind??""} commit(s) behind upstream`),W(Sn,`↓${c(b).behind??""}`)}),D(gn,un)};H(Yi,gn=>{c(b).behind>0&&gn(Qi)})}z(()=>{ln(ct,"title",`Branch: ${c(b).branch??""}`),W(gt,`⎇ ${c(b).branch??""}`)}),D(G,he)};H(ax,G=>{c(b)&&G(ql)})}var lx=v(ax,2),Gl=_(lx),od=_(Gl),ch=_(od),cx=v(od,2),xa=v(Gl,2);{var dh=G=>{var he=jK(),ct=Et(he),gt=v(ct,2),st=_(gt),ei=v(st,2);$("click",ct,()=>m(p,!1)),$("click",st,()=>{m(p,!1),Fe()}),$("click",ei,()=>{m(p,!1),Je()}),D(G,he)};H(xa,G=>{c(p)&&G(dh)})}var dx=v(lx,2);{var Af=G=>{var he=$K();$("click",he,Jn),D(G,he)};H(dx,G=>{c(u)&&G(Af)})}var kf=v(dx,2);let xr;var Nb=v(Ja,2),el=_(Nb),ux=_(el),mr=_(ux);gs(mr,G=>Vi=G,()=>Vi);var rd=v(mr,2);{var hx=G=>{var he=UK();D(G,he)};H(rd,G=>{c(u)||G(hx)})}var uh=v(rd,2);{var hh=G=>{var he=ZK(),ct=_(he),gt=_(ct),st=v(_(gt)),ei=_(st),Ri=v(gt,2),Pi=_(Ri),Yi=_(Pi),Qi=_(Yi),gn=_(Qi),un=v(Qi,2),Sn=v(Yi,2);{var yn=_n=>{var $n=KK(),Ns=Et($n),bo=v(Ns,2),Os=_(bo);{var ks=ls=>{var Ks=qK();$("click",Ks,()=>{m(li,!1),m(Gt,!0),ao()}),D(ls,Ks)},hs=ls=>{var Ks=GK();$("click",Ks,()=>{m(li,!1),m(Gt,!1)}),D(ls,Ks)};H(Os,ls=>{c(Gt)?ls(hs,-1):ls(ks)})}$("click",Ns,()=>m(li,!1)),D(_n,$n)};H(Sn,_n=>{c(li)&&_n(yn)})}var An=v(Pi,2),us=v(ct,2);gs(us,_n=>m(vt,_n),()=>c(vt)),z(_n=>{W(ei,_n),W(gn,c(Gt)?"Auto-accept ✓":"Accept")},[()=>{var _n;return(_n=c(u))==null?void 0:_n.split("/").pop()}]),$("click",Qi,ao),$("click",un,()=>m(li,!c(li))),$("click",An,ah),D(G,he)};H(uh,G=>{c(it)!==null&&G(hh)})}var Bf=v(uh,2);{var fh=G=>{var he=QK(),ct=_(he),gt=_(ct),st=v(_(gt)),ei=_(st),Ri=v(st,2),Pi=_(Ri),Yi=v(gt,2),Qi=_(Yi),gn=v(ct,2);{var un=yn=>{var An=XK();D(yn,An)},Sn=yn=>{var An=YK();gs(An,us=>m(P,us),()=>c(P)),D(yn,An)};H(gn,yn=>{c(X)?yn(un):yn(Sn,-1)})}z(yn=>{var An;W(ei,yn),W(Pi,(An=c(A))==null?void 0:An.name)},[()=>c(fe).slice(0,7)]),$("click",Qi,bt),D(G,he)};H(Bf,G=>{c(ae)&&G(fh)})}var ma=v(ux,2);let ad,gh;var Ff=_(ma);{var Ob=G=>{var he=JK();$("mousedown",he,ir),D(G,he)};H(Ff,G=>{c(C)&&G(Ob)})}var ld=v(Ff,2),Lf=_(ld),If=_(Lf),Hb=v(If);{var fx=G=>{var he=eZ(),ct=_(he);z(gt=>W(ct,`— ${gt??""}`),[()=>c(u).split("/").pop()]),D(G,he)};H(Hb,G=>{c(u)&&G(fx)})}var Wb=v(Lf,2);{var vr=G=>{var he=iZ(),ct=Et(he);ti(ct,21,()=>qi,Hi,(Pi,Yi)=>{var Qi=tZ(),gn=_(Qi),un={};z(()=>{W(gn,c(Yi)),un!==(un=c(Yi))&&(Qi.value=(Qi.__value=c(Yi))??"")}),D(Pi,Qi)});var gt=v(ct,2),st=v(gt,2),ei=_(st),Ri=v(st,2);Ls(ct,()=>c(pt),Pi=>m(pt,Pi)),zt(gt,()=>c(Ut),Pi=>m(Ut,Pi)),ws(ei,()=>c(Ni),Pi=>m(Ni,Pi)),$("click",Ri,In),D(G,he)};H(Wb,G=>{c(C)&&G(vr)})}var ph=v(ld,2);{var zb=G=>{var he=oZ(),ct=_(he);ti(ct,17,()=>{var ei;return(((ei=c(re))==null?void 0:ei.logEntries)??[]).filter(Wi)},ei=>ei.ts+ei.msg,(ei,Ri)=>{var Pi=nZ(),Yi=_(Pi),Qi=_(Yi),gn=v(Yi,2),un=_(gn),Sn=v(gn,2),yn=_(Sn);z((An,us)=>{At(Pi,1,`log-line ${c(Ri).level??""}`,"svelte-1pyfjii"),W(Qi,An),W(un,us),W(yn,c(Ri).msg)},[()=>Zi(c(Ri).ts),()=>c(Ri).level.toUpperCase()]),D(ei,Pi)});var gt=v(ct,2);{var st=ei=>{var Ri=sZ();D(ei,Ri)};H(gt,ei=>{var Ri;(((Ri=c(re))==null?void 0:Ri.logEntries.length)??0)===0&&ei(st)})}gs(he,ei=>m(ce,ei),()=>c(ce)),D(G,he)};H(ph,G=>{c(C)&&G(zb)})}var xh=v(el,2);{var Vb=G=>{var he=rZ(),ct=Et(he),gt=v(ct,2);let st;var ei=_(gt);HG(ei,{get currentScript(){return c(Ge)},onApply:Ps,onCreateFile:Qc,get extraFiles(){return c(Ae)},set extraFiles(Ri){m(Ae,Ri,!0)}}),z(()=>st=qo(gt,"",st,{width:`${c(ci)??""}px`})),$("mousedown",ct,zr),D(G,he)};H(xh,G=>{c(Qe)&&G(Vb)})}z(()=>{var G;$l=qo(id,"",$l,{width:`${c(dt)??""}px`}),W(jr,c(u)??"No file selected"),od.disabled=!((G=c(re))!=null&&G.dirty)||c(f),W(ch,c(f)?"Saving…":"Save"),cx.disabled=!c(u),xr=At(kf,1,"ai-toggle svelte-1pyfjii",null,xr,{"ai-open":c(Qe)}),ln(kf,"title",c(Qe)?"Close AI assistant":"Open AI assistant"),ad=At(ma,1,"log-panel svelte-1pyfjii",null,ad,{collapsed:!c(C)}),gh=qo(ma,"",gh,{height:c(C)?`${c(ye)}px`:"26px"}),W(If,`${c(C)?"▾":"▸"} Script Log `)}),$("keydown",td,fn),$("mousedown",nx,vs),$("click",od,Fe),$("click",cx,()=>m(p,!c(p))),$("click",kf,()=>m(Qe,!c(Qe))),$("click",Lf,es),D(o,nr),Us()}Ys(["click","contextmenu","keydown","change","input","mousedown"]);var rg={exports:{}};/* @preserve
220
+ * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com
221
+ * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade
222
+ */var cZ=rg.exports,R2;function dZ(){return R2||(R2=1,(function(o,e){(function(t,i){i(e)})(cZ,(function(t){var i="1.9.4";function n(l){var h,x,E,k;for(x=1,E=arguments.length;x<E;x++){k=arguments[x];for(h in k)l[h]=k[h]}return l}var s=Object.create||(function(){function l(){}return function(h){return l.prototype=h,new l}})();function r(l,h){var x=Array.prototype.slice;if(l.bind)return l.bind.apply(l,x.call(arguments,1));var E=x.call(arguments,2);return function(){return l.apply(h,E.length?E.concat(x.call(arguments)):arguments)}}var a=0;function d(l){return"_leaflet_id"in l||(l._leaflet_id=++a),l._leaflet_id}function u(l,h,x){var E,k,N,te;return te=function(){E=!1,k&&(N.apply(x,k),k=!1)},N=function(){E?k=arguments:(l.apply(x,arguments),setTimeout(te,h),E=!0)},N}function f(l,h,x){var E=h[1],k=h[0],N=E-k;return l===E&&x?l:((l-k)%N+N)%N+k}function g(){return!1}function p(l,h){if(h===!1)return l;var x=Math.pow(10,h===void 0?6:h);return Math.round(l*x)/x}function C(l){return l.trim?l.trim():l.replace(/^\s+|\s+$/g,"")}function b(l){return C(l).split(/\s+/)}function y(l,h){Object.prototype.hasOwnProperty.call(l,"options")||(l.options=l.options?s(l.options):{});for(var x in h)l.options[x]=h[x];return l.options}function w(l,h,x){var E=[];for(var k in l)E.push(encodeURIComponent(x?k.toUpperCase():k)+"="+encodeURIComponent(l[k]));return(!h||h.indexOf("?")===-1?"?":"&")+E.join("&")}var A=/\{ *([\w_ -]+) *\}/g;function I(l,h){return l.replace(A,function(x,E){var k=h[E];if(k===void 0)throw new Error("No value provided for variable "+x);return typeof k=="function"&&(k=k(h)),k})}var T=Array.isArray||function(l){return Object.prototype.toString.call(l)==="[object Array]"};function R(l,h){for(var x=0;x<l.length;x++)if(l[x]===h)return x;return-1}var P="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function V(l){return window["webkit"+l]||window["moz"+l]||window["ms"+l]}var j=0;function J(l){var h=+new Date,x=Math.max(0,16-(h-j));return j=h+x,window.setTimeout(l,x)}var ae=window.requestAnimationFrame||V("RequestAnimationFrame")||J,fe=window.cancelAnimationFrame||V("CancelAnimationFrame")||V("CancelRequestAnimationFrame")||function(l){window.clearTimeout(l)};function X(l,h,x){if(x&&ae===J)l.call(h);else return ae.call(window,r(l,h))}function ce(l){l&&fe.call(window,l)}var me={__proto__:null,extend:n,create:s,bind:r,get lastId(){return a},stamp:d,throttle:u,wrapNum:f,falseFn:g,formatNum:p,trim:C,splitWords:b,setOptions:y,getParamString:w,template:I,isArray:T,indexOf:R,emptyImageUrl:P,requestFn:ae,cancelFn:fe,requestAnimFrame:X,cancelAnimFrame:ce};function oe(){}oe.extend=function(l){var h=function(){y(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},x=h.__super__=this.prototype,E=s(x);E.constructor=h,h.prototype=E;for(var k in this)Object.prototype.hasOwnProperty.call(this,k)&&k!=="prototype"&&k!=="__super__"&&(h[k]=this[k]);return l.statics&&n(h,l.statics),l.includes&&(le(l.includes),n.apply(null,[E].concat(l.includes))),n(E,l),delete E.statics,delete E.includes,E.options&&(E.options=x.options?s(x.options):{},n(E.options,l.options)),E._initHooks=[],E.callInitHooks=function(){if(!this._initHooksCalled){x.callInitHooks&&x.callInitHooks.call(this),this._initHooksCalled=!0;for(var N=0,te=E._initHooks.length;N<te;N++)E._initHooks[N].call(this)}},h},oe.include=function(l){var h=this.prototype.options;return n(this.prototype,l),l.options&&(this.prototype.options=h,this.mergeOptions(l.options)),this},oe.mergeOptions=function(l){return n(this.prototype.options,l),this},oe.addInitHook=function(l){var h=Array.prototype.slice.call(arguments,1),x=typeof l=="function"?l:function(){this[l].apply(this,h)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(x),this};function le(l){if(!(typeof L>"u"||!L||!L.Mixin)){l=T(l)?l:[l];for(var h=0;h<l.length;h++)l[h]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",new Error().stack)}}var Ae={on:function(l,h,x){if(typeof l=="object")for(var E in l)this._on(E,l[E],h);else{l=b(l);for(var k=0,N=l.length;k<N;k++)this._on(l[k],h,x)}return this},off:function(l,h,x){if(!arguments.length)delete this._events;else if(typeof l=="object")for(var E in l)this._off(E,l[E],h);else{l=b(l);for(var k=arguments.length===1,N=0,te=l.length;N<te;N++)k?this._off(l[N]):this._off(l[N],h,x)}return this},_on:function(l,h,x,E){if(typeof h!="function"){console.warn("wrong listener type: "+typeof h);return}if(this._listens(l,h,x)===!1){x===this&&(x=void 0);var k={fn:h,ctx:x};E&&(k.once=!0),this._events=this._events||{},this._events[l]=this._events[l]||[],this._events[l].push(k)}},_off:function(l,h,x){var E,k,N;if(this._events&&(E=this._events[l],!!E)){if(arguments.length===1){if(this._firingCount)for(k=0,N=E.length;k<N;k++)E[k].fn=g;delete this._events[l];return}if(typeof h!="function"){console.warn("wrong listener type: "+typeof h);return}var te=this._listens(l,h,x);if(te!==!1){var _e=E[te];this._firingCount&&(_e.fn=g,this._events[l]=E=E.slice()),E.splice(te,1)}}},fire:function(l,h,x){if(!this.listens(l,x))return this;var E=n({},h,{type:l,target:this,sourceTarget:h&&h.sourceTarget||this});if(this._events){var k=this._events[l];if(k){this._firingCount=this._firingCount+1||1;for(var N=0,te=k.length;N<te;N++){var _e=k[N],ke=_e.fn;_e.once&&this.off(l,ke,_e.ctx),ke.call(_e.ctx||this,E)}this._firingCount--}}return x&&this._propagateEvent(E),this},listens:function(l,h,x,E){typeof l!="string"&&console.warn('"string" type argument expected');var k=h;typeof h!="function"&&(E=!!h,k=void 0,x=void 0);var N=this._events&&this._events[l];if(N&&N.length&&this._listens(l,k,x)!==!1)return!0;if(E){for(var te in this._eventParents)if(this._eventParents[te].listens(l,h,x,E))return!0}return!1},_listens:function(l,h,x){if(!this._events)return!1;var E=this._events[l]||[];if(!h)return!!E.length;x===this&&(x=void 0);for(var k=0,N=E.length;k<N;k++)if(E[k].fn===h&&E[k].ctx===x)return k;return!1},once:function(l,h,x){if(typeof l=="object")for(var E in l)this._on(E,l[E],h,!0);else{l=b(l);for(var k=0,N=l.length;k<N;k++)this._on(l[k],h,x,!0)}return this},addEventParent:function(l){return this._eventParents=this._eventParents||{},this._eventParents[d(l)]=l,this},removeEventParent:function(l){return this._eventParents&&delete this._eventParents[d(l)],this},_propagateEvent:function(l){for(var h in this._eventParents)this._eventParents[h].fire(l.type,n({layer:l.target,propagatedFrom:l.target},l),!0)}};Ae.addEventListener=Ae.on,Ae.removeEventListener=Ae.clearAllEventListeners=Ae.off,Ae.addOneTimeEventListener=Ae.once,Ae.fireEvent=Ae.fire,Ae.hasEventListeners=Ae.listens;var Te=oe.extend(Ae);function xe(l,h,x){this.x=x?Math.round(l):l,this.y=x?Math.round(h):h}var Ne=Math.trunc||function(l){return l>0?Math.floor(l):Math.ceil(l)};xe.prototype={clone:function(){return new xe(this.x,this.y)},add:function(l){return this.clone()._add(Ve(l))},_add:function(l){return this.x+=l.x,this.y+=l.y,this},subtract:function(l){return this.clone()._subtract(Ve(l))},_subtract:function(l){return this.x-=l.x,this.y-=l.y,this},divideBy:function(l){return this.clone()._divideBy(l)},_divideBy:function(l){return this.x/=l,this.y/=l,this},multiplyBy:function(l){return this.clone()._multiplyBy(l)},_multiplyBy:function(l){return this.x*=l,this.y*=l,this},scaleBy:function(l){return new xe(this.x*l.x,this.y*l.y)},unscaleBy:function(l){return new xe(this.x/l.x,this.y/l.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=Ne(this.x),this.y=Ne(this.y),this},distanceTo:function(l){l=Ve(l);var h=l.x-this.x,x=l.y-this.y;return Math.sqrt(h*h+x*x)},equals:function(l){return l=Ve(l),l.x===this.x&&l.y===this.y},contains:function(l){return l=Ve(l),Math.abs(l.x)<=Math.abs(this.x)&&Math.abs(l.y)<=Math.abs(this.y)},toString:function(){return"Point("+p(this.x)+", "+p(this.y)+")"}};function Ve(l,h,x){return l instanceof xe?l:T(l)?new xe(l[0],l[1]):l==null?l:typeof l=="object"&&"x"in l&&"y"in l?new xe(l.x,l.y):new xe(l,h,x)}function ve(l,h){if(l)for(var x=h?[l,h]:l,E=0,k=x.length;E<k;E++)this.extend(x[E])}ve.prototype={extend:function(l){var h,x;if(!l)return this;if(l instanceof xe||typeof l[0]=="number"||"x"in l)h=x=Ve(l);else if(l=mt(l),h=l.min,x=l.max,!h||!x)return this;return!this.min&&!this.max?(this.min=h.clone(),this.max=x.clone()):(this.min.x=Math.min(h.x,this.min.x),this.max.x=Math.max(x.x,this.max.x),this.min.y=Math.min(h.y,this.min.y),this.max.y=Math.max(x.y,this.max.y)),this},getCenter:function(l){return Ve((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,l)},getBottomLeft:function(){return Ve(this.min.x,this.max.y)},getTopRight:function(){return Ve(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(l){var h,x;return typeof l[0]=="number"||l instanceof xe?l=Ve(l):l=mt(l),l instanceof ve?(h=l.min,x=l.max):h=x=l,h.x>=this.min.x&&x.x<=this.max.x&&h.y>=this.min.y&&x.y<=this.max.y},intersects:function(l){l=mt(l);var h=this.min,x=this.max,E=l.min,k=l.max,N=k.x>=h.x&&E.x<=x.x,te=k.y>=h.y&&E.y<=x.y;return N&&te},overlaps:function(l){l=mt(l);var h=this.min,x=this.max,E=l.min,k=l.max,N=k.x>h.x&&E.x<x.x,te=k.y>h.y&&E.y<x.y;return N&&te},isValid:function(){return!!(this.min&&this.max)},pad:function(l){var h=this.min,x=this.max,E=Math.abs(h.x-x.x)*l,k=Math.abs(h.y-x.y)*l;return mt(Ve(h.x-E,h.y-k),Ve(x.x+E,x.y+k))},equals:function(l){return l?(l=mt(l),this.min.equals(l.getTopLeft())&&this.max.equals(l.getBottomRight())):!1}};function mt(l,h){return!l||l instanceof ve?l:new ve(l,h)}function Mt(l,h){if(l)for(var x=h?[l,h]:l,E=0,k=x.length;E<k;E++)this.extend(x[E])}Mt.prototype={extend:function(l){var h=this._southWest,x=this._northEast,E,k;if(l instanceof yt)E=l,k=l;else if(l instanceof Mt){if(E=l._southWest,k=l._northEast,!E||!k)return this}else return l?this.extend(be(l)||ot(l)):this;return!h&&!x?(this._southWest=new yt(E.lat,E.lng),this._northEast=new yt(k.lat,k.lng)):(h.lat=Math.min(E.lat,h.lat),h.lng=Math.min(E.lng,h.lng),x.lat=Math.max(k.lat,x.lat),x.lng=Math.max(k.lng,x.lng)),this},pad:function(l){var h=this._southWest,x=this._northEast,E=Math.abs(h.lat-x.lat)*l,k=Math.abs(h.lng-x.lng)*l;return new Mt(new yt(h.lat-E,h.lng-k),new yt(x.lat+E,x.lng+k))},getCenter:function(){return new yt((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new yt(this.getNorth(),this.getWest())},getSouthEast:function(){return new yt(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(l){typeof l[0]=="number"||l instanceof yt||"lat"in l?l=be(l):l=ot(l);var h=this._southWest,x=this._northEast,E,k;return l instanceof Mt?(E=l.getSouthWest(),k=l.getNorthEast()):E=k=l,E.lat>=h.lat&&k.lat<=x.lat&&E.lng>=h.lng&&k.lng<=x.lng},intersects:function(l){l=ot(l);var h=this._southWest,x=this._northEast,E=l.getSouthWest(),k=l.getNorthEast(),N=k.lat>=h.lat&&E.lat<=x.lat,te=k.lng>=h.lng&&E.lng<=x.lng;return N&&te},overlaps:function(l){l=ot(l);var h=this._southWest,x=this._northEast,E=l.getSouthWest(),k=l.getNorthEast(),N=k.lat>h.lat&&E.lat<x.lat,te=k.lng>h.lng&&E.lng<x.lng;return N&&te},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(l,h){return l?(l=ot(l),this._southWest.equals(l.getSouthWest(),h)&&this._northEast.equals(l.getNorthEast(),h)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function ot(l,h){return l instanceof Mt?l:new Mt(l,h)}function yt(l,h,x){if(isNaN(l)||isNaN(h))throw new Error("Invalid LatLng object: ("+l+", "+h+")");this.lat=+l,this.lng=+h,x!==void 0&&(this.alt=+x)}yt.prototype={equals:function(l,h){if(!l)return!1;l=be(l);var x=Math.max(Math.abs(this.lat-l.lat),Math.abs(this.lng-l.lng));return x<=(h===void 0?1e-9:h)},toString:function(l){return"LatLng("+p(this.lat,l)+", "+p(this.lng,l)+")"},distanceTo:function(l){return si.distance(this,be(l))},wrap:function(){return si.wrapLatLng(this)},toBounds:function(l){var h=180*l/40075017,x=h/Math.cos(Math.PI/180*this.lat);return ot([this.lat-h,this.lng-x],[this.lat+h,this.lng+x])},clone:function(){return new yt(this.lat,this.lng,this.alt)}};function be(l,h,x){return l instanceof yt?l:T(l)&&typeof l[0]!="object"?l.length===3?new yt(l[0],l[1],l[2]):l.length===2?new yt(l[0],l[1]):null:l==null?l:typeof l=="object"&&"lat"in l?new yt(l.lat,"lng"in l?l.lng:l.lon,l.alt):h===void 0?null:new yt(l,h,x)}var Nt={latLngToPoint:function(l,h){var x=this.projection.project(l),E=this.scale(h);return this.transformation._transform(x,E)},pointToLatLng:function(l,h){var x=this.scale(h),E=this.transformation.untransform(l,x);return this.projection.unproject(E)},project:function(l){return this.projection.project(l)},unproject:function(l){return this.projection.unproject(l)},scale:function(l){return 256*Math.pow(2,l)},zoom:function(l){return Math.log(l/256)/Math.LN2},getProjectedBounds:function(l){if(this.infinite)return null;var h=this.projection.bounds,x=this.scale(l),E=this.transformation.transform(h.min,x),k=this.transformation.transform(h.max,x);return new ve(E,k)},infinite:!1,wrapLatLng:function(l){var h=this.wrapLng?f(l.lng,this.wrapLng,!0):l.lng,x=this.wrapLat?f(l.lat,this.wrapLat,!0):l.lat,E=l.alt;return new yt(x,h,E)},wrapLatLngBounds:function(l){var h=l.getCenter(),x=this.wrapLatLng(h),E=h.lat-x.lat,k=h.lng-x.lng;if(E===0&&k===0)return l;var N=l.getSouthWest(),te=l.getNorthEast(),_e=new yt(N.lat-E,N.lng-k),ke=new yt(te.lat-E,te.lng-k);return new Mt(_e,ke)}},si=n({},Nt,{wrapLng:[-180,180],R:6371e3,distance:function(l,h){var x=Math.PI/180,E=l.lat*x,k=h.lat*x,N=Math.sin((h.lat-l.lat)*x/2),te=Math.sin((h.lng-l.lng)*x/2),_e=N*N+Math.cos(E)*Math.cos(k)*te*te,ke=2*Math.atan2(Math.sqrt(_e),Math.sqrt(1-_e));return this.R*ke}}),Xe=6378137,tt={R:Xe,MAX_LATITUDE:85.0511287798,project:function(l){var h=Math.PI/180,x=this.MAX_LATITUDE,E=Math.max(Math.min(x,l.lat),-x),k=Math.sin(E*h);return new xe(this.R*l.lng*h,this.R*Math.log((1+k)/(1-k))/2)},unproject:function(l){var h=180/Math.PI;return new yt((2*Math.atan(Math.exp(l.y/this.R))-Math.PI/2)*h,l.x*h/this.R)},bounds:(function(){var l=Xe*Math.PI;return new ve([-l,-l],[l,l])})()};function wt(l,h,x,E){if(T(l)){this._a=l[0],this._b=l[1],this._c=l[2],this._d=l[3];return}this._a=l,this._b=h,this._c=x,this._d=E}wt.prototype={transform:function(l,h){return this._transform(l.clone(),h)},_transform:function(l,h){return h=h||1,l.x=h*(this._a*l.x+this._b),l.y=h*(this._c*l.y+this._d),l},untransform:function(l,h){return h=h||1,new xe((l.x/h-this._b)/this._a,(l.y/h-this._d)/this._c)}};function Yt(l,h,x,E){return new wt(l,h,x,E)}var fi=n({},si,{code:"EPSG:3857",projection:tt,transformation:(function(){var l=.5/(Math.PI*tt.R);return Yt(l,.5,-l,.5)})()}),oi=n({},fi,{code:"EPSG:900913"});function ki(l){return document.createElementNS("http://www.w3.org/2000/svg",l)}function _i(l,h){var x="",E,k,N,te,_e,ke;for(E=0,N=l.length;E<N;E++){for(_e=l[E],k=0,te=_e.length;k<te;k++)ke=_e[k],x+=(k?"L":"M")+ke.x+" "+ke.y;x+=h?ye.svg?"z":"x":""}return x||"M0 0"}var Ze=document.documentElement.style,Ee="ActiveXObject"in window,ii=Ee&&!document.addEventListener,Ci="msLaunchUri"in navigator&&!("documentMode"in document),Jt=dt("webkit"),zi=dt("android"),Ji=dt("android 2")||dt("android 3"),Ii=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),wn=zi&&dt("Google")&&Ii<537&&!("AudioNode"in window),cn=!!window.opera,pn=!Ci&&dt("chrome"),fn=dt("gecko")&&!Jt&&!cn&&!Ee,pt=!pn&&dt("safari"),Ut=dt("phantom"),Ni="OTransition"in Ze,qi=navigator.platform.indexOf("Win")===0,gi=Ee&&"transition"in Ze,Wi="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!Ji,Ui="MozPerspective"in Ze,tn=!window.L_DISABLE_3D&&(gi||Wi||Ui)&&!Ni&&!Ut,yi=typeof orientation<"u"||dt("mobile"),Vi=yi&&Jt,ze=yi&&Wi,qt=!window.PointerEvent&&window.MSPointerEvent,wi=!!(window.PointerEvent||qt),ji="ontouchstart"in window||!!window.TouchEvent,Si=!window.L_NO_TOUCH&&(ji||wi),K=yi&&cn,De=yi&&fn,Qe=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,it=(function(){var l=!1;try{var h=Object.defineProperty({},"passive",{get:function(){l=!0}});window.addEventListener("testPassiveEventSupport",g,h),window.removeEventListener("testPassiveEventSupport",g,h)}catch{}return l})(),Gt=(function(){return!!document.createElement("canvas").getContext})(),li=!!(document.createElementNS&&ki("svg").createSVGRect),vt=!!li&&(function(){var l=document.createElement("div");return l.innerHTML="<svg/>",(l.firstChild&&l.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),ft=!li&&(function(){try{var l=document.createElement("div");l.innerHTML='<v:shape adj="1"/>';var h=l.firstChild;return h.style.behavior="url(#default#VML)",h&&typeof h.adj=="object"}catch{return!1}})(),Y=navigator.platform.indexOf("Mac")===0,Re=navigator.platform.indexOf("Linux")===0;function dt(l){return navigator.userAgent.toLowerCase().indexOf(l)>=0}var ye={ie:Ee,ielt9:ii,edge:Ci,webkit:Jt,android:zi,android23:Ji,androidStock:wn,opera:cn,chrome:pn,gecko:fn,safari:pt,phantom:Ut,opera12:Ni,win:qi,ie3d:gi,webkit3d:Wi,gecko3d:Ui,any3d:tn,mobile:yi,mobileWebkit:Vi,mobileWebkit3d:ze,msPointer:qt,pointer:wi,touch:Si,touchNative:ji,mobileOpera:K,mobileGecko:De,retina:Qe,passiveEvents:it,canvas:Gt,svg:li,vml:ft,inlineSvg:vt,mac:Y,linux:Re},ci=ye.msPointer?"MSPointerDown":"pointerdown",It=ye.msPointer?"MSPointerMove":"pointermove",ie=ye.msPointer?"MSPointerUp":"pointerup",Ye=ye.msPointer?"MSPointerCancel":"pointercancel",kt={touchstart:ci,touchmove:It,touchend:ie,touchcancel:Ye},Pt={touchstart:rt,touchmove:Ge,touchend:Ge,touchcancel:Ge},Bt={},Be=!1;function je(l,h,x){return h==="touchstart"&&pe(),Pt[h]?(x=Pt[h].bind(this,x),l.addEventListener(kt[h],x,!1),x):(console.warn("wrong event specified:",h),g)}function Kt(l,h,x){if(!kt[h]){console.warn("wrong event specified:",h);return}l.removeEventListener(kt[h],x,!1)}function ri(l){Bt[l.pointerId]=l}function ui(l){Bt[l.pointerId]&&(Bt[l.pointerId]=l)}function Xt(l){delete Bt[l.pointerId]}function pe(){Be||(document.addEventListener(ci,ri,!0),document.addEventListener(It,ui,!0),document.addEventListener(ie,Xt,!0),document.addEventListener(Ye,Xt,!0),Be=!0)}function Ge(l,h){if(h.pointerType!==(h.MSPOINTER_TYPE_MOUSE||"mouse")){h.touches=[];for(var x in Bt)h.touches.push(Bt[x]);h.changedTouches=[h],l(h)}}function rt(l,h){h.MSPOINTER_TYPE_TOUCH&&h.pointerType===h.MSPOINTER_TYPE_TOUCH&&hi(h),Ge(l,h)}function lt(l){var h={},x,E;for(E in l)x=l[E],h[E]=x&&x.bind?x.bind(l):x;return l=h,h.type="dblclick",h.detail=2,h.isTrusted=!1,h._simulated=!0,h}var Vt=200;function Ot(l,h){l.addEventListener("dblclick",h);var x=0,E;function k(N){if(N.detail!==1){E=N.detail;return}if(!(N.pointerType==="mouse"||N.sourceCapabilities&&!N.sourceCapabilities.firesTouchEvents)){var te=dn(N);if(!(te.some(function(ke){return ke instanceof HTMLLabelElement&&ke.attributes.for})&&!te.some(function(ke){return ke instanceof HTMLInputElement||ke instanceof HTMLSelectElement}))){var _e=Date.now();_e-x<=Vt?(E++,E===2&&h(lt(N))):E=1,x=_e}}}return l.addEventListener("click",k),{dblclick:h,simDblclick:k}}function bi(l,h){l.removeEventListener("dblclick",h.dblclick),l.removeEventListener("click",h.simDblclick)}var U=Ft(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),M=Ft(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),O=M==="webkitTransition"||M==="OTransition"?M+"End":"transitionend";function ee(l){return typeof l=="string"?document.getElementById(l):l}function ne(l,h){var x=l.style[h]||l.currentStyle&&l.currentStyle[h];if((!x||x==="auto")&&document.defaultView){var E=document.defaultView.getComputedStyle(l,null);x=E?E[h]:null}return x==="auto"?null:x}function se(l,h,x){var E=document.createElement(l);return E.className=h||"",x&&x.appendChild(E),E}function re(l){var h=l.parentNode;h&&h.removeChild(l)}function Ie(l){for(;l.firstChild;)l.removeChild(l.firstChild)}function We(l){var h=l.parentNode;h&&h.lastChild!==l&&h.appendChild(l)}function Ce(l){var h=l.parentNode;h&&h.firstChild!==l&&h.insertBefore(l,h.firstChild)}function Pe(l,h){if(l.classList!==void 0)return l.classList.contains(h);var x=Z(l);return x.length>0&&new RegExp("(^|\\s)"+h+"(\\s|$)").test(x)}function Me(l,h){if(l.classList!==void 0)for(var x=b(h),E=0,k=x.length;E<k;E++)l.classList.add(x[E]);else if(!Pe(l,h)){var N=Z(l);Qt(l,(N?N+" ":"")+h)}}function at(l,h){l.classList!==void 0?l.classList.remove(h):Qt(l,C((" "+Z(l)+" ").replace(" "+h+" "," ")))}function Qt(l,h){l.className.baseVal===void 0?l.className=h:l.className.baseVal=h}function Z(l){return l.correspondingElement&&(l=l.correspondingElement),l.className.baseVal===void 0?l.className:l.className.baseVal}function de(l,h){"opacity"in l.style?l.style.opacity=h:"filter"in l.style&&Ue(l,h)}function Ue(l,h){var x=!1,E="DXImageTransform.Microsoft.Alpha";try{x=l.filters.item(E)}catch{if(h===1)return}h=Math.round(h*100),x?(x.Enabled=h!==100,x.Opacity=h):l.style.filter+=" progid:"+E+"(opacity="+h+")"}function Ft(l){for(var h=document.documentElement.style,x=0;x<l.length;x++)if(l[x]in h)return l[x];return!1}function we(l,h,x){var E=h||new xe(0,0);l.style[U]=(ye.ie3d?"translate("+E.x+"px,"+E.y+"px)":"translate3d("+E.x+"px,"+E.y+"px,0)")+(x?" scale("+x+")":"")}function Oe(l,h){l._leaflet_pos=h,ye.any3d?we(l,h):(l.style.left=h.x+"px",l.style.top=h.y+"px")}function St(l){return l._leaflet_pos||new xe(0,0)}var ut,nt,ue;if("onselectstart"in document)ut=function(){bt(window,"selectstart",hi)},nt=function(){Di(window,"selectstart",hi)};else{var He=Ft(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);ut=function(){if(He){var l=document.documentElement.style;ue=l[He],l[He]="none"}},nt=function(){He&&(document.documentElement.style[He]=ue,ue=void 0)}}function Fe(){bt(window,"dragstart",hi)}function Je(){Di(window,"dragstart",hi)}var ht,Ke;function et(l){for(;l.tabIndex===-1;)l=l.parentNode;l.style&&(ge(),ht=l,Ke=l.style.outlineStyle,l.style.outlineStyle="none",bt(window,"keydown",ge))}function ge(){ht&&(ht.style.outlineStyle=Ke,ht=void 0,Ke=void 0,Di(window,"keydown",ge))}function $e(l){do l=l.parentNode;while((!l.offsetWidth||!l.offsetHeight)&&l!==document.body);return l}function _t(l){var h=l.getBoundingClientRect();return{x:h.width/l.offsetWidth||1,y:h.height/l.offsetHeight||1,boundingClientRect:h}}var Wt={__proto__:null,TRANSFORM:U,TRANSITION:M,TRANSITION_END:O,get:ee,getStyle:ne,create:se,remove:re,empty:Ie,toFront:We,toBack:Ce,hasClass:Pe,addClass:Me,removeClass:at,setClass:Qt,getClass:Z,setOpacity:de,testProp:Ft,setTransform:we,setPosition:Oe,getPosition:St,get disableTextSelection(){return ut},get enableTextSelection(){return nt},disableImageDrag:Fe,enableImageDrag:Je,preventOutline:et,restoreOutline:ge,getSizedParentNode:$e,getScale:_t};function bt(l,h,x,E){if(h&&typeof h=="object")for(var k in h)ai(l,k,h[k],x);else{h=b(h);for(var N=0,te=h.length;N<te;N++)ai(l,h[N],x,E)}return this}var pi="_leaflet_events";function Di(l,h,x,E){if(arguments.length===1)Xi(l),delete l[pi];else if(h&&typeof h=="object")for(var k in h)Ht(l,k,h[k],x);else if(h=b(h),arguments.length===2)Xi(l,function(_e){return R(h,_e)!==-1});else for(var N=0,te=h.length;N<te;N++)Ht(l,h[N],x,E);return this}function Xi(l,h){for(var x in l[pi]){var E=x.split(/\d/)[0];(!h||h(E))&&Ht(l,E,null,null,x)}}var Mi={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function ai(l,h,x,E){var k=h+d(x)+(E?"_"+d(E):"");if(l[pi]&&l[pi][k])return this;var N=function(_e){return x.call(E||l,_e||window.event)},te=N;!ye.touchNative&&ye.pointer&&h.indexOf("touch")===0?N=je(l,h,N):ye.touch&&h==="dblclick"?N=Ot(l,N):"addEventListener"in l?h==="touchstart"||h==="touchmove"||h==="wheel"||h==="mousewheel"?l.addEventListener(Mi[h]||h,N,ye.passiveEvents?{passive:!1}:!1):h==="mouseenter"||h==="mouseleave"?(N=function(_e){_e=_e||window.event,Jn(l,_e)&&te(_e)},l.addEventListener(Mi[h],N,!1)):l.addEventListener(h,te,!1):l.attachEvent("on"+h,N),l[pi]=l[pi]||{},l[pi][k]=N}function Ht(l,h,x,E,k){k=k||h+d(x)+(E?"_"+d(E):"");var N=l[pi]&&l[pi][k];if(!N)return this;!ye.touchNative&&ye.pointer&&h.indexOf("touch")===0?Kt(l,h,N):ye.touch&&h==="dblclick"?bi(l,N):"removeEventListener"in l?l.removeEventListener(Mi[h]||h,N,!1):l.detachEvent("on"+h,N),l[pi][k]=null}function Dt(l){return l.stopPropagation?l.stopPropagation():l.originalEvent?l.originalEvent._stopped=!0:l.cancelBubble=!0,this}function jt(l){return ai(l,"wheel",Dt),this}function Zt(l){return bt(l,"mousedown touchstart dblclick contextmenu",Dt),l._leaflet_disable_click=!0,this}function hi(l){return l.preventDefault?l.preventDefault():l.returnValue=!1,this}function nn(l){return hi(l),Dt(l),this}function dn(l){if(l.composedPath)return l.composedPath();for(var h=[],x=l.target;x;)h.push(x),x=x.parentNode;return h}function Ln(l,h){if(!h)return new xe(l.clientX,l.clientY);var x=_t(h),E=x.boundingClientRect;return new xe((l.clientX-E.left)/x.x-h.clientLeft,(l.clientY-E.top)/x.y-h.clientTop)}var Oi=ye.linux&&ye.chrome?window.devicePixelRatio:ye.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function Dn(l){return ye.edge?l.wheelDeltaY/2:l.deltaY&&l.deltaMode===0?-l.deltaY/Oi:l.deltaY&&l.deltaMode===1?-l.deltaY*20:l.deltaY&&l.deltaMode===2?-l.deltaY*60:l.deltaX||l.deltaZ?0:l.wheelDelta?(l.wheelDeltaY||l.wheelDelta)/2:l.detail&&Math.abs(l.detail)<32765?-l.detail*20:l.detail?l.detail/-32765*60:0}function Jn(l,h){var x=h.relatedTarget;if(!x)return!0;try{for(;x&&x!==l;)x=x.parentNode}catch{return!1}return x!==l}var In={__proto__:null,on:bt,off:Di,stopPropagation:Dt,disableScrollPropagation:jt,disableClickPropagation:Zt,preventDefault:hi,stop:nn,getPropagationPath:dn,getMousePosition:Ln,getWheelDelta:Dn,isExternalTarget:Jn,addListener:bt,removeListener:Di},es=Te.extend({run:function(l,h,x,E){this.stop(),this._el=l,this._inProgress=!0,this._duration=x||.25,this._easeOutPower=1/Math.max(E||.5,.2),this._startPos=St(l),this._offset=h.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=X(this._animate,this),this._step()},_step:function(l){var h=+new Date-this._startTime,x=this._duration*1e3;h<x?this._runFrame(this._easeOut(h/x),l):(this._runFrame(1),this._complete())},_runFrame:function(l,h){var x=this._startPos.add(this._offset.multiplyBy(l));h&&x._round(),Oe(this._el,x),this.fire("step")},_complete:function(){ce(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(l){return 1-Math.pow(1-l,this._easeOutPower)}}),Zi=Te.extend({options:{crs:fi,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(l,h){h=y(this,h),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(l),this._initLayout(),this._onResize=r(this._onResize,this),this._initEvents(),h.maxBounds&&this.setMaxBounds(h.maxBounds),h.zoom!==void 0&&(this._zoom=this._limitZoom(h.zoom)),h.center&&h.zoom!==void 0&&this.setView(be(h.center),h.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=M&&ye.any3d&&!ye.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),bt(this._proxy,O,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(l,h,x){if(h=h===void 0?this._zoom:this._limitZoom(h),l=this._limitCenter(be(l),h,this.options.maxBounds),x=x||{},this._stop(),this._loaded&&!x.reset&&x!==!0){x.animate!==void 0&&(x.zoom=n({animate:x.animate},x.zoom),x.pan=n({animate:x.animate,duration:x.duration},x.pan));var E=this._zoom!==h?this._tryAnimatedZoom&&this._tryAnimatedZoom(l,h,x.zoom):this._tryAnimatedPan(l,x.pan);if(E)return clearTimeout(this._sizeTimer),this}return this._resetView(l,h,x.pan&&x.pan.noMoveStart),this},setZoom:function(l,h){return this._loaded?this.setView(this.getCenter(),l,{zoom:h}):(this._zoom=l,this)},zoomIn:function(l,h){return l=l||(ye.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+l,h)},zoomOut:function(l,h){return l=l||(ye.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-l,h)},setZoomAround:function(l,h,x){var E=this.getZoomScale(h),k=this.getSize().divideBy(2),N=l instanceof xe?l:this.latLngToContainerPoint(l),te=N.subtract(k).multiplyBy(1-1/E),_e=this.containerPointToLatLng(k.add(te));return this.setView(_e,h,{zoom:x})},_getBoundsCenterZoom:function(l,h){h=h||{},l=l.getBounds?l.getBounds():ot(l);var x=Ve(h.paddingTopLeft||h.padding||[0,0]),E=Ve(h.paddingBottomRight||h.padding||[0,0]),k=this.getBoundsZoom(l,!1,x.add(E));if(k=typeof h.maxZoom=="number"?Math.min(h.maxZoom,k):k,k===1/0)return{center:l.getCenter(),zoom:k};var N=E.subtract(x).divideBy(2),te=this.project(l.getSouthWest(),k),_e=this.project(l.getNorthEast(),k),ke=this.unproject(te.add(_e).divideBy(2).add(N),k);return{center:ke,zoom:k}},fitBounds:function(l,h){if(l=ot(l),!l.isValid())throw new Error("Bounds are not valid.");var x=this._getBoundsCenterZoom(l,h);return this.setView(x.center,x.zoom,h)},fitWorld:function(l){return this.fitBounds([[-90,-180],[90,180]],l)},panTo:function(l,h){return this.setView(l,this._zoom,{pan:h})},panBy:function(l,h){if(l=Ve(l).round(),h=h||{},!l.x&&!l.y)return this.fire("moveend");if(h.animate!==!0&&!this.getSize().contains(l))return this._resetView(this.unproject(this.project(this.getCenter()).add(l)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new es,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),h.noMoveStart||this.fire("movestart"),h.animate!==!1){Me(this._mapPane,"leaflet-pan-anim");var x=this._getMapPanePos().subtract(l).round();this._panAnim.run(this._mapPane,x,h.duration||.25,h.easeLinearity)}else this._rawPanBy(l),this.fire("move").fire("moveend");return this},flyTo:function(l,h,x){if(x=x||{},x.animate===!1||!ye.any3d)return this.setView(l,h,x);this._stop();var E=this.project(this.getCenter()),k=this.project(l),N=this.getSize(),te=this._zoom;l=be(l),h=h===void 0?te:h;var _e=Math.max(N.x,N.y),ke=_e*this.getZoomScale(te,h),xt=k.distanceTo(E)||1,xi=1.42,en=xi*xi;function Ei(Bs){var cd=Bs?-1:1,Gb=Bs?ke:_e,Kb=ke*ke-_e*_e+cd*en*en*xt*xt,Zb=2*Gb*en*xt,Xb=Kb/Zb,kS=Math.sqrt(Xb*Xb+1)-Xb,GF=kS<1e-9?-18:Math.log(kS);return GF}function mn(Bs){return(Math.exp(Bs)-Math.exp(-Bs))/2}function Nn(Bs){return(Math.exp(Bs)+Math.exp(-Bs))/2}function Es(Bs){return mn(Bs)/Nn(Bs)}var Hs=Ei(0);function $r(Bs){return _e*(Nn(Hs)/Nn(Hs+xi*Bs))}function jb(Bs){return _e*(Nn(Hs)*Es(Hs+xi*Bs)-mn(Hs))/en}function $b(Bs){return 1-Math.pow(1-Bs,1.5)}var Ub=Date.now(),gx=(Ei(1)-Hs)/xi,qb=x.duration?1e3*x.duration:1e3*gx*.8;function mh(){var Bs=(Date.now()-Ub)/qb,cd=$b(Bs)*gx;Bs<=1?(this._flyToFrame=X(mh,this),this._move(this.unproject(E.add(k.subtract(E).multiplyBy(jb(cd)/xt)),te),this.getScaleZoom(_e/$r(cd),te),{flyTo:!0})):this._move(l,h)._moveEnd(!0)}return this._moveStart(!0,x.noMoveStart),mh.call(this),this},flyToBounds:function(l,h){var x=this._getBoundsCenterZoom(l,h);return this.flyTo(x.center,x.zoom,h)},setMaxBounds:function(l){return l=ot(l),this.listens("moveend",this._panInsideMaxBounds)&&this.off("moveend",this._panInsideMaxBounds),l.isValid()?(this.options.maxBounds=l,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},setMinZoom:function(l){var h=this.options.minZoom;return this.options.minZoom=l,this._loaded&&h!==l&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(l):this},setMaxZoom:function(l){var h=this.options.maxZoom;return this.options.maxZoom=l,this._loaded&&h!==l&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(l):this},panInsideBounds:function(l,h){this._enforcingBounds=!0;var x=this.getCenter(),E=this._limitCenter(x,this._zoom,ot(l));return x.equals(E)||this.panTo(E,h),this._enforcingBounds=!1,this},panInside:function(l,h){h=h||{};var x=Ve(h.paddingTopLeft||h.padding||[0,0]),E=Ve(h.paddingBottomRight||h.padding||[0,0]),k=this.project(this.getCenter()),N=this.project(l),te=this.getPixelBounds(),_e=mt([te.min.add(x),te.max.subtract(E)]),ke=_e.getSize();if(!_e.contains(N)){this._enforcingBounds=!0;var xt=N.subtract(_e.getCenter()),xi=_e.extend(N).getSize().subtract(ke);k.x+=xt.x<0?-xi.x:xi.x,k.y+=xt.y<0?-xi.y:xi.y,this.panTo(this.unproject(k),h),this._enforcingBounds=!1}return this},invalidateSize:function(l){if(!this._loaded)return this;l=n({animate:!1,pan:!0},l===!0?{animate:!0}:l);var h=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var x=this.getSize(),E=h.divideBy(2).round(),k=x.divideBy(2).round(),N=E.subtract(k);return!N.x&&!N.y?this:(l.animate&&l.pan?this.panBy(N):(l.pan&&this._rawPanBy(N),this.fire("move"),l.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(r(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:h,newSize:x}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(l){if(l=this._locateOptions=n({timeout:1e4,watch:!1},l),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var h=r(this._handleGeolocationResponse,this),x=r(this._handleGeolocationError,this);return l.watch?this._locationWatchId=navigator.geolocation.watchPosition(h,x,l):navigator.geolocation.getCurrentPosition(h,x,l),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(l){if(this._container._leaflet_id){var h=l.code,x=l.message||(h===1?"permission denied":h===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:h,message:"Geolocation error: "+x+"."})}},_handleGeolocationResponse:function(l){if(this._container._leaflet_id){var h=l.coords.latitude,x=l.coords.longitude,E=new yt(h,x),k=E.toBounds(l.coords.accuracy*2),N=this._locateOptions;if(N.setView){var te=this.getBoundsZoom(k);this.setView(E,N.maxZoom?Math.min(te,N.maxZoom):te)}var _e={latlng:E,bounds:k,timestamp:l.timestamp};for(var ke in l.coords)typeof l.coords[ke]=="number"&&(_e[ke]=l.coords[ke]);this.fire("locationfound",_e)}},addHandler:function(l,h){if(!h)return this;var x=this[l]=new h(this);return this._handlers.push(x),this.options[l]&&x.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),re(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(ce(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var l;for(l in this._layers)this._layers[l].remove();for(l in this._panes)re(this._panes[l]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(l,h){var x="leaflet-pane"+(l?" leaflet-"+l.replace("Pane","")+"-pane":""),E=se("div",x,h||this._mapPane);return l&&(this._panes[l]=E),E},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var l=this.getPixelBounds(),h=this.unproject(l.getBottomLeft()),x=this.unproject(l.getTopRight());return new Mt(h,x)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(l,h,x){l=ot(l),x=Ve(x||[0,0]);var E=this.getZoom()||0,k=this.getMinZoom(),N=this.getMaxZoom(),te=l.getNorthWest(),_e=l.getSouthEast(),ke=this.getSize().subtract(x),xt=mt(this.project(_e,E),this.project(te,E)).getSize(),xi=ye.any3d?this.options.zoomSnap:1,en=ke.x/xt.x,Ei=ke.y/xt.y,mn=h?Math.max(en,Ei):Math.min(en,Ei);return E=this.getScaleZoom(mn,E),xi&&(E=Math.round(E/(xi/100))*(xi/100),E=h?Math.ceil(E/xi)*xi:Math.floor(E/xi)*xi),Math.max(k,Math.min(N,E))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new xe(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(l,h){var x=this._getTopLeftPoint(l,h);return new ve(x,x.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(l){return this.options.crs.getProjectedBounds(l===void 0?this.getZoom():l)},getPane:function(l){return typeof l=="string"?this._panes[l]:l},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(l,h){var x=this.options.crs;return h=h===void 0?this._zoom:h,x.scale(l)/x.scale(h)},getScaleZoom:function(l,h){var x=this.options.crs;h=h===void 0?this._zoom:h;var E=x.zoom(l*x.scale(h));return isNaN(E)?1/0:E},project:function(l,h){return h=h===void 0?this._zoom:h,this.options.crs.latLngToPoint(be(l),h)},unproject:function(l,h){return h=h===void 0?this._zoom:h,this.options.crs.pointToLatLng(Ve(l),h)},layerPointToLatLng:function(l){var h=Ve(l).add(this.getPixelOrigin());return this.unproject(h)},latLngToLayerPoint:function(l){var h=this.project(be(l))._round();return h._subtract(this.getPixelOrigin())},wrapLatLng:function(l){return this.options.crs.wrapLatLng(be(l))},wrapLatLngBounds:function(l){return this.options.crs.wrapLatLngBounds(ot(l))},distance:function(l,h){return this.options.crs.distance(be(l),be(h))},containerPointToLayerPoint:function(l){return Ve(l).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(l){return Ve(l).add(this._getMapPanePos())},containerPointToLatLng:function(l){var h=this.containerPointToLayerPoint(Ve(l));return this.layerPointToLatLng(h)},latLngToContainerPoint:function(l){return this.layerPointToContainerPoint(this.latLngToLayerPoint(be(l)))},mouseEventToContainerPoint:function(l){return Ln(l,this._container)},mouseEventToLayerPoint:function(l){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(l))},mouseEventToLatLng:function(l){return this.layerPointToLatLng(this.mouseEventToLayerPoint(l))},_initContainer:function(l){var h=this._container=ee(l);if(h){if(h._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");bt(h,"scroll",this._onScroll,this),this._containerId=d(h)},_initLayout:function(){var l=this._container;this._fadeAnimated=this.options.fadeAnimation&&ye.any3d,Me(l,"leaflet-container"+(ye.touch?" leaflet-touch":"")+(ye.retina?" leaflet-retina":"")+(ye.ielt9?" leaflet-oldie":"")+(ye.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var h=ne(l,"position");h!=="absolute"&&h!=="relative"&&h!=="fixed"&&h!=="sticky"&&(l.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var l=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Oe(this._mapPane,new xe(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(Me(l.markerPane,"leaflet-zoom-hide"),Me(l.shadowPane,"leaflet-zoom-hide"))},_resetView:function(l,h,x){Oe(this._mapPane,new xe(0,0));var E=!this._loaded;this._loaded=!0,h=this._limitZoom(h),this.fire("viewprereset");var k=this._zoom!==h;this._moveStart(k,x)._move(l,h)._moveEnd(k),this.fire("viewreset"),E&&this.fire("load")},_moveStart:function(l,h){return l&&this.fire("zoomstart"),h||this.fire("movestart"),this},_move:function(l,h,x,E){h===void 0&&(h=this._zoom);var k=this._zoom!==h;return this._zoom=h,this._lastCenter=l,this._pixelOrigin=this._getNewPixelOrigin(l),E?x&&x.pinch&&this.fire("zoom",x):((k||x&&x.pinch)&&this.fire("zoom",x),this.fire("move",x)),this},_moveEnd:function(l){return l&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return ce(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(l){Oe(this._mapPane,this._getMapPanePos().subtract(l))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(l){this._targets={},this._targets[d(this._container)]=this;var h=l?Di:bt;h(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&h(window,"resize",this._onResize,this),ye.any3d&&this.options.transform3DLimit&&(l?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){ce(this._resizeRequest),this._resizeRequest=X(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var l=this._getMapPanePos();Math.max(Math.abs(l.x),Math.abs(l.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(l,h){for(var x=[],E,k=h==="mouseout"||h==="mouseover",N=l.target||l.srcElement,te=!1;N;){if(E=this._targets[d(N)],E&&(h==="click"||h==="preclick")&&this._draggableMoved(E)){te=!0;break}if(E&&E.listens(h,!0)&&(k&&!Jn(N,l)||(x.push(E),k))||N===this._container)break;N=N.parentNode}return!x.length&&!te&&!k&&this.listens(h,!0)&&(x=[this]),x},_isClickDisabled:function(l){for(;l&&l!==this._container;){if(l._leaflet_disable_click)return!0;l=l.parentNode}},_handleDOMEvent:function(l){var h=l.target||l.srcElement;if(!(!this._loaded||h._leaflet_disable_events||l.type==="click"&&this._isClickDisabled(h))){var x=l.type;x==="mousedown"&&et(h),this._fireDOMEvent(l,x)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(l,h,x){if(l.type==="click"){var E=n({},l);E.type="preclick",this._fireDOMEvent(E,E.type,x)}var k=this._findEventTargets(l,h);if(x){for(var N=[],te=0;te<x.length;te++)x[te].listens(h,!0)&&N.push(x[te]);k=N.concat(k)}if(k.length){h==="contextmenu"&&hi(l);var _e=k[0],ke={originalEvent:l};if(l.type!=="keypress"&&l.type!=="keydown"&&l.type!=="keyup"){var xt=_e.getLatLng&&(!_e._radius||_e._radius<=10);ke.containerPoint=xt?this.latLngToContainerPoint(_e.getLatLng()):this.mouseEventToContainerPoint(l),ke.layerPoint=this.containerPointToLayerPoint(ke.containerPoint),ke.latlng=xt?_e.getLatLng():this.layerPointToLatLng(ke.layerPoint)}for(te=0;te<k.length;te++)if(k[te].fire(h,ke,!0),ke.originalEvent._stopped||k[te].options.bubblingMouseEvents===!1&&R(this._mouseEvents,h)!==-1)return}},_draggableMoved:function(l){return l=l.dragging&&l.dragging.enabled()?l:this,l.dragging&&l.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var l=0,h=this._handlers.length;l<h;l++)this._handlers[l].disable()},whenReady:function(l,h){return this._loaded?l.call(h||this,{target:this}):this.on("load",l,h),this},_getMapPanePos:function(){return St(this._mapPane)||new xe(0,0)},_moved:function(){var l=this._getMapPanePos();return l&&!l.equals([0,0])},_getTopLeftPoint:function(l,h){var x=l&&h!==void 0?this._getNewPixelOrigin(l,h):this.getPixelOrigin();return x.subtract(this._getMapPanePos())},_getNewPixelOrigin:function(l,h){var x=this.getSize()._divideBy(2);return this.project(l,h)._subtract(x)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(l,h,x){var E=this._getNewPixelOrigin(x,h);return this.project(l,h)._subtract(E)},_latLngBoundsToNewLayerBounds:function(l,h,x){var E=this._getNewPixelOrigin(x,h);return mt([this.project(l.getSouthWest(),h)._subtract(E),this.project(l.getNorthWest(),h)._subtract(E),this.project(l.getSouthEast(),h)._subtract(E),this.project(l.getNorthEast(),h)._subtract(E)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(l){return this.latLngToLayerPoint(l).subtract(this._getCenterLayerPoint())},_limitCenter:function(l,h,x){if(!x)return l;var E=this.project(l,h),k=this.getSize().divideBy(2),N=new ve(E.subtract(k),E.add(k)),te=this._getBoundsOffset(N,x,h);return Math.abs(te.x)<=1&&Math.abs(te.y)<=1?l:this.unproject(E.add(te),h)},_limitOffset:function(l,h){if(!h)return l;var x=this.getPixelBounds(),E=new ve(x.min.add(l),x.max.add(l));return l.add(this._getBoundsOffset(E,h))},_getBoundsOffset:function(l,h,x){var E=mt(this.project(h.getNorthEast(),x),this.project(h.getSouthWest(),x)),k=E.min.subtract(l.min),N=E.max.subtract(l.max),te=this._rebound(k.x,-N.x),_e=this._rebound(k.y,-N.y);return new xe(te,_e)},_rebound:function(l,h){return l+h>0?Math.round(l-h)/2:Math.max(0,Math.ceil(l))-Math.max(0,Math.floor(h))},_limitZoom:function(l){var h=this.getMinZoom(),x=this.getMaxZoom(),E=ye.any3d?this.options.zoomSnap:1;return E&&(l=Math.round(l/E)*E),Math.max(h,Math.min(x,l))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){at(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(l,h){var x=this._getCenterOffset(l)._trunc();return(h&&h.animate)!==!0&&!this.getSize().contains(x)?!1:(this.panBy(x,h),!0)},_createAnimProxy:function(){var l=this._proxy=se("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(l),this.on("zoomanim",function(h){var x=U,E=this._proxy.style[x];we(this._proxy,this.project(h.center,h.zoom),this.getZoomScale(h.zoom,1)),E===this._proxy.style[x]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){re(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var l=this.getCenter(),h=this.getZoom();we(this._proxy,this.project(l,h),this.getZoomScale(h,1))},_catchTransitionEnd:function(l){this._animatingZoom&&l.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(l,h,x){if(this._animatingZoom)return!0;if(x=x||{},!this._zoomAnimated||x.animate===!1||this._nothingToAnimate()||Math.abs(h-this._zoom)>this.options.zoomAnimationThreshold)return!1;var E=this.getZoomScale(h),k=this._getCenterOffset(l)._divideBy(1-1/E);return x.animate!==!0&&!this.getSize().contains(k)?!1:(X(function(){this._moveStart(!0,x.noMoveStart||!1)._animateZoom(l,h,!0)},this),!0)},_animateZoom:function(l,h,x,E){this._mapPane&&(x&&(this._animatingZoom=!0,this._animateToCenter=l,this._animateToZoom=h,Me(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:l,zoom:h,noUpdate:E}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(r(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&at(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function Is(l,h){return new Zi(l,h)}var Tn=oe.extend({options:{position:"topright"},initialize:function(l){y(this,l)},getPosition:function(){return this.options.position},setPosition:function(l){var h=this._map;return h&&h.removeControl(this),this.options.position=l,h&&h.addControl(this),this},getContainer:function(){return this._container},addTo:function(l){this.remove(),this._map=l;var h=this._container=this.onAdd(l),x=this.getPosition(),E=l._controlCorners[x];return Me(h,"leaflet-control"),x.indexOf("bottom")!==-1?E.insertBefore(h,E.firstChild):E.appendChild(h),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(re(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(l){this._map&&l&&l.screenX>0&&l.screenY>0&&this._map.getContainer().focus()}}),Gn=function(l){return new Tn(l)};Zi.include({addControl:function(l){return l.addTo(this),this},removeControl:function(l){return l.remove(),this},_initControlPos:function(){var l=this._controlCorners={},h="leaflet-",x=this._controlContainer=se("div",h+"control-container",this._container);function E(k,N){var te=h+k+" "+h+N;l[k+N]=se("div",te,x)}E("top","left"),E("top","right"),E("bottom","left"),E("bottom","right")},_clearControlPos:function(){for(var l in this._controlCorners)re(this._controlCorners[l]);re(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var vs=Tn.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(l,h,x,E){return x<E?-1:E<x?1:0}},initialize:function(l,h,x){y(this,x),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1;for(var E in l)this._addLayer(l[E],E);for(E in h)this._addLayer(h[E],E,!0)},onAdd:function(l){this._initLayout(),this._update(),this._map=l,l.on("zoomend",this._checkDisabledLayers,this);for(var h=0;h<this._layers.length;h++)this._layers[h].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(l){return Tn.prototype.addTo.call(this,l),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var l=0;l<this._layers.length;l++)this._layers[l].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(l,h){return this._addLayer(l,h),this._map?this._update():this},addOverlay:function(l,h){return this._addLayer(l,h,!0),this._map?this._update():this},removeLayer:function(l){l.off("add remove",this._onLayerChange,this);var h=this._getLayer(d(l));return h&&this._layers.splice(this._layers.indexOf(h),1),this._map?this._update():this},expand:function(){Me(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var l=this._map.getSize().y-(this._container.offsetTop+50);return l<this._section.clientHeight?(Me(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=l+"px"):at(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return at(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var l="leaflet-control-layers",h=this._container=se("div",l),x=this.options.collapsed;h.setAttribute("aria-haspopup",!0),Zt(h),jt(h);var E=this._section=se("section",l+"-list");x&&(this._map.on("click",this.collapse,this),bt(h,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var k=this._layersLink=se("a",l+"-toggle",h);k.href="#",k.title="Layers",k.setAttribute("role","button"),bt(k,{keydown:function(N){N.keyCode===13&&this._expandSafely()},click:function(N){hi(N),this._expandSafely()}},this),x||this.expand(),this._baseLayersList=se("div",l+"-base",E),this._separator=se("div",l+"-separator",E),this._overlaysList=se("div",l+"-overlays",E),h.appendChild(E)},_getLayer:function(l){for(var h=0;h<this._layers.length;h++)if(this._layers[h]&&d(this._layers[h].layer)===l)return this._layers[h]},_addLayer:function(l,h,x){this._map&&l.on("add remove",this._onLayerChange,this),this._layers.push({layer:l,name:h,overlay:x}),this.options.sortLayers&&this._layers.sort(r(function(E,k){return this.options.sortFunction(E.layer,k.layer,E.name,k.name)},this)),this.options.autoZIndex&&l.setZIndex&&(this._lastZIndex++,l.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;Ie(this._baseLayersList),Ie(this._overlaysList),this._layerControlInputs=[];var l,h,x,E,k=0;for(x=0;x<this._layers.length;x++)E=this._layers[x],this._addItem(E),h=h||E.overlay,l=l||!E.overlay,k+=E.overlay?0:1;return this.options.hideSingleBase&&(l=l&&k>1,this._baseLayersList.style.display=l?"":"none"),this._separator.style.display=h&&l?"":"none",this},_onLayerChange:function(l){this._handlingClick||this._update();var h=this._getLayer(d(l.target)),x=h.overlay?l.type==="add"?"overlayadd":"overlayremove":l.type==="add"?"baselayerchange":null;x&&this._map.fire(x,h)},_createRadioElement:function(l,h){var x='<input type="radio" class="leaflet-control-layers-selector" name="'+l+'"'+(h?' checked="checked"':"")+"/>",E=document.createElement("div");return E.innerHTML=x,E.firstChild},_addItem:function(l){var h=document.createElement("label"),x=this._map.hasLayer(l.layer),E;l.overlay?(E=document.createElement("input"),E.type="checkbox",E.className="leaflet-control-layers-selector",E.defaultChecked=x):E=this._createRadioElement("leaflet-base-layers_"+d(this),x),this._layerControlInputs.push(E),E.layerId=d(l.layer),bt(E,"click",this._onInputClick,this);var k=document.createElement("span");k.innerHTML=" "+l.name;var N=document.createElement("span");h.appendChild(N),N.appendChild(E),N.appendChild(k);var te=l.overlay?this._overlaysList:this._baseLayersList;return te.appendChild(h),this._checkDisabledLayers(),h},_onInputClick:function(){if(!this._preventClick){var l=this._layerControlInputs,h,x,E=[],k=[];this._handlingClick=!0;for(var N=l.length-1;N>=0;N--)h=l[N],x=this._getLayer(h.layerId).layer,h.checked?E.push(x):h.checked||k.push(x);for(N=0;N<k.length;N++)this._map.hasLayer(k[N])&&this._map.removeLayer(k[N]);for(N=0;N<E.length;N++)this._map.hasLayer(E[N])||this._map.addLayer(E[N]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var l=this._layerControlInputs,h,x,E=this._map.getZoom(),k=l.length-1;k>=0;k--)h=l[k],x=this._getLayer(h.layerId).layer,h.disabled=x.options.minZoom!==void 0&&E<x.options.minZoom||x.options.maxZoom!==void 0&&E>x.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var l=this._section;this._preventClick=!0,bt(l,"click",hi),this.expand();var h=this;setTimeout(function(){Di(l,"click",hi),h._preventClick=!1})}}),ir=function(l,h,x){return new vs(l,h,x)},zr=Tn.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">&#x2212;</span>',zoomOutTitle:"Zoom out"},onAdd:function(l){var h="leaflet-control-zoom",x=se("div",h+" leaflet-bar"),E=this.options;return this._zoomInButton=this._createButton(E.zoomInText,E.zoomInTitle,h+"-in",x,this._zoomIn),this._zoomOutButton=this._createButton(E.zoomOutText,E.zoomOutTitle,h+"-out",x,this._zoomOut),this._updateDisabled(),l.on("zoomend zoomlevelschange",this._updateDisabled,this),x},onRemove:function(l){l.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(l){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(l.shiftKey?3:1))},_zoomOut:function(l){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(l.shiftKey?3:1))},_createButton:function(l,h,x,E,k){var N=se("a",x,E);return N.innerHTML=l,N.href="#",N.title=h,N.setAttribute("role","button"),N.setAttribute("aria-label",h),Zt(N),bt(N,"click",nn),bt(N,"click",k,this),bt(N,"click",this._refocusOnMap,this),N},_updateDisabled:function(){var l=this._map,h="leaflet-disabled";at(this._zoomInButton,h),at(this._zoomOutButton,h),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||l._zoom===l.getMinZoom())&&(Me(this._zoomOutButton,h),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||l._zoom===l.getMaxZoom())&&(Me(this._zoomInButton,h),this._zoomInButton.setAttribute("aria-disabled","true"))}});Zi.mergeOptions({zoomControl:!0}),Zi.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new zr,this.addControl(this.zoomControl))});var Xa=function(l){return new zr(l)},zl=Tn.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(l){var h="leaflet-control-scale",x=se("div",h),E=this.options;return this._addScales(E,h+"-line",x),l.on(E.updateWhenIdle?"moveend":"move",this._update,this),l.whenReady(this._update,this),x},onRemove:function(l){l.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(l,h,x){l.metric&&(this._mScale=se("div",h,x)),l.imperial&&(this._iScale=se("div",h,x))},_update:function(){var l=this._map,h=l.getSize().y/2,x=l.distance(l.containerPointToLatLng([0,h]),l.containerPointToLatLng([this.options.maxWidth,h]));this._updateScales(x)},_updateScales:function(l){this.options.metric&&l&&this._updateMetric(l),this.options.imperial&&l&&this._updateImperial(l)},_updateMetric:function(l){var h=this._getRoundNum(l),x=h<1e3?h+" m":h/1e3+" km";this._updateScale(this._mScale,x,h/l)},_updateImperial:function(l){var h=l*3.2808399,x,E,k;h>5280?(x=h/5280,E=this._getRoundNum(x),this._updateScale(this._iScale,E+" mi",E/x)):(k=this._getRoundNum(h),this._updateScale(this._iScale,k+" ft",k/h))},_updateScale:function(l,h,x){l.style.width=Math.round(this.options.maxWidth*x)+"px",l.innerHTML=h},_getRoundNum:function(l){var h=Math.pow(10,(Math.floor(l)+"").length-1),x=l/h;return x=x>=10?10:x>=5?5:x>=3?3:x>=2?2:1,h*x}}),pr=function(l){return new zl(l)},Vr='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8" class="leaflet-attribution-flag"><path fill="#4C7BE1" d="M0 0h12v4H0z"/><path fill="#FFD500" d="M0 4h12v3H0z"/><path fill="#E0BC00" d="M0 7h12v1H0z"/></svg>',Qc=Tn.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(ye.inlineSvg?Vr+" ":"")+"Leaflet</a>"},initialize:function(l){y(this,l),this._attributions={}},onAdd:function(l){l.attributionControl=this,this._container=se("div","leaflet-control-attribution"),Zt(this._container);for(var h in l._layers)l._layers[h].getAttribution&&this.addAttribution(l._layers[h].getAttribution());return this._update(),l.on("layeradd",this._addAttribution,this),this._container},onRemove:function(l){l.off("layeradd",this._addAttribution,this)},_addAttribution:function(l){l.layer.getAttribution&&(this.addAttribution(l.layer.getAttribution()),l.layer.once("remove",function(){this.removeAttribution(l.layer.getAttribution())},this))},setPrefix:function(l){return this.options.prefix=l,this._update(),this},addAttribution:function(l){return l?(this._attributions[l]||(this._attributions[l]=0),this._attributions[l]++,this._update(),this):this},removeAttribution:function(l){return l?(this._attributions[l]&&(this._attributions[l]--,this._update()),this):this},_update:function(){if(this._map){var l=[];for(var h in this._attributions)this._attributions[h]&&l.push(h);var x=[];this.options.prefix&&x.push(this.options.prefix),l.length&&x.push(l.join(", ")),this._container.innerHTML=x.join(' <span aria-hidden="true">|</span> ')}}});Zi.mergeOptions({attributionControl:!0}),Zi.addInitHook(function(){this.options.attributionControl&&new Qc().addTo(this)});var Ps=function(l){return new Qc(l)};Tn.Layers=vs,Tn.Zoom=zr,Tn.Scale=zl,Tn.Attribution=Qc,Gn.layers=ir,Gn.zoom=Xa,Gn.scale=pr,Gn.attribution=Ps;var ao=oe.extend({initialize:function(l){this._map=l},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});ao.addTo=function(l,h){return l.addHandler(h,this),this};var ah={Events:Ae},Vl=ye.touch?"touchstart mousedown":"mousedown",nr=Te.extend({options:{clickTolerance:3},initialize:function(l,h,x,E){y(this,E),this._element=l,this._dragStartTarget=h||l,this._preventOutline=x},enable:function(){this._enabled||(bt(this._dragStartTarget,Vl,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(nr._dragging===this&&this.finishDrag(!0),Di(this._dragStartTarget,Vl,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(l){if(this._enabled&&(this._moved=!1,!Pe(this._element,"leaflet-zoom-anim"))){if(l.touches&&l.touches.length!==1){nr._dragging===this&&this.finishDrag();return}if(!(nr._dragging||l.shiftKey||l.which!==1&&l.button!==1&&!l.touches)&&(nr._dragging=this,this._preventOutline&&et(this._element),Fe(),ut(),!this._moving)){this.fire("down");var h=l.touches?l.touches[0]:l,x=$e(this._element);this._startPoint=new xe(h.clientX,h.clientY),this._startPos=St(this._element),this._parentScale=_t(x);var E=l.type==="mousedown";bt(document,E?"mousemove":"touchmove",this._onMove,this),bt(document,E?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(l){if(this._enabled){if(l.touches&&l.touches.length>1){this._moved=!0;return}var h=l.touches&&l.touches.length===1?l.touches[0]:l,x=new xe(h.clientX,h.clientY)._subtract(this._startPoint);!x.x&&!x.y||Math.abs(x.x)+Math.abs(x.y)<this.options.clickTolerance||(x.x/=this._parentScale.x,x.y/=this._parentScale.y,hi(l),this._moved||(this.fire("dragstart"),this._moved=!0,Me(document.body,"leaflet-dragging"),this._lastTarget=l.target||l.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),Me(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(x),this._moving=!0,this._lastEvent=l,this._updatePosition())}},_updatePosition:function(){var l={originalEvent:this._lastEvent};this.fire("predrag",l),Oe(this._element,this._newPos),this.fire("drag",l)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(l){at(document.body,"leaflet-dragging"),this._lastTarget&&(at(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),Di(document,"mousemove touchmove",this._onMove,this),Di(document,"mouseup touchend touchcancel",this._onUp,this),Je(),nt();var h=this._moved&&this._moving;this._moving=!1,nr._dragging=!1,h&&this.fire("dragend",{noInertia:l,distance:this._newPos.distanceTo(this._startPos)})}});function Jc(l,h,x){var E,k=[1,4,2,8],N,te,_e,ke,xt,xi,en,Ei;for(N=0,xi=l.length;N<xi;N++)l[N]._code=Qa(l[N],h);for(_e=0;_e<4;_e++){for(en=k[_e],E=[],N=0,xi=l.length,te=xi-1;N<xi;te=N++)ke=l[N],xt=l[te],ke._code&en?xt._code&en||(Ei=Ul(xt,ke,en,h,x),Ei._code=Qa(Ei,h),E.push(Ei)):(xt._code&en&&(Ei=Ul(xt,ke,en,h,x),Ei._code=Qa(Ei,h),E.push(Ei)),E.push(ke));l=E}return l}function jl(l,h){var x,E,k,N,te,_e,ke,xt,xi;if(!l||l.length===0)throw new Error("latlngs not passed");Bo(l)||(console.warn("latlngs are not flat! Only the first ring will be used"),l=l[0]);var en=be([0,0]),Ei=ot(l),mn=Ei.getNorthWest().distanceTo(Ei.getSouthWest())*Ei.getNorthEast().distanceTo(Ei.getNorthWest());mn<1700&&(en=Ya(l));var Nn=l.length,Es=[];for(x=0;x<Nn;x++){var Hs=be(l[x]);Es.push(h.project(be([Hs.lat-en.lat,Hs.lng-en.lng])))}for(_e=ke=xt=0,x=0,E=Nn-1;x<Nn;E=x++)k=Es[x],N=Es[E],te=k.y*N.x-N.y*k.x,ke+=(k.x+N.x)*te,xt+=(k.y+N.y)*te,_e+=te*3;_e===0?xi=Es[0]:xi=[ke/_e,xt/_e];var $r=h.unproject(Ve(xi));return be([$r.lat+en.lat,$r.lng+en.lng])}function Ya(l){for(var h=0,x=0,E=0,k=0;k<l.length;k++){var N=be(l[k]);h+=N.lat,x+=N.lng,E++}return be([h/E,x/E])}var Cf={__proto__:null,clipPolygon:Jc,polygonCenter:jl,centroid:Ya};function ed(l,h){if(!h||!l.length)return l.slice();var x=h*h;return l=pa(l,x),l=id(l,x),l}function lh(l,h,x){return Math.sqrt(nd(l,h,x,!0))}function td(l,h,x){return nd(l,h,x)}function id(l,h){var x=l.length,E=typeof Uint8Array<"u"?Uint8Array:Array,k=new E(x);k[0]=k[x-1]=1,$l(l,k,h,0,x-1);var N,te=[];for(N=0;N<x;N++)k[N]&&te.push(l[N]);return te}function $l(l,h,x,E,k){var N=0,te,_e,ke;for(_e=E+1;_e<=k-1;_e++)ke=nd(l[_e],l[E],l[k],!0),ke>N&&(te=_e,N=ke);N>x&&(h[te]=1,$l(l,h,x,E,te),$l(l,h,x,te,k))}function pa(l,h){for(var x=[l[0]],E=1,k=0,N=l.length;E<N;E++)tx(l[E],l[k])>h&&(x.push(l[E]),k=E);return k<N-1&&x.push(l[N-1]),x}var Ef;function yf(l,h,x,E,k){var N=E?Ef:Qa(l,x),te=Qa(h,x),_e,ke,xt;for(Ef=te;;){if(!(N|te))return[l,h];if(N&te)return!1;_e=N||te,ke=Ul(l,h,_e,x,k),xt=Qa(ke,x),_e===N?(l=ke,N=xt):(h=ke,te=xt)}}function Ul(l,h,x,E,k){var N=h.x-l.x,te=h.y-l.y,_e=E.min,ke=E.max,xt,xi;return x&8?(xt=l.x+N*(ke.y-l.y)/te,xi=ke.y):x&4?(xt=l.x+N*(_e.y-l.y)/te,xi=_e.y):x&2?(xt=ke.x,xi=l.y+te*(ke.x-l.x)/N):x&1&&(xt=_e.x,xi=l.y+te*(_e.x-l.x)/N),new xe(xt,xi,k)}function Qa(l,h){var x=0;return l.x<h.min.x?x|=1:l.x>h.max.x&&(x|=2),l.y<h.min.y?x|=4:l.y>h.max.y&&(x|=8),x}function tx(l,h){var x=h.x-l.x,E=h.y-l.y;return x*x+E*E}function nd(l,h,x,E){var k=h.x,N=h.y,te=x.x-k,_e=x.y-N,ke=te*te+_e*_e,xt;return ke>0&&(xt=((l.x-k)*te+(l.y-N)*_e)/ke,xt>1?(k=x.x,N=x.y):xt>0&&(k+=te*xt,N+=_e*xt)),te=l.x-k,_e=l.y-N,E?te*te+_e*_e:new xe(k,N)}function Bo(l){return!T(l[0])||typeof l[0][0]!="object"&&typeof l[0][0]<"u"}function ix(l){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Bo(l)}function wf(l,h){var x,E,k,N,te,_e,ke,xt;if(!l||l.length===0)throw new Error("latlngs not passed");Bo(l)||(console.warn("latlngs are not flat! Only the first ring will be used"),l=l[0]);var xi=be([0,0]),en=ot(l),Ei=en.getNorthWest().distanceTo(en.getSouthWest())*en.getNorthEast().distanceTo(en.getNorthWest());Ei<1700&&(xi=Ya(l));var mn=l.length,Nn=[];for(x=0;x<mn;x++){var Es=be(l[x]);Nn.push(h.project(be([Es.lat-xi.lat,Es.lng-xi.lng])))}for(x=0,E=0;x<mn-1;x++)E+=Nn[x].distanceTo(Nn[x+1])/2;if(E===0)xt=Nn[0];else for(x=0,N=0;x<mn-1;x++)if(te=Nn[x],_e=Nn[x+1],k=te.distanceTo(_e),N+=k,N>E){ke=(N-E)/k,xt=[_e.x-ke*(_e.x-te.x),_e.y-ke*(_e.y-te.y)];break}var Hs=h.unproject(Ve(xt));return be([Hs.lat+xi.lat,Hs.lng+xi.lng])}var sd={__proto__:null,simplify:ed,pointToSegmentDistance:lh,closestPointOnSegment:td,clipSegment:yf,_getEdgeIntersection:Ul,_getBitCode:Qa,_sqClosestPointOnSegment:nd,isFlat:Bo,_flat:ix,polylineCenter:wf},Sf={project:function(l){return new xe(l.lng,l.lat)},unproject:function(l){return new yt(l.y,l.x)},bounds:new ve([-180,-90],[180,90])},Df={R:6378137,R_MINOR:6356752314245179e-9,bounds:new ve([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(l){var h=Math.PI/180,x=this.R,E=l.lat*h,k=this.R_MINOR/x,N=Math.sqrt(1-k*k),te=N*Math.sin(E),_e=Math.tan(Math.PI/4-E/2)/Math.pow((1-te)/(1+te),N/2);return E=-x*Math.log(Math.max(_e,1e-10)),new xe(l.lng*h*x,E)},unproject:function(l){for(var h=180/Math.PI,x=this.R,E=this.R_MINOR/x,k=Math.sqrt(1-E*E),N=Math.exp(-l.y/x),te=Math.PI/2-2*Math.atan(N),_e=0,ke=.1,xt;_e<15&&Math.abs(ke)>1e-7;_e++)xt=k*Math.sin(te),xt=Math.pow((1-xt)/(1+xt),k/2),ke=Math.PI/2-2*Math.atan(N*xt)-te,te+=ke;return new yt(te*h,l.x*h/x)}},Rb={__proto__:null,LonLat:Sf,Mercator:Df,SphericalMercator:tt},nx=n({},si,{code:"EPSG:3395",projection:Df,transformation:(function(){var l=.5/(Math.PI*Df.R);return Yt(l,.5,-l,.5)})()}),sx=n({},si,{code:"EPSG:4326",projection:Sf,transformation:Yt(1/180,1,-1/180,.5)}),ox=n({},Nt,{projection:Sf,transformation:Yt(1,0,-1,0),scale:function(l){return Math.pow(2,l)},zoom:function(l){return Math.log(l)/Math.LN2},distance:function(l,h){var x=h.lng-l.lng,E=h.lat-l.lat;return Math.sqrt(x*x+E*E)},infinite:!0});Nt.Earth=si,Nt.EPSG3395=nx,Nt.EPSG3857=fi,Nt.EPSG900913=oi,Nt.EPSG4326=sx,Nt.Simple=ox;var sr=Te.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(l){return l.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(l){return l&&l.removeLayer(this),this},getPane:function(l){return this._map.getPane(l?this.options[l]||l:this.options.pane)},addInteractiveTarget:function(l){return this._map._targets[d(l)]=this,this},removeInteractiveTarget:function(l){return delete this._map._targets[d(l)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(l){var h=l.target;if(h.hasLayer(this)){if(this._map=h,this._zoomAnimated=h._zoomAnimated,this.getEvents){var x=this.getEvents();h.on(x,this),this.once("remove",function(){h.off(x,this)},this)}this.onAdd(h),this.fire("add"),h.fire("layeradd",{layer:this})}}});Zi.include({addLayer:function(l){if(!l._layerAdd)throw new Error("The provided object is not a Layer.");var h=d(l);return this._layers[h]?this:(this._layers[h]=l,l._mapToAdd=this,l.beforeAdd&&l.beforeAdd(this),this.whenReady(l._layerAdd,l),this)},removeLayer:function(l){var h=d(l);return this._layers[h]?(this._loaded&&l.onRemove(this),delete this._layers[h],this._loaded&&(this.fire("layerremove",{layer:l}),l.fire("remove")),l._map=l._mapToAdd=null,this):this},hasLayer:function(l){return d(l)in this._layers},eachLayer:function(l,h){for(var x in this._layers)l.call(h,this._layers[x]);return this},_addLayers:function(l){l=l?T(l)?l:[l]:[];for(var h=0,x=l.length;h<x;h++)this.addLayer(l[h])},_addZoomLimit:function(l){(!isNaN(l.options.maxZoom)||!isNaN(l.options.minZoom))&&(this._zoomBoundLayers[d(l)]=l,this._updateZoomLevels())},_removeZoomLimit:function(l){var h=d(l);this._zoomBoundLayers[h]&&(delete this._zoomBoundLayers[h],this._updateZoomLevels())},_updateZoomLevels:function(){var l=1/0,h=-1/0,x=this._getZoomSpan();for(var E in this._zoomBoundLayers){var k=this._zoomBoundLayers[E].options;l=k.minZoom===void 0?l:Math.min(l,k.minZoom),h=k.maxZoom===void 0?h:Math.max(h,k.maxZoom)}this._layersMaxZoom=h===-1/0?void 0:h,this._layersMinZoom=l===1/0?void 0:l,x!==this._getZoomSpan()&&this.fire("zoomlevelschange"),this.options.maxZoom===void 0&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Ja=sr.extend({initialize:function(l,h){y(this,h),this._layers={};var x,E;if(l)for(x=0,E=l.length;x<E;x++)this.addLayer(l[x])},addLayer:function(l){var h=this.getLayerId(l);return this._layers[h]=l,this._map&&this._map.addLayer(l),this},removeLayer:function(l){var h=l in this._layers?l:this.getLayerId(l);return this._map&&this._layers[h]&&this._map.removeLayer(this._layers[h]),delete this._layers[h],this},hasLayer:function(l){var h=typeof l=="number"?l:this.getLayerId(l);return h in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(l){var h=Array.prototype.slice.call(arguments,1),x,E;for(x in this._layers)E=this._layers[x],E[l]&&E[l].apply(E,h);return this},onAdd:function(l){this.eachLayer(l.addLayer,l)},onRemove:function(l){this.eachLayer(l.removeLayer,l)},eachLayer:function(l,h){for(var x in this._layers)l.call(h,this._layers[x]);return this},getLayer:function(l){return this._layers[l]},getLayers:function(){var l=[];return this.eachLayer(l.push,l),l},setZIndex:function(l){return this.invoke("setZIndex",l)},getLayerId:function(l){return d(l)}}),rx=function(l,h){return new Ja(l,h)},jr=Ja.extend({addLayer:function(l){return this.hasLayer(l)?this:(l.addEventParent(this),Ja.prototype.addLayer.call(this,l),this.fire("layeradd",{layer:l}))},removeLayer:function(l){return this.hasLayer(l)?(l in this._layers&&(l=this._layers[l]),l.removeEventParent(this),Ja.prototype.removeLayer.call(this,l),this.fire("layerremove",{layer:l})):this},setStyle:function(l){return this.invoke("setStyle",l)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var l=new Mt;for(var h in this._layers){var x=this._layers[h];l.extend(x.getBounds?x.getBounds():x.getLatLng())}return l}}),ax=function(l,h){return new jr(l,h)},ql=oe.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(l){y(this,l)},createIcon:function(l){return this._createIcon("icon",l)},createShadow:function(l){return this._createIcon("shadow",l)},_createIcon:function(l,h){var x=this._getIconUrl(l);if(!x){if(l==="icon")throw new Error("iconUrl not set in Icon options (see the docs).");return null}var E=this._createImg(x,h&&h.tagName==="IMG"?h:null);return this._setIconStyles(E,l),(this.options.crossOrigin||this.options.crossOrigin==="")&&(E.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),E},_setIconStyles:function(l,h){var x=this.options,E=x[h+"Size"];typeof E=="number"&&(E=[E,E]);var k=Ve(E),N=Ve(h==="shadow"&&x.shadowAnchor||x.iconAnchor||k&&k.divideBy(2,!0));l.className="leaflet-marker-"+h+" "+(x.className||""),N&&(l.style.marginLeft=-N.x+"px",l.style.marginTop=-N.y+"px"),k&&(l.style.width=k.x+"px",l.style.height=k.y+"px")},_createImg:function(l,h){return h=h||document.createElement("img"),h.src=l,h},_getIconUrl:function(l){return ye.retina&&this.options[l+"RetinaUrl"]||this.options[l+"Url"]}});function lx(l){return new ql(l)}var Gl=ql.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(l){return typeof Gl.imagePath!="string"&&(Gl.imagePath=this._detectIconPath()),(this.options.imagePath||Gl.imagePath)+ql.prototype._getIconUrl.call(this,l)},_stripUrl:function(l){var h=function(x,E,k){var N=E.exec(x);return N&&N[k]};return l=h(l,/^url\((['"])?(.+)\1\)$/,2),l&&h(l,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var l=se("div","leaflet-default-icon-path",document.body),h=ne(l,"background-image")||ne(l,"backgroundImage");if(document.body.removeChild(l),h=this._stripUrl(h),h)return h;var x=document.querySelector('link[href$="leaflet.css"]');return x?x.href.substring(0,x.href.length-11-1):""}}),od=ao.extend({initialize:function(l){this._marker=l},addHooks:function(){var l=this._marker._icon;this._draggable||(this._draggable=new nr(l,l,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),Me(l,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&at(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(l){var h=this._marker,x=h._map,E=this._marker.options.autoPanSpeed,k=this._marker.options.autoPanPadding,N=St(h._icon),te=x.getPixelBounds(),_e=x.getPixelOrigin(),ke=mt(te.min._subtract(_e).add(k),te.max._subtract(_e).subtract(k));if(!ke.contains(N)){var xt=Ve((Math.max(ke.max.x,N.x)-ke.max.x)/(te.max.x-ke.max.x)-(Math.min(ke.min.x,N.x)-ke.min.x)/(te.min.x-ke.min.x),(Math.max(ke.max.y,N.y)-ke.max.y)/(te.max.y-ke.max.y)-(Math.min(ke.min.y,N.y)-ke.min.y)/(te.min.y-ke.min.y)).multiplyBy(E);x.panBy(xt,{animate:!1}),this._draggable._newPos._add(xt),this._draggable._startPos._add(xt),Oe(h._icon,this._draggable._newPos),this._onDrag(l),this._panRequest=X(this._adjustPan.bind(this,l))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire("movestart").fire("dragstart")},_onPreDrag:function(l){this._marker.options.autoPan&&(ce(this._panRequest),this._panRequest=X(this._adjustPan.bind(this,l)))},_onDrag:function(l){var h=this._marker,x=h._shadow,E=St(h._icon),k=h._map.layerPointToLatLng(E);x&&Oe(x,E),h._latlng=k,l.latlng=k,l.oldLatLng=this._oldLatLng,h.fire("move",l).fire("drag",l)},_onDragEnd:function(l){ce(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",l)}}),ch=sr.extend({options:{icon:new Gl,interactive:!0,keyboard:!0,title:"",alt:"Marker",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,autoPanOnFocus:!0,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(l,h){y(this,h),this._latlng=be(l)},onAdd:function(l){this._zoomAnimated=this._zoomAnimated&&l.options.markerZoomAnimation,this._zoomAnimated&&l.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(l){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&l.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(l){var h=this._latlng;return this._latlng=be(l),this.update(),this.fire("move",{oldLatLng:h,latlng:this._latlng})},setZIndexOffset:function(l){return this.options.zIndexOffset=l,this.update()},getIcon:function(){return this.options.icon},setIcon:function(l){return this.options.icon=l,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var l=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(l)}return this},_initIcon:function(){var l=this.options,h="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),x=l.icon.createIcon(this._icon),E=!1;x!==this._icon&&(this._icon&&this._removeIcon(),E=!0,l.title&&(x.title=l.title),x.tagName==="IMG"&&(x.alt=l.alt||"")),Me(x,h),l.keyboard&&(x.tabIndex="0",x.setAttribute("role","button")),this._icon=x,l.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&bt(x,"focus",this._panOnFocus,this);var k=l.icon.createShadow(this._shadow),N=!1;k!==this._shadow&&(this._removeShadow(),N=!0),k&&(Me(k,h),k.alt=""),this._shadow=k,l.opacity<1&&this._updateOpacity(),E&&this.getPane().appendChild(this._icon),this._initInteraction(),k&&N&&this.getPane(l.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Di(this._icon,"focus",this._panOnFocus,this),re(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&re(this._shadow),this._shadow=null},_setPos:function(l){this._icon&&Oe(this._icon,l),this._shadow&&Oe(this._shadow,l),this._zIndex=l.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(l){this._icon&&(this._icon.style.zIndex=this._zIndex+l)},_animateZoom:function(l){var h=this._map._latLngToNewLayerPoint(this._latlng,l.zoom,l.center).round();this._setPos(h)},_initInteraction:function(){if(this.options.interactive&&(Me(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),od)){var l=this.options.draggable;this.dragging&&(l=this.dragging.enabled(),this.dragging.disable()),this.dragging=new od(this),l&&this.dragging.enable()}},setOpacity:function(l){return this.options.opacity=l,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var l=this.options.opacity;this._icon&&de(this._icon,l),this._shadow&&de(this._shadow,l)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var l=this._map;if(l){var h=this.options.icon.options,x=h.iconSize?Ve(h.iconSize):Ve(0,0),E=h.iconAnchor?Ve(h.iconAnchor):Ve(0,0);l.panInside(this._latlng,{paddingTopLeft:E,paddingBottomRight:x.subtract(E)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function cx(l,h){return new ch(l,h)}var xa=sr.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(l){this._renderer=l.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(l){return y(this,l),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&l&&Object.prototype.hasOwnProperty.call(l,"weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+(this._renderer.options.tolerance||0)}}),dh=xa.extend({options:{fill:!0,radius:10},initialize:function(l,h){y(this,h),this._latlng=be(l),this._radius=this.options.radius},setLatLng:function(l){var h=this._latlng;return this._latlng=be(l),this.redraw(),this.fire("move",{oldLatLng:h,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(l){return this.options.radius=this._radius=l,this.redraw()},getRadius:function(){return this._radius},setStyle:function(l){var h=l&&l.radius||this._radius;return xa.prototype.setStyle.call(this,l),this.setRadius(h),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var l=this._radius,h=this._radiusY||l,x=this._clickTolerance(),E=[l+x,h+x];this._pxBounds=new ve(this._point.subtract(E),this._point.add(E))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(l){return l.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function dx(l,h){return new dh(l,h)}var Af=dh.extend({initialize:function(l,h,x){if(typeof h=="number"&&(h=n({},x,{radius:h})),y(this,h),this._latlng=be(l),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(l){return this._mRadius=l,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var l=[this._radius,this._radiusY||this._radius];return new Mt(this._map.layerPointToLatLng(this._point.subtract(l)),this._map.layerPointToLatLng(this._point.add(l)))},setStyle:xa.prototype.setStyle,_project:function(){var l=this._latlng.lng,h=this._latlng.lat,x=this._map,E=x.options.crs;if(E.distance===si.distance){var k=Math.PI/180,N=this._mRadius/si.R/k,te=x.project([h+N,l]),_e=x.project([h-N,l]),ke=te.add(_e).divideBy(2),xt=x.unproject(ke).lat,xi=Math.acos((Math.cos(N*k)-Math.sin(h*k)*Math.sin(xt*k))/(Math.cos(h*k)*Math.cos(xt*k)))/k;(isNaN(xi)||xi===0)&&(xi=N/Math.cos(Math.PI/180*h)),this._point=ke.subtract(x.getPixelOrigin()),this._radius=isNaN(xi)?0:ke.x-x.project([xt,l-xi]).x,this._radiusY=ke.y-te.y}else{var en=E.unproject(E.project(this._latlng).subtract([this._mRadius,0]));this._point=x.latLngToLayerPoint(this._latlng),this._radius=this._point.x-x.latLngToLayerPoint(en).x}this._updateBounds()}});function kf(l,h,x){return new Af(l,h,x)}var xr=xa.extend({options:{smoothFactor:1,noClip:!1},initialize:function(l,h){y(this,h),this._setLatLngs(l)},getLatLngs:function(){return this._latlngs},setLatLngs:function(l){return this._setLatLngs(l),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(l){for(var h=1/0,x=null,E=nd,k,N,te=0,_e=this._parts.length;te<_e;te++)for(var ke=this._parts[te],xt=1,xi=ke.length;xt<xi;xt++){k=ke[xt-1],N=ke[xt];var en=E(l,k,N,!0);en<h&&(h=en,x=E(l,k,N))}return x&&(x.distance=Math.sqrt(h)),x},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return wf(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(l,h){return h=h||this._defaultShape(),l=be(l),h.push(l),this._bounds.extend(l),this.redraw()},_setLatLngs:function(l){this._bounds=new Mt,this._latlngs=this._convertLatLngs(l)},_defaultShape:function(){return Bo(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(l){for(var h=[],x=Bo(l),E=0,k=l.length;E<k;E++)x?(h[E]=be(l[E]),this._bounds.extend(h[E])):h[E]=this._convertLatLngs(l[E]);return h},_project:function(){var l=new ve;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,l),this._bounds.isValid()&&l.isValid()&&(this._rawPxBounds=l,this._updateBounds())},_updateBounds:function(){var l=this._clickTolerance(),h=new xe(l,l);this._rawPxBounds&&(this._pxBounds=new ve([this._rawPxBounds.min.subtract(h),this._rawPxBounds.max.add(h)]))},_projectLatlngs:function(l,h,x){var E=l[0]instanceof yt,k=l.length,N,te;if(E){for(te=[],N=0;N<k;N++)te[N]=this._map.latLngToLayerPoint(l[N]),x.extend(te[N]);h.push(te)}else for(N=0;N<k;N++)this._projectLatlngs(l[N],h,x)},_clipPoints:function(){var l=this._renderer._bounds;if(this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(l))){if(this.options.noClip){this._parts=this._rings;return}var h=this._parts,x,E,k,N,te,_e,ke;for(x=0,k=0,N=this._rings.length;x<N;x++)for(ke=this._rings[x],E=0,te=ke.length;E<te-1;E++)_e=yf(ke[E],ke[E+1],l,E,!0),_e&&(h[k]=h[k]||[],h[k].push(_e[0]),(_e[1]!==ke[E+1]||E===te-2)&&(h[k].push(_e[1]),k++))}},_simplifyPoints:function(){for(var l=this._parts,h=this.options.smoothFactor,x=0,E=l.length;x<E;x++)l[x]=ed(l[x],h)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(l,h){var x,E,k,N,te,_e,ke=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(l))return!1;for(x=0,N=this._parts.length;x<N;x++)for(_e=this._parts[x],E=0,te=_e.length,k=te-1;E<te;k=E++)if(!(!h&&E===0)&&lh(l,_e[k],_e[E])<=ke)return!0;return!1}});function Nb(l,h){return new xr(l,h)}xr._flat=ix;var el=xr.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return jl(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(l){var h=xr.prototype._convertLatLngs.call(this,l),x=h.length;return x>=2&&h[0]instanceof yt&&h[0].equals(h[x-1])&&h.pop(),h},_setLatLngs:function(l){xr.prototype._setLatLngs.call(this,l),Bo(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Bo(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var l=this._renderer._bounds,h=this.options.weight,x=new xe(h,h);if(l=new ve(l.min.subtract(x),l.max.add(x)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(l))){if(this.options.noClip){this._parts=this._rings;return}for(var E=0,k=this._rings.length,N;E<k;E++)N=Jc(this._rings[E],l,!0),N.length&&this._parts.push(N)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(l){var h=!1,x,E,k,N,te,_e,ke,xt;if(!this._pxBounds||!this._pxBounds.contains(l))return!1;for(N=0,ke=this._parts.length;N<ke;N++)for(x=this._parts[N],te=0,xt=x.length,_e=xt-1;te<xt;_e=te++)E=x[te],k=x[_e],E.y>l.y!=k.y>l.y&&l.x<(k.x-E.x)*(l.y-E.y)/(k.y-E.y)+E.x&&(h=!h);return h||xr.prototype._containsPoint.call(this,l,!0)}});function ux(l,h){return new el(l,h)}var mr=jr.extend({initialize:function(l,h){y(this,h),this._layers={},l&&this.addData(l)},addData:function(l){var h=T(l)?l:l.features,x,E,k;if(h){for(x=0,E=h.length;x<E;x++)k=h[x],(k.geometries||k.geometry||k.features||k.coordinates)&&this.addData(k);return this}var N=this.options;if(N.filter&&!N.filter(l))return this;var te=rd(l,N);return te?(te.feature=ad(l),te.defaultOptions=te.options,this.resetStyle(te),N.onEachFeature&&N.onEachFeature(l,te),this.addLayer(te)):this},resetStyle:function(l){return l===void 0?this.eachLayer(this.resetStyle,this):(l.options=n({},l.defaultOptions),this._setLayerStyle(l,this.options.style),this)},setStyle:function(l){return this.eachLayer(function(h){this._setLayerStyle(h,l)},this)},_setLayerStyle:function(l,h){l.setStyle&&(typeof h=="function"&&(h=h(l.feature)),l.setStyle(h))}});function rd(l,h){var x=l.type==="Feature"?l.geometry:l,E=x?x.coordinates:null,k=[],N=h&&h.pointToLayer,te=h&&h.coordsToLatLng||uh,_e,ke,xt,xi;if(!E&&!x)return null;switch(x.type){case"Point":return _e=te(E),hx(N,l,_e,h);case"MultiPoint":for(xt=0,xi=E.length;xt<xi;xt++)_e=te(E[xt]),k.push(hx(N,l,_e,h));return new jr(k);case"LineString":case"MultiLineString":return ke=hh(E,x.type==="LineString"?0:1,te),new xr(ke,h);case"Polygon":case"MultiPolygon":return ke=hh(E,x.type==="Polygon"?1:2,te),new el(ke,h);case"GeometryCollection":for(xt=0,xi=x.geometries.length;xt<xi;xt++){var en=rd({geometry:x.geometries[xt],type:"Feature",properties:l.properties},h);en&&k.push(en)}return new jr(k);case"FeatureCollection":for(xt=0,xi=x.features.length;xt<xi;xt++){var Ei=rd(x.features[xt],h);Ei&&k.push(Ei)}return new jr(k);default:throw new Error("Invalid GeoJSON object.")}}function hx(l,h,x,E){return l?l(h,x):new ch(x,E&&E.markersInheritOptions&&E)}function uh(l){return new yt(l[1],l[0],l[2])}function hh(l,h,x){for(var E=[],k=0,N=l.length,te;k<N;k++)te=h?hh(l[k],h-1,x):(x||uh)(l[k]),E.push(te);return E}function Bf(l,h){return l=be(l),l.alt!==void 0?[p(l.lng,h),p(l.lat,h),p(l.alt,h)]:[p(l.lng,h),p(l.lat,h)]}function fh(l,h,x,E){for(var k=[],N=0,te=l.length;N<te;N++)k.push(h?fh(l[N],Bo(l[N])?0:h-1,x,E):Bf(l[N],E));return!h&&x&&k.length>0&&k.push(k[0].slice()),k}function ma(l,h){return l.feature?n({},l.feature,{geometry:h}):ad(h)}function ad(l){return l.type==="Feature"||l.type==="FeatureCollection"?l:{type:"Feature",properties:{},geometry:l}}var gh={toGeoJSON:function(l){return ma(this,{type:"Point",coordinates:Bf(this.getLatLng(),l)})}};ch.include(gh),Af.include(gh),dh.include(gh),xr.include({toGeoJSON:function(l){var h=!Bo(this._latlngs),x=fh(this._latlngs,h?1:0,!1,l);return ma(this,{type:(h?"Multi":"")+"LineString",coordinates:x})}}),el.include({toGeoJSON:function(l){var h=!Bo(this._latlngs),x=h&&!Bo(this._latlngs[0]),E=fh(this._latlngs,x?2:h?1:0,!0,l);return h||(E=[E]),ma(this,{type:(x?"Multi":"")+"Polygon",coordinates:E})}}),Ja.include({toMultiPoint:function(l){var h=[];return this.eachLayer(function(x){h.push(x.toGeoJSON(l).geometry.coordinates)}),ma(this,{type:"MultiPoint",coordinates:h})},toGeoJSON:function(l){var h=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(h==="MultiPoint")return this.toMultiPoint(l);var x=h==="GeometryCollection",E=[];return this.eachLayer(function(k){if(k.toGeoJSON){var N=k.toGeoJSON(l);if(x)E.push(N.geometry);else{var te=ad(N);te.type==="FeatureCollection"?E.push.apply(E,te.features):E.push(te)}}}),x?ma(this,{geometries:E,type:"GeometryCollection"}):{type:"FeatureCollection",features:E}}});function Ff(l,h){return new mr(l,h)}var Ob=Ff,ld=sr.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(l,h,x){this._url=l,this._bounds=ot(h),y(this,x)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(Me(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){re(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(l){return this.options.opacity=l,this._image&&this._updateOpacity(),this},setStyle:function(l){return l.opacity&&this.setOpacity(l.opacity),this},bringToFront:function(){return this._map&&We(this._image),this},bringToBack:function(){return this._map&&Ce(this._image),this},setUrl:function(l){return this._url=l,this._image&&(this._image.src=l),this},setBounds:function(l){return this._bounds=ot(l),this._map&&this._reset(),this},getEvents:function(){var l={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(l.zoomanim=this._animateZoom),l},setZIndex:function(l){return this.options.zIndex=l,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var l=this._url.tagName==="IMG",h=this._image=l?this._url:se("img");if(Me(h,"leaflet-image-layer"),this._zoomAnimated&&Me(h,"leaflet-zoom-animated"),this.options.className&&Me(h,this.options.className),h.onselectstart=g,h.onmousemove=g,h.onload=r(this.fire,this,"load"),h.onerror=r(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(h.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),l){this._url=h.src;return}h.src=this._url,h.alt=this.options.alt},_animateZoom:function(l){var h=this._map.getZoomScale(l.zoom),x=this._map._latLngBoundsToNewLayerBounds(this._bounds,l.zoom,l.center).min;we(this._image,x,h)},_reset:function(){var l=this._image,h=new ve(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),x=h.getSize();Oe(l,h.min),l.style.width=x.x+"px",l.style.height=x.y+"px"},_updateOpacity:function(){de(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var l=this.options.errorOverlayUrl;l&&this._url!==l&&(this._url=l,this._image.src=l)},getCenter:function(){return this._bounds.getCenter()}}),Lf=function(l,h,x){return new ld(l,h,x)},If=ld.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var l=this._url.tagName==="VIDEO",h=this._image=l?this._url:se("video");if(Me(h,"leaflet-image-layer"),this._zoomAnimated&&Me(h,"leaflet-zoom-animated"),this.options.className&&Me(h,this.options.className),h.onselectstart=g,h.onmousemove=g,h.onloadeddata=r(this.fire,this,"load"),l){for(var x=h.getElementsByTagName("source"),E=[],k=0;k<x.length;k++)E.push(x[k].src);this._url=x.length>0?E:[h.src];return}T(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(h.style,"objectFit")&&(h.style.objectFit="fill"),h.autoplay=!!this.options.autoplay,h.loop=!!this.options.loop,h.muted=!!this.options.muted,h.playsInline=!!this.options.playsInline;for(var N=0;N<this._url.length;N++){var te=se("source");te.src=this._url[N],h.appendChild(te)}}});function Hb(l,h,x){return new If(l,h,x)}var fx=ld.extend({_initImage:function(){var l=this._image=this._url;Me(l,"leaflet-image-layer"),this._zoomAnimated&&Me(l,"leaflet-zoom-animated"),this.options.className&&Me(l,this.options.className),l.onselectstart=g,l.onmousemove=g}});function Wb(l,h,x){return new fx(l,h,x)}var vr=sr.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(l,h){l&&(l instanceof yt||T(l))?(this._latlng=be(l),y(this,h)):(y(this,l),this._source=h),this.options.content&&(this._content=this.options.content)},openOn:function(l){return l=arguments.length?l:this._source._map,l.hasLayer(this)||l.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(l){return this._map?this.close():(arguments.length?this._source=l:l=this._source,this._prepareOpen(),this.openOn(l._map)),this},onAdd:function(l){this._zoomAnimated=l._zoomAnimated,this._container||this._initLayout(),l._fadeAnimated&&de(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),l._fadeAnimated&&de(this._container,1),this.bringToFront(),this.options.interactive&&(Me(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(l){l._fadeAnimated?(de(this._container,0),this._removeTimeout=setTimeout(r(re,void 0,this._container),200)):re(this._container),this.options.interactive&&(at(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(l){return this._latlng=be(l),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(l){return this._content=l,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var l={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(l.zoomanim=this._animateZoom),l},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&We(this._container),this},bringToBack:function(){return this._map&&Ce(this._container),this},_prepareOpen:function(l){var h=this._source;if(!h._map)return!1;if(h instanceof jr){h=null;var x=this._source._layers;for(var E in x)if(x[E]._map){h=x[E];break}if(!h)return!1;this._source=h}if(!l)if(h.getCenter)l=h.getCenter();else if(h.getLatLng)l=h.getLatLng();else if(h.getBounds)l=h.getBounds().getCenter();else throw new Error("Unable to get source layer LatLng.");return this.setLatLng(l),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var l=this._contentNode,h=typeof this._content=="function"?this._content(this._source||this):this._content;if(typeof h=="string")l.innerHTML=h;else{for(;l.hasChildNodes();)l.removeChild(l.firstChild);l.appendChild(h)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var l=this._map.latLngToLayerPoint(this._latlng),h=Ve(this.options.offset),x=this._getAnchor();this._zoomAnimated?Oe(this._container,l.add(x)):h=h.add(l).add(x);var E=this._containerBottom=-h.y,k=this._containerLeft=-Math.round(this._containerWidth/2)+h.x;this._container.style.bottom=E+"px",this._container.style.left=k+"px"}},_getAnchor:function(){return[0,0]}});Zi.include({_initOverlay:function(l,h,x,E){var k=h;return k instanceof l||(k=new l(E).setContent(h)),x&&k.setLatLng(x),k}}),sr.include({_initOverlay:function(l,h,x,E){var k=x;return k instanceof l?(y(k,E),k._source=this):(k=h&&!E?h:new l(E,this),k.setContent(x)),k}});var ph=vr.extend({options:{pane:"popupPane",offset:[0,7],maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(l){return l=arguments.length?l:this._source._map,!l.hasLayer(this)&&l._popup&&l._popup.options.autoClose&&l.removeLayer(l._popup),l._popup=this,vr.prototype.openOn.call(this,l)},onAdd:function(l){vr.prototype.onAdd.call(this,l),l.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof xa||this._source.on("preclick",Dt))},onRemove:function(l){vr.prototype.onRemove.call(this,l),l.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof xa||this._source.off("preclick",Dt))},getEvents:function(){var l=vr.prototype.getEvents.call(this);return(this.options.closeOnClick!==void 0?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(l.preclick=this.close),this.options.keepInView&&(l.moveend=this._adjustPan),l},_initLayout:function(){var l="leaflet-popup",h=this._container=se("div",l+" "+(this.options.className||"")+" leaflet-zoom-animated"),x=this._wrapper=se("div",l+"-content-wrapper",h);if(this._contentNode=se("div",l+"-content",x),Zt(h),jt(this._contentNode),bt(h,"contextmenu",Dt),this._tipContainer=se("div",l+"-tip-container",h),this._tip=se("div",l+"-tip",this._tipContainer),this.options.closeButton){var E=this._closeButton=se("a",l+"-close-button",h);E.setAttribute("role","button"),E.setAttribute("aria-label","Close popup"),E.href="#close",E.innerHTML='<span aria-hidden="true">&#215;</span>',bt(E,"click",function(k){hi(k),this.close()},this)}},_updateLayout:function(){var l=this._contentNode,h=l.style;h.width="",h.whiteSpace="nowrap";var x=l.offsetWidth;x=Math.min(x,this.options.maxWidth),x=Math.max(x,this.options.minWidth),h.width=x+1+"px",h.whiteSpace="",h.height="";var E=l.offsetHeight,k=this.options.maxHeight,N="leaflet-popup-scrolled";k&&E>k?(h.height=k+"px",Me(l,N)):at(l,N),this._containerWidth=this._container.offsetWidth},_animateZoom:function(l){var h=this._map._latLngToNewLayerPoint(this._latlng,l.zoom,l.center),x=this._getAnchor();Oe(this._container,h.add(x))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var l=this._map,h=parseInt(ne(this._container,"marginBottom"),10)||0,x=this._container.offsetHeight+h,E=this._containerWidth,k=new xe(this._containerLeft,-x-this._containerBottom);k._add(St(this._container));var N=l.layerPointToContainerPoint(k),te=Ve(this.options.autoPanPadding),_e=Ve(this.options.autoPanPaddingTopLeft||te),ke=Ve(this.options.autoPanPaddingBottomRight||te),xt=l.getSize(),xi=0,en=0;N.x+E+ke.x>xt.x&&(xi=N.x+E-xt.x+ke.x),N.x-xi-_e.x<0&&(xi=N.x-_e.x),N.y+x+ke.y>xt.y&&(en=N.y+x-xt.y+ke.y),N.y-en-_e.y<0&&(en=N.y-_e.y),(xi||en)&&(this.options.keepInView&&(this._autopanning=!0),l.fire("autopanstart").panBy([xi,en]))}},_getAnchor:function(){return Ve(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),zb=function(l,h){return new ph(l,h)};Zi.mergeOptions({closePopupOnClick:!0}),Zi.include({openPopup:function(l,h,x){return this._initOverlay(ph,l,h,x).openOn(this),this},closePopup:function(l){return l=arguments.length?l:this._popup,l&&l.close(),this}}),sr.include({bindPopup:function(l,h){return this._popup=this._initOverlay(ph,this._popup,l,h),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(l){return this._popup&&(this instanceof jr||(this._popup._source=this),this._popup._prepareOpen(l||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(l){return this._popup&&this._popup.setContent(l),this},getPopup:function(){return this._popup},_openPopup:function(l){if(!(!this._popup||!this._map)){nn(l);var h=l.layer||l.target;if(this._popup._source===h&&!(h instanceof xa)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(l.latlng);return}this._popup._source=h,this.openPopup(l.latlng)}},_movePopup:function(l){this._popup.setLatLng(l.latlng)},_onKeyPress:function(l){l.originalEvent.keyCode===13&&this._openPopup(l)}});var xh=vr.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(l){vr.prototype.onAdd.call(this,l),this.setOpacity(this.options.opacity),l.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(l){vr.prototype.onRemove.call(this,l),l.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var l=vr.prototype.getEvents.call(this);return this.options.permanent||(l.preclick=this.close),l},_initLayout:function(){var l="leaflet-tooltip",h=l+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=se("div",h),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+d(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(l){var h,x,E=this._map,k=this._container,N=E.latLngToContainerPoint(E.getCenter()),te=E.layerPointToContainerPoint(l),_e=this.options.direction,ke=k.offsetWidth,xt=k.offsetHeight,xi=Ve(this.options.offset),en=this._getAnchor();_e==="top"?(h=ke/2,x=xt):_e==="bottom"?(h=ke/2,x=0):_e==="center"?(h=ke/2,x=xt/2):_e==="right"?(h=0,x=xt/2):_e==="left"?(h=ke,x=xt/2):te.x<N.x?(_e="right",h=0,x=xt/2):(_e="left",h=ke+(xi.x+en.x)*2,x=xt/2),l=l.subtract(Ve(h,x,!0)).add(xi).add(en),at(k,"leaflet-tooltip-right"),at(k,"leaflet-tooltip-left"),at(k,"leaflet-tooltip-top"),at(k,"leaflet-tooltip-bottom"),Me(k,"leaflet-tooltip-"+_e),Oe(k,l)},_updatePosition:function(){var l=this._map.latLngToLayerPoint(this._latlng);this._setPosition(l)},setOpacity:function(l){this.options.opacity=l,this._container&&de(this._container,l)},_animateZoom:function(l){var h=this._map._latLngToNewLayerPoint(this._latlng,l.zoom,l.center);this._setPosition(h)},_getAnchor:function(){return Ve(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),Vb=function(l,h){return new xh(l,h)};Zi.include({openTooltip:function(l,h,x){return this._initOverlay(xh,l,h,x).openOn(this),this},closeTooltip:function(l){return l.close(),this}}),sr.include({bindTooltip:function(l,h){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(xh,this._tooltip,l,h),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(l){if(!(!l&&this._tooltipHandlersAdded)){var h=l?"off":"on",x={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?x.add=this._openTooltip:(x.mouseover=this._openTooltip,x.mouseout=this.closeTooltip,x.click=this._openTooltip,this._map?this._addFocusListeners():x.add=this._addFocusListeners),this._tooltip.options.sticky&&(x.mousemove=this._moveTooltip),this[h](x),this._tooltipHandlersAdded=!l}},openTooltip:function(l){return this._tooltip&&(this instanceof jr||(this._tooltip._source=this),this._tooltip._prepareOpen(l)&&(this._tooltip.openOn(this._map),this.getElement?this._setAriaDescribedByOnLayer(this):this.eachLayer&&this.eachLayer(this._setAriaDescribedByOnLayer,this))),this},closeTooltip:function(){if(this._tooltip)return this._tooltip.close()},toggleTooltip:function(){return this._tooltip&&this._tooltip.toggle(this),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(l){return this._tooltip&&this._tooltip.setContent(l),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(l){var h=typeof l.getElement=="function"&&l.getElement();h&&(bt(h,"focus",function(){this._tooltip._source=l,this.openTooltip()},this),bt(h,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(l){var h=typeof l.getElement=="function"&&l.getElement();h&&h.setAttribute("aria-describedby",this._tooltip._container.id)},_openTooltip:function(l){if(!(!this._tooltip||!this._map)){if(this._map.dragging&&this._map.dragging.moving()&&!this._openOnceFlag){this._openOnceFlag=!0;var h=this;this._map.once("moveend",function(){h._openOnceFlag=!1,h._openTooltip(l)});return}this._tooltip._source=l.layer||l.target,this.openTooltip(this._tooltip.options.sticky?l.latlng:void 0)}},_moveTooltip:function(l){var h=l.latlng,x,E;this._tooltip.options.sticky&&l.originalEvent&&(x=this._map.mouseEventToContainerPoint(l.originalEvent),E=this._map.containerPointToLayerPoint(x),h=this._map.layerPointToLatLng(E)),this._tooltip.setLatLng(h)}});var G=ql.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(l){var h=l&&l.tagName==="DIV"?l:document.createElement("div"),x=this.options;if(x.html instanceof Element?(Ie(h),h.appendChild(x.html)):h.innerHTML=x.html!==!1?x.html:"",x.bgPos){var E=Ve(x.bgPos);h.style.backgroundPosition=-E.x+"px "+-E.y+"px"}return this._setIconStyles(h,"icon"),h},createShadow:function(){return null}});function he(l){return new G(l)}ql.Default=Gl;var ct=sr.extend({options:{tileSize:256,opacity:1,updateWhenIdle:ye.mobile,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(l){y(this,l)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(l){l._addZoomLimit(this)},onRemove:function(l){this._removeAllTiles(),re(this._container),l._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(We(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(Ce(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(l){return this.options.opacity=l,this._updateOpacity(),this},setZIndex:function(l){return this.options.zIndex=l,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){if(this._map){this._removeAllTiles();var l=this._clampZoom(this._map.getZoom());l!==this._tileZoom&&(this._tileZoom=l,this._updateLevels()),this._update()}return this},getEvents:function(){var l={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=u(this._onMoveEnd,this.options.updateInterval,this)),l.move=this._onMove),this._zoomAnimated&&(l.zoomanim=this._animateZoom),l},createTile:function(){return document.createElement("div")},getTileSize:function(){var l=this.options.tileSize;return l instanceof xe?l:new xe(l,l)},_updateZIndex:function(){this._container&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(l){for(var h=this.getPane().children,x=-l(-1/0,1/0),E=0,k=h.length,N;E<k;E++)N=h[E].style.zIndex,h[E]!==this._container&&N&&(x=l(x,+N));isFinite(x)&&(this.options.zIndex=x+l(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!ye.ielt9){de(this._container,this.options.opacity);var l=+new Date,h=!1,x=!1;for(var E in this._tiles){var k=this._tiles[E];if(!(!k.current||!k.loaded)){var N=Math.min(1,(l-k.loaded)/200);de(k.el,N),N<1?h=!0:(k.active?x=!0:this._onOpaqueTile(k),k.active=!0)}}x&&!this._noPrune&&this._pruneTiles(),h&&(ce(this._fadeFrame),this._fadeFrame=X(this._updateOpacity,this))}},_onOpaqueTile:g,_initContainer:function(){this._container||(this._container=se("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var l=this._tileZoom,h=this.options.maxZoom;if(l!==void 0){for(var x in this._levels)x=Number(x),this._levels[x].el.children.length||x===l?(this._levels[x].el.style.zIndex=h-Math.abs(l-x),this._onUpdateLevel(x)):(re(this._levels[x].el),this._removeTilesAtZoom(x),this._onRemoveLevel(x),delete this._levels[x]);var E=this._levels[l],k=this._map;return E||(E=this._levels[l]={},E.el=se("div","leaflet-tile-container leaflet-zoom-animated",this._container),E.el.style.zIndex=h,E.origin=k.project(k.unproject(k.getPixelOrigin()),l).round(),E.zoom=l,this._setZoomTransform(E,k.getCenter(),k.getZoom()),g(E.el.offsetWidth),this._onCreateLevel(E)),this._level=E,E}},_onUpdateLevel:g,_onRemoveLevel:g,_onCreateLevel:g,_pruneTiles:function(){if(this._map){var l,h,x=this._map.getZoom();if(x>this.options.maxZoom||x<this.options.minZoom){this._removeAllTiles();return}for(l in this._tiles)h=this._tiles[l],h.retain=h.current;for(l in this._tiles)if(h=this._tiles[l],h.current&&!h.active){var E=h.coords;this._retainParent(E.x,E.y,E.z,E.z-5)||this._retainChildren(E.x,E.y,E.z,E.z+2)}for(l in this._tiles)this._tiles[l].retain||this._removeTile(l)}},_removeTilesAtZoom:function(l){for(var h in this._tiles)this._tiles[h].coords.z===l&&this._removeTile(h)},_removeAllTiles:function(){for(var l in this._tiles)this._removeTile(l)},_invalidateAll:function(){for(var l in this._levels)re(this._levels[l].el),this._onRemoveLevel(Number(l)),delete this._levels[l];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(l,h,x,E){var k=Math.floor(l/2),N=Math.floor(h/2),te=x-1,_e=new xe(+k,+N);_e.z=+te;var ke=this._tileCoordsToKey(_e),xt=this._tiles[ke];return xt&&xt.active?(xt.retain=!0,!0):(xt&&xt.loaded&&(xt.retain=!0),te>E?this._retainParent(k,N,te,E):!1)},_retainChildren:function(l,h,x,E){for(var k=2*l;k<2*l+2;k++)for(var N=2*h;N<2*h+2;N++){var te=new xe(k,N);te.z=x+1;var _e=this._tileCoordsToKey(te),ke=this._tiles[_e];if(ke&&ke.active){ke.retain=!0;continue}else ke&&ke.loaded&&(ke.retain=!0);x+1<E&&this._retainChildren(k,N,x+1,E)}},_resetView:function(l){var h=l&&(l.pinch||l.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),h,h)},_animateZoom:function(l){this._setView(l.center,l.zoom,!0,l.noUpdate)},_clampZoom:function(l){var h=this.options;return h.minNativeZoom!==void 0&&l<h.minNativeZoom?h.minNativeZoom:h.maxNativeZoom!==void 0&&h.maxNativeZoom<l?h.maxNativeZoom:l},_setView:function(l,h,x,E){var k=Math.round(h);this.options.maxZoom!==void 0&&k>this.options.maxZoom||this.options.minZoom!==void 0&&k<this.options.minZoom?k=void 0:k=this._clampZoom(k);var N=this.options.updateWhenZooming&&k!==this._tileZoom;(!E||N)&&(this._tileZoom=k,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),k!==void 0&&this._update(l),x||this._pruneTiles(),this._noPrune=!!x),this._setZoomTransforms(l,h)},_setZoomTransforms:function(l,h){for(var x in this._levels)this._setZoomTransform(this._levels[x],l,h)},_setZoomTransform:function(l,h,x){var E=this._map.getZoomScale(x,l.zoom),k=l.origin.multiplyBy(E).subtract(this._map._getNewPixelOrigin(h,x)).round();ye.any3d?we(l.el,k,E):Oe(l.el,k)},_resetGrid:function(){var l=this._map,h=l.options.crs,x=this._tileSize=this.getTileSize(),E=this._tileZoom,k=this._map.getPixelWorldBounds(this._tileZoom);k&&(this._globalTileRange=this._pxBoundsToTileRange(k)),this._wrapX=h.wrapLng&&!this.options.noWrap&&[Math.floor(l.project([0,h.wrapLng[0]],E).x/x.x),Math.ceil(l.project([0,h.wrapLng[1]],E).x/x.y)],this._wrapY=h.wrapLat&&!this.options.noWrap&&[Math.floor(l.project([h.wrapLat[0],0],E).y/x.x),Math.ceil(l.project([h.wrapLat[1],0],E).y/x.y)]},_onMoveEnd:function(){!this._map||this._map._animatingZoom||this._update()},_getTiledPixelBounds:function(l){var h=this._map,x=h._animatingZoom?Math.max(h._animateToZoom,h.getZoom()):h.getZoom(),E=h.getZoomScale(x,this._tileZoom),k=h.project(l,this._tileZoom).floor(),N=h.getSize().divideBy(E*2);return new ve(k.subtract(N),k.add(N))},_update:function(l){var h=this._map;if(h){var x=this._clampZoom(h.getZoom());if(l===void 0&&(l=h.getCenter()),this._tileZoom!==void 0){var E=this._getTiledPixelBounds(l),k=this._pxBoundsToTileRange(E),N=k.getCenter(),te=[],_e=this.options.keepBuffer,ke=new ve(k.getBottomLeft().subtract([_e,-_e]),k.getTopRight().add([_e,-_e]));if(!(isFinite(k.min.x)&&isFinite(k.min.y)&&isFinite(k.max.x)&&isFinite(k.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var xt in this._tiles){var xi=this._tiles[xt].coords;(xi.z!==this._tileZoom||!ke.contains(new xe(xi.x,xi.y)))&&(this._tiles[xt].current=!1)}if(Math.abs(x-this._tileZoom)>1){this._setView(l,x);return}for(var en=k.min.y;en<=k.max.y;en++)for(var Ei=k.min.x;Ei<=k.max.x;Ei++){var mn=new xe(Ei,en);if(mn.z=this._tileZoom,!!this._isValidTile(mn)){var Nn=this._tiles[this._tileCoordsToKey(mn)];Nn?Nn.current=!0:te.push(mn)}}if(te.sort(function(Hs,$r){return Hs.distanceTo(N)-$r.distanceTo(N)}),te.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Es=document.createDocumentFragment();for(Ei=0;Ei<te.length;Ei++)this._addTile(te[Ei],Es);this._level.el.appendChild(Es)}}}},_isValidTile:function(l){var h=this._map.options.crs;if(!h.infinite){var x=this._globalTileRange;if(!h.wrapLng&&(l.x<x.min.x||l.x>x.max.x)||!h.wrapLat&&(l.y<x.min.y||l.y>x.max.y))return!1}if(!this.options.bounds)return!0;var E=this._tileCoordsToBounds(l);return ot(this.options.bounds).overlaps(E)},_keyToBounds:function(l){return this._tileCoordsToBounds(this._keyToTileCoords(l))},_tileCoordsToNwSe:function(l){var h=this._map,x=this.getTileSize(),E=l.scaleBy(x),k=E.add(x),N=h.unproject(E,l.z),te=h.unproject(k,l.z);return[N,te]},_tileCoordsToBounds:function(l){var h=this._tileCoordsToNwSe(l),x=new Mt(h[0],h[1]);return this.options.noWrap||(x=this._map.wrapLatLngBounds(x)),x},_tileCoordsToKey:function(l){return l.x+":"+l.y+":"+l.z},_keyToTileCoords:function(l){var h=l.split(":"),x=new xe(+h[0],+h[1]);return x.z=+h[2],x},_removeTile:function(l){var h=this._tiles[l];h&&(re(h.el),delete this._tiles[l],this.fire("tileunload",{tile:h.el,coords:this._keyToTileCoords(l)}))},_initTile:function(l){Me(l,"leaflet-tile");var h=this.getTileSize();l.style.width=h.x+"px",l.style.height=h.y+"px",l.onselectstart=g,l.onmousemove=g,ye.ielt9&&this.options.opacity<1&&de(l,this.options.opacity)},_addTile:function(l,h){var x=this._getTilePos(l),E=this._tileCoordsToKey(l),k=this.createTile(this._wrapCoords(l),r(this._tileReady,this,l));this._initTile(k),this.createTile.length<2&&X(r(this._tileReady,this,l,null,k)),Oe(k,x),this._tiles[E]={el:k,coords:l,current:!0},h.appendChild(k),this.fire("tileloadstart",{tile:k,coords:l})},_tileReady:function(l,h,x){h&&this.fire("tileerror",{error:h,tile:x,coords:l});var E=this._tileCoordsToKey(l);x=this._tiles[E],x&&(x.loaded=+new Date,this._map._fadeAnimated?(de(x.el,0),ce(this._fadeFrame),this._fadeFrame=X(this._updateOpacity,this)):(x.active=!0,this._pruneTiles()),h||(Me(x.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:x.el,coords:l})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),ye.ielt9||!this._map._fadeAnimated?X(this._pruneTiles,this):setTimeout(r(this._pruneTiles,this),250)))},_getTilePos:function(l){return l.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(l){var h=new xe(this._wrapX?f(l.x,this._wrapX):l.x,this._wrapY?f(l.y,this._wrapY):l.y);return h.z=l.z,h},_pxBoundsToTileRange:function(l){var h=this.getTileSize();return new ve(l.min.unscaleBy(h).floor(),l.max.unscaleBy(h).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var l in this._tiles)if(!this._tiles[l].loaded)return!1;return!0}});function gt(l){return new ct(l)}var st=ct.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(l,h){this._url=l,h=y(this,h),h.detectRetina&&ye.retina&&h.maxZoom>0?(h.tileSize=Math.floor(h.tileSize/2),h.zoomReverse?(h.zoomOffset--,h.minZoom=Math.min(h.maxZoom,h.minZoom+1)):(h.zoomOffset++,h.maxZoom=Math.max(h.minZoom,h.maxZoom-1)),h.minZoom=Math.max(0,h.minZoom)):h.zoomReverse?h.minZoom=Math.min(h.maxZoom,h.minZoom):h.maxZoom=Math.max(h.minZoom,h.maxZoom),typeof h.subdomains=="string"&&(h.subdomains=h.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(l,h){return this._url===l&&h===void 0&&(h=!0),this._url=l,h||this.redraw(),this},createTile:function(l,h){var x=document.createElement("img");return bt(x,"load",r(this._tileOnLoad,this,h,x)),bt(x,"error",r(this._tileOnError,this,h,x)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(x.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(x.referrerPolicy=this.options.referrerPolicy),x.alt="",x.src=this.getTileUrl(l),x},getTileUrl:function(l){var h={r:ye.retina?"@2x":"",s:this._getSubdomain(l),x:l.x,y:l.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var x=this._globalTileRange.max.y-l.y;this.options.tms&&(h.y=x),h["-y"]=x}return I(this._url,n(h,this.options))},_tileOnLoad:function(l,h){ye.ielt9?setTimeout(r(l,this,null,h),0):l(null,h)},_tileOnError:function(l,h,x){var E=this.options.errorTileUrl;E&&h.getAttribute("src")!==E&&(h.src=E),l(x,h)},_onTileRemove:function(l){l.tile.onload=null},_getZoomForUrl:function(){var l=this._tileZoom,h=this.options.maxZoom,x=this.options.zoomReverse,E=this.options.zoomOffset;return x&&(l=h-l),l+E},_getSubdomain:function(l){var h=Math.abs(l.x+l.y)%this.options.subdomains.length;return this.options.subdomains[h]},_abortLoading:function(){var l,h;for(l in this._tiles)if(this._tiles[l].coords.z!==this._tileZoom&&(h=this._tiles[l].el,h.onload=g,h.onerror=g,!h.complete)){h.src=P;var x=this._tiles[l].coords;re(h),delete this._tiles[l],this.fire("tileabort",{tile:h,coords:x})}},_removeTile:function(l){var h=this._tiles[l];if(h)return h.el.setAttribute("src",P),ct.prototype._removeTile.call(this,l)},_tileReady:function(l,h,x){if(!(!this._map||x&&x.getAttribute("src")===P))return ct.prototype._tileReady.call(this,l,h,x)}});function ei(l,h){return new st(l,h)}var Ri=st.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(l,h){this._url=l;var x=n({},this.defaultWmsParams);for(var E in h)E in this.options||(x[E]=h[E]);h=y(this,h);var k=h.detectRetina&&ye.retina?2:1,N=this.getTileSize();x.width=N.x*k,x.height=N.y*k,this.wmsParams=x},onAdd:function(l){this._crs=this.options.crs||l.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var h=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[h]=this._crs.code,st.prototype.onAdd.call(this,l)},getTileUrl:function(l){var h=this._tileCoordsToNwSe(l),x=this._crs,E=mt(x.project(h[0]),x.project(h[1])),k=E.min,N=E.max,te=(this._wmsVersion>=1.3&&this._crs===sx?[k.y,k.x,N.y,N.x]:[k.x,k.y,N.x,N.y]).join(","),_e=st.prototype.getTileUrl.call(this,l);return _e+w(this.wmsParams,_e,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+te},setParams:function(l,h){return n(this.wmsParams,l),h||this.redraw(),this}});function Pi(l,h){return new Ri(l,h)}st.WMS=Ri,ei.wms=Pi;var Yi=sr.extend({options:{padding:.1},initialize:function(l){y(this,l),d(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),Me(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var l={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(l.zoomanim=this._onAnimZoom),l},_onAnimZoom:function(l){this._updateTransform(l.center,l.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(l,h){var x=this._map.getZoomScale(h,this._zoom),E=this._map.getSize().multiplyBy(.5+this.options.padding),k=this._map.project(this._center,h),N=E.multiplyBy(-x).add(k).subtract(this._map._getNewPixelOrigin(l,h));ye.any3d?we(this._container,N,x):Oe(this._container,N)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var l in this._layers)this._layers[l]._reset()},_onZoomEnd:function(){for(var l in this._layers)this._layers[l]._project()},_updatePaths:function(){for(var l in this._layers)this._layers[l]._update()},_update:function(){var l=this.options.padding,h=this._map.getSize(),x=this._map.containerPointToLayerPoint(h.multiplyBy(-l)).round();this._bounds=new ve(x,x.add(h.multiplyBy(1+l*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),Qi=Yi.extend({options:{tolerance:0},getEvents:function(){var l=Yi.prototype.getEvents.call(this);return l.viewprereset=this._onViewPreReset,l},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Yi.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var l=this._container=document.createElement("canvas");bt(l,"mousemove",this._onMouseMove,this),bt(l,"click dblclick mousedown mouseup contextmenu",this._onClick,this),bt(l,"mouseout",this._handleMouseOut,this),l._leaflet_disable_events=!0,this._ctx=l.getContext("2d")},_destroyContainer:function(){ce(this._redrawRequest),delete this._ctx,re(this._container),Di(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var l;this._redrawBounds=null;for(var h in this._layers)l=this._layers[h],l._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Yi.prototype._update.call(this);var l=this._bounds,h=this._container,x=l.getSize(),E=ye.retina?2:1;Oe(h,l.min),h.width=E*x.x,h.height=E*x.y,h.style.width=x.x+"px",h.style.height=x.y+"px",ye.retina&&this._ctx.scale(2,2),this._ctx.translate(-l.min.x,-l.min.y),this.fire("update")}},_reset:function(){Yi.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(l){this._updateDashArray(l),this._layers[d(l)]=l;var h=l._order={layer:l,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=h),this._drawLast=h,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(l){this._requestRedraw(l)},_removePath:function(l){var h=l._order,x=h.next,E=h.prev;x?x.prev=E:this._drawLast=E,E?E.next=x:this._drawFirst=x,delete l._order,delete this._layers[d(l)],this._requestRedraw(l)},_updatePath:function(l){this._extendRedrawBounds(l),l._project(),l._update(),this._requestRedraw(l)},_updateStyle:function(l){this._updateDashArray(l),this._requestRedraw(l)},_updateDashArray:function(l){if(typeof l.options.dashArray=="string"){var h=l.options.dashArray.split(/[, ]+/),x=[],E,k;for(k=0;k<h.length;k++){if(E=Number(h[k]),isNaN(E))return;x.push(E)}l.options._dashArray=x}else l.options._dashArray=l.options.dashArray},_requestRedraw:function(l){this._map&&(this._extendRedrawBounds(l),this._redrawRequest=this._redrawRequest||X(this._redraw,this))},_extendRedrawBounds:function(l){if(l._pxBounds){var h=(l.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new ve,this._redrawBounds.extend(l._pxBounds.min.subtract([h,h])),this._redrawBounds.extend(l._pxBounds.max.add([h,h]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var l=this._redrawBounds;if(l){var h=l.getSize();this._ctx.clearRect(l.min.x,l.min.y,h.x,h.y)}else this._ctx.save(),this._ctx.setTransform(1,0,0,1,0,0),this._ctx.clearRect(0,0,this._container.width,this._container.height),this._ctx.restore()},_draw:function(){var l,h=this._redrawBounds;if(this._ctx.save(),h){var x=h.getSize();this._ctx.beginPath(),this._ctx.rect(h.min.x,h.min.y,x.x,x.y),this._ctx.clip()}this._drawing=!0;for(var E=this._drawFirst;E;E=E.next)l=E.layer,(!h||l._pxBounds&&l._pxBounds.intersects(h))&&l._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(l,h){if(this._drawing){var x,E,k,N,te=l._parts,_e=te.length,ke=this._ctx;if(_e){for(ke.beginPath(),x=0;x<_e;x++){for(E=0,k=te[x].length;E<k;E++)N=te[x][E],ke[E?"lineTo":"moveTo"](N.x,N.y);h&&ke.closePath()}this._fillStroke(ke,l)}}},_updateCircle:function(l){if(!(!this._drawing||l._empty())){var h=l._point,x=this._ctx,E=Math.max(Math.round(l._radius),1),k=(Math.max(Math.round(l._radiusY),1)||E)/E;k!==1&&(x.save(),x.scale(1,k)),x.beginPath(),x.arc(h.x,h.y/k,E,0,Math.PI*2,!1),k!==1&&x.restore(),this._fillStroke(x,l)}},_fillStroke:function(l,h){var x=h.options;x.fill&&(l.globalAlpha=x.fillOpacity,l.fillStyle=x.fillColor||x.color,l.fill(x.fillRule||"evenodd")),x.stroke&&x.weight!==0&&(l.setLineDash&&l.setLineDash(h.options&&h.options._dashArray||[]),l.globalAlpha=x.opacity,l.lineWidth=x.weight,l.strokeStyle=x.color,l.lineCap=x.lineCap,l.lineJoin=x.lineJoin,l.stroke())},_onClick:function(l){for(var h=this._map.mouseEventToLayerPoint(l),x,E,k=this._drawFirst;k;k=k.next)x=k.layer,x.options.interactive&&x._containsPoint(h)&&(!(l.type==="click"||l.type==="preclick")||!this._map._draggableMoved(x))&&(E=x);this._fireEvent(E?[E]:!1,l)},_onMouseMove:function(l){if(!(!this._map||this._map.dragging.moving()||this._map._animatingZoom)){var h=this._map.mouseEventToLayerPoint(l);this._handleMouseHover(l,h)}},_handleMouseOut:function(l){var h=this._hoveredLayer;h&&(at(this._container,"leaflet-interactive"),this._fireEvent([h],l,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(l,h){if(!this._mouseHoverThrottled){for(var x,E,k=this._drawFirst;k;k=k.next)x=k.layer,x.options.interactive&&x._containsPoint(h)&&(E=x);E!==this._hoveredLayer&&(this._handleMouseOut(l),E&&(Me(this._container,"leaflet-interactive"),this._fireEvent([E],l,"mouseover"),this._hoveredLayer=E)),this._fireEvent(this._hoveredLayer?[this._hoveredLayer]:!1,l),this._mouseHoverThrottled=!0,setTimeout(r(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(l,h,x){this._map._fireDOMEvent(h,x||h.type,l)},_bringToFront:function(l){var h=l._order;if(h){var x=h.next,E=h.prev;if(x)x.prev=E;else return;E?E.next=x:x&&(this._drawFirst=x),h.prev=this._drawLast,this._drawLast.next=h,h.next=null,this._drawLast=h,this._requestRedraw(l)}},_bringToBack:function(l){var h=l._order;if(h){var x=h.next,E=h.prev;if(E)E.next=x;else return;x?x.prev=E:E&&(this._drawLast=E),h.prev=null,h.next=this._drawFirst,this._drawFirst.prev=h,this._drawFirst=h,this._requestRedraw(l)}}});function gn(l){return ye.canvas?new Qi(l):null}var un=(function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(l){return document.createElement("<lvml:"+l+' class="lvml">')}}catch{}return function(l){return document.createElement("<"+l+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}})(),Sn={_initContainer:function(){this._container=se("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Yi.prototype._update.call(this),this.fire("update"))},_initPath:function(l){var h=l._container=un("shape");Me(h,"leaflet-vml-shape "+(this.options.className||"")),h.coordsize="1 1",l._path=un("path"),h.appendChild(l._path),this._updateStyle(l),this._layers[d(l)]=l},_addPath:function(l){var h=l._container;this._container.appendChild(h),l.options.interactive&&l.addInteractiveTarget(h)},_removePath:function(l){var h=l._container;re(h),l.removeInteractiveTarget(h),delete this._layers[d(l)]},_updateStyle:function(l){var h=l._stroke,x=l._fill,E=l.options,k=l._container;k.stroked=!!E.stroke,k.filled=!!E.fill,E.stroke?(h||(h=l._stroke=un("stroke")),k.appendChild(h),h.weight=E.weight+"px",h.color=E.color,h.opacity=E.opacity,E.dashArray?h.dashStyle=T(E.dashArray)?E.dashArray.join(" "):E.dashArray.replace(/( *, *)/g," "):h.dashStyle="",h.endcap=E.lineCap.replace("butt","flat"),h.joinstyle=E.lineJoin):h&&(k.removeChild(h),l._stroke=null),E.fill?(x||(x=l._fill=un("fill")),k.appendChild(x),x.color=E.fillColor||E.color,x.opacity=E.fillOpacity):x&&(k.removeChild(x),l._fill=null)},_updateCircle:function(l){var h=l._point.round(),x=Math.round(l._radius),E=Math.round(l._radiusY||x);this._setPath(l,l._empty()?"M0 0":"AL "+h.x+","+h.y+" "+x+","+E+" 0,"+65535*360)},_setPath:function(l,h){l._path.v=h},_bringToFront:function(l){We(l._container)},_bringToBack:function(l){Ce(l._container)}},yn=ye.vml?un:ki,An=Yi.extend({_initContainer:function(){this._container=yn("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=yn("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){re(this._container),Di(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Yi.prototype._update.call(this);var l=this._bounds,h=l.getSize(),x=this._container;(!this._svgSize||!this._svgSize.equals(h))&&(this._svgSize=h,x.setAttribute("width",h.x),x.setAttribute("height",h.y)),Oe(x,l.min),x.setAttribute("viewBox",[l.min.x,l.min.y,h.x,h.y].join(" ")),this.fire("update")}},_initPath:function(l){var h=l._path=yn("path");l.options.className&&Me(h,l.options.className),l.options.interactive&&Me(h,"leaflet-interactive"),this._updateStyle(l),this._layers[d(l)]=l},_addPath:function(l){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(l._path),l.addInteractiveTarget(l._path)},_removePath:function(l){re(l._path),l.removeInteractiveTarget(l._path),delete this._layers[d(l)]},_updatePath:function(l){l._project(),l._update()},_updateStyle:function(l){var h=l._path,x=l.options;h&&(x.stroke?(h.setAttribute("stroke",x.color),h.setAttribute("stroke-opacity",x.opacity),h.setAttribute("stroke-width",x.weight),h.setAttribute("stroke-linecap",x.lineCap),h.setAttribute("stroke-linejoin",x.lineJoin),x.dashArray?h.setAttribute("stroke-dasharray",x.dashArray):h.removeAttribute("stroke-dasharray"),x.dashOffset?h.setAttribute("stroke-dashoffset",x.dashOffset):h.removeAttribute("stroke-dashoffset")):h.setAttribute("stroke","none"),x.fill?(h.setAttribute("fill",x.fillColor||x.color),h.setAttribute("fill-opacity",x.fillOpacity),h.setAttribute("fill-rule",x.fillRule||"evenodd")):h.setAttribute("fill","none"))},_updatePoly:function(l,h){this._setPath(l,_i(l._parts,h))},_updateCircle:function(l){var h=l._point,x=Math.max(Math.round(l._radius),1),E=Math.max(Math.round(l._radiusY),1)||x,k="a"+x+","+E+" 0 1,0 ",N=l._empty()?"M0 0":"M"+(h.x-x)+","+h.y+k+x*2+",0 "+k+-x*2+",0 ";this._setPath(l,N)},_setPath:function(l,h){l._path.setAttribute("d",h)},_bringToFront:function(l){We(l._path)},_bringToBack:function(l){Ce(l._path)}});ye.vml&&An.include(Sn);function us(l){return ye.svg||ye.vml?new An(l):null}Zi.include({getRenderer:function(l){var h=l.options.renderer||this._getPaneRenderer(l.options.pane)||this.options.renderer||this._renderer;return h||(h=this._renderer=this._createRenderer()),this.hasLayer(h)||this.addLayer(h),h},_getPaneRenderer:function(l){if(l==="overlayPane"||l===void 0)return!1;var h=this._paneRenderers[l];return h===void 0&&(h=this._createRenderer({pane:l}),this._paneRenderers[l]=h),h},_createRenderer:function(l){return this.options.preferCanvas&&gn(l)||us(l)}});var _n=el.extend({initialize:function(l,h){el.prototype.initialize.call(this,this._boundsToLatLngs(l),h)},setBounds:function(l){return this.setLatLngs(this._boundsToLatLngs(l))},_boundsToLatLngs:function(l){return l=ot(l),[l.getSouthWest(),l.getNorthWest(),l.getNorthEast(),l.getSouthEast()]}});function $n(l,h){return new _n(l,h)}An.create=yn,An.pointsToPath=_i,mr.geometryToLayer=rd,mr.coordsToLatLng=uh,mr.coordsToLatLngs=hh,mr.latLngToCoords=Bf,mr.latLngsToCoords=fh,mr.getFeature=ma,mr.asFeature=ad,Zi.mergeOptions({boxZoom:!0});var Ns=ao.extend({initialize:function(l){this._map=l,this._container=l._container,this._pane=l._panes.overlayPane,this._resetStateTimeout=0,l.on("unload",this._destroy,this)},addHooks:function(){bt(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Di(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){re(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(l){if(!l.shiftKey||l.which!==1&&l.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),ut(),Fe(),this._startPoint=this._map.mouseEventToContainerPoint(l),bt(document,{contextmenu:nn,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(l){this._moved||(this._moved=!0,this._box=se("div","leaflet-zoom-box",this._container),Me(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(l);var h=new ve(this._point,this._startPoint),x=h.getSize();Oe(this._box,h.min),this._box.style.width=x.x+"px",this._box.style.height=x.y+"px"},_finish:function(){this._moved&&(re(this._box),at(this._container,"leaflet-crosshair")),nt(),Je(),Di(document,{contextmenu:nn,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(l){if(!(l.which!==1&&l.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(r(this._resetState,this),0);var h=new Mt(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(h).fire("boxzoomend",{boxZoomBounds:h})}},_onKeyDown:function(l){l.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});Zi.addInitHook("addHandler","boxZoom",Ns),Zi.mergeOptions({doubleClickZoom:!0});var bo=ao.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(l){var h=this._map,x=h.getZoom(),E=h.options.zoomDelta,k=l.originalEvent.shiftKey?x-E:x+E;h.options.doubleClickZoom==="center"?h.setZoom(k):h.setZoomAround(l.containerPoint,k)}});Zi.addInitHook("addHandler","doubleClickZoom",bo),Zi.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var Os=ao.extend({addHooks:function(){if(!this._draggable){var l=this._map;this._draggable=new nr(l._mapPane,l._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),l.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),l.on("zoomend",this._onZoomEnd,this),l.whenReady(this._onZoomEnd,this))}Me(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){at(this._map._container,"leaflet-grab"),at(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var l=this._map;if(l._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var h=ot(this._map.options.maxBounds);this._offsetLimit=mt(this._map.latLngToContainerPoint(h.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(h.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;l.fire("movestart").fire("dragstart"),l.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(l){if(this._map.options.inertia){var h=this._lastTime=+new Date,x=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(x),this._times.push(h),this._prunePositions(h)}this._map.fire("move",l).fire("drag",l)},_prunePositions:function(l){for(;this._positions.length>1&&l-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var l=this._map.getSize().divideBy(2),h=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=h.subtract(l).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(l,h){return l-(l-h)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var l=this._draggable._newPos.subtract(this._draggable._startPos),h=this._offsetLimit;l.x<h.min.x&&(l.x=this._viscousLimit(l.x,h.min.x)),l.y<h.min.y&&(l.y=this._viscousLimit(l.y,h.min.y)),l.x>h.max.x&&(l.x=this._viscousLimit(l.x,h.max.x)),l.y>h.max.y&&(l.y=this._viscousLimit(l.y,h.max.y)),this._draggable._newPos=this._draggable._startPos.add(l)}},_onPreDragWrap:function(){var l=this._worldWidth,h=Math.round(l/2),x=this._initialWorldOffset,E=this._draggable._newPos.x,k=(E-h+x)%l+h-x,N=(E+h+x)%l-h-x,te=Math.abs(k+x)<Math.abs(N+x)?k:N;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=te},_onDragEnd:function(l){var h=this._map,x=h.options,E=!x.inertia||l.noInertia||this._times.length<2;if(h.fire("dragend",l),E)h.fire("moveend");else{this._prunePositions(+new Date);var k=this._lastPos.subtract(this._positions[0]),N=(this._lastTime-this._times[0])/1e3,te=x.easeLinearity,_e=k.multiplyBy(te/N),ke=_e.distanceTo([0,0]),xt=Math.min(x.inertiaMaxSpeed,ke),xi=_e.multiplyBy(xt/ke),en=xt/(x.inertiaDeceleration*te),Ei=xi.multiplyBy(-en/2).round();!Ei.x&&!Ei.y?h.fire("moveend"):(Ei=h._limitOffset(Ei,h.options.maxBounds),X(function(){h.panBy(Ei,{duration:en,easeLinearity:te,noMoveStart:!0,animate:!0})}))}}});Zi.addInitHook("addHandler","dragging",Os),Zi.mergeOptions({keyboard:!0,keyboardPanDelta:80});var ks=ao.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(l){this._map=l,this._setPanDelta(l.options.keyboardPanDelta),this._setZoomDelta(l.options.zoomDelta)},addHooks:function(){var l=this._map._container;l.tabIndex<=0&&(l.tabIndex="0"),bt(l,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),Di(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var l=document.body,h=document.documentElement,x=l.scrollTop||h.scrollTop,E=l.scrollLeft||h.scrollLeft;this._map._container.focus(),window.scrollTo(E,x)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(l){var h=this._panKeys={},x=this.keyCodes,E,k;for(E=0,k=x.left.length;E<k;E++)h[x.left[E]]=[-1*l,0];for(E=0,k=x.right.length;E<k;E++)h[x.right[E]]=[l,0];for(E=0,k=x.down.length;E<k;E++)h[x.down[E]]=[0,l];for(E=0,k=x.up.length;E<k;E++)h[x.up[E]]=[0,-1*l]},_setZoomDelta:function(l){var h=this._zoomKeys={},x=this.keyCodes,E,k;for(E=0,k=x.zoomIn.length;E<k;E++)h[x.zoomIn[E]]=l;for(E=0,k=x.zoomOut.length;E<k;E++)h[x.zoomOut[E]]=-l},_addHooks:function(){bt(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){Di(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(l){if(!(l.altKey||l.ctrlKey||l.metaKey)){var h=l.keyCode,x=this._map,E;if(h in this._panKeys){if(!x._panAnim||!x._panAnim._inProgress)if(E=this._panKeys[h],l.shiftKey&&(E=Ve(E).multiplyBy(3)),x.options.maxBounds&&(E=x._limitOffset(Ve(E),x.options.maxBounds)),x.options.worldCopyJump){var k=x.wrapLatLng(x.unproject(x.project(x.getCenter()).add(E)));x.panTo(k)}else x.panBy(E)}else if(h in this._zoomKeys)x.setZoom(x.getZoom()+(l.shiftKey?3:1)*this._zoomKeys[h]);else if(h===27&&x._popup&&x._popup.options.closeOnEscapeKey)x.closePopup();else return;nn(l)}}});Zi.addInitHook("addHandler","keyboard",ks),Zi.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var hs=ao.extend({addHooks:function(){bt(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){Di(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(l){var h=Dn(l),x=this._map.options.wheelDebounceTime;this._delta+=h,this._lastMousePos=this._map.mouseEventToContainerPoint(l),this._startTime||(this._startTime=+new Date);var E=Math.max(x-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(r(this._performZoom,this),E),nn(l)},_performZoom:function(){var l=this._map,h=l.getZoom(),x=this._map.options.zoomSnap||0;l._stop();var E=this._delta/(this._map.options.wheelPxPerZoomLevel*4),k=4*Math.log(2/(1+Math.exp(-Math.abs(E))))/Math.LN2,N=x?Math.ceil(k/x)*x:k,te=l._limitZoom(h+(this._delta>0?N:-N))-h;this._delta=0,this._startTime=null,te&&(l.options.scrollWheelZoom==="center"?l.setZoom(h+te):l.setZoomAround(this._lastMousePos,h+te))}});Zi.addInitHook("addHandler","scrollWheelZoom",hs);var ls=600;Zi.mergeOptions({tapHold:ye.touchNative&&ye.safari&&ye.mobile,tapTolerance:15});var Ks=ao.extend({addHooks:function(){bt(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Di(this._map._container,"touchstart",this._onDown,this)},_onDown:function(l){if(clearTimeout(this._holdTimeout),l.touches.length===1){var h=l.touches[0];this._startPos=this._newPos=new xe(h.clientX,h.clientY),this._holdTimeout=setTimeout(r(function(){this._cancel(),this._isTapValid()&&(bt(document,"touchend",hi),bt(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",h))},this),ls),bt(document,"touchend touchcancel contextmenu",this._cancel,this),bt(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function l(){Di(document,"touchend",hi),Di(document,"touchend touchcancel",l)},_cancel:function(){clearTimeout(this._holdTimeout),Di(document,"touchend touchcancel contextmenu",this._cancel,this),Di(document,"touchmove",this._onMove,this)},_onMove:function(l){var h=l.touches[0];this._newPos=new xe(h.clientX,h.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(l,h){var x=new MouseEvent(l,{bubbles:!0,cancelable:!0,view:window,screenX:h.screenX,screenY:h.screenY,clientX:h.clientX,clientY:h.clientY});x._simulated=!0,h.target.dispatchEvent(x)}});Zi.addInitHook("addHandler","tapHold",Ks),Zi.mergeOptions({touchZoom:ye.touch,bounceAtZoomLimits:!0});var Mn=ao.extend({addHooks:function(){Me(this._map._container,"leaflet-touch-zoom"),bt(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){at(this._map._container,"leaflet-touch-zoom"),Di(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(l){var h=this._map;if(!(!l.touches||l.touches.length!==2||h._animatingZoom||this._zooming)){var x=h.mouseEventToContainerPoint(l.touches[0]),E=h.mouseEventToContainerPoint(l.touches[1]);this._centerPoint=h.getSize()._divideBy(2),this._startLatLng=h.containerPointToLatLng(this._centerPoint),h.options.touchZoom!=="center"&&(this._pinchStartLatLng=h.containerPointToLatLng(x.add(E)._divideBy(2))),this._startDist=x.distanceTo(E),this._startZoom=h.getZoom(),this._moved=!1,this._zooming=!0,h._stop(),bt(document,"touchmove",this._onTouchMove,this),bt(document,"touchend touchcancel",this._onTouchEnd,this),hi(l)}},_onTouchMove:function(l){if(!(!l.touches||l.touches.length!==2||!this._zooming)){var h=this._map,x=h.mouseEventToContainerPoint(l.touches[0]),E=h.mouseEventToContainerPoint(l.touches[1]),k=x.distanceTo(E)/this._startDist;if(this._zoom=h.getScaleZoom(k,this._startZoom),!h.options.bounceAtZoomLimits&&(this._zoom<h.getMinZoom()&&k<1||this._zoom>h.getMaxZoom()&&k>1)&&(this._zoom=h._limitZoom(this._zoom)),h.options.touchZoom==="center"){if(this._center=this._startLatLng,k===1)return}else{var N=x._add(E)._divideBy(2)._subtract(this._centerPoint);if(k===1&&N.x===0&&N.y===0)return;this._center=h.unproject(h.project(this._pinchStartLatLng,this._zoom).subtract(N),this._zoom)}this._moved||(h._moveStart(!0,!1),this._moved=!0),ce(this._animRequest);var te=r(h._move,h,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=X(te,this,!0),hi(l)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,ce(this._animRequest),Di(document,"touchmove",this._onTouchMove,this),Di(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});Zi.addInitHook("addHandler","touchZoom",Mn),Zi.BoxZoom=Ns,Zi.DoubleClickZoom=bo,Zi.Drag=Os,Zi.Keyboard=ks,Zi.ScrollWheelZoom=hs,Zi.TapHold=Ks,Zi.TouchZoom=Mn,t.Bounds=ve,t.Browser=ye,t.CRS=Nt,t.Canvas=Qi,t.Circle=Af,t.CircleMarker=dh,t.Class=oe,t.Control=Tn,t.DivIcon=G,t.DivOverlay=vr,t.DomEvent=In,t.DomUtil=Wt,t.Draggable=nr,t.Evented=Te,t.FeatureGroup=jr,t.GeoJSON=mr,t.GridLayer=ct,t.Handler=ao,t.Icon=ql,t.ImageOverlay=ld,t.LatLng=yt,t.LatLngBounds=Mt,t.Layer=sr,t.LayerGroup=Ja,t.LineUtil=sd,t.Map=Zi,t.Marker=ch,t.Mixin=ah,t.Path=xa,t.Point=xe,t.PolyUtil=Cf,t.Polygon=el,t.Polyline=xr,t.Popup=ph,t.PosAnimation=es,t.Projection=Rb,t.Rectangle=_n,t.Renderer=Yi,t.SVG=An,t.SVGOverlay=fx,t.TileLayer=st,t.Tooltip=xh,t.Transformation=wt,t.Util=me,t.VideoOverlay=If,t.bind=r,t.bounds=mt,t.canvas=gn,t.circle=kf,t.circleMarker=dx,t.control=Gn,t.divIcon=he,t.extend=n,t.featureGroup=ax,t.geoJSON=Ff,t.geoJson=Ob,t.gridLayer=gt,t.icon=lx,t.imageOverlay=Lf,t.latLng=be,t.latLngBounds=ot,t.layerGroup=rx,t.map=Is,t.marker=cx,t.point=Ve,t.polygon=ux,t.polyline=Nb,t.popup=zb,t.rectangle=$n,t.setOptions=y,t.stamp=d,t.svg=us,t.svgOverlay=Wb,t.tileLayer=ei,t.tooltip=Vb,t.transformation=Yt,t.version=i,t.videoOverlay=Hb;var ps=window.L;t.noConflict=function(){return window.L=ps,this},window.L=t}))})(rg,rg.exports)),rg.exports}var uZ=dZ();const jf=fS(uZ),hZ="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=",fZ="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAABSCAMAAAAhFXfZAAAC91BMVEVMaXEzeak2f7I4g7g3g7cua5gzeKg8hJo3grY4g7c3grU0gLI2frE0daAubJc2gbQwd6QzeKk2gLMtd5sxdKIua5g1frA2f7IydaM0e6w2fq41fK01eqo3grgubJgta5cxdKI1f7AydaQydaMxc6EubJgvbJkwcZ4ubZkwcJwubZgubJcydqUydKIxapgubJctbJcubZcubJcvbJYubJcvbZkubJctbJctbZcubJg2f7AubJcrbZcubJcubJcua5g3grY0fq8ubJcubJdEkdEwhsw6i88vhswuhcsuhMtBjMgthMsrg8srgss6is8qgcs8i9A9iMYtg8spgcoogMo7hcMngMonf8olfso4gr8kfck5iM8jfMk4iM8he8k1fro7itAgesk2hs8eecgzfLcofssdeMg0hc4cd8g2hcsxeLQbdsgZdcgxeLImfcszhM0vda4xgckzhM4xg84wf8Yxgs4udKsvfcQucqhUndROmdM1fK0wcZ8vb5w0eqpQm9MzeKhXoNVcpdYydKNWn9VZotVKltJFjsIwcJ1Rms9OlslLmtH///8+kc9epdYzd6dbo9VHkMM2f7FHmNBClM8ydqVcpNY9hro3gLM9hLczealQmcw3fa46f7A8gLMxc6I3eagyc6FIldJMl9JSnNRSntNNl9JPnNJFi75UnM9ZodVKksg8kM45jc09e6ZHltFBk883gbRBh7pDk9EwcaBzn784g7dKkcY2i81Om9M7j85Llc81is09g7Q4grY/j9A0eqxKmdFFltBEjcXf6fFImdBCiLxJl9FGlNFBi78yiMxVndEvbpo6js74+vx+psPP3+o/ks5HkcpGmNCjwdZCkNDM3ehYoNJEls+lxNkxh8xHks0+jdC1zd5Lg6r+/v/H2ufz9/o3jM3t8/edvdM/k89Th61OiLBSjbZklbaTt9BfptdjmL1AicBHj8hGk9FAgK1dkLNTjLRekrdClc/k7fM0icy0y9tgp9c4jc2NtM9Dlc8zicxeXZn3AAAAQ3RSTlMAHDdTb4yPA+LtnEQmC4L2EmHqB7XA0d0sr478x4/Yd5i1zOfyPkf1sLVq4Nh3FvjxopQ2/STNuFzUwFIwxKaejILpIBEV9wAABhVJREFUeF6s1NdyFEcYBeBeoQIhRAkLlRDGrhIgY3BJL8CVeKzuyXFzzjkn5ZxzzuScg3PO8cKzu70JkO0LfxdTU//pM9vTu7Xgf6KqOVTb9X7toRrVEfBf1HTVjZccrT/2by1VV928Yty9ZbVuucdz90frG8DBjl9pVApbOstvmMuvVgaNXSfAAd6pGxpy6yxf5ph43pS/4f3uoaGm2rdu72S9xzOvMymkZFq/ptDrk90mhW7e4zl7HLzhxGWPR20xmSxJ/VqldG5m9XhaVOA1DadsNh3Pu5L2N6QtPO/32JpqQBVVk20oy/Pi2s23WEvyfHbe1thadVQttvm7Llf65gGmXK67XtupyoM7HQhmXdLS8oGWJNeOJ3C5fG5XCEJnkez3/oFdsvgJ4l2ANZwhrJKk/7OSXa+3Vw2WJMlKnGkobouYk6T0TyX30klOUnTD9HJ5qpckL3EW/w4XF3Xd0FGywXUrstrclVsqz5Pd/sXFYyDnPdrLcQODmGOK47IZb4CmibmMn+MYRzFZ5jg33ZL/EJrWcszHmANy3ARBK/IXtciJy8VsitPSdE3uuHxzougojcUdr8/32atnz/ev3f/K5wtpxUTpcaI45zusVDpYtZi+jg0oU9b3x74h7+n9ABvYEZeKaVq0sh0AtLKsFtqNBdeT0MrSzwwlq9+x6xAO4tgOtSzbCjrNQQiNvQUbUEubvzBUeGw26yDCsRHCoLkTHDa7IdOLIThs/gHvChszh2CimE8peRs47cxANI0lYNB5y1DljpOF0IhzBDPOZnDOqYYbeGKECbPzWnXludPphw5c2YBq5zlwXphIbO4VDCZ0gnPfUO1TwZoYwAs2ExPCedAu9DAjfQUjzITQb3jNj0KG2Sgt6BHaQUdYzWz+XmBktOHwanXjaSTcwwziBcuMOtwBmqPrTOxFQR/DRKKPqyur0aiW6cULYsx6tBm0jXpR/AUWR6HRq9WVW6MRhIq5jLyjbaCTDCijyYJNpCajdyobP/eTw0iexBAKkJ3gA5KcQb2zBXsIBckn+xVv8jkZSaEFHE+jFEleAEfayRU0MouNoBmB/L50Ai/HSLIHxcrpCvnhSQAuakKp2C/YbCylJjXRVy/z3+Kv/RrNcCo+WUzlVEhzKffnTQnxeN9fWF88fiNCUdSTsaufaChKWInHeysygfpIqagoakW+vV20J8uyl6TyNKEZWV4oRSPyCkWpgOLSbkCObT8o2r6tlG58HQquf6O0v50tB7JM7F4EORd2dx/K0w/KHsVkLPaoYrwgP/y7krr3SSMA4zj+OBgmjYkxcdIJQyQRKgg2viX9Hddi9UBb29LrKR7CVVEEEXWojUkXNyfTNDE14W9gbHJNuhjDettN3ZvbOvdOqCD3Jp/9l+/wJE+9PkYGjx/fqkys3S2rMozM/o2106rfMUINo6hVqz+eu/hd1c4xTg0TAfy5kV+4UG6+IthHTU9woWmxuKNbTfuCSfovBCxq7EtHqvYL4Sm6F8GVxsSXHMQ07TOi1DKtZxjWaaIyi4CXWjxPccUw8WVbMYY5wxC1mzEyXMJWkllpRloi+Kkoq69sxBTlElF6aAxYUbjXNlhlDZilDnM4U5SlN5biRsRHnbx3mbeWjEh4mEyiuJDl5XcWVmX5GvNkFgLWZM5qwsop4/AWfLhU1cR7k1VVvcYCWRkOI6Xy5gmnphCYIkvzuNYzHzosq2oNk2RtSs8khfUOfHIDgR6ysYBaMpl4uEgk2U/oJTs9AaTSwma7dT69geAE2ZpEjUsn2ieJNHeKfrI3EcAGJ2ZaNgVuC8EBctCLc57P5u5led6IOBkIYkuQMrmmjChs4VkfOerHqSBkPzZlhe06RslZ3zMjk2sscqKwY0RcjKK+LWbzd7KiHhkncs/siFJ+V5eXxD34B8nVuJEpGJNmxN2gH3vSvp7J70tF+D1Ej8qUJD1TkErAND2GZwTFg/LubvmgiBG3SOvdlsqFQrkEzJCL1rstlnVFROixZoDDSuXQFHESwVGlcuQcMb/b42NgjLowh5MTDFE3vNB5qStRIErdCQEh6pLPR92anSUb/wAIhldAaDMpGgAAAABJRU5ErkJggg==",gZ="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC",On=(o,e=rb)=>{var t=pZ(),i=v(_(t),2),n=_(i);z(()=>W(n,e())),D(o,t)};var pZ=B('<span class="tip svelte-767znw"><span class="tip-icon svelte-767znw">ℹ</span> <span class="tip-box svelte-767znw"> </span></span>'),xZ=B("<button> </button>"),mZ=B('<span class="err svelte-767znw"> </span>'),vZ=B('<span class="ok svelte-767znw"> </span>'),_Z=B('<div class="loading svelte-767znw">Loading…</div>'),bZ=B('<section id="sec-appearance" class="svelte-767znw"><h3 class="svelte-767znw">Appearance</h3> <div class="field svelte-767znw"><label for="theme-select" class="svelte-767znw">Color theme</label> <select id="theme-select" class="svelte-767znw"><option>Dark</option><option>Light</option><option>System (OS preference)</option></select></div></section>'),CZ=B('<div class="field svelte-767znw"><label class="svelte-767znw"> <!></label> <input type="password" placeholder="Enter new password" autocomplete="new-password" class="svelte-767znw"/></div>'),EZ=B('<div class="field svelte-767znw"><label class="svelte-767znw">Proxy user header <!></label> <input type="text" placeholder="X-Remote-User" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">Logout URL <!></label> <input type="text" placeholder="https://auth.example.com/…/end-session/" class="svelte-767znw"/></div>',1),yZ=B('<div class="field-error svelte-767znw"> </div>'),wZ=B('<div class="field-ok svelte-767znw"> </div>'),SZ=B('<section id="sec-auth" class="svelte-767znw"><h3 class="svelte-767znw">Authentication</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Mode <!></label> <select class="svelte-767znw"><option>None (open)</option><option>Password</option><option>Proxy header (nginx / authentik)</option></select></div> <!> <!> <!> <!> <div class="field svelte-767znw"><span></span> <button class="save-auth-btn svelte-767znw"> </button></div></section>'),DZ=B('<div class="field svelte-767znw"><label class="svelte-767znw">CA certificate <!></label> <textarea rows="4" placeholder="-----BEGIN CERTIFICATE----- … -----END CERTIFICATE-----" spellcheck="false" class="svelte-767znw"></textarea></div> <div class="field svelte-767znw"><label class="svelte-767znw">Client certificate <!></label> <textarea rows="4" placeholder="-----BEGIN CERTIFICATE----- … -----END CERTIFICATE-----" spellcheck="false" class="svelte-767znw"></textarea></div> <div class="field svelte-767znw"><label class="svelte-767znw">Client private key <!></label> <textarea rows="4" placeholder="-----BEGIN PRIVATE KEY----- … -----END PRIVATE KEY-----" spellcheck="false" class="svelte-767znw"></textarea></div>',1),AZ=B('<section id="sec-mqtt" class="svelte-767znw"><h3 class="svelte-767znw">MQTT</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Protocol <!></label> <select class="svelte-767znw"><option>mqtt (plain TCP)</option><option>mqtts (TLS)</option><option>ws (WebSocket)</option><option>wss (WebSocket + TLS)</option></select></div> <div class="field svelte-767znw"><label class="svelte-767znw">Broker address <!></label> <input type="text" placeholder="localhost:1883" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">Username <!></label> <input type="text" placeholder="(optional)" autocomplete="off" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">Password <!></label> <input type="password" placeholder="(optional)" autocomplete="new-password" class="svelte-767znw"/></div> <!> <div class="field svelte-767znw"><label class="svelte-767znw">MQTT protocol version <!></label> <select class="svelte-767znw"><option>3.1.1 (default)</option><option>5.0</option></select></div> <div class="field svelte-767znw"><label class="svelte-767znw">Client name <!></label> <input type="text" placeholder="she" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">Variable prefix <!></label> <input type="text" placeholder="var" class="svelte-767znw"/></div> <div class="field field--check svelte-767znw"><span></span> <label class="check-label svelte-767znw"><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> Disable variable system <!></label></div></section>'),kZ=B('<section id="sec-broker" class="svelte-767znw"><h3 class="svelte-767znw">Mosquitto management</h3> <div class="field field--check svelte-767znw"><label class="svelte-767znw">Enable <!></label> <label><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> Mosquitto management<!></label></div></section>'),BZ=B('<div class="field svelte-767znw"><label class="svelte-767znw">Storage path <!></label> <input id="matter-storage-input" type="text" class="svelte-767znw"/></div>'),FZ=B('<section id="sec-matter" class="svelte-767znw"><h3 class="svelte-767znw">Matter controller</h3> <div class="field field--check svelte-767znw"><label class="svelte-767znw">Enable <!></label> <label><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> Matter controller<!></label></div> <!></section>'),LZ=B('<section id="sec-webserver" class="svelte-767znw"><h3 class="svelte-767znw">Web server</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Port <!></label> <input type="number" min="0" max="65535" placeholder="8080" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">Bind address <!></label> <input type="text" placeholder="0.0.0.0 (default)" class="svelte-767znw"/></div></section>'),IZ=B('<section id="sec-scripts" class="svelte-767znw"><h3 class="svelte-767znw">Scripts</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Scripts directory <!></label> <input type="text" class="svelte-767znw"/></div> <div class="field field--check svelte-767znw"><span></span> <label class="check-label svelte-767znw"><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> Disable file watching <!></label></div></section>'),PZ=B('<section id="sec-git" class="svelte-767znw"><h3 class="svelte-767znw">Git</h3> <div class="field field--check svelte-767znw"><span></span> <label class="check-label svelte-767znw"><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> Auto-commit on save <!></label></div> <div class="field field--check svelte-767znw"><span></span> <label class="check-label svelte-767znw"><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> Auto-push after commit <!></label></div></section>'),N2=B("<option> </option>"),TZ=B('<div class="field svelte-767znw"><div class="map-label svelte-767znw">Map <span class="map-note svelte-767znw">(click or drag marker to set location — requires internet for tiles)</span></div> <div class="map-container svelte-767znw"></div></div>'),MZ=B('<section id="sec-solar" class="svelte-767znw"><h3 class="svelte-767znw">Location</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Timezone <!></label> <input type="text" list="tz-list" placeholder="(system default)" autocomplete="off" spellcheck="false" class="svelte-767znw"/> <datalist id="tz-list"></datalist></div> <div class="field svelte-767znw"><label class="svelte-767znw">Latitude <!></label> <input type="number" step="0.0001" placeholder="48.7408" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">Longitude <!></label> <input type="number" step="0.0001" placeholder="9.1778" class="svelte-767znw"/></div> <div class="field geo-actions svelte-767znw"><span></span> <div class="geo-btns svelte-767znw"><button class="geo-btn svelte-767znw"><!></button> <button class="geo-btn svelte-767znw"> </button></div></div> <!></section>'),RZ=B('<div class="field field--check svelte-767znw"><span></span> <label class="check-label svelte-767znw"><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> Retain document messages <!></label></div>'),NZ=B('<div class="field svelte-767znw"><label class="svelte-767znw">Database path <!></label> <input type="text" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">MQTT topic prefix <!></label> <input type="text" placeholder="she/db/ (default)" class="svelte-767znw"/></div> <div class="field field--check svelte-767znw"><span></span> <label class="check-label svelte-767znw"><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> Publish documents to MQTT <!></label></div> <!>',1),OZ=B('<section id="sec-shedb" class="svelte-767znw"><h3 class="svelte-767znw">sheDB</h3> <div class="field field--check svelte-767znw"><label class="svelte-767znw">Enable <!></label> <label class="check-label svelte-767znw"><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> sheDB</label></div> <!></section>'),HZ=B('<section id="sec-redis" class="svelte-767znw"><h3 class="svelte-767znw">Redis</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Redis URL <!></label> <input type="text" placeholder="leave empty to disable" class="svelte-767znw"/></div></section>'),WZ=B('<section id="sec-logging" class="svelte-767znw"><h3 class="svelte-767znw">Logging</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Verbosity <!></label> <select class="svelte-767znw"><option>debug</option><option>info</option><option>warn</option><option>error</option></select></div></section>'),zZ=B('<span class="free-badge svelte-767znw">FREE</span> ',1),VZ=B('&nbsp;— <a target="_blank" rel="noreferrer" class="svelte-767znw">Get API key ↗</a>',1),jZ=B("<div><!> <!></div>"),$Z=B('<div class="field svelte-767znw"><label class="svelte-767znw">Base URL <!></label> <input type="text" class="svelte-767znw"/></div>'),UZ=B('<div class="field svelte-767znw"><label class="svelte-767znw">API key <!></label> <input type="password" placeholder="sk-…" autocomplete="off" class="svelte-767znw"/></div>'),qZ=B('<section id="sec-ai" class="svelte-767znw"><h3 class="svelte-767znw">AI Assistant</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Provider <!></label> <select class="svelte-767znw"></select></div> <!> <!> <div class="field svelte-767znw"><label class="svelte-767znw">Model <!></label> <input type="text" class="svelte-767znw"/></div> <!></section>'),GZ=B('<div class="config-form svelte-767znw"><!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!></div>'),KZ=B('<!> <div class="config-root svelte-767znw"><aside class="config-sidebar svelte-767znw"><div class="sidebar-search svelte-767znw"><svg class="search-icon svelte-767znw" width="13" height="13" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><circle cx="6.5" cy="6.5" r="4.5"></circle><line x1="10" y1="10" x2="14" y2="14"></line></svg> <input class="search-input svelte-767znw" type="search" placeholder="Filter settings…" autocomplete="off" spellcheck="false"/></div> <nav class="section-nav svelte-767znw"></nav></aside> <div class="config-main svelte-767znw"><div class="config-topbar svelte-767znw"><span class="topbar-title svelte-767znw">Settings</span> <!> <!> <button class="save-btn svelte-767znw"> </button></div> <!></div></div>',1);function ZZ(o,e){$s(e,!0),delete jf.Icon.Default.prototype._getIconUrl,jf.Icon.Default.mergeOptions({iconUrl:hZ,iconRetinaUrl:fZ,shadowUrl:gZ});let t=F(Li(I$())),i=F("~/.she"),n=F("mqtt"),s=F(""),r=F(""),a=F(""),d=F(""),u=F(""),f=F(""),g=F("logic"),p=F("var"),C=F(""),b=F(!1),y=F(!1),w=F(!1),A=F(!1),I=F(""),T=F(!1),R=F(8080),P=F(""),V=F("none"),j=F(""),J=F("X-Remote-User"),ae=F(""),fe=F(!1),X=F(""),ce=F(""),me=F(""),oe=F(!1),le=F(!1),Ae=F(!1),Te=F(""),xe=F(48.7408),Ne=F(9.1778),Ve=F(!1),ve=F(void 0),mt=F(!1),Mt=F(null),ot=F("info"),yt=F(!0),be=F(""),Nt=F(""),si=F(!1),Xe=F(!1),tt=F("");const wt=[{id:"ollama",label:"Ollama (local)",provider:"ollama",baseUrl:"",defaultModel:"",freeNote:"",apiKeyUrl:""},{id:"lmstudio",label:"LM Studio (local)",provider:"openai",baseUrl:"http://localhost:1234",defaultModel:"",freeNote:"",apiKeyUrl:""},{id:"groq",label:"Groq — Qwen 2.5 Coder 32B (free)",provider:"openai",baseUrl:"https://api.groq.com/openai/v1",defaultModel:"qwen-2.5-coder-32b",freeNote:"14 400 req/day · no credit card needed",apiKeyUrl:"https://console.groq.com/keys"},{id:"gemini",label:"Google Gemini 2.0 Flash (free)",provider:"openai",baseUrl:"https://generativelanguage.googleapis.com/v1beta/openai",defaultModel:"gemini-2.0-flash",freeNote:"15 RPM · 1 000 000 tokens/day · no credit card",apiKeyUrl:"https://aistudio.google.com/apikey"},{id:"openai",label:"OpenAI (paid)",provider:"openai",baseUrl:"",defaultModel:"gpt-4o-mini",freeNote:"",apiKeyUrl:"https://platform.openai.com/api-keys"},{id:"anthropic",label:"Anthropic (paid)",provider:"anthropic",baseUrl:"",defaultModel:"claude-3-5-haiku-20241022",freeNote:"",apiKeyUrl:"https://console.anthropic.com/settings/keys"}];let Yt=F("ollama"),fi=F("ollama"),oi=F(""),ki=F(""),_i=F("");const Ze={};let Ee="ollama";function ii(ie,Ye){return ie==="anthropic"?"anthropic":ie==="ollama"?"ollama":Ye?Ye.includes("localhost:1234")?"lmstudio":Ye.includes("groq.com")?"groq":Ye.includes("googleapis.com")?"gemini":"openai":"openai"}function Ci(){Ze[Ee]={baseUrl:c(oi),model:c(ki),apiKey:c(_i)};const ie=wt.find(kt=>kt.id===c(Yt));if(!ie)return;m(fi,ie.provider,!0);const Ye=Ze[c(Yt)];m(oi,(Ye==null?void 0:Ye.baseUrl)??ie.baseUrl,!0),m(ki,(Ye==null?void 0:Ye.model)??ie.defaultModel,!0),m(_i,(Ye==null?void 0:Ye.apiKey)??"",!0),Ee=c(Yt)}const Jt=Lt(()=>wt.find(ie=>ie.id===c(Yt)));let zi=F(Li({}));const Ji=new Set(["url","name","variablePrefix","disableVariables","mqttUsername","mqttPassword","mqttCa","mqttCert","mqttKey","mqttVersion","port","bindAddress","auth","password","proxyHeader","proxyLogoutUrl","dir","disableWatch","gitAutoCommit","gitAutoPush","latitude","longitude","timezone","verbosity","dbPath","dbPrefix","dbPublish","dbRetain","redis","ai","broker","matter-storage"]);Kn(()=>{if(!c(ve))return;const ie=typeof c(xe)=="number"?c(xe):48.7408,Ye=typeof c(Ne)=="number"?c(Ne):9.1778,kt=jf.map(c(ve)).setView([ie,Ye],10);jf.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'}).addTo(kt);const Pt=jf.marker([ie,Ye],{draggable:!0}).addTo(kt);m(Mt,Pt,!0);const Bt=Be=>{m(xe,+Be.lat.toFixed(6)),m(Ne,+Be.lng.toFixed(6))};return Pt.on("dragend",()=>Bt(Pt.getLatLng())),kt.on("click",Be=>{Pt.setLatLng(Be.latlng),Bt(Be.latlng)}),()=>{m(Mt,null),kt.remove()}}),Kn(()=>{!c(Mt)||c(xe)===""||c(Ne)===""||c(Mt).setLatLng([Number(c(xe)),Number(c(Ne))])});let Ii;function wn(){if(!navigator.geolocation){Ii.show("Geolocation is not supported by this browser.",{alert:!0});return}m(mt,!0),navigator.geolocation.getCurrentPosition(ie=>{m(xe,+ie.coords.latitude.toFixed(6)),m(Ne,+ie.coords.longitude.toFixed(6)),m(mt,!1)},()=>{m(mt,!1)})}let cn=F(!0),pn=F(!1),fn=F(""),pt=F(""),Ut=F(""),Ni=F("appearance");const qi=[{id:"appearance",label:"Appearance",terms:["theme","color","dark","light"]},{id:"auth",label:"Authentication",terms:["auth","password","login","proxy","header","nginx","authentik","secure"]},{id:"mqtt",label:"MQTT",terms:["broker","url","client","name","variable","prefix","protocol","version","mqtt5"]},{id:"broker",label:"Mosquitto",terms:["mosquitto","broker","mqtt broker","management","dynsec"]},{id:"matter",label:"Matter controller",terms:["matter","thread","zigbee","iot","devices","smart home controller"]},{id:"webserver",label:"Web server",terms:["port","http","server","bind","address"]},{id:"scripts",label:"Scripts",terms:["directory","watch","hot reload","dir"]},{id:"git",label:"Git",terms:["git","auto commit","auto push","commit","push","repository"]},{id:"solar",label:"Location",terms:["latitude","longitude","sunrise","sunset","geo","timezone","time zone","iana","schedule"]},{id:"shedb",label:"sheDB",terms:["database","db","shedb","path","retain","enable"]},{id:"redis",label:"Redis",terms:["redis","cache"]},{id:"logging",label:"Logging",terms:["verbosity","debug","info","warn","error"]},{id:"ai",label:"AI Assistant",terms:["llm","ollama","openai","anthropic","model","provider","base url"]}];let gi=Lt(()=>qi.filter(ie=>{const Ye=c(Ut).trim().toLowerCase();return!Ye||ie.label.toLowerCase().includes(Ye)||ie.terms.some(kt=>kt.includes(Ye))}));function Wi(ie){var Ye;m(Ni,ie,!0),(Ye=document.getElementById("sec-"+ie))==null||Ye.scrollIntoView({behavior:"smooth",block:"start"})}Xs(async()=>{try{const ie=await e0();ie.dataDir&&m(i,ie.dataDir,!0)}catch{}try{const ie=await Pl();if(typeof ie.url=="string"&&ie.url)try{const Be=new URL(ie.url);m(n,Be.protocol.replace(":",""),!0),m(s,Be.host,!0)}catch{m(s,ie.url,!0)}typeof ie.mqttUsername=="string"&&m(r,ie.mqttUsername,!0),typeof ie.mqttPassword=="string"&&m(a,ie.mqttPassword,!0),typeof ie.mqttCa=="string"&&m(d,ie.mqttCa,!0),typeof ie.mqttCert=="string"&&m(u,ie.mqttCert,!0),typeof ie.mqttKey=="string"&&m(f,ie.mqttKey,!0),typeof ie.mqttVersion=="string"&&m(C,ie.mqttVersion,!0),typeof ie.name=="string"&&m(g,ie.name,!0),typeof ie.variablePrefix=="string"&&m(p,ie.variablePrefix,!0),typeof ie.disableVariables=="boolean"&&m(b,ie.disableVariables,!0),typeof ie.port=="number"&&m(R,ie.port,!0),typeof ie.bindAddress=="string"&&m(P,ie.bindAddress,!0),typeof ie.auth=="string"&&m(V,ie.auth,!0),typeof ie.proxyHeader=="string"&&m(J,ie.proxyHeader,!0),typeof ie.proxyLogoutUrl=="string"&&m(ae,ie.proxyLogoutUrl,!0),typeof ie.dir=="string"&&m(me,ie.dir,!0),typeof ie.disableWatch=="boolean"&&m(oe,ie.disableWatch,!0),typeof ie.gitAutoCommit=="boolean"&&m(le,ie.gitAutoCommit,!0),typeof ie.gitAutoPush=="boolean"&&m(Ae,ie.gitAutoPush,!0),typeof ie.latitude=="number"&&m(xe,ie.latitude,!0),typeof ie.longitude=="number"&&m(Ne,ie.longitude,!0),typeof ie.timezone=="string"&&m(Te,ie.timezone,!0),typeof ie.verbosity=="string"&&m(ot,ie.verbosity,!0),typeof ie.dbPath=="string"?(m(yt,ie.dbPath!==""),m(be,ie.dbPath,!0)):(m(yt,!0),m(be,"")),typeof ie.dbPrefix=="string"&&m(Nt,ie.dbPrefix,!0),typeof ie.dbPublish=="boolean"&&m(si,ie.dbPublish,!0),typeof ie.dbRetain=="boolean"&&m(Xe,ie.dbRetain,!0);const Ye=ie.redis;Ye!=null&&Ye.url&&m(tt,Ye.url,!0);const kt=ie.broker;m(y,(kt==null?void 0:kt.enabled)===!0);const Pt=ie["matter-storage"];m(A,!!Pt),m(I,Pt&&typeof Pt=="string"&&Pt!=="true"?Pt:"",!0);const Bt=ie.ai;Bt!=null&&Bt.provider&&m(fi,Bt.provider,!0),Bt!=null&&Bt.baseUrl&&m(oi,Bt.baseUrl,!0),Bt!=null&&Bt.model&&m(ki,Bt.model,!0),Bt!=null&&Bt.apiKey&&m(_i,Bt.apiKey,!0),m(Yt,ii(c(fi),c(oi)),!0),Ee=c(Yt),m(zi,Object.fromEntries(Object.entries(ie).filter(([Be])=>!Ji.has(Be))),!0),kt&&m(zi,{...c(zi),broker:kt},!0)}catch(ie){m(pt,ie.message,!0)}finally{m(cn,!1)}});async function Ui(){if(m(ce,""),m(X,""),c(V)==="password"&&!c(j)){m(ce,"A password is required to enable password authentication.");return}m(fe,!0);try{await H$(c(V),c(V)==="password"?c(j):void 0,c(V)==="proxy"?c(J):void 0,c(V)==="proxy"?c(ae):void 0),m(j,""),m(X,"Authentication settings saved.")}catch(ie){m(ce,ie.message,!0)}finally{m(fe,!1)}}async function tn(ie){if(ie){m(yt,!0);return}let Ye=0;try{Ye=(await e0()).dbDocs??0}catch{}Ye>0&&!await Ii.show(`sheDB contains ${Ye} document${Ye===1?"":"s"}. Disabling it will hide the DB page but data on disk is preserved and can be re-enabled later. Continue?`,{confirm:"Disable anyway",danger:!0})||m(yt,!1)}async function yi(ie){if(ie){m(A,!0);return}m(T,!0);try{const Ye=await cS();if(Ye.length>0){await Ii.show(`Cannot disable the Matter controller: ${Ye.length} device${Ye.length===1?" is":"s are"} still paired. Unpair all devices first via the Matter page.`,{alert:!0});return}}catch{}finally{m(T,!1)}m(A,!1)}async function Vi(ie){var Ye;if(ie){m(y,!0);return}m(w,!0);try{const kt=await Pb();if((Ye=kt.dynsec)!=null&&Ye.configured){await Ii.show("Cannot disable mosquitto management: the dynamic security plugin is still configured. Remove it first via Broker → Status.",{alert:!0});return}if(kt.sshConfigured&&!await Ii.show("An SSH broker connection is configured. Disabling mosquitto management will hide the Broker page but your configuration will be preserved.",{confirm:"Disable anyway",danger:!0}))return}catch{}finally{m(w,!1)}m(y,!1)}async function ze(){m(pt,""),m(fn,"");const ie={...c(zi)};c(s)&&(ie.url=`${c(n)}://${c(s)}`),ie.name=c(g),ie.variablePrefix=c(p),c(C)&&(ie.mqttVersion=c(C)),c(b)&&(ie.disableVariables=!0),c(r)&&(ie.mqttUsername=c(r)),c(a)&&(ie.mqttPassword=c(a)),c(d)&&(ie.mqttCa=c(d)),c(u)&&(ie.mqttCert=c(u)),c(f)&&(ie.mqttKey=c(f)),c(R)!==""&&(ie.port=Number(c(R))),c(P)&&(ie.bindAddress=c(P)),c(me)&&(ie.dir=c(me)),c(oe)&&(ie.disableWatch=!0),c(le)&&(ie.gitAutoCommit=!0),c(Ae)&&(ie.gitAutoPush=!0),c(xe)!==""&&(ie.latitude=Number(c(xe))),c(Ne)!==""&&(ie.longitude=Number(c(Ne))),c(Te)&&(ie.timezone=c(Te)),ie.verbosity=c(ot),c(yt)?c(be)&&(ie.dbPath=c(be),c(Nt)&&(ie.dbPrefix=c(Nt)),c(si)&&(ie.dbPublish=!0,c(Xe)&&(ie.dbRetain=!0))):ie.dbPath="",c(tt)&&(ie.redis={url:c(tt)});const Ye=c(zi).broker??{},{enabled:kt,...Pt}=Ye;c(y)?ie.broker={...Pt,enabled:!0}:Object.keys(Pt).length>0&&(ie.broker=Pt),c(A)&&(ie["matter-storage"]=c(I)||!0),c(fi)&&(ie.ai={provider:c(fi),...c(oi)?{baseUrl:c(oi)}:{},...c(ki)?{model:c(ki)}:{},...c(_i)?{apiKey:c(_i)}:{}}),m(pn,!0);try{const Bt=await pp(ie);window.dispatchEvent(new CustomEvent("she:config-changed")),m(fn,Bt.restartRequired?"Saved — restart required to apply changes.":"Saved.",!0)}catch(Bt){m(pt,Bt.message,!0)}finally{m(pn,!1)}}var qt=KZ(),wi=Et(qt);gs(Yc(wi,{}),ie=>Ii=ie,()=>Ii);var ji=v(wi,2),Si=_(ji),K=_(Si),De=v(_(K),2),Qe=v(K,2);ti(Qe,21,()=>qi,ie=>ie.id,(ie,Ye)=>{var kt=Ss(),Pt=Et(kt);{var Bt=je=>{var Kt=xZ();let ri;var ui=_(Kt);z(()=>{ri=At(Kt,1,"section-link svelte-767znw",null,ri,{active:c(Ni)===c(Ye).id}),W(ui,c(Ye).label)}),$("click",Kt,()=>Wi(c(Ye).id)),D(je,Kt)},Be=Lt(()=>c(gi).some(je=>je.id===c(Ye).id));H(Pt,je=>{c(Be)&&je(Bt)})}D(ie,kt)});var it=v(Si,2),Gt=_(it),li=v(_(Gt),2);{var vt=ie=>{var Ye=mZ(),kt=_(Ye);z(()=>W(kt,c(pt))),D(ie,Ye)};H(li,ie=>{c(pt)&&ie(vt)})}var ft=v(li,2);{var Y=ie=>{var Ye=vZ(),kt=_(Ye);z(()=>W(kt,c(fn))),D(ie,Ye)};H(ft,ie=>{c(fn)&&ie(Y)})}var Re=v(ft,2),dt=_(Re),ye=v(Gt,2);{var ci=ie=>{var Ye=_Z();D(ie,Ye)},It=ie=>{var Ye=GZ(),kt=_(Ye);{var Pt=ue=>{var He=bZ(),Fe=v(_(He),2),Je=v(_(Fe),2),ht=_(Je);ht.value=ht.__value="dark";var Ke=v(ht);Ke.value=Ke.__value="light";var et=v(Ke);et.value=et.__value="system",$("change",Je,()=>P$(c(t))),Ls(Je,()=>c(t),ge=>m(t,ge)),D(ue,He)},Bt=Lt(()=>c(gi).some(ue=>ue.id==="appearance"));H(kt,ue=>{c(Bt)&&ue(Pt)})}var Be=v(kt,2);{var je=ue=>{var He=SZ(),Fe=v(_(He),2),Je=_(Fe),ht=v(_(Je));On(ht,()=>"none: no authentication required. password: single-user password login. proxy: trust a header set by nginx/authentik.");var Ke=v(Je,2),et=_(Ke);et.value=et.__value="none";var ge=v(et);ge.value=ge.__value="password";var $e=v(ge);$e.value=$e.__value="proxy";var _t=v(Fe,2);{var Wt=Zt=>{var hi=CZ(),nn=_(hi),dn=_(nn),Ln=v(dn);On(Ln,()=>"Set a new password. Leave empty to keep the current password (if already set).");var Oi=v(nn,2);z(()=>W(dn,`${c(j)?"New password":"Password"} `)),zt(Oi,()=>c(j),Dn=>m(j,Dn)),D(Zt,hi)};H(_t,Zt=>{c(V)==="password"&&Zt(Wt)})}var bt=v(_t,2);{var pi=Zt=>{var hi=EZ(),nn=Et(hi),dn=_(nn),Ln=v(_(dn));On(Ln,()=>"The HTTP header that nginx/authentik sets after successful authentication. Default: X-Remote-User");var Oi=v(dn,2),Dn=v(nn,2),Jn=_(Dn),In=v(_(Jn));On(In,()=>"URL to redirect to when the user clicks Logout (e.g. https://auth.example.com/application/o/she/end-session/ for Authentik). Leave empty to do nothing on logout.");var es=v(Jn,2);zt(Oi,()=>c(J),Zi=>m(J,Zi)),zt(es,()=>c(ae),Zi=>m(ae,Zi)),D(Zt,hi)};H(bt,Zt=>{c(V)==="proxy"&&Zt(pi)})}var Di=v(bt,2);{var Xi=Zt=>{var hi=yZ(),nn=_(hi);z(()=>W(nn,c(ce))),D(Zt,hi)};H(Di,Zt=>{c(ce)&&Zt(Xi)})}var Mi=v(Di,2);{var ai=Zt=>{var hi=wZ(),nn=_(hi);z(()=>W(nn,c(X))),D(Zt,hi)};H(Mi,Zt=>{c(X)&&Zt(ai)})}var Ht=v(Mi,2),Dt=v(_(Ht),2),jt=_(Dt);z(()=>{Dt.disabled=c(fe)||c(V)==="password"&&!c(j),W(jt,c(fe)?"Saving…":"Apply authentication settings")}),Ls(Ke,()=>c(V),Zt=>m(V,Zt)),$("click",Dt,Ui),D(ue,He)},Kt=Lt(()=>c(gi).some(ue=>ue.id==="auth"));H(Be,ue=>{c(Kt)&&ue(je)})}var ri=v(Be,2);{var ui=ue=>{var He=AZ(),Fe=v(_(He),2),Je=_(Fe),ht=v(_(Je));On(ht,()=>"Transport protocol. Use mqtts or wss for TLS encryption.");var Ke=v(Je,2),et=_(Ke);et.value=et.__value="mqtt";var ge=v(et);ge.value=ge.__value="mqtts";var $e=v(ge);$e.value=$e.__value="ws";var _t=v($e);_t.value=_t.__value="wss";var Wt=v(Fe,2),bt=_(Wt),pi=v(_(bt));On(pi,()=>"Hostname and optional port of the MQTT broker. Example: 192.168.1.1:1883. Leave empty to run without MQTT.");var Di=v(bt,2),Xi=v(Wt,2),Mi=_(Xi),ai=v(_(Mi));On(ai,()=>"MQTT broker username. Leave empty if the broker does not require authentication.");var Ht=v(Mi,2),Dt=v(Xi,2),jt=_(Dt),Zt=v(_(jt));On(Zt,()=>"MQTT broker password. Stored in plain text in config.json.");var hi=v(jt,2),nn=v(Dt,2);{var dn=Ps=>{var ao=DZ(),ah=Et(ao),Vl=_(ah),nr=v(_(Vl));On(nr,()=>"PEM-encoded CA certificate to verify the broker's TLS certificate. Leave empty to use the system's default CA store.");var Jc=v(Vl,2),jl=v(ah,2),Ya=_(jl),Cf=v(_(Ya));On(Cf,()=>"PEM-encoded client certificate for mutual TLS authentication.");var ed=v(Ya,2),lh=v(jl,2),td=_(lh),id=v(_(td));On(id,()=>"PEM-encoded private key matching the client certificate.");var $l=v(td,2);zt(Jc,()=>c(d),pa=>m(d,pa)),zt(ed,()=>c(u),pa=>m(u,pa)),zt($l,()=>c(f),pa=>m(f,pa)),D(Ps,ao)};H(nn,Ps=>{(c(n)==="mqtts"||c(n)==="wss")&&Ps(dn)})}var Ln=v(nn,2),Oi=_(Ln),Dn=v(_(Oi));On(Dn,()=>"MQTT protocol version used when connecting to the broker. Choose 5 only if your broker supports MQTT 5.0. Default: 3.1.1 (mqtt.js default).");var Jn=v(Oi,2),In=_(Jn);In.value=In.__value="";var es=v(In);es.value=es.__value="5";var Zi=v(Ln,2),Is=_(Zi),Tn=v(_(Is));On(Tn,()=>'MQTT client ID and topic prefix used for the "connected" status message. Default: she');var Gn=v(Is,2),vs=v(Zi,2),ir=_(vs),zr=v(_(ir));On(zr,()=>"Topic prefix for the variable system (var/set/name → var/status/name). Default: var");var Xa=v(ir,2),zl=v(vs,2),pr=v(_(zl),2),Vr=_(pr),Qc=v(Vr,4);On(Qc,()=>"When enabled, var/set/… messages are not processed and no var/status/… retained messages are published."),Ls(Ke,()=>c(n),Ps=>m(n,Ps)),zt(Di,()=>c(s),Ps=>m(s,Ps)),zt(Ht,()=>c(r),Ps=>m(r,Ps)),zt(hi,()=>c(a),Ps=>m(a,Ps)),Ls(Jn,()=>c(C),Ps=>m(C,Ps)),zt(Gn,()=>c(g),Ps=>m(g,Ps)),zt(Xa,()=>c(p),Ps=>m(p,Ps)),ws(Vr,()=>c(b),Ps=>m(b,Ps)),D(ue,He)},Xt=Lt(()=>c(gi).some(ue=>ue.id==="mqtt"));H(ri,ue=>{c(Xt)&&ue(ui)})}var pe=v(ri,2);{var Ge=ue=>{var He=kZ(),Fe=v(_(He),2),Je=_(Fe),ht=v(_(Je));On(ht,()=>"Shows the Broker page in the navigation, giving access to listener config, dynamic security, TLS certificates and more. Disable if you are not using Mosquitto or prefer to manage it externally.");var Ke=v(Je,2);let et;var ge=_(Ke),$e=v(ge,4);{var _t=Wt=>{var bt=oo("— checking…");D(Wt,bt)};H($e,Wt=>{c(w)&&Wt(_t)})}z(()=>{et=At(Ke,1,"check-label svelte-767znw",null,et,{muted:c(w)}),Zo(ge,c(y)),ge.disabled=c(w)}),$("change",ge,Wt=>Vi(Wt.target.checked)),D(ue,He)},rt=Lt(()=>c(gi).some(ue=>ue.id==="broker"));H(pe,ue=>{c(rt)&&ue(Ge)})}var lt=v(pe,2);{var Vt=ue=>{var He=FZ(),Fe=v(_(He),2),Je=_(Fe),ht=v(_(Je));On(ht,()=>"Shows the Matter page and starts the built-in Matter controller on next restart. Requires a restart to take effect. Disable only after unpairing all devices.");var Ke=v(Je,2);let et;var ge=_(Ke),$e=v(ge,4);{var _t=pi=>{var Di=oo("— checking…");D(pi,Di)};H($e,pi=>{c(T)&&pi(_t)})}var Wt=v(Fe,2);{var bt=pi=>{var Di=BZ(),Xi=_(Di),Mi=v(_(Xi));On(Mi,()=>"Path to the Matter controller storage directory. Leave empty to use the default ({dataDir}/matter).");var ai=v(Xi,2);z(()=>ln(ai,"placeholder",`${c(i)??""}/matter (default)`)),zt(ai,()=>c(I),Ht=>m(I,Ht)),D(pi,Di)};H(Wt,pi=>{c(A)&&pi(bt)})}z(()=>{et=At(Ke,1,"check-label svelte-767znw",null,et,{muted:c(T)}),Zo(ge,c(A)),ge.disabled=c(T)}),$("change",ge,pi=>yi(pi.target.checked)),D(ue,He)},Ot=Lt(()=>c(gi).some(ue=>ue.id==="matter"));H(lt,ue=>{c(Ot)&&ue(Vt)})}var bi=v(lt,2);{var U=ue=>{var He=LZ(),Fe=v(_(He),2),Je=_(Fe),ht=v(_(Je));On(ht,()=>"HTTP server port. Use 0 to let the OS pick a free port. Default: 8080");var Ke=v(Je,2),et=v(Fe,2),ge=_(et),$e=v(_(ge));On($e,()=>"Interface she listens on. Use 127.0.0.1 when running behind nginx (recommended with proxy auth). Default: 0.0.0.0");var _t=v(ge,2);zt(Ke,()=>c(R),Wt=>m(R,Wt)),zt(_t,()=>c(P),Wt=>m(P,Wt)),D(ue,He)},M=Lt(()=>c(gi).some(ue=>ue.id==="webserver"));H(bi,ue=>{c(M)&&ue(U)})}var O=v(bi,2);{var ee=ue=>{var He=IZ(),Fe=v(_(He),2),Je=_(Fe),ht=v(_(Je));On(ht,()=>"Directory that is watched for .js script files. Defaults to {dataDir}/scripts");var Ke=v(Je,2),et=v(Fe,2),ge=v(_(et),2),$e=_(ge),_t=v($e,4);On(_t,()=>"When enabled the daemon will not watch for file changes and will not hot-reload scripts."),z(()=>ln(Ke,"placeholder",`${c(i)??""}/scripts (default)`)),zt(Ke,()=>c(me),Wt=>m(me,Wt)),ws($e,()=>c(oe),Wt=>m(oe,Wt)),D(ue,He)},ne=Lt(()=>c(gi).some(ue=>ue.id==="scripts"));H(O,ue=>{c(ne)&&ue(ee)})}var se=v(O,2);{var re=ue=>{var He=PZ(),Fe=v(_(He),2),Je=v(_(Fe),2),ht=_(Je),Ke=v(ht,4);On(Ke,()=>"When enabled, saving or renaming/deleting a script automatically creates a git commit. Only effective when the scripts directory is inside a git repository.");var et=v(Fe,2),ge=v(_(et),2),$e=_(ge),_t=v($e,4);On(_t,()=>"When enabled, every commit (manual or automatic) is immediately pushed to the remote."),ws(ht,()=>c(le),Wt=>m(le,Wt)),ws($e,()=>c(Ae),Wt=>m(Ae,Wt)),D(ue,He)},Ie=Lt(()=>c(gi).some(ue=>ue.id==="git"));H(se,ue=>{c(Ie)&&ue(re)})}var We=v(se,2);{var Ce=ue=>{var He=MZ(),Fe=v(_(He),2),Je=_(Fe),ht=v(_(Je));On(ht,()=>"IANA timezone for cron scheduling (e.g. Europe/Berlin). Leave empty to use the system timezone. Requires daemon restart.");var Ke=v(Je,2),et=v(Ke,2);ti(et,20,()=>{var Oi;return((Oi=Intl.supportedValuesOf)==null?void 0:Oi.call(Intl,"timeZone"))??[]},Hi,(Oi,Dn)=>{var Jn=N2(),In=_(Jn),es={};z(()=>{W(In,Dn),es!==(es=Dn)&&(Jn.value=(Jn.__value=Dn)??"")}),D(Oi,Jn)});var ge=v(Fe,2),$e=_(ge),_t=v(_($e));On(_t,()=>"Geographic latitude used for sunrise/sunset calculations. Default: 48.7408 (Stuttgart)");var Wt=v($e,2),bt=v(ge,2),pi=_(bt),Di=v(_(pi));On(Di,()=>"Geographic longitude used for sunrise/sunset calculations. Default: 9.1778 (Stuttgart)");var Xi=v(pi,2),Mi=v(bt,2),ai=v(_(Mi),2),Ht=_(ai),Dt=_(Ht);{var jt=Oi=>{var Dn=oo("…");D(Oi,Dn)},Zt=Oi=>{var Dn=oo("📍 Use my location");D(Oi,Dn)};H(Dt,Oi=>{c(mt)?Oi(jt):Oi(Zt,-1)})}var hi=v(Ht,2),nn=_(hi),dn=v(Mi,2);{var Ln=Oi=>{var Dn=TZ(),Jn=v(_(Dn),2);gs(Jn,In=>m(ve,In),()=>c(ve)),D(Oi,Dn)};H(dn,Oi=>{c(Ve)&&Oi(Ln)})}z(()=>{Ht.disabled=c(mt),W(nn,c(Ve)?"Hide map":"Pick on map")}),zt(Ke,()=>c(Te),Oi=>m(Te,Oi)),zt(Wt,()=>c(xe),Oi=>m(xe,Oi)),zt(Xi,()=>c(Ne),Oi=>m(Ne,Oi)),$("click",Ht,wn),$("click",hi,()=>m(Ve,!c(Ve))),D(ue,He)},Pe=Lt(()=>c(gi).some(ue=>ue.id==="solar"));H(We,ue=>{c(Pe)&&ue(Ce)})}var Me=v(We,2);{var at=ue=>{var He=OZ(),Fe=v(_(He),2),Je=_(Fe),ht=v(_(Je));On(ht,()=>"Built-in JSON document store used by scripts and the DB page. Disable only if you don't use it — data on disk is preserved.");var Ke=v(Je,2),et=_(Ke),ge=v(Fe,2);{var $e=_t=>{var Wt=NZ(),bt=Et(Wt),pi=_(bt),Di=v(_(pi));On(Di,()=>"Path to the sheDB data directory. Defaults to {dataDir}/db. Leave empty to use the default.");var Xi=v(pi,2),Mi=v(bt,2),ai=_(Mi),Ht=v(_(ai));On(Ht,()=>"Prefix for all sheDB MQTT topics. Defaults to she/db/ — documents publish to {prefix}doc/{id}, views to {prefix}view/{id}, commands use {prefix}set/{id} etc.");var Dt=v(ai,2),jt=v(Mi,2),Zt=v(_(jt),2),hi=_(Zt),nn=v(hi,4);On(nn,()=>'When enabled, every document change is published to {dbPrefix}doc/{id}. Individual views can publish independently via their own "mqttpub" setting.');var dn=v(jt,2);{var Ln=Oi=>{var Dn=RZ(),Jn=v(_(Dn),2),In=_(Jn),es=v(In,4);On(es,()=>"When enabled, MQTT messages for document changes are published as retained messages."),ws(In,()=>c(Xe),Zi=>m(Xe,Zi)),D(Oi,Dn)};H(dn,Oi=>{c(si)&&Oi(Ln)})}z(()=>ln(Xi,"placeholder",`defaults to ${c(i)??""}/db`)),zt(Xi,()=>c(be),Oi=>m(be,Oi)),zt(Dt,()=>c(Nt),Oi=>m(Nt,Oi)),ws(hi,()=>c(si),Oi=>m(si,Oi)),D(_t,Wt)};H(ge,_t=>{c(yt)&&_t($e)})}z(()=>Zo(et,c(yt))),$("change",et,_t=>tn(_t.target.checked)),D(ue,He)},Qt=Lt(()=>c(gi).some(ue=>ue.id==="shedb"));H(Me,ue=>{c(Qt)&&ue(at)})}var Z=v(Me,2);{var de=ue=>{var He=HZ(),Fe=v(_(He),2),Je=_(Fe),ht=v(_(Je));On(ht,()=>"redis:// URL for the optional Redis write-through cache. All state store changes are written to the she:state hash. Leave empty to disable.");var Ke=v(Je,2);zt(Ke,()=>c(tt),et=>m(tt,et)),D(ue,He)},Ue=Lt(()=>c(gi).some(ue=>ue.id==="redis"));H(Z,ue=>{c(Ue)&&ue(de)})}var Ft=v(Z,2);{var we=ue=>{var He=WZ(),Fe=v(_(He),2),Je=_(Fe),ht=v(_(Je));On(ht,()=>"Minimum log level. debug shows all messages including MQTT traffic details.");var Ke=v(Je,2),et=_(Ke);et.value=et.__value="debug";var ge=v(et);ge.value=ge.__value="info";var $e=v(ge);$e.value=$e.__value="warn";var _t=v($e);_t.value=_t.__value="error",Ls(Ke,()=>c(ot),Wt=>m(ot,Wt)),D(ue,He)},Oe=Lt(()=>c(gi).some(ue=>ue.id==="logging"));H(Ft,ue=>{c(Oe)&&ue(we)})}var St=v(Ft,2);{var ut=ue=>{var He=qZ(),Fe=v(_(He),2),Je=_(Fe),ht=v(_(Je));On(ht,()=>"Choose a provider. Free options need a free API key from the provider's website — no credit card required.");var Ke=v(Je,2);ti(Ke,21,()=>wt,Hi,(ai,Ht)=>{var Dt=N2(),jt=_(Dt),Zt={};z(()=>{W(jt,c(Ht).label),Zt!==(Zt=c(Ht).id)&&(Dt.value=(Dt.__value=c(Ht).id)??"")}),D(ai,Dt)});var et=v(Fe,2);{var ge=ai=>{var Ht=jZ();let Dt;var jt=_(Ht);{var Zt=dn=>{var Ln=zZ(),Oi=v(Et(Ln));z(()=>W(Oi,` ${c(Jt).freeNote??""}`)),D(dn,Ln)};H(jt,dn=>{c(Jt).freeNote&&dn(Zt)})}var hi=v(jt,2);{var nn=dn=>{var Ln=VZ(),Oi=v(Et(Ln));z(()=>ln(Oi,"href",c(Jt).apiKeyUrl)),D(dn,Ln)};H(hi,dn=>{c(Jt).apiKeyUrl&&dn(nn)})}z(()=>Dt=At(Ht,1,"preset-note svelte-767znw",null,Dt,{free:!!c(Jt).freeNote})),D(ai,Ht)};H(et,ai=>{var Ht,Dt;((Ht=c(Jt))!=null&&Ht.freeNote||(Dt=c(Jt))!=null&&Dt.apiKeyUrl)&&ai(ge)})}var $e=v(et,2);{var _t=ai=>{var Ht=$Z(),Dt=_(Ht),jt=v(_(Dt));On(jt,()=>"Base URL of the LLM API. Auto-filled for cloud presets. For Ollama: http://localhost:11434.");var Zt=v(Dt,2);z(()=>{var hi;return ln(Zt,"placeholder",c(Yt)==="ollama"?"http://localhost:11434":c(Yt)==="lmstudio"?"http://localhost:1234":((hi=c(Jt))==null?void 0:hi.baseUrl)??"")}),zt(Zt,()=>c(oi),hi=>m(oi,hi)),D(ai,Ht)};H($e,ai=>{c(Yt)!=="anthropic"&&ai(_t)})}var Wt=v($e,2),bt=_(Wt),pi=v(_(bt));On(pi,()=>"Model identifier. Suggested default is filled in when you choose a preset.");var Di=v(bt,2),Xi=v(Wt,2);{var Mi=ai=>{var Ht=UZ(),Dt=_(Ht),jt=v(_(Dt));On(jt,()=>"Stored in config.json. Not needed for local providers.");var Zt=v(Dt,2);zt(Zt,()=>c(_i),hi=>m(_i,hi)),D(ai,Ht)};H(Xi,ai=>{c(Yt)!=="ollama"&&c(Yt)!=="lmstudio"&&ai(Mi)})}z(()=>{var ai;return ln(Di,"placeholder",((ai=c(Jt))==null?void 0:ai.defaultModel)||"e.g. llama3.2")}),$("change",Ke,Ci),Ls(Ke,()=>c(Yt),ai=>m(Yt,ai)),zt(Di,()=>c(ki),ai=>m(ki,ai)),D(ue,He)},nt=Lt(()=>c(gi).some(ue=>ue.id==="ai"));H(St,ue=>{c(nt)&&ue(ut)})}D(ie,Ye)};H(ye,ie=>{c(cn)?ie(ci):ie(It,-1)})}z(()=>{Re.disabled=c(pn),W(dt,c(pn)?"Saving…":"Save")}),zt(De,()=>c(Ut),ie=>m(Ut,ie)),$("click",Re,ze),D(o,qt),Us()}Ys(["click","change"]);var XZ=B('<span class="history-loading svelte-18loop9" title="Loading log history…">↺</span>'),YZ=B("<option> </option>"),QZ=B('<div><span class="ts svelte-18loop9"> </span> <span class="lvl svelte-18loop9"> </span> <span class="msg svelte-18loop9"> </span></div>'),JZ=B('<div class="page svelte-18loop9"><div class="toolbar svelte-18loop9"><h2 class="svelte-18loop9">Logs</h2> <!> <select class="svelte-18loop9"></select> <input class="filter-in svelte-18loop9" type="search" placeholder="Filter messages…"/> <label class="check-label svelte-18loop9" title="Interpret filter as a regular expression"><input type="checkbox" class="svelte-18loop9"/> <span class="checkmark svelte-18loop9"></span> Regex</label> <label class="check-label svelte-18loop9"><input type="checkbox" class="svelte-18loop9"/> <span class="checkmark svelte-18loop9"></span> Auto-scroll</label> <button class="svelte-18loop9">Clear</button></div> <div class="log svelte-18loop9"></div></div>');function eX(o,e){$s(e,!0);const t=2e3;let i=F(Li(kF())),n=F(!0),s,r=F(!0),a=F("all"),d=F(""),u=F(!1);const f=["all","debug","info","warn","error"],g={debug:0,info:1,warn:2,error:3};hS(X=>{m(i,[...c(i).slice(-1999),X],!0)}),Xs(async()=>{try{const X=await fetch("/she/logs/history");if(X.ok){const ce=await X.json(),me=new Set(c(i).map(le=>le.ts+le.msg)),oe=ce.filter(le=>!me.has(le.ts+le.msg));m(i,[...oe,...c(i)].slice(-t),!0)}}catch{}m(n,!1),s&&(s.scrollTop=s.scrollHeight)}),Kn(()=>{c(i).length,c(r)&&s&&(s.scrollTop=s.scrollHeight)});function p(){m(i,[],!0)}function C(X){if(c(a)!=="all"&&g[X.level]<g[c(a)])return!1;if(!c(d))return!0;if(c(u))try{return new RegExp(c(d),"i").test(X.msg)}catch{}return X.msg.toLowerCase().includes(c(d).toLowerCase())}function b(X){return new Date(X).toLocaleTimeString()}var y=JZ(),w=_(y),A=v(_(w),2);{var I=X=>{var ce=XZ();D(X,ce)};H(A,X=>{c(n)&&X(I)})}var T=v(A,2);ti(T,21,()=>f,Hi,(X,ce)=>{var me=YZ(),oe=_(me),le={};z(()=>{W(oe,c(ce)),le!==(le=c(ce))&&(me.value=(me.__value=c(ce))??"")}),D(X,me)});var R=v(T,2),P=v(R,2),V=_(P),j=v(P,2),J=_(j),ae=v(j,2),fe=v(w,2);ti(fe,21,()=>c(i).filter(C),X=>X.ts+X.msg,(X,ce)=>{var me=QZ(),oe=_(me),le=_(oe),Ae=v(oe,2),Te=_(Ae),xe=v(Ae,2),Ne=_(xe);z((Ve,ve)=>{At(me,1,`line ${c(ce).level??""}`,"svelte-18loop9"),W(le,Ve),W(Te,ve),W(Ne,c(ce).msg)},[()=>b(c(ce).ts),()=>c(ce).level.toUpperCase()]),D(X,me)}),gs(fe,X=>s=X,()=>s),Ls(T,()=>c(a),X=>m(a,X)),zt(R,()=>c(d),X=>m(d,X)),ws(V,()=>c(u),X=>m(u,X)),ws(J,()=>c(r),X=>m(r,X)),$("click",ae,p),D(o,y),Us()}Ys(["click"]);var tX=B('<span class="chat-model svelte-1twuiul"><!></span>'),iX=B('<button class="clear-btn svelte-1twuiul" title="Clear conversation">✕</button>'),nX=B('<div class="unconfigured svelte-1twuiul">Configure an AI provider in the <strong class="svelte-1twuiul">Config</strong> tab to use the AI assistant.</div>'),sX=B('Working on view <code class="svelte-1twuiul"> </code>',1),oX=B('<button class="chip svelte-1twuiul"> </button>'),rX=B('<div class="suggestions svelte-1twuiul"><p class="suggestions-hint svelte-1twuiul"><!></p> <!></div>'),aX=B('<div class="msg-content user-text svelte-1twuiul"> </div>'),O2=B('<div class="tool-event tool-call svelte-1twuiul"><span class="tool-icon svelte-1twuiul">🔧</span><span class="tool-name svelte-1twuiul"> </span></div>'),H2=B('<div class="tool-event tool-result svelte-1twuiul"><span class="tool-icon svelte-1twuiul">✓</span><span class="tool-name svelte-1twuiul"> </span></div>'),W2=B('<div class="tool-events svelte-1twuiul"></div>'),z2=B('<div class="text-block svelte-1twuiul"></div>'),lX=B('<button class="expand-btn svelte-1twuiul"> </button>'),cX=B('<div class="code-block svelte-1twuiul"><div class="code-header svelte-1twuiul"><span class="code-lang svelte-1twuiul"> </span> <div class="code-actions svelte-1twuiul"><button class="svelte-1twuiul">Copy</button></div></div> <div><pre class="svelte-1twuiul"><code class="hljs svelte-1twuiul"></code></pre> <!></div></div>'),dX=B('<div class="apply-view-row svelte-1twuiul"><button class="apply-view-btn svelte-1twuiul"> </button></div>'),uX=B('<!> <div class="msg-content svelte-1twuiul"><!> <!></div>',1),hX=B("<div><!></div>"),fX=B('<div class="message assistant svelte-1twuiul"><div class="msg-content svelte-1twuiul"><span class="status-shimmer svelte-1twuiul"> </span></div></div>'),gX=B('<div class="code-block svelte-1twuiul"><div class="code-header svelte-1twuiul"><span class="code-lang svelte-1twuiul"> </span></div> <pre class="svelte-1twuiul"><code class="hljs svelte-1twuiul"></code></pre></div>'),pX=B('<div class="message assistant streaming svelte-1twuiul"><div class="msg-content svelte-1twuiul"></div></div>'),xX=B('<div class="chat-error svelte-1twuiul"> </div>'),mX=B('<span><span class="badge badge-db svelte-1twuiul">db</span> <span class="chip-name svelte-1twuiul"> </span> <button class="chip-remove svelte-1twuiul"> </button></span>'),vX=B('<span class="file-chip svelte-1twuiul"><span> </span> <span class="chip-name svelte-1twuiul"> </span> <button class="chip-remove svelte-1twuiul" title="Remove from context">×</button></span>'),_X=B('<button class="stop-btn svelte-1twuiul" title="Stop generation">■</button>'),bX=B('<button class="send-btn svelte-1twuiul">↑</button>'),CX=B('<option class="svelte-1twuiul"> </option>'),EX=B('<select class="model-select svelte-1twuiul"></select>'),yX=B('<span class="model-name svelte-1twuiul"> </span>'),wX=B('<button class="info-btn svelte-1twuiul" title="Model info">ℹ</button>'),SX=B('<div class="model-bar svelte-1twuiul"><span class="model-provider svelte-1twuiul"> </span> <!> <!></div>'),DX=B('<p class="info-status svelte-1twuiul">Loading…</p>'),AX=B('<p class="info-status info-err svelte-1twuiul"> </p>'),kX=B('<dt class="svelte-1twuiul">Ollama version</dt><dd class="svelte-1twuiul"> </dd>',1),BX=B('<dt class="svelte-1twuiul">Family</dt><dd class="svelte-1twuiul"> </dd>',1),FX=B('<dt class="svelte-1twuiul">Parameters</dt><dd class="svelte-1twuiul"> </dd>',1),LX=B('<dt class="svelte-1twuiul">Quantization</dt><dd class="svelte-1twuiul"> </dd>',1),IX=B('<div class="running-model svelte-1twuiul"> </div>'),PX=B('<dt class="svelte-1twuiul">Loaded</dt> <dd class="svelte-1twuiul"></dd>',1),TX=B('<dt class="svelte-1twuiul">Loaded</dt><dd class="dim svelte-1twuiul">Not in memory</dd>',1),MX=B('<dl class="svelte-1twuiul"><!> <!> <!> <!> <!></dl>'),RX=B('<div class="info-overlay svelte-1twuiul"><div class="info-popup svelte-1twuiul"><div class="info-popup-header svelte-1twuiul"><span class="svelte-1twuiul"> </span> <button title="Close" class="svelte-1twuiul">✕</button></div> <div class="info-popup-body svelte-1twuiul"><!></div></div></div>'),NX=B('<div class="chat-panel svelte-1twuiul"><div class="chat-header svelte-1twuiul"><span class="chat-title svelte-1twuiul">AI — View assistant</span> <!> <!></div> <div class="messages svelte-1twuiul"><!> <!> <!> <!> <!></div> <!> <div class="context-row svelte-1twuiul"><label title="Include sheDB document IDs in context" class="svelte-1twuiul"><input type="checkbox" class="svelte-1twuiul"/><span class="checkmark svelte-1twuiul"></span> Doc IDs</label> <label title="Include sample document content in context (first 10 docs)" class="svelte-1twuiul"><input type="checkbox" class="svelte-1twuiul"/><span class="checkmark svelte-1twuiul"></span> Sample docs</label> <label title="Let the AI query sheDB documents on demand. Disables real-time streaming." class="svelte-1twuiul"><input type="checkbox" class="svelte-1twuiul"/><span class="checkmark svelte-1twuiul"></span> 😎 Agent</label> <span class="req-size svelte-1twuiul"> </span></div> <div class="files-row svelte-1twuiul"><!> <!> <button class="add-file-btn svelte-1twuiul" title="Attach file to context">+</button> <input type="file" multiple="" class="file-input-hidden svelte-1twuiul"/></div> <div><div><textarea rows="3" class="svelte-1twuiul"></textarea></div> <!></div> <!></div> <!>',1);function OX(o,e){$s(e,!0),zv.registerLanguage("javascript",PF),os.use({breaks:!0,gfm:!0});let t=Tu(e,"currentView",3,null);const i="she:viewchat:messages";let n=F(Li(JSON.parse(localStorage.getItem(i)??"[]"))),s=F(null),r=F(""),a=F(!1),d=F(""),u=F(null),f=F(Li([])),g=F(Li(localStorage.getItem("she:selectedModel")??""));Kn(()=>{localStorage.setItem(i,JSON.stringify(c(n)))});let p=F(Li(new Set)),C=F(!1),b=F(null),y=F(!1),w=F(""),A=null,I=F(0);const T=["[core] reticulating splines…","[io] calibrating the flux capacitor…","[net] pinging the oracle (no response)…","[gpu] overclocking the neurons…","[fs] loading sarcasm module v4.2…","[mem] defragmenting the embedding space…","[sched] running gradient descent into madness…","[net] synchronizing with the hive mind…","[model] tickling the transformer…","[io] consulting rubber duck debugger…"];let R=F(!0),P=F(!0),V=F(!0),j=F(Li([])),J=F(!0),ae=F(!1),fe,X=F(Li([])),ce=F(0),me,oe;const le=Lt(()=>({apiref:!1,shedb:c(R),sampleDocs:c(P),tools:c(V)})),Ae=Lt(()=>{var U;return((U=c(u))==null?void 0:U.configured)??!1}),Te=Lt(()=>c(ce)+new TextEncoder().encode(c(r)).length),xe=Lt(()=>c(J)?t():null);async function Ne(){try{const U=await CF();m(u,U,!0),U.configured&&!c(g)&&m(g,U.model,!0)}catch{}}Kn(()=>(window.addEventListener("she:config-changed",Ne),()=>window.removeEventListener("she:config-changed",Ne))),Xs(()=>{Ne()}),Kn(()=>{c(g)&&localStorage.setItem("she:selectedModel",c(g))}),Kn(()=>{var U;(U=c(u))!=null&&U.provider&&EF().then(M=>{m(f,M.models,!0),!c(g)&&M.models.length>0&&m(g,M.models[0],!0)}).catch(()=>{})}),Kn(()=>{c(g),m(b,null),m(w,"")}),Kn(()=>{const U=c(le),M=c(xe),O=c(j);c(Ae)&&yF({context:U,currentView:M??null,extraFiles:O.length>0?O:void 0}).then(ee=>{m(ce,new TextEncoder().encode(ee.prompt).length,!0)}).catch(()=>{})}),Kn(()=>{if(!c(a))return;m(I,Math.floor(Math.random()*T.length),!0);const U=setInterval(()=>{m(I,(c(I)+1)%T.length)},1e4);return()=>clearInterval(U)}),Kn(()=>{var U;oe&&(c(n).length+(((U=c(s))==null?void 0:U.length)??0),requestAnimationFrame(()=>{oe&&(oe.scrollTop=oe.scrollHeight)}))});function Ve(U){const M=[],O=/```(\w*)\n([\s\S]*?)```/g;let ee=0,ne;for(;(ne=O.exec(U))!==null;)ne.index>ee&&M.push({type:"text",text:U.slice(ee,ne.index)}),M.push({type:"code",lang:ne[1]||"text",text:ne[2].trimEnd()}),ee=ne.index+ne[0].length;return ee<U.length&&M.push({type:"text",text:U.slice(ee)}),M}function ve(U){const M=[],O=/```(\w*)\n([\s\S]*?)```/g;let ee=0,ne;for(;(ne=O.exec(U))!==null;)ne.index>ee&&M.push({type:"text",text:U.slice(ee,ne.index)}),M.push({type:"code",lang:ne[1]||"text",text:ne[2].trimEnd()}),ee=ne.index+ne[0].length;const se=U.slice(ee),re=se.match(/```(\w*)\n([\s\S]*)$/);return re?(re.index>0&&M.push({type:"text",text:se.slice(0,re.index)}),M.push({type:"code",lang:re[1]||"text",text:re[2]})):se&&M.push({type:"text",text:se}),M}function mt(U){const M={};for(const O of U)if(O.type==="code"){if(O.lang==="filter")M.filter=O.text.trim();else if(tt(O.lang)){const ee=O.text.split(`
223
+ `)[0].trim();ee==="// @view-map"?M.map=O.text.split(`
224
+ `).slice(1).join(`
225
+ `).trim():ee==="// @view-reduce"&&(M.reduce=O.text.split(`
226
+ `).slice(1).join(`
227
+ `).trim())}}return M}function Mt(U){return U.filter!==void 0||U.map!==void 0||U.reduce!==void 0}function ot(U){const M=[];return U.filter!==void 0&&M.push("filter"),U.map!==void 0&&M.push("map"),U.reduce!==void 0&&M.push("reduce"),`Apply ${M.join(" + ")}`}const yt=15;function be(U){return U.split(`
228
+ `).length>yt}function Nt(U){const M=new Set(c(p));M.has(U)?M.delete(U):M.add(U),m(p,M,!0)}function si(U,M){if(tt(M))try{return zv.highlight(U,{language:"javascript"}).value}catch{}return U.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Xe(U){return os.parse(U)}function tt(U){return!U||U==="js"||U==="javascript"}function wt(U){navigator.clipboard.writeText(U).catch(()=>{})}async function Yt(){if(m(C,!0),!(c(b)||c(y))){m(y,!0),m(w,"");try{m(b,await mw(c(g)||c(u).model),!0)}catch(U){m(w,U.message,!0)}m(y,!1)}}function fi(U){return U>=1e9?`${(U/1e9).toFixed(1)} GB`:U>=1e6?`${(U/1e6).toFixed(0)} MB`:`${U} B`}function oi(U){const M=U.match(/\.([^.]+)$/);return M?M[1].toUpperCase():"?"}function ki(U){switch(U){case"SH":case"BASH":return"$";case"MD":case"MARKDOWN":return"↓";case"JSON":case"JSONC":return"{}";default:return U}}function _i(U){m(j,c(j).filter((M,O)=>O!==U),!0)}function Ze(){fe.click()}async function Ee(U){if(!(!U||U.length===0))for(const M of Array.from(U)){const O=await M.text();m(j,[...c(j),{name:M.name,content:O}],!0)}}function ii(U){const M=U.target;Ee(M.files),M.value=""}function Ci(U){var M;U.preventDefault(),m(ae,!1),Ee(((M=U.dataTransfer)==null?void 0:M.files)??null)}function Jt(U){var M;(M=U.dataTransfer)!=null&&M.types.includes("Files")&&(U.preventDefault(),m(ae,!0))}function zi(){m(ae,!1)}async function Ji(){const U=c(r).trim();if(!(!U||c(a))){m(r,""),m(d,""),m(a,!0),m(n,[...c(n),{role:"user",content:U}],!0),A=new AbortController,m(X,[],!0);try{await wF({messages:c(n),currentView:c(xe),context:c(le),modelOverride:c(g)||void 0,extraFiles:c(j).length>0?c(j):void 0},M=>{m(s,(c(s)??"")+M)},A.signal,M=>{m(X,[...c(X),M],!0)}),m(n,[...c(n),{role:"assistant",content:c(s)??"",toolEvents:c(X).length>0?[...c(X)]:void 0}],!0),m(X,[],!0)}catch(M){if(M.name==="AbortError"){const O=c(s);O!=null&&O.trim()&&m(n,[...c(n),{role:"assistant",content:O+`
229
+
230
+ *[stopped]*`,toolEvents:c(X).length>0?[...c(X)]:void 0}],!0)}else m(d,M.message,!0)}finally{A=null,m(s,null),m(X,[],!0),m(a,!1)}}}function Ii(){A==null||A.abort()}function wn(U){U.key==="Enter"&&!U.shiftKey&&(U.preventDefault(),Ji())}function cn(){m(n,[],!0),m(d,"")}const pn=["Write a view to list all document IDs","Write a view to sum a numeric property across all documents","Write a view that filters to a specific prefix and emits a field","Write a reduce that returns the maximum value","Explain how the current view works"];function fn(U){m(r,U,!0),me==null||me.focus()}var pt=NX(),Ut=Et(pt),Ni=_(Ut),qi=v(_(Ni),2);{var gi=U=>{var M=tX(),O=_(M);{var ee=se=>{var re=oo();z(()=>W(re,`${c(u).provider??""} · ${(c(g)||c(u).model)??""}`)),D(se,re)},ne=se=>{var re=oo("Not configured");D(se,re)};H(O,se=>{c(Ae)?se(ee):se(ne,-1)})}z(()=>ln(M,"title",`Provider: ${c(u).provider??""}`)),D(U,M)};H(qi,U=>{c(u)&&U(gi)})}var Wi=v(qi,2);{var Ui=U=>{var M=iX();$("click",M,cn),D(U,M)};H(Wi,U=>{c(n).length>0&&U(Ui)})}var tn=v(Ni,2),yi=_(tn);{var Vi=U=>{var M=nX();D(U,M)},ze=U=>{var M=rX(),O=_(M),ee=_(O);{var ne=Ie=>{var We=sX(),Ce=v(Et(We)),Pe=_(Ce);z(()=>W(Pe,t().id)),D(Ie,We)},se=Ie=>{var We=oo("No view selected. Ask a general sheDB view question.");D(Ie,We)};H(ee,Ie=>{t()?Ie(ne):Ie(se,-1)})}var re=v(O,2);ti(re,17,()=>pn,Hi,(Ie,We)=>{var Ce=oX(),Pe=_(Ce);z(()=>W(Pe,c(We))),$("click",Ce,()=>fn(c(We))),D(Ie,Ce)}),D(U,M)};H(yi,U=>{c(Ae)?c(n).length===0&&c(s)===null&&U(ze,1):U(Vi)})}var qt=v(yi,2);ti(qt,17,()=>c(n),Hi,(U,M,O)=>{var ee=hX(),ne=_(ee);{var se=Ie=>{var We=aX(),Ce=_(We);z(()=>W(Ce,c(M).content)),D(Ie,We)},re=Ie=>{const We=Lt(()=>Ve(c(M).content)),Ce=Lt(()=>mt(c(We)));var Pe=uX(),Me=Et(Pe);{var at=we=>{var Oe=W2();ti(Oe,21,()=>c(M).toolEvents,Hi,(St,ut)=>{var nt=Ss(),ue=Et(nt);{var He=Je=>{var ht=O2(),Ke=v(_(ht)),et=_(Ke);z(ge=>W(et,ge),[()=>c(ut).name.replace(/_/g," ")]),D(Je,ht)},Fe=Je=>{var ht=H2(),Ke=v(_(ht)),et=_(Ke);z(ge=>W(et,ge),[()=>c(ut).name.replace(/_/g," ")]),D(Je,ht)};H(ue,Je=>{c(ut).type==="tool_call"?Je(He):Je(Fe,-1)})}D(St,nt)}),D(we,Oe)};H(Me,we=>{var Oe;(Oe=c(M).toolEvents)!=null&&Oe.length&&we(at)})}var Qt=v(Me,2),Z=_(Qt);ti(Z,17,()=>c(We),Hi,(we,Oe,St)=>{var ut=Ss(),nt=Et(ut);{var ue=Fe=>{var Je=z2();hc(Je,()=>Xe(c(Oe).text),!0),D(Fe,Je)},He=Fe=>{const Je=Lt(()=>`${O}:${St}`),ht=Lt(()=>be(c(Oe).text)),Ke=Lt(()=>c(p).has(c(Je))),et=Lt(()=>c(Oe).lang==="filter");var ge=cX(),$e=_(ge),_t=_($e),Wt=_(_t),bt=v(_t,2),pi=_(bt),Di=v($e,2);let Xi;var Mi=_(Di),ai=_(Mi);hc(ai,()=>si(c(Oe).text,c(Oe).lang??""),!0);var Ht=v(Mi,2);{var Dt=jt=>{var Zt=lX(),hi=_(Zt);z(()=>W(hi,c(Ke)?"▲ collapse":"▼ expand")),$("click",Zt,()=>Nt(c(Je))),D(jt,Zt)};H(Ht,jt=>{c(ht)&&jt(Dt)})}z(()=>{W(Wt,c(et)?"filter":c(Oe).lang),Xi=At(Di,1,"code-body svelte-1twuiul",null,Xi,{collapsed:c(ht)&&!c(Ke)})}),$("click",pi,()=>wt(c(Oe).text)),D(Fe,ge)};H(nt,Fe=>{c(Oe).type==="text"?Fe(ue):Fe(He,-1)})}D(we,ut)});var de=v(Z,2);{var Ue=we=>{var Oe=dX(),St=_(Oe),ut=_(St);z(nt=>W(ut,nt),[()=>ot(c(Ce))]),$("click",St,()=>e.onApplyView(c(Ce))),D(we,Oe)},Ft=Lt(()=>Mt(c(Ce))&&e.onApplyView);H(de,we=>{c(Ft)&&we(Ue)})}D(Ie,Pe)};H(ne,Ie=>{c(M).role==="user"?Ie(se):Ie(re,-1)})}z(()=>At(ee,1,`message ${c(M).role??""}`,"svelte-1twuiul")),D(U,ee)});var wi=v(qt,2);{var ji=U=>{var M=W2();ti(M,21,()=>c(X),Hi,(O,ee)=>{var ne=Ss(),se=Et(ne);{var re=We=>{var Ce=O2(),Pe=v(_(Ce)),Me=_(Pe);z(at=>W(Me,at),[()=>c(ee).name.replace(/_/g," ")]),D(We,Ce)},Ie=We=>{var Ce=H2(),Pe=v(_(Ce)),Me=_(Pe);z(at=>W(Me,at),[()=>c(ee).name.replace(/_/g," ")]),D(We,Ce)};H(se,We=>{c(ee).type==="tool_call"?We(re):We(Ie,-1)})}D(O,ne)}),D(U,M)};H(wi,U=>{c(X).length>0&&U(ji)})}var Si=v(wi,2);{var K=U=>{var M=fX(),O=_(M),ee=_(O),ne=_(ee);z(()=>W(ne,T[c(I)])),D(U,M)};H(Si,U=>{c(a)&&c(s)===null&&c(X).length===0&&U(K)})}var De=v(Si,2);{var Qe=U=>{var M=pX(),O=_(M);ti(O,21,()=>ve(c(s)),Hi,(ee,ne)=>{var se=Ss(),re=Et(se);{var Ie=Ce=>{var Pe=z2();hc(Pe,()=>Xe(c(ne).text),!0),D(Ce,Pe)},We=Ce=>{var Pe=gX(),Me=_(Pe),at=_(Me),Qt=_(at),Z=v(Me,2),de=_(Z);hc(de,()=>si(c(ne).text,c(ne).lang??""),!0),z(()=>W(Qt,c(ne).lang)),D(Ce,Pe)};H(re,Ce=>{c(ne).type==="text"?Ce(Ie):Ce(We,-1)})}D(ee,se)}),D(U,M)};H(De,U=>{c(s)!==null&&U(Qe)})}gs(tn,U=>oe=U,()=>oe);var it=v(tn,2);{var Gt=U=>{var M=xX(),O=_(M);z(()=>W(O,c(d))),D(U,M)};H(it,U=>{c(d)&&U(Gt)})}var li=v(it,2),vt=_(li),ft=_(vt),Y=v(vt,2),Re=_(Y),dt=v(Y,2),ye=_(dt),ci=v(dt,2),It=_(ci),ie=v(li,2),Ye=_(ie);{var kt=U=>{var M=mX();let O;var ee=v(_(M),2),ne=_(ee),se=v(ee,2),re=_(se);z(()=>{O=At(M,1,"file-chip svelte-1twuiul",null,O,{inactive:!c(J)}),W(ne,t().id),ln(se,"title",c(J)?"Remove from context":"Re-add to context"),W(re,c(J)?"×":"+")}),$("click",se,()=>m(J,!c(J))),D(U,M)};H(Ye,U=>{t()&&U(kt)})}var Pt=v(Ye,2);ti(Pt,17,()=>c(j),Hi,(U,M,O)=>{const ee=Lt(()=>oi(c(M).name));var ne=vX(),se=_(ne),re=_(se),Ie=v(se,2),We=_(Ie),Ce=v(Ie,2);z((Pe,Me)=>{At(se,1,`badge badge-${Pe??""}`,"svelte-1twuiul"),W(re,Me),W(We,c(M).name)},[()=>c(ee).toLowerCase(),()=>ki(c(ee))]),$("click",Ce,()=>_i(O)),D(U,ne)});var Bt=v(Pt,2),Be=v(Bt,2);gs(Be,U=>fe=U,()=>fe);var je=v(ie,2);let Kt;var ri=_(je);let ui;var Xt=_(ri);gs(Xt,U=>me=U,()=>me);var pe=v(ri,2);{var Ge=U=>{var M=_X();$("click",M,Ii),D(U,M)},rt=U=>{var M=bX();z(O=>M.disabled=O,[()=>!c(r).trim()||!c(Ae)]),$("click",M,Ji),D(U,M)};H(pe,U=>{c(a)?U(Ge):U(rt,-1)})}var lt=v(je,2);{var Vt=U=>{var M=SX(),O=_(M),ee=_(O),ne=v(O,2);{var se=Ce=>{var Pe=EX();ti(Pe,21,()=>c(f),Hi,(Me,at)=>{var Qt=CX(),Z=_(Qt),de={};z(()=>{W(Z,c(at)),de!==(de=c(at))&&(Qt.value=(Qt.__value=c(at))??"")}),D(Me,Qt)}),z(()=>Pe.disabled=c(a)),Ls(Pe,()=>c(g),Me=>m(g,Me)),D(Ce,Pe)},re=Ce=>{var Pe=yX(),Me=_(Pe);z(()=>W(Me,c(g)||c(u).model)),D(Ce,Pe)};H(ne,Ce=>{c(f).length>0?Ce(se):Ce(re,-1)})}var Ie=v(ne,2);{var We=Ce=>{var Pe=wX();$("click",Pe,Yt),D(Ce,Pe)};H(Ie,Ce=>{c(u).provider==="ollama"&&Ce(We)})}z(()=>W(ee,c(u).provider)),D(U,M)};H(lt,U=>{c(Ae)&&c(u)&&U(Vt)})}var Ot=v(Ut,2);{var bi=U=>{var M=RX(),O=_(M),ee=_(O),ne=_(ee),se=_(ne),re=v(ne,2),Ie=v(ee,2),We=_(Ie);{var Ce=at=>{var Qt=DX();D(at,Qt)},Pe=at=>{var Qt=AX(),Z=_(Qt);z(()=>W(Z,c(w))),D(at,Qt)},Me=at=>{var Qt=MX(),Z=_(Qt);{var de=Fe=>{var Je=kX(),ht=v(Et(Je)),Ke=_(ht);z(()=>W(Ke,c(b).version)),D(Fe,Je)};H(Z,Fe=>{c(b).version&&Fe(de)})}var Ue=v(Z,2);{var Ft=Fe=>{var Je=BX(),ht=v(Et(Je)),Ke=_(ht);z(()=>W(Ke,c(b).details.family)),D(Fe,Je)};H(Ue,Fe=>{var Je;(Je=c(b).details)!=null&&Je.family&&Fe(Ft)})}var we=v(Ue,2);{var Oe=Fe=>{var Je=FX(),ht=v(Et(Je)),Ke=_(ht);z(()=>W(Ke,c(b).details.parameter_size)),D(Fe,Je)};H(we,Fe=>{var Je;(Je=c(b).details)!=null&&Je.parameter_size&&Fe(Oe)})}var St=v(we,2);{var ut=Fe=>{var Je=LX(),ht=v(Et(Je)),Ke=_(ht);z(()=>W(Ke,c(b).details.quantization_level)),D(Fe,Je)};H(St,Fe=>{var Je;(Je=c(b).details)!=null&&Je.quantization_level&&Fe(ut)})}var nt=v(St,2);{var ue=Fe=>{var Je=PX(),ht=v(Et(Je),2);ti(ht,21,()=>c(b).running,Hi,(Ke,et)=>{var ge=IX(),$e=_(ge);z(_t=>W($e,`${c(et).name??""} · ${_t??""} VRAM`),[()=>fi(c(et).size_vram)]),D(Ke,ge)}),D(Fe,Je)},He=Fe=>{var Je=TX();D(Fe,Je)};H(nt,Fe=>{c(b).running&&c(b).running.length>0?Fe(ue):c(b).running!==null&&Fe(He,1)})}D(at,Qt)};H(We,at=>{c(y)?at(Ce):c(w)?at(Pe,1):c(b)&&at(Me,2)})}z(()=>{var at;return W(se,`Ollama · ${(c(g)||((at=c(u))==null?void 0:at.model))??""}`)}),$("click",M,()=>m(C,!1)),$("click",O,at=>at.stopPropagation()),$("click",re,()=>m(C,!1)),D(U,M)};H(Ot,U=>{c(C)&&U(bi)})}z(U=>{W(It,U),Kt=At(je,1,"input-row svelte-1twuiul",null,Kt,{"drag-over":c(ae)}),ui=At(ri,1,"textarea-wrap svelte-1twuiul",null,ui,{loading:c(a)}),ln(Xt,"placeholder",c(Ae)?"Ask anything… (Enter to send, Shift+Enter for newline, drag & drop files to add context)":"AI not configured"),Xt.disabled=c(a)||!c(Ae)},[()=>fi(c(Te))]),ws(ft,()=>c(R),U=>m(R,U)),ws(Re,()=>c(P),U=>m(P,U)),ws(ye,()=>c(V),U=>m(V,U)),$("click",Bt,Ze),$("change",Be,ii),xs("dragover",je,Jt),xs("dragleave",je,zi),xs("drop",je,Ci),$("keydown",Xt,wn),zt(Xt,()=>c(r),U=>m(r,U)),D(o,pt),Us()}Ys(["click","change","keydown"]);var HX=B('<div class="me svelte-1pxdb1"></div>');function ZC(o,e){$s(e,!0);let t=Tu(e,"value",15,""),i=Tu(e,"language",3,"javascript"),n,s,r=!1;function a(){zo.setTheme(Jh())}Xs(()=>{const u=i()==="json"?{formatOnPaste:!0,autoIndent:"full"}:{};s=zo.create(n,{value:t(),language:i(),theme:Jh(),minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,fontFamily:"'Cascadia Code', 'Fira Code', monospace",automaticLayout:!0,wordWrap:"on",lineNumbers:"on",renderLineHighlight:"none",overviewRulerLanes:0,scrollbar:{verticalScrollbarSize:6,horizontalScrollbarSize:6},...u}),s.onDidChangeModelContent(()=>{r||t(s.getValue())}),e.onSave&&s.addCommand(g1.CtrlCmd|Pk.KeyS,()=>e.onSave()),window.addEventListener("she:theme-changed",a);const f=window.matchMedia("(prefers-color-scheme: dark)");return f.addEventListener("change",a),()=>{window.removeEventListener("she:theme-changed",a),f.removeEventListener("change",a)}}),Vp(()=>s==null?void 0:s.dispose()),Kn(()=>{!s||s.getValue()===t()||(r=!0,s.setValue(t()),r=!1)});var d=HX();gs(d,u=>n=u,()=>n),D(o,d),Us()}const V2=o=>{var e=WX();D(o,e)};var WX=B('<div class="welcome svelte-rrt0o"><div class="welcome-inner svelte-rrt0o"><div class="welcome-logo svelte-rrt0o">db</div> <p class="welcome-sub svelte-rrt0o">sheDB — embedded JSON document store with MapReduce views</p> <div class="welcome-hint svelte-rrt0o"><strong>In scripts:</strong> use <code class="svelte-rrt0o">she.db.get(id)</code>, <code class="svelte-rrt0o">she.db.set(id, doc)</code>, <code class="svelte-rrt0o">she.db.extend(id, partial)</code>, <code class="svelte-rrt0o">she.db.sub(pattern, cb)</code>.<br/> <strong>Views:</strong> <code class="svelte-rrt0o">this</code> = current document &mdash; call <code class="svelte-rrt0o">emit(value)</code> to add to result.</div> <div class="welcome-links svelte-rrt0o"><a href="https://github.com/hobbyquaker/she/blob/main/doc/db/README.md" target="_blank" rel="noopener" class="svelte-rrt0o">sheDB docs</a> <span class="svelte-rrt0o">·</span> <a href="https://github.com/hobbyquaker/she/blob/main/doc/db/view-examples.md" target="_blank" rel="noopener" class="svelte-rrt0o">View examples</a> <span class="svelte-rrt0o">·</span> <a href="https://github.com/hobbyquaker/she" target="_blank" rel="noopener" class="svelte-rrt0o">GitHub</a></div></div></div>'),zX=B('<button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"><line x1="5.5" y1="5" x2="4" y2="2.5"></line><line x1="10.5" y1="5" x2="12" y2="2.5"></line><path d="M3 11 V7 A5 3.5 0 0 0 13 7 V11 Z" stroke-linejoin="round"></path><circle cx="6" cy="8.2" r="0.7" fill="currentColor" stroke="none"></circle><circle cx="10" cy="8.2" r="0.7" fill="currentColor" stroke="none"></circle></svg> AI</button>'),j2=B('<div class="form-error svelte-rrt0o"> </div>'),VX=B('<div class="new-item-form svelte-rrt0o"><input placeholder="device/lamp1" class="svelte-rrt0o"/> <button class="svelte-rrt0o">Create</button></div> <!>',1),$2=B("<li> </li>"),U2=B('<div class="error-bar svelte-rrt0o"> </div>'),q2=B('<div class="loading svelte-rrt0o">Loading…</div>'),jX=B('<div class="monaco-doc-wrap svelte-rrt0o"><!></div>'),$X=B('<div class="editor-toolbar svelte-rrt0o"><span class="editor-title svelte-rrt0o"> </span> <button class="svelte-rrt0o">Save</button> <button class="btn-danger svelte-rrt0o">Delete</button></div> <!> <!>',1),UX=B('<div class="panel svelte-rrt0o"><aside class="sidebar svelte-rrt0o"><div class="toolbar svelte-rrt0o"><button class="svelte-rrt0o">+ Doc</button></div> <!> <div class="sidebar-search svelte-rrt0o"><input type="search" placeholder="Filter…" class="svelte-rrt0o"/></div> <ul class="flat-list svelte-rrt0o"></ul></aside> <div class="resize-handle svelte-rrt0o" role="separator"></div> <main class="editor-area svelte-rrt0o"><!></main></div>'),qX=B('<div class="new-item-form svelte-rrt0o"><input placeholder="myView" class="svelte-rrt0o"/> <button class="svelte-rrt0o">Create</button></div> <!>',1),GX=B('<label class="opt-check svelte-rrt0o"><input type="checkbox" class="svelte-rrt0o"/> <span class="checkmark svelte-rrt0o"></span> Retain <span class="section-hint svelte-rrt0o">— send as retained MQTT message</span></label>'),KX=B('<span class="badge-error svelte-rrt0o">error</span>'),ZX=B('<span class="badge-ok svelte-rrt0o"> </span>'),XX=B('<pre class="result-error svelte-rrt0o"> </pre>'),YX=B('<pre class="result-json svelte-rrt0o"> </pre>'),QX=B('<div class="view-result svelte-rrt0o"><div class="result-header svelte-rrt0o">Result <!></div> <!></div>'),JX=B('<div class="view-sections svelte-rrt0o"><div class="view-section svelte-rrt0o"><div class="section-title svelte-rrt0o">Description <span class="section-hint svelte-rrt0o">— optional, shown in sidebar</span></div> <div class="section-body svelte-rrt0o"><input class="filter-input svelte-rrt0o" placeholder="(optional description)"/></div></div> <div class="view-section svelte-rrt0o"><div class="section-title svelte-rrt0o">Filter <span class="section-hint svelte-rrt0o">— MQTT wildcard, optional</span></div> <div class="section-body svelte-rrt0o"><input class="filter-input svelte-rrt0o" placeholder="#"/></div></div> <div class="view-section svelte-rrt0o"><div class="section-title svelte-rrt0o">Map <span class="section-hint svelte-rrt0o">— <code>this</code> = document &nbsp;·&nbsp; call <code>emit(this)</code> to include in result</span></div> <div class="monaco-view-wrap monaco-view-wrap--map svelte-rrt0o"><!></div></div> <div class="view-section svelte-rrt0o"><div class="section-title svelte-rrt0o">Reduce <span class="section-hint svelte-rrt0o">— receives <code>result</code> array, must <code>return</code> new value (optional)</span></div> <div class="monaco-view-wrap monaco-view-wrap--reduce svelte-rrt0o"><!></div></div> <div class="view-section view-section--options svelte-rrt0o"><label class="opt-check svelte-rrt0o"><input type="checkbox" class="svelte-rrt0o"/> <span class="checkmark svelte-rrt0o"></span> Publish to MQTT <span class="section-hint svelte-rrt0o">— publish view to MQTT topic <code> </code></span></label> <!></div> <!></div>'),eY=B('<div class="editor-toolbar svelte-rrt0o"><span class="editor-title svelte-rrt0o"> </span> <button class="svelte-rrt0o">Save</button> <button title="Re-run view" class="svelte-rrt0o">Refresh</button> <button class="btn-danger svelte-rrt0o">Delete</button></div> <!> <!>',1),tY=B('<div class="chat-resize-handle svelte-rrt0o" role="separator"></div> <div class="chat-pane svelte-rrt0o"><!></div>',1),iY=B('<div class="panel svelte-rrt0o"><aside class="sidebar svelte-rrt0o"><div class="toolbar svelte-rrt0o"><button class="svelte-rrt0o">+ View</button></div> <!> <div class="sidebar-search svelte-rrt0o"><input type="search" placeholder="Filter…" class="svelte-rrt0o"/></div> <ul class="flat-list svelte-rrt0o"></ul></aside> <div class="resize-handle svelte-rrt0o" role="separator"></div> <main class="editor-area svelte-rrt0o"><!></main> <!></div>'),nY=B('<!> <div class="db-root svelte-rrt0o" role="presentation"><div class="panel-tabs svelte-rrt0o"><button>Documents</button> <button>Views</button> <!></div> <!></div>',1);function sY(o,e){$s(e,!0);let t=F(Li([])),i=F(null),n=F("{}"),s=F(!1),r=F(null);const a="she-db-selected-view";let d=F(Li([])),u=F(Li(localStorage.getItem(a))),f=F("#"),g=F("// emit(this.someProperty)"),p=F(""),C=F(""),b=F(!1),y=F(!1),w=F(null),A=F(!1),I=F(null),T=F("she/db/view/");const R="she-db-panel";let P=F(Li(localStorage.getItem(R)??"docs")),V=F(""),j=F(!1),J=F(null),ae=F(""),fe=F(!1),X=F(null);const ce="she-db-sidebar-width";let me=F(Li(parseInt(localStorage.getItem(ce)??"220",10))),oe=!1,le=0,Ae=0;const Te="she-db-chat-width",xe="she-db-chat-open";let Ne=F(localStorage.getItem(xe)==="true"),Ve=F(Li(parseInt(localStorage.getItem(Te)??"320",10))),ve=!1,mt=0,Mt=0;const ot=Lt(()=>c(u)?{id:c(u),filter:c(f),map:c(g),reduce:c(p)}:null);function yt(ze){ze.filter!==void 0&&m(f,ze.filter,!0),ze.map!==void 0&&m(g,ze.map,!0),ze.reduce!==void 0&&m(p,ze.reduce,!0)}Kn(()=>{localStorage.setItem(xe,String(c(Ne)))}),Kn(()=>{localStorage.setItem(R,c(P))}),Kn(()=>{c(u)?localStorage.setItem(a,c(u)):localStorage.removeItem(a)});function be(ze){oe=!0,le=ze.clientX,Ae=c(me),ze.preventDefault()}function Nt(ze){oe&&m(me,Math.max(140,Math.min(500,Ae+ze.clientX-le)),!0),ve&&m(Ve,Math.max(240,Math.min(600,Mt-(ze.clientX-mt))),!0)}function si(){oe&&(oe=!1,localStorage.setItem(ce,String(c(me)))),ve&&(ve=!1,localStorage.setItem(Te,String(c(Ve))))}function Xe(ze){ve=!0,mt=ze.clientX,Mt=c(Ve),ze.preventDefault()}async function tt(){try{m(t,await mF(),!0)}catch{}}async function wt(){try{m(d,await vF(),!0)}catch{}}async function Yt(ze){m(i,ze,!0),m(r,null),m(s,!0);try{const qt=await K$(ze);m(n,JSON.stringify(qt,null,2),!0)}catch(qt){m(r,qt instanceof Error?qt.message:String(qt),!0)}finally{m(s,!1)}}async function fi(){if(c(i)){m(r,null);try{const ze=JSON.parse(c(n));await d2(c(i),ze)}catch(ze){m(r,ze instanceof Error?ze.message:String(ze),!0)}}}let oi;async function ki(){if(c(i)&&await oi.show(`Delete document "${c(i)}"?`,{confirm:"Delete",danger:!0}))try{await Z$(c(i)),m(i,null),m(n,"{}")}catch(ze){m(r,ze instanceof Error?ze.message:String(ze),!0)}}async function _i(){const ze=c(V).trim();if(ze){m(J,null);try{await d2(ze,{}),m(j,!1),m(V,""),await Yt(ze)}catch(qt){m(J,qt instanceof Error?qt.message:String(qt),!0)}}}async function Ze(ze){m(u,ze,!0),m(I,null),m(A,!0),m(w,null);try{const qt=await X$(ze);m(f,qt.filter??"",!0),m(g,qt.map,!0),m(p,qt.reduce??"",!0),m(C,qt.description??"",!0),m(b,qt.mqttpub??!1,!0),m(y,qt.retain??!1,!0),m(w,await UC(ze).catch(()=>null),!0)}catch(qt){m(I,qt instanceof Error?qt.message:String(qt),!0)}finally{m(A,!1)}}async function Ee(){if(c(u)){m(I,null);try{const ze={map:c(g)};c(f).trim()&&(ze.filter=c(f).trim()),c(p).trim()&&(ze.reduce=c(p).trim()),c(C).trim()&&(ze.description=c(C).trim()),c(b)&&(ze.mqttpub=!0),c(y)&&(ze.retain=!0),await u2(c(u),ze)}catch(ze){m(I,ze instanceof Error?ze.message:String(ze),!0)}}}async function ii(){if(c(u))try{m(w,await UC(c(u)),!0)}catch(ze){m(I,ze instanceof Error?ze.message:String(ze),!0)}}async function Ci(){if(c(u)&&await oi.show(`Delete view "${c(u)}"?`,{confirm:"Delete",danger:!0}))try{await Y$(c(u)),m(u,null),m(f,""),m(g,"// emit(this.someProperty)"),m(p,""),m(C,""),m(b,!1),m(y,!1),m(w,null)}catch(ze){m(I,ze instanceof Error?ze.message:String(ze),!0)}}async function Jt(){if(!c(ae).trim())return;const ze=c(ae).trim();m(X,null);try{await u2(ze,{map:"// emit(this.someProperty)"}),m(fe,!1),m(ae,""),await wt(),await Ze(ze)}catch(qt){m(X,qt instanceof Error?qt.message:String(qt),!0)}}let zi=F(""),Ji=F(""),Ii=Lt(()=>[...c(t)].filter(ze=>!c(zi)||ze.toLowerCase().includes(c(zi).toLowerCase())).sort()),wn=Lt(()=>[...c(d)].filter(ze=>!c(Ji)||ze.toLowerCase().includes(c(Ji).toLowerCase())).sort());Xs(()=>{tt(),wt().then(()=>{c(u)&&c(d).includes(c(u))?Ze(c(u)):m(u,null)}),Pl().then(Si=>{const K=Si.dbPrefix||"she/db/",De=K.endsWith("/")?K:K+"/";m(T,De+"view/")}).catch(()=>{});const ze=Xo("db:ids",Si=>{m(t,Si.ids??[],!0)}),qt=Xo("db:viewIds",Si=>{m(d,Si.ids??[],!0)}),wi=Xo("db:change",async Si=>{const K=Si.id;c(i)===K&&(Si.doc===null?(m(i,null),m(n,"{}")):m(n,JSON.stringify(Si.doc,null,2),!0))}),ji=Xo("db:viewUpdate",async Si=>{const K=Si.id;c(u)===K&&m(w,await UC(K).catch(()=>null),!0)});return()=>{ze(),qt(),wi(),ji()}});var cn=nY(),pn=Et(cn);gs(Yc(pn,{}),ze=>oi=ze,()=>oi);var fn=v(pn,2),pt=_(fn),Ut=_(pt);let Ni;var qi=v(Ut,2);let gi;var Wi=v(qi,2);{var Ui=ze=>{var qt=zX();let wi;z(()=>{wi=At(qt,1,"ai-toggle svelte-rrt0o",null,wi,{"ai-open":c(Ne)}),ln(qt,"title",c(Ne)?"Close AI assistant":"Open AI assistant")}),$("click",qt,()=>m(Ne,!c(Ne))),D(ze,qt)};H(Wi,ze=>{c(P)==="views"&&ze(Ui)})}var tn=v(pt,2);{var yi=ze=>{var qt=UX(),wi=_(qt);let ji;var Si=_(wi),K=_(Si),De=v(Si,2);{var Qe=ye=>{var ci=VX(),It=Et(ci),ie=_(It),Ye=v(ie,2),kt=v(It,2);{var Pt=Bt=>{var Be=j2(),je=_(Be);z(()=>W(je,c(J))),D(Bt,Be)};H(kt,Bt=>{c(J)&&Bt(Pt)})}$("keydown",ie,Bt=>Bt.key==="Enter"&&_i()),zt(ie,()=>c(V),Bt=>m(V,Bt)),$("click",Ye,_i),D(ye,ci)};H(De,ye=>{c(j)&&ye(Qe)})}var it=v(De,2),Gt=_(it),li=v(it,2);ti(li,20,()=>c(Ii),ye=>ye,(ye,ci)=>{var It=$2();let ie;var Ye=_(It);z(()=>{ie=At(It,1,"flat-item svelte-rrt0o",null,ie,{"active-item":c(i)===ci}),W(Ye,ci)}),$("click",It,()=>Yt(ci)),D(ye,It)});var vt=v(wi,2),ft=v(vt,2),Y=_(ft);{var Re=ye=>{var ci=$X(),It=Et(ci),ie=_(It),Ye=_(ie),kt=v(ie,2),Pt=v(kt,2),Bt=v(It,2);{var Be=ui=>{var Xt=U2(),pe=_(Xt);z(()=>W(pe,c(r))),D(ui,Xt)};H(Bt,ui=>{c(r)&&ui(Be)})}var je=v(Bt,2);{var Kt=ui=>{var Xt=q2();D(ui,Xt)},ri=ui=>{var Xt=jX(),pe=_(Xt);ZC(pe,{language:"json",get value(){return c(n)},set value(Ge){m(n,Ge,!0)}}),D(ui,Xt)};H(je,ui=>{c(s)?ui(Kt):ui(ri,-1)})}z(()=>W(Ye,c(i))),$("click",kt,fi),$("click",Pt,ki),D(ye,ci)},dt=ye=>{V2(ye)};H(Y,ye=>{c(i)?ye(Re):ye(dt,-1)})}z(()=>ji=qo(wi,"",ji,{width:`${c(me)??""}px`})),$("click",K,()=>{m(j,!c(j)),m(J,null)}),zt(Gt,()=>c(zi),ye=>m(zi,ye)),$("mousedown",vt,be),D(ze,qt)},Vi=ze=>{var qt=iY(),wi=_(qt);let ji;var Si=_(wi),K=_(Si),De=v(Si,2);{var Qe=It=>{var ie=qX(),Ye=Et(ie),kt=_(Ye),Pt=v(kt,2),Bt=v(Ye,2);{var Be=je=>{var Kt=j2(),ri=_(Kt);z(()=>W(ri,c(X))),D(je,Kt)};H(Bt,je=>{c(X)&&je(Be)})}$("keydown",kt,je=>je.key==="Enter"&&Jt()),zt(kt,()=>c(ae),je=>m(ae,je)),$("click",Pt,Jt),D(It,ie)};H(De,It=>{c(fe)&&It(Qe)})}var it=v(De,2),Gt=_(it),li=v(it,2);ti(li,20,()=>c(wn),It=>It,(It,ie)=>{var Ye=$2();let kt;var Pt=_(Ye);z(()=>{kt=At(Ye,1,"flat-item svelte-rrt0o",null,kt,{"active-item":c(u)===ie}),W(Pt,ie)}),$("click",Ye,()=>Ze(ie)),D(It,Ye)});var vt=v(wi,2),ft=v(vt,2),Y=_(ft);{var Re=It=>{var ie=eY(),Ye=Et(ie),kt=_(Ye),Pt=_(kt),Bt=v(kt,2),Be=v(Bt,2),je=v(Be,2),Kt=v(Ye,2);{var ri=Ge=>{var rt=U2(),lt=_(rt);z(()=>W(lt,c(I))),D(Ge,rt)};H(Kt,Ge=>{c(I)&&Ge(ri)})}var ui=v(Kt,2);{var Xt=Ge=>{var rt=q2();D(Ge,rt)},pe=Ge=>{var rt=JX(),lt=_(rt),Vt=v(_(lt),2),Ot=_(Vt),bi=v(lt,2),U=v(_(bi),2),M=_(U),O=v(bi,2),ee=v(_(O),2),ne=_(ee);ZC(ne,{language:"javascript",onSave:Ee,get value(){return c(g)},set value(we){m(g,we,!0)}});var se=v(O,2),re=v(_(se),2),Ie=_(re);ZC(Ie,{language:"javascript",onSave:Ee,get value(){return c(p)},set value(we){m(p,we,!0)}});var We=v(se,2),Ce=_(We),Pe=_(Ce),Me=v(Pe,4),at=v(_(Me)),Qt=_(at),Z=v(Ce,2);{var de=we=>{var Oe=GX(),St=_(Oe);ws(St,()=>c(y),ut=>m(y,ut)),D(we,Oe)};H(Z,we=>{c(b)&&we(de)})}var Ue=v(We,2);{var Ft=we=>{var Oe=QX(),St=_(Oe),ut=v(_(St));{var nt=ht=>{var Ke=KX();D(ht,Ke)},ue=ht=>{var Ke=ZX(),et=_(Ke);z(()=>W(et,`${c(w).length??0??""} items · rev ${c(w)._rev??""}`)),D(ht,Ke)};H(ut,ht=>{c(w).error?ht(nt):ht(ue,-1)})}var He=v(St,2);{var Fe=ht=>{var Ke=XX(),et=_(Ke);z(()=>W(et,c(w).error)),D(ht,Ke)},Je=ht=>{var Ke=YX(),et=_(Ke);z(ge=>W(et,ge),[()=>JSON.stringify(c(w).result,null,2)]),D(ht,Ke)};H(He,ht=>{c(w).error?ht(Fe):ht(Je,-1)})}D(we,Oe)};H(Ue,we=>{c(w)&&we(Ft)})}z(()=>W(Qt,`${c(T)??""}${c(u)??""} on every update`)),zt(Ot,()=>c(C),we=>m(C,we)),zt(M,()=>c(f),we=>m(f,we)),ws(Pe,()=>c(b),we=>m(b,we)),D(Ge,rt)};H(ui,Ge=>{c(A)?Ge(Xt):Ge(pe,-1)})}z(()=>W(Pt,c(u))),$("click",Bt,Ee),$("click",Be,ii),$("click",je,Ci),D(It,ie)},dt=It=>{V2(It)};H(Y,It=>{c(u)?It(Re):It(dt,-1)})}var ye=v(ft,2);{var ci=It=>{var ie=tY(),Ye=Et(ie),kt=v(Ye,2);let Pt;var Bt=_(kt);OX(Bt,{get currentView(){return c(ot)},onApplyView:yt}),z(()=>Pt=qo(kt,"",Pt,{width:`${c(Ve)??""}px`})),$("mousedown",Ye,Xe),D(It,ie)};H(ye,It=>{c(Ne)&&It(ci)})}z(()=>ji=qo(wi,"",ji,{width:`${c(me)??""}px`})),$("click",K,()=>{m(fe,!c(fe)),m(X,null)}),zt(Gt,()=>c(Ji),It=>m(Ji,It)),$("mousedown",vt,be),D(ze,qt)};H(tn,ze=>{c(P)==="docs"?ze(yi):ze(Vi,-1)})}z(()=>{Ni=At(Ut,1,"svelte-rrt0o",null,Ni,{active:c(P)==="docs"}),gi=At(qi,1,"svelte-rrt0o",null,gi,{active:c(P)==="views"})}),$("mousemove",fn,Nt),$("mouseup",fn,si),xs("mouseleave",fn,si),$("click",Ut,()=>m(P,"docs")),$("click",qi,()=>m(P,"views")),D(o,cn),Us()}Ys(["mousemove","mouseup","click","keydown","mousedown"]);var Em={exports:{}},oY=Em.exports,G2;function rY(){return G2||(G2=1,(function(o,e){(function(i,n){o.exports=n()})(typeof self<"u"?self:oY,function(){return(function(t){var i={};function n(s){if(i[s])return i[s].exports;var r=i[s]={i:s,l:!1,exports:{}};return t[s].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=i,n.d=function(s,r,a){n.o(s,r)||Object.defineProperty(s,r,{configurable:!1,enumerable:!0,get:a})},n.n=function(s){var r=s&&s.__esModule?function(){return s.default}:function(){return s};return n.d(r,"a",r),r},n.o=function(s,r){return Object.prototype.hasOwnProperty.call(s,r)},n.p="",n(n.s=3)})([(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=(function(){function r(a,d){this.width=d,this.height=a.length/d,this.data=a}return r.createEmpty=function(a,d){return new r(new Uint8ClampedArray(a*d),a)},r.prototype.get=function(a,d){return a<0||a>=this.width||d<0||d>=this.height?!1:!!this.data[d*this.width+a]},r.prototype.set=function(a,d,u){this.data[d*this.width+a]=u?1:0},r.prototype.setRegion=function(a,d,u,f,g){for(var p=d;p<d+f;p++)for(var C=a;C<a+u;C++)this.set(C,p,!!g)},r})();i.BitMatrix=s}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=n(2);function r(d,u){return d^u}i.addOrSubtractGF=r;var a=(function(){function d(u,f,g){this.primitive=u,this.size=f,this.generatorBase=g,this.expTable=new Array(this.size),this.logTable=new Array(this.size);for(var p=1,C=0;C<this.size;C++)this.expTable[C]=p,p=p*2,p>=this.size&&(p=(p^this.primitive)&this.size-1);for(var C=0;C<this.size-1;C++)this.logTable[this.expTable[C]]=C;this.zero=new s.default(this,Uint8ClampedArray.from([0])),this.one=new s.default(this,Uint8ClampedArray.from([1]))}return d.prototype.multiply=function(u,f){return u===0||f===0?0:this.expTable[(this.logTable[u]+this.logTable[f])%(this.size-1)]},d.prototype.inverse=function(u){if(u===0)throw new Error("Can't invert 0");return this.expTable[this.size-this.logTable[u]-1]},d.prototype.buildMonomial=function(u,f){if(u<0)throw new Error("Invalid monomial degree less than 0");if(f===0)return this.zero;var g=new Uint8ClampedArray(u+1);return g[0]=f,new s.default(this,g)},d.prototype.log=function(u){if(u===0)throw new Error("Can't take log(0)");return this.logTable[u]},d.prototype.exp=function(u){return this.expTable[u]},d})();i.default=a}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=n(1),r=(function(){function a(d,u){if(u.length===0)throw new Error("No coefficients.");this.field=d;var f=u.length;if(f>1&&u[0]===0){for(var g=1;g<f&&u[g]===0;)g++;if(g===f)this.coefficients=d.zero.coefficients;else{this.coefficients=new Uint8ClampedArray(f-g);for(var p=0;p<this.coefficients.length;p++)this.coefficients[p]=u[g+p]}}else this.coefficients=u}return a.prototype.degree=function(){return this.coefficients.length-1},a.prototype.isZero=function(){return this.coefficients[0]===0},a.prototype.getCoefficient=function(d){return this.coefficients[this.coefficients.length-1-d]},a.prototype.addOrSubtract=function(d){var u;if(this.isZero())return d;if(d.isZero())return this;var f=this.coefficients,g=d.coefficients;f.length>g.length&&(u=[g,f],f=u[0],g=u[1]);for(var p=new Uint8ClampedArray(g.length),C=g.length-f.length,b=0;b<C;b++)p[b]=g[b];for(var b=C;b<g.length;b++)p[b]=s.addOrSubtractGF(f[b-C],g[b]);return new a(this.field,p)},a.prototype.multiply=function(d){if(d===0)return this.field.zero;if(d===1)return this;for(var u=this.coefficients.length,f=new Uint8ClampedArray(u),g=0;g<u;g++)f[g]=this.field.multiply(this.coefficients[g],d);return new a(this.field,f)},a.prototype.multiplyPoly=function(d){if(this.isZero()||d.isZero())return this.field.zero;for(var u=this.coefficients,f=u.length,g=d.coefficients,p=g.length,C=new Uint8ClampedArray(f+p-1),b=0;b<f;b++)for(var y=u[b],w=0;w<p;w++)C[b+w]=s.addOrSubtractGF(C[b+w],this.field.multiply(y,g[w]));return new a(this.field,C)},a.prototype.multiplyByMonomial=function(d,u){if(d<0)throw new Error("Invalid degree less than 0");if(u===0)return this.field.zero;for(var f=this.coefficients.length,g=new Uint8ClampedArray(f+d),p=0;p<f;p++)g[p]=this.field.multiply(this.coefficients[p],u);return new a(this.field,g)},a.prototype.evaluateAt=function(d){var u=0;if(d===0)return this.getCoefficient(0);var f=this.coefficients.length;if(d===1)return this.coefficients.forEach(function(p){u=s.addOrSubtractGF(u,p)}),u;u=this.coefficients[0];for(var g=1;g<f;g++)u=s.addOrSubtractGF(this.field.multiply(d,u),this.coefficients[g]);return u},a})();i.default=r}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=n(4),r=n(5),a=n(11),d=n(12);function u(p){var C=d.locate(p);if(!C)return null;for(var b=0,y=C;b<y.length;b++){var w=y[b],A=a.extract(p,w),I=r.decode(A.matrix);if(I)return{binaryData:I.bytes,data:I.text,chunks:I.chunks,version:I.version,location:{topRightCorner:A.mappingFunction(w.dimension,0),topLeftCorner:A.mappingFunction(0,0),bottomRightCorner:A.mappingFunction(w.dimension,w.dimension),bottomLeftCorner:A.mappingFunction(0,w.dimension),topRightFinderPattern:w.topRight,topLeftFinderPattern:w.topLeft,bottomLeftFinderPattern:w.bottomLeft,bottomRightAlignmentPattern:w.alignmentPattern}}}return null}var f={inversionAttempts:"attemptBoth"};function g(p,C,b,y){y===void 0&&(y={});var w=f;Object.keys(w||{}).forEach(function(j){w[j]=y[j]||w[j]});var A=w.inversionAttempts==="attemptBoth"||w.inversionAttempts==="invertFirst",I=w.inversionAttempts==="onlyInvert"||w.inversionAttempts==="invertFirst",T=s.binarize(p,C,b,A),R=T.binarized,P=T.inverted,V=u(I?P:R);return!V&&(w.inversionAttempts==="attemptBoth"||w.inversionAttempts==="invertFirst")&&(V=u(I?R:P)),V}g.default=g,i.default=g}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=n(0),r=8,a=24;function d(g,p,C){return g<p?p:g>C?C:g}var u=(function(){function g(p,C){this.width=p,this.data=new Uint8ClampedArray(p*C)}return g.prototype.get=function(p,C){return this.data[C*this.width+p]},g.prototype.set=function(p,C,b){this.data[C*this.width+p]=b},g})();function f(g,p,C,b){if(g.length!==p*C*4)throw new Error("Malformed data passed to binarizer.");for(var y=new u(p,C),w=0;w<p;w++)for(var A=0;A<C;A++){var I=g[(A*p+w)*4+0],T=g[(A*p+w)*4+1],R=g[(A*p+w)*4+2];y.set(w,A,.2126*I+.7152*T+.0722*R)}for(var P=Math.ceil(p/r),V=Math.ceil(C/r),j=new u(P,V),J=0;J<V;J++)for(var ae=0;ae<P;ae++){for(var fe=0,X=1/0,ce=0,A=0;A<r;A++)for(var w=0;w<r;w++){var me=y.get(ae*r+w,J*r+A);fe+=me,X=Math.min(X,me),ce=Math.max(ce,me)}var oe=fe/Math.pow(r,2);if(ce-X<=a&&(oe=X/2,J>0&&ae>0)){var le=(j.get(ae,J-1)+2*j.get(ae-1,J)+j.get(ae-1,J-1))/4;X<le&&(oe=le)}j.set(ae,J,oe)}var Ae=s.BitMatrix.createEmpty(p,C),Te=null;b&&(Te=s.BitMatrix.createEmpty(p,C));for(var J=0;J<V;J++)for(var ae=0;ae<P;ae++){for(var xe=d(ae,2,P-3),Ne=d(J,2,V-3),fe=0,Ve=-2;Ve<=2;Ve++)for(var ve=-2;ve<=2;ve++)fe+=j.get(xe+Ve,Ne+ve);for(var mt=fe/25,Ve=0;Ve<r;Ve++)for(var ve=0;ve<r;ve++){var w=ae*r+Ve,A=J*r+ve,Mt=y.get(w,A);Ae.set(w,A,Mt<=mt),b&&Te.set(w,A,!(Mt<=mt))}}return b?{binarized:Ae,inverted:Te}:{binarized:Ae}}i.binarize=f}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=n(0),r=n(6),a=n(9),d=n(10);function u(R,P){for(var V=R^P,j=0;V;)j++,V&=V-1;return j}function f(R,P){return P<<1|R}var g=[{bits:21522,formatInfo:{errorCorrectionLevel:1,dataMask:0}},{bits:20773,formatInfo:{errorCorrectionLevel:1,dataMask:1}},{bits:24188,formatInfo:{errorCorrectionLevel:1,dataMask:2}},{bits:23371,formatInfo:{errorCorrectionLevel:1,dataMask:3}},{bits:17913,formatInfo:{errorCorrectionLevel:1,dataMask:4}},{bits:16590,formatInfo:{errorCorrectionLevel:1,dataMask:5}},{bits:20375,formatInfo:{errorCorrectionLevel:1,dataMask:6}},{bits:19104,formatInfo:{errorCorrectionLevel:1,dataMask:7}},{bits:30660,formatInfo:{errorCorrectionLevel:0,dataMask:0}},{bits:29427,formatInfo:{errorCorrectionLevel:0,dataMask:1}},{bits:32170,formatInfo:{errorCorrectionLevel:0,dataMask:2}},{bits:30877,formatInfo:{errorCorrectionLevel:0,dataMask:3}},{bits:26159,formatInfo:{errorCorrectionLevel:0,dataMask:4}},{bits:25368,formatInfo:{errorCorrectionLevel:0,dataMask:5}},{bits:27713,formatInfo:{errorCorrectionLevel:0,dataMask:6}},{bits:26998,formatInfo:{errorCorrectionLevel:0,dataMask:7}},{bits:5769,formatInfo:{errorCorrectionLevel:3,dataMask:0}},{bits:5054,formatInfo:{errorCorrectionLevel:3,dataMask:1}},{bits:7399,formatInfo:{errorCorrectionLevel:3,dataMask:2}},{bits:6608,formatInfo:{errorCorrectionLevel:3,dataMask:3}},{bits:1890,formatInfo:{errorCorrectionLevel:3,dataMask:4}},{bits:597,formatInfo:{errorCorrectionLevel:3,dataMask:5}},{bits:3340,formatInfo:{errorCorrectionLevel:3,dataMask:6}},{bits:2107,formatInfo:{errorCorrectionLevel:3,dataMask:7}},{bits:13663,formatInfo:{errorCorrectionLevel:2,dataMask:0}},{bits:12392,formatInfo:{errorCorrectionLevel:2,dataMask:1}},{bits:16177,formatInfo:{errorCorrectionLevel:2,dataMask:2}},{bits:14854,formatInfo:{errorCorrectionLevel:2,dataMask:3}},{bits:9396,formatInfo:{errorCorrectionLevel:2,dataMask:4}},{bits:8579,formatInfo:{errorCorrectionLevel:2,dataMask:5}},{bits:11994,formatInfo:{errorCorrectionLevel:2,dataMask:6}},{bits:11245,formatInfo:{errorCorrectionLevel:2,dataMask:7}}],p=[function(R){return(R.y+R.x)%2===0},function(R){return R.y%2===0},function(R){return R.x%3===0},function(R){return(R.y+R.x)%3===0},function(R){return(Math.floor(R.y/2)+Math.floor(R.x/3))%2===0},function(R){return R.x*R.y%2+R.x*R.y%3===0},function(R){return(R.y*R.x%2+R.y*R.x%3)%2===0},function(R){return((R.y+R.x)%2+R.y*R.x%3)%2===0}];function C(R){var P=17+4*R.versionNumber,V=s.BitMatrix.createEmpty(P,P);V.setRegion(0,0,9,9,!0),V.setRegion(P-8,0,8,9,!0),V.setRegion(0,P-8,9,8,!0);for(var j=0,J=R.alignmentPatternCenters;j<J.length;j++)for(var ae=J[j],fe=0,X=R.alignmentPatternCenters;fe<X.length;fe++){var ce=X[fe];ae===6&&ce===6||ae===6&&ce===P-7||ae===P-7&&ce===6||V.setRegion(ae-2,ce-2,5,5,!0)}return V.setRegion(6,9,1,P-17,!0),V.setRegion(9,6,P-17,1,!0),R.versionNumber>6&&(V.setRegion(P-11,0,3,6,!0),V.setRegion(0,P-11,6,3,!0)),V}function b(R,P,V){for(var j=p[V.dataMask],J=R.height,ae=C(P),fe=[],X=0,ce=0,me=!0,oe=J-1;oe>0;oe-=2){oe===6&&oe--;for(var le=0;le<J;le++)for(var Ae=me?J-1-le:le,Te=0;Te<2;Te++){var xe=oe-Te;if(!ae.get(xe,Ae)){ce++;var Ne=R.get(xe,Ae);j({y:Ae,x:xe})&&(Ne=!Ne),X=f(Ne,X),ce===8&&(fe.push(X),ce=0,X=0)}}me=!me}return fe}function y(R){var P=R.height,V=Math.floor((P-17)/4);if(V<=6)return d.VERSIONS[V-1];for(var j=0,J=5;J>=0;J--)for(var ae=P-9;ae>=P-11;ae--)j=f(R.get(ae,J),j);for(var fe=0,ae=5;ae>=0;ae--)for(var J=P-9;J>=P-11;J--)fe=f(R.get(ae,J),fe);for(var X=1/0,ce,me=0,oe=d.VERSIONS;me<oe.length;me++){var le=oe[me];if(le.infoBits===j||le.infoBits===fe)return le;var Ae=u(j,le.infoBits);Ae<X&&(ce=le,X=Ae),Ae=u(fe,le.infoBits),Ae<X&&(ce=le,X=Ae)}if(X<=3)return ce}function w(R){for(var P=0,V=0;V<=8;V++)V!==6&&(P=f(R.get(V,8),P));for(var j=7;j>=0;j--)j!==6&&(P=f(R.get(8,j),P));for(var J=R.height,ae=0,j=J-1;j>=J-7;j--)ae=f(R.get(8,j),ae);for(var V=J-8;V<J;V++)ae=f(R.get(V,8),ae);for(var fe=1/0,X=null,ce=0,me=g;ce<me.length;ce++){var oe=me[ce],le=oe.bits,Ae=oe.formatInfo;if(le===P||le===ae)return Ae;var Te=u(P,le);Te<fe&&(X=Ae,fe=Te),P!==ae&&(Te=u(ae,le),Te<fe&&(X=Ae,fe=Te))}return fe<=3?X:null}function A(R,P,V){var j=P.errorCorrectionLevels[V],J=[],ae=0;if(j.ecBlocks.forEach(function(Ne){for(var Ve=0;Ve<Ne.numBlocks;Ve++)J.push({numDataCodewords:Ne.dataCodewordsPerBlock,codewords:[]}),ae+=Ne.dataCodewordsPerBlock+j.ecCodewordsPerBlock}),R.length<ae)return null;R=R.slice(0,ae);for(var fe=j.ecBlocks[0].dataCodewordsPerBlock,X=0;X<fe;X++)for(var ce=0,me=J;ce<me.length;ce++){var oe=me[ce];oe.codewords.push(R.shift())}if(j.ecBlocks.length>1)for(var le=j.ecBlocks[0].numBlocks,Ae=j.ecBlocks[1].numBlocks,X=0;X<Ae;X++)J[le+X].codewords.push(R.shift());for(;R.length>0;)for(var Te=0,xe=J;Te<xe.length;Te++){var oe=xe[Te];oe.codewords.push(R.shift())}return J}function I(R){var P=y(R);if(!P)return null;var V=w(R);if(!V)return null;var j=b(R,P,V),J=A(j,P,V.errorCorrectionLevel);if(!J)return null;for(var ae=J.reduce(function(Te,xe){return Te+xe.numDataCodewords},0),fe=new Uint8ClampedArray(ae),X=0,ce=0,me=J;ce<me.length;ce++){var oe=me[ce],le=a.decode(oe.codewords,oe.codewords.length-oe.numDataCodewords);if(!le)return null;for(var Ae=0;Ae<oe.numDataCodewords;Ae++)fe[X++]=le[Ae]}try{return r.decode(fe,P.versionNumber)}catch{return null}}function T(R){if(R==null)return null;var P=I(R);if(P)return P;for(var V=0;V<R.width;V++)for(var j=V+1;j<R.height;j++)R.get(V,j)!==R.get(j,V)&&(R.set(V,j,!R.get(V,j)),R.set(j,V,!R.get(j,V)));return I(R)}i.decode=T}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=n(7),r=n(8),a;(function(y){y.Numeric="numeric",y.Alphanumeric="alphanumeric",y.Byte="byte",y.Kanji="kanji",y.ECI="eci"})(a=i.Mode||(i.Mode={}));var d;(function(y){y[y.Terminator=0]="Terminator",y[y.Numeric=1]="Numeric",y[y.Alphanumeric=2]="Alphanumeric",y[y.Byte=4]="Byte",y[y.Kanji=8]="Kanji",y[y.ECI=7]="ECI"})(d||(d={}));function u(y,w){for(var A=[],I="",T=[10,12,14][w],R=y.readBits(T);R>=3;){var P=y.readBits(10);if(P>=1e3)throw new Error("Invalid numeric value above 999");var V=Math.floor(P/100),j=Math.floor(P/10)%10,J=P%10;A.push(48+V,48+j,48+J),I+=V.toString()+j.toString()+J.toString(),R-=3}if(R===2){var P=y.readBits(7);if(P>=100)throw new Error("Invalid numeric value above 99");var V=Math.floor(P/10),j=P%10;A.push(48+V,48+j),I+=V.toString()+j.toString()}else if(R===1){var P=y.readBits(4);if(P>=10)throw new Error("Invalid numeric value above 9");A.push(48+P),I+=P.toString()}return{bytes:A,text:I}}var f=["0","1","2","3","4","5","6","7","8","9","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"," ","$","%","*","+","-",".","/",":"];function g(y,w){for(var A=[],I="",T=[9,11,13][w],R=y.readBits(T);R>=2;){var P=y.readBits(11),V=Math.floor(P/45),j=P%45;A.push(f[V].charCodeAt(0),f[j].charCodeAt(0)),I+=f[V]+f[j],R-=2}if(R===1){var V=y.readBits(6);A.push(f[V].charCodeAt(0)),I+=f[V]}return{bytes:A,text:I}}function p(y,w){for(var A=[],I="",T=[8,16,16][w],R=y.readBits(T),P=0;P<R;P++){var V=y.readBits(8);A.push(V)}try{I+=decodeURIComponent(A.map(function(j){return"%"+("0"+j.toString(16)).substr(-2)}).join(""))}catch{}return{bytes:A,text:I}}function C(y,w){for(var A=[],I="",T=[8,10,12][w],R=y.readBits(T),P=0;P<R;P++){var V=y.readBits(13),j=Math.floor(V/192)<<8|V%192;j<7936?j+=33088:j+=49472,A.push(j>>8,j&255),I+=String.fromCharCode(r.shiftJISTable[j])}return{bytes:A,text:I}}function b(y,w){for(var A,I,T,R,P=new s.BitStream(y),V=w<=9?0:w<=26?1:2,j={text:"",bytes:[],chunks:[],version:w};P.available()>=4;){var J=P.readBits(4);if(J===d.Terminator)return j;if(J===d.ECI)P.readBits(1)===0?j.chunks.push({type:a.ECI,assignmentNumber:P.readBits(7)}):P.readBits(1)===0?j.chunks.push({type:a.ECI,assignmentNumber:P.readBits(14)}):P.readBits(1)===0?j.chunks.push({type:a.ECI,assignmentNumber:P.readBits(21)}):j.chunks.push({type:a.ECI,assignmentNumber:-1});else if(J===d.Numeric){var ae=u(P,V);j.text+=ae.text,(A=j.bytes).push.apply(A,ae.bytes),j.chunks.push({type:a.Numeric,text:ae.text})}else if(J===d.Alphanumeric){var fe=g(P,V);j.text+=fe.text,(I=j.bytes).push.apply(I,fe.bytes),j.chunks.push({type:a.Alphanumeric,text:fe.text})}else if(J===d.Byte){var X=p(P,V);j.text+=X.text,(T=j.bytes).push.apply(T,X.bytes),j.chunks.push({type:a.Byte,bytes:X.bytes,text:X.text})}else if(J===d.Kanji){var ce=C(P,V);j.text+=ce.text,(R=j.bytes).push.apply(R,ce.bytes),j.chunks.push({type:a.Kanji,bytes:ce.bytes,text:ce.text})}}if(P.available()===0||P.readBits(P.available())===0)return j}i.decode=b}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=(function(){function r(a){this.byteOffset=0,this.bitOffset=0,this.bytes=a}return r.prototype.readBits=function(a){if(a<1||a>32||a>this.available())throw new Error("Cannot read "+a.toString()+" bits");var d=0;if(this.bitOffset>0){var u=8-this.bitOffset,f=a<u?a:u,g=u-f,p=255>>8-f<<g;d=(this.bytes[this.byteOffset]&p)>>g,a-=f,this.bitOffset+=f,this.bitOffset===8&&(this.bitOffset=0,this.byteOffset++)}if(a>0){for(;a>=8;)d=d<<8|this.bytes[this.byteOffset]&255,this.byteOffset++,a-=8;if(a>0){var g=8-a,p=255>>g<<g;d=d<<a|(this.bytes[this.byteOffset]&p)>>g,this.bitOffset+=a}}return d},r.prototype.available=function(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset},r})();i.BitStream=s}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.shiftJISTable={32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:165,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:8254,33088:12288,33089:12289,33090:12290,33091:65292,33092:65294,33093:12539,33094:65306,33095:65307,33096:65311,33097:65281,33098:12443,33099:12444,33100:180,33101:65344,33102:168,33103:65342,33104:65507,33105:65343,33106:12541,33107:12542,33108:12445,33109:12446,33110:12291,33111:20189,33112:12293,33113:12294,33114:12295,33115:12540,33116:8213,33117:8208,33118:65295,33119:92,33120:12316,33121:8214,33122:65372,33123:8230,33124:8229,33125:8216,33126:8217,33127:8220,33128:8221,33129:65288,33130:65289,33131:12308,33132:12309,33133:65339,33134:65341,33135:65371,33136:65373,33137:12296,33138:12297,33139:12298,33140:12299,33141:12300,33142:12301,33143:12302,33144:12303,33145:12304,33146:12305,33147:65291,33148:8722,33149:177,33150:215,33152:247,33153:65309,33154:8800,33155:65308,33156:65310,33157:8806,33158:8807,33159:8734,33160:8756,33161:9794,33162:9792,33163:176,33164:8242,33165:8243,33166:8451,33167:65509,33168:65284,33169:162,33170:163,33171:65285,33172:65283,33173:65286,33174:65290,33175:65312,33176:167,33177:9734,33178:9733,33179:9675,33180:9679,33181:9678,33182:9671,33183:9670,33184:9633,33185:9632,33186:9651,33187:9650,33188:9661,33189:9660,33190:8251,33191:12306,33192:8594,33193:8592,33194:8593,33195:8595,33196:12307,33208:8712,33209:8715,33210:8838,33211:8839,33212:8834,33213:8835,33214:8746,33215:8745,33224:8743,33225:8744,33226:172,33227:8658,33228:8660,33229:8704,33230:8707,33242:8736,33243:8869,33244:8978,33245:8706,33246:8711,33247:8801,33248:8786,33249:8810,33250:8811,33251:8730,33252:8765,33253:8733,33254:8757,33255:8747,33256:8748,33264:8491,33265:8240,33266:9839,33267:9837,33268:9834,33269:8224,33270:8225,33271:182,33276:9711,33359:65296,33360:65297,33361:65298,33362:65299,33363:65300,33364:65301,33365:65302,33366:65303,33367:65304,33368:65305,33376:65313,33377:65314,33378:65315,33379:65316,33380:65317,33381:65318,33382:65319,33383:65320,33384:65321,33385:65322,33386:65323,33387:65324,33388:65325,33389:65326,33390:65327,33391:65328,33392:65329,33393:65330,33394:65331,33395:65332,33396:65333,33397:65334,33398:65335,33399:65336,33400:65337,33401:65338,33409:65345,33410:65346,33411:65347,33412:65348,33413:65349,33414:65350,33415:65351,33416:65352,33417:65353,33418:65354,33419:65355,33420:65356,33421:65357,33422:65358,33423:65359,33424:65360,33425:65361,33426:65362,33427:65363,33428:65364,33429:65365,33430:65366,33431:65367,33432:65368,33433:65369,33434:65370,33439:12353,33440:12354,33441:12355,33442:12356,33443:12357,33444:12358,33445:12359,33446:12360,33447:12361,33448:12362,33449:12363,33450:12364,33451:12365,33452:12366,33453:12367,33454:12368,33455:12369,33456:12370,33457:12371,33458:12372,33459:12373,33460:12374,33461:12375,33462:12376,33463:12377,33464:12378,33465:12379,33466:12380,33467:12381,33468:12382,33469:12383,33470:12384,33471:12385,33472:12386,33473:12387,33474:12388,33475:12389,33476:12390,33477:12391,33478:12392,33479:12393,33480:12394,33481:12395,33482:12396,33483:12397,33484:12398,33485:12399,33486:12400,33487:12401,33488:12402,33489:12403,33490:12404,33491:12405,33492:12406,33493:12407,33494:12408,33495:12409,33496:12410,33497:12411,33498:12412,33499:12413,33500:12414,33501:12415,33502:12416,33503:12417,33504:12418,33505:12419,33506:12420,33507:12421,33508:12422,33509:12423,33510:12424,33511:12425,33512:12426,33513:12427,33514:12428,33515:12429,33516:12430,33517:12431,33518:12432,33519:12433,33520:12434,33521:12435,33600:12449,33601:12450,33602:12451,33603:12452,33604:12453,33605:12454,33606:12455,33607:12456,33608:12457,33609:12458,33610:12459,33611:12460,33612:12461,33613:12462,33614:12463,33615:12464,33616:12465,33617:12466,33618:12467,33619:12468,33620:12469,33621:12470,33622:12471,33623:12472,33624:12473,33625:12474,33626:12475,33627:12476,33628:12477,33629:12478,33630:12479,33631:12480,33632:12481,33633:12482,33634:12483,33635:12484,33636:12485,33637:12486,33638:12487,33639:12488,33640:12489,33641:12490,33642:12491,33643:12492,33644:12493,33645:12494,33646:12495,33647:12496,33648:12497,33649:12498,33650:12499,33651:12500,33652:12501,33653:12502,33654:12503,33655:12504,33656:12505,33657:12506,33658:12507,33659:12508,33660:12509,33661:12510,33662:12511,33664:12512,33665:12513,33666:12514,33667:12515,33668:12516,33669:12517,33670:12518,33671:12519,33672:12520,33673:12521,33674:12522,33675:12523,33676:12524,33677:12525,33678:12526,33679:12527,33680:12528,33681:12529,33682:12530,33683:12531,33684:12532,33685:12533,33686:12534,33695:913,33696:914,33697:915,33698:916,33699:917,33700:918,33701:919,33702:920,33703:921,33704:922,33705:923,33706:924,33707:925,33708:926,33709:927,33710:928,33711:929,33712:931,33713:932,33714:933,33715:934,33716:935,33717:936,33718:937,33727:945,33728:946,33729:947,33730:948,33731:949,33732:950,33733:951,33734:952,33735:953,33736:954,33737:955,33738:956,33739:957,33740:958,33741:959,33742:960,33743:961,33744:963,33745:964,33746:965,33747:966,33748:967,33749:968,33750:969,33856:1040,33857:1041,33858:1042,33859:1043,33860:1044,33861:1045,33862:1025,33863:1046,33864:1047,33865:1048,33866:1049,33867:1050,33868:1051,33869:1052,33870:1053,33871:1054,33872:1055,33873:1056,33874:1057,33875:1058,33876:1059,33877:1060,33878:1061,33879:1062,33880:1063,33881:1064,33882:1065,33883:1066,33884:1067,33885:1068,33886:1069,33887:1070,33888:1071,33904:1072,33905:1073,33906:1074,33907:1075,33908:1076,33909:1077,33910:1105,33911:1078,33912:1079,33913:1080,33914:1081,33915:1082,33916:1083,33917:1084,33918:1085,33920:1086,33921:1087,33922:1088,33923:1089,33924:1090,33925:1091,33926:1092,33927:1093,33928:1094,33929:1095,33930:1096,33931:1097,33932:1098,33933:1099,33934:1100,33935:1101,33936:1102,33937:1103,33951:9472,33952:9474,33953:9484,33954:9488,33955:9496,33956:9492,33957:9500,33958:9516,33959:9508,33960:9524,33961:9532,33962:9473,33963:9475,33964:9487,33965:9491,33966:9499,33967:9495,33968:9507,33969:9523,33970:9515,33971:9531,33972:9547,33973:9504,33974:9519,33975:9512,33976:9527,33977:9535,33978:9501,33979:9520,33980:9509,33981:9528,33982:9538,34975:20124,34976:21782,34977:23043,34978:38463,34979:21696,34980:24859,34981:25384,34982:23030,34983:36898,34984:33909,34985:33564,34986:31312,34987:24746,34988:25569,34989:28197,34990:26093,34991:33894,34992:33446,34993:39925,34994:26771,34995:22311,34996:26017,34997:25201,34998:23451,34999:22992,35e3:34427,35001:39156,35002:32098,35003:32190,35004:39822,35005:25110,35006:31903,35007:34999,35008:23433,35009:24245,35010:25353,35011:26263,35012:26696,35013:38343,35014:38797,35015:26447,35016:20197,35017:20234,35018:20301,35019:20381,35020:20553,35021:22258,35022:22839,35023:22996,35024:23041,35025:23561,35026:24799,35027:24847,35028:24944,35029:26131,35030:26885,35031:28858,35032:30031,35033:30064,35034:31227,35035:32173,35036:32239,35037:32963,35038:33806,35039:34915,35040:35586,35041:36949,35042:36986,35043:21307,35044:20117,35045:20133,35046:22495,35047:32946,35048:37057,35049:30959,35050:19968,35051:22769,35052:28322,35053:36920,35054:31282,35055:33576,35056:33419,35057:39983,35058:20801,35059:21360,35060:21693,35061:21729,35062:22240,35063:23035,35064:24341,35065:39154,35066:28139,35067:32996,35068:34093,35136:38498,35137:38512,35138:38560,35139:38907,35140:21515,35141:21491,35142:23431,35143:28879,35144:32701,35145:36802,35146:38632,35147:21359,35148:40284,35149:31418,35150:19985,35151:30867,35152:33276,35153:28198,35154:22040,35155:21764,35156:27421,35157:34074,35158:39995,35159:23013,35160:21417,35161:28006,35162:29916,35163:38287,35164:22082,35165:20113,35166:36939,35167:38642,35168:33615,35169:39180,35170:21473,35171:21942,35172:23344,35173:24433,35174:26144,35175:26355,35176:26628,35177:27704,35178:27891,35179:27945,35180:29787,35181:30408,35182:31310,35183:38964,35184:33521,35185:34907,35186:35424,35187:37613,35188:28082,35189:30123,35190:30410,35191:39365,35192:24742,35193:35585,35194:36234,35195:38322,35196:27022,35197:21421,35198:20870,35200:22290,35201:22576,35202:22852,35203:23476,35204:24310,35205:24616,35206:25513,35207:25588,35208:27839,35209:28436,35210:28814,35211:28948,35212:29017,35213:29141,35214:29503,35215:32257,35216:33398,35217:33489,35218:34199,35219:36960,35220:37467,35221:40219,35222:22633,35223:26044,35224:27738,35225:29989,35226:20985,35227:22830,35228:22885,35229:24448,35230:24540,35231:25276,35232:26106,35233:27178,35234:27431,35235:27572,35236:29579,35237:32705,35238:35158,35239:40236,35240:40206,35241:40644,35242:23713,35243:27798,35244:33659,35245:20740,35246:23627,35247:25014,35248:33222,35249:26742,35250:29281,35251:20057,35252:20474,35253:21368,35254:24681,35255:28201,35256:31311,35257:38899,35258:19979,35259:21270,35260:20206,35261:20309,35262:20285,35263:20385,35264:20339,35265:21152,35266:21487,35267:22025,35268:22799,35269:23233,35270:23478,35271:23521,35272:31185,35273:26247,35274:26524,35275:26550,35276:27468,35277:27827,35278:28779,35279:29634,35280:31117,35281:31166,35282:31292,35283:31623,35284:33457,35285:33499,35286:33540,35287:33655,35288:33775,35289:33747,35290:34662,35291:35506,35292:22057,35293:36008,35294:36838,35295:36942,35296:38686,35297:34442,35298:20420,35299:23784,35300:25105,35301:29273,35302:30011,35303:33253,35304:33469,35305:34558,35306:36032,35307:38597,35308:39187,35309:39381,35310:20171,35311:20250,35312:35299,35313:22238,35314:22602,35315:22730,35316:24315,35317:24555,35318:24618,35319:24724,35320:24674,35321:25040,35322:25106,35323:25296,35324:25913,35392:39745,35393:26214,35394:26800,35395:28023,35396:28784,35397:30028,35398:30342,35399:32117,35400:33445,35401:34809,35402:38283,35403:38542,35404:35997,35405:20977,35406:21182,35407:22806,35408:21683,35409:23475,35410:23830,35411:24936,35412:27010,35413:28079,35414:30861,35415:33995,35416:34903,35417:35442,35418:37799,35419:39608,35420:28012,35421:39336,35422:34521,35423:22435,35424:26623,35425:34510,35426:37390,35427:21123,35428:22151,35429:21508,35430:24275,35431:25313,35432:25785,35433:26684,35434:26680,35435:27579,35436:29554,35437:30906,35438:31339,35439:35226,35440:35282,35441:36203,35442:36611,35443:37101,35444:38307,35445:38548,35446:38761,35447:23398,35448:23731,35449:27005,35450:38989,35451:38990,35452:25499,35453:31520,35454:27179,35456:27263,35457:26806,35458:39949,35459:28511,35460:21106,35461:21917,35462:24688,35463:25324,35464:27963,35465:28167,35466:28369,35467:33883,35468:35088,35469:36676,35470:19988,35471:39993,35472:21494,35473:26907,35474:27194,35475:38788,35476:26666,35477:20828,35478:31427,35479:33970,35480:37340,35481:37772,35482:22107,35483:40232,35484:26658,35485:33541,35486:33841,35487:31909,35488:21e3,35489:33477,35490:29926,35491:20094,35492:20355,35493:20896,35494:23506,35495:21002,35496:21208,35497:21223,35498:24059,35499:21914,35500:22570,35501:23014,35502:23436,35503:23448,35504:23515,35505:24178,35506:24185,35507:24739,35508:24863,35509:24931,35510:25022,35511:25563,35512:25954,35513:26577,35514:26707,35515:26874,35516:27454,35517:27475,35518:27735,35519:28450,35520:28567,35521:28485,35522:29872,35523:29976,35524:30435,35525:30475,35526:31487,35527:31649,35528:31777,35529:32233,35530:32566,35531:32752,35532:32925,35533:33382,35534:33694,35535:35251,35536:35532,35537:36011,35538:36996,35539:37969,35540:38291,35541:38289,35542:38306,35543:38501,35544:38867,35545:39208,35546:33304,35547:20024,35548:21547,35549:23736,35550:24012,35551:29609,35552:30284,35553:30524,35554:23721,35555:32747,35556:36107,35557:38593,35558:38929,35559:38996,35560:39e3,35561:20225,35562:20238,35563:21361,35564:21916,35565:22120,35566:22522,35567:22855,35568:23305,35569:23492,35570:23696,35571:24076,35572:24190,35573:24524,35574:25582,35575:26426,35576:26071,35577:26082,35578:26399,35579:26827,35580:26820,35648:27231,35649:24112,35650:27589,35651:27671,35652:27773,35653:30079,35654:31048,35655:23395,35656:31232,35657:32e3,35658:24509,35659:35215,35660:35352,35661:36020,35662:36215,35663:36556,35664:36637,35665:39138,35666:39438,35667:39740,35668:20096,35669:20605,35670:20736,35671:22931,35672:23452,35673:25135,35674:25216,35675:25836,35676:27450,35677:29344,35678:30097,35679:31047,35680:32681,35681:34811,35682:35516,35683:35696,35684:25516,35685:33738,35686:38816,35687:21513,35688:21507,35689:21931,35690:26708,35691:27224,35692:35440,35693:30759,35694:26485,35695:40653,35696:21364,35697:23458,35698:33050,35699:34384,35700:36870,35701:19992,35702:20037,35703:20167,35704:20241,35705:21450,35706:21560,35707:23470,35708:24339,35709:24613,35710:25937,35712:26429,35713:27714,35714:27762,35715:27875,35716:28792,35717:29699,35718:31350,35719:31406,35720:31496,35721:32026,35722:31998,35723:32102,35724:26087,35725:29275,35726:21435,35727:23621,35728:24040,35729:25298,35730:25312,35731:25369,35732:28192,35733:34394,35734:35377,35735:36317,35736:37624,35737:28417,35738:31142,35739:39770,35740:20136,35741:20139,35742:20140,35743:20379,35744:20384,35745:20689,35746:20807,35747:31478,35748:20849,35749:20982,35750:21332,35751:21281,35752:21375,35753:21483,35754:21932,35755:22659,35756:23777,35757:24375,35758:24394,35759:24623,35760:24656,35761:24685,35762:25375,35763:25945,35764:27211,35765:27841,35766:29378,35767:29421,35768:30703,35769:33016,35770:33029,35771:33288,35772:34126,35773:37111,35774:37857,35775:38911,35776:39255,35777:39514,35778:20208,35779:20957,35780:23597,35781:26241,35782:26989,35783:23616,35784:26354,35785:26997,35786:29577,35787:26704,35788:31873,35789:20677,35790:21220,35791:22343,35792:24062,35793:37670,35794:26020,35795:27427,35796:27453,35797:29748,35798:31105,35799:31165,35800:31563,35801:32202,35802:33465,35803:33740,35804:34943,35805:35167,35806:35641,35807:36817,35808:37329,35809:21535,35810:37504,35811:20061,35812:20534,35813:21477,35814:21306,35815:29399,35816:29590,35817:30697,35818:33510,35819:36527,35820:39366,35821:39368,35822:39378,35823:20855,35824:24858,35825:34398,35826:21936,35827:31354,35828:20598,35829:23507,35830:36935,35831:38533,35832:20018,35833:27355,35834:37351,35835:23633,35836:23624,35904:25496,35905:31391,35906:27795,35907:38772,35908:36705,35909:31402,35910:29066,35911:38536,35912:31874,35913:26647,35914:32368,35915:26705,35916:37740,35917:21234,35918:21531,35919:34219,35920:35347,35921:32676,35922:36557,35923:37089,35924:21350,35925:34952,35926:31041,35927:20418,35928:20670,35929:21009,35930:20804,35931:21843,35932:22317,35933:29674,35934:22411,35935:22865,35936:24418,35937:24452,35938:24693,35939:24950,35940:24935,35941:25001,35942:25522,35943:25658,35944:25964,35945:26223,35946:26690,35947:28179,35948:30054,35949:31293,35950:31995,35951:32076,35952:32153,35953:32331,35954:32619,35955:33550,35956:33610,35957:34509,35958:35336,35959:35427,35960:35686,35961:36605,35962:38938,35963:40335,35964:33464,35965:36814,35966:39912,35968:21127,35969:25119,35970:25731,35971:28608,35972:38553,35973:26689,35974:20625,35975:27424,35976:27770,35977:28500,35978:31348,35979:32080,35980:34880,35981:35363,35982:26376,35983:20214,35984:20537,35985:20518,35986:20581,35987:20860,35988:21048,35989:21091,35990:21927,35991:22287,35992:22533,35993:23244,35994:24314,35995:25010,35996:25080,35997:25331,35998:25458,35999:26908,36e3:27177,36001:29309,36002:29356,36003:29486,36004:30740,36005:30831,36006:32121,36007:30476,36008:32937,36009:35211,36010:35609,36011:36066,36012:36562,36013:36963,36014:37749,36015:38522,36016:38997,36017:39443,36018:40568,36019:20803,36020:21407,36021:21427,36022:24187,36023:24358,36024:28187,36025:28304,36026:29572,36027:29694,36028:32067,36029:33335,36030:35328,36031:35578,36032:38480,36033:20046,36034:20491,36035:21476,36036:21628,36037:22266,36038:22993,36039:23396,36040:24049,36041:24235,36042:24359,36043:25144,36044:25925,36045:26543,36046:28246,36047:29392,36048:31946,36049:34996,36050:32929,36051:32993,36052:33776,36053:34382,36054:35463,36055:36328,36056:37431,36057:38599,36058:39015,36059:40723,36060:20116,36061:20114,36062:20237,36063:21320,36064:21577,36065:21566,36066:23087,36067:24460,36068:24481,36069:24735,36070:26791,36071:27278,36072:29786,36073:30849,36074:35486,36075:35492,36076:35703,36077:37264,36078:20062,36079:39881,36080:20132,36081:20348,36082:20399,36083:20505,36084:20502,36085:20809,36086:20844,36087:21151,36088:21177,36089:21246,36090:21402,36091:21475,36092:21521,36160:21518,36161:21897,36162:22353,36163:22434,36164:22909,36165:23380,36166:23389,36167:23439,36168:24037,36169:24039,36170:24055,36171:24184,36172:24195,36173:24218,36174:24247,36175:24344,36176:24658,36177:24908,36178:25239,36179:25304,36180:25511,36181:25915,36182:26114,36183:26179,36184:26356,36185:26477,36186:26657,36187:26775,36188:27083,36189:27743,36190:27946,36191:28009,36192:28207,36193:28317,36194:30002,36195:30343,36196:30828,36197:31295,36198:31968,36199:32005,36200:32024,36201:32094,36202:32177,36203:32789,36204:32771,36205:32943,36206:32945,36207:33108,36208:33167,36209:33322,36210:33618,36211:34892,36212:34913,36213:35611,36214:36002,36215:36092,36216:37066,36217:37237,36218:37489,36219:30783,36220:37628,36221:38308,36222:38477,36224:38917,36225:39321,36226:39640,36227:40251,36228:21083,36229:21163,36230:21495,36231:21512,36232:22741,36233:25335,36234:28640,36235:35946,36236:36703,36237:40633,36238:20811,36239:21051,36240:21578,36241:22269,36242:31296,36243:37239,36244:40288,36245:40658,36246:29508,36247:28425,36248:33136,36249:29969,36250:24573,36251:24794,36252:39592,36253:29403,36254:36796,36255:27492,36256:38915,36257:20170,36258:22256,36259:22372,36260:22718,36261:23130,36262:24680,36263:25031,36264:26127,36265:26118,36266:26681,36267:26801,36268:28151,36269:30165,36270:32058,36271:33390,36272:39746,36273:20123,36274:20304,36275:21449,36276:21766,36277:23919,36278:24038,36279:24046,36280:26619,36281:27801,36282:29811,36283:30722,36284:35408,36285:37782,36286:35039,36287:22352,36288:24231,36289:25387,36290:20661,36291:20652,36292:20877,36293:26368,36294:21705,36295:22622,36296:22971,36297:23472,36298:24425,36299:25165,36300:25505,36301:26685,36302:27507,36303:28168,36304:28797,36305:37319,36306:29312,36307:30741,36308:30758,36309:31085,36310:25998,36311:32048,36312:33756,36313:35009,36314:36617,36315:38555,36316:21092,36317:22312,36318:26448,36319:32618,36320:36001,36321:20916,36322:22338,36323:38442,36324:22586,36325:27018,36326:32948,36327:21682,36328:23822,36329:22524,36330:30869,36331:40442,36332:20316,36333:21066,36334:21643,36335:25662,36336:26152,36337:26388,36338:26613,36339:31364,36340:31574,36341:32034,36342:37679,36343:26716,36344:39853,36345:31545,36346:21273,36347:20874,36348:21047,36416:23519,36417:25334,36418:25774,36419:25830,36420:26413,36421:27578,36422:34217,36423:38609,36424:30352,36425:39894,36426:25420,36427:37638,36428:39851,36429:30399,36430:26194,36431:19977,36432:20632,36433:21442,36434:23665,36435:24808,36436:25746,36437:25955,36438:26719,36439:29158,36440:29642,36441:29987,36442:31639,36443:32386,36444:34453,36445:35715,36446:36059,36447:37240,36448:39184,36449:26028,36450:26283,36451:27531,36452:20181,36453:20180,36454:20282,36455:20351,36456:21050,36457:21496,36458:21490,36459:21987,36460:22235,36461:22763,36462:22987,36463:22985,36464:23039,36465:23376,36466:23629,36467:24066,36468:24107,36469:24535,36470:24605,36471:25351,36472:25903,36473:23388,36474:26031,36475:26045,36476:26088,36477:26525,36478:27490,36480:27515,36481:27663,36482:29509,36483:31049,36484:31169,36485:31992,36486:32025,36487:32043,36488:32930,36489:33026,36490:33267,36491:35222,36492:35422,36493:35433,36494:35430,36495:35468,36496:35566,36497:36039,36498:36060,36499:38604,36500:39164,36501:27503,36502:20107,36503:20284,36504:20365,36505:20816,36506:23383,36507:23546,36508:24904,36509:25345,36510:26178,36511:27425,36512:28363,36513:27835,36514:29246,36515:29885,36516:30164,36517:30913,36518:31034,36519:32780,36520:32819,36521:33258,36522:33940,36523:36766,36524:27728,36525:40575,36526:24335,36527:35672,36528:40235,36529:31482,36530:36600,36531:23437,36532:38635,36533:19971,36534:21489,36535:22519,36536:22833,36537:23241,36538:23460,36539:24713,36540:28287,36541:28422,36542:30142,36543:36074,36544:23455,36545:34048,36546:31712,36547:20594,36548:26612,36549:33437,36550:23649,36551:34122,36552:32286,36553:33294,36554:20889,36555:23556,36556:25448,36557:36198,36558:26012,36559:29038,36560:31038,36561:32023,36562:32773,36563:35613,36564:36554,36565:36974,36566:34503,36567:37034,36568:20511,36569:21242,36570:23610,36571:26451,36572:28796,36573:29237,36574:37196,36575:37320,36576:37675,36577:33509,36578:23490,36579:24369,36580:24825,36581:20027,36582:21462,36583:23432,36584:25163,36585:26417,36586:27530,36587:29417,36588:29664,36589:31278,36590:33131,36591:36259,36592:37202,36593:39318,36594:20754,36595:21463,36596:21610,36597:23551,36598:25480,36599:27193,36600:32172,36601:38656,36602:22234,36603:21454,36604:21608,36672:23447,36673:23601,36674:24030,36675:20462,36676:24833,36677:25342,36678:27954,36679:31168,36680:31179,36681:32066,36682:32333,36683:32722,36684:33261,36685:33311,36686:33936,36687:34886,36688:35186,36689:35728,36690:36468,36691:36655,36692:36913,36693:37195,36694:37228,36695:38598,36696:37276,36697:20160,36698:20303,36699:20805,36700:21313,36701:24467,36702:25102,36703:26580,36704:27713,36705:28171,36706:29539,36707:32294,36708:37325,36709:37507,36710:21460,36711:22809,36712:23487,36713:28113,36714:31069,36715:32302,36716:31899,36717:22654,36718:29087,36719:20986,36720:34899,36721:36848,36722:20426,36723:23803,36724:26149,36725:30636,36726:31459,36727:33308,36728:39423,36729:20934,36730:24490,36731:26092,36732:26991,36733:27529,36734:28147,36736:28310,36737:28516,36738:30462,36739:32020,36740:24033,36741:36981,36742:37255,36743:38918,36744:20966,36745:21021,36746:25152,36747:26257,36748:26329,36749:28186,36750:24246,36751:32210,36752:32626,36753:26360,36754:34223,36755:34295,36756:35576,36757:21161,36758:21465,36759:22899,36760:24207,36761:24464,36762:24661,36763:37604,36764:38500,36765:20663,36766:20767,36767:21213,36768:21280,36769:21319,36770:21484,36771:21736,36772:21830,36773:21809,36774:22039,36775:22888,36776:22974,36777:23100,36778:23477,36779:23558,36780:23567,36781:23569,36782:23578,36783:24196,36784:24202,36785:24288,36786:24432,36787:25215,36788:25220,36789:25307,36790:25484,36791:25463,36792:26119,36793:26124,36794:26157,36795:26230,36796:26494,36797:26786,36798:27167,36799:27189,36800:27836,36801:28040,36802:28169,36803:28248,36804:28988,36805:28966,36806:29031,36807:30151,36808:30465,36809:30813,36810:30977,36811:31077,36812:31216,36813:31456,36814:31505,36815:31911,36816:32057,36817:32918,36818:33750,36819:33931,36820:34121,36821:34909,36822:35059,36823:35359,36824:35388,36825:35412,36826:35443,36827:35937,36828:36062,36829:37284,36830:37478,36831:37758,36832:37912,36833:38556,36834:38808,36835:19978,36836:19976,36837:19998,36838:20055,36839:20887,36840:21104,36841:22478,36842:22580,36843:22732,36844:23330,36845:24120,36846:24773,36847:25854,36848:26465,36849:26454,36850:27972,36851:29366,36852:30067,36853:31331,36854:33976,36855:35698,36856:37304,36857:37664,36858:22065,36859:22516,36860:39166,36928:25325,36929:26893,36930:27542,36931:29165,36932:32340,36933:32887,36934:33394,36935:35302,36936:39135,36937:34645,36938:36785,36939:23611,36940:20280,36941:20449,36942:20405,36943:21767,36944:23072,36945:23517,36946:23529,36947:24515,36948:24910,36949:25391,36950:26032,36951:26187,36952:26862,36953:27035,36954:28024,36955:28145,36956:30003,36957:30137,36958:30495,36959:31070,36960:31206,36961:32051,36962:33251,36963:33455,36964:34218,36965:35242,36966:35386,36967:36523,36968:36763,36969:36914,36970:37341,36971:38663,36972:20154,36973:20161,36974:20995,36975:22645,36976:22764,36977:23563,36978:29978,36979:23613,36980:33102,36981:35338,36982:36805,36983:38499,36984:38765,36985:31525,36986:35535,36987:38920,36988:37218,36989:22259,36990:21416,36992:36887,36993:21561,36994:22402,36995:24101,36996:25512,36997:27700,36998:28810,36999:30561,37e3:31883,37001:32736,37002:34928,37003:36930,37004:37204,37005:37648,37006:37656,37007:38543,37008:29790,37009:39620,37010:23815,37011:23913,37012:25968,37013:26530,37014:36264,37015:38619,37016:25454,37017:26441,37018:26905,37019:33733,37020:38935,37021:38592,37022:35070,37023:28548,37024:25722,37025:23544,37026:19990,37027:28716,37028:30045,37029:26159,37030:20932,37031:21046,37032:21218,37033:22995,37034:24449,37035:24615,37036:25104,37037:25919,37038:25972,37039:26143,37040:26228,37041:26866,37042:26646,37043:27491,37044:28165,37045:29298,37046:29983,37047:30427,37048:31934,37049:32854,37050:22768,37051:35069,37052:35199,37053:35488,37054:35475,37055:35531,37056:36893,37057:37266,37058:38738,37059:38745,37060:25993,37061:31246,37062:33030,37063:38587,37064:24109,37065:24796,37066:25114,37067:26021,37068:26132,37069:26512,37070:30707,37071:31309,37072:31821,37073:32318,37074:33034,37075:36012,37076:36196,37077:36321,37078:36447,37079:30889,37080:20999,37081:25305,37082:25509,37083:25666,37084:25240,37085:35373,37086:31363,37087:31680,37088:35500,37089:38634,37090:32118,37091:33292,37092:34633,37093:20185,37094:20808,37095:21315,37096:21344,37097:23459,37098:23554,37099:23574,37100:24029,37101:25126,37102:25159,37103:25776,37104:26643,37105:26676,37106:27849,37107:27973,37108:27927,37109:26579,37110:28508,37111:29006,37112:29053,37113:26059,37114:31359,37115:31661,37116:32218,37184:32330,37185:32680,37186:33146,37187:33307,37188:33337,37189:34214,37190:35438,37191:36046,37192:36341,37193:36984,37194:36983,37195:37549,37196:37521,37197:38275,37198:39854,37199:21069,37200:21892,37201:28472,37202:28982,37203:20840,37204:31109,37205:32341,37206:33203,37207:31950,37208:22092,37209:22609,37210:23720,37211:25514,37212:26366,37213:26365,37214:26970,37215:29401,37216:30095,37217:30094,37218:30990,37219:31062,37220:31199,37221:31895,37222:32032,37223:32068,37224:34311,37225:35380,37226:38459,37227:36961,37228:40736,37229:20711,37230:21109,37231:21452,37232:21474,37233:20489,37234:21930,37235:22766,37236:22863,37237:29245,37238:23435,37239:23652,37240:21277,37241:24803,37242:24819,37243:25436,37244:25475,37245:25407,37246:25531,37248:25805,37249:26089,37250:26361,37251:24035,37252:27085,37253:27133,37254:28437,37255:29157,37256:20105,37257:30185,37258:30456,37259:31379,37260:31967,37261:32207,37262:32156,37263:32865,37264:33609,37265:33624,37266:33900,37267:33980,37268:34299,37269:35013,37270:36208,37271:36865,37272:36973,37273:37783,37274:38684,37275:39442,37276:20687,37277:22679,37278:24974,37279:33235,37280:34101,37281:36104,37282:36896,37283:20419,37284:20596,37285:21063,37286:21363,37287:24687,37288:25417,37289:26463,37290:28204,37291:36275,37292:36895,37293:20439,37294:23646,37295:36042,37296:26063,37297:32154,37298:21330,37299:34966,37300:20854,37301:25539,37302:23384,37303:23403,37304:23562,37305:25613,37306:26449,37307:36956,37308:20182,37309:22810,37310:22826,37311:27760,37312:35409,37313:21822,37314:22549,37315:22949,37316:24816,37317:25171,37318:26561,37319:33333,37320:26965,37321:38464,37322:39364,37323:39464,37324:20307,37325:22534,37326:23550,37327:32784,37328:23729,37329:24111,37330:24453,37331:24608,37332:24907,37333:25140,37334:26367,37335:27888,37336:28382,37337:32974,37338:33151,37339:33492,37340:34955,37341:36024,37342:36864,37343:36910,37344:38538,37345:40667,37346:39899,37347:20195,37348:21488,37349:22823,37350:31532,37351:37261,37352:38988,37353:40441,37354:28381,37355:28711,37356:21331,37357:21828,37358:23429,37359:25176,37360:25246,37361:25299,37362:27810,37363:28655,37364:29730,37365:35351,37366:37944,37367:28609,37368:35582,37369:33592,37370:20967,37371:34552,37372:21482,37440:21481,37441:20294,37442:36948,37443:36784,37444:22890,37445:33073,37446:24061,37447:31466,37448:36799,37449:26842,37450:35895,37451:29432,37452:40008,37453:27197,37454:35504,37455:20025,37456:21336,37457:22022,37458:22374,37459:25285,37460:25506,37461:26086,37462:27470,37463:28129,37464:28251,37465:28845,37466:30701,37467:31471,37468:31658,37469:32187,37470:32829,37471:32966,37472:34507,37473:35477,37474:37723,37475:22243,37476:22727,37477:24382,37478:26029,37479:26262,37480:27264,37481:27573,37482:30007,37483:35527,37484:20516,37485:30693,37486:22320,37487:24347,37488:24677,37489:26234,37490:27744,37491:30196,37492:31258,37493:32622,37494:33268,37495:34584,37496:36933,37497:39347,37498:31689,37499:30044,37500:31481,37501:31569,37502:33988,37504:36880,37505:31209,37506:31378,37507:33590,37508:23265,37509:30528,37510:20013,37511:20210,37512:23449,37513:24544,37514:25277,37515:26172,37516:26609,37517:27880,37518:34411,37519:34935,37520:35387,37521:37198,37522:37619,37523:39376,37524:27159,37525:28710,37526:29482,37527:33511,37528:33879,37529:36015,37530:19969,37531:20806,37532:20939,37533:21899,37534:23541,37535:24086,37536:24115,37537:24193,37538:24340,37539:24373,37540:24427,37541:24500,37542:25074,37543:25361,37544:26274,37545:26397,37546:28526,37547:29266,37548:30010,37549:30522,37550:32884,37551:33081,37552:33144,37553:34678,37554:35519,37555:35548,37556:36229,37557:36339,37558:37530,37559:38263,37560:38914,37561:40165,37562:21189,37563:25431,37564:30452,37565:26389,37566:27784,37567:29645,37568:36035,37569:37806,37570:38515,37571:27941,37572:22684,37573:26894,37574:27084,37575:36861,37576:37786,37577:30171,37578:36890,37579:22618,37580:26626,37581:25524,37582:27131,37583:20291,37584:28460,37585:26584,37586:36795,37587:34086,37588:32180,37589:37716,37590:26943,37591:28528,37592:22378,37593:22775,37594:23340,37595:32044,37596:29226,37597:21514,37598:37347,37599:40372,37600:20141,37601:20302,37602:20572,37603:20597,37604:21059,37605:35998,37606:21576,37607:22564,37608:23450,37609:24093,37610:24213,37611:24237,37612:24311,37613:24351,37614:24716,37615:25269,37616:25402,37617:25552,37618:26799,37619:27712,37620:30855,37621:31118,37622:31243,37623:32224,37624:33351,37625:35330,37626:35558,37627:36420,37628:36883,37696:37048,37697:37165,37698:37336,37699:40718,37700:27877,37701:25688,37702:25826,37703:25973,37704:28404,37705:30340,37706:31515,37707:36969,37708:37841,37709:28346,37710:21746,37711:24505,37712:25764,37713:36685,37714:36845,37715:37444,37716:20856,37717:22635,37718:22825,37719:23637,37720:24215,37721:28155,37722:32399,37723:29980,37724:36028,37725:36578,37726:39003,37727:28857,37728:20253,37729:27583,37730:28593,37731:3e4,37732:38651,37733:20814,37734:21520,37735:22581,37736:22615,37737:22956,37738:23648,37739:24466,37740:26007,37741:26460,37742:28193,37743:30331,37744:33759,37745:36077,37746:36884,37747:37117,37748:37709,37749:30757,37750:30778,37751:21162,37752:24230,37753:22303,37754:22900,37755:24594,37756:20498,37757:20826,37758:20908,37760:20941,37761:20992,37762:21776,37763:22612,37764:22616,37765:22871,37766:23445,37767:23798,37768:23947,37769:24764,37770:25237,37771:25645,37772:26481,37773:26691,37774:26812,37775:26847,37776:30423,37777:28120,37778:28271,37779:28059,37780:28783,37781:29128,37782:24403,37783:30168,37784:31095,37785:31561,37786:31572,37787:31570,37788:31958,37789:32113,37790:21040,37791:33891,37792:34153,37793:34276,37794:35342,37795:35588,37796:35910,37797:36367,37798:36867,37799:36879,37800:37913,37801:38518,37802:38957,37803:39472,37804:38360,37805:20685,37806:21205,37807:21516,37808:22530,37809:23566,37810:24999,37811:25758,37812:27934,37813:30643,37814:31461,37815:33012,37816:33796,37817:36947,37818:37509,37819:23776,37820:40199,37821:21311,37822:24471,37823:24499,37824:28060,37825:29305,37826:30563,37827:31167,37828:31716,37829:27602,37830:29420,37831:35501,37832:26627,37833:27233,37834:20984,37835:31361,37836:26932,37837:23626,37838:40182,37839:33515,37840:23493,37841:37193,37842:28702,37843:22136,37844:23663,37845:24775,37846:25958,37847:27788,37848:35930,37849:36929,37850:38931,37851:21585,37852:26311,37853:37389,37854:22856,37855:37027,37856:20869,37857:20045,37858:20970,37859:34201,37860:35598,37861:28760,37862:25466,37863:37707,37864:26978,37865:39348,37866:32260,37867:30071,37868:21335,37869:26976,37870:36575,37871:38627,37872:27741,37873:20108,37874:23612,37875:24336,37876:36841,37877:21250,37878:36049,37879:32905,37880:34425,37881:24319,37882:26085,37883:20083,37884:20837,37952:22914,37953:23615,37954:38894,37955:20219,37956:22922,37957:24525,37958:35469,37959:28641,37960:31152,37961:31074,37962:23527,37963:33905,37964:29483,37965:29105,37966:24180,37967:24565,37968:25467,37969:25754,37970:29123,37971:31896,37972:20035,37973:24316,37974:20043,37975:22492,37976:22178,37977:24745,37978:28611,37979:32013,37980:33021,37981:33075,37982:33215,37983:36786,37984:35223,37985:34468,37986:24052,37987:25226,37988:25773,37989:35207,37990:26487,37991:27874,37992:27966,37993:29750,37994:30772,37995:23110,37996:32629,37997:33453,37998:39340,37999:20467,38e3:24259,38001:25309,38002:25490,38003:25943,38004:26479,38005:30403,38006:29260,38007:32972,38008:32954,38009:36649,38010:37197,38011:20493,38012:22521,38013:23186,38014:26757,38016:26995,38017:29028,38018:29437,38019:36023,38020:22770,38021:36064,38022:38506,38023:36889,38024:34687,38025:31204,38026:30695,38027:33833,38028:20271,38029:21093,38030:21338,38031:25293,38032:26575,38033:27850,38034:30333,38035:31636,38036:31893,38037:33334,38038:34180,38039:36843,38040:26333,38041:28448,38042:29190,38043:32283,38044:33707,38045:39361,38046:40614,38047:20989,38048:31665,38049:30834,38050:31672,38051:32903,38052:31560,38053:27368,38054:24161,38055:32908,38056:30033,38057:30048,38058:20843,38059:37474,38060:28300,38061:30330,38062:37271,38063:39658,38064:20240,38065:32624,38066:25244,38067:31567,38068:38309,38069:40169,38070:22138,38071:22617,38072:34532,38073:38588,38074:20276,38075:21028,38076:21322,38077:21453,38078:21467,38079:24070,38080:25644,38081:26001,38082:26495,38083:27710,38084:27726,38085:29256,38086:29359,38087:29677,38088:30036,38089:32321,38090:33324,38091:34281,38092:36009,38093:31684,38094:37318,38095:29033,38096:38930,38097:39151,38098:25405,38099:26217,38100:30058,38101:30436,38102:30928,38103:34115,38104:34542,38105:21290,38106:21329,38107:21542,38108:22915,38109:24199,38110:24444,38111:24754,38112:25161,38113:25209,38114:25259,38115:26e3,38116:27604,38117:27852,38118:30130,38119:30382,38120:30865,38121:31192,38122:32203,38123:32631,38124:32933,38125:34987,38126:35513,38127:36027,38128:36991,38129:38750,38130:39131,38131:27147,38132:31800,38133:20633,38134:23614,38135:24494,38136:26503,38137:27608,38138:29749,38139:30473,38140:32654,38208:40763,38209:26570,38210:31255,38211:21305,38212:30091,38213:39661,38214:24422,38215:33181,38216:33777,38217:32920,38218:24380,38219:24517,38220:30050,38221:31558,38222:36924,38223:26727,38224:23019,38225:23195,38226:32016,38227:30334,38228:35628,38229:20469,38230:24426,38231:27161,38232:27703,38233:28418,38234:29922,38235:31080,38236:34920,38237:35413,38238:35961,38239:24287,38240:25551,38241:30149,38242:31186,38243:33495,38244:37672,38245:37618,38246:33948,38247:34541,38248:39981,38249:21697,38250:24428,38251:25996,38252:27996,38253:28693,38254:36007,38255:36051,38256:38971,38257:25935,38258:29942,38259:19981,38260:20184,38261:22496,38262:22827,38263:23142,38264:23500,38265:20904,38266:24067,38267:24220,38268:24598,38269:25206,38270:25975,38272:26023,38273:26222,38274:28014,38275:29238,38276:31526,38277:33104,38278:33178,38279:33433,38280:35676,38281:36e3,38282:36070,38283:36212,38284:38428,38285:38468,38286:20398,38287:25771,38288:27494,38289:33310,38290:33889,38291:34154,38292:37096,38293:23553,38294:26963,38295:39080,38296:33914,38297:34135,38298:20239,38299:21103,38300:24489,38301:24133,38302:26381,38303:31119,38304:33145,38305:35079,38306:35206,38307:28149,38308:24343,38309:25173,38310:27832,38311:20175,38312:29289,38313:39826,38314:20998,38315:21563,38316:22132,38317:22707,38318:24996,38319:25198,38320:28954,38321:22894,38322:31881,38323:31966,38324:32027,38325:38640,38326:25991,38327:32862,38328:19993,38329:20341,38330:20853,38331:22592,38332:24163,38333:24179,38334:24330,38335:26564,38336:20006,38337:34109,38338:38281,38339:38491,38340:31859,38341:38913,38342:20731,38343:22721,38344:30294,38345:30887,38346:21029,38347:30629,38348:34065,38349:31622,38350:20559,38351:22793,38352:29255,38353:31687,38354:32232,38355:36794,38356:36820,38357:36941,38358:20415,38359:21193,38360:23081,38361:24321,38362:38829,38363:20445,38364:33303,38365:37610,38366:22275,38367:25429,38368:27497,38369:29995,38370:35036,38371:36628,38372:31298,38373:21215,38374:22675,38375:24917,38376:25098,38377:26286,38378:27597,38379:31807,38380:33769,38381:20515,38382:20472,38383:21253,38384:21574,38385:22577,38386:22857,38387:23453,38388:23792,38389:23791,38390:23849,38391:24214,38392:25265,38393:25447,38394:25918,38395:26041,38396:26379,38464:27861,38465:27873,38466:28921,38467:30770,38468:32299,38469:32990,38470:33459,38471:33804,38472:34028,38473:34562,38474:35090,38475:35370,38476:35914,38477:37030,38478:37586,38479:39165,38480:40179,38481:40300,38482:20047,38483:20129,38484:20621,38485:21078,38486:22346,38487:22952,38488:24125,38489:24536,38490:24537,38491:25151,38492:26292,38493:26395,38494:26576,38495:26834,38496:20882,38497:32033,38498:32938,38499:33192,38500:35584,38501:35980,38502:36031,38503:37502,38504:38450,38505:21536,38506:38956,38507:21271,38508:20693,38509:21340,38510:22696,38511:25778,38512:26420,38513:29287,38514:30566,38515:31302,38516:37350,38517:21187,38518:27809,38519:27526,38520:22528,38521:24140,38522:22868,38523:26412,38524:32763,38525:20961,38526:30406,38528:25705,38529:30952,38530:39764,38531:40635,38532:22475,38533:22969,38534:26151,38535:26522,38536:27598,38537:21737,38538:27097,38539:24149,38540:33180,38541:26517,38542:39850,38543:26622,38544:40018,38545:26717,38546:20134,38547:20451,38548:21448,38549:25273,38550:26411,38551:27819,38552:36804,38553:20397,38554:32365,38555:40639,38556:19975,38557:24930,38558:28288,38559:28459,38560:34067,38561:21619,38562:26410,38563:39749,38564:24051,38565:31637,38566:23724,38567:23494,38568:34588,38569:28234,38570:34001,38571:31252,38572:33032,38573:22937,38574:31885,38575:27665,38576:30496,38577:21209,38578:22818,38579:28961,38580:29279,38581:30683,38582:38695,38583:40289,38584:26891,38585:23167,38586:23064,38587:20901,38588:21517,38589:21629,38590:26126,38591:30431,38592:36855,38593:37528,38594:40180,38595:23018,38596:29277,38597:28357,38598:20813,38599:26825,38600:32191,38601:32236,38602:38754,38603:40634,38604:25720,38605:27169,38606:33538,38607:22916,38608:23391,38609:27611,38610:29467,38611:30450,38612:32178,38613:32791,38614:33945,38615:20786,38616:26408,38617:40665,38618:30446,38619:26466,38620:21247,38621:39173,38622:23588,38623:25147,38624:31870,38625:36016,38626:21839,38627:24758,38628:32011,38629:38272,38630:21249,38631:20063,38632:20918,38633:22812,38634:29242,38635:32822,38636:37326,38637:24357,38638:30690,38639:21380,38640:24441,38641:32004,38642:34220,38643:35379,38644:36493,38645:38742,38646:26611,38647:34222,38648:37971,38649:24841,38650:24840,38651:27833,38652:30290,38720:35565,38721:36664,38722:21807,38723:20305,38724:20778,38725:21191,38726:21451,38727:23461,38728:24189,38729:24736,38730:24962,38731:25558,38732:26377,38733:26586,38734:28263,38735:28044,38736:29494,38737:29495,38738:30001,38739:31056,38740:35029,38741:35480,38742:36938,38743:37009,38744:37109,38745:38596,38746:34701,38747:22805,38748:20104,38749:20313,38750:19982,38751:35465,38752:36671,38753:38928,38754:20653,38755:24188,38756:22934,38757:23481,38758:24248,38759:25562,38760:25594,38761:25793,38762:26332,38763:26954,38764:27096,38765:27915,38766:28342,38767:29076,38768:29992,38769:31407,38770:32650,38771:32768,38772:33865,38773:33993,38774:35201,38775:35617,38776:36362,38777:36965,38778:38525,38779:39178,38780:24958,38781:25233,38782:27442,38784:27779,38785:28020,38786:32716,38787:32764,38788:28096,38789:32645,38790:34746,38791:35064,38792:26469,38793:33713,38794:38972,38795:38647,38796:27931,38797:32097,38798:33853,38799:37226,38800:20081,38801:21365,38802:23888,38803:27396,38804:28651,38805:34253,38806:34349,38807:35239,38808:21033,38809:21519,38810:23653,38811:26446,38812:26792,38813:29702,38814:29827,38815:30178,38816:35023,38817:35041,38818:37324,38819:38626,38820:38520,38821:24459,38822:29575,38823:31435,38824:33870,38825:25504,38826:30053,38827:21129,38828:27969,38829:28316,38830:29705,38831:30041,38832:30827,38833:31890,38834:38534,38835:31452,38836:40845,38837:20406,38838:24942,38839:26053,38840:34396,38841:20102,38842:20142,38843:20698,38844:20001,38845:20940,38846:23534,38847:26009,38848:26753,38849:28092,38850:29471,38851:30274,38852:30637,38853:31260,38854:31975,38855:33391,38856:35538,38857:36988,38858:37327,38859:38517,38860:38936,38861:21147,38862:32209,38863:20523,38864:21400,38865:26519,38866:28107,38867:29136,38868:29747,38869:33256,38870:36650,38871:38563,38872:40023,38873:40607,38874:29792,38875:22593,38876:28057,38877:32047,38878:39006,38879:20196,38880:20278,38881:20363,38882:20919,38883:21169,38884:23994,38885:24604,38886:29618,38887:31036,38888:33491,38889:37428,38890:38583,38891:38646,38892:38666,38893:40599,38894:40802,38895:26278,38896:27508,38897:21015,38898:21155,38899:28872,38900:35010,38901:24265,38902:24651,38903:24976,38904:28451,38905:29001,38906:31806,38907:32244,38908:32879,38976:34030,38977:36899,38978:37676,38979:21570,38980:39791,38981:27347,38982:28809,38983:36034,38984:36335,38985:38706,38986:21172,38987:23105,38988:24266,38989:24324,38990:26391,38991:27004,38992:27028,38993:28010,38994:28431,38995:29282,38996:29436,38997:31725,38998:32769,38999:32894,39e3:34635,39001:37070,39002:20845,39003:40595,39004:31108,39005:32907,39006:37682,39007:35542,39008:20525,39009:21644,39010:35441,39011:27498,39012:36036,39013:33031,39014:24785,39015:26528,39016:40434,39017:20121,39018:20120,39019:39952,39020:35435,39021:34241,39022:34152,39023:26880,39024:28286,39025:30871,39026:33109,39071:24332,39072:19984,39073:19989,39074:20010,39075:20017,39076:20022,39077:20028,39078:20031,39079:20034,39080:20054,39081:20056,39082:20098,39083:20101,39084:35947,39085:20106,39086:33298,39087:24333,39088:20110,39089:20126,39090:20127,39091:20128,39092:20130,39093:20144,39094:20147,39095:20150,39096:20174,39097:20173,39098:20164,39099:20166,39100:20162,39101:20183,39102:20190,39103:20205,39104:20191,39105:20215,39106:20233,39107:20314,39108:20272,39109:20315,39110:20317,39111:20311,39112:20295,39113:20342,39114:20360,39115:20367,39116:20376,39117:20347,39118:20329,39119:20336,39120:20369,39121:20335,39122:20358,39123:20374,39124:20760,39125:20436,39126:20447,39127:20430,39128:20440,39129:20443,39130:20433,39131:20442,39132:20432,39133:20452,39134:20453,39135:20506,39136:20520,39137:20500,39138:20522,39139:20517,39140:20485,39141:20252,39142:20470,39143:20513,39144:20521,39145:20524,39146:20478,39147:20463,39148:20497,39149:20486,39150:20547,39151:20551,39152:26371,39153:20565,39154:20560,39155:20552,39156:20570,39157:20566,39158:20588,39159:20600,39160:20608,39161:20634,39162:20613,39163:20660,39164:20658,39232:20681,39233:20682,39234:20659,39235:20674,39236:20694,39237:20702,39238:20709,39239:20717,39240:20707,39241:20718,39242:20729,39243:20725,39244:20745,39245:20737,39246:20738,39247:20758,39248:20757,39249:20756,39250:20762,39251:20769,39252:20794,39253:20791,39254:20796,39255:20795,39256:20799,39257:20800,39258:20818,39259:20812,39260:20820,39261:20834,39262:31480,39263:20841,39264:20842,39265:20846,39266:20864,39267:20866,39268:22232,39269:20876,39270:20873,39271:20879,39272:20881,39273:20883,39274:20885,39275:20886,39276:20900,39277:20902,39278:20898,39279:20905,39280:20906,39281:20907,39282:20915,39283:20913,39284:20914,39285:20912,39286:20917,39287:20925,39288:20933,39289:20937,39290:20955,39291:20960,39292:34389,39293:20969,39294:20973,39296:20976,39297:20981,39298:20990,39299:20996,39300:21003,39301:21012,39302:21006,39303:21031,39304:21034,39305:21038,39306:21043,39307:21049,39308:21071,39309:21060,39310:21067,39311:21068,39312:21086,39313:21076,39314:21098,39315:21108,39316:21097,39317:21107,39318:21119,39319:21117,39320:21133,39321:21140,39322:21138,39323:21105,39324:21128,39325:21137,39326:36776,39327:36775,39328:21164,39329:21165,39330:21180,39331:21173,39332:21185,39333:21197,39334:21207,39335:21214,39336:21219,39337:21222,39338:39149,39339:21216,39340:21235,39341:21237,39342:21240,39343:21241,39344:21254,39345:21256,39346:30008,39347:21261,39348:21264,39349:21263,39350:21269,39351:21274,39352:21283,39353:21295,39354:21297,39355:21299,39356:21304,39357:21312,39358:21318,39359:21317,39360:19991,39361:21321,39362:21325,39363:20950,39364:21342,39365:21353,39366:21358,39367:22808,39368:21371,39369:21367,39370:21378,39371:21398,39372:21408,39373:21414,39374:21413,39375:21422,39376:21424,39377:21430,39378:21443,39379:31762,39380:38617,39381:21471,39382:26364,39383:29166,39384:21486,39385:21480,39386:21485,39387:21498,39388:21505,39389:21565,39390:21568,39391:21548,39392:21549,39393:21564,39394:21550,39395:21558,39396:21545,39397:21533,39398:21582,39399:21647,39400:21621,39401:21646,39402:21599,39403:21617,39404:21623,39405:21616,39406:21650,39407:21627,39408:21632,39409:21622,39410:21636,39411:21648,39412:21638,39413:21703,39414:21666,39415:21688,39416:21669,39417:21676,39418:21700,39419:21704,39420:21672,39488:21675,39489:21698,39490:21668,39491:21694,39492:21692,39493:21720,39494:21733,39495:21734,39496:21775,39497:21780,39498:21757,39499:21742,39500:21741,39501:21754,39502:21730,39503:21817,39504:21824,39505:21859,39506:21836,39507:21806,39508:21852,39509:21829,39510:21846,39511:21847,39512:21816,39513:21811,39514:21853,39515:21913,39516:21888,39517:21679,39518:21898,39519:21919,39520:21883,39521:21886,39522:21912,39523:21918,39524:21934,39525:21884,39526:21891,39527:21929,39528:21895,39529:21928,39530:21978,39531:21957,39532:21983,39533:21956,39534:21980,39535:21988,39536:21972,39537:22036,39538:22007,39539:22038,39540:22014,39541:22013,39542:22043,39543:22009,39544:22094,39545:22096,39546:29151,39547:22068,39548:22070,39549:22066,39550:22072,39552:22123,39553:22116,39554:22063,39555:22124,39556:22122,39557:22150,39558:22144,39559:22154,39560:22176,39561:22164,39562:22159,39563:22181,39564:22190,39565:22198,39566:22196,39567:22210,39568:22204,39569:22209,39570:22211,39571:22208,39572:22216,39573:22222,39574:22225,39575:22227,39576:22231,39577:22254,39578:22265,39579:22272,39580:22271,39581:22276,39582:22281,39583:22280,39584:22283,39585:22285,39586:22291,39587:22296,39588:22294,39589:21959,39590:22300,39591:22310,39592:22327,39593:22328,39594:22350,39595:22331,39596:22336,39597:22351,39598:22377,39599:22464,39600:22408,39601:22369,39602:22399,39603:22409,39604:22419,39605:22432,39606:22451,39607:22436,39608:22442,39609:22448,39610:22467,39611:22470,39612:22484,39613:22482,39614:22483,39615:22538,39616:22486,39617:22499,39618:22539,39619:22553,39620:22557,39621:22642,39622:22561,39623:22626,39624:22603,39625:22640,39626:27584,39627:22610,39628:22589,39629:22649,39630:22661,39631:22713,39632:22687,39633:22699,39634:22714,39635:22750,39636:22715,39637:22712,39638:22702,39639:22725,39640:22739,39641:22737,39642:22743,39643:22745,39644:22744,39645:22757,39646:22748,39647:22756,39648:22751,39649:22767,39650:22778,39651:22777,39652:22779,39653:22780,39654:22781,39655:22786,39656:22794,39657:22800,39658:22811,39659:26790,39660:22821,39661:22828,39662:22829,39663:22834,39664:22840,39665:22846,39666:31442,39667:22869,39668:22864,39669:22862,39670:22874,39671:22872,39672:22882,39673:22880,39674:22887,39675:22892,39676:22889,39744:22904,39745:22913,39746:22941,39747:20318,39748:20395,39749:22947,39750:22962,39751:22982,39752:23016,39753:23004,39754:22925,39755:23001,39756:23002,39757:23077,39758:23071,39759:23057,39760:23068,39761:23049,39762:23066,39763:23104,39764:23148,39765:23113,39766:23093,39767:23094,39768:23138,39769:23146,39770:23194,39771:23228,39772:23230,39773:23243,39774:23234,39775:23229,39776:23267,39777:23255,39778:23270,39779:23273,39780:23254,39781:23290,39782:23291,39783:23308,39784:23307,39785:23318,39786:23346,39787:23248,39788:23338,39789:23350,39790:23358,39791:23363,39792:23365,39793:23360,39794:23377,39795:23381,39796:23386,39797:23387,39798:23397,39799:23401,39800:23408,39801:23411,39802:23413,39803:23416,39804:25992,39805:23418,39806:23424,39808:23427,39809:23462,39810:23480,39811:23491,39812:23495,39813:23497,39814:23508,39815:23504,39816:23524,39817:23526,39818:23522,39819:23518,39820:23525,39821:23531,39822:23536,39823:23542,39824:23539,39825:23557,39826:23559,39827:23560,39828:23565,39829:23571,39830:23584,39831:23586,39832:23592,39833:23608,39834:23609,39835:23617,39836:23622,39837:23630,39838:23635,39839:23632,39840:23631,39841:23409,39842:23660,39843:23662,39844:20066,39845:23670,39846:23673,39847:23692,39848:23697,39849:23700,39850:22939,39851:23723,39852:23739,39853:23734,39854:23740,39855:23735,39856:23749,39857:23742,39858:23751,39859:23769,39860:23785,39861:23805,39862:23802,39863:23789,39864:23948,39865:23786,39866:23819,39867:23829,39868:23831,39869:23900,39870:23839,39871:23835,39872:23825,39873:23828,39874:23842,39875:23834,39876:23833,39877:23832,39878:23884,39879:23890,39880:23886,39881:23883,39882:23916,39883:23923,39884:23926,39885:23943,39886:23940,39887:23938,39888:23970,39889:23965,39890:23980,39891:23982,39892:23997,39893:23952,39894:23991,39895:23996,39896:24009,39897:24013,39898:24019,39899:24018,39900:24022,39901:24027,39902:24043,39903:24050,39904:24053,39905:24075,39906:24090,39907:24089,39908:24081,39909:24091,39910:24118,39911:24119,39912:24132,39913:24131,39914:24128,39915:24142,39916:24151,39917:24148,39918:24159,39919:24162,39920:24164,39921:24135,39922:24181,39923:24182,39924:24186,39925:40636,39926:24191,39927:24224,39928:24257,39929:24258,39930:24264,39931:24272,39932:24271,4e4:24278,40001:24291,40002:24285,40003:24282,40004:24283,40005:24290,40006:24289,40007:24296,40008:24297,40009:24300,40010:24305,40011:24307,40012:24304,40013:24308,40014:24312,40015:24318,40016:24323,40017:24329,40018:24413,40019:24412,40020:24331,40021:24337,40022:24342,40023:24361,40024:24365,40025:24376,40026:24385,40027:24392,40028:24396,40029:24398,40030:24367,40031:24401,40032:24406,40033:24407,40034:24409,40035:24417,40036:24429,40037:24435,40038:24439,40039:24451,40040:24450,40041:24447,40042:24458,40043:24456,40044:24465,40045:24455,40046:24478,40047:24473,40048:24472,40049:24480,40050:24488,40051:24493,40052:24508,40053:24534,40054:24571,40055:24548,40056:24568,40057:24561,40058:24541,40059:24755,40060:24575,40061:24609,40062:24672,40064:24601,40065:24592,40066:24617,40067:24590,40068:24625,40069:24603,40070:24597,40071:24619,40072:24614,40073:24591,40074:24634,40075:24666,40076:24641,40077:24682,40078:24695,40079:24671,40080:24650,40081:24646,40082:24653,40083:24675,40084:24643,40085:24676,40086:24642,40087:24684,40088:24683,40089:24665,40090:24705,40091:24717,40092:24807,40093:24707,40094:24730,40095:24708,40096:24731,40097:24726,40098:24727,40099:24722,40100:24743,40101:24715,40102:24801,40103:24760,40104:24800,40105:24787,40106:24756,40107:24560,40108:24765,40109:24774,40110:24757,40111:24792,40112:24909,40113:24853,40114:24838,40115:24822,40116:24823,40117:24832,40118:24820,40119:24826,40120:24835,40121:24865,40122:24827,40123:24817,40124:24845,40125:24846,40126:24903,40127:24894,40128:24872,40129:24871,40130:24906,40131:24895,40132:24892,40133:24876,40134:24884,40135:24893,40136:24898,40137:24900,40138:24947,40139:24951,40140:24920,40141:24921,40142:24922,40143:24939,40144:24948,40145:24943,40146:24933,40147:24945,40148:24927,40149:24925,40150:24915,40151:24949,40152:24985,40153:24982,40154:24967,40155:25004,40156:24980,40157:24986,40158:24970,40159:24977,40160:25003,40161:25006,40162:25036,40163:25034,40164:25033,40165:25079,40166:25032,40167:25027,40168:25030,40169:25018,40170:25035,40171:32633,40172:25037,40173:25062,40174:25059,40175:25078,40176:25082,40177:25076,40178:25087,40179:25085,40180:25084,40181:25086,40182:25088,40183:25096,40184:25097,40185:25101,40186:25100,40187:25108,40188:25115,40256:25118,40257:25121,40258:25130,40259:25134,40260:25136,40261:25138,40262:25139,40263:25153,40264:25166,40265:25182,40266:25187,40267:25179,40268:25184,40269:25192,40270:25212,40271:25218,40272:25225,40273:25214,40274:25234,40275:25235,40276:25238,40277:25300,40278:25219,40279:25236,40280:25303,40281:25297,40282:25275,40283:25295,40284:25343,40285:25286,40286:25812,40287:25288,40288:25308,40289:25292,40290:25290,40291:25282,40292:25287,40293:25243,40294:25289,40295:25356,40296:25326,40297:25329,40298:25383,40299:25346,40300:25352,40301:25327,40302:25333,40303:25424,40304:25406,40305:25421,40306:25628,40307:25423,40308:25494,40309:25486,40310:25472,40311:25515,40312:25462,40313:25507,40314:25487,40315:25481,40316:25503,40317:25525,40318:25451,40320:25449,40321:25534,40322:25577,40323:25536,40324:25542,40325:25571,40326:25545,40327:25554,40328:25590,40329:25540,40330:25622,40331:25652,40332:25606,40333:25619,40334:25638,40335:25654,40336:25885,40337:25623,40338:25640,40339:25615,40340:25703,40341:25711,40342:25718,40343:25678,40344:25898,40345:25749,40346:25747,40347:25765,40348:25769,40349:25736,40350:25788,40351:25818,40352:25810,40353:25797,40354:25799,40355:25787,40356:25816,40357:25794,40358:25841,40359:25831,40360:33289,40361:25824,40362:25825,40363:25260,40364:25827,40365:25839,40366:25900,40367:25846,40368:25844,40369:25842,40370:25850,40371:25856,40372:25853,40373:25880,40374:25884,40375:25861,40376:25892,40377:25891,40378:25899,40379:25908,40380:25909,40381:25911,40382:25910,40383:25912,40384:30027,40385:25928,40386:25942,40387:25941,40388:25933,40389:25944,40390:25950,40391:25949,40392:25970,40393:25976,40394:25986,40395:25987,40396:35722,40397:26011,40398:26015,40399:26027,40400:26039,40401:26051,40402:26054,40403:26049,40404:26052,40405:26060,40406:26066,40407:26075,40408:26073,40409:26080,40410:26081,40411:26097,40412:26482,40413:26122,40414:26115,40415:26107,40416:26483,40417:26165,40418:26166,40419:26164,40420:26140,40421:26191,40422:26180,40423:26185,40424:26177,40425:26206,40426:26205,40427:26212,40428:26215,40429:26216,40430:26207,40431:26210,40432:26224,40433:26243,40434:26248,40435:26254,40436:26249,40437:26244,40438:26264,40439:26269,40440:26305,40441:26297,40442:26313,40443:26302,40444:26300,40512:26308,40513:26296,40514:26326,40515:26330,40516:26336,40517:26175,40518:26342,40519:26345,40520:26352,40521:26357,40522:26359,40523:26383,40524:26390,40525:26398,40526:26406,40527:26407,40528:38712,40529:26414,40530:26431,40531:26422,40532:26433,40533:26424,40534:26423,40535:26438,40536:26462,40537:26464,40538:26457,40539:26467,40540:26468,40541:26505,40542:26480,40543:26537,40544:26492,40545:26474,40546:26508,40547:26507,40548:26534,40549:26529,40550:26501,40551:26551,40552:26607,40553:26548,40554:26604,40555:26547,40556:26601,40557:26552,40558:26596,40559:26590,40560:26589,40561:26594,40562:26606,40563:26553,40564:26574,40565:26566,40566:26599,40567:27292,40568:26654,40569:26694,40570:26665,40571:26688,40572:26701,40573:26674,40574:26702,40576:26803,40577:26667,40578:26713,40579:26723,40580:26743,40581:26751,40582:26783,40583:26767,40584:26797,40585:26772,40586:26781,40587:26779,40588:26755,40589:27310,40590:26809,40591:26740,40592:26805,40593:26784,40594:26810,40595:26895,40596:26765,40597:26750,40598:26881,40599:26826,40600:26888,40601:26840,40602:26914,40603:26918,40604:26849,40605:26892,40606:26829,40607:26836,40608:26855,40609:26837,40610:26934,40611:26898,40612:26884,40613:26839,40614:26851,40615:26917,40616:26873,40617:26848,40618:26863,40619:26920,40620:26922,40621:26906,40622:26915,40623:26913,40624:26822,40625:27001,40626:26999,40627:26972,40628:27e3,40629:26987,40630:26964,40631:27006,40632:26990,40633:26937,40634:26996,40635:26941,40636:26969,40637:26928,40638:26977,40639:26974,40640:26973,40641:27009,40642:26986,40643:27058,40644:27054,40645:27088,40646:27071,40647:27073,40648:27091,40649:27070,40650:27086,40651:23528,40652:27082,40653:27101,40654:27067,40655:27075,40656:27047,40657:27182,40658:27025,40659:27040,40660:27036,40661:27029,40662:27060,40663:27102,40664:27112,40665:27138,40666:27163,40667:27135,40668:27402,40669:27129,40670:27122,40671:27111,40672:27141,40673:27057,40674:27166,40675:27117,40676:27156,40677:27115,40678:27146,40679:27154,40680:27329,40681:27171,40682:27155,40683:27204,40684:27148,40685:27250,40686:27190,40687:27256,40688:27207,40689:27234,40690:27225,40691:27238,40692:27208,40693:27192,40694:27170,40695:27280,40696:27277,40697:27296,40698:27268,40699:27298,40700:27299,40768:27287,40769:34327,40770:27323,40771:27331,40772:27330,40773:27320,40774:27315,40775:27308,40776:27358,40777:27345,40778:27359,40779:27306,40780:27354,40781:27370,40782:27387,40783:27397,40784:34326,40785:27386,40786:27410,40787:27414,40788:39729,40789:27423,40790:27448,40791:27447,40792:30428,40793:27449,40794:39150,40795:27463,40796:27459,40797:27465,40798:27472,40799:27481,40800:27476,40801:27483,40802:27487,40803:27489,40804:27512,40805:27513,40806:27519,40807:27520,40808:27524,40809:27523,40810:27533,40811:27544,40812:27541,40813:27550,40814:27556,40815:27562,40816:27563,40817:27567,40818:27570,40819:27569,40820:27571,40821:27575,40822:27580,40823:27590,40824:27595,40825:27603,40826:27615,40827:27628,40828:27627,40829:27635,40830:27631,40832:40638,40833:27656,40834:27667,40835:27668,40836:27675,40837:27684,40838:27683,40839:27742,40840:27733,40841:27746,40842:27754,40843:27778,40844:27789,40845:27802,40846:27777,40847:27803,40848:27774,40849:27752,40850:27763,40851:27794,40852:27792,40853:27844,40854:27889,40855:27859,40856:27837,40857:27863,40858:27845,40859:27869,40860:27822,40861:27825,40862:27838,40863:27834,40864:27867,40865:27887,40866:27865,40867:27882,40868:27935,40869:34893,40870:27958,40871:27947,40872:27965,40873:27960,40874:27929,40875:27957,40876:27955,40877:27922,40878:27916,40879:28003,40880:28051,40881:28004,40882:27994,40883:28025,40884:27993,40885:28046,40886:28053,40887:28644,40888:28037,40889:28153,40890:28181,40891:28170,40892:28085,40893:28103,40894:28134,40895:28088,40896:28102,40897:28140,40898:28126,40899:28108,40900:28136,40901:28114,40902:28101,40903:28154,40904:28121,40905:28132,40906:28117,40907:28138,40908:28142,40909:28205,40910:28270,40911:28206,40912:28185,40913:28274,40914:28255,40915:28222,40916:28195,40917:28267,40918:28203,40919:28278,40920:28237,40921:28191,40922:28227,40923:28218,40924:28238,40925:28196,40926:28415,40927:28189,40928:28216,40929:28290,40930:28330,40931:28312,40932:28361,40933:28343,40934:28371,40935:28349,40936:28335,40937:28356,40938:28338,40939:28372,40940:28373,40941:28303,40942:28325,40943:28354,40944:28319,40945:28481,40946:28433,40947:28748,40948:28396,40949:28408,40950:28414,40951:28479,40952:28402,40953:28465,40954:28399,40955:28466,40956:28364,161:65377,162:65378,163:65379,164:65380,165:65381,166:65382,167:65383,168:65384,169:65385,170:65386,171:65387,172:65388,173:65389,174:65390,175:65391,176:65392,177:65393,178:65394,179:65395,180:65396,181:65397,182:65398,183:65399,184:65400,185:65401,186:65402,187:65403,188:65404,189:65405,190:65406,191:65407,192:65408,193:65409,194:65410,195:65411,196:65412,197:65413,198:65414,199:65415,200:65416,201:65417,202:65418,203:65419,204:65420,205:65421,206:65422,207:65423,208:65424,209:65425,210:65426,211:65427,212:65428,213:65429,214:65430,215:65431,216:65432,217:65433,218:65434,219:65435,220:65436,221:65437,222:65438,223:65439,57408:28478,57409:28435,57410:28407,57411:28550,57412:28538,57413:28536,57414:28545,57415:28544,57416:28527,57417:28507,57418:28659,57419:28525,57420:28546,57421:28540,57422:28504,57423:28558,57424:28561,57425:28610,57426:28518,57427:28595,57428:28579,57429:28577,57430:28580,57431:28601,57432:28614,57433:28586,57434:28639,57435:28629,57436:28652,57437:28628,57438:28632,57439:28657,57440:28654,57441:28635,57442:28681,57443:28683,57444:28666,57445:28689,57446:28673,57447:28687,57448:28670,57449:28699,57450:28698,57451:28532,57452:28701,57453:28696,57454:28703,57455:28720,57456:28734,57457:28722,57458:28753,57459:28771,57460:28825,57461:28818,57462:28847,57463:28913,57464:28844,57465:28856,57466:28851,57467:28846,57468:28895,57469:28875,57470:28893,57472:28889,57473:28937,57474:28925,57475:28956,57476:28953,57477:29029,57478:29013,57479:29064,57480:29030,57481:29026,57482:29004,57483:29014,57484:29036,57485:29071,57486:29179,57487:29060,57488:29077,57489:29096,57490:29100,57491:29143,57492:29113,57493:29118,57494:29138,57495:29129,57496:29140,57497:29134,57498:29152,57499:29164,57500:29159,57501:29173,57502:29180,57503:29177,57504:29183,57505:29197,57506:29200,57507:29211,57508:29224,57509:29229,57510:29228,57511:29232,57512:29234,57513:29243,57514:29244,57515:29247,57516:29248,57517:29254,57518:29259,57519:29272,57520:29300,57521:29310,57522:29314,57523:29313,57524:29319,57525:29330,57526:29334,57527:29346,57528:29351,57529:29369,57530:29362,57531:29379,57532:29382,57533:29380,57534:29390,57535:29394,57536:29410,57537:29408,57538:29409,57539:29433,57540:29431,57541:20495,57542:29463,57543:29450,57544:29468,57545:29462,57546:29469,57547:29492,57548:29487,57549:29481,57550:29477,57551:29502,57552:29518,57553:29519,57554:40664,57555:29527,57556:29546,57557:29544,57558:29552,57559:29560,57560:29557,57561:29563,57562:29562,57563:29640,57564:29619,57565:29646,57566:29627,57567:29632,57568:29669,57569:29678,57570:29662,57571:29858,57572:29701,57573:29807,57574:29733,57575:29688,57576:29746,57577:29754,57578:29781,57579:29759,57580:29791,57581:29785,57582:29761,57583:29788,57584:29801,57585:29808,57586:29795,57587:29802,57588:29814,57589:29822,57590:29835,57591:29854,57592:29863,57593:29898,57594:29903,57595:29908,57596:29681,57664:29920,57665:29923,57666:29927,57667:29929,57668:29934,57669:29938,57670:29936,57671:29937,57672:29944,57673:29943,57674:29956,57675:29955,57676:29957,57677:29964,57678:29966,57679:29965,57680:29973,57681:29971,57682:29982,57683:29990,57684:29996,57685:30012,57686:30020,57687:30029,57688:30026,57689:30025,57690:30043,57691:30022,57692:30042,57693:30057,57694:30052,57695:30055,57696:30059,57697:30061,57698:30072,57699:30070,57700:30086,57701:30087,57702:30068,57703:30090,57704:30089,57705:30082,57706:30100,57707:30106,57708:30109,57709:30117,57710:30115,57711:30146,57712:30131,57713:30147,57714:30133,57715:30141,57716:30136,57717:30140,57718:30129,57719:30157,57720:30154,57721:30162,57722:30169,57723:30179,57724:30174,57725:30206,57726:30207,57728:30204,57729:30209,57730:30192,57731:30202,57732:30194,57733:30195,57734:30219,57735:30221,57736:30217,57737:30239,57738:30247,57739:30240,57740:30241,57741:30242,57742:30244,57743:30260,57744:30256,57745:30267,57746:30279,57747:30280,57748:30278,57749:30300,57750:30296,57751:30305,57752:30306,57753:30312,57754:30313,57755:30314,57756:30311,57757:30316,57758:30320,57759:30322,57760:30326,57761:30328,57762:30332,57763:30336,57764:30339,57765:30344,57766:30347,57767:30350,57768:30358,57769:30355,57770:30361,57771:30362,57772:30384,57773:30388,57774:30392,57775:30393,57776:30394,57777:30402,57778:30413,57779:30422,57780:30418,57781:30430,57782:30433,57783:30437,57784:30439,57785:30442,57786:34351,57787:30459,57788:30472,57789:30471,57790:30468,57791:30505,57792:30500,57793:30494,57794:30501,57795:30502,57796:30491,57797:30519,57798:30520,57799:30535,57800:30554,57801:30568,57802:30571,57803:30555,57804:30565,57805:30591,57806:30590,57807:30585,57808:30606,57809:30603,57810:30609,57811:30624,57812:30622,57813:30640,57814:30646,57815:30649,57816:30655,57817:30652,57818:30653,57819:30651,57820:30663,57821:30669,57822:30679,57823:30682,57824:30684,57825:30691,57826:30702,57827:30716,57828:30732,57829:30738,57830:31014,57831:30752,57832:31018,57833:30789,57834:30862,57835:30836,57836:30854,57837:30844,57838:30874,57839:30860,57840:30883,57841:30901,57842:30890,57843:30895,57844:30929,57845:30918,57846:30923,57847:30932,57848:30910,57849:30908,57850:30917,57851:30922,57852:30956,57920:30951,57921:30938,57922:30973,57923:30964,57924:30983,57925:30994,57926:30993,57927:31001,57928:31020,57929:31019,57930:31040,57931:31072,57932:31063,57933:31071,57934:31066,57935:31061,57936:31059,57937:31098,57938:31103,57939:31114,57940:31133,57941:31143,57942:40779,57943:31146,57944:31150,57945:31155,57946:31161,57947:31162,57948:31177,57949:31189,57950:31207,57951:31212,57952:31201,57953:31203,57954:31240,57955:31245,57956:31256,57957:31257,57958:31264,57959:31263,57960:31104,57961:31281,57962:31291,57963:31294,57964:31287,57965:31299,57966:31319,57967:31305,57968:31329,57969:31330,57970:31337,57971:40861,57972:31344,57973:31353,57974:31357,57975:31368,57976:31383,57977:31381,57978:31384,57979:31382,57980:31401,57981:31432,57982:31408,57984:31414,57985:31429,57986:31428,57987:31423,57988:36995,57989:31431,57990:31434,57991:31437,57992:31439,57993:31445,57994:31443,57995:31449,57996:31450,57997:31453,57998:31457,57999:31458,58e3:31462,58001:31469,58002:31472,58003:31490,58004:31503,58005:31498,58006:31494,58007:31539,58008:31512,58009:31513,58010:31518,58011:31541,58012:31528,58013:31542,58014:31568,58015:31610,58016:31492,58017:31565,58018:31499,58019:31564,58020:31557,58021:31605,58022:31589,58023:31604,58024:31591,58025:31600,58026:31601,58027:31596,58028:31598,58029:31645,58030:31640,58031:31647,58032:31629,58033:31644,58034:31642,58035:31627,58036:31634,58037:31631,58038:31581,58039:31641,58040:31691,58041:31681,58042:31692,58043:31695,58044:31668,58045:31686,58046:31709,58047:31721,58048:31761,58049:31764,58050:31718,58051:31717,58052:31840,58053:31744,58054:31751,58055:31763,58056:31731,58057:31735,58058:31767,58059:31757,58060:31734,58061:31779,58062:31783,58063:31786,58064:31775,58065:31799,58066:31787,58067:31805,58068:31820,58069:31811,58070:31828,58071:31823,58072:31808,58073:31824,58074:31832,58075:31839,58076:31844,58077:31830,58078:31845,58079:31852,58080:31861,58081:31875,58082:31888,58083:31908,58084:31917,58085:31906,58086:31915,58087:31905,58088:31912,58089:31923,58090:31922,58091:31921,58092:31918,58093:31929,58094:31933,58095:31936,58096:31941,58097:31938,58098:31960,58099:31954,58100:31964,58101:31970,58102:39739,58103:31983,58104:31986,58105:31988,58106:31990,58107:31994,58108:32006,58176:32002,58177:32028,58178:32021,58179:32010,58180:32069,58181:32075,58182:32046,58183:32050,58184:32063,58185:32053,58186:32070,58187:32115,58188:32086,58189:32078,58190:32114,58191:32104,58192:32110,58193:32079,58194:32099,58195:32147,58196:32137,58197:32091,58198:32143,58199:32125,58200:32155,58201:32186,58202:32174,58203:32163,58204:32181,58205:32199,58206:32189,58207:32171,58208:32317,58209:32162,58210:32175,58211:32220,58212:32184,58213:32159,58214:32176,58215:32216,58216:32221,58217:32228,58218:32222,58219:32251,58220:32242,58221:32225,58222:32261,58223:32266,58224:32291,58225:32289,58226:32274,58227:32305,58228:32287,58229:32265,58230:32267,58231:32290,58232:32326,58233:32358,58234:32315,58235:32309,58236:32313,58237:32323,58238:32311,58240:32306,58241:32314,58242:32359,58243:32349,58244:32342,58245:32350,58246:32345,58247:32346,58248:32377,58249:32362,58250:32361,58251:32380,58252:32379,58253:32387,58254:32213,58255:32381,58256:36782,58257:32383,58258:32392,58259:32393,58260:32396,58261:32402,58262:32400,58263:32403,58264:32404,58265:32406,58266:32398,58267:32411,58268:32412,58269:32568,58270:32570,58271:32581,58272:32588,58273:32589,58274:32590,58275:32592,58276:32593,58277:32597,58278:32596,58279:32600,58280:32607,58281:32608,58282:32616,58283:32617,58284:32615,58285:32632,58286:32642,58287:32646,58288:32643,58289:32648,58290:32647,58291:32652,58292:32660,58293:32670,58294:32669,58295:32666,58296:32675,58297:32687,58298:32690,58299:32697,58300:32686,58301:32694,58302:32696,58303:35697,58304:32709,58305:32710,58306:32714,58307:32725,58308:32724,58309:32737,58310:32742,58311:32745,58312:32755,58313:32761,58314:39132,58315:32774,58316:32772,58317:32779,58318:32786,58319:32792,58320:32793,58321:32796,58322:32801,58323:32808,58324:32831,58325:32827,58326:32842,58327:32838,58328:32850,58329:32856,58330:32858,58331:32863,58332:32866,58333:32872,58334:32883,58335:32882,58336:32880,58337:32886,58338:32889,58339:32893,58340:32895,58341:32900,58342:32902,58343:32901,58344:32923,58345:32915,58346:32922,58347:32941,58348:20880,58349:32940,58350:32987,58351:32997,58352:32985,58353:32989,58354:32964,58355:32986,58356:32982,58357:33033,58358:33007,58359:33009,58360:33051,58361:33065,58362:33059,58363:33071,58364:33099,58432:38539,58433:33094,58434:33086,58435:33107,58436:33105,58437:33020,58438:33137,58439:33134,58440:33125,58441:33126,58442:33140,58443:33155,58444:33160,58445:33162,58446:33152,58447:33154,58448:33184,58449:33173,58450:33188,58451:33187,58452:33119,58453:33171,58454:33193,58455:33200,58456:33205,58457:33214,58458:33208,58459:33213,58460:33216,58461:33218,58462:33210,58463:33225,58464:33229,58465:33233,58466:33241,58467:33240,58468:33224,58469:33242,58470:33247,58471:33248,58472:33255,58473:33274,58474:33275,58475:33278,58476:33281,58477:33282,58478:33285,58479:33287,58480:33290,58481:33293,58482:33296,58483:33302,58484:33321,58485:33323,58486:33336,58487:33331,58488:33344,58489:33369,58490:33368,58491:33373,58492:33370,58493:33375,58494:33380,58496:33378,58497:33384,58498:33386,58499:33387,58500:33326,58501:33393,58502:33399,58503:33400,58504:33406,58505:33421,58506:33426,58507:33451,58508:33439,58509:33467,58510:33452,58511:33505,58512:33507,58513:33503,58514:33490,58515:33524,58516:33523,58517:33530,58518:33683,58519:33539,58520:33531,58521:33529,58522:33502,58523:33542,58524:33500,58525:33545,58526:33497,58527:33589,58528:33588,58529:33558,58530:33586,58531:33585,58532:33600,58533:33593,58534:33616,58535:33605,58536:33583,58537:33579,58538:33559,58539:33560,58540:33669,58541:33690,58542:33706,58543:33695,58544:33698,58545:33686,58546:33571,58547:33678,58548:33671,58549:33674,58550:33660,58551:33717,58552:33651,58553:33653,58554:33696,58555:33673,58556:33704,58557:33780,58558:33811,58559:33771,58560:33742,58561:33789,58562:33795,58563:33752,58564:33803,58565:33729,58566:33783,58567:33799,58568:33760,58569:33778,58570:33805,58571:33826,58572:33824,58573:33725,58574:33848,58575:34054,58576:33787,58577:33901,58578:33834,58579:33852,58580:34138,58581:33924,58582:33911,58583:33899,58584:33965,58585:33902,58586:33922,58587:33897,58588:33862,58589:33836,58590:33903,58591:33913,58592:33845,58593:33994,58594:33890,58595:33977,58596:33983,58597:33951,58598:34009,58599:33997,58600:33979,58601:34010,58602:34e3,58603:33985,58604:33990,58605:34006,58606:33953,58607:34081,58608:34047,58609:34036,58610:34071,58611:34072,58612:34092,58613:34079,58614:34069,58615:34068,58616:34044,58617:34112,58618:34147,58619:34136,58620:34120,58688:34113,58689:34306,58690:34123,58691:34133,58692:34176,58693:34212,58694:34184,58695:34193,58696:34186,58697:34216,58698:34157,58699:34196,58700:34203,58701:34282,58702:34183,58703:34204,58704:34167,58705:34174,58706:34192,58707:34249,58708:34234,58709:34255,58710:34233,58711:34256,58712:34261,58713:34269,58714:34277,58715:34268,58716:34297,58717:34314,58718:34323,58719:34315,58720:34302,58721:34298,58722:34310,58723:34338,58724:34330,58725:34352,58726:34367,58727:34381,58728:20053,58729:34388,58730:34399,58731:34407,58732:34417,58733:34451,58734:34467,58735:34473,58736:34474,58737:34443,58738:34444,58739:34486,58740:34479,58741:34500,58742:34502,58743:34480,58744:34505,58745:34851,58746:34475,58747:34516,58748:34526,58749:34537,58750:34540,58752:34527,58753:34523,58754:34543,58755:34578,58756:34566,58757:34568,58758:34560,58759:34563,58760:34555,58761:34577,58762:34569,58763:34573,58764:34553,58765:34570,58766:34612,58767:34623,58768:34615,58769:34619,58770:34597,58771:34601,58772:34586,58773:34656,58774:34655,58775:34680,58776:34636,58777:34638,58778:34676,58779:34647,58780:34664,58781:34670,58782:34649,58783:34643,58784:34659,58785:34666,58786:34821,58787:34722,58788:34719,58789:34690,58790:34735,58791:34763,58792:34749,58793:34752,58794:34768,58795:38614,58796:34731,58797:34756,58798:34739,58799:34759,58800:34758,58801:34747,58802:34799,58803:34802,58804:34784,58805:34831,58806:34829,58807:34814,58808:34806,58809:34807,58810:34830,58811:34770,58812:34833,58813:34838,58814:34837,58815:34850,58816:34849,58817:34865,58818:34870,58819:34873,58820:34855,58821:34875,58822:34884,58823:34882,58824:34898,58825:34905,58826:34910,58827:34914,58828:34923,58829:34945,58830:34942,58831:34974,58832:34933,58833:34941,58834:34997,58835:34930,58836:34946,58837:34967,58838:34962,58839:34990,58840:34969,58841:34978,58842:34957,58843:34980,58844:34992,58845:35007,58846:34993,58847:35011,58848:35012,58849:35028,58850:35032,58851:35033,58852:35037,58853:35065,58854:35074,58855:35068,58856:35060,58857:35048,58858:35058,58859:35076,58860:35084,58861:35082,58862:35091,58863:35139,58864:35102,58865:35109,58866:35114,58867:35115,58868:35137,58869:35140,58870:35131,58871:35126,58872:35128,58873:35148,58874:35101,58875:35168,58876:35166,58944:35174,58945:35172,58946:35181,58947:35178,58948:35183,58949:35188,58950:35191,58951:35198,58952:35203,58953:35208,58954:35210,58955:35219,58956:35224,58957:35233,58958:35241,58959:35238,58960:35244,58961:35247,58962:35250,58963:35258,58964:35261,58965:35263,58966:35264,58967:35290,58968:35292,58969:35293,58970:35303,58971:35316,58972:35320,58973:35331,58974:35350,58975:35344,58976:35340,58977:35355,58978:35357,58979:35365,58980:35382,58981:35393,58982:35419,58983:35410,58984:35398,58985:35400,58986:35452,58987:35437,58988:35436,58989:35426,58990:35461,58991:35458,58992:35460,58993:35496,58994:35489,58995:35473,58996:35493,58997:35494,58998:35482,58999:35491,59e3:35524,59001:35533,59002:35522,59003:35546,59004:35563,59005:35571,59006:35559,59008:35556,59009:35569,59010:35604,59011:35552,59012:35554,59013:35575,59014:35550,59015:35547,59016:35596,59017:35591,59018:35610,59019:35553,59020:35606,59021:35600,59022:35607,59023:35616,59024:35635,59025:38827,59026:35622,59027:35627,59028:35646,59029:35624,59030:35649,59031:35660,59032:35663,59033:35662,59034:35657,59035:35670,59036:35675,59037:35674,59038:35691,59039:35679,59040:35692,59041:35695,59042:35700,59043:35709,59044:35712,59045:35724,59046:35726,59047:35730,59048:35731,59049:35734,59050:35737,59051:35738,59052:35898,59053:35905,59054:35903,59055:35912,59056:35916,59057:35918,59058:35920,59059:35925,59060:35938,59061:35948,59062:35960,59063:35962,59064:35970,59065:35977,59066:35973,59067:35978,59068:35981,59069:35982,59070:35988,59071:35964,59072:35992,59073:25117,59074:36013,59075:36010,59076:36029,59077:36018,59078:36019,59079:36014,59080:36022,59081:36040,59082:36033,59083:36068,59084:36067,59085:36058,59086:36093,59087:36090,59088:36091,59089:36100,59090:36101,59091:36106,59092:36103,59093:36111,59094:36109,59095:36112,59096:40782,59097:36115,59098:36045,59099:36116,59100:36118,59101:36199,59102:36205,59103:36209,59104:36211,59105:36225,59106:36249,59107:36290,59108:36286,59109:36282,59110:36303,59111:36314,59112:36310,59113:36300,59114:36315,59115:36299,59116:36330,59117:36331,59118:36319,59119:36323,59120:36348,59121:36360,59122:36361,59123:36351,59124:36381,59125:36382,59126:36368,59127:36383,59128:36418,59129:36405,59130:36400,59131:36404,59132:36426,59200:36423,59201:36425,59202:36428,59203:36432,59204:36424,59205:36441,59206:36452,59207:36448,59208:36394,59209:36451,59210:36437,59211:36470,59212:36466,59213:36476,59214:36481,59215:36487,59216:36485,59217:36484,59218:36491,59219:36490,59220:36499,59221:36497,59222:36500,59223:36505,59224:36522,59225:36513,59226:36524,59227:36528,59228:36550,59229:36529,59230:36542,59231:36549,59232:36552,59233:36555,59234:36571,59235:36579,59236:36604,59237:36603,59238:36587,59239:36606,59240:36618,59241:36613,59242:36629,59243:36626,59244:36633,59245:36627,59246:36636,59247:36639,59248:36635,59249:36620,59250:36646,59251:36659,59252:36667,59253:36665,59254:36677,59255:36674,59256:36670,59257:36684,59258:36681,59259:36678,59260:36686,59261:36695,59262:36700,59264:36706,59265:36707,59266:36708,59267:36764,59268:36767,59269:36771,59270:36781,59271:36783,59272:36791,59273:36826,59274:36837,59275:36834,59276:36842,59277:36847,59278:36999,59279:36852,59280:36869,59281:36857,59282:36858,59283:36881,59284:36885,59285:36897,59286:36877,59287:36894,59288:36886,59289:36875,59290:36903,59291:36918,59292:36917,59293:36921,59294:36856,59295:36943,59296:36944,59297:36945,59298:36946,59299:36878,59300:36937,59301:36926,59302:36950,59303:36952,59304:36958,59305:36968,59306:36975,59307:36982,59308:38568,59309:36978,59310:36994,59311:36989,59312:36993,59313:36992,59314:37002,59315:37001,59316:37007,59317:37032,59318:37039,59319:37041,59320:37045,59321:37090,59322:37092,59323:25160,59324:37083,59325:37122,59326:37138,59327:37145,59328:37170,59329:37168,59330:37194,59331:37206,59332:37208,59333:37219,59334:37221,59335:37225,59336:37235,59337:37234,59338:37259,59339:37257,59340:37250,59341:37282,59342:37291,59343:37295,59344:37290,59345:37301,59346:37300,59347:37306,59348:37312,59349:37313,59350:37321,59351:37323,59352:37328,59353:37334,59354:37343,59355:37345,59356:37339,59357:37372,59358:37365,59359:37366,59360:37406,59361:37375,59362:37396,59363:37420,59364:37397,59365:37393,59366:37470,59367:37463,59368:37445,59369:37449,59370:37476,59371:37448,59372:37525,59373:37439,59374:37451,59375:37456,59376:37532,59377:37526,59378:37523,59379:37531,59380:37466,59381:37583,59382:37561,59383:37559,59384:37609,59385:37647,59386:37626,59387:37700,59388:37678,59456:37657,59457:37666,59458:37658,59459:37667,59460:37690,59461:37685,59462:37691,59463:37724,59464:37728,59465:37756,59466:37742,59467:37718,59468:37808,59469:37804,59470:37805,59471:37780,59472:37817,59473:37846,59474:37847,59475:37864,59476:37861,59477:37848,59478:37827,59479:37853,59480:37840,59481:37832,59482:37860,59483:37914,59484:37908,59485:37907,59486:37891,59487:37895,59488:37904,59489:37942,59490:37931,59491:37941,59492:37921,59493:37946,59494:37953,59495:37970,59496:37956,59497:37979,59498:37984,59499:37986,59500:37982,59501:37994,59502:37417,59503:38e3,59504:38005,59505:38007,59506:38013,59507:37978,59508:38012,59509:38014,59510:38017,59511:38015,59512:38274,59513:38279,59514:38282,59515:38292,59516:38294,59517:38296,59518:38297,59520:38304,59521:38312,59522:38311,59523:38317,59524:38332,59525:38331,59526:38329,59527:38334,59528:38346,59529:28662,59530:38339,59531:38349,59532:38348,59533:38357,59534:38356,59535:38358,59536:38364,59537:38369,59538:38373,59539:38370,59540:38433,59541:38440,59542:38446,59543:38447,59544:38466,59545:38476,59546:38479,59547:38475,59548:38519,59549:38492,59550:38494,59551:38493,59552:38495,59553:38502,59554:38514,59555:38508,59556:38541,59557:38552,59558:38549,59559:38551,59560:38570,59561:38567,59562:38577,59563:38578,59564:38576,59565:38580,59566:38582,59567:38584,59568:38585,59569:38606,59570:38603,59571:38601,59572:38605,59573:35149,59574:38620,59575:38669,59576:38613,59577:38649,59578:38660,59579:38662,59580:38664,59581:38675,59582:38670,59583:38673,59584:38671,59585:38678,59586:38681,59587:38692,59588:38698,59589:38704,59590:38713,59591:38717,59592:38718,59593:38724,59594:38726,59595:38728,59596:38722,59597:38729,59598:38748,59599:38752,59600:38756,59601:38758,59602:38760,59603:21202,59604:38763,59605:38769,59606:38777,59607:38789,59608:38780,59609:38785,59610:38778,59611:38790,59612:38795,59613:38799,59614:38800,59615:38812,59616:38824,59617:38822,59618:38819,59619:38835,59620:38836,59621:38851,59622:38854,59623:38856,59624:38859,59625:38876,59626:38893,59627:40783,59628:38898,59629:31455,59630:38902,59631:38901,59632:38927,59633:38924,59634:38968,59635:38948,59636:38945,59637:38967,59638:38973,59639:38982,59640:38991,59641:38987,59642:39019,59643:39023,59644:39024,59712:39025,59713:39028,59714:39027,59715:39082,59716:39087,59717:39089,59718:39094,59719:39108,59720:39107,59721:39110,59722:39145,59723:39147,59724:39171,59725:39177,59726:39186,59727:39188,59728:39192,59729:39201,59730:39197,59731:39198,59732:39204,59733:39200,59734:39212,59735:39214,59736:39229,59737:39230,59738:39234,59739:39241,59740:39237,59741:39248,59742:39243,59743:39249,59744:39250,59745:39244,59746:39253,59747:39319,59748:39320,59749:39333,59750:39341,59751:39342,59752:39356,59753:39391,59754:39387,59755:39389,59756:39384,59757:39377,59758:39405,59759:39406,59760:39409,59761:39410,59762:39419,59763:39416,59764:39425,59765:39439,59766:39429,59767:39394,59768:39449,59769:39467,59770:39479,59771:39493,59772:39490,59773:39488,59774:39491,59776:39486,59777:39509,59778:39501,59779:39515,59780:39511,59781:39519,59782:39522,59783:39525,59784:39524,59785:39529,59786:39531,59787:39530,59788:39597,59789:39600,59790:39612,59791:39616,59792:39631,59793:39633,59794:39635,59795:39636,59796:39646,59797:39647,59798:39650,59799:39651,59800:39654,59801:39663,59802:39659,59803:39662,59804:39668,59805:39665,59806:39671,59807:39675,59808:39686,59809:39704,59810:39706,59811:39711,59812:39714,59813:39715,59814:39717,59815:39719,59816:39720,59817:39721,59818:39722,59819:39726,59820:39727,59821:39730,59822:39748,59823:39747,59824:39759,59825:39757,59826:39758,59827:39761,59828:39768,59829:39796,59830:39827,59831:39811,59832:39825,59833:39830,59834:39831,59835:39839,59836:39840,59837:39848,59838:39860,59839:39872,59840:39882,59841:39865,59842:39878,59843:39887,59844:39889,59845:39890,59846:39907,59847:39906,59848:39908,59849:39892,59850:39905,59851:39994,59852:39922,59853:39921,59854:39920,59855:39957,59856:39956,59857:39945,59858:39955,59859:39948,59860:39942,59861:39944,59862:39954,59863:39946,59864:39940,59865:39982,59866:39963,59867:39973,59868:39972,59869:39969,59870:39984,59871:40007,59872:39986,59873:40006,59874:39998,59875:40026,59876:40032,59877:40039,59878:40054,59879:40056,59880:40167,59881:40172,59882:40176,59883:40201,59884:40200,59885:40171,59886:40195,59887:40198,59888:40234,59889:40230,59890:40367,59891:40227,59892:40223,59893:40260,59894:40213,59895:40210,59896:40257,59897:40255,59898:40254,59899:40262,59900:40264,59968:40285,59969:40286,59970:40292,59971:40273,59972:40272,59973:40281,59974:40306,59975:40329,59976:40327,59977:40363,59978:40303,59979:40314,59980:40346,59981:40356,59982:40361,59983:40370,59984:40388,59985:40385,59986:40379,59987:40376,59988:40378,59989:40390,59990:40399,59991:40386,59992:40409,59993:40403,59994:40440,59995:40422,59996:40429,59997:40431,59998:40445,59999:40474,6e4:40475,60001:40478,60002:40565,60003:40569,60004:40573,60005:40577,60006:40584,60007:40587,60008:40588,60009:40594,60010:40597,60011:40593,60012:40605,60013:40613,60014:40617,60015:40632,60016:40618,60017:40621,60018:38753,60019:40652,60020:40654,60021:40655,60022:40656,60023:40660,60024:40668,60025:40670,60026:40669,60027:40672,60028:40677,60029:40680,60030:40687,60032:40692,60033:40694,60034:40695,60035:40697,60036:40699,60037:40700,60038:40701,60039:40711,60040:40712,60041:30391,60042:40725,60043:40737,60044:40748,60045:40766,60046:40778,60047:40786,60048:40788,60049:40803,60050:40799,60051:40800,60052:40801,60053:40806,60054:40807,60055:40812,60056:40810,60057:40823,60058:40818,60059:40822,60060:40853,60061:40860,60062:40864,60063:22575,60064:27079,60065:36953,60066:29796,60067:20956,60068:29081}}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=n(1),r=n(2);function a(g,p,C,b){var y;p.degree()<C.degree()&&(y=[C,p],p=y[0],C=y[1]);for(var w=p,A=C,I=g.zero,T=g.one;A.degree()>=b/2;){var R=w,P=I;if(w=A,I=T,w.isZero())return null;A=R;for(var V=g.zero,j=w.getCoefficient(w.degree()),J=g.inverse(j);A.degree()>=w.degree()&&!A.isZero();){var ae=A.degree()-w.degree(),fe=g.multiply(A.getCoefficient(A.degree()),J);V=V.addOrSubtract(g.buildMonomial(ae,fe)),A=A.addOrSubtract(w.multiplyByMonomial(ae,fe))}if(T=V.multiplyPoly(I).addOrSubtract(P),A.degree()>=w.degree())return null}var X=T.getCoefficient(0);if(X===0)return null;var ce=g.inverse(X);return[T.multiply(ce),A.multiply(ce)]}function d(g,p){var C=p.degree();if(C===1)return[p.getCoefficient(1)];for(var b=new Array(C),y=0,w=1;w<g.size&&y<C;w++)p.evaluateAt(w)===0&&(b[y]=g.inverse(w),y++);return y!==C?null:b}function u(g,p,C){for(var b=C.length,y=new Array(b),w=0;w<b;w++){for(var A=g.inverse(C[w]),I=1,T=0;T<b;T++)w!==T&&(I=g.multiply(I,s.addOrSubtractGF(1,g.multiply(C[T],A))));y[w]=g.multiply(p.evaluateAt(A),g.inverse(I)),g.generatorBase!==0&&(y[w]=g.multiply(y[w],A))}return y}function f(g,p){var C=new Uint8ClampedArray(g.length);C.set(g);for(var b=new s.default(285,256,0),y=new r.default(b,C),w=new Uint8ClampedArray(p),A=!1,I=0;I<p;I++){var T=y.evaluateAt(b.exp(I+b.generatorBase));w[w.length-1-I]=T,T!==0&&(A=!0)}if(!A)return C;var R=new r.default(b,w),P=a(b,b.buildMonomial(p,1),R,p);if(P===null)return null;var V=d(b,P[0]);if(V==null)return null;for(var j=u(b,P[1],V),J=0;J<V.length;J++){var ae=C.length-1-b.log(V[J]);if(ae<0)return null;C[ae]=s.addOrSubtractGF(C[ae],j[J])}return C}i.decode=f}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0}),i.VERSIONS=[{infoBits:null,versionNumber:1,alignmentPatternCenters:[],errorCorrectionLevels:[{ecCodewordsPerBlock:7,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:13,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:13}]},{ecCodewordsPerBlock:17,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:2,alignmentPatternCenters:[6,18],errorCorrectionLevels:[{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:34}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:28}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]}]},{infoBits:null,versionNumber:3,alignmentPatternCenters:[6,22],errorCorrectionLevels:[{ecCodewordsPerBlock:15,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:55}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:13}]}]},{infoBits:null,versionNumber:4,alignmentPatternCenters:[6,26],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:80}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:32}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:5,alignmentPatternCenters:[6,30],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:43}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:11},{numBlocks:2,dataCodewordsPerBlock:12}]}]},{infoBits:null,versionNumber:6,alignmentPatternCenters:[6,34],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:27}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:31892,versionNumber:7,alignmentPatternCenters:[6,22,38],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:78}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:31}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:13},{numBlocks:1,dataCodewordsPerBlock:14}]}]},{infoBits:34236,versionNumber:8,alignmentPatternCenters:[6,24,42],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:97}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:38},{numBlocks:2,dataCodewordsPerBlock:39}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:18},{numBlocks:2,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:14},{numBlocks:2,dataCodewordsPerBlock:15}]}]},{infoBits:39577,versionNumber:9,alignmentPatternCenters:[6,26,46],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:16},{numBlocks:4,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:12},{numBlocks:4,dataCodewordsPerBlock:13}]}]},{infoBits:42195,versionNumber:10,alignmentPatternCenters:[6,28,50],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68},{numBlocks:2,dataCodewordsPerBlock:69}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:43},{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]}]},{infoBits:48118,versionNumber:11,alignmentPatternCenters:[6,30,54],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:81}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:50},{numBlocks:4,dataCodewordsPerBlock:51}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:22},{numBlocks:4,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:12},{numBlocks:8,dataCodewordsPerBlock:13}]}]},{infoBits:51042,versionNumber:12,alignmentPatternCenters:[6,32,58],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:92},{numBlocks:2,dataCodewordsPerBlock:93}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:20},{numBlocks:6,dataCodewordsPerBlock:21}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:55367,versionNumber:13,alignmentPatternCenters:[6,34,62],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:37},{numBlocks:1,dataCodewordsPerBlock:38}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:20},{numBlocks:4,dataCodewordsPerBlock:21}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:11},{numBlocks:4,dataCodewordsPerBlock:12}]}]},{infoBits:58893,versionNumber:14,alignmentPatternCenters:[6,26,46,66],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:115},{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:40},{numBlocks:5,dataCodewordsPerBlock:41}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:16},{numBlocks:5,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:5,dataCodewordsPerBlock:13}]}]},{infoBits:63784,versionNumber:15,alignmentPatternCenters:[6,26,48,70],errorCorrectionLevels:[{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:87},{numBlocks:1,dataCodewordsPerBlock:88}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:41},{numBlocks:5,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:7,dataCodewordsPerBlock:13}]}]},{infoBits:68472,versionNumber:16,alignmentPatternCenters:[6,26,50,74],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:98},{numBlocks:1,dataCodewordsPerBlock:99}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},{infoBits:70749,versionNumber:17,alignmentPatternCenters:[6,30,54,78],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},{numBlocks:1,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22},{numBlocks:15,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:17,dataCodewordsPerBlock:15}]}]},{infoBits:76311,versionNumber:18,alignmentPatternCenters:[6,30,56,82],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:120},{numBlocks:1,dataCodewordsPerBlock:121}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:43},{numBlocks:4,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:1,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:19,dataCodewordsPerBlock:15}]}]},{infoBits:79154,versionNumber:19,alignmentPatternCenters:[6,30,58,86],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:113},{numBlocks:4,dataCodewordsPerBlock:114}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:44},{numBlocks:11,dataCodewordsPerBlock:45}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:21},{numBlocks:4,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:13},{numBlocks:16,dataCodewordsPerBlock:14}]}]},{infoBits:84390,versionNumber:20,alignmentPatternCenters:[6,34,62,90],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:41},{numBlocks:13,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:5,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:15},{numBlocks:10,dataCodewordsPerBlock:16}]}]},{infoBits:87683,versionNumber:21,alignmentPatternCenters:[6,28,50,72,94],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:116},{numBlocks:4,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:16},{numBlocks:6,dataCodewordsPerBlock:17}]}]},{infoBits:92361,versionNumber:22,alignmentPatternCenters:[6,26,50,74,98],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:111},{numBlocks:7,dataCodewordsPerBlock:112}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:13}]}]},{infoBits:96236,versionNumber:23,alignmentPatternCenters:[6,30,54,74,102],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:121},{numBlocks:5,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:47},{numBlocks:14,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:16,dataCodewordsPerBlock:15},{numBlocks:14,dataCodewordsPerBlock:16}]}]},{infoBits:102084,versionNumber:24,alignmentPatternCenters:[6,28,54,80,106],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:45},{numBlocks:14,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:30,dataCodewordsPerBlock:16},{numBlocks:2,dataCodewordsPerBlock:17}]}]},{infoBits:102881,versionNumber:25,alignmentPatternCenters:[6,32,58,84,110],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:106},{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:47},{numBlocks:13,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},{infoBits:110507,versionNumber:26,alignmentPatternCenters:[6,30,58,86,114],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:114},{numBlocks:2,dataCodewordsPerBlock:115}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:46},{numBlocks:4,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:28,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:33,dataCodewordsPerBlock:16},{numBlocks:4,dataCodewordsPerBlock:17}]}]},{infoBits:110734,versionNumber:27,alignmentPatternCenters:[6,34,62,90,118],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:23},{numBlocks:26,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:117786,versionNumber:28,alignmentPatternCenters:[6,26,50,74,98,122],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:117},{numBlocks:10,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:45},{numBlocks:23,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:24},{numBlocks:31,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:31,dataCodewordsPerBlock:16}]}]},{infoBits:119615,versionNumber:29,alignmentPatternCenters:[6,30,54,78,102,126],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:116},{numBlocks:7,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:21,dataCodewordsPerBlock:45},{numBlocks:7,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:23},{numBlocks:37,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:26,dataCodewordsPerBlock:16}]}]},{infoBits:126325,versionNumber:30,alignmentPatternCenters:[6,26,52,78,104,130],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:115},{numBlocks:10,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:47},{numBlocks:10,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:25,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:25,dataCodewordsPerBlock:16}]}]},{infoBits:127568,versionNumber:31,alignmentPatternCenters:[6,30,56,82,108,134],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:3,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:46},{numBlocks:29,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:24},{numBlocks:1,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:133589,versionNumber:32,alignmentPatternCenters:[6,34,60,86,112,138],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:24},{numBlocks:35,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:35,dataCodewordsPerBlock:16}]}]},{infoBits:136944,versionNumber:33,alignmentPatternCenters:[6,30,58,86,114,142],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115},{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:21,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:24},{numBlocks:19,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:141498,versionNumber:34,alignmentPatternCenters:[6,34,62,90,118,146],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:6,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:44,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:59,dataCodewordsPerBlock:16},{numBlocks:1,dataCodewordsPerBlock:17}]}]},{infoBits:145311,versionNumber:35,alignmentPatternCenters:[6,30,54,78,102,126,150],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:121},{numBlocks:7,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:47},{numBlocks:26,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:39,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:41,dataCodewordsPerBlock:16}]}]},{infoBits:150283,versionNumber:36,alignmentPatternCenters:[6,24,50,76,102,128,154],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:121},{numBlocks:14,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:47},{numBlocks:34,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:46,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:15},{numBlocks:64,dataCodewordsPerBlock:16}]}]},{infoBits:152622,versionNumber:37,alignmentPatternCenters:[6,28,54,80,106,132,158],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:46},{numBlocks:14,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:49,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:24,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:158308,versionNumber:38,alignmentPatternCenters:[6,32,58,84,110,136,162],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:122},{numBlocks:18,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:46},{numBlocks:32,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:48,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:15},{numBlocks:32,dataCodewordsPerBlock:16}]}]},{infoBits:161089,versionNumber:39,alignmentPatternCenters:[6,26,54,82,110,138,166],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:40,dataCodewordsPerBlock:47},{numBlocks:7,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:43,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:15},{numBlocks:67,dataCodewordsPerBlock:16}]}]},{infoBits:167017,versionNumber:40,alignmentPatternCenters:[6,30,58,86,114,142,170],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:118},{numBlocks:6,dataCodewordsPerBlock:119}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:18,dataCodewordsPerBlock:47},{numBlocks:31,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:24},{numBlocks:34,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:15},{numBlocks:61,dataCodewordsPerBlock:16}]}]}]}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=n(0);function r(f,g,p,C){var b=f.x-g.x+p.x-C.x,y=f.y-g.y+p.y-C.y;if(b===0&&y===0)return{a11:g.x-f.x,a12:g.y-f.y,a13:0,a21:p.x-g.x,a22:p.y-g.y,a23:0,a31:f.x,a32:f.y,a33:1};var w=g.x-p.x,A=C.x-p.x,I=g.y-p.y,T=C.y-p.y,R=w*T-A*I,P=(b*T-A*y)/R,V=(w*y-b*I)/R;return{a11:g.x-f.x+P*g.x,a12:g.y-f.y+P*g.y,a13:P,a21:C.x-f.x+V*C.x,a22:C.y-f.y+V*C.y,a23:V,a31:f.x,a32:f.y,a33:1}}function a(f,g,p,C){var b=r(f,g,p,C);return{a11:b.a22*b.a33-b.a23*b.a32,a12:b.a13*b.a32-b.a12*b.a33,a13:b.a12*b.a23-b.a13*b.a22,a21:b.a23*b.a31-b.a21*b.a33,a22:b.a11*b.a33-b.a13*b.a31,a23:b.a13*b.a21-b.a11*b.a23,a31:b.a21*b.a32-b.a22*b.a31,a32:b.a12*b.a31-b.a11*b.a32,a33:b.a11*b.a22-b.a12*b.a21}}function d(f,g){return{a11:f.a11*g.a11+f.a21*g.a12+f.a31*g.a13,a12:f.a12*g.a11+f.a22*g.a12+f.a32*g.a13,a13:f.a13*g.a11+f.a23*g.a12+f.a33*g.a13,a21:f.a11*g.a21+f.a21*g.a22+f.a31*g.a23,a22:f.a12*g.a21+f.a22*g.a22+f.a32*g.a23,a23:f.a13*g.a21+f.a23*g.a22+f.a33*g.a23,a31:f.a11*g.a31+f.a21*g.a32+f.a31*g.a33,a32:f.a12*g.a31+f.a22*g.a32+f.a32*g.a33,a33:f.a13*g.a31+f.a23*g.a32+f.a33*g.a33}}function u(f,g){for(var p=a({x:3.5,y:3.5},{x:g.dimension-3.5,y:3.5},{x:g.dimension-6.5,y:g.dimension-6.5},{x:3.5,y:g.dimension-3.5}),C=r(g.topLeft,g.topRight,g.alignmentPattern,g.bottomLeft),b=d(C,p),y=s.BitMatrix.createEmpty(g.dimension,g.dimension),w=function(V,j){var J=b.a13*V+b.a23*j+b.a33;return{x:(b.a11*V+b.a21*j+b.a31)/J,y:(b.a12*V+b.a22*j+b.a32)/J}},A=0;A<g.dimension;A++)for(var I=0;I<g.dimension;I++){var T=I+.5,R=A+.5,P=w(T,R);y.set(I,A,f.get(Math.floor(P.x),Math.floor(P.y)))}return{matrix:y,mappingFunction:w}}i.extract=u}),(function(t,i,n){Object.defineProperty(i,"__esModule",{value:!0});var s=4,r=.5,a=1.5,d=function(T,R){return Math.sqrt(Math.pow(R.x-T.x,2)+Math.pow(R.y-T.y,2))};function u(T){return T.reduce(function(R,P){return R+P})}function f(T,R,P){var V,j,J,ae,fe=d(T,R),X=d(R,P),ce=d(T,P),me,oe,le;return X>=fe&&X>=ce?(V=[R,T,P],me=V[0],oe=V[1],le=V[2]):ce>=X&&ce>=fe?(j=[T,R,P],me=j[0],oe=j[1],le=j[2]):(J=[T,P,R],me=J[0],oe=J[1],le=J[2]),(le.x-oe.x)*(me.y-oe.y)-(le.y-oe.y)*(me.x-oe.x)<0&&(ae=[le,me],me=ae[0],le=ae[1]),{bottomLeft:me,topLeft:oe,topRight:le}}function g(T,R,P,V){var j=(u(C(T,P,V,5))/7+u(C(T,R,V,5))/7+u(C(P,T,V,5))/7+u(C(R,T,V,5))/7)/4;if(j<1)throw new Error("Invalid module size");var J=Math.round(d(T,R)/j),ae=Math.round(d(T,P)/j),fe=Math.floor((J+ae)/2)+7;switch(fe%4){case 0:fe++;break;case 2:fe--;break}return{dimension:fe,moduleSize:j}}function p(T,R,P,V){var j=[{x:Math.floor(T.x),y:Math.floor(T.y)}],J=Math.abs(R.y-T.y)>Math.abs(R.x-T.x),ae,fe,X,ce;J?(ae=Math.floor(T.y),fe=Math.floor(T.x),X=Math.floor(R.y),ce=Math.floor(R.x)):(ae=Math.floor(T.x),fe=Math.floor(T.y),X=Math.floor(R.x),ce=Math.floor(R.y));for(var me=Math.abs(X-ae),oe=Math.abs(ce-fe),le=Math.floor(-me/2),Ae=ae<X?1:-1,Te=fe<ce?1:-1,xe=!0,Ne=ae,Ve=fe;Ne!==X+Ae;Ne+=Ae){var ve=J?Ve:Ne,mt=J?Ne:Ve;if(P.get(ve,mt)!==xe&&(xe=!xe,j.push({x:ve,y:mt}),j.length===V+1))break;if(le+=oe,le>0){if(Ve===ce)break;Ve+=Te,le-=me}}for(var Mt=[],ot=0;ot<V;ot++)j[ot]&&j[ot+1]?Mt.push(d(j[ot],j[ot+1])):Mt.push(0);return Mt}function C(T,R,P,V){var j,J=R.y-T.y,ae=R.x-T.x,fe=p(T,R,P,Math.ceil(V/2)),X=p(T,{x:T.x-ae,y:T.y-J},P,Math.ceil(V/2)),ce=fe.shift()+X.shift()-1;return(j=X.concat(ce)).concat.apply(j,fe)}function b(T,R){var P=u(T)/u(R),V=0;return R.forEach(function(j,J){V+=Math.pow(T[J]-j*P,2)}),{averageSize:P,error:V}}function y(T,R,P){try{var V=C(T,{x:-1,y:T.y},P,R.length),j=C(T,{x:T.x,y:-1},P,R.length),J={x:Math.max(0,T.x-T.y)-1,y:Math.max(0,T.y-T.x)-1},ae=C(T,J,P,R.length),fe={x:Math.min(P.width,T.x+T.y)+1,y:Math.min(P.height,T.y+T.x)+1},X=C(T,fe,P,R.length),ce=b(V,R),me=b(j,R),oe=b(ae,R),le=b(X,R),Ae=Math.sqrt(ce.error*ce.error+me.error*me.error+oe.error*oe.error+le.error*le.error),Te=(ce.averageSize+me.averageSize+oe.averageSize+le.averageSize)/4,xe=(Math.pow(ce.averageSize-Te,2)+Math.pow(me.averageSize-Te,2)+Math.pow(oe.averageSize-Te,2)+Math.pow(le.averageSize-Te,2))/Te;return Ae+xe}catch{return 1/0}}function w(T,R){for(var P=Math.round(R.x);T.get(P,Math.round(R.y));)P--;for(var V=Math.round(R.x);T.get(V,Math.round(R.y));)V++;for(var j=(P+V)/2,J=Math.round(R.y);T.get(Math.round(j),J);)J--;for(var ae=Math.round(R.y);T.get(Math.round(j),ae);)ae++;var fe=(J+ae)/2;return{x:j,y:fe}}function A(T){for(var R=[],P=[],V=[],j=[],J=function(ve){for(var mt=0,Mt=!1,ot=[0,0,0,0,0],yt=function(Nt){var si=T.get(Nt,ve);if(si===Mt)mt++;else{ot=[ot[1],ot[2],ot[3],ot[4],mt],mt=1,Mt=si;var Xe=u(ot)/7,tt=Math.abs(ot[0]-Xe)<Xe&&Math.abs(ot[1]-Xe)<Xe&&Math.abs(ot[2]-3*Xe)<3*Xe&&Math.abs(ot[3]-Xe)<Xe&&Math.abs(ot[4]-Xe)<Xe&&!si,wt=u(ot.slice(-3))/3,Yt=Math.abs(ot[2]-wt)<wt&&Math.abs(ot[3]-wt)<wt&&Math.abs(ot[4]-wt)<wt&&si;if(tt){var fi=Nt-ot[3]-ot[4],oi=fi-ot[2],ki={startX:oi,endX:fi,y:ve},_i=P.filter(function(ii){return oi>=ii.bottom.startX&&oi<=ii.bottom.endX||fi>=ii.bottom.startX&&oi<=ii.bottom.endX||oi<=ii.bottom.startX&&fi>=ii.bottom.endX&&ot[2]/(ii.bottom.endX-ii.bottom.startX)<a&&ot[2]/(ii.bottom.endX-ii.bottom.startX)>r});_i.length>0?_i[0].bottom=ki:P.push({top:ki,bottom:ki})}if(Yt){var Ze=Nt-ot[4],Ee=Ze-ot[3],ki={startX:Ee,y:ve,endX:Ze},_i=j.filter(function(Jt){return Ee>=Jt.bottom.startX&&Ee<=Jt.bottom.endX||Ze>=Jt.bottom.startX&&Ee<=Jt.bottom.endX||Ee<=Jt.bottom.startX&&Ze>=Jt.bottom.endX&&ot[2]/(Jt.bottom.endX-Jt.bottom.startX)<a&&ot[2]/(Jt.bottom.endX-Jt.bottom.startX)>r});_i.length>0?_i[0].bottom=ki:j.push({top:ki,bottom:ki})}}},be=-1;be<=T.width;be++)yt(be);R.push.apply(R,P.filter(function(Nt){return Nt.bottom.y!==ve&&Nt.bottom.y-Nt.top.y>=2})),P=P.filter(function(Nt){return Nt.bottom.y===ve}),V.push.apply(V,j.filter(function(Nt){return Nt.bottom.y!==ve})),j=j.filter(function(Nt){return Nt.bottom.y===ve})},ae=0;ae<=T.height;ae++)J(ae);R.push.apply(R,P.filter(function(ve){return ve.bottom.y-ve.top.y>=2})),V.push.apply(V,j);var fe=R.filter(function(ve){return ve.bottom.y-ve.top.y>=2}).map(function(ve){var mt=(ve.top.startX+ve.top.endX+ve.bottom.startX+ve.bottom.endX)/4,Mt=(ve.top.y+ve.bottom.y+1)/2;if(T.get(Math.round(mt),Math.round(Mt))){var ot=[ve.top.endX-ve.top.startX,ve.bottom.endX-ve.bottom.startX,ve.bottom.y-ve.top.y+1],yt=u(ot)/ot.length,be=y({x:Math.round(mt),y:Math.round(Mt)},[1,1,3,1,1],T);return{score:be,x:mt,y:Mt,size:yt}}}).filter(function(ve){return!!ve}).sort(function(ve,mt){return ve.score-mt.score}).map(function(ve,mt,Mt){if(mt>s)return null;var ot=Mt.filter(function(be,Nt){return mt!==Nt}).map(function(be){return{x:be.x,y:be.y,score:be.score+Math.pow(be.size-ve.size,2)/ve.size,size:be.size}}).sort(function(be,Nt){return be.score-Nt.score});if(ot.length<2)return null;var yt=ve.score+ot[0].score+ot[1].score;return{points:[ve].concat(ot.slice(0,2)),score:yt}}).filter(function(ve){return!!ve}).sort(function(ve,mt){return ve.score-mt.score});if(fe.length===0)return null;var X=f(fe[0].points[0],fe[0].points[1],fe[0].points[2]),ce=X.topRight,me=X.topLeft,oe=X.bottomLeft,le=I(T,V,ce,me,oe),Ae=[];le&&Ae.push({alignmentPattern:{x:le.alignmentPattern.x,y:le.alignmentPattern.y},bottomLeft:{x:oe.x,y:oe.y},dimension:le.dimension,topLeft:{x:me.x,y:me.y},topRight:{x:ce.x,y:ce.y}});var Te=w(T,ce),xe=w(T,me),Ne=w(T,oe),Ve=I(T,V,Te,xe,Ne);return Ve&&Ae.push({alignmentPattern:{x:Ve.alignmentPattern.x,y:Ve.alignmentPattern.y},bottomLeft:{x:Ne.x,y:Ne.y},topLeft:{x:xe.x,y:xe.y},topRight:{x:Te.x,y:Te.y},dimension:Ve.dimension}),Ae.length===0?null:Ae}i.locate=A;function I(T,R,P,V,j){var J,ae,fe;try{J=g(V,P,j,T),ae=J.dimension,fe=J.moduleSize}catch{return null}var X={x:P.x-V.x+j.x,y:P.y-V.y+j.y},ce=(d(V,j)+d(V,P))/2/fe,me=1-3/ce,oe={x:V.x+me*(X.x-V.x),y:V.y+me*(X.y-V.y)},le=R.map(function(Te){var xe=(Te.top.startX+Te.top.endX+Te.bottom.startX+Te.bottom.endX)/4,Ne=(Te.top.y+Te.bottom.y+1)/2;if(T.get(Math.floor(xe),Math.floor(Ne))){var Ve=[Te.top.endX-Te.top.startX,Te.bottom.endX-Te.bottom.startX,Te.bottom.y-Te.top.y+1];u(Ve)/Ve.length;var ve=y({x:Math.floor(xe),y:Math.floor(Ne)},[1,1,1],T),mt=ve+d({x:xe,y:Ne},oe);return{x:xe,y:Ne,score:mt}}}).filter(function(Te){return!!Te}).sort(function(Te,xe){return Te.score-xe.score}),Ae=ce>=15&&le.length?le[0]:oe;return{alignmentPattern:Ae,dimension:ae}}})]).default})})(Em)),Em.exports}var aY=rY();const lY=fS(aY);var cY=B('<label class="svelte-1ua3isv">Passcode <input type="number" placeholder="20202021" class="svelte-1ua3isv"/></label> <label class="svelte-1ua3isv">Discriminator (optional) <input type="number" placeholder="3840" class="svelte-1ua3isv"/></label>',1),dY=B('<label class="svelte-1ua3isv">Pairing Code / QR <input type="text" placeholder="MT:..." class="svelte-1ua3isv"/></label> <div class="scan-row svelte-1ua3isv"><button class="scan-btn svelte-1ua3isv" title="Scan QR code with camera"><svg width="13" height="13" viewBox="0 0 16 16" fill="currentColor"><path d="M1 1h5v5H1V1zm1 1v3h3V2H2zm7-1h5v5h-5V1zm1 1v3h3V2h-3zM1 9h5v5H1V9zm1 1v3h3v-3H2zm7 0h2v2H9v-2zm2 0h2v2h-2v-2zm0 2h2v2h-2v-2zm-2 2h2v2H9v-2zm2 0h2v2h-2v-2z"></path></svg> Camera</button> <label class="scan-btn scan-file-btn svelte-1ua3isv" title="Decode QR from image file"><svg width="13" height="13" viewBox="0 0 16 16" fill="currentColor"><path d="M13 4H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1zM3 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2H3zm5 2.5a.5.5 0 0 1 .5.5v1h1a.5.5 0 0 1 0 1h-1v1a.5.5 0 0 1-1 0v-1h-1a.5.5 0 0 1 0-1h1V6a.5.5 0 0 1 .5-.5z"></path></svg> Image… <input type="file" accept="image/*" style="display:none" class="svelte-1ua3isv"/></label></div>',1),K2=B('<p class="err svelte-1ua3isv"> </p>'),uY=B('<div class="wizard svelte-1ua3isv"><div class="wizard-tabs svelte-1ua3isv"><button>Passcode</button> <button>QR / Code</button></div> <!> <label class="svelte-1ua3isv">IP Address (optional, bypasses mDNS) <input type="text" placeholder="192.168.1.100 or 192.168.1.100:5540" class="svelte-1ua3isv"/></label> <!> <button class="commission-btn svelte-1ua3isv"> </button></div>'),hY=B('<span class="device-name svelte-1ua3isv"> </span> <span class="device-nodeid svelte-1ua3isv"> </span>',1),fY=B('<span class="device-name svelte-1ua3isv"> </span>'),gY=B('<li><button class="device-select-btn svelte-1ua3isv"><span></span> <span class="device-label svelte-1ua3isv"><!></span></button> <button class="unpair-btn svelte-1ua3isv" title="Unpair">✕</button></li>'),pY=B('<li class="empty svelte-1ua3isv">No paired devices</li>'),xY=B('<p class="info svelte-1ua3isv">Loading…</p>'),mY=B('<p class="device-subtitle svelte-1ua3isv"> </p>'),vY=B('<span class="ep-chip svelte-1ua3isv"> </span>'),_Y=B('<span class="attr-id svelte-1ua3isv"> </span>'),bY=B('<button class="attr-action-btn svelte-1ua3isv"> </button>'),CY=B('<div class="attr-actions svelte-1ua3isv"></div>'),EY=B('<span class="cmd-sep svelte-1ua3isv">,</span>'),yY=B('<span class="cmd-name svelte-1ua3isv"> </span><span class="cmd-id svelte-1ua3isv"> </span>',1),wY=B('<span class="cmd-id svelte-1ua3isv"> </span>'),SY=B("<!> <!>",1),DY=B('<span class="cmd-list svelte-1ua3isv"></span>'),AY=B(' <span class="cmd-id svelte-1ua3isv"> </span>',1),kY=B('<tr class="svelte-1ua3isv"><td class="svelte-1ua3isv"><!></td><td class="svelte-1ua3isv"> </td></tr>'),BY=B('<table class="attr-arr-table svelte-1ua3isv"><thead class="svelte-1ua3isv"><tr class="svelte-1ua3isv"><th class="svelte-1ua3isv">deviceType</th><th class="svelte-1ua3isv">revision</th></tr></thead><tbody class="svelte-1ua3isv"></tbody></table>'),FY=B('<th class="svelte-1ua3isv"> </th>'),LY=B('<td class="svelte-1ua3isv"> </td>'),IY=B('<tr class="svelte-1ua3isv"></tr>'),PY=B('<table class="attr-arr-table svelte-1ua3isv"><thead class="svelte-1ua3isv"><tr class="svelte-1ua3isv"></tr></thead><tbody class="svelte-1ua3isv"></tbody></table>'),TY=B('<tr class="svelte-1ua3isv"><td class="attr-obj-key svelte-1ua3isv"> </td><td class="attr-obj-val svelte-1ua3isv"> </td></tr>'),MY=B('<table class="attr-obj-table svelte-1ua3isv"><tbody class="svelte-1ua3isv"></tbody></table>'),RY=B('<a class="attr-link svelte-1ua3isv" target="_blank" rel="noopener noreferrer"> </a>'),NY=B('<span class="attr-val svelte-1ua3isv"> </span>'),OY=B('<tr class="svelte-1ua3isv"><td class="attr-name-cell svelte-1ua3isv"><span class="attr-key svelte-1ua3isv"> </span><!></td><td class="attr-actions-cell svelte-1ua3isv"><!></td><td class="attr-val-cell svelte-1ua3isv"><!></td></tr>'),HY=B('<tr class="cluster-hdr-row svelte-1ua3isv"><td colspan="3" class="cluster-hdr-cell svelte-1ua3isv"> </td></tr> <!>',1),WY=B('<table class="cluster-table svelte-1ua3isv"><colgroup><col class="col-attr-name svelte-1ua3isv"/><col class="col-attr-actions svelte-1ua3isv"/><col class="col-attr-val"/></colgroup><tbody class="svelte-1ua3isv"></tbody></table>'),zY=B('<p class="no-clusters svelte-1ua3isv">No clusters</p>'),VY=B('<details class="svelte-1ua3isv"><summary class="svelte-1ua3isv"> <span class="ep-id svelte-1ua3isv"> </span> <span class="ep-chips svelte-1ua3isv"></span></summary> <!></details>'),jY=B('<div class="detail-hdr svelte-1ua3isv"><h2 class="svelte-1ua3isv"> </h2> <!> <p class="detail-nodeid svelte-1ua3isv"> </p></div> <!>',1),$Y=B('<p class="info svelte-1ua3isv">Select a device to view its endpoints.</p>'),UY=B('<span class="stream-badge svelte-1ua3isv"> </span>'),qY=B('<span class="stream-empty svelte-1ua3isv">Waiting for events…</span>'),XC=B('&nbsp;<span class="e-sub svelte-1ua3isv"> </span>',1),GY=B('<span class="e-badge e-badge-status svelte-1ua3isv">status</span> <span class="e-node svelte-1ua3isv"> <!></span> <span> </span>',1),KY=B('<span class="e-badge e-badge-attr svelte-1ua3isv">attr</span> <span class="e-node svelte-1ua3isv"> <!></span> <span class="e-ep svelte-1ua3isv"> <!></span> <span class="e-cluster svelte-1ua3isv"> </span> <span class="e-attr svelte-1ua3isv"> </span> <span class="e-val svelte-1ua3isv"> </span>',1),ZY=B('<div class="er svelte-1ua3isv"><span class="e-ts svelte-1ua3isv"> </span> <!></div>'),XY=B('<div class="stream-body svelte-1ua3isv"><!></div>'),YY=B('<p class="scan-err svelte-1ua3isv"> </p>'),QY=B('<div class="scan-preview svelte-1ua3isv"><video playsinline="" class="scan-video svelte-1ua3isv"></video> <div class="scan-reticle svelte-1ua3isv"></div></div> <p class="scan-hint svelte-1ua3isv">Point camera at the QR code on the device</p>',3),JY=B('<div class="scan-backdrop svelte-1ua3isv"></div> <div class="scan-modal svelte-1ua3isv"><div class="scan-modal-hdr svelte-1ua3isv"><span>Scan Matter QR Code</span> <button class="scan-close svelte-1ua3isv">✕</button></div> <!> <canvas style="display:none"></canvas></div>',1),eQ=B('<!> <div class="matter-page svelte-1ua3isv"><div class="matter-main svelte-1ua3isv"><div class="sidebar svelte-1ua3isv"><div class="sidebar-header svelte-1ua3isv"><span class="sidebar-title svelte-1ua3isv">Matter Devices</span> <button class="add-btn svelte-1ua3isv" title="Commission new device">+</button></div> <!> <ul class="device-list svelte-1ua3isv"><!> <!></ul></div> <div class="detail svelte-1ua3isv"><!></div></div> <div class="stream-panel svelte-1ua3isv"><div class="stream-resize svelte-1ua3isv"></div> <div class="stream-hdr-row svelte-1ua3isv"><span class="stream-title svelte-1ua3isv">Matter Events</span> <!> <button class="stream-toggle svelte-1ua3isv" title="Toggle event feed"> </button></div> <!></div></div> <!>',1);function tQ(o,e){$s(e,!0);const t={onOff:{onOff:[{label:"On",command:"on"},{label:"Off",command:"off"},{label:"Toggle",command:"toggle"}]},levelControl:{currentLevel:[{label:"Step ▲",command:"stepWithOnOff",args:{stepMode:0,stepSize:25,transitionTime:5}},{label:"Step ▼",command:"stepWithOnOff",args:{stepMode:1,stepSize:25,transitionTime:5}}]},windowCovering:{currentPositionLiftPercent100ths:[{label:"Open",command:"upOrOpen"},{label:"Close",command:"downOrClose"},{label:"Stop",command:"stopMotion"}],currentPositionTiltPercent100ths:[{label:"Open",command:"upOrOpen"},{label:"Close",command:"downOrClose"},{label:"Stop",command:"stopMotion"}]}};async function i(Y,Re,dt,ye,ci){try{await cU(Y,Re,dt,ye,ci)}catch(It){console.error("matter command failed",It)}}const n={identify:{0:"identify",1:"triggerEffect"},groups:{0:"addGroup",1:"viewGroup",2:"getGroupMembership",3:"removeGroup",4:"removeAllGroups",5:"addGroupIfIdentifying"},scenes:{0:"addScene",1:"viewScene",2:"removeScene",3:"removeAllScenes",4:"storeScene",5:"recallScene",6:"getSceneMembership",64:"enhancedAddScene",65:"enhancedViewScene",66:"copyScene"},onOff:{0:"off",1:"on",2:"toggle",64:"offWithEffect",65:"onWithRecallGlobalScene",66:"onWithTimedOff"},levelControl:{0:"moveToLevel",1:"move",2:"step",3:"stop",4:"moveToLevelWithOnOff",5:"moveWithOnOff",6:"stepWithOnOff",7:"stopWithOnOff",8:"moveToClosestFrequency"},colorControl:{0:"moveToHue",1:"moveHue",2:"stepHue",3:"moveToSaturation",4:"moveSaturation",5:"stepSaturation",6:"moveToHueAndSaturation",7:"moveToColor",8:"moveColor",9:"stepColor",10:"moveToColorTemperature",64:"enhancedMoveToHue",65:"enhancedMoveHue",66:"enhancedStepHue",67:"enhancedMoveToHueAndSaturation",68:"colorLoopSet",71:"stopMoveStep",75:"moveColorTemperature",76:"stepColorTemperature"},thermostat:{0:"setpointRaiseLower",1:"setWeeklySchedule",2:"getWeeklySchedule",3:"clearWeeklySchedule"},doorLock:{0:"lockDoor",1:"unlockDoor",3:"unlockWithTimeout",11:"setWeekDaySchedule",12:"getWeekDaySchedule",13:"clearWeekDaySchedule",14:"setYearDaySchedule",15:"getYearDaySchedule",16:"clearYearDaySchedule",17:"setHolidaySchedule",18:"getHolidaySchedule",19:"clearHolidaySchedule",26:"setUser",27:"getUser",28:"clearUser",34:"setCredential",36:"getCredential",38:"clearCredential"},windowCovering:{0:"upOrOpen",1:"downOrClose",2:"stopMotion",4:"goToLiftValue",5:"goToLiftPercentage",7:"goToTiltValue",8:"goToTiltPercentage"},fanControl:{0:"step"}};function s(Y,Re){const dt=n[Y];return Re.map(ye=>{const ci=typeof ye=="number"?ye:Number(ye);return{id:ci,name:(dt==null?void 0:dt[ci])??null}})}const r={10:"Door Lock",11:"Door Lock Controller",14:"Aggregator",15:"Generic Switch",17:"On/Off Plug-In Unit",18:"Dimmable Plug-In Unit",19:"Pump",20:"On/Off Light Switch",21:"Dimmer Switch",22:"Color Dimmer Switch",23:"Control Bridge",24:"Pump Controller",256:"On/Off Light",257:"Dimmable Light",268:"Extended Color Light",269:"Color Temperature Light",262:"Light Sensor",263:"Occupancy Sensor",514:"Window Covering",515:"Window Covering Controller",768:"Heating/Cooling Unit",769:"Thermostat",770:"Temperature Sensor",771:"Pressure Sensor",772:"Flow Sensor",773:"Humidity Sensor",774:"On/Off Sensor",2112:"Air Quality Sensor"},a={generatedCommandList:65528,acceptedCommandList:65529,eventList:65530,attributeList:65531,featureMap:65532,clusterRevision:65533},d={descriptor:{deviceTypeList:0,serverList:1,clientList:2,partsList:3,tagList:4},basicInformation:{dataModelRevision:0,vendorName:1,vendorID:2,vendorId:2,productName:3,productID:4,productId:4,nodeLabel:5,location:6,hardwareVersion:7,hardwareVersionString:8,softwareVersion:9,softwareVersionString:10,manufacturingDate:11,partNumber:12,productURL:13,productUrl:13,productLabel:14,serialNumber:15,localConfigDisabled:16,reachable:17,uniqueID:18,uniqueId:18,capabilityMinima:19,productAppearance:20,specificationVersion:21,maxPathsPerInvoke:22},bridgedDeviceBasicInformation:{vendorName:1,vendorID:2,vendorId:2,productName:3,productId:4,nodeLabel:5,hardwareVersion:7,hardwareVersionString:8,softwareVersion:9,softwareVersionString:10,manufacturingDate:11,partNumber:12,productURL:13,productUrl:13,productLabel:14,serialNumber:15,reachable:17,uniqueID:18,uniqueId:18,productAppearance:20},identify:{identifyTime:0,identifyType:1},groups:{nameSupport:0},onOff:{onOff:0,globalSceneControl:16384,onTime:16385,offWaitTime:16386,startUpOnOff:16387},levelControl:{currentLevel:0,remainingTime:1,minLevel:2,maxLevel:3,currentFrequency:4,minFrequency:5,maxFrequency:6,options:15,onOffTransitionTime:16,onLevel:17,onTransitionTime:18,offTransitionTime:19,defaultMoveRate:20,startUpCurrentLevel:16384},colorControl:{currentHue:0,currentSaturation:1,remainingTime:2,currentX:3,currentY:4,colorTemperatureMireds:7,colorMode:8,options:15,enhancedCurrentHue:16384,enhancedColorMode:16385,colorLoopActive:16386,colorLoopDirection:16387,colorLoopTime:16388,colorCapabilities:16394,colorTempPhysicalMinMireds:16395,colorTempPhysicalMaxMireds:16396,coupleColorTempToLevelMinMireds:16397,startUpColorTemperatureMireds:16400},thermostat:{localTemperature:0,outdoorTemperature:1,occupancy:2,absMinHeatSetpointLimit:3,absMaxHeatSetpointLimit:4,absMinCoolSetpointLimit:5,absMaxCoolSetpointLimit:6,piCoolingDemand:7,piHeatingDemand:8,localTemperatureCalibration:16,occupiedCoolingSetpoint:17,occupiedHeatingSetpoint:18,unoccupiedCoolingSetpoint:19,unoccupiedHeatingSetpoint:20,minHeatSetpointLimit:21,maxHeatSetpointLimit:22,minCoolSetpointLimit:23,maxCoolSetpointLimit:24,minSetpointDeadBand:25,remoteSensing:26,controlSequenceOfOperation:27,systemMode:28,thermostatRunningMode:30,startOfWeek:32,numberOfWeeklyTransitions:33,numberOfDailyTransitions:34,temperatureSetpointHold:35,temperatureSetpointHoldDuration:36,thermostatProgrammingOperationMode:37,thermostatRunningState:41,setpointChangeSource:48,setpointChangeAmount:49,setpointChangeSourceTimestamp:50,occupiedSetback:52,unoccupiedSetback:55,emergencyHeatDelta:58},windowCovering:{type:0,physicalClosedLimitLift:1,physicalClosedLimitTilt:2,currentPositionLift:3,currentPositionTilt:4,numberOfActuationsLift:5,numberOfActuationsTilt:6,configStatus:7,currentPositionLiftPercentage:8,currentPositionTiltPercentage:9,operationalStatus:10,targetPositionLiftPercent100ths:11,targetPositionTiltPercent100ths:12,endProductType:13,currentPositionLiftPercent100ths:14,currentPositionTiltPercent100ths:15,installedOpenLimitLift:16,installedClosedLimitLift:17,installedOpenLimitTilt:18,installedClosedLimitTilt:19,mode:23,safetyStatus:26},doorLock:{lockState:0,lockType:1,actuatorEnabled:2,doorState:3,numberOfTotalUsersSupported:17,numberOfPINUsersSupported:18,maxPINCodeLength:23,minPINCodeLength:24,language:33,autoRelockTime:35,soundVolume:36,operatingMode:37,supportedOperatingModes:38,wrongCodeEntryLimit:48},fanControl:{fanMode:0,fanModeSequence:1,percentSetting:2,percentCurrent:3,speedMax:4,speedSetting:5,speedCurrent:6,rockSupport:7,rockSetting:8,windSupport:9,windSetting:10,airflowDirectionSupport:11,airflowDirection:12},occupancySensing:{occupancy:0,occupancySensorType:1,occupancySensorTypeBitmap:2,holdTime:3,pirOccupiedToUnoccupiedDelay:16,pirUnoccupiedToOccupiedDelay:17},illuminanceMeasurement:{measuredValue:0,minMeasuredValue:1,maxMeasuredValue:2,tolerance:3,lightSensorType:4},temperatureMeasurement:{measuredValue:0,minMeasuredValue:1,maxMeasuredValue:2,tolerance:3},pressureMeasurement:{measuredValue:0,minMeasuredValue:1,maxMeasuredValue:2,tolerance:3,scaledValue:16,minScaledValue:17,maxScaledValue:18,scale:20},flowMeasurement:{measuredValue:0,minMeasuredValue:1,maxMeasuredValue:2,tolerance:3},relativeHumidityMeasurement:{measuredValue:0,minMeasuredValue:1,maxMeasuredValue:2,tolerance:3},powerSource:{status:0,order:1,description:2,batVoltage:11,batPercentRemaining:12,batTimeRemaining:13,batChargeLevel:14,batReplacementNeeded:15,batReplaceability:16,batPresent:17,activeBatFaults:18,batChargeState:26}};function u(Y){return"0x"+Y.toString(16).toUpperCase().padStart(4,"0")}let f=F(Li([])),g=Li(new Map);function p(Y){if(Y==null)return"—";if(typeof Y=="boolean"||typeof Y=="number")return String(Y);if(typeof Y=="string")return Y.length>50?Y.slice(0,47)+"…":Y;const Re=JSON.stringify(Y);return Re.length>60?Re.slice(0,57)+"…":Re}function C(Y){return Y==null?"—":typeof Y=="boolean"||typeof Y=="number"?String(Y):typeof Y=="string"?Y:JSON.stringify(Y)}function b(Y){return Y!==null&&typeof Y=="object"&&!Array.isArray(Y)}function y(Y){return Array.isArray(Y)&&Y.length>0&&Y.every(b)}function w(Y,Re){return!!(Re==="attributeList"||Array.isArray(Y)&&Y.length===0||b(Y)&&Object.keys(Y).length===0)}function A(Y){return new Date(Y).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}const I=500,T=20,R=32;let P=0,V=F(Li([])),j=F(!0),J=F(180),ae=Lt(()=>{const Y=Math.max(1,Math.floor((c(J)-R)/T)+1);return c(V).slice(0,Y)});function fe(Y){Y.preventDefault();const Re=Y.clientY,dt=c(J);function ye(It){m(J,Math.max(60,Math.min(600,dt+Re-It.clientY)),!0)}function ci(){document.removeEventListener("mousemove",ye),document.removeEventListener("mouseup",ci)}document.addEventListener("mousemove",ye),document.addEventListener("mouseup",ci)}let X=F(null),ce=F(!1),me=F(null),oe=F(!1),le=F("passcode"),Ae=F(""),Te=F(""),xe=F(""),Ne=F(!1),Ve=F(null),ve=F(""),mt=F(!1),Mt=F(""),ot=F(void 0),yt=F(void 0),be=null,Nt=null;function si(){Nt!==null&&(cancelAnimationFrame(Nt),Nt=null),be&&(be.getTracks().forEach(Y=>Y.stop()),be=null),m(mt,!1),m(Mt,"")}function Xe(Y){si(),m(le,"pairingCode"),m(xe,Y,!0)}function tt(){if(!c(yt))return null;const Y=c(yt).getContext("2d",{willReadFrequently:!0}),{width:Re,height:dt}=c(yt);if(!Re||!dt)return null;const ye=Y.getImageData(0,0,Re,dt);return lY(ye.data,ye.width,ye.height,{inversionAttempts:"dontInvert"})}async function wt(){if(m(mt,!0),m(Mt,""),await hl(),!c(ot)||!c(yt))return;try{be=await navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"}}),c(ot).srcObject=be,await c(ot).play()}catch(Re){m(Mt,"Camera unavailable: "+(Re instanceof Error?Re.message:String(Re)));return}const Y=()=>{var Re;if(!(!c(ot)||!c(yt)||!be)){if(c(ot).readyState===c(ot).HAVE_ENOUGH_DATA){c(yt).width=c(ot).videoWidth,c(yt).height=c(ot).videoHeight,c(yt).getContext("2d",{willReadFrequently:!0}).drawImage(c(ot),0,0);const ye=tt();if((Re=ye==null?void 0:ye.data)!=null&&Re.startsWith("MT:")){Xe(ye.data);return}}Nt=requestAnimationFrame(Y)}};Nt=requestAnimationFrame(Y)}function Yt(Y){var ye;const Re=(ye=Y.target.files)==null?void 0:ye[0];if(!Re)return;const dt=new FileReader;dt.onload=ci=>{const It=new Image;It.onload=()=>{var kt;if(!c(yt))return;c(yt).width=It.width,c(yt).height=It.height,c(yt).getContext("2d",{willReadFrequently:!0}).drawImage(It,0,0);const Ye=tt();(kt=Ye==null?void 0:Ye.data)!=null&&kt.startsWith("MT:")?Xe(Ye.data):m(Mt,"No Matter QR code found in image.")},It.src=ci.target.result},dt.readAsDataURL(Re)}const fi="she:matter:selectedNodeId";async function oi(){try{m(f,await cS(),!0);for(const Y of c(f))_m(Y.nodeId).then(Re=>{g.set(Y.nodeId,Re)}).catch(()=>{});if(c(f).length>0&&!c(X)){const Y=localStorage.getItem(fi),Re=Y&&c(f).find(dt=>dt.nodeId===Y)?Y:c(f)[0].nodeId;ki(Re)}}catch{m(f,[],!0)}}async function ki(Y){m(ce,!0),m(me,null);try{m(X,await _m(Y),!0),g.set(Y,c(X)),localStorage.setItem(fi,Y)}catch(Re){m(me,Re instanceof Error?Re.message:String(Re),!0)}finally{m(ce,!1)}}let _i;async function Ze(Y){var Re;if(await _i.show(`Unpair device ${Y}?`,{confirm:"Unpair",danger:!0}))try{await lU(Y),((Re=c(X))==null?void 0:Re.nodeId)===Y&&m(X,null),await oi()}catch(dt){m(me,dt instanceof Error?dt.message:String(dt),!0)}}async function Ee(){m(Ne,!0),m(Ve,null);try{let Y;c(le)==="passcode"?(Y={passcode:Number(c(Ae))},c(Te)&&(Y={...Y,discriminator:Number(c(Te))})):Y={pairingCode:c(xe).trim()},c(ve).trim()&&(Y={...Y,discoveryAddress:c(ve).trim()}),await aU(Y),m(oe,!1),m(Ae,""),m(Te,""),m(xe,""),m(ve,""),await oi()}catch(Y){m(Ve,Y instanceof Error?Y.message:String(Y),!0)}finally{m(Ne,!1)}}Xs(()=>{oi()});const ii=Xo("matter:deviceList",Y=>{if(!Array.isArray(Y.devices))return;const Re=Y.devices;for(const dt of Re)g.has(dt.nodeId)||_m(dt.nodeId).then(ye=>{g.set(dt.nodeId,ye)}).catch(()=>{});m(f,Re,!0)}),Ci=Xo("matter:deviceStatus",Y=>{if(Y.nodeId===void 0)return;const Re=String(Y.nodeId),dt=!!Y.online;m(f,c(f).map(ye=>ye.nodeId===Re?{...ye,online:dt}:ye),!0),m(V,[{id:P++,kind:"status",nodeId:Re,online:dt,ts:Date.now()},...c(V).slice(0,I-1)],!0)}),Jt=Xo("matter:attr",Y=>{const Re=String(Y.nodeId),dt=Y.endpointId,ye=String(Y.clusterName),ci=String(Y.attrName),It=Y.value;if(c(X)&&c(X).nodeId===Re){const Ye=c(X).endpoints.find(Pt=>Pt.endpointId===dt),kt=Ye==null?void 0:Ye.clusters.find(Pt=>Pt.name===ye);kt&&(kt.attrs[ci]=It)}const ie=g.get(Re);if(ie){const Ye=ie.endpoints.find(Pt=>Pt.endpointId===dt),kt=Ye==null?void 0:Ye.clusters.find(Pt=>Pt.name===ye);kt&&(kt.attrs[ci]=It)}m(V,[{id:P++,kind:"attr",nodeId:Re,endpointId:dt,clusterName:ye,attrName:ci,value:It,ts:Y.ts??Date.now()},...c(V).slice(0,I-1)],!0)});Vp(()=>{ii(),Ci(),Jt(),si()});var zi=eQ(),Ji=Et(zi);gs(Yc(Ji,{}),Y=>_i=Y,()=>_i);var Ii=v(Ji,2),wn=_(Ii),cn=_(wn),pn=_(cn),fn=v(_(pn),2),pt=v(pn,2);{var Ut=Y=>{var Re=uY(),dt=_(Re),ye=_(dt);let ci;var It=v(ye,2);let ie;var Ye=v(dt,2);{var kt=Xt=>{var pe=cY(),Ge=Et(pe),rt=v(_(Ge)),lt=v(Ge,2),Vt=v(_(lt));zt(rt,()=>c(Ae),Ot=>m(Ae,Ot)),zt(Vt,()=>c(Te),Ot=>m(Te,Ot)),D(Xt,pe)},Pt=Xt=>{var pe=dY(),Ge=Et(pe),rt=v(_(Ge)),lt=v(Ge,2),Vt=_(lt),Ot=v(Vt,2),bi=v(_(Ot),2);zt(rt,()=>c(xe),U=>m(xe,U)),$("click",Vt,wt),$("change",bi,Yt),D(Xt,pe)};H(Ye,Xt=>{c(le)==="passcode"?Xt(kt):Xt(Pt,-1)})}var Bt=v(Ye,2),Be=v(_(Bt)),je=v(Bt,2);{var Kt=Xt=>{var pe=K2(),Ge=_(pe);z(()=>W(Ge,c(Ve))),D(Xt,pe)};H(je,Xt=>{c(Ve)&&Xt(Kt)})}var ri=v(je,2),ui=_(ri);z(()=>{ci=At(ye,1,"svelte-1ua3isv",null,ci,{active:c(le)==="passcode"}),ie=At(It,1,"svelte-1ua3isv",null,ie,{active:c(le)==="pairingCode"}),ri.disabled=c(Ne),W(ui,c(Ne)?"Commissioning…":"Commission")}),$("click",ye,()=>m(le,"passcode")),$("click",It,()=>m(le,"pairingCode")),zt(Be,()=>c(ve),Xt=>m(ve,Xt)),$("click",ri,Ee),D(Y,Re)};H(pt,Y=>{c(oe)&&Y(Ut)})}var Ni=v(pt,2),qi=_(Ni);ti(qi,17,()=>c(f),Y=>Y.nodeId,(Y,Re)=>{var dt=gY();let ye;var ci=_(dt),It=_(ci);let ie;var Ye=v(It,2),kt=_(Ye);{var Pt=je=>{var Kt=hY(),ri=Et(Kt),ui=_(ri),Xt=v(ri,2),pe=_(Xt);z(()=>{W(ui,c(Re).name),W(pe,`#${c(Re).nodeId??""}`)}),D(je,Kt)},Bt=je=>{var Kt=fY(),ri=_(Kt);z(()=>W(ri,`Node ${c(Re).nodeId??""}`)),D(je,Kt)};H(kt,je=>{c(Re).name?je(Pt):je(Bt,-1)})}var Be=v(ci,2);z(()=>{var je;ye=At(dt,1,"svelte-1ua3isv",null,ye,{selected:((je=c(X))==null?void 0:je.nodeId)===c(Re).nodeId}),ie=At(It,1,"status-dot svelte-1ua3isv",null,ie,{online:c(Re).online})}),$("click",ci,()=>ki(c(Re).nodeId)),$("click",Be,()=>Ze(c(Re).nodeId)),D(Y,dt)});var gi=v(qi,2);{var Wi=Y=>{var Re=pY();D(Y,Re)};H(gi,Y=>{c(f).length===0&&Y(Wi)})}var Ui=v(cn,2),tn=_(Ui);{var yi=Y=>{var Re=xY();D(Y,Re)},Vi=Y=>{var Re=K2(),dt=_(Re);z(()=>W(dt,c(me))),D(Y,Re)},ze=Y=>{var Re=jY(),dt=Et(Re),ye=_(dt),ci=_(ye),It=v(ye,2);{var ie=Bt=>{var Be=mY(),je=_(Be);z(()=>W(je,c(X).subtitle)),D(Bt,Be)};H(It,Bt=>{c(X).subtitle&&Bt(ie)})}var Ye=v(It,2),kt=_(Ye),Pt=v(dt,2);ti(Pt,17,()=>c(X).endpoints,Bt=>Bt.endpointId,(Bt,Be)=>{var je=VY(),Kt=_(je),ri=_(Kt),ui=v(ri),Xt=_(ui),pe=v(ui,2);ti(pe,21,()=>c(Be).clusters,Hi,(Vt,Ot)=>{var bi=vY(),U=_(bi);z(()=>W(U,c(Ot).name)),D(Vt,bi)});var Ge=v(Kt,2);{var rt=Vt=>{var Ot=WY(),bi=v(_(Ot));ti(bi,21,()=>c(Be).clusters,Hi,(U,M)=>{var O=HY(),ee=Et(O),ne=_(ee),se=_(ne),re=v(ee,2);ti(re,17,()=>Object.entries(c(M).attrs),Hi,(Ie,We)=>{var Ce=Lt(()=>l8(c(We),2));let Pe=()=>c(Ce)[0],Me=()=>c(Ce)[1];var at=Ss(),Qt=Et(at);{var Z=Ue=>{const Ft=Lt(()=>{var Ht;return(Ht=t[c(M).name])==null?void 0:Ht[Pe()]}),we=Lt(()=>(Pe()==="acceptedCommandList"||Pe()==="generatedCommandList")&&Array.isArray(Me())),Oe=Lt(()=>{var Ht;return((Ht=d[c(M).name])==null?void 0:Ht[Pe()])??a[Pe()]});var St=OY(),ut=_(St),nt=_(ut),ue=_(nt),He=v(nt);{var Fe=Ht=>{var Dt=_Y(),jt=_(Dt);z(Zt=>W(jt,`(${Zt??""})`),[()=>u(c(Oe))]),D(Ht,Dt)};H(He,Ht=>{c(Oe)!==void 0&&Ht(Fe)})}var Je=v(ut),ht=_(Je);{var Ke=Ht=>{var Dt=CY();ti(Dt,21,()=>c(Ft),Hi,(jt,Zt)=>{var hi=bY(),nn=_(hi);z(()=>W(nn,c(Zt).label)),$("click",hi,()=>i(c(X).nodeId,c(Be).endpointId,c(M).name,c(Zt).command,c(Zt).args)),D(jt,hi)}),D(Ht,Dt)};H(ht,Ht=>{c(Ft)&&Ht(Ke)})}var et=v(Je),ge=_(et);{var $e=Ht=>{var Dt=DY();ti(Dt,21,()=>s(c(M).name,Me()),Hi,(jt,Zt,hi)=>{var nn=SY(),dn=Et(nn);{var Ln=In=>{var es=EY();D(In,es)};H(dn,In=>{hi>0&&In(Ln)})}var Oi=v(dn,2);{var Dn=In=>{var es=yY(),Zi=Et(es),Is=_(Zi),Tn=v(Zi),Gn=_(Tn);z(()=>{W(Is,c(Zt).name),W(Gn,`(${c(Zt).id??""})`)}),D(In,es)},Jn=In=>{var es=wY(),Zi=_(es);z(()=>W(Zi,c(Zt).id)),D(In,es)};H(Oi,In=>{c(Zt).name?In(Dn):In(Jn,-1)})}D(jt,nn)}),D(Ht,Dt)},_t=Ht=>{var Dt=BY(),jt=v(_(Dt));ti(jt,21,Me,Hi,(Zt,hi)=>{const nn=Lt(()=>c(hi)),dn=Lt(()=>c(nn).deviceType),Ln=Lt(()=>r[c(dn)]);var Oi=kY(),Dn=_(Oi),Jn=_(Dn);{var In=Tn=>{var Gn=AY(),vs=Et(Gn),ir=v(vs),zr=_(ir);z(Xa=>{W(vs,`${c(Ln)??""} `),W(zr,`(${Xa??""})`)},[()=>u(c(dn))]),D(Tn,Gn)},es=Tn=>{var Gn=oo();z(vs=>W(Gn,vs),[()=>u(c(dn))]),D(Tn,Gn)};H(Jn,Tn=>{c(Ln)?Tn(In):Tn(es,-1)})}var Zi=v(Dn),Is=_(Zi);z(Tn=>W(Is,Tn),[()=>C(c(nn).revision)]),D(Zt,Oi)}),D(Ht,Dt)},Wt=Lt(()=>Pe()==="deviceTypeList"&&Array.isArray(Me())),bt=Ht=>{const Dt=Lt(()=>[...new Set(Me().flatMap(dn=>Object.keys(dn)))]);var jt=PY(),Zt=_(jt),hi=_(Zt);ti(hi,21,()=>c(Dt),Hi,(dn,Ln)=>{var Oi=FY(),Dn=_(Oi);z(()=>W(Dn,c(Ln))),D(dn,Oi)});var nn=v(Zt);ti(nn,21,Me,Hi,(dn,Ln)=>{var Oi=IY();ti(Oi,21,()=>c(Dt),Hi,(Dn,Jn)=>{var In=LY(),es=_(In);z(Zi=>W(es,Zi),[()=>C(c(Ln)[c(Jn)])]),D(Dn,In)}),D(dn,Oi)}),D(Ht,jt)},pi=Lt(()=>y(Me())),Di=Ht=>{var Dt=MY(),jt=_(Dt);ti(jt,21,()=>Object.entries(Me()),Hi,(Zt,hi)=>{var nn=Lt(()=>l8(c(hi),2));let dn=()=>c(nn)[0],Ln=()=>c(nn)[1];var Oi=TY(),Dn=_(Oi),Jn=_(Dn),In=v(Dn),es=_(In);z(Zi=>{W(Jn,dn()),W(es,Zi)},[()=>C(Ln())]),D(Zt,Oi)}),D(Ht,Dt)},Xi=Lt(()=>b(Me())),Mi=Ht=>{var Dt=RY(),jt=_(Dt);z(()=>{ln(Dt,"href",Me()),W(jt,Me())}),D(Ht,Dt)},ai=Ht=>{var Dt=NY(),jt=_(Dt);z(Zt=>W(jt,Zt),[()=>C(Me())]),D(Ht,Dt)};H(ge,Ht=>{c(we)?Ht($e):c(Wt)?Ht(_t,1):c(pi)?Ht(bt,2):c(Xi)?Ht(Di,3):(Pe()==="productUrl"||Pe()==="productURL")&&typeof Me()=="string"?Ht(Mi,4):Ht(ai,-1)})}z(()=>{ln(ut,"title",Pe()),W(ue,Pe())}),D(Ue,St)},de=Lt(()=>!w(Me(),Pe()));H(Qt,Ue=>{c(de)&&Ue(Z)})}D(Ie,at)}),z(()=>W(se,c(M).name)),D(U,O)}),D(Vt,Ot)},lt=Vt=>{var Ot=zY();D(Vt,Ot)};H(Ge,Vt=>{c(Be).clusters.length>0?Vt(rt):Vt(lt,-1)})}z(()=>{W(ri,`${c(Be).name??`Endpoint ${c(Be).endpointId}`??""} `),W(Xt,`ep${c(Be).endpointId??""}`)}),D(Bt,je)}),z(()=>{W(ci,c(X).name??`Node ${c(X).nodeId}`),W(kt,`Node ID: ${c(X).nodeId??""}`)}),D(Y,Re)},qt=Y=>{var Re=$Y();D(Y,Re)};H(tn,Y=>{c(ce)?Y(yi):c(me)?Y(Vi,1):c(X)?Y(ze,2):Y(qt,-1)})}var wi=v(wn,2),ji=_(wi),Si=v(ji,2),K=v(_(Si),2);{var De=Y=>{var Re=UY(),dt=_(Re);z(()=>W(dt,c(V).length)),D(Y,Re)};H(K,Y=>{!c(j)&&c(V).length>0&&Y(De)})}var Qe=v(K,2),it=_(Qe),Gt=v(Si,2);{var li=Y=>{var Re=XY(),dt=_(Re);{var ye=It=>{var ie=qY();D(It,ie)},ci=It=>{var ie=Ss(),Ye=Et(ie);ti(Ye,17,()=>c(ae),kt=>kt.id,(kt,Pt)=>{const Bt=Lt(()=>{var rt,lt;return((rt=g.get(c(Pt).nodeId))==null?void 0:rt.name)??((lt=c(f).find(Vt=>Vt.nodeId===c(Pt).nodeId))==null?void 0:lt.name)??null}),Be=Lt(()=>{var rt,lt;return c(Pt).endpointId!==void 0?((lt=(rt=g.get(c(Pt).nodeId))==null?void 0:rt.endpoints.find(Vt=>Vt.endpointId===c(Pt).endpointId))==null?void 0:lt.name)??null:null}),je=Lt(()=>c(Pt).attrName??c(Pt).clusterName);var Kt=ZY(),ri=_(Kt),ui=_(ri),Xt=v(ri,2);{var pe=rt=>{var lt=GY(),Vt=v(Et(lt),2),Ot=_(Vt),bi=v(Ot);{var U=ne=>{var se=XC(),re=v(Et(se)),Ie=_(re);z(()=>W(Ie,`(#${c(Pt).nodeId??""})`)),D(ne,se)};H(bi,ne=>{c(Bt)&&ne(U)})}var M=v(Vt,2);let O;var ee=_(M);z(()=>{W(Ot,c(Bt)??`#${c(Pt).nodeId}`),O=At(M,1,"e-val svelte-1ua3isv",null,O,{"e-online":c(Pt).online,"e-offline":!c(Pt).online}),W(ee,c(Pt).online?"online":"offline")}),D(rt,lt)},Ge=rt=>{var lt=KY(),Vt=v(Et(lt),2),Ot=_(Vt),bi=v(Ot);{var U=Me=>{var at=XC(),Qt=v(Et(at)),Z=_(Qt);z(()=>W(Z,`(#${c(Pt).nodeId??""})`)),D(Me,at)};H(bi,Me=>{c(Bt)&&Me(U)})}var M=v(Vt,2),O=_(M),ee=v(O);{var ne=Me=>{var at=XC(),Qt=v(Et(at)),Z=_(Qt);z(()=>W(Z,`(ep ${c(Pt).endpointId??""})`)),D(Me,at)};H(ee,Me=>{c(Be)&&Me(ne)})}var se=v(M,2),re=_(se),Ie=v(se,2),We=_(Ie),Ce=v(Ie,2),Pe=_(Ce);z(Me=>{W(Ot,c(Bt)??`#${c(Pt).nodeId}`),W(O,c(Be)??`ep${c(Pt).endpointId}`),W(re,c(Pt).clusterName),W(We,c(je)),W(Pe,Me)},[()=>p(c(Pt).value)]),D(rt,lt)};H(Xt,rt=>{c(Pt).kind==="status"?rt(pe):rt(Ge,-1)})}z(rt=>W(ui,rt),[()=>A(c(Pt).ts)]),D(kt,Kt)}),D(It,ie)};H(dt,It=>{c(ae).length===0?It(ye):It(ci,-1)})}D(Y,Re)};H(Gt,Y=>{c(j)&&Y(li)})}var vt=v(Ii,2);{var ft=Y=>{var Re=JY(),dt=Et(Re),ye=v(dt,2),ci=_(ye),It=v(_(ci),2),ie=v(ci,2);{var Ye=Bt=>{var Be=YY(),je=_(Be);z(()=>W(je,c(Mt))),D(Bt,Be)},kt=Bt=>{var Be=QY(),je=Et(Be),Kt=_(je);gs(Kt,ri=>m(ot,ri),()=>c(ot)),D(Bt,Be)};H(ie,Bt=>{c(Mt)?Bt(Ye):Bt(kt,-1)})}var Pt=v(ie,2);gs(Pt,Bt=>m(yt,Bt),()=>c(yt)),$("click",dt,si),$("click",It,si),D(Y,Re)};H(vt,Y=>{c(mt)&&Y(ft)})}z(()=>{qo(wi,c(j)?`height: ${c(J)}px;`:""),W(it,c(j)?"▾":"▸")}),$("click",fn,()=>m(oe,!c(oe))),$("mousedown",ji,fe),$("click",Qe,()=>{m(j,!c(j))}),D(o,zi),Us()}Ys(["click","change","mousedown"]);var iQ=B("<button>›</button>"),nQ=B('<span class="chev-ph svelte-1vejtrc"></span>'),sQ=B('<span class="tv svelte-1vejtrc"> </span> <span class="tt svelte-1vejtrc"> </span>',1),oQ=B("<button>🔒</button>"),rQ=B('<span class="acl-loading">Loading…</span>'),aQ=B("<span> </span>"),lQ=B('<span class="acl-dyn svelte-1vejtrc" title="per-user/client pattern — cannot evaluate statically">⚠%u/%c</span>'),cQ=B('<span class="acl-members svelte-1vejtrc"> </span>'),dQ=B('<span class="acl-group svelte-1vejtrc"> </span>'),uQ=B('<span> <strong class="svelte-1vejtrc"> </strong> <!> <!> <!></span>'),hQ=B('<div class="acl-sec svelte-1vejtrc"><span class="acl-sec-hdr svelte-1vejtrc"> </span> <!></div>'),fQ=B('<div class="acl-panel svelte-1vejtrc"><!></div>'),gQ=B('<div class="tc svelte-1vejtrc"></div>'),pQ=B('<div class="tn svelte-1vejtrc"><div><!> <span class="seg svelte-1vejtrc"> </span> <!> <!></div> <!> <!></div>'),xQ=B('<button class="acl-refresh svelte-1vejtrc" title="Refresh ACL data">↺</button>'),mQ=B('<button title="Show ACL coverage for topics"><svg width="11" height="11" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><rect x="3" y="7" width="10" height="8" rx="1.5"></rect><path d="M5 7V5a3 3 0 0 1 6 0v2" fill="none" stroke="currentColor" stroke-width="1.8"></path></svg> ACL<!></button> <!>',1),vQ=B("<option></option>"),_Q=B('<span class="pub-ok svelte-1vejtrc">✓</span>'),bQ=B('<span class="pub-err svelte-1vejtrc"> </span>'),CQ=B('<div class="info svelte-1vejtrc">Loading…</div>'),EQ=B('<div class="info err svelte-1vejtrc"> </div>'),yQ=B('<div class="info svelte-1vejtrc">No topics match.</div>'),wQ=B('<div class="vr svelte-1vejtrc"><span class="v-topic svelte-1vejtrc"> </span> <span class="v-val svelte-1vejtrc"> </span> <span class="v-ts svelte-1vejtrc"> </span></div>'),SQ=B('<div class="vs svelte-1vejtrc"><div><div class="vrows-abs svelte-1vejtrc"></div></div></div>'),DQ=B('<div class="info svelte-1vejtrc">No topics yet.</div>'),AQ=B('<div class="tree-wrap svelte-1vejtrc"><!></div>'),kQ=B('<span class="stream-badge"> </span>'),BQ=B('<span class="stream-empty svelte-1vejtrc">Waiting for messages…</span>'),FQ=B('<span class="s-ret svelte-1vejtrc" title="retained snapshot">&#x229B;</span>'),LQ=B('<div><span class="s-ts svelte-1vejtrc"> </span> <!> <span class="s-topic svelte-1vejtrc"> </span> <span class="s-val svelte-1vejtrc"> </span></div>'),IQ=B('<div class="stream-body svelte-1vejtrc"><!></div>'),PQ=B('<div class="ctx-bd svelte-1vejtrc"></div> <div class="ctx-menu svelte-1vejtrc"><button class="svelte-1vejtrc">Copy topic</button> <button class="svelte-1vejtrc">Clear retained</button></div>',1),TQ=B('<label class="modal-check svelte-1vejtrc"><input type="checkbox" class="svelte-1vejtrc"/> <span class="checkmark svelte-1vejtrc"></span> Recursive — also clear all child topics</label>'),MQ=B('<div class="modal-bd svelte-1vejtrc"></div> <div class="modal svelte-1vejtrc"><div class="modal-title svelte-1vejtrc">Clear retained</div> <div class="modal-body svelte-1vejtrc"><p class="svelte-1vejtrc">Clear retained value for <code class="svelte-1vejtrc"> </code>?</p> <!></div> <div class="modal-footer svelte-1vejtrc"><button class="btn-cancel svelte-1vejtrc">Cancel</button> <button class="btn-confirm svelte-1vejtrc">Clear</button></div></div>',1),RQ=B('<div class="page svelte-1vejtrc"><div class="toolbar svelte-1vejtrc"><h2 class="svelte-1vejtrc">MQTT</h2> <!></div> <div class="main-group svelte-1vejtrc"><div class="pub-bar svelte-1vejtrc"><input class="pt svelte-1vejtrc" type="text" placeholder="topic" list="pub-topic-list" autocomplete="off"/> <datalist id="pub-topic-list"></datalist> <input class="pp svelte-1vejtrc" type="text" placeholder="payload"/> <label class="rl svelte-1vejtrc"><input type="checkbox" class="svelte-1vejtrc"/> <span class="checkmark svelte-1vejtrc"></span> retain</label> <select class="svelte-1vejtrc"><option>QoS 0</option><option>QoS 1</option><option>QoS 2</option></select> <button class="svelte-1vejtrc">Publish</button> <!> <!></div> <div class="tree-filter-bar svelte-1vejtrc"><input class="filter-in svelte-1vejtrc" type="search" placeholder="Filter topics…"/> <span class="count svelte-1vejtrc"><!> </span></div> <!></div> <div class="stream-panel svelte-1vejtrc"><div class="stream-resize svelte-1vejtrc"></div> <div class="stream-hdr-row svelte-1vejtrc"><input class="filter-in stream-filter-in svelte-1vejtrc" type="search" placeholder="Live stream filter (MQTT wildcard, default: #)"/> <!> <button class="stream-toggle svelte-1vejtrc" title="Toggle live stream"> </button></div> <!></div> <!> <!></div>');function NQ(o,e){$s(e,!0);const t=(M,O=rb)=>{const ee=Lt(()=>c(g).has(O().path)),ne=Lt(()=>c(a)>=0&&O().children.size>0),se=Lt(()=>c(a)>=0&&O().isLeaf&&!n.has(O().path));var re=pQ(),Ie=_(re);let We;var Ce=_(Ie);{var Pe=ue=>{var He=iQ();let Fe;z(()=>{Fe=At(He,1,"chev svelte-1vejtrc",null,Fe,{open:c(ee)}),ln(He,"aria-label",c(ee)?"Collapse":"Expand")}),$("click",He,()=>p(O().path)),D(ue,He)},Me=ue=>{var He=nQ();D(ue,He)};H(Ce,ue=>{c(ne)?ue(Pe):ue(Me,-1)})}var at=v(Ce,2),Qt=_(at),Z=v(at,2);{var de=ue=>{var He=sQ(),Fe=Et(He),Je=_(Fe),ht=v(Fe,2),Ke=_(ht);z((et,ge,$e)=>{ln(Fe,"title",et),W(Je,ge),W(Ke,$e)},[()=>{var et;return fi((et=_i(O().path))==null?void 0:et.val)},()=>{var et;return fi((et=_i(O().path))==null?void 0:et.val)},()=>{var et;return((et=_i(O().path))==null?void 0:et.ts)!=null?oi(_i(O().path).ts):""}]),D(ue,He)},Ue=Lt(()=>O().isLeaf&&i.has(O().path));H(Z,ue=>{c(Ue)&&ue(de)})}var Ft=v(Z,2);{var we=ue=>{const He=Lt(()=>!!c(zi)&&pn(O().path));var Fe=oQ();let Je;z(()=>{Je=At(Fe,1,"acl-badge svelte-1vejtrc",null,Je,{matched:c(He)}),ln(Fe,"title",c(He)?"Has explicit ACL — click to inspect":"No explicit ACL — click to inspect defaults")}),$("click",Fe,ht=>{ht.stopPropagation(),pt(O().path)}),D(ue,Fe)};H(Ft,ue=>{c(Ci)&&O().isLeaf&&ue(we)})}var Oe=v(Ie,2);{var St=ue=>{var He=fQ(),Fe=_(He);{var Je=Ke=>{var et=rQ();D(Ke,et)},ht=Ke=>{var et=Ss(),ge=Et(et);ti(ge,17,()=>[{label:"Send",section:c(Ii).send},{label:"Subscribe",section:c(Ii).subscribe},{label:"Receive",section:c(Ii).receive}],Hi,($e,_t)=>{var Wt=hQ(),bt=_(Wt),pi=_(bt),Di=v(bt,2);{var Xi=ai=>{var Ht=aQ();let Dt;var jt=_(Ht);z(()=>{Dt=At(Ht,1,"acl-def svelte-1vejtrc",null,Dt,{allow:c(_t).section.default,deny:!c(_t).section.default}),W(jt,`${c(_t).section.default?"allow":"deny"} (default)`)}),D(ai,Ht)},Mi=ai=>{var Ht=Ss(),Dt=Et(Ht);ti(Dt,17,()=>c(_t).section.roles,Hi,(jt,Zt)=>{var hi=uQ();let nn;var dn=_(hi),Ln=v(dn),Oi=_(Ln),Dn=v(Ln,2);{var Jn=Is=>{var Tn=lQ();D(Is,Tn)};H(Dn,Is=>{c(Zt).dynamic&&Is(Jn)})}var In=v(Dn,2);{var es=Is=>{var Tn=cQ(),Gn=_(Tn);z(vs=>W(Gn,vs),[()=>c(Zt).users.join(", ")]),D(Is,Tn)};H(In,Is=>{c(Zt).users.length>0&&Is(es)})}var Zi=v(In,2);ti(Zi,17,()=>c(Zt).groups,Hi,(Is,Tn)=>{var Gn=dQ(),vs=_(Gn);z(()=>W(vs,c(Tn).groupname)),D(Is,Gn)}),z(()=>{nn=At(hi,1,"acl-role svelte-1vejtrc",null,nn,{allow:c(Zt).allow,deny:!c(Zt).allow}),W(dn,`${c(Zt).allow?"✓":"✗"} `),W(Oi,c(Zt).rolename)}),D(jt,hi)}),D(ai,Ht)};H(Di,ai=>{c(_t).section.roles.length===0?ai(Xi):ai(Mi,-1)})}z(()=>W(pi,c(_t).label)),D($e,Wt)}),D(Ke,et)};H(Fe,Ke=>{c(wn)?Ke(Je):c(Ii)&&Ke(ht,1)})}D(ue,He)};H(Oe,ue=>{c(Ci)&&O().isLeaf&&c(Ji)===O().path&&ue(St)})}var ut=v(Oe,2);{var nt=ue=>{var He=gQ();ti(He,21,()=>[...O().children.values()].sort((Fe,Je)=>Fe.seg.localeCompare(Je.seg)),Fe=>Fe.path,(Fe,Je)=>{t(Fe,()=>c(Je))}),D(ue,He)};H(ut,ue=>{c(ne)&&c(ee)&&ue(nt)})}z(()=>{We=At(Ie,1,"tr svelte-1vejtrc",null,We,{stale:c(se)}),W(Qt,O().seg)}),$("click",Ie,()=>{m(ce,O().path+"/#")}),$("contextmenu",Ie,ue=>{ue.preventDefault(),m(ve,{x:ue.clientX,y:ue.clientY,topic:O().path},!0)}),D(M,re)},i=new Map,n=new Set,s=new Set;let r=null,a=F(0);function d(){r===null&&(r=requestAnimationFrame(()=>{r=null;for(const M of s)f(M);s.clear(),u8(a)}))}const u=new Map;function f(M){const O=M.split("/");let ee=u,ne="";for(let se=0;se<O.length;se++){const re=O[se];ne=se===0?re:`${ne}/${re}`,ee.has(re)||ee.set(re,{seg:re,path:ne,children:new Map,isLeaf:!1});const Ie=ee.get(re);se===O.length-1&&(Ie.isLeaf=!0),ee=Ie.children}}let g=F(Li(new Set));function p(M){const O=new Set(c(g));O.has(M)?O.delete(M):O.add(M),m(g,O,!0)}let C=F("");const b=24,y=5;let w=F(0),A=F(300),I=Lt(()=>{if(c(a),!c(C))return[];const M=c(C).toLowerCase().split(/\s+/).filter(Boolean),O=[];for(const[ee,ne]of i){const se=ee.toLowerCase();M.every(re=>se.includes(re))&&O.push({topic:ee,...ne})}return O.sort((ee,ne)=>ee.topic.localeCompare(ne.topic))}),T=Lt(()=>{const M=c(I).length,O=Math.max(0,Math.floor(c(w)/b)-y),ee=Math.min(M,Math.ceil((c(w)+c(A))/b)+y);return{start:O,end:ee,totalH:M*b,top:O*b}});const R=1e3,P=200,V=20,j=36;let J=0,ae=F(Li([])),fe=F(Li([])),X=F(!0),ce=F("#"),me=F(200);Kn(()=>{const M=c(ce).trim(),O=Hl(()=>c(ae)),ee=!M||M==="#"?O.slice(0,P):O.filter(ne=>oe(M,ne.topic)).slice(0,P);if(M&&M!=="#"){const ne=new Set(ee.map(re=>re.topic)),se=[];for(const[re,Ie]of i)ne.has(re)||oe(M,re)&&se.push({id:-(se.length+1),topic:re,val:Ie.val,ts:Ie.ts,retained:!0});se.sort((re,Ie)=>re.topic.localeCompare(Ie.topic)),m(fe,[...ee,...se],!0)}else m(fe,ee,!0)});function oe(M,O){if(M==="#")return!0;const ee=M.split("/"),ne=O.split("/");for(let se=0;se<ee.length;se++){if(ee[se]==="#")return!0;if(se>=ne.length||ee[se]!=="+"&&ee[se]!==ne[se])return!1}return ee.length===ne.length}function le(M){M.preventDefault();const O=M.clientY,ee=c(me);function ne(re){m(me,Math.max(60,Math.min(800,ee+O-re.clientY)),!0)}function se(){document.removeEventListener("mousemove",ne),document.removeEventListener("mouseup",se)}document.addEventListener("mousemove",ne),document.addEventListener("mouseup",se)}let Ae=Lt(()=>{const M=Math.max(1,Math.floor((c(me)-j)/V)+1);return c(fe).slice(0,M)}),Te=F(!0),xe=F(null);async function Ne(){m(Te,!0),m(xe,null);try{const M=await bF();for(const O of M)i.set(O.topic,{val:O.val,ts:O.ts}),f(O.topic)}catch(M){m(xe,M instanceof Error?M.message:String(M),!0)}finally{m(Te,!1),u8(a)}}const Ve=Xo("mqtt",M=>{const{topic:O,val:ee,ts:ne}=M;i.set(O,{val:ee,ts:ne}),n.add(O),s.add(O),d();const se={id:J++,topic:O,val:ee,ts:ne};m(ae,[se,...c(ae).slice(0,R-1)],!0);const re=c(ce).trim();(!re||re==="#"||oe(re,O))&&m(fe,[se,...c(fe).filter(Ie=>!(Ie.retained&&Ie.topic===O)).slice(0,P-1)],!0)});let ve=F(null),mt=F(null);async function Mt(M,O){const ee=[M];if(O){const ne=M+"/";for(const se of i.keys())se.startsWith(ne)&&ee.push(se)}for(const ne of ee)await f2(ne,"",!0,0)}let ot=Lt(()=>(c(a),[...i.keys()].sort())),yt=F(""),be=F(""),Nt=F(!1),si=F(0),Xe=F(!1),tt=F(null),wt=F(!1);async function Yt(){if(c(yt)){m(Xe,!0),m(tt,null),m(wt,!1);try{await f2(c(yt),c(be),c(Nt),c(si)),m(wt,!0),setTimeout(()=>{m(wt,!1)},2e3)}catch(M){m(tt,M instanceof Error?M.message:String(M),!0)}finally{m(Xe,!1)}}}function fi(M){return M==null?"":typeof M=="object"?JSON.stringify(M):String(M)}function oi(M){return new Date(M).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function ki(M){return new Date(M).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function _i(M){return c(a),i.get(M)}let Ze=Lt(()=>(c(a),[...u.values()].sort((M,O)=>M.seg.localeCompare(O.seg)))),Ee=Lt(()=>(c(a),i.size)),ii=F(!1),Ci=F(!1),Jt=F(!1),zi=F(null),Ji=F(null),Ii=F(null),wn=F(!1);function cn(M,O,ee){return O.includes("%u")||O.includes("%c")?"dynamic":M==="subscribeLiteral"||M==="unsubscribeLiteral"?O===ee?"match":"no-match":oe(O,ee)?"match":"no-match"}function pn(M){if(!c(zi))return!1;for(const O of c(zi).roles)if(O.acls){for(const ee of O.acls)if(cn(ee.acltype,ee.topic,M)!=="no-match")return!0}return!1}async function fn(){m(Jt,!0);try{const M=await AF();m(zi,{roles:M.roles},!0)}catch{m(zi,null),m(Ci,!1)}finally{m(Jt,!1)}}async function pt(M){if(c(Ji)===M){m(Ji,null),m(Ii,null);return}m(Ji,M,!0),m(Ii,null),m(wn,!0);try{m(Ii,await TU(M),!0)}catch{m(Ii,null)}finally{m(wn,!1)}}async function Ut(){c(Ci)?(m(Ci,!1),m(Ji,null),m(Ii,null)):(m(Ci,!0),m(Ji,null),m(Ii,null),c(zi)||await fn())}const Ni=Xo("mqtt:status",()=>{Ne()});Xs(Ne),Xs(async()=>{var M;try{const O=await Pb();m(ii,!!((M=O.dynsec)!=null&&M.dynsecReady),!0)}catch{m(ii,!1)}}),Vp(()=>{Ve(),Ni(),r!==null&&cancelAnimationFrame(r)});var qi=RQ(),gi=_(qi),Wi=v(_(gi),2);{var Ui=M=>{var O=mQ(),ee=Et(O);let ne;var se=v(_(ee),2);{var re=Ce=>{var Pe=oo("…");D(Ce,Pe)};H(se,Ce=>{c(Jt)&&Ce(re)})}var Ie=v(ee,2);{var We=Ce=>{var Pe=xQ();z(()=>Pe.disabled=c(Jt)),$("click",Pe,fn),D(Ce,Pe)};H(Ie,Ce=>{c(Ci)&&Ce(We)})}z(()=>{ne=At(ee,1,"acl-btn svelte-1vejtrc",null,ne,{active:c(Ci)}),ee.disabled=c(Jt)}),$("click",ee,Ut),D(M,O)};H(Wi,M=>{c(ii)&&M(Ui)})}var tn=v(gi,2),yi=_(tn),Vi=_(yi),ze=v(Vi,2);ti(ze,20,()=>c(ot),M=>M,(M,O)=>{var ee=vQ(),ne={};z(()=>{ne!==(ne=O)&&(ee.value=(ee.__value=O)??"")}),D(M,ee)});var qt=v(ze,2),wi=v(qt,2),ji=_(wi),Si=v(wi,2),K=_(Si);K.value=K.__value=0;var De=v(K);De.value=De.__value=1;var Qe=v(De);Qe.value=Qe.__value=2;var it=v(Si,2),Gt=v(it,2);{var li=M=>{var O=_Q();D(M,O)};H(Gt,M=>{c(wt)&&M(li)})}var vt=v(Gt,2);{var ft=M=>{var O=bQ(),ee=_(O);z(()=>W(ee,c(tt))),D(M,O)};H(vt,M=>{c(tt)&&M(ft)})}var Y=v(yi,2),Re=_(Y),dt=v(Re,2),ye=_(dt);{var ci=M=>{var O=oo();z(()=>W(O,`${c(I).length??""} /`)),D(M,O)};H(ye,M=>{c(C)&&M(ci)})}var It=v(ye),ie=v(Y,2);{var Ye=M=>{var O=CQ();D(M,O)},kt=M=>{var O=EQ(),ee=_(O);z(()=>W(ee,c(xe))),D(M,O)},Pt=M=>{var O=Ss(),ee=Et(O);{var ne=re=>{var Ie=yQ();D(re,Ie)},se=re=>{var Ie=SQ(),We=_(Ie),Ce=_(We);ti(Ce,21,()=>c(I).slice(c(T).start,c(T).end),Pe=>Pe.topic,(Pe,Me)=>{var at=wQ(),Qt=_(at),Z=_(Qt),de=v(Qt,2),Ue=_(de),Ft=v(de,2),we=_(Ft);z((Oe,St,ut)=>{W(Z,c(Me).topic),ln(de,"title",Oe),W(Ue,St),W(we,ut)},[()=>fi(c(Me).val),()=>fi(c(Me).val),()=>oi(c(Me).ts)]),D(Pe,at)}),z(()=>{qo(We,`height: ${c(T).totalH??""}px; position: relative;`),qo(Ce,`top: ${c(T).top??""}px;`)}),xs("scroll",Ie,Pe=>{m(w,Pe.currentTarget.scrollTop,!0)}),fP(Ie,"clientHeight",Pe=>m(A,Pe)),D(re,Ie)};H(ee,re=>{c(I).length===0?re(ne):re(se,-1)})}D(M,O)},Bt=M=>{var O=AQ(),ee=_(O);{var ne=re=>{var Ie=DQ();D(re,Ie)},se=re=>{var Ie=Ss(),We=Et(Ie);ti(We,17,()=>c(Ze),Ce=>Ce.path,(Ce,Pe)=>{t(Ce,()=>c(Pe))}),D(re,Ie)};H(ee,re=>{c(Ze).length===0?re(ne):re(se,-1)})}D(M,O)};H(ie,M=>{c(Te)?M(Ye):c(xe)?M(kt,1):c(C)?M(Pt,2):M(Bt,-1)})}var Be=v(tn,2),je=_(Be),Kt=v(je,2),ri=_(Kt),ui=v(ri,2);{var Xt=M=>{var O=kQ(),ee=_(O);z(()=>W(ee,c(fe).length)),D(M,O)};H(ui,M=>{!c(X)&&c(fe).length>0&&M(Xt)})}var pe=v(ui,2),Ge=_(pe),rt=v(Kt,2);{var lt=M=>{var O=IQ(),ee=_(O);{var ne=re=>{var Ie=BQ();D(re,Ie)},se=re=>{var Ie=Ss(),We=Et(Ie);ti(We,17,()=>c(Ae),Ce=>Ce.id,(Ce,Pe)=>{var Me=LQ();let at;var Qt=_(Me),Z=_(Qt),de=v(Qt,2);{var Ue=ut=>{var nt=FQ();D(ut,nt)};H(de,ut=>{c(Pe).retained&&ut(Ue)})}var Ft=v(de,2),we=_(Ft),Oe=v(Ft,2),St=_(Oe);z((ut,nt,ue)=>{at=At(Me,1,"sr svelte-1vejtrc",null,at,{retained:c(Pe).retained}),W(Z,ut),W(we,c(Pe).topic),ln(Oe,"title",nt),W(St,ue)},[()=>ki(c(Pe).ts),()=>fi(c(Pe).val),()=>fi(c(Pe).val)]),D(Ce,Me)}),D(re,Ie)};H(ee,re=>{c(Ae).length===0?re(ne):re(se,-1)})}D(M,O)};H(rt,M=>{c(X)&&M(lt)})}var Vt=v(Be,2);{var Ot=M=>{var O=PQ(),ee=Et(O),ne=v(ee,2);let se;var re=_(ne),Ie=v(re,2);z(()=>se=qo(ne,"",se,{left:`${c(ve).x??""}px`,top:`${c(ve).y??""}px`})),$("click",ee,()=>m(ve,null)),$("contextmenu",ee,We=>{We.preventDefault(),m(ve,null)}),$("click",re,()=>{navigator.clipboard.writeText(c(ve).topic),m(ve,null)}),$("click",Ie,()=>{const We=c(ve).topic,Ce=We+"/",Pe=[...i.keys()].some(Me=>Me.startsWith(Ce));m(mt,{topic:We,hasChildren:Pe,recursive:!1},!0),m(ve,null)}),D(M,O)};H(Vt,M=>{c(ve)&&M(Ot)})}var bi=v(Vt,2);{var U=M=>{var O=MQ(),ee=Et(O),ne=v(ee,2),se=v(_(ne),2),re=_(se),Ie=v(_(re)),We=_(Ie),Ce=v(re,2);{var Pe=Z=>{var de=TQ(),Ue=_(de);ws(Ue,()=>c(mt).recursive,Ft=>c(mt).recursive=Ft),D(Z,de)};H(Ce,Z=>{c(mt).hasChildren&&Z(Pe)})}var Me=v(se,2),at=_(Me),Qt=v(at,2);z(()=>W(We,c(mt).topic)),$("click",ee,()=>m(mt,null)),$("click",at,()=>m(mt,null)),$("click",Qt,()=>{const{topic:Z,recursive:de}=c(mt);m(mt,null),Mt(Z,de)}),D(M,O)};H(bi,M=>{c(mt)&&M(U)})}z(()=>{it.disabled=c(Xe)||!c(yt),W(It,` ${c(Ee)??""}`),qo(Be,c(X)?`height: ${c(me)}px;`:""),W(Ge,c(X)?"▾":"▸")}),zt(Vi,()=>c(yt),M=>m(yt,M)),zt(qt,()=>c(be),M=>m(be,M)),ws(ji,()=>c(Nt),M=>m(Nt,M)),Ls(Si,()=>c(si),M=>m(si,M)),$("click",it,Yt),zt(Re,()=>c(C),M=>m(C,M)),$("mousedown",je,le),zt(ri,()=>c(ce),M=>m(ce,M)),$("click",pe,()=>{m(X,!c(X))}),D(o,qi),Us()}Ys(["click","contextmenu","mousedown"]);var OQ=B('<div class="restart-banner restart-banner--restarting svelte-twakcj">Restarting daemon…</div>'),HQ=B('<div class="restart-banner svelte-twakcj">⚠ Package changes require a daemon restart to take effect. <button class="restart-btn svelte-twakcj">Restart now</button></div>'),WQ=B('<div class="err svelte-twakcj"> </div>'),zQ=B('<span class="pane-count pane-count--warn svelte-twakcj"> </span>'),VQ=B('<p class="empty svelte-twakcj">No packages installed.</p>'),jQ=B('<p class="empty svelte-twakcj">No match.</p>'),$Q=B("<span> </span>"),UQ=S6('<svg width="12" height="12" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><circle cx="8" cy="8" r="6" stroke-dasharray="18" stroke-dashoffset="4"></circle></svg>'),qQ=S6('<svg width="12" height="12" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M13 8A5 5 0 1 1 10.5 3.67"></path><polyline points="10.5,1.5 10.5,4 13,4"></polyline></svg>'),GQ=B('<div><div class="dep-info svelte-twakcj"><a class="dep-name svelte-twakcj" target="_blank" rel="noopener noreferrer"> </a> <span class="dep-ver svelte-twakcj"> </span> <!></div> <div class="dep-btns svelte-twakcj"><button><svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 4.5l-4 4l-4 1.5l-1.5 1.5l7 7l1.5 -1.5l1.5 -4l4 -4"></path><line x1="9" y1="15" x2="4.5" y2="19.5"></line><line x1="14.5" y1="4" x2="20" y2="9.5"></line></svg></button> <button><!></button> <button class="icon-btn icon-btn--danger svelte-twakcj" title="Uninstall"><svg width="11" height="11" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><line x1="2" y1="2" x2="14" y2="14"></line><line x1="14" y1="2" x2="2" y2="14"></line></svg></button></div></div>'),KQ=B('<span class="result-author svelte-twakcj"> </span>'),ZQ=B('<span class="result-date svelte-twakcj"> </span>'),XQ=B('<span class="result-desc svelte-twakcj"> </span>'),YQ=B('<div class="result-row svelte-twakcj"><div class="result-info svelte-twakcj"><a class="result-name svelte-twakcj" target="_blank" rel="noopener noreferrer"> </a> <span class="result-ver svelte-twakcj"> </span> <!> <!> <!></div> <button class="install-btn svelte-twakcj"> </button></div>'),QQ=B('<div class="results-list svelte-twakcj"></div>'),JQ=B('<pre class="npm-output svelte-twakcj"> </pre>'),eJ=B(`<p class="hint svelte-twakcj">Install npm packages into <code class="svelte-twakcj">~/.she/</code>. Scripts can then <code class="svelte-twakcj">require('package-name')</code> directly.</p>`),tJ=B('<!> <div class="pkg-shell svelte-twakcj"><!> <!> <div class="pkg-body svelte-twakcj"><div class="pkg-left svelte-twakcj"><div class="pane-hdr svelte-twakcj"><span class="pane-title svelte-twakcj">Installed</span> <span class="pane-count svelte-twakcj"> </span> <!> <button class="icon-btn check-outdated-btn svelte-twakcj" title="Check for package updates"><svg width="12" height="12" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M13 8A5 5 0 1 1 10.5 3.67"></path><polyline points="10.5,1.5 10.5,4 13,4"></polyline></svg></button></div> <div class="filter-row svelte-twakcj"><input class="filter-in svelte-twakcj" type="search" placeholder="Filter…"/></div> <div class="installed-list svelte-twakcj"><!></div></div> <div class="pkg-right svelte-twakcj"><div class="pane-hdr svelte-twakcj"><span class="pane-title svelte-twakcj">Search npm</span></div> <div class="search-row svelte-twakcj"><input class="search-in svelte-twakcj" type="text" placeholder="Package name, e.g. axios, lodash…"/> <button class="search-btn svelte-twakcj"> </button></div> <!> <!> <!></div></div></div>',1);function iJ(o,e){$s(e,!0);let t=F(Li([])),i=F(""),n=F(Li({})),s=F(Li([])),r=F(!1),a=F(""),d=F(Li([])),u=F(!1),f=F(!1),g=F(!1),p=F(""),C=F(""),b=Li({});const y=Lt(()=>c(i).trim()?c(t).filter(pt=>pt.name.toLowerCase().includes(c(i).toLowerCase())):c(t)),w=Lt(()=>Object.keys(c(n)).filter(pt=>!c(s).includes(pt)).length);Xs(async()=>{await Promise.all([A(),I(),T()])});async function A(){try{m(t,await Q$(),!0),m(p,"")}catch(pt){m(p,pt.message,!0)}}async function I(){try{m(n,await _F(),!0)}catch{}}async function T(){try{const pt=await Pl();m(s,Array.isArray(pt.pinnedPackages)?pt.pinnedPackages:[],!0)}catch{}}async function R(pt){const Ut=c(s).includes(pt)?c(s).filter(Ni=>Ni!==pt):[...c(s),pt];m(s,Ut,!0);try{const Ni=await Pl();await pp({...Ni,pinnedPackages:Ut})}catch{}}async function P(){m(r,!0);try{m(n,await nU(),!0)}catch{}finally{m(r,!1)}}async function V(){const pt=c(a).trim();if(!pt){m(d,[],!0);return}m(g,!0),m(p,"");try{m(d,await J$(pt),!0)}catch(Ut){m(p,Ut.message,!0)}finally{m(g,!1)}}function j(pt){if(!pt)return"";try{return new Date(pt).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}async function J(pt,Ut){b[pt]=!0,m(p,""),m(C,"");try{const Ni=await eU(pt,Ut);m(C,Ni.stdout||Ni.stderr||"Done.",!0),m(u,!0),await A()}catch(Ni){m(p,Ni.message,!0)}finally{b[pt]=!1}}async function ae(pt){b[pt]=!0,m(p,""),m(C,"");try{const Ut=await tU(pt);m(C,Ut.stdout||Ut.stderr||"Done.",!0),m(u,!0);const Ni={...c(n)};delete Ni[pt],m(n,Ni,!0),await A()}catch(Ut){m(p,Ut.message,!0)}finally{b[pt]=!1}}async function fe(pt){b[pt]=!0,m(p,""),m(C,"");try{const Ut=await iU(pt);m(C,Ut.stdout||Ut.stderr||"Done.",!0),m(u,!0);const Ni={...c(n)};delete Ni[pt],m(n,Ni,!0),await A()}catch(Ut){m(p,Ut.message,!0)}finally{b[pt]=!1}}let X;async function ce(){if(await X.show("Restart the she daemon? The page will reload after a moment.",{confirm:"Restart"})){m(f,!0);try{await xF()}catch{}setTimeout(()=>{window.location.reload()},3e3)}}var me=tJ(),oe=Et(me);gs(Yc(oe,{}),pt=>X=pt,()=>X);var le=v(oe,2),Ae=_(le);{var Te=pt=>{var Ut=OQ();D(pt,Ut)},xe=pt=>{var Ut=HQ(),Ni=v(_(Ut));$("click",Ni,ce),D(pt,Ut)};H(Ae,pt=>{c(f)?pt(Te):c(u)&&pt(xe,1)})}var Ne=v(Ae,2);{var Ve=pt=>{var Ut=WQ(),Ni=_(Ut);z(()=>W(Ni,c(p))),D(pt,Ut)};H(Ne,pt=>{c(p)&&pt(Ve)})}var ve=v(Ne,2),mt=_(ve),Mt=_(mt),ot=v(_(Mt),2),yt=_(ot),be=v(ot,2);{var Nt=pt=>{var Ut=zQ(),Ni=_(Ut);z(()=>W(Ni,`${c(w)??""} outdated`)),D(pt,Ut)};H(be,pt=>{c(w)>0&&pt(Nt)})}var si=v(be,2),Xe=_(si);let tt;var wt=v(Mt,2),Yt=_(wt),fi=v(wt,2),oi=_(fi);{var ki=pt=>{var Ut=VQ();D(pt,Ut)},_i=pt=>{var Ut=jQ();D(pt,Ut)},Ze=pt=>{var Ut=Ss(),Ni=Et(Ut);ti(Ni,17,()=>c(y),qi=>qi.name,(qi,gi)=>{var Wi=GQ();let Ui;var tn=_(Wi),yi=_(tn),Vi=_(yi),ze=v(yi,2),qt=_(ze),wi=v(ze,2);{var ji=Y=>{var Re=$Q();let dt;var ye=_(Re);z(ci=>{dt=At(Re,1,"dep-latest svelte-twakcj",null,dt,ci),W(ye,`→ v${c(n)[c(gi).name].latest??""}`)},[()=>({"dep-latest--pinned":c(s).includes(c(gi).name)})]),D(Y,Re)};H(wi,Y=>{c(n)[c(gi).name]&&Y(ji)})}var Si=v(tn,2),K=_(Si);let De;var Qe=v(K,2);let it;var Gt=_(Qe);{var li=Y=>{var Re=UQ();D(Y,Re)},vt=Y=>{var Re=qQ();D(Y,Re)};H(Gt,Y=>{b[c(gi).name]?Y(li):Y(vt,-1)})}var ft=v(Qe,2);z((Y,Re,dt)=>{Ui=At(Wi,1,"dep-row svelte-twakcj",null,Ui,{"dep-busy":!!b[c(gi).name]}),ln(yi,"href",c(gi).url??`https://www.npmjs.com/package/${c(gi).name}`),W(Vi,c(gi).name),W(qt,c(gi).installedVersion??c(gi).version),De=At(K,1,"icon-btn svelte-twakcj",null,De,Y),ln(K,"title",Re),it=At(Qe,1,"icon-btn svelte-twakcj",null,it,dt),Qe.disabled=!!b[c(gi).name],ln(Qe,"title",c(n)[c(gi).name]?`Update to v${c(n)[c(gi).name].latest}`:"Update to latest"),ft.disabled=!!b[c(gi).name]},[()=>({"icon-btn--pinned":c(s).includes(c(gi).name)}),()=>c(s).includes(c(gi).name)?"Unpin package":"Pin package (suppress update dot)",()=>({"icon-btn--update":!!c(n)[c(gi).name]&&!c(s).includes(c(gi).name)})]),$("click",K,()=>R(c(gi).name)),$("click",Qe,()=>fe(c(gi).name)),$("click",ft,()=>ae(c(gi).name)),D(qi,Wi)}),D(pt,Ut)};H(oi,pt=>{c(t).length===0?pt(ki):c(y).length===0?pt(_i,1):pt(Ze,-1)})}var Ee=v(mt,2),ii=v(_(Ee),2),Ci=_(ii),Jt=v(Ci,2),zi=_(Jt),Ji=v(ii,2);{var Ii=pt=>{var Ut=QQ();ti(Ut,21,()=>c(d),Ni=>Ni.name,(Ni,qi)=>{var gi=YQ(),Wi=_(gi),Ui=_(Wi),tn=_(Ui),yi=v(Ui,2),Vi=_(yi),ze=v(yi,2);{var qt=it=>{var Gt=KQ(),li=_(Gt);z(()=>W(li,c(qi).author)),D(it,Gt)};H(ze,it=>{c(qi).author&&it(qt)})}var wi=v(ze,2);{var ji=it=>{var Gt=ZQ(),li=_(Gt);z(vt=>{ln(Gt,"title",c(qi).date),W(li,vt)},[()=>j(c(qi).date)]),D(it,Gt)};H(wi,it=>{c(qi).date&&it(ji)})}var Si=v(wi,2);{var K=it=>{var Gt=XQ(),li=_(Gt);z(()=>W(li,c(qi).description)),D(it,Gt)};H(Si,it=>{c(qi).description&&it(K)})}var De=v(Wi,2),Qe=_(De);z(()=>{ln(Ui,"href",c(qi).url??`https://www.npmjs.com/package/${c(qi).name}`),W(tn,c(qi).name),W(Vi,c(qi).version),De.disabled=!!b[c(qi).name],W(Qe,b[c(qi).name]?"Installing…":"Install")}),$("click",De,()=>J(c(qi).name)),D(Ni,gi)}),D(pt,Ut)};H(Ji,pt=>{c(d).length>0&&pt(Ii)})}var wn=v(Ji,2);{var cn=pt=>{var Ut=JQ(),Ni=_(Ut);z(()=>W(Ni,c(C))),D(pt,Ut)};H(wn,pt=>{c(C)&&pt(cn)})}var pn=v(wn,2);{var fn=pt=>{var Ut=eJ();D(pt,Ut)};H(pn,pt=>{!c(d).length&&!c(C)&&pt(fn)})}z(()=>{W(yt,c(t).length),si.disabled=c(r),tt=At(Xe,0,"svelte-twakcj",null,tt,{spinning:c(r)}),Jt.disabled=c(g),W(zi,c(g)?"Searching…":"Search")}),$("click",si,P),zt(Yt,()=>c(i),pt=>m(i,pt)),$("keydown",Ci,pt=>pt.key==="Enter"&&V()),zt(Ci,()=>c(a),pt=>m(a,pt)),$("click",Jt,V),D(o,me),Us()}Ys(["click","keydown"]);var nJ=B('<div class="plugin-warning svelte-3itf14">⚠ The dynamic-security plugin is not responding. Add <code class="svelte-3itf14">plugin …/mosquitto_dynamic_security.so</code> and <code class="svelte-3itf14">plugin_opt_config_file …/dynamic-security.json</code> to your mosquitto.conf and restart mosquitto. Operations below will time out until the plugin is active.</div>'),Ca=B('<div class="err svelte-3itf14"> </div>'),sJ=B('<div class="empty svelte-3itf14">No users found.</div>'),oJ=B('<span class="tag svelte-3itf14"> <button class="tag-x svelte-3itf14" title="Remove role">×</button></span>'),Th=B("<option> </option>"),qx=B('<div class="inline-err svelte-3itf14"> </div>'),Z2=B('<div class="inline-add svelte-3itf14"><select class="svelte-3itf14"><option>— role —</option><!></select> <button class="inline-confirm svelte-3itf14">Add</button> <button class="inline-cancel svelte-3itf14">×</button></div> <!>',1),rJ=B('<span class="tag tag--group svelte-3itf14"> <button class="tag-x svelte-3itf14" title="Remove from group">×</button></span>'),aJ=B('<div class="inline-add svelte-3itf14"><select class="svelte-3itf14"><option>— group —</option><!></select> <button class="inline-confirm svelte-3itf14">Add</button> <button class="inline-cancel svelte-3itf14">×</button></div> <!>',1),lJ=B('<tr class="svelte-3itf14"><td class="mono svelte-3itf14"> </td><td class="svelte-3itf14"><div class="tags-cell svelte-3itf14"><div class="tags svelte-3itf14"><!> <button class="tag-plus svelte-3itf14" title="Add role">+</button></div> <!></div></td><td class="svelte-3itf14"><div class="tags-cell svelte-3itf14"><div class="tags svelte-3itf14"><!> <button class="tag-plus tag-plus--group svelte-3itf14" title="Add to group">+</button></div> <!></div></td><td class="cell-actions svelte-3itf14"><div class="actions svelte-3itf14"><button title="Set password" class="svelte-3itf14">🔑</button> <button class="danger svelte-3itf14" title="Delete">✕</button></div></td></tr>'),cJ=B('<table class="svelte-3itf14"><thead><tr><th class="svelte-3itf14">Username</th><th class="svelte-3itf14">Roles</th><th class="svelte-3itf14">Groups</th><th class="svelte-3itf14"></th></tr></thead><tbody></tbody></table>'),dJ=B('<div class="panel svelte-3itf14"><div class="panel-header svelte-3itf14"><h3 class="svelte-3itf14">Users</h3> <button class="btn-add svelte-3itf14">+ Add user</button></div> <!> <!></div>'),uJ=B('<div class="empty svelte-3itf14">No roles found.</div>'),hJ=B('<tr class="svelte-3itf14"><td class="mono svelte-3itf14"> </td><td class="svelte-3itf14"> </td><td class="cell-actions svelte-3itf14"><div class="actions svelte-3itf14"><button title="Edit ACLs" class="svelte-3itf14">Edit ACLs</button> <button class="danger svelte-3itf14" title="Delete">✕</button></div></td></tr>'),fJ=B('<table class="svelte-3itf14"><thead><tr><th class="svelte-3itf14">Role</th><th class="svelte-3itf14">ACLs</th><th class="svelte-3itf14"></th></tr></thead><tbody></tbody></table>'),gJ=B('<div class="panel svelte-3itf14"><div class="panel-header svelte-3itf14"><h3 class="svelte-3itf14">Roles</h3> <button class="btn-add svelte-3itf14">+ Add role</button></div> <!> <!></div>'),pJ=B('<div class="empty svelte-3itf14">No groups found.</div>'),xJ=B('<span class="tag svelte-3itf14"> <button class="tag-x svelte-3itf14" title="Remove member">×</button></span>'),mJ=B('<div class="inline-add svelte-3itf14"><select class="svelte-3itf14"><option>— user —</option><!></select> <button class="inline-confirm svelte-3itf14">Add</button> <button class="inline-cancel svelte-3itf14">×</button></div> <!>',1),vJ=B('<span class="tag tag--group svelte-3itf14"> <button class="tag-x svelte-3itf14" title="Remove role">×</button></span>'),_J=B('<tr class="svelte-3itf14"><td class="mono svelte-3itf14"> </td><td class="svelte-3itf14"><div class="tags-cell svelte-3itf14"><div class="tags svelte-3itf14"><!> <button class="tag-plus svelte-3itf14" title="Add member">+</button></div> <!></div></td><td class="svelte-3itf14"><div class="tags-cell svelte-3itf14"><div class="tags svelte-3itf14"><!> <button class="tag-plus tag-plus--group svelte-3itf14" title="Add role">+</button></div> <!></div></td><td class="cell-actions svelte-3itf14"><div class="actions svelte-3itf14"><button class="danger svelte-3itf14" title="Delete">✕</button></div></td></tr>'),bJ=B('<table class="svelte-3itf14"><thead><tr><th class="svelte-3itf14">Group</th><th class="svelte-3itf14">Members</th><th class="svelte-3itf14">Roles</th><th class="svelte-3itf14"></th></tr></thead><tbody></tbody></table>'),CJ=B('<div class="panel svelte-3itf14"><div class="panel-header svelte-3itf14"><h3 class="svelte-3itf14">Groups</h3> <button class="btn-add svelte-3itf14">+ Add group</button></div> <!> <!></div>'),X2=B('<div class="empty svelte-3itf14">Loading…</div>'),EJ=B('<tr><td class="mono small svelte-3itf14"> </td><td class="acl-radio svelte-3itf14"><input type="radio" value="allow"/></td><td class="acl-radio svelte-3itf14"><input type="radio" value="deny"/></td></tr>'),yJ=B('<table class="acl-defaults-table svelte-3itf14"><thead><tr><th class="svelte-3itf14">Operation</th><th class="svelte-3itf14">Allow</th><th class="svelte-3itf14">Deny</th></tr></thead><tbody></tbody></table>'),wJ=B('<div class="anon-current svelte-3itf14">Current: <span class="mono svelte-3itf14"> </span></div>'),SJ=B('<div class="anon-current muted svelte-3itf14">No anonymous group configured.</div>'),DJ=B('<div class="anon-row svelte-3itf14"><select class="svelte-3itf14"><option>— none —</option><!></select> <button class="svelte-3itf14"> </button></div> <!>',1),AJ=B('<div class="panel svelte-3itf14"><div class="settings-section svelte-3itf14"><h3 class="settings-heading svelte-3itf14">Default ACL Access</h3> <p class="settings-hint svelte-3itf14">Broker-wide defaults applied when no role ACL matches. Role ACLs always take precedence over these defaults.</p> <!> <!></div> <div class="settings-section svelte-3itf14"><h3 class="settings-heading svelte-3itf14">Anonymous Group</h3> <p class="settings-hint svelte-3itf14">Clients connecting without credentials are treated as members of this group. Requires <code class="svelte-3itf14">allow_anonymous true</code> in mosquitto.conf.</p> <!> <!></div></div>'),kJ=B('<div class="modal-backdrop svelte-3itf14" role="dialog" aria-modal="true"><div class="modal svelte-3itf14"><h3 class="svelte-3itf14">Add user</h3> <label class="svelte-3itf14">Username<input autocomplete="off" class="svelte-3itf14"/></label> <label class="svelte-3itf14">Password <div class="pw-row svelte-3itf14"><input autocomplete="new-password" class="svelte-3itf14"/> <button class="toggle-pw svelte-3itf14"> </button></div></label> <!> <div class="modal-actions svelte-3itf14"><button class="svelte-3itf14">Cancel</button> <button class="btn-primary svelte-3itf14"> </button></div></div></div>'),BJ=B('<div class="modal-backdrop svelte-3itf14" role="dialog" aria-modal="true"><div class="modal svelte-3itf14"><h3 class="svelte-3itf14">Set password for <em class="svelte-3itf14"> </em></h3> <label class="svelte-3itf14">New password <input type="password" autocomplete="new-password" class="svelte-3itf14"/></label> <!> <div class="modal-actions svelte-3itf14"><button class="svelte-3itf14">Cancel</button> <button class="btn-primary svelte-3itf14"> </button></div></div></div>'),FJ=B('<div class="modal-backdrop svelte-3itf14" role="dialog" aria-modal="true"><div class="modal svelte-3itf14"><h3 class="svelte-3itf14">Add role</h3> <label class="svelte-3itf14">Role name<input autocomplete="off" class="svelte-3itf14"/></label> <!> <div class="modal-actions svelte-3itf14"><button class="svelte-3itf14">Cancel</button> <button class="btn-primary svelte-3itf14"> </button></div></div></div>'),LJ=B('<tr class="svelte-3itf14"><td class="mono small svelte-3itf14"> </td><td class="mono svelte-3itf14"> </td><td class="svelte-3itf14"> </td><td class="svelte-3itf14"><button class="danger">✕</button></td></tr>'),IJ=B('<table class="acl-table svelte-3itf14"><thead><tr><th class="svelte-3itf14">Type</th><th class="svelte-3itf14">Topic</th><th class="svelte-3itf14">Allow</th><th class="svelte-3itf14"></th></tr></thead><tbody></tbody></table>'),PJ=B('<div class="empty svelte-3itf14">No ACL rules yet.</div>'),TJ=B('<div class="modal-backdrop svelte-3itf14" role="dialog" aria-modal="true"><div class="modal modal--wide svelte-3itf14"><h3 class="svelte-3itf14">ACLs for role <em class="svelte-3itf14"> </em></h3> <!> <div class="acl-add-row svelte-3itf14"><select class="svelte-3itf14"></select> <input placeholder="topic or pattern" class="svelte-3itf14"/> <label class="allow-toggle svelte-3itf14"><input type="checkbox" class="svelte-3itf14"/> Allow</label> <button class="svelte-3itf14">Add</button></div> <!> <div class="modal-actions svelte-3itf14"><button class="svelte-3itf14">Close</button></div></div></div>'),MJ=B('<div class="modal-backdrop svelte-3itf14" role="dialog" aria-modal="true"><div class="modal svelte-3itf14"><h3 class="svelte-3itf14">Add group</h3> <label class="svelte-3itf14">Group name<input autocomplete="off" class="svelte-3itf14"/></label> <!> <div class="modal-actions svelte-3itf14"><button class="svelte-3itf14">Cancel</button> <button class="btn-primary svelte-3itf14"> </button></div></div></div>'),RJ=B('<div class="users-page svelte-3itf14"><!> <div class="panel-tabs svelte-3itf14"><button>Users</button> <button>Roles</button> <button>Groups</button> <button>Settings</button> <button class="reload-btn svelte-3itf14" title="Refresh">↺</button></div> <!> <!> <!> <!></div> <!> <!> <!> <!> <!> <!>',1);function NJ(o,e){$s(e,!0);let t=Tu(e,"dynsecReady",3,!1),i,n=F(Li([])),s=F(Li([])),r=F(Li([])),a=F(""),d=F(""),u=F(""),f=F("users"),g=F(null),p=F(""),C=F(""),b=F(!1);const y=Lt(()=>c(g)?c(g).kind==="user-roles"?c(s).map(pe=>pe.rolename).filter(pe=>{var Ge,rt;return!((rt=(Ge=c(n).find(lt=>lt.username===c(g).target))==null?void 0:Ge.roles)!=null&&rt.some(lt=>lt.rolename===pe))}):c(g).kind==="user-groups"?c(r).map(pe=>pe.groupname).filter(pe=>{var Ge,rt;return!((rt=(Ge=c(n).find(lt=>lt.username===c(g).target))==null?void 0:Ge.groups)!=null&&rt.some(lt=>lt.groupname===pe))}):c(g).kind==="group-members"?c(n).map(pe=>pe.username).filter(pe=>{var Ge,rt;return!((rt=(Ge=c(r).find(lt=>lt.groupname===c(g).target))==null?void 0:Ge.clients)!=null&&rt.some(lt=>lt.username===pe))}):c(s).map(pe=>pe.rolename).filter(pe=>{var Ge,rt;return!((rt=(Ge=c(r).find(lt=>lt.groupname===c(g).target))==null?void 0:Ge.roles)!=null&&rt.some(lt=>lt.rolename===pe))}):[]);function w(pe,Ge){m(g,{kind:pe,target:Ge},!0),m(p,""),m(C,"")}async function A(){if(!(!c(g)||!c(p))){m(b,!0),m(C,"");try{const{kind:pe,target:Ge}=c(g);pe==="user-roles"?await CU(Ge,c(p)):pe==="user-groups"?await g2(c(p),Ge):pe==="group-members"?await g2(Ge,c(p)):await FU(Ge,c(p)),m(g,null),m(p,""),await Ii()}catch(pe){m(C,pe.message,!0)}finally{m(b,!1)}}}async function I(pe,Ge){try{await EU(pe,Ge),await Ii()}catch(rt){m(a,rt.message,!0)}}async function T(pe,Ge){try{await p2(Ge,pe),await Ii()}catch(rt){m(a,rt.message,!0)}}async function R(pe,Ge){try{await p2(pe,Ge),await Ii()}catch(rt){m(u,rt.message,!0)}}async function P(pe,Ge){try{await LU(pe,Ge),await Ii()}catch(rt){m(u,rt.message,!0)}}let V=F(!1),j=F(""),J=F(""),ae=F(!1),fe=F(""),X=F(!1),ce=F(!1),me=F(""),oe=F(""),le=F(""),Ae=F(!1),Te=F(!1),xe=F(""),Ne=F(""),Ve=F(!1),ve=F(null),mt=F(!1),Mt=F("publishClientSend"),ot=F(""),yt=F(!0),be=F(""),Nt=F(!1),si=F(""),Xe=F(""),tt=F(!1),wt=F(Li([])),Yt=F(""),fi=F(!1),oi=F(null),ki=F(""),_i=F(""),Ze=F(!1),Ee=F(!1);const ii=[{acltype:"publishClientSend",label:"Publish (send)"},{acltype:"publishClientReceive",label:"Publish (receive)"},{acltype:"subscribe",label:"Subscribe"},{acltype:"unsubscribe",label:"Unsubscribe"}];async function Ci(){var pe,Ge;m(Ee,!1),m(Yt,""),m(_i,"");try{const[rt,lt]=await Promise.allSettled([IU(),MU()]);if(rt.status==="fulfilled"){const Vt=Object.fromEntries(rt.value.acls.map(Ot=>[Ot.acltype,Ot.allow]));m(wt,ii.map(({acltype:Ot})=>({acltype:Ot,allow:Vt[Ot]??(Ot==="publishClientReceive"||Ot==="unsubscribe")})),!0)}else m(Yt,((pe=rt.reason)==null?void 0:pe.message)??"Failed to load default ACLs",!0);lt.status==="fulfilled"?(m(oi,lt.value.group,!0),m(ki,lt.value.group??"",!0)):m(_i,((Ge=lt.reason)==null?void 0:Ge.message)??"Failed to load anonymous group",!0)}finally{m(Ee,!0)}}async function Jt(pe,Ge){m(wt,c(wt).map(rt=>rt.acltype===pe?{...rt,allow:Ge}:rt),!0),m(fi,!0),m(Yt,"");try{await PU(c(wt))}catch(rt){m(Yt,rt.message,!0)}finally{m(fi,!1)}}async function zi(){m(Ze,!0),m(_i,"");try{await RU(c(ki)||null),m(oi,c(ki)||null,!0)}catch(pe){m(_i,pe.message,!0)}finally{m(Ze,!1)}}const Ji=["publishClientSend","publishClientReceive","subscribeLiteral","subscribePattern","unsubscribeLiteral","unsubscribePattern"];async function Ii(){var pe,Ge,rt;try{const[lt,Vt,Ot]=await Promise.allSettled([mU(),AF(),AU()]);lt.status==="fulfilled"?(m(n,lt.value.users,!0),m(a,"")):m(a,((pe=lt.reason)==null?void 0:pe.message)??"Failed to load users",!0),Vt.status==="fulfilled"?(m(s,Vt.value.roles,!0),m(d,"")):m(d,((Ge=Vt.reason)==null?void 0:Ge.message)??"Failed to load roles",!0),Ot.status==="fulfilled"?(m(r,Ot.value.groups,!0),m(u,"")):m(u,((rt=Ot.reason)==null?void 0:rt.message)??"Failed to load groups",!0)}catch{}}Xs(()=>{Ii()});async function wn(){m(fe,""),m(X,!0);try{await vU(c(j),c(J)),m(j,""),m(J,""),m(V,!1),await Ii()}catch(pe){m(fe,pe.message??"Failed to create user",!0)}finally{m(X,!1)}}async function cn(pe){if(await i.show(`Delete user “${pe}”?`,{confirm:"Delete",danger:!0}))try{await _U(pe),await Ii()}catch(Ge){m(a,Ge.message,!0)}}async function pn(pe){m(me,pe,!0),m(oe,""),m(le,""),m(ce,!0)}async function fn(){m(le,""),m(Ae,!0);try{await bU(c(me),c(oe)),m(ce,!1)}catch(pe){m(le,pe.message,!0)}finally{m(Ae,!1)}}async function pt(){m(Ne,""),m(Ve,!0);try{await yU(c(xe)),m(xe,""),m(Te,!1),await Ii()}catch(pe){m(Ne,pe.message??"Failed to create role",!0)}finally{m(Ve,!1)}}async function Ut(pe){var Ge;if(await i.show(`Delete role “${pe}”?`,{confirm:"Delete",danger:!0}))try{await wU(pe),((Ge=c(ve))==null?void 0:Ge.rolename)===pe&&(m(ve,null),m(mt,!1)),await Ii()}catch(rt){m(d,rt.message,!0)}}function Ni(pe){m(ve,pe,!0),m(mt,!0),m(Mt,"publishClientSend"),m(ot,""),m(yt,!0),m(be,"")}async function qi(){if(c(ve)){m(be,"");try{await SU(c(ve).rolename,{acltype:c(Mt),topic:c(ot),allow:c(yt)}),m(ot,""),await Ii(),m(ve,c(s).find(pe=>pe.rolename===c(ve).rolename)??c(ve),!0)}catch(pe){m(be,pe.message,!0)}}}async function gi(pe,Ge,rt){try{await DU(pe,Ge,rt),await Ii(),m(ve,c(s).find(lt=>lt.rolename===pe)??c(ve),!0)}catch(lt){m(be,lt.message,!0)}}async function Wi(){m(Xe,""),m(tt,!0);try{await kU(c(si)),m(si,""),m(Nt,!1),await Ii()}catch(pe){m(Xe,pe.message??"Failed to create group",!0)}finally{m(tt,!1)}}async function Ui(pe){if(await i.show(`Delete group “${pe}”?`,{confirm:"Delete",danger:!0}))try{await BU(pe),await Ii()}catch(Ge){m(u,Ge.message,!0)}}var tn=RJ(),yi=Et(tn),Vi=_(yi);{var ze=pe=>{var Ge=nJ();D(pe,Ge)};H(Vi,pe=>{t()||pe(ze)})}var qt=v(Vi,2),wi=_(qt);let ji;var Si=v(wi,2);let K;var De=v(Si,2);let Qe;var it=v(De,2);let Gt;var li=v(it,2),vt=v(qt,2);{var ft=pe=>{var Ge=dJ(),rt=_(Ge),lt=v(_(rt),2),Vt=v(rt,2);{var Ot=O=>{var ee=Ca(),ne=_(ee);z(()=>W(ne,c(a))),D(O,ee)};H(Vt,O=>{c(a)&&O(Ot)})}var bi=v(Vt,2);{var U=O=>{var ee=sJ();D(O,ee)},M=O=>{var ee=cJ(),ne=v(_(ee));ti(ne,21,()=>c(n),Hi,(se,re)=>{var Ie=lJ(),We=_(Ie),Ce=_(We),Pe=v(We),Me=_(Pe),at=_(Me),Qt=_(at);ti(Qt,17,()=>c(re).roles??[],Hi,(Ke,et)=>{var ge=oJ(),$e=_(ge),_t=v($e);z(()=>W($e,c(et).rolename)),$("click",_t,()=>I(c(re).username,c(et).rolename)),D(Ke,ge)});var Z=v(Qt,2),de=v(at,2);{var Ue=Ke=>{var et=Z2(),ge=Et(et),$e=_(ge),_t=_($e);_t.value=_t.__value="";var Wt=v(_t);ti(Wt,17,()=>c(y),Hi,(Mi,ai)=>{var Ht=Th(),Dt=_(Ht),jt={};z(()=>{W(Dt,c(ai)),jt!==(jt=c(ai))&&(Ht.value=(Ht.__value=c(ai))??"")}),D(Mi,Ht)});var bt=v($e,2),pi=v(bt,2),Di=v(ge,2);{var Xi=Mi=>{var ai=qx(),Ht=_(ai);z(()=>W(Ht,c(C))),D(Mi,ai)};H(Di,Mi=>{c(C)&&Mi(Xi)})}z(()=>bt.disabled=!c(p)||c(b)),Ls($e,()=>c(p),Mi=>m(p,Mi)),$("click",bt,A),$("click",pi,()=>m(g,null)),D(Ke,et)};H(de,Ke=>{var et;((et=c(g))==null?void 0:et.kind)==="user-roles"&&c(g).target===c(re).username&&Ke(Ue)})}var Ft=v(Pe),we=_(Ft),Oe=_(we),St=_(Oe);ti(St,17,()=>c(re).groups??[],Hi,(Ke,et)=>{var ge=rJ(),$e=_(ge),_t=v($e);z(()=>W($e,c(et).groupname)),$("click",_t,()=>T(c(re).username,c(et).groupname)),D(Ke,ge)});var ut=v(St,2),nt=v(Oe,2);{var ue=Ke=>{var et=aJ(),ge=Et(et),$e=_(ge),_t=_($e);_t.value=_t.__value="";var Wt=v(_t);ti(Wt,17,()=>c(y),Hi,(Mi,ai)=>{var Ht=Th(),Dt=_(Ht),jt={};z(()=>{W(Dt,c(ai)),jt!==(jt=c(ai))&&(Ht.value=(Ht.__value=c(ai))??"")}),D(Mi,Ht)});var bt=v($e,2),pi=v(bt,2),Di=v(ge,2);{var Xi=Mi=>{var ai=qx(),Ht=_(ai);z(()=>W(Ht,c(C))),D(Mi,ai)};H(Di,Mi=>{c(C)&&Mi(Xi)})}z(()=>bt.disabled=!c(p)||c(b)),Ls($e,()=>c(p),Mi=>m(p,Mi)),$("click",bt,A),$("click",pi,()=>m(g,null)),D(Ke,et)};H(nt,Ke=>{var et;((et=c(g))==null?void 0:et.kind)==="user-groups"&&c(g).target===c(re).username&&Ke(ue)})}var He=v(Ft),Fe=_(He),Je=_(Fe),ht=v(Je,2);z(()=>W(Ce,c(re).username)),$("click",Z,()=>w("user-roles",c(re).username)),$("click",ut,()=>w("user-groups",c(re).username)),$("click",Je,()=>pn(c(re).username)),$("click",ht,()=>cn(c(re).username)),D(se,Ie)}),D(O,ee)};H(bi,O=>{c(n).length===0?O(U):O(M,-1)})}$("click",lt,()=>{m(V,!0),m(fe,"")}),D(pe,Ge)};H(vt,pe=>{c(f)==="users"&&pe(ft)})}var Y=v(vt,2);{var Re=pe=>{var Ge=gJ(),rt=_(Ge),lt=v(_(rt),2),Vt=v(rt,2);{var Ot=O=>{var ee=Ca(),ne=_(ee);z(()=>W(ne,c(d))),D(O,ee)};H(Vt,O=>{c(d)&&O(Ot)})}var bi=v(Vt,2);{var U=O=>{var ee=uJ();D(O,ee)},M=O=>{var ee=fJ(),ne=v(_(ee));ti(ne,21,()=>c(s),Hi,(se,re)=>{var Ie=hJ(),We=_(Ie),Ce=_(We),Pe=v(We),Me=_(Pe),at=v(Pe),Qt=_(at),Z=_(Qt),de=v(Z,2);z(()=>{var Ue;W(Ce,c(re).rolename),W(Me,((Ue=c(re).acls)==null?void 0:Ue.length)??0)}),$("click",Z,()=>Ni(c(re))),$("click",de,()=>Ut(c(re).rolename)),D(se,Ie)}),D(O,ee)};H(bi,O=>{c(s).length===0?O(U):O(M,-1)})}$("click",lt,()=>{m(Te,!0),m(Ne,""),m(xe,"")}),D(pe,Ge)};H(Y,pe=>{c(f)==="roles"&&pe(Re)})}var dt=v(Y,2);{var ye=pe=>{var Ge=CJ(),rt=_(Ge),lt=v(_(rt),2),Vt=v(rt,2);{var Ot=O=>{var ee=Ca(),ne=_(ee);z(()=>W(ne,c(u))),D(O,ee)};H(Vt,O=>{c(u)&&O(Ot)})}var bi=v(Vt,2);{var U=O=>{var ee=pJ();D(O,ee)},M=O=>{var ee=bJ(),ne=v(_(ee));ti(ne,21,()=>c(r),Hi,(se,re)=>{var Ie=_J(),We=_(Ie),Ce=_(We),Pe=v(We),Me=_(Pe),at=_(Me),Qt=_(at);ti(Qt,17,()=>c(re).clients??[],Hi,(ht,Ke)=>{var et=xJ(),ge=_(et),$e=v(ge);z(()=>W(ge,c(Ke).username)),$("click",$e,()=>R(c(re).groupname,c(Ke).username)),D(ht,et)});var Z=v(Qt,2),de=v(at,2);{var Ue=ht=>{var Ke=mJ(),et=Et(Ke),ge=_(et),$e=_(ge);$e.value=$e.__value="";var _t=v($e);ti(_t,17,()=>c(y),Hi,(Xi,Mi)=>{var ai=Th(),Ht=_(ai),Dt={};z(()=>{W(Ht,c(Mi)),Dt!==(Dt=c(Mi))&&(ai.value=(ai.__value=c(Mi))??"")}),D(Xi,ai)});var Wt=v(ge,2),bt=v(Wt,2),pi=v(et,2);{var Di=Xi=>{var Mi=qx(),ai=_(Mi);z(()=>W(ai,c(C))),D(Xi,Mi)};H(pi,Xi=>{c(C)&&Xi(Di)})}z(()=>Wt.disabled=!c(p)||c(b)),Ls(ge,()=>c(p),Xi=>m(p,Xi)),$("click",Wt,A),$("click",bt,()=>m(g,null)),D(ht,Ke)};H(de,ht=>{var Ke;((Ke=c(g))==null?void 0:Ke.kind)==="group-members"&&c(g).target===c(re).groupname&&ht(Ue)})}var Ft=v(Pe),we=_(Ft),Oe=_(we),St=_(Oe);ti(St,17,()=>c(re).roles??[],Hi,(ht,Ke)=>{var et=vJ(),ge=_(et),$e=v(ge);z(()=>W(ge,c(Ke).rolename)),$("click",$e,()=>P(c(re).groupname,c(Ke).rolename)),D(ht,et)});var ut=v(St,2),nt=v(Oe,2);{var ue=ht=>{var Ke=Z2(),et=Et(Ke),ge=_(et),$e=_(ge);$e.value=$e.__value="";var _t=v($e);ti(_t,17,()=>c(y),Hi,(Xi,Mi)=>{var ai=Th(),Ht=_(ai),Dt={};z(()=>{W(Ht,c(Mi)),Dt!==(Dt=c(Mi))&&(ai.value=(ai.__value=c(Mi))??"")}),D(Xi,ai)});var Wt=v(ge,2),bt=v(Wt,2),pi=v(et,2);{var Di=Xi=>{var Mi=qx(),ai=_(Mi);z(()=>W(ai,c(C))),D(Xi,Mi)};H(pi,Xi=>{c(C)&&Xi(Di)})}z(()=>Wt.disabled=!c(p)||c(b)),Ls(ge,()=>c(p),Xi=>m(p,Xi)),$("click",Wt,A),$("click",bt,()=>m(g,null)),D(ht,Ke)};H(nt,ht=>{var Ke;((Ke=c(g))==null?void 0:Ke.kind)==="group-roles"&&c(g).target===c(re).groupname&&ht(ue)})}var He=v(Ft),Fe=_(He),Je=_(Fe);z(()=>W(Ce,c(re).groupname)),$("click",Z,()=>w("group-members",c(re).groupname)),$("click",ut,()=>w("group-roles",c(re).groupname)),$("click",Je,()=>Ui(c(re).groupname)),D(se,Ie)}),D(O,ee)};H(bi,O=>{c(r).length===0?O(U):O(M,-1)})}$("click",lt,()=>{m(Nt,!0),m(Xe,""),m(si,"")}),D(pe,Ge)};H(dt,pe=>{c(f)==="groups"&&pe(ye)})}var ci=v(dt,2);{var It=pe=>{var Ge=AJ(),rt=_(Ge),lt=v(_(rt),4);{var Vt=Ie=>{var We=Ca(),Ce=_(We);z(()=>W(Ce,c(Yt))),D(Ie,We)};H(lt,Ie=>{c(Yt)&&Ie(Vt)})}var Ot=v(lt,2);{var bi=Ie=>{var We=X2();D(Ie,We)},U=Ie=>{var We=yJ(),Ce=v(_(We));ti(Ce,21,()=>ii,Hi,(Pe,Me)=>{let at=()=>c(Me).acltype,Qt=()=>c(Me).label;const Z=Lt(()=>c(wt).find(ue=>ue.acltype===at()));var de=EJ();let Ue;var Ft=_(de),we=_(Ft),Oe=v(Ft),St=_(Oe),ut=v(Oe),nt=_(ut);z(()=>{var ue,He;Ue=At(de,1,"svelte-3itf14",null,Ue,{saving:c(fi)}),W(we,Qt()),ln(St,"name",at()),Zo(St,((ue=c(Z))==null?void 0:ue.allow)===!0),ln(nt,"name",at()),Zo(nt,((He=c(Z))==null?void 0:He.allow)===!1)}),$("change",St,()=>Jt(at(),!0)),$("change",nt,()=>Jt(at(),!1)),D(Pe,de)}),D(Ie,We)};H(Ot,Ie=>{c(Ee)?Ie(U,-1):Ie(bi)})}var M=v(rt,2),O=v(_(M),4);{var ee=Ie=>{var We=Ca(),Ce=_(We);z(()=>W(Ce,c(_i))),D(Ie,We)};H(O,Ie=>{c(_i)&&Ie(ee)})}var ne=v(O,2);{var se=Ie=>{var We=X2();D(Ie,We)},re=Ie=>{var We=DJ(),Ce=Et(We),Pe=_(Ce),Me=_(Pe);Me.value=Me.__value="";var at=v(Me);ti(at,17,()=>c(r),Hi,(we,Oe)=>{var St=Th(),ut=_(St),nt={};z(()=>{W(ut,c(Oe).groupname),nt!==(nt=c(Oe).groupname)&&(St.value=(St.__value=c(Oe).groupname)??"")}),D(we,St)});var Qt=v(Pe,2),Z=_(Qt),de=v(Ce,2);{var Ue=we=>{var Oe=wJ(),St=v(_(Oe)),ut=_(St);z(()=>W(ut,c(oi))),D(we,Oe)},Ft=we=>{var Oe=SJ();D(we,Oe)};H(de,we=>{c(oi)?we(Ue):we(Ft,-1)})}z(()=>{Qt.disabled=c(Ze)||c(ki)===(c(oi)??""),W(Z,c(Ze)?"Saving…":"Save")}),Ls(Pe,()=>c(ki),we=>m(ki,we)),$("click",Qt,zi),D(Ie,We)};H(ne,Ie=>{c(Ee)?Ie(re,-1):Ie(se)})}D(pe,Ge)};H(ci,pe=>{c(f)==="settings"&&pe(It)})}var ie=v(yi,2);{var Ye=pe=>{var Ge=kJ(),rt=_(Ge),lt=v(_(rt),2),Vt=v(_(lt)),Ot=v(lt,2),bi=v(_(Ot)),U=_(bi),M=v(U,2),O=_(M),ee=v(Ot,2);{var ne=Ce=>{var Pe=Ca(),Me=_(Pe);z(()=>W(Me,c(fe))),D(Ce,Pe)};H(ee,Ce=>{c(fe)&&Ce(ne)})}var se=v(ee,2),re=_(se),Ie=v(re,2),We=_(Ie);z(()=>{ln(U,"type",c(ae)?"text":"password"),W(O,c(ae)?"Hide":"Show"),Ie.disabled=c(X)||!c(j)||!c(J),W(We,c(X)?"Creating…":"Create")}),zt(Vt,()=>c(j),Ce=>m(j,Ce)),zt(U,()=>c(J),Ce=>m(J,Ce)),$("click",M,()=>m(ae,!c(ae))),$("click",re,()=>m(V,!1)),$("click",Ie,wn),D(pe,Ge)};H(ie,pe=>{c(V)&&pe(Ye)})}var kt=v(ie,2);{var Pt=pe=>{var Ge=BJ(),rt=_(Ge),lt=_(rt),Vt=v(_(lt)),Ot=_(Vt),bi=v(lt,2),U=v(_(bi)),M=v(bi,2);{var O=Ie=>{var We=Ca(),Ce=_(We);z(()=>W(Ce,c(le))),D(Ie,We)};H(M,Ie=>{c(le)&&Ie(O)})}var ee=v(M,2),ne=_(ee),se=v(ne,2),re=_(se);z(()=>{W(Ot,c(me)),se.disabled=c(Ae)||!c(oe),W(re,c(Ae)?"Saving…":"Set password")}),zt(U,()=>c(oe),Ie=>m(oe,Ie)),$("click",ne,()=>m(ce,!1)),$("click",se,fn),D(pe,Ge)};H(kt,pe=>{c(ce)&&pe(Pt)})}var Bt=v(kt,2);{var Be=pe=>{var Ge=FJ(),rt=_(Ge),lt=v(_(rt),2),Vt=v(_(lt)),Ot=v(lt,2);{var bi=ne=>{var se=Ca(),re=_(se);z(()=>W(re,c(Ne))),D(ne,se)};H(Ot,ne=>{c(Ne)&&ne(bi)})}var U=v(Ot,2),M=_(U),O=v(M,2),ee=_(O);z(()=>{O.disabled=c(Ve)||!c(xe),W(ee,c(Ve)?"Creating…":"Create")}),zt(Vt,()=>c(xe),ne=>m(xe,ne)),$("click",M,()=>m(Te,!1)),$("click",O,pt),D(pe,Ge)};H(Bt,pe=>{c(Te)&&pe(Be)})}var je=v(Bt,2);{var Kt=pe=>{var Ge=TJ(),rt=_(Ge),lt=_(rt),Vt=v(_(lt)),Ot=_(Vt),bi=v(lt,2);{var U=at=>{var Qt=IJ(),Z=v(_(Qt));ti(Z,21,()=>c(ve).acls??[],Hi,(de,Ue)=>{var Ft=LJ(),we=_(Ft),Oe=_(we),St=v(we),ut=_(St),nt=v(St),ue=_(nt),He=v(nt),Fe=_(He);z(()=>{W(Oe,c(Ue).acltype),W(ut,c(Ue).topic),W(ue,c(Ue).allow?"✓":"✗")}),$("click",Fe,()=>gi(c(ve).rolename,c(Ue).acltype,c(Ue).topic)),D(de,Ft)}),D(at,Qt)},M=at=>{var Qt=PJ();D(at,Qt)};H(bi,at=>{var Qt;(((Qt=c(ve).acls)==null?void 0:Qt.length)??0)>0?at(U):at(M,-1)})}var O=v(bi,2),ee=_(O);ti(ee,21,()=>Ji,Hi,(at,Qt)=>{var Z=Th(),de=_(Z),Ue={};z(()=>{W(de,c(Qt)),Ue!==(Ue=c(Qt))&&(Z.value=(Z.__value=c(Qt))??"")}),D(at,Z)});var ne=v(ee,2),se=v(ne,2),re=_(se),Ie=v(se,2),We=v(O,2);{var Ce=at=>{var Qt=Ca(),Z=_(Qt);z(()=>W(Z,c(be))),D(at,Qt)};H(We,at=>{c(be)&&at(Ce)})}var Pe=v(We,2),Me=_(Pe);z(()=>{W(Ot,c(ve).rolename),Ie.disabled=!c(ot)}),Ls(ee,()=>c(Mt),at=>m(Mt,at)),zt(ne,()=>c(ot),at=>m(ot,at)),ws(re,()=>c(yt),at=>m(yt,at)),$("click",Ie,qi),$("click",Me,()=>m(mt,!1)),D(pe,Ge)};H(je,pe=>{c(mt)&&c(ve)&&pe(Kt)})}var ri=v(je,2);{var ui=pe=>{var Ge=MJ(),rt=_(Ge),lt=v(_(rt),2),Vt=v(_(lt)),Ot=v(lt,2);{var bi=ne=>{var se=Ca(),re=_(se);z(()=>W(re,c(Xe))),D(ne,se)};H(Ot,ne=>{c(Xe)&&ne(bi)})}var U=v(Ot,2),M=_(U),O=v(M,2),ee=_(O);z(()=>{O.disabled=c(tt)||!c(si),W(ee,c(tt)?"Creating…":"Create")}),zt(Vt,()=>c(si),ne=>m(si,ne)),$("click",M,()=>m(Nt,!1)),$("click",O,Wi),D(pe,Ge)};H(ri,pe=>{c(Nt)&&pe(ui)})}var Xt=v(ri,2);gs(Yc(Xt,{}),pe=>i=pe,()=>i),z(()=>{ji=At(wi,1,"svelte-3itf14",null,ji,{active:c(f)==="users"}),K=At(Si,1,"svelte-3itf14",null,K,{active:c(f)==="roles"}),Qe=At(De,1,"svelte-3itf14",null,Qe,{active:c(f)==="groups"}),Gt=At(it,1,"svelte-3itf14",null,Gt,{active:c(f)==="settings"})}),$("click",wi,()=>m(f,"users")),$("click",Si,()=>m(f,"roles")),$("click",De,()=>m(f,"groups")),$("click",it,()=>{m(f,"settings"),c(Ee)||Ci()}),$("click",li,Ii),D(o,tn),Us()}Ys(["click","change"]);var Y2=B('<div class="err svelte-9i68x"> </div>'),OJ=B('<div class="ok svelte-9i68x">Saved.</div>'),HJ=B('<div class="reload-msg svelte-9i68x"> </div>'),WJ=B('<div class="loading svelte-9i68x">Loading…</div>'),zJ=B('<div class="anon-row svelte-9i68x"><span class="field-label svelte-9i68x"><code class="svelte-9i68x">allow_anonymous</code></span> <select class="svelte-9i68x"><option>auto (broker default)</option><option>true — allow unauthenticated clients</option><option>false — require authentication</option></select></div>'),VJ=B("<option></option>"),jJ=B('<div class="tls-section svelte-9i68x"><div class="field-row svelte-9i68x"><label class="svelte-9i68x">Certificate file (certfile) <input placeholder="/etc/mosquitto/certs/server.crt" class="svelte-9i68x"/></label> <label class="svelte-9i68x">Key file (keyfile) <input placeholder="/etc/mosquitto/certs/server.key" class="svelte-9i68x"/></label></div> <div class="field-row svelte-9i68x"><label class="svelte-9i68x">CA file (cafile) — single CA cert <input placeholder="/etc/mosquitto/ca.crt" class="svelte-9i68x"/></label> <label class="svelte-9i68x">CA path (capath) — CA cert directory <input placeholder="/etc/mosquitto/ca-certs/" class="svelte-9i68x"/></label></div> <div class="field-row svelte-9i68x"><label class="svelte-9i68x">CRL file (crlfile) <input placeholder="/etc/mosquitto/crl.pem" class="svelte-9i68x"/></label> <label class="svelte-9i68x">TLS version <select class="svelte-9i68x"><option>Default</option><option>tlsv1.3</option><option>tlsv1.2</option></select></label></div> <div class="field-row svelte-9i68x"><label class="toggle-label svelte-9i68x"><input type="checkbox" class="svelte-9i68x"/> <span class="checkmark svelte-9i68x"></span> Require client certificate (require_certificate)</label> <label class="toggle-label svelte-9i68x"><input type="checkbox" class="svelte-9i68x"/> <span class="checkmark svelte-9i68x"></span> Use cert CN as username (use_identity_as_username)</label></div></div>'),$J=B('<div class="field-row svelte-9i68x"><label class="toggle-label svelte-9i68x"><input type="checkbox" class="svelte-9i68x"/> <span class="checkmark svelte-9i68x"></span> Use cert Subject as username (use_subject_as_username)</label></div>'),UJ=B('<div class="advanced-section svelte-9i68x"><div class="field-row svelte-9i68x"><label class="svelte-9i68x">Mount point <input placeholder="(none)" class="svelte-9i68x"/></label> <label class="svelte-9i68x">Max connections <input type="number" min="-1" placeholder="-1 (unlimited)" class="svelte-9i68x"/></label> <label class="svelte-9i68x">Max QoS <select class="svelte-9i68x"><option>default</option><option>0 — fire and forget</option><option>1 — at least once</option><option>2 — exactly once</option></select></label></div> <!></div>'),qJ=B('<div class="auth-section svelte-9i68x"><div class="auth-section-title svelte-9i68x">Authentication</div> <div class="field-row svelte-9i68x"><label class="svelte-9i68x">allow_anonymous <select class="svelte-9i68x"><option>auto (broker default)</option><option>true — allow unauthenticated</option><option>false — require auth</option></select></label> <label class="svelte-9i68x">password_file <input placeholder="/etc/mosquitto/passwd" class="svelte-9i68x"/></label> <label class="svelte-9i68x">acl_file <input placeholder="/etc/mosquitto/acl" class="svelte-9i68x"/></label></div></div>'),GJ=B('<div class="listener-card svelte-9i68x"><div class="card-title svelte-9i68x"><span> </span> <button class="remove-btn svelte-9i68x" title="Remove listener">✕</button></div> <div class="field-row svelte-9i68x"><label class="svelte-9i68x">Port <input type="number" min="1" max="65535" class="svelte-9i68x"/></label> <label class="svelte-9i68x">Protocol <select class="svelte-9i68x"><option>mqtt</option><option>websockets</option></select></label> <label class="svelte-9i68x">Bind address <input placeholder="(all interfaces)" class="svelte-9i68x"/></label> <label class="toggle-label tls-inline svelte-9i68x"><input type="checkbox" class="svelte-9i68x"/> <span class="checkmark svelte-9i68x"></span> TLS</label></div> <datalist></datalist> <!> <button class="advanced-btn svelte-9i68x"> </button> <!> <!></div>'),KJ=B('<div class="empty svelte-9i68x">No listeners configured. Click "+ Add listener" to create one.</div>'),ZJ=B('<div class="global-settings svelte-9i68x"><label class="toggle-label svelte-9i68x"><input type="checkbox" class="svelte-9i68x"/> <span class="checkmark svelte-9i68x"></span> <span><code>per_listener_settings</code> — independent auth per listener</span> <span class="info-icon svelte-9i68x" title="Not recommended when using the dynamic-security plugin — dynsec credentials only apply to the default listener. See mosquitto documentation.">ℹ</span></label> <!></div> <div class="cards svelte-9i68x"><!> <!></div>',1),XJ=B('<div class="listeners-page svelte-9i68x"><div class="page-header svelte-9i68x"><h3 class="svelte-9i68x">Listeners</h3> <div class="header-actions svelte-9i68x"><button class="svelte-9i68x">+ Add listener</button> <button class="btn-save svelte-9i68x"> </button> <button class="btn-reload svelte-9i68x" title="Apply &amp; Reload mosquitto"> </button></div></div> <!> <!> <!> <!> <!></div>');function YJ(o,e){$s(e,!0);let t=F(null),i=F(""),n=F(!1),s=F(""),r=F(!1),a=F(!1),d=F(""),u=F(Li([])),f=F(null),g=F(!1),p=F(""),C=F(Li([])),b=F(Li(new Set));Xs(()=>{y(),uU().then(be=>{m(C,be.addresses,!0)}).catch(()=>{})});async function y(){try{m(t,await dS(),!0),m(u,JSON.parse(JSON.stringify(c(t).listeners)),!0),m(f,c(t).checksum,!0);const be=c(t).managed.allow_anonymous;m(p,be==="true"||be==="false"?be:"",!0),m(g,c(t).managed.per_listener_settings==="true"),m(i,"")}catch(be){m(i,be.message??"Failed to load broker config",!0)}}function w(){m(u,[...c(u),{port:1883,bindAddress:"",protocol:"mqtt",tls:{}}],!0),m(b,new Set(c(b)),!0)}function A(be){const Nt=new Set(c(b));Nt.has(be)?Nt.delete(be):Nt.add(be),m(b,Nt,!0)}function I(be){m(u,c(u).filter((Nt,si)=>si!==be),!0)}async function T(){if(c(t)){m(n,!0),m(s,""),m(r,!1);try{const be={...c(t).managed};c(g)?(be.per_listener_settings="true",delete be.allow_anonymous):(delete be.per_listener_settings,c(p)?be.allow_anonymous=c(p):delete be.allow_anonymous),await SF({listeners:c(u),managed:be,passthrough:c(t).passthrough,checksum:c(f)}),m(r,!0),setTimeout(()=>m(r,!1),3e3),await y()}catch(be){m(s,be.message??"Save failed",!0)}finally{m(n,!1)}}}async function R(){m(a,!0),m(d,"");try{const be=await DF();m(d,be.stderr||be.stdout||"Reloaded",!0)}catch(be){m(d,"Error: "+(be.message??"reload failed"))}finally{m(a,!1)}}function P(be){var Nt,si,Xe,tt,wt;return!!((Nt=be.tls)!=null&&Nt.enabled||(si=be.tls)!=null&&si.certfile||(Xe=be.tls)!=null&&Xe.keyfile||(tt=be.tls)!=null&&tt.capath||(wt=be.tls)!=null&&wt.cafile)}function V(be,Nt){Nt?be.tls={...be.tls,enabled:!0}:be.tls={},m(u,[...c(u)],!0)}var j=XJ(),J=_(j),ae=v(_(J),2),fe=_(ae),X=v(fe,2),ce=_(X),me=v(X,2),oe=_(me),le=v(J,2);{var Ae=be=>{var Nt=Y2(),si=_(Nt);z(()=>W(si,c(i))),D(be,Nt)};H(le,be=>{c(i)&&be(Ae)})}var Te=v(le,2);{var xe=be=>{var Nt=Y2(),si=_(Nt);z(()=>W(si,c(s))),D(be,Nt)};H(Te,be=>{c(s)&&be(xe)})}var Ne=v(Te,2);{var Ve=be=>{var Nt=OJ();D(be,Nt)};H(Ne,be=>{c(r)&&be(Ve)})}var ve=v(Ne,2);{var mt=be=>{var Nt=HJ(),si=_(Nt);z(()=>W(si,c(d))),D(be,Nt)};H(ve,be=>{c(d)&&be(mt)})}var Mt=v(ve,2);{var ot=be=>{var Nt=WJ();D(be,Nt)},yt=be=>{var Nt=ZJ(),si=Et(Nt),Xe=_(si),tt=_(Xe),wt=v(Xe,2);{var Yt=Ze=>{var Ee=zJ(),ii=v(_(Ee),2),Ci=_(ii);Ci.value=Ci.__value="";var Jt=v(Ci);Jt.value=Jt.__value="true";var zi=v(Jt);zi.value=zi.__value="false",Ls(ii,()=>c(p),Ji=>m(p,Ji)),D(Ze,Ee)};H(wt,Ze=>{c(g)||Ze(Yt)})}var fi=v(si,2),oi=_(fi);ti(oi,17,()=>c(u),Hi,(Ze,Ee,ii)=>{var Ci=GJ(),Jt=_(Ci),zi=_(Jt),Ji=_(zi),Ii=v(zi,2),wn=v(Jt,2),cn=_(wn),pn=v(_(cn)),fn=v(cn,2),pt=v(_(fn)),Ut=_(pt);Ut.value=Ut.__value="mqtt";var Ni=v(Ut);Ni.value=Ni.__value="websockets";var qi=v(fn,2),gi=v(_(qi));ln(gi,"list",`bind-addr-list-${ii}`);var Wi=v(qi,2),Ui=_(Wi),tn=v(wn,2);ln(tn,"id",`bind-addr-list-${ii}`),ti(tn,21,()=>c(C),Hi,(it,Gt)=>{var li=VJ(),vt={};z(()=>{vt!==(vt=c(Gt))&&(li.value=(li.__value=c(Gt))??"")}),D(it,li)});var yi=v(tn,2);{var Vi=it=>{var Gt=jJ(),li=_(Gt),vt=_(li),ft=v(_(vt)),Y=v(vt,2),Re=v(_(Y)),dt=v(li,2),ye=_(dt),ci=v(_(ye)),It=v(ye,2),ie=v(_(It)),Ye=v(dt,2),kt=_(Ye),Pt=v(_(kt)),Bt=v(kt,2),Be=v(_(Bt)),je=_(Be);je.value=je.__value="";var Kt=v(je);Kt.value=Kt.__value="tlsv1.3";var ri=v(Kt);ri.value=ri.__value="tlsv1.2";var ui=v(Ye,2),Xt=_(ui),pe=_(Xt),Ge=v(Xt,2),rt=_(Ge);zt(ft,()=>c(Ee).tls.certfile,lt=>c(Ee).tls.certfile=lt),zt(Re,()=>c(Ee).tls.keyfile,lt=>c(Ee).tls.keyfile=lt),zt(ci,()=>c(Ee).tls.cafile,lt=>c(Ee).tls.cafile=lt),zt(ie,()=>c(Ee).tls.capath,lt=>c(Ee).tls.capath=lt),zt(Pt,()=>c(Ee).tls.crlfile,lt=>c(Ee).tls.crlfile=lt),Ls(Be,()=>c(Ee).tls.tls_version,lt=>c(Ee).tls.tls_version=lt),ws(pe,()=>c(Ee).tls.require_certificate,lt=>c(Ee).tls.require_certificate=lt),ws(rt,()=>c(Ee).tls.use_identity_as_username,lt=>c(Ee).tls.use_identity_as_username=lt),D(it,Gt)},ze=Lt(()=>P(c(Ee)));H(yi,it=>{c(ze)&&it(Vi)})}var qt=v(yi,2),wi=_(qt),ji=v(qt,2);{var Si=it=>{var Gt=UJ(),li=_(Gt),vt=_(li),ft=v(_(vt)),Y=v(vt,2),Re=v(_(Y)),dt=v(Y,2),ye=v(_(dt)),ci=_(ye);ci.value=ci.__value="";var It=v(ci);It.value=It.__value="0";var ie=v(It);ie.value=ie.__value="1";var Ye=v(ie);Ye.value=Ye.__value="2";var kt;k1(ye);var Pt=v(li,2);{var Bt=je=>{var Kt=$J(),ri=_(Kt),ui=_(ri);ws(ui,()=>c(Ee).tls.use_subject_as_username,Xt=>c(Ee).tls.use_subject_as_username=Xt),D(je,Kt)},Be=Lt(()=>P(c(Ee)));H(Pt,je=>{c(Be)&&je(Bt)})}z(je=>{kt!==(kt=je)&&(ye.value=(ye.__value=je)??"",Hm(ye,je))},[()=>c(Ee).max_qos!==void 0?String(c(Ee).max_qos):""]),zt(ft,()=>c(Ee).mount_point,je=>c(Ee).mount_point=je),zt(Re,()=>c(Ee).max_connections,je=>c(Ee).max_connections=je),$("change",ye,je=>{const Kt=je.target.value;c(Ee).max_qos=Kt===""?void 0:Number(Kt),m(u,[...c(u)],!0)}),D(it,Gt)},K=Lt(()=>c(b).has(ii));H(ji,it=>{c(K)&&it(Si)})}var De=v(ji,2);{var Qe=it=>{var Gt=qJ(),li=v(_(Gt),2),vt=_(li),ft=v(_(vt)),Y=_(ft);Y.value=Y.__value="";var Re=v(Y);Re.value=Re.__value="true";var dt=v(Re);dt.value=dt.__value="false";var ye;k1(ft);var ci=v(vt,2),It=v(_(ci)),ie=v(ci,2),Ye=v(_(ie));z(()=>{ye!==(ye=c(Ee).allow_anonymous===void 0?"":c(Ee).allow_anonymous?"true":"false")&&(ft.value=ft.__value=c(Ee).allow_anonymous===void 0?"":c(Ee).allow_anonymous?"true":"false",Hm(ft,c(Ee).allow_anonymous===void 0?"":c(Ee).allow_anonymous?"true":"false"))}),$("change",ft,kt=>{const Pt=kt.target.value;c(Ee).allow_anonymous=Pt===""?void 0:Pt==="true",m(u,[...c(u)],!0)}),zt(It,()=>c(Ee).password_file,kt=>c(Ee).password_file=kt),zt(Ye,()=>c(Ee).acl_file,kt=>c(Ee).acl_file=kt),D(it,Gt)};H(De,it=>{c(g)&&it(Qe)})}z((it,Gt)=>{W(Ji,`Port ${c(Ee).port??""}`),Zo(Ui,it),W(wi,`${Gt??""} Advanced`)},[()=>P(c(Ee)),()=>c(b).has(ii)?"▾":"▸"]),$("click",Ii,()=>I(ii)),zt(pn,()=>c(Ee).port,it=>c(Ee).port=it),Ls(pt,()=>c(Ee).protocol,it=>c(Ee).protocol=it),zt(gi,()=>c(Ee).bindAddress,it=>c(Ee).bindAddress=it),$("change",Ui,it=>V(c(Ee),it.target.checked)),$("click",qt,()=>A(ii)),D(Ze,Ci)});var ki=v(oi,2);{var _i=Ze=>{var Ee=KJ();D(Ze,Ee)};H(ki,Ze=>{c(u).length===0&&Ze(_i)})}ws(tt,()=>c(g),Ze=>m(g,Ze)),D(be,Nt)};H(Mt,be=>{c(t)===null&&!c(i)?be(ot):be(yt,-1)})}z(()=>{X.disabled=c(n),W(ce,c(n)?"Saving…":"Save"),me.disabled=c(a),W(oe,c(a)?"Reloading…":"Apply & Reload")}),$("click",fe,w),$("click",X,T),$("click",me,R),D(o,j),Us()}Ys(["click","change"]);var Q2=B('<div class="err svelte-1by6o5t"> </div>'),QJ=B('<div class="ok svelte-1by6o5t">Saved.</div>'),JJ=B('<div class="reload-msg svelte-1by6o5t"> </div>'),YC=B('<label class="check-label svelte-1by6o5t"><input type="checkbox" class="svelte-1by6o5t"/> <span class="checkmark svelte-1by6o5t"></span> </label>'),eee=B('<label class="check-label svelte-1by6o5t"><input type="checkbox" class="svelte-1by6o5t"/> <span class="checkmark svelte-1by6o5t"></span> <strong> </strong></label>'),tee=B(`<div class="section svelte-1by6o5t"><h4 class="svelte-1by6o5t">General</h4> <div class="field-grid svelte-1by6o5t"><div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">persistence</span> <select class="svelte-1by6o5t"><option>auto (broker default)</option><option>true — persist sessions &amp; retained msgs</option><option>false — no disk persistence</option></select></label> <p class="hint svelte-1by6o5t">Enable on-disk persistence of subscriptions, retained messages, and QoS 1/2 queues.</p></div> <div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">persistence_location</span> <input placeholder="/var/lib/mosquitto/" class="svelte-1by6o5t"/></label> <p class="hint svelte-1by6o5t">Directory where mosquitto stores its persistence data. Must be writable by the mosquitto process.</p></div> <div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">sys_interval</span> <input type="number" placeholder="10" min="0" class="svelte-1by6o5t"/></label> <p class="hint svelte-1by6o5t">Interval in seconds between <code class="svelte-1by6o5t">$SYS</code> status updates. <code class="svelte-1by6o5t">0</code> disables <code class="svelte-1by6o5t">$SYS</code> messages.</p></div></div> <div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">include_dir</span> <textarea placeholder="/etc/mosquitto/conf.d" class="svelte-1by6o5t"></textarea></label> <p class="hint svelte-1by6o5t">One path per line. Each directory will be scanned for <code class="svelte-1by6o5t">*.conf</code> files and included in order.</p></div></div> <div class="section svelte-1by6o5t"><h4 class="svelte-1by6o5t">Logging</h4> <div class="field svelte-1by6o5t"><span class="field-key svelte-1by6o5t">log_dest</span> <div class="checkbox-group svelte-1by6o5t"></div> <p class="hint svelte-1by6o5t">Log destinations. Enable <code class="svelte-1by6o5t">topic</code> to stream logs to <code class="svelte-1by6o5t">$SYS/broker/log/*</code> and view them in the Logs tab. <code class="svelte-1by6o5t">none</code> disables logging entirely.</p></div> <div class="field svelte-1by6o5t"><span class="field-key svelte-1by6o5t">log_type</span> <div class="log-type-grid svelte-1by6o5t"><div class="log-type-group svelte-1by6o5t"><span class="log-type-group-label svelte-1by6o5t">Severity</span> <!></div> <div class="log-type-group svelte-1by6o5t"><span class="log-type-group-label svelte-1by6o5t">Events</span> <!></div> <div class="log-type-group log-type-group--other svelte-1by6o5t"><!> <span class="all-hint svelte-1by6o5t">enables all types above</span></div></div> <p class="hint svelte-1by6o5t">Types of messages to log. Leave all unchecked to use the broker default.</p></div></div> <div class="section svelte-1by6o5t"><h4 class="svelte-1by6o5t">Connection limits</h4> <div class="field-grid svelte-1by6o5t"><div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">max_connections</span> <input placeholder="−1 (unlimited)" class="svelte-1by6o5t"/></label> <p class="hint svelte-1by6o5t">Maximum simultaneous client connections. <code class="svelte-1by6o5t">-1</code> = unlimited.</p></div> <div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">max_keepalive</span> <input placeholder="65535" class="svelte-1by6o5t"/></label> <p class="hint svelte-1by6o5t">Maximum keepalive value (seconds) a client may request. <code class="svelte-1by6o5t">0</code> = unlimited.</p></div> <div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">max_inflight_messages</span> <input placeholder="20" class="svelte-1by6o5t"/></label> <p class="hint svelte-1by6o5t">Max simultaneous unacknowledged QoS 1/2 messages per client.</p></div> <div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">max_queued_messages</span> <input placeholder="100" class="svelte-1by6o5t"/></label> <p class="hint svelte-1by6o5t">Max messages queued for a disconnected persistent client.</p></div></div></div> <div class="section svelte-1by6o5t"><h4 class="svelte-1by6o5t">Packet &amp; payload size</h4> <div class="field-grid svelte-1by6o5t"><div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">max_packet_size</span> <input placeholder="0 (no limit)" class="svelte-1by6o5t"/></label> <p class="hint svelte-1by6o5t">Maximum MQTT packet size in bytes (MQTT v5 only). <code class="svelte-1by6o5t">0</code> = no limit.</p></div> <div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">message_size_limit</span> <input placeholder="0 (no limit)" class="svelte-1by6o5t"/></label> <p class="hint svelte-1by6o5t">Maximum payload size in bytes for published messages. <code class="svelte-1by6o5t">0</code> = no limit.</p></div></div></div> <div class="section svelte-1by6o5t"><h4 class="svelte-1by6o5t">Sessions &amp; persistence</h4> <div class="field-grid svelte-1by6o5t"><div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">persistent_client_expiration</span> <input placeholder="e.g. 7d, 2h, 30m" class="svelte-1by6o5t"/></label> <p class="hint svelte-1by6o5t">Expire persistent sessions after this duration. Suffix: <code class="svelte-1by6o5t">d</code>/<code class="svelte-1by6o5t">h</code>/<code class="svelte-1by6o5t">m</code>/<code class="svelte-1by6o5t">s</code>. Empty = never expire.</p></div> <div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">retain_available</span> <select class="svelte-1by6o5t"><option>auto (broker default)</option><option>true — allow retained messages</option><option>false — disable retained messages globally</option></select></label> <p class="hint svelte-1by6o5t">Disable retained messages broker-wide.</p></div></div></div> <div class="section svelte-1by6o5t"><h4 class="svelte-1by6o5t">Performance</h4> <div class="field-grid svelte-1by6o5t"><div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">set_tcp_nodelay</span> <select class="svelte-1by6o5t"><option>auto (broker default)</option><option>true — disable Nagle (lower latency)</option><option>false — enable Nagle</option></select></label> <p class="hint svelte-1by6o5t">Disable Nagle's algorithm to reduce latency at the cost of slightly more packets.</p></div> <div class="field svelte-1by6o5t"><label class="svelte-1by6o5t"><span class="svelte-1by6o5t">connection_messages</span> <select class="svelte-1by6o5t"><option>auto (broker default)</option><option>true — log connect/disconnect</option><option>false — suppress</option></select></label> <p class="hint svelte-1by6o5t">Log a message on every client connect and disconnect.</p></div></div></div>`,1),iee=B('<div class="config-page svelte-1by6o5t"><div class="page-header svelte-1by6o5t"><h3 class="svelte-1by6o5t">Global config</h3> <div class="header-actions svelte-1by6o5t"><button class="btn-save svelte-1by6o5t"> </button> <button class="btn-reload svelte-1by6o5t"> </button></div></div> <!> <!> <!> <!> <!></div>');function nee(o,e){$s(e,!0);let t=F(null),i=F(""),n=F(!1),s=F(""),r=F(!1),a=F(!1),d=F(""),u=F(null),f=F(""),g=F(""),p=F(""),C=F(""),b=F(""),y=F(""),w=F(""),A=F(""),I=F(""),T=F(""),R=F(""),P=F(""),V=F(""),j=F("");const J=["file","stdout","stderr","syslog","topic","none"],ae=["error","warning","notice","information","debug"],fe=["connect","disconnect","subscribe","unsubscribe","publish","receive","websockets"],X=["all"];[...ae,...fe,...X];let ce=F(Li(new Set)),me=F(Li(new Set));function oe(Ze,Ee){const ii=new Set(Ze);return ii.has(Ee)?ii.delete(Ee):ii.add(Ee),ii}function le(Ze){if(!c(t))return"";const Ee=c(t).managed[Ze];return Array.isArray(Ee)?Ee[0]:Ee??""}function Ae(Ze){if(!c(t))return new Set;const Ee=c(t).managed[Ze];return Ee?new Set(Array.isArray(Ee)?Ee:[Ee]):new Set}Xs(()=>Te());async function Te(){try{m(t,await dS(),!0),m(u,c(t).checksum,!0),m(f,le("persistence"),!0),m(g,le("persistence_location"),!0),m(p,le("sys_interval"),!0);const Ze=c(t).managed.include_dir;m(C,Ze?Array.isArray(Ze)?Ze.join(`
231
+ `):Ze:"",!0),m(b,le("max_connections"),!0),m(y,le("max_inflight_messages"),!0),m(w,le("max_queued_messages"),!0),m(A,le("max_packet_size"),!0),m(I,le("message_size_limit"),!0),m(T,le("max_keepalive"),!0),m(R,le("persistent_client_expiration"),!0),m(P,le("retain_available"),!0),m(V,le("set_tcp_nodelay"),!0),m(j,le("connection_messages"),!0),m(ce,Ae("log_dest"),!0),m(me,Ae("log_type"),!0),m(i,"")}catch(Ze){m(i,Ze.message??"Failed to load config",!0)}}async function xe(){if(c(t)){m(n,!0),m(s,""),m(r,!1);try{let Ee=function(Ci,Jt){Jt!==""?Ze[Ci]=Jt:delete Ze[Ci]};const Ze={...c(t).managed};Ee("persistence",c(f)),Ee("persistence_location",c(g)),Ee("sys_interval",c(p));const ii=c(C).split(`
232
+ `).map(Ci=>Ci.trim()).filter(Boolean);ii.length>0?Ze.include_dir=ii.length===1?ii[0]:ii:delete Ze.include_dir,Ee("max_connections",c(b)),Ee("max_inflight_messages",c(y)),Ee("max_queued_messages",c(w)),Ee("max_packet_size",c(A)),Ee("message_size_limit",c(I)),Ee("max_keepalive",c(T)),Ee("persistent_client_expiration",c(R)),Ee("retain_available",c(P)),Ee("set_tcp_nodelay",c(V)),Ee("connection_messages",c(j)),c(ce).size>0?Ze.log_dest=c(ce).size===1?[...c(ce)][0]:[...c(ce)]:delete Ze.log_dest,c(me).size>0?Ze.log_type=c(me).size===1?[...c(me)][0]:[...c(me)]:delete Ze.log_type,await SF({listeners:c(t).listeners,managed:Ze,passthrough:c(t).passthrough,checksum:c(u)}),m(r,!0),setTimeout(()=>m(r,!1),3e3),await Te()}catch(Ze){m(s,Ze.message??"Save failed",!0)}finally{m(n,!1)}}}async function Ne(){m(a,!0),m(d,"");try{const Ze=await DF();m(d,Ze.stderr||Ze.stdout||"Reloaded",!0)}catch(Ze){m(d,"Error: "+(Ze.message??"reload failed"))}finally{m(a,!1)}}var Ve=iee(),ve=_(Ve),mt=v(_(ve),2),Mt=_(mt),ot=_(Mt),yt=v(Mt,2),be=_(yt),Nt=v(ve,2);{var si=Ze=>{var Ee=Q2(),ii=_(Ee);z(()=>W(ii,c(i))),D(Ze,Ee)};H(Nt,Ze=>{c(i)&&Ze(si)})}var Xe=v(Nt,2);{var tt=Ze=>{var Ee=Q2(),ii=_(Ee);z(()=>W(ii,c(s))),D(Ze,Ee)};H(Xe,Ze=>{c(s)&&Ze(tt)})}var wt=v(Xe,2);{var Yt=Ze=>{var Ee=QJ();D(Ze,Ee)};H(wt,Ze=>{c(r)&&Ze(Yt)})}var fi=v(wt,2);{var oi=Ze=>{var Ee=JJ(),ii=_(Ee);z(()=>W(ii,c(d))),D(Ze,Ee)};H(fi,Ze=>{c(d)&&Ze(oi)})}var ki=v(fi,2);{var _i=Ze=>{var Ee=tee(),ii=Et(Ee),Ci=v(_(ii),2),Jt=_(Ci),zi=_(Jt),Ji=v(_(zi),2),Ii=_(Ji);Ii.value=Ii.__value="";var wn=v(Ii);wn.value=wn.__value="true";var cn=v(wn);cn.value=cn.__value="false";var pn=v(Jt,2),fn=_(pn),pt=v(_(fn),2),Ut=v(pn,2),Ni=_(Ut),qi=v(_(Ni),2),gi=v(Ci,2),Wi=_(gi),Ui=v(_(Wi),2);ln(Ui,"rows",3);var tn=v(ii,2),yi=v(_(tn),2),Vi=v(_(yi),2);ti(Vi,21,()=>J,Hi,(we,Oe)=>{var St=YC(),ut=_(St),nt=v(ut,3);z(ue=>{Zo(ut,ue),W(nt,` ${c(Oe)??""}`)},[()=>c(ce).has(c(Oe))]),$("change",ut,()=>{m(ce,oe(c(ce),c(Oe)),!0)}),D(we,St)});var ze=v(yi,2),qt=v(_(ze),2),wi=_(qt),ji=v(_(wi),2);ti(ji,17,()=>ae,Hi,(we,Oe)=>{var St=YC(),ut=_(St),nt=v(ut,3);z(ue=>{Zo(ut,ue),W(nt,` ${c(Oe)??""}`)},[()=>c(me).has(c(Oe))]),$("change",ut,()=>{m(me,oe(c(me),c(Oe)),!0)}),D(we,St)});var Si=v(wi,2),K=v(_(Si),2);ti(K,17,()=>fe,Hi,(we,Oe)=>{var St=YC(),ut=_(St),nt=v(ut,3);z(ue=>{Zo(ut,ue),W(nt,` ${c(Oe)??""}`)},[()=>c(me).has(c(Oe))]),$("change",ut,()=>{m(me,oe(c(me),c(Oe)),!0)}),D(we,St)});var De=v(Si,2),Qe=_(De);ti(Qe,17,()=>X,Hi,(we,Oe)=>{var St=eee(),ut=_(St),nt=v(ut,4),ue=_(nt);z(He=>{Zo(ut,He),W(ue,c(Oe))},[()=>c(me).has(c(Oe))]),$("change",ut,()=>{m(me,oe(c(me),c(Oe)),!0)}),D(we,St)});var it=v(tn,2),Gt=v(_(it),2),li=_(Gt),vt=_(li),ft=v(_(vt),2),Y=v(li,2),Re=_(Y),dt=v(_(Re),2),ye=v(Y,2),ci=_(ye),It=v(_(ci),2),ie=v(ye,2),Ye=_(ie),kt=v(_(Ye),2),Pt=v(it,2),Bt=v(_(Pt),2),Be=_(Bt),je=_(Be),Kt=v(_(je),2),ri=v(Be,2),ui=_(ri),Xt=v(_(ui),2),pe=v(Pt,2),Ge=v(_(pe),2),rt=_(Ge),lt=_(rt),Vt=v(_(lt),2),Ot=v(rt,2),bi=_(Ot),U=v(_(bi),2),M=_(U);M.value=M.__value="";var O=v(M);O.value=O.__value="true";var ee=v(O);ee.value=ee.__value="false";var ne=v(pe,2),se=v(_(ne),2),re=_(se),Ie=_(re),We=v(_(Ie),2),Ce=_(We);Ce.value=Ce.__value="";var Pe=v(Ce);Pe.value=Pe.__value="true";var Me=v(Pe);Me.value=Me.__value="false";var at=v(re,2),Qt=_(at),Z=v(_(Qt),2),de=_(Z);de.value=de.__value="";var Ue=v(de);Ue.value=Ue.__value="true";var Ft=v(Ue);Ft.value=Ft.__value="false",Ls(Ji,()=>c(f),we=>m(f,we)),zt(pt,()=>c(g),we=>m(g,we)),zt(qi,()=>c(p),we=>m(p,we)),zt(Ui,()=>c(C),we=>m(C,we)),zt(ft,()=>c(b),we=>m(b,we)),zt(dt,()=>c(T),we=>m(T,we)),zt(It,()=>c(y),we=>m(y,we)),zt(kt,()=>c(w),we=>m(w,we)),zt(Kt,()=>c(A),we=>m(A,we)),zt(Xt,()=>c(I),we=>m(I,we)),zt(Vt,()=>c(R),we=>m(R,we)),Ls(U,()=>c(P),we=>m(P,we)),Ls(We,()=>c(V),we=>m(V,we)),Ls(Z,()=>c(j),we=>m(j,we)),D(Ze,Ee)};H(ki,Ze=>{c(t)&&Ze(_i)})}z(()=>{Mt.disabled=c(n),W(ot,c(n)?"Saving…":"Save"),yt.disabled=c(a),W(be,c(a)?"Reloading…":"Apply & Reload")}),$("click",Mt,xe),$("click",yt,Ne),D(o,Ve),Us()}Ys(["click","change"]);var nl=B('<div class="err svelte-9auejo"> </div>'),see=B('<div class="info-card svelte-9auejo"><dl class="svelte-9auejo"><dt class="svelte-9auejo">CN</dt><dd class="svelte-9auejo"> </dd> <dt class="svelte-9auejo">Fingerprint (SHA-256)</dt><dd class="mono small svelte-9auejo"> </dd> <dt class="svelte-9auejo">Expires</dt><dd> </dd></dl></div>'),oee=B('<div class="empty svelte-9auejo">No managed server certificate. Use one of the options above, or configure <code>certfile</code>/<code>keyfile</code> manually in the Listeners tab.</div>'),ree=B('<div class="empty svelte-9auejo">No trusted CA certs. Add one to enable client certificate authentication.</div>'),aee=B('<tr><td class="mono svelte-9auejo"> </td><td class="mono small svelte-9auejo"> </td><td> </td><td class="actions svelte-9auejo"><button class="danger svelte-9auejo">✕</button></td></tr>'),lee=B('<table class="svelte-9auejo"><thead><tr><th class="svelte-9auejo">CN</th><th class="svelte-9auejo">Fingerprint</th><th class="svelte-9auejo">Expires</th><th class="svelte-9auejo"></th></tr></thead><tbody></tbody></table>'),cee=B('<div class="result-box svelte-9auejo"><p class="svelte-9auejo">✓ Certificate installed.</p> <dl class="svelte-9auejo"><dt class="svelte-9auejo">Fingerprint</dt><dd class="mono small svelte-9auejo"> </dd><dt class="svelte-9auejo">Expires</dt><dd class="svelte-9auejo"> </dd></dl></div>'),J2=B('<button class="btn-primary svelte-9auejo"> </button>'),dee=B('<div class="modal-backdrop svelte-9auejo" role="dialog" aria-modal="true"><div class="modal svelte-9auejo"><h3 class="svelte-9auejo">Generate self-signed server certificate</h3> <label class="svelte-9auejo">Common Name (hostname / IP)<input placeholder="e.g. mqtt.home.arpa" class="svelte-9auejo"/></label> <label class="svelte-9auejo">Subject Alternative Names (comma-separated, optional)<input placeholder="192.168.1.10, mqtt.local" class="svelte-9auejo"/></label> <label class="svelte-9auejo">Validity (days)<input type="number" min="1" max="3650" class="svelte-9auejo"/></label> <!> <!> <div class="modal-actions svelte-9auejo"><button class="svelte-9auejo">Close</button> <!></div></div></div>'),uee=B('<label class="svelte-9auejo">Common Name (hostname / IP)<input placeholder="e.g. mqtt.home.arpa" class="svelte-9auejo"/></label> <label class="svelte-9auejo">Subject Alternative Names (comma-separated, optional)<input placeholder="192.168.1.10, mqtt.local" class="svelte-9auejo"/></label> <p class="hint svelte-9auejo">A private key and CSR are generated on the server. Copy the CSR, have it signed by your CA, then paste the signed cert below.</p> <!> <div class="modal-actions svelte-9auejo"><button class="svelte-9auejo">Cancel</button> <button class="btn-primary svelte-9auejo"> </button></div>',1),hee=B('<div class="ok svelte-9auejo">✓ Certificate installed.</div>'),fee=B('<p class="hint svelte-9auejo">Key stored on server. Copy the CSR, get it signed, then paste the signed certificate to complete installation.</p> <label class="svelte-9auejo">Certificate Signing Request<textarea readonly="" rows="8" class="svelte-9auejo"></textarea></label> <div class="csr-actions svelte-9auejo"><button class="svelte-9auejo">Copy CSR</button> <a class="btn-download svelte-9auejo" download="server.csr">Download .csr</a></div> <hr class="svelte-9auejo"/> <label class="svelte-9auejo">Upload signed certificate (PEM)<textarea rows="6" placeholder="-----BEGIN CERTIFICATE----- … -----END CERTIFICATE-----" class="svelte-9auejo"></textarea></label> <!> <!> <div class="modal-actions svelte-9auejo"><button class="svelte-9auejo">Close</button> <!></div>',1),gee=B('<div class="modal-backdrop svelte-9auejo" role="dialog" aria-modal="true"><div class="modal modal--wide svelte-9auejo"><h3 class="svelte-9auejo">Generate key + CSR for server certificate</h3> <!></div></div>'),pee=B('<label class="svelte-9auejo">Certificate (PEM)<textarea rows="5" placeholder="-----BEGIN CERTIFICATE----- … -----END CERTIFICATE-----" class="svelte-9auejo"></textarea></label> <label class="svelte-9auejo">Private key (PEM — leave blank if key is already on disk from a prior CSR)<textarea rows="4" placeholder="-----BEGIN PRIVATE KEY----- … -----END PRIVATE KEY-----" class="svelte-9auejo"></textarea></label>',1),xee=B('<span class="file-name mono small svelte-9auejo"> </span>'),mee=B('<label class="svelte-9auejo">PKCS#12 file <div class="file-row svelte-9auejo"><input type="file" accept=".p12,.pfx" class="svelte-9auejo"/> <!></div></label> <label class="svelte-9auejo">Passphrase <div class="pw-row svelte-9auejo"><input autocomplete="off" class="svelte-9auejo"/> <button class="toggle-pw svelte-9auejo"> </button></div></label>',1),vee=B('<div class="modal-backdrop svelte-9auejo" role="dialog" aria-modal="true"><div class="modal modal--wide svelte-9auejo"><h3 class="svelte-9auejo">Import server certificate</h3> <div class="import-mode-tabs svelte-9auejo"><button>PEM files</button> <button>PKCS#12 (.p12 / .pfx)</button></div> <!> <!> <div class="modal-actions svelte-9auejo"><button class="svelte-9auejo">Cancel</button> <button class="btn-primary svelte-9auejo"> </button></div></div></div>'),QC=B("<option></option>"),_ee=B('<div class="modal-backdrop svelte-9auejo" role="dialog" aria-modal="true"><div class="modal modal--wide svelte-9auejo"><h3 class="svelte-9auejo">Use existing certificate files</h3> <p class="hint svelte-9auejo">Enter absolute paths on the broker host. Tab-completion is available for paths starting with /.</p> <label class="svelte-9auejo">Certificate file path <input list="set-cert-path-list" placeholder="/etc/letsencrypt/live/mqtt.example.com/fullchain.pem" class="svelte-9auejo"/> <datalist id="set-cert-path-list"></datalist></label> <label class="svelte-9auejo">Private key file path <input list="set-key-path-list" placeholder="/etc/letsencrypt/live/mqtt.example.com/privkey.pem" class="svelte-9auejo"/> <datalist id="set-key-path-list"></datalist></label> <!> <div class="modal-actions svelte-9auejo"><button class="svelte-9auejo">Cancel</button> <button class="btn-primary svelte-9auejo"> </button></div></div></div>'),bee=B('<label class="svelte-9auejo">CA certificate (PEM)<textarea rows="8" placeholder="-----BEGIN CERTIFICATE----- … -----END CERTIFICATE-----" class="svelte-9auejo"></textarea></label> <!> <div class="modal-actions svelte-9auejo"><button class="svelte-9auejo">Cancel</button> <button class="btn-primary svelte-9auejo"> </button></div>',1),Cee=B('<p class="hint svelte-9auejo">Enter the absolute path to the CA certificate file on the broker host.</p> <label class="svelte-9auejo">CA certificate path <input list="trusted-path-list" placeholder="/etc/ssl/certs/my-ca.pem" class="svelte-9auejo"/> <datalist id="trusted-path-list"></datalist></label> <!> <div class="modal-actions svelte-9auejo"><button class="svelte-9auejo">Cancel</button> <button class="btn-primary svelte-9auejo"> </button></div>',1),Eee=B('<div class="modal-backdrop svelte-9auejo" role="dialog" aria-modal="true"><div class="modal modal--wide svelte-9auejo"><h3 class="svelte-9auejo">Add trusted CA certificate</h3> <div class="import-mode-tabs svelte-9auejo"><button>Paste PEM</button> <button>From path</button></div> <!></div></div>'),yee=B('<div class="certs-page svelte-9auejo"><div class="page-toolbar svelte-9auejo"><button class="reload-btn svelte-9auejo" title="Refresh">↺</button></div> <!> <!> <div class="section svelte-9auejo"><div class="section-header svelte-9auejo"><h3 class="svelte-9auejo">Server Certificate</h3> <button class="svelte-9auejo">Self-signed</button> <button class="svelte-9auejo">Generate CSR</button> <button class="svelte-9auejo">Import cert</button> <button class="svelte-9auejo">Use path</button></div> <!></div> <div class="section svelte-9auejo"><div class="section-header svelte-9auejo"><h3 class="svelte-9auejo">Trusted CA Certificates</h3> <button class="svelte-9auejo">+ Add CA cert</button></div> <!></div></div> <!> <!> <!> <!> <!>',1);function wee(o,e){$s(e,!0);let t=F(null),i=F(Li([])),n=F(""),s=F(""),r=F(!1),a=F(""),d=F(""),u=F(365),f=F(!1),g=F(""),p=F(null),C=F(!1),b=F(""),y=F(""),w=F(!1),A=F(""),I=F(""),T=F(""),R=F(!1),P=F(""),V=F(!1),j=F(!1),J=F("pem"),ae=F(""),fe=F(""),X=F(""),ce=F(""),me=F(""),oe=F(!1),le=F(!1),Ae=F(""),Te=F(!1),xe=F(""),Ne=F(""),Ve=F(!1),ve=F(""),mt=F(Li([])),Mt=F(Li([])),ot=F(!1),yt=F("pem"),be=F(""),Nt=F(!1),si=F(""),Xe=F(""),tt=F(Li([])),wt=F(!1),Yt=F("");async function fi(){try{const[Be,je]=await Promise.allSettled([NU(),WU()]);Be.status==="fulfilled"&&m(t,Be.value.server,!0),je.status==="fulfilled"&&m(i,je.value.certs,!0),m(n,"")}catch(Be){m(n,Be.message,!0)}}Xs(()=>{fi()});async function oi(){m(g,""),m(f,!0),m(p,null);try{const Be=c(d).split(",").map(Kt=>Kt.trim()).filter(Boolean),je=await OU({cn:c(a),san:Be,days:c(u)});m(p,{fingerprint:je.fingerprint,expires:je.expires},!0),await fi()}catch(Be){m(g,Be.message,!0)}finally{m(f,!1)}}async function ki(){m(A,""),m(w,!0),m(I,"");try{const Be=c(y).split(",").map(Kt=>Kt.trim()).filter(Boolean),je=await HU({cn:c(b),san:Be});m(I,je.csrPem,!0)}catch(Be){m(A,Be.message,!0)}finally{m(w,!1)}}async function _i(){m(P,""),m(R,!0),m(V,!1);try{if(!c(T).trim())throw new Error("Paste the signed certificate PEM");await qC({cert:c(T)}),m(V,!0),await fi()}catch(Be){m(P,Be.message,!0)}finally{m(R,!1)}}function Ze(){navigator.clipboard.writeText(c(I)).catch(()=>{})}function Ee(Be){var ri;const je=(ri=Be.target.files)==null?void 0:ri[0];if(!je)return;m(ce,je.name,!0);const Kt=new FileReader;Kt.onload=()=>{const ui=Kt.result;m(X,btoa(String.fromCharCode(...new Uint8Array(ui))),!0)},Kt.readAsArrayBuffer(je)}async function ii(){m(Ae,""),m(le,!0);try{if(c(J)==="p12"){if(!c(X))throw new Error("Select a .p12 / .pfx file");await qC({p12base64:c(X),passphrase:c(me)})}else{if(!c(ae).trim())throw new Error("Certificate PEM is required");await qC({cert:c(ae),key:c(fe)||void 0})}m(j,!1),await fi()}catch(Be){m(Ae,Be.message,!0)}finally{m(le,!1)}}function Ci(Be){let je;return Kt=>{const ri=Kt.target.value;clearTimeout(je),je=setTimeout(async()=>{if(!ri.startsWith("/")||ri.length<2){Be([]);return}try{Be((await jU(ri)).suggestions)}catch{Be([])}},280)}}const Jt=Ci(Be=>{m(mt,Be,!0)}),zi=Ci(Be=>{m(Mt,Be,!0)}),Ji=Ci(Be=>{m(tt,Be,!0)});async function Ii(){m(ve,""),m(Ve,!0);try{await $U({certPath:c(xe),keyPath:c(Ne)}),m(Te,!1),await fi()}catch(Be){m(ve,Be.message,!0)}finally{m(Ve,!1)}}async function wn(){m(si,""),m(Nt,!0);try{await zU(c(be)),m(be,""),m(ot,!1),await fi()}catch(Be){m(si,Be.message,!0)}finally{m(Nt,!1)}}async function cn(){m(Yt,""),m(wt,!0);try{await UU(c(Xe)),m(Xe,""),m(ot,!1),await fi()}catch(Be){m(Yt,Be.message,!0)}finally{m(wt,!1)}}async function pn(Be){if(confirm("Remove this trusted CA cert?"))try{await VU(Be),await fi()}catch(je){m(s,je.message,!0)}}function fn(Be){const je=new Date(Be).getTime()-Date.now();return je<0?"expired":je<30*864e5?"expiring":""}function pt(Be){return new Date(Be).toLocaleDateString()}var Ut=yee(),Ni=Et(Ut),qi=_(Ni),gi=_(qi),Wi=v(qi,2);{var Ui=Be=>{var je=nl(),Kt=_(je);z(()=>W(Kt,c(n))),D(Be,je)};H(Wi,Be=>{c(n)&&Be(Ui)})}var tn=v(Wi,2);{var yi=Be=>{var je=nl(),Kt=_(je);z(()=>W(Kt,c(s))),D(Be,je)};H(tn,Be=>{c(s)&&Be(yi)})}var Vi=v(tn,2),ze=_(Vi),qt=v(_(ze),2),wi=v(qt,2),ji=v(wi,2),Si=v(ji,2),K=v(ze,2);{var De=Be=>{var je=see(),Kt=_(je),ri=v(_(Kt)),ui=_(ri),Xt=v(ri,3),pe=_(Xt),Ge=v(Xt,3),rt=_(Ge);z((lt,Vt)=>{W(ui,c(t).cn),W(pe,c(t).fingerprint),At(Ge,1,lt,"svelte-9auejo"),W(rt,Vt)},[()=>hg(fn(c(t).expires)),()=>pt(c(t).expires)]),D(Be,je)},Qe=Be=>{var je=oee();D(Be,je)};H(K,Be=>{c(t)?Be(De):Be(Qe,-1)})}var it=v(Vi,2),Gt=_(it),li=v(_(Gt),2),vt=v(Gt,2);{var ft=Be=>{var je=ree();D(Be,je)},Y=Be=>{var je=lee(),Kt=v(_(je));ti(Kt,21,()=>c(i),Hi,(ri,ui)=>{var Xt=aee(),pe=_(Xt),Ge=_(pe),rt=v(pe),lt=_(rt),Vt=v(rt),Ot=_(Vt),bi=v(Vt),U=_(bi);z((M,O,ee)=>{W(Ge,c(ui).cn),W(lt,`${M??""}…`),At(Vt,1,O,"svelte-9auejo"),W(Ot,ee)},[()=>c(ui).fingerprint.slice(0,29),()=>hg(fn(c(ui).expires)),()=>pt(c(ui).expires)]),$("click",U,()=>pn(c(ui).fingerprint)),D(ri,Xt)}),D(Be,je)};H(vt,Be=>{c(i).length===0?Be(ft):Be(Y,-1)})}var Re=v(Ni,2);{var dt=Be=>{var je=dee(),Kt=_(je),ri=v(_(Kt),2),ui=v(_(ri)),Xt=v(ri,2),pe=v(_(Xt)),Ge=v(Xt,2),rt=v(_(Ge)),lt=v(Ge,2);{var Vt=ne=>{var se=nl(),re=_(se);z(()=>W(re,c(g))),D(ne,se)};H(lt,ne=>{c(g)&&ne(Vt)})}var Ot=v(lt,2);{var bi=ne=>{var se=cee(),re=v(_(se),2),Ie=v(_(re)),We=_(Ie),Ce=v(Ie,2),Pe=_(Ce);z(Me=>{W(We,c(p).fingerprint),W(Pe,Me)},[()=>pt(c(p).expires)]),D(ne,se)};H(Ot,ne=>{c(p)&&ne(bi)})}var U=v(Ot,2),M=_(U),O=v(M,2);{var ee=ne=>{var se=J2(),re=_(se);z(()=>{se.disabled=c(f),W(re,c(f)?"Generating…":"Generate")}),$("click",se,oi),D(ne,se)};H(O,ne=>{c(p)||ne(ee)})}zt(ui,()=>c(a),ne=>m(a,ne)),zt(pe,()=>c(d),ne=>m(d,ne)),zt(rt,()=>c(u),ne=>m(u,ne)),$("click",M,()=>m(r,!1)),D(Be,je)};H(Re,Be=>{c(r)&&Be(dt)})}var ye=v(Re,2);{var ci=Be=>{var je=gee(),Kt=_(je),ri=v(_(Kt),2);{var ui=pe=>{var Ge=uee(),rt=Et(Ge),lt=v(_(rt)),Vt=v(rt,2),Ot=v(_(Vt)),bi=v(Vt,4);{var U=se=>{var re=nl(),Ie=_(re);z(()=>W(Ie,c(A))),D(se,re)};H(bi,se=>{c(A)&&se(U)})}var M=v(bi,2),O=_(M),ee=v(O,2),ne=_(ee);z(()=>{ee.disabled=c(w),W(ne,c(w)?"Generating…":"Generate key + CSR")}),zt(lt,()=>c(b),se=>m(b,se)),zt(Ot,()=>c(y),se=>m(y,se)),$("click",O,()=>m(C,!1)),$("click",ee,ki),D(pe,Ge)},Xt=pe=>{var Ge=fee(),rt=v(Et(Ge),2),lt=v(_(rt)),Vt=v(rt,2),Ot=_(Vt),bi=v(Ot,2),U=v(Vt,4),M=v(_(U)),O=v(U,2);{var ee=Pe=>{var Me=nl(),at=_(Me);z(()=>W(at,c(P))),D(Pe,Me)};H(O,Pe=>{c(P)&&Pe(ee)})}var ne=v(O,2);{var se=Pe=>{var Me=hee();D(Pe,Me)};H(ne,Pe=>{c(V)&&Pe(se)})}var re=v(ne,2),Ie=_(re),We=v(Ie,2);{var Ce=Pe=>{var Me=J2(),at=_(Me);z(Qt=>{Me.disabled=Qt,W(at,c(R)?"Uploading…":"Upload signed cert")},[()=>c(R)||!c(T).trim()]),$("click",Me,_i),D(Pe,Me)};H(We,Pe=>{c(V)||Pe(Ce)})}z(Pe=>{B1(lt,c(I)),ln(bi,"href",`data:application/pkcs10;charset=utf-8,${Pe??""}`)},[()=>encodeURIComponent(c(I))]),$("click",Ot,Ze),zt(M,()=>c(T),Pe=>m(T,Pe)),$("click",Ie,()=>m(C,!1)),D(pe,Ge)};H(ri,pe=>{c(I)?pe(Xt,-1):pe(ui)})}D(Be,je)};H(ye,Be=>{c(C)&&Be(ci)})}var It=v(ye,2);{var ie=Be=>{var je=vee(),Kt=_(je),ri=v(_(Kt),2),ui=_(ri);let Xt;var pe=v(ui,2);let Ge;var rt=v(ri,2);{var lt=ne=>{var se=pee(),re=Et(se),Ie=v(_(re)),We=v(re,2),Ce=v(_(We));zt(Ie,()=>c(ae),Pe=>m(ae,Pe)),zt(Ce,()=>c(fe),Pe=>m(fe,Pe)),D(ne,se)},Vt=ne=>{var se=mee(),re=Et(se),Ie=v(_(re)),We=_(Ie),Ce=v(We,2);{var Pe=Ue=>{var Ft=xee(),we=_(Ft);z(()=>W(we,c(ce))),D(Ue,Ft)};H(Ce,Ue=>{c(ce)&&Ue(Pe)})}var Me=v(re,2),at=v(_(Me)),Qt=_(at),Z=v(Qt,2),de=_(Z);z(()=>{ln(Qt,"type",c(oe)?"text":"password"),W(de,c(oe)?"Hide":"Show")}),$("change",We,Ee),zt(Qt,()=>c(me),Ue=>m(me,Ue)),$("click",Z,()=>m(oe,!c(oe))),D(ne,se)};H(rt,ne=>{c(J)==="pem"?ne(lt):ne(Vt,-1)})}var Ot=v(rt,2);{var bi=ne=>{var se=nl(),re=_(se);z(()=>W(re,c(Ae))),D(ne,se)};H(Ot,ne=>{c(Ae)&&ne(bi)})}var U=v(Ot,2),M=_(U),O=v(M,2),ee=_(O);z(()=>{Xt=At(ui,1,"svelte-9auejo",null,Xt,{active:c(J)==="pem"}),Ge=At(pe,1,"svelte-9auejo",null,Ge,{active:c(J)==="p12"}),O.disabled=c(le),W(ee,c(le)?"Importing…":"Import")}),$("click",ui,()=>m(J,"pem")),$("click",pe,()=>m(J,"p12")),$("click",M,()=>m(j,!1)),$("click",O,ii),D(Be,je)};H(It,Be=>{c(j)&&Be(ie)})}var Ye=v(It,2);{var kt=Be=>{var je=_ee(),Kt=_(je),ri=v(_(Kt),4),ui=v(_(ri)),Xt=v(ui,2);ti(Xt,21,()=>c(mt),Hi,(O,ee)=>{var ne=QC(),se={};z(()=>{se!==(se=c(ee))&&(ne.value=(ne.__value=c(ee))??"")}),D(O,ne)});var pe=v(ri,2),Ge=v(_(pe)),rt=v(Ge,2);ti(rt,21,()=>c(Mt),Hi,(O,ee)=>{var ne=QC(),se={};z(()=>{se!==(se=c(ee))&&(ne.value=(ne.__value=c(ee))??"")}),D(O,ne)});var lt=v(pe,2);{var Vt=O=>{var ee=nl(),ne=_(ee);z(()=>W(ne,c(ve))),D(O,ee)};H(lt,O=>{c(ve)&&O(Vt)})}var Ot=v(lt,2),bi=_(Ot),U=v(bi,2),M=_(U);z(O=>{U.disabled=O,W(M,c(Ve)?"Installing…":"Install")},[()=>c(Ve)||!c(xe).trim()||!c(Ne).trim()]),$("input",ui,Jt),zt(ui,()=>c(xe),O=>m(xe,O)),$("input",Ge,zi),zt(Ge,()=>c(Ne),O=>m(Ne,O)),$("click",bi,()=>m(Te,!1)),$("click",U,Ii),D(Be,je)};H(Ye,Be=>{c(Te)&&Be(kt)})}var Pt=v(Ye,2);{var Bt=Be=>{var je=Eee(),Kt=_(je),ri=v(_(Kt),2),ui=_(ri);let Xt;var pe=v(ui,2);let Ge;var rt=v(ri,2);{var lt=Ot=>{var bi=bee(),U=Et(bi),M=v(_(U)),O=v(U,2);{var ee=We=>{var Ce=nl(),Pe=_(Ce);z(()=>W(Pe,c(si))),D(We,Ce)};H(O,We=>{c(si)&&We(ee)})}var ne=v(O,2),se=_(ne),re=v(se,2),Ie=_(re);z(We=>{re.disabled=We,W(Ie,c(Nt)?"Adding…":"Add CA cert")},[()=>c(Nt)||!c(be).trim()]),zt(M,()=>c(be),We=>m(be,We)),$("click",se,()=>m(ot,!1)),$("click",re,wn),D(Ot,bi)},Vt=Ot=>{var bi=Cee(),U=v(Et(bi),2),M=v(_(U)),O=v(M,2);ti(O,21,()=>c(tt),Hi,(Ce,Pe)=>{var Me=QC(),at={};z(()=>{at!==(at=c(Pe))&&(Me.value=(Me.__value=c(Pe))??"")}),D(Ce,Me)});var ee=v(U,2);{var ne=Ce=>{var Pe=nl(),Me=_(Pe);z(()=>W(Me,c(Yt))),D(Ce,Pe)};H(ee,Ce=>{c(Yt)&&Ce(ne)})}var se=v(ee,2),re=_(se),Ie=v(re,2),We=_(Ie);z(Ce=>{Ie.disabled=Ce,W(We,c(wt)?"Adding…":"Add CA cert")},[()=>c(wt)||!c(Xe).trim()]),$("input",M,Ji),zt(M,()=>c(Xe),Ce=>m(Xe,Ce)),$("click",re,()=>m(ot,!1)),$("click",Ie,cn),D(Ot,bi)};H(rt,Ot=>{c(yt)==="pem"?Ot(lt):Ot(Vt,-1)})}z(()=>{Xt=At(ui,1,"svelte-9auejo",null,Xt,{active:c(yt)==="pem"}),Ge=At(pe,1,"svelte-9auejo",null,Ge,{active:c(yt)==="path"})}),$("click",ui,()=>m(yt,"pem")),$("click",pe,()=>m(yt,"path")),D(Be,je)};H(Pt,Be=>{c(ot)&&Be(Bt)})}$("click",gi,fi),$("click",qt,()=>{m(r,!0),m(g,""),m(p,null)}),$("click",wi,()=>{m(C,!0),m(A,""),m(I,""),m(T,""),m(V,!1),m(P,"")}),$("click",ji,()=>{m(j,!0),m(Ae,""),m(J,"pem"),m(ae,""),m(fe,""),m(X,""),m(ce,""),m(me,""),m(oe,!1)}),$("click",Si,()=>{m(Te,!0),m(ve,""),m(xe,""),m(Ne,""),m(mt,[],!0),m(Mt,[],!0)}),$("click",li,()=>{m(ot,!0),m(si,""),m(be,""),m(yt,"pem"),m(Yt,""),m(Xe,""),m(tt,[],!0)}),D(o,Ut),Us()}Ys(["click","change","input"]);var Gx=B('<div class="err svelte-17yczfe"> </div>'),See=B('<div class="check-list svelte-17yczfe"><div class="check-row svelte-17yczfe"><span> </span> <code class="svelte-17yczfe">mosquitto_ctrl</code> <span> </span></div> <div class="check-row svelte-17yczfe"><span> </span> <code class="svelte-17yczfe">mosquitto</code> <span> </span></div></div>'),Dee=B('<div class="checking svelte-17yczfe">Checking…</div>'),Aee=B('<div class="section svelte-17yczfe"><h3 class="svelte-17yczfe">Tool availability</h3> <p class="hint svelte-17yczfe">These tools must be installed and in the PATH of the she process. They are used by the Setup Wizard and cert installation.</p> <!> <!> <div class="row svelte-17yczfe"><button class="svelte-17yczfe"> </button></div></div>'),kee=B('<label class="svelte-17yczfe">Install command (run locally) <div class="pubkey-row svelte-17yczfe"><input readonly="" class="svelte-17yczfe"/> <button class="copy-btn svelte-17yczfe">Copy</button></div></label>'),Bee=B('<label class="svelte-17yczfe">Public key <div class="pubkey-row svelte-17yczfe"><textarea readonly="" rows="3" class="svelte-17yczfe"></textarea> <button class="copy-btn svelte-17yczfe">Copy</button></div></label> <!> <div class="row svelte-17yczfe"><button class="svelte-17yczfe"> </button></div>',1),Fee=B('<div class="row svelte-17yczfe"><button class="svelte-17yczfe"> </button></div>'),Lee=B("<span> </span>"),Iee=B('<div class="section svelte-17yczfe"><h3 class="svelte-17yczfe">SSH connection</h3> <p class="hint svelte-17yczfe">Used for file operations: reading/writing mosquitto.conf and installing certificates on the broker host. User/ACL management always uses the MQTT port directly.</p> <div class="fields svelte-17yczfe"><label class="svelte-17yczfe">Host<input placeholder="192.168.1.10 or broker.local" class="svelte-17yczfe"/></label> <label class="svelte-17yczfe">Port<input type="number" min="1" max="65535" class="svelte-17yczfe"/></label> <label class="svelte-17yczfe">SSH user<input placeholder="root" class="svelte-17yczfe"/></label> <label class="svelte-17yczfe">Identity file (private key)<input class="svelte-17yczfe"/></label></div></div> <div class="section svelte-17yczfe"><h3 class="svelte-17yczfe">SSH keypair</h3> <p class="hint svelte-17yczfe">Dedicated Ed25519 keypair for she to authenticate to the broker host. Private key stored at <code class="svelte-17yczfe"> </code>.</p> <!> <!></div> <div class="section svelte-17yczfe"><h3 class="svelte-17yczfe">Test connection</h3> <div class="row svelte-17yczfe"><button class="svelte-17yczfe"> </button> <!></div></div>',1),Pee=B('<div class="ok svelte-17yczfe">Saved.</div>'),Tee=B('<div class="mosquitto-page svelte-17yczfe"><!> <div class="mode-bar svelte-17yczfe"><span class="mode-label svelte-17yczfe">Connection mode</span> <div class="mode-toggle svelte-17yczfe"><button>Local</button> <button>SSH / Remote</button></div> <span class="mode-desc svelte-17yczfe"> </span></div> <!> <!> <!> <!> <div class="row svelte-17yczfe"><button class="btn-primary svelte-17yczfe"> </button></div></div>');function Mee(o,e){$s(e,!0);let t=F(Li({})),i=F(""),n=F(!1),s=F(!1),r=F(""),a=F("~/.she/ssh/broker_id_ed25519"),d=F("local"),u=F(null),f=F(!1),g=F(""),p=F(""),C=F(!1),b=F(""),y=F(!1),w=F(""),A=F(Li({}));Xs(async()=>{try{const[tt,wt,Yt]=await Promise.all([Pl(),Pb(),fetch("/she/broker/ssh/pubkey").then(oi=>oi.json()).catch(()=>({publicKey:null}))]);m(A,tt,!0),wt.sshKeyDefault&&m(a,wt.sshKeyDefault,!0);const fi=c(A).broker??{};m(t,fi.ssh??{},!0),c(t).port||(c(t).port=22),c(t).identityFile||(c(t).identityFile=c(a)),Yt.publicKey&&m(p,Yt.publicKey,!0),m(d,c(t).host?"ssh":"local",!0),c(d)==="local"&&I()}catch(tt){m(i,tt.message,!0)}});async function I(){m(f,!0),m(g,"");try{m(u,await dU(),!0)}catch(tt){m(g,tt.message??"Check failed",!0)}finally{m(f,!1)}}async function T(){m(n,!0),m(r,""),m(s,!1);try{const tt=c(A).broker??{},wt=c(d)==="local"?{...c(t),host:""}:c(t),Yt={...c(A),broker:{...tt,ssh:wt}};await pp(Yt),m(s,!0),setTimeout(()=>m(s,!1),3e3)}catch(tt){m(r,tt.message,!0)}finally{m(n,!1)}}async function R(){m(C,!0),m(b,"");try{const tt=await fetch("/she/broker/ssh/keygen",{method:"POST",headers:{"Content-Type":"application/json"}}),wt=await tt.json();if(!tt.ok)throw new Error(wt.error??tt.statusText);m(p,wt.publicKey,!0)}catch(tt){m(b,tt.message,!0)}finally{m(C,!1)}}async function P(){m(y,!0),m(w,"");try{const tt=await fetch("/she/broker/ssh/test",{method:"POST",headers:{"Content-Type":"application/json"}}),wt=await tt.json();if(!tt.ok)throw new Error(wt.error??tt.statusText);m(w,wt.ok?"✓ Connection successful":"✗ "+(wt.error??"Failed"),!0)}catch(tt){m(w,"✗ "+tt.message)}finally{m(y,!1)}}function V(tt){navigator.clipboard.writeText(tt).catch(()=>{})}const j=Lt(()=>c(t).identityFile&&c(t).user&&c(t).host?`ssh-copy-id -i ${c(t).identityFile}.pub ${c(t).user}@${c(t).host}`:"");var J=Tee(),ae=_(J);{var fe=tt=>{var wt=Gx(),Yt=_(wt);z(()=>W(Yt,c(i))),D(tt,wt)};H(ae,tt=>{c(i)&&tt(fe)})}var X=v(ae,2),ce=v(_(X),2),me=_(ce);let oe;var le=v(me,2);let Ae;var Te=v(ce,2),xe=_(Te),Ne=v(X,2);{var Ve=tt=>{var wt=Aee(),Yt=v(_(wt),4);{var fi=Ci=>{var Jt=Gx(),zi=_(Jt);z(()=>W(zi,c(g))),D(Ci,Jt)};H(Yt,Ci=>{c(g)&&Ci(fi)})}var oi=v(Yt,2);{var ki=Ci=>{var Jt=See(),zi=_(Jt),Ji=_(zi);let Ii;var wn=_(Ji),cn=v(Ji,4);let pn;var fn=_(cn),pt=v(zi,2),Ut=_(pt);let Ni;var qi=_(Ut),gi=v(Ut,4);let Wi;var Ui=_(gi);z(()=>{Ii=At(Ji,1,"check-icon svelte-17yczfe",null,Ii,{ok:c(u).mosquittoCtrl,fail:!c(u).mosquittoCtrl}),W(wn,c(u).mosquittoCtrl?"✓":"✗"),pn=At(cn,1,"check-note svelte-17yczfe",null,pn,{ok:c(u).mosquittoCtrl,fail:!c(u).mosquittoCtrl}),W(fn,c(u).mosquittoCtrl?"found in PATH":"not found — install the mosquitto or mosquitto-clients package"),Ni=At(Ut,1,"check-icon svelte-17yczfe",null,Ni,{ok:c(u).mosquitto,fail:!c(u).mosquitto}),W(qi,c(u).mosquitto?"✓":"✗"),Wi=At(gi,1,"check-note svelte-17yczfe",null,Wi,{ok:c(u).mosquitto,fail:!c(u).mosquitto}),W(Ui,c(u).mosquitto?"found in PATH":"not found — install the mosquitto package")}),D(Ci,Jt)},_i=Ci=>{var Jt=Dee();D(Ci,Jt)};H(oi,Ci=>{c(u)?Ci(ki):c(f)&&Ci(_i,1)})}var Ze=v(oi,2),Ee=_(Ze),ii=_(Ee);z(()=>{Ee.disabled=c(f),W(ii,c(f)?"Checking…":c(u)?"Re-check":"Check tools")}),$("click",Ee,I),D(tt,wt)};H(Ne,tt=>{c(d)==="local"&&tt(Ve)})}var ve=v(Ne,2);{var mt=tt=>{var wt=Iee(),Yt=Et(wt),fi=v(_(Yt),4),oi=_(fi),ki=v(_(oi)),_i=v(oi,2),Ze=v(_(_i)),Ee=v(_i,2),ii=v(_(Ee)),Ci=v(Ee,2),Jt=v(_(Ci)),zi=v(Yt,2),Ji=v(_(zi),2),Ii=v(_(Ji)),wn=_(Ii),cn=v(Ji,2);{var pn=yi=>{var Vi=Bee(),ze=Et(Vi),qt=v(_(ze)),wi=_(qt),ji=v(wi,2),Si=v(ze,2);{var K=Gt=>{var li=kee(),vt=v(_(li)),ft=_(vt),Y=v(ft,2);z(()=>B1(ft,c(j))),$("click",Y,()=>V(c(j))),D(Gt,li)};H(Si,Gt=>{c(j)&&Gt(K)})}var De=v(Si,2),Qe=_(De),it=_(Qe);z(()=>{B1(wi,c(p)),Qe.disabled=c(C),W(it,c(C)?"Generating…":"Regenerate keypair")}),$("click",ji,()=>V(c(p))),$("click",Qe,R),D(yi,Vi)},fn=yi=>{var Vi=Fee(),ze=_(Vi),qt=_(ze);z(()=>{ze.disabled=c(C),W(qt,c(C)?"Generating…":"Generate keypair")}),$("click",ze,R),D(yi,Vi)};H(cn,yi=>{c(p)?yi(pn):yi(fn,-1)})}var pt=v(cn,2);{var Ut=yi=>{var Vi=Gx(),ze=_(Vi);z(()=>W(ze,c(b))),D(yi,Vi)};H(pt,yi=>{c(b)&&yi(Ut)})}var Ni=v(zi,2),qi=v(_(Ni),2),gi=_(qi),Wi=_(gi),Ui=v(gi,2);{var tn=yi=>{var Vi=Lee();let ze;var qt=_(Vi);z(wi=>{ze=At(Vi,1,"test-result svelte-17yczfe",null,ze,wi),W(qt,c(w))},[()=>({ok:c(w).startsWith("✓"),fail:c(w).startsWith("✗")})]),D(yi,Vi)};H(Ui,yi=>{c(w)&&yi(tn)})}z(()=>{ln(Jt,"placeholder",c(a)),W(wn,c(t).identityFile||c(a)),gi.disabled=c(y)||!c(t).host,W(Wi,c(y)?"Testing…":"Test SSH connection")}),zt(ki,()=>c(t).host,yi=>c(t).host=yi),zt(Ze,()=>c(t).port,yi=>c(t).port=yi),zt(ii,()=>c(t).user,yi=>c(t).user=yi),zt(Jt,()=>c(t).identityFile,yi=>c(t).identityFile=yi),$("click",gi,P),D(tt,wt)};H(ve,tt=>{c(d)==="ssh"&&tt(mt)})}var Mt=v(ve,2);{var ot=tt=>{var wt=Gx(),Yt=_(wt);z(()=>W(Yt,c(r))),D(tt,wt)};H(Mt,tt=>{c(r)&&tt(ot)})}var yt=v(Mt,2);{var be=tt=>{var wt=Pee();D(tt,wt)};H(yt,tt=>{c(s)&&tt(be)})}var Nt=v(yt,2),si=_(Nt),Xe=_(si);z(()=>{oe=At(me,1,"svelte-17yczfe",null,oe,{active:c(d)==="local"}),Ae=At(le,1,"svelte-17yczfe",null,Ae,{active:c(d)==="ssh"}),W(xe,c(d)==="local"?"she and mosquitto run on the same machine — local filesystem access":"mosquitto runs on a remote host — file operations go through SSH"),si.disabled=c(n),W(Xe,c(n)?"Saving…":"Save")}),$("click",me,()=>{m(d,"local"),c(u)||I()}),$("click",le,()=>m(d,"ssh")),$("click",si,T),D(o,J),Us()}Ys(["click"]);var Ree=B("<button> </button>"),Nee=B('<code>log_dest topic</code> is not enabled in mosquitto.conf.<br/> <span class="hint svelte-1yc29ow">Enable it in the <strong>Config</strong> tab, then click <em>Apply &amp; Reload</em>.</span>',1),Oee=B('<code>log_dest topic</code> is configured — waiting for messages&hellip;<br/> <span class="hint svelte-1yc29ow">If nothing appears, mosquitto may need a full restart for the change to take effect.</span>',1),Hee=B('Waiting for log messages&hellip;<br/> <span class="hint svelte-1yc29ow">Make sure <code class="svelte-1yc29ow">log_dest topic</code> is set in mosquitto.conf.</span>',1),Wee=B('<div class="empty svelte-1yc29ow"><!></div>'),zee=B('<div class="entry svelte-1yc29ow"><span class="ts svelte-1yc29ow"> </span> <span> </span> <span class="msg svelte-1yc29ow"> </span></div>'),Vee=B('<div class="logs-page svelte-1yc29ow"><div class="toolbar svelte-1yc29ow"><div class="level-filters svelte-1yc29ow"></div> <div class="spacer svelte-1yc29ow"></div> <label class="autoscroll-label svelte-1yc29ow"><input type="checkbox" class="svelte-1yc29ow"/> <span class="checkmark svelte-1yc29ow"></span> Auto-scroll</label> <button class="btn-clear svelte-1yc29ow">Clear</button></div> <div class="log-container svelte-1yc29ow"><!></div></div>');function jee(o,e){$s(e,!0);const t={D:"DBG",I:"INF",N:"NTC",W:"WRN",E:"ERR"},i={D:"lvl-d",I:"lvl-i",N:"lvl-n",W:"lvl-w",E:"lvl-e"},n=new Set(["D","I","N","W","E"]);let s=F(Li([])),r=F(!0),a=F(Li(new Set(["D","I","N","W","E"]))),d=F(void 0),u=F(!1),f=F(null),g=null;Xs(async()=>{const X=await hU().catch(()=>[]),ce=KU(),me=new Set,oe=[...X,...ce].filter(le=>n.has(le.level)).map(le=>({ts:le.ts,level:le.level,msg:le.msg}));oe.sort((le,Ae)=>le.ts-Ae.ts),m(s,oe.filter(le=>{const Ae=`${le.ts}\0${le.msg}`;return me.has(Ae)?!1:(me.add(Ae),!0)}).slice(-500),!0),c(s).length>0&&(m(u,!0),hl().then(p)),g=Xo("brokerLog",le=>{n.has(le.level)&&(m(u,!0),m(s,[...c(s).slice(-499),{ts:le.ts,level:le.level,msg:le.msg}],!0),c(r)&&hl().then(p))}),dS().then(le=>{const Ae=le.managed.log_dest,Te=Array.isArray(Ae)?Ae:Ae?[Ae]:[];m(f,Te.includes("topic"),!0)}).catch(()=>{m(f,null)})}),Vp(()=>{g==null||g()});function p(){c(d)&&(c(d).scrollTop=c(d).scrollHeight)}function C(X){const ce=new Set(c(a));ce.has(X)?ce.delete(X):ce.add(X),m(a,ce,!0)}function b(){m(s,[],!0),m(u,!1)}let y=Lt(()=>c(s).filter(X=>c(a).has(X.level)));function w(X){const ce=new Date(X);return ce.toTimeString().slice(0,8)+"."+String(ce.getMilliseconds()).padStart(3,"0")}var A=Vee(),I=_(A),T=_(I);ti(T,20,()=>["D","I","N","W","E"],Hi,(X,ce)=>{var me=Ree();let oe;var le=_(me);z(Ae=>{oe=At(me,1,`lvl-btn ${i[ce]??""}`,"svelte-1yc29ow",oe,Ae),ln(me,"title",`Toggle ${ce??""} messages`),W(le,t[ce])},[()=>({active:c(a).has(ce)})]),$("click",me,()=>C(ce)),D(X,me)});var R=v(T,4),P=_(R),V=v(R,2),j=v(I,2),J=_(j);{var ae=X=>{var ce=Wee(),me=_(ce);{var oe=Ae=>{var Te=Ss(),xe=Et(Te);{var Ne=mt=>{var Mt=Nee();D(mt,Mt)},Ve=mt=>{var Mt=Oee();D(mt,Mt)},ve=mt=>{var Mt=Hee();D(mt,Mt)};H(xe,mt=>{c(f)===!1?mt(Ne):c(f)===!0?mt(Ve,1):mt(ve,-1)})}D(Ae,Te)},le=Ae=>{var Te=oo("No messages match the current filter.");D(Ae,Te)};H(me,Ae=>{c(u)?Ae(le,-1):Ae(oe)})}D(X,ce)},fe=X=>{var ce=Ss(),me=Et(ce);ti(me,17,()=>c(y),oe=>oe.ts+oe.msg,(oe,le)=>{var Ae=zee(),Te=_(Ae),xe=_(Te),Ne=v(Te,2),Ve=_(Ne),ve=v(Ne,2),mt=_(ve);z(Mt=>{W(xe,Mt),At(Ne,1,`badge ${i[c(le).level]??""}`,"svelte-1yc29ow"),W(Ve,t[c(le).level]),W(mt,c(le).msg)},[()=>w(c(le).ts)]),D(oe,Ae)}),D(X,ce)};H(J,X=>{c(y).length===0?X(ae):X(fe,-1)})}gs(j,X=>m(d,X),()=>c(d)),ws(P,()=>c(r),X=>m(r,X)),$("click",V,b),D(o,A),Us()}Ys(["click"]);var $ee=B('<div class="err svelte-d31be1"> </div>'),Uee=B('<div class="step svelte-d31be1"><p class="svelte-d31be1">This wizard will configure the <strong>Mosquitto Dynamic Security plugin</strong> for use with she. It will:</p> <ul class="svelte-d31be1"><li>Create a <code class="svelte-d31be1">she-admin</code> service account with a random strong password.</li> <li>Write <code class="svelte-d31be1">dynamic-security.json</code> to your mosquitto config directory.</li> <li>Add the <code class="svelte-d31be1">plugin</code> line to <code class="svelte-d31be1">mosquitto.conf</code>.</li> <li>Ask you to restart mosquitto to activate the plugin.</li></ul> <p class="hint svelte-d31be1">In <strong>remote mode</strong> (SSH host configured), <code class="svelte-d31be1">mosquitto_ctrl</code> is invoked on the broker host via SSH. In local mode, it must be installed on this machine. <code class="svelte-d31be1">mosquitto_ctrl</code> is part of the <code class="svelte-d31be1">mosquitto</code> package.</p> <div class="actions svelte-d31be1"><button class="svelte-d31be1">Start</button></div></div>'),qee=B('<div class="step svelte-d31be1"><p class="svelte-d31be1"> </p></div>'),Gee=B('<div class="step svelte-d31be1"><p class="svelte-d31be1">dynsec is not yet active. Configure bootstrap settings:</p> <label class="svelte-d31be1">Admin username<input class="svelte-d31be1"/></label> <label class="svelte-d31be1">Admin password<input type="password" placeholder="(leave blank to auto-generate)" class="svelte-d31be1"/></label> <label class="svelte-d31be1">Mosquitto config directory<input class="svelte-d31be1"/></label> <div class="actions svelte-d31be1"><button class="svelte-d31be1"> </button></div></div>'),Kee=B('<p class="hint svelte-d31be1">Restarting mosquitto… this may take a few seconds.</p>'),Zee=B(`<div class="step svelte-d31be1"><div class="ok-banner svelte-d31be1">✓ dynsec files written and credentials saved.</div> <p class="svelte-d31be1">The <code class="svelte-d31be1">plugin</code> line has been added to <code class="svelte-d31be1"> </code>.</p> <p class="svelte-d31be1">Enabling a new plugin requires a <strong>full mosquitto restart</strong> (not just SIGHUP):</p> <div class="actions svelte-d31be1"><button class="btn-warn svelte-d31be1"> </button> <button class="skip-step svelte-d31be1">Skip (I'll restart manually)</button></div> <!></div>`),Xee=B('<div class="step svelte-d31be1"><div class="ok-banner svelte-d31be1">✓ dynsec is configured and connected.</div> <p class="svelte-d31be1">she is now managing broker users and ACLs via the Dynamic Security plugin. You can use the <strong>Users & Roles</strong> tab to add users, create roles, and define ACL rules.</p> <div class="actions svelte-d31be1"><button class="btn-primary svelte-d31be1">Done</button></div></div>'),Yee=B('<div class="step svelte-d31be1"><p class="svelte-d31be1">Enter the credentials of an existing dynsec admin account:</p> <label class="svelte-d31be1">Admin username<input class="svelte-d31be1"/></label> <label class="svelte-d31be1">Admin password<input type="password" class="svelte-d31be1"/></label> <div class="actions svelte-d31be1"><button class="svelte-d31be1">Back</button> <button class="btn-primary svelte-d31be1"> </button></div></div>'),Qee=B('<div class="wizard svelte-d31be1"><div class="wizard-header svelte-d31be1"><h3 class="svelte-d31be1">dynsec Setup Wizard</h3> <button class="skip-btn svelte-d31be1">Manual setup instead</button></div> <!> <!></div>');function Jee(o,e){$s(e,!0);let t=F("intro"),i=F(""),n=F(!1),s=F("she-admin"),r=F(""),a=F("/etc/mosquitto"),d=F(null),u=F(!1),f=F(!1),g=F("she-admin"),p=F(""),C=F(!1);async function b(){m(n,!0),m(i,"");try{(await(await fetch("/she/broker/wizard/probe",{method:"POST",headers:{"Content-Type":"application/json"}})).json()).active?m(t,"done"):m(t,"config")}catch(oe){m(i,oe.message,!0)}finally{m(n,!1)}}async function y(){m(n,!0),m(i,"");try{const oe=await fetch("/she/broker/wizard/bootstrap",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({adminUsername:c(s),adminPassword:c(r)||void 0,configDir:c(a)})}),le=await oe.json();if(!oe.ok||!le.ok)throw new Error(le.error??"Bootstrap failed");m(d,le,!0);const Ae=await Pl(),Te=Ae.broker??{};await pp({...Ae,broker:{...Te,dynsec:{adminUsername:le.adminUsername,adminPassword:le.adminPassword}}}),await pU().catch(()=>{}),m(t,"restart")}catch(oe){m(i,oe.message,!0)}finally{m(n,!1)}}async function w(){m(f,!0),m(i,"");try{await fU(),await new Promise(oe=>setTimeout(oe,2e3)),m(u,!0),m(t,"done")}catch(oe){m(i,oe.message,!0)}finally{m(f,!1)}}async function A(){m(C,!0),m(i,"");try{const oe=await Pl(),le=oe.broker??{};await pp({...oe,broker:{...le,dynsec:{adminUsername:c(g),adminPassword:c(p)}}}),m(t,"done")}catch(oe){m(i,oe.message,!0)}finally{m(C,!1)}}var I=Qee(),T=_(I),R=v(_(T),2),P=v(T,2);{var V=oe=>{var le=$ee(),Ae=_(le);z(()=>W(Ae,c(i))),D(oe,le)};H(P,oe=>{c(i)&&oe(V)})}var j=v(P,2);{var J=oe=>{var le=Uee(),Ae=v(_(le),6),Te=_(Ae);z(()=>Te.disabled=c(n)),$("click",Te,()=>{m(t,"probe"),b()}),D(oe,le)},ae=oe=>{var le=qee(),Ae=_(le),Te=_(Ae);z(()=>W(Te,c(n)?"Probing dynsec…":"Checking dynsec status…")),D(oe,le)},fe=oe=>{var le=Gee(),Ae=v(_(le),2),Te=v(_(Ae)),xe=v(Ae,2),Ne=v(_(xe)),Ve=v(xe,2),ve=v(_(Ve)),mt=v(Ve,2),Mt=_(mt),ot=_(Mt);z(()=>{Mt.disabled=c(n)||!c(s),W(ot,c(n)?"Bootstrapping…":"Bootstrap dynsec")}),zt(Te,()=>c(s),yt=>m(s,yt)),zt(Ne,()=>c(r),yt=>m(r,yt)),zt(ve,()=>c(a),yt=>m(a,yt)),$("click",Mt,y),D(oe,le)},X=oe=>{var le=Zee(),Ae=v(_(le),2),Te=v(_(Ae),3),xe=_(Te),Ne=v(Ae,4),Ve=_(Ne),ve=_(Ve),mt=v(Ve,2),Mt=v(Ne,2);{var ot=yt=>{var be=Kee();D(yt,be)};H(Mt,yt=>{c(f)&&yt(ot)})}z(()=>{W(xe,c(d).confFilePath),Ve.disabled=c(f),W(ve,c(f)?"Restarting…":"Restart mosquitto now")}),$("click",Ve,w),$("click",mt,()=>{m(t,"done")}),D(oe,le)},ce=oe=>{var le=Xee(),Ae=v(_(le),4),Te=_(Ae);$("click",Te,function(...xe){var Ne;(Ne=e.onDone)==null||Ne.apply(this,xe)}),D(oe,le)},me=oe=>{var le=Yee(),Ae=v(_(le),2),Te=v(_(Ae)),xe=v(Ae,2),Ne=v(_(xe)),Ve=v(xe,2),ve=_(Ve),mt=v(ve,2),Mt=_(mt);z(()=>{mt.disabled=c(C)||!c(g)||!c(p),W(Mt,c(C)?"Saving…":"Save credentials")}),zt(Te,()=>c(g),ot=>m(g,ot)),zt(Ne,()=>c(p),ot=>m(p,ot)),$("click",ve,()=>m(t,"intro")),$("click",mt,A),D(oe,le)};H(j,oe=>{c(t)==="intro"?oe(J):c(t)==="probe"?oe(ae,1):c(t)==="config"?oe(fe,2):c(t)==="restart"&&c(d)?oe(X,3):c(t)==="done"?oe(ce,4):c(t)==="manual"&&oe(me,5)})}$("click",R,()=>m(t,"manual")),D(o,I),Us()}Ys(["click"]);var ete=B('<div class="loading svelte-zuhcpo">Loading…</div>'),tte=B('<div class="error-banner svelte-zuhcpo"> </div>'),ite=B('<div class="conn-row svelte-zuhcpo"><span></span> <span class="conn-name svelte-zuhcpo">dynamic security</span> <span><!></span> <button class="btn-deactivate svelte-zuhcpo"> </button></div>'),nte=B('<button class="btn-wizard-inline svelte-zuhcpo">Setup Wizard ↗</button>'),ste=B('<div class="conn-row svelte-zuhcpo"><span class="dot dot-off svelte-zuhcpo"></span> <span class="conn-name svelte-zuhcpo">dynamic security</span> <span class="conn-detail muted svelte-zuhcpo">not configured</span> <!></div>'),ote=B('<div class="error-inline svelte-zuhcpo"> </div>'),rte=B('<button class="diag-btn svelte-zuhcpo"> </button>'),eA=B('<p class="diag-issue svelte-zuhcpo"> </p>'),ate=B('<p class="diag-ok-msg svelte-zuhcpo">✓ dynamic-security.json looks correct. Verify mosquitto restarted with the plugin loaded.</p>'),lte=B('<p class="diag-row svelte-zuhcpo"><span class="svelte-zuhcpo">File</span><code class="svelte-zuhcpo"> </code></p> <p class="diag-row svelte-zuhcpo"><span class="svelte-zuhcpo">Admin user exists</span><span> </span></p> <p class="diag-row svelte-zuhcpo"><span class="svelte-zuhcpo">Has admin role</span><span> </span></p> <p class="diag-row svelte-zuhcpo"><span class="svelte-zuhcpo">$CONTROL publish ACL</span><span> </span></p> <!> <!>',1),cte=B('<div><!></div> <button class="diag-btn svelte-zuhcpo" style="margin-top:6px"> </button>',1),dte=B('<button class="wizard-btn svelte-zuhcpo">Run Setup Wizard</button>'),ute=B('<div class="diag-area svelte-zuhcpo"><!> <!></div>'),hte=B('<div class="stats-block svelte-zuhcpo"><dl class="svelte-zuhcpo"><dt class="svelte-zuhcpo">Version</dt><dd class="svelte-zuhcpo"> </dd> <dt class="svelte-zuhcpo">Uptime</dt><dd class="svelte-zuhcpo"> </dd> <dt class="svelte-zuhcpo">Clients</dt><dd class="svelte-zuhcpo"> </dd> <dt class="svelte-zuhcpo">Messages</dt><dd class="svelte-zuhcpo"> </dd> <dt class="svelte-zuhcpo">Topics</dt><dd class="svelte-zuhcpo"> </dd> <dt class="svelte-zuhcpo">Traffic</dt><dd class="svelte-zuhcpo"> </dd></dl></div>'),fte=B('<div style="margin-top: 20px;"><!></div>'),gte=B('<div class="status-layout svelte-zuhcpo"><div class="conn-block svelte-zuhcpo"><div class="conn-row svelte-zuhcpo"><span class="dot ok svelte-zuhcpo"></span> <span class="conn-name svelte-zuhcpo">mosquitto</span> <span class="conn-detail svelte-zuhcpo"> </span></div> <!> <!></div> <!> <!></div> <!>',1),pte=B('<div class="tab-content svelte-zuhcpo"><!></div>'),xte=B('<div class="broker-page svelte-zuhcpo"><div class="sub-nav svelte-zuhcpo"><button>Status</button> <button>Directory</button> <button>Config</button> <button>Listeners</button> <button>Certificates</button> <button>Connection</button> <button>Logs</button></div> <!></div> <!>',1);function mte(o,e){$s(e,!0);let t=F(!1),i,n=F(!1),s=F(""),r=F(!1),a=F(null);const d="she-broker-tab";let u=F(Li(localStorage.getItem(d)??"status"));Kn(()=>{localStorage.setItem(d,c(u))});let f=F(null),g=F(""),p=F(!0);async function C(){try{m(f,await Pb(),!0),m(g,"")}catch(Xe){m(g,Xe.message??"Failed to load broker status",!0)}finally{m(p,!1)}}Xs(()=>{C();const Xe=setInterval(C,1e4);return()=>clearInterval(Xe)});async function b(){m(r,!0),m(a,null);try{m(a,await xU(),!0)}catch(Xe){m(a,{ok:!1,dynSecPath:"",issues:[Xe.message??"Diagnose request failed"]},!0)}finally{m(r,!1)}}async function y(){if(await i.show("Remove dynsec plugin lines from mosquitto.conf and clear credentials? You will need to restart mosquitto afterwards.",{confirm:"Deactivate",danger:!0})){m(n,!0),m(s,"");try{await gU(),await C()}catch(Xe){m(s,Xe.message??"Deactivate failed",!0)}finally{m(n,!1)}}}function w(Xe){var wt;if(!((wt=c(f))!=null&&wt.sys))return"—";const tt=c(f).sys[Xe];return tt?String(tt.val??"—"):"—"}function A(Xe){if(Xe==="—")return Xe;const tt=Xe.match(/^(\d+)/),wt=tt?parseInt(tt[1]):NaN;if(isNaN(wt))return Xe;const Yt=Math.floor(wt/86400),fi=Math.floor(wt%86400/3600),oi=Math.floor(wt%3600/60),ki=wt%60,_i=Ze=>String(Ze).padStart(2,"0");return Yt>0?`${Yt}d ${_i(fi)}:${_i(oi)}:${_i(ki)}`:`${_i(fi)}:${_i(oi)}:${_i(ki)}`}function I(Xe){if(Xe==="—")return Xe;const tt=parseInt(Xe);return isNaN(tt)?Xe:tt<1024?`${tt} B`:tt<1048576?`${(tt/1024).toFixed(1)} KB`:tt<1073741824?`${(tt/1048576).toFixed(1)} MB`:`${(tt/1073741824).toFixed(1)} GB`}var T=xte(),R=Et(T),P=_(R),V=_(P);let j;var J=v(V,2);let ae;var fe=v(J,2);let X;var ce=v(fe,2);let me;var oe=v(ce,2);let le;var Ae=v(oe,2);let Te;var xe=v(Ae,2);let Ne;var Ve=v(P,2);{var ve=Xe=>{var tt=pte(),wt=_(tt);{var Yt=ki=>{var _i=ete();D(ki,_i)},fi=ki=>{var _i=tte(),Ze=_(_i);z(()=>W(Ze,c(g))),D(ki,_i)},oi=ki=>{var _i=gte(),Ze=Et(_i),Ee=_(Ze),ii=_(Ee),Ci=v(_(ii),4),Jt=_(Ci),zi=v(ii,2);{var Ji=Wi=>{var Ui=ite(),tn=_(Ui);let yi;var Vi=v(tn,4);let ze;var qt=_(Vi);{var wi=Qe=>{var it=oo("plugin active");D(Qe,it)},ji=Qe=>{var it=oo("connected — plugin not responding");D(Qe,it)},Si=Qe=>{var it=oo("disconnected");D(Qe,it)};H(qt,Qe=>{c(f).dynsec.dynsecReady?Qe(wi):c(f).dynsec.connected?Qe(ji,1):Qe(Si,-1)})}var K=v(Vi,2),De=_(K);z(()=>{yi=At(tn,1,"dot svelte-zuhcpo",null,yi,{ok:c(f).dynsec.dynsecReady,warn:c(f).dynsec.connected&&!c(f).dynsec.dynsecReady,"dot-err":!c(f).dynsec.connected}),ze=At(Vi,1,"conn-detail svelte-zuhcpo",null,ze,{ok:c(f).dynsec.dynsecReady,warn:c(f).dynsec.connected&&!c(f).dynsec.dynsecReady,err:!c(f).dynsec.connected}),K.disabled=c(n),W(De,c(n)?"…":"deactivate")}),$("click",K,y),D(Wi,Ui)},Ii=Wi=>{var Ui=ste(),tn=v(_(Ui),6);{var yi=Vi=>{var ze=nte();$("click",ze,()=>m(t,!0)),D(Vi,ze)};H(tn,Vi=>{c(t)||Vi(yi)})}D(Wi,Ui)};H(zi,Wi=>{c(f).dynsec.configured?Wi(Ji):Wi(Ii,-1)})}var wn=v(zi,2);{var cn=Wi=>{var Ui=ote(),tn=_(Ui);z(()=>W(tn,c(s))),D(Wi,Ui)};H(wn,Wi=>{c(s)&&Wi(cn)})}var pn=v(Ee,2);{var fn=Wi=>{var Ui=ute(),tn=_(Ui);{var yi=wi=>{var ji=rte(),Si=_(ji);z(()=>{ji.disabled=c(r),W(Si,c(r)?"Running diagnostics…":"Run diagnostics")}),$("click",ji,b),D(wi,ji)},Vi=wi=>{var ji=cte(),Si=Et(ji);let K;var De=_(Si);{var Qe=vt=>{var ft=eA(),Y=_(ft);z(()=>W(Y,`⚠ ${c(a).error??""}`)),D(vt,ft)},it=vt=>{var ft=lte(),Y=Et(ft),Re=v(_(Y)),dt=_(Re),ye=v(Y,2),ci=v(_(ye)),It=_(ci),ie=v(ye,2),Ye=v(_(ie)),kt=_(Ye),Pt=v(ie,2),Bt=v(_(Pt)),Be=_(Bt),je=v(Pt,2);ti(je,17,()=>c(a).issues,Hi,(ui,Xt)=>{var pe=eA(),Ge=_(pe);z(()=>W(Ge,`⚠ ${c(Xt)??""}`)),D(ui,pe)});var Kt=v(je,2);{var ri=ui=>{var Xt=ate();D(ui,Xt)};H(Kt,ui=>{c(a).ok&&ui(ri)})}z(()=>{W(dt,c(a).dynSecPath),At(ci,1,hg(c(a).adminClientExists?"ok":"fail"),"svelte-zuhcpo"),W(It,c(a).adminClientExists?"✓ yes":"✗ no"),At(Ye,1,hg(c(a).hasAdminRole?"ok":"fail"),"svelte-zuhcpo"),W(kt,c(a).hasAdminRole?"✓ yes":"✗ no"),At(Bt,1,hg(c(a).hasControlSendAcl?"ok":"fail"),"svelte-zuhcpo"),W(Be,c(a).hasControlSendAcl?"✓ present":"✗ missing")}),D(vt,ft)};H(De,vt=>{c(a).error?vt(Qe):vt(it,-1)})}var Gt=v(Si,2),li=_(Gt);z(()=>{K=At(Si,1,"diag-card svelte-zuhcpo",null,K,{"diag-ok":c(a).ok,"diag-fail":!c(a).ok}),Gt.disabled=c(r),W(li,c(r)?"Running…":"Re-run")}),$("click",Gt,b),D(wi,ji)};H(tn,wi=>{c(a)?wi(Vi,-1):wi(yi)})}var ze=v(tn,2);{var qt=wi=>{var ji=dte();$("click",ji,()=>m(t,!0)),D(wi,ji)};H(ze,wi=>{c(t)||wi(qt)})}D(Wi,Ui)};H(pn,Wi=>{c(f).dynsec.configured&&c(f).dynsec.connected&&!c(f).dynsec.dynsecReady&&Wi(fn)})}var pt=v(pn,2);{var Ut=Wi=>{var Ui=hte(),tn=_(Ui),yi=v(_(tn)),Vi=_(yi),ze=v(yi,3),qt=_(ze),wi=v(ze,3),ji=_(wi),Si=v(wi,3),K=_(Si),De=v(Si,3),Qe=_(De),it=v(De,3),Gt=_(it);z((li,vt,ft,Y,Re,dt,ye,ci,It,ie,Ye,kt)=>{W(Vi,li),W(qt,vt),W(ji,`${ft??""} connected · ${Y??""} max · ${Re??""} total`),W(K,`${dt??""} rcv · ${ye??""} sent · ${ci??""} stored`),W(Qe,`${It??""} retained · ${ie??""} subscriptions`),W(Gt,`${Ye??""} in · ${kt??""} out`)},[()=>w("$SYS/broker/version"),()=>A(w("$SYS/broker/uptime")),()=>w("$SYS/broker/clients/connected"),()=>w("$SYS/broker/clients/maximum"),()=>w("$SYS/broker/clients/total"),()=>w("$SYS/broker/messages/received"),()=>w("$SYS/broker/messages/sent"),()=>w("$SYS/broker/messages/stored"),()=>w("$SYS/broker/retained messages/count"),()=>w("$SYS/broker/subscriptions/count"),()=>I(w("$SYS/broker/bytes/received")),()=>I(w("$SYS/broker/bytes/sent"))]),D(Wi,Ui)},Ni=Lt(()=>Object.keys(c(f).sys).length>0);H(pt,Wi=>{c(Ni)&&Wi(Ut)})}var qi=v(Ze,2);{var gi=Wi=>{var Ui=fte(),tn=_(Ui);Jee(tn,{onDone:()=>{m(t,!1),C()}}),D(Wi,Ui)};H(qi,Wi=>{c(t)&&(!c(f).dynsec.configured||!c(f).dynsec.dynsecReady)&&Wi(gi)})}z(()=>W(Jt,c(f).sshConfigured?`ssh — ${c(f).sshHost}`:"local")),D(ki,_i)};H(wt,ki=>{c(p)?ki(Yt):c(g)?ki(fi,1):c(f)&&ki(oi,2)})}D(Xe,tt)},mt=Xe=>{{let tt=Lt(()=>{var wt;return((wt=c(f))==null?void 0:wt.dynsec.dynsecReady)??!1});NJ(Xe,{get dynsecReady(){return c(tt)}})}},Mt=Xe=>{nee(Xe,{})},ot=Xe=>{YJ(Xe,{})},yt=Xe=>{wee(Xe,{})},be=Xe=>{Mee(Xe,{})},Nt=Xe=>{jee(Xe,{})};H(Ve,Xe=>{c(u)==="status"?Xe(ve):c(u)==="users"?Xe(mt,1):c(u)==="brokerconfig"?Xe(Mt,2):c(u)==="listeners"?Xe(ot,3):c(u)==="certs"?Xe(yt,4):c(u)==="ssh"?Xe(be,5):c(u)==="logs"&&Xe(Nt,6)})}var si=v(R,2);gs(Yc(si,{}),Xe=>i=Xe,()=>i),z(()=>{j=At(V,1,"svelte-zuhcpo",null,j,{active:c(u)==="status"}),ae=At(J,1,"svelte-zuhcpo",null,ae,{active:c(u)==="users"}),X=At(fe,1,"svelte-zuhcpo",null,X,{active:c(u)==="brokerconfig"}),me=At(ce,1,"svelte-zuhcpo",null,me,{active:c(u)==="listeners"}),le=At(oe,1,"svelte-zuhcpo",null,le,{active:c(u)==="certs"}),Te=At(Ae,1,"svelte-zuhcpo",null,Te,{active:c(u)==="ssh"}),Ne=At(xe,1,"svelte-zuhcpo",null,Ne,{active:c(u)==="logs"})}),$("click",V,()=>m(u,"status")),$("click",J,()=>m(u,"users")),$("click",fe,()=>m(u,"brokerconfig")),$("click",ce,()=>m(u,"listeners")),$("click",oe,()=>m(u,"certs")),$("click",Ae,()=>m(u,"ssh")),$("click",xe,()=>m(u,"logs")),D(o,T),Us()}Ys(["click"]);var vte=B('<span class="nav-dot nav-dot--warn svelte-1n46o8q"></span>'),_te=B('<span class="nav-dot nav-dot--err svelte-1n46o8q" title="MQTT broker not connected"></span>'),bte=B('<span class="nav-dot nav-dot--warn nav-dot--blink svelte-1n46o8q" title="Waiting for retained MQTT state"></span>'),Cte=B('<span class="nav-dot nav-dot--ok svelte-1n46o8q" title="MQTT connected"></span>'),Ete=B('<button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="svelte-1n46o8q"><circle cx="8" cy="10" r="2" class="svelte-1n46o8q"></circle><path d="M5,7 A4,4 0,0,1 11,7" class="svelte-1n46o8q"></path><path d="M3,5 A6.5,6.5 0,0,1 13,5" class="svelte-1n46o8q"></path><line x1="8" y1="12" x2="8" y2="15" class="svelte-1n46o8q"></line></svg> Broker</button>'),yte=B('<span class="nav-dot nav-dot--ok svelte-1n46o8q" title="All Matter devices online"></span>'),wte=B('<span class="nav-dot nav-dot--warn svelte-1n46o8q" title="Some Matter devices offline"></span>'),Ste=B('<span class="nav-dot nav-dot--err svelte-1n46o8q" title="No Matter devices online"></span>'),Dte=B('<button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" class="svelte-1n46o8q"><path d="M8,2 L8,7" class="svelte-1n46o8q"></path><path d="M6,5 L8,7.5 L10,5" class="svelte-1n46o8q"></path><path d="M2.5,14 L6,10" class="svelte-1n46o8q"></path><path d="M6.2,12.8 L6,10 L3.2,10.2" class="svelte-1n46o8q"></path><path d="M13.5,14 L10,10" class="svelte-1n46o8q"></path><path d="M9.8,12.8 L10,10 L12.8,10.2" class="svelte-1n46o8q"></path></svg> Matter <!></button>'),Ate=B('<button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="svelte-1n46o8q"><ellipse cx="8" cy="4.5" rx="5" ry="1.8" class="svelte-1n46o8q"></ellipse><path d="M3,4.5 v7 a5,1.8 0,0,0 10,0 v-7" class="svelte-1n46o8q"></path><path d="M3,8 a5,1.8 0,0,0 10,0" class="svelte-1n46o8q"></path></svg> DB</button>'),kte=B('<span class="nav-dot nav-dot--err svelte-1n46o8q" title="Errors in recent logs"></span>'),Bte=B('<span class="nav-dot nav-dot--warn svelte-1n46o8q" title="Warnings in recent logs"></span>'),Fte=B('<span class="update-dot svelte-1n46o8q" title="Update available"></span>'),Lte=B('<dt class="svelte-1n46o8q">Latest</dt><dd style="color: #f90" class="svelte-1n46o8q"> </dd>',1),Ite=B('<dt class="svelte-1n46o8q">Latest</dt><dd class="svelte-1n46o8q">up to date</dd>',1),Pte=B('<button class="svelte-1n46o8q"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-1n46o8q"><polyline points="4 4 4 10 10 10" class="svelte-1n46o8q"></polyline><path d="M4 10A9 9 0 1 0 6.5 5" class="svelte-1n46o8q"></path></svg> </button>'),Tte=B('<div class="version-popup svelte-1n46o8q"><dl class="svelte-1n46o8q"><dt class="svelte-1n46o8q">Installed</dt><dd class="svelte-1n46o8q"></dd> <!></dl> <div class="version-actions svelte-1n46o8q"><!> <button class="check-btn svelte-1n46o8q" title="Check for updates now"><svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 4 4 10 10 10" class="svelte-1n46o8q"></polyline><path d="M4 10A9 9 0 1 0 6.5 5" class="svelte-1n46o8q"></path></svg> </button></div></div>'),Mte=B('<dt class="svelte-1n46o8q">Uptime</dt><dd class="svelte-1n46o8q"> </dd>',1),Rte=B('<dt class="svelte-1n46o8q">Matter nodes</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">Matter endpoints</dt><dd class="svelte-1n46o8q"> </dd>',1),Nte=B('<dt class="svelte-1n46o8q">DB docs</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">DB views</dt><dd class="svelte-1n46o8q"> </dd>',1),Ote=B('<dl class="svelte-1n46o8q"><!> <dt class="svelte-1n46o8q">Scripts</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">MQTT topics</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">MQTT msg/s</dt><dd class="svelte-1n46o8q"> </dd> <!> <!> <dt class="svelte-1n46o8q">Handlers</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">Memory</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">CPU</dt><dd class="svelte-1n46o8q"> </dd></dl>'),Hte=B('<span class="stats-empty svelte-1n46o8q">Loading…</span>'),Wte=B('<button class="svelte-1n46o8q"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-1n46o8q"><path d="M18.36 6.64a9 9 0 1 1-12.73 0" class="svelte-1n46o8q"></path><line x1="12" y1="2" x2="12" y2="12" class="svelte-1n46o8q"></line></svg> Restart daemon</button>'),zte=B('<div class="stats-popup svelte-1n46o8q"><!> <div class="stats-actions svelte-1n46o8q"><!></div></div>'),Vte=B('<button class="nav-logout svelte-1n46o8q" title="Logout"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-1n46o8q"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" class="svelte-1n46o8q"></path><polyline points="16 17 21 12 16 7" class="svelte-1n46o8q"></polyline><line x1="21" y1="12" x2="9" y2="12" class="svelte-1n46o8q"></line></svg></button>'),jte=B('<div class="shell svelte-1n46o8q"><nav class="svelte-1n46o8q"><span class="brand svelte-1n46o8q">she</span> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="svelte-1n46o8q"><polyline points="5,3 1,8 5,13" class="svelte-1n46o8q"></polyline><polyline points="11,3 15,8 11,13" class="svelte-1n46o8q"></polyline></svg> Scripts</button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="square" stroke-linejoin="miter" class="svelte-1n46o8q"><rect x="0.75" y="0.75" width="14.5" height="14.5" rx="1" class="svelte-1n46o8q"></rect><path d="M2,11 V5 H5 V11" class="svelte-1n46o8q"></path><path d="M6,12 V5 H9 V8 H6" class="svelte-1n46o8q"></path><path d="M10,11 V5 H15 V11" class="svelte-1n46o8q"></path><line x1="12.5" y1="5" x2="12.5" y2="11" class="svelte-1n46o8q"></line></svg> Packages <!></button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" stroke="none" style="vertical-align: middle" class="svelte-1n46o8q"><path fill-rule="evenodd" d="M2,0 H14 A2,2 0 0,1 16,2 V14 A2,2 0 0,1 14,16 H0 V2 A2,2 0 0,1 2,0 Z M0,16 L0,12 A4,4 0 0,1 4,16 Z M0,10.5 A5.5,5.5 0 0,1 5.5,16 L9,16 A9,9 0 0,0 0,7 Z M0,5.5 A10.5,10.5 0 0,1 10.5,16 L13.5,16 A13.5,13.5 0 0,0 0,2.5 Z" class="svelte-1n46o8q"></path></svg> MQTT <!></button> <!> <!> <!> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" class="svelte-1n46o8q"><line x1="2" y1="5" x2="14" y2="5" class="svelte-1n46o8q"></line><line x1="2" y1="8" x2="14" y2="8" class="svelte-1n46o8q"></line><line x1="2" y1="11" x2="9" y2="11" class="svelte-1n46o8q"></line></svg> Logs <!></button> <div class="nav-spacer svelte-1n46o8q"></div> <div class="nav-right svelte-1n46o8q"><a class="nav-icon svelte-1n46o8q" href="https://github.com/hobbyquaker/she" target="_blank" rel="noopener" title="GitHub"><svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" class="svelte-1n46o8q"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z" class="svelte-1n46o8q"></path></svg></a> <div class="version-wrap svelte-1n46o8q"><button class="version svelte-1n46o8q"> <!></button> <!></div> <div class="stats-wrap svelte-1n46o8q"><button class="nav-icon svelte-1n46o8q" title="Daemon status"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-1n46o8q"><line x1="18" y1="20" x2="18" y2="10" class="svelte-1n46o8q"></line><line x1="12" y1="20" x2="12" y2="4" class="svelte-1n46o8q"></line><line x1="6" y1="20" x2="6" y2="14" class="svelte-1n46o8q"></line></svg></button> <!></div> <button title="Settings"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-1n46o8q"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" class="svelte-1n46o8q"></path><circle cx="12" cy="12" r="3" class="svelte-1n46o8q"></circle></svg></button> <!></div></nav> <main class="svelte-1n46o8q"><!> <div><!></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div></main></div>'),$te=B('<div class="login-error svelte-1n46o8q"> </div>'),Ute=B('<div class="login-overlay svelte-1n46o8q"><form class="login-box svelte-1n46o8q"><div class="login-brand svelte-1n46o8q">she</div> <h2 class="svelte-1n46o8q">Sign in</h2> <div class="login-field svelte-1n46o8q"><label for="she-password" class="svelte-1n46o8q">Password</label> <input id="she-password" type="password" placeholder="Enter password" autocomplete="current-password" class="svelte-1n46o8q"/></div> <!> <button type="submit" class="login-btn svelte-1n46o8q"> </button></form></div>'),qte=B('<div class="updating-overlay svelte-1n46o8q"><div class="updating-box svelte-1n46o8q"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-1n46o8q"><polyline points="4 4 4 10 10 10" class="svelte-1n46o8q"></polyline><path d="M4 10A9 9 0 1 0 6.5 5" class="svelte-1n46o8q"></path></svg> Restarting smart-home-engine…</div></div>'),Gte=B('<div class="updating-overlay svelte-1n46o8q"><div class="updating-box svelte-1n46o8q"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-1n46o8q"><polyline points="4 4 4 10 10 10" class="svelte-1n46o8q"></polyline><path d="M4 10A9 9 0 1 0 6.5 5" class="svelte-1n46o8q"></path></svg> Updating smart-home-engine…</div></div>'),Kte=B("<!> <!> <!> <!>",1);function Zte(o,e){$s(e,!0);const t=["scripts","mqtt","matter","security","db","logs","config","packages"];function i(){const Xe=location.hash.slice(1);return t.includes(Xe)?Xe:"scripts"}let n=F(Li(i())),s=F(null),r=F(!1),a=F(!1),d=F(!1),u=F(!1),f=F("none"),g=F(""),p=F(!1),C=F(""),b=F(""),y=F(!1),w=F(!1);T$(()=>{m(p,!0)});async function A(){m(b,""),m(y,!0);try{await N$(c(C)),m(C,""),m(p,!1)}catch(Xe){m(b,Xe.message??"Login failed",!0)}finally{m(y,!1)}}async function I(){if(c(f)==="proxy"&&c(g)){window.location.href=c(g);return}await O$(),m(p,!0)}let T=F(null),R=F(!1),P=F(!1),V=F(!1),j=F(!1),J=F(Li([])),ae=F(0),fe=F(!1),X=F(Li([]));const ce=Lt(()=>c(X).filter(Xe=>Xe.online).length),me=Lt(()=>c(X).length===0?"none":c(ce)===c(X).length?"all":c(ce)>0?"some":"offline");let oe=F(!1),le=F(!1);async function Ae(){if(!await c(T).show("Restart the she daemon? The page will reload after a moment.",{confirm:"Restart"}))return;m(R,!0);let Xe;try{Xe=(await e0()).startedAt}catch{}try{await xF()}catch{}const tt=Date.now()+6e4;for(;Date.now()<tt;){await new Promise(wt=>setTimeout(wt,250));try{const wt=await e0();if(Xe===void 0||wt.startedAt!==Xe){location.reload();return}}catch{}}location.reload()}async function Te(){m(d,!0);try{const Xe=await $$();c(s)&&m(s,{...c(s),latestVersion:Xe.latestVersion??void 0},!0)}catch{}finally{m(d,!1)}}async function xe(){var wt,Yt;if(!await c(T).show(`Update to v${(wt=c(s))==null?void 0:wt.latestVersion}? The daemon will restart after the update completes.`,{confirm:"Update"}))return;m(a,!1),m(u,!0);const Xe=(Yt=c(s))==null?void 0:Yt.startedAt;try{await j$()}catch{}const tt=Date.now()+18e4;for(;Date.now()<tt;){await new Promise(fi=>setTimeout(fi,1e3));try{const fi=await e0();if(Xe===void 0||fi.startedAt!==Xe){location.reload();return}}catch{m(u,!1),m(R,!0)}}location.reload()}function Ne(Xe){m(n,Xe,!0),location.hash=Xe}Xs(async()=>{location.hash||(location.hash=c(n));const Xe=()=>{m(n,i(),!0)};window.addEventListener("hashchange",Xe);try{const Ze=await R$();m(f,Ze.mode,!0),m(g,Ze.proxyLogoutUrl??"",!0),c(f)==="password"&&(await fetch("/she/scripts")).status===401&&m(p,!0)}catch{}m(w,!0);async function tt(){var Ze,Ee,ii;try{m(s,await e0(),!0)}catch{}try{const[Ci,Jt]=await Promise.all([_F(),Pl()]);m(J,Array.isArray(Jt.pinnedPackages)?Jt.pinnedPackages:[],!0),m(ae,Object.keys(Ci).filter(Ji=>!c(J).includes(Ji)).length,!0);const zi=c(fe);m(fe,((Ze=Jt.broker)==null?void 0:Ze.enabled)===!0),zi&&!c(fe)&&c(n)==="security"&&Ne("scripts")}catch{}!((Ee=c(s))!=null&&Ee.matterEnabled)&&c(n)==="matter"&&Ne("scripts"),!((ii=c(s))!=null&&ii.dbEnabled)&&c(n)==="db"&&Ne("scripts")}tt();const wt=setInterval(tt,5e3),Yt=Xo("mqtt:status",Ze=>{Ze.connected===!1?(m(j,!0),m(P,!1),m(V,!1)):(m(j,!1),m(P,Ze.ready===!1),m(V,Ze.ready===!0))}),fi=Xo("matter:deviceList",Ze=>{Array.isArray(Ze.devices)&&m(X,Ze.devices.map(Ee=>({nodeId:String(Ee.nodeId),online:!!Ee.online})),!0)}),oi=Xo("matter:deviceStatus",Ze=>{if(Ze.nodeId===void 0)return;const Ee=String(Ze.nodeId),ii=!!Ze.online;m(X,c(X).map(Ci=>Ci.nodeId===Ee?{...Ci,online:ii}:Ci),!0)}),ki=kF();m(oe,ki.some(Ze=>Ze.level==="error"),!0),m(le,!c(oe)&&ki.some(Ze=>Ze.level==="warn"),!0);const _i=hS(Ze=>{Ze.level==="error"?(m(oe,!0),m(le,!1)):Ze.level==="warn"&&!c(oe)&&m(le,!0)});return()=>{window.removeEventListener("hashchange",Xe),clearInterval(wt),Yt(),fi(),oi(),_i()}});var Ve=Kte();xs("click",s6,()=>{c(r)&&m(r,!1),c(a)&&m(a,!1)});var ve=Et(Ve);{var mt=Xe=>{var tt=jte(),wt=_(tt),Yt=v(_(wt),2);let fi;var oi=v(Yt,2);let ki;var _i=v(_(oi),2);{var Ze=M=>{var O=vte();z(()=>ln(O,"title",`${c(ae)??""} package update${c(ae)===1?"":"s"} available`)),D(M,O)};H(_i,M=>{c(ae)>0&&M(Ze)})}var Ee=v(oi,2);let ii;var Ci=v(_(Ee),2);{var Jt=M=>{var O=_te();D(M,O)},zi=M=>{var O=bte();D(M,O)},Ji=M=>{var O=Cte();D(M,O)};H(Ci,M=>{c(j)?M(Jt):c(P)?M(zi,1):c(V)&&M(Ji,2)})}var Ii=v(Ee,2);{var wn=M=>{var O=Ete();let ee;z(()=>ee=At(O,1,"svelte-1n46o8q",null,ee,{active:c(n)==="security"})),$("click",O,()=>Ne("security")),D(M,O)};H(Ii,M=>{c(fe)&&M(wn)})}var cn=v(Ii,2);{var pn=M=>{var O=Dte();let ee;var ne=v(_(O),2);{var se=We=>{var Ce=yte();D(We,Ce)},re=We=>{var Ce=wte();D(We,Ce)},Ie=We=>{var Ce=Ste();D(We,Ce)};H(ne,We=>{c(me)==="all"?We(se):c(me)==="some"?We(re,1):c(me)==="offline"&&We(Ie,2)})}z(()=>ee=At(O,1,"svelte-1n46o8q",null,ee,{active:c(n)==="matter"})),$("click",O,()=>Ne("matter")),D(M,O)};H(cn,M=>{var O;(O=c(s))!=null&&O.matterEnabled&&M(pn)})}var fn=v(cn,2);{var pt=M=>{var O=Ate();let ee;z(()=>ee=At(O,1,"svelte-1n46o8q",null,ee,{active:c(n)==="db"})),$("click",O,()=>Ne("db")),D(M,O)};H(fn,M=>{var O;(O=c(s))!=null&&O.dbEnabled&&M(pt)})}var Ut=v(fn,2);let Ni;var qi=v(_(Ut),2);{var gi=M=>{var O=kte();D(M,O)},Wi=M=>{var O=Bte();D(M,O)};H(qi,M=>{c(oe)?M(gi):c(le)&&M(Wi,1)})}var Ui=v(Ut,4),tn=v(_(Ui),2),yi=_(tn),Vi=_(yi);Vi.nodeValue="v1.15.0 ";var ze=v(Vi);{var qt=M=>{var O=Fte();D(M,O)};H(ze,M=>{var O,ee;(O=c(s))!=null&&O.latestVersion&&!((ee=c(s))!=null&&ee.docker)&&M(qt)})}var wi=v(yi,2);{var ji=M=>{var O=Tte(),ee=_(O),ne=v(_(ee));ne.textContent="v1.15.0";var se=v(ne,2);{var re=de=>{var Ue=Lte(),Ft=v(Et(Ue)),we=_(Ft);z(()=>W(we,`v${c(s).latestVersion??""}`)),D(de,Ue)},Ie=de=>{var Ue=Ite();D(de,Ue)};H(se,de=>{var Ue;(Ue=c(s))!=null&&Ue.latestVersion?de(re):de(Ie,-1)})}var We=v(ee,2),Ce=_(We);{var Pe=de=>{var Ue=Pte(),Ft=v(_(Ue));z(()=>W(Ft,` Update to v${c(s).latestVersion??""}`)),$("click",Ue,xe),D(de,Ue)};H(Ce,de=>{var Ue;(Ue=c(s))!=null&&Ue.latestVersion&&de(Pe)})}var Me=v(Ce,2),at=_(Me);let Qt;var Z=v(at);z(()=>{Me.disabled=c(d),Qt=At(at,0,"svelte-1n46o8q",null,Qt,{spinning:c(d)}),W(Z,` ${c(d)?"Checking…":"Check for updates"}`)}),$("click",O,de=>de.stopPropagation()),$("click",Me,Te),D(M,O)};H(wi,M=>{var O;c(a)&&!((O=c(s))!=null&&O.docker)&&M(ji)})}var Si=v(tn,2),K=_(Si),De=v(K,2);{var Qe=M=>{var O=zte(),ee=_(O);{var ne=Ce=>{var Pe=Ote(),Me=_(Pe);{var at=et=>{const ge=Lt(()=>Math.floor((Date.now()-c(s).startedAt)/1e3)),$e=Lt(()=>Math.floor(c(ge)/86400)),_t=Lt(()=>Math.floor(c(ge)%86400/3600)),Wt=Lt(()=>Math.floor(c(ge)%3600/60));var bt=Mte(),pi=v(Et(bt)),Di=_(pi);z(()=>W(Di,`${c($e)>0?c($e)+"d ":""}${c(_t)>0||c($e)>0?c(_t)+"h ":""}${c(Wt)??""}m`)),D(et,bt)};H(Me,et=>{c(s).startedAt&&et(at)})}var Qt=v(Me,3),Z=_(Qt),de=v(Qt,3),Ue=_(de),Ft=v(de,3),we=_(Ft),Oe=v(Ft,2);{var St=et=>{var ge=Rte(),$e=v(Et(ge)),_t=_($e),Wt=v($e,3),bt=_(Wt);z(()=>{W(_t,c(s).matterNodes??0),W(bt,c(s).matterEndpoints??0)}),D(et,ge)};H(Oe,et=>{c(s).matterEnabled&&et(St)})}var ut=v(Oe,2);{var nt=et=>{var ge=Nte(),$e=v(Et(ge)),_t=_($e),Wt=v($e,3),bt=_(Wt);z(()=>{W(_t,c(s).dbDocs??"—"),W(bt,c(s).dbViews??"—")}),D(et,ge)};H(ut,et=>{c(s).dbEnabled&&et(nt)})}var ue=v(ut,3),He=_(ue),Fe=v(ue,3),Je=_(Fe),ht=v(Fe,3),Ke=_(ht);z(()=>{W(Z,c(s).scripts),W(Ue,c(s).topics),W(we,c(s).mqttMsgPerSec??"—"),W(He,c(s).handlers??"—"),W(Je,c(s).memMb!=null?c(s).memMb+" MB":"—"),W(Ke,c(s).cpuPercent!=null?c(s).cpuPercent+" %":"—")}),D(Ce,Pe)},se=Ce=>{var Pe=Hte();D(Ce,Pe)};H(ee,Ce=>{c(s)?Ce(ne):Ce(se,-1)})}var re=v(ee,2),Ie=_(re);{var We=Ce=>{var Pe=Wte();$("click",Pe,()=>{m(r,!1),Ae()}),D(Ce,Pe)};H(Ie,Ce=>{var Pe;(Pe=c(s))!=null&&Pe.docker||Ce(We)})}$("click",O,Ce=>Ce.stopPropagation()),D(M,O)};H(De,M=>{c(r)&&M(Qe)})}var it=v(Si,2);let Gt;var li=v(it,2);{var vt=M=>{var O=Vte();$("click",O,I),D(M,O)};H(li,M=>{c(f)==="password"&&M(vt)})}var ft=v(wt,2),Y=_(ft);gs(Yc(Y,{}),M=>m(T,M,!0),()=>c(T));var Re=v(Y,2);let dt;var ye=_(Re);{let M=Lt(()=>c(n)==="scripts");lZ(ye,{get active(){return c(M)}})}var ci=v(Re,2);let It;var ie=_(ci);iJ(ie,{});var Ye=v(ci,2);let kt;var Pt=_(Ye);NQ(Pt,{});var Bt=v(Ye,2);let Be;var je=_(Bt);tQ(je,{});var Kt=v(Bt,2);let ri;var ui=_(Kt);mte(ui,{});var Xt=v(Kt,2);let pe;var Ge=_(Xt);sY(Ge,{});var rt=v(Xt,2);let lt;var Vt=_(rt);ZZ(Vt,{});var Ot=v(rt,2);let bi;var U=_(Ot);eX(U,{}),z(()=>{fi=At(Yt,1,"svelte-1n46o8q",null,fi,{active:c(n)==="scripts"}),ki=At(oi,1,"svelte-1n46o8q",null,ki,{active:c(n)==="packages"}),ii=At(Ee,1,"svelte-1n46o8q",null,ii,{active:c(n)==="mqtt"}),Ni=At(Ut,1,"svelte-1n46o8q",null,Ni,{active:c(n)==="logs"}),Gt=At(it,1,"nav-settings svelte-1n46o8q",null,Gt,{active:c(n)==="config"}),dt=At(Re,1,"page-wrap svelte-1n46o8q",null,dt,{hidden:c(n)!=="scripts"}),It=At(ci,1,"page-wrap svelte-1n46o8q",null,It,{hidden:c(n)!=="packages"}),kt=At(Ye,1,"page-wrap svelte-1n46o8q",null,kt,{hidden:c(n)!=="mqtt"}),Be=At(Bt,1,"page-wrap svelte-1n46o8q",null,Be,{hidden:c(n)!=="matter"}),ri=At(Kt,1,"page-wrap svelte-1n46o8q",null,ri,{hidden:c(n)!=="security"}),pe=At(Xt,1,"page-wrap svelte-1n46o8q",null,pe,{hidden:c(n)!=="db"}),lt=At(rt,1,"page-wrap svelte-1n46o8q",null,lt,{hidden:c(n)!=="config"}),bi=At(Ot,1,"page-wrap svelte-1n46o8q",null,bi,{hidden:c(n)!=="logs"})}),$("click",Yt,()=>Ne("scripts")),$("click",oi,()=>Ne("packages")),$("click",Ee,()=>Ne("mqtt")),$("click",Ut,()=>{Ne("logs"),m(oe,!1),m(le,!1)}),$("click",yi,M=>{M.stopPropagation(),m(a,!c(a)),m(r,!1)}),$("click",K,M=>{M.stopPropagation(),m(r,!c(r)),m(a,!1)}),$("click",it,()=>Ne("config")),D(Xe,tt)};H(ve,Xe=>{c(w)&&!c(p)&&Xe(mt)})}var Mt=v(ve,2);{var ot=Xe=>{var tt=Ute(),wt=_(tt),Yt=v(_(wt),4),fi=v(_(Yt),2),oi=v(Yt,2);{var ki=Ee=>{var ii=$te(),Ci=_(ii);z(()=>W(Ci,c(b))),D(Ee,ii)};H(oi,Ee=>{c(b)&&Ee(ki)})}var _i=v(oi,2),Ze=_(_i);z(()=>{fi.disabled=c(y),_i.disabled=c(y)||!c(C),W(Ze,c(y)?"Signing in…":"Sign in")}),xs("submit",wt,Ee=>{Ee.preventDefault(),A()}),zt(fi,()=>c(C),Ee=>m(C,Ee)),D(Xe,tt)};H(Mt,Xe=>{c(p)&&Xe(ot)})}var yt=v(Mt,2);{var be=Xe=>{var tt=qte();D(Xe,tt)};H(yt,Xe=>{c(R)&&Xe(be)})}var Nt=v(yt,2);{var si=Xe=>{var tt=Gte();D(Xe,tt)};H(Nt,Xe=>{c(u)&&Xe(si)})}D(o,Ve),Us()}Ys(["click"]);QI(Zte,{target:document.getElementById("app")});export{N6 as t};