smart-home-engine 0.12.0 → 0.14.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,220 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/tsMode-BcZhguVQ.js","assets/monaco-langs-DZ6hB11b.js","assets/monaco-langs-DyX1CsEw.css"])))=>i.map(i=>d[i]);
2
+ var RR=Object.defineProperty;var lL=o=>{throw TypeError(o)};var AR=(o,e,t)=>e in o?RR(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var vi=(o,e,t)=>AR(o,typeof e!="symbol"?e+"":e,t),pw=(o,e,t)=>e.has(o)||lL("Cannot "+t);var G=(o,e,t)=>(pw(o,e,"read from private field"),t?t.call(o):e.get(o)),li=(o,e,t)=>e.has(o)?lL("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,t),ci=(o,e,t,i)=>(pw(o,e,"write to private field"),i?i.call(o,t):e.set(o,t),t),tn=(o,e,t)=>(pw(o,e,"access private method"),t);import{dg as OR,gU as FR,gH as Xe,b as Ns,u as ie,aB as on,K as rp,az as xn,fd as gD,bI as We,o as xt,X as pr,Z as T,hn as Ti,bK as Vo,gG as w,t as HR,r as Gi,ca as di,cq as _t,bE as us,dl as Uo,aC as wi,hr as Zt,hp as Q,W as ge,bp as Dn,ho as Ke,M as Se,ck as Rn,c9 as O,bN as oi,bZ as Kr,hX as Pn,c2 as Qe,bP as mw,cf as ap,ev as fD,bo as Da,cd as mr,F as gy,bL as Xn,cY as Ri,b8 as _u,aQ as Je,dJ as Aa,hz as WR,cm as Ds,Q as fy,cj as BR,gV as pD,$ as qe,cR as xi,di as bi,a9 as hn,aL as Bt,bS as oo,et as hf,O as we,gg as Lm,hD as zR,h7 as VR,a7 as Nn,fQ as UR,a_ as _r,Y as Rs,hq as it,gq as mD,h_ as nn,f as jR,hZ as $R,fl as Ps,aD as Ku,aM as En,ax as hb,aZ as Ss,fS as Ql,fc as Fx,gu as ub,d_ as qn,a3 as vu,i as Kn,H as gb,g as fb,m as qR,hi as lp,ay as Gu,b0 as $a,a$ as KR,gk as Zu,g1 as GR,bQ as Hx,gt as ZR,bc as XR,v as cL,h5 as Cn,fH as Ea,aY as Cs,h as $t,c4 as xa,cP as YR,eY as Yr,gl as io,aA as Bn,b4 as vr,bw as Wx,f6 as An,ht as yn,ak as Xm,a5 as jt,ai as _D,dj as QR,dQ as Bx,aE as pb,bs as zx,bW as Vx,dt as Ic,hL as JR,bC as Ux,e9 as eA,fJ as jx,d$ as qa,hx as Ka,i1 as bu,c as uf,cE as qs,cS as cp,f_ as Ym,cw as _w,h4 as Vi,aW as $x,aH as dp,hy as mb,eD as tA,eE as vD,g4 as gf,hR as wu,e_ as ff,ab as hp,ez as _b,dw as Si,b3 as Jl,bu as up,hI as iA,gI as nA,d6 as qx,hC as sA,hF as Qm,aP as yo,U as Kx,cB as yu,aI as Ga,hs as Xu,p as ii,c8 as Su,T as bD,d5 as gp,c1 as oA,fz as kc,dn as Ve,eI as dL,ao as Im,aj as wD,b7 as qo,e as hr,L as $i,a as Cu,fC as Oo,bJ as xu,dy as dn,cr as pf,aX as Ud,d as py,bH as yD,i6 as SD,dd as CD,dX as Gx,h0 as Bs,eb as Ei,dA as fp,eh as xD,bg as Pa,ee as vb,dZ as rA,cl as Eh,bY as hL,fg as pp,au as LD,fx as Ph,fo as aA,fy as Eo,av as bb,as as lA,hv as As,aR as br,aK as mp,fY as mf,ds as ID,at as mo,dO as _p,gZ as wb,db as cA,l as dA,br as hA,bD as Yu,gf as Qr,aO as zn,n as uA,gT as Zx,e5 as gA,bb as fA,hA as uL,dY as pA,eH as vp,dU as Oa,eL as my,dh as xd,dk as Fa,dW as mA,dI as Gr,hN as Fo,fF as Js,e$ as gL,eu as fs,dL as bp,ci as Ul,dB as Jr,e7 as _A,b5 as wr,aN as _f,e1 as yb,ba as kD,x as vA,e6 as bA,eq as Xx,aq as wA,ag as vf,cA as yA,cO as fl,b_ as bf,cz as fL,dD as SA,da as CA,bt as ia,bi as xA,aS as Yx,dc as DD,de as ED,df as PD,dK as TD,gO as LA,gc as IA,bl as MD,fT as ND,g7 as kA,ct as Qx,bO as DA,q as EA,V as pn,g3 as PA,bM as Jx,ex as TA,be as Th,bf as pL,eO as MA,eP as NA,eQ as RA,eR as AA,eM as OA,eN as FA,B as Lu,cW as Sb,f5 as _y,fu as HA,cH as WA,cG as mL,g8 as vy,gp as BA,gR as _L,ha as vw,dT as zA,f1 as RD,co as VA,cg as AD,e0 as by,j as UA,d4 as jA,cc as $A,fL as OD,fK as FD,ar as qA,a8 as Jm,cT as HD,fk as Cb,ad as KA,fP as GA,I as jl,f7 as e1,fw as ZA,ea as vL,e8 as bL,g9 as XA,du as Mh,i9 as WD,fj as YA,eG as QA,eC as JA,eF as eO,hw as BD,bR as zD,hb as VD,fE as UD,dV as tO,i3 as Zr,eS as wL,fG as iO,ae as wp,hu as nO,gr as kg,gn as jD,gm as yL,a4 as wf,aw as $D,k as e_,ft as sO,A as qD,af as oO,f8 as KD,f9 as rO,y as aO,e3 as GD,cM as ZD,cy as Ha,hP as xb,dz as lO,e4 as XD,h3 as no,h2 as Dc,cF as YD,dS as cO,bA as dO,hE as QD,ce as JD,a0 as hO,dq as eE,fR as tE,by as yf,cL as uO,bv as gO,hd as fO,J as pO,gB as mg,gC as SL,gD as mO,cs as _O,dv as vO,cN as t_,fq as ts,bx as bO,es as wy,i2 as jd,eZ as wO,ef as Ca,gP as yO,gv as SO,fX as iE,fD as CO,dC as jg,er as xO,g0 as LO,i0 as IO,fZ as kO,go as CL,d3 as xL,fB as LL,aT as $d,h1 as t1,ed as nE,gw as yy,fV as km,hm as sE,hV as i_,gJ as DO,c0 as EO,hQ as PO,cK as TO,s as i1,bB as oE,f$ as MO,dE as n_,ah as rE,fa as aE,fb as NO,dP as RO,dm as AO,hh as OO,aJ as FO,gd as HO,g5 as WO,cQ as BO,S as lE,hO as zO,G as s_,eW as cE,eX as VO,hf as dE,hg as UO,he as hE,gF as uE,gE as jO,b$ as IL,fr as gE,hH as kL,dH as $O,d7 as bw,bq as DL,f0 as qO,f2 as KO,cp as GO,g_ as Br,ec as $l,gK as ZO,hj as EL,w as Dm,hk as XO,dR as La,hY as Lb,dG as Sy,i7 as YO,dx as fE,a2 as pE,bF as ps,dN as PL,cu as Zp,h6 as n1,eA as QO,eB as JO,eU as e2,eV as t2,eK as i2,ey as n2,cn as s2,aV as o2,aU as TL,eJ as r2,c3 as a2,gW as l2,cv as Iu,fn as $g,fp as mE,fv as c2,z as s1,gA as Em,bd as Xp,fm as ww,ch as d2,cX as h2,a6 as _E,dM as u2,f4 as o1,h9 as g2,gx as f2,hc as vE,gS as Ib,eT as p2,P as o_,ek as r1,en as a1,aG as l1,bX as bE,em as wE,ep as yE,eo as SE,el as CE,ej as xE,ei as LE,bh as ML,hU as IE,hW as ah,E as m2,_ as _2,dr as v2,dp as b2,eg as kE,bz as w2,g$ as y2,dF as NL,hl as Cy,cx as Cl,g6 as S2,fA as C2,ia as x2,i8 as L2,fO as I2,fN as k2,fM as RL,cC as c1,bU as xy,ff as D2,hB as Ly,bT as E2,b6 as P2,ga as T2,d0 as M2,b1 as d1,h$ as DE,ge as AL,gs as OL,fi as N2,cD as R2,cb as A2,cJ as FL,R as yw,aa as O2,gy as F2,b9 as H2,fI as Sw,gj as EE,gi as PE,gh as TE,c_ as ME,i5 as Wa,bk as NE,aF as h1,cZ as HL,gN as W2,fW as RE,hM as B2,hJ as z2,C as kb,bm as Db,fs as qd,a1 as Eb,d8 as yp,D as V2,d9 as Pb,ap as U2,hG as j2,N as $2,b2 as AE,cV as _g,bV as q2,gY as K2,gX as G2,bj as Z2,ac as Sp,c6 as X2,fh as OE,e2 as FE,al as HE,hK as Iy,hT as Y2,i4 as Q2,cI as J2,fe as eF,f3 as tF,c7 as ky,bn as iF,g2 as nF,h8 as sF,gL as oF,gQ as rF,gM as aF,gb as lF,hS as cF,c5 as WE,cU as dF,d1 as hF,d2 as uF,fU as WL,am as gF,an as fF,gz as uc,ew as pa,c$ as pF,bG as mF}from"./monaco-langs-DZ6hB11b.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 BE=!1;var u1=Array.isArray,_F=Array.prototype.indexOf,r_=Array.prototype.includes,Tb=Array.from,vF=Object.defineProperty,Gh=Object.getOwnPropertyDescriptor,bF=Object.getOwnPropertyDescriptors,wF=Object.prototype,yF=Array.prototype,zE=Object.getPrototypeOf,BL=Object.isExtensible;const pl=()=>{};function SF(o){for(var e=0;e<o.length;e++)o[e]()}function VE(){var o,e,t=new Promise((i,n)=>{o=i,e=n});return{promise:t,resolve:o,reject:e}}const ws=2,ku=4,Mb=8,UE=1<<24,ur=16,fr=32,ql=64,Dy=128,Bo=512,ns=1024,as=2048,ea=4096,Vs=8192,zo=16384,Qu=32768,Ey=1<<25,Du=65536,a_=1<<17,CF=1<<18,Ju=1<<19,xF=1<<20,jr=1<<25,Ld=65536,l_=1<<21,Zh=1<<22,xl=1<<23,Ec=Symbol("$state"),LF=Symbol("legacy props"),IF=Symbol(""),Pm=Symbol("attributes"),Py=Symbol("class"),Ty=Symbol("style"),Dg=Symbol("text"),Tm=Symbol("form reset"),Nb=new class extends Error{constructor(){super(...arguments);vi(this,"name","StaleReactionError");vi(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function jE(o){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function kF(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function DF(o,e,t){throw new Error("https://svelte.dev/e/each_key_duplicate")}function EF(o){throw new Error("https://svelte.dev/e/effect_in_teardown")}function PF(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function TF(o){throw new Error("https://svelte.dev/e/effect_orphan")}function MF(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function NF(o){throw new Error("https://svelte.dev/e/props_invalid_value")}function RF(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function AF(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function OF(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function FF(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const HF=1,WF=2,$E=4,BF=8,zF=16,VF=1,UF=4,jF=8,$F=16,qF=1,KF=2,es=Symbol("uninitialized"),qE="http://www.w3.org/1999/xhtml",GF="http://www.w3.org/2000/svg",ZF="http://www.w3.org/1998/Math/MathML";function XF(){console.warn("https://svelte.dev/e/derived_inert")}function YF(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function QF(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function KE(o){return o===this.v}function JF(o,e){return o!=o?e==e:o!==e||o!==null&&typeof o=="object"||typeof o=="function"}function GE(o){return!JF(o,this.v)}let eH=!1,bs=null;function Eu(o){bs=o}function ao(o,e=!1,t){bs={p:bs,i:!1,c:null,e:null,s:o,x:null,r:Pi,l:null}}function lo(o){var e=bs,t=e.e;if(t!==null){e.e=null;for(var i of t)_P(i)}return o!==void 0&&(e.x=o),e.i=!0,bs=e.p,o??{}}function ZE(){return!0}let _c=[];function XE(){var o=_c;_c=[],SF(o)}function Ll(o){if(_c.length===0&&!Kg){var e=_c;queueMicrotask(()=>{e===_c&&XE()})}_c.push(o)}function tH(){for(;_c.length>0;)XE()}function YE(o){var e=Pi;if(e===null)return Di.f|=xl,o;if((e.f&Qu)===0&&(e.f&ku)===0)throw o;ml(o,e)}function ml(o,e){for(;e!==null;){if((e.f&Dy)!==0){if((e.f&Qu)===0)throw o;try{e.b.error(o);return}catch(t){o=t}}e=e.parent}throw o}const iH=-7169;function Hn(o,e){o.f=o.f&iH|e}function g1(o){(o.f&Bo)!==0||o.deps===null?Hn(o,ns):Hn(o,ea)}function QE(o){if(o!==null)for(const e of o)(e.f&ws)===0||(e.f&Ld)===0||(e.f^=Ld,QE(e.deps))}function JE(o,e,t){(o.f&as)!==0?e.add(o):(o.f&ea)!==0&&t.add(o),QE(o.deps),Hn(o,ns)}let Yp=!1;function nH(o){var e=Yp;try{return Yp=!1,[o(),Yp]}finally{Yp=e}}let Cw=null,lh=null,Ut=null,qg=null,gs=null,My=null,Kg=!1,xw=!1,Nh=null,Mm=null;var zL=0;let sH=1;var Jh,hl,yc,eu,tu,iu,ba,nu,Xs,ep,wa,ir,Or,su,Sc,mn,Ny,Eg,Ry,eP,tP,Ch,oH,Pg;const vv=class vv{constructor(){li(this,mn);vi(this,"id",sH++);li(this,Jh,!1);vi(this,"linked",!0);li(this,hl,null);li(this,yc,null);vi(this,"async_deriveds",new Map);vi(this,"current",new Map);vi(this,"previous",new Map);li(this,eu,new Set);li(this,tu,new Set);li(this,iu,0);li(this,ba,new Map);li(this,nu,null);li(this,Xs,[]);li(this,ep,[]);li(this,wa,new Set);li(this,ir,new Set);li(this,Or,new Map);li(this,su,new Set);vi(this,"is_fork",!1);li(this,Sc,!1);lh===null?Cw=lh=this:(ci(lh,yc,this),ci(this,hl,lh)),lh=this}skip_effect(e){G(this,Or).has(e)||G(this,Or).set(e,{d:[],m:[]}),G(this,su).delete(e)}unskip_effect(e,t=i=>this.schedule(i)){var i=G(this,Or).get(e);if(i){G(this,Or).delete(e);for(var n of i.d)Hn(n,as),t(n);for(n of i.m)Hn(n,ea),t(n)}G(this,su).add(e)}capture(e,t,i=!1){e.v!==es&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&xl)===0&&(this.current.set(e,[t,i]),gs==null||gs.set(e,t)),this.is_fork||(e.v=t)}activate(){Ut=this}deactivate(){Ut=null,gs=null}flush(){try{xw=!0,Ut=this,tn(this,mn,Eg).call(this)}finally{zL=0,My=null,Nh=null,Mm=null,xw=!1,Ut=null,gs=null,Pc.clear()}}discard(){var e;for(const t of G(this,tu))t(this);G(this,tu).clear(),tn(this,mn,Pg).call(this),(e=G(this,nu))==null||e.resolve()}register_created_effect(e){G(this,ep).push(e)}increment(e,t){if(ci(this,iu,G(this,iu)+1),e){let i=G(this,ba).get(t)??0;G(this,ba).set(t,i+1)}}decrement(e,t){if(ci(this,iu,G(this,iu)-1),e){let i=G(this,ba).get(t)??0;i===1?G(this,ba).delete(t):G(this,ba).set(t,i-1)}G(this,Sc)||(ci(this,Sc,!0),Ll(()=>{ci(this,Sc,!1),this.linked&&this.flush()}))}transfer_effects(e,t){for(const i of e)G(this,wa).add(i);for(const i of t)G(this,ir).add(i);e.clear(),t.clear()}oncommit(e){G(this,eu).add(e)}ondiscard(e){G(this,tu).add(e)}settled(){return(G(this,nu)??ci(this,nu,VE())).promise}static ensure(){if(Ut===null){const e=Ut=new vv;!xw&&!Kg&&Ll(()=>{G(e,Jh)||e.flush()})}return Ut}apply(){{gs=null;return}}schedule(e){var n;if(My=e,(n=e.b)!=null&&n.is_pending&&(e.f&(ku|Mb|UE))!==0&&(e.f&Qu)===0){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var i=t.f;if(Nh!==null&&t===Pi&&(Di===null||(Di.f&ws)===0))return;if((i&(ql|fr))!==0){if((i&ns)===0)return;t.f^=ns}}G(this,Xs).push(t)}};Jh=new WeakMap,hl=new WeakMap,yc=new WeakMap,eu=new WeakMap,tu=new WeakMap,iu=new WeakMap,ba=new WeakMap,nu=new WeakMap,Xs=new WeakMap,ep=new WeakMap,wa=new WeakMap,ir=new WeakMap,Or=new WeakMap,su=new WeakMap,Sc=new WeakMap,mn=new WeakSet,Ny=function(){if(this.is_fork)return!0;for(const i of G(this,ba).keys()){for(var e=i,t=!1;e.parent!==null;){if(G(this,Or).has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1},Eg=function(){var c,h,u,g;ci(this,Jh,!0),zL++>1e3&&(tn(this,mn,Pg).call(this),aH());for(const f of G(this,wa))G(this,ir).delete(f),Hn(f,as),this.schedule(f);for(const f of G(this,ir))Hn(f,ea),this.schedule(f);const e=G(this,Xs);ci(this,Xs,[]),this.apply();var t=Nh=[],i=[],n=Mm=[];for(const f of e)try{tn(this,mn,Ry).call(this,f,t,i)}catch(v){throw sP(f),tn(this,mn,Ny).call(this)||this.discard(),v}if(Ut=null,n.length>0){var s=vv.ensure();for(const f of n)s.schedule(f)}if(Nh=null,Mm=null,tn(this,mn,Ny).call(this)){tn(this,mn,Ch).call(this,i),tn(this,mn,Ch).call(this,t);for(const[f,v]of G(this,Or))nP(f,v);n.length>0&&tn(c=Ut,mn,Eg).call(c);return}const r=tn(this,mn,eP).call(this);if(r){tn(this,mn,Ch).call(this,i),tn(this,mn,Ch).call(this,t),tn(h=r,mn,tP).call(h,this);return}G(this,wa).clear(),G(this,ir).clear();for(const f of G(this,eu))f(this);G(this,eu).clear(),qg=this,VL(i),VL(t),qg=null,(u=G(this,nu))==null||u.resolve();var a=Ut;if(G(this,iu)===0&&(G(this,Xs).length===0||a!==null)&&tn(this,mn,Pg).call(this),G(this,Xs).length>0)if(a!==null){const f=a;G(f,Xs).push(...G(this,Xs).filter(v=>!G(f,Xs).includes(v)))}else a=this;a!==null&&tn(g=a,mn,Eg).call(g)},Ry=function(e,t,i){e.f^=ns;for(var n=e.first;n!==null;){var s=n.f,r=(s&(fr|ql))!==0,a=r&&(s&ns)!==0,c=a||(s&Vs)!==0||G(this,Or).has(n);if(!c&&n.fn!==null){r?n.f^=ns:(s&ku)!==0?t.push(n):xp(n)&&((s&ur)!==0&&G(this,ir).add(n),Tu(n));var h=n.first;if(h!==null){n=h;continue}}for(;n!==null;){var u=n.next;if(u!==null){n=u;break}n=n.parent}}},eP=function(){for(var e=G(this,hl);e!==null;){if(!e.is_fork){for(const[t,[,i]]of this.current)if(e.current.has(t)&&!i)return e}e=G(e,hl)}return null},tP=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(G(e,wa),G(e,ir));const t=n=>{var s=n.reactions;if(s!==null)for(const c of s){var r=c.f;if((r&ws)!==0)t(c);else{var a=c;r&(Zh|ur)&&!this.async_deriveds.has(a)&&(G(this,ir).delete(a),Hn(a,as),this.schedule(a))}}};for(const n of this.current.keys())t(n);this.oncommit(()=>e.discard()),tn(i=e,mn,Pg).call(i),Ut=this,tn(this,mn,Eg).call(this)},Ch=function(e){for(var t=0;t<e.length;t+=1)JE(e[t],G(this,wa),G(this,ir))},oH=function(){var u;for(let g=Cw;g!==null;g=G(g,yc)){var e=g.id<this.id,t=[];for(const[f,[v,_]]of this.current){if(g.current.has(f)){var i=g.current.get(f)[0];if(e&&v!==i)g.current.set(f,[v,_]);else continue}t.push(f)}if(e)for(const[f,v]of this.async_deriveds){const _=g.async_deriveds.get(f);_&&v.promise.then(_.resolve).catch(_.reject)}if(G(g,Jh)){var n=[...g.current.keys()].filter(f=>!g.current.get(f)[1]&&!this.current.has(f));if(n.length===0)e&&g.discard();else if(t.length>0){if(e)for(const f of G(this,su))g.unskip_effect(f,v=>{var _;(v.f&(ur|Zh))!==0?g.schedule(v):tn(_=g,mn,Ch).call(_,[v])});g.activate();var s=new Set,r=new Map;for(var a of t)iP(a,n,s,r);r=new Map;var c=[...g.current].filter(([f,v])=>{const _=this.current.get(f);return _?_[0]!==v[0]||_[1]!==v[1]:!0}).map(([f])=>f);if(c.length>0)for(const f of G(this,ep))(f.f&(zo|Vs|a_))===0&&f1(f,c,r)&&((f.f&(Zh|ur))!==0?(Hn(f,as),g.schedule(f)):G(g,wa).add(f));if(G(g,Xs).length>0&&!G(g,Sc)){g.apply();for(var h of G(g,Xs))tn(u=g,mn,Ry).call(u,h,[],[]);ci(g,Xs,[])}g.deactivate()}}}},Pg=function(){if(this.linked){var e=G(this,hl),t=G(this,yc);e===null?Cw=t:ci(e,yc,t),t===null?lh=e:ci(t,hl,e),this.linked=!1}};let Id=vv;function rH(o){var e=Kg;Kg=!0;try{for(var t;;){if(tH(),Ut===null)return t;Ut.flush()}}finally{Kg=e}}function aH(){try{MF()}catch(o){ml(o,My)}}let Jo=null;function VL(o){var e=o.length;if(e!==0){for(var t=0;t<e;){var i=o[t++];if((i.f&(zo|Vs))===0&&xp(i)&&(Jo=new Set,Tu(i),i.deps===null&&i.first===null&&i.nodes===null&&i.teardown===null&&i.ac===null&&wP(i),(Jo==null?void 0:Jo.size)>0)){Pc.clear();for(const n of Jo){if((n.f&(zo|Vs))!==0)continue;const s=[n];let r=n.parent;for(;r!==null;)Jo.has(r)&&(Jo.delete(r),s.push(r)),r=r.parent;for(let a=s.length-1;a>=0;a--){const c=s[a];(c.f&(zo|Vs))===0&&Tu(c)}}Jo.clear()}}Jo=null}}function iP(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&ws)!==0?iP(n,e,t,i):(s&(Zh|ur))!==0&&(s&as)===0&&f1(n,e,i)&&(Hn(n,as),p1(n))}}function f1(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(r_.call(e,n))return!0;if((n.f&ws)!==0&&f1(n,e,t))return t.set(n,!0),!0}return t.set(o,!1),!1}function p1(o){Ut.schedule(o)}function nP(o,e){if(!((o.f&fr)!==0&&(o.f&ns)!==0)){(o.f&as)!==0?e.d.push(o):(o.f&ea)!==0&&e.m.push(o),Hn(o,ns);for(var t=o.first;t!==null;)nP(t,e),t=t.next}}function sP(o){Hn(o,ns);for(var e=o.first;e!==null;)sP(e),e=e.next}function lH(o){let e=0,t=kd(0),i;return()=>{v1()&&(m(t),Ab(()=>(e===0&&(i=Xa(()=>o(()=>Gg(t)))),e+=1,()=>{Ll(()=>{e-=1,e===0&&(i==null||i(),i=void 0,Gg(t))})})))}}var cH=Du|Ju;function dH(o,e,t,i){new hH(o,e,t,i)}var To,Ox,Mo,Cc,Ys,No,Hs,uo,ya,xc,ul,ou,tp,ip,Sa,bv,Wn,uH,gH,fH,Ay,Nm,Rm,Oy,Fy;class hH{constructor(e,t,i,n){li(this,Wn);vi(this,"parent");vi(this,"is_pending",!1);vi(this,"transform_error");li(this,To);li(this,Ox,null);li(this,Mo);li(this,Cc);li(this,Ys);li(this,No,null);li(this,Hs,null);li(this,uo,null);li(this,ya,null);li(this,xc,0);li(this,ul,0);li(this,ou,!1);li(this,tp,new Set);li(this,ip,new Set);li(this,Sa,null);li(this,bv,lH(()=>(ci(this,Sa,kd(G(this,xc))),()=>{ci(this,Sa,null)})));var s;ci(this,To,e),ci(this,Mo,t),ci(this,Cc,r=>{var a=Pi;a.b=this,a.f|=Dy,i(r)}),this.parent=Pi.b,this.transform_error=n??((s=this.parent)==null?void 0:s.transform_error)??(r=>r),ci(this,Ys,y1(()=>{tn(this,Wn,Ay).call(this)},cH))}defer_effect(e){JE(e,G(this,tp),G(this,ip))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!G(this,Mo).pending}update_pending_count(e,t){tn(this,Wn,Oy).call(this,e,t),ci(this,xc,G(this,xc)+e),!(!G(this,Sa)||G(this,ou))&&(ci(this,ou,!0),Ll(()=>{ci(this,ou,!1),G(this,Sa)&&Pu(G(this,Sa),G(this,xc))}))}get_effect_pending(){return G(this,bv).call(this),m(G(this,Sa))}error(e){if(!G(this,Mo).onerror&&!G(this,Mo).failed)throw e;Ut!=null&&Ut.is_fork?(G(this,No)&&Ut.skip_effect(G(this,No)),G(this,Hs)&&Ut.skip_effect(G(this,Hs)),G(this,uo)&&Ut.skip_effect(G(this,uo)),Ut.oncommit(()=>{tn(this,Wn,Fy).call(this,e)})):tn(this,Wn,Fy).call(this,e)}}To=new WeakMap,Ox=new WeakMap,Mo=new WeakMap,Cc=new WeakMap,Ys=new WeakMap,No=new WeakMap,Hs=new WeakMap,uo=new WeakMap,ya=new WeakMap,xc=new WeakMap,ul=new WeakMap,ou=new WeakMap,tp=new WeakMap,ip=new WeakMap,Sa=new WeakMap,bv=new WeakMap,Wn=new WeakSet,uH=function(){try{ci(this,No,Ro(()=>G(this,Cc).call(this,G(this,To))))}catch(e){this.error(e)}},gH=function(e){const t=G(this,Mo).failed;t&&ci(this,uo,Ro(()=>{t(G(this,To),()=>e,()=>()=>{})}))},fH=function(){const e=G(this,Mo).pending;e&&(this.is_pending=!0,ci(this,Hs,Ro(()=>e(G(this,To)))),Ll(()=>{var t=ci(this,ya,document.createDocumentFragment()),i=Ta();t.append(i),ci(this,No,tn(this,Wn,Rm).call(this,()=>Ro(()=>G(this,Cc).call(this,i)))),G(this,ul)===0&&(G(this,To).before(t),ci(this,ya,null),Mc(G(this,Hs),()=>{ci(this,Hs,null)}),tn(this,Wn,Nm).call(this,Ut))}))},Ay=function(){try{if(this.is_pending=this.has_pending_snippet(),ci(this,ul,0),ci(this,xc,0),ci(this,No,Ro(()=>{G(this,Cc).call(this,G(this,To))})),G(this,ul)>0){var e=ci(this,ya,document.createDocumentFragment());C1(G(this,No),e);const t=G(this,Mo).pending;ci(this,Hs,Ro(()=>t(G(this,To))))}else tn(this,Wn,Nm).call(this,Ut)}catch(t){this.error(t)}},Nm=function(e){this.is_pending=!1,e.transfer_effects(G(this,tp),G(this,ip))},Rm=function(e){var t=Pi,i=Di,n=bs;ta(G(this,Ys)),jo(G(this,Ys)),Eu(G(this,Ys).ctx);try{return Id.ensure(),e()}catch(s){return YE(s),null}finally{ta(t),jo(i),Eu(n)}},Oy=function(e,t){var i;if(!this.has_pending_snippet()){this.parent&&tn(i=this.parent,Wn,Oy).call(i,e,t);return}ci(this,ul,G(this,ul)+e),G(this,ul)===0&&(tn(this,Wn,Nm).call(this,t),G(this,Hs)&&Mc(G(this,Hs),()=>{ci(this,Hs,null)}),G(this,ya)&&(G(this,To).before(G(this,ya)),ci(this,ya,null)))},Fy=function(e){G(this,No)&&(so(G(this,No)),ci(this,No,null)),G(this,Hs)&&(so(G(this,Hs)),ci(this,Hs,null)),G(this,uo)&&(so(G(this,uo)),ci(this,uo,null));var t=G(this,Mo).onerror;let i=G(this,Mo).failed;var n=!1,s=!1;const r=()=>{if(n){QF();return}n=!0,s&&FF(),G(this,uo)!==null&&Mc(G(this,uo),()=>{ci(this,uo,null)}),tn(this,Wn,Rm).call(this,()=>{tn(this,Wn,Ay).call(this)})},a=c=>{try{s=!0,t==null||t(c,r),s=!1}catch(h){ml(h,G(this,Ys)&&G(this,Ys).parent)}i&&ci(this,uo,tn(this,Wn,Rm).call(this,()=>{try{return Ro(()=>{var h=Pi;h.b=this,h.f|=Dy,i(G(this,To),()=>c,()=>r)})}catch(h){return ml(h,G(this,Ys).parent),null}}))};Ll(()=>{var c;try{c=this.transform_error(e)}catch(h){ml(h,G(this,Ys)&&G(this,Ys).parent);return}c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(a,h=>ml(h,G(this,Ys)&&G(this,Ys).parent)):a(c)})};function pH(o,e,t,i){const n=Sf;var s=o.filter(f=>!f.settled);if(t.length===0&&s.length===0){i(e.map(n));return}var r=Pi,a=mH(),c=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(f=>f.promise)):null;function h(f){if((r.f&zo)===0){a();try{i(f)}catch(v){ml(v,r)}c_()}}var u=oP();if(t.length===0){c.then(()=>h(e.map(n))).finally(u);return}function g(){Promise.all(t.map(f=>_H(f))).then(f=>h([...e.map(n),...f])).catch(f=>ml(f,r)).finally(u)}c?c.then(()=>{a(),g(),c_()}):g()}function mH(){var o=Pi,e=Di,t=bs,i=Ut;return function(s=!0){ta(o),jo(e),Eu(t),s&&(o.f&zo)===0&&(i==null||i.activate(),i==null||i.apply())}}function c_(o=!0){ta(null),jo(null),Eu(null),o&&(Ut==null||Ut.deactivate())}function oP(){var o=Pi,e=o.b,t=Ut,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 Sf(o){var e=ws|as;return Pi!==null&&(Pi.f|=Ju),{ctx:bs,deps:null,effects:null,equals:KE,f:e,fn:o,reactions:null,rv:0,v:es,wv:0,parent:Pi,ac:null}}const Qp=Symbol("obsolete");function _H(o,e,t){let i=Pi;i===null&&kF();var n=void 0,s=kd(es),r=!Di,a=new Set;return EH(()=>{var v,_;var c=Pi,h=VE();n=h.promise;try{Promise.resolve(o()).then(h.resolve,y=>{y!==Nb&&h.reject(y)}).finally(c_)}catch(y){h.reject(y),c_()}var u=Ut;if(r){if((c.f&Qu)!==0)var g=oP();if((v=i.b)!=null&&v.is_rendered())(_=u.async_deriveds.get(c))==null||_.reject(Qp);else for(const y of a.values())y.reject(Qp);a.add(h),u.async_deriveds.set(c,h)}const f=(y,S=void 0)=>{g==null||g(),a.delete(h),S!==Qp&&(u.activate(),S?(s.f|=xl,Pu(s,S)):((s.f&xl)!==0&&(s.f^=xl),Pu(s,y)),u.deactivate())};h.promise.then(f,y=>f(null,y||"unknown"))}),b1(()=>{for(const c of a)c.reject(Qp)}),new Promise(c=>{function h(u){function g(){u===n?c(s):h(n)}u.then(g,g)}h(n)})}function Vt(o){const e=Sf(o);return CP(e),e}function rP(o){const e=Sf(o);return e.equals=GE,e}function vH(o){var e=o.effects;if(e!==null){o.effects=null;for(var t=0;t<e.length;t+=1)so(e[t])}}function m1(o){var e,t=Pi,i=o.parent;if(!Ba&&i!==null&&o.v!==es&&(i.f&(zo|Vs))!==0)return XF(),o.v;ta(i);try{o.f&=~Ld,vH(o),e=kP(o)}finally{ta(t)}return e}function aP(o){var e=m1(o);if(!o.equals(e)&&(o.wv=LP(),(!(Ut!=null&&Ut.is_fork)||o.deps===null)&&(Ut!==null?(Ut.capture(o,e,!0),qg==null||qg.capture(o,e,!0)):o.v=e,o.deps===null))){Hn(o,ns);return}Ba||(gs!==null?(v1()||Ut!=null&&Ut.is_fork)&&gs.set(o,e):g1(o))}function bH(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(Nb),i.fn!==null&&(i.teardown=pl),i.ac=null,Cf(i,0),S1(i))}function lP(o){if(o.effects!==null)for(const e of o.effects)e.teardown&&e.fn!==null&&Tu(e)}let d_=new Set;const Pc=new Map;let cP=!1;function kd(o,e){var t={f:0,v:o,reactions:null,equals:KE,rv:0,wv:0};return t}function j(o,e){const t=kd(o);return CP(t),t}function wH(o,e=!1,t=!0){const i=kd(o);return e||(i.equals=GE),i}function I(o,e,t=!1){Di!==null&&(!gr||(Di.f&a_)!==0)&&ZE()&&(Di.f&(ws|ur|Zh|a_))!==0&&(Xr===null||!Xr.has(o))&&OF();let i=t?Li(e):e;return Pu(o,i,Mm)}function Pu(o,e,t=null){if(!o.equals(e)){Pc.set(o,Ba?e:o.v);var i=Id.ensure();if(i.capture(o,e),(o.f&ws)!==0){const n=o;(o.f&as)!==0&&m1(n),gs===null&&g1(n)}o.wv=LP(),dP(o,as,t),Pi!==null&&(Pi.f&ns)!==0&&(Pi.f&(fr|ql))===0&&(Po===null?TH([o]):Po.push(o)),!i.is_fork&&d_.size>0&&!cP&&yH()}return e}function yH(){cP=!1;for(const o of d_){(o.f&ns)!==0&&Hn(o,ea);let e;try{e=xp(o)}catch{e=!0}e&&Tu(o)}d_.clear()}function UL(o,e=1){var t=m(o),i=e===1?t++:t--;return I(o,t),i}function Gg(o){I(o,o.v+1)}function dP(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,c=(a&as)===0;if(c&&Hn(r,e),(a&a_)!==0)d_.add(r);else if((a&ws)!==0){var h=r;gs==null||gs.delete(h),(a&Ld)===0&&(a&Bo&&(Pi===null||(Pi.f&l_)===0)&&(r.f|=Ld),dP(h,ea,t))}else if(c){var u=r;(a&ur)!==0&&Jo!==null&&Jo.add(u),t!==null?t.push(u):p1(u)}}}function Li(o){if(typeof o!="object"||o===null||Ec in o)return o;const e=zE(o);if(e!==wF&&e!==yF)return o;var t=new Map,i=u1(o),n=j(0),s=Nc,r=a=>{if(Nc===s)return a();var c=Di,h=Nc;jo(null),KL(s);var u=a();return jo(c),KL(h),u};return i&&t.set("length",j(o.length)),new Proxy(o,{defineProperty(a,c,h){(!("value"in h)||h.configurable===!1||h.enumerable===!1||h.writable===!1)&&RF();var u=t.get(c);return u===void 0?r(()=>{var g=j(h.value);return t.set(c,g),g}):I(u,h.value,!0),!0},deleteProperty(a,c){var h=t.get(c);if(h===void 0){if(c in a){const u=r(()=>j(es));t.set(c,u),Gg(n)}}else I(h,es),Gg(n);return!0},get(a,c,h){var v;if(c===Ec)return o;var u=t.get(c),g=c in a;if(u===void 0&&(!g||(v=Gh(a,c))!=null&&v.writable)&&(u=r(()=>{var _=Li(g?a[c]:es),y=j(_);return y}),t.set(c,u)),u!==void 0){var f=m(u);return f===es?void 0:f}return Reflect.get(a,c,h)},getOwnPropertyDescriptor(a,c){var h=Reflect.getOwnPropertyDescriptor(a,c);if(h&&"value"in h){var u=t.get(c);u&&(h.value=m(u))}else if(h===void 0){var g=t.get(c),f=g==null?void 0:g.v;if(g!==void 0&&f!==es)return{enumerable:!0,configurable:!0,value:f,writable:!0}}return h},has(a,c){var f;if(c===Ec)return!0;var h=t.get(c),u=h!==void 0&&h.v!==es||Reflect.has(a,c);if(h!==void 0||Pi!==null&&(!u||(f=Gh(a,c))!=null&&f.writable)){h===void 0&&(h=r(()=>{var v=u?Li(a[c]):es,_=j(v);return _}),t.set(c,h));var g=m(h);if(g===es)return!1}return u},set(a,c,h,u){var M;var g=t.get(c),f=c in a;if(i&&c==="length")for(var v=h;v<g.v;v+=1){var _=t.get(v+"");_!==void 0?I(_,es):v in a&&(_=r(()=>j(es)),t.set(v+"",_))}if(g===void 0)(!f||(M=Gh(a,c))!=null&&M.writable)&&(g=r(()=>j(void 0)),I(g,Li(h)),t.set(c,g));else{f=g.v!==es;var y=r(()=>Li(h));I(g,y)}var S=Reflect.getOwnPropertyDescriptor(a,c);if(S!=null&&S.set&&S.set.call(u,h),!f){if(i&&typeof c=="string"){var x=t.get("length"),E=Number(c);Number.isInteger(E)&&E>=x.v&&I(x,E+1)}Gg(n)}return!0},ownKeys(a){m(n);var c=Reflect.ownKeys(a).filter(g=>{var f=t.get(g);return f===void 0||f.v!==es});for(var[h,u]of t)u.v!==es&&!(h in a)&&c.push(h);return c},setPrototypeOf(){AF()}})}function jL(o){try{if(o!==null&&typeof o=="object"&&Ec in o)return o[Ec]}catch{}return o}function SH(o,e){return Object.is(jL(o),jL(e))}var Tc,hP,uP,gP,fP;function CH(){if(Tc===void 0){Tc=window,hP=document,uP=/Firefox/.test(navigator.userAgent);var o=Element.prototype,e=Node.prototype,t=Text.prototype;gP=Gh(e,"firstChild").get,fP=Gh(e,"nextSibling").get,BL(o)&&(o[Py]=void 0,o[Pm]=null,o[Ty]=void 0,o.__e=void 0),BL(t)&&(t[Dg]=void 0)}}function Ta(o=""){return document.createTextNode(o)}function $r(o){return gP.call(o)}function Cp(o){return fP.call(o)}function k(o,e){return $r(o)}function Wt(o,e=!1){{var t=$r(o);return t instanceof Comment&&t.data===""?Cp(t):t}}function D(o,e=1,t=!1){let i=o;for(;e--;)i=Cp(i);return i}function xH(o){o.textContent=""}function pP(){return!1}function mP(o,e,t){return e==null||e===qE?t?document.createElement(o,{is:t}):document.createElement(o):t?document.createElementNS(e,o,{is:t}):document.createElementNS(e,o)}let $L=!1;function LH(){$L||($L=!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 Rb(o){var e=Di,t=Pi;jo(null),ta(null);try{return o()}finally{jo(e),ta(t)}}function _1(o,e,t,i=t){o.addEventListener(e,()=>Rb(t));const n=o[Tm];n?o[Tm]=()=>{n(),i(!0)}:o[Tm]=()=>i(!0),LH()}function IH(o){Pi===null&&(Di===null&&TF(),PF()),Ba&&EF()}function kH(o,e){var t=e.last;t===null?e.last=e.first=o:(t.next=o,o.prev=t,e.last=o)}function Za(o,e){var t=Pi;t!==null&&(t.f&Vs)!==0&&(o|=Vs);var i={ctx:bs,deps:null,nodes:null,f:o|as|Bo,first:null,fn:e,last:null,next:null,parent:t,b:t&&t.b,prev:null,teardown:null,wv:0,ac:null};Ut==null||Ut.register_created_effect(i);var n=i;if((o&ku)!==0)Nh!==null?Nh.push(i):Id.ensure().schedule(i);else if(e!==null){try{Tu(i)}catch(r){throw so(i),r}n.deps===null&&n.teardown===null&&n.nodes===null&&n.first===n.last&&(n.f&Ju)===0&&(n=n.first,(o&ur)!==0&&(o&Du)!==0&&n!==null&&(n.f|=Du))}if(n!==null&&(n.parent=t,t!==null&&kH(n,t),Di!==null&&(Di.f&ws)!==0&&(o&ql)===0)){var s=Di;(s.effects??(s.effects=[])).push(n)}return i}function v1(){return Di!==null&&!gr}function b1(o){const e=Za(Mb,null);return Hn(e,ns),e.teardown=o,e}function kn(o){IH();var e=Pi.f,t=!Di&&(e&fr)!==0&&bs!==null&&!bs.i;if(t){var i=bs;(i.e??(i.e=[])).push(o)}else return _P(o)}function _P(o){return Za(ku|xF,o)}function DH(o){Id.ensure();const e=Za(ql|Ju,o);return(t={})=>new Promise(i=>{t.outro?Mc(e,()=>{so(e),i(void 0)}):(so(e),i(void 0))})}function w1(o){return Za(ku,o)}function EH(o){return Za(Zh|Ju,o)}function Ab(o,e=0){return Za(Mb|e,o)}function se(o,e=[],t=[],i=[]){pH(i,e,t,n=>{Za(Mb,()=>o(...n.map(m)))})}function y1(o,e=0){var t=Za(ur|e,o);return t}function Ro(o){return Za(fr|Ju,o)}function vP(o){var e=o.teardown;if(e!==null){const t=Ba,i=Di;qL(!0),jo(null);try{e.call(null)}finally{qL(t),jo(i)}}}function S1(o,e=!1){var t=o.first;for(o.first=o.last=null;t!==null;){const n=t.ac;n!==null&&Rb(()=>{n.abort(Nb)});var i=t.next;(t.f&ql)!==0?t.parent=null:so(t,e),t=i}}function PH(o){for(var e=o.first;e!==null;){var t=e.next;(e.f&fr)===0&&so(e),e=t}}function so(o,e=!0){var t=!1;(e||(o.f&CF)!==0)&&o.nodes!==null&&o.nodes.end!==null&&(bP(o.nodes.start,o.nodes.end),t=!0),Hn(o,Ey),S1(o,e&&!t),Cf(o,0);var i=o.nodes&&o.nodes.t;if(i!==null)for(const s of i)s.stop();vP(o),o.f^=Ey,o.f|=zo;var n=o.parent;n!==null&&n.first!==null&&wP(o),o.next=o.prev=o.teardown=o.ctx=o.deps=o.fn=o.nodes=o.ac=o.b=null}function bP(o,e){for(;o!==null;){var t=o===e?null:Cp(o);o.remove(),o=t}}function wP(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 Mc(o,e,t=!0){var i=[];yP(o,i,!0);var n=()=>{t&&so(o),e&&e()},s=i.length;if(s>0){var r=()=>--s||n();for(var a of i)a.out(r)}else n()}function yP(o,e,t){if((o.f&Vs)===0){o.f^=Vs;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&ql)===0){var r=(n.f&Du)!==0||(n.f&fr)!==0&&(o.f&ur)!==0;yP(n,e,r?t:!1)}n=s}}}function h_(o){SP(o,!0)}function SP(o,e){if((o.f&Vs)!==0){o.f^=Vs,(o.f&ns)===0&&(Hn(o,as),Id.ensure().schedule(o));for(var t=o.first;t!==null;){var i=t.next,n=(t.f&Du)!==0||(t.f&fr)!==0;SP(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 C1(o,e){if(o.nodes)for(var t=o.nodes.start,i=o.nodes.end;t!==null;){var n=t===i?null:Cp(t);e.append(t),t=n}}let Am=!1,Ba=!1;function qL(o){Ba=o}let Di=null,gr=!1;function jo(o){Di=o}let Pi=null;function ta(o){Pi=o}let Xr=null;function CP(o){Di!==null&&(Xr??(Xr=new Set)).add(o)}let Qs=null,co=0,Po=null;function TH(o){Po=o}let xP=1,vc=0,Nc=vc;function KL(o){Nc=o}function LP(){return++xP}function xp(o){var e=o.f;if((e&as)!==0)return!0;if(e&ws&&(o.f&=~Ld),(e&ea)!==0){for(var t=o.deps,i=t.length,n=0;n<i;n++){var s=t[n];if(xp(s)&&aP(s),s.wv>o.wv)return!0}(e&Bo)!==0&&gs===null&&Hn(o,ns)}return!1}function IP(o,e,t=!0){var i=o.reactions;if(i!==null&&!(Xr!==null&&Xr.has(o)))for(var n=0;n<i.length;n++){var s=i[n];(s.f&ws)!==0?IP(s,e,!1):e===s&&(t?Hn(s,as):(s.f&ns)!==0&&Hn(s,ea),p1(s))}}function kP(o){var y;var e=Qs,t=co,i=Po,n=Di,s=Xr,r=bs,a=gr,c=Nc,h=o.f;Qs=null,co=0,Po=null,Di=(h&(fr|ql))===0?o:null,Xr=null,Eu(o.ctx),gr=!1,Nc=++vc,o.ac!==null&&(Rb(()=>{o.ac.abort(Nb)}),o.ac=null);try{o.f|=l_;var u=o.fn,g=u();o.f|=Qu;var f=o.deps,v=Ut==null?void 0:Ut.is_fork;if(Qs!==null){var _;if(v||Cf(o,co),f!==null&&co>0)for(f.length=co+Qs.length,_=0;_<Qs.length;_++)f[co+_]=Qs[_];else o.deps=f=Qs;if(v1()&&(o.f&Bo)!==0)for(_=co;_<f.length;_++)((y=f[_]).reactions??(y.reactions=[])).push(o)}else!v&&f!==null&&co<f.length&&(Cf(o,co),f.length=co);if(ZE()&&Po!==null&&!gr&&f!==null&&(o.f&(ws|ea|as))===0)for(_=0;_<Po.length;_++)IP(Po[_],o);if(n!==null&&n!==o){if(vc++,n.deps!==null)for(let S=0;S<t;S+=1)n.deps[S].rv=vc;if(e!==null)for(const S of e)S.rv=vc;Po!==null&&(i===null?i=Po:i.push(...Po))}return(o.f&xl)!==0&&(o.f^=xl),g}catch(S){return YE(S)}finally{o.f^=l_,Qs=e,co=t,Po=i,Di=n,Xr=s,Eu(r),gr=a,Nc=c}}function MH(o,e){let t=e.reactions;if(t!==null){var i=_F.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&ws)!==0&&(Qs===null||!r_.call(Qs,e))){var s=e;(s.f&Bo)!==0&&(s.f^=Bo,s.f&=~Ld),s.v!==es&&g1(s),bH(s),Cf(s,0)}}function Cf(o,e){var t=o.deps;if(t!==null)for(var i=e;i<t.length;i++)MH(o,t[i])}function Tu(o){var e=o.f;if((e&zo)===0){Hn(o,ns);var t=Pi,i=Am;Pi=o,Am=!0;try{(e&(ur|UE))!==0?PH(o):S1(o),vP(o);var n=kP(o);o.teardown=typeof n=="function"?n:null,o.wv=xP;var s;BE&&eH&&(o.f&as)!==0&&o.deps}finally{Am=i,Pi=t}}}async function Hy(){await Promise.resolve(),rH()}function m(o){var e=o.f,t=(e&ws)!==0;if(Di!==null&&!gr){var i=Pi!==null&&(Pi.f&zo)!==0;if(!i&&(Xr===null||!Xr.has(o))){var n=Di.deps;if((Di.f&l_)!==0)o.rv<vc&&(o.rv=vc,Qs===null&&n!==null&&n[co]===o?co++:Qs===null?Qs=[o]:Qs.push(o));else{Di.deps??(Di.deps=[]),r_.call(Di.deps,o)||Di.deps.push(o);var s=o.reactions;s===null?o.reactions=[Di]:r_.call(s,Di)||s.push(Di)}}}if(Ba&&Pc.has(o))return Pc.get(o);if(t){var r=o;if(Ba){var a=r.v;return((r.f&ns)===0&&r.reactions!==null||EP(r))&&(a=m1(r)),Pc.set(r,a),a}var c=(r.f&Bo)===0&&!gr&&Di!==null&&(Am||(Di.f&Bo)!==0),h=(r.f&Qu)===0;xp(r)&&(c&&(r.f|=Bo),aP(r)),c&&!h&&(lP(r),DP(r))}if(gs!=null&&gs.has(o))return gs.get(o);if((o.f&xl)!==0)throw o.v;return o.v}function DP(o){if(o.f|=Bo,o.deps!==null)for(const e of o.deps)(e.reactions??(e.reactions=[])).push(o),(e.f&ws)!==0&&(e.f&Bo)===0&&(lP(e),DP(e))}function EP(o){if(o.v===es)return!0;if(o.deps===null)return!1;for(const e of o.deps)if(Pc.has(e)||(e.f&ws)!==0&&EP(e))return!0;return!1}function Xa(o){var e=gr;try{return gr=!0,o()}finally{gr=e}}const NH=["touchstart","touchmove"];function RH(o){return NH.includes(o)}const bc=Symbol("events"),PP=new Set,Wy=new Set;function AH(o,e,t,i={}){function n(s){if(i.capture||By.call(e,s),!s.cancelBubble)return Rb(()=>t==null?void 0:t.call(this,s))}return o.startsWith("pointer")||o.startsWith("touch")||o==="wheel"?Ll(()=>{e.addEventListener(o,n,i)}):e.addEventListener(o,n,i),n}function _o(o,e,t,i,n){var s={capture:i,passive:n},r=AH(o,e,t,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&b1(()=>{e.removeEventListener(o,r,s)})}function de(o,e,t){(e[bc]??(e[bc]={}))[o]=t}function Ko(o){for(var e=0;e<o.length;e++)PP.add(o[e]);for(var t of Wy)t(o)}let GL=null;function By(o){var y,S;var e=this,t=e.ownerDocument,i=o.type,n=((y=o.composedPath)==null?void 0:y.call(o))||[],s=n[0]||o.target;GL=o;var r=0,a=GL===o&&o[bc];if(a){var c=n.indexOf(a);if(c!==-1&&(e===document||e===window)){o[bc]=e;return}var h=n.indexOf(e);if(h===-1)return;c<=h&&(r=c)}if(s=n[r]||o.target,s!==e){vF(o,"currentTarget",{configurable:!0,get(){return s||t}});var u=Di,g=Pi;jo(null),ta(null);try{for(var f,v=[];s!==null&&s!==e;){try{var _=(S=s[bc])==null?void 0:S[i];_!=null&&(!s.disabled||o.target===s)&&_.call(s,o)}catch(x){f?v.push(x):f=x}if(o.cancelBubble)break;r++,s=r<n.length?n[r]:null}if(f){for(let x of v)queueMicrotask(()=>{throw x});throw f}}finally{o[bc]=e,delete o.currentTarget,jo(u),ta(g)}}}var hD;const Lw=((hD=globalThis==null?void 0:globalThis.window)==null?void 0:hD.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:o=>o});function OH(o){return(Lw==null?void 0:Lw.createHTML(o))??o}function TP(o){var e=mP("template");return e.innerHTML=OH(o.replaceAll("<!>","<!---->")),e.content}function Dd(o,e){var t=Pi;t.nodes===null&&(t.nodes={start:o,end:e,a:null,t:null})}function B(o,e){var t=(e&qF)!==0,i=(e&KF)!==0,n,s=!o.startsWith("<!>");return()=>{n===void 0&&(n=TP(s?o:"<!>"+o),t||(n=$r(n)));var r=i||uP?document.importNode(n,!0):n.cloneNode(!0);if(t){var a=$r(r),c=r.lastChild;Dd(a,c)}else Dd(r,r);return r}}function FH(o,e,t="svg"){var i=!o.startsWith("<!>"),n=`<${t}>${i?o:"<!>"+o}</${t}>`,s;return()=>{if(!s){var r=TP(n),a=$r(r);s=$r(a)}var c=s.cloneNode(!0);return Dd(c,c),c}}function MP(o,e){return FH(o,e,"svg")}function Ma(o=""){{var e=Ta(o+"");return Dd(e,e),e}}function _s(){var o=document.createDocumentFragment(),e=document.createComment(""),t=Ta();return o.append(e,t),Dd(e,t),o}function N(o,e){o!==null&&o.before(e)}function oe(o,e){var t=e==null?"":typeof e=="object"?`${e}`:e;t!==(o[Dg]??(o[Dg]=o.nodeValue))&&(o[Dg]=t,o.nodeValue=`${t}`)}function HH(o,e){return WH(o,e)}const Jp=new Map;function WH(o,{target:e,anchor:t,props:i={},events:n,context:s,intro:r=!0,transformError:a}){CH();var c=void 0,h=DH(()=>{var u=t??e.appendChild(Ta());dH(u,{pending:()=>{}},v=>{ao({});var _=bs;s&&(_.c=s),n&&(i.$$events=n),c=o(v,i)||{},lo()},a);var g=new Set,f=v=>{for(var _=0;_<v.length;_++){var y=v[_];if(!g.has(y)){g.add(y);var S=RH(y);for(const M of[e,document]){var x=Jp.get(M);x===void 0&&(x=new Map,Jp.set(M,x));var E=x.get(y);E===void 0?(M.addEventListener(y,By,{passive:S}),x.set(y,1)):x.set(y,E+1)}}}};return f(Tb(PP)),Wy.add(f),()=>{var S;for(var v of g)for(const x of[e,document]){var _=Jp.get(x),y=_.get(v);--y==0?(x.removeEventListener(v,By),_.delete(v),_.size===0&&Jp.delete(x)):_.set(v,y)}Wy.delete(f),u!==t&&((S=u.parentNode)==null||S.removeChild(u))}});return BH.set(c,h),c}let BH=new WeakMap;var nr,Fr,go,Lc,np,sp,wv;class zH{constructor(e,t=!0){vi(this,"anchor");li(this,nr,new Map);li(this,Fr,new Map);li(this,go,new Map);li(this,Lc,new Set);li(this,np,!0);li(this,sp,e=>{if(G(this,nr).has(e)){var t=G(this,nr).get(e),i=G(this,Fr).get(t);if(i)h_(i),G(this,Lc).delete(t);else{var n=G(this,go).get(t);n&&(h_(n.effect),G(this,Fr).set(t,n.effect),G(this,go).delete(t),n.fragment.lastChild.remove(),this.anchor.before(n.fragment),i=n.effect)}for(const[s,r]of G(this,nr)){if(G(this,nr).delete(s),s===e)break;const a=G(this,go).get(r);a&&(so(a.effect),G(this,go).delete(r))}for(const[s,r]of G(this,Fr)){if(s===t||G(this,Lc).has(s))continue;const a=()=>{if(Array.from(G(this,nr).values()).includes(s)){var h=document.createDocumentFragment();C1(r,h),h.append(Ta()),G(this,go).set(s,{effect:r,fragment:h})}else so(r);G(this,Lc).delete(s),G(this,Fr).delete(s)};G(this,np)||!i?(G(this,Lc).add(s),Mc(r,a,!1)):a()}}});li(this,wv,e=>{G(this,nr).delete(e);const t=Array.from(G(this,nr).values());for(const[i,n]of G(this,go))t.includes(i)||(so(n.effect),G(this,go).delete(i))});this.anchor=e,ci(this,np,t)}ensure(e,t){var i=Ut,n=pP();if(t&&!G(this,Fr).has(e)&&!G(this,go).has(e))if(n){var s=document.createDocumentFragment(),r=Ta();s.append(r),G(this,go).set(e,{effect:Ro(()=>t(r)),fragment:s})}else G(this,Fr).set(e,Ro(()=>t(this.anchor)));if(G(this,nr).set(i,e),n){for(const[a,c]of G(this,Fr))a===e?i.unskip_effect(c):i.skip_effect(c);for(const[a,c]of G(this,go))a===e?i.unskip_effect(c.effect):i.skip_effect(c.effect);i.oncommit(G(this,sp)),i.ondiscard(G(this,wv))}else G(this,sp).call(this,i)}}nr=new WeakMap,Fr=new WeakMap,go=new WeakMap,Lc=new WeakMap,np=new WeakMap,sp=new WeakMap,wv=new WeakMap;function J(o,e,t=!1){var i=new zH(o),n=t?Du:0;function s(r,a){i.ensure(r,a)}y1(()=>{var r=!1;e((a,c=0)=>{r=!0,s(c,a)}),r||s(-1,null)},n)}function ks(o,e){return e}function VH(o,e,t){for(var i=[],n=e.length,s,r=e.length,a=0;a<n;a++){let g=e[a];Mc(g,()=>{if(s){if(s.pending.delete(g),s.done.add(g),s.pending.size===0){var f=o.outrogroups;zy(o,Tb(s.done)),f.delete(s),f.size===0&&(o.outrogroups=null)}}else r-=1},!1)}if(r===0){var c=i.length===0&&t!==null;if(c){var h=t,u=h.parentNode;xH(u),u.append(h),o.items.clear()}zy(o,e,!c)}else s={pending:new Set(e),done:new Set},(o.outrogroups??(o.outrogroups=new Set)).add(s)}function zy(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|=jr;const r=document.createDocumentFragment();C1(s,r)}else so(e[n],t)}}var ZL;function an(o,e,t,i,n,s=null){var r=o,a=new Map,c=(e&$E)!==0;if(c){var h=o;r=h.appendChild(Ta())}var u=null,g=rP(()=>{var M=t();return u1(M)?M:M==null?[]:Tb(M)}),f,v=new Map,_=!0;function y(M){(E.effect.f&zo)===0&&(E.pending.delete(M),E.fallback=u,UH(E,f,r,e,i),u!==null&&(f.length===0?(u.f&jr)===0?h_(u):(u.f^=jr,Tg(u,null,r)):Mc(u,()=>{u=null})))}function S(M){E.pending.delete(M)}var x=y1(()=>{f=m(g);for(var M=f.length,F=new Set,R=Ut,Z=pP(),q=0;q<M;q+=1){var he=f[q],pe=i(he,q),Ce=_?null:a.get(pe);Ce?(Ce.v&&Pu(Ce.v,he),Ce.i&&Pu(Ce.i,q),Z&&R.unskip_effect(Ce.e)):(Ce=jH(a,_?r:ZL??(ZL=Ta()),he,pe,q,n,e,t),_||(Ce.e.f|=jr),a.set(pe,Ce)),F.add(pe)}if(M===0&&s&&!u&&(_?u=Ro(()=>s(r)):(u=Ro(()=>s(ZL??(ZL=Ta()))),u.f|=jr)),M>F.size&&DF(),!_)if(v.set(R,F),Z){for(const[Pe,je]of a)F.has(Pe)||R.skip_effect(je.e);R.oncommit(y),R.ondiscard(S)}else y(R);m(g)}),E={effect:x,items:a,pending:v,outrogroups:null,fallback:u};_=!1}function vg(o){for(;o!==null&&(o.f&fr)===0;)o=o.next;return o}function UH(o,e,t,i,n){var Ce,Pe,je,qt,Ge,Xt,pt,Kt,ae;var s=(i&BF)!==0,r=e.length,a=o.items,c=vg(o.effect.first),h,u=null,g,f=[],v=[],_,y,S,x;if(s)for(x=0;x<r;x+=1)_=e[x],y=n(_,x),S=a.get(y).e,(S.f&jr)===0&&((Pe=(Ce=S.nodes)==null?void 0:Ce.a)==null||Pe.measure(),(g??(g=new Set)).add(S));for(x=0;x<r;x+=1){if(_=e[x],y=n(_,x),S=a.get(y).e,o.outrogroups!==null)for(const Te of o.outrogroups)Te.pending.delete(S),Te.done.delete(S);if((S.f&Vs)!==0&&(h_(S),s&&((qt=(je=S.nodes)==null?void 0:je.a)==null||qt.unfix(),(g??(g=new Set)).delete(S))),(S.f&jr)!==0)if(S.f^=jr,S===c)Tg(S,null,t);else{var E=u?u.next:c;S===o.effect.last&&(o.effect.last=S.prev),S.prev&&(S.prev.next=S.next),S.next&&(S.next.prev=S.prev),Ja(o,u,S),Ja(o,S,E),Tg(S,E,t),u=S,f=[],v=[],c=vg(u.next);continue}if(S!==c){if(h!==void 0&&h.has(S)){if(f.length<v.length){var M=v[0],F;u=M.prev;var R=f[0],Z=f[f.length-1];for(F=0;F<f.length;F+=1)Tg(f[F],M,t);for(F=0;F<v.length;F+=1)h.delete(v[F]);Ja(o,R.prev,Z.next),Ja(o,u,R),Ja(o,Z,M),c=M,u=Z,x-=1,f=[],v=[]}else h.delete(S),Tg(S,c,t),Ja(o,S.prev,S.next),Ja(o,S,u===null?o.effect.first:u.next),Ja(o,u,S),u=S;continue}for(f=[],v=[];c!==null&&c!==S;)(h??(h=new Set)).add(c),v.push(c),c=vg(c.next);if(c===null)continue}(S.f&jr)===0&&f.push(S),u=S,c=vg(S.next)}if(o.outrogroups!==null){for(const Te of o.outrogroups)Te.pending.size===0&&(zy(o,Tb(Te.done)),(Ge=o.outrogroups)==null||Ge.delete(Te));o.outrogroups.size===0&&(o.outrogroups=null)}if(c!==null||h!==void 0){var q=[];if(h!==void 0)for(S of h)(S.f&Vs)===0&&q.push(S);for(;c!==null;)(c.f&Vs)===0&&c!==o.fallback&&q.push(c),c=vg(c.next);var he=q.length;if(he>0){var pe=(i&$E)!==0&&r===0?t:null;if(s){for(x=0;x<he;x+=1)(pt=(Xt=q[x].nodes)==null?void 0:Xt.a)==null||pt.measure();for(x=0;x<he;x+=1)(ae=(Kt=q[x].nodes)==null?void 0:Kt.a)==null||ae.fix()}VH(o,q,pe)}}s&&Ll(()=>{var Te,ve;if(g!==void 0)for(S of g)(ve=(Te=S.nodes)==null?void 0:Te.a)==null||ve.apply()})}function jH(o,e,t,i,n,s,r,a){var c=(r&HF)!==0?(r&zF)===0?wH(t,!1,!1):kd(t):null,h=(r&WF)!==0?kd(n):null;return{v:c,i:h,e:Ro(()=>(s(e,c??t,h??n,a),()=>{o.delete(i)}))}}function Tg(o,e,t){if(o.nodes)for(var i=o.nodes.start,n=o.nodes.end,s=e&&(e.f&jr)===0?e.nodes.start:t;i!==null;){var r=Cp(i);if(s.before(i),i===n)return;i=r}}function Ja(o,e,t){e===null?o.effect.first=t:e.next=t,t===null?o.effect.last=e:t.prev=e}function _l(o,e,t=!1,i=!1,n=!1,s=!1){var r=o,a="";if(t)var c=o;se(()=>{var h=Pi;if(a!==(a=e()??"")){if(t){h.nodes=null,c.innerHTML=a,a!==""&&Dd($r(c),c.lastChild);return}if(h.nodes!==null&&(bP(h.nodes.start,h.nodes.end),h.nodes=null),a!==""){var u=i?GF:n?ZF:void 0,g=mP(i?"svg":n?"math":"template",u);g.innerHTML=a;var f=i||n?g:g.content;if(Dd($r(f),f.lastChild),i||n)for(;$r(f);)r.before($r(f));else r.before(f)}}})}const XL=[...`
3
+ \r\f \v\uFEFF`];function $H(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||XL.includes(i[r-1]))&&(a===i.length||XL.includes(i[a]))?i=(r===0?"":i.substring(0,r))+i.substring(a+1):r=a}}return i===""?null:i}function YL(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 Iw(o){return o[0]!=="-"||o[1]!=="-"?o.toLowerCase():o}function qH(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,c=[];i&&c.push(...Object.keys(i).map(Iw)),n&&c.push(...Object.keys(n).map(Iw));var h=0,u=-1;const y=o.length;for(var g=0;g<y;g++){var f=o[g];if(a?f==="/"&&o[g-1]==="*"&&(a=!1):s?s===f&&(s=!1):f==="/"&&o[g+1]==="*"?a=!0:f==='"'||f==="'"?s=f:f==="("?r++:f===")"&&r--,!a&&s===!1&&r===0){if(f===":"&&u===-1)u=g;else if(f===";"||g===y-1){if(u!==-1){var v=Iw(o.substring(h,u).trim());if(!c.includes(v)){f!==";"&&g++;var _=o.substring(h,g).trim();t+=" "+_+";"}}h=g+1,u=-1}}}}return i&&(t+=YL(i)),n&&(t+=YL(n,!0)),t=t.trim(),t===""?null:t}return o==null?null:String(o)}function ti(o,e,t,i,n,s){var r=o[Py];if(r!==t||r===void 0){var a=$H(t,i,s);a==null?o.removeAttribute("class"):o.className=a,o[Py]=t}else if(s&&n!==s)for(var c in s){var h=!!s[c];(n==null||h!==!!n[c])&&o.classList.toggle(c,h)}return s}function kw(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 hs(o,e,t,i){var n=o[Ty];if(n!==e){var s=qH(e,i);s==null?o.removeAttribute("style"):o.style.cssText=s,o[Ty]=e}else i&&(Array.isArray(i)?(kw(o,t==null?void 0:t[0],i[0]),kw(o,t==null?void 0:t[1],i[1],"important")):kw(o,t,i));return i}function NP(o,e,t=!1){if(o.multiple){if(e==null)return;if(!u1(e))return YF();for(var i of o.options)i.selected=e.includes(Zg(i));return}for(i of o.options){var n=Zg(i);if(SH(n,e)){i.selected=!0;return}}(!t||e!==void 0)&&(o.selectedIndex=-1)}function KH(o){var e=new MutationObserver(()=>{NP(o,o.__value)});e.observe(o,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),b1(()=>{e.disconnect()})}function vl(o,e,t=e){var i=new WeakSet,n=!0;_1(o,"change",s=>{var r=s?"[selected]":":checked",a;if(o.multiple)a=[].map.call(o.querySelectorAll(r),Zg);else{var c=o.querySelector(r)??o.querySelector("option:not([disabled])");a=c&&Zg(c)}t(a),o.__value=a,Ut!==null&&i.add(Ut)}),w1(()=>{var s=e();if(o===document.activeElement){var r=Ut;if(i.has(r))return}if(NP(o,s,n),n&&s===void 0){var a=o.querySelector(":checked");a!==null&&(s=Zg(a),t(s))}o.__value=s,n=!1}),KH(o)}function Zg(o){return"__value"in o?o.__value:o.value}const GH=Symbol("is custom element"),ZH=Symbol("is html");function XH(o,e){var t=RP(o);t.checked!==(t.checked=e??void 0)&&(o.checked=e)}function is(o,e,t,i){var n=RP(o);n[e]!==(n[e]=t)&&(e==="loading"&&(o[IF]=t),t==null?o.removeAttribute(e):typeof t!="string"&&YH(o).includes(e)?o[e]=t:o.setAttribute(e,t))}function RP(o){return o[Pm]??(o[Pm]={[GH]:o.nodeName.includes("-"),[ZH]:o.namespaceURI===qE})}var QL=new Map;function YH(o){var e=o.getAttribute("is")||o.nodeName,t=QL.get(e);if(t)return t;QL.set(e,t=[]);for(var i,n=o,s=Element.prototype;s!==n;){i=bF(n);for(var r in i)i[r].set&&r!=="innerHTML"&&r!=="textContent"&&r!=="innerText"&&t.push(r);n=zE(n)}return t}function Bi(o,e,t=e){var i=new WeakSet;_1(o,"input",async n=>{var s=n?o.defaultValue:o.value;if(s=Dw(o)?Ew(s):s,t(s),Ut!==null&&i.add(Ut),await Hy(),s!==(s=e())){var r=o.selectionStart,a=o.selectionEnd,c=o.value.length;if(o.value=s??"",a!==null){var h=o.value.length;r===a&&a===c&&h>c?(o.selectionStart=h,o.selectionEnd=h):(o.selectionStart=r,o.selectionEnd=Math.min(a,h))}}}),Xa(e)==null&&o.value&&(t(Dw(o)?Ew(o.value):o.value),Ut!==null&&i.add(Ut)),Ab(()=>{var n=e();if(o===document.activeElement){var s=Ut;if(i.has(s))return}Dw(o)&&n===Ew(o.value)||o.type==="date"&&!n&&!o.value||n!==o.value&&(o.value=n??"")})}function ms(o,e,t=e){_1(o,"change",i=>{var n=i?o.defaultChecked:o.checked;t(n)}),Xa(e)==null&&t(o.checked),Ab(()=>{var i=e();o.checked=!!i})}function Dw(o){var e=o.type;return e==="number"||e==="range"}function Ew(o){return o===""?null:+o}var gl,ru,op,yv,AP;const Sv=class Sv{constructor(e){li(this,yv);li(this,gl,new WeakMap);li(this,ru);li(this,op);ci(this,op,e)}observe(e,t){var i=G(this,gl).get(e)||new Set;return i.add(t),G(this,gl).set(e,i),tn(this,yv,AP).call(this).observe(e,G(this,op)),()=>{var n=G(this,gl).get(e);n.delete(t),n.size===0&&(G(this,gl).delete(e),G(this,ru).unobserve(e))}}};gl=new WeakMap,ru=new WeakMap,op=new WeakMap,yv=new WeakSet,AP=function(){return G(this,ru)??ci(this,ru,new ResizeObserver(e=>{for(var t of e){Sv.entries.set(t.target,t);for(var i of G(this,gl).get(t.target)||[])i(t)}}))},vi(Sv,"entries",new WeakMap);let Vy=Sv;var QH=new Vy({box:"border-box"});function JH(o,e,t){var i=QH.observe(o,()=>t(o[e]));w1(()=>(Xa(()=>t(o[e])),i))}function Pw(o,e){return o===e||(o==null?void 0:o[Ec])===e}function bo(o={},e,t,i){var n=bs.r,s=Pi;return w1(()=>{var r,a;return Ab(()=>{r=a,a=[],Xa(()=>{Pw(t(...a),o)||(e(o,...a),r&&Pw(t(...r),o)&&e(null,...r))})}),()=>{let c=s;for(;c!==n&&c.parent!==null&&c.parent.f&Ey;)c=c.parent;const h=()=>{a&&Pw(t(...a),o)&&e(null,...a)},u=c.teardown;c.teardown=()=>{h(),u==null||u()}}}),o}function xf(o,e,t,i){var F;var n=!0,s=(t&jF)!==0,r=(t&$F)!==0,a=i,c=!0,h=void 0,u=()=>r&&n?(h??(h=Sf(i)),m(h)):(c&&(c=!1,a=r?Xa(i):i),a);let g;if(s){var f=Ec in o||LF in o;g=((F=Gh(o,e))==null?void 0:F.set)??(f&&e in o?R=>o[e]=R:void 0)}var v,_=!1;s?[v,_]=nH(()=>o[e]):v=o[e],v===void 0&&i!==void 0&&(v=u(),g&&(NF(),g(v)));var y;if(y=()=>{var R=o[e];return R===void 0?u():(c=!0,R)},(t&UF)===0)return y;if(g){var S=o.$$legacy;return(function(R,Z){return arguments.length>0?((!Z||S||_)&&g(Z?y():R),R):y()})}var x=!1,E=((t&VF)!==0?Sf:rP)(()=>(x=!1,y()));s&&m(E);var M=Pi;return(function(R,Z){if(arguments.length>0){const q=Z?m(E):s?Li(R):R;return I(E,q),x=!0,a!==void 0&&(a=q),R}return Ba&&x||(M.f&zo)!==0?E.v:m(E)})}function na(o){bs===null&&jE(),kn(()=>{const e=Xa(o);if(typeof e=="function")return e})}function x1(o){bs===null&&jE(),na(()=>()=>Xa(o))}const eW="5";var uD;typeof window<"u"&&((uD=window.__svelte??(window.__svelte={})).v??(uD.v=new Set)).add(eW);/*!-----------------------------------------------------------------------------
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 tW=Object.defineProperty,iW=Object.getOwnPropertyDescriptor,nW=Object.getOwnPropertyNames,sW=Object.prototype.hasOwnProperty,oW=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of nW(e))!sW.call(o,n)&&n!==t&&tW(o,n,{get:()=>e[n],enumerable:!(i=iW(e,n))||i.enumerable});return o},rW=(o,e,t)=>(oW(o,e,"default"),t),aW="5.4.5",Mu={};rW(Mu,FR);var OP=(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))(OP||{}),FP=(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))(FP||{}),HP=(o=>(o[o.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",o[o.LineFeed=1]="LineFeed",o))(HP||{}),WP=(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))(WP||{}),BP=(o=>(o[o.Classic=1]="Classic",o[o.NodeJs=2]="NodeJs",o))(BP||{}),zP=class{constructor(o,e,t,i,n){this._onDidChange=new Mu.Emitter,this._onDidExtraLibsChange=new Mu.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)}},lW=aW,VP={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},UP=new zP({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},VP),jP=new zP({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},VP),cW=()=>Ob().then(o=>o.getTypeScriptWorker()),dW=()=>Ob().then(o=>o.getJavaScriptWorker());Mu.languages.typescript={ModuleKind:OP,JsxEmit:FP,NewLineKind:HP,ScriptTarget:WP,ModuleResolutionKind:BP,typescriptVersion:lW,typescriptDefaults:UP,javascriptDefaults:jP,getTypeScriptWorker:cW,getJavaScriptWorker:dW};function Ob(){return OR(()=>import("./tsMode-BcZhguVQ.js"),__vite__mapDeps([0,1,2]))}Mu.languages.onLanguage("typescript",()=>Ob().then(o=>o.setupTypeScript(UP)));Mu.languages.onLanguage("javascript",()=>Ob().then(o=>o.setupJavaScript(jP)));class hW extends Ns{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:Xe("toggleCollapseUnchangedRegions","Toggle Collapse Unchanged Regions"),icon:xt.map,toggled:ie.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:ie.has("isInDiffEditor"),menu:{when:ie.has("isInDiffEditor"),id:We.EditorTitle,order:22,group:"navigation"}})}run(e,...t){const i=e.get(on),n=!i.getValue("diffEditor.hideUnchangedRegions.enabled");i.updateValue("diffEditor.hideUnchangedRegions.enabled",n)}}class $P extends Ns{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:Xe("toggleShowMovedCodeBlocks","Toggle Show Moved Code Blocks"),precondition:ie.has("isInDiffEditor")})}run(e,...t){const i=e.get(on),n=!i.getValue("diffEditor.experimental.showMoves");i.updateValue("diffEditor.experimental.showMoves",n)}}class qP extends Ns{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:Xe("toggleUseInlineViewWhenSpaceIsLimited","Toggle Use Inline View When Space Is Limited"),precondition:ie.has("isInDiffEditor")})}run(e,...t){const i=e.get(on),n=!i.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");i.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",n)}}const Lp=Xe("diffEditor","Diff Editor");class uW extends pr{constructor(){super({id:"diffEditor.switchSide",title:Xe("switchSide","Switch Side"),icon:xt.arrowSwap,precondition:ie.has("isInDiffEditor"),f1:!0,category:Lp})}runEditorCommand(e,t,i){const n=eg(e);if(n instanceof rp){if(i&&i.dryRun)return{destinationSelection:n.mapToOtherSide().destinationSelection};n.switchSide()}}}class gW extends pr{constructor(){super({id:"diffEditor.exitCompareMove",title:Xe("exitCompareMove","Exit Compare Move"),icon:xt.close,precondition:T.comparingMovedCode,f1:!1,category:Lp,keybinding:{weight:1e4,primary:9}})}runEditorCommand(e,t,...i){const n=eg(e);n instanceof rp&&n.exitCompareMove()}}class fW extends pr{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:Xe("collapseAllUnchangedRegions","Collapse All Unchanged Regions"),icon:xt.fold,precondition:ie.has("isInDiffEditor"),f1:!0,category:Lp})}runEditorCommand(e,t,...i){const n=eg(e);n instanceof rp&&n.collapseAllUnchangedRegions()}}class pW extends pr{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:Xe("showAllUnchangedRegions","Show All Unchanged Regions"),icon:xt.unfold,precondition:ie.has("isInDiffEditor"),f1:!0,category:Lp})}runEditorCommand(e,t,...i){const n=eg(e);n instanceof rp&&n.showAllUnchangedRegions()}}class Uy extends Ns{constructor(){super({id:"diffEditor.revert",title:Xe("revert","Revert"),f1:!1,category:Lp})}run(e,t){const i=mW(e,t.originalUri,t.modifiedUri);i instanceof rp&&i.revertRangeMappings(t.mapping.innerChanges??[])}}const KP=Xe("accessibleDiffViewer","Accessible Diff Viewer"),Cv=class Cv extends Ns{constructor(){super({id:Cv.id,title:Xe("editor.action.accessibleDiffViewer.next","Go to Next Difference"),category:KP,precondition:ie.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(e){const t=eg(e);t==null||t.accessibleDiffViewerNext()}};Cv.id="editor.action.accessibleDiffViewer.next";let Lf=Cv;const xv=class xv extends Ns{constructor(){super({id:xv.id,title:Xe("editor.action.accessibleDiffViewer.prev","Go to Previous Difference"),category:KP,precondition:ie.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(e){const t=eg(e);t==null||t.accessibleDiffViewerPrev()}};xv.id="editor.action.accessibleDiffViewer.prev";let u_=xv;function mW(o,e,t){return o.get(xn).listDiffEditors().find(s=>{var c,h;const r=s.getModifiedEditor(),a=s.getOriginalEditor();return r&&((c=r.getModel())==null?void 0:c.uri.toString())===t.toString()&&a&&((h=a.getModel())==null?void 0:h.uri.toString())===e.toString()})||null}function eg(o){const t=o.get(xn).listDiffEditors(),i=gD();if(i)for(const n of t){const s=n.getContainerDomNode();if(_W(s,i))return n}return null}function _W(o,e){let t=e;for(;t;){if(t===o)return!0;t=t.parentElement}return!1}Ti(hW);Ti($P);Ti(qP);Vo.appendMenuItem(We.EditorTitle,{command:{id:new qP().desc.id,title:w("useInlineViewWhenSpaceIsLimited","Use Inline View When Space Is Limited"),toggled:ie.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:ie.has("isInDiffEditor")},order:11,group:"1_diff",when:ie.and(T.diffEditorRenderSideBySideInlineBreakpointReached,ie.has("isInDiffEditor"))});Vo.appendMenuItem(We.EditorTitle,{command:{id:new $P().desc.id,title:w("showMoves","Show Moved Code Blocks"),icon:xt.move,toggled:HR.create("config.diffEditor.experimental.showMoves",!0),precondition:ie.has("isInDiffEditor")},order:10,group:"1_diff",when:ie.has("isInDiffEditor")});Ti(Uy);for(const o of[{icon:xt.arrowRight,key:T.diffEditorInlineMode.toNegated()},{icon:xt.discard,key:T.diffEditorInlineMode}])Vo.appendMenuItem(We.DiffEditorHunkToolbar,{command:{id:new Uy().desc.id,title:w("revertHunk","Revert Block"),icon:o.icon},when:ie.and(T.diffEditorModifiedWritable,o.key),order:5,group:"primary"}),Vo.appendMenuItem(We.DiffEditorSelectionToolbar,{command:{id:new Uy().desc.id,title:w("revertSelection","Revert Selection"),icon:o.icon},when:ie.and(T.diffEditorModifiedWritable,o.key),order:5,group:"primary"});Ti(uW);Ti(gW);Ti(fW);Ti(pW);Vo.appendMenuItem(We.EditorTitle,{command:{id:Lf.id,title:w("Open Accessible Diff Viewer","Open Accessible Diff Viewer"),precondition:ie.has("isInDiffEditor")},order:10,group:"2_diff",when:ie.and(T.accessibleDiffViewerVisible.negate(),ie.has("isInDiffEditor"))});Gi.registerCommandAlias("editor.action.diffReview.next",Lf.id);Ti(Lf);Gi.registerCommandAlias("editor.action.diffReview.prev",u_.id);Ti(u_);var vW=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)}},jy;const Fb=new di("selectionAnchorSet",!1);var Fc;let Kl=(Fc=class{static get(e){return e.getContribution(jy.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=Fb.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(_t.fromPositions(e,e),{description:"selection-anchor",stickiness:1,hoverMessage:new us().appendText(w("selectionAnchor","Selection Anchor")),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),Uo(w("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(_t.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()}},jy=Fc,Fc.ID="editor.contrib.selectionAnchorController",Fc);Kl=jy=vW([bW(1,wi)],Kl);class wW extends ge{constructor(){super({id:"editor.action.setSelectionAnchor",label:w("setSelectionAnchor","Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:Dn(2089,2080),weight:100}})}async run(e,t){var i;(i=Kl.get(t))==null||i.setSelectionAnchor()}}class yW extends ge{constructor(){super({id:"editor.action.goToSelectionAnchor",label:w("goToSelectionAnchor","Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:Fb})}async run(e,t){var i;(i=Kl.get(t))==null||i.goToSelectionAnchor()}}class SW extends ge{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:w("selectFromAnchorToCursor","Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:Fb,kbOpts:{kbExpr:T.editorTextFocus,primary:Dn(2089,2089),weight:100}})}async run(e,t){var i;(i=Kl.get(t))==null||i.selectFromAnchorToCursor()}}class CW extends ge{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:w("cancelSelectionAnchor","Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:Fb,kbOpts:{kbExpr:T.editorTextFocus,primary:9,weight:100}})}async run(e,t){var i;(i=Kl.get(t))==null||i.cancelSelectionAnchor()}}Zt(Kl.ID,Kl,4);Q(wW);Q(yW);Q(SW);Q(CW);const xW=Ke("editorOverviewRuler.bracketMatchForeground","#A0A0A0",w("overviewRulerBracketMatchForeground","Overview ruler marker color for matching brackets."));class LW extends ge{constructor(){super({id:"editor.action.jumpToBracket",label:w("smartSelect.jumpBracket","Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:3165,weight:100}})}run(e,t){var i;(i=Ed.get(t))==null||i.jumpToBracket()}}class IW extends ge{constructor(){super({id:"editor.action.selectToBracket",label:w("smartSelect.selectToBracket","Select to Bracket"),alias:"Select to Bracket",precondition:void 0,metadata:{description:Xe("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=Ed.get(t))==null||s.selectToBracket(n)}}class kW extends ge{constructor(){super({id:"editor.action.removeBrackets",label:w("smartSelect.removeBrackets","Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:2561,weight:100}})}run(e,t){var i;(i=Ed.get(t))==null||i.removeBrackets(this.id)}}class DW{constructor(e,t,i){this.position=e,this.brackets=t,this.options=i}}const rl=class rl extends Se{static get(e){return e.getContribution(rl.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new Rn(()=>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 c=e.bracketPairs.findNextBracket(n);c&&c.range&&(r=c.range.getStartPosition())}}return r?new _t(r.lineNumber,r.column,r.lineNumber,r.column):new _t(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 h=t.bracketPairs.findNextBracket(s);h&&h.range&&(r=t.bracketPairs.matchBracket(h.range.getStartPosition()))}let a=null,c=null;if(r){r.sort(O.compareRangesUsingStarts);const[h,u]=r;if(a=e?h.getStartPosition():h.getEndPosition(),c=e?u.getEndPosition():u.getStartPosition(),u.containsPosition(s)){const g=a;a=c,c=g}}a&&c&&i.push(new _t(a.lineNumber,a.column,c.lineNumber,c.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,f=e.length;g<f;g++){const v=e[g];v.isEmpty()&&(s[r++]=v.getStartPosition())}s.length>1&&s.sort(Qe.compare);const a=[];let c=0,h=0;const u=n.length;for(let g=0,f=s.length;g<f;g++){const v=s[g];for(;h<u&&n[h].position.isBefore(v);)h++;if(h<u&&n[h].position.equals(v))a[c++]=n[h];else{let _=t.bracketPairs.matchBracket(v,20),y=rl._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;!_&&this._matchBrackets==="always"&&(_=t.bracketPairs.findEnclosingBrackets(v,20),y=rl._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),a[c++]=new DW(v,_,y)}}this._lastBracketsData=a,this._lastVersionId=i}};rl.ID="editor.contrib.bracketMatchingController",rl._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=oi.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:Pn(xW),position:Kr.Center}}),rl._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=oi.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"});let Ed=rl;Zt(Ed.ID,Ed,1);Q(IW);Q(LW);Q(kW);Vo.appendMenuItem(We.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:w({key:"miGoToBracket",comment:["&& denotes a mnemonic"]},"Go to &&Bracket")},order:2});class EW{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 O(i,n-1,i,n),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new O(i,s,i,s),a)}else{const r=new O(i,s,i,s+1),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new O(i,n,i,n),a)}}computeCursorState(e,t){return this._isMovingLeft?new _t(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new _t(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class GP extends ge{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 EW(s,this.left));t.pushUndoStop(),t.executeCommands(this.id,i),t.pushUndoStop()}}class PW extends GP{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:w("caret.moveLeft","Move Selected Text Left"),alias:"Move Selected Text Left",precondition:T.writable})}}class TW extends GP{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:w("caret.moveRight","Move Selected Text Right"),alias:"Move Selected Text Right",precondition:T.writable})}}Q(PW);Q(TW);class MW extends ge{constructor(){super({id:"editor.action.transposeLetters",label:w("transposeLetters.label","Transpose Letters"),alias:"Transpose Letters",precondition:T.writable,kbOpts:{kbExpr:T.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,c=r.startColumn,h=i.getLineMaxColumn(a);if(a===1&&(c===1||c===2&&h===2))continue;const u=c===h?r.getPosition():mw.rightPosition(i,r.getPosition().lineNumber,r.getPosition().column),g=mw.leftPosition(i,u),f=mw.leftPosition(i,g),v=i.getValueInRange(O.fromPositions(f,g)),_=i.getValueInRange(O.fromPositions(g,u)),y=O.fromPositions(f,u);n.push(new ap(y,_+v))}n.length>0&&(t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop())}}Q(MW);const Hb=(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 L1(o){return{asString:async()=>o,asFile:()=>{},value:typeof o=="string"?o:void 0}}function NW(o,e,t){const i={id:Hb(),name:o,uri:e,data:t};return{asString:async()=>"",asFile:()=>i,value:void 0}}class ZP{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 Da.some(this,([i,n])=>n.asFile())&&t.push("files"),YP(g_(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 g_(e)}}function g_(o){return o.toLowerCase()}function XP(o,e){return YP(g_(o),e.map(g_))}function YP(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 Wb=Object.freeze({create:o=>fD(o.map(e=>e.toString())).join(`\r
9
+ `),split:o=>o.split(`\r
10
+ `),parse:o=>Wb.split(o).filter(e=>!e.startsWith("#"))}),Mr=class Mr{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+Mr.sep)}intersects(e){return this.contains(e)||e.contains(this)}append(...e){return new Mr((this.value?[this.value,...e]:e).join(Mr.sep))}};Mr.sep=".",Mr.None=new Mr("@@none@@"),Mr.Empty=new Mr("");let sn=Mr;const JL={EDITORS:"CodeEditors",FILES:"CodeFiles"};class RW{}const AW={DragAndDropContribution:"workbench.contributions.dragAndDrop"};mr.add(AW.DragAndDropContribution,new RW);const af=class af{constructor(){}static getInstance(){return af.INSTANCE}hasData(e){return e&&e===this.proto}getData(e){if(this.hasData(e))return this.data}};af.INSTANCE=new af;let $y=af;function QP(o){const e=new ZP;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,L1(n))}else if(t.kind==="file"){const n=t.getAsFile();n&&e.append(i,OW(n))}}return e}function OW(o){const e=o.path?Ri.parse(o.path):void 0;return NW(o.name,e,async()=>new Uint8Array(await o.arrayBuffer()))}const FW=Object.freeze([JL.EDITORS,JL.FILES,gy.RESOURCES,gy.INTERNAL_URI_LIST]);function JP(o,e=!1){const t=QP(o),i=t.get(gy.INTERNAL_URI_LIST);if(i)t.replace(Xn.uriList,i);else if(e||!t.has(Xn.uriList)){const n=[];for(const s of o.items){const r=s.getAsFile();if(r){const a=r.path;try{a?n.push(Ri.file(a).toString()):n.push(Ri.parse(r.name,!0).toString())}catch{}}}n.length&&t.replace(Xn.uriList,L1(Wb.create(n)))}for(const n of FW)t.delete(n);return t}var I1=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},If=function(o,e){return function(t,i){e(t,i,o)}};class k1{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 lf=class lf extends k1{constructor(){super(...arguments),this.kind=lf.kind,this.dropMimeTypes=[Xn.text],this.pasteMimeTypes=[Xn.text]}async getEdit(e,t){const i=e.get(Xn.text);if(!i||e.has(Xn.uriList))return;const n=await i.asString();return{handledMimeType:Xn.text,title:w("text.label","Insert Plain Text"),insertText:n,kind:this.kind}}};lf.id="text",lf.kind=new sn("text.plain");let Pd=lf;class eT extends k1{constructor(){super(...arguments),this.kind=new sn("uri.absolute"),this.dropMimeTypes=[Xn.uriList],this.pasteMimeTypes=[Xn.uriList]}async getEdit(e,t){const i=await tT(e);if(!i.length||t.isCancellationRequested)return;let n=0;const s=i.map(({uri:a,originalText:c})=>a.scheme===Ds.file?a.fsPath:(n++,c)).join(" ");let r;return n>0?r=i.length>1?w("defaultDropProvider.uriList.uris","Insert Uris"):w("defaultDropProvider.uriList.uri","Insert Uri"):r=i.length>1?w("defaultDropProvider.uriList.paths","Insert Paths"):w("defaultDropProvider.uriList.path","Insert Path"),{handledMimeType:Xn.uriList,insertText:s,title:r,kind:this.kind}}}let f_=class extends k1{constructor(e){super(),this._workspaceContextService=e,this.kind=new sn("uri.relative"),this.dropMimeTypes=[Xn.uriList],this.pasteMimeTypes=[Xn.uriList]}async getEdit(e,t){const i=await tT(e);if(!i.length||t.isCancellationRequested)return;const n=Aa(i.map(({uri:s})=>{const r=this._workspaceContextService.getWorkspaceFolder(s);return r?WR(r.uri,s):void 0}));if(n.length)return{handledMimeType:Xn.uriList,insertText:n.join(" "),title:i.length>1?w("defaultDropProvider.uriList.relativePaths","Insert Relative Paths"):w("defaultDropProvider.uriList.relativePath","Insert Relative Path"),kind:this.kind}}};f_=I1([If(0,_u)],f_);class HW{constructor(){this.kind=new sn("html"),this.pasteMimeTypes=["text/html"],this._yieldTo=[{mimeType:Xn.text}]}async provideDocumentPasteEdits(e,t,i,n,s){var c;if(n.triggerKind!==fy.PasteAs&&!((c=n.only)!=null&&c.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:w("pasteHtmlLabel","Insert HTML"),kind:this.kind}]}}}async function tT(o){const e=o.get(Xn.uriList);if(!e)return[];const t=await e.asString(),i=[];for(const n of Wb.parse(t))try{i.push({uri:Ri.parse(n),originalText:n})}catch{}return i}let qy=class extends Se{constructor(e,t){super(),this._register(e.documentDropEditProvider.register("*",new Pd)),this._register(e.documentDropEditProvider.register("*",new eT)),this._register(e.documentDropEditProvider.register("*",new f_(t)))}};qy=I1([If(0,Je),If(1,_u)],qy);let Ky=class extends Se{constructor(e,t){super(),this._register(e.documentPasteEditProvider.register("*",new Pd)),this._register(e.documentPasteEditProvider.register("*",new eT)),this._register(e.documentPasteEditProvider.register("*",new f_(t))),this._register(e.documentPasteEditProvider.register("*",new HW))}};Ky=I1([If(0,Je),If(1,_u)],Ky);const Io=class Io{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=Io._table[i],typeof n=="number")return this.pos+=1,{type:n,pos:e,len:1};if(Io.isDigitCharacter(i)){n=8;do t+=1,i=this.value.charCodeAt(e+t);while(Io.isDigitCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}if(Io.isVariableCharacter(i)){n=9;do i=this.value.charCodeAt(e+ ++t);while(Io.isVariableCharacter(i)||Io.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 Io._table[i]>"u"&&!Io.isDigitCharacter(i)&&!Io.isVariableCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}};Io._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13};let Gy=Io;class tg{constructor(){this._children=[]}appendChild(e){return e instanceof zs&&this._children[this._children.length-1]instanceof zs?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,c){for(const h of a)h.parent=c,r(h.children,h)})(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 Ip)return e;e=e.parent}}toString(){return this.children.reduce((e,t)=>e+t.toString(),"")}len(){return 0}}let zs=class iT extends tg{constructor(e){super(),this.value=e}toString(){return this.value}len(){return this.value.length}clone(){return new iT(this.value)}};class nT extends tg{}class vo extends nT{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 ig?this._children[0]:void 0}clone(){const e=new vo(this.index);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}class ig extends tg{constructor(){super(...arguments),this.options=[]}appendChild(e){return e instanceof zs&&(e.parent=this,this.options.push(e)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const e=new ig;return this.options.forEach(e.appendChild,e),e}}class D1 extends tg{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 sr&&!!s.elseValue)&&(n=this._replace([])),n}_replace(e){let t="";for(const i of this._children)if(i instanceof sr){let n=e[i.index]||"";n=i.resolve(n),t+=n}else t+=i.toString();return t}toString(){return""}clone(){const e=new D1;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 sr extends tg{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 sr(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class kf extends nT{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 zs(t)],!0):!1}clone(){const e=new kf(this.name);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}function eI(o,e){const t=[...o];for(;t.length>0;){const i=t.shift();if(!e(i))break;t.unshift(...i.children)}}class Ip extends tg{get placeholderInfo(){if(!this._placeholders){const e=[];let t;this.walk(function(i){return i instanceof vo&&(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 eI([e],i=>(t+=i.len(),!0)),t}enclosingPlaceholders(e){const t=[];let{parent:i}=e;for(;i;)i instanceof vo&&t.push(i),i=i.parent;return t}resolveVariables(e){return this.walk(t=>(t instanceof kf&&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 Ip;return this._children=this.children.map(t=>t.clone()),e}walk(e){eI(this.children,e)}}class Td{constructor(){this._scanner=new Gy,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 Ip;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(c=>(c instanceof vo&&(c.isFinalTabstop?n.set(0,void 0):!n.has(c.index)&&c.children.length>0?n.set(c.index,c.children):s.push(c)),!0));const r=(c,h)=>{const u=n.get(c.index);if(!u)return;const g=new vo(c.index);g.transform=c.transform;for(const f of u){const v=f.clone();g.appendChild(v),v instanceof vo&&n.has(v.index)&&!h.has(v.index)&&(h.add(v.index),r(v,h),h.delete(v.index))}t.replace(c,[g])},a=new Set;for(const c of s)r(c,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 vo(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 zs(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 vo(Number(t)):new kf(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 vo(Number(t));if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new zs("${"+t+":")),s.children.forEach(e.appendChild,e),!0}else if(s.index>0&&this._accept(7)){const r=new ig;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 zs(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 kf(t);if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new zs("${"+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 D1;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 zs(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 sr(Number(n))),!0;if(!this._accept(1))return this._backTo(t),!1}else return e.appendChild(new sr(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 sr(Number(n),s)),!0)}else if(this._accept(11)){const s=this._until(4);if(s)return e.appendChild(new sr(Number(n),void 0,s,void 0)),!0}else if(this._accept(12)){const s=this._until(4);if(s)return e.appendChild(new sr(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 sr(Number(n),void 0,s,r)),!0}}else{const s=this._until(4);if(s)return e.appendChild(new sr(Number(n),void 0,void 0,s)),!0}return this._backTo(t),!1}_parseAnything(e){return this._token.type!==14?(e.appendChild(new zs(this._scanner.tokenText(this._token))),this._accept(void 0),!0):!1}}function sT(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 BR(o,{range:s,text:typeof t.insertText=="string"?Td.escape(t.insertText)+"$0":t.insertText.snippet,insertAsSnippet:!0})),...((n=t.additionalEdit)==null?void 0:n.edits)??[]]}}function oT(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 c of o)if(c!==r&&e(a,c)){let h=t.get(r);h||(h=[],t.set(r,h)),h.push(c)}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 c=[];const h=t.get(a);return h&&(n.push(a),c=s(h),n.pop()),i.add(a),[...c,a,...s(r.slice(1))]}return s(Array.from(o))}var WW=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 zW=oi.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:pD,inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}}),Lv=class Lv extends Se{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=qe(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=e;const t=qe("span.icon");this.domNode.append(t),t.classList.add(...xi.asClassNameArray(xt.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(bi(this.domNode,hn.CLICK,n=>{this.delegate.cancel()}))}getId(){return Lv.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)}};Lv.baseId="editor.widget.inlineProgressWidget";let Zy=Lv,p_=class extends Se{constructor(e,t,i){super(),this.id=e,this._editor=t,this._instantiationService=i,this._showDelay=500,this._showPromise=this._register(new oo),this._currentWidget=this._register(new oo),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=hf(()=>{const a=O.fromPositions(e);this._currentDecorations.set([{range:a,options:zW}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(Zy,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()}};p_=WW([BW(2,Bt)],p_);var VW=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},tI=function(o,e){return function(t,i){e(t,i,o)}},Om,kl;let Us=(kl=class{static get(e){return e.getContribution(Om.ID)}constructor(e,t,i){this._openerService=i,this._messageWidget=new oo,this._messageListeners=new we,this._mouseOverMessage=!1,this._editor=e,this._visible=Om.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){Uo(Lm(e)?e.value:e),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._message=Lm(e)?zR(e,{actionHandler:{callback:n=>{this.closeMessage(),VR(this._openerService,n,Lm(e)?e.isTrusted:void 0)},disposables:this._messageListeners}}):void 0,this._messageWidget.value=new iI(this._editor,t,typeof e=="string"?e:this._message.element),this._messageListeners.add(Nn.debounce(this._editor.onDidBlurEditorText,(n,s)=>s,0)(()=>{this._mouseOverMessage||this._messageWidget.value&&UR(gD(),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(bi(this._messageWidget.value.getDomNode(),hn.MOUSE_ENTER,()=>this._mouseOverMessage=!0,!0)),this._messageListeners.add(bi(this._messageWidget.value.getDomNode(),hn.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 O(t.lineNumber-3,1,n.target.position.lineNumber+3,1))}))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(iI.fadeOut(this._messageWidget.value))}},Om=kl,kl.ID="editor.contrib.messageController",kl.MESSAGE_VISIBLE=new di("messageVisible",!1,w("messageVisible","Whether the editor is currently showing an inline message")),kl);Us=Om=VW([tI(1,wi),tI(2,_r)],Us);const UW=Rs.bindToContribution(Us.get);it(new UW({id:"leaveEditorMessage",precondition:Us.MESSAGE_VISIBLE,handler:o=>o.closeMessage(),kbOpts:{weight:130,primary:9}}));let iI=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)}};Zt(Us.ID,Us,4);function Tw(o,e){return e&&(o.stack||o.stacktrace)?w("stackTrace.format","{0}: {1}",sI(o),nI(o.stack)||nI(o.stacktrace)):sI(o)}function nI(o){return Array.isArray(o)?o.join(`
11
+ `):o}function sI(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"?w("nodeExceptionMessage","A system error occurred ({0})",o.message):o.message||w("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}function m_(o=null,e=!1){if(!o)return w("error.defaultMessage","An unknown error occurred. Please consult the log for more details.");if(Array.isArray(o)){const t=Aa(o),i=m_(t[0],e);return t.length>1?w("error.moreErrors","{0} ({1} errors in total)",i,t.length):i}if(mD(o))return o;if(o.detail){const t=o.detail;if(t.error)return Tw(t.error,e);if(t.exception)return Tw(t.exception,e)}return o.stack?Tw(o,e):o.message?o.message:w("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}var rT=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},Xh=function(o,e){return function(t,i){e(t,i,o)}},Xy,Hc;let Yy=(Hc=class extends Se{constructor(e,t,i,n,s,r,a,c,h,u){super(),this.typeId=e,this.editor=t,this.showCommand=n,this.range=s,this.edits=r,this.onSelectNewEdit=a,this._contextMenuService=c,this._keybindingService=u,this.allowEditorOverflow=!0,this.suppressMouseDown=!0,this.create(),this.visibleContext=i.bindTo(h),this.visibleContext.set(!0),this._register(nn(()=>this.visibleContext.reset())),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(nn((()=>this.editor.removeContentWidget(this)))),this._register(this.editor.onDidChangeCursorPosition(g=>{s.containsPosition(g.position)||this.dispose()})),this._register(Nn.runAndSubscribe(u.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=qe(".post-edit-widget"),this.button=this._register(new jR(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(bi(this.domNode,hn.CLICK,()=>this.showSelector()))}getId(){return Xy.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){this._contextMenuService.showContextMenu({getAnchor:()=>{const e=Ps(this.button.element);return{x:e.left+e.width,y:e.top+e.height}},getActions:()=>this.edits.allEdits.map((e,t)=>$R({id:"",label:e.title,checked:t===this.edits.activeEditIndex,run:()=>{if(t!==this.edits.activeEditIndex)return this.onSelectNewEdit(t)}}))})}},Xy=Hc,Hc.baseId="editor.widget.postEditWidget",Hc);Yy=Xy=rT([Xh(7,Ku),Xh(8,wi),Xh(9,En)],Yy);let __=class extends Se{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 oo),this._register(Nn.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 c=async S=>{const x=this._editor.getModel();x&&(await x.undo(),this.applyEditAndShowIfNeeded(e,{activeEditIndex:S,allEdits:t.allEdits},i,n,s))},h=(S,x)=>{Ql(S)||(this._notificationService.error(x),i&&this.show(e[0],t,c))};let u;try{u=await n(a,s)}catch(S){return h(S,w("resolveError",`Error resolving edit '{0}':
12
+ {1}`,a.title,m_(S)))}if(s.isCancellationRequested)return;const g=sT(r.uri,e,u),f=e[0],v=r.deltaDecorations([],[{range:f,options:{description:"paste-line-suffix",stickiness:0}}]);this._editor.focus();let _,y;try{_=await this._bulkEditService.apply(g,{editor:this._editor,token:s}),y=r.getDecorationRange(v[0])}catch(S){return h(S,w("applyError",`Error applying edit '{0}':
13
+ {1}`,a.title,m_(S)))}finally{r.deltaDecorations(v,[])}s.isCancellationRequested||i&&_.isApplied&&t.allEdits.length>1&&this.show(y??f,t,c)}show(e,t,i){this.clear(),this._editor.hasModel()&&(this._currentWidget.value=this._instantiationService.createInstance(Yy,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()}};__=rT([Xh(4,Bt),Xh(5,hb),Xh(6,Ss)],__);var jW=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)}},cc;const aT="editor.changePasteType",E1=new di("pasteWidgetVisible",!1,w("pasteWidgetVisible","Whether the paste widget is showing")),Mw="application/vnd.code.copyMetadata";var Wc;let za=(Wc=class extends Se{static get(e){return e.getContribution(cc.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 c=e.getContainerDomNode();this._register(bi(c,"copy",h=>this.handleCopy(h))),this._register(bi(c,"cut",h=>this.handleCopy(h))),this._register(bi(c,"paste",h=>this.handlePaste(h),!0)),this._pasteProgressManager=this._register(new p_("pasteIntoEditor",e,t)),this._postPasteWidgetManager=this._register(t.createInstance(__,"pasteIntoEditor",e,E1,{id:aT,label:w("postPasteWidgetTitle","Show paste options...")}))}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}pasteAs(e){this._editor.focus();try{this._pasteAsActionContext={preferred:e},Fx().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,S,x,E;if(!this._editor.hasTextFocus()||((S=(y=this._clipboardService).clearInternalState)==null||S.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 O(s[0].startLineNumber,1,s[0].startLineNumber,1+t.getLineLength(s[0].startLineNumber))]}const a=(x=this._editor._getViewModel())==null?void 0:x.getPlainTextToCopy(i,n,ub),h={multicursorText:Array.isArray(a)?a:null,pasteOnNewLine:r,mode:null},u=this._languageFeaturesService.documentPasteEditProvider.ordered(t).filter(M=>!!M.prepareDocumentPaste);if(!u.length){this.setCopyMetadata(e.clipboardData,{defaultPastePayload:h});return}const g=QP(e.clipboardData),f=u.flatMap(M=>M.copyMimeTypes??[]),v=Hb();this.setCopyMetadata(e.clipboardData,{id:v,providerCopyMimeTypes:f,defaultPastePayload:h});const _=qn(async M=>{const F=Aa(await Promise.all(u.map(async R=>{try{return await R.prepareDocumentPaste(t,s,g,M)}catch(Z){console.error(Z);return}})));F.reverse();for(const R of F)for(const[Z,q]of R)g.replace(Z,q);return g});(E=cc._currentCopyOperation)==null||E.dataTransferPromise.cancel(),cc._currentCopyOperation={handle:v,dataTransferPromise:_}}async handlePaste(e){var c,h,u;if(!e.clipboardData||!this._editor.hasTextFocus())return;(c=Us.get(this._editor))==null||c.closeMessage(),(h=this._currentPasteOperation)==null||h.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=JP(e.clipboardData);s.delete(Mw);const r=[...e.clipboardData.types,...(n==null?void 0:n.providerCopyMimeTypes)??[],Xn.uriList],a=this._languageFeaturesService.documentPasteEditProvider.ordered(t).filter(g=>{var v,_;const f=(v=this._pasteAsActionContext)==null?void 0:v.preferred;return f&&g.providedPasteEditKinds&&!this.providerMatchesPreference(g,f)?!1:(_=g.pasteMimeTypes)==null?void 0:_.some(y=>XP(y,r))});if(!a.length){(u=this._pasteAsActionContext)!=null&&u.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=Us.get(this._editor))==null||i.showMessage(w("pasteAsError","No paste edits for '{0}' found",t instanceof sn?t.value:t.providerId),e[0].getStartPosition())}doPasteInline(e,t,i,n,s){const r=this._editor;if(!r.hasModel())return;const a=new vu(r,3,void 0),c=qn(async h=>{const u=this._editor;if(!u.hasModel())return;const g=u.getModel(),f=new we,v=f.add(new Kn(h));f.add(a.token.onCancellationRequested(()=>v.cancel()));const _=v.token;try{if(await this.mergeInDataFromCopy(i,n,_),_.isCancellationRequested)return;const y=e.filter(E=>this.isSupportedPasteProvider(E,i));if(!y.length||y.length===1&&y[0]instanceof Pd)return this.applyDefaultPasteHandler(i,n,_,s);const S={triggerKind:fy.Automatic},x=await this.getPasteEdits(y,i,g,t,S,_);if(f.add(x),_.isCancellationRequested)return;if(x.edits.length===1&&x.edits[0].provider instanceof Pd)return this.applyDefaultPasteHandler(i,n,_,s);if(x.edits.length){const E=u.getOption(85).showPasteSelector==="afterPaste";return this._postPasteWidgetManager.applyEditAndShowIfNeeded(t,{activeEditIndex:0,allEdits:x.edits},E,(M,F)=>new Promise((R,Z)=>{(async()=>{var q,he;try{const pe=(he=(q=M.provider).resolveDocumentPasteEdit)==null?void 0:he.call(q,M,F),Ce=new gb,Pe=pe&&await this._pasteProgressManager.showWhile(t[0].getEndPosition(),w("resolveProcess","Resolving paste edit. Click to cancel"),Promise.race([Ce.p,pe]),{cancel:()=>(Ce.cancel(),Z(new fb))},0);return Pe&&(M.additionalEdit=Pe.additionalEdit),R(M)}catch(pe){return Z(pe)}})()}),_)}await this.applyDefaultPasteHandler(i,n,_,s)}finally{f.dispose(),this._currentPasteOperation===c&&(this._currentPasteOperation=void 0)}});this._pasteProgressManager.showWhile(t[0].getEndPosition(),w("pasteIntoEditorProgress","Running paste handlers. Click to cancel and do basic paste"),c,{cancel:async()=>{try{if(c.cancel(),a.token.isCancellationRequested)return;await this.applyDefaultPasteHandler(i,n,a.token,s)}finally{a.dispose()}}}).then(()=>{a.dispose()}),this._currentPasteOperation=c}showPasteAsPick(e,t,i,n,s){const r=qn(async a=>{const c=this._editor;if(!c.hasModel())return;const h=c.getModel(),u=new we,g=u.add(new vu(c,3,void 0,a));try{if(await this.mergeInDataFromCopy(n,s,g.token),g.token.isCancellationRequested)return;let f=t.filter(x=>this.isSupportedPasteProvider(x,n,e));e&&(f=f.filter(x=>this.providerMatchesPreference(x,e)));const v={triggerKind:fy.PasteAs,only:e&&e instanceof sn?e:void 0};let _=u.add(await this.getPasteEdits(f,n,h,i,v,g.token));if(g.token.isCancellationRequested)return;if(e&&(_={edits:_.edits.filter(x=>e instanceof sn?e.contains(x.kind):e.providerId===x.provider.id),dispose:_.dispose}),!_.edits.length){v.only&&this.showPasteAsNoEditMessage(i,v.only);return}let y;if(e)y=_.edits.at(0);else{const x=await this._quickInputService.pick(_.edits.map(E=>{var M;return{label:E.title,description:(M=E.kind)==null?void 0:M.value,edit:E}}),{placeHolder:w("pasteAsPickerPlaceholder","Select Paste Action")});y=x==null?void 0:x.edit}if(!y)return;const S=sT(h.uri,i,y);await this._bulkEditService.apply(S,{editor:this._editor})}finally{u.dispose(),this._currentPasteOperation===r&&(this._currentPasteOperation=void 0)}});this._progressService.withProgress({location:10,title:w("pasteAsProgress","Running paste handlers")},()=>r)}setCopyMetadata(e,t){e.setData(Mw,JSON.stringify(t))}fetchCopyMetadata(e){if(!e.clipboardData)return;const t=e.clipboardData.getData(Mw);if(t)try{return JSON.parse(t)}catch{return}const[i,n]=qR.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=cc._currentCopyOperation)==null?void 0:n.handle)===t.id){const s=await cc._currentCopyOperation.dataTransferPromise;if(i.isCancellationRequested)return;for(const[r,a]of s)e.replace(r,a)}if(!e.has(Xn.uriList)){const s=await this._clipboardService.readResources();if(i.isCancellationRequested)return;s.length&&e.append(Xn.uriList,L1(Wb.create(s)))}}async getPasteEdits(e,t,i,n,s,r){const a=new we,c=await lp(Promise.all(e.map(async u=>{var g,f;try{const v=await((g=u.provideDocumentPasteEdits)==null?void 0:g.call(u,i,n,t,s,r));return v&&a.add(v),(f=v==null?void 0:v.edits)==null?void 0:f.map(_=>({..._,provider:u}))}catch(v){Ql(v)||console.error(v);return}})),r),h=Aa(c??[]).flat().filter(u=>!s.only||s.only.contains(u.kind));return{edits:oT(h),dispose:()=>a.dispose()}}async applyDefaultPasteHandler(e,t,i,n){const s=e.get(Xn.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 sn?e.providedPasteEditKinds?e.providedPasteEditKinds.some(i=>t.contains(i)):!0:e.id===t.providerId}},cc=Wc,Wc.ID="editor.contrib.copyPasteActionController",Wc);za=cc=jW([ch(1,Bt),ch(2,hb),ch(3,Gu),ch(4,Je),ch(5,$a),ch(6,KR)],za);const Md="9_cutcopypaste",$W=Zu||document.queryCommandSupported("cut"),lT=Zu||document.queryCommandSupported("copy"),qW=typeof navigator.clipboard>"u"||GR?document.queryCommandSupported("paste"):!0;function P1(o){return o.register(),o}const KW=$W?P1(new Hx({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:Zu?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:We.MenubarEditMenu,group:"2_ccp",title:w({key:"miCut",comment:["&& denotes a mnemonic"]},"Cu&&t"),order:1},{menuId:We.EditorContext,group:Md,title:w("actions.clipboard.cutLabel","Cut"),when:T.writable,order:1},{menuId:We.CommandPalette,group:"",title:w("actions.clipboard.cutLabel","Cut"),order:1},{menuId:We.SimpleEditorContext,group:Md,title:w("actions.clipboard.cutLabel","Cut"),when:T.writable,order:1}]})):void 0,GW=lT?P1(new Hx({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:Zu?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:We.MenubarEditMenu,group:"2_ccp",title:w({key:"miCopy",comment:["&& denotes a mnemonic"]},"&&Copy"),order:2},{menuId:We.EditorContext,group:Md,title:w("actions.clipboard.copyLabel","Copy"),order:2},{menuId:We.CommandPalette,group:"",title:w("actions.clipboard.copyLabel","Copy"),order:1},{menuId:We.SimpleEditorContext,group:Md,title:w("actions.clipboard.copyLabel","Copy"),order:2}]})):void 0;Vo.appendMenuItem(We.MenubarEditMenu,{submenu:We.MenubarCopy,title:Xe("copy as","Copy As"),group:"2_ccp",order:3});Vo.appendMenuItem(We.EditorContext,{submenu:We.EditorContextCopy,title:Xe("copy as","Copy As"),group:Md,order:3});Vo.appendMenuItem(We.EditorContext,{submenu:We.EditorContextShare,title:Xe("share","Share"),group:"11_share",order:-1,when:ie.and(ie.notEquals("resourceScheme","output"),T.editorTextFocus)});Vo.appendMenuItem(We.ExplorerContext,{submenu:We.ExplorerContextShare,title:Xe("share","Share"),group:"11_share",order:-1});const Nw=qW?P1(new Hx({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:Zu?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:We.MenubarEditMenu,group:"2_ccp",title:w({key:"miPaste",comment:["&& denotes a mnemonic"]},"&&Paste"),order:4},{menuId:We.EditorContext,group:Md,title:w("actions.clipboard.pasteLabel","Paste"),when:T.writable,order:4},{menuId:We.CommandPalette,group:"",title:w("actions.clipboard.pasteLabel","Paste"),order:1},{menuId:We.SimpleEditorContext,group:Md,title:w("actions.clipboard.pasteLabel","Paste"),when:T.writable,order:4}]})):void 0;class ZW extends ge{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:w("actions.clipboard.copyWithSyntaxHighlightingLabel","Copy With Syntax Highlighting"),alias:"Copy With Syntax Highlighting",precondition:void 0,kbOpts:{kbExpr:T.textInputFocus,primary:0,weight:100}})}run(e,t){!t.hasModel()||!t.getOption(37)&&t.getSelection().isEmpty()||(cL.forceCopyWithSyntaxHighlighting=!0,t.focus(),t.getContainerDomNode().ownerDocument.execCommand("copy"),cL.forceCopyWithSyntaxHighlighting=!1)}}function cT(o,e){o&&(o.addImplementation(1e4,"code-editor",(t,i)=>{const n=t.get(xn).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)=>(Fx().execCommand(e),!0)))}cT(KW,"cut");cT(GW,"copy");Nw&&(Nw.addImplementation(1e4,"code-editor",(o,e)=>{var s;const t=o.get(xn),i=o.get(Gu),n=t.getFocusedCodeEditor();return n&&n.hasTextFocus()?n.getContainerDomNode().ownerDocument.execCommand("paste")?((s=za.get(n))==null?void 0:s.finishedPaste())??Promise.resolve():ZR?(async()=>{const a=await i.readText();if(a!==""){const c=XR.INSTANCE.get(a);let h=!1,u=null,g=null;c&&(h=n.getOption(37)&&!!c.isFromEmptySelection,u=typeof c.multicursorText<"u"?c.multicursorText:null,g=c.mode),n.trigger("keyboard","paste",{text:a,pasteOnNewLine:h,multicursorText:u,mode:g})}})():!0:!1}),Nw.addImplementation(0,"generic-dom",(o,e)=>(Fx().execCommand("paste"),!0)));lT&&Q(ZW);const qi=new class{constructor(){this.QuickFix=new sn("quickfix"),this.Refactor=new sn("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 sn("notebook"),this.Source=new sn("source"),this.SourceOrganizeImports=this.Source.append("organizeImports"),this.SourceFixAll=this.Source.append("fixAll"),this.SurroundWith=this.Refactor.append("surround")}};var Ks;(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"})(Ks||(Ks={}));function XW(o,e){return!(o.include&&!o.include.intersects(e)||o.excludes&&o.excludes.some(t=>dT(e,t,o.include))||!o.includeSourceActions&&qi.Source.contains(e))}function YW(o,e){const t=e.kind?new sn(e.kind):void 0;return!(o.include&&(!t||!o.include.contains(t))||o.excludes&&t&&o.excludes.some(i=>dT(t,i,o.include))||!o.includeSourceActions&&t&&qi.Source.contains(t)||o.onlyIncludePreferredActions&&!e.isPreferred)}function dT(o,e,t){return!(!e.contains(o)||t&&e.contains(t))}class zr{static fromUser(e,t){return!e||typeof e!="object"?new zr(t.kind,t.apply,!1):new zr(zr.getKindFromUser(e,t.kind),zr.getApplyFromUser(e,t.apply),zr.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 sn(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 QW{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){Cn(n)}i&&(this.action.edit=i.edit)}return this}}const hT="editor.action.codeAction",T1="editor.action.quickFix",uT="editor.action.autoFix",gT="editor.action.refactor",fT="editor.action.sourceAction",Qy="editor.action.organizeImports",Jy="editor.action.fixAll";class Xg extends Se{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:io(e.diagnostics)?io(t.diagnostics)?Xg.codeActionsPreferredComparator(e,t):-1:io(t.diagnostics)?1:Xg.codeActionsPreferredComparator(e,t)}constructor(e,t,i){super(),this.documentation=t,this._register(i),this.allActions=[...e].sort(Xg.codeActionsComparator),this.validActions=this.allActions.filter(({action:n})=>!n.disabled)}get hasAutoFix(){return this.validActions.some(({action:e})=>!!e.kind&&qi.QuickFix.contains(new sn(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 oI={actions:[],documentation:void 0};async function Rh(o,e,t,i,n,s){var y;const r=i.filter||{},a={...r,excludes:[...r.excludes||[],qi.Notebook]},c={only:(y=r.include)==null?void 0:y.value,trigger:i.type},h=new YR(e,s),u=i.type===2,g=JW(o,e,u?a:r),f=new we,v=g.map(async S=>{try{n.report(S);const x=await S.provideCodeActions(e,t,c,h.token);if(x&&f.add(x),h.token.isCancellationRequested)return oI;const E=((x==null?void 0:x.actions)||[]).filter(F=>F&&YW(r,F)),M=tB(S,E,r.include);return{actions:E.map(F=>new QW(F,S)),documentation:M}}catch(x){if(Ql(x))throw x;return Cn(x),oI}}),_=o.onDidChange(()=>{const S=o.all(e);Yr(S,g)||h.cancel()});try{const S=await Promise.all(v),x=S.map(M=>M.actions).flat(),E=[...Aa(S.map(M=>M.documentation)),...eB(o,e,i,x)];return new Xg(x,E,f)}finally{_.dispose(),h.dispose()}}function JW(o,e,t){return o.all(e).filter(i=>i.providedCodeActionKinds?i.providedCodeActionKinds.some(n=>XW(t,new sn(n))):!0)}function*eB(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(c=>c.action)))}function tB(o,e,t){if(!o.documentation)return;const i=o.documentation.map(n=>({kind:new sn(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 sn(n.kind)))return s.command}}var wc;(function(o){o.OnSave="onSave",o.FromProblemsView="fromProblemsView",o.FromCodeActions="fromCodeActions",o.FromAILightbulb="fromAILightbulb"})(wc||(wc={}));async function iB(o,e,t,i,n=$t.None){var h;const s=o.get(hb),r=o.get(Bn),a=o.get(vr),c=o.get(Ss);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&&!((h=e.action.edit)!=null&&h.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!==wc.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(u){const g=nB(u);c.error(typeof g=="string"?g:w("applyCodeActionFailed","An unknown error occurred while applying the code action"))}}function nB(o){return typeof o=="string"?o:o instanceof Error&&typeof o.message=="string"?o.message:void 0}Gi.registerCommand("_executeCodeActionProvider",async function(o,e,t,i,n){if(!(e instanceof Ri))throw Ea();const{codeActionProvider:s}=o.get(Je),r=o.get(Cs).getModel(e);if(!r)throw Ea();const a=_t.isISelection(t)?_t.liftSelection(t):O.isIRange(t)?r.validateRange(t):void 0;if(!a)throw Ea();const c=typeof i=="string"?new sn(i):void 0,h=await Rh(s,r,a,{type:1,triggerAction:Ks.Default,filter:{includeSourceActions:!0,include:c}},xa.None,$t.None),u=[],g=Math.min(h.validActions.length,typeof n=="number"?n:0);for(let f=0;f<g;f++)u.push(h.validActions[f].resolve($t.None));try{return await Promise.all(u),h.validActions.map(f=>f.action)}finally{setTimeout(()=>h.dispose(),100)}});var sB=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},oB=function(o,e){return function(t,i){e(t,i,o)}},eS,Bc;let tS=(Bc=class{constructor(e){this.keybindingService=e}getResolver(){const e=new Wx(()=>this.keybindingService.getKeybindings().filter(t=>eS.codeActionCommands.indexOf(t.command)>=0).filter(t=>t.resolvedKeybinding).map(t=>{let i=t.commandArgs;return t.command===Qy?i={kind:qi.SourceOrganizeImports.value}:t.command===Jy&&(i={kind:qi.SourceFixAll.value}),{resolvedKeybinding:t.resolvedKeybinding,...zr.fromUser(i,{kind:sn.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 sn(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)}},eS=Bc,Bc.codeActionCommands=[gT,hT,fT,Qy,Jy],Bc);tS=eS=sB([oB(0,En)],tS);Ke("symbolIcon.arrayForeground",An,w("symbolIcon.arrayForeground","The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.booleanForeground",An,w("symbolIcon.booleanForeground","The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},w("symbolIcon.classForeground","The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.colorForeground",An,w("symbolIcon.colorForeground","The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.constantForeground",An,w("symbolIcon.constantForeground","The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},w("symbolIcon.constructorForeground","The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},w("symbolIcon.enumeratorForeground","The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},w("symbolIcon.enumeratorMemberForeground","The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},w("symbolIcon.eventForeground","The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},w("symbolIcon.fieldForeground","The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.fileForeground",An,w("symbolIcon.fileForeground","The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.folderForeground",An,w("symbolIcon.folderForeground","The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},w("symbolIcon.functionForeground","The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},w("symbolIcon.interfaceForeground","The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.keyForeground",An,w("symbolIcon.keyForeground","The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.keywordForeground",An,w("symbolIcon.keywordForeground","The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},w("symbolIcon.methodForeground","The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.moduleForeground",An,w("symbolIcon.moduleForeground","The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.namespaceForeground",An,w("symbolIcon.namespaceForeground","The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.nullForeground",An,w("symbolIcon.nullForeground","The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.numberForeground",An,w("symbolIcon.numberForeground","The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.objectForeground",An,w("symbolIcon.objectForeground","The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.operatorForeground",An,w("symbolIcon.operatorForeground","The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.packageForeground",An,w("symbolIcon.packageForeground","The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.propertyForeground",An,w("symbolIcon.propertyForeground","The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.referenceForeground",An,w("symbolIcon.referenceForeground","The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.snippetForeground",An,w("symbolIcon.snippetForeground","The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.stringForeground",An,w("symbolIcon.stringForeground","The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.structForeground",An,w("symbolIcon.structForeground","The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.textForeground",An,w("symbolIcon.textForeground","The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.typeParameterForeground",An,w("symbolIcon.typeParameterForeground","The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.unitForeground",An,w("symbolIcon.unitForeground","The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));Ke("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},w("symbolIcon.variableForeground","The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));const pT=Object.freeze({kind:sn.Empty,title:w("codeAction.widget.id.more","More Actions...")}),rB=Object.freeze([{kind:qi.QuickFix,title:w("codeAction.widget.id.quickfix","Quick Fix")},{kind:qi.RefactorExtract,title:w("codeAction.widget.id.extract","Extract"),icon:xt.wrench},{kind:qi.RefactorInline,title:w("codeAction.widget.id.inline","Inline"),icon:xt.wrench},{kind:qi.RefactorRewrite,title:w("codeAction.widget.id.convert","Rewrite"),icon:xt.wrench},{kind:qi.RefactorMove,title:w("codeAction.widget.id.move","Move"),icon:xt.wrench},{kind:qi.SurroundWith,title:w("codeAction.widget.id.surround","Surround With"),icon:xt.surroundWith},{kind:qi.Source,title:w("codeAction.widget.id.source","Source Action"),icon:xt.symbolFile},pT]);function aB(o,e,t){if(!e)return o.map(s=>{var r;return{kind:"action",item:s,group:pT,disabled:!!s.action.disabled,label:s.action.disabled||s.action.title,canPreview:!!((r=s.action.edit)!=null&&r.edits.length)}});const i=rB.map(s=>({group:s,actions:[]}));for(const s of o){const r=s.action.kind?new sn(s.action.kind):sn.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:xt.sparkle}:a,label:r.action.title,disabled:!!r.action.disabled,keybinding:t(r.action)})}}return n}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},cB=function(o,e){return function(t,i){e(t,i,o)}},xh;const rI=yn("gutter-lightbulb",xt.lightBulb,w("gutterLightbulbWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor.")),aI=yn("gutter-lightbulb-auto-fix",xt.lightbulbAutofix,w("gutterLightbulbAutoFixWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor and a quick fix is available.")),lI=yn("gutter-lightbulb-sparkle",xt.lightbulbSparkle,w("gutterLightbulbAIFixWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix is available.")),cI=yn("gutter-lightbulb-aifix-auto-fix",xt.lightbulbSparkleAutofix,w("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.")),dI=yn("gutter-lightbulb-sparkle-filled",xt.sparkleFilled,w("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 er;(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})(er||(er={}));var Ia;let Df=(Ia=class extends Se{constructor(e,t){super(),this._editor=e,this._keybindingService=t,this._onClick=this._register(new jt),this.onClick=this._onClick.event,this._state=er.Hidden,this._gutterState=er.Hidden,this._iconClasses=[],this.lightbulbClasses=["codicon-"+rI.id,"codicon-"+cI.id,"codicon-"+aI.id,"codicon-"+lI.id,"codicon-"+dI.id],this.gutterDecoration=xh.GUTTER_DECORATION,this._domNode=qe("div.lightBulbWidget"),this._domNode.role="listbox",this._register(_D.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(QR(this._domNode,i=>{if(this.state.type!==1)return;this._editor.focus(),i.preventDefault();const{top:n,height:s}=Ps(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(bi(this._domNode,"mouseenter",i=>{(i.buttons&1)===1&&this.hide()})),this._register(Nn.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{var i,n;this._preferredKbLabel=((i=this._keybindingService.lookupKeybinding(uT))==null?void 0:i.getLabel())??void 0,this._quickFixKbLabel=((n=this._keybindingService.lookupKeybinding(T1))==null?void 0:n.getLabel())??void 0,this._updateLightBulbTitleAndIcon()})),this._register(this._editor.onMouseDown(async i=>{if(!i.target.element||!this.lightbulbClasses.some(c=>i.target.element&&i.target.element.classList.contains(c))||this.gutterState.type!==1)return;this._editor.focus();const{top:n,height:s}=Ps(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:c}=r.validatePosition(i),h=r.getOptions().tabSize,u=this._editor.getOptions().get(50),g=r.getLineContent(a),f=Bx(g,h),v=u.spaceWidth*f>22,_=R=>R>2&&this._editor.getTopForLineNumber(R)===this._editor.getTopForLineNumber(R-1),y=this._editor.getLineDecorations(a);let S=!1;if(y)for(const R of y){const Z=R.options.glyphMarginClassName;if(Z&&!this.lightbulbClasses.some(q=>Z.includes(q))){S=!0;break}}let x=a,E=1;if(!v){const R=Z=>{const q=r.getLineContent(Z);return/^\s*$|^\s+/.test(q)||q.length<=E};if(a>1&&!_(a-1)){const Z=r.getLineCount(),q=a===Z,he=a>1&&R(a-1),pe=!q&&R(a+1),Ce=R(a),Pe=!pe&&!he;if(!pe&&!he&&!S)return this.gutterState=new er.Showing(e,t,i,{position:{lineNumber:x,column:E},preference:xh._posPref}),this.renderGutterLightbub(),this.hide();he||q||he&&!Ce?x-=1:(pe||Pe&&Ce)&&(x+=1)}else if(a===1&&(a===r.getLineCount()||!R(a+1)&&!R(a)))if(this.gutterState=new er.Showing(e,t,i,{position:{lineNumber:x,column:E},preference:xh._posPref}),S)this.gutterHide();else return this.renderGutterLightbub(),this.hide();else if(a<r.getLineCount()&&!_(a+1))x+=1;else if(c*u.spaceWidth<22)return this.hide();E=/^\S\s*$/.test(r.getLineContent(x))?2:1}this.state=new er.Showing(e,t,i,{position:{lineNumber:x,column:E},preference:xh._posPref}),this._gutterDecorationID&&(this._removeGutterDecoration(this._gutterDecorationID),this.gutterHide());const M=e.validActions,F=e.validActions[0].action.kind;if(M.length!==1||!F){this._editor.layoutContentWidget(this);return}this._editor.layoutContentWidget(this)}hide(){this.state!==er.Hidden&&(this.state=er.Hidden,this._editor.layoutContentWidget(this))}gutterHide(){this.gutterState!==er.Hidden&&(this._gutterDecorationID&&this._removeGutterDecoration(this._gutterDecorationID),this.gutterState=er.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=xt.sparkleFilled,this.state.actions.validActions.length===1&&(t=!0)):this.state.actions.hasAutoFix?this.state.actions.hasAIFix?e=xt.lightbulbSparkleAutofix:e=xt.lightbulbAutofix:this.state.actions.hasAIFix?e=xt.lightbulbSparkle:e=xt.lightBulb,this._updateLightbulbTitle(this.state.actions.hasAutoFix,t),this._iconClasses=xi.asClassNameArray(e),this._domNode.classList.add(...this._iconClasses)}_updateGutterLightBulbTitleAndIcon(){if(this.gutterState.type!==1)return;let e,t=!1;this.gutterState.actions.allAIFixes?(e=dI,this.gutterState.actions.validActions.length===1&&(t=!0)):this.gutterState.actions.hasAutoFix?this.gutterState.actions.hasAIFix?e=cI:e=aI:this.gutterState.actions.hasAIFix?e=lI:e=rI,this._updateLightbulbTitle(this.gutterState.actions.hasAutoFix,t);const i=oi.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:xi.asClassName(e),glyphMargin:{position:Xm.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 O(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 O(t,0,t,0)),i.changeDecorationOptions(e,this.gutterDecoration)})}_updateLightbulbTitle(e,t){this.state.type===1&&(t?this.title=w("codeActionAutoRun","Run: {0}",this.state.actions.validActions[0].action.title):e&&this._preferredKbLabel?this.title=w("preferredcodeActionWithKb","Show Code Actions. Preferred Quick Fix Available ({0})",this._preferredKbLabel):!e&&this._quickFixKbLabel?this.title=w("codeActionWithKb","Show Code Actions ({0})",this._quickFixKbLabel):e||(this.title=w("codeAction","Show Code Actions")))}set title(e){this._domNode.title=e}},xh=Ia,Ia.GUTTER_DECORATION=oi.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:xi.asClassName(xt.lightBulb),glyphMargin:{position:Xm.Left},stickiness:1}),Ia.ID="editor.contrib.lightbulbWidget",Ia._posPref=[0],Ia);Df=xh=lB([cB(1,En)],Df);var mT=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},iS=function(o,e){return function(t,i){e(t,i,o)}};const _T="acceptSelectedCodeAction",vT="previewSelectedCodeAction";class dB{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 nS=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 zx(e,Vx);return{container:e,icon:t,text:i,keybinding:n}}renderElement(e,t,i){var r,a,c;if((r=e.group)!=null&&r.icon?(i.icon.className=xi.asClassName(e.group.icon),e.group.icon.color&&(i.icon.style.color=Ic(e.group.icon.color.id))):(i.icon.className=xi.asClassName(xt.lightBulb),i.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!e.item||!e.label)return;i.text.textContent=bT(e.label),i.keybinding.set(e.keybinding),JR(!!e.keybinding,i.keybinding.element);const n=(a=this._keybindingService.lookupKeybinding(_T))==null?void 0:a.getLabel(),s=(c=this._keybindingService.lookupKeybinding(vT))==null?void 0:c.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=w({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=w({key:"label",comment:['placeholder is a keybinding, e.g "F2 to Apply"']},"{0} to Apply",n):i.container.title=""}disposeTemplate(e){e.keybinding.dispose()}};nS=mT([iS(1,En)],nS);class hB extends UIEvent{constructor(){super("acceptSelectedAction")}}class hI extends UIEvent{constructor(){super("previewSelectedAction")}}function uB(o){if(o.kind==="action")return o.label}let sS=class extends Se{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 Kn),this.domNode=document.createElement("div"),this.domNode.classList.add("actionList");const a={getHeight:c=>c.kind==="header"?this._headerLineHeight:this._actionLineHeight,getTemplateId:c=>c.kind};this._list=this._register(new Ux(e,this.domNode,a,[new nS(t,this._keybindingService),new dB],{keyboardSupport:!1,typeNavigationEnabled:!0,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:uB},accessibilityProvider:{getAriaLabel:c=>{if(c.kind==="action"){let h=c.label?bT(c==null?void 0:c.label):"";return c.disabled&&(h=w({key:"customQuickFixWidget.labels",comment:["Action widget labels for accessibility."]},"{0}, Disabled Reason: {1}",h,c.disabled)),h}return null},getWidgetAriaLabel:()=>w({key:"customQuickFixWidget",comment:["An action widget option"]},"Action Widget"),getRole:c=>c.kind==="action"?"option":"separator",getWidgetRole:()=>"listbox"}})),this._list.style(eA),this._register(this._list.onMouseClick(c=>this.onListClick(c))),this._register(this._list.onMouseOver(c=>this.onListHover(c))),this._register(this._list.onDidChangeFocus(()=>this.onFocus())),this._register(this._list.onDidChangeSelection(c=>this.onListSelection(c))),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(c=>c.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 c=this._allMenuItems.map((h,u)=>{const g=this.domNode.ownerDocument.getElementById(this._list.getElementID(u));if(g){g.style.width="auto";const f=g.getBoundingClientRect().width;return g.style.width="",f}return 0});s=Math.max(...c,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 hI:new hB;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 hI):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([])}};sS=mT([iS(4,pb),iS(5,En)],sS);function bT(o){return o.replace(/\r\n|\r|\n/g," ")}var gB=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)}};Ke("actionBar.toggledBackground",jx,w("actionBar.toggledBackground","Background color for toggled action items in action bar."));const Nd={Visible:new di("codeActionMenuVisible",!1,w("codeActionMenuVisible","Whether the action widget list is visible"))},Kd=qa("actionWidgetService");let Rd=class extends Se{get isVisible(){return Nd.Visible.getValue(this._contextKeyService)||!1}constructor(e,t,i){super(),this._contextViewService=e,this._contextKeyService=t,this._instantiationService=i,this._list=this._register(new oo)}show(e,t,i,n,s,r,a){const c=Nd.Visible.bindTo(this._contextKeyService),h=this._instantiationService.createInstance(sS,e,t,i,n);this._contextViewService.showContextView({getAnchor:()=>s,render:u=>(c.set(!0),this._renderWidget(u,h,a??[])),onHide:u=>{c.reset(),this._onWidgetClosed(u)}},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 v;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 we,r=document.createElement("div"),a=e.appendChild(r);a.classList.add("context-view-block"),s.add(bi(a,hn.MOUSE_DOWN,_=>_.stopPropagation()));const c=document.createElement("div"),h=e.appendChild(c);h.classList.add("context-view-pointerBlock"),s.add(bi(h,hn.POINTER_MOVE,()=>h.remove())),s.add(bi(h,hn.MOUSE_DOWN,()=>h.remove()));let u=0;if(i.length){const _=this._createActionBar(".action-widget-action-bar",i);_&&(n.appendChild(_.getContainer().parentElement),s.add(_),u=_.getContainer().offsetWidth)}const g=(v=this._list.value)==null?void 0:v.layout(u);n.style.width=`${g}px`;const f=s.add(bu(e));return s.add(f.onDidBlur(()=>this.hide(!0))),s}_createActionBar(e,t){if(!t.length)return;const i=qe(e),n=new uf(i);return n.push(t,{icon:!1,label:!0}),n}_onWidgetClosed(e){var t;(t=this._list.value)==null||t.hide(e)}};Rd=gB([Rw(0,pb),Rw(1,wi),Rw(2,Bt)],Rd);Ka(Kd,Rd,1);const kp=1100;Ti(class extends Ns{constructor(){super({id:"hideCodeActionWidget",title:Xe("hideCodeActionWidget.title","Hide action widget"),precondition:Nd.Visible,keybinding:{weight:kp,primary:9,secondary:[1033]}})}run(o){o.get(Kd).hide(!0)}});Ti(class extends Ns{constructor(){super({id:"selectPrevCodeAction",title:Xe("selectPrevCodeAction.title","Select previous action"),precondition:Nd.Visible,keybinding:{weight:kp,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(o){const e=o.get(Kd);e instanceof Rd&&e.focusPrevious()}});Ti(class extends Ns{constructor(){super({id:"selectNextCodeAction",title:Xe("selectNextCodeAction.title","Select next action"),precondition:Nd.Visible,keybinding:{weight:kp,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(o){const e=o.get(Kd);e instanceof Rd&&e.focusNext()}});Ti(class extends Ns{constructor(){super({id:_T,title:Xe("acceptSelected.title","Accept selected action"),precondition:Nd.Visible,keybinding:{weight:kp,primary:3,secondary:[2137]}})}run(o){const e=o.get(Kd);e instanceof Rd&&e.acceptSelected()}});Ti(class extends Ns{constructor(){super({id:vT,title:Xe("previewSelected.title","Preview selected action"),precondition:Nd.Visible,keybinding:{weight:kp,primary:2051}})}run(o){const e=o.get(Kd);e instanceof Rd&&e.acceptSelected(!0)}});const wT=new di("supportedCodeAction",""),uI="_typescript.applyFixAllCodeAction";class fB extends Se{constructor(e,t,i,n=250){super(),this._editor=e,this._markerService=t,this._signalChange=i,this._delay=n,this._autoTriggerTimer=this._register(new cp),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=>Ym(i,t.uri))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet(()=>{this.trigger({type:2,triggerAction:Ks.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!==_w.Off){{if(i===_w.On)return t;if(i===_w.OnCode){if(!t.isEmpty())return t;const s=this._editor.getModel(),{lineNumber:r,column:a}=t.getPosition(),c=s.getLineContent(r);if(c.length===0)return;if(a===1){if(/\s/.test(c[0]))return}else if(a===s.getLineMaxColumn(r)){if(/\s/.test(c[c.length-1]))return}else if(/\s/.test(c[a-2])&&/\s/.test(c[a-1]))return}}return t}}}var gc;(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(Ql(r))return yT;throw r})}cancel(){this._cancellablePromise.cancel()}}o.Triggered=e})(gc||(gc={}));const yT=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1});class pB extends Se{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 oo),this._state=gc.Empty,this._onDidChangeState=this._register(new jt),this.onDidChangeState=this._onDidChangeState.event,this._disposed=!1,this._supportedCodeActions=wT.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(c=>{c.hasChanged(65)&&this._update()})),this._update()}dispose(){this._disposed||(this._disposed=!0,super.dispose(),this.setState(gc.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(gc.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 fB(this._editor,this._markerService,i=>{var c;if(!i){this.setState(gc.Empty);return}const n=i.selection.getStartPosition(),s=qn(async h=>{var u,g,f,v,_,y,S,x,E,M;if(this._settingEnabledNearbyQuickfixes()&&i.trigger.type===1&&(i.trigger.triggerAction===Ks.QuickFix||(g=(u=i.trigger.filter)==null?void 0:u.include)!=null&&g.contains(qi.QuickFix))){const F=await Rh(this._registry,e,i.selection,i.trigger,xa.None,h),R=[...F.allActions];if(h.isCancellationRequested)return yT;const Z=(f=F.validActions)==null?void 0:f.some(he=>he.action.kind?qi.QuickFix.contains(new sn(he.action.kind)):!1),q=this._markerService.read({resource:e.uri});if(Z){for(const he of F.validActions)(_=(v=he.action.command)==null?void 0:v.arguments)!=null&&_.some(pe=>typeof pe=="string"&&pe.includes(uI))&&(he.action.diagnostics=[...q.filter(pe=>pe.relatedInformation)]);return{validActions:F.validActions,allActions:R,documentation:F.documentation,hasAutoFix:F.hasAutoFix,hasAIFix:F.hasAIFix,allAIFixes:F.allAIFixes,dispose:()=>{F.dispose()}}}else if(!Z&&q.length>0){const he=i.selection.getPosition();let pe=he,Ce=Number.MAX_VALUE;const Pe=[...F.validActions];for(const qt of q){const Ge=qt.endColumn,Xt=qt.endLineNumber,pt=qt.startLineNumber;if(Xt===he.lineNumber||pt===he.lineNumber){pe=new Qe(Xt,Ge);const Kt={type:i.trigger.type,triggerAction:i.trigger.triggerAction,filter:{include:(y=i.trigger.filter)!=null&&y.include?(S=i.trigger.filter)==null?void 0:S.include:qi.QuickFix},autoApply:i.trigger.autoApply,context:{notAvailableMessage:((x=i.trigger.context)==null?void 0:x.notAvailableMessage)||"",position:pe}},ae=new _t(pe.lineNumber,pe.column,pe.lineNumber,pe.column),Te=await Rh(this._registry,e,ae,Kt,xa.None,h);if(Te.validActions.length!==0){for(const ve of Te.validActions)(M=(E=ve.action.command)==null?void 0:E.arguments)!=null&&M.some(lt=>typeof lt=="string"&&lt.includes(uI))&&(ve.action.diagnostics=[...q.filter(lt=>lt.relatedInformation)]);F.allActions.length===0&&R.push(...Te.allActions),Math.abs(he.column-Ge)<Ce?Pe.unshift(...Te.validActions):Pe.push(...Te.validActions)}Ce=Math.abs(he.column-Ge)}}const je=Pe.filter((qt,Ge,Xt)=>Xt.findIndex(pt=>pt.action.title===qt.action.title)===Ge);return je.sort((qt,Ge)=>qt.action.isPreferred&&!Ge.action.isPreferred?-1:!qt.action.isPreferred&&Ge.action.isPreferred||qt.action.isAI&&!Ge.action.isAI?1:!qt.action.isAI&&Ge.action.isAI?-1:0),{validActions:je,allActions:R,documentation:F.documentation,hasAutoFix:F.hasAutoFix,hasAIFix:F.hasAIFix,allAIFixes:F.allAIFixes,dispose:()=>{F.dispose()}}}}if(i.trigger.type===1){const F=new qs,R=await Rh(this._registry,e,i.selection,i.trigger,xa.None,h);return this._telemetryService&&this._telemetryService.publicLog2("codeAction.invokedDurations",{codeActions:R.validActions.length,duration:F.elapsed()}),R}return Rh(this._registry,e,i.selection,i.trigger,xa.None,h)});i.trigger.type===1&&((c=this._progressService)==null||c.showWhile(s,250));const r=new gc.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:Ks.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 mB=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},kr=function(o,e){return function(t,i){e(t,i,o)}},Lh;const _B="quickfix-edit-highlight";var Dl;let Nu=(Dl=class extends Se{static get(e){return e.getContribution(Lh.ID)}constructor(e,t,i,n,s,r,a,c,h,u,g){super(),this._commandService=a,this._configurationService=c,this._actionWidgetService=h,this._instantiationService=u,this._telemetryService=g,this._activeCodeActions=this._register(new oo),this._showDisabled=!1,this._disposed=!1,this._editor=e,this._model=this._register(new pB(this._editor,s.codeActionProvider,t,i,r,c,this._telemetryService)),this._register(this._model.onDidChangeState(f=>this.update(f))),this._lightBulbWidget=new Wx(()=>{const f=this._editor.getContribution(Df.ID);return f&&this._register(f.onClick(v=>this.showCodeActionsFromLightbulb(v.actions,v))),f}),this._resolver=n.createInstance(tS),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,wc.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=Us.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(iB,e,n,{preview:i,editor:this._editor})}finally{t&&this._trigger({type:2,triggerAction:Ks.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,c;if(e.type!==1){this.hideLightBulbWidget();return}let t;try{t=await e.actions}catch(h){Vi(h);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 u=this.tryGetValidActionToApply(e.trigger,t);if(u){try{this.hideLightBulbWidget(),await this._applyCodeAction(u,!1,!1,wc.FromCodeActions)}finally{t.dispose()}return}if(e.trigger.context){const g=this.getInvalidActionThatWouldHaveBeenApplied(e.trigger,t);if(g&&g.action.disabled){(r=Us.get(this._editor))==null||r.showMessage(g.action.disabled,e.trigger.context.position),t.dispose();return}}}const h=!!((a=e.trigger.filter)!=null&&a.include);if(e.trigger.context&&(!t.allActions.length||!h&&!t.validActions.length)){(c=Us.get(this._editor))==null||c.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:h,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=Qe.isIPosition(t)?this.toCoords(t):t,c={onSelect:async(h,u)=>{this._applyCodeAction(h,!0,!!u,i.fromLightbulb?wc.FromAILightbulb:wc.FromCodeActions),this._actionWidgetService.hide(!1),n.clear()},onHide:h=>{var u;(u=this._editor)==null||u.focus(),n.clear()},onHover:async(h,u)=>{var v;if(u.isCancellationRequested)return;let g=!1;const f=h.action.kind;if(f){const _=new sn(f);g=[qi.RefactorExtract,qi.RefactorInline,qi.RefactorRewrite,qi.RefactorMove,qi.Source].some(S=>S.contains(_))}return{canPreview:g||!!((v=h.action.edit)!=null&&v.edits.length)}},onFocus:h=>{var u,g;if(h&&h.action){const f=h.action.ranges,v=h.action.diagnostics;if(n.clear(),f&&f.length>0){const _=v&&(v==null?void 0:v.length)>1?v.map(y=>({range:y,options:Lh.DECORATION})):f.map(y=>({range:y,options:Lh.DECORATION}));n.set(_)}else if(v&&v.length>0){const _=v.map(S=>({range:S,options:Lh.DECORATION}));n.set(_);const y=v[0];if(y.startLineNumber&&y.startColumn){const S=(g=(u=this._editor.getModel())==null?void 0:u.getWordAtPosition({lineNumber:y.startLineNumber,column:y.startColumn}))==null?void 0:g.word;wu(w("editingNewSelection","Context: {0} at line {1} and column {2}.",S,y.startLineNumber,y.startColumn))}}}else n.clear()}};this._actionWidgetService.show("codeActionWidget",!0,aB(r,this._shouldShowHeaders(),this._resolver.getResolver()),c,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=Ps(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:w("hideMoreActions","Hide Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(e,t,i))}:{id:"showMoreActions",label:w("showMoreActions","Show Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(e,t,i))}),n}},Lh=Dl,Dl.ID="editor.contrib.codeActionController",Dl.DECORATION=oi.register({description:"quickfix-highlight",className:_B}),Dl);Nu=Lh=mB([kr(1,$x),kr(2,wi),kr(3,Bt),kr(4,Je),kr(5,dp),kr(6,Bn),kr(7,on),kr(8,Kd),kr(9,Bt),kr(10,vr)],Nu);mb((o,e)=>{((n,s)=>{s&&e.addRule(`.monaco-editor ${n} { background-color: ${s}; }`)})(".quickfix-edit-highlight",o.getColor(tA));const i=o.getColor(vD);i&&e.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${gf(o.type)?"dotted":"solid"} ${i}; box-sizing: border-box; }`)});function Dp(o){return ie.regex(wT.keys()[0],new RegExp("(\\s|^)"+ff(o.value)+"\\b"))}const M1={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:w("args.schema.kind","Kind of the code action to run.")},apply:{type:"string",description:w("args.schema.apply","Controls when the returned actions are applied."),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[w("args.schema.apply.first","Always apply the first returned code action."),w("args.schema.apply.ifSingle","Apply the first returned code action if it is the only one."),w("args.schema.apply.never","Do not apply the returned code actions.")]},preferred:{type:"boolean",default:!1,description:w("args.schema.preferred","Controls if only preferred code actions should be returned.")}}};function Gd(o,e,t,i,n=Ks.Default){if(o.hasModel()){const s=Nu.get(o);s==null||s.manualTriggerAtCurrentPosition(e,n,t,i)}}class vB extends ge{constructor(){super({id:T1,label:w("quickfix.trigger.label","Quick Fix..."),alias:"Quick Fix...",precondition:ie.and(T.writable,T.hasCodeActionsProvider),kbOpts:{kbExpr:T.textInputFocus,primary:2137,weight:100}})}run(e,t){return Gd(t,w("editor.action.quickFix.noneMessage","No code actions available"),void 0,void 0,Ks.QuickFix)}}class bB extends Rs{constructor(){super({id:hT,precondition:ie.and(T.writable,T.hasCodeActionsProvider),metadata:{description:"Trigger a code action",args:[{name:"args",schema:M1}]}})}runEditorCommand(e,t,i){const n=zr.fromUser(i,{kind:sn.Empty,apply:"ifSingle"});return Gd(t,typeof(i==null?void 0:i.kind)=="string"?n.preferred?w("editor.action.codeAction.noneMessage.preferred.kind","No preferred code actions for '{0}' available",i.kind):w("editor.action.codeAction.noneMessage.kind","No code actions for '{0}' available",i.kind):n.preferred?w("editor.action.codeAction.noneMessage.preferred","No preferred code actions available"):w("editor.action.codeAction.noneMessage","No code actions available"),{include:n.kind,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply)}}class wB extends ge{constructor(){super({id:gT,label:w("refactor.label","Refactor..."),alias:"Refactor...",precondition:ie.and(T.writable,T.hasCodeActionsProvider),kbOpts:{kbExpr:T.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:ie.and(T.writable,Dp(qi.Refactor))},metadata:{description:"Refactor...",args:[{name:"args",schema:M1}]}})}run(e,t,i){const n=zr.fromUser(i,{kind:qi.Refactor,apply:"never"});return Gd(t,typeof(i==null?void 0:i.kind)=="string"?n.preferred?w("editor.action.refactor.noneMessage.preferred.kind","No preferred refactorings for '{0}' available",i.kind):w("editor.action.refactor.noneMessage.kind","No refactorings for '{0}' available",i.kind):n.preferred?w("editor.action.refactor.noneMessage.preferred","No preferred refactorings available"):w("editor.action.refactor.noneMessage","No refactorings available"),{include:qi.Refactor.contains(n.kind)?n.kind:sn.None,onlyIncludePreferredActions:n.preferred},n.apply,Ks.Refactor)}}class yB extends ge{constructor(){super({id:fT,label:w("source.label","Source Action..."),alias:"Source Action...",precondition:ie.and(T.writable,T.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:ie.and(T.writable,Dp(qi.Source))},metadata:{description:"Source Action...",args:[{name:"args",schema:M1}]}})}run(e,t,i){const n=zr.fromUser(i,{kind:qi.Source,apply:"never"});return Gd(t,typeof(i==null?void 0:i.kind)=="string"?n.preferred?w("editor.action.source.noneMessage.preferred.kind","No preferred source actions for '{0}' available",i.kind):w("editor.action.source.noneMessage.kind","No source actions for '{0}' available",i.kind):n.preferred?w("editor.action.source.noneMessage.preferred","No preferred source actions available"):w("editor.action.source.noneMessage","No source actions available"),{include:qi.Source.contains(n.kind)?n.kind:sn.None,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply,Ks.SourceAction)}}class SB extends ge{constructor(){super({id:Qy,label:w("organizeImports.label","Organize Imports"),alias:"Organize Imports",precondition:ie.and(T.writable,Dp(qi.SourceOrganizeImports)),kbOpts:{kbExpr:T.textInputFocus,primary:1581,weight:100}})}run(e,t){return Gd(t,w("editor.action.organize.noneMessage","No organize imports action available"),{include:qi.SourceOrganizeImports,includeSourceActions:!0},"ifSingle",Ks.OrganizeImports)}}class CB extends ge{constructor(){super({id:Jy,label:w("fixAll.label","Fix All"),alias:"Fix All",precondition:ie.and(T.writable,Dp(qi.SourceFixAll))})}run(e,t){return Gd(t,w("fixAll.noneMessage","No fix all action available"),{include:qi.SourceFixAll,includeSourceActions:!0},"ifSingle",Ks.FixAll)}}class xB extends ge{constructor(){super({id:uT,label:w("autoFix.label","Auto Fix..."),alias:"Auto Fix...",precondition:ie.and(T.writable,Dp(qi.QuickFix)),kbOpts:{kbExpr:T.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(e,t){return Gd(t,w("editor.action.autoFix.noneMessage","No auto fixes available"),{include:qi.QuickFix,onlyIncludePreferredActions:!0},"ifSingle",Ks.AutoFix)}}Zt(Nu.ID,Nu,3);Zt(Df.ID,Df,4);Q(vB);Q(wB);Q(yB);Q(SB);Q(xB);Q(CB);it(new bB);mr.as(hp.Configuration).registerConfiguration({..._b,properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:5,description:w("showCodeActionHeaders","Enable/disable showing group headers in the Code Action menu."),default:!0}}});mr.as(hp.Configuration).registerConfiguration({..._b,properties:{"editor.codeActionWidget.includeNearbyQuickFixes":{type:"boolean",scope:5,description:w("includeNearbyQuickFixes","Enable/disable showing nearest Quick Fix within a line when not currently on a diagnostic."),default:!0}}});mr.as(hp.Configuration).registerConfiguration({..._b,properties:{"editor.codeActions.triggerOnFocusChange":{type:"boolean",scope:5,markdownDescription:w("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 oS{constructor(){this.lenses=[],this._disposables=new we}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 ST(o,e,t){const i=o.ordered(e),n=new Map,s=new oS,r=i.map(async(a,c)=>{n.set(a,c);try{const h=await Promise.resolve(a.provideCodeLenses(e,t));h&&s.add(h,a)}catch(h){Cn(h)}});return await Promise.all(r),s.lenses=s.lenses.sort((a,c)=>a.symbol.range.startLineNumber<c.symbol.range.startLineNumber?-1:a.symbol.range.startLineNumber>c.symbol.range.startLineNumber?1:n.get(a.provider)<n.get(c.provider)?-1:n.get(a.provider)>n.get(c.provider)?1:a.symbol.range.startColumn<c.symbol.range.startColumn?-1:a.symbol.range.startColumn>c.symbol.range.startColumn?1:0),s}Gi.registerCommand("_executeCodeLensProvider",function(o,...e){let[t,i]=e;Si(Ri.isUri(t)),Si(typeof i=="number"||!i);const{codeLensProvider:n}=o.get(Je),s=o.get(Cs).getModel(t);if(!s)throw Ea();const r=[],a=new we;return ST(n,s,$t.None).then(c=>{a.add(c);const h=[];for(const u of c.lenses)i==null||u.symbol.command?r.push(u.symbol):i-- >0&&u.provider.resolveCodeLens&&h.push(Promise.resolve(u.provider.resolveCodeLens(s,u.symbol,$t.None)).then(g=>r.push(g||u.symbol)));return Promise.all(h)}).then(()=>r).finally(()=>{setTimeout(()=>a.dispose(),100)})});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},IB=function(o,e){return function(t,i){e(t,i,o)}};const CT=qa("ICodeLensCache");class gI{constructor(e,t){this.lineCount=e,this.data=t}}let rS=class{constructor(e){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}},this._cache=new up(20,.75);const t="codelens/cache";iA(nA,()=>e.remove(t,1));const i="codelens/cache2",n=e.get(i,1,"{}");this._deserialize(n);const s=Nn.filter(e.onWillSaveState,r=>r.reason===qx.SHUTDOWN);Nn.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 oS;n.add({lenses:i,dispose:()=>{}},this._fakeProvider);const s=new gI(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 O(a,1,a,11)});const r=new oS;r.add({lenses:s,dispose(){}},this._fakeProvider),this._cache.set(i,new gI(n.lineCount,r))}}catch{}}};rS=LB([IB(0,Jl)],rS);Ka(CT,rS,1);class kB{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 cf=class cf{constructor(e,t){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=e,this._id=`codelens.widget-${cf._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=sA(r.command.title.trim());if(r.command.id){const c=`c${cf._idPool++}`;i.push(qe("a",{id:c,title:r.command.tooltip,role:"button"},...a)),this._commands.set(c,r.command)}else i.push(qe("span",{title:r.command.tooltip},...a));s+1<e.length&&i.push(qe("span",void 0," | "))}}n?(Qm(this._domNode,...i),this._isEmpty&&t&&this._domNode.classList.add("fadein"),this._isEmpty=!1):Qm(this._domNode,qe("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}};cf._idPool=0;let aS=cf;class Aw{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 fI=oi.register({collapseOnReplaceEdit:!0,description:"codelens"});class pI{constructor(e,t,i,n,s,r){this._isDisposed=!1,this._editor=t,this._data=e,this._decorationIds=[];let a;const c=[];this._data.forEach((h,u)=>{h.symbol.command&&c.push(h.symbol),i.addDecoration({range:h.symbol.range,options:fI},g=>this._decorationIds[u]=g),a?a=O.plusRange(a,h.symbol.range):a=O.lift(h.symbol.range)}),this._viewZone=new kB(a.startLineNumber-1,s,r),this._viewZoneId=n.addZone(this._viewZone),c.length>0&&(this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(c,!1))}_createContentWidgetIfNecessary(){this._contentWidget?this._editor.layoutContentWidget(this._contentWidget):(this._contentWidget=new aS(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&&O.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:fI},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 DB=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},bg=function(o,e){return function(t,i){e(t,i,o)}},au;let Ef=(au=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 we,this._localToDispose=new we,this._lenses=[],this._oldCodeLensModels=new we,this._provideCodeLensDebounce=i.for(t.codeLensProvider,"CodeLensProvide",{min:250}),this._resolveCodeLensesDebounce=i.for(t.codeLensProvider,"CodeLensResolve",{min:250,salt:"resolve"}),this._resolveCodeLensesScheduler=new Rn(()=>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",Kx.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&&hf(()=>{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 Rn(()=>{var s;const n=Date.now();(s=this._getCodeLensModelPromise)==null||s.cancel(),this._getCodeLensModelPromise=qn(r=>ST(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()},Vi)},this._provideCodeLensDebounce.get(e));this._localToDispose.add(i),this._localToDispose.add(nn(()=>this._resolveCodeLensesScheduler.cancel())),this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{var n;this._editor.changeDecorations(s=>{this._editor.changeViewZones(r=>{const a=[];let c=-1;this._lenses.forEach(u=>{!u.isValid()||c===u.getLineNumber()?a.push(u):(u.update(r),c=u.getLineNumber())});const h=new Aw;a.forEach(u=>{u.dispose(h,r),this._lenses.splice(this._lenses.indexOf(u),1)}),h.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(nn(()=>{if(this._editor.getModel()){const n=yu.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(c=>this._notificationService.error(c));break}}})),i.schedule()}_disposeAllLenses(e,t){const i=new Aw;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 c=a.symbol.range.startLineNumber;c<1||c>t||(n&&n[n.length-1].symbol.range.startLineNumber===c?n.push(a):(n=[a],i.push(n)))}if(!i.length&&!this._lenses.length)return;const s=yu.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations(a=>{this._editor.changeViewZones(c=>{const h=new Aw;let u=0,g=0;for(;g<i.length&&u<this._lenses.length;){const f=i[g][0].symbol.range.startLineNumber,v=this._lenses[u].getLineNumber();v<f?(this._lenses[u].dispose(h,c),this._lenses.splice(u,1)):v===f?(this._lenses[u].updateCodeLensSymbols(i[g],h),g++,u++):(this._lenses.splice(u,0,new pI(i[g],this._editor,h,c,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),u++,g++)}for(;u<this._lenses.length;)this._lenses[u].dispose(h,c),this._lenses.splice(u,1);for(;g<i.length;)this._lenses.push(new pI(i[g],this._editor,h,c,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),g++;h.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 c=a.computeIfNecessary(e);c&&(t.push(c),i.push(a))}),t.length===0)return;const n=Date.now(),s=qn(a=>{const c=t.map((h,u)=>{const g=new Array(h.length),f=h.map((v,_)=>!v.symbol.command&&typeof v.provider.resolveCodeLens=="function"?Promise.resolve(v.provider.resolveCodeLens(e,v.symbol,a)).then(y=>{g[_]=y},Cn):(g[_]=v.symbol,Promise.resolve(void 0)));return Promise.all(f).then(()=>{!a.isCancellationRequested&&!i[u].isDisposed()&&i[u].updateCommands(g)})});return Promise.all(c)});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=>{Vi(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}},au.ID="css.editor.codeLens",au);Ef=DB([bg(1,Je),bg(2,yo),bg(3,Bn),bg(4,Ss),bg(5,CT)],Ef);Zt(Ef.ID,Ef,1);Q(class extends ge{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:T.hasCodeLensProvider,label:w("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($a),n=e.get(Bn),s=e.get(Ss),r=t.getSelection().positionLineNumber,a=t.getContribution(Ef.ID);if(!a)return;const c=await a.getModel();if(!c)return;const h=[];for(const f of c.lenses)f.symbol.command&&f.symbol.range.startLineNumber===r&&h.push({label:f.symbol.command.title,command:f.symbol.command});if(h.length===0)return;const u=await i.pick(h,{canPickMany:!1,placeHolder:w("placeHolder","Select a command")});if(!u)return;let g=u.command;if(c.isDisposed){const f=await a.getModel(),v=f==null?void 0:f.lenses.find(_=>{var y;return _.symbol.range.startLineNumber===r&&((y=_.symbol.command)==null?void 0:y.title)===g.title});if(!v||!v.symbol.command)return;g=v.symbol.command}try{await n.executeCommand(g.id,...g.arguments||[])}catch(f){s.error(f)}}});var xT=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},lS=function(o,e){return function(t,i){e(t,i,o)}};let Pf=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 ii(new Su(Math.round(255*s.red),Math.round(255*s.green),Math.round(255*s.blue),r)),c=r?ii.Format.CSS.formatRGB(a):ii.Format.CSS.formatRGBA(a),h=r?ii.Format.CSS.formatHSL(a):ii.Format.CSS.formatHSLA(a),u=r?ii.Format.CSS.formatHex(a):ii.Format.CSS.formatHexA(a),g=[];return g.push({label:c,textEdit:{range:n,text:c}}),g.push({label:h,textEdit:{range:n,text:h}}),g.push({label:u,textEdit:{range:n,text:u}}),g}};Pf=xT([lS(0,Ga)],Pf);let cS=class extends Se{constructor(e,t){super(),this._register(e.colorProvider.register("*",new Pf(t)))}};cS=xT([lS(0,Je),lS(1,Ga)],cS);Xu(cS);async function LT(o,e,t,i=!0){return N1(new EB,o,e,t,i)}function IT(o,e,t,i){return Promise.resolve(t.provideColorPresentations(o,e,i))}class EB{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 PB{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 TB{constructor(e){this.colorInfo=e}async compute(e,t,i,n){const s=await e.provideColorPresentations(t,this.colorInfo,$t.None);return Array.isArray(s)&&n.push(...s),Array.isArray(s)}}async function N1(o,e,t,i,n){let s=!1,r;const a=[],c=e.ordered(t);for(let h=c.length-1;h>=0;h--){const u=c[h];if(u instanceof Pf)r=u;else try{await o.compute(u,t,i,a)&&(s=!0)}catch(g){Cn(g)}}return s?a:r&&n?(await o.compute(r,t,i,a),a):[]}function kT(o,e){const{colorProvider:t}=o.get(Je),i=o.get(Cs).getModel(e);if(!i)throw Ea();const n=o.get(on).getValue("editor.defaultColorDecorators",{resource:e});return{model:i,colorProviderRegistry:t,isDefaultColorDecoratorsEnabled:n}}Gi.registerCommand("_executeDocumentColorProvider",function(o,...e){const[t]=e;if(!(t instanceof Ri))throw Ea();const{model:i,colorProviderRegistry:n,isDefaultColorDecoratorsEnabled:s}=kT(o,t);return N1(new PB,n,i,$t.None,s)});Gi.registerCommand("_executeColorPresentationProvider",function(o,...e){const[t,i]=e,{uri:n,range:s}=i;if(!(n instanceof Ri)||!Array.isArray(t)||t.length!==4||!O.isIRange(s))throw Ea();const{model:r,colorProviderRegistry:a,isDefaultColorDecoratorsEnabled:c}=kT(o,n),[h,u,g,f]=t;return N1(new TB({range:s,color:{red:h,green:u,blue:g,alpha:f}}),a,r,$t.None,c)});var MB=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},Ow=function(o,e){return function(t,i){e(t,i,o)}},dS;const DT=Object.create({});var El;let Ru=(El=class extends Se{constructor(e,t,i,n){super(),this._editor=e,this._configurationService=t,this._languageFeaturesService=i,this._localToDispose=this._register(new we),this._decorationsIds=[],this._colorDatas=new Map,this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=new bD(this._editor),this._decoratorLimitReporter=new NB,this._colorDecorationClassRefs=this._register(new we),this._debounceInformation=n.for(i.colorProvider,"Document Colors",{min:dS.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),c=s.hasChanged(148);(a||c)&&(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 cp,this._timeoutTimer.cancelAndSet(()=>{this._timeoutTimer=null,this.beginCompute()},this._debounceInformation.get(e)))})),this.beginCompute())}async beginCompute(){this._computePromise=qn(async e=>{const t=this._editor.getModel();if(!t)return[];const i=new qs(!1),n=await LT(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){Vi(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:oi.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:c,alpha:h}=e[s].colorInfo.color,u=new Su(Math.round(r*255),Math.round(a*255),Math.round(c*255),h),g=`rgba(${u.r}, ${u.g}, ${u.b}, ${u.a})`,f=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:pD,inlineClassName:`${f.className} colorpicker-color-decoration`,inlineClassNameAffectsLetterSpacing:!0,attachedData:DT}}})}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(O.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)}},dS=El,El.ID="editor.contrib.colorDetector",El.RECOMPUTE_TIME=1e3,El);Ru=dS=MB([Ow(1,on),Ow(2,Je),Ow(3,yo)],Ru);class NB{constructor(){this._onDidChange=new jt,this._computed=0,this._limited=!1}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}}Zt(Ru.ID,Ru,1);class RB{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 jt,this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=new jt,this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=new jt,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 to=qe;class AB extends Se{constructor(e,t,i,n=!1){super(),this.model=t,this.showingStandaloneColorPicker=n,this._closeButton=null,this._domNode=to(".colorpicker-header"),Ve(e,this._domNode),this._pickedColorNode=Ve(this._domNode,to(".picked-color")),Ve(this._pickedColorNode,to("span.codicon.codicon-color-mode")),this._pickedColorPresentation=Ve(this._pickedColorNode,document.createElement("span")),this._pickedColorPresentation.classList.add("picked-color-presentation");const s=w("clickToToggleColorOptions","Click to toggle color options (rgb/hsl/hex)");this._pickedColorNode.setAttribute("title",s),this._originalColorNode=Ve(this._domNode,to(".original-color")),this._originalColorNode.style.backgroundColor=ii.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=i.getColorTheme().getColor(dL)||ii.white,this._register(i.onDidColorThemeChange(r=>{this.backgroundColor=r.getColor(dL)||ii.white})),this._register(bi(this._pickedColorNode,hn.CLICK,()=>this.model.selectNextColorPresentation())),this._register(bi(this._originalColorNode,hn.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=ii.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 OB(this._domNode)))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(e){this._pickedColorNode.style.backgroundColor=ii.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 OB extends Se{constructor(e){super(),this._onClicked=this._register(new jt),this.onClicked=this._onClicked.event,this._button=document.createElement("div"),this._button.classList.add("close-button"),Ve(e,this._button);const t=document.createElement("div");t.classList.add("close-button-inner-div"),Ve(this._button,t),Ve(t,to(".button"+xi.asCSSSelector(yn("color-picker-close",xt.close,w("closeIcon","Icon to close the color picker"))))).classList.add("close-icon"),this._register(bi(this._button,hn.CLICK,()=>{this._onClicked.fire()}))}}class FB extends Se{constructor(e,t,i,n=!1){super(),this.model=t,this.pixelRatio=i,this._insertButton=null,this._domNode=to(".colorpicker-body"),Ve(e,this._domNode),this._saturationBox=new HB(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 WB(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 BB(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 zB(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 ii(new Im(i.h,e,t,i.a))}onDidOpacityChange(e){const t=this.model.color.hsva;this.model.color=new ii(new Im(t.h,t.s,t.v,e))}onDidHueChange(e){const t=this.model.color.hsva,i=(1-e)*360;this.model.color=new ii(new Im(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 HB extends Se{constructor(e,t,i){super(),this.model=t,this.pixelRatio=i,this._onDidChange=new jt,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new jt,this.onColorFlushed=this._onColorFlushed.event,this._domNode=to(".saturation-wrap"),Ve(e,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",Ve(this._domNode,this._canvas),this.selection=to(".saturation-selection"),Ve(this._domNode,this.selection),this.layout(),this._register(bi(this._domNode,hn.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 wD);const t=Ps(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=bi(e.target.ownerDocument,hn.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 ii(new Im(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=ii.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 ET extends Se{constructor(e,t,i=!1){super(),this.model=t,this._onDidChange=new jt,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new jt,this.onColorFlushed=this._onColorFlushed.event,i?(this.domNode=Ve(e,to(".standalone-strip")),this.overlay=Ve(this.domNode,to(".standalone-overlay"))):(this.domNode=Ve(e,to(".strip")),this.overlay=Ve(this.domNode,to(".overlay"))),this.slider=Ve(this.domNode,to(".slider")),this.slider.style.top="0px",this._register(bi(this.domNode,hn.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 wD),i=Ps(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=bi(e.target.ownerDocument,hn.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 WB extends ET{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 ii(new Su(t,i,n,1)),r=new ii(new Su(t,i,n,0));this.overlay.style.background=`linear-gradient(to bottom, ${s} 0%, ${r} 100%)`}getValue(e){return e.hsva.a}}class BB extends ET{constructor(e,t,i=!1){super(e,t,i),this.domNode.classList.add("hue-strip")}getValue(e){return 1-e.hsva.h/360}}class zB extends Se{constructor(e){super(),this._onClicked=this._register(new jt),this.onClicked=this._onClicked.event,this._button=Ve(e,document.createElement("button")),this._button.classList.add("insert-button"),this._button.textContent="Insert",this._register(bi(this._button,hn.CLICK,()=>{this._onClicked.fire()}))}get button(){return this._button}}class VB extends gp{constructor(e,t,i,n,s=!1){super(),this.model=t,this.pixelRatio=i,this._register(oA.getInstance(kc(e)).onDidChange(()=>this.layout())),this._domNode=to(".colorpicker-widget"),e.appendChild(this._domNode),this.header=this._register(new AB(this._domNode,this.model,n,s)),this.body=this._register(new FB(this._domNode,this.model,this.pixelRatio,s))}layout(){this.body.layout()}get domNode(){return this._domNode}}class Fw{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 Fm{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 Ad{constructor(e){this.renderedHoverParts=e}dispose(){for(const e of this.renderedHoverParts)e.dispose()}}const Zd=new class{constructor(){this._participants=[]}register(e){this._participants.push(e)}getAll(){return this._participants}};var PT=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},TT=function(o,e){return function(t,i){e(t,i,o)}};class UB{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 Tf=class{constructor(e,t){this._editor=e,this._themeService=t,this.hoverOrdinal=2}computeSync(e,t){return[]}computeAsync(e,t,i){return hr.fromPromise(this._computeAsync(e,t,i))}async _computeAsync(e,t,i){if(!this._editor.hasModel())return[];const n=Ru.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 MT(this,this._editor.getModel(),r.colorInfo,r.provider)]}return[]}renderHoverParts(e,t){const i=NT(this,this._editor,this._themeService,t,e);if(!i)return new Ad([]);this._colorPicker=i.colorPicker;const n={hoverPart:i.hoverPart,hoverElement:this._colorPicker.domNode,dispose(){i.disposables.dispose()}};return new Ad([n])}handleResize(){var e;(e=this._colorPicker)==null||e.layout()}isColorPickerVisible(){return!!this._colorPicker}};Tf=PT([TT(1,qo)],Tf);class jB{constructor(e,t,i,n){this.owner=e,this.range=t,this.model=i,this.provider=n}}let Mf=class{constructor(e,t){this._editor=e,this._themeService=t,this._color=null}async createColorHover(e,t,i){if(!this._editor.hasModel()||!Ru.get(this._editor))return null;const s=await LT(i,this._editor.getModel(),$t.None);let r=null,a=null;for(const g of s){const f=g.colorInfo;O.containsRange(f.range,e.range)&&(r=f,a=g.provider)}const c=r??e,h=a??t,u=!!r;return{colorHover:await MT(this,this._editor.getModel(),c,h),foundInEditor:u}}async updateEditorModel(e){if(!this._editor.hasModel())return;const t=e.model;let i=new O(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn);this._color&&(await Hm(this._editor.getModel(),t,this._color,i,e),i=RT(this._editor,i,t))}renderHoverParts(e,t){return NT(this,this._editor,this._themeService,t,e)}set color(e){this._color=e}get color(){return this._color}};Mf=PT([TT(1,qo)],Mf);async function MT(o,e,t,i){const n=e.getValueInRange(t.range),{red:s,green:r,blue:a,alpha:c}=t.color,h=new Su(Math.round(s*255),Math.round(r*255),Math.round(a*255),c),u=new ii(h),g=await IT(e,t,i,$t.None),f=new RB(u,[],0);return f.colorPresentations=g||[],f.guessColorPresentation(u,n),o instanceof Tf?new UB(o,O.lift(t.range),f,i):new jB(o,O.lift(t.range),f,i)}function NT(o,e,t,i,n){if(i.length===0||!e.hasModel())return;if(n.setMinimumDimensions){const f=e.getOption(67)+8;n.setMinimumDimensions(new $i(302,f))}const s=new we,r=i[0],a=e.getModel(),c=r.model,h=s.add(new VB(n.fragment,c,e.getOption(144),t,o instanceof Mf));let u=!1,g=new O(r.range.startLineNumber,r.range.startColumn,r.range.endLineNumber,r.range.endColumn);if(o instanceof Mf){const f=r.model.color;o.color=f,Hm(a,c,f,g,r),s.add(c.onColorFlushed(v=>{o.color=v}))}else s.add(c.onColorFlushed(async f=>{await Hm(a,c,f,g,r),u=!0,g=RT(e,g,c)}));return s.add(c.onDidChangeColor(f=>{Hm(a,c,f,g,r)})),s.add(e.onDidChangeModelContent(f=>{u?u=!1:(n.hide(),e.focus())})),{hoverPart:r,colorPicker:h,disposables:s}}function RT(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=O.lift(n.range),r=o.getModel()._setTrackedRange(null,s,3);return o.executeEdits("colorpicker",i),o.pushUndoStop(),o.getModel()._getTrackedRange(r)??s}async function Hm(o,e,t,i,n){const s=await IT(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,$t.None);e.colorPresentations=s||[]}const AT="editor.action.showHover",$B="editor.action.showDefinitionPreviewHover",qB="editor.action.scrollUpHover",KB="editor.action.scrollDownHover",GB="editor.action.scrollLeftHover",ZB="editor.action.scrollRightHover",XB="editor.action.pageUpHover",YB="editor.action.pageDownHover",QB="editor.action.goToTopHover",JB="editor.action.goToBottomHover",Bb="editor.action.increaseHoverVerbosityLevel",e3=w({key:"increaseHoverVerbosityLevel",comment:["Label for action that will increase the hover verbosity level."]},"Increase Hover Verbosity Level"),zb="editor.action.decreaseHoverVerbosityLevel",t3=w({key:"decreaseHoverVerbosityLevel",comment:["Label for action that will decrease the hover verbosity level."]},"Decrease Hover Verbosity Level"),OT="editor.action.inlineSuggest.commit",FT="editor.action.inlineSuggest.showPrevious",HT="editor.action.inlineSuggest.showNext";var R1=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)}},Wm;let hS=class extends Se{constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=Bs(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).showToolbar==="always"),this.sessionPosition=void 0,this.position=Ei(this,n=>{var c,h;const s=(c=this.model.read(n))==null?void 0:c.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 Qe(s.lineNumber,Math.min(r,((h=this.sessionPosition)==null?void 0:h.column)??Number.MAX_SAFE_INTEGER));return this.sessionPosition=a,a}),this._register(fp((n,s)=>{const r=this.model.read(n);if(!r||!this.alwaysShowToolbar.read(n))return;const a=xD((h,u)=>{const g=u.add(this.instantiationService.createInstance(Au,this.editor,!0,this.position,r.selectedInlineCompletionIndex,r.inlineCompletionsCount,r.activeCommands));return e.addContentWidget(g),u.add(nn(()=>e.removeContentWidget(g))),u.add(dn(f=>{this.position.read(f)&&r.lastTriggerKind.read(f)!==Pa.Explicit&&r.triggerExplicitly()})),g}),c=vb(this,(h,u)=>!!this.position.read(h)||!!u);s.add(dn(h=>{c.read(h)&&a.read(h)}))}))}};hS=R1([Ao(2,Bt)],hS);const i3=yn("inline-suggestion-hints-next",xt.chevronRight,w("parameterHintsNextIcon","Icon for show next parameter hint.")),n3=yn("inline-suggestion-hints-previous",xt.chevronLeft,w("parameterHintsPreviousIcon","Icon for show previous parameter hint."));var Pl;let Au=(Pl=class extends Se{static get dropDownVisible(){return this._dropDownVisible}createCommandAction(e,t,i){const n=new Cu(e,t,i,!0,()=>this._commandService.executeCommand(e)),s=this.keybindingService.lookupKeybinding(e,this._contextKeyService);let r=t;return s&&(r=w({key:"content",comment:["A label","A keybinding"]},"{0} ({1})",t,s.getLabel())),n.tooltip=r,n}constructor(e,t,i,n,s,r,a,c,h,u,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=h,this._contextKeyService=u,this._menuService=g,this.id=`InlineSuggestionHintsContentWidget${Wm.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Oo("div.inlineSuggestionsHints",{className:this.withBorder?".withBorder":""},[Oo("div@toolBar")]),this.previousAction=this.createCommandAction(FT,w("previous","Previous"),xi.asClassName(n3)),this.availableSuggestionCountAction=new Cu("inlineSuggestionHints.availableSuggestionCount","",void 0,!1),this.nextAction=this.createCommandAction(HT,w("next","Next"),xi.asClassName(i3)),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(We.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new Rn(()=>{this.availableSuggestionCountAction.label=""},100)),this.disableButtonsDebounced=this._register(new Rn(()=>{this.previousAction.enabled=this.nextAction.enabled=!1},100)),this.toolBar=this._register(c.createInstance(uS,this.nodes.toolBar,We.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:f=>f.startsWith("primary")},actionViewItemProvider:(f,v)=>{if(f instanceof xu)return c.createInstance(o3,f,void 0);if(f===this.availableSuggestionCountAction){const _=new s3(void 0,f,{label:!0,icon:!1});return _.setClass("availableSuggestionCount"),_}},telemetrySource:"InlineSuggestionToolbar"})),this.toolBar.setPrependedPrimaryActions([this.previousAction,this.availableSuggestionCountAction,this.nextAction]),this._register(this.toolBar.onDidChangeDropdownVisibility(f=>{Wm._dropDownVisible=f})),this._register(dn(f=>{this._position.read(f),this.editor.layoutContentWidget(this)})),this._register(dn(f=>{const v=this._suggestionCount.read(f),_=this._currentSuggestionIdx.read(f);v!==void 0?(this.clearAvailableSuggestionCountLabelDebounced.cancel(),this.availableSuggestionCountAction.label=`${_+1}/${v}`):this.clearAvailableSuggestionCountLabelDebounced.schedule(),v!==void 0&&v>1?(this.disableButtonsDebounced.cancel(),this.previousAction.enabled=this.nextAction.enabled=!0):this.disableButtonsDebounced.schedule()})),this._register(dn(f=>{const _=this._extraCommands.read(f).map(y=>({class:void 0,id:y.id,enabled:!0,tooltip:y.tooltip||"",label:y.title,run:S=>this._commandService.executeCommand(y.id)}));for(const[y,S]of this.inlineCompletionsActionsMenus.getActions())for(const x of S)x instanceof xu&&_.push(x);_.length>0&&_.unshift(new pf),this.toolBar.setAdditionalSecondaryActions(_)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}},Wm=Pl,Pl._dropDownVisible=!1,Pl.id=0,Pl);Au=Wm=R1([Ao(6,Bn),Ao(7,Bt),Ao(8,En),Ao(9,wi),Ao(10,Ud)],Au);class s3 extends py{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 o3=class extends yD{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=Oo("div.keybinding").root;this._register(new zx(t,Vx,{disableTitle:!0,...SD})).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}updateTooltip(){}},uS=class extends CD{constructor(e,t,i,n,s,r,a,c,h){super(e,{resetMenu:t,...i},n,s,r,a,c,h),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,c,h;const e=[],t=[];Gx(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,(h=(c=this.options2)==null?void 0:c.toolbarOptions)==null?void 0:h.useSeparatorsInPrimaryActions),t.push(...this.additionalActions),e.unshift(...this.prependedPrimaryActions),this.setActions(e,t)}setPrependedPrimaryActions(e){Yr(this.prependedPrimaryActions,e,(t,i)=>t===i)||(this.prependedPrimaryActions=e,this.updateToolbar())}setAdditionalSecondaryActions(e){Yr(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};uS=R1([Ao(3,Ud),Ao(4,wi),Ao(5,Ku),Ao(6,En),Ao(7,Bn),Ao(8,vr)],uS);function Vb(o,e,t){const i=Ps(o);return!(e<i.left||e>i.left+i.width||t<i.top||t>i.top+i.height)}let r3=class{constructor(e,t,i){this.value=e,this.isComplete=t,this.hasLoadingMessage=i}};class WT extends Se{constructor(e,t){super(),this._editor=e,this._computer=t,this._onResult=this._register(new jt),this.onResult=this._onResult.event,this._firstWaitScheduler=this._register(new Rn(()=>this._triggerAsyncComputation(),0)),this._secondWaitScheduler=this._register(new Rn(()=>this._triggerSyncComputation(),0)),this._loadingMessageScheduler=this._register(new Rn(()=>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=rA(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){Vi(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 r3(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 A1{constructor(){this._onDidWillResize=new jt,this.onDidWillResize=this._onDidWillResize.event,this._onDidResize=new jt,this.onDidResize=this._onDidResize.event,this._sashListener=new we,this._size=new $i(0,0),this._minSize=new $i(0,0),this._maxSize=new $i(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),this.domNode=document.createElement("div"),this._eastSash=new Eh(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new Eh(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new Eh(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:hL.North}),this._southSash=new Eh(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:hL.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(Nn.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(Nn.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(Nn.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(Nn.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 $i(t,e);$i.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 a3=30,l3=24;class c3 extends Se{constructor(e,t=new $i(10,10)){super(),this._editor=e,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._resizableNode=this._register(new A1),this._contentPosition=null,this._isResizing=!1,this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=$i.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 $i(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?Qe.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);return!t||!i?void 0:Ps(t).top+i.top-a3}_availableVerticalSpaceBelow(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);if(!t||!i)return;const n=Ps(t),s=pp(t.ownerDocument.body),r=n.top+i.top+i.height;return s.height-r-l3}_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 d3=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},em=function(o,e){return function(t,i){e(t,i,o)}},Pr;const mI=30,h3=6;var Tl;let gS=(Tl=class extends c3{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,c=new $i(a,r);super(e,c),this._configurationService=i,this._accessibilityService=n,this._keybindingService=s,this._hover=this._register(new LD),this._onDidResize=this._register(new jt),this.onDidResize=this._onDidResize.event,this._minimumSize=c,this._hoverVisibleKey=T.hoverVisible.bindTo(t),this._hoverFocusedKey=T.hoverFocused.bindTo(t),Ve(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(u=>{u.hasChanged(50)&&this._updateFont()}));const h=this._register(bu(this._resizableNode.domNode));this._register(h.onDidFocus(()=>{this._hoverFocusedKey.set(!0)})),this._register(h.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 Pr.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 Pr._applyDimensions(i,e,t)}_setContainerDomNodeDimensions(e,t){const i=this._hover.containerDomNode;return Pr._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){Pr._applyMaxDimensions(this._hover.contentsDomNode,e,t),Pr._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 $i(e,t),this._setHoverWidgetMaxDimensions(e,t)}_resize(e){Pr._lastDimensions=new $i(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=h3;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?pp(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=Ps(this.getDomNode());this._renderedHover.closestMouseDistance===void 0&&(this._renderedHover.closestMouseDistance=_I(this._renderedHover.initialMousePosX,this._renderedHover.initialMousePosY,i.left,i.top,i.width,i.height));const n=_I(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,Pr._lastDimensions.height),t=Math.max(this._editor.getLayoutInfo().width*.66,500,Pr._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=Ph(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&&aA(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 $i(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 $i(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 $i(e,this._minimumSize.height)}onContentsChanged(){var n;this._removeConstraintsRenderNormally();const e=this._hover.containerDomNode;let t=Ph(e),i=Eo(e);if(this._resizableNode.layout(t,i),this._setHoverWidgetDimensions(i,t),t=Ph(e),i=Eo(e),this._contentWidth=i,this._updateMinimumWidth(),this._resizableNode.layout(t,i),(n=this._renderedHover)!=null&&n.showAtPosition){const s=Ph(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-mI})}scrollRight(){const e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e+mI})}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})}},Pr=Tl,Tl.ID="editor.contrib.resizableContentHoverWidget",Tl._lastDimensions=new $i(0,0),Tl);gS=Pr=d3([em(1,wi),em(2,on),em(3,bb),em(4,En)],gS);function _I(o,e,t,i,n,s){const r=t+n/2,a=i+s/2,c=Math.max(Math.abs(o-r)-n/2,0),h=Math.max(Math.abs(e-a)-s/2,0);return Math.sqrt(c*c+h*h)}class v_{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,c=r.range.endLineNumber===n?r.range.endColumn:s;if(r.options.showIfCollapsed){if(a>t.range.startColumn+1||t.range.endColumn-1>c)return!1}else if(a>t.range.startColumn||t.range.endColumn>c)return!1;return!0})}computeAsync(e){const t=this._anchor;if(!this._editor.hasModel()||!t)return hr.EMPTY;const i=v_._getLineDecorations(this._editor,t);return hr.merge(this._participants.map(n=>n.computeAsync?n.computeAsync(t,i,e):hr.EMPTY))}computeSync(){if(!this._editor.hasModel()||!this._anchor)return[];const e=v_._getLineDecorations(this._editor,this._anchor);let t=[];for(const i of this._participants)t=t.concat(i.computeSync(this._anchor,e));return Aa(t)}}class BT{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 u3(this,this.anchor,t,this.isComplete)}}class u3 extends BT{constructor(e,t,i,n){super(t,i,n),this.original=e}filter(e){return this.original.filter(e)}}var g3=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},f3=function(o,e){return function(t,i){e(t,i,o)}};const vI=qe;let b_=class extends Se{get hasContent(){return this._hasContent}constructor(e){super(),this._keybindingService=e,this.actions=[],this._hasContent=!1,this.hoverElement=vI("div.hover-row.status-bar"),this.hoverElement.tabIndex=0,this.actionsElement=Ve(this.hoverElement,vI("div.actions"))}addAction(e){const t=this._keybindingService.lookupKeybinding(e.commandId),i=t?t.getLabel():null;this._hasContent=!0;const n=this._register(lA.render(this.actionsElement,e,i));return this.actions.push(n),n}append(e){const t=Ve(this.actionsElement,e);return this._hasContent=!0,t}};b_=g3([f3(0,En)],b_);class p3{constructor(e,t,i){this.provider=e,this.hover=t,this.ordinal=i}}async function m3(o,e,t,i,n){const s=await Promise.resolve(o.provideHover(t,i,n)).catch(Cn);if(!(!s||!_3(s)))return new p3(o,s,e)}function O1(o,e,t,i,n=!1){const r=o.ordered(e,n).map((a,c)=>m3(a,c,e,t,i));return hr.fromPromises(r).coalesce()}function zT(o,e,t,i,n=!1){return O1(o,e,t,i,n).map(s=>s.hover).toPromise()}As("_executeHoverProvider",(o,e,t)=>{const i=o.get(Je);return zT(i.hoverProvider,e,t,$t.None)});As("_executeHoverProvider_recursive",(o,e,t)=>{const i=o.get(Je);return zT(i.hoverProvider,e,t,$t.None,!0)});function _3(o){const e=typeof o.range<"u",t=typeof o.contents<"u"&&o.contents&&o.contents.length>0;return e&&t}var v3=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},oc=function(o,e){return function(t,i){e(t,i,o)}};const Ah=qe,b3=yn("hover-increase-verbosity",xt.add,w("increaseHoverVerbosity","Icon for increaseing hover verbosity.")),w3=yn("hover-decrease-verbosity",xt.remove,w("decreaseHoverVerbosity","Icon for decreasing hover verbosity."));class Ho{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 VT{constructor(e,t,i){this.hover=e,this.hoverProvider=t,this.hoverPosition=i}supportsVerbosityAction(e){switch(e){case mo.Increase:return this.hover.canIncreaseVerbosity??!1;case mo.Decrease:return this.hover.canDecreaseVerbosity??!1}}}let Nf=class{constructor(e,t,i,n,s,r,a,c){this._editor=e,this._languageService=t,this._openerService=i,this._configurationService=n,this._languageFeaturesService=s,this._keybindingService=r,this._hoverService=a,this._commandService=c,this.hoverOrdinal=3}createLoadingMessage(e){return new Ho(this,e.range,[new us().appendText(w("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 c=i.getLineLength(n),h=i.getLanguageIdAtPosition(e.range.startLineNumber,e.range.startColumn),u=this._editor.getOption(118),g=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:h});let f=!1;u>=0&&c>u&&e.range.startColumn>=u&&(f=!0,r.push(new Ho(this,e.range,[{value:w("stopped rendering","Rendering paused for long line for performance reasons. This can be configured via `editor.stopRenderingLineAfter`.")}],!1,a++))),!f&&typeof g=="number"&&c>=g&&r.push(new Ho(this,e.range,[{value:w("too many characters","Tokenization is skipped for long lines for performance reasons. This can be configured via `editor.maxTokenizationLineLength`.")}],!1,a++));let v=!1;for(const _ of t){const y=_.range.startLineNumber===n?_.range.startColumn:1,S=_.range.endLineNumber===n?_.range.endColumn:s,x=_.options.hoverMessage;if(!x||mf(x))continue;_.options.beforeContentClassName&&(v=!0);const E=new O(e.range.startLineNumber,y,e.range.startLineNumber,S);r.push(new Ho(this,E,ID(x),v,a++))}return r}computeAsync(e,t,i){if(!this._editor.hasModel()||e.type!==1)return hr.EMPTY;const n=this._editor.getModel(),s=this._languageFeaturesService.hoverProvider;return s.has(n)?this._getMarkdownHovers(s,n,e,i):hr.EMPTY}_getMarkdownHovers(e,t,i,n){const s=i.range.getStartPosition();return O1(e,t,s,n).filter(c=>!mf(c.hover.contents)).map(c=>{const h=c.hover.range?O.lift(c.hover.range):i.range,u=new VT(c.hover,c.provider,s);return new Ho(this,h,c.hover.contents,!1,c.ordinal,u)})}renderHoverParts(e,t){return this._renderedHoverParts=new y3(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))}};Nf=v3([oc(1,br),oc(2,_r),oc(3,on),oc(4,Je),oc(5,En),oc(6,mp),oc(7,Bn)],Nf);class tm{constructor(e,t,i){this.hoverPart=e,this.hoverElement=t,this.disposables=i}dispose(){this.disposables.dispose()}}class y3{constructor(e,t,i,n,s,r,a,c,h,u,g){this._hoverParticipant=i,this._editor=n,this._languageService=s,this._openerService=r,this._commandService=a,this._keybindingService=c,this._hoverService=h,this._configurationService=u,this._onFinishedRendering=g,this._ongoingHoverOperations=new Map,this._disposables=new we,this.renderedHoverParts=this._renderHoverParts(e,t,this._onFinishedRendering),this._disposables.add(nn(()=>{this.renderedHoverParts.forEach(f=>{f.dispose()}),this._ongoingHoverOperations.forEach(f=>{f.tokenSource.dispose(!0)})}))}_renderHoverParts(e,t,i){return e.sort(_p(n=>n.ordinal,wb)),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 we;if(r.add(i),!s)return new tm(e,n,r);const a=s.supportsVerbosityAction(mo.Increase),c=s.supportsVerbosityAction(mo.Decrease);if(!a&&!c)return new tm(e,n,r);const h=Ah("div.verbosity-actions");return n.prepend(h),r.add(this._renderHoverExpansionAction(h,mo.Increase,a)),r.add(this._renderHoverExpansionAction(h,mo.Decrease,c)),new tm(e,n,r)}_renderMarkdownHover(e,t){return UT(this._editor,e,this._languageService,this._openerService,t)}_renderHoverExpansionAction(e,t,i){const n=new we,s=t===mo.Increase,r=Ve(e,Ah(xi.asCSSSelector(s?b3:w3)));r.tabIndex=0;const a=new cA("mouse",!1,{target:e,position:{hoverPosition:0}},this._configurationService,this._hoverService);if(n.add(this._hoverService.setupManagedHover(a,r,C3(this._keybindingService,t))),!i)return r.classList.add("disabled"),n;r.classList.add("enabled");const c=()=>this._commandService.executeCommand(t===mo.Increase?Bb:zb);return n.add(new dA(r,c)),n.add(new hA(r,c,[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 c=new VT(a,r.hoverProvider,r.hoverPosition),h=s.hoverPart,u=new Ho(this._hoverParticipant,h.range,a.contents,h.isBeforeContent,h.ordinal,c),g=this._renderHoverPart(u,this._onFinishedRendering);return this._replaceRenderedHoverPartAtIndex(t,g,u),i&&this._focusOnHoverPartWithIndex(t),{hoverPart:u,hoverElement:g.hoverElement}}async _fetchHover(e,t,i){let n=i===mo.Increase?1:-1;const s=e.hoverProvider,r=this._ongoingHoverOperations.get(s);r&&(r.tokenSource.cancel(),n+=r.verbosityDelta);const a=new Kn;this._ongoingHoverOperations.set(s,{verbosityDelta:n,tokenSource:a});const c={verbosityRequest:{verbosityDelta:n,previousHover:e.hover}};let h;try{h=await Promise.resolve(s.provideHover(t,e.hoverPosition,a.token,c))}catch(u){Cn(u)}return a.dispose(),this._ongoingHoverOperations.delete(s),h}_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 c=new tm(i,s,t.disposables);s.focus(),n.dispose(),this.renderedHoverParts[e]=c}_focusOnHoverPartWithIndex(e){this.renderedHoverParts[e].hoverElement.focus()}_getRenderedHoverPartAtIndex(e){return this.renderedHoverParts[e]}dispose(){this._disposables.dispose()}}function S3(o,e,t,i,n){e.sort(_p(r=>r.ordinal,wb));const s=[];for(const r of e)s.push(UT(t,r,i,n,o.onContentsChanged));return new Ad(s)}function UT(o,e,t,i,n){const s=new we,r=Ah("div.hover-row"),a=Ah("div.hover-row-contents");r.appendChild(a);const c=e.contents;for(const u of c){if(mf(u))continue;const g=Ah("div.markdown-hover"),f=Ve(g,Ah("div.hover-contents")),v=s.add(new Yu({editor:o},t,i));s.add(v.onDidRenderAsync(()=>{f.className="hover-contents code-hover-contents",n()}));const _=s.add(v.render(u));f.appendChild(_.element),a.appendChild(g)}return{hoverPart:e,hoverElement:r,dispose(){s.dispose()}}}function C3(o,e){switch(e){case mo.Increase:{const t=o.lookupKeybinding(Bb);return t?w("increaseVerbosityWithKb","Increase Hover Verbosity ({0})",t.getLabel()):w("increaseVerbosity","Increase Hover Verbosity")}case mo.Decrease:{const t=o.lookupKeybinding(zb);return t?w("decreaseVerbosityWithKb","Decrease Hover Verbosity ({0})",t.getLabel()):w("decreaseVerbosity","Decrease Hover Verbosity")}}}function fS(o,e){return!!o[e]}class Hw{constructor(e,t){this.target=e.target,this.isLeftClick=e.event.leftButton,this.isMiddleClick=e.event.middleButton,this.isRightClick=e.event.rightButton,this.hasTriggerModifier=fS(e.event,t.triggerModifier),this.hasSideBySideModifier=fS(e.event,t.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=e.event.detail<=1}}class bI{constructor(e,t){this.keyCodeIsTriggerKey=e.keyCode===t.triggerKey,this.keyCodeIsSideBySideKey=e.keyCode===t.triggerSideBySideKey,this.hasTriggerModifier=fS(e,t.triggerModifier)}}class im{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 wI(o){return o==="altKey"?Qr?new im(57,"metaKey",6,"altKey"):new im(5,"ctrlKey",6,"altKey"):Qr?new im(6,"altKey",57,"metaKey"):new im(6,"altKey",5,"ctrlKey")}class Ub extends Se{constructor(e,t){super(),this._onMouseMoveOrRelevantKeyDown=this._register(new jt),this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event,this._onExecute=this._register(new jt),this.onExecute=this._onExecute.event,this._onCancel=this._register(new jt),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=wI(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=wI(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 Hw(i,this._opts)))),this._register(this._editor.onMouseDown(i=>this._onEditorMouseDown(new Hw(i,this._opts)))),this._register(this._editor.onMouseUp(i=>this._onEditorMouseUp(new Hw(i,this._opts)))),this._register(this._editor.onKeyDown(i=>this._onEditorKeyDown(new bI(i,this._opts)))),this._register(this._editor.onKeyUp(i=>this._onEditorKeyUp(new bI(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 jT{constructor(e,t){this.range=e,this.direction=t}}class F1{constructor(e,t,i){this.hint=e,this.anchor=t,this.provider=i,this._isResolved=!1}with(e){const t=new F1(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){Cn(t),this._isResolved=!1}}}const Uh=class Uh{static async create(e,t,i,n){const s=[],r=e.ordered(t).reverse().map(a=>i.map(async c=>{try{const h=await a.provideInlayHints(t,c,n);(h!=null&&h.hints.length||a.onDidChangeInlayHints)&&s.push([h??Uh._emptyInlayHintList,a])}catch(h){Cn(h)}}));if(await Promise.all(r.flat()),n.isCancellationRequested||t.isDisposed())throw new fb;return new Uh(i,s,t)}constructor(e,t,i){this._disposables=new we,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 c=i.validatePosition(a.position);let h="before";const u=Uh._getRangeAtPosition(i,c);let g;u.getStartPosition().isBefore(c)?(g=O.fromPositions(u.getStartPosition(),c),h="after"):(g=O.fromPositions(c,u.getEndPosition()),h="before"),n.push(new F1(a,new jT(g,h),r))}}this.items=n.sort((s,r)=>Qe.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 O(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 c=s.getStartOffset(a),h=s.getEndOffset(a);return h-c===1&&(c===r&&a>1?(c=s.getStartOffset(a-1),h=s.getEndOffset(a-1)):h===r&&a<s.getCount()-1&&(c=s.getStartOffset(a+1),h=s.getEndOffset(a+1))),new O(i,c+1,i,h+1)}};Uh._emptyInlayHintList=Object.freeze({dispose(){},hints:[]});let w_=Uh;function x3(o){return Ri.from({scheme:Ds.command,path:o.id,query:o.arguments&&encodeURIComponent(JSON.stringify(o.arguments))}).toString()}var L3=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},ga=function(o,e){return function(t,i){e(t,i,o)}};let $o=class extends uA{constructor(e,t,i,n,s,r,a,c,h,u,g,f,v){super(e,{...n.getRawOptions(),overflowWidgetsDomNode:n.getOverflowWidgetsDomNode()},i,s,r,a,c,h,u,g,f,v),this._parentEditor=n,this._overwriteOptions=t,super.updateOptions(this._overwriteOptions),this._register(n.onDidChangeConfiguration(_=>this._onParentConfigurationChanged(_)))}getParentEditor(){return this._parentEditor}_onParentConfigurationChanged(e){super.updateOptions(this._parentEditor.getRawOptions()),super.updateOptions(this._overwriteOptions)}updateOptions(e){Zx(this._overwriteOptions,e,!0),super.updateOptions(this._overwriteOptions)}};$o=L3([ga(4,Bt),ga(5,xn),ga(6,Bn),ga(7,wi),ga(8,qo),ga(9,Ss),ga(10,bb),ga(11,zn),ga(12,Je)],$o);const yI=new ii(new Su(0,122,204)),I3={showArrow:!0,showFrame:!0,className:"",frameColor:yI,arrowColor:yI,keepEditorSelection:!1},k3="vs.editor.contrib.zoneWidget";class D3{constructor(e,t,i,n,s,r,a,c){this.id="",this.domNode=e,this.afterLineNumber=t,this.afterColumn=i,this.heightInLines=n,this.showInHiddenAreas=a,this.ordinal=c,this._onDomNodeTop=s,this._onComputedHeight=r}onDomNodeTop(e){this._onDomNodeTop(e)}onComputedHeight(e){this._onComputedHeight(e)}}class E3{constructor(e,t){this._id=e,this._domNode=t}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}}const Iv=class Iv{constructor(e){this._editor=e,this._ruleName=Iv._IdGenerator.nextId(),this._decorations=this._editor.createDecorationsCollection(),this._color=null,this._height=-1}dispose(){this.hide(),uL(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(){uL(this._ruleName),pA(`.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:O.fromPositions(e),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}};Iv._IdGenerator=new fA(".arrow-decoration-");let pS=Iv;class P3{constructor(e,t={}){this._arrow=null,this._overlayWidget=null,this._resizeSash=null,this._viewZone=null,this._disposables=new we,this.container=null,this._isShowing=!1,this.editor=e,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=gA(t),Zx(this.options,I3,!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 pS(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=O.isIRange(e)?O.lift(e):O.fromPositions(e);this._isShowing=!0,this._showImpl(i,t),this._isShowing=!1,this._positionMarkerId.set([{range:i,options:oi.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 f=Math.max(12,this.editor.getLayoutInfo().height/a*.8);t=Math.min(t,f)}let c=0,h=0;if(this._arrow&&this.options.showArrow&&(c=Math.round(a/3),this._arrow.height=c,this._arrow.show(i)),this.options.showFrame&&(h=Math.round(a/9)),this.editor.changeViewZones(f=>{this._viewZone&&f.removeZone(this._viewZone.id),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this.domNode.style.top="-1000px",this._viewZone=new D3(r,i.lineNumber,i.column,t,v=>this._onViewZoneTop(v),v=>this._onViewZoneHeight(v),this.options.showInHiddenAreas,this.options.ordinal),this._viewZone.id=f.addZone(this._viewZone),this._overlayWidget=new E3(k3+this._viewZone.id,this.domNode),this.editor.addOverlayWidget(this._overlayWidget)}),this.container&&this.options.showFrame){const f=this.options.frameWidth?this.options.frameWidth:h;this.container.style.borderTopWidth=f+"px",this.container.style.borderBottomWidth=f+"px"}const u=t*a-this._decoratingElementsHeight();this.container&&(this.container.style.top=c+"px",this.container.style.height=u+"px",this.container.style.overflow="hidden"),this._doLayout(u,s),this.options.keepEditorSelection||this.editor.setSelection(e);const g=this.editor.getModel();if(g){const f=g.validateRange(new O(e.startLineNumber,1,e.endLineNumber+1,1));this.revealRange(f,f.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 Eh(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 $T=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},qT=function(o,e){return function(t,i){e(t,i,o)}};const KT=qa("IPeekViewService");Ka(KT,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 Ts;(function(o){o.inPeekEditor=new di("inReferenceSearchEditor",!0,w("inReferenceSearchEditor","Whether the current code editor is embedded inside peek")),o.notInPeekEditor=o.inPeekEditor.toNegated()})(Ts||(Ts={}));var lu;let y_=(lu=class{constructor(e,t){e instanceof $o&&Ts.inPeekEditor.bindTo(t)}dispose(){}},lu.ID="editor.contrib.referenceController",lu);y_=$T([qT(1,wi)],y_);Zt(y_.ID,y_,0);function T3(o){const e=o.get(xn).getFocusedCodeEditor();return e instanceof $o?e.getParentEditor():e}const M3={headerBackgroundColor:ii.white,primaryHeadingColor:ii.fromHex("#333333"),secondaryHeadingColor:ii.fromHex("#6c6c6cb3")};let S_=class extends P3{constructor(e,t,i){super(e,t),this.instantiationService=i,this._onDidClose=new jt,this.onDidClose=this._onDidClose.event,Zx(this.options,M3,!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=qe(".head"),this._bodyElement=qe(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),e.appendChild(this._headElement),e.appendChild(this._bodyElement)}_fillHead(e,t){this._titleElement=qe(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),Fa(this._titleElement,"click",s=>this._onTitleClick(s))),Ve(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=qe("span.filename"),this._secondaryHeading=qe("span.dirname"),this._metaHeading=qe("span.meta"),Ve(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);const i=qe(".peekview-actions");Ve(this._headElement,i);const n=this._getActionBarOptions();this._actionbarWidget=new uf(i,n),this._disposables.add(this._actionbarWidget),t||this._actionbarWidget.push(new Cu("peekview.close",w("label.close","Close"),xi.asClassName(xt.close),!0,()=>(this.dispose(),Promise.resolve())),{label:!1,icon:!0})}_fillTitleIcon(e){}_getActionBarOptions(){return{actionViewItemProvider:mA.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:Gr(this._secondaryHeading))}setMetaTitle(e){this._metaHeading&&(e?(this._metaHeading.innerText=e,Fo(this._metaHeading)):Js(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`)}};S_=$T([qT(2,Bt)],S_);const N3=Ke("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:ii.black,hcLight:ii.white},w("peekViewTitleBackground","Background color of the peek view title area.")),GT=Ke("peekViewTitleLabel.foreground",{dark:ii.white,light:ii.black,hcDark:ii.white,hcLight:vp},w("peekViewTitleForeground","Color of the peek view title.")),ZT=Ke("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},w("peekViewTitleInfoForeground","Color of the peek view title info.")),R3=Ke("peekView.border",{dark:my,light:my,hcDark:Oa,hcLight:Oa},w("peekViewBorder","Color of the peek view borders and arrow.")),A3=Ke("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:ii.black,hcLight:ii.white},w("peekViewResultsBackground","Background color of the peek view result list."));Ke("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:ii.white,hcLight:vp},w("peekViewResultsMatchForeground","Foreground color for line nodes in the peek view result list."));Ke("peekViewResult.fileForeground",{dark:ii.white,light:"#1E1E1E",hcDark:ii.white,hcLight:vp},w("peekViewResultsFileForeground","Foreground color for file nodes in the peek view result list."));Ke("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},w("peekViewResultsSelectionBackground","Background color of the selected entry in the peek view result list."));Ke("peekViewResult.selectionForeground",{dark:ii.white,light:"#6C6C6C",hcDark:ii.white,hcLight:vp},w("peekViewResultsSelectionForeground","Foreground color of the selected entry in the peek view result list."));const XT=Ke("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:ii.black,hcLight:ii.white},w("peekViewEditorBackground","Background color of the peek view editor."));Ke("peekViewEditorGutter.background",XT,w("peekViewEditorGutterBackground","Background color of the gutter in the peek view editor."));Ke("peekViewEditorStickyScroll.background",XT,w("peekViewEditorStickScrollBackground","Background color of sticky scroll in the peek view editor."));Ke("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},w("peekViewResultsMatchHighlight","Match highlight color in the peek view result list."));Ke("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},w("peekViewEditorMatchHighlight","Match highlight color in the peek view editor."));Ke("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:xd,hcLight:xd},w("peekViewEditorMatchHighlightBorder","Match highlight border in the peek view editor."));class Gl{constructor(e,t,i,n){this.isProviderFirst=e,this.parent=t,this.link=i,this._rangeCallback=n,this.id=_A.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?w({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,Jr(this.uri),this.range.startLineNumber,this.range.startColumn):w("aria.oneReference","in {0} on line {1} at column {2}",Jr(this.uri),this.range.startLineNumber,this.range.startColumn)}}class O3{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,c=i.getWordUntilPosition({lineNumber:n,column:s-t}),h=new O(n,c.startColumn,n,s),u=new O(r,a,r,1073741824),g=i.getValueInRange(h).replace(/^\s+/,""),f=i.getValueInRange(e),v=i.getValueInRange(u).replace(/\s+$/,"");return{value:g+f+v,highlight:{start:g.length,end:g.length+f.length}}}}class Rf{constructor(e,t){this.parent=e,this.uri=t,this.children=[],this._previews=new Ul}dispose(){fs(this._previews.values()),this._previews.clear()}getPreview(e){return this._previews.get(e.uri)}get ariaMessage(){const e=this.children.length;return e===1?w("aria.fileReferences.1","1 symbol in {0}, full path {1}",Jr(this.uri),this.uri.fsPath):w("aria.fileReferences.N","{0} symbols in {1}, full path {2}",e,Jr(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 O3(i))}catch(i){Vi(i)}return this}}class js{constructor(e,t){this.groups=[],this.references=[],this._onDidChangeReferenceRange=new jt,this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event,this._links=e,this._title=t;const[i]=e;e.sort(js._compareReferences);let n;for(const s of e)if((!n||!gL.isEqual(n.uri,s.uri,!0))&&(n=new Rf(this,s.uri),this.groups.push(n)),n.children.length===0||js._compareReferences(s,n.children[n.children.length-1])!==0){const r=new Gl(i===s,n,s,a=>this._onDidChangeReferenceRange.fire(a));this.references.push(r),n.children.push(r)}}dispose(){fs(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new js(this._links,this._title)}get title(){return this._title}get isEmpty(){return this.groups.length===0}get ariaMessage(){return this.isEmpty?w("aria.result.0","No results found"):this.references.length===1?w("aria.result.1","Found 1 symbol in {0}",this.references[0].uri.fsPath):this.groups.length===1?w("aria.result.n1","Found {0} symbols in {1}",this.references.length,this.groups[0].uri.fsPath):w("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:bp(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()&&O.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 gL.compare(e.uri,t.uri)||O.compareRangesUsingStarts(e.range,t.range)}}var jb=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},$b=function(o,e){return function(t,i){e(t,i,o)}},mS;let _S=class{constructor(e){this._resolverService=e}hasChildren(e){return e instanceof js||e instanceof Rf}getChildren(e){if(e instanceof js)return e.groups;if(e instanceof Rf)return e.resolve(this._resolverService).then(t=>t.children);throw new Error("bad tree")}};_S=jb([$b(0,wr)],_S);class F3{getHeight(){return 23}getTemplateId(e){return e instanceof Rf?C_.id:x_.id}}let vS=class{constructor(e){this._keybindingService=e}getKeyboardNavigationLabel(e){var t;if(e instanceof Gl){const i=(t=e.parent.getPreview(e))==null?void 0:t.preview(e.range);if(i)return i.value}return Jr(e.uri)}};vS=jb([$b(0,En)],vS);class H3{getId(e){return e instanceof Gl?e.id:e.uri}}let bS=class extends Se{constructor(e,t){super(),this._labelService=t;const i=document.createElement("div");i.classList.add("reference-file"),this.file=this._register(new kD(i,{supportHighlights:!0})),this.badge=new vA(Ve(i,qe(".count")),{},bA),e.appendChild(i)}set(e,t){const i=Xx(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(w("referencesCount","{0} references",n)):this.badge.setTitleFormat(w("referenceCount","{0} reference",n))}};bS=jb([$b(1,_f)],bS);var zc;let C_=(zc=class{constructor(e){this._instantiationService=e,this.templateId=mS.id}renderTemplate(e){return this._instantiationService.createInstance(bS,e)}renderElement(e,t,i){i.set(e.element,yb(e.filterData))}disposeTemplate(e){e.dispose()}},mS=zc,zc.id="FileReferencesRenderer",zc);C_=mS=jb([$b(0,Bt)],C_);class W3 extends Se{constructor(e){super(),this.label=this._register(new wA(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(`${Jr(e.uri)}:${e.range.startLineNumber+1}:${e.range.startColumn+1}`);else{const{value:s,highlight:r}=i;t&&!vf.isDefault(t)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(s,yb(t))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(s,[r]))}}}const kv=class kv{constructor(){this.templateId=kv.id}renderTemplate(e){return new W3(e)}renderElement(e,t,i){i.set(e.element,e.filterData)}disposeTemplate(e){e.dispose()}};kv.id="OneReferenceRenderer";let x_=kv;class B3{getWidgetAriaLabel(){return w("treeAriaLabel","References")}getAriaLabel(e){return e.ariaMessage}}var z3=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},dh=function(o,e){return function(t,i){e(t,i,o)}};const Dv=class Dv{constructor(e,t){this._editor=e,this._model=t,this._decorations=new Map,this._decorationIgnoreSet=new Set,this._callOnDispose=new we,this._callOnModelChange=new we,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:Dv.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(!O.equalsRange(s,n.range)){if(O.spansMultipleLines(s))r=!0;else{const a=n.range.endColumn-n.range.startColumn,c=s.endColumn-s.startColumn;a!==c&&(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()}};Dv.DecorationOptions=oi.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"});let wS=Dv;class V3{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 U3 extends CA{}let yS=class extends S_{constructor(e,t,i,n,s,r,a,c,h){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=c,this._keybindingService=h,this._disposeOnNewModel=new we,this._callOnDispose=new we,this._onDidSelectReference=new jt,this.onDidSelectReference=this._onDidSelectReference.event,this._dim=new $i(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(),fs(this._preview),fs(this._previewNotAvailableMessage),fs(this._tree),fs(this._previewModelReference),this._splitView.dispose(),super.dispose()}_applyTheme(e){const t=e.getColor(R3)||ii.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(N3)||ii.transparent,primaryHeadingColor:e.getColor(GT),secondaryHeadingColor:e.getColor(ZT)})}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=Ve(e,qe("div.messages")),Js(this._messageContainer),this._splitView=new yA(e,{orientation:1}),this._previewContainer=Ve(e,qe("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($o,this._previewContainer,t,{},this.editor),Js(this._previewContainer),this._previewNotAvailableMessage=this._instantiationService.createInstance(fl,w("missingPreviewMessage","no preview available"),bf,fl.DEFAULT_CREATION_OPTIONS,null),this._treeContainer=Ve(e,qe("div.ref-tree.inline"));const i={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new B3,keyboardNavigationLabelProvider:this._instantiationService.createInstance(vS),identityProvider:new H3,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:A3}};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(Fa(this._treeContainer,"keydown",s=>{s.equals(9)&&(this._keybindingService.dispatchEvent(s,s.target),s.stopPropagation())},!0)),this._tree=this._instantiationService.createInstance(U3,"ReferencesWidget",this._treeContainer,new F3,[this._instantiationService.createInstance(C_),this._instantiationService.createInstance(x_)],this._instantiationService.createInstance(_S),i),this._splitView.addView({onDidChange:Nn.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:s=>{this._preview.layout({height:this._dim.height,width:s})}},fL.Distribute),this._splitView.addView({onDidChange:Nn.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)}},fL.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 Gl&&(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")})),Js(this._treeContainer)}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._dim=new $i(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=w("noResults","No results"),Fo(this._messageContainer),Promise.resolve(void 0)):(Js(this._messageContainer),this._decorationsManager=new wS(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"),Fo(this._treeContainer),Fo(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 Gl)return e;if(e instanceof Rf&&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!==Ds.inMemory?this.setTitle(SA(e.uri),this._uriLabel.getUriLabel(Xx(e.uri))):this.setTitle(w("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}fs(this._previewModelReference);const s=n.object;if(s){const r=this._preview.getModel()===s.textEditorModel?0:1,a=O.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()}};yS=z3([dh(3,qo),dh(4,wr),dh(5,Bt),dh(6,KT),dh(7,_f),dh(8,En)],yS);var j3=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},hh=function(o,e){return function(t,i){e(t,i,o)}},Bm;const Xd=new di("referenceSearchVisible",!1,w("referenceSearchVisible","Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));var Vc;let Od=(Vc=class{static get(e){return e.getContribution(Bm.ID)}constructor(e,t,i,n,s,r,a,c){this._defaultTreeKeyboardSupport=e,this._editor=t,this._editorService=n,this._notificationService=s,this._instantiationService=r,this._storageService=a,this._configurationService=c,this._disposables=new we,this._requestIdPool=0,this._ignoreModelChangeEvent=!1,this._referenceSearchVisible=Xd.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=V3.fromJSON(this._storageService.get(s,0,"{}"));this._widget=this._instantiationService.createInstance(yS,this._editor,this._defaultTreeKeyboardSupport,r),this._widget.setTitle(w("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(c=>{const{element:h,kind:u}=c;if(h)switch(u){case"open":(c.source!=="editor"||!this._configurationService.getValue("editor.stablePeek"))&&this.openReference(h,!1,!1);break;case"side":this.openReference(h,!0,!1);break;case"goto":i?this._gotoReference(h,!0):this.openReference(h,!1,!0);break}}));const a=++this._requestIdPool;t.then(c=>{var h;if(a!==this._requestIdPool||!this._widget){c.dispose();return}return(h=this._model)==null||h.dispose(),this._model=c,this._widget.setModel(this._model).then(()=>{if(this._widget&&this._model&&this._editor.hasModel()){this._model.isEmpty?this._widget.setMetaTitle(""):this._widget.setMetaTitle(w("metaTitle.N","{0} ({1})",this._model.title,this._model.references.length));const u=this._editor.getModel().uri,g=new Qe(e.startLineNumber,e.startColumn),f=this._model.nearestReference(u,g);if(f)return this._widget.setSelection(f).then(()=>{this._widget&&this._editor.getOption(87)==="editor"&&this._widget.focusOnPreviewEditor()})}})},c=>{this._notificationService.error(c)})}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=O.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=Bm.get(s),a=this._model.clone();this.closeWidget(),s.focus(),r==null||r.toggleWidget(i,qn(c=>Promise.resolve(a)),this._peekMode??!1)}},s=>{this._ignoreModelChangeEvent=!1,Vi(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)}},Bm=Vc,Vc.ID="editor.contrib.referencesController",Vc);Od=Bm=j3([hh(2,wi),hh(3,xn),hh(4,Ss),hh(5,Bt),hh(6,Jl),hh(7,on)],Od);function Yd(o,e){const t=T3(o);if(!t)return;const i=Od.get(t);i&&e(i)}ia.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:Dn(2089,60),when:ie.or(Xd,Ts.inPeekEditor),handler(o){Yd(o,e=>{e.changeFocusBetweenPreviewAndReferences()})}});ia.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:ie.or(Xd,Ts.inPeekEditor),handler(o){Yd(o,e=>{e.goToNextOrPreviousReference(!0)})}});ia.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:ie.or(Xd,Ts.inPeekEditor),handler(o){Yd(o,e=>{e.goToNextOrPreviousReference(!1)})}});Gi.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference");Gi.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference");Gi.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch");Gi.registerCommand("closeReferenceSearch",o=>Yd(o,e=>e.closeWidget()));ia.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:ie.and(Ts.inPeekEditor,ie.not("config.editor.stablePeek"))});ia.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:ie.and(Xd,ie.not("config.editor.stablePeek"),ie.or(T.editorTextFocus,xA.negate()))});ia.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:ie.and(Xd,DD,ED.negate(),PD.negate()),handler(o){var i;const t=(i=o.get(Yx).lastFocusedList)==null?void 0:i.getFocus();Array.isArray(t)&&t[0]instanceof Gl&&Yd(o,n=>n.revealReference(t[0]))}});ia.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:ie.and(Xd,DD,ED.negate(),PD.negate()),handler(o){var i;const t=(i=o.get(Yx).lastFocusedList)==null?void 0:i.getFocus();Array.isArray(t)&&t[0]instanceof Gl&&Yd(o,n=>n.openReference(t[0],!0,!0))}});Gi.registerCommand("openReference",o=>{var i;const t=(i=o.get(Yx).lastFocusedList)==null?void 0:i.getFocus();Array.isArray(t)&&t[0]instanceof Gl&&Yd(o,n=>n.openReference(t[0],!1,!0))});var YT=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},Mg=function(o,e){return function(t,i){e(t,i,o)}};const H1=new di("hasSymbols",!1,w("hasSymbols","Whether there are symbol locations that can be navigated via keyboard-only.")),qb=qa("ISymbolNavigationService");let SS=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=H1.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 CS(this._editorService),n=i.onDidChange(s=>{if(this._ignoreEditorChange)return;const r=this._editorService.getActiveCodeEditor();if(!r)return;const a=r.getModel(),c=r.getPosition();if(!a||!c)return;let h=!1,u=!1;for(const g of t.references)if(Ym(g.uri,a.uri))h=!0,u=u||O.containsPosition(g.range,c);else if(h)break;(!h||!u)&&this.reset()});this._currentState=TD(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:O.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?w("location.kb","Symbol {0} of {1}, {2} for next",this._currentIdx+1,this._currentModel.references.length,e.getLabel()):w("location","Symbol {0} of {1}",this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(t)}};SS=YT([Mg(0,wi),Mg(1,xn),Mg(2,Ss),Mg(3,En)],SS);Ka(qb,SS,1);it(new class extends Rs{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:H1,kbOpts:{weight:100,primary:70}})}runEditorCommand(o,e){return o.get(qb).revealNext(e)}});ia.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:H1,primary:9,handler(o){o.get(qb).reset()}});let CS=class{constructor(e){this._listener=new Map,this._disposables=new we,this._onDidChange=new jt,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(),fs(this._listener.values())}_onDidAddEditor(e){this._listener.set(e,TD(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)}};CS=YT([Mg(0,xn)],CS);function xS(o,e){return e.uri.scheme===o.uri.scheme?!0:!LA(e.uri,Ds.walkThroughSnippet,Ds.vscodeChatCodeBlock,Ds.vscodeChatCodeCompareBlock)}async function Ep(o,e,t,i,n){const r=t.ordered(o,i).map(c=>Promise.resolve(n(c,o,e)).then(void 0,h=>{Cn(h)})),a=await Promise.all(r);return Aa(a.flat()).filter(c=>xS(o,c))}function Pp(o,e,t,i,n){return Ep(e,t,o,i,(s,r,a)=>s.provideDefinition(r,a,n))}function W1(o,e,t,i,n){return Ep(e,t,o,i,(s,r,a)=>s.provideDeclaration(r,a,n))}function B1(o,e,t,i,n){return Ep(e,t,o,i,(s,r,a)=>s.provideImplementation(r,a,n))}function z1(o,e,t,i,n){return Ep(e,t,o,i,(s,r,a)=>s.provideTypeDefinition(r,a,n))}function Tp(o,e,t,i,n,s){return Ep(e,t,o,n,async(r,a,c)=>{var g,f;const h=(g=await r.provideReferences(a,c,{includeDeclaration:!0},s))==null?void 0:g.filter(v=>xS(a,v));if(!i||!h||h.length!==2)return h;const u=(f=await r.provideReferences(a,c,{includeDeclaration:!1},s))==null?void 0:f.filter(v=>xS(a,v));return u&&u.length===1?u:h})}async function sa(o){const e=await o(),t=new js(e,""),i=t.references.map(n=>n.link);return t.dispose(),i}As("_executeDefinitionProvider",(o,e,t)=>{const i=o.get(Je),n=Pp(i.definitionProvider,e,t,!1,$t.None);return sa(()=>n)});As("_executeDefinitionProvider_recursive",(o,e,t)=>{const i=o.get(Je),n=Pp(i.definitionProvider,e,t,!0,$t.None);return sa(()=>n)});As("_executeTypeDefinitionProvider",(o,e,t)=>{const i=o.get(Je),n=z1(i.typeDefinitionProvider,e,t,!1,$t.None);return sa(()=>n)});As("_executeTypeDefinitionProvider_recursive",(o,e,t)=>{const i=o.get(Je),n=z1(i.typeDefinitionProvider,e,t,!0,$t.None);return sa(()=>n)});As("_executeDeclarationProvider",(o,e,t)=>{const i=o.get(Je),n=W1(i.declarationProvider,e,t,!1,$t.None);return sa(()=>n)});As("_executeDeclarationProvider_recursive",(o,e,t)=>{const i=o.get(Je),n=W1(i.declarationProvider,e,t,!0,$t.None);return sa(()=>n)});As("_executeReferenceProvider",(o,e,t)=>{const i=o.get(Je),n=Tp(i.referenceProvider,e,t,!1,!1,$t.None);return sa(()=>n)});As("_executeReferenceProvider_recursive",(o,e,t)=>{const i=o.get(Je),n=Tp(i.referenceProvider,e,t,!1,!0,$t.None);return sa(()=>n)});As("_executeImplementationProvider",(o,e,t)=>{const i=o.get(Je),n=B1(i.implementationProvider,e,t,!1,$t.None);return sa(()=>n)});As("_executeImplementationProvider_recursive",(o,e,t)=>{const i=o.get(Je),n=B1(i.implementationProvider,e,t,!0,$t.None);return sa(()=>n)});Vo.appendMenuItem(We.EditorContext,{submenu:We.EditorContextPeek,title:w("peek.submenu","Peek"),group:"navigation",order:100});class Ou{static is(e){return!e||typeof e!="object"?!1:!!(e instanceof Ou||Qe.isIPosition(e.position)&&e.model)}constructor(e,t){this.model=e,this.position=t}}const ko=class ko extends pr{static all(){return ko._allSymbolNavigationCommands.values()}static _patchConfig(e){const t={...e,f1:!0};if(t.menu)for(const i of Da.wrap(t.menu))(i.id===We.EditorContext||i.id===We.EditorContextPeek)&&(i.when=ie.and(e.precondition,i.when));return t}constructor(e,t){super(ko._patchConfig(t)),this.configuration=e,ko._allSymbolNavigationCommands.set(t.id,this)}runEditorCommand(e,t,i,n){if(!t.hasModel())return Promise.resolve(void 0);const s=e.get(Ss),r=e.get(xn),a=e.get(dp),c=e.get(qb),h=e.get(Je),u=e.get(Bt),g=t.getModel(),f=t.getPosition(),v=Ou.is(i)?i:new Ou(g,f),_=new vu(t,5),y=lp(this._getLocationModel(h,v.model,v.position,_.token),_.token).then(async S=>{var M;if(!S||_.token.isCancellationRequested)return;Uo(S.ariaMessage);let x;if(S.referenceAt(g.uri,f)){const F=this._getAlternativeCommand(t);!ko._activeAlternativeCommands.has(F)&&ko._allSymbolNavigationCommands.has(F)&&(x=ko._allSymbolNavigationCommands.get(F))}const E=S.references.length;if(E===0){if(!this.configuration.muteMessage){const F=g.getWordAtPosition(f);(M=Us.get(t))==null||M.showMessage(this._getNoResultFoundMessage(F),f)}}else if(E===1&&x)ko._activeAlternativeCommands.add(this.desc.id),u.invokeFunction(F=>x.runEditorCommand(F,t,i,n).finally(()=>{ko._activeAlternativeCommands.delete(this.desc.id)}));else return this._onResult(r,c,t,S,n)},S=>{s.error(S)}).finally(()=>{_.dispose()});return a.showWhile(y,250),y}async _onResult(e,t,i,n,s){const r=this._getGoToPreference(i);if(!(i instanceof $o)&&(this.configuration.openInPeek||r==="peek"&&n.references.length>1))this._openInPeek(i,n,s);else{const a=n.firstReference(),c=n.references.length>1&&r==="gotoAndPeek",h=await this._openReference(i,e,a,this.configuration.openToSide,!c);c&&h?this._openInPeek(h,n,s):n.dispose(),r==="goto"&&t.put(a)}}async _openReference(e,t,i,n,s){let r;if(IA(i)&&(r=i.targetSelectionRange),r||(r=i.range),!r)return;const a=await t.openCodeEditor({resource:i.uri,options:{selection:O.collapseToStart(r),selectionRevealType:3,selectionSource:"code.jump"}},e,n);if(a){if(s){const c=a.getModel(),h=a.createDecorationsCollection([{range:r,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout(()=>{a.getModel()===c&&h.clear()},350)}return a}}_openInPeek(e,t,i){const n=Od.get(e);n&&e.hasModel()?n.toggleWidget(i??e.getSelection(),qn(s=>Promise.resolve(t)),this.configuration.openInPeek):t.dispose()}};ko._allSymbolNavigationCommands=new Map,ko._activeAlternativeCommands=new Set;let Va=ko;class Mp extends Va{async _getLocationModel(e,t,i,n){return new js(await Pp(e.definitionProvider,t,i,!1,n),w("def.title","Definitions"))}_getNoResultFoundMessage(e){return e&&e.word?w("noResultWord","No definition found for '{0}'",e.word):w("generic.noResults","No definition found")}_getAlternativeCommand(e){return e.getOption(58).alternativeDefinitionCommand}_getGoToPreference(e){return e.getOption(58).multipleDefinitions}}var Ml;Ti((Ml=class extends Mp{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Ml.id,title:{...Xe("actions.goToDecl.label","Go to Definition"),mnemonicTitle:w({key:"miGotoDefinition",comment:["&& denotes a mnemonic"]},"Go to &&Definition")},precondition:T.hasDefinitionProvider,keybinding:[{when:T.editorTextFocus,primary:70,weight:100},{when:ie.and(T.editorTextFocus,MD),primary:2118,weight:100}],menu:[{id:We.EditorContext,group:"navigation",order:1.1},{id:We.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),Gi.registerCommandAlias("editor.action.goToDeclaration",Ml.id)}},Ml.id="editor.action.revealDefinition",Ml));var Nl;Ti((Nl=class extends Mp{constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:Nl.id,title:Xe("actions.goToDeclToSide.label","Open Definition to the Side"),precondition:ie.and(T.hasDefinitionProvider,T.isInEmbeddedEditor.toNegated()),keybinding:[{when:T.editorTextFocus,primary:Dn(2089,70),weight:100},{when:ie.and(T.editorTextFocus,MD),primary:Dn(2089,2118),weight:100}]}),Gi.registerCommandAlias("editor.action.openDeclarationToTheSide",Nl.id)}},Nl.id="editor.action.revealDefinitionAside",Nl));var Rl;Ti((Rl=class extends Mp{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Rl.id,title:Xe("actions.previewDecl.label","Peek Definition"),precondition:ie.and(T.hasDefinitionProvider,Ts.notInPeekEditor,T.isInEmbeddedEditor.toNegated()),keybinding:{when:T.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:We.EditorContextPeek,group:"peek",order:2}}),Gi.registerCommandAlias("editor.action.previewDeclaration",Rl.id)}},Rl.id="editor.action.peekDefinition",Rl));class QT extends Va{async _getLocationModel(e,t,i,n){return new js(await W1(e.declarationProvider,t,i,!1,n),w("decl.title","Declarations"))}_getNoResultFoundMessage(e){return e&&e.word?w("decl.noResultWord","No declaration found for '{0}'",e.word):w("decl.generic.noResults","No declaration found")}_getAlternativeCommand(e){return e.getOption(58).alternativeDeclarationCommand}_getGoToPreference(e){return e.getOption(58).multipleDeclarations}}var Uc;Ti((Uc=class extends QT{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Uc.id,title:{...Xe("actions.goToDeclaration.label","Go to Declaration"),mnemonicTitle:w({key:"miGotoDeclaration",comment:["&& denotes a mnemonic"]},"Go to &&Declaration")},precondition:ie.and(T.hasDeclarationProvider,T.isInEmbeddedEditor.toNegated()),menu:[{id:We.EditorContext,group:"navigation",order:1.3},{id:We.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}_getNoResultFoundMessage(e){return e&&e.word?w("decl.noResultWord","No declaration found for '{0}'",e.word):w("decl.generic.noResults","No declaration found")}},Uc.id="editor.action.revealDeclaration",Uc));Ti(class extends QT{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:Xe("actions.peekDecl.label","Peek Declaration"),precondition:ie.and(T.hasDeclarationProvider,Ts.notInPeekEditor,T.isInEmbeddedEditor.toNegated()),menu:{id:We.EditorContextPeek,group:"peek",order:3}})}});class JT extends Va{async _getLocationModel(e,t,i,n){return new js(await z1(e.typeDefinitionProvider,t,i,!1,n),w("typedef.title","Type Definitions"))}_getNoResultFoundMessage(e){return e&&e.word?w("goToTypeDefinition.noResultWord","No type definition found for '{0}'",e.word):w("goToTypeDefinition.generic.noResults","No type definition found")}_getAlternativeCommand(e){return e.getOption(58).alternativeTypeDefinitionCommand}_getGoToPreference(e){return e.getOption(58).multipleTypeDefinitions}}var jc;Ti((jc=class extends JT{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:jc.ID,title:{...Xe("actions.goToTypeDefinition.label","Go to Type Definition"),mnemonicTitle:w({key:"miGotoTypeDefinition",comment:["&& denotes a mnemonic"]},"Go to &&Type Definition")},precondition:T.hasTypeDefinitionProvider,keybinding:{when:T.editorTextFocus,primary:0,weight:100},menu:[{id:We.EditorContext,group:"navigation",order:1.4},{id:We.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}},jc.ID="editor.action.goToTypeDefinition",jc));var $c;Ti(($c=class extends JT{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:$c.ID,title:Xe("actions.peekTypeDefinition.label","Peek Type Definition"),precondition:ie.and(T.hasTypeDefinitionProvider,Ts.notInPeekEditor,T.isInEmbeddedEditor.toNegated()),menu:{id:We.EditorContextPeek,group:"peek",order:4}})}},$c.ID="editor.action.peekTypeDefinition",$c));class eM extends Va{async _getLocationModel(e,t,i,n){return new js(await B1(e.implementationProvider,t,i,!1,n),w("impl.title","Implementations"))}_getNoResultFoundMessage(e){return e&&e.word?w("goToImplementation.noResultWord","No implementation found for '{0}'",e.word):w("goToImplementation.generic.noResults","No implementation found")}_getAlternativeCommand(e){return e.getOption(58).alternativeImplementationCommand}_getGoToPreference(e){return e.getOption(58).multipleImplementations}}var qc;Ti((qc=class extends eM{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:qc.ID,title:{...Xe("actions.goToImplementation.label","Go to Implementations"),mnemonicTitle:w({key:"miGotoImplementation",comment:["&& denotes a mnemonic"]},"Go to &&Implementations")},precondition:T.hasImplementationProvider,keybinding:{when:T.editorTextFocus,primary:2118,weight:100},menu:[{id:We.EditorContext,group:"navigation",order:1.45},{id:We.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}},qc.ID="editor.action.goToImplementation",qc));var Kc;Ti((Kc=class extends eM{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Kc.ID,title:Xe("actions.peekImplementation.label","Peek Implementations"),precondition:ie.and(T.hasImplementationProvider,Ts.notInPeekEditor,T.isInEmbeddedEditor.toNegated()),keybinding:{when:T.editorTextFocus,primary:3142,weight:100},menu:{id:We.EditorContextPeek,group:"peek",order:5}})}},Kc.ID="editor.action.peekImplementation",Kc));class tM extends Va{_getNoResultFoundMessage(e){return e?w("references.no","No references found for '{0}'",e.word):w("references.noGeneric","No references found")}_getAlternativeCommand(e){return e.getOption(58).alternativeReferenceCommand}_getGoToPreference(e){return e.getOption(58).multipleReferences}}Ti(class extends tM{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{...Xe("goToReferences.label","Go to References"),mnemonicTitle:w({key:"miGotoReference",comment:["&& denotes a mnemonic"]},"Go to &&References")},precondition:ie.and(T.hasReferenceProvider,Ts.notInPeekEditor,T.isInEmbeddedEditor.toNegated()),keybinding:{when:T.editorTextFocus,primary:1094,weight:100},menu:[{id:We.EditorContext,group:"navigation",order:1.45},{id:We.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}async _getLocationModel(e,t,i,n){return new js(await Tp(e.referenceProvider,t,i,!0,!1,n),w("ref.title","References"))}});Ti(class extends tM{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:Xe("references.action.label","Peek References"),precondition:ie.and(T.hasReferenceProvider,Ts.notInPeekEditor,T.isInEmbeddedEditor.toNegated()),menu:{id:We.EditorContextPeek,group:"peek",order:6}})}async _getLocationModel(e,t,i,n){return new js(await Tp(e.referenceProvider,t,i,!1,!1,n),w("ref.title","References"))}});class $3 extends Va{constructor(e,t,i){super(e,{id:"editor.action.goToLocation",title:Xe("label.generic","Go to Any Symbol"),precondition:ie.and(Ts.notInPeekEditor,T.isInEmbeddedEditor.toNegated())}),this._references=t,this._gotoMultipleBehaviour=i}async _getLocationModel(e,t,i,n){return new js(this._references,w("generic.title","Locations"))}_getNoResultFoundMessage(e){return e&&w("generic.noResult","No results for '{0}'",e.word)||""}_getGoToPreference(e){return this._gotoMultipleBehaviour??e.getOption(58).multipleReferences}_getAlternativeCommand(){return""}}Gi.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:Ri},{name:"position",description:"The position at which to start",constraint:Qe.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)=>{Si(Ri.isUri(e)),Si(Qe.isIPosition(t)),Si(Array.isArray(i)),Si(typeof n>"u"||typeof n=="string"),Si(typeof r>"u"||typeof r=="boolean");const a=o.get(xn),c=await a.openCodeEditor({resource:e},a.getFocusedCodeEditor());if(ND(c))return c.setPosition(t),c.revealPositionInCenterIfOutsideViewport(t,0),c.invokeWithinContext(h=>{const u=new class extends $3{_getNoResultFoundMessage(g){return s||super._getNoResultFoundMessage(g)}}({muteMessage:!s,openInPeek:!!r,openToSide:!1},i,n);h.get(Bt).invokeFunction(u.run.bind(u),c)})}});Gi.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:Ri},{name:"position",description:"The position at which to start",constraint:Qe.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(Bn).executeCommand("editor.action.goToLocations",e,t,i,n,void 0,!0)}});Gi.registerCommand({id:"editor.action.findReferences",handler:(o,e,t)=>{Si(Ri.isUri(e)),Si(Qe.isIPosition(t));const i=o.get(Je),n=o.get(xn);return n.openCodeEditor({resource:e},n.getFocusedCodeEditor()).then(s=>{if(!ND(s)||!s.hasModel())return;const r=Od.get(s);if(!r)return;const a=qn(h=>Tp(i.referenceProvider,s.getModel(),Qe.lift(t),!1,!1,h).then(u=>new js(u,w("ref.title","References")))),c=new O(t.lineNumber,t.column,t.lineNumber,t.column);return Promise.resolve(r.toggleWidget(c,a,!1))})}});Gi.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");async function q3(o,e,t,i){const n=o.get(wr),s=o.get(Ku),r=o.get(Bn),a=o.get(Bt),c=o.get(Ss);if(await i.item.resolve($t.None),!i.part.location)return;const h=i.part.location,u=[],g=new Set(Vo.getMenuItems(We.EditorContext).map(v=>kA(v)?v.command.id:Hb()));for(const v of Va.all())g.has(v.desc.id)&&u.push(new Cu(v.desc.id,xu.label(v.desc,{renderShortTitle:!0}),void 0,!0,async()=>{const _=await n.createModelReference(h.uri);try{const y=new Ou(_.object.textEditorModel,O.getStartPosition(h.range)),S=i.item.anchor.range;await a.invokeFunction(v.runEditorCommand.bind(v),e,y,S)}finally{_.dispose()}}));if(i.part.command){const{command:v}=i.part;u.push(new pf),u.push(new Cu(v.id,v.title,void 0,!0,async()=>{try{await r.executeCommand(v.id,...v.arguments??[])}catch(_){c.notify({severity:Qx.Error,source:i.item.provider.displayName,message:_})}}))}const f=e.getOption(128);s.showContextMenu({domForShadowRoot:f?e.getDomNode()??void 0:void 0,getAnchor:()=>{const v=Ps(t);return{x:v.left,y:v.top+v.height+8}},getActions:()=>u,onHide:()=>{e.focus()},autoSelectFirstItem:!0})}async function iM(o,e,t,i){const s=await o.get(wr).createModelReference(i.uri);await t.invokeWithinContext(async r=>{const a=e.hasSideBySideModifier,c=r.get(wi),h=Ts.inPeekEditor.getValue(c),u=!a&&t.getOption(89)&&!h;return new Mp({openToSide:a,openInPeek:u,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(r,new Ou(s.object.textEditorModel,O.getStartPosition(i.range)),O.lift(i.range))}),s.dispose()}var K3=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},uh=function(o,e){return function(t,i){e(t,i,o)}},Ih;class L_{constructor(){this._entries=new up(50)}get(e){const t=L_._key(e);return this._entries.get(t)}set(e,t){const i=L_._key(e);this._entries.set(i,t)}static _key(e){return`${e.uri.toString()}/${e.getVersionId()}`}}const nM=qa("IInlayHintsCache");Ka(nM,L_,1);class LS{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 G3{constructor(e,t){this.part=e,this.hasTriggerModifier=t}}var ka;let Af=(ka=class{static get(e){return e.getContribution(Ih.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 we,this._sessionDisposables=new we,this._decorationsMetadata=new Map,this._ruleFactory=new bD(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(c=>{c.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,c;e.enabled==="onUnlessPressed"?(a=0,c=1):(a=1,c=0),this._activeRenderMode=a,this._sessionDisposables.add(DA.getInstance().event(h=>{if(!this._editor.hasModel())return;const u=h.altKey&&h.ctrlKey&&!(h.shiftKey||h.metaKey)?c:a;if(u!==this._activeRenderMode){this._activeRenderMode=u;const g=this._editor.getModel(),f=this._copyInlayHintsWithCurrentAnchor(g);this._updateHintsDecorators([g.getFullModelRange()],f),r.schedule(0)}}))}const i=this._inlayHintsCache.get(t);i&&this._updateHintsDecorators([t.getFullModelRange()],i),this._sessionDisposables.add(nn(()=>{t.isDisposed()||this._cacheHintsForFastRestore(t)}));let n;const s=new Set,r=new Rn(async()=>{const a=Date.now();n==null||n.dispose(!0),n=new Kn;const c=t.onWillDispose(()=>n==null?void 0:n.cancel());try{const h=n.token,u=await w_.create(this._languageFeaturesService.inlayHintsProvider,t,this._getHintsRanges(),h);if(r.delay=this._debounceInfo.update(t,Date.now()-a),h.isCancellationRequested){u.dispose();return}for(const g of u.provider)typeof g.onDidChangeInlayHints=="function"&&!s.has(g)&&(s.add(g),this._sessionDisposables.add(g.onDidChangeInlayHints(()=>{r.isScheduled()||r.schedule()})));this._sessionDisposables.add(u),this._updateHintsDecorators(u.ranges,u.items),this._cacheHintsForFastRestore(t)}catch(h){Vi(h)}finally{n.dispose(),c.dispose()}},this._debounceInfo.get(t));this._sessionDisposables.add(r),this._sessionDisposables.add(nn(()=>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 c=Math.max(r.delay,1250);r.schedule(c)})),this._sessionDisposables.add(this._installDblClickGesture(()=>r.schedule(0))),this._sessionDisposables.add(this._installLinkGesture()),this._sessionDisposables.add(this._installContextMenu())}_installLinkGesture(){const e=new we,t=e.add(new Ub(this._editor)),i=new we;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 c=new Kn;i.add(nn(()=>c.dispose(!0))),r.item.resolve(c.token),this._activeInlayHintPart=r.part.command||r.part.location?new G3(r,s.hasTriggerModifier):void 0;const h=a.validatePosition(r.item.hint.position).lineNumber,u=new O(h,1,h,a.getLineMaxColumn(h)),g=this._getInlineHintsForRange(u);this._updateHintsDecorators([u],g),i.add(nn(()=>{this._activeInlayHintPart=void 0,this._updateHintsDecorators([u],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(iM,n,this._editor,r.location):EA.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($t.None),io(i.item.hint.textEdits))){const n=i.item.hint.textEdits.map(s=>pn.replace(O.lift(s.range),s.text));this._editor.executeEdits("inlayHint.default",n),e()}})}_installContextMenu(){return this._editor.onContextMenu(async e=>{if(!PA(e.event.target))return;const t=this._getInlayHintLabelPart(e);t&&await this._instaService.invokeFunction(q3,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 Jx&&(t==null?void 0:t.attachedData)instanceof LS)return t.attachedData}async _invokeCommand(e,t){try{await this._commandService.executeCommand(e.id,...e.arguments??[])}catch(i){this._notificationService.notify({severity:Qx.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 jT(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(O.compareRangesUsingStarts)){const r=t.validateRange(new O(s.startLineNumber-30,s.startColumn,s.endLineNumber+30,s.endColumn));n.length===0||!O.areIntersectingOrTouching(n[n.length-1],r)?n.push(r):n[n.length-1]=O.plusRange(n[n.length-1],r)}return n}_updateHintsDecorators(e,t){var _,y;const i=[],n=(S,x,E,M,F)=>{const R={content:E,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:x.className,cursorStops:M,attachedData:F};i.push({item:S,classNameRef:x,decoration:{range:S.anchor.range,options:{description:"InlayHint",showIfCollapsed:S.anchor.range.isEmpty(),collapseOnReplaceEdit:!S.anchor.range.isEmpty(),stickiness:0,[S.anchor.direction]:this._activeRenderMode===0?R:void 0}}})},s=(S,x)=>{const E=this._ruleFactory.createClassNameRef({width:`${r/3|0}px`,display:"inline-block"});n(S,E," ",x?Th.Right:Th.None)},{fontSize:r,fontFamily:a,padding:c,isUniform:h}=this._getLayoutInfo(),u="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(u,a);let g={line:0,totalLen:0};for(const S of t){if(g.line!==S.anchor.range.startLineNumber&&(g={line:S.anchor.range.startLineNumber,totalLen:0}),g.totalLen>Ih._MAX_LABEL_LEN)continue;S.hint.paddingLeft&&s(S,!1);const x=typeof S.hint.label=="string"?[{label:S.hint.label}]:S.hint.label;for(let E=0;E<x.length;E++){const M=x[E],F=E===0,R=E===x.length-1,Z={fontSize:`${r}px`,fontFamily:`var(${u}), ${Kx.fontFamily}`,verticalAlign:h?"baseline":"middle",unicodeBidi:"isolate"};io(S.hint.textEdits)&&(Z.cursor="default"),this._fillInColors(Z,S.hint),(M.command||M.location)&&((_=this._activeInlayHintPart)==null?void 0:_.part.item)===S&&this._activeInlayHintPart.part.index===E&&(Z.textDecoration="underline",this._activeInlayHintPart.hasTriggerModifier&&(Z.color=Pn(TA),Z.cursor="pointer")),c&&(F&&R?(Z.padding=`1px ${Math.max(1,r/4)|0}px`,Z.borderRadius=`${r/4|0}px`):F?(Z.padding=`1px 0 1px ${Math.max(1,r/4)|0}px`,Z.borderRadius=`${r/4|0}px 0 0 ${r/4|0}px`):R?(Z.padding=`1px ${Math.max(1,r/4)|0}px 1px 0`,Z.borderRadius=`0 ${r/4|0}px ${r/4|0}px 0`):Z.padding="1px 0 1px 0");let q=M.label;g.totalLen+=q.length;let he=!1;const pe=g.totalLen-Ih._MAX_LABEL_LEN;if(pe>0&&(q=q.slice(0,-pe)+"…",he=!0),n(S,this._ruleFactory.createClassNameRef(Z),Z3(q),R&&!S.hint.paddingRight?Th.Right:Th.None,new LS(S,E)),he)break}if(S.hint.paddingRight&&s(S,!0),i.length>Ih._MAX_DECORATORS)break}const f=[];for(const[S,x]of this._decorationsMetadata){const E=(y=this._editor.getModel())==null?void 0:y.getDecorationRange(S);E&&e.some(M=>M.containsRange(E))&&(f.push(S),x.classNameRef.dispose(),this._decorationsMetadata.delete(S))}const v=yu.capture(this._editor);this._editor.changeDecorations(S=>{const x=S.deltaDecorations(f,i.map(E=>E.decoration));for(let E=0;E<x.length;E++){const M=i[E];this._decorationsMetadata.set(x[E],M)}}),v.restore(this._editor)}_fillInColors(e,t){t.kind===pL.Parameter?(e.backgroundColor=Pn(MA),e.color=Pn(NA)):t.kind===pL.Type?(e.backgroundColor=Pn(RA),e.color=Pn(AA)):(e.backgroundColor=Pn(OA),e.color=Pn(FA))}_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()}},Ih=ka,ka.ID="editor.contrib.InlayHints",ka._MAX_DECORATORS=1500,ka._MAX_LABEL_LEN=43,ka);Af=Ih=K3([uh(1,Je),uh(2,yo),uh(3,nM),uh(4,Bn),uh(5,Ss),uh(6,Bt)],Af);function Z3(o){return o.replace(/[ \t]/g," ")}Gi.registerCommand("_executeInlayHintProvider",async(o,...e)=>{const[t,i]=e;Si(Ri.isUri(t)),Si(O.isIRange(i));const{inlayHintsProvider:n}=o.get(Je),s=await o.get(wr).createModelReference(t);try{const r=await w_.create(n,s.object.textEditorModel,[O.lift(i)],$t.None),a=r.items.map(c=>c.hint);return setTimeout(()=>r.dispose(),0),a}finally{s.dispose()}});var X3=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},el=function(o,e){return function(t,i){e(t,i,o)}};class SI extends Fm{constructor(e,t,i,n){super(10,t,e.item.anchor.range,i,n,!0),this.part=e}}let I_=class extends Nf{constructor(e,t,i,n,s,r,a,c,h){super(e,t,i,r,c,n,s,h),this._resolverService=a,this.hoverOrdinal=6}suggestHoverAnchor(e){var n;if(!Af.get(this._editor)||e.target.type!==6)return null;const i=(n=e.target.detail.injectedText)==null?void 0:n.options;return i instanceof Jx&&i.attachedData instanceof LS?new SI(i.attachedData,this,e.event.posx,e.event.posy):null}computeSync(){return[]}computeAsync(e,t,i){return e instanceof SI?new hr(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 us().appendText(s.item.hint.tooltip):s.item.hint.tooltip&&(r=s.item.hint.tooltip),r&&n.emitOne(new Ho(this,e.range,[r],!1,0)),io(s.item.hint.textEdits)&&n.emitOne(new Ho(this,e.range,[new us().appendText(w("hint.dbl","Double-click to insert"))],!1,10001));let a;if(typeof s.part.tooltip=="string"?a=new us().appendText(s.part.tooltip):s.part.tooltip&&(a=s.part.tooltip),a&&n.emitOne(new Ho(this,e.range,[a],!1,1)),s.part.location||s.part.command){let h;const g=this._editor.getOption(78)==="altKey"?Qr?w("links.navigate.kb.meta.mac","cmd + click"):w("links.navigate.kb.meta","ctrl + click"):Qr?w("links.navigate.kb.alt.mac","option + click"):w("links.navigate.kb.alt","alt + click");s.part.location&&s.part.command?h=new us().appendText(w("hint.defAndCommand","Go to Definition ({0}), right click for more",g)):s.part.location?h=new us().appendText(w("hint.def","Go to Definition ({0})",g)):s.part.command&&(h=new us(`[${w("hint.cmd","Execute Command")}](${x3(s.part.command)} "${s.part.command.title}") (${g})`,{isTrusted:!0})),h&&n.emitOne(new Ho(this,e.range,[h],!1,1e4))}const c=await this._resolveInlayHintLabelPartHover(s,i);for await(const h of c)n.emitOne(h)}):hr.EMPTY}async _resolveInlayHintLabelPartHover(e,t){if(!e.part.location)return hr.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)?O1(this._languageFeaturesService.hoverProvider,r,new Qe(n.startLineNumber,n.startColumn),t).filter(a=>!mf(a.hover.contents)).map(a=>new Ho(this,e.item.anchor.range,a.hover.contents,!1,2+a.ordinal)):hr.EMPTY}finally{s.dispose()}}};I_=X3([el(1,br),el(2,_r),el(3,En),el(4,mp),el(5,on),el(6,wr),el(7,Je),el(8,Bn)],I_);class V1 extends Se{constructor(e,t,i,n,s,r){super();const a=t.anchor,c=t.hoverParts;this._renderedHoverParts=this._register(new IS(e,i,c,r,s));const{showAtPosition:h,showAtSecondaryPosition:u}=V1.computeHoverPositions(e,a.range,c);this.shouldAppearBeforeContent=c.some(g=>g.isBeforeContent),this.showAtPosition=h,this.showAtSecondaryPosition=u,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 u=e._getViewModel(),g=u.coordinatesConverter,f=g.convertModelRangeToViewRange(t),v=u.getLineMinColumn(f.startLineNumber),_=new Qe(f.startLineNumber,v);n=g.convertViewPositionToModelPosition(_).column}const s=t.startLineNumber;let r=t.startColumn,a;for(const u of i){const g=u.range,f=g.startLineNumber===s,v=g.endLineNumber===s;if(f&&v){const y=g.startColumn,S=Math.min(r,y);r=Math.max(S,n)}u.forceShowAtRange&&(a=g)}let c,h;if(a){const u=a.getStartPosition();c=u,h=u}else c=t.getStartPosition(),h=new Qe(s,r);return{showAtPosition:c,showAtSecondaryPosition:h}}}class Y3{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 Ev=class Ev extends Se{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 Se.None;let i=t[0].range;for(const s of t){const r=s.range;i=O.plusRange(i,r)}const n=e.createDecorationsCollection();return n.set([{range:i,options:Ev._DECORATION_OPTIONS}]),nn(()=>{n.clear()})}_renderParts(e,t,i,n){const s=new b_(n),r={fragment:this._fragment,statusBar:s,...i},a=new we;for(const h of e){const u=this._renderHoverPartsForParticipant(t,h,r);a.add(u);for(const g of u.renderedHoverParts)this._renderedParts.push({type:"hoverPart",participant:h,hoverPart:g.hoverPart,hoverElement:g.hoverElement})}const c=this._renderStatusBar(this._fragment,s);return c&&(a.add(c),this._renderedParts.push({type:"statusBar",hoverElement:c.hoverElement,actions:c.actions})),nn(()=>{a.dispose()})}_renderHoverPartsForParticipant(e,t,i){const n=e.filter(r=>r.owner===t);return n.length>0?t.renderHoverParts(i,n):new Ad([])}_renderStatusBar(e,t){if(t.hasContent)return new Y3(e,t)}_registerListenersOnRenderedParts(){const e=new we;return this._renderedParts.forEach((t,i)=>{const n=t.hoverElement;n.tabIndex=0,e.add(bi(n,hn.FOCUS_IN,s=>{s.stopPropagation(),this._focusedHoverPartIndex=i})),e.add(bi(n,hn.FOCUS_OUT,s=>{s.stopPropagation(),this._focusedHoverPartIndex=-1}))}),e}_updateMarkdownAndColorParticipantInfo(e){const t=e.find(i=>i instanceof Nf&&!(i instanceof I_));t&&(this._markdownHoverParticipant=t),this._colorHoverParticipant=e.find(i=>i instanceof Tf)}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 Lu;return t-s}get domNode(){return this._fragment}get domNodeHasChildren(){return this._fragment.hasChildNodes()}get focusedHoverPartIndex(){return this._focusedHoverPartIndex}};Ev._DECORATION_OPTIONS=oi.register({description:"content-hover-highlight",className:"hoverHighlight"});let IS=Ev;var Q3=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},CI=function(o,e){return function(t,i){e(t,i,o)}};let kS=class extends Se{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._currentResult=null,this._onContentsChanged=this._register(new jt),this.onContentsChanged=this._onContentsChanged.event,this._contentHoverWidget=this._register(this._instantiationService.createInstance(gS,this._editor)),this._participants=this._initializeHoverParticipants(),this._computer=new v_(this._editor,this._participants),this._hoverOperation=this._register(new WT(this._editor,this._computer)),this._registerListeners()}_initializeHoverParticipants(){const e=[];for(const t of Zd.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 BT(this._computer.anchor,i,t.isComplete))}));const e=this._contentHoverWidget.getDomNode();this._register(Fa(e,"keydown",t=>{t.equals(9)&&this.hide()})),this._register(Fa(e,"mouseleave",t=>{this._onMouseLeave(t)})),this._register(Sb.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,c=s&&this._contentHoverWidget.isMouseGettingCloser(s.event.posx,s.event.posy);return a&&c?(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 V1(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 Fw(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 Fw(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||!Vb(t,e.x,e.y))&&this.hide()}startShowingAtRange(e,t,i,n){this._startShowingOrUpdateHover(new Fw(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}};kS=Q3([CI(1,Bt),CI(2,En)],kS);var J3=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},xI=function(o,e){return function(t,i){e(t,i,o)}},DS,Gc;let ls=(Gc=class extends Se{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._onHoverContentsChanged=this._register(new jt),this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new we,this._hoverState={mouseDown:!1,activatedByDecoratorClick:!1},this._reactToEditorMouseMoveRunner=this._register(new Rn(()=>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(DS.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?Vb(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 c=this._isMouseOnContentHoverWidget(r);return a&&c},n=r=>{var h;const a=this._isMouseOnContentHoverWidget(r),c=((h=this._contentWidget)==null?void 0:h.isColorPickerVisible)??!1;return a&&c},s=(r,a)=>{var c,h,u,g;return(a&&((h=this._contentWidget)==null?void 0:h.containsNode((c=r.event.browserEvent.view)==null?void 0:c.document.activeElement))&&!((g=(u=r.event.browserEvent.view)==null?void 0:u.getSelection())!=null&&g.isCollapsed))??!1};return i(e,t)||n(e)||s(e,t)}_onEditorMouseMove(e){var a,c,h,u;if(this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._mouseMoveEvent=e,(a=this._contentWidget)!=null&&a.isFocused||(c=this._contentWidget)!=null&&c.isResizing))return;const t=this._hoverSettings.sticky;if(t&&((h=this._contentWidget)!=null&&h.isVisibleFromKeyboard))return;if(this._shouldNotRecomputeCurrentHoverWidget(e)){this._reactToEditorMouseMoveRunner.cancel();return}const n=this._hoverSettings.hidingDelay;if(((u=this._contentWidget)==null?void 0:u.isVisible)&&t&&n>0){this._reactToEditorMouseMoveRunner.isScheduled()||this._reactToEditorMouseMoveRunner.schedule(n);return}this._reactToEditorMouseMove(e)}_reactToEditorMouseMove(e){var c;if(!e)return;const i=(c=e.target.element)==null?void 0:c.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===AT||t.commandId===Bb||t.commandId===zb)&&((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)||Au.dropDownVisible||(this._hoverState.activatedByDecoratorClick=!1,(t=this._contentWidget)==null||t.hide())}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance(kS,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()}},DS=Gc,Gc.ID="editor.contrib.contentHover",Gc);ls=DS=J3([xI(1,Bt),xI(2,En)],ls);const k0=class k0 extends Se{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!==DT||!i.range)return;const n=this._editor.getContribution(ls.ID);if(n&&!n.isColorPickerVisible){const s=new O(i.range.startLineNumber,i.range.startColumn+1,i.range.endLineNumber,i.range.endColumn+1);n.showContentHover(s,1,0,!1,!0)}}};k0.ID="editor.contrib.colorContribution";let k_=k0;Zt(k_.ID,k_,2);Zd.register(Tf);var sM=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)}},ES,PS,Zc;let Fd=(Zc=class extends Se{constructor(e,t,i){super(),this._editor=e,this._instantiationService=i,this._standaloneColorPickerWidget=null,this._standaloneColorPickerVisible=T.standaloneColorPickerVisible.bindTo(t),this._standaloneColorPickerFocused=T.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(TS,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(ES.ID)}},ES=Zc,Zc.ID="editor.contrib.standaloneColorPickerController",Zc);Fd=ES=sM([Oh(1,wi),Oh(2,Bt)],Fd);Zt(Fd.ID,Fd,1);const LI=8,ez=22;var Xc;let TS=(Xc=class extends Se{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 jt),this.onResult=this._onResult.event,this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=n.createInstance(Mf,this._editor),this._position=(g=this._editor._getViewModel())==null?void 0:g.getPrimaryCursorState().modelState.position;const c=this._editor.getSelection(),h=c?{startLineNumber:c.startLineNumber,startColumn:c.startColumn,endLineNumber:c.endLineNumber,endColumn:c.endColumn}:{startLineNumber:0,endLineNumber:0,endColumn:0,startColumn:0},u=this._register(bu(this._body));this._register(u.onDidBlur(f=>{this.hide()})),this._register(u.onDidFocus(f=>{this.focus()})),this._register(this._editor.onDidChangeCursorPosition(()=>{this._selectionSetInEditor?this._selectionSetInEditor=!1:this.hide()})),this._register(this._editor.onMouseMove(f=>{var _;const v=(_=f.target.element)==null?void 0:_.classList;v&&v.contains("colorpicker-color-decoration")&&this.hide()})),this._register(this.onResult(f=>{this._render(f.value,f.foundInEditor)})),this._start(h),this._body.style.zIndex="50",this._editor.addContentWidget(this)}updateEditor(){this._colorHover&&this._standaloneColorPickerParticipant.updateEditorModel(this._colorHover)}getId(){return PS.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 tz(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 Pf(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 b_(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 c=a.body,h=c.saturationBox.domNode.clientWidth,u=c.domNode.clientWidth-h-ez-LI,g=a.body.enterButton;g==null||g.onClicked(()=>{this.updateEditor(),this.hide()});const f=a.header,v=f.pickedColorNode;v.style.width=h+LI+"px";const _=f.originalColorNode;_.style.width=u+"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)}},PS=Xc,Xc.ID="editor.contrib.standaloneColorPickerWidget",Xc);TS=PS=sM([Oh(3,Bt),Oh(4,En),Oh(5,Je),Oh(6,Ga)],TS);class tz{constructor(e,t){this.value=e,this.foundInEditor=t}}class iz extends pr{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{...Xe("showOrFocusStandaloneColorPicker","Show or Focus Standalone Color Picker"),mnemonicTitle:w({key:"mishowOrFocusStandaloneColorPicker",comment:["&& denotes a mnemonic"]},"&&Show or Focus Standalone Color Picker")},precondition:void 0,menu:[{id:We.CommandPalette}],metadata:{description:Xe("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=Fd.get(t))==null||i.showOrFocus()}}class nz extends ge{constructor(){super({id:"editor.action.hideColorPicker",label:w({key:"hideColorPicker",comment:["Action that hides the color picker"]},"Hide the Color Picker"),alias:"Hide the Color Picker",precondition:T.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100},metadata:{description:Xe("hideColorPickerDescription","Hide the standalone color picker.")}})}run(e,t){var i;(i=Fd.get(t))==null||i.hide()}}class sz extends ge{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:w({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:T.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100},metadata:{description:Xe("insertColorWithStandaloneColorPickerDescription","Insert hex/rgb/hsl colors with the focused standalone color picker.")}})}run(e,t){var i;(i=Fd.get(t))==null||i.insertColor()}}Q(nz);Q(sz);Ti(iz);class bl{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),c=t.charCodeAt(r);if(a!==c&&!(a>=65&&a<=90&&a+32===c)&&!(c>=65&&c<=90&&c+32===a))return!1}return!0}_createOperationsForBlockComment(e,t,i,n,s,r){const a=e.startLineNumber,c=e.startColumn,h=e.endLineNumber,u=e.endColumn,g=s.getLineContent(a),f=s.getLineContent(h);let v=g.lastIndexOf(t,c-1+t.length),_=f.indexOf(i,u-1-i.length);if(v!==-1&&_!==-1)if(a===h)g.substring(v+t.length,_).indexOf(i)>=0&&(v=-1,_=-1);else{const S=g.substring(v+t.length),x=f.substring(0,_);(S.indexOf(i)>=0||x.indexOf(i)>=0)&&(v=-1,_=-1)}let y;v!==-1&&_!==-1?(n&&v+t.length<g.length&&g.charCodeAt(v+t.length)===32&&(t=t+" "),n&&_>0&&f.charCodeAt(_-1)===32&&(i=" "+i,_-=1),y=bl._createRemoveBlockCommentOperations(new O(a,v+t.length+1,h,_+1),t,i)):(y=bl._createAddBlockCommentOperations(e,t,i,this._insertSpace),this._usedEndToken=y.length===1?i:null);for(const S of y)r.addTrackedEditOperation(S.range,S.text)}static _createRemoveBlockCommentOperations(e,t,i){const n=[];return O.isEmpty(e)?n.push(pn.delete(new O(e.startLineNumber,e.startColumn-t.length,e.endLineNumber,e.endColumn+i.length))):(n.push(pn.delete(new O(e.startLineNumber,e.startColumn-t.length,e.startLineNumber,e.startColumn))),n.push(pn.delete(new O(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn+i.length)))),n}static _createAddBlockCommentOperations(e,t,i,n){const s=[];return O.isEmpty(e)?s.push(pn.replace(new O(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),t+" "+i)):(s.push(pn.insert(new Qe(e.startLineNumber,e.startColumn),t+(n?" ":""))),s.push(pn.insert(new Qe(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 _t(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 _t(n.endLineNumber,n.endColumn+s,n.endLineNumber,n.endColumn+s)}}}class ma{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 c=[];for(let h=0,u=i-t+1;h<u;h++)c[h]={ignore:!1,commentStr:a,commentStrOffset:0,commentStrLength:a.length};return c}static _analyzeLines(e,t,i,n,s,r,a,c){let h=!0,u;e===0?u=!0:e===1?u=!1:u=!0;for(let g=0,f=n.length;g<f;g++){const v=n[g],_=s+g;if(_===s&&a){v.ignore=!0;continue}const y=i.getLineContent(_),S=_y(y);if(S===-1){v.ignore=r,v.commentStrOffset=y.length;continue}if(h=!1,v.ignore=!1,v.commentStrOffset=S,u&&!bl._haystackHasNeedleAtOffset(y,v.commentStr,S)&&(e===0?u=!1:e===1||(v.ignore=!0)),u&&t){const x=S+v.commentStrLength;x<y.length&&y.charCodeAt(x)===32&&(v.commentStrLength+=1)}}if(e===0&&h){u=!1;for(let g=0,f=n.length;g<f;g++)n[g].ignore=!1}return{supported:!0,shouldRemoveComments:u,lines:n}}static _gatherPreflightData(e,t,i,n,s,r,a,c){const h=ma._gatherPreflightCommentStrings(i,n,s,c);return h===null?{supported:!1}:ma._analyzeLines(e,t,i,h,n,r,a,c)}_executeLineComments(e,t,i,n){let s;i.shouldRemoveComments?s=ma._createRemoveLineCommentsOperations(i.lines,n.startLineNumber):(ma._normalizeInsertionPoint(e,i.lines,n.startLineNumber,this._indentSize),s=this._createAddLineCommentsOperations(i.lines,n.startLineNumber));const r=new Qe(n.positionLineNumber,n.positionColumn);for(let a=0,c=s.length;a<c;a++)t.addEditOperation(s[a].range,s[a].text),O.isEmpty(s[a].range)&&O.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 c=e.getLineContent(s).lastIndexOf(i,a-1),h=e.getLineContent(r).indexOf(n,t.endColumn-1-i.length);return c!==-1&&h===-1&&(h=e.getLineContent(s).indexOf(n,c+i.length),r=s),c===-1&&h!==-1&&(c=e.getLineContent(r).lastIndexOf(i,h),s=r),t.isEmpty()&&(c===-1||h===-1)&&(c=e.getLineContent(s).indexOf(i),c!==-1&&(h=e.getLineContent(s).indexOf(n,c+i.length))),c!==-1&&e.getLineContent(s).charCodeAt(c+i.length)===32&&(i+=" "),h!==-1&&e.getLineContent(r).charCodeAt(h-1)===32&&(n=" "+n,h-=1),c!==-1&&h!==-1?bl._createRemoveBlockCommentOperations(new O(s,c+i.length+1,r,h+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 c=this._attemptRemoveBlockComment(e,i,r,a);if(!c){if(i.isEmpty()){const h=e.getLineContent(i.startLineNumber);let u=_y(h);u===-1&&(u=h.length),c=bl._createAddBlockCommentOperations(new O(i.startLineNumber,u+1,i.startLineNumber,h.length+1),r,a,this._insertSpace)}else c=bl._createAddBlockCommentOperations(new O(i.startLineNumber,e.getLineFirstNonWhitespaceColumn(i.startLineNumber),i.endLineNumber,e.getLineMaxColumn(i.endLineNumber)),r,a,this._insertSpace);c.length===1&&(this._deltaColumn=r.length+1)}this._selectionId=t.trackSelection(i);for(const h of c)t.addEditOperation(h.range,h.text)}getEditOperations(e,t){let i=this._selection;if(this._moveEndPositionDown=!1,i.startLineNumber===i.endLineNumber&&this._ignoreFirstLine){t.addEditOperation(new O(i.startLineNumber,e.getLineMaxColumn(i.startLineNumber),i.startLineNumber+1,1),i.startLineNumber===e.getLineCount()?"":`
14
+ `),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=ma._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 _t(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(pn.delete(new O(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(pn.insert(new Qe(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 c=0,h=t.length;c<h;c++){if(t[c].ignore)continue;const u=e.getLineContent(i+c);let g=0;for(let f=0,v=t[c].commentStrOffset;g<s&&f<v;f++)g=ma.nextVisibleColumn(g,n,u.charCodeAt(f)===9,1);g<s&&(s=g)}s=Math.floor(s/n)*n;for(let c=0,h=t.length;c<h;c++){if(t[c].ignore)continue;const u=e.getLineContent(i+c);let g=0;for(r=0,a=t[c].commentStrOffset;g<s&&r<a;r++)g=ma.nextVisibleColumn(g,n,u.charCodeAt(r)===9,1);g>s?t[c].commentStrOffset=r-1:t[c].commentStrOffset=r}}}class U1 extends ge{constructor(e,t){super(t),this._type=e}run(e,t){const i=e.get(zn);if(!t.hasModel())return;const n=t.getModel(),s=[],r=n.getOptions(),a=t.getOption(23),c=t.getSelections().map((u,g)=>({selection:u,index:g,ignoreFirstLine:!1}));c.sort((u,g)=>O.compareRangesUsingStarts(u.selection,g.selection));let h=c[0];for(let u=1;u<c.length;u++){const g=c[u];h.selection.endLineNumber===g.selection.startLineNumber&&(h.index<g.index?g.ignoreFirstLine=!0:(h.ignoreFirstLine=!0,h=g))}for(const u of c)s.push(new ma(i,u.selection,r.indentSize,this._type,a.insertSpace,a.ignoreEmptyLines,u.ignoreFirstLine));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class oz extends U1{constructor(){super(0,{id:"editor.action.commentLine",label:w("comment.line","Toggle Line Comment"),alias:"Toggle Line Comment",precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:We.MenubarEditMenu,group:"5_insert",title:w({key:"miToggleLineComment",comment:["&& denotes a mnemonic"]},"&&Toggle Line Comment"),order:1}})}}class rz extends U1{constructor(){super(1,{id:"editor.action.addCommentLine",label:w("comment.line.add","Add Line Comment"),alias:"Add Line Comment",precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:Dn(2089,2081),weight:100}})}}class az extends U1{constructor(){super(2,{id:"editor.action.removeCommentLine",label:w("comment.line.remove","Remove Line Comment"),alias:"Remove Line Comment",precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:Dn(2089,2099),weight:100}})}}class lz extends ge{constructor(){super({id:"editor.action.blockComment",label:w("comment.block","Toggle Block Comment"),alias:"Toggle Block Comment",precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:We.MenubarEditMenu,group:"5_insert",title:w({key:"miToggleBlockComment",comment:["&& denotes a mnemonic"]},"Toggle &&Block Comment"),order:2}})}run(e,t){const i=e.get(zn);if(!t.hasModel())return;const n=t.getOption(23),s=[],r=t.getSelections();for(const a of r)s.push(new bl(a,n.insertSpace,i));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}Q(oz);Q(rz);Q(az);Q(lz);var cz=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)}},MS,Yc;let Fu=(Yc=class{static get(e){return e.getContribution(MS.ID)}constructor(e,t,i,n,s,r,a,c){this._contextMenuService=t,this._contextViewService=i,this._contextKeyService=n,this._keybindingService=s,this._menuService=r,this._configurationService=a,this._workspaceContextService=c,this._toDispose=new we,this._contextMenuIsBeingShownCount=0,this._editor=e,this._toDispose.add(this._editor.onContextMenu(h=>this._onContextMenu(h))),this._toDispose.add(this._editor.onMouseWheel(h=>{if(this._contextMenuIsBeingShownCount>0){const u=this._contextViewService.getContextViewElement(),g=h.srcElement;g.shadowRoot&&HA(u)===g.shadowRoot||this._contextViewService.hideContextView()}})),this._toDispose.add(this._editor.onKeyDown(h=>{this._editor.getOption(24)&&h.keyCode===58&&(h.preventDefault(),h.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 c of r)if(c instanceof WA){const h=this._getMenuActions(e,c.item.submenu);h.length>0&&(i.push(new mL(c.id,c.label,h)),a++)}else i.push(c),a++;a&&i.push(new pf)}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=Ps(this._editor.getDomNode()),c=a.left+r.left,h=a.top+r.top+r.height;n={x:c,y:h}}const s=this._editor.getOption(128)&&!vy;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 py(r,r,{label:!0,keybinding:a.getLabel(),isMenu:!0});const c=r;return typeof c.getActionViewItem=="function"?c.getActionViewItem():new py(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()||BA(this._workspaceContextService.getWorkspace()))return;const t=this._editor.getOption(73);let i=0;const n=h=>({id:`menu-action-${++i}`,label:h.label,tooltip:"",class:void 0,enabled:typeof h.enabled>"u"?!0:h.enabled,checked:h.checked,run:h.run}),s=(h,u)=>new mL(`menu-action-${++i}`,h,u,void 0),r=(h,u,g,f,v)=>{if(!u)return n({label:h,enabled:u,run:()=>{}});const _=S=>()=>{this._configurationService.updateValue(g,S)},y=[];for(const S of v)y.push(n({label:S.label,checked:f===S.value,run:_(S.value)}));return s(h,y)},a=[];a.push(n({label:w("context.minimap.minimap","Minimap"),checked:t.enabled,run:()=>{this._configurationService.updateValue("editor.minimap.enabled",!t.enabled)}})),a.push(new pf),a.push(n({label:w("context.minimap.renderCharacters","Render Characters"),enabled:t.enabled,checked:t.renderCharacters,run:()=>{this._configurationService.updateValue("editor.minimap.renderCharacters",!t.renderCharacters)}})),a.push(r(w("context.minimap.size","Vertical size"),t.enabled,"editor.minimap.size",t.size,[{label:w("context.minimap.size.proportional","Proportional"),value:"proportional"},{label:w("context.minimap.size.fill","Fill"),value:"fill"},{label:w("context.minimap.size.fit","Fit"),value:"fit"}])),a.push(r(w("context.minimap.slider","Slider"),t.enabled,"editor.minimap.showSlider",t.showSlider,[{label:w("context.minimap.slider.mouseover","Mouse Over"),value:"mouseover"},{label:w("context.minimap.slider.always","Always"),value:"always"}]));const c=this._editor.getOption(128)&&!vy;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:c?this._editor.getDomNode():void 0,getAnchor:()=>e,getActions:()=>a,onHide:h=>{this._contextMenuIsBeingShownCount--,this._editor.focus()}})}_keybindingFor(e){return this._keybindingService.lookupKeybinding(e.id)}dispose(){this._contextMenuIsBeingShownCount>0&&this._contextViewService.hideContextView(),this._toDispose.dispose()}},MS=Yc,Yc.ID="editor.contrib.contextmenu",Yc);Fu=MS=cz([rc(1,Ku),rc(2,pb),rc(3,wi),rc(4,En),rc(5,Ud),rc(6,on),rc(7,_u)],Fu);class dz extends ge{constructor(){super({id:"editor.action.showContextMenu",label:w("action.showContextMenu.label","Show Editor Context Menu"),alias:"Show Editor Context Menu",precondition:void 0,kbOpts:{kbExpr:T.textInputFocus,primary:1092,weight:100}})}run(e,t){var i;(i=Fu.get(t))==null||i.showContextMenu()}}Zt(Fu.ID,Fu,2);Q(dz);class Ww{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 Bw{constructor(e,t,i){this.cursorState=e,this.scrollTop=t,this.scrollLeft=i}}const Pv=class Pv extends Se{static get(e){return e.getContribution(Pv.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 Ww(t.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(i)||(this._undoStack.push(new Bw(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 Bw(new Ww(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 Bw(new Ww(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}};Pv.ID="editor.contrib.cursorUndoRedoController";let Hu=Pv;class hz extends ge{constructor(){super({id:"cursorUndo",label:w("cursor.undo","Cursor Undo"),alias:"Cursor Undo",precondition:void 0,kbOpts:{kbExpr:T.textInputFocus,primary:2099,weight:100}})}run(e,t,i){var n;(n=Hu.get(t))==null||n.cursorUndo()}}class uz extends ge{constructor(){super({id:"cursorRedo",label:w("cursor.redo","Cursor Redo"),alias:"Cursor Redo",precondition:void 0})}run(e,t,i){var n;(n=Hu.get(t))==null||n.cursorRedo()}}Zt(Hu.ID,Hu,0);Q(hz);Q(uz);class gz{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 O(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 _t(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 _t(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 _t(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 _t(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 _t(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 gh(o){return Qr?o.altKey:o.ctrlKey}const al=class al extends Se{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)||(gh(e)&&(this._modifierPressed=!0),this._mouseDown&&gh(e)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(e){!this._editor.getOption(35)||this._editor.getOption(22)||(gh(e)&&(this._modifierPressed=!1),this._mouseDown&&e.keyCode===al.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}gh(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 Qe(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 _t(s,r,t.lineNumber,t.column)]}}else i=(this._editor.getSelections()||[]).map(n=>n.containsPosition(t)?new _t(t.lineNumber,t.column,t.lineNumber,t.column):n);this._editor.setSelections(i||[],"mouse",3)}else(!this._dragSelection.containsPosition(t)||(gh(e.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(t)||this._dragSelection.getStartPosition().equals(t)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(al.ID,new gz(this._dragSelection,t,gh(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 O(e.lineNumber,e.column,e.lineNumber,e.column),options:al._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()}};al.ID="editor.contrib.dragAndDrop",al.TRIGGER_KEY_VALUE=Qr?6:5,al._DECORATION_OPTIONS=oi.register({description:"dnd-target",className:"dnd-target"});let D_=al;Zt(D_.ID,D_,2);Zt(za.ID,za,0);Xu(Ky);it(new class extends Rs{constructor(){super({id:aT,precondition:E1,kbOpts:{weight:100,primary:2137}})}runEditorCommand(o,e){var t;return(t=za.get(e))==null?void 0:t.changePasteType()}});it(new class extends Rs{constructor(){super({id:"editor.hidePasteWidget",precondition:E1,kbOpts:{weight:100,primary:9}})}runEditorCommand(o,e){var t;(t=za.get(e))==null||t.clearWidgets()}});var Qc;Q((Qc=class extends ge{constructor(){super({id:"editor.action.pasteAs",label:w("pasteAs","Paste As..."),alias:"Paste As...",precondition:T.writable,metadata:{description:"Paste as",args:[{name:"args",schema:Qc.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=za.get(t))==null?void 0:s.pasteAs(n?new sn(n):void 0)}},Qc.argsSchema={type:"object",properties:{kind:{type:"string",description:w("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.")}}},Qc));Q(class extends ge{constructor(){super({id:"editor.action.pasteAsText",label:w("pasteAsText","Paste as Text"),alias:"Paste as Text",precondition:T.writable})}run(o,e){var t;return(t=za.get(e))==null?void 0:t.pasteAs({providerId:Pd.id})}});class fz{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 II{constructor(e){this.identifier=e}}const oM=qa("treeViewsDndService");Ka(oM,fz,1);var pz=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},nm=function(o,e){return function(t,i){e(t,i,o)}},NS;const rM="editor.experimental.dropIntoEditor.defaultProvider",aM="editor.changeDropType",j1=new di("dropWidgetVisible",!1,w("dropWidgetVisible","Whether the drop widget is showing"));var Jc;let Wu=(Jc=class extends Se{static get(e){return e.getContribution(NS.ID)}constructor(e,t,i,n,s){super(),this._configService=i,this._languageFeaturesService=n,this._treeViewsDragAndDropService=s,this.treeItemsTransfer=$y.getInstance(),this._dropProgressManager=this._register(t.createInstance(p_,"dropIntoEditor",e)),this._postDropWidgetManager=this._register(t.createInstance(__,"dropIntoEditor",e,j1,{id:aM,label:w("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=qn(async r=>{const a=new we,c=a.add(new vu(e,1,void 0,r));try{const h=await this.extractDataTransferData(i);if(h.size===0||c.token.isCancellationRequested)return;const u=e.getModel();if(!u)return;const g=this._languageFeaturesService.documentDropEditProvider.ordered(u).filter(v=>v.dropMimeTypes?v.dropMimeTypes.some(_=>h.matches(_)):!0),f=a.add(await this.getDropEdits(g,u,t,h,c));if(c.token.isCancellationRequested)return;if(f.edits.length){const v=this.getInitialActiveEditIndex(u,f.edits),_=e.getOption(36).showDropSelector==="afterDrop";await this._postDropWidgetManager.applyEditAndShowIfNeeded([O.fromPositions(t)],{activeEditIndex:v,allEdits:f.edits},_,async y=>y,r)}}finally{a.dispose(),this._currentOperation===n&&(this._currentOperation=void 0)}});this._dropProgressManager.showWhile(t,w("dropIntoEditorProgress","Running drop handlers. Click to cancel"),n,{cancel:()=>n.cancel()}),this._currentOperation=n}async getDropEdits(e,t,i,n,s){const r=new we,a=await lp(Promise.all(e.map(async h=>{try{const u=await h.provideDocumentDropEdits(t,i,n,s.token);return u&&r.add(u),u==null?void 0:u.edits.map(g=>({...g,providerId:h.id}))}catch(u){console.error(u)}})),s.token),c=Aa(a??[]).flat();return{edits:oT(c),dispose:()=>r.dispose()}}getInitialActiveEditIndex(e,t){const i=this._configService.getValue(rM,{resource:e.uri});for(const[n,s]of Object.entries(i)){const r=new sn(s),a=t.findIndex(c=>r.value===c.providerId&&c.handledMimeType&&XP(n,[c.handledMimeType]));if(a>=0)return a}return 0}async extractDataTransferData(e){if(!e.dataTransfer)return new ZP;const t=JP(e.dataTransfer);if(this.treeItemsTransfer.hasData(II.prototype)){const i=this.treeItemsTransfer.getData(II.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}},NS=Jc,Jc.ID="editor.contrib.dropIntoEditorController",Jc);Wu=NS=pz([nm(1,Bt),nm(2,on),nm(3,Je),nm(4,oM)],Wu);Zt(Wu.ID,Wu,2);Xu(qy);it(new class extends Rs{constructor(){super({id:aM,precondition:j1,kbOpts:{weight:100,primary:2137}})}runEditorCommand(o,e,t){var i;(i=Wu.get(e))==null||i.changeDropType()}});it(new class extends Rs{constructor(){super({id:"editor.hideDropWidget",precondition:j1,kbOpts:{weight:100,primary:9}})}runEditorCommand(o,e,t){var i;(i=Wu.get(e))==null||i.clearWidgets()}});mr.as(hp.Configuration).registerConfiguration({..._b,properties:{[rM]:{type:"object",scope:5,description:w("defaultProviderDescription","Configures the default drop provider to use for content of a given mime type."),default:{},additionalProperties:{type:"string"}}}});const rs=class rs{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===rs._FIND_MATCH_DECORATION||n===rs._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,rs._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),t!==null&&(this._highlightedDecorationId=t,n.changeDecorationOptions(this._highlightedDecorationId,rs._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 O(s.startLineNumber,s.startColumn,r,a)}this._rangeHighlightDecorationId=n.addDecoration(s,rs._RANGE_HIGHLIGHT_DECORATION)}}),i}set(e,t){this._editor.changeDecorations(i=>{let n=rs._FIND_MATCH_DECORATION;const s=[];if(e.length>1e3){n=rs._FIND_MATCH_NO_OVERVIEW_DECORATION;const a=this._editor.getModel().getLineCount(),h=this._editor.getLayoutInfo().height/a,u=Math.max(2,Math.ceil(3/h));let g=e[0].range.startLineNumber,f=e[0].range.endLineNumber;for(let v=1,_=e.length;v<_;v++){const y=e[v].range;f+u>=y.startLineNumber?y.endLineNumber>f&&(f=y.endLineNumber):(s.push({range:new O(g,1,f,1),options:rs._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),g=y.startLineNumber,f=y.endLineNumber)}s.push({range:new O(g,1,f,1),options:rs._FIND_MATCH_ONLY_OVERVIEW_DECORATION})}const r=new Array(e.length);for(let a=0,c=e.length;a<c;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,rs._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}};rs._CURRENT_FIND_MATCH_DECORATION=oi.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",inlineClassName:"currentFindMatchInline",showIfCollapsed:!0,overviewRuler:{color:Pn(vw),position:Kr.Center},minimap:{color:Pn(_L),position:1}}),rs._FIND_MATCH_DECORATION=oi.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",inlineClassName:"findMatchInline",showIfCollapsed:!0,overviewRuler:{color:Pn(vw),position:Kr.Center},minimap:{color:Pn(_L),position:1}}),rs._FIND_MATCH_NO_OVERVIEW_DECORATION=oi.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0}),rs._FIND_MATCH_ONLY_OVERVIEW_DECORATION=oi.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:Pn(vw),position:Kr.Center}}),rs._RANGE_HIGHLIGHT_DECORATION=oi.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0}),rs._FIND_SCOPE_DECORATION=oi.register({description:"find-scope",className:"findScope",isWholeLine:!0});let RS=rs;class mz{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)=>O.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 lM(o,e){if(o&&o[0]!==""){const t=kI(o,e,"-"),i=kI(o,e,"_");return t&&!i?DI(o,e,"-"):!t&&i?DI(o,e,"_"):o[0].toUpperCase()===o[0]?e.toUpperCase():o[0].toLowerCase()===o[0]?e.toLowerCase():zA(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 kI(o,e,t){return o[0].indexOf(t)!==-1&&e.indexOf(t)!==-1&&o[0].split(t).length===e.split(t).length}function DI(o,e,t){const i=e.split(t),n=o[0].split(t);let s="";return i.forEach((r,a)=>{s+=lM([n[a]],r)+t}),s.slice(0,-1)}class EI{constructor(e){this.staticValue=e,this.kind=0}}class _z{constructor(e){this.pieces=e,this.kind=1}}class Bu{static fromStaticValue(e){return new Bu([Rc.staticValue(e)])}get hasReplacementPatterns(){return this._state.kind===1}constructor(e){!e||e.length===0?this._state=new EI(""):e.length===1&&e[0].staticValue!==null?this._state=new EI(e[0].staticValue):this._state=new _z(e)}buildReplaceString(e,t){if(this._state.kind===0)return t?lM(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=Bu._substitute(r.matchIndex,e);if(r.caseOps!==null&&r.caseOps.length>0){const c=[],h=r.caseOps.length;let u=0;for(let g=0,f=a.length;g<f;g++){if(u>=h){c.push(a.slice(g));break}switch(r.caseOps[u]){case"U":c.push(a[g].toUpperCase());break;case"u":c.push(a[g].toUpperCase()),u++;break;case"L":c.push(a[g].toLowerCase());break;case"l":c.push(a[g].toLowerCase()),u++;break;default:c.push(a[g])}}a=c.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 Rc{static staticValue(e){return new Rc(e,-1,null)}static caseOps(e,t){return new Rc(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 vz{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++]=Rc.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=Rc.caseOps(e,i),this._lastCharIndex=t}finalize(){return this.emitUnchanged(this._source.length),this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=Rc.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new Bu(this._result)}}function bz(o){if(!o||o.length===0)return new Bu(null);const e=[],t=new vz(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(`
15
+ `,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 c=o.charCodeAt(i+1);if(48<=c&&c<=57){i++,a=a*10+(c-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 Ya=new di("findWidgetVisible",!1);Ya.toNegated();const Kb=new di("findInputFocussed",!1),$1=new di("replaceInputFocussed",!1),sm={primary:545,mac:{primary:2593}},om={primary:565,mac:{primary:2613}},rm={primary:560,mac:{primary:2608}},am={primary:554,mac:{primary:2602}},lm={primary:558,mac:{primary:2606}},zi={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"},wl=19999,wz=240;class Yg{constructor(e,t){this._toDispose=new we,this._editor=e,this._state=t,this._isDisposed=!1,this._startSearchingTimer=new cp,this._decorations=new RS(e),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new Rn(()=>{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,fs(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)},wz)):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 c=a.endLineNumber;return a.endColumn===1&&(c=c-1),new O(a.startLineNumber,1,c,this._editor.getModel().getLineMaxColumn(c))}return a}));const n=this._findMatches(i,!1,wl);this._decorations.set(n,i);const s=this._editor.getSelection();let r=this._decorations.getCurrentMatchesPosition(s);if(r===0&&n.length>0){const a=RD(n.map(c=>c.range),c=>O.compareRangesUsingStarts(c,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 Qe(i,n)}_moveToPrevMatch(e,t=!1){if(!this._state.canNavigateBack()){const u=this._decorations.matchAfterPosition(e);u&&this._setCurrentFindMatch(u);return}if(this._decorations.getCount()<wl){let u=this._decorations.matchBeforePosition(e);u&&u.isEmpty()&&u.getStartPosition().equals(e)&&(e=this._prevSearchPosition(e),u=this._decorations.matchBeforePosition(e)),u&&this._setCurrentFindMatch(u);return}if(this._cannotFind())return;const i=this._decorations.getFindScope(),n=Yg._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 c=new Qe(s,r),h=a.findPreviousMatch(this._state.searchString,c,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null,!1);if(h&&h.range.isEmpty()&&h.range.getStartPosition().equals(c)&&(c=this._prevSearchPosition(c),h=a.findPreviousMatch(this._state.searchString,c,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null,!1)),!!h){if(!t&&!n.containsRange(h.range))return this._moveToPrevMatch(h.range.getStartPosition(),!0);this._setCurrentFindMatch(h.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 Qe(i,n)}_moveToNextMatch(e){if(!this._state.canNavigateForward()){const i=this._decorations.matchBeforePosition(e);i&&this._setCurrentFindMatch(i);return}if(this._decorations.getCount()<wl){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=Yg._getSearchRange(this._editor.getModel(),s);r.getEndPosition().isBefore(e)&&(e=r.getStartPosition()),e.isBefore(r.getStartPosition())&&(e=r.getStartPosition());const{lineNumber:a,column:c}=e,h=this._editor.getModel();let u=new Qe(a,c),g=h.findNextMatch(this._state.searchString,u,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(u)&&(u=this._nextSearchPosition(u),g=h.findNextMatch(this._state.searchString,u,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?bz(this._state.replaceString):Bu.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 ap(t,n);this._executeEditorCommand("replace",s),this._decorations.setStartPosition(new Qe(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=>Yg._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>=wl?this._largeReplaceAll():this._regularReplaceAll(e),this.research(!1)}_largeReplaceAll(){const t=new VA(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 c;const h=this._state.preserveCase;a.hasReplacementPatterns||h?c=s.replace(i,function(){return a.buildReplaceString(arguments,h)}):c=s.replace(i,a.buildReplaceString(null,h));const u=new AD(r,c,this._editor.getSelection());this._executeEditorCommand("replaceAll",u)}_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 mz(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 _t(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 Tv=class Tv extends gp{constructor(e,t,i){super(),this._hideSoon=this._register(new Rn(()=>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:Ic(FD),inputActiveOptionForeground:Ic(OD),inputActiveOptionBackground:Ic(jx)},s=this._register(by());this.caseSensitive=this._register(new UA({appendTitle:this._keybindingLabelFor(zi.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 jA({appendTitle:this._keybindingLabelFor(zi.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 $A({appendTitle:this._keybindingLabelFor(zi.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(bi(this._domNode,hn.MOUSE_LEAVE,r=>this._onMouseLeave())),this._register(bi(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 Tv.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")}};Tv.ID="editor.contrib.findOptionsWidget";let AS=Tv;function cm(o,e){return o===1?!0:o===2?!1:e}class yz extends Se{get searchString(){return this._searchString}get replaceString(){return this._replaceString}get isRevealed(){return this._isRevealed}get isReplaceRevealed(){return this._isReplaceRevealed}get isRegex(){return cm(this._isRegexOverride,this._isRegex)}get wholeWord(){return cm(this._wholeWordOverride,this._wholeWord)}get matchCase(){return cm(this._matchCaseOverride,this._matchCase)}get preserveCase(){return cm(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 jt),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"&&(O.equalsRange(this._currentMatch,i)||(this._currentMatch=i,n.currentMatch=!0,s=!0)),s&&this._onFindReplaceStateChange.fire(n)}change(e,t,i=!0){var u;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,c=this.matchCase,h=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"&&((u=e.searchScope)!=null&&u.every(g=>{var f;return(f=this._searchScope)==null?void 0:f.some(v=>!O.equalsRange(v,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),c!==this.matchCase&&(s=!0,n.matchCase=!0),h!==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>=wl}}const Sz=w("defaultLabel","input"),Cz=w("label.preserveCaseToggle","Preserve Case");class xz extends HD{constructor(e){super({icon:xt.preserveCase,title:Cz+e.appendTitle,isChecked:e.isChecked,hoverDelegate:e.hoverDelegate??Cb("element"),inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}class Lz extends gp{constructor(e,t,i,n){super(),this._showOptionButtons=i,this.fixFocusOnOptionClickEnabled=!0,this.cachedOptionsWidth=0,this._onDidOptionChange=this._register(new jt),this.onDidOptionChange=this._onDidOptionChange.event,this._onKeyDown=this._register(new jt),this.onKeyDown=this._onKeyDown.event,this._onMouseDown=this._register(new jt),this._onInput=this._register(new jt),this._onKeyUp=this._register(new jt),this._onPreserveCaseKeyDown=this._register(new jt),this.onPreserveCaseKeyDown=this._onPreserveCaseKeyDown.event,this.contextViewProvider=t,this.placeholder=n.placeholder||"",this.validation=n.validation,this.label=n.label||Sz;const s=n.appendPreserveCaseLabel||"",r=n.history||[],a=!!n.flexibleHeight,c=!!n.flexibleWidth,h=n.flexibleMaxHeight;this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new qA(this.domNode,this.contextViewProvider,{ariaLabel:this.label||"",placeholder:this.placeholder||"",validationOptions:{validation:this.validation},history:r,showHistoryHint:n.showHistoryHint,flexibleHeight:a,flexibleWidth:c,flexibleMaxHeight:h,inputBoxStyles:n.inputBoxStyles})),this.preserveCase=this._register(new xz({appendTitle:s,isChecked:!1,...n.toggleStyles})),this._register(this.preserveCase.onChange(f=>{this._onDidOptionChange.fire(f),!f&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.preserveCase.onKeyDown(f=>{this._onPreserveCaseKeyDown.fire(f)})),this._showOptionButtons?this.cachedOptionsWidth=this.preserveCase.width():this.cachedOptionsWidth=0;const u=[this.preserveCase.domNode];this.onkeydown(this.domNode,f=>{if(f.equals(15)||f.equals(17)||f.equals(9)){const v=u.indexOf(this.domNode.ownerDocument.activeElement);if(v>=0){let _=-1;f.equals(17)?_=(v+1)%u.length:f.equals(15)&&(v===0?_=u.length-1:_=v-1),f.equals(9)?(u[v].blur(),this.inputBox.focus()):_>=0&&u[_].focus(),Jm.stop(f,!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,f=>this._onKeyDown.fire(f)),this.onkeyup(this.inputBox.inputElement,f=>this._onKeyUp.fire(f)),this.oninput(this.inputBox.inputElement,f=>this._onInput.fire()),this.onmousedown(this.inputBox.inputElement,f=>this._onMouseDown.fire(f))}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 cM=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},dM=function(o,e){return function(t,i){e(t,i,o)}};const q1=new di("suggestWidgetVisible",!1,w("suggestWidgetVisible","Whether suggestion are visible")),K1="historyNavigationWidgetFocus",hM="historyNavigationForwardsEnabled",uM="historyNavigationBackwardsEnabled";let Na;const dm=[];function gM(o,e){if(dm.includes(e))throw new Error("Cannot register the same widget multiple times");dm.push(e);const t=new we,i=new di(K1,!1).bindTo(o),n=new di(hM,!0).bindTo(o),s=new di(uM,!0).bindTo(o),r=()=>{i.set(!0),Na=e},a=()=>{i.set(!1),Na===e&&(Na=void 0)};return GA(e.element)&&r(),t.add(e.onDidFocus(()=>r())),t.add(e.onDidBlur(()=>a())),t.add(nn(()=>{dm.splice(dm.indexOf(e),1),a()})),{historyNavigationForwardsEnablement:n,historyNavigationBackwardsEnablement:s,dispose(){t.dispose()}}}let OS=class extends KA{constructor(e,t,i,n){super(e,t,i);const s=this._register(n.createScoped(this.inputBox.element));this._register(gM(s,this.inputBox))}};OS=cM([dM(3,wi)],OS);let FS=class extends Lz{constructor(e,t,i,n,s=!1){super(e,t,s,i);const r=this._register(n.createScoped(this.inputBox.element));this._register(gM(r,this.inputBox))}};FS=cM([dM(3,wi)],FS);ia.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:ie.and(ie.has(K1),ie.equals(uM,!0),ie.not("isComposing"),q1.isEqualTo(!1)),primary:16,secondary:[528],handler:o=>{Na==null||Na.showPreviousValue()}});ia.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:ie.and(ie.has(K1),ie.equals(hM,!0),ie.not("isComposing"),q1.isEqualTo(!1)),primary:18,secondary:[530],handler:o=>{Na==null||Na.showNextValue()}});function PI(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 TI=yn("find-collapsed",xt.chevronRight,w("findCollapsedIcon","Icon to indicate that the editor find widget is collapsed.")),MI=yn("find-expanded",xt.chevronDown,w("findExpandedIcon","Icon to indicate that the editor find widget is expanded.")),Iz=yn("find-selection",xt.selection,w("findSelectionIcon","Icon for 'Find in Selection' in the editor find widget.")),kz=yn("find-replace",xt.replace,w("findReplaceIcon","Icon for 'Replace' in the editor find widget.")),Dz=yn("find-replace-all",xt.replaceAll,w("findReplaceAllIcon","Icon for 'Replace All' in the editor find widget.")),Ez=yn("find-previous-match",xt.arrowUp,w("findPreviousMatchIcon","Icon for 'Find Previous' in the editor find widget.")),Pz=yn("find-next-match",xt.arrowDown,w("findNextMatchIcon","Icon for 'Find Next' in the editor find widget.")),Tz=w("label.findDialog","Find / Replace"),Mz=w("label.find","Find"),Nz=w("placeholder.find","Find"),Rz=w("label.previousMatchButton","Previous Match"),Az=w("label.nextMatchButton","Next Match"),Oz=w("label.toggleSelectionFind","Find in Selection"),Fz=w("label.closeButton","Close"),Hz=w("label.replace","Replace"),Wz=w("placeholder.replace","Replace"),Bz=w("label.replaceButton","Replace"),zz=w("label.replaceAllButton","Replace All"),Vz=w("label.toggleReplaceButton","Toggle Replace"),Uz=w("title.matchesCountLimit","Only the first {0} results are highlighted, but all find operations work on the entire text.",wl),jz=w("label.matchesLocation","{0} of {1}"),NI=w("label.noResults","No results"),Dr=419,$z=275,qz=$z-54;let wg=69;const Kz=33,RI="ctrlEnterReplaceAll.windows.donotask",AI=Qr?256:2048;class zw{constructor(e){this.afterLineNumber=e,this.heightInPx=Kz,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}}function OI(o,e,t){const i=!!e.match(/\n/);if(t&&i&&t.selectionStart>0){o.stopPropagation();return}}function FI(o,e,t){const i=!!e.match(/\n/);if(t&&i&&t.selectionEnd<t.value.length){o.stopPropagation();return}}const Mv=class Mv extends gp{constructor(e,t,i,n,s,r,a,c,h,u){super(),this._hoverService=u,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=c,this._notificationService=h,this._ctrlEnterReplaceAllWarningPrompted=!!c.getBoolean(RI,0),this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._updateHistoryDelayer=new jl(500),this._register(nn(()=>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 f=this._codeEditor.getOption(41).loop;this._state.change({loop:f},!1);const v=this._codeEditor.getOption(41).addExtraSpaceOnTop;v&&!this._viewZone&&(this._viewZone=new zw(0),this._showViewZone()),!v&&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=Kb.bindTo(r),this._findFocusTracker=this._register(bu(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=$1.bindTo(r),this._replaceFocusTracker=this._register(bu(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 zw(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 Mv.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=Eo(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,Vi)}_updateHistory(){this._state.searchString&&this._findInput.inputBox.addToHistory(),this._state.replaceString&&this._replaceInput.inputBox.addToHistory()}_updateMatchesCount(){var t;this._matchesCount.style.minWidth=wg+"px",this._state.matchesCount>=wl?this._matchesCount.title=Uz: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>=wl&&(i+="+");let n=String(this._state.matchesPosition);n==="0"&&(n="?"),e=e1(jz,n,i)}else e=NI;this._matchesCount.appendChild(document.createTextNode(e)),Uo(this._getAriaLabel(e,this._state.currentMatch,this._state.searchString)),wg=Math.max(wg,this._matchesCount.clientWidth)}_getAriaLabel(e,t,i){if(e===NI)return i===""?w("ariaSearchNoResultEmpty","{0} found",e):w("ariaSearchNoResult","{0} found for '{1}'",e,i);if(t){const n=w("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 w("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=Ps(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 c=ZA(this._domNode).left;r>c&&(t=!1);const h=this._codeEditor.getScrolledVisiblePosition(e.getEndPosition());n.left+(h?h.left:0)>c&&(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 zw(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&&Eo(this._domNode)>Dr){this._domNode.style.maxWidth=`${i-28-n-15}px`,this._replaceInput.width=Eo(this._findInput.domNode);return}if(Dr+28+n>=i&&(r=!0),Dr+28+n-wg>=i&&(a=!0),Dr+28+n-wg>=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 c=this._findInput.inputBox.element.clientWidth;c>0&&(this._replaceInput.width=c)}else this._isReplaceVisible&&(this._replaceInput.width=Eo(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&&!O.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(AI|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{this._findInput.inputBox.insertAtCursor(`
16
+ `),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 OI(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"));if(e.equals(18))return FI(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"))}_onReplaceInputKeyDown(e){if(e.equals(AI|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{ub&&Zu&&!this._ctrlEnterReplaceAllWarningPrompted&&(this._notificationService.info(w("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(RI,!0,0,0)),this._replaceInput.inputBox.insertAtCursor(`
17
+ `),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 OI(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"));if(e.equals(18))return FI(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 OS(null,this._contextViewProvider,{width:qz,label:Mz,placeholder:Nz,appendCaseSensitiveLabel:this._keybindingLabelFor(zi.ToggleCaseSensitiveCommand),appendWholeWordsLabel:this._keybindingLabelFor(zi.ToggleWholeWordCommand),appendRegexLabel:this._keybindingLabelFor(zi.ToggleRegexCommand),validation:u=>{if(u.length===0||!this._findInput.getRegex())return null;try{return new RegExp(u,"gu"),null}catch(g){return{content:g.message}}},flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showCommonFindToggles:!0,showHistoryHint:()=>PI(this._keybindingService),inputBoxStyles:bL,toggleStyles:vL},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(u=>this._onFindInputKeyDown(u))),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(u=>{u.equals(1026)&&this._isReplaceVisible&&(this._replaceInput.focus(),u.preventDefault())})),this._register(this._findInput.onRegexKeyDown(u=>{u.equals(2)&&this._isReplaceVisible&&(this._replaceInput.focusOnPreserve(),u.preventDefault())})),this._register(this._findInput.inputBox.onDidHeightChange(u=>{this._tryUpdateHeight()&&this._showViewZone()})),XA&&this._register(this._findInput.onMouseDown(u=>this._onFindInputMouseDown(u))),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._updateMatchesCount();const i=this._register(by());this._prevBtn=this._register(new fh({label:Rz+this._keybindingLabelFor(zi.PreviousMatchFindAction),icon:Ez,hoverDelegate:i,onTrigger:()=>{Mh(this._codeEditor.getAction(zi.PreviousMatchFindAction)).run().then(void 0,Vi)}},this._hoverService)),this._nextBtn=this._register(new fh({label:Az+this._keybindingLabelFor(zi.NextMatchFindAction),icon:Pz,hoverDelegate:i,onTrigger:()=>{Mh(this._codeEditor.getAction(zi.NextMatchFindAction)).run().then(void 0,Vi)}},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 HD({icon:Iz,title:Oz+this._keybindingLabelFor(zi.ToggleSearchScopeCommand),isChecked:!1,hoverDelegate:i,inputActiveOptionBackground:Ic(jx),inputActiveOptionBorder:Ic(FD),inputActiveOptionForeground:Ic(OD)})),this._register(this._toggleSelectionFind.onChange(()=>{if(this._toggleSelectionFind.checked){if(this._codeEditor.hasModel()){let u=this._codeEditor.getSelections();u=u.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),u.length&&this._state.change({searchScope:u},!0)}}else this._state.change({searchScope:null},!0)})),s.appendChild(this._toggleSelectionFind.domNode),this._closeBtn=this._register(new fh({label:Fz+this._keybindingLabelFor(zi.CloseFindWidgetCommand),icon:WD,hoverDelegate:i,onTrigger:()=>{this._state.change({isRevealed:!1,searchScope:null},!1)},onKeyDown:u=>{u.equals(2)&&this._isReplaceVisible&&(this._replaceBtn.isEnabled()?this._replaceBtn.focus():this._codeEditor.focus(),u.preventDefault())}},this._hoverService)),this._replaceInput=this._register(new FS(null,void 0,{label:Hz,placeholder:Wz,appendPreserveCaseLabel:this._keybindingLabelFor(zi.TogglePreserveCaseCommand),history:[],flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>PI(this._keybindingService),inputBoxStyles:bL,toggleStyles:vL},this._contextKeyService,!0)),this._replaceInput.setPreserveCase(!!this._state.preserveCase),this._register(this._replaceInput.onKeyDown(u=>this._onReplaceInputKeyDown(u))),this._register(this._replaceInput.inputBox.onDidChange(()=>{this._state.change({replaceString:this._replaceInput.inputBox.value},!1)})),this._register(this._replaceInput.inputBox.onDidHeightChange(u=>{this._isReplaceVisible&&this._tryUpdateHeight()&&this._showViewZone()})),this._register(this._replaceInput.onDidOptionChange(()=>{this._state.change({preserveCase:this._replaceInput.getPreserveCase()},!0)})),this._register(this._replaceInput.onPreserveCaseKeyDown(u=>{u.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(),u.preventDefault())}));const r=this._register(by());this._replaceBtn=this._register(new fh({label:Bz+this._keybindingLabelFor(zi.ReplaceOneAction),icon:kz,hoverDelegate:r,onTrigger:()=>{this._controller.replace()},onKeyDown:u=>{u.equals(1026)&&(this._closeBtn.focus(),u.preventDefault())}},this._hoverService)),this._replaceAllBtn=this._register(new fh({label:zz+this._keybindingLabelFor(zi.ReplaceAllAction),icon:Dz,hoverDelegate:r,onTrigger:()=>{this._controller.replaceAll()}},this._hoverService));const a=document.createElement("div");a.className="replace-part",a.appendChild(this._replaceInput.domNode);const c=document.createElement("div");c.className="replace-actions",a.appendChild(c),c.appendChild(this._replaceBtn.domNode),c.appendChild(this._replaceAllBtn.domNode),this._toggleReplaceBtn=this._register(new fh({label:Vz,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=Eo(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=Tz,this._domNode.role="dialog",this._domNode.style.width=`${Dr}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 Eh(this._domNode,this,{orientation:0,size:2})),this._resized=!1;let h=Dr;this._register(this._resizeSash.onDidStart(()=>{h=Eo(this._domNode)})),this._register(this._resizeSash.onDidChange(u=>{this._resized=!0;const g=h+u.startX-u.currentX;if(g<Dr)return;const f=parseFloat(YA(this._domNode).maxWidth)||0;g>f||(this._domNode.style.width=`${g}px`,this._isReplaceVisible&&(this._replaceInput.width=Eo(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())})),this._register(this._resizeSash.onDidReset(()=>{const u=Eo(this._domNode);if(u<Dr)return;let g=Dr;if(!this._resized||u===Dr){const f=this._codeEditor.getLayoutInfo();g=f.width-28-f.minimap.minimapWidth-15,this._resized=!0}this._domNode.style.width=`${g}px`,this._isReplaceVisible&&(this._replaceInput.width=Eo(this._findInput.domNode)),this._findInput.inputBox.layout()}))}updateAccessibilitySupport(){const e=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(e!==2)}};Mv.ID="editor.contrib.findWidget";let HS=Mv;class fh extends gp{constructor(e,t){super(),this._opts=e;let i="button";this._opts.className&&(i=i+" "+this._opts.className),this._opts.icon&&(i=i+" "+xi.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??Cb("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(...xi.asClassNameArray(TI)),this._domNode.classList.add(...xi.asClassNameArray(MI))):(this._domNode.classList.remove(...xi.asClassNameArray(MI)),this._domNode.classList.add(...xi.asClassNameArray(TI)))}}mb((o,e)=>{const t=o.getColor(vD);t&&e.addRule(`.monaco-editor .findMatch { border: 1px ${gf(o.type)?"dotted":"solid"} ${t}; box-sizing: border-box; }`);const i=o.getColor(QA);i&&e.addRule(`.monaco-editor .findScope { border: 1px ${gf(o.type)?"dashed":"solid"} ${i}; }`);const n=o.getColor(Oa);n&&e.addRule(`.monaco-editor .find-widget { border: 1px solid ${n}; }`);const s=o.getColor(JA);s&&e.addRule(`.monaco-editor .findMatchInline { color: ${s}; }`);const r=o.getColor(eO);r&&e.addRule(`.monaco-editor .currentFindMatchInline { color: ${r}; }`)});var fM=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},fo=function(o,e){return function(t,i){e(t,i,o)}},WS;const Gz=524288;function BS(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)<Gz)return o.getModel().getValueInRange(i)}return null}var ed;let Ms=(ed=class extends Se{get editor(){return this._editor}static get(e){return e.getContribution(WS.ID)}constructor(e,t,i,n,s,r){super(),this._editor=e,this._findWidgetVisible=Ya.bindTo(t),this._contextKeyService=t,this._storageService=i,this._clipboardService=n,this._notificationService=s,this._hoverService=r,this._updateHistoryDelayer=new jl(500),this._state=this._register(new yz),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!!Kb.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=ff(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=BS(this._editor,e.seedSearchStringFromSelection,e.seedSearchStringFromNonEmptySelection);n&&(this._state.isRegex?i.searchString=ff(n):i.searchString=n)}else if(e.seedSearchStringFromSelection==="multiple"&&!e.updateSearchScope){const n=BS(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 Yg(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(w("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)}},WS=ed,ed.ID="editor.contrib.findController",ed);Ms=WS=fM([fo(1,wi),fo(2,Jl),fo(3,Gu),fo(4,Ss),fo(5,mp)],Ms);let zS=class extends Ms{constructor(e,t,i,n,s,r,a,c,h){super(e,i,a,c,r,h),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 HS(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._themeService,this._storageService,this._notificationService,this._hoverService)),this._findOptionsWidget=this._register(new AS(this._editor,this._state,this._keybindingService))}};zS=fM([fo(1,pb),fo(2,wi),fo(3,En),fo(4,qo),fo(5,Ss),fo(6,Jl),fo(7,Gu),fo(8,mp)],zS);const Zz=BD(new zD({id:zi.StartFindAction,label:w("startFindAction","Find"),alias:"Find",precondition:ie.or(T.focus,ie.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:We.MenubarEditMenu,group:"3_find",title:w({key:"miFind",comment:["&& denotes a mnemonic"]},"&&Find"),order:1}}));Zz.addImplementation(0,(o,e,t)=>{const i=Ms.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 Xz={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 Yz extends ge{constructor(){super({id:zi.StartFindWithArgs,label:w("startFindWithArgsAction","Find With Arguments"),alias:"Find With Arguments",precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},metadata:Xz})}async run(e,t,i){const n=Ms.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 Qz extends ge{constructor(){super({id:zi.StartFindWithSelection,label:w("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=Ms.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 pM extends ge{async run(e,t){const i=Ms.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 Jz extends pM{constructor(){super({id:zi.NextMatchFindAction,label:w("findNextMatchAction","Find Next"),alias:"Find Next",precondition:void 0,kbOpts:[{kbExpr:T.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:ie.and(T.focus,Kb),primary:3,weight:100}]})}_run(e){return e.moveToNextMatch()?(e.editor.pushUndoStop(),!0):!1}}class eV extends pM{constructor(){super({id:zi.PreviousMatchFindAction,label:w("findPreviousMatchAction","Find Previous"),alias:"Find Previous",precondition:void 0,kbOpts:[{kbExpr:T.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:ie.and(T.focus,Kb),primary:1027,weight:100}]})}_run(e){return e.moveToPrevMatch()}}class tV extends ge{constructor(){super({id:zi.GoToMatchFindAction,label:w("findMatchAction.goToMatch","Go to Match..."),alias:"Go to Match...",precondition:Ya}),this._highlightDecorations=[]}run(e,t,i){const n=Ms.get(t);if(!n)return;const s=n.getState().matchesCount;if(s<1){e.get(Ss).notify({severity:Qx.Warning,message:w("findMatchAction.noResults","No matches. Try searching for something else.")});return}const r=e.get($a),a=new we,c=a.add(r.createInputBox());c.placeholder=w("findMatchAction.inputPlaceHolder","Type a number to go to a specific match (between 1 and {0})",s);const h=g=>{const f=parseInt(g);if(isNaN(f))return;const v=n.getState().matchesCount;if(f>0&&f<=v)return f-1;if(f<0&&f>=-v)return v+f},u=g=>{const f=h(g);if(typeof f=="number"){c.validationMessage=void 0,n.goToMatch(f);const v=n.getState().currentMatch;v&&this.addDecorations(t,v)}else c.validationMessage=w("findMatchAction.inputValidationMessage","Please type a number between 1 and {0}",n.getState().matchesCount),this.clearDecorations(t)};a.add(c.onDidChangeValue(g=>{u(g)})),a.add(c.onDidAccept(()=>{const g=h(c.value);typeof g=="number"?(n.goToMatch(g),c.hide()):c.validationMessage=w("findMatchAction.inputValidationMessage","Please type a number between 1 and {0}",n.getState().matchesCount)})),a.add(c.onDidHide(()=>{this.clearDecorations(t),a.dispose()})),c.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:Pn(VD),position:Kr.Full}}}])})}}class mM extends ge{async run(e,t){const i=Ms.get(t);if(!i)return;const n=BS(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 iV extends mM{constructor(){super({id:zi.NextSelectionMatchFindAction,label:w("nextSelectionMatchFindAction","Find Next Selection"),alias:"Find Next Selection",precondition:void 0,kbOpts:{kbExpr:T.focus,primary:2109,weight:100}})}_run(e){return e.moveToNextMatch()}}class nV extends mM{constructor(){super({id:zi.PreviousSelectionMatchFindAction,label:w("previousSelectionMatchFindAction","Find Previous Selection"),alias:"Find Previous Selection",precondition:void 0,kbOpts:{kbExpr:T.focus,primary:3133,weight:100}})}_run(e){return e.moveToPrevMatch()}}const sV=BD(new zD({id:zi.StartFindReplaceAction,label:w("startReplace","Replace"),alias:"Replace",precondition:ie.or(T.focus,ie.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:We.MenubarEditMenu,group:"3_find",title:w({key:"miReplace",comment:["&& denotes a mnemonic"]},"&&Replace"),order:2}}));sV.addImplementation(0,(o,e,t)=>{if(!e.hasModel()||e.getOption(92))return!1;const i=Ms.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})});Zt(Ms.ID,zS,0);Q(Yz);Q(Qz);Q(Jz);Q(eV);Q(tV);Q(iV);Q(nV);const yr=Rs.bindToContribution(Ms.get);it(new yr({id:zi.CloseFindWidgetCommand,precondition:Ya,handler:o=>o.closeFindWidget(),kbOpts:{weight:105,kbExpr:ie.and(T.focus,ie.not("isComposing")),primary:9,secondary:[1033]}}));it(new yr({id:zi.ToggleCaseSensitiveCommand,precondition:void 0,handler:o=>o.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:T.focus,primary:sm.primary,mac:sm.mac,win:sm.win,linux:sm.linux}}));it(new yr({id:zi.ToggleWholeWordCommand,precondition:void 0,handler:o=>o.toggleWholeWords(),kbOpts:{weight:105,kbExpr:T.focus,primary:om.primary,mac:om.mac,win:om.win,linux:om.linux}}));it(new yr({id:zi.ToggleRegexCommand,precondition:void 0,handler:o=>o.toggleRegex(),kbOpts:{weight:105,kbExpr:T.focus,primary:rm.primary,mac:rm.mac,win:rm.win,linux:rm.linux}}));it(new yr({id:zi.ToggleSearchScopeCommand,precondition:void 0,handler:o=>o.toggleSearchScope(),kbOpts:{weight:105,kbExpr:T.focus,primary:am.primary,mac:am.mac,win:am.win,linux:am.linux}}));it(new yr({id:zi.TogglePreserveCaseCommand,precondition:void 0,handler:o=>o.togglePreserveCase(),kbOpts:{weight:105,kbExpr:T.focus,primary:lm.primary,mac:lm.mac,win:lm.win,linux:lm.linux}}));it(new yr({id:zi.ReplaceOneAction,precondition:Ya,handler:o=>o.replace(),kbOpts:{weight:105,kbExpr:T.focus,primary:3094}}));it(new yr({id:zi.ReplaceOneAction,precondition:Ya,handler:o=>o.replace(),kbOpts:{weight:105,kbExpr:ie.and(T.focus,$1),primary:3}}));it(new yr({id:zi.ReplaceAllAction,precondition:Ya,handler:o=>o.replaceAll(),kbOpts:{weight:105,kbExpr:T.focus,primary:2563}}));it(new yr({id:zi.ReplaceAllAction,precondition:Ya,handler:o=>o.replaceAll(),kbOpts:{weight:105,kbExpr:ie.and(T.focus,$1),primary:void 0,mac:{primary:2051}}}));it(new yr({id:zi.SelectAllMatchesAction,precondition:Ya,handler:o=>o.selectAllMatches(),kbOpts:{weight:105,kbExpr:T.focus,primary:515}}));const oV={0:" ",1:"u",2:"r"},HI=65535,or=16777215,WI=4278190080;class Vw{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 eo{constructor(e,t,i){if(e.length!==t.length||e.length>HI)throw new Error("invalid startIndexes or endIndexes size");this._startIndexes=e,this._endIndexes=t,this._collapseStates=new Vw(e.length),this._userDefinedStates=new Vw(e.length),this._recoveredStates=new Vw(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>or||r>or)throw new Error("startLineNumber or endLineNumber must not exceed "+or);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]&or}getEndLineNumber(e){return this._endIndexes[e]&or}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 rV(this,e)}getParentIndex(e){this.ensureParentIndices();const t=((this._startIndexes[e]&WI)>>>24)+((this._endIndexes[e]&WI)>>>16);return t===HI?-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]=`[${oV[this.getSource(t)]}${this.isCollapsed(t)?"+":"-"}] ${this.getStartLineNumber(t)}/${this.getEndLineNumber(t)}`;return e.join(", ")}toFoldRange(e){return{startLineNumber:this._startIndexes[e]&or,endLineNumber:this._endIndexes[e]&or,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 c=0;c<t;c++){const h=e[c];i[c]=h.startLineNumber,n[c]=h.endLineNumber,s.push(h.type),h.type&&(r=!0)}r||(s=void 0);const a=new eo(i,n,s);for(let c=0;c<t;c++)e[c].isCollapsed&&a.setCollapsed(c,!0),a.setSource(c,e[c].source);return a}static sanitizeAndMerge(e,t,i,n){i=i??Number.MAX_VALUE;const s=(S,x)=>Array.isArray(S)?(E=>E<x?S[E]:void 0):(E=>E<x?S.toFoldRange(E):void 0),r=s(e,e.length),a=s(t,t.length);let c=0,h=0,u=r(0),g=a(0);const f=[];let v,_=0;const y=[];for(;u||g;){let S;if(g&&(!u||u.startLineNumber>=g.startLineNumber))u&&u.startLineNumber===g.startLineNumber?(g.source===1?S=g:(S=u,S.isCollapsed=g.isCollapsed&&(u.endLineNumber===g.endLineNumber||!(n!=null&&n.startsInside(u.startLineNumber+1,u.endLineNumber+1))),S.source=0),u=r(++c)):(S=g,g.isCollapsed&&g.source===0&&(S.source=2)),g=a(++h);else{let x=h,E=g;for(;;){if(!E||E.startLineNumber>u.endLineNumber){S=u;break}if(E.source===1&&E.endLineNumber>u.endLineNumber)break;E=a(++x)}u=r(++c)}if(S){for(;v&&v.endLineNumber<S.startLineNumber;)v=f.pop();S.endLineNumber>S.startLineNumber&&S.startLineNumber>_&&S.endLineNumber<=i&&(!v||v.endLineNumber>=S.endLineNumber)&&(y.push(S),_=S.startLineNumber,v&&f.push(v),v=S)}}return y}}class rV{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 aV{get regions(){return this._regions}get textModel(){return this._textModel}constructor(e,t){this._updateEventEmitter=new jt,this.onDidChange=this._updateEventEmitter.event,this._textModel=e,this._decorationProvider=t,this._regions=new eo(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=c=>{for(;n<c;){const h=this._regions.getEndLineNumber(n),u=this._regions.isCollapsed(n);if(h<=s){const g=this.regions.getSource(n)!==0;i.changeDecorationOptions(this._editorDecorationIds[n],this._decorationProvider.getDecorationOption(u,h<=r,g))}u&&h>r&&(r=h),n++}};for(const c of e){const h=c.regionIndex,u=this._editorDecorationIds[h];if(u&&!t[u]){t[u]=!0,a(h);const g=!this._regions.isCollapsed(h);this._regions.setCollapsed(h,g),s=Math.max(s,this._regions.getEndLineNumber(h))}}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(eo.fromFoldRanges(t))}update(e,t){const i=this._currentFoldedOrManualRanges(t),n=eo.sanitizeAndMerge(e,i,this._textModel.getLineCount(),t);this.updatePost(eo.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),c=e.isCollapsed(n),h=e.getSource(n)!==0,u={startLineNumber:r,startColumn:this._textModel.getLineMaxColumn(r),endLineNumber:a,endColumn:this._textModel.getLineMaxColumn(a)+1};t.push({range:u,options:this._decorationProvider.getDecorationOption(c,a<=i,h)}),c&&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),c=this._textModel.getDecorationRange(this._editorDecorationIds[i]);c&&(s&&(e!=null&&e.startsInside(c.startLineNumber+1,c.endLineNumber))&&(s=!1),t.push({startLineNumber:c.startLineNumber,endLineNumber:c.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=eo.sanitizeAndMerge(this._regions,t,i);this.updatePost(eo.fromFoldRanges(n))}_getLinesChecksum(e,t){return UD(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,c=this._regions.length;a<c;a++){const h=this._regions.toRegion(a);if(this._regions.getStartLineNumber(a)<s){for(;r.length>0&&!h.containedBy(r[r.length-1]);)r.pop();r.push(h),t(h,r.length)&&i.push(h)}else break}}else for(let r=n,a=this._regions.length;r<a;r++){const c=this._regions.toRegion(r);if(this._regions.getStartLineNumber(r)<s)(!t||t(c))&&i.push(c);else break}return i}}function G1(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,(c,h)=>c.isCollapsed!==r&&h<e);i.push(...a)}}}o.toggleCollapseState(i)}function ng(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,(c,h)=>c.isCollapsed!==e&&h<t);n.push(...a)}}else{const s=o.getRegionsInside(null,(r,a)=>r.isCollapsed!==e&&a<t);n.push(...s)}o.toggleCollapseState(n)}function _M(o,e,t,i){const n=[];for(const s of i){const r=o.getAllRegionsAtLine(s,(a,c)=>a.isCollapsed!==e&&c<=t);n.push(...r)}o.toggleCollapseState(n)}function lV(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 cV(o,e,t,i){const n=(r,a)=>a===e&&r.isCollapsed!==t&&!i.some(c=>r.containsLine(c)),s=o.getRegionsInside(null,n);o.toggleCollapseState(s)}function vM(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 Z1(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 X1(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 dV(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 hV(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 uV(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 gV{get onDidChange(){return this._updateEventEmitter.event}get hiddenRanges(){return this._hiddenRanges}constructor(e){this._updateEventEmitter=new jt,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||tO(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 c=a.getStartLineNumber(i)+1,h=a.getEndLineNumber(i);s<=c&&h<=r||(!e&&n<this._hiddenRanges.length&&this._hiddenRanges[n].startLineNumber===c&&this._hiddenRanges[n].endLineNumber===h?(t.push(this._hiddenRanges[n]),n++):(e=!0,t.push(new O(c,1,h,1))),s=c,r=h)}(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 BI(this._hiddenRanges,e)!==null}adjustSelections(e){let t=!1;const i=this._foldingModel.textModel;let n=null;const s=r=>((!n||!fV(r,n))&&(n=BI(this._hiddenRanges,r)),n?n.startLineNumber-1:null);for(let r=0,a=e.length;r<a;r++){let c=e[r];const h=s(c.startLineNumber);h&&(c=c.setStartPosition(h,i.getLineMaxColumn(h)),t=!0);const u=s(c.endLineNumber);u&&(c=c.setEndPosition(u,i.getLineMaxColumn(u)),t=!0),e[r]=c}return t}dispose(){this.hiddenRanges.length>0&&(this._hiddenRanges=[],this._updateEventEmitter.fire(this._hiddenRanges)),this._foldingModelListener&&(this._foldingModelListener.dispose(),this._foldingModelListener=null)}}function fV(o,e){return o>=e.startLineNumber&&o<=e.endLineNumber}function BI(o,e){const t=RD(o,i=>e<i.startLineNumber)-1;return t>=0&&o[t].endLineNumber>=e?o[t]:null}const pV=5e3,mV="indent";class Y1{constructor(e,t,i){this.editorModel=e,this.languageConfigurationService=t,this.foldingRangesLimit=i,this.id=mV}dispose(){}compute(e){const t=this.languageConfigurationService.getLanguageConfiguration(this.editorModel.getLanguageId()).foldingRules,i=t&&!!t.offSide,n=t&&t.markers;return Promise.resolve(bV(this.editorModel,i,n,this.foldingRangesLimit))}}let _V=class{constructor(e){this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=e}insertFirst(e,t,i){if(e>or||t>or)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 eo(i,n)}else{this._foldingRangesLimit.update(this._length,t);let i=0,n=this._indentOccurrences.length;for(let c=0;c<this._indentOccurrences.length;c++){const h=this._indentOccurrences[c];if(h){if(h+i>t){n=c;break}i+=h}}const s=e.getOptions().tabSize,r=new Uint32Array(t),a=new Uint32Array(t);for(let c=this._length-1,h=0;c>=0;c--){const u=this._startIndexes[c],g=e.getLineContent(u),f=Bx(g,s);(f<n||f===n&&i++<t)&&(r[h]=u,a[h]=this._endIndexes[c],h++)}return new eo(r,a)}}};const vV={limit:pV,update:()=>{}};function bV(o,e,t,i=vV){const n=o.getOptions().tabSize,s=new _V(i);let r;t&&(r=new RegExp(`(${t.start.source})|(?:${t.end.source})`));const a=[],c=o.getLineCount()+1;a.push({indent:-1,endAbove:c,line:c});for(let h=o.getLineCount();h>0;h--){const u=o.getLineContent(h),g=Bx(u,n);let f=a[a.length-1];if(g===-1){e&&(f.endAbove=h);continue}let v;if(r&&(v=u.match(r)))if(v[1]){let _=a.length-1;for(;_>0&&a[_].indent!==-2;)_--;if(_>0){a.length=_+1,f=a[_],s.insertFirst(h,f.line,g),f.line=h,f.indent=g,f.endAbove=h;continue}}else{a.push({indent:-2,endAbove:h,line:h});continue}if(f.indent>g){do a.pop(),f=a[a.length-1];while(f.indent>g);const _=f.endAbove-1;_-h>=1&&s.insertFirst(h,_,g)}f.indent===g?f.endAbove=h:a.push({indent:g,endAbove:h,line:h})}return s.toIndentRanges(o)}const wV=Ke("editor.foldBackground",{light:Zr(wL,.3),dark:Zr(wL,.3),hcDark:null,hcLight:null},w("foldBackgroundBackground","Background color behind folded ranges. The color must not be opaque so as not to hide underlying decorations."),!0);Ke("editor.foldPlaceholderForeground",{light:"#808080",dark:"#808080",hcDark:null,hcLight:null},w("collapsedTextColor","Color of the collapsed text after the first line of a folded range."));Ke("editorGutter.foldingControlForeground",iO,w("editorGutter.foldingControlForeground","Color of the folding control in the editor gutter."));const E_=yn("folding-expanded",xt.chevronDown,w("foldingExpandedIcon","Icon for expanded ranges in the editor glyph margin.")),P_=yn("folding-collapsed",xt.chevronRight,w("foldingCollapsedIcon","Icon for collapsed ranges in the editor glyph margin.")),zI=yn("folding-manual-collapsed",P_,w("foldingManualCollapedIcon","Icon for manually collapsed ranges in the editor glyph margin.")),VI=yn("folding-manual-expanded",E_,w("foldingManualExpandedIcon","Icon for manually expanded ranges in the editor glyph margin.")),Uw={color:Pn(wV),position:1},ph=w("linesCollapsed","Click to expand the range."),hm=w("linesExpanded","Click to collapse the range."),Sn=class Sn{constructor(e){this.editor=e,this.showFoldingControls="mouseover",this.showFoldingHighlights=!0}getDecorationOption(e,t,i){return t?Sn.HIDDEN_RANGE_DECORATION:this.showFoldingControls==="never"?e?this.showFoldingHighlights?Sn.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:Sn.NO_CONTROLS_COLLAPSED_RANGE_DECORATION:Sn.NO_CONTROLS_EXPANDED_RANGE_DECORATION:e?i?this.showFoldingHighlights?Sn.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:Sn.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?Sn.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:Sn.COLLAPSED_VISUAL_DECORATION:this.showFoldingControls==="mouseover"?i?Sn.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:Sn.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:i?Sn.MANUALLY_EXPANDED_VISUAL_DECORATION:Sn.EXPANDED_VISUAL_DECORATION}changeDecorations(e){return this.editor.changeDecorations(e)}removeDecorations(e){this.editor.removeDecorations(e)}};Sn.COLLAPSED_VISUAL_DECORATION=oi.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:ph,firstLineDecorationClassName:xi.asClassName(P_)}),Sn.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=oi.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Uw,isWholeLine:!0,linesDecorationsTooltip:ph,firstLineDecorationClassName:xi.asClassName(P_)}),Sn.MANUALLY_COLLAPSED_VISUAL_DECORATION=oi.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:ph,firstLineDecorationClassName:xi.asClassName(zI)}),Sn.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=oi.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Uw,isWholeLine:!0,linesDecorationsTooltip:ph,firstLineDecorationClassName:xi.asClassName(zI)}),Sn.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=oi.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:ph}),Sn.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=oi.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Uw,isWholeLine:!0,linesDecorationsTooltip:ph}),Sn.EXPANDED_VISUAL_DECORATION=oi.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+xi.asClassName(E_),linesDecorationsTooltip:hm}),Sn.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=oi.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:xi.asClassName(E_),linesDecorationsTooltip:hm}),Sn.MANUALLY_EXPANDED_VISUAL_DECORATION=oi.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+xi.asClassName(VI),linesDecorationsTooltip:hm}),Sn.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=oi.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:xi.asClassName(VI),linesDecorationsTooltip:hm}),Sn.NO_CONTROLS_EXPANDED_RANGE_DECORATION=oi.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0}),Sn.HIDDEN_RANGE_DECORATION=oi.register({description:"folding-hidden-range-decoration",stickiness:1});let VS=Sn;const yV={},SV="syntax";class Q1{constructor(e,t,i,n,s){this.editorModel=e,this.providers=t,this.handleFoldingRangesChange=i,this.foldingRangesLimit=n,this.fallbackRangeProvider=s,this.id=SV,this.disposables=new we,s&&this.disposables.add(s);for(const r of t)typeof r.onDidChange=="function"&&this.disposables.add(r.onDidChange(i))}compute(e){return CV(this.providers,this.editorModel,e).then(t=>{var i;return t?LV(t,this.foldingRangesLimit):((i=this.fallbackRangeProvider)==null?void 0:i.compute(e))??null})}dispose(){this.disposables.dispose()}}function CV(o,e,t){let i=null;const n=o.map((s,r)=>Promise.resolve(s.provideFoldingRanges(e,yV,t)).then(a=>{if(!t.isCancellationRequested&&Array.isArray(a)){Array.isArray(i)||(i=[]);const c=e.getLineCount();for(const h of a)h.start>0&&h.end>h.start&&h.end<=c&&i.push({start:h.start,end:h.end,rank:r,kind:h.kind})}},Cn));return Promise.all(n).then(s=>i)}class xV{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>or||t>or)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 eo(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 c=this._nestingLevelCounts[a];if(c){if(c+t>e){i=a;break}t+=c}}const n=new Uint32Array(e),s=new Uint32Array(e),r=[];for(let a=0,c=0;a<this._length;a++){const h=this._nestingLevels[a];(h<i||h===i&&t++<e)&&(n[c]=this._startIndexes[a],s[c]=this._endIndexes[a],r[c]=this._types[a],c++)}return new eo(n,s,r)}}}function LV(o,e){const t=o.sort((r,a)=>{let c=r.start-a.start;return c===0&&(c=r.rank-a.rank),c}),i=new xV(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 IV=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},yg=function(o,e){return function(t,i){e(t,i,o)}},dc;const Yn=new di("foldingEnabled",!1);var td;let Zl=(td=class extends Se{static get(e){return e.getContribution(dc.ID)}static getFoldingRangeProviders(e,t){var n;const i=e.foldingRangeProvider.ordered(t);return((n=dc._foldingRangeSelector)==null?void 0:n.call(dc,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 we),this.editor=e,this._foldingLimitReporter=new bM(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 VS(e),this.foldingDecorationProvider.showFoldingControls=a.get(111),this.foldingDecorationProvider.showFoldingHighlights=a.get(45),this.foldingEnabled=Yn.bindTo(this.contextKeyService),this.foldingEnabled.set(this._isEnabled),this._register(this.editor.onDidChangeModel(()=>this.onModelChanged())),this._register(this.editor.onDidChangeConfiguration(c=>{if(c.hasChanged(43)&&(this._isEnabled=this.editor.getOptions().get(43),this.foldingEnabled.set(this._isEnabled),this.onModelChanged()),c.hasChanged(47)&&this.onModelChanged(),c.hasChanged(111)||c.hasChanged(45)){const h=this.editor.getOptions();this.foldingDecorationProvider.showFoldingControls=h.get(111),this.foldingDecorationProvider.showFoldingHighlights=h.get(45),this.triggerFoldingModelChanged()}c.hasChanged(44)&&(this._useFoldingProviders=this.editor.getOptions().get(44)!=="indentation",this.onFoldingStrategyChanged()),c.hasChanged(48)&&(this._unfoldOnClickAfterEndOfLine=this.editor.getOptions().get(48)),c.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 aV(e,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new gV(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange(t=>this.onHiddenRangesChanges(t))),this.updateScheduler=new jl(this.updateDebounceInfo.get(e)),this.cursorChangedScheduler=new Rn(()=>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 Y1(e,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=t,this._useFoldingProviders&&this.foldingModel){const i=dc.getFoldingRangeProviders(this.languageFeaturesService,e);i.length>0&&(this.rangeProvider=new Q1(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 qs,i=this.getRangeProvider(e.textModel),n=this.foldingRegionPromise=qn(s=>i.compute(s));return n.then(s=>{if(s&&n===this.foldingRegionPromise){let r;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){const h=s.setCollapsedAllOfType(wp.Imports.value,!0);h&&(r=yu.capture(this.editor),this._currentModelHasFoldedImports=h)}const a=this.editor.getSelections();e.update(s,kV(a)),r==null||r.restore(this.editor);const c=this.updateDebounceInfo.update(e.textModel,t.elapsed());this.updateScheduler&&(this.updateScheduler.defaultDelay=c)}return e})}).then(void 0,e=>(Vi(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,Vi)}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 c=e.event.altKey;let h=[];if(c){const u=f=>!f.containedBy(r)&&!r.containedBy(f),g=t.getRegionsInside(null,u);for(const f of g)f.isCollapsed&&h.push(f);h.length===0&&(h=g)}else{const u=e.event.middleButton||e.event.shiftKey;if(u)for(const g of t.getRegionsInside(r))g.isCollapsed===a&&h.push(g);(a||!u||h.length===0)&&h.push(r)}t.toggleCollapseState(h),this.reveal({lineNumber:i,column:1})}}}reveal(e){this.editor.revealPositionInCenterIfOutsideViewport(e,0)}},dc=td,td.ID="editor.contrib.folding",td);Zl=dc=IV([yg(1,wi),yg(2,zn),yg(3,Ss),yg(4,yo),yg(5,Je)],Zl);class bM{constructor(e){this.editor=e,this._onDidChange=new jt,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 ss extends ge{runEditorCommand(e,t,i){const n=e.get(zn),s=Zl.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 c=t.getSelection();c&&s.reveal(c.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 kV(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 wM(o){if(!kg(o)){if(!jD(o))return!1;const e=o;if(!kg(e.levels)&&!yL(e.levels)||!kg(e.direction)&&!mD(e.direction)||!kg(e.selectionLines)&&(!Array.isArray(e.selectionLines)||!e.selectionLines.every(yL)))return!1}return!0}class DV extends ss{constructor(){super({id:"editor.unfold",label:w("unfoldAction.label","Unfold"),alias:"Unfold",precondition:Yn,kbOpts:{kbExpr:T.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:
18
+ * 'levels': Number of levels to unfold. If not set, defaults to 1.
19
+ * 'direction': If 'up', unfold given number of levels up otherwise unfolds down.
20
+ * '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.
21
+ `,constraint:wM,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"?_M(t,!1,s,r):ng(t,!1,s,r)}}class EV extends ss{constructor(){super({id:"editor.unfoldRecursively",label:w("unFoldRecursivelyAction.label","Unfold Recursively"),alias:"Unfold Recursively",precondition:Yn,kbOpts:{kbExpr:T.editorTextFocus,primary:Dn(2089,2142),weight:100}})}invoke(e,t,i,n){ng(t,!1,Number.MAX_VALUE,this.getSelectedLines(i))}}class PV extends ss{constructor(){super({id:"editor.fold",label:w("foldAction.label","Fold"),alias:"Fold",precondition:Yn,kbOpts:{kbExpr:T.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:
22
+ * 'levels': Number of levels to fold.
23
+ * 'direction': If 'up', folds given number of levels up otherwise folds down.
24
+ * '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.
25
+ If no levels or direction is set, folds the region at the locations or if already collapsed, the first uncollapsed parent instead.
26
+ `,constraint:wM,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"?lV(t,!0,s):a==="up"?_M(t,!0,r||1,s):ng(t,!0,r||1,s)}}class TV extends ss{constructor(){super({id:"editor.toggleFold",label:w("toggleFoldAction.label","Toggle Fold"),alias:"Toggle Fold",precondition:Yn,kbOpts:{kbExpr:T.editorTextFocus,primary:Dn(2089,2090),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);G1(t,1,n)}}class MV extends ss{constructor(){super({id:"editor.foldRecursively",label:w("foldRecursivelyAction.label","Fold Recursively"),alias:"Fold Recursively",precondition:Yn,kbOpts:{kbExpr:T.editorTextFocus,primary:Dn(2089,2140),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);ng(t,!0,Number.MAX_VALUE,n)}}class NV extends ss{constructor(){super({id:"editor.toggleFoldRecursively",label:w("toggleFoldRecursivelyAction.label","Toggle Fold Recursively"),alias:"Toggle Fold Recursively",precondition:Yn,kbOpts:{kbExpr:T.editorTextFocus,primary:Dn(2089,3114),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);G1(t,Number.MAX_VALUE,n)}}class RV extends ss{constructor(){super({id:"editor.foldAllBlockComments",label:w("foldAllBlockComments.label","Fold All Block Comments"),alias:"Fold All Block Comments",precondition:Yn,kbOpts:{kbExpr:T.editorTextFocus,primary:Dn(2089,2138),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())X1(t,wp.Comment.value,!0);else{const r=i.getModel();if(!r)return;const a=s.getLanguageConfiguration(r.getLanguageId()).comments;if(a&&a.blockCommentStartToken){const c=new RegExp("^\\s*"+ff(a.blockCommentStartToken));Z1(t,c,!0)}}}}class AV extends ss{constructor(){super({id:"editor.foldAllMarkerRegions",label:w("foldAllMarkerRegions.label","Fold All Regions"),alias:"Fold All Regions",precondition:Yn,kbOpts:{kbExpr:T.editorTextFocus,primary:Dn(2089,2077),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())X1(t,wp.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 c=new RegExp(a.markers.start);Z1(t,c,!0)}}}}class OV extends ss{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:w("unfoldAllMarkerRegions.label","Unfold All Regions"),alias:"Unfold All Regions",precondition:Yn,kbOpts:{kbExpr:T.editorTextFocus,primary:Dn(2089,2078),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())X1(t,wp.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 c=new RegExp(a.markers.start);Z1(t,c,!1)}}}}class FV extends ss{constructor(){super({id:"editor.foldAllExcept",label:w("foldAllExcept.label","Fold All Except Selected"),alias:"Fold All Except Selected",precondition:Yn,kbOpts:{kbExpr:T.editorTextFocus,primary:Dn(2089,2136),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);vM(t,!0,n)}}class HV extends ss{constructor(){super({id:"editor.unfoldAllExcept",label:w("unfoldAllExcept.label","Unfold All Except Selected"),alias:"Unfold All Except Selected",precondition:Yn,kbOpts:{kbExpr:T.editorTextFocus,primary:Dn(2089,2134),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);vM(t,!1,n)}}class WV extends ss{constructor(){super({id:"editor.foldAll",label:w("foldAllAction.label","Fold All"),alias:"Fold All",precondition:Yn,kbOpts:{kbExpr:T.editorTextFocus,primary:Dn(2089,2069),weight:100}})}invoke(e,t,i){ng(t,!0)}}class BV extends ss{constructor(){super({id:"editor.unfoldAll",label:w("unfoldAllAction.label","Unfold All"),alias:"Unfold All",precondition:Yn,kbOpts:{kbExpr:T.editorTextFocus,primary:Dn(2089,2088),weight:100}})}invoke(e,t,i){ng(t,!1)}}const jh=class jh extends ss{getFoldingLevel(){return parseInt(this.id.substr(jh.ID_PREFIX.length))}invoke(e,t,i){cV(t,this.getFoldingLevel(),!0,this.getSelectedLines(i))}};jh.ID_PREFIX="editor.foldLevel",jh.ID=e=>jh.ID_PREFIX+e;let T_=jh;class zV extends ss{constructor(){super({id:"editor.gotoParentFold",label:w("gotoParentFold.label","Go to Parent Fold"),alias:"Go to Parent Fold",precondition:Yn,kbOpts:{kbExpr:T.editorTextFocus,weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);if(n.length>0){const s=dV(n[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class VV extends ss{constructor(){super({id:"editor.gotoPreviousFold",label:w("gotoPreviousFold.label","Go to Previous Folding Range"),alias:"Go to Previous Folding Range",precondition:Yn,kbOpts:{kbExpr:T.editorTextFocus,weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);if(n.length>0){const s=hV(n[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class UV extends ss{constructor(){super({id:"editor.gotoNextFold",label:w("gotoNextFold.label","Go to Next Folding Range"),alias:"Go to Next Folding Range",precondition:Yn,kbOpts:{kbExpr:T.editorTextFocus,weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);if(n.length>0){const s=uV(n[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class jV extends ss{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:w("createManualFoldRange.label","Create Folding Range from Selection"),alias:"Create Folding Range from Selection",precondition:Yn,kbOpts:{kbExpr:T.editorTextFocus,primary:Dn(2089,2135),weight:100}})}invoke(e,t,i){var r;const n=[],s=i.getSelections();if(s){for(const a of s){let c=a.endLineNumber;a.endColumn===1&&--c,c>a.startLineNumber&&(n.push({startLineNumber:a.startLineNumber,endLineNumber:c,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((c,h)=>c.startLineNumber-h.startLineNumber);const a=eo.sanitizeAndMerge(t.regions,n,(r=i.getModel())==null?void 0:r.getLineCount());t.updatePost(eo.fromFoldRanges(a))}}}}class $V extends ss{constructor(){super({id:"editor.removeManualFoldingRanges",label:w("removeManualFoldingRanges.label","Remove Manual Folding Ranges"),alias:"Remove Manual Folding Ranges",precondition:Yn,kbOpts:{kbExpr:T.editorTextFocus,primary:Dn(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:c}=r;s.push(c>=a?{startLineNumber:a,endLineNumber:c}:{endLineNumber:c,startLineNumber:a})}t.removeManualRanges(s),e.triggerFoldingModelChanged()}}}Zt(Zl.ID,Zl,0);Q(DV);Q(EV);Q(PV);Q(MV);Q(NV);Q(WV);Q(BV);Q(RV);Q(AV);Q(OV);Q(FV);Q(HV);Q(TV);Q(zV);Q(VV);Q(UV);Q(jV);Q($V);for(let o=1;o<=7;o++)nO(new T_({id:T_.ID(o),label:w("foldLevelAction.label","Fold Level {0}",o),alias:`Fold Level ${o}`,precondition:Yn,kbOpts:{kbExpr:T.editorTextFocus,primary:Dn(2089,2048|21+o),weight:100}}));Gi.registerCommand("_executeFoldingRangeProvider",async function(o,...e){const[t]=e;if(!(t instanceof Ri))throw Ea();const i=o.get(Je),n=o.get(Cs).getModel(t);if(!n)throw Ea();const s=o.get(on);if(!s.getValue("editor.folding",{resource:t}))return[];const r=o.get(zn),a=s.getValue("editor.foldingStrategy",{resource:t}),c={get limit(){return s.getValue("editor.foldingMaximumRegions",{resource:t})},update:(v,_)=>{}},h=new Y1(n,r,c);let u=h;if(a!=="indentation"){const v=Zl.getFoldingRangeProviders(i,n);v.length&&(u=new Q1(n,v,()=>{},c,h))}const g=await u.compute($t.None),f=[];try{if(g)for(let v=0;v<g.length;v++){const _=g.getType(v);f.push({start:g.getStartLineNumber(v),end:g.getEndLineNumber(v),kind:_?wp.fromValue(_):void 0})}return f}finally{u.dispose()}});class qV extends ge{constructor(){super({id:"editor.action.fontZoomIn",label:w("EditorFontZoomIn.label","Increase Editor Font Size"),alias:"Increase Editor Font Size",precondition:void 0})}run(e,t){wf.setZoomLevel(wf.getZoomLevel()+1)}}class KV extends ge{constructor(){super({id:"editor.action.fontZoomOut",label:w("EditorFontZoomOut.label","Decrease Editor Font Size"),alias:"Decrease Editor Font Size",precondition:void 0})}run(e,t){wf.setZoomLevel(wf.getZoomLevel()-1)}}class GV extends ge{constructor(){super({id:"editor.action.fontZoomReset",label:w("EditorFontZoomReset.label","Reset Editor Font Size"),alias:"Reset Editor Font Size",precondition:void 0})}run(e,t){wf.setZoomLevel(0)}}Q(qV);Q(KV);Q(GV);var yM=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},Qg=function(o,e){return function(t,i){e(t,i,o)}},cu;let M_=(cu=class{constructor(e,t,i,n){this._editor=e,this._languageFeaturesService=t,this._workerService=i,this._accessibilitySignalService=n,this._disposables=new we,this._sessionDisposables=new we,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 e_;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 Kn,s=this._editor.onDidChangeModelContent(r=>{if(r.isFlush){n.cancel(),s.dispose();return}for(let a=0,c=r.changes.length;a<c;a++)if(r.changes[a].range.endLineNumber<=i.lineNumber){n.cancel(),s.dispose();return}});sO(this._workerService,this._languageFeaturesService,t,i,e,t.getFormattingOptions(),n.token).then(r=>{n.token.isCancellationRequested||io(r)&&(this._accessibilitySignalService.playSignal(qD.format,{userGesture:!1}),oO.execute(this._editor,r,!0))}).finally(()=>{s.dispose()})}},cu.ID="editor.contrib.autoFormat",cu);M_=yM([Qg(1,Je),Qg(2,Ga),Qg(3,$D)],M_);var du;let N_=(du=class{constructor(e,t,i){this.editor=e,this._languageFeaturesService=t,this._instantiationService=i,this._callOnDispose=new we,this._callOnModel=new we,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(KD,this.editor,e,2,xa.None,$t.None,!1).catch(Vi))}},du.ID="editor.contrib.formatOnPaste",du);N_=yM([Qg(1,Je),Qg(2,Bt)],N_);class ZV extends ge{constructor(){super({id:"editor.action.formatDocument",label:w("formatDocument.label","Format Document"),alias:"Format Document",precondition:ie.and(T.notInCompositeEditor,T.writable,T.hasDocumentFormattingProvider),kbOpts:{kbExpr:T.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(Bt);await e.get(dp).showWhile(i.invokeFunction(rO,t,1,xa.None,$t.None,!0),250)}}}class XV extends ge{constructor(){super({id:"editor.action.formatSelection",label:w("formatSelection.label","Format Selection"),alias:"Format Selection",precondition:ie.and(T.writable,T.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:T.editorTextFocus,primary:Dn(2089,2084),weight:100},contextMenuOpts:{when:T.hasNonEmptySelection,group:"1_modification",order:1.31}})}async run(e,t){if(!t.hasModel())return;const i=e.get(Bt),n=t.getModel(),s=t.getSelections().map(a=>a.isEmpty()?new O(a.startLineNumber,1,a.startLineNumber,n.getLineMaxColumn(a.startLineNumber)):a);await e.get(dp).showWhile(i.invokeFunction(KD,t,s,1,xa.None,$t.None,!0),250)}}Zt(M_.ID,M_,2);Zt(N_.ID,N_,2);Q(ZV);Q(XV);Gi.registerCommand("editor.action.format",async o=>{const e=o.get(xn).getFocusedCodeEditor();if(!e||!e.hasModel())return;const t=o.get(Bn);e.getSelection().isEmpty()?await t.executeCommand("editor.action.formatDocument"):await t.executeCommand("editor.action.formatSelection")});var YV=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},jw=function(o,e){return function(t,i){e(t,i,o)}};class Fh{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 US extends Fh{constructor(e,t,i){super(),this.id=e,this.parent=t,this.symbol=i,this.children=new Map}}class SM extends Fh{constructor(e,t,i,n){super(),this.id=e,this.parent=t,this.label=i,this.order=n,this.children=new Map}}class va extends Fh{static create(e,t,i){const n=new Kn(i),s=new va(t.uri),r=e.ordered(t),a=r.map((h,u)=>{const g=Fh.findId(`provider_${u}`,s),f=new SM(g,s,h.displayName??"Unknown Outline Provider",u);return Promise.resolve(h.provideDocumentSymbols(t,n.token)).then(v=>{for(const _ of v||[])va._makeOutlineElement(_,f);return f},v=>(Cn(v),f)).then(v=>{Fh.empty(v)?v.remove():s._groups.set(g,v)})}),c=e.onDidChange(()=>{const h=e.ordered(t);Yr(h,r)||n.cancel()});return Promise.all(a).then(()=>n.token.isCancellationRequested&&!i.isCancellationRequested?va.create(e,t,i):s._compact()).finally(()=>{n.dispose(),c.dispose(),n.dispose()})}static _makeOutlineElement(e,t){const i=Fh.findId(e,t),n=new US(i,t,e);if(e.children)for(const s of e.children)va._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=Da.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 US?e.push(t.symbol):e.push(...Da.map(t.children.values(),i=>i.symbol));return e.sort((t,i)=>O.compareRangesUsingStarts(t.range,i.range))}asListOfDocumentSymbols(){const e=this.getTopLevelSymbols(),t=[];return va._flattenDocumentSymbols(t,e,""),t.sort((i,n)=>Qe.compare(O.getStartPosition(i.range),O.getStartPosition(n.range))||Qe.compare(O.getEndPosition(n.range),O.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&&va._flattenDocumentSymbols(e,n.children,n.name)}}const Np=qa("IOutlineModelService");let jS=class{constructor(e,t,i){this._languageFeaturesService=e,this._disposables=new we,this._cache=new up(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()||!Yr(s.provider,n)){const a=new Kn;s={versionId:e.getVersionId(),provider:n,promiseCnt:0,source:a,promise:va.create(i,e,a.token),model:void 0},this._cache.set(e.id,s);const c=Date.now();s.promise.then(h=>{s.model=h,this._debounceInformation.update(e,Date.now()-c)}).catch(h=>{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()}}};jS=YV([jw(0,Je),jw(1,yo),jw(2,Cs)],jS);Ka(Np,jS,1);Gi.registerCommand("_executeDocumentSymbolProvider",async function(o,...e){const[t]=e;Si(Ri.isUri(t));const i=o.get(Np),s=await o.get(wr).createModelReference(t);try{return(await i.getOrCreate(s.object.textEditorModel,$t.None)).getTopLevelSymbols()}finally{s.dispose()}});const Nr=class Nr extends Se{constructor(e,t){super(),this.contextKeyService=e,this.model=t,this.inlineCompletionVisible=Nr.inlineSuggestionVisible.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentation=Nr.inlineSuggestionHasIndentation.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentationLessThanTabSize=Nr.inlineSuggestionHasIndentationLessThanTabSize.bindTo(this.contextKeyService),this.suppressSuggestions=Nr.suppressSuggestions.bindTo(this.contextKeyService),this._register(dn(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(dn(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:c,lines:h}=a.parts[0],u=h[0],g=n.textModel.getLineIndentColumn(a.lineNumber);if(c<=g){let v=_y(u);v===-1&&(v=u.length-1),s=v>0;const _=n.textModel.getOptions().tabSize;r=aO.visibleColumnFromColumn(u,v+1,_)<_}}this.inlineCompletionSuggestsIndentation.set(s),this.inlineCompletionSuggestsIndentationLessThanTabSize.set(r)}))}};Nr.inlineSuggestionVisible=new di("inlineSuggestionVisible",!1,w("inlineSuggestionVisible","Whether an inline suggestion is visible")),Nr.inlineSuggestionHasIndentation=new di("inlineSuggestionHasIndentation",!1,w("inlineSuggestionHasIndentation","Whether the inline suggestion starts with whitespace")),Nr.inlineSuggestionHasIndentationLessThanTabSize=new di("inlineSuggestionHasIndentationLessThanTabSize",!0,w("inlineSuggestionHasIndentationLessThanTabSize","Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab")),Nr.suppressSuggestions=new di("inlineSuggestionSuppressSuggestions",void 0,w("suppressSuggestions","Whether suggestions should be suppressed for the current suggestion"));let $s=Nr;function QV(o){const e=new we,t=e.add(GD());return e.add(dn(i=>{t.setStyle(o.read(i))})),e}class Of{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 ZD([...this.parts.map(s=>new Ha(O.fromPositions(new Qe(1,s.column)),s.lines.join(`
27
+ `)))]).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 R_{constructor(e,t,i){this.column=e,this.text=t,this.preview=i,this.lines=xb(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 $S{constructor(e,t,i,n=0){this.lineNumber=e,this.columnRange=t,this.text=i,this.additionalReservedLineCount=n,this.parts=[new R_(this.columnRange.endColumnExclusive,this.text,!1)],this.newLines=xb(this.text)}renderForScreenReader(e){return this.newLines.join(`
28
+ `)}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 UI(o,e){return Yr(o,e,CM)}function CM(o,e){return o===e?!0:!o||!e?!1:o instanceof Of&&e instanceof Of||o instanceof $S&&e instanceof $S?o.equals(e):!1}const JV=[];function e4(){return JV}class xM{constructor(e,t){if(this.startColumn=e,this.endColumnExclusive=t,e>t)throw new Lu(`startColumn ${e} cannot be after endColumnExclusive ${t}`)}toRange(e){return new O(e,this.startColumn,e,this.endColumnExclusive)}equals(e){return this.startColumn===e.startColumn&&this.endColumnExclusive===e.endColumnExclusive}}function LM(o,e){const t=new we,i=o.createDecorationsCollection();return t.add(lO({debugName:()=>`Apply decorations from ${e.debugName}`},n=>{const s=e.read(n);i.set(s)})),t.add({dispose:()=>{i.clear()}}),t}function t4(o,e){return new Qe(o.lineNumber+e.lineNumber-1,e.lineNumber===1?o.column+e.column-1:e.column)}function jI(o,e){return new Qe(o.lineNumber-e.lineNumber+1,o.lineNumber-e.lineNumber===0?o.column-e.column+1:o.column)}var i4=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},n4=function(o,e){return function(t,i){e(t,i,o)}};const $I="ghost-text";let qS=class extends Se{constructor(e,t,i){super(),this.editor=e,this.model=t,this.languageService=i,this.isDisposed=no(this,!1),this.currentTextModel=Bs(this,this.editor.onDidChangeModel,()=>this.editor.getModel()),this.uiState=Ei(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 $S?r.columnRange:void 0,c=[],h=[];function u(y,S){if(h.length>0){const x=h[h.length-1];S&&x.decorations.push(new yf(x.content.length+1,x.content.length+1+y[0].length,S,0)),x.content+=y[0],y=y.slice(1)}for(const x of y)h.push({content:x,decorations:S?[new yf(1,x.length+1,S,0)]:[]})}const g=s.getLineContent(r.lineNumber);let f,v=0;for(const y of r.parts){let S=y.lines;f===void 0?(c.push({column:y.column,text:S[0],preview:y.preview}),S=S.slice(1)):u([g.substring(v,y.column-1)],void 0),S.length>0&&(u(S,$I),f===void 0&&y.column<=g.length&&(f=y.column)),v=y.column-1}f!==void 0&&u([g.substring(v)],void 0);const _=f!==void 0?new xM(f,g.length+1):void 0;return{replacedRange:a,inlineTexts:c,additionalLines:h,hiddenRange:_,lineNumber:r.lineNumber,additionalReservedLineCount:this.model.minReservedLineCount.read(n),targetTextModel:s}}),this.decorations=Ei(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:O.fromPositions(new Qe(s.lineNumber,a.column)),options:{description:$I,after:{content:a.text,inlineClassName:a.preview?"ghost-text-decoration-preview":"ghost-text-decoration",cursorStops:Th.Left},showIfCollapsed:!0}});return r}),this.additionalLinesWidget=this._register(new s4(this.editor,this.languageService.languageIdCodec,Ei(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(nn(()=>{this.isDisposed.set(!0,void 0)})),this._register(LM(this.editor,this.decorations))}ownsViewZone(e){return this.additionalLinesWidget.viewZoneId===e}};qS=i4([n4(2,br)],qS);class s4 extends Se{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=Dc("editorOptionChanged",Nn.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(dn(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 c=document.createElement("div");o4(c,s,t,this.editor.getOptions(),this.languageIdCodec),this._viewZoneId=r.addZone({afterLineNumber:e,heightInLines:a,domNode:c,afterColumnAffinity:1})}})}}function o4(o,e,t,i,n){const s=i.get(33),r=i.get(118),a="none",c=i.get(95),h=i.get(51),u=i.get(50),g=i.get(67),f=new YD(1e4);f.appendString('<div class="suggest-preview-text">');for(let y=0,S=t.length;y<S;y++){const x=t[y],E=x.content;f.appendString('<div class="view-line'),f.appendString('" style="top:'),f.appendString(String(y*g)),f.appendString('px;width:1000000px;">');const M=tE(E),F=cO(E),R=dO.createEmpty(E,n);QD(new JD(u.isMonospace&&!s,u.canUseHalfwidthRightwardsArrow,E,!1,M,F,0,R,x.decorations,e,0,u.spaceWidth,u.middotWidth,u.wsmiddotWidth,r,a,c,h!==hO.OFF,null),f),f.appendString("</div>")}f.appendString("</div>"),eE(o,u);const v=f.build(),_=qI?qI.createHTML(v):v;o.innerHTML=_}const qI=XD("editorGhostText",{createHTML:o=>o});function r4(o,e){const t=new pO,i=new gO(t,h=>e.getLanguageConfiguration(h)),n=new uO(new a4([o]),i),s=fO(n,[],void 0,!0);let r="";const a=o.getLineContent();function c(h,u){if(h.kind===2)if(c(h.openingBracket,u),u=mg(u,h.openingBracket.length),h.child&&(c(h.child,u),u=mg(u,h.child.length)),h.closingBracket)c(h.closingBracket,u),u=mg(u,h.closingBracket.length);else{const f=i.getSingleLanguageBracketTokens(h.openingBracket.languageId).findClosingTokenText(h.openingBracket.bracketIds);r+=f}else if(h.kind!==3){if(h.kind===0||h.kind===1)r+=a.substring(SL(u),SL(mg(u,h.length)));else if(h.kind===4)for(const g of h.children)c(g,u),u=mg(u,g.length)}}return c(s,mO),r}class a4{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 IM(o,e,t,i,n=$t.None,s){const r=e instanceof Qe?d4(e,t):e,a=o.all(t),c=new _O;for(const x of a)x.groupId&&c.add(x.groupId,x);function h(x){if(!x.yieldsToGroupIds)return[];const E=[];for(const M of x.yieldsToGroupIds||[]){const F=c.get(M);for(const R of F)E.push(R)}return E}const u=new Map,g=new Set;function f(x,E){if(E=[...E,x],g.has(x))return E;g.add(x);try{const M=h(x);for(const F of M){const R=f(F,E);if(R)return R}}finally{g.delete(x)}}function v(x){const E=u.get(x);if(E)return E;const M=f(x,[]);M&&Cn(new Error(`Inline completions: cyclic yield-to dependency detected. Path: ${M.map(R=>R.toString?R.toString():""+R).join(" -> ")}`));const F=new gb;return u.set(x,F.p),(async()=>{var R;if(!M){const Z=h(x);for(const q of Z){const he=await v(q);if(he&&he.items.length>0)return}}try{return e instanceof Qe?await x.provideInlineCompletions(t,e,i,n):await((R=x.provideInlineEdits)==null?void 0:R.call(x,t,e,i,n))}catch(Z){Cn(Z);return}})().then(R=>F.complete(R),R=>F.error(R)),F.p}const _=await Promise.all(a.map(async x=>({provider:x,completions:await v(x)}))),y=new Map,S=[];for(const x of _){const E=x.completions;if(!E)continue;const M=new c4(E,x.provider);S.push(M);for(const F of E.items){const R=A_.from(F,M,r,t,s);y.set(R.hash(),R)}}return new l4(Array.from(y.values()),new Set(y.keys()),S)}class l4{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 c4{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 A_{static from(e,t,i,n,s){let r,a,c=e.range?O.lift(e.range):i;if(typeof e.insertText=="string"){if(r=e.insertText,s&&e.completeBracketPairs){r=KI(r,c.getStartPosition(),n,s);const h=r.length-e.insertText.length;h!==0&&(c=new O(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn+h))}a=void 0}else if("snippet"in e.insertText){const h=e.insertText.snippet.length;if(s&&e.completeBracketPairs){e.insertText.snippet=KI(e.insertText.snippet,c.getStartPosition(),n,s);const g=e.insertText.snippet.length-h;g!==0&&(c=new O(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn+g))}const u=new Td().parse(e.insertText.snippet);u.children.length===1&&u.children[0]instanceof zs?(r=u.children[0].value,a=void 0):(r=u.toString(),a={snippet:e.insertText.snippet,range:c})}else vO(e.insertText);return new A_(r,e.command,c,r,a,e.additionalTextEdits||e4(),e,t)}constructor(e,t,i,n,s,r,a,c){this.filterText=e,this.command=t,this.range=i,this.insertText=n,this.snippetInfo=s,this.additionalTextEdits=r,this.sourceInlineCompletion=a,this.source=c,e=e.replace(/\r\n|\r/g,`
29
+ `),n=e.replace(/\r\n|\r/g,`
30
+ `)}withRange(e){return new A_(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 Ha(this.range,this.insertText)}}function d4(o,e){const t=e.getWordAtPosition(o),i=e.getLineMaxColumn(o.lineNumber);return t?new O(o.lineNumber,t.startColumn,o.lineNumber,i):O.fromPositions(o,o.with(void 0,i))}function KI(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?r4(a,i):o}function Ac(o,e,t){const i=t?o.range.intersectRanges(t):o.range;if(!i)return o;const n=e.getValueInRange(i,1),s=bp(n,o.text),r=t_.ofText(n.substring(0,s)).addToPosition(o.range.getStartPosition()),a=o.text.substring(s),c=O.fromPositions(r,o.range.getEndPosition());return new Ha(c,a)}function kM(o,e){return o.text.startsWith(e.text)&&h4(o.range,e.range)}function GI(o,e,t,i,n=0){let s=Ac(o,e);if(s.range.endLineNumber!==s.range.startLineNumber)return;const r=e.getLineContent(s.range.startLineNumber),a=ts(r).length;if(s.range.startColumn-1<=a){const _=ts(s.text).length,y=r.substring(s.range.startColumn-1,a),[S,x]=[s.range.getStartPosition(),s.range.getEndPosition()],E=S.column+y.length<=x.column?S.delta(0,y.length):x,M=O.fromPositions(E,x),F=s.text.startsWith(y)?s.text.substring(y.length):s.text.substring(_);s=new Ha(M,F)}const h=e.getValueInRange(s.range),u=u4(h,s.text);if(!u)return;const g=s.range.startLineNumber,f=new Array;if(t==="prefix"){const _=u.filter(y=>y.originalLength===0);if(_.length>1||_.length===1&&_[0].originalStart!==h.length)return}const v=s.text.length-n;for(const _ of u){const y=s.range.startColumn+_.originalStart+_.originalLength;if(t==="subwordSmart"&&i&&i.lineNumber===s.range.startLineNumber&&y<i.column||_.originalLength>0)return;if(_.modifiedLength===0)continue;const S=_.modifiedStart+_.modifiedLength,x=Math.max(_.modifiedStart,Math.min(S,v)),E=s.text.substring(_.modifiedStart,x),M=s.text.substring(x,Math.max(_.modifiedStart,S));E.length>0&&f.push(new R_(y,E,!1)),M.length>0&&f.push(new R_(y,M,!0))}return new Of(g,f)}function h4(o,e){return e.getStartPosition().equals(o.getStartPosition())&&e.getEndPosition().isBeforeOrEqual(o.getEndPosition())}let Er;function u4(o,e){if((Er==null?void 0:Er.originalValue)===o&&(Er==null?void 0:Er.newValue)===e)return Er==null?void 0:Er.changes;{let t=XI(o,e,!0);if(t){const i=ZI(t);if(i>0){const n=XI(o,e,!1);n&&ZI(n)<i&&(t=n)}}return Er={originalValue:o,newValue:e,changes:t},t}}function ZI(o){let e=0;for(const t of o)e+=t.originalLength;return e}function XI(o,e,t){if(o.length>5e3||e.length>5e3)return;function i(h){let u=0;for(let g=0,f=h.length;g<f;g++){const v=h.charCodeAt(g);v>u&&(u=v)}return u}const n=Math.max(i(o),i(e));function s(h){if(h<0)throw new Error("unexpected");return n+h+1}function r(h){let u=0,g=0;const f=new Int32Array(h.length);for(let v=0,_=h.length;v<_;v++)if(t&&h[v]==="("){const y=g*100+u;f[v]=s(2*y),u++}else if(t&&h[v]===")"){u=Math.max(u-1,0);const y=g*100+u;f[v]=s(2*y+1),u===0&&g++}else f[v]=h.charCodeAt(v);return f}const a=r(o),c=r(e);return new bO({getElements:()=>a},{getElements:()=>c}).ComputeDiff(!1).changes}var g4=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},YI=function(o,e){return function(t,i){e(t,i,o)}};let KS=class extends Se{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 oo),this.inlineCompletions=wy("inlineCompletions",void 0),this.suggestWidgetInlineCompletions=wy("suggestWidgetInlineCompletions",void 0),this._register(this.textModel.onDidChangeContent(()=>{this._updateOperation.clear()}))}fetch(e,t,i){var u,g;const n=new p4(e,t,this.textModel.getVersionId()),s=t.selectedSuggestionInfo?this.suggestWidgetInlineCompletions:this.inlineCompletions;if((u=this._updateOperation.value)!=null&&u.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 Kn,c=(async()=>{if((r||t.triggerKind===Pa.Automatic)&&await f4(this._debounceValue.get(this.textModel),a.token),a.token.isCancellationRequested||this._store.isDisposed||this.textModel.getVersionId()!==n.versionId)return!1;const v=new Date,_=await IM(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()-v.getTime());const S=new _4(_,n,this.textModel,this.versionId);if(i){const x=i.toInlineCompletion(void 0);i.canBeReused(this.textModel,e)&&!_.has(x)&&S.prepend(i.inlineCompletion,x.range,!0)}return this._updateOperation.clear(),jd(x=>{s.set(S,x)}),!0})(),h=new m4(n,a,c);return this._updateOperation.value=h,c}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()}};KS=g4([YI(3,Je),YI(4,zn)],KS);function f4(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 p4{constructor(e,t,i){this.position=e,this.context=t,this.versionId=i}satisfies(e){return this.position.equals(e.position)&&wO(this.context.selectedSuggestionInfo,e.context.selectedSuggestionInfo,SO())&&(e.context.triggerKind===Pa.Automatic||this.context.triggerKind===Pa.Explicit)&&this.versionId===e.versionId}}class m4{constructor(e,t,i){this.request=e,this.cancellationTokenSource=t,this.promise=i}dispose(){this.cancellationTokenSource.cancel()}}class _4{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 QI(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 QI(e,n,this._textModel,this._versionId)),this._prependedInlineCompletionItems.push(e)}}class QI{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=Ca({owner:this,equalsFn:O.equalsRange},s=>(this._modelVersion.read(s),this._textModel.getDecorationRange(this.decorationId)))}toInlineCompletion(e){return this.inlineCompletion.withRange(this._updatedRange.read(e)??$w)}toSingleTextEdit(e){return new Ha(this._updatedRange.read(e)??$w,this.inlineCompletion.insertText)}isVisible(e,t,i){const n=Ac(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,c=Math.max(0,t.column-n.range.startColumn);let h=a.substring(0,c),u=a.substring(c),g=r.substring(0,c),f=r.substring(c);const v=e.getLineIndentColumn(n.range.startLineNumber);return n.range.startColumn<=v&&(g=g.trimStart(),g.length===0&&(f=f.trimStart()),h=h.trimStart(),h.length===0&&(u=u.trimStart())),h.startsWith(g)&&!!yO(f,u)}canBeReused(e,t){const i=this._updatedRange.read(void 0);return!!i&&i.containsPosition(t)&&this.isVisible(e,t,void 0)&&t_.ofRange(i).isGreaterThanOrEqualTo(t_.ofRange(this.inlineCompletion.range))}_toFilterTextReplacement(e){return new Ha(this._updatedRange.read(e)??$w,this.inlineCompletion.filterText)}}const $w=new O(1,1,1,1),St={Visible:q1,HasFocusedSuggestion:new di("suggestWidgetHasFocusedSuggestion",!1,w("suggestWidgetHasSelection","Whether any suggestion is focused")),DetailsVisible:new di("suggestWidgetDetailsVisible",!1,w("suggestWidgetDetailsVisible","Whether suggestion details are visible")),MultipleSuggestions:new di("suggestWidgetMultipleSuggestions",!1,w("suggestWidgetMultipleSuggestions","Whether there are multiple suggestions to pick from")),MakesTextEdit:new di("suggestionMakesTextEdit",!0,w("suggestionMakesTextEdit","Whether inserting the current suggestion yields in a change or has everything already been typed")),AcceptSuggestionsOnEnter:new di("acceptSuggestionOnEnter",!0,w("acceptSuggestionOnEnter","Whether suggestions are inserted when pressing Enter")),HasInsertAndReplaceRange:new di("suggestionHasInsertAndReplaceRange",!1,w("suggestionHasInsertAndReplaceRange","Whether the current suggestion has insert and replace behaviour")),InsertMode:new di("suggestionInsertMode",void 0,{type:"string",description:w("suggestionInsertMode","Whether the default behaviour is to insert or replace")}),CanResolve:new di("suggestionCanResolve",!1,w("suggestionCanResolve","Whether the current suggestion supports to resolve further details"))},Il=new We("suggestWidgetStatusBar");class v4{constructor(e,t,i,n){var s;this.position=e,this.completion=t,this.container=i,this.provider=n,this.isInvalid=!1,this.score=vf.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,O.isIRange(t.range)?(this.editStart=new Qe(t.range.startLineNumber,t.range.startColumn),this.editInsertEnd=new Qe(t.range.endLineNumber,t.range.endColumn),this.editReplaceEnd=new Qe(t.range.endLineNumber,t.range.endColumn),this.isInvalid=this.isInvalid||O.spansMultipleLines(t.range)||t.range.startLineNumber!==e.lineNumber):(this.editStart=new Qe(t.range.insert.startLineNumber,t.range.insert.startColumn),this.editInsertEnd=new Qe(t.range.insert.endLineNumber,t.range.insert.endColumn),this.editReplaceEnd=new Qe(t.range.replace.endLineNumber,t.range.replace.endColumn),this.isInvalid=this.isInvalid||O.spansMultipleLines(t.range.insert)||O.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 qs(!0);this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,e)).then(n=>{Object.assign(this.completion,n),this._resolveDuration=i.elapsed()},n=>{Ql(n)&&(this._resolveCache=void 0,this._resolveDuration=void 0)}).finally(()=>{t.dispose()})}return this._resolveCache}}const Nv=class Nv{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}};Nv.default=new Nv;let Ff=Nv;class b4{constructor(e,t,i,n){this.items=e,this.needsClipboard=t,this.durations=i,this.disposable=n}}async function J1(o,e,t,i=Ff.default,n={triggerKind:0},s=$t.None){const r=new qs;t=t.clone();const a=e.getWordAtPosition(t),c=a?new O(t.lineNumber,a.startColumn,t.lineNumber,a.endColumn):O.fromPositions(t),h={replace:c,insert:c.setEndPosition(t.lineNumber,t.column)},u=[],g=new we,f=[];let v=!1;const _=(S,x,E)=>{var F;let M=!1;if(!x)return M;for(const R of x.suggestions)if(!i.kindFilter.has(R.kind)){if(!i.showDeprecated&&((F=R==null?void 0:R.tags)!=null&&F.includes(1)))continue;R.range||(R.range=h),R.sortText||(R.sortText=typeof R.label=="string"?R.label:R.label.label),!v&&R.insertTextRules&&R.insertTextRules&4&&(v=Td.guessNeedsClipboard(R.insertText)),u.push(new v4(t,R,x,S)),M=!0}return iE(x)&&g.add(x),f.push({providerName:S._debugDisplayName??"unknown_provider",elapsedProvider:x.duration??-1,elapsedOverall:E.elapsed()}),M},y=(async()=>{})();for(const S of o.orderedGroups(e)){let x=!1;if(await Promise.all(S.map(async E=>{if(i.providerItemsToReuse.has(E)){const M=i.providerItemsToReuse.get(E);M.forEach(F=>u.push(F)),x=x||M.length>0;return}if(!(i.providerFilter.size>0&&!i.providerFilter.has(E)))try{const M=new qs,F=await E.provideCompletionItems(e,t,n,s);x=_(E,F,M)||x}catch(M){Cn(M)}})),x||s.isCancellationRequested)break}return await y,s.isCancellationRequested?(g.dispose(),Promise.reject(new fb)):new b4(u.sort(S4(i.snippetSortOrder)),v,{entries:f,elapsed:r.elapsed()},g)}function e0(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 w4(o,e){if(o.completion.kind!==e.completion.kind){if(o.completion.kind===27)return-1;if(e.completion.kind===27)return 1}return e0(o,e)}function y4(o,e){if(o.completion.kind!==e.completion.kind){if(o.completion.kind===27)return 1;if(e.completion.kind===27)return-1}return e0(o,e)}const Gb=new Map;Gb.set(0,w4);Gb.set(2,y4);Gb.set(1,e0);function S4(o){return Gb.get(o)}Gi.registerCommand("_executeCompletionItemProvider",async(o,...e)=>{const[t,i,n,s]=e;Si(Ri.isUri(t)),Si(Qe.isIPosition(i)),Si(typeof n=="string"||!n),Si(typeof s=="number"||!s);const{completionProvider:r}=o.get(Je),a=await o.get(wr).createModelReference(t);try{const c={incomplete:!1,suggestions:[]},h=[],u=a.object.textEditorModel.validatePosition(i),g=await J1(r,a.object.textEditorModel,u,void 0,{triggerCharacter:n??void 0,triggerKind:n?1:0});for(const f of g.items)h.length<(s??0)&&h.push(f.resolve($t.None)),c.incomplete=c.incomplete||f.container.incomplete,c.suggestions.push(f.completion);try{return await Promise.all(h),c}finally{setTimeout(()=>g.disposable.dispose(),100)}}finally{a.dispose()}});function C4(o,e){var t;(t=o.getContribution("editor.contrib.suggestController"))==null||t.triggerSuggest(new Set().add(e),void 0,!0)}class Hh{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 JI(o,e=ub){return CO(o,e)?o.charAt(0).toUpperCase()+o.slice(1):o}var x4=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},L4=function(o,e){return function(t,i){e(t,i,o)}};class ek{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 tk{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=ts(s,0,this._selection.startColumn-1);let a=r;e.snippet.walk(h=>h===e?!1:(h instanceof zs&&(a=ts(xb(h.value).pop())),!0));const c=bp(a,r);i=i.replace(/(\r\n|\r|\n)(.*)/g,(h,u,g)=>`${u}${a.substr(c)}${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 ik{constructor(e,t){this._labelService=e,this._model=t}resolve(e){const{name:t}=e;if(t==="TM_FILENAME")return jg(this._model.uri.fsPath);if(t==="TM_FILENAME_BASE"){const i=jg(this._model.uri.fsPath),n=i.lastIndexOf(".");return n<=0?i:i.slice(0,n)}else{if(t==="TM_DIRECTORY")return xO(this._model.uri.fsPath)==="."?"":this._labelService.getUriLabel(Xx(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 nk{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=>!LO(n));if(i.length===this._selectionCount)return i[this._selectionIdx]}return t}}}let O_=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}}};O_=x4([L4(2,zn)],O_);const Rr=class Rr{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 Rr.dayNames[this._date.getDay()];if(t==="CURRENT_DAY_NAME_SHORT")return Rr.dayNamesShort[this._date.getDay()];if(t==="CURRENT_MONTH_NAME")return Rr.monthNames[this._date.getMonth()];if(t==="CURRENT_MONTH_NAME_SHORT")return Rr.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,c=a<10?"0"+a:a;return n+r+":"+c}}};Rr.dayNames=[w("Sunday","Sunday"),w("Monday","Monday"),w("Tuesday","Tuesday"),w("Wednesday","Wednesday"),w("Thursday","Thursday"),w("Friday","Friday"),w("Saturday","Saturday")],Rr.dayNamesShort=[w("SundayShort","Sun"),w("MondayShort","Mon"),w("TuesdayShort","Tue"),w("WednesdayShort","Wed"),w("ThursdayShort","Thu"),w("FridayShort","Fri"),w("SaturdayShort","Sat")],Rr.monthNames=[w("January","January"),w("February","February"),w("March","March"),w("April","April"),w("May","May"),w("June","June"),w("July","July"),w("August","August"),w("September","September"),w("October","October"),w("November","November"),w("December","December")],Rr.monthNamesShort=[w("JanuaryShort","Jan"),w("FebruaryShort","Feb"),w("MarchShort","Mar"),w("AprilShort","Apr"),w("MayShort","May"),w("JuneShort","Jun"),w("JulyShort","Jul"),w("AugustShort","Aug"),w("SeptemberShort","Sep"),w("OctoberShort","Oct"),w("NovemberShort","Nov"),w("DecemberShort","Dec")];let F_=Rr;class sk{constructor(e){this._workspaceService=e}resolve(e){if(!this._workspaceService)return;const t=IO(this._workspaceService.getWorkspace());if(!kO(t)){if(e.name==="WORKSPACE_NAME")return this._resolveWorkspaceName(t);if(e.name==="WORKSPACE_FOLDER")return this._resoveWorkspacePath(t)}}_resolveWorkspaceName(e){if(CL(e))return jg(e.uri.path);let t=jg(e.configPath.path);return t.endsWith(xL)&&(t=t.substr(0,t.length-xL.length-1)),t}_resoveWorkspacePath(e){if(CL(e))return JI(e.uri.fsPath);const t=jg(e.configPath.path);let i=e.configPath.fsPath;return i.endsWith(t)&&(i=i.substr(0,i.length-t.length-1)),i?JI(i):"/"}}class ok{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 Hb()}}var I4=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},k4=function(o,e){return function(t,i){e(t,i,o)}},Qo;const Do=class Do{constructor(e,t,i){this._editor=e,this._snippet=t,this._snippetLineLeadingWhitespace=i,this._offset=-1,this._nestingLevel=1,this._placeholderGroups=LL(t.placeholders,vo.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=O.fromPositions(e.getPositionAt(this._offset+n),e.getPositionAt(this._offset+n+s)),a=i.isFinalTabstop?Do._decor.inactiveFinal:Do._decor.inactive,c=t.addDecoration(r,a);this._placeholderDecorations.set(i,c)}})}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),c=this._editor.getModel().getValueInRange(a),h=s.transform.resolve(c).split(/\r\n|\r|\n/);for(let u=1;u<h.length;u++)h[u]=this._editor.getModel().normalizeIndentation(this._snippetLineLeadingWhitespace+h[u]);n.push(pn.replace(a,h.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 c=this._placeholderDecorations.get(a),h=this._editor.getModel().getDecorationRange(c);r.push(new _t(h.startLineNumber,h.startColumn,h.endLineNumber,h.endColumn)),t=t&&this._hasPlaceholderBeenCollapsed(a),n.changeDecorationOptions(c,a.isFinalTabstop?Do._decor.activeFinal:Do._decor.active),s.add(a);for(const u of this._snippet.enclosingPlaceholders(a)){const g=this._placeholderDecorations.get(u);n.changeDecorationOptions(g,u.isFinalTabstop?Do._decor.activeFinal:Do._decor.active),s.add(u)}}for(const[a,c]of this._placeholderDecorations)s.has(a)||n.changeDecorationOptions(c,a.isFinalTabstop?Do._decor.inactiveFinal:Do._decor.inactive);return r});return t?this.move(e):i??[]}_hasPlaceholderBeenCollapsed(e){let t=e;for(;t;){if(t instanceof vo){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 ig,!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 c of s._snippet.placeholderInfo.all)c.isFinalTabstop?c.index=n.index+(r+1)/this._nestingLevel:c.index=n.index+c.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 c of s._snippet.placeholders){const h=s._snippet.offset(c),u=s._snippet.fullLen(c),g=O.fromPositions(t.getPositionAt(s._offset+h),t.getPositionAt(s._offset+h+u)),f=i.addDecoration(g,Do._decor.inactive);this._placeholderDecorations.set(c,f)}}this._placeholderGroups=LL(this._snippet.placeholders,vo.compareByIndex)})}};Do._decor={active:oi.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:oi.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:oi.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:oi.register({description:"snippet-placeholder-4",stickiness:1,className:"finish-snippet-placeholder"})};let H_=Do;const rk={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let W_=Qo=class{static adjustWhitespace(e,t,i,n,s){const r=e.getLineContent(t.lineNumber),a=ts(r,0,t.column-1);let c;return n.walk(h=>{if(!(h instanceof zs)||h.parent instanceof ig||s&&!s.has(h))return!0;const u=h.value.split(/\r\n|\r|\n/);if(i){const f=n.offset(h);if(f===0)u[0]=e.normalizeIndentation(u[0]);else{c=c??n.toString();const v=c.charCodeAt(f-1);(v===10||v===13)&&(u[0]=e.normalizeIndentation(a+u[0]))}for(let v=1;v<u.length;v++)u[v]=e.normalizeIndentation(a+u[v])}const g=u.join(e.getEOL());return g!==h.value&&(h.parent.replace(h,[new zs(g)]),c=void 0),!0}),a}static adjustSelection(e,t,i,n){if(i!==0||n!==0){const{positionLineNumber:s,positionColumn:r}=t,a=r-i,c=r+n,h=e.validateRange({startLineNumber:s,startColumn:a,endLineNumber:s,endColumn:c});t=_t.createWithDirection(h.startLineNumber,h.startColumn,h.endLineNumber,h.endColumn,t.getDirection())}return t}static createEditsAndSnippetsFromSelections(e,t,i,n,s,r,a,c,h){const u=[],g=[];if(!e.hasModel())return{edits:u,snippets:g};const f=e.getModel(),v=e.invokeWithinContext(F=>F.get(_u)),_=e.invokeWithinContext(F=>new ik(F.get(_f),f)),y=()=>a,S=f.getValueInRange(Qo.adjustSelection(f,e.getSelection(),i,0)),x=f.getValueInRange(Qo.adjustSelection(f,e.getSelection(),0,n)),E=f.getLineFirstNonWhitespaceColumn(e.getSelection().positionLineNumber),M=e.getSelections().map((F,R)=>({selection:F,idx:R})).sort((F,R)=>O.compareRangesUsingStarts(F.selection,R.selection));for(const{selection:F,idx:R}of M){let Z=Qo.adjustSelection(f,F,i,0),q=Qo.adjustSelection(f,F,0,n);S!==f.getValueInRange(Z)&&(Z=F),x!==f.getValueInRange(q)&&(q=F);const he=F.setStartPosition(Z.startLineNumber,Z.startColumn).setEndPosition(q.endLineNumber,q.endColumn),pe=new Td().parse(t,!0,s),Ce=he.getStartPosition(),Pe=Qo.adjustWhitespace(f,Ce,r||R>0&&E!==f.getLineFirstNonWhitespaceColumn(F.positionLineNumber),pe);pe.resolveVariables(new ek([_,new nk(y,R,M.length,e.getOption(79)==="spread"),new tk(f,F,R,c),new O_(f,F,h),new F_,new sk(v),new ok])),u[R]=pn.replace(he,pe.toString()),u[R].identifier={major:R,minor:0},u[R]._isTracked=!0,g[R]=new H_(e,pe,Pe)}return{edits:u,snippets:g}}static createEditsAndSnippetsFromEdits(e,t,i,n,s,r,a){if(!e.hasModel()||t.length===0)return{edits:[],snippets:[]};const c=[],h=e.getModel(),u=new Td,g=new Ip,f=new ek([e.invokeWithinContext(_=>new ik(_.get(_f),h)),new nk(()=>s,0,e.getSelections().length,e.getOption(79)==="spread"),new tk(h,e.getSelection(),0,r),new O_(h,e.getSelection(),a),new F_,new sk(e.invokeWithinContext(_=>_.get(_u))),new ok]);t=t.sort((_,y)=>O.compareRangesUsingStarts(_.range,y.range));let v=0;for(let _=0;_<t.length;_++){const{range:y,template:S}=t[_];if(_>0){const R=t[_-1].range,Z=O.fromPositions(R.getEndPosition(),y.getStartPosition()),q=new zs(h.getValueInRange(Z));g.appendChild(q),v+=q.value.length}const x=u.parseFragment(S,g);Qo.adjustWhitespace(h,y.getStartPosition(),!0,g,new Set(x)),g.resolveVariables(f);const E=g.toString(),M=E.slice(v);v=E.length;const F=pn.replace(y,M);F.identifier={major:_,minor:0},F._isTracked=!0,c.push(F)}return u.ensureFinalTabstop(g,i,!0),{edits:c,snippets:[new H_(e,g,"")]}}constructor(e,t,i=rk,n){this._editor=e,this._template=t,this._options=i,this._languageConfigurationService=n,this._templateMerges=[],this._snippets=[]}dispose(){fs(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"?Qo.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):Qo.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=>_t.fromPositions(s.range.getEndPosition()))}),this._editor.revealRange(this._editor.getSelections()[0])}merge(e,t=rk){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,e]);const{edits:i,snippets:n}=Qo.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(c=>!!c.identifier);for(let c=0;c<n.length;c++)n[c].initialize(r[c].textChange);const a=n[0].isTrivialSnippet;if(!a){for(const c of this._snippets)c.merge(n);console.assert(n.length===0)}return this._snippets[0].hasPlaceholder&&!a?this._move(void 0):r.map(c=>_t.fromPositions(c.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(O.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(O.compareRangesUsingStarts);for(const[i,n]of t){if(n.length!==e.length){t.delete(i);continue}n.sort(O.compareRangesUsingStarts);for(let s=0;s<n.length;s++)if(!n[s].containsRange(e[s])){t.delete(i);continue}}return t.size>0}};W_=Qo=I4([k4(3,zn)],W_);var D4=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},um=function(o,e){return function(t,i){e(t,i,o)}},kh;const ak={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};var Vr;let ys=(Vr=class{static get(e){return e.getContribution(kh.ID)}constructor(e,t,i,n,s){this._editor=e,this._logService=t,this._languageFeaturesService=i,this._languageConfigurationService=s,this._snippetListener=new we,this._modelVersionId=-1,this._inSnippet=kh.InSnippetMode.bindTo(n),this._hasNextTabstop=kh.HasNextTabstop.bindTo(n),this._hasPrevTabstop=kh.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"?ak:{...ak,...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?(Si(typeof e=="string"),this._session.merge(e,t)):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new W_(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:(u,g)=>{if(!this._session||u!==this._editor.getModel()||!Qe.equals(this._editor.getPosition(),g))return;const{activeChoice:f}=this._session;if(!f||f.choice.options.length===0)return;const v=u.getValueInRange(f.range),_=!!f.choice.options.find(S=>S.value===v),y=[];for(let S=0;S<f.choice.options.length;S++){const x=f.choice.options[S];y.push({kind:13,label:x.value,insertText:x.value,sortText:"a".repeat(S+1),range:f.range,filterText:_?`${v}_${x.value}`:void 0,command:{id:"jumpToNextSnippetPlaceholder",title:w("next","Go to next placeholder...")}})}return{suggestions:y}}},s=this._editor.getModel();let r,a=!1;const c=()=>{r==null||r.dispose(),a=!1},h=()=>{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:h,disable:c}}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(()=>{C4(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()}},kh=Vr,Vr.ID="snippetController2",Vr.InSnippetMode=new di("inSnippetMode",!1,w("inSnippetMode","Whether the editor in current in snippet mode")),Vr.HasNextTabstop=new di("hasNextTabstop",!1,w("hasNextTabstop","Whether there is a next tab stop when in snippet mode")),Vr.HasPrevTabstop=new di("hasPrevTabstop",!1,w("hasPrevTabstop","Whether there is a previous tab stop when in snippet mode")),Vr);ys=kh=D4([um(1,$d),um(2,Je),um(3,wi),um(4,zn)],ys);Zt(ys.ID,ys,4);const Zb=Rs.bindToContribution(ys.get);it(new Zb({id:"jumpToNextSnippetPlaceholder",precondition:ie.and(ys.InSnippetMode,ys.HasNextTabstop),handler:o=>o.next(),kbOpts:{weight:130,kbExpr:T.textInputFocus,primary:2}}));it(new Zb({id:"jumpToPrevSnippetPlaceholder",precondition:ie.and(ys.InSnippetMode,ys.HasPrevTabstop),handler:o=>o.prev(),kbOpts:{weight:130,kbExpr:T.textInputFocus,primary:1026}}));it(new Zb({id:"leaveSnippet",precondition:ys.InSnippetMode,handler:o=>o.cancel(!0),kbOpts:{weight:130,kbExpr:T.textInputFocus,primary:9,secondary:[1033]}}));it(new Zb({id:"acceptSnippet",precondition:ys.InSnippetMode,handler:o=>o.finish()}));var E4=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},qw=function(o,e){return function(t,i){e(t,i,o)}};let GS=class extends Se{get isAcceptingPartially(){return this._isAcceptingPartially}constructor(e,t,i,n,s,r,a,c,h,u,g,f){super(),this.textModel=e,this.selectedSuggestItem=t,this._textModelVersionId=i,this._positions=n,this._debounceValue=s,this._suggestPreviewEnabled=r,this._suggestPreviewMode=a,this._inlineSuggestMode=c,this._enabled=h,this._instantiationService=u,this._commandService=g,this._languageConfigurationService=f,this._source=this._register(this._instantiationService.createInstance(KS,this.textModel,this._textModelVersionId,this._debounceValue)),this._isActive=no(this,!1),this._forceUpdateExplicitlySignal=t1(this),this._selectedInlineCompletionId=no(this,void 0),this._primaryPosition=Ei(this,_=>this._positions.read(_)[0]??new Qe(1,1)),this._isAcceptingPartially=!1,this._preserveCurrentCompletionReasons=new Set([_a.Redo,_a.Undo,_a.AcceptWord]),this._fetchInlineCompletionsPromise=nE({owner:this,createEmptyChangeSummary:()=>({preserveCurrentCompletion:!1,inlineCompletionTriggerKind:Pa.Automatic}),handleChange:(_,y)=>(_.didChange(this._textModelVersionId)&&this._preserveCurrentCompletionReasons.has(this._getReason(_.change))?y.preserveCurrentCompletion=!0:_.didChange(this._forceUpdateExplicitlySignal)&&(y.inlineCompletionTriggerKind=Pa.Explicit),!0)},(_,y)=>{if(this._forceUpdateExplicitlySignal.read(_),!(this._enabled.read(_)&&this.selectedSuggestItem.read(_)||this._isActive.read(_))){this._source.cancelUpdate();return}this._textModelVersionId.read(_);const x=this._source.suggestWidgetInlineCompletions.get(),E=this.selectedSuggestItem.read(_);if(x&&!E){const q=this._source.inlineCompletions.get();jd(he=>{(!q||x.request.versionId>q.request.versionId)&&this._source.inlineCompletions.set(x.clone(),he),this._source.clearSuggestWidgetInlineCompletions(he)})}const M=this._primaryPosition.read(_),F={triggerKind:y.inlineCompletionTriggerKind,selectedSuggestionInfo:E==null?void 0:E.toSelectedSuggestionInfo()},R=this.selectedInlineCompletion.get(),Z=y.preserveCurrentCompletion||R!=null&&R.forwardStable?R:void 0;return this._source.fetch(M,F,Z)}),this._filteredInlineCompletionItems=Ca({owner:this,equalsFn:yy()},_=>{const y=this._source.inlineCompletions.read(_);if(!y)return[];const S=this._primaryPosition.read(_);return y.inlineCompletions.filter(E=>E.isVisible(this.textModel,S,_))}),this.selectedInlineCompletionIndex=Ei(this,_=>{const y=this._selectedInlineCompletionId.read(_),S=this._filteredInlineCompletionItems.read(_),x=this._selectedInlineCompletionId===void 0?-1:S.findIndex(E=>E.semanticId===y);return x===-1?(this._selectedInlineCompletionId.set(void 0,void 0),0):x}),this.selectedInlineCompletion=Ei(this,_=>{const y=this._filteredInlineCompletionItems.read(_),S=this.selectedInlineCompletionIndex.read(_);return y[S]}),this.activeCommands=Ca({owner:this,equalsFn:yy()},_=>{var y;return((y=this.selectedInlineCompletion.read(_))==null?void 0:y.inlineCompletion.source.inlineCompletions.commands)??[]}),this.lastTriggerKind=this._source.inlineCompletions.map(this,_=>_==null?void 0:_.request.context.triggerKind),this.inlineCompletionsCount=Ei(this,_=>{if(this.lastTriggerKind.read(_)===Pa.Explicit)return this._filteredInlineCompletionItems.read(_).length}),this.state=Ca({owner:this,equalsFn:(_,y)=>!_||!y?_===y:UI(_.ghostTexts,y.ghostTexts)&&_.inlineCompletion===y.inlineCompletion&&_.suggestItem===y.suggestItem},_=>{const y=this.textModel,S=this.selectedSuggestItem.read(_);if(S){const x=Ac(S.toSingleTextEdit(),y),E=this._computeAugmentation(x,_);if(!this._suggestPreviewEnabled.read(_)&&!E)return;const F=(E==null?void 0:E.edit)??x,R=E?E.edit.text.length-x.text.length:0,Z=this._suggestPreviewMode.read(_),q=this._positions.read(_),he=[F,...Kw(this.textModel,q,F)],pe=he.map((Pe,je)=>GI(Pe,y,Z,q[je],R)).filter(km),Ce=pe[0]??new Of(F.range.endLineNumber,[]);return{edits:he,primaryGhostText:Ce,ghostTexts:pe,inlineCompletion:E==null?void 0:E.completion,suggestItem:S}}else{if(!this._isActive.read(_))return;const x=this.selectedInlineCompletion.read(_);if(!x)return;const E=x.toSingleTextEdit(_),M=this._inlineSuggestMode.read(_),F=this._positions.read(_),R=[E,...Kw(this.textModel,F,E)],Z=R.map((q,he)=>GI(q,y,M,F[he],0)).filter(km);return Z[0]?{edits:R,primaryGhostText:Z[0],ghostTexts:Z,inlineCompletion:x,suggestItem:void 0}:void 0}}),this.ghostTexts=Ca({owner:this,equalsFn:UI},_=>{const y=this.state.read(_);if(y)return y.ghostTexts}),this.primaryGhostText=Ca({owner:this,equalsFn:CM},_=>{const y=this.state.read(_);if(y)return y==null?void 0:y.primaryGhostText}),this._register(sE(this._fetchInlineCompletionsPromise));let v;this._register(dn(_=>{var x,E;const y=this.state.read(_),S=y==null?void 0:y.inlineCompletion;if((S==null?void 0:S.semanticId)!==(v==null?void 0:v.semanticId)&&(v=S,S)){const M=S.inlineCompletion,F=M.source;(E=(x=F.provider).handleItemDidShow)==null||E.call(x,F.inlineCompletions,M.sourceInlineCompletion,M.insertText)}}))}_getReason(e){return e!=null&&e.isUndoing?_a.Undo:e!=null&&e.isRedoing?_a.Redo:this.isAcceptingPartially?_a.AcceptWord:_a.Other}async trigger(e){this._isActive.set(!0,e),await this._fetchInlineCompletionsPromise.get()}async triggerExplicitly(e){i_(e,t=>{this._isActive.set(!0,t),this._forceUpdateExplicitlySignal.trigger(t)}),await this._fetchInlineCompletionsPromise.get()}stop(e){i_(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(km);return DO(s,a=>{let c=a.toSingleTextEdit(t);return c=Ac(c,i,O.fromPositions(c.range.getStartPosition(),e.range.getEndPosition())),kM(c,e)?{completion:a,edit:c}: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 Lu;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",[pn.replace(i.range,""),...i.additionalTextEdits]),e.setPosition(i.snippetInfo.range.getStartPosition(),"inlineCompletionAccept"),(n=ys.get(e))==null||n.insert(i.snippetInfo.snippet,{undoStopBefore:!1});else{const s=t.edits,r=lk(s).map(a=>_t.fromPositions(a));e.executeEdits("inlineSuggestion.accept",[...s.map(a=>pn.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,Cn),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 c=0;a&&a.index!==void 0?a.index===0?c=a[0].length:c=a.index:c=i.length;const u=/\s+/g.exec(i);return u&&u.index!==void 0&&u.index+u[0].length<c&&(c=u.index+u[0].length),c},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 Lu;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],c=new Qe(s.lineNumber,a.column),h=a.text,u=t(c,h);if(u===h.length&&s.parts.length===1){this.accept(e);return}const g=h.substring(0,u),f=this._positions.get(),v=f[0];r.source.addRef();try{this._isAcceptingPartially=!0;try{e.pushUndoStop();const _=O.fromPositions(v,c),y=e.getModel().getValueInRange(_)+g,S=new Ha(_,y),x=[S,...Kw(this.textModel,f,S)],E=lk(x).map(M=>_t.fromPositions(M));e.executeEdits("inlineSuggestion.accept",x.map(M=>pn.replace(M.range,M.text))),e.setSelections(E,"inlineCompletionPartialAccept"),e.revealPositionInCenterIfOutsideViewport(e.getPosition(),1)}finally{this._isAcceptingPartially=!1}if(r.source.provider.handlePartialAccept){const _=O.fromPositions(r.range.getStartPosition(),t_.ofText(g).addToPosition(c)),y=e.getModel().getValueInRange(_,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=Ac(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})}};GS=E4([qw(9,Bt),qw(10,Bn),qw(11,zn)],GS);var _a;(function(o){o[o.Undo=0]="Undo",o[o.Redo=1]="Redo",o[o.AcceptWord=2]="AcceptWord",o[o.Other=3]="Other"})(_a||(_a={}));function Kw(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(O.fromPositions(i,r)),c=jI(i,s);if(c.lineNumber<1)return Vi(new Lu(`positionWithinTextEdit line number should be bigger than 0.
31
+ Invalid subtraction between ${i.toString()} and ${s.toString()}`)),[];const h=P4(t.text,c);return n.map(u=>{const g=t4(jI(u,s),r),f=o.getValueInRange(O.fromPositions(u,g)),v=bp(a,f),_=O.fromPositions(u,u.delta(0,v));return new Ha(_,h)})}function P4(o,e){let t="";const i=PO(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 lk(o){const e=EO.createSortPermutation(o,_p(s=>s.range,O.compareRangesUsingStarts)),i=new ZD(e.apply(o)).getNewRanges();return e.inverse().apply(i).map(s=>s.getEndPosition())}var T4=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},ck=function(o,e){return function(t,i){e(t,i,o)}},Ng;class t0{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 dk extends t0{constructor(){super("first")}memorize(e,t,i){}toJSON(){}fromJSON(){}}class M4 extends t0{constructor(){super("recentlyUsed"),this._cache=new up(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,c=-1;for(let h=0;h<i.length&&i[h].score[0]===s;h++){const u=`${e.getLanguageId()}/${i[h].textLabel}`,g=this._cache.peek(u);if(g&&g.touch>c&&g.type===i[h].completion.kind&&g.insertText===i[h].completion.insertText&&(c=g.touch,a=h),i[h].completion.preselect&&r===-1)return r=h}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:i1.fromString(n.type),this._cache.set(i,n);this._seq=this._cache.size}}class N4 extends t0{constructor(){super("recentlyUsedByPrefix"),this._trie=TO.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:c,insertText:h}=i[a].completion;if(c===r.type&&h===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:i1.fromString(i.type),this._trie.set(t,i)}}}var Al;let ZS=(Al=class{constructor(e,t){this._storageService=e,this._configService=t,this._disposables=new we,this._persistSoon=new Rn(()=>this._saveState(),500),this._disposables.add(e.onWillSaveState(i=>{i.reason===qx.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=Ng._strategyCtors.get(i)||dk;this._strategy=new s;try{const a=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,c=this._storageService.get(`${Ng._storagePrefix}/${i}`,a);c&&this._strategy.fromJSON(JSON.parse(c))}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(`${Ng._storagePrefix}/${this._strategy.name}`,i,t,1)}}},Ng=Al,Al._strategyCtors=new Map([["recentlyUsedByPrefix",N4],["recentlyUsed",M4],["first",dk]]),Al._storagePrefix="suggest/memories",Al);ZS=Ng=T4([ck(0,Jl),ck(1,on)],ZS);const Xb=qa("ISuggestMemories");Ka(Xb,ZS,1);var R4=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},A4=function(o,e){return function(t,i){e(t,i,o)}},XS,id;let B_=(id=class{constructor(e,t){this._editor=e,this._enabled=!1,this._ckAtEnd=XS.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)}},XS=id,id.AtEnd=new di("atEndOfWord",!1),id);B_=XS=R4([A4(1,wi)],B_);var O4=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},F4=function(o,e){return function(t,i){e(t,i,o)}},Rg,nd;let zu=(nd=class{constructor(e,t){this._editor=e,this._index=0,this._ckOtherSuggestions=Rg.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(Rg._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=Rg._moveIndex(e,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}},Rg=nd,nd.OtherSuggestions=new di("hasOtherSuggestions",!1),nd);zu=Rg=O4([F4(1,wi)],zu);class H4{constructor(e,t,i,n){this._disposables=new we,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||!io(e.item.completion.commitCharacters)){this.reset();return}if(this._active&&this._active.item.item===e.item)return;const t=new e_;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 ho=class ho{async provideSelectionRanges(e,t){const i=[];for(const n of t){const s=[];i.push(s);const r=new Map;await new Promise(a=>ho._bracketsRightYield(a,0,e,n,r)),await new Promise(a=>ho._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>=ho._maxRounds){e();break}if(!n){e();break}const c=i.bracketPairs.findNextBracket(n);if(!c){e();break}if(Date.now()-a>ho._maxDuration){setTimeout(()=>ho._bracketsRightYield(e,t+1,i,n,s));break}if(c.bracketInfo.isOpeningBracket){const u=c.bracketInfo.bracketText,g=r.has(u)?r.get(u):0;r.set(u,g+1)}else{const u=c.bracketInfo.getOpeningBrackets()[0].bracketText;let g=r.has(u)?r.get(u):0;if(g-=1,r.set(u,Math.max(0,g)),g<0){let f=s.get(u);f||(f=new oE,s.set(u,f)),f.push(c.range)}}n=c.range.getEndPosition()}}static _bracketsLeftYield(e,t,i,n,s,r){const a=new Map,c=Date.now();for(;;){if(t>=ho._maxRounds&&s.size===0){e();break}if(!n){e();break}const h=i.bracketPairs.findPrevBracket(n);if(!h){e();break}if(Date.now()-c>ho._maxDuration){setTimeout(()=>ho._bracketsLeftYield(e,t+1,i,n,s,r));break}if(h.bracketInfo.isOpeningBracket){const g=h.bracketInfo.bracketText;let f=a.has(g)?a.get(g):0;if(f-=1,a.set(g,Math.max(0,f)),f<0){const v=s.get(g);if(v){const _=v.shift();v.size===0&&s.delete(g);const y=O.fromPositions(h.range.getEndPosition(),_.getStartPosition()),S=O.fromPositions(h.range.getStartPosition(),_.getEndPosition());r.push({range:y}),r.push({range:S}),ho._addBracketLeading(i,S,r)}}}else{const g=h.bracketInfo.getOpeningBrackets()[0].bracketText,f=a.has(g)?a.get(g):0;a.set(g,f+1)}n=h.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:O.fromPositions(new Qe(n,s),t.getEndPosition())}),i.push({range:O.fromPositions(new Qe(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:O.fromPositions(new Qe(r,a),t.getEndPosition())}),i.push({range:O.fromPositions(new Qe(r,1),t.getEndPosition())}))}}};ho._maxDuration=30,ho._maxRounds=2;let z_=ho;const Ar=class Ar{static async create(e,t){if(!t.getOption(119).localityBonus||!t.hasModel())return Ar.None;const i=t.getModel(),n=t.getPosition();if(!e.canComputeWordRanges(i.uri))return Ar.None;const[s]=await new z_().provideSelectionRanges(i,[n]);if(s.length===0)return Ar.None;const r=await e.computeWordRanges(i.uri,s[0].range);if(!r)return Ar.None;const a=i.getWordUntilPosition(n);return delete r[a.word],new class extends Ar{distance(c,h){if(!n.equals(t.getPosition()))return 0;if(h.kind===17)return 2<<20;const u=typeof h.label=="string"?h.label:h.label.label,g=r[u];if(MO(g))return 2<<20;const f=n_(g,O.fromPositions(c),O.compareRangesUsingStarts),v=f>=0?g[f]:g[Math.max(0,~f-1)];let _=s.length;for(const y of s){if(!O.containsRange(y.range,v))break;_-=1}return _}}}};Ar.None=new class extends Ar{distance(){return 0}};let V_=Ar,hk=class{constructor(e,t){this.leadingLineContent=e,this.characterCountDelta=t}};class cl{constructor(e,t,i,n,s,r,a=rE.default,c=void 0){this.clipboardText=c,this._snippetCompareFn=cl._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=cl._compareCompletionItemsSnippetsUp:r==="bottom"&&(this._snippetCompareFn=cl._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=[],c=!this._options.filterGraceful||r.length>2e3?aE:NO;for(let h=0;h<r.length;h++){const u=r[h];if(u.isInvalid)continue;const g=this._itemsByProvider.get(u.provider);g?g.push(u):this._itemsByProvider.set(u.provider,[u]);const f=u.position.column-u.editStart.column,v=f+i-(u.position.column-this._column);if(n.length!==v&&(n=v===0?"":t.slice(-v),s=n.toLowerCase()),u.word=n,v===0)u.score=vf.Default;else{let _=0;for(;_<f;){const y=n.charCodeAt(_);if(y===32||y===9)_+=1;else break}if(_>=v)u.score=vf.Default;else if(typeof u.completion.filterText=="string"){const y=c(n,s,_,u.completion.filterText,u.filterTextLow,0,this._fuzzyScoreOptions);if(!y)continue;RO(u.completion.filterText,u.textLabel)===0?u.score=y:(u.score=AO(n,s,_,u.textLabel,u.labelLow,0),u.score[0]=y[0])}else{const y=c(n,s,_,u.textLabel,u.labelLow,0,this._fuzzyScoreOptions);if(!y)continue;u.score=y}}u.idx=h,u.distance=this._wordDistance.distance(u.position,u.completion),a.push(u),e.push(u.textLabel.length)}this._filteredItems=a.sort(this._snippetCompareFn),this._refilterKind=0,this._stats={pLabelLen:e.length?OO(e.length-.85,e,(h,u)=>h-u):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 cl._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 cl._compareCompletionItems(e,t)}}var W4=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)}},YS;class ac{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 B4(o,e,t){if(!e.getContextKeyValue($s.inlineSuggestionVisible.key))return!0;const i=e.getContextKeyValue($s.suppressSuggestions.key);return i!==void 0?!i:!o.getOption(62).suppressSuggestions}function z4(o,e,t){if(!e.getContextKeyValue("inlineSuggestionVisible"))return!0;const i=e.getContextKeyValue($s.suppressSuggestions.key);return i!==void 0?!i:!o.getOption(62).suppressSuggestions}let U_=YS=class{constructor(e,t,i,n,s,r,a,c,h){this._editor=e,this._editorWorkerService=t,this._clipboardService=i,this._telemetryService=n,this._logService=s,this._contextKeyService=r,this._configurationService=a,this._languageFeaturesService=c,this._envService=h,this._toDispose=new we,this._triggerCharacterListener=new we,this._triggerQuickSuggest=new cp,this._triggerState=void 0,this._completionDisposables=new we,this._onDidCancel=new jt,this._onDidTrigger=new jt,this._onDidSuggest=new jt,this.onDidCancel=this._onDidCancel.event,this.onDidTrigger=this._onDidTrigger.event,this.onDidSuggest=this._onDidSuggest.event,this._telemetryGate=0,this._currentSelection=this._editor.getSelection()||new _t(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 u=!1;this._toDispose.add(this._editor.onDidCompositionStart(()=>{u=!0})),this._toDispose.add(this._editor.onDidCompositionEnd(()=>{u=!1,this._onCompositionEnd()})),this._toDispose.add(this._editor.onDidChangeCursorSelection(g=>{u||this._onCursorChange(g)})),this._toDispose.add(this._editor.onDidChangeModelContent(()=>{!u&&this._triggerState!==void 0&&this._refilterCompletionItems()})),this._updateTriggerCharacters()}dispose(){fs(this._triggerCharacterListener),fs([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(!z4(this._editor,this._contextKeyService,this._configurationService)||ac.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="";HO(i.charCodeAt(i.length-1))?WO(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[c,h]of this._completionModel.getItemsByProvider())s.has(c)||a.set(c,h);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;Hh.isAllOff(this._editor.getOption(90))||this._editor.getOption(119).snippetsPreventQuickSuggestions&&((e=ys.get(this._editor))!=null&&e.isInSnippet())||(this.cancel(),this._triggerQuickSuggest.cancelAndSet(()=>{if(this._triggerState!==void 0||!ac.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(!Hh.isAllOff(n)){if(!Hh.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(Hh.valueFor(n,r)!=="on")return}B4(this._editor,this._contextKeyService,this._configurationService)&&this._languageFeaturesService.completionProvider.has(t)&&this.trigger({auto:!0})}},this._editor.getOption(91)))}_refilterCompletionItems(){Si(this._editor.hasModel()),Si(this._triggerState!==void 0);const e=this._editor.getModel(),t=this._editor.getPosition(),i=new ac(e,t,{...this._triggerState,refilter:!0});this._onNewContext(i)}trigger(e){var f,v,_;if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=new ac(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 Kn;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:c}=YS.createSuggestFilter(this._editor),h=new Ff(r,((f=e.completionOptions)==null?void 0:f.kindFilter)??a,(v=e.completionOptions)==null?void 0:v.providerFilter,(_=e.completionOptions)==null?void 0:_.providerItemsToReuse,c),u=V_.create(this._editorWorkerService,this._editor),g=J1(this._languageFeaturesService.completionProvider,t,this._editor.getPosition(),h,n,this._requestToken.token);Promise.all([g,u]).then(async([y,S])=>{var R;if((R=this._requestToken)==null||R.dispose(),!this._editor.hasModel())return;let x=e==null?void 0:e.clipboardText;if(!x&&y.needsClipboard&&(x=await this._clipboardService.readText()),this._triggerState===void 0)return;const E=this._editor.getModel(),M=new ac(E,this._editor.getPosition(),e),F={...rE.default,firstMatchCanBeWeak:!this._editor.getOption(119).matchOnWordStartOnly};if(this._completionModel=new cl(y.items,this._context.column,{leadingLineContent:M.leadingLineContent,characterCountDelta:M.column-this._context.column},S,this._editor.getOption(119),this._editor.getOption(113),F,x),this._completionDisposables.add(y.disposable),this._onNewContext(M),this._reportDurationsTelemetry(y.durations),!this._envService.isBuilt||this._envService.isExtensionDevelopment)for(const Z of y.items)Z.isInvalid&&this._logService.warn(`[suggest] did IGNORE invalid completion item from ${Z.provider._debugDisplayName}`,Z.completion)}).catch(Vi)}_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(ts(e.leadingLineContent)!==ts(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(ac.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=ac.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})}}}}};U_=YS=W4([tl(1,Ga),tl(2,Gu),tl(3,vr),tl(4,$d),tl(5,wi),tl(6,on),tl(7,Je),tl(8,FO)],U_);const Rv=class Rv{constructor(e,t){this._disposables=new we,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 c=i[a];if(r.getValueLengthInRange(c)>Rv._maxSelectionLength)return;this._lastOvertyped[a]={value:r.getValueInRange(c),multiline:c.startLineNumber!==c.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()}};Rv._maxSelectionLength=51200;let QS=Rv;var V4=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)}};let JS=class{constructor(e,t,i,n,s){this._menuId=t,this._menuService=n,this._contextKeyService=s,this._menuDisposables=new we,this.element=Ve(e,qe(".suggest-status-bar"));const r=(a=>a instanceof xu?i.createInstance(BO,a,{useComma:!0}):void 0);this._leftActions=new uf(this.element,{actionViewItemProvider:r}),this._rightActions=new uf(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()}};JS=V4([Gw(2,Bt),Gw(3,Ud),Gw(4,wi)],JS);var U4=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},j4=function(o,e){return function(t,i){e(t,i,o)}};function i0(o){return!!o&&!!(o.completion.documentation||o.completion.detail&&o.completion.detail!==o.completion.label)}let eC=class{constructor(e,t){this._editor=e,this._onDidClose=new jt,this.onDidClose=this._onDidClose.event,this._onDidChangeContents=new jt,this.onDidChangeContents=this._onDidChangeContents.event,this._disposables=new we,this._renderDisposeable=new we,this._borderWidth=1,this._size=new $i(330,0),this.domNode=qe(".suggest-details"),this.domNode.classList.add("no-docs"),this._markdownRenderer=t.createInstance(Yu,{editor:e}),this._body=qe(".body"),this._scrollbar=new lE(this._body,{alwaysConsumeMouseWheel:!0}),Ve(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=Ve(this._body,qe(".header")),this._close=Ve(this._header,qe("span"+xi.asCSSSelector(xt.close))),this._close.title=w("details.close","Close"),this._type=Ve(this._header,qe("p.type")),this._docs=Ve(this._body,qe("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`,c=`${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=c,this._close.style.width=c}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=w("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]}
32
+ `,r+=`prefix: ${e.word??"(no prefix)"}
33
+ `,r+=`word: ${e.completion.filterText?e.completion.filterText+" (filterText)":e.textLabel}
34
+ `,r+=`distance: ${e.distance} (localityBonus-setting)
35
+ `,r+=`index: ${e.idx}, based on ${e.completion.sortText&&`sortText: "${e.completion.sortText}"`||"label"}
36
+ `,r+=`commit_chars: ${(s=e.completion.commitCharacters)==null?void 0:s.join("")}
37
+ `,n=new us().appendCodeblock("empty",r),i=`Provider: ${e.provider._debugDisplayName}`}if(!t&&!i0(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,Fo(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gmi.test(r))}else Gr(this._type),this._type.title="",Js(this._type),this.domNode.classList.add("no-type");if(Gr(this._docs),typeof n=="string")this._docs.classList.remove("markdown-docs"),this._docs.textContent=n;else if(n){this._docs.classList.add("markdown-docs"),Gr(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 $i(e,t);$i.equals(i,this._size)||(this._size=i,zO(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}};eC=U4([j4(1,Bt)],eC);class $4{constructor(e,t){this.widget=e,this._editor=t,this.allowEditorOverflow=!0,this._disposables=new we,this._added=!1,this._preferAlignAtTop=!0,this._resizable=new A1,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 c=!1;a.west&&(r=n.width-a.dimension.width,c=!0),a.north&&(s=n.height-a.dimension.height,c=!0),c&&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=pp(this.getDomNode().ownerDocument.body),s=this.widget.getLayoutInfo(),r=new $i(220,2*s.lineHeight),a=e.top,c=(function(){const R=n.width-(e.left+e.width+s.borderWidth+s.horizontalPadding),Z=-s.borderWidth+e.left+e.width,q=new $i(R,n.height-e.top-s.borderHeight-s.verticalPadding),he=q.with(void 0,e.top+e.height-s.borderHeight-s.verticalPadding);return{top:a,left:Z,fit:R-t.width,maxSizeTop:q,maxSizeBottom:he,minSize:r.with(Math.min(R,r.width))}})(),h=(function(){const R=e.left-s.borderWidth-s.horizontalPadding,Z=Math.max(s.horizontalPadding,e.left-t.width-s.borderWidth),q=new $i(R,n.height-e.top-s.borderHeight-s.verticalPadding),he=q.with(void 0,e.top+e.height-s.borderHeight-s.verticalPadding);return{top:a,left:Z,fit:R-t.width,maxSizeTop:q,maxSizeBottom:he,minSize:r.with(Math.min(R,r.width))}})(),u=(function(){const R=e.left,Z=-s.borderWidth+e.top+e.height,q=new $i(e.width-s.borderHeight,n.height-e.top-e.height-s.verticalPadding);return{top:Z,left:R,fit:q.height-t.height,maxSizeBottom:q,maxSizeTop:q,minSize:r.with(q.width)}})(),g=[c,h,u],f=g.find(R=>R.fit>=0)??g.sort((R,Z)=>Z.fit-R.fit)[0],v=e.top+e.height-s.borderHeight;let _,y=t.height;const S=Math.max(f.maxSizeTop.height,f.maxSizeBottom.height);y>S&&(y=S);let x;i?y<=f.maxSizeTop.height?(_=!0,x=f.maxSizeTop):(_=!1,x=f.maxSizeBottom):y<=f.maxSizeBottom.height?(_=!1,x=f.maxSizeBottom):(_=!0,x=f.maxSizeTop);let{top:E,left:M}=f;!_&&y>e.height&&(E=v-y);const F=this._editor.getDomNode();if(F){const R=F.getBoundingClientRect();E-=R.top,M-=R.left}this._applyTopLeft({left:M,top:E}),this._resizable.enableSashes(!_,f===c,_,f!==c),this._resizable.minSize=f.minSize,this._resizable.maxSize=x,this._resizable.layout(y,Math.min(x.width,t.width)),this.widget.layout(this._resizable.size.width,this._resizable.size.height)}_applyTopLeft(e){this._topLeft=e,this._editor.layoutOverlayWidget(this)}}var qr;(function(o){o[o.FILE=0]="FILE",o[o.FOLDER=1]="FOLDER",o[o.ROOT_FOLDER=2]="ROOT_FOLDER"})(qr||(qr={}));const q4=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function gm(o,e,t,i,n){if(xi.isThemeIcon(n))return[`codicon-${n.id}`,"predefined-file-icon"];if(Ri.isUri(n))return[];const s=i===qr.ROOT_FOLDER?["rootfolder-icon"]:i===qr.FOLDER?["folder-icon"]:["file-icon"];if(t){let r;if(t.scheme===Ds.data)r=s_.parseMetaData(t).get(s_.META_DATA_LABEL);else{const a=t.path.match(q4);a?(r=fm(a[2].toLowerCase()),a[1]&&s.push(`${fm(a[1].toLowerCase())}-name-dir-icon`)):r=fm(t.authority.toLowerCase())}if(i===qr.ROOT_FOLDER)s.push(`${r}-root-name-folder-icon`);else if(i===qr.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 c=r.split(".");for(let h=1;h<c.length;h++)s.push(`${c.slice(h).join(".")}-ext-file-icon`)}s.push("ext-file-icon")}const a=K4(o,e,t);a&&s.push(`${fm(a)}-lang-file-icon`)}}return s}function K4(o,e,t){if(!t)return null;let i=null;if(t.scheme===Ds.data){const s=s_.parseMetaData(t).get(s_.META_DATA_MIME);s&&(i=e.getLanguageIdByMimeType(s))}else{const n=o.getModel(t);n&&(i=n.getLanguageId())}return i&&i!==bf?i:e.guessLanguageIdByFilepathOrFirstLine(t)}function fm(o){return o.replace(/[\s]/g,"/")}var G4=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},Zw=function(o,e){return function(t,i){e(t,i,o)}};function DM(o){return`suggest-aria-id:${o}`}const Z4=yn("suggest-more-info",xt.chevronRight,w("suggestMoreInfoIcon","Icon for more information in the suggest widget."));var lr;const X4=new(lr=class{extract(e,t){if(e.textLabel.match(lr._regexStrict))return t[0]=e.textLabel,!0;if(e.completion.detail&&e.completion.detail.match(lr._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=lr._regexRelaxed.exec(i);if(n&&(n.index===0||n.index+n[0].length===i.length))return t[0]=n[0],!0}return!1}},lr._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*\))/,lr._regexStrict=new RegExp(`^${lr._regexRelaxed.source}$`,"i"),lr);let tC=class{constructor(e,t,i,n){this._editor=e,this._modelService=t,this._languageService=i,this._themeService=n,this._onDidToggleDetails=new jt,this.onDidToggleDetails=this._onDidToggleDetails.event,this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(e){const t=new we,i=e;i.classList.add("show-file-icons");const n=Ve(e,qe(".icon")),s=Ve(n,qe("span.colorspan")),r=Ve(e,qe(".contents")),a=Ve(r,qe(".main")),c=Ve(a,qe(".icon-label.codicon")),h=Ve(a,qe("span.left")),u=Ve(a,qe("span.right")),g=new kD(h,{supportHighlights:!0,supportIcons:!0});t.add(g);const f=Ve(h,qe("span.signature-label")),v=Ve(h,qe("span.qualifier-label")),_=Ve(u,qe("span.details-label")),y=Ve(u,qe("span.readMore"+xi.asCSSSelector(Z4)));return y.title=w("readMore","Read More"),{root:i,left:h,right:u,icon:n,colorspan:s,iconLabel:g,iconContainer:c,parametersLabel:f,qualifierLabel:v,detailsLabel:_,readMore:y,disposables:t,configureFont:()=>{const x=this._editor.getOptions(),E=x.get(50),M=E.getMassagedFontFamily(),F=E.fontFeatureSettings,R=x.get(120)||E.fontSize,Z=x.get(121)||E.lineHeight,q=E.fontWeight,he=E.letterSpacing,pe=`${R}px`,Ce=`${Z}px`,Pe=`${he}px`;i.style.fontSize=pe,i.style.fontWeight=q,i.style.letterSpacing=Pe,a.style.fontFamily=M,a.style.fontFeatureSettings=F,a.style.lineHeight=Ce,n.style.height=Ce,n.style.width=Ce,y.style.height=Ce,y.style.width=Ce}}}renderElement(e,t,i){i.configureFont();const{completion:n}=e;i.root.id=DM(t),i.colorspan.style.backgroundColor="";const s={labelEscapeNewLines:!0,matches:yb(e.score)},r=[];if(n.kind===19&&X4.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=gm(this._modelService,this._languageService,Ri.from({scheme:"fake",path:e.textLabel}),qr.FILE),c=gm(this._modelService,this._languageService,Ri.from({scheme:"fake",path:n.detail}),qr.FILE);s.extraClasses=a.length>c.length?a:c}else n.kind===23&&this._themeService.getFileIconTheme().hasFolderIcons?(i.icon.className="icon hide",i.iconContainer.className="icon hide",s.extraClasses=[gm(this._modelService,this._languageService,Ri.from({scheme:"fake",path:e.textLabel}),qr.FOLDER),gm(this._modelService,this._languageService,Ri.from({scheme:"fake",path:n.detail}),qr.FOLDER)].flat()):(i.icon.className="icon hide",i.iconContainer.className="",i.iconContainer.classList.add("suggest-icon",...xi.asClassNameArray(i1.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=Xw(n.detail||""),i.root.classList.add("string-label")):(i.parametersLabel.textContent=Xw(n.label.detail||""),i.detailsLabel.textContent=Xw(n.label.description||""),i.root.classList.remove("string-label")),this._editor.getOption(119).showInlineDetails?Fo(i.detailsLabel):Js(i.detailsLabel),i0(e)?(i.right.classList.add("can-expand-details"),Fo(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"),Js(i.readMore),i.readMore.onmousedown=null,i.readMore.onclick=null)}disposeTemplate(e){e.disposables.dispose()}};tC=G4([Zw(1,Cs),Zw(2,br),Zw(3,qo)],tC);function Xw(o){return o.replace(/\r\n|\r|\n/g,"")}var Y4=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)}},Dh;Ke("editorSuggestWidget.background",cE,w("editorSuggestWidgetBackground","Background color of the suggest widget."));Ke("editorSuggestWidget.border",VO,w("editorSuggestWidgetBorder","Border color of the suggest widget."));const Q4=Ke("editorSuggestWidget.foreground",vp,w("editorSuggestWidgetForeground","Foreground color of the suggest widget."));Ke("editorSuggestWidget.selectedForeground",dE,w("editorSuggestWidgetSelectedForeground","Foreground color of the selected entry in the suggest widget."));Ke("editorSuggestWidget.selectedIconForeground",UO,w("editorSuggestWidgetSelectedIconForeground","Icon foreground color of the selected entry in the suggest widget."));const J4=Ke("editorSuggestWidget.selectedBackground",hE,w("editorSuggestWidgetSelectedBackground","Background color of the selected entry in the suggest widget."));Ke("editorSuggestWidget.highlightForeground",uE,w("editorSuggestWidgetHighlightForeground","Color of the match highlights in the suggest widget."));Ke("editorSuggestWidget.focusHighlightForeground",jO,w("editorSuggestWidgetFocusHighlightForeground","Color of the match highlights in the suggest widget when an item is focused."));Ke("editorSuggestWidgetStatus.foreground",Zr(Q4,.5),w("editorSuggestWidgetStatusForeground","Foreground color of the suggest widget status."));class eU{constructor(e,t){this._service=e,this._key=`suggestWidget.size/${t.getEditorType()}/${t instanceof $o}`}restore(){const e=this._service.get(this._key,0)??"";try{const t=JSON.parse(e);if($i.is(t))return $i.lift(t)}catch{}}store(e){this._service.store(this._key,JSON.stringify(e),0,1)}reset(){this._service.remove(this._key,0)}}var Ol;let iC=(Ol=class{constructor(e,t,i,n,s){this.editor=e,this._storageService=t,this._state=0,this._isAuto=!1,this._pendingLayout=new oo,this._pendingShowDetails=new oo,this._ignoreFocusEvents=!1,this._forceRenderingAbove=!1,this._explainMode=!1,this._showTimeout=new cp,this._disposables=new we,this._onDidSelect=new IL,this._onDidFocus=new IL,this._onDidHide=new jt,this._onDidShow=new jt,this.onDidSelect=this._onDidSelect.event,this.onDidFocus=this._onDidFocus.event,this.onDidHide=this._onDidHide.event,this.onDidShow=this._onDidShow.event,this._onDetailsKeydown=new jt,this.onDetailsKeyDown=this._onDetailsKeydown.event,this.element=new A1,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new tU(this,e),this._persistedSize=new eU(t,e);class r{constructor(v,_,y=!1,S=!1){this.persistedSize=v,this.currentSize=_,this.persistHeight=y,this.persistWidth=S}}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(f=>{var v,_;if(this._resize(f.dimension.width,f.dimension.height),a&&(a.persistHeight=a.persistHeight||!!f.north||!!f.south,a.persistWidth=a.persistWidth||!!f.east||!!f.west),!!f.done){if(a){const{itemHeight:y,defaultSize:S}=this.getLayoutInfo(),x=Math.round(y/2);let{width:E,height:M}=this.element.size;(!a.persistHeight||Math.abs(a.currentSize.height-M)<=x)&&(M=((v=a.persistedSize)==null?void 0:v.height)??S.height),(!a.persistWidth||Math.abs(a.currentSize.width-E)<=x)&&(E=((_=a.persistedSize)==null?void 0:_.width)??S.width),this._persistedSize.store(new $i(E,M))}this._contentWidget.unlockPreference(),a=void 0}})),this._messageElement=Ve(this.element.domNode,qe(".message")),this._listElement=Ve(this.element.domNode,qe(".tree"));const c=this._disposables.add(s.createInstance(eC,this.editor));c.onDidClose(this.toggleDetails,this,this._disposables),this._details=new $4(c,this.editor);const h=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(119).showIcons);h();const u=s.createInstance(tC,this.editor);this._disposables.add(u),this._disposables.add(u.onDidToggleDetails(()=>this.toggleDetails())),this._list=new Ux("SuggestWidget",this._listElement,{getHeight:f=>this.getLayoutInfo().itemHeight,getTemplateId:f=>"suggestion"},[u],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>"option",getWidgetAriaLabel:()=>w("suggest","Suggest"),getWidgetRole:()=>"listbox",getAriaLabel:f=>{let v=f.textLabel;if(typeof f.completion.label!="string"){const{detail:x,description:E}=f.completion.label;x&&E?v=w("label.full","{0} {1}, {2}",v,x,E):x?v=w("label.detail","{0} {1}",v,x):E&&(v=w("label.desc","{0}, {1}",v,E))}if(!f.isResolved||!this._isDetailsVisible())return v;const{documentation:_,detail:y}=f.completion,S=e1("{0}{1}",y||"",_?typeof _=="string"?_:_.value:"");return w("ariaCurrenttSuggestionReadDetails","{0}, docs: {1}",v,S)}}}),this._list.style(gE({listInactiveFocusBackground:J4,listInactiveFocusOutline:xd})),this._status=s.createInstance(JS,this.element.domNode,Il);const g=()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(119).showStatusBar);g(),this._disposables.add(n.onDidColorThemeChange(f=>this._onThemeChange(f))),this._onThemeChange(n.getColorTheme()),this._disposables.add(this._list.onMouseDown(f=>this._onListMouseDownOrTap(f))),this._disposables.add(this._list.onTap(f=>this._onListMouseDownOrTap(f))),this._disposables.add(this._list.onDidChangeSelection(f=>this._onListSelection(f))),this._disposables.add(this._list.onDidChangeFocus(f=>this._onListFocus(f))),this._disposables.add(this.editor.onDidChangeCursorSelection(()=>this._onCursorSelectionChanged())),this._disposables.add(this.editor.onDidChangeConfiguration(f=>{f.hasChanged(119)&&(g(),h()),this._completionModel&&(f.hasChanged(50)||f.hasChanged(120)||f.hasChanged(121))&&this._list.splice(0,this._list.length,this._completionModel.items)})),this._ctxSuggestWidgetVisible=St.Visible.bindTo(i),this._ctxSuggestWidgetDetailsVisible=St.DetailsVisible.bindTo(i),this._ctxSuggestWidgetMultipleSuggestions=St.MultipleSuggestions.bindTo(i),this._ctxSuggestWidgetHasFocusedSuggestion=St.HasFocusedSuggestion.bindTo(i),this._disposables.add(Fa(this._details.widget.domNode,"keydown",f=>{this._onDetailsKeydown.fire(f)})),this._disposables.add(this.editor.onMouseDown(f=>this._onEditorMouseDown(f)))}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=gf(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=qn(async s=>{const r=hf(()=>{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:DM(i)}))}).catch(Vi)),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:Js(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=Dh.LOADING_MESSAGE,Js(this._listElement,this._status.element),Fo(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,wu(Dh.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=Dh.NO_SUGGESTIONS_MESSAGE,Js(this._listElement,this._status.element),Fo(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,wu(Dh.NO_SUGGESTIONS_MESSAGE);break;case 3:Js(this._messageElement),Fo(this._listElement,this._status.element),this._show();break;case 4:Js(this._messageElement),Fo(this._listElement,this._status.element),this._show();break;case 5:Js(this._messageElement),Fo(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=hf(()=>this._setState(1),t)))}showSuggestions(e,t,i,n,s){var c,h;if(this._contentWidget.setPosition(this.editor.getPosition()),(c=this._loadingTimeout)==null||c.dispose(),(h=this._currentSuggestionDetails)==null||h.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=kL(kc(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")):(i0(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=kL(kc(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=pp(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 $i(s,n),this._contentWidget.setPreference(2);else{const c=t.width-i.borderHeight-2*i.horizontalPadding;s>c&&(s=c);const h=this._completionModel?this._completionModel.stats.pLabelLen*i.typicalHalfwidthCharacterWidth:s,u=i.statusBarHeight+this._list.contentHeight+i.borderHeight,g=i.itemHeight+i.statusBarHeight,f=Ps(this.editor.getDomNode()),v=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),_=f.top+v.top+v.height,y=Math.min(t.height-_-i.verticalPadding,u),S=f.top+v.top-i.verticalPadding,x=Math.min(S,u);let E=Math.min(Math.max(x,y)+i.borderHeight,u);n===((r=this._cappedHeight)==null?void 0:r.capped)&&(n=this._cappedHeight.wanted),n<g&&(n=g),n>E&&(n=E),n>y||this._forceRenderingAbove&&S>150?(this._contentWidget.setPreference(1),this.element.enableSashes(!0,!0,!1,!1),E=x):(this._contentWidget.setPreference(2),this.element.enableSashes(!1,!0,!0,!1),E=y),this.element.preferredSize=new $i(h,i.defaultSize.height),this.element.maxSize=new $i(c,E),this.element.minSize=new $i(220,g),this._cappedHeight=n===u?{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=$O(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 $i(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}},Dh=Ol,Ol.LOADING_MESSAGE=w("suggestWidget.loading","Loading..."),Ol.NO_SUGGESTIONS_MESSAGE=w("suggestWidget.noSuggestions","No suggestions."),Ol);iC=Dh=Y4([pm(1,Jl),pm(2,wi),pm(3,qo),pm(4,Bt)],iC);class tU{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 $i(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 iU=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},mh=function(o,e){return function(t,i){e(t,i,o)}},nC;class nU{constructor(e,t){if(this._model=e,this._position=t,this._decorationOptions=oi.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(O.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 sd;let Wo=(sd=class{static get(e){return e.getContribution(nC.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 oo,this._toDispose=new we,this._selectors=new sU(g=>g.priority),this._onWillInsertSuggestItem=new jt,this.onWillInsertSuggestItem=this._onWillInsertSuggestItem.event,this.editor=e,this.model=s.createInstance(U_,this.editor),this._selectors.register({priority:0,select:(g,f,v)=>this._memoryService.select(g,f,v)});const c=St.InsertMode.bindTo(n);c.set(e.getOption(119).insertMode),this._toDispose.add(this.model.onDidTrigger(()=>c.set(e.getOption(119).insertMode))),this.widget=this._toDispose.add(new bw(kc(e.getDomNode()),()=>{const g=this._instantiationService.createInstance(iC,this.editor);this._toDispose.add(g),this._toDispose.add(g.onDidSelect(S=>this._insertSuggestion(S,0),this));const f=new H4(this.editor,g,this.model,S=>this._insertSuggestion(S,2));this._toDispose.add(f);const v=St.MakesTextEdit.bindTo(this._contextKeyService),_=St.HasInsertAndReplaceRange.bindTo(this._contextKeyService),y=St.CanResolve.bindTo(this._contextKeyService);return this._toDispose.add(nn(()=>{v.reset(),_.reset(),y.reset()})),this._toDispose.add(g.onDidFocus(({item:S})=>{const x=this.editor.getPosition(),E=S.editStart.column,M=x.column;let F=!0;this.editor.getOption(1)==="smart"&&this.model.state===2&&!S.completion.additionalTextEdits&&!(S.completion.insertTextRules&4)&&M-E===S.completion.insertText.length&&(F=this.editor.getModel().getValueInRange({startLineNumber:x.lineNumber,startColumn:E,endLineNumber:x.lineNumber,endColumn:M})!==S.completion.insertText),v.set(F),_.set(!Qe.equals(S.editInsertEnd,S.editReplaceEnd)),y.set(!!S.provider.resolveCompletionItem||!!S.completion.documentation||S.completion.detail!==S.completion.label)})),this._toDispose.add(g.onDetailsKeyDown(S=>{if(S.toKeyCodeChord().equals(new DL(!0,!1,!1,!1,33))||Qr&&S.toKeyCodeChord().equals(new DL(!1,!1,!1,!0,33))){S.stopPropagation();return}S.toKeyCodeChord().isModifierKey()||this.editor.focus()})),g})),this._overtypingCapturer=this._toDispose.add(new bw(kc(e.getDomNode()),()=>this._toDispose.add(new QS(this.editor,this.model)))),this._alternatives=this._toDispose.add(new bw(kc(e.getDomNode()),()=>this._toDispose.add(new zu(this.editor,this._contextKeyService)))),this._toDispose.add(s.createInstance(B_,e)),this._toDispose.add(this.model.onDidTrigger(g=>{this.widget.value.showTriggered(g.auto,g.shy?250:50),this._lineSuffix.value=new nU(this.editor.getModel(),g.position)})),this._toDispose.add(this.model.onDidSuggest(g=>{if(g.triggerOptions.shy)return;let f=-1;for(const _ of this._selectors.itemsOrderedByPriorityDesc)if(f=_.select(this.editor.getModel(),this.editor.getPosition(),g.completionModel.items),f!==-1)break;if(f===-1&&(f=0),this.model.state===0)return;let v=!1;if(g.triggerOptions.auto){const _=this.editor.getOption(119);_.selectionMode==="never"||_.selectionMode==="always"?v=_.selectionMode==="never":_.selectionMode==="whenTriggerCharacter"?v=g.triggerOptions.triggerKind!==1:_.selectionMode==="whenQuickSuggestion"&&(v=g.triggerOptions.triggerKind===1&&!g.triggerOptions.refilter)}this.widget.value.showSuggestions(g.completionModel,f,g.isFrozen,g.triggerOptions.auto,v)})),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 h=St.AcceptSuggestionsOnEnter.bindTo(n),u=()=>{const g=this.editor.getOption(1);h.set(g==="on"||g==="smart")};this._toDispose.add(this.editor.onDidChangeConfiguration(()=>u())),u()}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=ys.get(this.editor);if(!i)return;this._onWillInsertSuggestItem.fire({item:e.item});const n=this.editor.getModel(),s=n.getAlternativeVersionId(),{item:r}=e,a=[],c=new Kn;t&1||this.editor.pushUndoStop();const h=this.getOverwriteInfo(r,!!(t&8));this._memoryService.memorize(n,this.editor.getPosition(),r);const u=r.isResolved;let g=-1,f=-1;if(Array.isArray(r.completion.additionalTextEdits)){this.model.cancel();const _=yu.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",r.completion.additionalTextEdits.map(y=>{let S=O.lift(y.range);if(S.startLineNumber===r.position.lineNumber&&S.startColumn>r.position.column){const x=this.editor.getPosition().column-r.position.column,E=x,M=O.spansMultipleLines(S)?0:x;S=new O(S.startLineNumber,S.startColumn+E,S.endLineNumber,S.endColumn+M)}return pn.replaceMove(S,y.text)})),_.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!u){const _=new qs;let y;const S=n.onDidChangeContent(F=>{if(F.isFlush){c.cancel(),S.dispose();return}for(const R of F.changes){const Z=O.getEndPosition(R.range);(!y||Qe.isBefore(Z,y))&&(y=Z)}}),x=t;t|=2;let E=!1;const M=this.editor.onWillType(()=>{M.dispose(),E=!0,x&2||this.editor.pushUndoStop()});a.push(r.resolve(c.token).then(()=>{if(!r.completion.additionalTextEdits||c.token.isCancellationRequested)return;if(y&&r.completion.additionalTextEdits.some(R=>Qe.isBefore(y,O.getStartPosition(R.range))))return!1;E&&this.editor.pushUndoStop();const F=yu.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map(R=>pn.replaceMove(O.lift(R.range),R.text))),F.restoreRelativeVerticalPositionOfCursor(this.editor),(E||!(x&2))&&this.editor.pushUndoStop(),!0}).then(F=>{this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)",_.elapsed(),F),f=F===!0?1:F===!1?0:-2}).finally(()=>{S.dispose(),M.dispose()}))}let{insertText:v}=r.completion;if(r.completion.insertTextRules&4||(v=Td.escape(v)),this.model.cancel(),i.insert(v,{overwriteBefore:h.overwriteBefore,overwriteAfter:h.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===j_.id)this.model.trigger({auto:!0,retrigger:!0});else{const _=new qs;a.push(this._commandService.executeCommand(r.completion.command.id,...r.completion.command.arguments?[...r.completion.command.arguments]:[]).catch(y=>{r.completion.extensionId?Cn(y):Vi(y)}).finally(()=>{g=_.elapsed()}))}t&4&&this._alternatives.value.set(e,_=>{for(c.cancel();n.canUndo();){s!==n.getAlternativeVersionId()&&n.undo(),this._insertSuggestion(_,3|(t&8?8:0));break}}),this._alertCompletionItem(r),Promise.all(a).finally(()=>{this._reportSuggestionAcceptedTelemetry(r,n,u,g,f,e.index,e.model.items),this.model.clear(),c.dispose()})}_reportSuggestionAcceptedTelemetry(e,t,i,n,s,r,a){var f;if(Math.floor(Math.random()*100)===0)return;const c=new Map;for(let v=0;v<Math.min(30,a.length);v++){const _=a[v].textLabel;c.has(_)?c.get(_).push(v):c.set(_,[v])}const h=c.get(e.textLabel),g=h&&h.length>1?h[0]:-1;this._telemetryService.publicLog2("suggest.acceptedSuggestion",{extensionId:((f=e.extensionId)==null?void 0:f.value)??"unknown",providerId:e.provider._debugDisplayName??"unknown",kind:e.completion.kind,basenameHash:UD(Jr(t.uri)).toString(16),languageId:t.getLanguageId(),fileExtension:qO(t.uri),resolveInfo:e.provider.resolveCompletionItem?i?1:0:-1,resolveDuration:e.resolveDuration,commandDuration:n,additionalEditsAsync:s,index:r,firstIndex:g})}getOverwriteInfo(e,t){Si(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(io(e.completion.additionalTextEdits)){const t=w("aria.alert.snippet","Accepting '{0}' made {1} additional edits",e.textLabel,e.completion.additionalTextEdits.length);Uo(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,c=r.column;return c-a!==s.completion.insertText.length?!0:this.editor.getModel().getValueInRange({startLineNumber:r.lineNumber,startColumn:a,endLineNumber:r.lineNumber,endColumn:c})!==s.completion.insertText};Nn.once(this.model.onDidTrigger)(s=>{const r=[];Nn.any(this.model.onDidTrigger,this.model.onDidCancel)(()=>{fs(r),i()},void 0,r),this.model.onDidSuggest(({completionModel:a})=>{if(fs(r),a.items.length===0){i();return}const c=this._memoryService.select(this.editor.getModel(),this.editor.getPosition(),a.items),h=a.items[c];if(!n(h)){i();return}this.editor.pushUndoStop(),this._insertSuggestion({index:c,item:h,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)}},nC=sd,sd.ID="editor.contrib.suggestController",sd);Wo=nC=iU([mh(1,Xb),mh(2,Bn),mh(3,wi),mh(4,Bt),mh(5,$d),mh(6,vr)],Wo);class sU{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 Av=class Av extends ge{constructor(){super({id:Av.id,label:w("suggest.trigger.label","Trigger Suggest"),alias:"Trigger Suggest",precondition:ie.and(T.writable,T.hasCompletionItemProvider,St.Visible.toNegated()),kbOpts:{kbExpr:T.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(e,t,i){const n=Wo.get(t);if(!n)return;let s;i&&typeof i=="object"&&i.auto===!0&&(s=!0),n.triggerSuggest(void 0,s,void 0)}};Av.id="editor.action.triggerSuggest";let j_=Av;Zt(Wo.ID,Wo,2);Q(j_);const ro=190,xs=Rs.bindToContribution(Wo.get);it(new xs({id:"acceptSelectedSuggestion",precondition:ie.and(St.Visible,St.HasFocusedSuggestion),handler(o){o.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:ie.and(St.Visible,T.textInputFocus),weight:ro},{primary:3,kbExpr:ie.and(St.Visible,T.textInputFocus,St.AcceptSuggestionsOnEnter,St.MakesTextEdit),weight:ro}],menuOpts:[{menuId:Il,title:w("accept.insert","Insert"),group:"left",order:1,when:St.HasInsertAndReplaceRange.toNegated()},{menuId:Il,title:w("accept.insert","Insert"),group:"left",order:1,when:ie.and(St.HasInsertAndReplaceRange,St.InsertMode.isEqualTo("insert"))},{menuId:Il,title:w("accept.replace","Replace"),group:"left",order:1,when:ie.and(St.HasInsertAndReplaceRange,St.InsertMode.isEqualTo("replace"))}]}));it(new xs({id:"acceptAlternativeSelectedSuggestion",precondition:ie.and(St.Visible,T.textInputFocus,St.HasFocusedSuggestion),kbOpts:{weight:ro,kbExpr:T.textInputFocus,primary:1027,secondary:[1026]},handler(o){o.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:Il,group:"left",order:2,when:ie.and(St.HasInsertAndReplaceRange,St.InsertMode.isEqualTo("insert")),title:w("accept.replace","Replace")},{menuId:Il,group:"left",order:2,when:ie.and(St.HasInsertAndReplaceRange,St.InsertMode.isEqualTo("replace")),title:w("accept.insert","Insert")}]}));Gi.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion");it(new xs({id:"hideSuggestWidget",precondition:St.Visible,handler:o=>o.cancelSuggestWidget(),kbOpts:{weight:ro,kbExpr:T.textInputFocus,primary:9,secondary:[1033]}}));it(new xs({id:"selectNextSuggestion",precondition:ie.and(St.Visible,ie.or(St.MultipleSuggestions,St.HasFocusedSuggestion.negate())),handler:o=>o.selectNextSuggestion(),kbOpts:{weight:ro,kbExpr:T.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}}));it(new xs({id:"selectNextPageSuggestion",precondition:ie.and(St.Visible,ie.or(St.MultipleSuggestions,St.HasFocusedSuggestion.negate())),handler:o=>o.selectNextPageSuggestion(),kbOpts:{weight:ro,kbExpr:T.textInputFocus,primary:12,secondary:[2060]}}));it(new xs({id:"selectLastSuggestion",precondition:ie.and(St.Visible,ie.or(St.MultipleSuggestions,St.HasFocusedSuggestion.negate())),handler:o=>o.selectLastSuggestion()}));it(new xs({id:"selectPrevSuggestion",precondition:ie.and(St.Visible,ie.or(St.MultipleSuggestions,St.HasFocusedSuggestion.negate())),handler:o=>o.selectPrevSuggestion(),kbOpts:{weight:ro,kbExpr:T.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}}));it(new xs({id:"selectPrevPageSuggestion",precondition:ie.and(St.Visible,ie.or(St.MultipleSuggestions,St.HasFocusedSuggestion.negate())),handler:o=>o.selectPrevPageSuggestion(),kbOpts:{weight:ro,kbExpr:T.textInputFocus,primary:11,secondary:[2059]}}));it(new xs({id:"selectFirstSuggestion",precondition:ie.and(St.Visible,ie.or(St.MultipleSuggestions,St.HasFocusedSuggestion.negate())),handler:o=>o.selectFirstSuggestion()}));it(new xs({id:"focusSuggestion",precondition:ie.and(St.Visible,St.HasFocusedSuggestion.negate()),handler:o=>o.focusSuggestion(),kbOpts:{weight:ro,kbExpr:T.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}}));it(new xs({id:"focusAndAcceptSuggestion",precondition:ie.and(St.Visible,St.HasFocusedSuggestion.negate()),handler:o=>{o.focusSuggestion(),o.acceptSelectedSuggestion(!0,!1)}}));it(new xs({id:"toggleSuggestionDetails",precondition:ie.and(St.Visible,St.HasFocusedSuggestion),handler:o=>o.toggleSuggestionDetails(),kbOpts:{weight:ro,kbExpr:T.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:Il,group:"right",order:1,when:ie.and(St.DetailsVisible,St.CanResolve),title:w("detail.more","Show Less")},{menuId:Il,group:"right",order:1,when:ie.and(St.DetailsVisible.toNegated(),St.CanResolve),title:w("detail.less","Show More")}]}));it(new xs({id:"toggleExplainMode",precondition:St.Visible,handler:o=>o.toggleExplainMode(),kbOpts:{weight:100,primary:2138}}));it(new xs({id:"toggleSuggestionFocus",precondition:St.Visible,handler:o=>o.toggleSuggestionFocus(),kbOpts:{weight:ro,kbExpr:T.textInputFocus,primary:2570,mac:{primary:778}}}));it(new xs({id:"insertBestCompletion",precondition:ie.and(T.textInputFocus,ie.equals("config.editor.tabCompletion","on"),B_.AtEnd,St.Visible.toNegated(),zu.OtherSuggestions.toNegated(),ys.InSnippetMode.toNegated()),handler:(o,e)=>{o.triggerSuggestAndAcceptBest(jD(e)?{fallback:"tab",...e}:{fallback:"tab"})},kbOpts:{weight:ro,primary:2}}));it(new xs({id:"insertNextSuggestion",precondition:ie.and(T.textInputFocus,ie.equals("config.editor.tabCompletion","on"),zu.OtherSuggestions,St.Visible.toNegated(),ys.InSnippetMode.toNegated()),handler:o=>o.acceptNextSuggestion(),kbOpts:{weight:ro,kbExpr:T.textInputFocus,primary:2}}));it(new xs({id:"insertPrevSuggestion",precondition:ie.and(T.textInputFocus,ie.equals("config.editor.tabCompletion","on"),zu.OtherSuggestions,St.Visible.toNegated(),ys.InSnippetMode.toNegated()),handler:o=>o.acceptPrevSuggestion(),kbOpts:{weight:ro,kbExpr:T.textInputFocus,primary:1026}}));Q(class extends ge{constructor(){super({id:"editor.action.resetSuggestSize",label:w("suggest.reset.label","Reset Suggest Widget Size"),alias:"Reset Suggest Widget Size",precondition:void 0})}run(o,e){var t;(t=Wo.get(e))==null||t.resetWidgetSize()}});class oU extends Se{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 jt),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=Wo.get(this.editor);if(n){this._register(n.registerSelector({priority:100,select:(a,c,h)=>{const u=this.editor.getModel();if(!u)return-1;const g=this.suggestControllerPreselector(),f=g?Ac(g,u):void 0;if(!f)return-1;const v=Qe.lift(c),_=h.map((S,x)=>{const E=Jg.fromSuggestion(n,u,v,S,this.isShiftKeyPressed),M=Ac(E.toSingleTextEdit(),u),F=kM(f,M);return{index:x,valid:F,prefixLength:M.text.length,suggestItem:S}}).filter(S=>S&&S.valid&&S.prefixLength>0),y=KO(_,_p(S=>S.prefixLength,wb));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(Nn.once(n.model.onDidTrigger)(a=>{r()})),this._register(n.onWillInsertSuggestItem(a=>{const c=this.editor.getPosition(),h=this.editor.getModel();if(!c||!h)return;const u=Jg.fromSuggestion(n,h,c,a.item,this.isShiftKeyPressed);this.onWillAccept(u)}))}this.update(this._isActive)}update(e){const t=this.getSuggestItemInfo();(this._isActive!==e||!rU(this._currentSuggestItemInfo,t))&&(this._isActive=e,this._currentSuggestItemInfo=t,this._onDidSelectedItemChange.fire())}getSuggestItemInfo(){const e=Wo.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 Jg.fromSuggestion(e,n,i,t.item,this.isShiftKeyPressed)}stopForceRenderingAbove(){const e=Wo.get(this.editor);e==null||e.stopForceRenderingAbove()}forceRenderingAbove(){const e=Wo.get(this.editor);e==null||e.forceRenderingAbove()}}class Jg{static fromSuggestion(e,t,i,n,s){let{insertText:r}=n.completion,a=!1;if(n.completion.insertTextRules&4){const h=new Td().parse(r);h.children.length<100&&W_.adjustWhitespace(t,i,!0,h),r=h.toString(),a=!0}const c=e.getOverwriteInfo(n,s);return new Jg(O.fromPositions(i.delta(0,-c.overwriteBefore),i.delta(0,Math.max(c.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 GO(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}toSingleTextEdit(){return new Ha(this.range,this.insertText)}}function rU(o,e){return o===e?!0:!o||!e?!1:o.equals(e)}var aU=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)}},sC,od;let wo=(od=class extends Se{static get(e){return e.getContribution(sC.ID)}constructor(e,t,i,n,s,r,a,c,h,u){super(),this.editor=e,this._instantiationService=t,this._contextKeyService=i,this._configurationService=n,this._commandService=s,this._debounceService=r,this._languageFeaturesService=a,this._accessibilitySignalService=c,this._keybindingService=h,this._accessibilityService=u,this._editorObs=Br(this.editor),this._positions=Ei(this,f=>{var v;return((v=this._editorObs.selections.read(f))==null?void 0:v.map(_=>_.getEndPosition()))??[new Qe(1,1)]}),this._suggestWidgetAdaptor=this._register(new oU(this.editor,()=>{var f,v;return this._editorObs.forceUpdate(),(v=(f=this.model.get())==null?void 0:f.selectedInlineCompletion.get())==null?void 0:v.toSingleTextEdit(void 0)},f=>this._editorObs.forceUpdate(v=>{var _;(_=this.model.get())==null||_.handleSuggestAccepted(f)}))),this._suggestWidgetSelectedItem=Bs(this,f=>this._suggestWidgetAdaptor.onDidSelectedItemChange(()=>{this._editorObs.forceUpdate(v=>f(void 0))}),()=>this._suggestWidgetAdaptor.selectedItem),this._enabledInConfig=Bs(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).enabled),this._isScreenReaderEnabled=Bs(this,this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this._editorDictationInProgress=Bs(this,this._contextKeyService.onDidChangeContext,()=>this._contextKeyService.getContext(this.editor.getDomNode()).getValue("editorDictation.inProgress")===!0),this._enabled=Ei(this,f=>this._enabledInConfig.read(f)&&(!this._isScreenReaderEnabled.read(f)||!this._editorDictationInProgress.read(f))),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineCompletionsDebounce",{min:50,max:50}),this.model=$l(this,f=>{if(this._editorObs.isReadonly.read(f))return;const v=this._editorObs.model.read(f);return v?this._instantiationService.createInstance(GS,v,this._suggestWidgetSelectedItem,this._editorObs.versionId,this._positions,this._debounceValue,Bs(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(119).preview),Bs(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(119).previewMode),Bs(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).mode),this._enabled):void 0}).recomputeInitiallyAndOnChange(this._store),this._ghostTexts=Ei(this,f=>{const v=this.model.read(f);return(v==null?void 0:v.ghostTexts.read(f))??[]}),this._stablizedGhostTexts=lU(this._ghostTexts,this._store),this._ghostTextWidgets=ZO(this,this._stablizedGhostTexts,(f,v)=>v.add(this._instantiationService.createInstance(qS,this.editor,{ghostText:f,minReservedLineCount:La(0),targetTextModel:this.model.map(_=>_==null?void 0:_.textModel)}))).recomputeInitiallyAndOnChange(this._store),this._playAccessibilitySignal=t1(this),this._fontFamily=Bs(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).fontFamily),this._register(new $s(this._contextKeyService,this.model)),this._register(EL(this._editorObs.onDidType,(f,v)=>{var _;this._enabled.get()&&((_=this.model.get())==null||_.trigger())})),this._register(this._commandService.onDidExecuteCommand(f=>{new Set([Dm.Tab.id,Dm.DeleteLeft.id,Dm.DeleteRight.id,OT,"acceptSelectedSuggestion"]).has(f.commandId)&&e.hasTextFocus()&&this._enabled.get()&&this._editorObs.forceUpdate(_=>{var y;(y=this.model.get())==null||y.trigger(_)})})),this._register(EL(this._editorObs.selections,(f,v)=>{var _;v.some(y=>y.reason===3||y.source==="api")&&((_=this.model.get())==null||_.stop())})),this._register(this.editor.onDidBlurEditorWidget(()=>{this._contextKeyService.getContextKeyValue("accessibleViewIsShown")||this._configurationService.getValue("editor.inlineSuggest.keepOnBlur")||e.getOption(62).keepOnBlur||Au.dropDownVisible||jd(f=>{var v;(v=this.model.get())==null||v.stop(f)})})),this._register(dn(f=>{var _;const v=(_=this.model.read(f))==null?void 0:_.state.read(f);v!=null&&v.suggestItem?v.primaryGhostText.lineCount>=2&&this._suggestWidgetAdaptor.forceRenderingAbove():this._suggestWidgetAdaptor.stopForceRenderingAbove()})),this._register(nn(()=>{this._suggestWidgetAdaptor.stopForceRenderingAbove()}));const g=vb(this,(f,v)=>{var S;const _=this.model.read(f),y=_==null?void 0:_.state.read(f);return this._suggestWidgetSelectedItem.get()?v:(S=y==null?void 0:y.inlineCompletion)==null?void 0:S.semanticId});this._register(XO(Ei(f=>(this._playAccessibilitySignal.read(f),g.read(f),{})),async(f,v,_)=>{const y=this.model.get(),S=y==null?void 0:y.state.get();if(!S||!y)return;const x=y.textModel.getLineContent(S.primaryGhostText.lineNumber);await Lb(50,Sy(_)),await YO(this._suggestWidgetSelectedItem,kg,()=>!1,Sy(_)),await this._accessibilitySignalService.playSignal(qD.inlineSuggestion),this.editor.getOption(8)&&this._provideScreenReaderUpdate(S.primaryGhostText.renderForScreenReader(x))})),this._register(new hS(this.editor,this.model,this._instantiationService)),this._register(QV(Ei(f=>{const v=this._fontFamily.read(f);return v===""||v==="default"?"":`
38
+ .monaco-editor .ghost-text-decoration,
39
+ .monaco-editor .ghost-text-decoration-preview,
40
+ .monaco-editor .ghost-text {
41
+ font-family: ${v};
42
+ }`}))),this._register(this._configurationService.onDidChangeConfiguration(f=>{f.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=w("showAccessibleViewHint","Inspect this in the accessible view ({0})",i.getAriaLabel())),Uo(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 Qe(t.lineNumber,n.column))):!1}shouldShowHoverAtViewZone(e){var t;return((t=this._ghostTextWidgets.get()[0])==null?void 0:t.ownsViewZone(e))??!1}},sC=od,od.ID="editor.contrib.inlineCompletionsController",od);wo=sC=aU([fa(1,Bt),fa(2,wi),fa(3,on),fa(4,Bn),fa(5,yo),fa(6,Je),fa(7,$D),fa(8,En),fa(9,bb)],wo);function lU(o,e){const t=no("result",[]),i=[];return e.add(dn(n=>{const s=o.read(n);jd(r=>{if(s.length!==i.length){i.length=s.length;for(let a=0;a<i.length;a++)i[a]||(i[a]=no("item",s[a]));t.set([...i],r)}i.forEach((a,c)=>a.set(s[c],r))})})),t}const Ov=class Ov extends ge{constructor(){super({id:Ov.ID,label:w("action.inlineSuggest.showNext","Show Next Inline Suggestion"),alias:"Show Next Inline Suggestion",precondition:ie.and(T.writable,$s.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}async run(e,t){var n;const i=wo.get(t);(n=i==null?void 0:i.model.get())==null||n.next()}};Ov.ID=HT;let oC=Ov;const Fv=class Fv extends ge{constructor(){super({id:Fv.ID,label:w("action.inlineSuggest.showPrevious","Show Previous Inline Suggestion"),alias:"Show Previous Inline Suggestion",precondition:ie.and(T.writable,$s.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}async run(e,t){var n;const i=wo.get(t);(n=i==null?void 0:i.model.get())==null||n.previous()}};Fv.ID=FT;let rC=Fv;class cU extends ge{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:w("action.inlineSuggest.trigger","Trigger Inline Suggestion"),alias:"Trigger Inline Suggestion",precondition:T.writable})}async run(e,t){const i=wo.get(t);await fE(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 dU extends ge{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:w("action.inlineSuggest.acceptNextWord","Accept Next Word Of Inline Suggestion"),alias:"Accept Next Word Of Inline Suggestion",precondition:ie.and(T.writable,$s.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:ie.and(T.writable,$s.inlineSuggestionVisible)},menuOpts:[{menuId:We.InlineSuggestionToolbar,title:w("acceptWord","Accept Word"),group:"primary",order:2}]})}async run(e,t){var n;const i=wo.get(t);await((n=i==null?void 0:i.model.get())==null?void 0:n.acceptNextWord(i.editor))}}class hU extends ge{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:w("action.inlineSuggest.acceptNextLine","Accept Next Line Of Inline Suggestion"),alias:"Accept Next Line Of Inline Suggestion",precondition:ie.and(T.writable,$s.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:We.InlineSuggestionToolbar,title:w("acceptLine","Accept Line"),group:"secondary",order:2}]})}async run(e,t){var n;const i=wo.get(t);await((n=i==null?void 0:i.model.get())==null?void 0:n.acceptNextLine(i.editor))}}class uU extends ge{constructor(){super({id:OT,label:w("action.inlineSuggest.accept","Accept Inline Suggestion"),alias:"Accept Inline Suggestion",precondition:$s.inlineSuggestionVisible,menuOpts:[{menuId:We.InlineSuggestionToolbar,title:w("accept","Accept"),group:"primary",order:1}],kbOpts:{primary:2,weight:200,kbExpr:ie.and($s.inlineSuggestionVisible,T.tabMovesFocus.toNegated(),$s.inlineSuggestionHasIndentationLessThanTabSize,St.Visible.toNegated(),T.hoverFocused.toNegated())}})}async run(e,t){var n;const i=wo.get(t);i&&((n=i.model.get())==null||n.accept(i.editor),i.editor.focus())}}const Hv=class Hv extends ge{constructor(){super({id:Hv.ID,label:w("action.inlineSuggest.hide","Hide Inline Suggestion"),alias:"Hide Inline Suggestion",precondition:$s.inlineSuggestionVisible,kbOpts:{weight:100,primary:9}})}async run(e,t){const i=wo.get(t);jd(n=>{var s;(s=i==null?void 0:i.model.get())==null||s.stop(n)})}};Hv.ID="editor.action.inlineSuggest.hide";let aC=Hv;const Wv=class Wv extends Ns{constructor(){super({id:Wv.ID,title:w("action.inlineSuggest.alwaysShowToolbar","Always Show Toolbar"),f1:!1,precondition:void 0,menu:[{id:We.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:ie.equals("config.editor.inlineSuggest.showToolbar","always")})}async run(e,t){const i=e.get(on),s=i.getValue("editor.inlineSuggest.showToolbar")==="always"?"onHover":"always";i.updateValue("editor.inlineSuggest.showToolbar",s)}};Wv.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar";let lC=Wv;var gU=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},Sg=function(o,e){return function(t,i){e(t,i,o)}};class fU{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 cC=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=wo.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 Fm(1e3,this,O.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 Fm(1e3,this,i.range,e.event.posx,e.event.posy,!1):i.type===6&&i.detail.mightBeForeignElement&&t.shouldShowHoverAt(i.range)?new Fm(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=wo.get(this._editor);return i&&i.shouldShowHoverAt(e.range)?[new fU(this,e.range,i)]:[]}renderHoverParts(e,t){const i=new we,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(Au,this._editor,!1,La(null),s.selectedInlineCompletionIndex,s.inlineCompletionsCount,s.activeCommands),a=r.getDomNode();e.fragment.appendChild(a),s.triggerExplicitly(),i.add(r);const c={hoverPart:n,hoverElement:a,dispose(){i.dispose()}};return new Ad([c])}renderScreenReaderText(e,t){const i=new we,n=qe,s=n("div.hover-row.markdown-hover"),r=Ve(s,n("div.hover-contents",{"aria-live":"assertive"})),a=i.add(new Yu({editor:this._editor},this._languageService,this._openerService)),c=h=>{i.add(a.onDidRenderAsync(()=>{r.className="hover-contents code-hover-contents",e.onContentsChanged()}));const u=w("inlineSuggestionFollows","Suggestion:"),g=i.add(a.render(new us().appendText(u).appendCodeblock("text",h)));r.replaceChildren(g.element)};return i.add(dn(h=>{var g;const u=(g=t.controller.model.read(h))==null?void 0:g.primaryGhostText.read(h);if(u){const f=this._editor.getModel().getLineContent(u.lineNumber);c(u.renderForScreenReader(f))}else Qm(r)})),e.fragment.appendChild(s),i}};cC=gU([Sg(1,br),Sg(2,_r),Sg(3,bb),Sg(4,Bt),Sg(5,vr)],cC);class pU{}const Yb=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}};Zt(wo.ID,wo,3);Q(cU);Q(oC);Q(rC);Q(dU);Q(hU);Q(uU);Q(aC);Ti(lC);Zd.register(cC);Yb.register(new pU);var mU=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},Yw=function(o,e){return function(t,i){e(t,i,o)}},Ag,Fl;let Hf=(Fl=class{constructor(e,t,i,n){this.textModelResolverService=t,this.languageService=i,this.languageFeaturesService=n,this.toUnhook=new we,this.toUnhookForKeyboard=new we,this.currentWordAtPosition=null,this.previousPromise=null,this.editor=e,this.linkDecorations=this.editor.createDecorationsCollection();const s=new Ub(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=>{Vi(a)}).finally(()=>{this.removeLinkDecorations()})})),this.toUnhook.add(s.onCancel(()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null}))}static get(e){return e.getContribution(Ag.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 pE(this.editor,15);this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=qn(a=>this.findDefinition(e,a));let n;try{n=await this.previousPromise}catch(a){Vi(a);return}if(!n||!n.length||!i.validate(this.editor)){this.removeLinkDecorations();return}const s=n[0].originSelectionRange?O.lift(n[0].originSelectionRange):new O(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn);if(n.length>1){let a=s;for(const{originSelectionRange:c}of n)c&&(a=O.plusRange(a,c));this.addDecoration(a,new us().appendText(w("multipleResults","Click to show {0} definitions.",n.length)))}else{const a=n[0];if(!a.uri)return;this.textModelResolverService.createModelReference(a.uri).then(c=>{if(!c.object||!c.object.textEditorModel){c.dispose();return}const{object:{textEditorModel:h}}=c,{startLineNumber:u}=a.range;if(u<1||u>h.getLineCount()){c.dispose();return}const g=this.getPreviewValue(h,u,a),f=this.languageService.guessLanguageIdByFilepathOrFirstLine(h.uri);this.addDecoration(s,g?new us().appendCodeblock(f||"",g):void 0),c.dispose()})}}getPreviewValue(e,t,i){let n=i.range;return n.endLineNumber-n.startLineNumber>=Ag.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 c=e.getLineFirstNonWhitespaceColumn(a);s=Math.min(s,c)}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+Ag.MAX_SOURCE_PREVIEW_LINES);let s=t+1;for(;s<n;s++){const r=e.getLineFirstNonWhitespaceColumn(s);if(i===r)break}return new O(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 Jx)&&(e.hasTriggerModifier||(t?t.keyCodeIsTriggerKey:!1))&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(e,t){const i=this.editor.getModel();return i?Pp(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 Mp({openToSide:t,openInPeek:n,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(i)})}isInPeekEditor(e){const t=e.get(wi);return Ts.inPeekEditor.getValue(t)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}},Ag=Fl,Fl.ID="editor.contrib.gotodefinitionatposition",Fl.MAX_SOURCE_PREVIEW_LINES=8,Fl);Hf=Ag=mU([Yw(1,wr),Yw(2,br),Yw(3,Je)],Hf);Zt(Hf.ID,Hf,2);var EM=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)}};class uk{constructor(e,t,i){this.marker=e,this.index=t,this.total=i}}let dC=class{constructor(e,t,i){this._markerService=t,this._configService=i,this._onDidChange=new jt,this.onDidChange=this._onDidChange.event,this._dispoables=new we,this._markers=[],this._nextIdx=-1,Ri.isUri(e)?this._resourceFilter=a=>a.toString()===e.toString():e&&(this._resourceFilter=e);const n=this._configService.getValue("problems.sortOrder"),s=(a,c)=>{let h=PL(a.resource.toString(),c.resource.toString());return h===0&&(n==="position"?h=O.compareRangesUsingStarts(a,c)||ps.compare(a.severity,c.severity):h=ps.compare(a.severity,c.severity)||O.compareRangesUsingStarts(a,c)),h},r=()=>{this._markers=this._markerService.read({resource:Ri.isUri(e)?e:void 0,severities:ps.Error|ps.Warning|ps.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(c=>this._resourceFilter(c)))&&(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 uk(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=n_(this._markers,{resource:e.uri},(r,a)=>PL(r.resource.toString(),a.resource.toString())),s<0&&(s=~s));for(let r=s;r<this._markers.length;r++){let a=O.lift(this._markers[r]);if(a.isEmpty()){const c=e.getWordAtPosition(a.getStartPosition());c&&(a=new O(a.startLineNumber,c.startColumn,a.startLineNumber,c.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(O.containsPosition(this._markers[i],t))return new uk(this._markers[i],i+1,this._markers.length)}}};dC=EM([$_(1,$x),$_(2,on)],dC);const PM=qa("IMarkerNavigationService");let hC=class{constructor(e,t){this._markerService=e,this._configService=t,this._provider=new oE}getMarkerList(e){for(const t of this._provider){const i=t.getMarkerList(e);if(i)return i}return new dC(e,this._markerService,this._configService)}};hC=EM([$_(0,$x),$_(1,on)],hC);Ka(PM,hC,1);var uC;(function(o){function e(t){switch(t){case Zp.Ignore:return"severity-ignore "+xi.asClassName(xt.info);case Zp.Info:return xi.asClassName(xt.info);case Zp.Warning:return xi.asClassName(xt.warning);case Zp.Error:return xi.asClassName(xt.error);default:return""}}o.className=e})(uC||(uC={}));var _U=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},_h=function(o,e){return function(t,i){e(t,i,o)}},gC;class vU{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 we,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(Fa(this._relatedBlock,"click",a=>{a.preventDefault();const c=this._relatedDiagnostics.get(a.target);c&&i(c)})),this._scrollable=new s2(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(){fs(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=xb(i);this._lines=a.length,this._longestLineLength=0;for(const f of a)this._longestLineLength=Math.max(f.length+r,this._longestLineLength);Gr(this._messageBlock),this._messageBlock.setAttribute("aria-label",this.getAriaLabel(e)),this._editor.applyFontInfo(this._messageBlock);let c=this._messageBlock;for(const f of a)c=document.createElement("div"),c.innerText=f,f===""&&(c.style.height=this._messageBlock.style.lineHeight),this._messageBlock.appendChild(c);if(t||s){const f=document.createElement("span");if(f.classList.add("details"),c.appendChild(f),t){const v=document.createElement("span");v.innerText=t,v.classList.add("source"),f.appendChild(v)}if(s)if(typeof s=="string"){const v=document.createElement("span");v.innerText=`(${s})`,v.classList.add("code"),f.appendChild(v)}else{this._codeLink=qe("a.code-link"),this._codeLink.setAttribute("href",`${s.target.toString()}`),this._codeLink.onclick=_=>{this._openerService.open(s.target,{allowCommands:!0}),_.preventDefault(),_.stopPropagation()};const v=Ve(this._codeLink,qe("span"));v.innerText=s.value,f.appendChild(this._codeLink)}}if(Gr(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),io(n)){const f=this._relatedBlock.appendChild(document.createElement("div"));f.style.paddingTop=`${Math.floor(this._editor.getOption(67)*.66)}px`,this._lines+=1;for(const v of n){const _=document.createElement("div"),y=document.createElement("a");y.classList.add("filename"),y.innerText=`${this._labelService.getUriBasenameLabel(v.resource)}(${v.startLineNumber}, ${v.startColumn}): `,y.title=this._labelService.getUriLabel(v.resource),this._relatedDiagnostics.set(y,v);const S=document.createElement("span");S.innerText=v.message,_.appendChild(y),_.appendChild(S),this._lines+=1,f.appendChild(_)}}const h=this._editor.getOption(50),u=Math.ceil(h.typicalFullwidthCharacterWidth*this._longestLineLength*.75),g=h.lineHeight*this._lines;this._scrollable.setScrollDimensions({scrollWidth:u,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 ps.Error:t=w("Error","Error");break;case ps.Warning:t=w("Warning","Warning");break;case ps.Info:t=w("Info","Info");break;case ps.Hint:t=w("Hint","Hint");break}let i=w("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 rd;let Wf=(rd=class extends S_{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 we,this._onDidSelectRelatedInformation=new jt,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=ps.Warning,this._backgroundColor=ii.white,this._applyTheme(t.getColorTheme()),this._callOnDispose.add(t.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(e){this._backgroundColor=e.getColor(SU);let t=fC,i=bU;this._severity===ps.Warning?(t=zm,i=wU):this._severity===ps.Info&&(t=pC,i=yU);const n=e.getColor(t),s=e.getColor(i);this.style({arrowColor:n,frameColor:n,headerBackgroundColor:s,primaryHeadingColor:e.getColor(GT),secondaryHeadingColor:e.getColor(ZT)})}_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(gC.TitleMenu,this._contextKeyService);Gx(i,t),this._actionbarWidget.push(t,{label:!1,icon:!0,index:0})}_fillTitleIcon(e){this._icon=Ve(e,qe(""))}_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 vU(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=O.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 c=i>1?w("problems","{0} of {1} problems",t,i):w("change","{0} of {1} problem",t,i);this.setTitle(Jr(a.uri),c)}this._icon.className=`codicon ${uC.className(ps.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()}},gC=rd,rd.TitleMenu=new We("gotoErrorTitleMenu"),rd);Wf=gC=_U([_h(1,qo),_h(2,_r),_h(3,Ud),_h(4,Bt),_h(5,wi),_h(6,_f)],Wf);const gk=n1(JO,QO),fk=n1(t2,e2),pk=n1(my,i2),fC=Ke("editorMarkerNavigationError.background",{dark:gk,light:gk,hcDark:Oa,hcLight:Oa},w("editorMarkerNavigationError","Editor marker navigation widget error color.")),bU=Ke("editorMarkerNavigationError.headerBackground",{dark:Zr(fC,.1),light:Zr(fC,.1),hcDark:null,hcLight:null},w("editorMarkerNavigationErrorHeaderBackground","Editor marker navigation widget error heading background.")),zm=Ke("editorMarkerNavigationWarning.background",{dark:fk,light:fk,hcDark:Oa,hcLight:Oa},w("editorMarkerNavigationWarning","Editor marker navigation widget warning color.")),wU=Ke("editorMarkerNavigationWarning.headerBackground",{dark:Zr(zm,.1),light:Zr(zm,.1),hcDark:"#0C141F",hcLight:Zr(zm,.2)},w("editorMarkerNavigationWarningBackground","Editor marker navigation widget warning heading background.")),pC=Ke("editorMarkerNavigationInfo.background",{dark:pk,light:pk,hcDark:Oa,hcLight:Oa},w("editorMarkerNavigationInfo","Editor marker navigation widget info color.")),yU=Ke("editorMarkerNavigationInfo.headerBackground",{dark:Zr(pC,.1),light:Zr(pC,.1),hcDark:null,hcLight:null},w("editorMarkerNavigationInfoHeaderBackground","Editor marker navigation widget info heading background.")),SU=Ke("editorMarkerNavigation.background",n2,w("editorMarkerNavigationBackground","Editor marker navigation widget background."));var CU=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)}},Og,ad;let Hd=(ad=class{static get(e){return e.getContribution(Og.ID)}constructor(e,t,i,n,s){this._markerNavigationService=t,this._contextKeyService=i,this._editorService=n,this._instantiationService=s,this._sessionDispoables=new we,this._editor=e,this._widgetVisible=TM.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(Wf,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)||!O.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:O.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 Qe(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=Og.get(r))==null||i.close(),(n=Og.get(r))==null||n.nagivate(e,t))}else this._widget.showAtMarker(s.selected.marker,s.selected.index,s.selected.total)}}},Og=ad,ad.ID="editor.contrib.markerController",ad);Hd=Og=CU([mm(1,PM),mm(2,wi),mm(3,xn),mm(4,Bt)],Hd);class Qb extends ge{constructor(e,t,i){super(i),this._next=e,this._multiFile=t}async run(e,t){var i;t.hasModel()&&((i=Hd.get(t))==null||i.nagivate(this._next,this._multiFile))}}const pc=class pc extends Qb{constructor(){super(!0,!1,{id:pc.ID,label:pc.LABEL,alias:"Go to Next Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:T.focus,primary:578,weight:100},menuOpts:{menuId:Wf.TitleMenu,title:pc.LABEL,icon:yn("marker-navigation-next",xt.arrowDown,w("nextMarkerIcon","Icon for goto next marker.")),group:"navigation",order:1}})}};pc.ID="editor.action.marker.next",pc.LABEL=w("markerAction.next.label","Go to Next Problem (Error, Warning, Info)");let q_=pc;const mc=class mc extends Qb{constructor(){super(!1,!1,{id:mc.ID,label:mc.LABEL,alias:"Go to Previous Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:T.focus,primary:1602,weight:100},menuOpts:{menuId:Wf.TitleMenu,title:mc.LABEL,icon:yn("marker-navigation-previous",xt.arrowUp,w("previousMarkerIcon","Icon for goto previous marker.")),group:"navigation",order:2}})}};mc.ID="editor.action.marker.prev",mc.LABEL=w("markerAction.previous.label","Go to Previous Problem (Error, Warning, Info)");let mC=mc;class xU extends Qb{constructor(){super(!0,!0,{id:"editor.action.marker.nextInFiles",label:w("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:T.focus,primary:66,weight:100},menuOpts:{menuId:We.MenubarGoMenu,title:w({key:"miGotoNextProblem",comment:["&& denotes a mnemonic"]},"Next &&Problem"),group:"6_problem_nav",order:1}})}}class LU extends Qb{constructor(){super(!1,!0,{id:"editor.action.marker.prevInFiles",label:w("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:T.focus,primary:1090,weight:100},menuOpts:{menuId:We.MenubarGoMenu,title:w({key:"miGotoPreviousProblem",comment:["&& denotes a mnemonic"]},"Previous &&Problem"),group:"6_problem_nav",order:2}})}}Zt(Hd.ID,Hd,4);Q(q_);Q(mC);Q(xU);Q(LU);const TM=new di("markersNavigationVisible",!1),IU=Rs.bindToContribution(Hd.get);it(new IU({id:"closeMarkersNavigation",precondition:TM,handler:o=>o.close(),kbOpts:{weight:150,kbExpr:T.focus,primary:9,secondary:[1033]}}));var tr;(function(o){o.NoAutoFocus="noAutoFocus",o.FocusIfVisible="focusIfVisible",o.AutoFocusImmediately="autoFocusImmediately"})(tr||(tr={}));class kU extends ge{constructor(){super({id:AT,label:w({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:Xe("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:[tr.NoAutoFocus,tr.FocusIfVisible,tr.AutoFocusImmediately],enumDescriptions:[w("showOrFocusHover.focus.noAutoFocus","The hover will not automatically take focus."),w("showOrFocusHover.focus.focusIfVisible","The hover will take focus only if it is already visible."),w("showOrFocusHover.focus.autoFocusImmediately","The hover will automatically take focus when it appears.")],default:tr.FocusIfVisible}}}}]},alias:"Show or Focus Hover",precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:Dn(2089,2087),weight:100}})}run(e,t,i){if(!t.hasModel())return;const n=ls.get(t);if(!n)return;const s=i==null?void 0:i.focus;let r=tr.FocusIfVisible;Object.values(tr).includes(s)?r=s:typeof s=="boolean"&&s&&(r=tr.AutoFocusImmediately);const a=h=>{const u=t.getPosition(),g=new O(u.lineNumber,u.column,u.lineNumber,u.column);n.showContentHover(g,1,1,h)},c=t.getOption(2)===2;n.isHoverVisible?r!==tr.NoAutoFocus?n.focus():a(c):a(c||r===tr.AutoFocusImmediately)}}class DU extends ge{constructor(){super({id:$B,label:w({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:Xe("showDefinitionPreviewHoverDescription","Show the definition preview hover in the editor.")}})}run(e,t){const i=ls.get(t);if(!i)return;const n=t.getPosition();if(!n)return;const s=new O(n.lineNumber,n.column,n.lineNumber,n.column),r=Hf.get(t);if(!r)return;r.startFindDefinitionFromCursor(n).then(()=>{i.showContentHover(s,1,1,!0)})}}class EU extends ge{constructor(){super({id:qB,label:w({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:T.hoverFocused,kbOpts:{kbExpr:T.hoverFocused,primary:16,weight:100},metadata:{description:Xe("scrollUpHoverDescription","Scroll up the editor hover.")}})}run(e,t){const i=ls.get(t);i&&i.scrollUp()}}class PU extends ge{constructor(){super({id:KB,label:w({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:T.hoverFocused,kbOpts:{kbExpr:T.hoverFocused,primary:18,weight:100},metadata:{description:Xe("scrollDownHoverDescription","Scroll down the editor hover.")}})}run(e,t){const i=ls.get(t);i&&i.scrollDown()}}class TU extends ge{constructor(){super({id:GB,label:w({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:T.hoverFocused,kbOpts:{kbExpr:T.hoverFocused,primary:15,weight:100},metadata:{description:Xe("scrollLeftHoverDescription","Scroll left the editor hover.")}})}run(e,t){const i=ls.get(t);i&&i.scrollLeft()}}class MU extends ge{constructor(){super({id:ZB,label:w({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:T.hoverFocused,kbOpts:{kbExpr:T.hoverFocused,primary:17,weight:100},metadata:{description:Xe("scrollRightHoverDescription","Scroll right the editor hover.")}})}run(e,t){const i=ls.get(t);i&&i.scrollRight()}}class NU extends ge{constructor(){super({id:XB,label:w({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:T.hoverFocused,kbOpts:{kbExpr:T.hoverFocused,primary:11,secondary:[528],weight:100},metadata:{description:Xe("pageUpHoverDescription","Page up the editor hover.")}})}run(e,t){const i=ls.get(t);i&&i.pageUp()}}class RU extends ge{constructor(){super({id:YB,label:w({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:T.hoverFocused,kbOpts:{kbExpr:T.hoverFocused,primary:12,secondary:[530],weight:100},metadata:{description:Xe("pageDownHoverDescription","Page down the editor hover.")}})}run(e,t){const i=ls.get(t);i&&i.pageDown()}}class AU extends ge{constructor(){super({id:QB,label:w({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:T.hoverFocused,kbOpts:{kbExpr:T.hoverFocused,primary:14,secondary:[2064],weight:100},metadata:{description:Xe("goToTopHoverDescription","Go to the top of the editor hover.")}})}run(e,t){const i=ls.get(t);i&&i.goToTop()}}class OU extends ge{constructor(){super({id:JB,label:w({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:T.hoverFocused,kbOpts:{kbExpr:T.hoverFocused,primary:13,secondary:[2066],weight:100},metadata:{description:Xe("goToBottomHoverDescription","Go to the bottom of the editor hover.")}})}run(e,t){const i=ls.get(t);i&&i.goToBottom()}}class FU extends ge{constructor(){super({id:Bb,label:e3,alias:"Increase Hover Verbosity Level",precondition:T.hoverVisible})}run(e,t,i){const n=ls.get(t);if(!n)return;const s=(i==null?void 0:i.index)!==void 0?i.index:n.focusedHoverPartIndex();n.updateHoverVerbosityLevel(mo.Increase,s,i==null?void 0:i.focus)}}class HU extends ge{constructor(){super({id:zb,label:t3,alias:"Decrease Hover Verbosity Level",precondition:T.hoverVisible})}run(e,t,i){var r;const n=ls.get(t);if(!n)return;const s=(i==null?void 0:i.index)!==void 0?i.index:n.focusedHoverPartIndex();(r=ls.get(t))==null||r.updateHoverVerbosityLevel(mo.Decrease,s,i==null?void 0:i.focus)}}var WU=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},Qw=function(o,e){return function(t,i){e(t,i,o)}};const Lo=qe;class BU{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 mk={type:1,filter:{include:qi.QuickFix},triggerAction:Ks.QuickFixHover};let _C=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 c=a.range.startLineNumber===n?a.range.startColumn:1,h=a.range.endLineNumber===n?a.range.endColumn:s,u=this._markerDecorationsService.getMarker(i.uri,a);if(!u)continue;const g=new O(e.range.startLineNumber,c,e.range.startLineNumber,h);r.push(new BU(this,g,u))}return r}renderHoverParts(e,t){if(!t.length)return new Ad([]);const i=new we,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)=>ps.compare(r.marker.severity,a.marker.severity))[0];return this.renderMarkerStatusbar(e,s,i),new Ad(n)}_renderMarkerHover(e){const t=new we,i=Lo("div.hover-row"),n=Ve(i,Lo("div.marker.hover-contents")),{source:s,message:r,code:a,relatedInformation:c}=e.marker;this._editor.applyFontInfo(n);const h=Ve(n,Lo("span"));if(h.style.whiteSpace="pre-wrap",h.innerText=r,s||a)if(a&&typeof a!="string"){const g=Lo("span");if(s){const y=Ve(g,Lo("span"));y.innerText=s}const f=Ve(g,Lo("a.code-link"));f.setAttribute("href",a.target.toString()),t.add(bi(f,"click",y=>{this._openerService.open(a.target,{allowCommands:!0}),y.preventDefault(),y.stopPropagation()}));const v=Ve(f,Lo("span"));v.innerText=a.value;const _=Ve(n,g);_.style.opacity="0.6",_.style.paddingLeft="6px"}else{const g=Ve(n,Lo("span"));g.style.opacity="0.6",g.style.paddingLeft="6px",g.innerText=s&&a?`${s}(${a})`:s||`(${a})`}if(io(c))for(const{message:g,resource:f,startLineNumber:v,startColumn:_}of c){const y=Ve(n,Lo("div"));y.style.marginTop="8px";const S=Ve(y,Lo("a"));S.innerText=`${Jr(f)}(${v}, ${_}): `,S.style.cursor="pointer",t.add(bi(S,"click",E=>{if(E.stopPropagation(),E.preventDefault(),this._openerService){const M={selection:{startLineNumber:v,startColumn:_}};this._openerService.open(f,{fromUserGesture:!0,editorOptions:M}).catch(Vi)}}));const x=Ve(y,Lo("span"));x.innerText=g,this._editor.applyFontInfo(x)}return{hoverPart:e,hoverElement:i,dispose:()=>t.dispose()}}renderMarkerStatusbar(e,t,i){if(t.marker.severity===ps.Error||t.marker.severity===ps.Warning||t.marker.severity===ps.Info){const n=Hd.get(this._editor);n&&e.statusBar.addAction({label:w("view problem","View Problem"),commandId:q_.ID,run:()=>{e.hide(),n.showAtMarker(t.marker),this._editor.focus()}})}if(!this._editor.getOption(92)){const n=e.statusBar.append(Lo("div"));this.recentMarkerCodeActionsInfo&&(TL.makeKey(this.recentMarkerCodeActionsInfo.marker)===TL.makeKey(t.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||(n.textContent=w("noQuickFixes","No quick fixes available")):this.recentMarkerCodeActionsInfo=void 0);const s=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?Se.None:hf(()=>n.textContent=w("checkingForQuickFixes","Checking for quick fixes..."),200,i);n.textContent||(n.textContent=" ");const r=this.getCodeActions(t.marker);i.add(nn(()=>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=w("noQuickFixes","No quick fixes available");return}n.style.display="none";let c=!1;i.add(nn(()=>{c||a.dispose()})),e.statusBar.addAction({label:w("quick fixes","Quick Fix..."),commandId:T1,run:h=>{c=!0;const u=Nu.get(this._editor),g=Ps(h);e.hide(),u==null||u.showCodeActions(mk,a,{x:g.left,y:g.top,width:g.width,height:g.height})}})},Vi)}}getCodeActions(e){return qn(t=>Rh(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new O(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),mk,xa.None,t))}};_C=WU([Qw(1,o2),Qw(2,_r),Qw(3,Je)],_C);class zU{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=Xm.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)??Xm.Center;if(!n&&a!==this._laneOrLine)continue;const c=n?r.options.lineNumberHoverMessage:r.options.glyphMarginHoverMessage;!c||mf(c)||i.push(...ID(c).map(e))}return i}}var VU=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},_k=function(o,e){return function(t,i){e(t,i,o)}},vC;const vk=qe;var ld;let bC=(ld=class extends Se{constructor(e,t,i){super(),this._renderDisposeables=this._register(new we),this._editor=e,this._isVisible=!1,this._messages=[],this._hover=this._register(new LD),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._markdownRenderer=this._register(new Yu({editor:this._editor},t,i)),this._computer=new zU(this._editor),this._hoverOperation=this._register(new WT(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(Fa(this._hover.containerDomNode,"mouseleave",n=>{this._onMouseLeave(n)})),this._editor.addOverlayWidget(this)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return vC.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=vk("div.hover-row.markdown-hover"),r=Ve(s,vk("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,c=t.glyphMarginLeft+t.glyphMarginWidth+(this._computer.lane==="lineNo"?t.lineNumbersWidth:0);this._hover.containerDomNode.style.left=`${c}px`,this._hover.containerDomNode.style.top=`${Math.max(Math.round(a),0)}px`}_onMouseLeave(e){const t=this._editor.getDomNode();(!t||!Vb(t,e.x,e.y))&&this.hide()}},vC=ld,ld.ID="editor.contrib.modesGlyphHoverWidget",ld);bC=vC=VU([_k(1,br),_k(2,_r)],bC);var UU=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},jU=function(o,e){return function(t,i){e(t,i,o)}},hu;let K_=(hu=class extends Se{constructor(e,t){super(),this._editor=e,this._instantiationService=t,this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new we,this._hoverState={mouseDown:!1},this._reactToEditorMouseMoveRunner=this._register(new Rn(()=>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?Vb(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(bC,this._editor)),this._glyphWidget}dispose(){var e;super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),(e=this._glyphWidget)==null||e.dispose()}},hu.ID="editor.contrib.marginHover",hu);K_=UU([jU(1,Bt)],K_);class $U{}class qU{}class KU{}Zt(ls.ID,ls,2);Zt(K_.ID,K_,2);Q(kU);Q(DU);Q(EU);Q(PU);Q(TU);Q(MU);Q(NU);Q(RU);Q(AU);Q(OU);Q(FU);Q(HU);Zd.register(Nf);Zd.register(_C);mb((o,e)=>{const t=o.getColor(r2);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)}; }`))});Yb.register(new $U);Yb.register(new qU);Yb.register(new KU);function Ws(o,e){let t=0;for(let i=0;i<o.length;i++)o.charAt(i)===" "?t+=e:t++;return t}function ef(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 MM(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 a2(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:c}=o.getOptions(),h=(y,S)=>(S=S||1,Iu.shiftIndent(y,y.length+S,r,a,c)),u=(y,S)=>(S=S||1,Iu.unshiftIndent(y,y.length+S,r,a,c)),g=[],f=o.getLineContent(t);let v=ts(f),_=v;s.shouldIncrease(t)?(_=h(_),v=h(v)):s.shouldIndentNextLine(t)&&(_=h(_)),t++;for(let y=t;y<=i;y++){if(GU(o,y))continue;const S=o.getLineContent(y),x=ts(S),E=_;s.shouldDecrease(y,E)&&(_=u(_),v=u(v)),x!==_&&g.push(pn.replaceMove(new _t(y,1,y,x.length+1),l2(_,a,c))),!s.shouldIgnore(y)&&(s.shouldIncrease(y,E)?(v=h(v),_=v):s.shouldIndentNextLine(y,E)?_=h(_):_=v)}return g}function GU(o,e){return o.tokenization.isCheapToTokenize(e)?o.tokenization.getLineTokens(e).getStandardTokenType(0)===2:!1}var ZU=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},XU=function(o,e){return function(t,i){e(t,i,o)}};const Bv=class Bv extends ge{constructor(){super({id:Bv.ID,label:w("indentationToSpaces","Convert Indentation to Spaces"),alias:"Convert Indentation to Spaces",precondition:T.writable,metadata:{description:Xe("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 tj(s,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!0})}};Bv.ID="editor.action.indentationToSpaces";let wC=Bv;const zv=class zv extends ge{constructor(){super({id:zv.ID,label:w("indentationToTabs","Convert Indentation to Tabs"),alias:"Convert Indentation to Tabs",precondition:T.writable,metadata:{description:Xe("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 ij(s,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!1})}};zv.ID="editor.action.indentationToTabs";let yC=zv;class n0 extends ge{constructor(e,t,i){super(i),this.insertSpaces=e,this.displaySizeOnly=t}run(e,t){const i=e.get($a),n=e.get(Cs),s=t.getModel();if(!s)return;const r=n.getCreationOptions(s.getLanguageId(),s.uri,s.isForSimpleWidget),a=s.getOptions(),c=[1,2,3,4,5,6,7,8].map(u=>({id:u.toString(),label:u.toString(),description:u===r.tabSize&&u===a.tabSize?w("configuredTabSize","Configured Tab Size"):u===r.tabSize?w("defaultTabSize","Default Tab Size"):u===a.tabSize?w("currentTabSize","Current Tab Size"):void 0})),h=Math.min(s.getOptions().tabSize-1,7);setTimeout(()=>{i.pick(c,{placeHolder:w({key:"selectTabWidth",comment:["Tab corresponds to the tab key"]},"Select Tab Size for Current File"),activeItem:c[h]}).then(u=>{if(u&&s&&!s.isDisposed()){const g=parseInt(u.label,10);this.displaySizeOnly?s.updateOptions({tabSize:g}):s.updateOptions({tabSize:g,indentSize:g,insertSpaces:this.insertSpaces})}})},50)}}const Vv=class Vv extends n0{constructor(){super(!1,!1,{id:Vv.ID,label:w("indentUsingTabs","Indent Using Tabs"),alias:"Indent Using Tabs",precondition:void 0,metadata:{description:Xe("indentUsingTabsDescription","Use indentation with tabs.")}})}};Vv.ID="editor.action.indentUsingTabs";let SC=Vv;const Uv=class Uv extends n0{constructor(){super(!0,!1,{id:Uv.ID,label:w("indentUsingSpaces","Indent Using Spaces"),alias:"Indent Using Spaces",precondition:void 0,metadata:{description:Xe("indentUsingSpacesDescription","Use indentation with spaces.")}})}};Uv.ID="editor.action.indentUsingSpaces";let CC=Uv;const jv=class jv extends n0{constructor(){super(!0,!0,{id:jv.ID,label:w("changeTabDisplaySize","Change Tab Display Size"),alias:"Change Tab Display Size",precondition:void 0,metadata:{description:Xe("changeTabDisplaySizeDescription","Change the space size equivalent of the tab.")}})}};jv.ID="editor.action.changeTabDisplaySize";let xC=jv;const $v=class $v extends ge{constructor(){super({id:$v.ID,label:w("detectIndentation","Detect Indentation from Content"),alias:"Detect Indentation from Content",precondition:void 0,metadata:{description:Xe("detectIndentationDescription","Detect the indentation from content.")}})}run(e,t){const i=e.get(Cs),n=t.getModel();if(!n)return;const s=i.getCreationOptions(n.getLanguageId(),n.uri,n.isForSimpleWidget);n.detectIndentation(s.insertSpaces,s.tabSize)}};$v.ID="editor.action.detectIndentation";let LC=$v;class YU extends ge{constructor(){super({id:"editor.action.reindentlines",label:w("editor.reindentlines","Reindent Lines"),alias:"Reindent Lines",precondition:T.writable,metadata:{description:Xe("editor.reindentlinesDescription","Reindent the lines of the editor.")}})}run(e,t){const i=e.get(zn),n=t.getModel();if(!n)return;const s=MM(n,i,1,n.getLineCount());s.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,s),t.pushUndoStop())}}class QU extends ge{constructor(){super({id:"editor.action.reindentselectedlines",label:w("editor.reindentselectedlines","Reindent Selected Lines"),alias:"Reindent Selected Lines",precondition:T.writable,metadata:{description:Xe("editor.reindentselectedlinesDescription","Reindent the selected lines of the editor.")}})}run(e,t){const i=e.get(zn),n=t.getModel();if(!n)return;const s=t.getSelections();if(s===null)return;const r=[];for(const a of s){let c=a.startLineNumber,h=a.endLineNumber;if(c!==h&&a.endColumn===1&&h--,c===1){if(c===h)continue}else c--;const u=MM(n,i,c,h);r.push(...u)}r.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,r),t.pushUndoStop())}}class JU{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(O.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 uu;let G_=(uu=class{constructor(e,t){this.editor=e,this._languageConfigurationService=t,this.callOnDispose=new we,this.callOnModel=new we,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)||ej(i,e)||!i.tokenization.isCheapToTokenize(e.getStartPosition().lineNumber))return;const s=this.editor.getOption(12),{tabSize:r,indentSize:a,insertSpaces:c}=i.getOptions(),h=[],u={shiftIndent:_=>Iu.shiftIndent(_,_.length+1,r,a,c),unshiftIndent:_=>Iu.unshiftIndent(_,_.length+1,r,a,c)};let g=e.startLineNumber;for(;g<=e.endLineNumber;){if(this.shouldIgnoreLine(i,g)){g++;continue}break}if(g>e.endLineNumber)return;let f=i.getLineContent(g);if(!/\S/.test(f.substring(0,e.startColumn-1))){const _=$g(s,i,i.getLanguageId(),g,u,this._languageConfigurationService);if(_!==null){const y=ts(f),S=Ws(_,r),x=Ws(y,r);if(S!==x){const E=ef(S,r,c);h.push({range:new O(g,1,g,y.length+1),text:E}),f=E+f.substring(y.length)}else{const E=mE(i,g,this._languageConfigurationService);if(E===0||E===8)return}}}const v=g;for(;g<e.endLineNumber;){if(!/\S/.test(i.getLineContent(g+1))){g++;continue}break}if(g!==e.endLineNumber){const y=$g(s,{tokenization:{getLineTokens:S=>i.tokenization.getLineTokens(S),getLanguageId:()=>i.getLanguageId(),getLanguageIdAtPosition:(S,x)=>i.getLanguageIdAtPosition(S,x)},getLineContent:S=>S===v?f:i.getLineContent(S)},i.getLanguageId(),g+1,u,this._languageConfigurationService);if(y!==null){const S=Ws(y,r),x=Ws(ts(i.getLineContent(g+1)),r);if(S!==x){const E=S-x;for(let M=g+1;M<=e.endLineNumber;M++){const F=i.getLineContent(M),R=ts(F),q=Ws(R,r)+E,he=ef(q,r,c);he!==R&&h.push({range:new O(M,1,M,R.length+1),text:he})}}}}if(h.length>0){this.editor.pushUndoStop();const _=new JU(h,this.editor.getSelection());this.editor.executeCommand("autoIndentOnPaste",_),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()}},uu.ID="editor.contrib.autoIndentOnPaste",uu);G_=ZU([XU(1,zn)],G_);function ej(o,e){const t=i=>c2(o,i)===2;return t(e.getStartPosition())||t(e.getEndPosition())}function NM(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 c=o.getLineFirstNonWhitespaceColumn(r);if(c===0&&(c=o.getLineMaxColumn(r)),c===1)continue;const h=new O(r,1,r,c),u=o.getValueInRange(h),g=i?u.replace(/\t/ig,n):u.replace(s," ");e.addEditOperation(h,g)}}class tj{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),NM(e,t,this.tabSize,!0)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}class ij{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),NM(e,t,this.tabSize,!1)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}Zt(G_.ID,G_,2);Q(wC);Q(yC);Q(SC);Q(CC);Q(xC);Q(LC);Q(YU);Q(QU);Zt(Af.ID,Af,1);Zd.register(I_);class nj{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 _t(n.endLineNumber,Math.min(this._originalSelection.positionColumn,n.endColumn),n.endLineNumber,Math.min(this._originalSelection.positionColumn,n.endColumn)):new _t(n.endLineNumber,n.endColumn-this._text.length,n.endLineNumber,n.endColumn)}}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},oj=function(o,e){return function(t,i){e(t,i,o)}},Vm,Hl;let Vu=(Hl=class{static get(e){return e.getContribution(Vm.ID)}constructor(e,t){this.editor=e,this.editorWorkerService=t,this.decorations=this.editor.createDecorationsCollection()}dispose(){}run(e,t){var c;(c=this.currentRequest)==null||c.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 pE(this.editor,5),a=n.uri;return this.editorWorkerService.canNavigateValueSet(a)?(this.currentRequest=qn(h=>this.editorWorkerService.navigateValueSet(a,s,t)),this.currentRequest.then(h=>{var _;if(!h||!h.range||!h.value||!r.validate(this.editor))return;const u=O.lift(h.range);let g=h.range;const f=h.value.length-(s.endColumn-s.startColumn);g={startLineNumber:g.startLineNumber,startColumn:g.startColumn,endLineNumber:g.endLineNumber,endColumn:g.startColumn+h.value.length},f>1&&(s=new _t(s.startLineNumber,s.startColumn,s.endLineNumber,s.endColumn+f-1));const v=new nj(u,s,h.value);this.editor.pushUndoStop(),this.editor.executeCommand(e,v),this.editor.pushUndoStop(),this.decorations.set([{range:g,options:Vm.DECORATION}]),(_=this.decorationRemover)==null||_.cancel(),this.decorationRemover=Lb(350),this.decorationRemover.then(()=>this.decorations.clear()).catch(Vi)}).catch(Vi)):Promise.resolve(void 0)}},Vm=Hl,Hl.ID="editor.contrib.inPlaceReplaceController",Hl.DECORATION=oi.register({description:"in-place-replace",className:"valueSetReplacement"}),Hl);Vu=Vm=sj([oj(1,Ga)],Vu);class rj extends ge{constructor(){super({id:"editor.action.inPlaceReplace.up",label:w("InPlaceReplaceAction.previous.label","Replace with Previous Value"),alias:"Replace with Previous Value",precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:3159,weight:100}})}run(e,t){const i=Vu.get(t);return i?i.run(this.id,!1):Promise.resolve(void 0)}}class aj extends ge{constructor(){super({id:"editor.action.inPlaceReplace.down",label:w("InPlaceReplaceAction.next.label","Replace with Next Value"),alias:"Replace with Next Value",precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:3161,weight:100}})}run(e,t){const i=Vu.get(t);return i?i.run(this.id,!0):Promise.resolve(void 0)}}Zt(Vu.ID,Vu,4);Q(rj);Q(aj);class lj extends ge{constructor(){super({id:"expandLineSelection",label:w("expandLineSelection","Expand Line Selection"),alias:"Expand Line Selection",precondition:void 0,kbOpts:{weight:0,kbExpr:T.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,s1.expandLineSelection(n,n.getCursorStates())),n.revealAllCursors(i.source,!0)}}Q(lj);class cj{constructor(e,t,i){this._selection=e,this._cursors=t,this._selectionId=null,this._trimInRegexesAndStrings=i}getEditOperations(e,t){const i=dj(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 dj(o,e,t){e.sort((a,c)=>a.lineNumber===c.lineNumber?a.column-c.column:a.lineNumber-c.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,c=o.getLineCount();a<=c;a++){const h=o.getLineContent(a),u=h.length+1;let g=0;if(s<r&&e[s].lineNumber===a&&(g=e[s].column,s++,g===u)||h.length===0)continue;const f=Em(h);let v=0;if(f===-1)v=1;else if(f!==h.length-1)v=f+2;else continue;if(!t){if(!o.tokenization.hasAccurateTokensForLine(a))continue;const _=o.tokenization.getLineTokens(a),y=_.getStandardTokenType(_.findTokenIndexAtOffset(v));if(y===2||y===3)continue}v=Math.max(g,v),i[n++]=pn.delete(new O(a,v,a,u))}return i}class RM{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(`
43
+ `);s===""&&this._isCopyingDown&&(this._startLineNumberDelta++,this._endLineNumberDelta++),this._noop?t.addEditOperation(new O(i.endLineNumber,e.getLineMaxColumn(i.endLineNumber),i.endLineNumber+1,1),i.endLineNumber===e.getLineCount()?"":`
44
+ `):this._isCopyingDown?t.addEditOperation(new O(i.startLineNumber,1,i.startLineNumber,1),s+`
45
+ `):t.addEditOperation(new O(i.endLineNumber,e.getLineMaxColumn(i.endLineNumber),i.endLineNumber,e.getLineMaxColumn(i.endLineNumber)),`
46
+ `+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=_t.createWithDirection(n,s,r,a,this._selectionDirection)}return i}}var hj=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},uj=function(o,e){return function(t,i){e(t,i,o)}};let IC=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,f)=>e.getLanguageIdAtPosition(g,f),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:c,insertSpaces:h}=e.getOptions(),u=this.buildIndentConverter(a,c,h);if(r.startLineNumber===r.endLineNumber&&e.getLineMaxColumn(r.startLineNumber)===1){const g=r.startLineNumber,f=this._isMovingDown?g+1:g-1;e.getLineMaxColumn(f)===1?t.addEditOperation(new O(1,1,1,1),null):(t.addEditOperation(new O(g,1,g,1),e.getLineContent(f)),t.addEditOperation(new O(f,1,f,e.getLineMaxColumn(f)),null)),r=new _t(f,1,f,1)}else{let g,f;if(this._isMovingDown){g=r.endLineNumber+1,f=e.getLineContent(g),t.addEditOperation(new O(g-1,e.getLineMaxColumn(g-1),g,e.getLineMaxColumn(g)),null);let v=f;if(this.shouldAutoIndent(e,r)){const _=this.matchEnterRule(e,u,a,g,r.startLineNumber-1);if(_!==null){const S=ts(e.getLineContent(g)),x=_+Ws(S,a);v=ef(x,a,h)+this.trimStart(f)}else{const S={tokenization:{getLineTokens:E=>E===r.startLineNumber?e.tokenization.getLineTokens(g):e.tokenization.getLineTokens(E),getLanguageId:i,getLanguageIdAtPosition:n},getLineContent:E=>E===r.startLineNumber?e.getLineContent(g):e.getLineContent(E)},x=$g(this._autoIndent,S,e.getLanguageIdAtPosition(g,1),r.startLineNumber,u,this._languageConfigurationService);if(x!==null){const E=ts(e.getLineContent(g)),M=Ws(x,a),F=Ws(E,a);M!==F&&(v=ef(M,a,h)+this.trimStart(f))}}t.addEditOperation(new O(r.startLineNumber,1,r.startLineNumber,1),v+`
47
+ `);const y=this.matchEnterRuleMovingDown(e,u,a,r.startLineNumber,g,v);if(y!==null)y!==0&&this.getIndentEditsOfMovingBlock(e,t,r,a,h,y);else{const S={tokenization:{getLineTokens:E=>E===r.startLineNumber?e.tokenization.getLineTokens(g):E>=r.startLineNumber+1&&E<=r.endLineNumber+1?e.tokenization.getLineTokens(E-1):e.tokenization.getLineTokens(E),getLanguageId:i,getLanguageIdAtPosition:n},getLineContent:E=>E===r.startLineNumber?v:E>=r.startLineNumber+1&&E<=r.endLineNumber+1?e.getLineContent(E-1):e.getLineContent(E)},x=$g(this._autoIndent,S,e.getLanguageIdAtPosition(g,1),r.startLineNumber+1,u,this._languageConfigurationService);if(x!==null){const E=ts(e.getLineContent(r.startLineNumber)),M=Ws(x,a),F=Ws(E,a);if(M!==F){const R=M-F;this.getIndentEditsOfMovingBlock(e,t,r,a,h,R)}}}}else t.addEditOperation(new O(r.startLineNumber,1,r.startLineNumber,1),v+`
48
+ `)}else if(g=r.startLineNumber-1,f=e.getLineContent(g),t.addEditOperation(new O(g,1,g+1,1),null),t.addEditOperation(new O(r.endLineNumber,e.getLineMaxColumn(r.endLineNumber),r.endLineNumber,e.getLineMaxColumn(r.endLineNumber)),`
49
+ `+f),this.shouldAutoIndent(e,r)){const v={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)},_=this.matchEnterRule(e,u,a,r.startLineNumber,r.startLineNumber-2);if(_!==null)_!==0&&this.getIndentEditsOfMovingBlock(e,t,r,a,h,_);else{const y=$g(this._autoIndent,v,e.getLanguageIdAtPosition(r.startLineNumber,1),g,u,this._languageConfigurationService);if(y!==null){const S=ts(e.getLineContent(r.startLineNumber)),x=Ws(y,a),E=Ws(S,a);if(x!==E){const M=x-E;this.getIndentEditsOfMovingBlock(e,t,r,a,h,M)}}}}}this._selectionId=t.trackSelection(r)}buildIndentConverter(e,t,i){return{shiftIndent:n=>Iu.shiftIndent(n,n.length+1,e,t,i),unshiftIndent:n=>Iu.unshiftIndent(n,n.length+1,e,t,i)}}parseEnterResult(e,t,i,n,s){if(s){let r=s.indentation;s.indentAction===Xp.None||s.indentAction===Xp.Indent?r=s.indentation+s.appendText:s.indentAction===Xp.IndentOutdent?r=s.indentation:s.indentAction===Xp.Outdent&&(r=t.unshiftIndent(s.indentation)+s.appendText);const a=e.getLineContent(n);if(this.trimStart(a).indexOf(this.trimStart(r))>=0){const c=ts(e.getLineContent(n));let h=ts(r);const u=mE(e,n,this._languageConfigurationService);u!==null&&u&2&&(h=t.unshiftIndent(h));const g=Ws(h,i),f=Ws(c,i);return g-f}}return null}matchEnterRuleMovingDown(e,t,i,n,s,r){if(Em(r)>=0){const a=e.getLineMaxColumn(s),c=ww(this._autoIndent,e,new O(s,a,s,a),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,c)}else{let a=n-1;for(;a>=1;){const u=e.getLineContent(a);if(Em(u)>=0)break;a--}if(a<1||n>e.getLineCount())return null;const c=e.getLineMaxColumn(a),h=ww(this._autoIndent,e,new O(a,c,a,c),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,h)}}matchEnterRule(e,t,i,n,s,r){let a=s;for(;a>=1;){let u;if(a===s&&r!==void 0?u=r:u=e.getLineContent(a),Em(u)>=0)break;a--}if(a<1||n>e.getLineCount())return null;const c=e.getLineMaxColumn(a),h=ww(this._autoIndent,e,new O(a,c,a,c),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,h)}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 c=e.getLineContent(a),h=ts(c),g=Ws(h,n)+r,f=ef(g,n,s);f!==h&&(t.addEditOperation(new O(a,1,a,h.length+1),f),a===i.endLineNumber&&i.endColumn<=h.length+1&&f===""&&(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}};IC=hj([uj(3,zn)],IC);const $h=class $h{static getCollator(){return $h._COLLATOR||($h._COLLATOR=new Intl.Collator),$h._COLLATOR}constructor(e,t){this.selection=e,this.descending=t,this.selectionId=null}getEditOperations(e,t){const i=gj(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=AM(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}};$h._COLLATOR=null;let Bf=$h;function AM(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(Bf.getCollator().compare),t===!0&&(r=r.reverse()),{startLineNumber:i,endLineNumber:n,before:s,after:r}}function gj(o,e,t){const i=AM(o,e,t);return i?pn.replace(new O(i.startLineNumber,1,i.endLineNumber,o.getLineMaxColumn(i.endLineNumber)),i.after.join(`
50
+ `)):null}class OM extends ge{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)=>O.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 RM(r.selection,this.down,r.ignore));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class fj extends OM{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:w("lines.copyUp","Copy Line Up"),alias:"Copy Line Up",precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:We.MenubarSelectionMenu,group:"2_line",title:w({key:"miCopyLinesUp",comment:["&& denotes a mnemonic"]},"&&Copy Line Up"),order:1}})}}class pj extends OM{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:w("lines.copyDown","Copy Line Down"),alias:"Copy Line Down",precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:We.MenubarSelectionMenu,group:"2_line",title:w({key:"miCopyLinesDown",comment:["&& denotes a mnemonic"]},"Co&&py Line Down"),order:2}})}}class mj extends ge{constructor(){super({id:"editor.action.duplicateSelection",label:w("duplicateSelection","Duplicate Selection"),alias:"Duplicate Selection",precondition:T.writable,menuOpts:{menuId:We.MenubarSelectionMenu,group:"2_line",title:w({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 RM(a,!0));else{const c=new _t(a.endLineNumber,a.endColumn,a.endLineNumber,a.endColumn);n.push(new d2(c,r.getValueInRange(a)))}t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}class FM extends ge{constructor(e,t){super(t),this.down=e}run(e,t){const i=e.get(zn),n=[],s=t.getSelections()||[],r=t.getOption(12);for(const a of s)n.push(new IC(a,this.down,r,i));t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}class _j extends FM{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:w("lines.moveUp","Move Line Up"),alias:"Move Line Up",precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:We.MenubarSelectionMenu,group:"2_line",title:w({key:"miMoveLinesUp",comment:["&& denotes a mnemonic"]},"Mo&&ve Line Up"),order:3}})}}class vj extends FM{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:w("lines.moveDown","Move Line Down"),alias:"Move Line Down",precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:We.MenubarSelectionMenu,group:"2_line",title:w({key:"miMoveLinesDown",comment:["&& denotes a mnemonic"]},"Move &&Line Down"),order:4}})}}class HM extends ge{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 _t(1,1,i.getLineCount(),i.getLineMaxColumn(i.getLineCount()))]);for(const r of n)if(!Bf.canRun(t.getModel(),r,this.descending))return;const s=[];for(let r=0,a=n.length;r<a;r++)s[r]=new Bf(n[r],this.descending);t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class bj extends HM{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:w("lines.sortAscending","Sort Lines Ascending"),alias:"Sort Lines Ascending",precondition:T.writable})}}class wj extends HM{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:w("lines.sortDescending","Sort Lines Descending"),alias:"Sort Lines Descending",precondition:T.writable})}}class yj extends ge{constructor(){super({id:"editor.action.removeDuplicateLines",label:w("lines.deleteDuplicates","Delete Duplicate Lines"),alias:"Delete Duplicate Lines",precondition:T.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,c=t.getSelections();c.length===1&&c[0].isEmpty()&&(c=[new _t(1,1,i.getLineCount(),i.getLineMaxColumn(i.getLineCount()))],a=!1);for(const h of c){const u=new Set,g=[];for(let y=h.startLineNumber;y<=h.endLineNumber;y++){const S=i.getLineContent(y);u.has(S)||(g.push(S),u.add(S))}const f=new _t(h.startLineNumber,1,h.endLineNumber,i.getLineMaxColumn(h.endLineNumber)),v=h.startLineNumber-r,_=new _t(v,1,v+g.length-1,g[g.length-1].length);n.push(pn.replace(f,g.join(`
51
+ `))),s.push(_),r+=h.endLineNumber-h.startLineNumber+1-g.length}t.pushUndoStop(),t.executeEdits(this.id,n,a?s:void 0),t.pushUndoStop()}}const qv=class qv extends ge{constructor(){super({id:qv.ID,label:w("lines.trimTrailingWhitespace","Trim Trailing Whitespace"),alias:"Trim Trailing Whitespace",precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:Dn(2089,2102),weight:100}})}run(e,t,i){let n=[];i.reason==="auto-save"&&(n=(t.getSelections()||[]).map(u=>new Qe(u.positionLineNumber,u.positionColumn)));const s=t.getSelection();if(s===null)return;const r=e.get(on),a=t.getModel(),c=r.getValue("files.trimTrailingWhitespaceInRegexAndStrings",{overrideIdentifier:a==null?void 0:a.getLanguageId(),resource:a==null?void 0:a.uri}),h=new cj(s,n,c);t.pushUndoStop(),t.executeCommands(this.id,[h]),t.pushUndoStop()}};qv.ID="editor.action.trimTrailingWhitespace";let kC=qv;class Sj extends ge{constructor(){super({id:"editor.action.deleteLines",label:w("lines.delete","Delete Line"),alias:"Delete Line",precondition:T.writable,kbOpts:{kbExpr:T.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 c=0,h=i.length;c<h;c++){const u=i[c];let g=u.startLineNumber,f=u.endLineNumber,v=1,_=n.getLineMaxColumn(f);f<n.getLineCount()?(f+=1,_=1):g>1&&(g-=1,v=n.getLineMaxColumn(g)),r.push(pn.replace(new _t(g,v,f,_),"")),a.push(new _t(g-s,u.positionColumn,g-s,u.positionColumn)),s+=u.endLineNumber-u.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 Cj extends ge{constructor(){super({id:"editor.action.indentLines",label:w("lines.indent","Indent Line"),alias:"Indent Line",precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:2142,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,h2.indent(i.cursorConfig,t.getModel(),t.getSelections())),t.pushUndoStop())}}class xj extends ge{constructor(){super({id:"editor.action.outdentLines",label:w("lines.outdent","Outdent Line"),alias:"Outdent Line",precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:2140,weight:100}})}run(e,t){Dm.Outdent.runEditorCommand(e,t,null)}}class Lj extends ge{constructor(){super({id:"editor.action.insertLineBefore",label:w("lines.insertBefore","Insert Line Above"),alias:"Insert Line Above",precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:3075,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,_E.lineInsertBefore(i.cursorConfig,t.getModel(),t.getSelections())))}}class Ij extends ge{constructor(){super({id:"editor.action.insertLineAfter",label:w("lines.insertAfter","Insert Line Below"),alias:"Insert Line Below",precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:2051,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,_E.lineInsertAfter(i.cursorConfig,t.getModel(),t.getSelections())))}}class WM extends ge{run(e,t){if(!t.hasModel())return;const i=t.getSelection(),n=this._getRangesToDelete(t),s=[];for(let c=0,h=n.length-1;c<h;c++){const u=n[c],g=n[c+1];O.intersectRanges(u,g)===null?s.push(u):n[c+1]=O.plusRange(u,g)}s.push(n[n.length-1]);const r=this._getEndCursorState(i,s),a=s.map(c=>pn.replace(c,""));t.pushUndoStop(),t.executeEdits(this.id,a,r),t.pushUndoStop()}}class kj extends WM{constructor(){super({id:"deleteAllLeft",label:w("lines.deleteAllLeft","Delete All Left"),alias:"Delete All Left",precondition:T.writable,kbOpts:{kbExpr:T.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 c=r.startLineNumber-s;a=new _t(c,r.startColumn,c,r.startColumn)}else a=new _t(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(O.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 O(r,a,s.startLineNumber,1)}else return new O(s.startLineNumber,1,s.startLineNumber,s.startColumn);else return new O(s.startLineNumber,1,s.endLineNumber,s.endColumn)}),i)}}class Dj extends WM{constructor(){super({id:"deleteAllRight",label:w("lines.deleteAllRight","Delete All Right"),alias:"Delete All Right",precondition:T.writable,kbOpts:{kbExpr:T.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 c=t[s],h=new _t(c.startLineNumber-a,c.startColumn,c.startLineNumber-a,c.startColumn);c.intersectRanges(e)?i=h:n.push(h)}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 O(s.startLineNumber,s.startColumn,s.startLineNumber+1,1):new O(s.startLineNumber,s.startColumn,s.startLineNumber,r)}return s});return n.sort(O.compareRangesUsingStarts),n}}class Ej extends ge{constructor(){super({id:"editor.action.joinLines",label:w("lines.joinLines","Join Lines"),alias:"Join Lines",precondition:T.writable,kbOpts:{kbExpr:T.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(O.compareRangesUsingStarts);const s=[],r=i.reduce((f,v)=>f.isEmpty()?f.endLineNumber===v.startLineNumber?(n.equalsSelection(f)&&(n=v),v):v.startLineNumber>f.endLineNumber+1?(s.push(f),v):new _t(f.startLineNumber,f.startColumn,v.endLineNumber,v.endColumn):v.startLineNumber>f.endLineNumber?(s.push(f),v):new _t(f.startLineNumber,f.startColumn,v.endLineNumber,v.endColumn));s.push(r);const a=t.getModel();if(a===null)return;const c=[],h=[];let u=n,g=0;for(let f=0,v=s.length;f<v;f++){const _=s[f],y=_.startLineNumber,S=1;let x=0,E,M;const F=a.getLineLength(_.endLineNumber)-_.endColumn;if(_.isEmpty()||_.startLineNumber===_.endLineNumber){const q=_.getStartPosition();q.lineNumber<a.getLineCount()?(E=y+1,M=a.getLineMaxColumn(E)):(E=q.lineNumber,M=a.getLineMaxColumn(q.lineNumber))}else E=_.endLineNumber,M=a.getLineMaxColumn(E);let R=a.getLineContent(y);for(let q=y+1;q<=E;q++){const he=a.getLineContent(q),pe=a.getLineFirstNonWhitespaceColumn(q);if(pe>=1){let Ce=!0;R===""&&(Ce=!1),Ce&&(R.charAt(R.length-1)===" "||R.charAt(R.length-1)===" ")&&(Ce=!1,R=R.replace(/[\s\uFEFF\xA0]+$/g," "));const Pe=he.substr(pe-1);R+=(Ce?" ":"")+Pe,Ce?x=Pe.length+1:x=Pe.length}else x=0}const Z=new O(y,S,E,M);if(!Z.isEmpty()){let q;_.isEmpty()?(c.push(pn.replace(Z,R)),q=new _t(Z.startLineNumber-g,R.length-x+1,y-g,R.length-x+1)):_.startLineNumber===_.endLineNumber?(c.push(pn.replace(Z,R)),q=new _t(_.startLineNumber-g,_.startColumn,_.endLineNumber-g,_.endColumn)):(c.push(pn.replace(Z,R)),q=new _t(_.startLineNumber-g,_.startColumn,_.startLineNumber-g,R.length-F)),O.intersectRanges(Z,n)!==null?u=q:h.push(q)}g+=Z.endLineNumber-Z.startLineNumber}h.unshift(u),t.pushUndoStop(),t.executeEdits(this.id,c,h),t.pushUndoStop()}}class Pj extends ge{constructor(){super({id:"editor.action.transpose",label:w("editor.transpose","Transpose Characters around the Cursor"),alias:"Transpose Characters around the Cursor",precondition:T.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 c=i[r];if(!c.isEmpty())continue;const h=c.getStartPosition(),u=n.getLineMaxColumn(h.lineNumber);if(h.column>=u){if(h.lineNumber===n.getLineCount())continue;const g=new O(h.lineNumber,Math.max(1,h.column-1),h.lineNumber+1,1),f=n.getValueInRange(g).split("").reverse().join("");s.push(new ap(new _t(h.lineNumber,Math.max(1,h.column-1),h.lineNumber+1,1),f))}else{const g=new O(h.lineNumber,Math.max(1,h.column-1),h.lineNumber,h.column+1),f=n.getValueInRange(g).split("").reverse().join("");s.push(new AD(g,f,new _t(h.lineNumber,h.column+1,h.lineNumber,h.column+1)))}}t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class Qd extends ge{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 c=a.getStartPosition(),h=t.getConfiguredWordAtPosition(c);if(!h)continue;const u=new O(c.lineNumber,h.startColumn,c.lineNumber,h.endColumn),g=n.getValueInRange(u);r.push(pn.replace(u,this._modifyText(g,s)))}else{const c=n.getValueInRange(a);r.push(pn.replace(a,this._modifyText(c,s)))}t.pushUndoStop(),t.executeEdits(this.id,r),t.pushUndoStop()}}class Tj extends Qd{constructor(){super({id:"editor.action.transformToUppercase",label:w("editor.transformToUppercase","Transform to Uppercase"),alias:"Transform to Uppercase",precondition:T.writable})}_modifyText(e,t){return e.toLocaleUpperCase()}}class Mj extends Qd{constructor(){super({id:"editor.action.transformToLowercase",label:w("editor.transformToLowercase","Transform to Lowercase"),alias:"Transform to Lowercase",precondition:T.writable})}_modifyText(e,t){return e.toLocaleLowerCase()}}class Ra{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 Kv=class Kv extends Qd{constructor(){super({id:"editor.action.transformToTitlecase",label:w("editor.transformToTitlecase","Transform to Title Case"),alias:"Transform to Title Case",precondition:T.writable})}_modifyText(e,t){const i=Kv.titleBoundary.get();return i?e.toLocaleLowerCase().replace(i,n=>n.toLocaleUpperCase()):e}};Kv.titleBoundary=new Ra("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu");let Z_=Kv;const qh=class qh extends Qd{constructor(){super({id:"editor.action.transformToSnakecase",label:w("editor.transformToSnakecase","Transform to Snake Case"),alias:"Transform to Snake Case",precondition:T.writable})}_modifyText(e,t){const i=qh.caseBoundary.get(),n=qh.singleLetters.get();return!i||!n?e:e.replace(i,"$1_$2").replace(n,"$1_$2$3").toLocaleLowerCase()}};qh.caseBoundary=new Ra("(\\p{Ll})(\\p{Lu})","gmu"),qh.singleLetters=new Ra("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu");let tf=qh;const Gv=class Gv extends Qd{constructor(){super({id:"editor.action.transformToCamelcase",label:w("editor.transformToCamelcase","Transform to Camel Case"),alias:"Transform to Camel Case",precondition:T.writable})}_modifyText(e,t){const i=Gv.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("")}};Gv.wordBoundary=new Ra("[_\\s-]","gm");let X_=Gv;const Kh=class Kh extends Qd{constructor(){super({id:"editor.action.transformToPascalcase",label:w("editor.transformToPascalcase","Transform to Pascal Case"),alias:"Transform to Pascal Case",precondition:T.writable})}_modifyText(e,t){const i=Kh.wordBoundary.get(),n=Kh.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("")}};Kh.wordBoundary=new Ra("[_\\s-]","gm"),Kh.wordBoundaryToMaintain=new Ra("(?<=\\.)","gm");let Y_=Kh;const ll=class ll extends Qd{static isSupported(){return[this.caseBoundary,this.singleLetters,this.underscoreBoundary].every(t=>t.isSupported())}constructor(){super({id:"editor.action.transformToKebabcase",label:w("editor.transformToKebabcase","Transform to Kebab Case"),alias:"Transform to Kebab Case",precondition:T.writable})}_modifyText(e,t){const i=ll.caseBoundary.get(),n=ll.singleLetters.get(),s=ll.underscoreBoundary.get();return!i||!n||!s?e:e.replace(s,"$1-$3").replace(i,"$1-$2").replace(n,"$1-$2").toLocaleLowerCase()}};ll.caseBoundary=new Ra("(\\p{Ll})(\\p{Lu})","gmu"),ll.singleLetters=new Ra("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu"),ll.underscoreBoundary=new Ra("(\\S)(_)(\\S)","gm");let Q_=ll;Q(fj);Q(pj);Q(mj);Q(_j);Q(vj);Q(bj);Q(wj);Q(yj);Q(kC);Q(Sj);Q(Cj);Q(xj);Q(Lj);Q(Ij);Q(kj);Q(Dj);Q(Ej);Q(Pj);Q(Tj);Q(Mj);tf.caseBoundary.isSupported()&&tf.singleLetters.isSupported()&&Q(tf);X_.wordBoundary.isSupported()&&Q(X_);Y_.wordBoundary.isSupported()&&Q(Y_);Z_.titleBoundary.isSupported()&&Q(Z_);Q_.isSupported()&&Q(Q_);var Nj=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},_m=function(o,e){return function(t,i){e(t,i,o)}},Um;const BM=new di("LinkedEditingInputVisible",!1),Rj="linked-editing-decoration";var Wl;let Uu=(Wl=class extends Se{static get(e){return e.getContribution(Um.ID)}constructor(e,t,i,n,s){super(),this.languageConfigurationService=n,this._syncRangesToken=0,this._localToDispose=this._register(new we),this._editor=e,this._providers=i.linkedEditingRangeProvider,this._enabled=!1,this._visibleContextKey=BM.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 we),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(Nn.runAndSubscribe(t.onDidChangeLanguageConfiguration,()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(t.getLanguageId()).getWordDefinition()}));const n=new jl(this._debounceInformation.get(t)),s=()=>{this._rangeUpdateTriggerPromise=n.trigger(()=>this.updateRanges(),this._debounceDuration??this._debounceInformation.get(t))},r=new jl(0),a=c=>{this._rangeSyncTriggerPromise=r.trigger(()=>this._syncRanges(c))};this._localToDispose.add(this._editor.onDidChangeCursorPosition(()=>{s()})),this._localToDispose.add(this._editor.onDidChangeModelContent(c=>{if(!this._ignoreChangeEvent&&this._currentDecorations.length>0){const h=this._currentDecorations.getRange(0);if(h&&c.changes.every(u=>h.intersectRanges(u.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 c=this._currentDecorations.getRange(r);if(c)if(c.startLineNumber!==c.endLineNumber)s.push({range:c,text:n});else{let h=t.getValueInRange(c),u=n,g=c.startColumn,f=c.endColumn;const v=bp(h,u);g+=v,h=h.substr(v),u=u.substr(v);const _=u2(h,u);f-=_,h=h.substr(0,h.length-_),u=u.substr(0,u.length-_),(g!==f||u.length!==0)&&s.push({range:new O(c.startLineNumber,g,c.endLineNumber,f),text:u})}}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 Kn;try{const r=new qs(!1),a=await zM(this._providers,i,t,s.token);if(this._debounceInformation.update(i,r.elapsed()),s!==this._currentRequestCts||(this._currentRequestCts=null,n!==i.getVersionId()))return;let c=[];a!=null&&a.ranges&&(c=a.ranges),this._currentWordPattern=(a==null?void 0:a.wordPattern)||this._languageWordPattern;let h=!1;for(let g=0,f=c.length;g<f;g++)if(O.containsPosition(c[g],t)){if(h=!0,g!==0){const v=c[g];c.splice(g,1),c.unshift(v)}break}if(!h){this.clearRanges();return}const u=c.map(g=>({range:g,options:Um.DECORATION}));this._visibleContextKey.set(!0),this._currentDecorations.set(u),this._syncRangesToken++}catch(r){Ql(r)||Vi(r),(this._currentRequestCts===s||!this._currentRequestCts)&&this.clearRanges()}}},Um=Wl,Wl.ID="editor.contrib.linkedEditing",Wl.DECORATION=oi.register({description:"linked-editing",stickiness:0,className:Rj}),Wl);Uu=Um=Nj([_m(1,wi),_m(2,Je),_m(3,zn),_m(4,yo)],Uu);class Aj extends ge{constructor(){super({id:"editor.action.linkedEditing",label:w("linkedEditing.label","Start Linked Editing"),alias:"Start Linked Editing",precondition:ie.and(T.writable,T.hasRenameProvider),kbOpts:{kbExpr:T.editorTextFocus,primary:3132,weight:100}})}runCommand(e,t){const i=e.get(xn),[n,s]=Array.isArray(t)&&t||[void 0,void 0];return Ri.isUri(n)&&Qe.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))))},Vi):super.runCommand(e,t)}run(e,t){const i=Uu.get(t);return i?Promise.resolve(i.updateRanges(!0)):Promise.resolve()}}const Oj=Rs.bindToContribution(Uu.get);it(new Oj({id:"cancelLinkedEditingInput",precondition:BM,handler:o=>o.clearRanges(),kbOpts:{kbExpr:T.editorTextFocus,weight:199,primary:9,secondary:[1033]}}));function zM(o,e,t,i){const n=o.ordered(e);return o1(n.map(s=>async()=>{try{return await s.provideLinkedEditingRanges(e,t,i)}catch(r){Cn(r);return}}),s=>!!s&&io(s==null?void 0:s.ranges))}Ke("editor.linkedEditingBackground",{dark:ii.fromHex("#f00").transparent(.3),light:ii.fromHex("#f00").transparent(.3),hcDark:ii.fromHex("#f00").transparent(.3),hcLight:ii.white},w("editorLinkedEditingBackground","Background color when the editor auto renames on type."));As("_executeLinkedEditingProvider",(o,e,t)=>{const{linkedEditingRangeProvider:i}=o.get(Je);return zM(i,e,t,$t.None)});Zt(Uu.ID,Uu,1);Q(Aj);let Fj=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 J_{constructor(e){this._disposables=new we;let t=[];for(const[i,n]of e){const s=i.links.map(r=>new Fj(r,n));t=J_._union(t,s),iE(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 c=e[n],h=t[r];if(O.areIntersectingOrTouching(c.range,h.range)){n++;continue}O.compareRangesUsingStarts(c.range,h.range)<0?(i.push(c),n++):(i.push(h),r++)}for(;n<s;n++)i.push(e[n]);for(;r<a;r++)i.push(t[r]);return i}}function VM(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])},Cn));return Promise.all(n).then(()=>{const s=new J_(Aa(i));return t.isCancellationRequested?(s.dispose(),new J_([])):s})}Gi.registerCommand("_executeLinkProvider",async(o,...e)=>{let[t,i]=e;Si(t instanceof Ri),typeof i!="number"&&(i=0);const{linkProvider:n}=o.get(Je),s=o.get(Cs).getModel(t);if(!s)return[];const r=await VM(n,s,$t.None);if(!r)return[];for(let c=0;c<Math.min(i,r.links.length);c++)await r.links[c].resolve($t.None);const a=r.links.slice(0);return r.dispose(),a});var Hj=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},vm=function(o,e){return function(t,i){e(t,i,o)}},DC,cd;let zf=(cd=class extends Se{static get(e){return e.getContribution(DC.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 Rn(()=>this.computeLinksNow(),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;const r=this._register(new Ub(e));this._register(r.onMouseMoveOrRelevantKeyDown(([a,c])=>{this._onEditorMouseMove(a,c)})),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=qn(t=>VM(this.providers,e,t));try{const t=new qs(!1);if(this.activeLinksList=await this.computePromise,this.debounceInformation.update(e,t.elapsed()),e.isDisposed())return;this.updateDecorations(this.activeLinksList.links)}catch(t){Vi(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(Yh.decoration(r,t));this.editor.changeDecorations(r=>{const a=r.deltaDecorations(i,s);this.currentOccurrences={},this.activeLinkDecorationId=null;for(let c=0,h=a.length;c<h;c++){const u=new Yh(e[c],a[c]);this.currentOccurrences[u.decorationId]=u}})}_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($t.None).then(s=>{if(typeof s=="string"&&this.editor.hasModel()){const r=this.editor.getModel().uri;if(r.scheme===Ds.file&&s.startsWith(`${Ds.file}:`)){const a=Ri.parse(s);if(a.scheme===Ds.file){const c=g2(a);let h=null;c.startsWith("/./")||c.startsWith("\\.\\")?h=`.${c.substr(1)}`:(c.startsWith("//./")||c.startsWith("\\\\.\\"))&&(h=`.${c.substr(2)}`),h&&(s=f2(r,h))}}}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(w("invalid.url","Failed to open this link because it is not well-formed: {0}",n.url.toString())):r==="missing"?this.notificationService.warn(w("missing.url","Failed to open this link because its target is missing.")):Vi(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()}},DC=cd,cd.ID="editor.linkDetector",cd);zf=DC=Hj([vm(1,_r),vm(2,Ss),vm(3,Je),vm(4,yo)],zf);const bk={general:oi.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),active:oi.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"})};class Yh{static decoration(e,t){return{range:e.range,options:Yh._getOptions(e,t,!1)}}static _getOptions(e,t,i){const n={...i?bk.active:bk.general};return n.hoverMessage=Wj(e,t),n}constructor(e,t){this.link=e,this.decorationId=t}activate(e,t){e.changeDecorationOptions(this.decorationId,Yh._getOptions(this.link,t,!0))}deactivate(e,t){e.changeDecorationOptions(this.decorationId,Yh._getOptions(this.link,t,!1))}}function Wj(o,e){const t=o.url&&/^command:/i.test(o.url.toString()),i=o.tooltip?o.tooltip:t?w("links.navigate.executeCmd","Execute command"):w("links.navigate.follow","Follow link"),n=e?Qr?w("links.navigate.kb.meta.mac","cmd + click"):w("links.navigate.kb.meta","ctrl + click"):Qr?w("links.navigate.kb.alt.mac","option + click"):w("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 c=a[1];s=w("tooltip.explanation","Execute command {0}",c)}}return new us("",!0).appendLink(o.url.toString(!0).replace(/ /g,"%20"),i,s).appendMarkdown(` (${n})`)}else return new us().appendText(`${i} (${n})`)}class Bj extends ge{constructor(){super({id:"editor.action.openLink",label:w("label","Open Link"),alias:"Open Link",precondition:void 0})}run(e,t){const i=zf.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)}}}Zt(zf.ID,zf,1);Q(Bj);const D0=class D0 extends Se{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})}))}};D0.ID="editor.contrib.longLinesHelper";let ev=D0;Zt(ev.ID,ev,2);const zj=Ke("editor.wordHighlightBackground",{dark:"#575757B8",light:"#57575740",hcDark:null,hcLight:null},w("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);Ke("editor.wordHighlightStrongBackground",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},w("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);Ke("editor.wordHighlightTextBackground",zj,w("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 Vj=Ke("editor.wordHighlightBorder",{light:null,dark:null,hcDark:xd,hcLight:xd},w("wordHighlightBorder","Border color of a symbol during read-access, like reading a variable."));Ke("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:xd,hcLight:xd},w("wordHighlightStrongBorder","Border color of a symbol during write-access, like writing to a variable."));Ke("editor.wordHighlightTextBorder",Vj,w("wordHighlightTextBorder","Border color of a textual occurrence for a symbol."));const Uj=Ke("editorOverviewRuler.wordHighlightForeground","#A0A0A0CC",w("overviewRulerWordHighlightForeground","Overview ruler marker color for symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),jj=Ke("editorOverviewRuler.wordHighlightStrongForeground","#C0A0C0CC",w("overviewRulerWordHighlightStrongForeground","Overview ruler marker color for write-access symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),$j=Ke("editorOverviewRuler.wordHighlightTextForeground",vE,w("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),qj=oi.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:Pn(jj),position:Kr.Center},minimap:{color:Pn(Ib),position:1}}),Kj=oi.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:Pn($j),position:Kr.Center},minimap:{color:Pn(Ib),position:1}}),Gj=oi.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:Pn(vE),position:Kr.Center},minimap:{color:Pn(Ib),position:1}}),Zj=oi.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),Xj=oi.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:Pn(Uj),position:Kr.Center},minimap:{color:Pn(Ib),position:1}});function Yj(o){return o===o_.Write?qj:o===o_.Text?Kj:Xj}function Qj(o){return o?Zj:Gj}mb((o,e)=>{const t=o.getColor(p2);t&&e.addRule(`.monaco-editor .selectionHighlight { background-color: ${t.transparent(.5)}; }`)});var Jj=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},e$=function(o,e){return function(t,i){e(t,i,o)}},EC;function ec(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?w("cursorAdded","Cursor added: {0}",i):w("cursorsAdded","Cursors added: {0}",i);wu(n)}}class t$ extends ge{constructor(){super({id:"editor.action.insertCursorAbove",label:w("mutlicursor.insertAbove","Add Cursor Above"),alias:"Add Cursor Above",precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:We.MenubarSelectionMenu,group:"3_multi",title:w({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,s1.addCursorUp(s,r,n)),s.revealTopMostCursor(i.source),ec(r,s.getCursorStates())}}class i$ extends ge{constructor(){super({id:"editor.action.insertCursorBelow",label:w("mutlicursor.insertBelow","Add Cursor Below"),alias:"Add Cursor Below",precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:We.MenubarSelectionMenu,group:"3_multi",title:w({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,s1.addCursorDown(s,r,n)),s.revealBottomMostCursor(i.source),ec(r,s.getCursorStates())}}class n$ extends ge{constructor(){super({id:"editor.action.insertCursorAtEndOfEachLineSelected",label:w("mutlicursor.insertAtEndOfEachLineSelected","Add Cursors to Line Ends"),alias:"Add Cursors to Line Ends",precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:We.MenubarSelectionMenu,group:"3_multi",title:w({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 _t(n,s,n,s))}e.endColumn>1&&i.push(new _t(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(c=>this.getCursorsForSelection(c,i,a)),a.length>0&&t.setSelections(a),ec(r,s.getCursorStates())}}class s$ extends ge{constructor(){super({id:"editor.action.addCursorsToBottom",label:w("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 c=i[0].startLineNumber;c<=n;c++)s.push(new _t(c,i[0].startColumn,c,i[0].endColumn));const r=t._getViewModel(),a=r.getCursorStates();s.length>0&&t.setSelections(s),ec(a,r.getCursorStates())}}class o$ extends ge{constructor(){super({id:"editor.action.addCursorsToTop",label:w("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 _t(a,i[0].startColumn,a,i[0].endColumn));const s=t._getViewModel(),r=s.getCursorStates();n.length>0&&t.setSelections(n),ec(r,s.getCursorStates())}}class bm{constructor(e,t,i){this.selections=e,this.revealRange=t,this.revealScrollType=i}}class Vf{static create(e,t){if(!e.hasModel())return null;const i=t.getState();if(!e.hasTextFocus()&&i.isRevealed&&i.searchString.length>0)return new Vf(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 c=e.getSelection();let h,u=null;if(c.isEmpty()){const g=e.getConfiguredWordAtPosition(c.getStartPosition());if(!g)return null;h=g.word,u=new _t(c.startLineNumber,g.startColumn,c.startLineNumber,g.endColumn)}else h=e.getModel().getValueInRange(c).replace(/\r\n/g,`
52
+ `);return new Vf(e,t,n,h,s,r,u)}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 bm(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 bm(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 _t(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 bm(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 bm(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 _t(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 Zv=class Zv extends Se{static get(e){return e.getContribution(Zv.ID)}constructor(e){super(),this._sessionDispose=this._register(new we),this._editor=e,this._ignoreSelectionChange=!1,this._session=null}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(e){if(!this._session){const t=Vf.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 _t(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(!UM(this._editor.getModel(),t,n)){const r=this._editor.getModel(),a=[];for(let c=0,h=t.length;c<h;c++)a[c]=this._expandEmptyToWord(r,t[c]);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 _t(s.range.startLineNumber,s.range.startColumn,s.range.endLineNumber,s.range.endColumn)))}}};Zv.ID="editor.contrib.multiCursorController";let ju=Zv;class sg extends ge{run(e,t){const i=ju.get(t);if(!i)return;const n=t._getViewModel();if(n){const s=n.getCursorStates(),r=Ms.get(t);if(r)this._run(i,r);else{const a=e.get(Bt).createInstance(Ms,t);this._run(i,a),a.dispose()}ec(s,n.getCursorStates())}}}class r$ extends sg{constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:w("addSelectionToNextFindMatch","Add Selection To Next Find Match"),alias:"Add Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:T.focus,primary:2082,weight:100},menuOpts:{menuId:We.MenubarSelectionMenu,group:"3_multi",title:w({key:"miAddSelectionToNextFindMatch",comment:["&& denotes a mnemonic"]},"Add &&Next Occurrence"),order:5}})}_run(e,t){e.addSelectionToNextFindMatch(t)}}class a$ extends sg{constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:w("addSelectionToPreviousFindMatch","Add Selection To Previous Find Match"),alias:"Add Selection To Previous Find Match",precondition:void 0,menuOpts:{menuId:We.MenubarSelectionMenu,group:"3_multi",title:w({key:"miAddSelectionToPreviousFindMatch",comment:["&& denotes a mnemonic"]},"Add P&&revious Occurrence"),order:6}})}_run(e,t){e.addSelectionToPreviousFindMatch(t)}}class l$ extends sg{constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:w("moveSelectionToNextFindMatch","Move Last Selection To Next Find Match"),alias:"Move Last Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:T.focus,primary:Dn(2089,2082),weight:100}})}_run(e,t){e.moveSelectionToNextFindMatch(t)}}class c$ extends sg{constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:w("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 d$ extends sg{constructor(){super({id:"editor.action.selectHighlights",label:w("selectAllOccurrencesOfFindMatch","Select All Occurrences of Find Match"),alias:"Select All Occurrences of Find Match",precondition:void 0,kbOpts:{kbExpr:T.focus,primary:3114,weight:100},menuOpts:{menuId:We.MenubarSelectionMenu,group:"3_multi",title:w({key:"miSelectHighlights",comment:["&& denotes a mnemonic"]},"Select All &&Occurrences"),order:7}})}_run(e,t){e.selectAll(t)}}class h$ extends sg{constructor(){super({id:"editor.action.changeAll",label:w("changeAll.label","Change All Occurrences"),alias:"Change All Occurrences",precondition:ie.and(T.writable,T.editorTextFocus),kbOpts:{kbExpr:T.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(e,t){e.selectAll(t)}}class u${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(O.compareRangesUsingStarts)),this._cachedFindMatches}}var dd;let tv=(dd=class extends Se{constructor(e,t){super(),this._languageFeaturesService=t,this.editor=e,this._isEnabled=e.getOption(109),this._decorations=e.createDecorationsCollection(),this.updateSoon=this._register(new Rn(()=>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=Ms.get(e);i&&this._register(i.getState().onFindReplaceStateChange(n=>{this._update()})),this.updateSoon.schedule()}_update(){this._setState(EC._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=ju.get(i);if(!s)return null;const r=Ms.get(i);if(!r)return null;let a=s.getSession(r);if(!a){const u=i.getSelections();if(u.length>1){const f=r.getState().matchCase;if(!UM(i.getModel(),u,f))return null}a=Vf.create(i,r)}if(!a||a.currentMatch||/^[ \t]+$/.test(a.searchText)||a.searchText.length>200)return null;const c=r.getState(),h=c.matchCase;if(c.isRevealed){let u=c.searchString;h||(u=u.toLowerCase());let g=a.searchText;if(h||(g=g.toLowerCase()),u===g&&a.matchCase===c.matchCase&&a.wholeWord===c.wholeWord&&!c.isRegex)return null}return new u$(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(O.compareRangesUsingStarts);const s=[];for(let h=0,u=0,g=i.length,f=n.length;h<g;){const v=i[h];if(u>=f)s.push(v),h++;else{const _=O.compareRangesUsingStarts(v,n[u]);_<0?((n[u].isEmpty()||!O.areIntersecting(v,n[u]))&&s.push(v),h++):(_>0||h++,u++)}}const r=this.editor.getOption(81)!=="off",a=this._languageFeaturesService.documentHighlightProvider.has(t)&&r,c=s.map(h=>({range:h,options:Qj(a)}));this._decorations.set(c)}dispose(){this._setState(null),super.dispose()}},EC=dd,dd.ID="editor.contrib.selectionHighlighter",dd);tv=EC=Jj([e$(1,Je)],tv);function UM(o,e,t){const i=wk(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=wk(o,r,!t);if(i!==a)return!1}return!0}function wk(o,e,t){const i=o.getValueInRange(e);return t?i.toLowerCase():i}class g$ extends ge{constructor(){super({id:"editor.action.focusNextCursor",label:w("mutlicursor.focusNextCursor","Focus Next Cursor"),metadata:{description:w("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),ec(s,n.getCursorStates()))}}class f$ extends ge{constructor(){super({id:"editor.action.focusPreviousCursor",label:w("mutlicursor.focusPreviousCursor","Focus Previous Cursor"),metadata:{description:w("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),ec(s,n.getCursorStates()))}}Zt(ju.ID,ju,4);Zt(tv.ID,tv,1);Q(t$);Q(i$);Q(n$);Q(r$);Q(a$);Q(l$);Q(c$);Q(d$);Q(h$);Q(s$);Q(o$);Q(g$);Q(f$);const p$="editor.action.inlineEdit.accept",m$="editor.action.inlineEdit.reject",_$="editor.action.inlineEdit.jumpTo",v$="editor.action.inlineEdit.jumpBack";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},w$=function(o,e){return function(t,i){e(t,i,o)}};const Jw="inline-edit";let PC=class extends Se{constructor(e,t,i){super(),this.editor=e,this.model=t,this.languageService=i,this.isDisposed=no(this,!1),this.currentTextModel=Bs(this,this.editor.onDidChangeModel,()=>this.editor.getModel()),this.uiState=Ei(this,n=>{var E;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=(E=this.model.range)==null?void 0:E.read(n);a&&a.startLineNumber===a.endLineNumber&&a.startColumn===a.endColumn&&(a=void 0);const c=(a?a.startLineNumber===a.endLineNumber:!0)&&r.parts.length===1&&r.parts[0].lines.length===1,h=r.parts.length===1&&r.parts[0].lines.every(M=>M.length===0),u=[],g=[];function f(M,F){if(g.length>0){const R=g[g.length-1];F&&R.decorations.push(new yf(R.content.length+1,R.content.length+1+M[0].length,F,0)),R.content+=M[0],M=M.slice(1)}for(const R of M)g.push({content:R,decorations:F?[new yf(1,R.length+1,F,0)]:[]})}const v=s.getLineContent(r.lineNumber);let _,y=0;if(!h&&(c||!a)){for(const M of r.parts){let F=M.lines;a&&!c&&(f(F,Jw),F=[]),_===void 0?(u.push({column:M.column,text:F[0],preview:M.preview}),F=F.slice(1)):f([v.substring(y,M.column-1)],void 0),F.length>0&&(f(F,Jw),_===void 0&&M.column<=v.length&&(_=M.column)),y=M.column-1}_!==void 0&&f([v.substring(y)],void 0)}const S=_!==void 0?new xM(_,v.length+1):void 0,x=c||!a?r.lineNumber:a.endLineNumber-1;return{inlineTexts:u,additionalLines:g,hiddenRange:S,lineNumber:x,additionalReservedLineCount:this.model.minReservedLineCount.read(n),targetTextModel:s,range:a,isSingleLine:c,isPureRemove:h}}),this.decorations=Ei(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 c=s.range.endLineNumber-s.range.startLineNumber;for(let h=0;h<c;h++){const u=s.range.startLineNumber+h,g=s.targetTextModel.getLineFirstNonWhitespaceColumn(u),f=s.targetTextModel.getLineLastNonWhitespaceColumn(u),v=new O(u,g,u,f);a.push(v)}}for(const c of a)r.push({range:c,options:r1})}if(s.range&&!s.isSingleLine&&s.isPureRemove){const a=new O(s.range.startLineNumber,1,s.range.endLineNumber-1,1);r.push({range:a,options:a1})}for(const a of s.inlineTexts)r.push({range:O.fromPositions(new Qe(s.lineNumber,a.column)),options:{description:Jw,after:{content:a.text,inlineClassName:a.preview?"inline-edit-decoration-preview":"inline-edit-decoration",cursorStops:Th.Left},showIfCollapsed:!0}});return r}),this._register(nn(()=>{this.isDisposed.set(!0,void 0)})),this._register(LM(this.editor,this.decorations))}};PC=b$([w$(2,br)],PC);var s0=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},Hr=function(o,e){return function(t,i){e(t,i,o)}},jm;let TC=class extends Se{constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=Bs(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).showToolbar==="always"),this.sessionPosition=void 0,this.position=Ei(this,n=>{var c,h;const s=(c=this.model.read(n))==null?void 0:c.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 Qe(s.lineNumber,Math.min(r,((h=this.sessionPosition)==null?void 0:h.column)??Number.MAX_SAFE_INTEGER));return this.sessionPosition=a,a}),this._register(fp((n,s)=>{if(!this.model.read(n)||!this.alwaysShowToolbar.read(n))return;const a=s.add(this.instantiationService.createInstance(MC,this.editor,!0,this.position));e.addContentWidget(a),s.add(nn(()=>e.removeContentWidget(a)))}))}};TC=s0([Hr(2,Bt)],TC);var Bl;let MC=(Bl=class extends Se{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${jm.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Oo("div.inlineEditHints",{className:this.withBorder?".withBorder":""},[Oo("div@toolBar")]),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(We.InlineEditActions,this._contextKeyService)),this.toolBar=this._register(n.createInstance(NC,this.nodes.toolBar,this.editor,We.InlineEditToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:a=>a.startsWith("primary")},actionViewItemProvider:(a,c)=>{if(a instanceof xu)return n.createInstance(y$,a,void 0)},telemetrySource:"InlineEditToolbar"})),this._register(this.toolBar.onDidChangeDropdownVisibility(a=>{jm._dropDownVisible=a})),this._register(dn(a=>{this._position.read(a),this.editor.layoutContentWidget(this)})),this._register(dn(a=>{const c=[];for(const[h,u]of this.inlineCompletionsActionsMenus.getActions())for(const g of u)g instanceof xu&&c.push(g);c.length>0&&c.unshift(new pf),this.toolBar.setAdditionalSecondaryActions(c)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}},jm=Bl,Bl._dropDownVisible=!1,Bl.id=0,Bl);MC=jm=s0([Hr(3,Bt),Hr(4,wi),Hr(5,Ud)],MC);class y$ extends yD{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=Oo("div.keybinding").root;this._register(new zx(t,Vx,{disableTitle:!0,...SD})).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add("inlineEditStatusBarItemLabel")}}updateTooltip(){}}let NC=class extends CD{constructor(e,t,i,n,s,r,a,c,h,u){super(e,{resetMenu:i,...n},s,r,a,c,h,u),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,c,h;const e=[],t=[];Gx(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,(h=(c=this.options2)==null?void 0:c.toolbarOptions)==null?void 0:h.useSeparatorsInPrimaryActions),t.push(...this.additionalActions),e.unshift(...this.prependedPrimaryActions),this.setActions(e,t)}setAdditionalSecondaryActions(e){Yr(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};NC=s0([Hr(4,Ud),Hr(5,wi),Hr(6,Ku),Hr(7,En),Hr(8,Bn),Hr(9,vr)],NC);var jM=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},$m=function(o,e){return function(t,i){e(t,i,o)}},Fg,RC;function*S$(o,e,t=1){e===void 0&&([e,o]=[o,0]);for(let i=o;i<e;i+=t)yield i}function ey(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 hd;let AC=(hd=class extends Se{static _createUniqueUri(){return Ri.from({scheme:"inline-edit-widget",path:new Date().toString()+String(Fg._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=Ei(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 c=this._editor.getModel();if(!c)return null;const h=Array.from(S$(a.range.startLineNumber,a.range.endLineNumber+1)),u=h.map(y=>c.getLineLastNonWhitespaceColumn(y)),g=Math.max(...u),f=h[u.indexOf(g)],v=new Qe(f,g);return{top:a.range.startLineNumber,left:v}}),this._text=Ei(this,r=>{const a=this._model.read(r);if(!a)return{text:"",shift:0};const c=ey(a.text.split(`
53
+ `));return{text:c.text.join(`
54
+ `),shift:c.shift}}),this._originalModel=$l(()=>this._modelService.createModel("",null,Fg._createUniqueUri())).keepObserved(this._store),this._modifiedModel=$l(()=>this._modelService.createModel("",null,Fg._createUniqueUri())).keepObserved(this._store),this._diff=Ei(this,r=>{var a,c;return(c=(a=this._diffPromise.read(r))==null?void 0:a.promiseResult.read(r))==null?void 0:c.data}),this._diffPromise=Ei(this,r=>{const a=this._model.read(r);if(!a)return;const c=this._editor.getModel();if(!c)return;const h=ey(c.getValueInRange(a.range).split(`
55
+ `)).text.join(`
56
+ `),u=ey(a.text.split(`
57
+ `)).text.join(`
58
+ `);this._originalModel.get().setValue(h),this._modifiedModel.get().setValue(u);const g=this._diffProviderFactoryService.createDiffProvider({diffAlgorithm:"advanced"});return bE.fromFn(async()=>{const f=await g.computeDiff(this._originalModel.get(),this._modifiedModel.get(),{computeMoves:!1,ignoreTrimWhitespace:!1,maxComputationTimeMs:1e3},$t.None);if(!f.identical)return f.changes})}),this._register(fp((r,a)=>{if(!this._model.read(r)||this._position.get()===null)return;const h=a.add(this._instantiationService.createInstance(OC,this._editor,this._position,this._text.map(u=>u.text),this._text.map(u=>u.shift),this._diff));e.addOverlayWidget(h),a.add(nn(()=>e.removeOverlayWidget(h)))}))}},Fg=hd,hd._modelId=0,hd);AC=Fg=jM([$m(2,Bt),$m(3,l1),$m(4,Cs)],AC);var ud;let OC=(ud=class extends Se{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${RC.id++}`,this.allowEditorOverflow=!1,this._nodes=qe("div.inlineEditSideBySide",void 0),this._scrollChanged=Dc("editor.onDidScrollChange",this._editor.onDidScrollChange),this._previewEditor=this._register(this._instantiationService.createInstance($o,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=Br(this._previewEditor),this._editorObs=Br(this._editor),this._previewTextModel=this._register(this._instantiationService.createInstance(fl,"",((a=this._editor.getModel())==null?void 0:a.getLanguageId())??bf,fl.DEFAULT_CREATION_OPTIONS,null)),this._setText=Ei(c=>{const h=this._text.read(c);h&&this._previewTextModel.setValue(h)}).recomputeInitiallyAndOnChange(this._store),this._decorations=Ei(this,c=>{this._setText.read(c);const h=this._position.read(c);if(!h)return{org:[],mod:[]};const u=this._diff.read(c);if(!u)return{org:[],mod:[]};const g=[],f=[];if(u.length===1&&u[0].innerChanges[0].modifiedRange.equalsRange(this._previewTextModel.getFullModelRange()))return{org:[],mod:[]};const v=this._shift.get(),_=y=>new O(y.startLineNumber+h.top-1,y.startColumn+v,y.endLineNumber+h.top-1,y.endColumn+v);for(const y of u)if(y.original.isEmpty||g.push({range:_(y.original.toInclusiveRange()),options:a1}),y.modified.isEmpty||f.push({range:y.modified.toInclusiveRange(),options:wE}),y.modified.isEmpty||y.original.isEmpty)y.original.isEmpty||g.push({range:_(y.original.toInclusiveRange()),options:yE}),y.modified.isEmpty||f.push({range:y.modified.toInclusiveRange(),options:SE});else for(const S of y.innerChanges||[])y.original.contains(S.originalRange.startLineNumber)&&g.push({range:_(S.originalRange),options:S.originalRange.isEmpty()?CE:r1}),y.modified.contains(S.modifiedRange.startLineNumber)&&f.push({range:S.modifiedRange,options:S.modifiedRange.isEmpty()?xE:LE});return{org:g,mod:f}}),this._originalDecorations=Ei(this,c=>this._decorations.read(c).org),this._modifiedDecorations=Ei(this,c=>this._decorations.read(c).mod),this._previewEditor.setModel(this._previewTextModel),this._register(this._editorObs.setDecorations(this._originalDecorations)),this._register(this._previewEditorObs.setDecorations(this._modifiedDecorations)),this._register(dn(c=>{const h=this._previewEditorObs.contentWidth.read(c),u=this._text.read(c).split(`
59
+ `).length-1,g=this._editor.getOption(67)*u;h<=0||this._previewEditor.layout({height:g,width:h})})),this._register(dn(c=>{this._position.read(c),this._editor.layoutOverlayWidget(this)})),this._register(dn(c=>{this._scrollChanged.read(c),this._position.read(c)&&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 Qe(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}}}},RC=ud,ud.id=0,ud);OC=RC=jM([$m(5,Bt)],OC);var C$=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)}},Hg,po;let vs=(po=class extends Se{static get(e){return e.getContribution(Hg.ID)}constructor(e,t,i,n,s,r,a,c){super(),this.editor=e,this.instantiationService=t,this.contextKeyService=i,this.languageFeaturesService=n,this._commandService=s,this._configurationService=r,this._diffProviderFactoryService=a,this._modelService=c,this._isVisibleContext=Hg.inlineEditVisibleContext.bindTo(this.contextKeyService),this._isCursorAtInlineEditContext=Hg.cursorAtInlineEditContext.bindTo(this.contextKeyService),this._currentEdit=no(this,void 0),this._currentWidget=$l(this._currentEdit,_=>{const y=this._currentEdit.read(_);if(!y)return;const S=y.range.endLineNumber,x=y.range.endColumn,E=y.text.endsWith(`
60
+ `)&&!(y.range.startLineNumber===y.range.endLineNumber&&y.range.startColumn===y.range.endColumn)?y.text.slice(0,-1):y.text,M=new Of(S,[new R_(x,E,!1)]),F=y.range.startLineNumber===y.range.endLineNumber&&M.parts.length===1&&M.parts[0].lines.length===1,R=y.text==="";return!F&&!R?void 0:this.instantiationService.createInstance(PC,this.editor,{ghostText:La(M),minReservedLineCount:La(0),targetTextModel:La(this.editor.getModel()??void 0),range:La(y.range)})}),this._isAccepting=no(this,!1),this._enabled=Bs(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).enabled),this._fontFamily=Bs(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).fontFamily);const h=Dc("InlineEditController.modelContentChangedSignal",e.onDidChangeModelContent);this._register(dn(_=>{this._enabled.read(_)&&(h.read(_),!this._isAccepting.read(_)&&this.getInlineEdit(e,!0))}));const u=Bs(this,e.onDidChangeCursorPosition,()=>e.getPosition());this._register(dn(_=>{if(!this._enabled.read(_))return;const y=u.read(_);y&&this.checkCursorPosition(y)})),this._register(dn(_=>{const y=this._currentEdit.read(_);if(this._isCursorAtInlineEditContext.set(!1),!y){this._isVisibleContext.set(!1);return}this._isVisibleContext.set(!0);const S=e.getPosition();S&&this.checkCursorPosition(S)}));const g=Dc("InlineEditController.editorBlurSignal",e.onDidBlurEditorWidget);this._register(dn(async _=>{var y;this._enabled.read(_)&&(g.read(_),!(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 f=Dc("InlineEditController.editorFocusSignal",e.onDidFocusEditorText);this._register(dn(_=>{this._enabled.read(_)&&(f.read(_),this.getInlineEdit(e,!0))}));const v=this._register(GD());this._register(dn(_=>{const y=this._fontFamily.read(_);v.setStyle(y===""||y==="default"?"":`
61
+ .monaco-editor .inline-edit-decoration,
62
+ .monaco-editor .inline-edit-decoration-preview,
63
+ .monaco-editor .inline-edit {
64
+ font-family: ${y};
65
+ }`)})),this._register(new TC(this.editor,this._currentWidget,this.instantiationService)),this._register(new AC(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(O.containsPosition(t.range,e))}validateInlineEdit(e,t){var i;if(t.text.includes(`
66
+ `)&&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 Kn;const a=this._currentRequestCts.token,c=t?ML.Automatic:ML.Invoke;if(t&&await x$(50,a),a.isCancellationRequested||i.isDisposed()||i.getVersionId()!==n)return;const u=await r.provideInlineEdit(i,{triggerKind:c},a);if(u&&!(a.isCancellationRequested||i.isDisposed()||i.getVersionId()!==n)&&this.validateInlineEdit(e,u))return u}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(`
67
+ `)&&(t=e.text.substring(1)),this.editor.pushUndoStop(),this.editor.executeEdits("acceptCurrent",[pn.replace(O.lift(e.range),t)]),e.accepted&&await this._commandService.executeCommand(e.accepted.id,...e.accepted.arguments||[]).then(void 0,Cn),this.freeEdit(e),jd(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=Qe.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,Cn),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)}},Hg=po,po.ID="editor.contrib.inlineEditController",po.inlineEditVisibleKey="inlineEditVisible",po.inlineEditVisibleContext=new di(po.inlineEditVisibleKey,!1),po.cursorAtInlineEditKey="cursorAtInlineEdit",po.cursorAtInlineEditContext=new di(po.cursorAtInlineEditKey,!1),po);vs=Hg=C$([lc(1,Bt),lc(2,wi),lc(3,Je),lc(4,Bn),lc(5,on),lc(6,l1),lc(7,Cs)],vs);function x$(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 L$=class extends ge{constructor(){super({id:p$,label:"Accept Inline Edit",alias:"Accept Inline Edit",precondition:ie.and(T.writable,vs.inlineEditVisibleContext),kbOpts:[{weight:101,primary:2,kbExpr:ie.and(T.writable,vs.inlineEditVisibleContext,vs.cursorAtInlineEditContext)}],menuOpts:[{menuId:We.InlineEditToolbar,title:"Accept",group:"primary",order:1}]})}async run(e,t){const i=vs.get(t);await(i==null?void 0:i.accept())}};class I$ extends ge{constructor(){const e=ie.and(T.writable,ie.not(vs.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=vs.get(t);i==null||i.trigger()}}class k$ extends ge{constructor(){const e=ie.and(T.writable,vs.inlineEditVisibleContext,ie.not(vs.cursorAtInlineEditKey));super({id:_$,label:"Jump to Inline Edit",alias:"Jump to Inline Edit",precondition:e,kbOpts:{weight:101,primary:2646,kbExpr:e},menuOpts:[{menuId:We.InlineEditToolbar,title:"Jump To Edit",group:"primary",order:3,when:e}]})}async run(e,t){const i=vs.get(t);i==null||i.jumpToCurrent()}}class D$ extends ge{constructor(){const e=ie.and(T.writable,vs.cursorAtInlineEditContext);super({id:v$,label:"Jump Back from Inline Edit",alias:"Jump Back from Inline Edit",precondition:e,kbOpts:{weight:110,primary:2646,kbExpr:e},menuOpts:[{menuId:We.InlineEditToolbar,title:"Jump Back",group:"primary",order:3,when:e}]})}async run(e,t){const i=vs.get(t);i==null||i.jumpBack()}}class E$ extends ge{constructor(){const e=ie.and(T.writable,vs.inlineEditVisibleContext);super({id:m$,label:"Reject Inline Edit",alias:"Reject Inline Edit",precondition:e,kbOpts:{weight:100,primary:9,kbExpr:e},menuOpts:[{menuId:We.InlineEditToolbar,title:"Reject",group:"secondary",order:2}]})}async run(e,t){const i=vs.get(t);await(i==null?void 0:i.clear())}}Q(L$);Q(E$);Q(k$);Q(D$);Q(I$);Zt(vs.ID,vs,3);const P$="editor.action.inlineEdits.accept",T$="editor.action.inlineEdits.showPrevious",M$="editor.action.inlineEdits.showNext",$u=new di("inlineEditsVisible",!1,w("inlineEditsVisible","Whether an inline edit is visible")),N$=new di("inlineEditsIsPinned",!1,w("isPinned","Whether an inline edit is visible")),E0=class E0 extends Se{constructor(e){super(),this._editor=e,this._editorObs=Br(this._editor),this._placeholderText=this._editorObs.getOption(88),this._state=Ca({owner:this,equalsFn:IE},t=>{const i=this._placeholderText.read(t);if(i&&this._editorObs.valueIsEmpty.read(t))return{placeholder:i}}),this._shouldViewBeAlive=R$(this,t=>{var i;return((i=this._state.read(t))==null?void 0:i.placeholder)!==void 0}),this._view=xD((t,i)=>{if(!this._shouldViewBeAlive.read(t))return;const n=Oo("div.editorPlaceholder");i.add(dn(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(dn(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(dn(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:La(0),position:La(null),domNode:n.root}))}),this._view.recomputeInitiallyAndOnChange(this._store)}};E0.ID="editor.contrib.placeholderText";let Uf=E0;function R$(o,e){return vb(o,(t,i)=>i===!0?!0:e(t))}var A$=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},O$=function(o,e){return function(t,i){e(t,i,o)}};class F${constructor(e,t,i){this.range=e,this.newLines=t,this.changes=i}}let FC=class extends Se{constructor(e,t,i,n){super(),this._editor=e,this._edit=t,this._userPrompt=i,this._instantiationService=n,this._editorObs=Br(this._editor),this._elements=Oo("div.inline-edits-widget",{style:{position:"absolute",overflow:"visible",top:"0px",left:"0px"}},[Oo("div@editorContainer",{style:{position:"absolute",top:"0px",left:"0px",width:"500px",height:"500px"}},[Oo("div.toolbar@toolbar",{style:{position:"absolute",top:"-25px",left:"0px"}}),Oo("div.promptEditor@promptEditor",{style:{position:"absolute",top:"-25px",left:"80px",width:"300px",height:"22px"}}),Oo("div.preview@editor",{style:{position:"absolute",top:"0px",left:"0px"}})]),ah("svg",{style:{overflow:"visible",pointerEvents:"none"}},[ah("defs",[ah("linearGradient",{id:"Gradient2",x1:"0",y1:"0",x2:"1",y2:"0"},[ah("stop",{offset:"0%",class:"gradient-stop"}),ah("stop",{offset:"100%",class:"gradient-stop"})])]),ah("path@path",{d:"",fill:"url(#Gradient2)"})])]),this._previewTextModel=this._register(this._instantiationService.createInstance(fl,"",bf,fl.DEFAULT_CREATION_OPTIONS,null)),this._setText=Ei(r=>{const a=this._edit.read(r);a&&this._previewTextModel.setValue(a.newLines.join(`
68
+ `))}).recomputeInitiallyAndOnChange(this._store),this._promptTextModel=this._register(this._instantiationService.createInstance(fl,"",bf,fl.DEFAULT_CREATION_OPTIONS,null)),this._promptEditor=this._register(this._instantiationService.createInstance($o,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:m2},{contributions:_2.getSomeEditorContributions([Wo.ID,Uf.ID,Fu.ID]),isSimpleWidget:!0},this._editor)),this._previewEditor=this._register(this._instantiationService.createInstance($o,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=Br(this._previewEditor),this._decorations=Ei(this,r=>{var u;this._setText.read(r);const a=(u=this._edit.read(r))==null?void 0:u.changes;if(!a)return[];const c=[],h=[];if(a.length===1&&a[0].innerChanges[0].modifiedRange.equalsRange(this._previewTextModel.getFullModelRange()))return[];for(const g of a)if(g.original.isEmpty||c.push({range:g.original.toInclusiveRange(),options:a1}),g.modified.isEmpty||h.push({range:g.modified.toInclusiveRange(),options:wE}),g.modified.isEmpty||g.original.isEmpty)g.original.isEmpty||c.push({range:g.original.toInclusiveRange(),options:yE}),g.modified.isEmpty||h.push({range:g.modified.toInclusiveRange(),options:SE});else for(const f of g.innerChanges||[])g.original.contains(f.originalRange.startLineNumber)&&c.push({range:f.originalRange,options:f.originalRange.isEmpty()?CE:r1}),g.modified.contains(f.modifiedRange.startLineNumber)&&h.push({range:f.modifiedRange,options:f.modifiedRange.isEmpty()?xE:LE});return h}),this._layout1=Ei(this,r=>{const a=this._editor.getModel(),c=this._edit.read(r);if(!c)return null;const h=c.range;let u=0;for(let v=h.startLineNumber;v<h.endLineNumberExclusive;v++){const _=a.getLineMaxColumn(v),y=this._editor.getOffsetForColumn(v,_);u=Math.max(u,y)}return{left:this._editor.getLayoutInfo().contentLeft+u}}),this._layout=Ei(this,r=>{const a=this._edit.read(r);if(!a)return null;const c=a.range,h=this._editorObs.scrollLeft.read(r),u=this._layout1.read(r).left+20-h,g=this._editor.getTopForLineNumber(c.startLineNumber)-this._editorObs.scrollTop.read(r),f=this._editor.getTopForLineNumber(c.endLineNumberExclusive)-this._editorObs.scrollTop.read(r),v=new Wh(u,g),_=new Wh(u,f),y=f-g,S=50,x=this._editor.getOption(67)*a.newLines.length,E=y-x,M=new Wh(u+S,g+E/2),F=new Wh(u+S,f-E/2);return{topCode:v,bottomCode:_,codeHeight:y,topEdit:M,bottomEdit:F,editHeight:x}});const s=Ei(this,r=>this._edit.read(r)!==void 0||this._userPrompt.read(r)!==void 0);this._register(v2(this._elements.root,{display:Ei(this,r=>s.read(r)?"block":"none")})),this._register(b2(this._editor.getDomNode(),this._elements.root)),this._register(Br(e).createOverlayWidget({domNode:this._elements.root,position:La(null),allowEditorOverflow:!1,minContentWidthInPx:Ei(r=>{var h;const a=(h=this._layout1.read(r))==null?void 0:h.left;if(a===void 0)return 0;const c=this._previewEditorObs.contentWidth.read(r);return a+c})})),this._previewEditor.setModel(this._previewTextModel),this._register(this._previewEditorObs.setDecorations(this._decorations)),this._register(dn(r=>{const a=this._layout.read(r);if(!a)return;const{topCode:c,bottomCode:h,topEdit:u,bottomEdit:g,editHeight:f}=a,v=10,_=0,y=40,S=new W$().moveTo(c).lineTo(c.deltaX(v)).curveTo(c.deltaX(v+y),u.deltaX(-y-_),u.deltaX(-_)).lineTo(u).lineTo(g).lineTo(g.deltaX(-_)).curveTo(g.deltaX(-y-_),h.deltaX(v+y),h.deltaX(v)).lineTo(h).build();this._elements.path.setAttribute("d",S),this._elements.editorContainer.style.top=`${u.y}px`,this._elements.editorContainer.style.left=`${u.x}px`,this._elements.editorContainer.style.height=`${f}px`;const x=this._previewEditorObs.contentWidth.read(r);this._previewEditor.layout({height:f,width:x})})),this._promptEditor.setModel(this._promptTextModel),this._promptEditor.layout(),this._register(B$(H$(this._userPrompt,r=>r??"",r=>r),Br(this._promptEditor).value)),this._register(dn(r=>{const a=Br(this._promptEditor).isFocused.read(r);this._elements.root.classList.toggle("focused",a)}))}};FC=A$([O$(3,Bt)],FC);function H$(o,e,t){return kE(void 0,i=>e(o.read(i)),(i,n)=>o.set(t(i),n))}class Wh{constructor(e,t){this.x=e,this.y=t}deltaX(e){return new Wh(this.x+e,this.y)}}class W${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 B$(o,e){const t=new we;return t.add(dn(i=>{const n=o.read(i);e.set(n,void 0)})),t.add(dn(i=>{const n=e.read(i);o.set(n,void 0)})),t}var z$=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},ty=function(o,e){return function(t,i){e(t,i,o)}},Wg,gd;let HC=(gd=class extends Se{static _createUniqueUri(){return Ri.from({scheme:"inline-edits",path:new Date().toString()+String(Wg._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=t1(this),this._selectedInlineCompletionId=no(this,void 0),this._isActive=no(this,!1),this._originalModel=$l(()=>this._modelService.createModel("",null,Wg._createUniqueUri())).keepObserved(this._store),this._modifiedModel=$l(()=>this._modelService.createModel("",null,Wg._createUniqueUri())).keepObserved(this._store),this._pinnedRange=new U$(this.textModel,this._textModelVersionId),this.isPinned=this._pinnedRange.range.map(c=>!!c),this.userPrompt=no(this,void 0),this.inlineEdit=Ei(this,c=>{var h,u;return(u=(h=this._inlineEdit.read(c))==null?void 0:h.promiseResult.read(c))==null?void 0:u.data}),this._inlineEdit=Ei(this,c=>{const h=this.selectedInlineEdit.read(c);if(!h)return;const u=h.inlineCompletion.range;if(h.inlineCompletion.insertText.trim()==="")return;let g=h.inlineCompletion.insertText.split(/\r\n|\r|\n/);function f(S){var E;const x=((E=S[0].match(/^\s*/))==null?void 0:E[0])??"";return S.map(M=>M.replace(new RegExp("^"+x),""))}g=f(g);let _=this.textModel.getValueInRange(u).split(/\r\n|\r|\n/);_=f(_),this._originalModel.get().setValue(_.join(`
69
+ `)),this._modifiedModel.get().setValue(g.join(`
70
+ `));const y=this._diffProviderFactoryService.createDiffProvider({diffAlgorithm:"advanced"});return bE.fromFn(async()=>{const S=await y.computeDiff(this._originalModel.get(),this._modifiedModel.get(),{computeMoves:!1,ignoreTrimWhitespace:!1,maxComputationTimeMs:1e3},$t.None);if(!S.identical)return new F$(w2.fromRangeInclusive(u),f(g),S.changes)})}),this._fetchStore=this._register(new we),this._inlineEditsFetchResult=wy(this,void 0),this._inlineEdits=Ca({owner:this,equalsFn:IE},c=>{var h;return((h=this._inlineEditsFetchResult.read(c))==null?void 0:h.completions.map(u=>new V$(u)))??[]}),this._fetchInlineEditsPromise=nE({owner:this,createEmptyChangeSummary:()=>({inlineCompletionTriggerKind:Pa.Automatic}),handleChange:(c,h)=>(c.didChange(this._forceUpdateExplicitlySignal)&&(h.inlineCompletionTriggerKind=Pa.Explicit),!0)},async(c,h)=>{this._fetchStore.clear(),this._forceUpdateExplicitlySignal.read(c),this._textModelVersionId.read(c);function u(y,S){return S(y)}const g=this._pinnedRange.range.read(c)??u(this._selection.read(c),y=>y.isEmpty()?void 0:y);if(!g){this._inlineEditsFetchResult.set(void 0,void 0),this.userPrompt.set(void 0,void 0);return}const f={triggerKind:h.inlineCompletionTriggerKind,selectedSuggestionInfo:void 0,userPrompt:this.userPrompt.read(c)},v=Sy(this._fetchStore);await Lb(200,v);const _=await IM(this.languageFeaturesService.inlineCompletionsProvider,g,this.textModel,f,v);v.isCancellationRequested||this._inlineEditsFetchResult.set(_,void 0)}),this._filteredInlineEditItems=Ca({owner:this,equalsFn:yy()},c=>this._inlineEdits.read(c)),this.selectedInlineCompletionIndex=Ei(this,c=>{const h=this._selectedInlineCompletionId.read(c),u=this._filteredInlineEditItems.read(c),g=this._selectedInlineCompletionId===void 0?-1:u.findIndex(f=>f.semanticId===h);return g===-1?(this._selectedInlineCompletionId.set(void 0,void 0),0):g}),this.selectedInlineEdit=Ei(this,c=>{const h=this._filteredInlineEditItems.read(c),u=this.selectedInlineCompletionIndex.read(c);return h[u]}),this._register(sE(this._fetchInlineEditsPromise))}async triggerExplicitly(e){i_(e,t=>{this._isActive.set(!0,t),this._forceUpdateExplicitlySignal.trigger(t)}),await this._fetchInlineEditsPromise.get()}stop(e){i_(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 Lu;const t=this.selectedInlineEdit.get();t&&(e.pushUndoStop(),e.executeEdits("inlineSuggestion.accept",[t.inlineCompletion.toSingleTextEdit().toSingleEditOperation()]),this.stop())}},Wg=gd,gd._modelId=0,gd);HC=Wg=z$([ty(4,Je),ty(5,l1),ty(6,Cs)],HC);class V${constructor(e){this.inlineCompletion=e,this.semanticId=this.inlineCompletion.hash()}}class U$ extends Se{constructor(e,t){super(),this._textModel=e,this._versionId=t,this._decorations=no(this,[]),this.range=Ei(this,i=>{this._versionId.read(i);const n=this._decorations.read(i)[0];return n?this._textModel.getDecorationRange(n)??null:null}),this._register(nn(()=>{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 j$=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},Cg=function(o,e){return function(t,i){e(t,i,o)}},WC,fd;let Ua=(fd=class extends Se{static get(e){return e.getContribution(WC.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=y2("editor.inlineEdits.enabled",!1,this._configurationService),this._editorObs=Br(this.editor),this._selection=Ei(this,a=>this._editorObs.cursorSelection.read(a)??new _t(1,1,1,1)),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineEditsDebounce",{min:50,max:50}),this.model=$l(this,a=>{if(!this._enabled.read(a)||this._editorObs.isReadonly.read(a))return;const c=this._editorObs.model.read(a);return c?this._instantiationService.createInstance(Cy(HC,a),c,this._editorObs.versionId,this._selection,this._debounceValue):void 0}),this._hadInlineEdit=vb(this,(a,c)=>{var h;return c||((h=this.model.read(a))==null?void 0:h.inlineEdit.read(a))!==void 0}),this._widget=$l(this,a=>{if(this._hadInlineEdit.read(a))return this._instantiationService.createInstance(Cy(FC,a),this.editor,this.model.map((c,h)=>c==null?void 0:c.inlineEdit.read(h)),$$(c=>{var h;return((h=this.model.read(c))==null?void 0:h.userPrompt)??no("empty","")}))}),this._register(NL($u,this._contextKeyService,a=>{var c;return!!((c=this.model.read(a))!=null&&c.inlineEdit.read(a))})),this._register(NL(N$,this._contextKeyService,a=>{var c;return!!((c=this.model.read(a))!=null&&c.isPinned.read(a))})),this.model.recomputeInitiallyAndOnChange(this._store),this._widget.recomputeInitiallyAndOnChange(this._store)}},WC=fd,fd.ID="editor.contrib.inlineEditsController",fd);Ua=WC=j$([Cg(1,Bt),Cg(2,wi),Cg(3,yo),Cg(4,Je),Cg(5,on)],Ua);function $$(o){return kE(void 0,e=>o(e).read(e),(e,t)=>{o(void 0).set(e,t)})}function Rp(o){return{label:o.value,alias:o.original}}const Xv=class Xv extends ge{constructor(){super({id:Xv.ID,...Rp(Xe("action.inlineEdits.showNext","Show Next Inline Edit")),precondition:ie.and(T.writable,$u),kbOpts:{weight:100,primary:606}})}async run(e,t){var n;const i=Ua.get(t);(n=i==null?void 0:i.model.get())==null||n.next()}};Xv.ID=M$;let BC=Xv;const Yv=class Yv extends ge{constructor(){super({id:Yv.ID,...Rp(Xe("action.inlineEdits.showPrevious","Show Previous Inline Edit")),precondition:ie.and(T.writable,$u),kbOpts:{weight:100,primary:604}})}async run(e,t){var n;const i=Ua.get(t);(n=i==null?void 0:i.model.get())==null||n.previous()}};Yv.ID=T$;let zC=Yv;class q$ extends ge{constructor(){super({id:"editor.action.inlineEdits.trigger",...Rp(Xe("action.inlineEdits.trigger","Trigger Inline Edit")),precondition:T.writable})}async run(e,t){const i=Ua.get(t);await fE(async n=>{var s;await((s=i==null?void 0:i.model.get())==null?void 0:s.triggerExplicitly(n))})}}class K$ extends ge{constructor(){super({id:P$,...Rp(Xe("action.inlineEdits.accept","Accept Inline Edit")),precondition:$u,menuOpts:{menuId:We.InlineEditsActions,title:w("inlineEditsActions","Accept Inline Edit"),group:"primary",order:1,icon:xt.check},kbOpts:{primary:2058,weight:2e4,kbExpr:$u}})}async run(e,t){var n;t instanceof $o&&(t=t.getParentEditor());const i=Ua.get(t);i&&((n=i.model.get())==null||n.accept(i.editor),i.editor.focus())}}const Qv=class Qv extends ge{constructor(){super({id:Qv.ID,...Rp(Xe("action.inlineEdits.hide","Hide Inline Edit")),precondition:$u,kbOpts:{weight:100,primary:9}})}async run(e,t){const i=Ua.get(t);jd(n=>{var s;(s=i==null?void 0:i.model.get())==null||s.stop(n)})}};Qv.ID="editor.action.inlineEdits.hide";let VC=Qv;Zt(Ua.ID,Ua,3);Q(q$);Q(BC);Q(zC);Q(K$);Q(VC);const Wd={Visible:new di("parameterHintsVisible",!1),MultipleSignatures:new di("parameterHintsMultipleSignatures",!1)};async function $M(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){Cn(a)}}Gi.registerCommand("_executeSignatureHelpProvider",async(o,...e)=>{const[t,i,n]=e;Si(Ri.isUri(t)),Si(Qe.isIPosition(i)),Si(typeof n=="string"||!n);const s=o.get(Je),r=await o.get(wr).createModelReference(t);try{const a=await $M(s.signatureHelpProvider,r.object.textEditorModel,Qe.lift(i),{triggerKind:Cl.Invoke,isRetrigger:!1,triggerCharacter:n},$t.None);return a?(setTimeout(()=>a.dispose(),0),a.value):void 0}finally{r.dispose()}});var ol;(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})(ol||(ol={}));const Jv=class Jv extends Se{constructor(e,t,i=Jv.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new jt),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=ol.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new oo),this.triggerChars=new e_,this.retriggerChars=new e_,this.triggerId=0,this.editor=e,this.providers=t,this.throttledDelayer=new jl(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=ol.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(Vi)}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 ol.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(G$);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 ol.Pending(qn(c=>$M(this.providers,r,a,s,c)),i);try{const c=await this.state.request;return e!==this.triggerId?(c==null||c.dispose(),!1):!c||!c.value.signatures||c.value.signatures.length===0?(c==null||c.dispose(),this._lastSignatureHelpResult.clear(),this.cancel(),!1):(this.state=new ol.Active(c.value),this._lastSignatureHelpResult.value=c,this._onChangedHints.fire(this.state.hints),!0)}catch(c){return e===this.triggerId&&(this.state=ol.Default),Vi(c),!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:Cl.TriggerCharacter,triggerCharacter:e.charAt(t)})}onCursorChange(e){e.source==="mouse"?this.cancel():this.isTriggered&&this.trigger({triggerKind:Cl.ContentChange})}onModelContentChange(){this.isTriggered&&this.trigger({triggerKind:Cl.ContentChange})}onEditorConfigurationChange(){this.triggerOnType=this.editor.getOption(86).enabled,this.triggerOnType||this.cancel()}dispose(){this.cancel(!0),super.dispose()}};Jv.DEFAULT_DELAY=120;let UC=Jv;function G$(o,e){switch(e.triggerKind){case Cl.Invoke:return e;case Cl.ContentChange:return o;case Cl.TriggerCharacter:default:return e}}var Z$=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},wm=function(o,e){return function(t,i){e(t,i,o)}},jC;const Zs=qe,X$=yn("parameter-hints-next",xt.chevronDown,w("parameterHintsNextIcon","Icon for show next parameter hint.")),Y$=yn("parameter-hints-previous",xt.chevronUp,w("parameterHintsPreviousIcon","Icon for show previous parameter hint."));var pd;let $C=(pd=class extends Se{constructor(e,t,i,n,s,r){super(),this.editor=e,this.model=t,this.telemetryService=r,this.renderDisposeables=this._register(new we),this.visible=!1,this.announcedLabel=null,this.allowEditorOverflow=!0,this.markdownRenderer=this._register(new Yu({editor:e},s,n)),this.keyVisible=Wd.Visible.bindTo(i),this.keyMultipleSignatures=Wd.MultipleSignatures.bindTo(i)}createParameterHintDOMNodes(){const e=Zs(".editor-widget.parameter-hints-widget"),t=Ve(e,Zs(".phwrapper"));t.tabIndex=-1;const i=Ve(t,Zs(".controls")),n=Ve(i,Zs(".button"+xi.asCSSSelector(Y$))),s=Ve(i,Zs(".overloads")),r=Ve(i,Zs(".button"+xi.asCSSSelector(X$)));this._register(bi(n,"click",f=>{Jm.stop(f),this.previous()})),this._register(bi(r,"click",f=>{Jm.stop(f),this.next()}));const a=Zs(".body"),c=new lE(a,{alwaysConsumeMouseWheel:!0});this._register(c),t.appendChild(c.getDomNode());const h=Ve(a,Zs(".signature")),u=Ve(a,Zs(".docs"));e.style.userSelect="text",this.domNodes={element:e,signature:h,overloads:s,docs:u,scrollbar:c},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection(f=>{this.visible&&this.editor.layoutContentWidget(this)}));const g=()=>{if(!this.domNodes)return;const f=this.editor.getOption(50),v=this.domNodes.element;v.style.fontSize=`${f.fontSize}px`,v.style.lineHeight=`${f.lineHeight/f.fontSize}`,v.style.setProperty("--vscode-parameterHintsWidget-editorFontFamily",f.fontFamily),v.style.setProperty("--vscode-parameterHintsWidget-editorFontFamilyDefault",Kx.fontFamily)};g(),this._register(Nn.chain(this.editor.onDidChangeConfiguration.bind(this.editor),f=>f.filter(v=>v.hasChanged(50)))(g)),this._register(this.editor.onDidLayoutChange(f=>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=Ve(this.domNodes.signature,Zs(".code")),s=i.parameters.length>0,r=i.activeParameter??e.activeParameter;if(s)this.renderParameters(n,i,r);else{const h=Ve(n,Zs("span"));h.textContent=i.label}const a=i.parameters[r];if(a!=null&&a.documentation){const h=Zs("span.documentation");if(typeof a.documentation=="string")h.textContent=a.documentation;else{const u=this.renderMarkdownDocs(a.documentation);h.appendChild(u.element)}Ve(this.domNodes.docs,Zs("p",{},h))}if(i.documentation!==void 0)if(typeof i.documentation=="string")Ve(this.domNodes.docs,Zs("p",{},i.documentation));else{const h=this.renderMarkdownDocs(i.documentation);Ve(this.domNodes.docs,h.element)}const c=this.hasDocs(i,a);if(this.domNodes.signature.classList.toggle("has-docs",c),this.domNodes.docs.classList.toggle("empty",!c),this.domNodes.overloads.textContent=String(e.activeSignature+1).padStart(e.signatures.length.toString().length,"0")+"/"+e.signatures.length,a){let h="";const u=i.parameters[r];Array.isArray(u.label)?h=i.label.substring(u.label[0],u.label[1]):h=u.label,u.documentation&&(h+=typeof u.documentation=="string"?`, ${u.documentation}`:`, ${u.documentation.value}`),i.documentation&&(h+=typeof i.documentation=="string"?`, ${i.documentation}`:`, ${i.documentation.value}`),this.announcedLabel!==h&&(Uo(w("hint","{0}, hint",h)),this.announcedLabel=h)}this.editor.layoutContentWidget(this),this.domNodes.scrollbar.scanDomNode()}renderMarkdownDocs(e){const t=new qs,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"&&Mh(t.documentation).length>0||t&&typeof t.documentation=="object"&&Mh(t.documentation).value.length>0||e.documentation&&typeof e.documentation=="string"&&Mh(e.documentation).length>0||e.documentation&&typeof e.documentation=="object"&&Mh(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 c=document.createElement("span");c.textContent=t.label.substring(s),Ve(e,r,a,c)}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|^)${ff(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 jC.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)}},jC=pd,pd.ID="editor.widget.parameterHintsWidget",pd);$C=jC=Z$([wm(2,wi),wm(3,_r),wm(4,br),wm(5,vr)],$C);Ke("editorHoverWidget.highlightForeground",uE,w("editorHoverWidgetHighlightForeground","Foreground color of the active item in the parameter hint."));var Q$=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},yk=function(o,e){return function(t,i){e(t,i,o)}},qC,md;let qu=(md=class extends Se{static get(e){return e.getContribution(qC.ID)}constructor(e,t,i){super(),this.editor=e,this.model=this._register(new UC(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 Wx(()=>this._register(t.createInstance($C,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)}},qC=md,md.ID="editor.controller.parameterHints",md);qu=qC=Q$([yk(1,Bt),yk(2,Je)],qu);class J$ extends ge{constructor(){super({id:"editor.action.triggerParameterHints",label:w("parameterHints.trigger.label","Trigger Parameter Hints"),alias:"Trigger Parameter Hints",precondition:T.hasSignatureHelpProvider,kbOpts:{kbExpr:T.editorTextFocus,primary:3082,weight:100}})}run(e,t){const i=qu.get(t);i==null||i.trigger({triggerKind:Cl.Invoke})}}Zt(qu.ID,qu,2);Q(J$);const o0=175,r0=Rs.bindToContribution(qu.get);it(new r0({id:"closeParameterHints",precondition:Wd.Visible,handler:o=>o.cancel(),kbOpts:{weight:o0,kbExpr:T.focus,primary:9,secondary:[1033]}}));it(new r0({id:"showPrevParameterHint",precondition:ie.and(Wd.Visible,Wd.MultipleSignatures),handler:o=>o.previous(),kbOpts:{weight:o0,kbExpr:T.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}}));it(new r0({id:"showNextParameterHint",precondition:ie.and(Wd.Visible,Wd.MultipleSignatures),handler:o=>o.next(),kbOpts:{weight:o0,kbExpr:T.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));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},t5=function(o,e){return function(t,i){e(t,i,o)}};class i5{constructor(e){this.instantiationService=e}init(...e){}}function n5(o,e){return class extends e{constructor(){super(...arguments),this._autorun=void 0}init(...i){this._autorun=fp((n,s)=>{const r=Cy(o(),n);s.add(this.instantiationService.createInstance(r,...i))})}dispose(){var i;(i=this._autorun)==null||i.dispose()}}}function s5(o){return S2()?n5(o,KC):o()}let KC=class extends i5{constructor(e,t){super(t),this.init(e)}};KC=e5([t5(1,Bt)],KC);Zt(Uf.ID,s5(()=>Uf),0);Ke("editor.placeholder.foreground",C2,w("placeholderForeground","Foreground color of the placeholder text in the editor."));var o5=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},ym=function(o,e){return function(t,i){e(t,i,o)}};const og=new di("renameInputVisible",!1,w("renameInputVisible","Whether the rename input widget is visible"));new di("renameInputFocused",!1,w("renameInputFocused","Whether the rename input widget is focused"));let GC=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 we,this._visibleContextKey=og.bindTo(s),this._isEditingRenameCandidate=!1,this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,this._candidates=new Set,this._beforeFirstInputFieldEditSW=new qs,this._inputWithButton=new r5,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 a0(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(x2),i=e.getColor(L2);this._domNode.style.backgroundColor=String(e.getColor(cE)??""),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(I2)??"");const n=e.getColor(k2);this._inputWithButton.domNode.style.backgroundColor=String(e.getColor(RL)??""),this._inputWithButton.input.style.backgroundColor=String(e.getColor(RL)??""),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;Si(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=pp(this.getDomNode().ownerDocument.body),t=Ps(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}=jf.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=w({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;Si(this._renameCandidateListView),Si(this._nPxAvailableAbove!==void 0),Si(this._nPxAvailableBelow!==void 0);const t=Ph(this._inputWithButton.domNode),i=Ph(this._label);let n;e===2?n=this._nPxAvailableBelow:n=this._nPxAvailableAbove,this._renameCandidateListView.layout({height:n-i-t,width:Eo(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 c=new we;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),c.add(bi(this._inputWithButton.button,"click",()=>this._requestRenameCandidates(t,!0))),c.add(bi(this._inputWithButton.button,hn.KEY_DOWN,u=>{const g=new c1(u);(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 Qe(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(),c.add(nn(()=>{this._renameCts=void 0,s.dispose(!0)})),c.add(nn(()=>{this._renameCandidateProvidersCts!==void 0&&(this._renameCandidateProvidersCts.dispose(!0),this._renameCandidateProvidersCts=void 0)})),c.add(nn(()=>this._candidates.clear()));const h=new gb;return h.p.finally(()=>{c.dispose(),this._hide()}),this._currentCancelInput=u=>{var g;return this._trace("invoking _currentCancelInput"),this._currentAcceptInput=void 0,this._currentCancelInput=void 0,(g=this._renameCandidateListView)==null||g.clearCandidates(),h.complete(u),!0},this._currentAcceptInput=u=>{this._trace("invoking _currentAcceptInput"),Si(this._renameCandidateListView!==void 0);const g=this._renameCandidateListView.nCandidates;let f,v;const _=this._renameCandidateListView.focusedCandidate;if(_!==void 0?(this._trace("using new name from renameSuggestion"),f=_,v={k:"renameSuggestion"}):(this._trace("using new name from inputField"),f=this._inputWithButton.input.value,v=this._isEditingRenameCandidate?{k:"userEditedRenameSuggestion"}:{k:"inputField"}),f===t||f.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(),h.complete({newName:f,wantsPreview:i&&u,stats:{source:v,nRenameSuggestions:g,timeBeforeFirstInputFieldEdit:this._timeBeforeFirstInputFieldEdit,nRenameSuggestionsInvocations:this._nRenameSuggestionsInvocations,hadAutomaticRenameSuggestionsInvocation:this._hadAutomaticRenameSuggestionsInvocation}})},c.add(s.token.onCancellationRequested(()=>this.cancelInput(!0,"cts.token.onCancellationRequested"))),c.add(this._editor.onDidBlurEditorWidget(()=>{var u;return this.cancelInput(!((u=this._domNode)!=null&&u.ownerDocument.hasFocus()),"editor.onDidBlurEditorWidget")})),this._show(),h.p}_requestRenameCandidates(e,t){if(this._requestRenameCandidatesOnce!==void 0&&(this._renameCandidateProvidersCts!==void 0&&this._renameCandidateProvidersCts.dispose(!0),Si(this._renameCts),this._inputWithButton.buttonState!=="stop")){this._renameCandidateProvidersCts=new Kn;const i=t?xy.Invoke:xy.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){Si(this._editor.hasModel());const i=this._editor.getSelection();let n=0,s=t.length;return!O.isEmpty(i)&&!O.spansMultipleLines(i)&&O.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=(...h)=>this._trace("_updateRenameCandidates",...h);n("start");const s=await lp(Promise.allSettled(e),i);if(this._inputWithButton.setSparkleButton(),s===void 0){n("returning early - received updateRenameCandidates results - undefined");return}const r=s.flatMap(h=>h.status==="fulfilled"&&km(h.value)?h.value:[]);n(`received updateRenameCandidates results - total (unfiltered) ${r.length} candidates.`);const a=fD(r,h=>h.newSymbolName);n(`distinct candidates - ${a.length} candidates.`);const c=a.filter(({newSymbolName:h})=>h.trim().length>0&&h!==this._inputWithButton.input.value&&h!==t&&!this._candidates.has(h));if(n(`valid distinct candidates - ${r.length} candidates.`),c.forEach(h=>this._candidates.add(h.newSymbolName)),c.length<1){n("returning early - no valid distinct candidates");return}n("setting candidates"),this._renameCandidateListView.setCandidates(c),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)}};GC=o5([ym(2,qo),ym(3,En),ym(4,wi),ym(5,$d)],GC);class a0{constructor(e,t){this._disposables=new we,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=a0._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(gE({listInactiveFocusForeground:dE,listInactiveFocusBackground:hE}))}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`,wu(w("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}=jf.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 jf(r,i)}renderElement(r,a,c){c.populate(r)}disposeTemplate(r){r.dispose()}};return new Ux("NewSymbolNameCandidates",e,n,[s],{keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!1})}}class r5{constructor(){this._onDidInputChange=new jt,this.onDidInputChange=this._onDidInputChange.event,this._disposables=new we}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",w("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=w("generateRenameSuggestionsButton","Generate new name suggestions"),this._buttonCancelHoverText=w("cancelRenameSuggestionsButton","Cancel"),this._buttonHover=D2().setupManagedHover(Cb("element"),this._buttonNode,this._buttonGenHoverText),this._disposables.add(this._buttonHover),this._domNode.appendChild(this._buttonNode),this._disposables.add(bi(this.input,hn.INPUT,()=>this._onDidInputChange.fire())),this._disposables.add(bi(this.input,hn.KEY_DOWN,e=>{const t=new c1(e);(t.keyCode===15||t.keyCode===17)&&this._onDidInputChange.fire()})),this._disposables.add(bi(this.input,hn.CLICK,()=>this._onDidInputChange.fire())),this._disposables.add(bi(this.input,hn.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(bi(this.input,hn.BLUR,()=>{this.domNode.style.outline="none"}))),this._domNode}get input(){return Si(this._inputNode),this._inputNode}get button(){return Si(this._buttonNode),this._buttonNode}get buttonState(){return this._buttonState}setSparkleButton(){var e;this._buttonState="sparkle",this._sparkleIcon??(this._sparkleIcon=Ly(xt.sparkle)),Gr(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=Ly(xt.primitiveSquare)),Gr(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 df=class df{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=`${df._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=Ly(xt.sparkle),this._icon.style.display="none",i.appendChild(this._icon),this._label=document.createElement("div"),eE(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(E2.AIGenerated));this._icon.style.display=t?"inherit":"none"}_updateLabel(e){this._label.innerText=e.newSymbolName}static getLayoutInfo({lineHeight:e}){return{totalHeight:e+df._PADDING*2}}dispose(){}};df._PADDING=2;let jf=df;var a5=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)}},ZC;class l0{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 O(this.position.lineNumber,i.startColumn,this.position.lineNumber,i.endColumn),text:i.word,rejectReason:t.length>0?t.join(`
71
+ `):void 0}:{range:O.fromPositions(this.position),text:"",rejectReason:t.length>0?t.join(`
72
+ `):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(`
73
+ `)};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(w("no result","No result.")),n);return r}}async function l5(o,e,t,i){const n=new l0(e,t,o),s=await n.resolveRenameLocation($t.None);return s!=null&&s.rejectReason?{edits:[],rejectReason:s.rejectReason}:n.provideRenameEdits(i,$t.None)}var _d;let Xl=(_d=class{static get(e){return e.getContribution(ZC.ID)}constructor(e,t,i,n,s,r,a,c,h){this.editor=e,this._instaService=t,this._notificationService=i,this._bulkEditService=n,this._progressService=s,this._logService=r,this._configService=a,this._languageFeaturesService=c,this._telemetryService=h,this._disposableStore=new we,this._cts=new Kn,this._renameWidget=this._disposableStore.add(this._instaService.createInstance(GC,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}async run(){var _,y;const e=this._logService.trace.bind(this._logService,"[rename]");if(this._cts.dispose(!0),this._cts=new Kn,!this.editor.hasModel()){e("editor has no model");return}const t=this.editor.getPosition(),i=new l0(this.editor.getModel(),t,this._languageFeaturesService.renameProvider);if(!i.hasProvider()){e("skeleton has no provider");return}const n=new vu(this.editor,5,void 0,this._cts.token);let s;try{e("resolving rename location");const S=i.resolveRenameLocation(n.token);this._progressService.showWhile(S,250),s=await S,e("resolved rename location")}catch(S){S instanceof fb?e("resolve rename location cancelled",JSON.stringify(S,null," ")):(e("resolve rename location failed",S instanceof Error?S:JSON.stringify(S,null," ")),(typeof S=="string"||Lm(S))&&((_=Us.get(this.editor))==null||_.showMessage(S||w("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=Us.get(this.editor))==null||y.showMessage(s.rejectReason,t);return}if(n.token.isCancellationRequested){e("returning early - cts1 cancelled");return}const r=new vu(this.editor,5,s.range,this._cts.token),a=this.editor.getModel(),c=this._languageFeaturesService.newSymbolNamesProvider.all(a),h=await Promise.all(c.map(async S=>[S,await S.supportsAutomaticNewSymbolNamesTriggerKind??!1])),u=(S,x)=>{let E=h.slice();return S===xy.Automatic&&(E=E.filter(([M,F])=>F)),E.map(([M])=>M.provideNewSymbolNames(a,s.range,S,x))};e("creating rename input field and awaiting its result");const g=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),f=await this._renameWidget.getInput(s.range,s.text,g,c.length>0?u:void 0,r);if(e("received response from rename input field"),c.length>0&&this._reportTelemetry(c.length,a.getLanguageId(),f),typeof f=="boolean"){e(`returning early - rename input field response - ${f}`),f&&this.editor.focus(),r.dispose();return}this.editor.focus(),e("requesting rename edits");const v=lp(i.provideRenameEdits(f.newName,r.token),r.token).then(async S=>{if(!S){e("returning early - no rename edits result");return}if(!this.editor.hasModel()){e("returning early - no model after rename edits are provided");return}if(S.rejectReason){e(`returning early - rejected with reason: ${S.rejectReason}`),this._notificationService.info(S.rejectReason);return}this.editor.setSelection(O.fromPositions(this.editor.getSelection().getPosition())),e("applying edits"),this._bulkEditService.apply(S,{editor:this.editor,showPreview:f.wantsPreview,label:w("label","Renaming '{0}' to '{1}'",s==null?void 0:s.text,f.newName),code:"undoredo.rename",quotableLabel:w("quotableLabel","Renaming {0} to {1}",s==null?void 0:s.text,f.newName),respectAutoSaveConfig:!0}).then(x=>{e("edits applied"),x.ariaSummary&&Uo(w("aria","Successfully renamed '{0}' to '{1}'. Summary: {2}",s.text,f.newName,x.ariaSummary))}).catch(x=>{e(`error when applying edits ${JSON.stringify(x,null," ")}`),this._notificationService.error(w("rename.failedApply","Rename failed to apply edits")),this._logService.error(x)})},S=>{e("error when providing rename edits",JSON.stringify(S,null," ")),this._notificationService.error(w("rename.failed","Rename failed to compute edits")),this._logService.error(S)}).finally(()=>{r.dispose()});return e("returning rename operation"),this._progressService.showWhile(v,250),v}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)}},ZC=_d,_d.ID="editor.contrib.renameController",_d);Xl=ZC=a5([il(1,Bt),il(2,Ss),il(3,hb),il(4,dp),il(5,$d),il(6,P2),il(7,Je),il(8,vr)],Xl);class c5 extends ge{constructor(){super({id:"editor.action.rename",label:w("rename.label","Rename Symbol"),alias:"Rename Symbol",precondition:ie.and(T.writable,T.hasRenameProvider),kbOpts:{kbExpr:T.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(e,t){const i=e.get(xn),[n,s]=Array.isArray(t)&&t||[void 0,void 0];return Ri.isUri(n)&&Qe.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))))},Vi):super.runCommand(e,t)}run(e,t){const i=e.get($d),n=Xl.get(t);return n?(i.trace("[RenameAction] got controller, running..."),n.run()):(i.trace("[RenameAction] returning early - controller missing"),Promise.resolve())}}Zt(Xl.ID,Xl,4);Q(c5);const c0=Rs.bindToContribution(Xl.get);it(new c0({id:"acceptRenameInput",precondition:og,handler:o=>o.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:ie.and(T.focus,ie.not("isComposing")),primary:3}}));it(new c0({id:"acceptRenameInputWithPreview",precondition:ie.and(og,ie.has("config.editor.rename.enablePreview")),handler:o=>o.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:ie.and(T.focus,ie.not("isComposing")),primary:2051}}));it(new c0({id:"cancelRenameInput",precondition:og,handler:o=>o.cancelRenameInput(),kbOpts:{weight:199,kbExpr:T.focus,primary:9,secondary:[1033]}}));Ti(class extends Ns{constructor(){super({id:"focusNextRenameSuggestion",title:{...Xe("focusNextRenameSuggestion","Focus Next Rename Suggestion")},precondition:og,keybinding:[{primary:18,weight:199}]})}run(e){const t=e.get(xn).getFocusedCodeEditor();if(!t)return;const i=Xl.get(t);i&&i.focusNextRenameSuggestion()}});Ti(class extends Ns{constructor(){super({id:"focusPreviousRenameSuggestion",title:{...Xe("focusPreviousRenameSuggestion","Focus Previous Rename Suggestion")},precondition:og,keybinding:[{primary:16,weight:199}]})}run(e){const t=e.get(xn).getFocusedCodeEditor();if(!t)return;const i=Xl.get(t);i&&i.focusPreviousRenameSuggestion()}});As("_executeDocumentRenameProvider",function(o,e,t,...i){const[n]=i;Si(typeof n=="string");const{renameProvider:s}=o.get(Je);return l5(s,e,t,n)});As("_executePrepareRename",async function(o,e,t){const{renameProvider:i}=o.get(Je),s=await new l0(e,t,i).resolveRenameLocation($t.None);if(s!=null&&s.rejectReason)throw new Error(s.rejectReason);return s});mr.as(hp.Configuration).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:5,description:w("enablePreview","Enable/disable the ability to preview changes before renaming"),default:!0,type:"boolean"}}});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},Sk=function(o,e){return function(t,i){e(t,i,o)}},gu;let iv=(gu=class extends Se{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 Rn(()=>{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),c=a.findTokenIndexAtOffset(r.startColumn-1),h=a.getStandardTokenType(c);return a.getLanguageId(c)===t.getLanguageId()&&h===1}));const i=Object.values(this.currentOccurrences).map(s=>s.decorationId),n=e.map(s=>h5(s));this.editor.changeDecorations(s=>{const r=s.deltaDecorations(i,n);this.currentOccurrences={};for(let a=0,c=r.length;a<c;a++){const h={sectionHeader:e[a],decorationId:r[a]};this.currentOccurrences[h.decorationId]=h}})}stop(){this.computeSectionHeaders.cancel(),this.computePromise&&(this.computePromise.cancel(),this.computePromise=null)}dispose(){super.dispose(),this.stop(),this.decorations.clear()}},gu.ID="editor.sectionHeaderDetector",gu);iv=d5([Sk(1,zn),Sk(2,Ga)],iv);function h5(o){return{range:o.range,options:oi.createDynamic({description:"section-header",stickiness:3,collapseOnReplaceEdit:!0,minimap:{color:void 0,position:1,sectionHeaderStyle:o.hasSeparatorLine?2:1,sectionHeaderText:o.text}})}}Zt(iv.ID,iv,1);function u5(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 g5(o){const e=new Uint8Array(o.buffer,o.byteOffset,o.length*4);return T2()||u5(e),M2.wrap(e)}function qM(o){const e=new Uint32Array(f5(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 g5(e)}function f5(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 Jb(o){return o&&!!o.data}function KM(o){return o&&Array.isArray(o.edits)}class p5{constructor(e,t,i){this.provider=e,this.tokens=t,this.error=i}}function GM(o,e){return o.has(e)}function m5(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:[]}async function ZM(o,e,t,i,n){const s=m5(o,e),r=await Promise.all(s.map(async a=>{let c,h=null;try{c=await a.provideDocumentSemanticTokens(e,a===t?i:null,n)}catch(u){h=u,c=null}return(!c||!Jb(c)&&!KM(c))&&(c=null),new p5(a,c,h)}));for(const a of r){if(a.error)throw a.error;if(a.tokens)return a}return r.length>0?r[0]:null}function _5(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:null}class v5{constructor(e,t){this.provider=e,this.tokens=t}}function b5(o,e){return o.has(e)}function XM(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:[]}async function d0(o,e,t,i){const n=XM(o,e),s=await Promise.all(n.map(async r=>{let a;try{a=await r.provideDocumentRangeSemanticTokens(e,t,i)}catch(c){Cn(c),a=null}return(!a||!Jb(a))&&(a=null),new v5(r,a)}));for(const r of s)if(r.tokens)return r;return s.length>0?s[0]:null}Gi.registerCommand("_provideDocumentSemanticTokensLegend",async(o,...e)=>{const[t]=e;Si(t instanceof Ri);const i=o.get(Cs).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=o.get(Je),s=_5(n,i);return s?s[0].getLegend():o.get(Bn).executeCommand("_provideDocumentRangeSemanticTokensLegend",t)});Gi.registerCommand("_provideDocumentSemanticTokens",async(o,...e)=>{const[t]=e;Si(t instanceof Ri);const i=o.get(Cs).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=o.get(Je);if(!GM(n,i))return o.get(Bn).executeCommand("_provideDocumentRangeSemanticTokens",t,i.getFullModelRange());const s=await ZM(n,i,null,null,$t.None);if(!s)return;const{provider:r,tokens:a}=s;if(!a||!Jb(a))return;const c=qM({id:0,type:"full",data:a.data});return a.resultId&&r.releaseDocumentSemanticTokens(a.resultId),c});Gi.registerCommand("_provideDocumentRangeSemanticTokensLegend",async(o,...e)=>{const[t,i]=e;Si(t instanceof Ri);const n=o.get(Cs).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=o.get(Je),r=XM(s,n);if(r.length===0)return;if(r.length===1)return r[0].getLegend();if(!i||!O.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 d0(s,n,O.lift(i),$t.None);if(a)return a.provider.getLegend()});Gi.registerCommand("_provideDocumentRangeSemanticTokens",async(o,...e)=>{const[t,i]=e;Si(t instanceof Ri),Si(O.isIRange(i));const n=o.get(Cs).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=o.get(Je),r=await d0(s,n,O.lift(i),$t.None);if(!(!r||!r.tokens))return qM({id:0,type:"full",data:r.tokens.data})});const h0="editor.semanticHighlighting";function qm(o,e,t){var n;const i=(n=t.getValue(h0,{overrideIdentifier:o.getLanguageId(),resource:o.uri}))==null?void 0:n.enabled;return typeof i=="boolean"?i:e.getColorTheme().semanticHighlighting}var YM=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},Wr=function(o,e){return function(t,i){e(t,i,o)}},sl;let XC=class extends Se{constructor(e,t,i,n,s,r){super(),this._watchers=Object.create(null);const a=u=>{this._watchers[u.uri.toString()]=new YC(u,e,i,s,r)},c=(u,g)=>{g.dispose(),delete this._watchers[u.uri.toString()]},h=()=>{for(const u of t.getModels()){const g=this._watchers[u.uri.toString()];qm(u,i,n)?g||a(u):g&&c(u,g)}};t.getModels().forEach(u=>{qm(u,i,n)&&a(u)}),this._register(t.onModelAdded(u=>{qm(u,i,n)&&a(u)})),this._register(t.onModelRemoved(u=>{const g=this._watchers[u.uri.toString()];g&&c(u,g)})),this._register(n.onDidChangeConfiguration(u=>{u.affectsConfiguration(h0)&&h()})),this._register(i.onDidColorThemeChange(h))}dispose(){for(const e of Object.values(this._watchers))e.dispose();super.dispose()}};XC=YM([Wr(0,d1),Wr(1,Cs),Wr(2,qo),Wr(3,on),Wr(4,yo),Wr(5,Je)],XC);var zl;let YC=(zl=class extends Se{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:sl.REQUEST_MIN_DELAY,max:sl.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new Rn(()=>this._fetchDocumentSemanticTokensNow(),sl.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=()=>{fs(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),fs(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[],this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!GM(this._provider,this._model)){this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1);return}if(!this._model.isAttachedToEditor())return;const e=new Kn,t=this._currentDocumentResponse?this._currentDocumentResponse.provider:null,i=this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,n=ZM(this._provider,this._model,t,i,e.token);this._currentDocumentRequestCancellationTokenSource=e,this._providersChangedDuringRequest=!1;const s=[],r=this._model.onDidChangeContent(c=>{s.push(c)}),a=new qs(!1);n.then(c=>{if(this._debounceInformation.update(this._model,a.elapsed()),this._currentDocumentRequestCancellationTokenSource=null,r.dispose(),!c)this._setDocumentSemanticTokens(null,null,null,s);else{const{provider:h,tokens:u}=c,g=this._semanticTokensStylingService.getStyling(h);this._setDocumentSemanticTokens(h,u||null,g,s)}},c=>{c&&(Ql(c)||typeof c.message=="string"&&c.message.indexOf("busy")!==-1)||Vi(c),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(KM(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 f of t.edits)a+=(f.data?f.data.length:0)-f.deleteCount;const c=s.data,h=new Uint32Array(c.length+a);let u=c.length,g=h.length;for(let f=t.edits.length-1;f>=0;f--){const v=t.edits[f];if(v.start>c.length){i.warnInvalidEditStart(s.resultId,t.resultId,f,v.start,c.length),this._model.tokenization.setSemanticTokens(null,!0);return}const _=u-(v.start+v.deleteCount);_>0&&(sl._copy(c,u-_,h,g-_,_),g-=_),v.data&&(sl._copy(v.data,0,h,g-v.data.length,v.data.length),g-=v.data.length),u=v.start}u>0&&sl._copy(c,0,h,0,u),t={resultId:t.resultId,data:h}}}if(Jb(t)){this._currentDocumentResponse=new w5(e,t.resultId,t.data);const a=DE(t,i,this._model.getLanguageId());if(n.length>0)for(const c of n)for(const h of a)for(const u of c.changes)h.applyEdit(u.range,u.text);this._model.tokenization.setSemanticTokens(a,!0)}else this._model.tokenization.setSemanticTokens(null,!0);r()}},sl=zl,zl.REQUEST_MIN_DELAY=300,zl.REQUEST_MAX_DELAY=2e3,zl);YC=sl=YM([Wr(1,d1),Wr(2,qo),Wr(3,yo),Wr(4,Je)],YC);class w5{constructor(e,t,i){this.provider=e,this.resultId=t,this.data=i}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}Xu(XC);var y5=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)}},fu;let nv=(fu=class extends Se{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 Rn(()=>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(c=>{this._cancelAll(),a()})),this._register(this._provider.onDidChange(()=>{this._cancelAll(),a()})),this._register(this._configurationService.onDidChangeConfiguration(c=>{c.affectsConfiguration(h0)&&(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(!qm(e,this._themeService,this._configurationService)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}if(!b5(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=qn(r=>Promise.resolve(d0(this._provider,e,t,r))),s=new qs(!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:c}=r,h=this._semanticTokensStylingService.getStyling(a);e.tokenization.setPartialSemanticTokens(t,DE(c,h,e.getLanguageId()))}).then(()=>this._removeOutstandingRequest(n),()=>this._removeOutstandingRequest(n)),n}},fu.ID="editor.contrib.viewportSemanticTokens",fu);nv=y5([xg(1,d1),xg(2,qo),xg(3,on),xg(4,yo),xg(5,Je)],nv);Zt(nv.ID,nv,1);class S5{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 c=a,h=a,u=0;for(;c>=0;c--){const g=s.charCodeAt(c);if(c!==a&&(g===95||g===45))break;if(AL(g)&&OL(u))break;u=g}for(c+=1;h<s.length;h++){const g=s.charCodeAt(h);if(OL(g)&&AL(u))break;if(g===95||g===45)break;u=g}c<h&&e.push({range:new O(i.lineNumber,r+c,i.lineNumber,r+h)})}_addWordRanges(e,t,i){const n=t.getWordAtPosition(i);n&&e.push({range:new O(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 O(i.lineNumber,1,i.lineNumber,t.getLineMaxColumn(i.lineNumber))})}}var C5=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},x5=function(o,e){return function(t,i){e(t,i,o)}},QC;class u0{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 u0(t,this.ranges);return i.ranges[t].equalsRange(this.ranges[this.index])?i.mov(e):i}}var vd;let $f=(vd=class{static get(e){return e.getContribution(QC.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 JM(this._languageFeaturesService.selectionRangeProvider,i,t.map(s=>s.getPosition()),this._editor.getOption(114),$t.None).then(s=>{var r;if(!(!io(s)||s.length!==t.length)&&!(!this._editor.hasModel()||!Yr(this._editor.getSelections(),t,(a,c)=>a.equalsSelection(c)))){for(let a=0;a<s.length;a++)s[a]=s[a].filter(c=>c.containsPosition(t[a].getStartPosition())&&c.containsPosition(t[a].getEndPosition())),s[a].unshift(t[a]);this._state=s.map(a=>new u0(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=>_t.fromPositions(s.ranges[s.index].getStartPosition(),s.ranges[s.index].getEndPosition()));this._ignoreSelection=!0;try{this._editor.setSelections(n)}finally{this._ignoreSelection=!1}}},QC=vd,vd.ID="editor.contrib.smartSelectController",vd);$f=QC=C5([x5(1,Je)],$f);class QM extends ge{constructor(e,t){super(t),this._forward=e}async run(e,t){const i=$f.get(t);i&&await i.run(this._forward)}}class L5 extends QM{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:w("smartSelect.expand","Expand Selection"),alias:"Expand Selection",precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:We.MenubarSelectionMenu,group:"1_basic",title:w({key:"miSmartSelectGrow",comment:["&& denotes a mnemonic"]},"&&Expand Selection"),order:2}})}}Gi.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand");class I5 extends QM{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:w("smartSelect.shrink","Shrink Selection"),alias:"Shrink Selection",precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:We.MenubarSelectionMenu,group:"1_basic",title:w({key:"miSmartSelectShrink",comment:["&& denotes a mnemonic"]},"&&Shrink Selection"),order:3}})}}Zt($f.ID,$f,4);Q(L5);Q(I5);async function JM(o,e,t,i,n){const s=o.all(e).concat(new S5(i.selectSubwords));s.length===1&&s.unshift(new z_);const r=[],a=[];for(const c of s)r.push(Promise.resolve(c.provideSelectionRanges(e,t,n)).then(h=>{if(io(h)&&h.length===t.length)for(let u=0;u<t.length;u++){a[u]||(a[u]=[]);for(const g of h[u])O.isIRange(g.range)&&O.containsPosition(g.range,t[u])&&a[u].push(O.lift(g.range))}},Cn));return await Promise.all(r),a.map(c=>{if(c.length===0)return[];c.sort((f,v)=>Qe.isBefore(f.getStartPosition(),v.getStartPosition())?1:Qe.isBefore(v.getStartPosition(),f.getStartPosition())||Qe.isBefore(f.getEndPosition(),v.getEndPosition())?-1:Qe.isBefore(v.getEndPosition(),f.getEndPosition())?1:0);const h=[];let u;for(const f of c)(!u||O.containsRange(f,u)&&!O.equalsRange(f,u))&&(h.push(f),u=f);if(!i.selectLeadingAndTrailingWhitespace)return h;const g=[h[0]];for(let f=1;f<h.length;f++){const v=h[f-1],_=h[f];if(_.startLineNumber!==v.startLineNumber||_.endLineNumber!==v.endLineNumber){const y=new O(v.startLineNumber,e.getLineFirstNonWhitespaceColumn(v.startLineNumber),v.endLineNumber,e.getLineLastNonWhitespaceColumn(v.endLineNumber));y.containsRange(v)&&!y.equalsRange(v)&&_.containsRange(y)&&!_.equalsRange(y)&&g.push(y);const S=new O(v.startLineNumber,1,v.endLineNumber,e.getLineMaxColumn(v.endLineNumber));S.containsRange(v)&&!S.equalsRange(y)&&_.containsRange(S)&&!_.equalsRange(S)&&g.push(S)}g.push(_)}return g})}Gi.registerCommand("_executeSelectionRangeProvider",async function(o,...e){const[t,i]=e;Si(Ri.isUri(t));const n=o.get(Je).selectionRangeProvider,s=await o.get(wr).createModelReference(t);try{return JM(n,s.object.textEditorModel,i,{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},$t.None)}finally{s.dispose()}});const k5=Object.freeze({View:Xe("view","View"),Help:Xe("help","Help"),Test:Xe("test","Test"),File:Xe("file","File"),Preferences:Xe("preferences","Preferences"),Developer:Xe({key:"developer",comment:["A developer on Code itself or someone diagnosing issues in Code"]},"Developer")});class nf{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&&Yr(this.startLineNumbers,e.startLineNumbers)&&Yr(this.endLineNumbers,e.endLineNumbers)}static get Empty(){return new nf([],[],0)}}const Ck=XD("stickyScrollViewLayer",{createHTML:o=>o}),iy="data-sticky-line-index",xk="data-sticky-is-line",D5="data-sticky-is-line-number",Lk="data-sticky-is-folding-icon";class E5 extends Se{constructor(e){super(),this._editor=e,this._foldingIconStore=new we,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 $o),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,c]of s.entries()){const h=this._renderChildNode(a+i,c,t,n);h&&(this._linesDomNode.appendChild(h.lineDomNode),this._lineNumbersDomNode.appendChild(h.lineNumberDomNode),this._renderedStickyLines.push(h))}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(bi(this._lineNumbersDomNode,hn.MOUSE_ENTER,()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)})),this._foldingIconStore.add(bi(this._lineNumbersDomNode,hn.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 Qe(t,1)).lineNumber,a=s.getViewLineRenderingData(r),c=this._editor.getOption(68);let h;try{h=yf.filter(a.inlineDecorations,r,a.minColumn,a.maxColumn)}catch{h=[]}const u=new JD(!0,!0,a.content,a.continuesWithWrappedLine,a.isBasicASCII,a.containsRTL,0,a.tokens,h,a.tabSize,a.startVisibleColumn,1,1,1,500,"none",!0,!0,null),g=new YD(2e3),f=QD(u,g);let v;Ck?v=Ck.createHTML(g.build()):v=g.build();const _=document.createElement("span");_.setAttribute(iy,String(e)),_.setAttribute(xk,""),_.setAttribute("role","listitem"),_.tabIndex=0,_.className="sticky-line-content",_.classList.add(`stickyLine${t}`),_.style.lineHeight=`${this._lineHeight}px`,_.innerHTML=v;const y=document.createElement("span");y.setAttribute(iy,String(e)),y.setAttribute(D5,""),y.className="sticky-line-number",y.style.lineHeight=`${this._lineHeight}px`;const S=n.contentLeft;y.style.width=`${S}px`;const x=document.createElement("span");c.renderType===1||c.renderType===3&&t%10===0?x.innerText=t.toString():c.renderType===2&&(x.innerText=Math.abs(t-this._editor.getPosition().lineNumber).toString()),x.className="sticky-line-number-inner",x.style.lineHeight=`${this._lineHeight}px`,x.style.width=`${n.lineNumbersWidth}px`,x.style.paddingLeft=`${n.lineNumbersLeft}px`,y.appendChild(x);const E=this._renderFoldingIconForLine(i,t);E&&y.appendChild(E.domNode),this._editor.applyFontInfo(_),this._editor.applyFontInfo(x),y.style.lineHeight=`${this._lineHeight}px`,_.style.lineHeight=`${this._lineHeight}px`,y.style.height=`${this._lineHeight}px`,_.style.height=`${this._lineHeight}px`;const M=new P5(e,t,_,y,E,f.characterMapping,_.scrollWidth);return this._updateTopAndZIndexOfStickyLine(M)}_updateTopAndZIndexOfStickyLine(e){var u;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 c=`${t*this._lineHeight+this._lastLineRelativePosition+((u=e.foldingIcon)!=null&&u.isCollapsed?1:0)}px`,h=`${t*this._lineHeight}px`;return i.style.top=s?c:h,n.style.top=s?c:h,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 c=n.isCollapsed(s),h=new T5(c,r,n.getEndLineNumber(s),this._lineHeight);return h.setVisible(this._isOnGlyphMargin?!0:c||i==="always"),h.domNode.setAttribute(Lk,""),h}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=N2(t.characterMapping,e,0);return new Qe(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,iy);return t?parseInt(t,10):null}isInStickyLine(e){return this._getAttributeValue(e,xk)!==void 0}isInFoldingIconDomNode(e){return this._getAttributeValue(e,Lk)!==void 0}_getAttributeValue(e,t){for(;e&&e!==this._rootDomNode;){const i=e.getAttribute(t);if(i!==null)return i;e=e.parentElement}}}class P5{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 T5{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=xi.asClassName(e?P_:E_)}setVisible(e){this.domNode.style.cursor=e?"pointer":"default",this.domNode.style.opacity=e?"1":"0"}}class sf{constructor(e,t){this.startLineNumber=e,this.endLineNumber=t}}class sv{constructor(e,t,i){this.range=e,this.children=t,this.parent=i}}class eN{constructor(e,t,i,n){this.uri=e,this.version=t,this.element=i,this.outlineProviderId=n}}var ew=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},qf=function(o,e){return function(t,i){e(t,i,o)}},of;(function(o){o.OUTLINE_MODEL="outlineModel",o.FOLDING_PROVIDER_MODEL="foldingProviderModel",o.INDENTATION_MODEL="indentationModel"})(of||(of={}));var yl;(function(o){o[o.VALID=0]="VALID",o[o.INVALID=1]="INVALID",o[o.CANCELED=2]="CANCELED"})(yl||(yl={}));let JC=class extends Se{constructor(e,t,i,n){switch(super(),this._editor=e,this._modelProviders=[],this._modelPromise=null,this._updateScheduler=this._register(new jl(300)),this._updateOperation=this._register(new we),this._editor.getOption(116).defaultModel){case of.OUTLINE_MODEL:this._modelProviders.push(new ex(this._editor,n));case of.FOLDING_PROVIDER_MODEL:this._modelProviders.push(new ix(this._editor,t,n));case of.INDENTATION_MODEL:this._modelProviders.push(new tx(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 yl.CANCELED:return this._updateOperation.clear(),null;case yl.VALID:return t.stickyModel}}return null}).catch(t=>(Vi(t),null))}};JC=ew([qf(2,Bt),qf(3,Je)],JC);class tN extends Se{constructor(e){super(),this._editor=e,this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,yl.INVALID}computeStickyModel(e){if(e.isCancellationRequested||!this.isProviderValid())return{statusPromise:this._invalid(),modelPromise:null};const t=qn(i=>this.createModelFromProvider(i));return{statusPromise:t.then(i=>this.isModelValid(i)?e.isCancellationRequested?yl.CANCELED:(this._stickyModel=this.createStickyModel(e,i),yl.VALID):this._invalid()).then(void 0,i=>(Vi(i),yl.CANCELED)),modelPromise:t}}isModelValid(e){return!0}isProviderValid(){return!0}}let ex=class extends tN{constructor(e,t){super(e),this._languageFeaturesService=t}createModelFromProvider(e){return va.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 eN(s.uri,s.getVersionId(),i,n)}isModelValid(e){return e&&e.children.size>0}_stickyModelFromOutlineModel(e,t){let i;if(Da.first(e.children.values())instanceof SM){const a=Da.find(e.children.values(),c=>c.id===t);if(a)i=a.children;else{let c="",h=-1,u;for(const[g,f]of e.children.entries()){const v=this._findSumOfRangesOfGroup(f);v>h&&(u=f,h=v,c=f.id)}t=c,i=u.children}}else i=e.children;const n=[],s=Array.from(i.values()).sort((a,c)=>{const h=new sf(a.symbol.range.startLineNumber,a.symbol.range.endLineNumber),u=new sf(c.symbol.range.startLineNumber,c.symbol.range.endLineNumber);return this._comparator(h,u)});for(const a of s)n.push(this._stickyModelFromOutlineElement(a,a.symbol.selectionRange.startLineNumber));return{stickyOutlineElement:new sv(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 sf(e.symbol.selectionRange.startLineNumber,e.symbol.range.endLineNumber);return new sv(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 US?t+e.symbol.range.endLineNumber-e.symbol.selectionRange.startLineNumber:t}};ex=ew([qf(1,Je)],ex);class iN extends tN{constructor(e){super(e),this._foldingLimitReporter=new bM(e)}createStickyModel(e,t){const i=this._fromFoldingRegions(t),n=this._editor.getModel();return new eN(n.uri,n.getVersionId(),i,void 0)}isModelValid(e){return e!==null}_fromFoldingRegions(e){const t=e.length,i=[],n=new sv(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 c=new sv(new sf(e.getStartLineNumber(s),e.getEndLineNumber(s)+1),[],a);a.children.push(c),i.push(c)}return n}}let tx=class extends iN{constructor(e,t){super(e),this._languageConfigurationService=t,this.provider=this._register(new Y1(e.getModel(),this._languageConfigurationService,this._foldingLimitReporter))}async createModelFromProvider(e){return this.provider.compute(e)}};tx=ew([qf(1,zn)],tx);let ix=class extends iN{constructor(e,t,i){super(e),this._languageFeaturesService=i;const n=Zl.getFoldingRangeProviders(this._languageFeaturesService,e.getModel());n.length>0&&(this.provider=this._register(new Q1(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}};ix=ew([qf(2,Je)],ix);var M5=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},Ik=function(o,e){return function(t,i){e(t,i,o)}};class N5{constructor(e,t,i){this.startLineNumber=e,this.endLineNumber=t,this.nestingDepth=i}}let nx=class extends Se{constructor(e,t,i){super(),this._languageFeaturesService=t,this._languageConfigurationService=i,this._onDidChangeStickyScroll=this._register(new jt),this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event,this._model=null,this._cts=null,this._stickyModelProvider=null,this._editor=e,this._sessionStore=this._register(new we),this._updateSoon=this._register(new Rn(()=>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(nn(()=>{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 JC(e,()=>this._updateSoon.schedule(),this._languageConfigurationService,this._languageFeaturesService))}async update(){var e;(e=this._cts)==null||e.dispose(!0),this._cts=new Kn,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 u=0;u<t.children.length;u++){const g=t.children[u];g.range&&a.push(g.range.startLineNumber)}const c=this.updateIndex(n_(a,e.startLineNumber,(u,g)=>u-g)),h=this.updateIndex(n_(a,e.startLineNumber+n,(u,g)=>u-g));for(let u=c;u<=h;u++){const g=t.children[u];if(!g)return;if(g.range){const f=g.range.startLineNumber,v=g.range.endLineNumber;e.startLineNumber<=v+1&&f-1<=e.endLineNumber&&f!==r&&(r=f,i.push(new N5(f,v-1,n+1)),this.getCandidateStickyLinesIntersectingFromStickyModel(e,g,i,n+1,f))}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}};nx=M5([Ik(1,Je),Ik(2,zn)],nx);var R5=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},vh=function(o,e){return function(t,i){e(t,i,o)}},sx,bd;let ja=(bd=class extends Se{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 we,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 E5(this._editor),this._stickyLineCandidateProvider=new nx(this._editor,i,s),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=nf.Empty,this._onDidResize(),this._readConfiguration();const c=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeConfiguration(u=>{this._readConfigurationChange(u)})),this._register(bi(c,hn.CONTEXT_MENU,async u=>{this._onContextMenu(kc(c),u)})),this._stickyScrollFocusedContextKey=T.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=T.stickyScrollVisible.bindTo(this._contextKeyService);const h=this._register(bu(c));this._register(h.onDidBlur(u=>{this._positionRevealed===!1&&c.clientHeight===0?(this._focusedStickyElementIndex=-1,this.focus()):this._disposeFocusStickyScrollStore()})),this._register(h.onDidFocus(u=>{this.focus()})),this._registerMouseListeners(),this._register(bi(c,hn.MOUSE_DOWN,u=>{this._onMouseDown=!0}))}static get(e){return e.getContribution(sx.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 we,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(O.fromPositions(e)),this._editor.focus()}_registerMouseListeners(){const e=this._register(new we),t=this._register(new Ub(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 O(a.lineNumber,a.column,a.lineNumber,a.column+r.innerText.length),textElement:r}:null},n=this._stickyScrollWidget.getDomNode();this._register(Fa(n,hn.CLICK,s=>{if(s.ctrlKey||s.altKey||s.metaKey||!s.leftButton)return;if(s.shiftKey){const h=this._stickyScrollWidget.getLineIndexFromChildDomNode(s.target);if(h===null)return;const u=new Qe(this._endLineNumbers[h],1);this._revealLineInCenterIfOutsideViewport(u);return}if(this._stickyScrollWidget.isInFoldingIconDomNode(s.target)){const h=this._stickyScrollWidget.getLineNumberFromChildDomNode(s.target);this._toggleFoldingRegionForLine(h);return}if(!this._stickyScrollWidget.isInStickyLine(s.target))return;let c=this._stickyScrollWidget.getEditorPositionFromNode(s.target);if(!c){const h=this._stickyScrollWidget.getLineNumberFromChildDomNode(s.target);if(h===null)return;c=new Qe(h,1)}this._revealPosition(c)})),this._register(Fa(n,hn.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(bi(n,hn.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:c,textElement:h}=a;if(!c.equalsRange(this._stickyRangeProjectedOnEditor))this._stickyRangeProjectedOnEditor=c,e.clear();else if(h.style.textDecoration==="underline")return;const u=new Kn;e.add(nn(()=>u.dispose(!0)));let g;Pp(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new Qe(c.startLineNumber,c.startColumn+1),!1,u.token).then((f=>{if(!u.token.isCancellationRequested)if(f.length!==0){this._candidateDefinitionsLength=f.length;const v=h;g!==v?(e.clear(),g=v,g.style.textDecoration="underline",e.add(nn(()=>{g.style.textDecoration="none"}))):g||(g=v,g.style.textDecoration="underline",e.add(nn(()=>{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(iM,s,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor})))}))}_onContextMenu(e,t){const i=new R2(e,t);this._contextMenuService.showContextMenu({menuId:We.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;G1(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=Zl.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=nf.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 c=new sf(a[0].startLineNumber,a[a.length-1].endLineNumber),h=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(c);for(const u of h){const g=u.startLineNumber,f=u.endLineNumber,v=u.nestingDepth;if(f-g>0){const _=(v-1)*e,y=v*e,S=this._editor.getBottomForLineNumber(g)-i,x=this._editor.getTopForLineNumber(f)-i,E=this._editor.getBottomForLineNumber(f)-i;if(_>x&&_<=E){s.push(g),r.push(f+1),n=E-y;break}else y>S&&y<=E&&(s.push(g),r.push(f+1));if(s.length===t)break}}}return this._endLineNumbers=r,new nf(s,r,n,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}},sx=bd,bd.ID="store.contrib.stickyScrollController",bd);ja=sx=R5([vh(1,Ku),vh(2,Je),vh(3,Bt),vh(4,zn),vh(5,yo),vh(6,wi)],ja);class A5 extends Ns{constructor(){super({id:"editor.action.toggleStickyScroll",title:{...Xe("toggleEditorStickyScroll","Toggle Editor Sticky Scroll"),mnemonicTitle:w({key:"mitoggleStickyScroll",comment:["&& denotes a mnemonic"]},"&&Toggle Editor Sticky Scroll")},metadata:{description:Xe("toggleEditorStickyScroll.description","Toggle/enable the editor sticky scroll which shows the nested scopes at the top of the viewport")},category:k5.View,toggled:{condition:ie.equals("config.editor.stickyScroll.enabled",!0),title:w("stickyScroll","Sticky Scroll"),mnemonicTitle:w({key:"miStickyScroll",comment:["&& denotes a mnemonic"]},"&&Sticky Scroll")},menu:[{id:We.CommandPalette},{id:We.MenubarAppearanceMenu,group:"4_editor",order:3},{id:We.StickyScrollContext}]})}async run(e){const t=e.get(on),i=!t.getValue("editor.stickyScroll.enabled");return t.updateValue("editor.stickyScroll.enabled",i)}}const tw=100;class O5 extends pr{constructor(){super({id:"editor.action.focusStickyScroll",title:{...Xe("focusStickyScroll","Focus on the editor sticky scroll"),mnemonicTitle:w({key:"mifocusStickyScroll",comment:["&& denotes a mnemonic"]},"&&Focus Sticky Scroll")},precondition:ie.and(ie.has("config.editor.stickyScroll.enabled"),T.stickyScrollVisible),menu:[{id:We.CommandPalette}]})}runEditorCommand(e,t){var i;(i=ja.get(t))==null||i.focus()}}class F5 extends pr{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:Xe("selectNextStickyScrollLine.title","Select the next editor sticky scroll line"),precondition:T.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:tw,primary:18}})}runEditorCommand(e,t){var i;(i=ja.get(t))==null||i.focusNext()}}class H5 extends pr{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:Xe("selectPreviousStickyScrollLine.title","Select the previous sticky scroll line"),precondition:T.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:tw,primary:16}})}runEditorCommand(e,t){var i;(i=ja.get(t))==null||i.focusPrevious()}}class W5 extends pr{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:Xe("goToFocusedStickyScrollLine.title","Go to the focused sticky scroll line"),precondition:T.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:tw,primary:3}})}runEditorCommand(e,t){var i;(i=ja.get(t))==null||i.goToFocused()}}class B5 extends pr{constructor(){super({id:"editor.action.selectEditor",title:Xe("selectEditor.title","Select Editor"),precondition:T.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:tw,primary:9}})}runEditorCommand(e,t){var i;(i=ja.get(t))==null||i.selectEditor()}}Zt(ja.ID,ja,1);Ti(A5);Ti(O5);Ti(H5);Ti(F5);Ti(W5);Ti(B5);var nN=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},Bg=function(o,e){return function(t,i){e(t,i,o)}};class z5{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 ox=class extends A2{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=Da.slice(t,i),s=Da.slice(t,0,i);let r=5;for(const a of Da.concat(n,s)){if(a.score===vf.Default)continue;const c=new O(a.editStart.lineNumber,a.editStart.column,a.editInsertEnd.lineNumber,a.editInsertEnd.column+this.completionModel.lineContext.characterCountDelta),h=a.completion.insertTextRules&&a.completion.insertTextRules&4?{snippet:a.completion.insertText}:a.completion.insertText;e.push(new z5(c,h,a.filterTextLow??a.labelLow,a.completion.additionalTextEdits,a.completion.command,a)),r-->=0&&a.resolve($t.None)}return e}};ox=nN([Bg(5,Xb)],ox);let rx=class extends Se{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 v;if(i.selectedSuggestionInfo)return;let s;for(const _ of this._editorService.listCodeEditors())if(_.getModel()===e){s=_;break}if(!s)return;const r=s.getOption(90);if(Hh.isAllOff(r))return;e.tokenization.tokenizeIfCheap(t.lineNumber);const a=e.tokenization.getLineTokens(t.lineNumber),c=a.getStandardTokenType(a.findTokenIndexAtOffset(Math.max(t.column-1-1,0)));if(Hh.valueFor(r,c)!=="inline")return;let h=e.getWordAtPosition(t),u;if(h!=null&&h.word||(u=this._getTriggerCharacterInfo(e,t)),!(h!=null&&h.word)&&!u||(h||(h=e.getWordUntilPosition(t)),h.endColumn!==t.column))return;let g;const f=e.getValueInRange(new O(t.lineNumber,1,t.lineNumber,t.column));if(!u&&((v=this._lastResult)!=null&&v.canBeReused(e,t.lineNumber,h))){const _=new hk(f,t.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=_,this._lastResult.acquire(),g=this._lastResult}else{const _=await J1(this._languageFeatureService.completionProvider,e,t,new Ff(void 0,U_.createSuggestFilter(s).itemKind,u==null?void 0:u.providers),u&&{triggerKind:1,triggerCharacter:u.ch},n);let y;_.needsClipboard&&(y=await this._clipboardService.readText());const S=new cl(_.items,t.column,new hk(f,0),V_.None,s.getOption(119),s.getOption(113),{boostFullMatch:!1,firstMatchCanBeWeak:!1},y);g=new ox(e,t.lineNumber,h,S,_,this._suggestMemoryService)}return this._lastResult=g,g}handleItemDidShow(e,t){t.completion.resolve($t.None)}freeInlineCompletions(e){e.release()}_getTriggerCharacterInfo(e,t){var s;const i=e.getValueInRange(O.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}}};rx=nN([Bg(0,Je),Bg(1,Gu),Bg(2,Xb),Bg(3,xn)],rx);Xu(rx);class V5 extends ge{constructor(){super({id:"editor.action.forceRetokenize",label:w("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 qs;i.tokenization.forceTokenization(i.getLineCount()),n.stop(),console.log(`tokenization took ${n.elapsed()}`)}}Q(V5);const eb=class eb extends Ns{constructor(){super({id:eb.ID,title:Xe({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:Xe("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=!FL.getTabFocusMode();FL.setTabFocusMode(t),t?Uo(w("toggle.tabMovesFocus.on","Pressing Tab will now move focus to the next focusable element")):Uo(w("toggle.tabMovesFocus.off","Pressing Tab will now insert the tab character"))}};eb.ID="editor.action.toggleTabFocusMode";let ax=eb;Ti(ax);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},kk=function(o,e){return function(t,i){e(t,i,o)}};let lx=class extends Se{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=Ve(e,qe("a.monaco-link",{tabIndex:t.tabIndex??0,href:t.href},t.label)),this.hoverDelegate=i.hoverDelegate??Cb("mouse"),this.setTooltip(t.title),this.el.setAttribute("role","button");const r=this._register(new yw(this.el,"click")),a=this._register(new yw(this.el,"keypress")),c=Nn.chain(a.event,g=>g.map(f=>new c1(f)).filter(f=>f.keyCode===3)),h=this._register(new yw(this.el,O2.Tap)).event;this._register(_D.addTarget(this.el));const u=Nn.any(r.event,c,h);this._register(u(g=>{this.enabled&&(Jm.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)}};lx=U5([kk(3,mp),kk(4,_r)],lx);var sN=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},oN=function(o,e){return function(t,i){e(t,i,o)}};const j5=26;let cx=class extends Se{constructor(e,t){super(),this._editor=e,this.instantiationService=t,this.banner=this._register(this.instantiationService.createInstance(dx))}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,j5)}};cx=sN([oN(1,Bt)],cx);let dx=class extends Se{constructor(e){super(),this.instantiationService=e,this.markdownRenderer=this.instantiationService.createInstance(Yu,{}),this.element=qe("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=qe("span");return t.innerText=e,t}return this.markdownRenderer.render(e).element}clear(){Gr(this.element)}show(e){Gr(this.element);const t=this.getAriaLabel(e);t&&this.element.setAttribute("aria-label",t);const i=Ve(this.element,qe("div.icon-container"));i.setAttribute("aria-hidden","true"),e.icon&&i.appendChild(qe(`div${xi.asCSSSelector(e.icon)}`));const n=Ve(this.element,qe("div.message-container"));if(n.setAttribute("aria-hidden","true"),n.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=Ve(this.element,qe("div.message-actions-container")),e.actions)for(const r of e.actions)this._register(this.instantiationService.createInstance(lx,this.messageActionsContainer,{...r,tabIndex:-1},{}));const s=Ve(this.element,qe("div.action-container"));this.actionBar=this._register(new uf(s)),this.actionBar.push(this._register(new Cu("banner.close","Close Banner",xi.asClassName(WD),!0,()=>{typeof e.onClose=="function"&&e.onClose()})),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};dx=sN([oN(0,Bt)],dx);var g0=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},Qh=function(o,e){return function(t,i){e(t,i,o)}};const $5=yn("extensions-warning-message",xt.warning,w("warningIcon","Icon shown with a warning message in the extensions editor."));var pu;let Kf=(pu=class extends Se{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:w("unicodeHighlighting.thisDocumentHasManyNonBasicAsciiUnicodeCharacters","This document contains many non-basic ASCII unicode characters"),command:new Zf};else if(s.ambiguousCharacterCount>=r)a={message:w("unicodeHighlighting.thisDocumentHasManyAmbiguousUnicodeCharacters","This document contains many ambiguous unicode characters"),command:new Bd};else if(s.invisibleCharacterCount>=r)a={message:w("unicodeHighlighting.thisDocumentHasManyInvisibleUnicodeCharacters","This document contains many invisible unicode characters"),command:new Gf};else throw new Error("Unreachable");this._bannerController.show({id:"unicodeHighlightBanner",message:a.message,icon:$5,actions:[{label:a.command.shortLabel,href:`command:${a.command.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(n.createInstance(cx,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=q5(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"?F2:i)};this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?this._highlighter=new hx(this._editor,t,this._updateState,this._editorWorkerService):this._highlighter=new K5(this._editor,t,this._updateState)}getDecorationInfo(e){return this._highlighter?this._highlighter.getDecorationInfo(e):null}},pu.ID="editor.contrib.unicodeHighlighter",pu);Kf=g0([Qh(1,Ga),Qh(2,H2),Qh(3,Bt)],Kf);function q5(o,e){return{nonBasicASCII:e.nonBasicASCII===Sw?!o:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments===Sw?!o:e.includeComments,includeStrings:e.includeStrings===Sw?!o:e.includeStrings,allowedCharacters:e.allowedCharacters,allowedLocales:e.allowedLocales}}let hx=class extends Se{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 Rn(()=>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:ov.instance.getDecorationFromOptions(this._options)});this._decorations.set(i)})}getDecorationInfo(e){if(!this._decorations.has(e))return null;const t=this._editor.getModel();if(!EE(t,e))return null;const i=t.getValueInRange(e.range);return{reason:aN(i,this._options),inComment:TE(t,e),inString:PE(t,e)}}};hx=g0([Qh(3,Ga)],hx);class K5 extends Se{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 Rn(()=>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=ME.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:ov.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 EE(t,e)?{reason:aN(i,this._options),inComment:TE(t,e),inString:PE(t,e)}:null}}const rN=w("unicodeHighlight.configureUnicodeHighlightOptions","Configure Unicode Highlight Options");let ux=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(Kf.ID);if(!n)return[];const s=[],r=new Set;let a=300;for(const c of t){const h=n.getDecorationInfo(c);if(!h)continue;const g=i.getValueInRange(c.range).codePointAt(0),f=ny(g);let v;switch(h.reason.kind){case 0:{tE(h.reason.confusableWith)?v=w("unicodeHighlight.characterIsAmbiguousASCII","The character {0} could be confused with the ASCII character {1}, which is more common in source code.",f,ny(h.reason.confusableWith.codePointAt(0))):v=w("unicodeHighlight.characterIsAmbiguous","The character {0} could be confused with the character {1}, which is more common in source code.",f,ny(h.reason.confusableWith.codePointAt(0)));break}case 1:v=w("unicodeHighlight.characterIsInvisible","The character {0} is invisible.",f);break;case 2:v=w("unicodeHighlight.characterIsNonBasicAscii","The character {0} is not a basic ASCII character.",f);break}if(r.has(v))continue;r.add(v);const _={codePoint:g,reason:h.reason,inComment:h.inComment,inString:h.inString},y=w("unicodeHighlight.adjustSettings","Adjust settings"),S=`command:${rv.ID}?${encodeURIComponent(JSON.stringify(_))}`,x=new us("",!0).appendMarkdown(v).appendText(" ").appendLink(S,y,rN);s.push(new Ho(this,c.range,[x],!1,a++))}return s}renderHoverParts(e,t){return S3(e,t,this._editor,this._languageService,this._openerService)}};ux=g0([Qh(1,br),Qh(2,_r)],ux);function gx(o){return`U+${o.toString(16).padStart(4,"0")}`}function ny(o){let e=`\`${gx(o)}\``;return NE.isInvisibleCharacter(o)||(e+=` "${`${G5(o)}`}"`),e}function G5(o){return o===96?"`` ` ``":"`"+String.fromCodePoint(o)+"`"}function aN(o,e){return ME.computeUnicodeHighlightReason(o,e)}const tb=class tb{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=oi.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}};tb.instance=new tb;let ov=tb;class Z5 extends ge{constructor(){super({id:Bd.ID,label:w("action.unicodeHighlight.disableHighlightingInComments","Disable highlighting of characters in comments"),alias:"Disable highlighting of characters in comments",precondition:void 0}),this.shortLabel=w("unicodeHighlight.disableHighlightingInComments.shortLabel","Disable Highlight In Comments")}async run(e,t,i){const n=e==null?void 0:e.get(on);n&&this.runAction(n)}async runAction(e){await e.updateValue(Wa.includeComments,!1,2)}}class X5 extends ge{constructor(){super({id:Bd.ID,label:w("action.unicodeHighlight.disableHighlightingInStrings","Disable highlighting of characters in strings"),alias:"Disable highlighting of characters in strings",precondition:void 0}),this.shortLabel=w("unicodeHighlight.disableHighlightingInStrings.shortLabel","Disable Highlight In Strings")}async run(e,t,i){const n=e==null?void 0:e.get(on);n&&this.runAction(n)}async runAction(e){await e.updateValue(Wa.includeStrings,!1,2)}}const ib=class ib extends ge{constructor(){super({id:ib.ID,label:w("action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters","Disable highlighting of ambiguous characters"),alias:"Disable highlighting of ambiguous characters",precondition:void 0}),this.shortLabel=w("unicodeHighlight.disableHighlightingOfAmbiguousCharacters.shortLabel","Disable Ambiguous Highlight")}async run(e,t,i){const n=e==null?void 0:e.get(on);n&&this.runAction(n)}async runAction(e){await e.updateValue(Wa.ambiguousCharacters,!1,2)}};ib.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters";let Bd=ib;const nb=class nb extends ge{constructor(){super({id:nb.ID,label:w("action.unicodeHighlight.disableHighlightingOfInvisibleCharacters","Disable highlighting of invisible characters"),alias:"Disable highlighting of invisible characters",precondition:void 0}),this.shortLabel=w("unicodeHighlight.disableHighlightingOfInvisibleCharacters.shortLabel","Disable Invisible Highlight")}async run(e,t,i){const n=e==null?void 0:e.get(on);n&&this.runAction(n)}async runAction(e){await e.updateValue(Wa.invisibleCharacters,!1,2)}};nb.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters";let Gf=nb;const sb=class sb extends ge{constructor(){super({id:sb.ID,label:w("action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters","Disable highlighting of non basic ASCII characters"),alias:"Disable highlighting of non basic ASCII characters",precondition:void 0}),this.shortLabel=w("unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters.shortLabel","Disable Non ASCII Highlight")}async run(e,t,i){const n=e==null?void 0:e.get(on);n&&this.runAction(n)}async runAction(e){await e.updateValue(Wa.nonBasicASCII,!1,2)}};sb.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters";let Zf=sb;const ob=class ob extends ge{constructor(){super({id:ob.ID,label:w("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,c=String.fromCodePoint(n),h=e.get($a),u=e.get(on);function g(_){return NE.isInvisibleCharacter(_)?w("unicodeHighlight.excludeInvisibleCharFromBeingHighlighted","Exclude {0} (invisible character) from being highlighted",gx(_)):w("unicodeHighlight.excludeCharFromBeingHighlighted","Exclude {0} from being highlighted",`${gx(_)} "${c}"`)}const f=[];if(s.kind===0)for(const _ of s.notAmbiguousInLocales)f.push({label:w("unicodeHighlight.allowCommonCharactersInLanguage",'Allow unicode characters that are more common in the language "{0}".',_),run:async()=>{Q5(u,[_])}});if(f.push({label:g(n),run:()=>Y5(u,[n])}),a){const _=new Z5;f.push({label:_.label,run:async()=>_.runAction(u)})}else if(r){const _=new X5;f.push({label:_.label,run:async()=>_.runAction(u)})}if(s.kind===0){const _=new Bd;f.push({label:_.label,run:async()=>_.runAction(u)})}else if(s.kind===1){const _=new Gf;f.push({label:_.label,run:async()=>_.runAction(u)})}else if(s.kind===2){const _=new Zf;f.push({label:_.label,run:async()=>_.runAction(u)})}else J5(s);const v=await h.pick(f,{title:rN});v&&await v.run()}};ob.ID="editor.action.unicodeHighlight.showExcludeOptions";let rv=ob;async function Y5(o,e){const t=o.getValue(Wa.allowedCharacters);let i;typeof t=="object"&&t?i=t:i={};for(const n of e)i[String.fromCodePoint(n)]=!0;await o.updateValue(Wa.allowedCharacters,i,2)}async function Q5(o,e){var n;const t=(n=o.inspect(Wa.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(Wa.allowedLocales,i,2)}function J5(o){throw new Error(`Unexpected value: ${o}`)}Q(Bd);Q(Gf);Q(Zf);Q(rv);Zt(Kf.ID,Kf,1);Zd.register(ux);var e6=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},Dk=function(o,e){return function(t,i){e(t,i,o)}};const lN="ignoreUnusualLineTerminators";function t6(o,e,t){o.setModelProperty(e.uri,lN,t)}function i6(o,e){return o.getModelProperty(e.uri,lN)}var mu;let av=(mu=class extends Se{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()||i6(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:w("unusualLineTerminators.title","Unusual Line Terminators"),message:w("unusualLineTerminators.message","Detected unusual line terminators"),detail:w("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`.",Jr(e.uri)),primaryButton:w({key:"unusualLineTerminators.fix",comment:["&& denotes a mnemonic"]},"&&Remove Unusual Line Terminators"),cancelButton:w("unusualLineTerminators.ignore","Ignore")})}finally{this._isPresentingDialog=!1}if(!i.confirmed){t6(this._codeEditorService,e,!0);return}e.removeUnusualLineTerminators(this._editor.getSelections())}},mu.ID="editor.contrib.unusualLineTerminatorsDetector",mu);av=e6([Dk(1,h1),Dk(2,xn)],av);Zt(av.ID,av,1);var n6=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},s6=function(o,e){return function(t,i){e(t,i,o)}};class Ek{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,HL,!1).map(a=>({range:a.range,kind:o_.Text})):Promise.resolve(n)}provideMultiDocumentHighlights(e,t,i,n){const s=new Ul,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 h=a.findMatches(r.word,!0,!1,!0,HL,!1).map(u=>({range:u.range,kind:o_.Text}));h&&s.set(a.uri,h)}return s}}let fx=class extends Se{constructor(e){super(),this._register(e.documentHighlightProvider.register("*",new Ek)),this._register(e.multiDocumentHighlightProvider.register("*",new Ek))}};fx=n6([s6(0,Je)],fx);var cN=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},Km=function(o,e){return function(t,i){e(t,i,o)}},vn,px;const f0=new di("hasWordHighlights",!1);function dN(o,e,t,i){const n=o.ordered(e);return o1(n.map(s=>()=>Promise.resolve(s.provideDocumentHighlights(e,t,i)).then(void 0,Cn)),s=>s!=null).then(s=>{if(s){const r=new Ul;return r.set(e.uri,s),r}return new Ul})}function o6(o,e,t,i,n,s){const r=o.ordered(e);return o1(r.map(a=>()=>{const c=s.filter(h=>B2(h)).filter(h=>z2(a.selector,h.uri,h.getLanguageId(),!0,void 0,void 0)>0);return Promise.resolve(a.provideMultiDocumentHighlights(e,t,c,n)).then(void 0,Cn)}),a=>a!=null)}class hN{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=qn(e=>this._compute(this._model,this._selection,this._wordSeparators,e))),this._result}_getCurrentWordRange(e,t){const i=e.getWordAtPosition(t.getPosition());return i?new O(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 c=!!(this._wordRange&&this._wordRange.equalsRange(a));for(let h=0,u=i.length;!c&&h<u;h++){const g=i.getRange(h);g&&g.startLineNumber===n&&g.startColumn<=s&&g.endColumn>=r&&(c=!0)}return c}cancel(){this.result.cancel()}}class r6 extends hN{constructor(e,t,i,n){super(e,t,i),this._providers=n}_compute(e,t,i,n){return dN(this._providers,e,t.getPosition(),n).then(s=>s||new Ul)}}class a6 extends hN{constructor(e,t,i,n,s){super(e,t,i),this._providers=n,this._otherModels=s}_compute(e,t,i,n){return o6(this._providers,e,t.getPosition(),i,n,this._otherModels).then(s=>s||new Ul)}}function l6(o,e,t,i,n){return new r6(e,t,n,o)}function c6(o,e,t,i,n,s){return new a6(e,t,n,o,s)}As("_executeDocumentHighlights",async(o,e,t)=>{const i=o.get(Je),n=await dN(i.documentHighlightProvider,e,t,$t.None);return n==null?void 0:n.get(e.uri)});var Vl;let mx=(Vl=class{constructor(e,t,i,n,s){this.toUnhook=new we,this.workerRequestTokenId=0,this.workerRequestCompleted=!1,this.workerRequestValue=new Ul,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,this.runDelayer=this.toUnhook.add(new jl(50)),this.editor=e,this.providers=t,this.multiDocumentProviders=i,this.codeEditorService=s,this._hasWordHighlights=f0.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=>{W2(this.model.uri,"output")||this._stopAll()})),this.toUnhook.add(e.onDidChangeModel(r=>{!r.newModelUrl&&r.oldModelUrl?this._stopSingular():vn.query&&this._run()})),this.toUnhook.add(e.onDidChangeConfiguration(r=>{var c,h;const a=this.editor.getOption(81);if(this.occurrencesHighlight!==a)switch(this.occurrencesHighlight=a,a){case"off":this._stopAll();break;case"singleFile":this._stopAll((h=(c=vn.query)==null?void 0:c.modelInfo)==null?void 0:h.model);break;case"multiFile":vn.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,vn.query&&this._run()}hasDecorations(){return this.decorations.length>0}restore(){this.occurrencesHighlight!=="off"&&(this.runDelayer.cancel(),this._run())}_getSortedHighlights(){return this.decorations.getRanges().sort(O.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);Uo(`${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);Uo(`${r}, ${i+1} of ${e.length} for '${s.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}_removeSingleDecorations(){if(!this.editor.hasModel())return;const e=vn.storedDecorationIDs.get(this.editor.getModel().uri);e&&(this.editor.removeDecorations(e),vn.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()||Ym(n.getModel().uri,e==null?void 0:e.uri))continue;const s=vn.storedDecorationIDs.get(n.getModel().uri);if(!s)continue;n.removeDecorations(s),i.push(n.getModel().uri);const r=Yl.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)vn.storedDecorationIDs.delete(n)}_stopSingular(){var e,t,i,n;this._removeSingleDecorations(),this.editor.hasTextFocus()&&(((e=this.editor.getModel())==null?void 0:e.uri.scheme)!==Ds.vscodeNotebookCell&&((i=(t=vn.query)==null?void 0:t.modelInfo)==null?void 0:i.model.uri.scheme)!==Ds.vscodeNotebookCell?(vn.query=null,this._run()):(n=vn.query)!=null&&n.modelInfo&&(vn.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)!==Ds.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===Ds.vscodeNotebookCell){const s=[],r=this.codeEditorService.listCodeEditors();for(const a of r){const c=a.getModel();c&&c!==e&&c.uri.scheme===Ds.vscodeNotebookCell&&s.push(c)}return s}const i=[],n=this.codeEditorService.listCodeEditors();for(const s of n){if(!RE(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){vn.query=null,this._stopAll();return}const a=r.startColumn,c=r.endColumn,h=this._getWord();if(!h||h.startColumn>a||h.endColumn<c){vn.query=null,this._stopAll();return}t=this.workerRequest&&this.workerRequest.isValid(this.model,r,this.decorations),vn.query={modelInfo:{model:this.model,selection:r},word:h}}else if(!vn.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(Ym(this.editor.getModel().uri,(n=vn.query.modelInfo)==null?void 0:n.model.uri)){if(!e){const c=this.decorations.getRanges();for(const h of c)if(h.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(!vn.query||!vn.query.modelInfo||vn.query.modelInfo.model.isDisposed())return;this.workerRequest=this.computeWithModel(vn.query.modelInfo.model,vn.query.modelInfo.selection,vn.query.word,a),(s=this.workerRequest)==null||s.result.then(c=>{r===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=c||[],this._beginRenderDecorations())},Vi)}}computeWithModel(e,t,i,n){return n.length?c6(this.multiDocumentProviders,e,t,i,this.editor.getOption(132),n):l6(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=Yl.get(s);if(!r)continue;const a=[],c=(t=s.getModel())==null?void 0:t.uri;if(c&&this.workerRequestValue.has(c)){const h=vn.storedDecorationIDs.get(c),u=this.workerRequestValue.get(c);if(u)for(const f of u)f.range&&a.push({range:f.range,options:Yj(f.kind)});let g=[];s.changeDecorations(f=>{g=f.deltaDecorations(h??[],a)}),vn.storedDecorationIDs=vn.storedDecorationIDs.set(c,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()}},vn=Vl,Vl.storedDecorationIDs=new Ul,Vl.query=null,Vl);mx=vn=cN([Km(4,xn)],mx);var wd;let Yl=(wd=class extends Se{static get(e){return e.getContribution(px.ID)}constructor(e,t,i,n){super(),this._wordHighlighter=null;const s=()=>{e.hasModel()&&!e.getModel().isTooLargeForTokenization()&&(this._wordHighlighter=new mx(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()}},px=wd,wd.ID="editor.contrib.wordHighlighter",wd);Yl=px=cN([Km(1,wi),Km(2,Je),Km(3,xn)],Yl);class uN extends ge{constructor(e,t){super(t),this._isNext=e}run(e,t){const i=Yl.get(t);i&&(this._isNext?i.moveNext():i.moveBack())}}class d6 extends uN{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:w("wordHighlight.next.label","Go to Next Symbol Highlight"),alias:"Go to Next Symbol Highlight",precondition:f0,kbOpts:{kbExpr:T.editorTextFocus,primary:65,weight:100}})}}class h6 extends uN{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:w("wordHighlight.previous.label","Go to Previous Symbol Highlight"),alias:"Go to Previous Symbol Highlight",precondition:f0,kbOpts:{kbExpr:T.editorTextFocus,primary:1089,weight:100}})}}class u6 extends ge{constructor(){super({id:"editor.action.wordHighlight.trigger",label:w("wordHighlight.trigger.label","Trigger Symbol Highlight"),alias:"Trigger Symbol Highlight",precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:0,weight:100}})}run(e,t,i){const n=Yl.get(t);n&&n.restoreViewState(!0)}}Zt(Yl.ID,Yl,0);Q(d6);Q(h6);Q(u6);Xu(fx);class iw extends Rs{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){if(!t.hasModel())return;const n=qd(t.getOption(132),t.getOption(131)),s=t.getModel(),r=t.getSelections(),a=r.length>1,c=r.map(h=>{const u=new Qe(h.positionLineNumber,h.positionColumn),g=this._move(n,s,u,this._wordNavigationType,a);return this._moveTo(h,g,this._inSelectionMode)});if(s.pushStackElement(),t._getViewModel().setCursorStates("moveWordCommand",3,c.map(h=>V2.fromModelSelection(h))),c.length===1){const h=new Qe(c[0].positionLineNumber,c[0].positionColumn);t.revealPosition(h,0)}}_moveTo(e,t,i){return i?new _t(e.selectionStartLineNumber,e.selectionStartColumn,t.lineNumber,t.column):new _t(t.lineNumber,t.column,t.lineNumber,t.column)}}class tc extends iw{_move(e,t,i,n,s){return yp.moveWordLeft(e,t,i,n,s)}}class ic extends iw{_move(e,t,i,n,s){return yp.moveWordRight(e,t,i,n)}}class g6 extends tc{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}class f6 extends tc{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}class p6 extends tc{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:ie.and(T.textInputFocus,(e=ie.and(kb,Db))==null?void 0:e.negate()),primary:2063,mac:{primary:527},weight:100}})}}class m6 extends tc{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}class _6 extends tc{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}class v6 extends tc{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:ie.and(T.textInputFocus,(e=ie.and(kb,Db))==null?void 0:e.negate()),primary:3087,mac:{primary:1551},weight:100}})}}class b6 extends tc{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(e,t,i,n,s){return super._move(qd(Eb.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class w6 extends tc{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(e,t,i,n,s){return super._move(qd(Eb.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class y6 extends ic{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}class S6 extends ic{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:ie.and(T.textInputFocus,(e=ie.and(kb,Db))==null?void 0:e.negate()),primary:2065,mac:{primary:529},weight:100}})}}class C6 extends ic{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}class x6 extends ic{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}class L6 extends ic{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:ie.and(T.textInputFocus,(e=ie.and(kb,Db))==null?void 0:e.negate()),primary:3089,mac:{primary:1553},weight:100}})}}class I6 extends ic{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}class k6 extends ic{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(e,t,i,n,s){return super._move(qd(Eb.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class D6 extends ic{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(e,t,i,n,s){return super._move(qd(Eb.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class nw extends Rs{constructor(e){super(e),this._whitespaceHeuristics=e.whitespaceHeuristics,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){const n=e.get(zn);if(!t.hasModel())return;const s=qd(t.getOption(132),t.getOption(131)),r=t.getModel(),a=t.getSelections(),c=t.getOption(6),h=t.getOption(11),u=n.getLanguageConfiguration(r.getLanguageId()).getAutoClosingPairs(),g=t._getViewModel(),f=a.map(v=>{const _=this._delete({wordSeparators:s,model:r,selection:v,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:t.getOption(9),autoClosingBrackets:c,autoClosingQuotes:h,autoClosingPairs:u,autoClosedCharacters:g.getCursorAutoClosedCharacters()},this._wordNavigationType);return new ap(_,"")});t.pushUndoStop(),t.executeCommands(this.id,f),t.pushUndoStop()}}class p0 extends nw{_delete(e,t){const i=yp.deleteWordLeft(e,t);return i||new O(1,1,1,1)}}class m0 extends nw{_delete(e,t){const i=yp.deleteWordRight(e,t);if(i)return i;const n=e.model.getLineCount(),s=e.model.getLineMaxColumn(n);return new O(n,s,n,s)}}class E6 extends p0{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:T.writable})}}class P6 extends p0{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:T.writable})}}class T6 extends p0{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:T.writable,kbOpts:{kbExpr:T.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}class M6 extends m0{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:T.writable})}}class N6 extends m0{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:T.writable})}}class R6 extends m0{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:T.writable,kbOpts:{kbExpr:T.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}class A6 extends ge{constructor(){super({id:"deleteInsideWord",precondition:T.writable,label:w("deleteInsideWord","Delete Word"),alias:"Delete Word"})}run(e,t,i){if(!t.hasModel())return;const n=qd(t.getOption(132),t.getOption(131)),s=t.getModel(),a=t.getSelections().map(c=>{const h=yp.deleteInsideWord(n,s,c);return new ap(h,"")});t.pushUndoStop(),t.executeCommands(this.id,a),t.pushUndoStop()}}it(new g6);it(new f6);it(new p6);it(new m6);it(new _6);it(new v6);it(new y6);it(new S6);it(new C6);it(new x6);it(new L6);it(new I6);it(new b6);it(new w6);it(new k6);it(new D6);it(new E6);it(new P6);it(new T6);it(new M6);it(new N6);it(new R6);Q(A6);class O6 extends nw{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:T.writable,kbOpts:{kbExpr:T.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(e,t){const i=Pb.deleteWordPartLeft(e);return i||new O(1,1,1,1)}}class F6 extends nw{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:T.writable,kbOpts:{kbExpr:T.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(e,t){const i=Pb.deleteWordPartRight(e);if(i)return i;const n=e.model.getLineCount(),s=e.model.getLineMaxColumn(n);return new O(n,s,n,s)}}class gN extends iw{_move(e,t,i,n,s){return Pb.moveWordPartLeft(e,t,i,s)}}class H6 extends gN{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:T.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}Gi.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft");class W6 extends gN{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:T.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}Gi.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class fN extends iw{_move(e,t,i,n,s){return Pb.moveWordPartRight(e,t,i)}}class B6 extends fN{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:T.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}class z6 extends fN{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:T.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}}it(new O6);it(new F6);it(new H6);it(new W6);it(new B6);it(new z6);const P0=class P0 extends Se{constructor(e){super(),this.editor=e,this._register(this.editor.onDidAttemptReadOnlyEdit(()=>this._onDidAttemptReadOnlyEdit()))}_onDidAttemptReadOnlyEdit(){const e=Us.get(this.editor);if(e&&this.editor.hasModel()){let t=this.editor.getOptions().get(93);t||(this.editor.isSimpleWidget?t=new us(w("editor.simple.readonly","Cannot edit in read-only input")):t=new us(w("editor.readonly","Cannot edit in read-only editor"))),e.showMessage(t,this.editor.getPosition())}}};P0.ID="editor.contrib.readOnlyMessageController";let lv=P0;Zt(lv.ID,lv,2);var V6=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},Pk=function(o,e){return function(t,i){e(t,i,o)}};let _x=class extends Se{constructor(e,t,i){super(),this._textModel=e,this._languageFeaturesService=t,this._outlineModelService=i,this._currentModel=no(this,void 0);const n=Dc("documentSymbolProvider.onDidChange",this._languageFeaturesService.documentSymbolProvider.onDidChange),s=Dc("_textModel.onDidChangeContent",Nn.debounce(r=>this._textModel.onDidChangeContent(r),()=>{},100));this._register(fp(async(r,a)=>{n.read(r),s.read(r);const c=a.add(new $2),h=await this._outlineModelService.getOrCreate(this._textModel,c.token);a.isDisposed||this._currentModel.set(h,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(j2(_p(s=>s.range.endLineNumber-s.range.startLineNumber,wb))),n.map(s=>({name:s.name,kind:s.kind,startLineNumber:s.range.startLineNumber}))}};_x=V6([Pk(1,Je),Pk(2,Np)],_x);U2.setBreadcrumbsSourceFactory((o,e)=>e.createInstance(_x,o));const T0=class T0 extends Se{constructor(e){super(),this.editor=e,this.widget=null,vy&&(this._register(e.onDidChangeConfiguration(()=>this.update())),this.update())}update(){const e=!this.editor.getOption(92);!this.widget&&e?this.widget=new vx(this.editor):this.widget&&!e&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&(this.widget.dispose(),this.widget=null)}};T0.ID="editor.contrib.iPadShowKeyboard";let cv=T0;const rb=class rb extends Se{constructor(e){super(),this.editor=e,this._domNode=document.createElement("textarea"),this._domNode.className="iPadShowKeyboard",this._register(bi(this._domNode,"touchstart",t=>{this.editor.focus()})),this._register(bi(this._domNode,"focus",t=>{this.editor.focus()})),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return rb.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}};rb.ID="editor.contrib.ShowKeyboardWidget";let vx=rb;Zt(cv.ID,cv,3);var U6=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},Tk=function(o,e){return function(t,i){e(t,i,o)}},bx,yd;let Xf=(yd=class extends Se{static get(e){return e.getContribution(bx.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(Sb.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 wx(this._editor,this._languageService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}},bx=yd,yd.ID="editor.contrib.inspectTokens",yd);Xf=bx=U6([Tk(1,AE),Tk(2,br)],Xf);class j6 extends ge{constructor(){super({id:"editor.action.inspectTokens",label:Z2.inspectTokensAction,alias:"Developer: Inspect Tokens",precondition:void 0})}run(e,t){const i=Xf.get(t);i==null||i.launch()}}function $6(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 q6(o,e){const t=Sb.get(e);if(t)return t;const i=o.encodeLanguageId(e);return{getInitialState:()=>q2,tokenize:(n,s,r)=>G2(e,r),tokenizeEncoded:(n,s,r)=>K2(i,r)}}const ab=class ab extends Se{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=q6(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 ab._ID}_compute(e){const t=this._getTokensAtLine(e.lineNumber);let i=0;for(let c=t.tokens1.length-1;c>=0;c--){const h=t.tokens1[c];if(e.column-1>=h.offset){i=c;break}}let n=0;for(let c=t.tokens2.length>>>1;c>=0;c--)if(e.column-1>=t.tokens2[c<<1]){n=c;break}const s=this._model.getLineContent(e.lineNumber);let r="";if(i<t.tokens1.length){const c=t.tokens1[i].offset,h=i+1<t.tokens1.length?t.tokens1[i+1].offset:s.length;r=s.substring(c,h)}Qm(this._domNode,qe("h2.tm-token",void 0,$6(r),qe("span.tm-token-length",void 0,`${r.length} ${r.length===1?"char":"chars"}`))),Ve(this._domNode,qe("hr.tokens-inspect-separator",{style:"clear:both"}));const a=(n<<1)+1<t.tokens2.length?this._decodeMetadata(t.tokens2[(n<<1)+1]):null;Ve(this._domNode,qe("table.tm-metadata-table",void 0,qe("tbody",void 0,qe("tr",void 0,qe("td.tm-metadata-key",void 0,"language"),qe("td.tm-metadata-value",void 0,`${a?a.languageId:"-?-"}`)),qe("tr",void 0,qe("td.tm-metadata-key",void 0,"token type"),qe("td.tm-metadata-value",void 0,`${a?this._tokenTypeToString(a.tokenType):"-?-"}`)),qe("tr",void 0,qe("td.tm-metadata-key",void 0,"font style"),qe("td.tm-metadata-value",void 0,`${a?this._fontStyleToString(a.fontStyle):"-?-"}`)),qe("tr",void 0,qe("td.tm-metadata-key",void 0,"foreground"),qe("td.tm-metadata-value",void 0,`${a?ii.Format.CSS.formatHex(a.foreground):"-?-"}`)),qe("tr",void 0,qe("td.tm-metadata-key",void 0,"background"),qe("td.tm-metadata-value",void 0,`${a?ii.Format.CSS.formatHex(a.background):"-?-"}`))))),Ve(this._domNode,qe("hr.tokens-inspect-separator")),i<t.tokens1.length&&Ve(this._domNode,qe("span.tm-token-type",void 0,t.tokens1[i].type)),this._editor.layoutContentWidget(this)}_decodeMetadata(e){const t=Sb.getColorMap(),i=_g.getLanguageId(e),n=_g.getTokenType(e),s=_g.getFontStyle(e),r=_g.getForeground(e),a=_g.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]}}};ab._ID="editor.contrib.inspectTokensWidget";let wx=ab;Zt(Xf.ID,Xf,4);Q(j6);var K6=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},Mk=function(o,e){return function(t,i){e(t,i,o)}},zg,Sd;let yx=(Sd=class{constructor(e,t){this.quickInputService=e,this.keybindingService=t,this.registry=mr.as(Sp.Quickaccess)}provide(e){const t=new we;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(zg.PREFIX.length));n&&n.prefix&&n.prefix!==zg.PREFIX&&this.quickInputService.quickAccess.show(n.prefix,{preserveValue:!0})})),e.items=this.getQuickAccessProviders().filter(i=>i.prefix!==zg.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:w("helpPickAriaLabel","{0}, {1}",n,t.description),description:t.description}})}},zg=Sd,Sd.PREFIX="?",Sd);yx=zg=K6([Mk(0,$a),Mk(1,En)],yx);mr.as(Sp.Quickaccess).registerQuickAccessProvider({ctor:yx,prefix:"",helpEntries:[{description:X2.helpQuickAccessActionLabel}]});class pN{constructor(e){this.options=e,this.rangeHighlightDecorationId=void 0}provide(e,t,i){var r;const n=new we;e.canAcceptInBackground=!!((r=this.options)!=null&&r.canAcceptInBackground),e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;const s=n.add(new oo);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 we,s=this.activeTextEditorControl;if(s&&this.canProvideWithTextEditor(s)){const r={editor:s},a=OE(s);if(a){let c=s.saveViewState()??void 0;n.add(a.onDidChangeCursorPosition(()=>{c=s.saveViewState()??void 0})),r.restoreViewState=()=>{c&&s===this.activeTextEditorControl&&s.restoreViewState(c)},n.add(FE(t.onCancellationRequested)(()=>{var h;return(h=r.restoreViewState)==null?void 0:h.call(r)}))}n.add(nn(()=>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&&wu(`${i.getLineContent(t.range.startLineNumber)}`)}getModel(e){var t;return RE(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:Pn(VD),position:Kr.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 lb=class lb extends pN{constructor(){super({canAcceptInBackground:!0})}provideWithoutTextEditor(e){const t=w("cannotRunGotoLine","Open a text editor first to go to a line.");return e.items=[{label:t}],e.ariaLabel=t,Se.None}provideWithTextEditor(e,t,i){const n=e.editor,s=new we;s.add(t.onDidAccept(c=>{const[h]=t.selectedItems;if(h){if(!this.isValidLineNumber(n,h.lineNumber))return;this.gotoLocation(e,{range:this.toRange(h.lineNumber,h.column),keyMods:t.keyMods,preserveFocus:c.inBackground}),c.inBackground||t.hide()}}));const r=()=>{const c=this.parsePosition(n,t.value.trim().substr(lb.PREFIX.length)),h=this.getPickLabel(n,c.lineNumber,c.column);if(t.items=[{lineNumber:c.lineNumber,column:c.column,label:h}],t.ariaLabel=h,!this.isValidLineNumber(n,c.lineNumber)){this.clearDecorations(n);return}const u=this.toRange(c.lineNumber,c.column);n.revealRangeInCenter(u,0),this.addDecorations(n,u)};r(),s.add(t.onDidChangeValue(()=>r()));const a=OE(n);return a&&a.getOptions().get(68).renderType===2&&(a.updateOptions({lineNumbers:"on"}),s.add(nn(()=>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)?w("gotoLineColumnLabel","Go to line {0} and character {1}.",t,i):w("gotoLineLabel","Go to line {0}.",t);const n=e.getPosition()||{lineNumber:1,column:1},s=this.lineCount(e);return s>1?w("gotoLineLabelEmptyWithLimit","Current Line: {0}, Character: {1}. Type a line number between 1 and {2} to navigate to.",n.lineNumber,n.column,s):w("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}};lb.PREFIX=":";let Sx=lb;var G6=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},Z6=function(o,e){return function(t,i){e(t,i,o)}};let Yf=class extends Sx{constructor(e){super(),this.editorService=e,this.onDidActiveTextEditorControlChange=Nn.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};Yf=G6([Z6(0,xn)],Yf);var Cd;let mN=(Cd=class extends ge{constructor(){super({id:Cd.ID,label:HE.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:T.focus,primary:2085,mac:{primary:293},weight:100}})}run(e){e.get($a).quickAccess.show(Yf.PREFIX)}},Cd.ID="editor.action.gotoLine",Cd);Q(mN);mr.as(Sp.Quickaccess).registerQuickAccessProvider({ctor:Yf,prefix:Yf.PREFIX,helpEntries:[{description:HE.gotoLineActionLabel,commandId:mN.ID}]});const _N=[void 0,[]];function sy(o,e,t=0,i=0){const n=e;return n.values&&n.values.length>1?X6(o,n.values,t,i):vN(o,e,t,i)}function X6(o,e,t,i){let n=0;const s=[];for(const r of e){const[a,c]=vN(o,r,t,i);if(typeof a!="number")return _N;n+=a,s.push(...c)}return[n,Y6(s)]}function vN(o,e,t,i){const n=aE(e.original,e.originalLowercase,t,o,o.toLowerCase(),i,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return n?[n[0],yb(n)]:_N}function Y6(o){const e=o.sort((n,s)=>n.start-s.start),t=[];let i;for(const n of e)!i||!Q6(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 Q6(o,e){return!(o.end<e.start||e.end<o.start)}function Nk(o){return o.startsWith('"')&&o.endsWith('"')}const bN=" ";function Cx(o){typeof o!="string"&&(o="");const e=o.toLowerCase(),{pathNormalized:t,normalized:i,normalizedLowercase:n}=Rk(o),s=t.indexOf(Iy)>=0,r=Nk(o);let a;const c=o.split(bN);if(c.length>1)for(const h of c){const u=Nk(h),{pathNormalized:g,normalized:f,normalizedLowercase:v}=Rk(h);f&&(a||(a=[]),a.push({original:h,originalLowercase:h.toLowerCase(),pathNormalized:g,normalized:f,normalizedLowercase:v,expectContiguousMatch:u}))}return{original:o,originalLowercase:e,pathNormalized:t,normalized:i,normalizedLowercase:n,values:a,containsPathSeparator:s,expectContiguousMatch:r}}function Rk(o){let e;ub?e=o.replace(/\//g,Iy):e=o.replace(/\\/g,Iy);const t=Y2(e).replace(/\s|"/g,"");return{pathNormalized:e,normalized:t,normalizedLowercase:t.toLowerCase()}}function Ak(o){return Array.isArray(o)?Cx(o.map(e=>e.original).join(bN)):Cx(o.original)}var J6=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},Ok=function(o,e){return function(t,i){e(t,i,o)}},Gm,cr;let Oc=(cr=class extends pN{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,w("cannotRunGotoSymbolWithoutEditor","To go to a symbol, first open a text editor with symbol information.")),Se.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):Se.None}doProvideWithoutEditorSymbols(e,t,i,n){const s=new we;return this.provideLabelPick(i,w("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 gb,n=t.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>{this._languageFeaturesService.documentSymbolProvider.has(e)&&(n.dispose(),i.complete(!0))}));return t.add(nn(()=>i.complete(!1))),i.p}doProvideWithEditorSymbols(e,t,i,n,s){var g;const r=e.editor,a=new we;a.add(i.onDidAccept(f=>{var _;const[v]=i.selectedItems;v&&v.range&&(this.gotoLocation(e,{range:v.range.selection,keyMods:i.keyMods,preserveFocus:f.inBackground}),(_=s==null?void 0:s.handleAccept)==null||_.call(s,v),f.inBackground||i.hide())})),a.add(i.onDidTriggerItemButton(({item:f})=>{f&&f.range&&(this.gotoLocation(e,{range:f.range.selection,keyMods:i.keyMods,forceSideBySide:!0}),i.hide())}));const c=this.getDocumentSymbols(t,n);let h;const u=async f=>{h==null||h.dispose(!0),i.busy=!1,h=new Kn(n),i.busy=!0;try{const v=Cx(i.value.substr(Gm.PREFIX.length).trim()),_=await this.doGetSymbolPicks(c,v,void 0,h.token,t);if(n.isCancellationRequested)return;if(_.length>0){if(i.items=_,f&&v.original.length===0){const y=tF(_,S=>!!(S.type!=="separator"&&S.range&&O.containsPosition(S.range.decoration,f)));y&&(i.activeItems=[y])}}else v.original.length>0?this.provideLabelPick(i,w("noMatchingSymbolResults","No matching editor symbols")):this.provideLabelPick(i,w("noSymbolResults","No editor symbols"))}finally{n.isCancellationRequested||(i.busy=!1)}};return a.add(i.onDidChangeValue(()=>u(void 0))),u((g=r.getSelection())==null?void 0:g.getPosition()),a.add(i.onDidChangeActive(()=>{const[f]=i.activeItems;f&&f.range&&(r.revealRangeInCenter(f.range.selection,0),this.addDecorations(r,f.range.decoration))})),a}async doGetSymbolPicks(e,t,i,n,s){var S,x;const r=await e;if(n.isCancellationRequested)return[];const a=t.original.indexOf(Gm.SCOPE_PREFIX)===0,c=a?1:0;let h,u;t.values&&t.values.length>1?(h=Ak(t.values[0]),u=Ak(t.values.slice(1))):h=t;let g;const f=(x=(S=this.options)==null?void 0:S.openSideBySideDirection)==null?void 0:x.call(S);f&&(g=[{iconClass:f==="right"?xi.asClassName(xt.splitHorizontal):xi.asClassName(xt.splitVertical),tooltip:f==="right"?w("openToSide","Open to the Side"):w("openToBottom","Open to the Bottom")}]);const v=[];for(let E=0;E<r.length;E++){const M=r[E],F=Q2(M.name),R=`$(${J2.toIcon(M.kind).id}) ${F}`,Z=R.length-F.length;let q=M.containerName;i!=null&&i.extraContainerLabel&&(q?q=`${i.extraContainerLabel} • ${q}`:q=i.extraContainerLabel);let he,pe,Ce,Pe;if(t.original.length>c){let qt=!1;if(h!==t&&([he,pe]=sy(R,{...t,values:void 0},c,Z),typeof he=="number"&&(qt=!0)),typeof he!="number"&&([he,pe]=sy(R,h,c,Z),typeof he!="number"))continue;if(!qt&&u){if(q&&u.original.length>0&&([Ce,Pe]=sy(q,u)),typeof Ce!="number")continue;typeof he=="number"&&(he+=Ce)}}const je=M.tags&&M.tags.indexOf(1)>=0;v.push({index:E,kind:M.kind,score:he,label:R,ariaLabel:eF(M.name,M.kind),description:q,highlights:je?void 0:{label:pe,description:Pe},range:{selection:O.collapseToStart(M.selectionRange),decoration:M.range},uri:s.uri,symbolName:F,strikethrough:je,buttons:g})}const _=v.sort((E,M)=>a?this.compareByKindAndScore(E,M):this.compareByScore(E,M));let y=[];if(a){let R=function(){M&&typeof E=="number"&&F>0&&(M.label=e1(ry[E]||oy,F))},E,M,F=0;for(const Z of _)E!==Z.kind?(R(),E=Z.kind,F=1,M={type:"separator"},y.push(M)):F++,y.push(Z);R()}else _.length>0&&(y=[{label:w("symbols","symbols ({0})",v.length),type:"separator"},..._]);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=ry[e.kind]||oy,n=ry[t.kind]||oy,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()}},Gm=cr,cr.PREFIX="@",cr.SCOPE_PREFIX=":",cr.PREFIX_BY_CATEGORY=`${cr.PREFIX}${cr.SCOPE_PREFIX}`,cr);Oc=Gm=J6([Ok(0,Je),Ok(1,Np)],Oc);const oy=w("property","properties ({0})"),ry={5:w("method","methods ({0})"),11:w("function","functions ({0})"),8:w("_constructor","constructors ({0})"),12:w("variable","variables ({0})"),4:w("class","classes ({0})"),22:w("struct","structs ({0})"),23:w("event","events ({0})"),24:w("operator","operators ({0})"),10:w("interface","interfaces ({0})"),2:w("namespace","namespaces ({0})"),3:w("package","packages ({0})"),25:w("typeParameter","type parameters ({0})"),1:w("modules","modules ({0})"),6:w("property","properties ({0})"),9:w("enum","enumerations ({0})"),21:w("enumMember","enumeration members ({0})"),14:w("string","strings ({0})"),0:w("file","files ({0})"),17:w("array","arrays ({0})"),15:w("number","numbers ({0})"),16:w("boolean","booleans ({0})"),18:w("object","objects ({0})"),19:w("key","keys ({0})"),7:w("field","fields ({0})"),13:w("constant","constants ({0})")};var e7=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},ay=function(o,e){return function(t,i){e(t,i,o)}};let xx=class extends Oc{constructor(e,t,i){super(t,i),this.editorService=e,this.onDidActiveTextEditorControlChange=Nn.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};xx=e7([ay(0,xn),ay(1,Je),ay(2,Np)],xx);const cb=class cb extends ge{constructor(){super({id:cb.ID,label:ky.quickOutlineActionLabel,alias:"Go to Symbol...",precondition:T.hasDocumentSymbolProvider,kbOpts:{kbExpr:T.focus,primary:3117,weight:100},contextMenuOpts:{group:"navigation",order:3}})}run(e){e.get($a).quickAccess.show(Oc.PREFIX,{itemActivation:iF.NONE})}};cb.ID="editor.action.quickOutline";let dv=cb;Q(dv);mr.as(Sp.Quickaccess).registerQuickAccessProvider({ctor:xx,prefix:Oc.PREFIX,helpEntries:[{description:ky.quickOutlineActionLabel,prefix:Oc.PREFIX,commandId:dv.ID},{description:ky.quickOutlineByCategoryActionLabel,prefix:Oc.PREFIX_BY_CATEGORY}]});function t7(o){const e=new Map;for(const t of o)e.set(t,(e.get(t)??0)+1);return e}class rf{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 c of a.chunks){const h=this.computeSimilarityScore(c,i,n);h>0&&s.push({key:r,score:h})}}return s}static termFrequencies(e){return t7(rf.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=rf.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 c=i.get(s);typeof c!="number"&&(c=this.computeIdf(s),i.set(s,c));const h=a*c;n+=h*r}return n}computeEmbedding(e){const t=rf.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 i7(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 Bh;(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"})(Bh||(Bh={}));function ly(o){return Array.isArray(o.items)}function Fk(o){const e=o;return!!e.picks&&e.additionalPicks instanceof Promise}class n7 extends Se{constructor(e,t){super(),this.prefix=e,this.options=t}provide(e,t,i){var h;const n=new we;e.canAcceptInBackground=!!((h=this.options)!=null&&h.canAcceptInBackground),e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;let s;const r=n.add(new oo),a=async()=>{var S;const u=r.value=new we;s==null||s.dispose(!0),e.busy=!1,s=new Kn(t);const g=s.token;let f=e.value.substring(this.prefix.length);(S=this.options)!=null&&S.shouldSkipTrimPickFilter||(f=f.trim());const v=this._getPicks(f,u,g,i),_=(x,E)=>{var R;let M,F;if(ly(x)?(M=x.items,F=x.active):M=x,M.length===0){if(E)return!1;(f.length>0||e.hideInput)&&((R=this.options)!=null&&R.noResultsPick)&&(nF(this.options.noResultsPick)?M=[this.options.noResultsPick(f)]:M=[this.options.noResultsPick])}return e.items=M,F&&(e.activeItems=[F]),!0},y=async x=>{let E=!1,M=!1;await Promise.all([(async()=>{typeof x.mergeDelay=="number"&&(await Lb(x.mergeDelay),g.isCancellationRequested)||M||(E=_(x.picks,!0))})(),(async()=>{e.busy=!0;try{const F=await x.additionalPicks;if(g.isCancellationRequested)return;let R,Z;ly(x.picks)?(R=x.picks.items,Z=x.picks.active):R=x.picks;let q,he;if(ly(F)?(q=F.items,he=F.active):q=F,q.length>0||!E){let pe;if(!Z&&!he){const Ce=e.activeItems[0];Ce&&R.indexOf(Ce)!==-1&&(pe=Ce)}_({items:[...R,...q],active:Z||he||pe})}}finally{g.isCancellationRequested||(e.busy=!1),M=!0}})()])};if(v!==null)if(Fk(v))await y(v);else if(!(v instanceof Promise))_(v);else{e.busy=!0;try{const x=await v;if(g.isCancellationRequested)return;Fk(x)?await y(x):_(x)}finally{g.isCancellationRequested||(e.busy=!1)}}};n.add(e.onDidChangeValue(()=>a())),a(),n.add(e.onDidAccept(u=>{var f;if(i!=null&&i.handleAccept){u.inBackground||e.hide(),(f=i.handleAccept)==null||f.call(i,e.activeItems[0]);return}const[g]=e.selectedItems;typeof(g==null?void 0:g.accept)=="function"&&(u.inBackground||e.hide(),g.accept(e.keyMods,u))}));const c=async(u,g)=>{var v;if(typeof g.trigger!="function")return;const f=((v=g.buttons)==null?void 0:v.indexOf(u))??-1;if(f>=0){const _=g.trigger(f,e.keyMods),y=typeof _=="number"?_:await _;if(t.isCancellationRequested)return;switch(y){case Bh.NO_ACTION:break;case Bh.CLOSE_PICKER:e.hide();break;case Bh.REFRESH_PICKER:a();break;case Bh.REMOVE_ITEM:{const S=e.items.indexOf(g);if(S!==-1){const x=e.items.slice(),E=x.splice(S,1),M=e.activeItems.filter(R=>R!==E[0]),F=e.keepScrollPosition;e.keepScrollPosition=!0,e.items=x,M&&(e.activeItems=M),e.keepScrollPosition=F}break}}}};return n.add(e.onDidTriggerItemButton(({button:u,item:g})=>c(u,g))),n.add(e.onDidTriggerSeparatorButton(({button:u,separator:g})=>c(u,g))),n}}var wN=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},dl=function(o,e){return function(t,i){e(t,i,o)}},hc,In,Ur;let Lx=(Ur=class extends n7{constructor(e,t,i,n,s,r){super(hc.PREFIX,e),this.instantiationService=t,this.keybindingService=i,this.commandService=n,this.telemetryService=s,this.dialogService=r,this.commandsHistory=this._register(this.instantiationService.createInstance(Ix)),this.options=e}async _getPicks(e,t,i,n){var v,_;const s=await this.getCommandPicks(i);if(i.isCancellationRequested)return[];const r=FE(()=>{const y=new rf;y.updateDocuments(s.map(x=>({key:x.commandId,textChunks:[this.getTfIdfChunk(x)]})));const S=y.calculateScores(e,i);return i7(S).filter(x=>x.score>hc.TFIDF_THRESHOLD).slice(0,hc.TFIDF_MAX_RESULTS)}),a=[];for(const y of s){const S=hc.WORD_FILTER(e,y.label)??void 0,x=y.commandAlias?hc.WORD_FILTER(e,y.commandAlias)??void 0:void 0;if(S||x)y.highlights={label:S,detail:this.options.showAlias?x:void 0},a.push(y);else if(e===y.commandId)a.push(y);else if(e.length>=3){const E=r();if(i.isCancellationRequested)return[];const M=E.find(F=>F.key===y.commandId);M&&(y.tfIdfScore=M.score,a.push(y))}}const c=new Map;for(const y of a){const S=c.get(y.label);S?(y.description=y.commandId,S.description=S.commandId):c.set(y.label,y)}a.sort((y,S)=>{if(y.tfIdfScore&&S.tfIdfScore)return y.tfIdfScore===S.tfIdfScore?y.label.localeCompare(S.label):S.tfIdfScore-y.tfIdfScore;if(y.tfIdfScore)return 1;if(S.tfIdfScore)return-1;const x=this.commandsHistory.peek(y.commandId),E=this.commandsHistory.peek(S.commandId);if(x&&E)return x>E?-1:1;if(x)return-1;if(E)return 1;if(this.options.suggestedCommandIds){const M=this.options.suggestedCommandIds.has(y.commandId),F=this.options.suggestedCommandIds.has(S.commandId);if(M&&F)return 0;if(M)return-1;if(F)return 1}return y.label.localeCompare(S.label)});const h=[];let u=!1,g=!0,f=!!this.options.suggestedCommandIds;for(let y=0;y<a.length;y++){const S=a[y];y===0&&this.commandsHistory.peek(S.commandId)&&(h.push({type:"separator",label:w("recentlyUsed","recently used")}),u=!0),g&&S.tfIdfScore!==void 0&&(h.push({type:"separator",label:w("suggested","similar commands")}),g=!1),f&&S.tfIdfScore===void 0&&!this.commandsHistory.peek(S.commandId)&&((v=this.options.suggestedCommandIds)!=null&&v.has(S.commandId))&&(h.push({type:"separator",label:w("commonlyUsed","commonly used")}),u=!0,f=!1),u&&S.tfIdfScore===void 0&&!this.commandsHistory.peek(S.commandId)&&!((_=this.options.suggestedCommandIds)!=null&&_.has(S.commandId))&&(h.push({type:"separator",label:w("morecCommands","other commands")}),u=!1),h.push(this.toCommandPick(S,n))}return this.hasAdditionalCommandPicks(e,i)?{picks:h,additionalPicks:(async()=>{var x;const y=await this.getAdditionalCommandPicks(s,a,e,i);if(i.isCancellationRequested)return[];const S=y.map(E=>this.toCommandPick(E,n));return g&&((x=S[0])==null?void 0:x.type)!=="separator"&&S.unshift({type:"separator",label:w("suggested","similar commands")}),S})()}:h}toCommandPick(e,t){if(e.type==="separator")return e;const i=this.keybindingService.lookupKeybinding(e.commandId),n=i?w("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){Ql(r)||this.dialogService.error(w("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}},hc=Ur,Ur.PREFIX=">",Ur.TFIDF_THRESHOLD=.5,Ur.TFIDF_MAX_RESULTS=5,Ur.WORD_FILTER=sF(aF,rF,oF),Ur);Lx=hc=wN([dl(1,Bt),dl(2,En),dl(3,Bn),dl(4,vr),dl(5,h1)],Lx);var dr;let Ix=(dr=class extends Se{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===qx.SHUTDOWN&&this.saveState()}))}updateConfiguration(e){e&&!e.affectsConfiguration("workbench.commandPalette.history")||(this.configuredCommandsHistoryLength=In.getConfiguredCommandHistoryLength(this.configurationService),In.cache&&In.cache.limit!==this.configuredCommandsHistoryLength&&(In.cache.limit=this.configuredCommandsHistoryLength,In.hasChanges=!0))}load(){const e=this.storageService.get(In.PREF_KEY_CACHE,0);let t;if(e)try{t=JSON.parse(e)}catch(n){this.logService.error(`[CommandsHistory] invalid data: ${n}`)}const i=In.cache=new up(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))}In.counter=this.storageService.getNumber(In.PREF_KEY_COUNTER,0,In.counter)}push(e){In.cache&&(In.cache.set(e,In.counter++),In.hasChanges=!0)}peek(e){var t;return(t=In.cache)==null?void 0:t.peek(e)}saveState(){if(!In.cache||!In.hasChanges)return;const e={usesLRU:!0,entries:[]};In.cache.forEach((t,i)=>e.entries.push({key:i,value:t})),this.storageService.store(In.PREF_KEY_CACHE,JSON.stringify(e),0,0),this.storageService.store(In.PREF_KEY_COUNTER,In.counter,0,0),In.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:In.DEFAULT_COMMANDS_HISTORY_LENGTH}},In=dr,dr.DEFAULT_COMMANDS_HISTORY_LENGTH=50,dr.PREF_KEY_CACHE="commandPalette.mru.cache",dr.PREF_KEY_COUNTER="commandPalette.mru.counter",dr.counter=1,dr.hasChanges=!1,dr);Ix=In=wN([dl(0,Jl),dl(1,on),dl(2,$d)],Ix);class s7 extends Lx{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&&(lF(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:cF(n.label)||n.id})}return t}}var o7=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)}};let Qf=class extends s7{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[]}};Qf=o7([bh(0,Bt),bh(1,xn),bh(2,En),bh(3,Bn),bh(4,vr),bh(5,h1)],Qf);const db=class db extends ge{constructor(){super({id:db.ID,label:WE.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:T.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(e){e.get($a).quickAccess.show(Qf.PREFIX)}};db.ID="editor.action.quickCommand";let hv=db;Q(hv);mr.as(Sp.Quickaccess).registerQuickAccessProvider({ctor:Qf,prefix:Qf.PREFIX,helpEntries:[{description:WE.quickCommandHelp,commandId:hv.ID}]});var r7=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},wh=function(o,e){return function(t,i){e(t,i,o)}};let kx=class extends Od{constructor(e,t,i,n,s,r,a){super(!0,e,t,i,n,s,r,a)}};kx=r7([wh(1,wi),wh(2,xn),wh(3,Ss),wh(4,Bt),wh(5,Jl),wh(6,on)],kx);Zt(Od.ID,kx,4);class a7 extends ge{constructor(){super({id:"editor.action.toggleHighContrast",label:dF.toggleHighContrast,alias:"Toggle High Contrast Theme",precondition:void 0}),this._originalThemeName=null}run(e,t){const i=e.get(AE),n=i.getColorTheme();gf(n.type)?(i.setTheme(this._originalThemeName||(WL(n.type)?hF:uF)),this._originalThemeName=null):(i.setTheme(WL(n.type)?gF:fF),this._originalThemeName=n.themeName)}}Q(a7);let Dx=null;function l7(o){Dx=o}function c7(o={}){return{"Content-Type":"application/json",...o}}async function Ai(o,e,t){const i=await fetch(e,{method:o,headers:c7(),body:t!==void 0?JSON.stringify(t):void 0});if(i.status===401)throw Dx&&Dx(),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 d7(){return(await(await fetch("/she/auth/mode")).json()).mode}async function h7(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 u7(){await fetch("/she/auth/logout",{method:"POST"})}async function g7(o,e,t){const i=await fetch("/she/auth/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:o,password:e,proxyHeader:t})});if(!i.ok){const n=await i.json().catch(()=>({error:i.statusText}));throw new Error(n.error??"Setup failed")}}function f7(){return Ai("GET","/she/scripts/tree")}function p7(o){return Ai("GET",`/she/scripts/${o}`)}function yh(o,e){return Ai("PUT",`/she/scripts/${o}`,{content:e})}function cy(o){return Ai("DELETE",`/she/scripts/${o}`)}function Hk(o,e){return Ai("POST",`/she/scripts/${o}/rename`,{newPath:e})}function m7(o){return Ai("POST","/she/scripts/mkdir",{path:o})}function _7(){return Ai("GET","/she/git/status")}function v7(){return Ai("GET","/she/status")}function b7(){return Ai("POST","/she/restart")}function w7(o,e){return Ai("POST","/she/git/commit",{path:o,message:e})}function y7(o){return Ai("POST","/she/git/push",{remote:o})}function S7(){return Ai("GET","/she/config")}function C7(o){return Ai("PUT","/she/config",o)}function yN(){return Ai("GET","/she/db/docs")}function x7(o){return Ai("GET",`/she/db/docs/${o}`)}function Wk(o,e){return Ai("PUT",`/she/db/docs/${o}`,e)}function L7(o){return Ai("DELETE",`/she/db/docs/${o}`)}function SN(){return Ai("GET","/she/db/views")}function I7(o){return Ai("GET",`/she/db/views/${o}`)}function Bk(o,e){return Ai("PUT",`/she/db/views/${o}`,e)}function k7(o){return Ai("DELETE",`/she/db/views/${o}`)}function D7(){return Ai("GET","/she/deps")}function E7(o){return Ai("GET",`/she/deps/search?q=${encodeURIComponent(o)}`)}function P7(o,e){return Ai("POST","/she/deps/install",{name:o,version:null})}function T7(o){return Ai("POST","/she/deps/remove",{name:o})}function M7(o){return Ai("POST","/she/deps/update",{name:o})}function dy(o){return Ai("GET",`/she/db/views/${o}/result`)}function CN(){return Ai("GET","/she/matter/devices")}function xN(o){return Ai("GET",`/she/matter/devices/${o}`)}function N7(o){return Ai("POST","/she/matter/commission",o)}function R7(o){return Ai("DELETE",`/she/matter/devices/${o}`)}function LN(){return Ai("GET","/she/mqtt/state")}function A7(o,e,t=!1,i=0){return Ai("POST","/she/mqtt/publish",{topic:o,payload:e,retain:t,qos:i})}function IN(){return Ai("GET","/she/ai/config")}function kN(){return Ai("GET","/she/ai/models")}function DN(o){return Ai("GET",`/she/ai/model-info?model=${encodeURIComponent(o)}`)}async function EN(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 h=await s.json().catch(()=>({error:s.statusText}));throw new Error(h.error??s.statusText)}const r=s.body.getReader(),a=new TextDecoder;let c="";try{for(;;){const{done:h,value:u}=await r.read();if(h)break;c+=a.decode(u,{stream:!0});const g=c.split(`
74
+ `);c=g.pop()??"";for(const f of g){if(!f.startsWith("data: "))continue;const v=f.slice(6).trim();if(v==="[DONE]")return;try{const _=JSON.parse(v);if(_.error)throw new Error(_.error);if(_.type==="tool_call"||_.type==="tool_result"){i==null||i({type:_.type,name:_.name??"",args:_.args,content:_.content});continue}_.token&&e(_.token)}catch(_){if(_ instanceof SyntaxError)continue;throw _}}}}finally{r.releaseLock()}}const O7=2e3,Zm=[];function F7(){return Zm.slice()}let Sl=null;const uv=new Set,zh=new Map;let Ex=null;function Jf(){let o=uv.size;for(const e of zh.values())o+=e.size;return o}function H7(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/she/ws`}function _0(){if(Sl)return;const o=H7(),e=new WebSocket(o);Sl=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};Zm.length>=O7&&Zm.shift(),Zm.push(s),uv.forEach(r=>r(s))}const n=zh.get(i.type);n&&n.forEach(s=>s(i))}catch{}},e.onclose=()=>{Sl===e&&(Sl=null),Jf()>0&&(Ex=setTimeout(_0,3e3))},e.onerror=()=>{e.close()}}function PN(){Ex&&clearTimeout(Ex),Sl==null||Sl.close(),Sl=null}function TN(o){return uv.add(o),Jf()===1&&_0(),()=>{uv.delete(o),Jf()===0&&PN()}}function Vh(o,e){return zh.has(o)||zh.set(o,new Set),zh.get(o).add(e),Jf()===1&&_0(),()=>{var t;(t=zh.get(o))==null||t.delete(e),Jf()===0&&PN()}}var W7=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 class="cancel svelte-1eh8v5n">Cancel</button> <button> </button></div></div>',1);function B7(o,e){ao(e,!0);let t=j(!1),i=j(""),n=j("Confirm"),s=j(!1),r=null;function a(_,y){return I(i,_,!0),I(n,(y==null?void 0:y.confirm)??"Confirm",!0),I(s,(y==null?void 0:y.danger)??!1,!0),I(t,!0),new Promise(S=>r=S)}function c(_){I(t,!1),r==null||r(_),r=null}function h(_){m(t)&&(_.key==="Escape"&&c(!1),_.key==="Enter"&&c(!0))}var u={show:a},g=_s();_o("keydown",Tc,h);var f=Wt(g);{var v=_=>{var y=W7(),S=Wt(y),x=D(S,2),E=k(x),M=k(E),F=D(E,2),R=k(F),Z=D(R,2);let q;var he=k(Z);se(()=>{oe(M,m(i)),q=ti(Z,1,"svelte-1eh8v5n",null,q,{danger:m(s)}),oe(he,m(n))}),de("click",S,()=>c(!1)),de("click",R,()=>c(!1)),de("click",Z,()=>c(!0)),N(_,y)};J(f,_=>{m(t)&&_(v)})}return N(o,g),lo(u)}Ko(["click"]);var z7=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 V7(o,e){ao(e,!0);let t=j(!1),i=j(""),n=j(""),s=j("OK"),r=j(""),a=null,c=j(void 0);function h(x,E){return I(i,x,!0),I(n,(E==null?void 0:E.placeholder)??"",!0),I(s,(E==null?void 0:E.confirm)??"OK",!0),I(r,(E==null?void 0:E.initial)??"",!0),I(t,!0),setTimeout(()=>{var M;return(M=m(c))==null?void 0:M.select()},0),new Promise(M=>a=M)}function u(){const x=m(r).trim();x&&(I(t,!1),a==null||a(x),a=null,I(r,""))}function g(){I(t,!1),a==null||a(null),a=null,I(r,"")}function f(x){m(t)&&x.key==="Escape"&&(x.stopPropagation(),g())}var v={show:h},_=_s();_o("keydown",Tc,f);var y=Wt(_);{var S=x=>{var E=z7(),M=Wt(E),F=D(M,2),R=k(F),Z=k(R),q=D(R,2);bo(q,je=>I(c,je),()=>m(c));var he=D(q,2),pe=k(he),Ce=D(pe,2),Pe=k(Ce);se(je=>{oe(Z,m(i)),is(q,"placeholder",m(n)),Ce.disabled=je,oe(Pe,m(s))},[()=>!m(r).trim()]),de("click",M,g),de("keydown",q,je=>{je.key==="Enter"&&(je.preventDefault(),u())}),Bi(q,()=>m(r),je=>I(r,je)),de("click",pe,g),de("click",Ce,u),N(x,E)};J(y,x=>{m(t)&&x(S)})}return N(o,_),lo(v)}Ko(["click","keydown"]);function MN(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var hy,zk;function U7(){if(zk)return hy;zk=1;function o(A){return A instanceof Map?A.clear=A.delete=A.set=function(){throw new Error("map is read-only")}:A instanceof Set&&(A.add=A.clear=A.delete=function(){throw new Error("set is read-only")}),Object.freeze(A),Object.getOwnPropertyNames(A).forEach(te=>{const H=A[te],ee=typeof H;(ee==="object"||ee==="function")&&!Object.isFrozen(H)&&o(H)}),A}class e{constructor(te){te.data===void 0&&(te.data={}),this.data=te.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(A){return A.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function i(A,...te){const H=Object.create(null);for(const ee in A)H[ee]=A[ee];return te.forEach(function(ee){for(const ke in ee)H[ke]=ee[ke]}),H}const n="</span>",s=A=>!!A.scope,r=(A,{prefix:te})=>{if(A.startsWith("language:"))return A.replace("language:","language-");if(A.includes(".")){const H=A.split(".");return[`${te}${H.shift()}`,...H.map((ee,ke)=>`${ee}${"_".repeat(ke+1)}`)].join(" ")}return`${te}${A}`};class a{constructor(te,H){this.buffer="",this.classPrefix=H.classPrefix,te.walk(this)}addText(te){this.buffer+=t(te)}openNode(te){if(!s(te))return;const H=r(te.scope,{prefix:this.classPrefix});this.span(H)}closeNode(te){s(te)&&(this.buffer+=n)}value(){return this.buffer}span(te){this.buffer+=`<span class="${te}">`}}const c=(A={})=>{const te={children:[]};return Object.assign(te,A),te};class h{constructor(){this.rootNode=c(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(te){this.top.children.push(te)}openNode(te){const H=c({scope:te});this.add(H),this.stack.push(H)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(te){return this.constructor._walk(te,this.rootNode)}static _walk(te,H){return typeof H=="string"?te.addText(H):H.children&&(te.openNode(H),H.children.forEach(ee=>this._walk(te,ee)),te.closeNode(H)),te}static _collapse(te){typeof te!="string"&&te.children&&(te.children.every(H=>typeof H=="string")?te.children=[te.children.join("")]:te.children.forEach(H=>{h._collapse(H)}))}}class u extends h{constructor(te){super(),this.options=te}addText(te){te!==""&&this.add(te)}startScope(te){this.openNode(te)}endScope(){this.closeNode()}__addSublanguage(te,H){const ee=te.root;H&&(ee.scope=`language:${H}`),this.add(ee)}toHTML(){return new a(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function g(A){return A?typeof A=="string"?A:A.source:null}function f(A){return y("(?=",A,")")}function v(A){return y("(?:",A,")*")}function _(A){return y("(?:",A,")?")}function y(...A){return A.map(H=>g(H)).join("")}function S(A){const te=A[A.length-1];return typeof te=="object"&&te.constructor===Object?(A.splice(A.length-1,1),te):{}}function x(...A){return"("+(S(A).capture?"":"?:")+A.map(ee=>g(ee)).join("|")+")"}function E(A){return new RegExp(A.toString()+"|").exec("").length-1}function M(A,te){const H=A&&A.exec(te);return H&&H.index===0}const F=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function R(A,{joinWith:te}){let H=0;return A.map(ee=>{H+=1;const ke=H;let Ue=g(ee),z="";for(;Ue.length>0;){const $=F.exec(Ue);if(!$){z+=Ue;break}z+=Ue.substring(0,$.index),Ue=Ue.substring($.index+$[0].length),$[0][0]==="\\"&&$[1]?z+="\\"+String(Number($[1])+ke):(z+=$[0],$[0]==="("&&H++)}return z}).map(ee=>`(${ee})`).join(te)}const Z=/\b\B/,q="[a-zA-Z]\\w*",he="[a-zA-Z_]\\w*",pe="\\b\\d+(\\.\\d+)?",Ce="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Pe="\\b(0b[01]+)",je="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",qt=(A={})=>{const te=/^#![ ]*\//;return A.binary&&(A.begin=y(te,/.*\b/,A.binary,/\b.*/)),i({scope:"meta",begin:te,end:/$/,relevance:0,"on:begin":(H,ee)=>{H.index!==0&&ee.ignoreMatch()}},A)},Ge={begin:"\\\\[\\s\\S]",relevance:0},Xt={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Ge]},pt={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Ge]},Kt={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/},ae=function(A,te,H={}){const ee=i({scope:"comment",begin:A,end:te,contains:[]},H);ee.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 ke=x("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 ee.contains.push({begin:y(/[ ]+/,"(",ke,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),ee},Te=ae("//","$"),ve=ae("/\\*","\\*/"),lt=ae("#","$"),Qt={scope:"number",begin:pe,relevance:0},It={scope:"number",begin:Ce,relevance:0},Tt={scope:"number",begin:Pe,relevance:0},Lt={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Ge,{begin:/\[/,end:/\]/,relevance:0,contains:[Ge]}]},gt={scope:"title",begin:q,relevance:0},Oi={scope:"title",begin:he,relevance:0},Gt={begin:"\\.\\s*"+he,relevance:0};var Be=Object.freeze({__proto__:null,APOS_STRING_MODE:Xt,BACKSLASH_ESCAPE:Ge,BINARY_NUMBER_MODE:Tt,BINARY_NUMBER_RE:Pe,COMMENT:ae,C_BLOCK_COMMENT_MODE:ve,C_LINE_COMMENT_MODE:Te,C_NUMBER_MODE:It,C_NUMBER_RE:Ce,END_SAME_AS_BEGIN:function(A){return Object.assign(A,{"on:begin":(te,H)=>{H.data._beginMatch=te[1]},"on:end":(te,H)=>{H.data._beginMatch!==te[1]&&H.ignoreMatch()}})},HASH_COMMENT_MODE:lt,IDENT_RE:q,MATCH_NOTHING_RE:Z,METHOD_GUARD:Gt,NUMBER_MODE:Qt,NUMBER_RE:pe,PHRASAL_WORDS_MODE:Kt,QUOTE_STRING_MODE:pt,REGEXP_MODE:Lt,RE_STARTERS_RE:je,SHEBANG:qt,TITLE_MODE:gt,UNDERSCORE_IDENT_RE:he,UNDERSCORE_TITLE_MODE:Oi});function Mt(A,te){A.input[A.index-1]==="."&&te.ignoreMatch()}function kt(A,te){A.className!==void 0&&(A.scope=A.className,delete A.className)}function pi(A,te){te&&A.beginKeywords&&(A.begin="\\b("+A.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",A.__beforeBegin=Mt,A.keywords=A.keywords||A.beginKeywords,delete A.beginKeywords,A.relevance===void 0&&(A.relevance=0))}function Nt(A,te){Array.isArray(A.illegal)&&(A.illegal=x(...A.illegal))}function mi(A,te){if(A.match){if(A.begin||A.end)throw new Error("begin & end are not supported with match");A.begin=A.match,delete A.match}}function Mi(A,te){A.relevance===void 0&&(A.relevance=1)}const Ui=(A,te)=>{if(!A.beforeMatch)return;if(A.starts)throw new Error("beforeMatch cannot be used with starts");const H=Object.assign({},A);Object.keys(A).forEach(ee=>{delete A[ee]}),A.keywords=H.keywords,A.begin=y(H.beforeMatch,f(H.begin)),A.starts={relevance:0,contains:[Object.assign(H,{endsParent:!0})]},A.relevance=0,delete H.beforeMatch},Fi=["of","and","for","in","not","or","if","then","parent","list","value"],yi="keyword";function cn(A,te,H=yi){const ee=Object.create(null);return typeof A=="string"?ke(H,A.split(" ")):Array.isArray(A)?ke(H,A):Object.keys(A).forEach(function(Ue){Object.assign(ee,cn(A[Ue],te,Ue))}),ee;function ke(Ue,z){te&&(z=z.map($=>$.toLowerCase())),z.forEach(function($){const re=$.split("|");ee[re[0]]=[Ue,Zi(re[0],re[1])]})}}function Zi(A,te){return te?Number(te):rn(A)?0:1}function rn(A){return Fi.includes(A.toLowerCase())}const bn={},_i=A=>{console.error(A)},_n=(A,...te)=>{console.log(`WARN: ${A}`,...te)},ki=(A,te)=>{bn[`${A}/${te}`]||(console.log(`Deprecated as of ${A}. ${te}`),bn[`${A}/${te}`]=!0)},Ni=new Error;function fn(A,te,{key:H}){let ee=0;const ke=A[H],Ue={},z={};for(let $=1;$<=te.length;$++)z[$+ee]=ke[$],Ue[$+ee]=!0,ee+=E(te[$-1]);A[H]=z,A[H]._emit=Ue,A[H]._multi=!0}function On(A){if(Array.isArray(A.begin)){if(A.skip||A.excludeBegin||A.returnBegin)throw _i("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Ni;if(typeof A.beginScope!="object"||A.beginScope===null)throw _i("beginScope must be object"),Ni;fn(A,A.begin,{key:"beginScope"}),A.begin=R(A.begin,{joinWith:""})}}function Vn(A){if(Array.isArray(A.end)){if(A.skip||A.excludeEnd||A.returnEnd)throw _i("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Ni;if(typeof A.endScope!="object"||A.endScope===null)throw _i("endScope must be object"),Ni;fn(A,A.end,{key:"endScope"}),A.end=R(A.end,{joinWith:""})}}function Un(A){A.scope&&typeof A.scope=="object"&&A.scope!==null&&(A.beginScope=A.scope,delete A.scope)}function Jt(A){Un(A),typeof A.beginScope=="string"&&(A.beginScope={_wrap:A.beginScope}),typeof A.endScope=="string"&&(A.endScope={_wrap:A.endScope}),On(A),Vn(A)}function be(A){function te(z,$){return new RegExp(g(z),"m"+(A.case_insensitive?"i":"")+(A.unicodeRegex?"u":"")+($?"g":""))}class H{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule($,re){re.position=this.position++,this.matchIndexes[this.matchAt]=re,this.regexes.push([re,$]),this.matchAt+=E($)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const $=this.regexes.map(re=>re[1]);this.matcherRe=te(R($,{joinWith:"|"}),!0),this.lastIndex=0}exec($){this.matcherRe.lastIndex=this.lastIndex;const re=this.matcherRe.exec($);if(!re)return null;const xe=re.findIndex((X,V)=>V>0&&X!==void 0),_e=this.matchIndexes[xe];return re.splice(0,xe),Object.assign(re,_e)}}class ee{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher($){if(this.multiRegexes[$])return this.multiRegexes[$];const re=new H;return this.rules.slice($).forEach(([xe,_e])=>re.addRule(xe,_e)),re.compile(),this.multiRegexes[$]=re,re}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule($,re){this.rules.push([$,re]),re.type==="begin"&&this.count++}exec($){const re=this.getMatcher(this.regexIndex);re.lastIndex=this.lastIndex;let xe=re.exec($);if(this.resumingScanAtSamePosition()&&!(xe&&xe.index===this.lastIndex)){const _e=this.getMatcher(0);_e.lastIndex=this.lastIndex+1,xe=_e.exec($)}return xe&&(this.regexIndex+=xe.position+1,this.regexIndex===this.count&&this.considerAll()),xe}}function ke(z){const $=new ee;return z.contains.forEach(re=>$.addRule(re.begin,{rule:re,type:"begin"})),z.terminatorEnd&&$.addRule(z.terminatorEnd,{type:"end"}),z.illegal&&$.addRule(z.illegal,{type:"illegal"}),$}function Ue(z,$){const re=z;if(z.isCompiled)return re;[kt,mi,Jt,Ui].forEach(_e=>_e(z,$)),A.compilerExtensions.forEach(_e=>_e(z,$)),z.__beforeBegin=null,[pi,Nt,Mi].forEach(_e=>_e(z,$)),z.isCompiled=!0;let xe=null;return typeof z.keywords=="object"&&z.keywords.$pattern&&(z.keywords=Object.assign({},z.keywords),xe=z.keywords.$pattern,delete z.keywords.$pattern),xe=xe||/\w+/,z.keywords&&(z.keywords=cn(z.keywords,A.case_insensitive)),re.keywordPatternRe=te(xe,!0),$&&(z.begin||(z.begin=/\B|\b/),re.beginRe=te(re.begin),!z.end&&!z.endsWithParent&&(z.end=/\B|\b/),z.end&&(re.endRe=te(re.end)),re.terminatorEnd=g(re.end)||"",z.endsWithParent&&$.terminatorEnd&&(re.terminatorEnd+=(z.end?"|":"")+$.terminatorEnd)),z.illegal&&(re.illegalRe=te(z.illegal)),z.contains||(z.contains=[]),z.contains=[].concat(...z.contains.map(function(_e){return Ie(_e==="self"?z:_e)})),z.contains.forEach(function(_e){Ue(_e,re)}),z.starts&&Ue(z.starts,$),re.matcher=ke(re),re}if(A.compilerExtensions||(A.compilerExtensions=[]),A.contains&&A.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return A.classNameAliases=i(A.classNameAliases||{}),Ue(A)}function K(A){return A?A.endsWithParent||K(A.starts):!1}function Ie(A){return A.variants&&!A.cachedVariants&&(A.cachedVariants=A.variants.map(function(te){return i(A,{variants:null},te)})),A.cachedVariants?A.cachedVariants:K(A)?i(A,{starts:A.starts?i(A.starts):null}):Object.isFrozen(A)?i(A):A}var nt="11.11.1";class Rt extends Error{constructor(te,H){super(te),this.name="HTMLInjectionError",this.html=H}}const vt=t,rt=i,ni=Symbol("nomatch"),ri=7,Xi=function(A){const te=Object.create(null),H=Object.create(null),ee=[];let ke=!0;const Ue="Could not find the language '{}', did you forget to load/include a language module?",z={disableAutodetect:!0,name:"Plain text",contains:[]};let $={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:u};function re(ce){return $.noHighlightRe.test(ce)}function xe(ce){let He=ce.className+" ";He+=ce.parentNode?ce.parentNode.className:"";const dt=$.languageDetectRe.exec(He);if(dt){const At=De(dt[1]);return At||(_n(Ue.replace("{}",dt[1])),_n("Falling back to no-highlight mode for this block.",ce)),At?dt[1]:"no-highlight"}return He.split(/\s+/).find(At=>re(At)||De(At))}function _e(ce,He,dt){let At="",ei="";typeof He=="object"?(At=ce,dt=He.ignoreIllegals,ei=He.language):(ki("10.7.0","highlight(lang, code, ...args) has been deprecated."),ki("10.7.0",`Please use highlight(code, options) instead.
75
+ https://github.com/highlightjs/highlight.js/issues/2277`),ei=ce,At=He),dt===void 0&&(dt=!0);const ht={code:At,language:ei};mt("before:highlight",ht);const st=ht.result?ht.result:X(ht.language,ht.code,dt);return st.code=ht.code,mt("after:highlight",st),st}function X(ce,He,dt,At){const ei=Object.create(null);function ht($e,wt){return $e.keywords[wt]}function st(){if(!Ft.keywords){wn.addText(Ci);return}let $e=0;Ft.keywordPatternRe.lastIndex=0;let wt=Ft.keywordPatternRe.exec(Ci),si="";for(;wt;){si+=Ci.substring($e,wt.index);const Wi=Et.case_insensitive?wt[0].toLowerCase():wt[0],yt=ht(Ft,Wi);if(yt){const[Fn,gn]=yt;if(wn.addText(si),si="",ei[Wi]=(ei[Wi]||0)+1,ei[Wi]<=ri&&(Os+=gn),Fn.startsWith("_"))si+=wt[0];else{const eh=Et.classNameAliases[Fn]||Fn;Ot(wt[0],eh)}}else si+=wt[0];$e=Ft.keywordPatternRe.lastIndex,wt=Ft.keywordPatternRe.exec(Ci)}si+=Ci.substring($e),wn.addText(si)}function Ye(){if(Ci==="")return;let $e=null;if(typeof Ft.subLanguage=="string"){if(!te[Ft.subLanguage]){wn.addText(Ci);return}$e=X(Ft.subLanguage,Ci,!0,Zo[Ft.subLanguage]),Zo[Ft.subLanguage]=$e._top}else $e=ue(Ci,Ft.subLanguage.length?Ft.subLanguage:null);Ft.relevance>0&&(Os+=$e.relevance),wn.__addSublanguage($e._emitter,$e.language)}function Ee(){Ft.subLanguage!=null?Ye():st(),Ci=""}function Ot($e,wt){$e!==""&&(wn.startScope(wt),wn.addText($e),wn.endScope())}function Re($e,wt){let si=1;const Wi=wt.length-1;for(;si<=Wi;){if(!$e._emit[si]){si++;continue}const yt=Et.classNameAliases[$e[si]]||$e[si],Fn=wt[si];yt?Ot(Fn,yt):(Ci=Fn,st(),Ci=""),si++}}function Fe($e,wt){return $e.scope&&typeof $e.scope=="string"&&wn.openNode(Et.classNameAliases[$e.scope]||$e.scope),$e.beginScope&&($e.beginScope._wrap?(Ot(Ci,Et.classNameAliases[$e.beginScope._wrap]||$e.beginScope._wrap),Ci=""):$e.beginScope._multi&&(Re($e.beginScope,wt),Ci="")),Ft=Object.create($e,{parent:{value:Ft}}),Ft}function zt($e,wt,si){let Wi=M($e.endRe,si);if(Wi){if($e["on:end"]){const yt=new e($e);$e["on:end"](wt,yt),yt.isMatchIgnored&&(Wi=!1)}if(Wi){for(;$e.endsParent&&$e.parent;)$e=$e.parent;return $e}}if($e.endsWithParent)return zt($e.parent,wt,si)}function Yi($e){return Ft.matcher.regexIndex===0?(Ci+=$e[0],1):(Cr=!0,0)}function Ln($e){const wt=$e[0],si=$e.rule,Wi=new e(si),yt=[si.__beforeBegin,si["on:begin"]];for(const Fn of yt)if(Fn&&(Fn($e,Wi),Wi.isMatchIgnored))return Yi(wt);return si.skip?Ci+=wt:(si.excludeBegin&&(Ci+=wt),Ee(),!si.returnBegin&&!si.excludeBegin&&(Ci=wt)),Fe(si,$e),si.returnBegin?0:wt.length}function un($e){const wt=$e[0],si=He.substring($e.index),Wi=zt(Ft,$e,si);if(!Wi)return ni;const yt=Ft;Ft.endScope&&Ft.endScope._wrap?(Ee(),Ot(wt,Ft.endScope._wrap)):Ft.endScope&&Ft.endScope._multi?(Ee(),Re(Ft.endScope,$e)):yt.skip?Ci+=wt:(yt.returnEnd||yt.excludeEnd||(Ci+=wt),Ee(),yt.excludeEnd&&(Ci=wt));do Ft.scope&&wn.closeNode(),!Ft.skip&&!Ft.subLanguage&&(Os+=Ft.relevance),Ft=Ft.parent;while(Ft!==Wi.parent);return Wi.starts&&Fe(Wi.starts,$e),yt.returnEnd?0:wt.length}function Go(){const $e=[];for(let wt=Ft;wt!==Et;wt=wt.parent)wt.scope&&$e.unshift(wt.scope);$e.forEach(wt=>wn.openNode(wt))}let cs={};function ds($e,wt){const si=wt&&wt[0];if(Ci+=$e,si==null)return Ee(),0;if(cs.type==="begin"&&wt.type==="end"&&cs.index===wt.index&&si===""){if(Ci+=He.slice(wt.index,wt.index+1),!ke){const Wi=new Error(`0 width match regex (${ce})`);throw Wi.languageName=ce,Wi.badRule=cs.rule,Wi}return 1}if(cs=wt,wt.type==="begin")return Ln(wt);if(wt.type==="illegal"&&!dt){const Wi=new Error('Illegal lexeme "'+si+'" for mode "'+(Ft.scope||"<unnamed>")+'"');throw Wi.mode=Ft,Wi}else if(wt.type==="end"){const Wi=un(wt);if(Wi!==ni)return Wi}if(wt.type==="illegal"&&si==="")return Ci+=`
76
+ `,1;if(Sr>1e5&&Sr>wt.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Ci+=si,si.length}const Et=De(ce);if(!Et)throw _i(Ue.replace("{}",ce)),new Error('Unknown language: "'+ce+'"');const Qi=be(Et);let Tn="",Ft=At||Qi;const Zo={},wn=new $.__emitter($);Go();let Ci="",Os=0,Ls=0,Sr=0,Cr=!1;try{if(Et.__emitTokens)Et.__emitTokens(He,wn);else{for(Ft.matcher.considerAll();;){Sr++,Cr?Cr=!1:Ft.matcher.considerAll(),Ft.matcher.lastIndex=Ls;const $e=Ft.matcher.exec(He);if(!$e)break;const wt=He.substring(Ls,$e.index),si=ds(wt,$e);Ls=$e.index+si}ds(He.substring(Ls))}return wn.finalize(),Tn=wn.toHTML(),{language:ce,value:Tn,relevance:Os,illegal:!1,_emitter:wn,_top:Ft}}catch($e){if($e.message&&$e.message.includes("Illegal"))return{language:ce,value:vt(He),illegal:!0,relevance:0,_illegalBy:{message:$e.message,index:Ls,context:He.slice(Ls-100,Ls+100),mode:$e.mode,resultSoFar:Tn},_emitter:wn};if(ke)return{language:ce,value:vt(He),illegal:!1,relevance:0,errorRaised:$e,_emitter:wn,_top:Ft};throw $e}}function V(ce){const He={value:vt(ce),illegal:!1,relevance:0,_top:z,_emitter:new $.__emitter($)};return He._emitter.addText(ce),He}function ue(ce,He){He=He||$.languages||Object.keys(te);const dt=V(ce),At=He.filter(De).filter(Ct).map(Ee=>X(Ee,ce,!1));At.unshift(dt);const ei=At.sort((Ee,Ot)=>{if(Ee.relevance!==Ot.relevance)return Ot.relevance-Ee.relevance;if(Ee.language&&Ot.language){if(De(Ee.language).supersetOf===Ot.language)return 1;if(De(Ot.language).supersetOf===Ee.language)return-1}return 0}),[ht,st]=ei,Ye=ht;return Ye.secondBest=st,Ye}function Le(ce,He,dt){const At=He&&H[He]||dt;ce.classList.add("hljs"),ce.classList.add(`language-${At}`)}function Me(ce){let He=null;const dt=xe(ce);if(re(dt))return;if(mt("before:highlightElement",{el:ce,language:dt}),ce.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",ce);return}if(ce.children.length>0&&($.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(ce)),$.throwUnescapedHTML))throw new Rt("One of your code blocks includes unescaped HTML.",ce.innerHTML);He=ce;const At=He.textContent,ei=dt?_e(At,{language:dt,ignoreIllegals:!0}):ue(At);ce.innerHTML=ei.value,ce.dataset.highlighted="yes",Le(ce,dt,ei.language),ce.result={language:ei.language,re:ei.relevance,relevance:ei.relevance},ei.secondBest&&(ce.secondBest={language:ei.secondBest.language,relevance:ei.secondBest.relevance}),mt("after:highlightElement",{el:ce,result:ei,text:At})}function Oe(ce){$=rt($,ce)}const Ze=()=>{Ht(),ki("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function bt(){Ht(),ki("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Dt=!1;function Ht(){function ce(){Ht()}if(document.readyState==="loading"){Dt||window.addEventListener("DOMContentLoaded",ce,!1),Dt=!0;return}document.querySelectorAll($.cssSelector).forEach(Me)}function ct(ce,He){let dt=null;try{dt=He(A)}catch(At){if(_i("Language definition for '{}' could not be registered.".replace("{}",ce)),ke)_i(At);else throw At;dt=z}dt.name||(dt.name=ce),te[ce]=dt,dt.rawDefinition=He.bind(null,A),dt.aliases&&ze(dt.aliases,{languageName:ce})}function me(ce){delete te[ce];for(const He of Object.keys(H))H[He]===ce&&delete H[He]}function Ne(){return Object.keys(te)}function De(ce){return ce=(ce||"").toLowerCase(),te[ce]||te[H[ce]]}function ze(ce,{languageName:He}){typeof ce=="string"&&(ce=[ce]),ce.forEach(dt=>{H[dt.toLowerCase()]=He})}function Ct(ce){const He=De(ce);return He&&!He.disableAutodetect}function et(ce){ce["before:highlightBlock"]&&!ce["before:highlightElement"]&&(ce["before:highlightElement"]=He=>{ce["before:highlightBlock"](Object.assign({block:He.el},He))}),ce["after:highlightBlock"]&&!ce["after:highlightElement"]&&(ce["after:highlightElement"]=He=>{ce["after:highlightBlock"](Object.assign({block:He.el},He))})}function tt(ce){et(ce),ee.push(ce)}function at(ce){const He=ee.indexOf(ce);He!==-1&&ee.splice(He,1)}function mt(ce,He){const dt=ce;ee.forEach(function(At){At[dt]&&At[dt](He)})}function ui(ce){return ki("10.7.0","highlightBlock will be removed entirely in v12.0"),ki("10.7.0","Please use highlightElement now."),Me(ce)}Object.assign(A,{highlight:_e,highlightAuto:ue,highlightAll:Ht,highlightElement:Me,highlightBlock:ui,configure:Oe,initHighlighting:Ze,initHighlightingOnLoad:bt,registerLanguage:ct,unregisterLanguage:me,listLanguages:Ne,getLanguage:De,registerAliases:ze,autoDetection:Ct,inherit:rt,addPlugin:tt,removePlugin:at}),A.debugMode=function(){ke=!1},A.safeMode=function(){ke=!0},A.versionString=nt,A.regex={concat:y,lookahead:f,either:x,optional:_,anyNumberOfTimes:v};for(const ce in Be)typeof Be[ce]=="object"&&o(Be[ce]);return Object.assign(A,Be),A},Hi=Xi({});return Hi.newInstance=()=>Xi({}),hy=Hi,Hi.HighlightJS=Hi,Hi.default=Hi,hy}var j7=U7();const gv=MN(j7),Vk="[A-Za-z$_][0-9A-Za-z$_]*",$7=["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"],q7=["true","false","null","undefined","NaN","Infinity"],NN=["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"],RN=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],AN=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],K7=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],G7=[].concat(AN,NN,RN);function ON(o){const e=o.regex,t=(ae,{after:Te})=>{const ve="</"+ae[0].slice(1);return ae.input.indexOf(ve,Te)!==-1},i=Vk,n={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,r={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(ae,Te)=>{const ve=ae[0].length+ae.index,lt=ae.input[ve];if(lt==="<"||lt===","){Te.ignoreMatch();return}lt===">"&&(t(ae,{after:ve})||Te.ignoreMatch());let Qt;const It=ae.input.substring(ve);if(Qt=It.match(/^\s*=/)){Te.ignoreMatch();return}if((Qt=It.match(/^\s+extends\s+/))&&Qt.index===0){Te.ignoreMatch();return}}},a={$pattern:Vk,keyword:$7,literal:q7,built_in:G7,"variable.language":K7},c="[0-9](_?[0-9])*",h=`\\.(${c})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",g={className:"number",variants:[{begin:`(\\b(${u})((${h})|\\.)?|(${h}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${h})\\b|\\.)?|(${h})\\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},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},v={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[o.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},_={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[o.BACKSLASH_ESCAPE,f],subLanguage:"css"}},y={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[o.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},S={className:"string",begin:"`",end:"`",contains:[o.BACKSLASH_ESCAPE,f]},E={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]},M=[o.APOS_STRING_MODE,o.QUOTE_STRING_MODE,v,_,y,S,{match:/\$\d+/},g];f.contains=M.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(M)});const F=[].concat(E,f.contains),R=F.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(F)}]),Z={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:R},q={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"}}]},he={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:{_:[...NN,...RN]}},pe={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Ce={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[Z],illegal:/%/},Pe={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function je(ae){return e.concat("(?!",ae.join("|"),")")}const qt={match:e.concat(/\b/,je([...AN,"super","import"].map(ae=>`${ae}\\s*\\(`)),i,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},Ge={begin:e.concat(/\./,e.lookahead(e.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},Xt={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},Z]},pt="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+o.UNDERSCORE_IDENT_RE+")\\s*=>",Kt={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(pt)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[Z]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:R,CLASS_REFERENCE:he},illegal:/#(?![$_A-z])/,contains:[o.SHEBANG({label:"shebang",binary:"node",relevance:5}),pe,o.APOS_STRING_MODE,o.QUOTE_STRING_MODE,v,_,y,S,E,{match:/\$\d+/},g,he,{scope:"attr",match:i+e.lookahead(":"),relevance:0},Kt,{begin:"("+o.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[E,o.REGEXP_MODE,{className:"function",begin:pt,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:R}]}]},{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"]}]}]},Ce,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+o.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[Z,o.inherit(o.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},Ge,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[Z]},qt,Pe,q,Xt,{match:/\$[(.]/}]}}function v0(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Jd=v0();function FN(o){Jd=o}var fc={exec:()=>null};function Sh(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 Ki(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(Es.caret,"$1"),t=t.replace(n,r),i},getRegex:()=>new RegExp(t,e)};return i}var Z7=((o="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+o)}catch{return!1}})(),Es={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:Sh(o=>new RegExp(`^ {0,${o}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Sh(o=>new RegExp(`^ {0,${o}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Sh(o=>new RegExp(`^ {0,${o}}(?:\`\`\`|~~~)`)),headingBeginRegex:Sh(o=>new RegExp(`^ {0,${o}}#`)),htmlBeginRegex:Sh(o=>new RegExp(`^ {0,${o}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Sh(o=>new RegExp(`^ {0,${o}}>`))},X7=/^(?:[ \t]*(?:\n|$))+/,Y7=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Q7=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ap=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,J7=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,b0=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,HN=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,WN=Ki(HN).replace(/bull/g,b0).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(),e8=Ki(HN).replace(/bull/g,b0).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(),w0=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,t8=/^[^\n]+/,y0=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,i8=Ki(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",y0).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),n8=Ki(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,b0).getRegex(),sw="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",S0=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,s8=Ki("^ {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",S0).replace("tag",sw).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),BN=Ki(w0).replace("hr",Ap).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",sw).getRegex(),o8=Ki(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",BN).getRegex(),C0={blockquote:o8,code:Y7,def:i8,fences:Q7,heading:J7,hr:Ap,html:s8,lheading:WN,list:n8,newline:X7,paragraph:BN,table:fc,text:t8},Uk=Ki("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ap).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",sw).getRegex(),r8={...C0,lheading:e8,table:Uk,paragraph:Ki(w0).replace("hr",Ap).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Uk).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",sw).getRegex()},a8={...C0,html:Ki(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",S0).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:fc,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ki(w0).replace("hr",Ap).replace("heading",` *#{1,6} *[^
77
+ ]`).replace("lheading",WN).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},l8=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,c8=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,zN=/^( {2,}|\\)\n(?!\s*$)/,d8=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,rg=/[\p{P}\p{S}]/u,ow=/[\s\p{P}\p{S}]/u,x0=/[^\s\p{P}\p{S}]/u,h8=Ki(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ow).getRegex(),VN=/(?!~)[\p{P}\p{S}]/u,u8=/(?!~)[\s\p{P}\p{S}]/u,g8=/(?:[^\s\p{P}\p{S}]|~)/u,f8=Ki(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Z7?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),UN=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,p8=Ki(UN,"u").replace(/punct/g,rg).getRegex(),m8=Ki(UN,"u").replace(/punct/g,VN).getRegex(),jN="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",_8=Ki(jN,"gu").replace(/notPunctSpace/g,x0).replace(/punctSpace/g,ow).replace(/punct/g,rg).getRegex(),v8=Ki(jN,"gu").replace(/notPunctSpace/g,g8).replace(/punctSpace/g,u8).replace(/punct/g,VN).getRegex(),b8=Ki("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,x0).replace(/punctSpace/g,ow).replace(/punct/g,rg).getRegex(),w8=Ki(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,rg).getRegex(),y8="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",S8=Ki(y8,"gu").replace(/notPunctSpace/g,x0).replace(/punctSpace/g,ow).replace(/punct/g,rg).getRegex(),C8=Ki(/\\(punct)/,"gu").replace(/punct/g,rg).getRegex(),x8=Ki(/^<(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(),L8=Ki(S0).replace("(?:-->|$)","-->").getRegex(),I8=Ki("^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",L8).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),fv=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,k8=Ki(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",fv).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),$N=Ki(/^!?\[(label)\]\[(ref)\]/).replace("label",fv).replace("ref",y0).getRegex(),qN=Ki(/^!?\[(ref)\](?:\[\])?/).replace("ref",y0).getRegex(),D8=Ki("reflink|nolink(?!\\()","g").replace("reflink",$N).replace("nolink",qN).getRegex(),jk=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,L0={_backpedal:fc,anyPunctuation:C8,autolink:x8,blockSkip:f8,br:zN,code:c8,del:fc,delLDelim:fc,delRDelim:fc,emStrongLDelim:p8,emStrongRDelimAst:_8,emStrongRDelimUnd:b8,escape:l8,link:k8,nolink:qN,punctuation:h8,reflink:$N,reflinkSearch:D8,tag:I8,text:d8,url:fc},E8={...L0,link:Ki(/^!?\[(label)\]\((.*?)\)/).replace("label",fv).getRegex(),reflink:Ki(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",fv).getRegex()},Px={...L0,emStrongRDelimAst:v8,emStrongLDelim:m8,delLDelim:w8,delRDelim:S8,url:Ki(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",jk).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:Ki(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",jk).getRegex()},P8={...Px,br:Ki(zN).replace("{2,}","*").getRegex(),text:Ki(Px.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Sm={normal:C0,gfm:r8,pedantic:a8},Lg={normal:L0,gfm:Px,breaks:P8,pedantic:E8},T8={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},$k=o=>T8[o];function Tr(o,e){if(e){if(Es.escapeTest.test(o))return o.replace(Es.escapeReplace,$k)}else if(Es.escapeTestNoEncode.test(o))return o.replace(Es.escapeReplaceNoEncode,$k);return o}function qk(o){try{o=encodeURI(o).replace(Es.percentDecode,"%")}catch{return null}return o}function Kk(o,e){var s;let t=o.replace(Es.findPipe,(r,a,c)=>{let h=!1,u=a;for(;--u>=0&&c[u]==="\\";)h=!h;return h?"|":" |"}),i=t.split(Es.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(Es.slashPipe,"|");return i}function nl(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 Gk(o){let e=o.split(`
78
+ `),t=e.length-1;for(;t>=0&&Es.blankLine.test(e[t]);)t--;return e.length-t<=2?o:e.slice(0,t+1).join(`
79
+ `)}function M8(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 N8(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 Zk(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 c={type:o[0].charAt(0)==="!"?"image":"link",raw:t,href:s,title:r,text:a,tokens:i.inlineTokens(a)};return i.state.inLink=!1,c}function R8(o,e,t){let i=o.match(t.other.indentCodeCompensation);if(i===null)return e;let n=i[1];return e.split(`
80
+ `).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(`
81
+ `)}var pv=class{constructor(o){vi(this,"options");vi(this,"rules");vi(this,"lexer");this.options=o||Jd}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]:Gk(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=R8(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=nl(t,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(t=i.trim())}return{type:"heading",raw:nl(e[0],`
82
+ `),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:nl(e[0],`
83
+ `)}}blockquote(o){let e=this.rules.block.blockquote.exec(o);if(e){let t=nl(e[0],`
84
+ `).split(`
85
+ `),i="",n="",s=[];for(;t.length>0;){let r=!1,a=[],c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))a.push(t[c]),r=!0;else if(!r)a.push(t[c]);else break;t=t.slice(c);let h=a.join(`
86
+ `),u=h.replace(this.rules.other.blockquoteSetextReplace,`
87
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
88
+ ${h}`:h,n=n?`${n}
89
+ ${u}`:u;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,s,!0),this.lexer.state.top=g,t.length===0)break;let f=s.at(-1);if((f==null?void 0:f.type)==="code")break;if((f==null?void 0:f.type)==="blockquote"){let v=f,_=v.raw+`
90
+ `+t.join(`
91
+ `),y=this.blockquote(_);s[s.length-1]=y,i=i.substring(0,i.length-v.raw.length)+y.raw,n=n.substring(0,n.length-v.text.length)+y.text;break}else if((f==null?void 0:f.type)==="list"){let v=f,_=v.raw+`
92
+ `+t.join(`
93
+ `),y=this.list(_);s[s.length-1]=y,i=i.substring(0,i.length-f.raw.length)+y.raw,n=n.substring(0,n.length-v.raw.length)+y.raw,t=_.substring(s.at(-1).raw.length).split(`
94
+ `);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 c=!1,h="",u="";if(!(e=s.exec(o))||this.rules.block.hr.test(o))break;h=e[0],o=o.substring(h.length);let g=N8(e[2].split(`
95
+ `,1)[0],e[1].length),f=o.split(`
96
+ `,1)[0],v=!g.trim(),_=0;if(this.options.pedantic?(_=2,u=g.trimStart()):v?_=e[1].length+1:(_=g.search(this.rules.other.nonSpaceChar),_=_>4?1:_,u=g.slice(_),_+=e[1].length),v&&this.rules.other.blankLine.test(f)&&(h+=f+`
97
+ `,o=o.substring(f.length+1),c=!0),!c){let y=this.rules.other.nextBulletRegex(_),S=this.rules.other.hrRegex(_),x=this.rules.other.fencesBeginRegex(_),E=this.rules.other.headingBeginRegex(_),M=this.rules.other.htmlBeginRegex(_),F=this.rules.other.blockquoteBeginRegex(_);for(;o;){let R=o.split(`
98
+ `,1)[0],Z;if(f=R,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),Z=f):Z=f.replace(this.rules.other.tabCharGlobal," "),x.test(f)||E.test(f)||M.test(f)||F.test(f)||y.test(f)||S.test(f))break;if(Z.search(this.rules.other.nonSpaceChar)>=_||!f.trim())u+=`
99
+ `+Z.slice(_);else{if(v||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||x.test(g)||E.test(g)||S.test(g))break;u+=`
100
+ `+f}v=!f.trim(),h+=R+`
101
+ `,o=o.substring(R.length+1),g=Z.slice(_)}}n.loose||(r?n.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(r=!0)),n.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),n.raw+=h}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 c of n.items){this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]);let h=c.tokens[0];if(c.task&&((h==null?void 0:h.type)==="text"||(h==null?void 0:h.type)==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),h.raw=h.raw.replace(this.rules.other.listReplaceTask,""),h.text=h.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 u=this.rules.other.listTaskCheckbox.exec(c.raw);if(u){let g={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};c.checked=g.checked,n.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=g.raw+c.tokens[0].raw,c.tokens[0].text=g.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(g)):c.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):c.tokens.unshift(g)}}else c.task&&(c.task=!1);if(!n.loose){let u=c.tokens.filter(f=>f.type==="space"),g=u.length>0&&u.some(f=>this.rules.other.anyLine.test(f.raw));n.loose=g}}if(n.loose)for(let c of n.items){c.loose=!0;for(let h of c.tokens)h.type==="text"&&(h.type="paragraph")}return n}}html(o){let e=this.rules.block.html.exec(o);if(e){let t=Gk(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:nl(e[0],`
102
+ `),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=Kk(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(`
103
+ `):[],s={type:"table",raw:nl(e[0],`
104
+ `),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(Kk(a,s.header.length).map((c,h)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:s.align[h]})));return s}}lheading(o){let e=this.rules.block.lheading.exec(o);if(e){let t=e[1].trim();return{type:"heading",raw:nl(e[0],`
105
+ `),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)===`
106
+ `?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=nl(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=M8(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)),Zk(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 Zk(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,c=0,h=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*o.length+n);(i=h.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)){c+=r;continue}if(a-=r,a>0)continue;r=Math.min(r,r+a+c);let u=[...i[0]][0].length,g=o.slice(0,n+i.index+u+r);if(Math.min(n,r)%2){let v=g.slice(1,-1);return{type:"em",raw:g,text:v,tokens:this.lexer.inlineTokens(v)}}let f=g.slice(2,-2);return{type:"strong",raw:g,text:f,tokens:this.lexer.inlineTokens(f)}}}}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,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*o.length+n);(i=c.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 h=[...i[0]][0].length,u=o.slice(0,n+i.index+h+r),g=u.slice(n,-n);return{type:"del",raw:u,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}}}},rr=class Tx{constructor(e){vi(this,"tokens");vi(this,"options");vi(this,"state");vi(this,"inlineQueue");vi(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Jd,this.options.tokenizer=this.options.tokenizer||new pv,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:Es,block:Sm.normal,inline:Lg.normal};this.options.pedantic?(t.block=Sm.pedantic,t.inline=Lg.pedantic):this.options.gfm&&(t.block=Sm.gfm,this.options.breaks?t.inline=Lg.breaks:t.inline=Lg.gfm),this.tokenizer.rules=t}static get rules(){return{block:Sm,inline:Lg}}static lex(e,t){return new Tx(t).lex(e)}static lexInline(e,t){return new Tx(t).inlineTokens(e)}lex(e){e=e.replace(Es.carriageReturn,`
107
+ `),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(Es.tabCharGlobal," ").replace(Es.spaceLine,""));let n=1/0;for(;e;){if(e.length<n)n=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let c;if((r=(s=this.options.extensions)==null?void 0:s.block)!=null&&r.some(u=>(c=u.call({lexer:this},e,t))?(e=e.substring(c.raw.length),t.push(c),!0):!1))continue;if(c=this.tokenizer.space(e)){e=e.substring(c.raw.length);let u=t.at(-1);c.raw.length===1&&u!==void 0?u.raw+=`
108
+ `:t.push(c);continue}if(c=this.tokenizer.code(e)){e=e.substring(c.raw.length);let u=t.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
109
+ `)?"":`
110
+ `)+c.raw,u.text+=`
111
+ `+c.text,this.inlineQueue.at(-1).src=u.text):t.push(c);continue}if(c=this.tokenizer.fences(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.heading(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.hr(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.blockquote(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.list(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.html(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.def(e)){e=e.substring(c.raw.length);let u=t.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
112
+ `)?"":`
113
+ `)+c.raw,u.text+=`
114
+ `+c.raw,this.inlineQueue.at(-1).src=u.text):this.tokens.links[c.tag]||(this.tokens.links[c.tag]={href:c.href,title:c.title},t.push(c));continue}if(c=this.tokenizer.table(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.lheading(e)){e=e.substring(c.raw.length),t.push(c);continue}let h=e;if((a=this.options.extensions)!=null&&a.startBlock){let u=1/0,g=e.slice(1),f;this.options.extensions.startBlock.forEach(v=>{f=v.call({lexer:this},g),typeof f=="number"&&f>=0&&(u=Math.min(u,f))}),u<1/0&&u>=0&&(h=e.substring(0,u+1))}if(this.state.top&&(c=this.tokenizer.paragraph(h))){let u=t.at(-1);i&&(u==null?void 0:u.type)==="paragraph"?(u.raw+=(u.raw.endsWith(`
115
+ `)?"":`
116
+ `)+c.raw,u.text+=`
117
+ `+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):t.push(c),i=h.length!==e.length,e=e.substring(c.raw.length);continue}if(c=this.tokenizer.text(e)){e=e.substring(c.raw.length);let u=t.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
118
+ `)?"":`
119
+ `)+c.raw,u.text+=`
120
+ `+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):t.push(c);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 h,u,g,f,v;this.tokenizer.lexer=this;let i=e,n=null;if(this.tokens.links){let _=Object.keys(this.tokens.links);if(_.length>0)for(;(n=this.tokenizer.rules.inline.reflinkSearch.exec(i))!==null;)_.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=((u=(h=this.options.hooks)==null?void 0:h.emStrongMask)==null?void 0:u.call({lexer:this},i))??i;let r=!1,a="",c=1/0;for(;e;){if(e.length<c)c=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(a=""),r=!1;let _;if((f=(g=this.options.extensions)==null?void 0:g.inline)!=null&&f.some(S=>(_=S.call({lexer:this},e,t))?(e=e.substring(_.raw.length),t.push(_),!0):!1))continue;if(_=this.tokenizer.escape(e)){e=e.substring(_.raw.length),t.push(_);continue}if(_=this.tokenizer.tag(e)){e=e.substring(_.raw.length),t.push(_);continue}if(_=this.tokenizer.link(e)){e=e.substring(_.raw.length),t.push(_);continue}if(_=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(_.raw.length);let S=t.at(-1);_.type==="text"&&(S==null?void 0:S.type)==="text"?(S.raw+=_.raw,S.text+=_.text):t.push(_);continue}if(_=this.tokenizer.emStrong(e,i,a)){e=e.substring(_.raw.length),t.push(_);continue}if(_=this.tokenizer.codespan(e)){e=e.substring(_.raw.length),t.push(_);continue}if(_=this.tokenizer.br(e)){e=e.substring(_.raw.length),t.push(_);continue}if(_=this.tokenizer.del(e,i,a)){e=e.substring(_.raw.length),t.push(_);continue}if(_=this.tokenizer.autolink(e)){e=e.substring(_.raw.length),t.push(_);continue}if(!this.state.inLink&&(_=this.tokenizer.url(e))){e=e.substring(_.raw.length),t.push(_);continue}let y=e;if((v=this.options.extensions)!=null&&v.startInline){let S=1/0,x=e.slice(1),E;this.options.extensions.startInline.forEach(M=>{E=M.call({lexer:this},x),typeof E=="number"&&E>=0&&(S=Math.min(S,E))}),S<1/0&&S>=0&&(y=e.substring(0,S+1))}if(_=this.tokenizer.inlineText(y)){e=e.substring(_.raw.length),_.raw.slice(-1)!=="_"&&(a=_.raw.slice(-1)),r=!0;let S=t.at(-1);(S==null?void 0:S.type)==="text"?(S.raw+=_.raw,S.text+=_.text):t.push(_);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)}},mv=class{constructor(o){vi(this,"options");vi(this,"parser");this.options=o||Jd}space(o){return""}code({text:o,lang:e,escaped:t}){var s;let i=(s=(e||"").match(Es.notSpaceStart))==null?void 0:s[0],n=o.replace(Es.endingNewline,"")+`
121
+ `;return i?'<pre><code class="language-'+Tr(i)+'">'+(t?n:Tr(n,!0))+`</code></pre>
122
+ `:"<pre><code>"+(t?n:Tr(n,!0))+`</code></pre>
123
+ `}blockquote({tokens:o}){return`<blockquote>
124
+ ${this.parser.parse(o)}</blockquote>
125
+ `}html({text:o}){return o}def(o){return""}heading({tokens:o,depth:e}){return`<h${e}>${this.parser.parseInline(o)}</h${e}>
126
+ `}hr(o){return`<hr>
127
+ `}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+`>
128
+ `+i+"</"+n+`>
129
+ `}listitem(o){return`<li>${this.parser.parse(o.tokens)}</li>
130
+ `}checkbox({checked:o}){return"<input "+(o?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:o}){return`<p>${this.parser.parseInline(o)}</p>
131
+ `}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>
132
+ <thead>
133
+ `+e+`</thead>
134
+ `+i+`</table>
135
+ `}tablerow({text:o}){return`<tr>
136
+ ${o}</tr>
137
+ `}tablecell(o){let e=this.parser.parseInline(o.tokens),t=o.header?"th":"td";return(o.align?`<${t} align="${o.align}">`:`<${t}>`)+e+`</${t}>
138
+ `}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>${Tr(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=qk(o);if(n===null)return i;o=n;let s='<a href="'+o+'"';return e&&(s+=' title="'+Tr(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=qk(o);if(n===null)return Tr(t);o=n;let s=`<img src="${o}" alt="${Tr(t)}"`;return e&&(s+=` title="${Tr(e)}"`),s+=">",s}text(o){return"tokens"in o&&o.tokens?this.parser.parseInline(o.tokens):"escaped"in o&&o.escaped?o.text:Tr(o.text)}},I0=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}},ar=class Mx{constructor(e){vi(this,"options");vi(this,"renderer");vi(this,"textRenderer");this.options=e||Jd,this.options.renderer=this.options.renderer||new mv,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new I0}static parse(e,t){return new Mx(t).parse(e)}static parseInline(e,t){return new Mx(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 c=r,h=this.options.extensions.renderers[c.type].call({parser:this},c);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.type)){t+=h||"";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 c='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}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 h=this.options.extensions.renderers[a.type].call({parser:this},a);if(h!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){i+=h||"";continue}}let c=a;switch(c.type){case"escape":{i+=t.text(c);break}case"html":{i+=t.html(c);break}case"link":{i+=t.link(c);break}case"image":{i+=t.image(c);break}case"checkbox":{i+=t.checkbox(c);break}case"strong":{i+=t.strong(c);break}case"em":{i+=t.em(c);break}case"codespan":{i+=t.codespan(c);break}case"br":{i+=t.br(c);break}case"del":{i+=t.del(c);break}case"text":{i+=t.text(c);break}default:{let h='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return i}},xm,Vg=(xm=class{constructor(o){vi(this,"options");vi(this,"block");this.options=o||Jd}preprocess(o){return o}postprocess(o){return o}processAllTokens(o){return o}emStrongMask(o){return o}provideLexer(o=this.block){return o?rr.lex:rr.lexInline}provideParser(o=this.block){return o?ar.parse:ar.parseInline}},vi(xm,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),vi(xm,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),xm),A8=class{constructor(...o){vi(this,"defaults",v0());vi(this,"options",this.setOptions);vi(this,"parse",this.parseMarkdown(!0));vi(this,"parseInline",this.parseMarkdown(!1));vi(this,"Parser",ar);vi(this,"Renderer",mv);vi(this,"TextRenderer",I0);vi(this,"Lexer",rr);vi(this,"Tokenizer",pv);vi(this,"Hooks",Vg);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 c of a)t=t.concat(this.walkTokens(c.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 c=r[a].flat(1/0);t=t.concat(this.walkTokens(c,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 mv(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],c=n[r];n[r]=(...h)=>{let u=a.apply(n,h);return u===!1&&(u=c.apply(n,h)),u||""}}i.renderer=n}if(t.tokenizer){let n=this.defaults.tokenizer||new pv(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],c=n[r];n[r]=(...h)=>{let u=a.apply(n,h);return u===!1&&(u=c.apply(n,h)),u}}i.tokenizer=n}if(t.hooks){let n=this.defaults.hooks||new Vg;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],c=n[r];Vg.passThroughHooks.has(s)?n[r]=h=>{if(this.defaults.async&&Vg.passThroughHooksRespectAsync.has(s))return(async()=>{let g=await a.call(n,h);return c.call(n,g)})();let u=a.call(n,h);return c.call(n,u)}:n[r]=(...h)=>{if(this.defaults.async)return(async()=>{let g=await a.apply(n,h);return g===!1&&(g=await c.apply(n,h)),g})();let u=a.apply(n,h);return u===!1&&(u=c.apply(n,h)),u}}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 rr.lex(o,e??this.defaults)}parser(o,e){return ar.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?rr.lex:rr.lexInline)(r,n),c=n.hooks?await n.hooks.processAllTokens(a):a;n.walkTokens&&await Promise.all(this.walkTokens(c,n.walkTokens));let h=await(n.hooks?await n.hooks.provideParser(o):o?ar.parse:ar.parseInline)(c,n);return n.hooks?await n.hooks.postprocess(h):h})().catch(s);try{n.hooks&&(e=n.hooks.preprocess(e));let r=(n.hooks?n.hooks.provideLexer(o):o?rr.lex:rr.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?ar.parse:ar.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+=`
139
+ Please report this to https://github.com/markedjs/marked.`,o){let i="<p>An error occurred:</p><pre>"+Tr(t.message+"",!0)+"</pre>";return e?Promise.resolve(i):i}if(e)return Promise.reject(t);throw t}}},zd=new A8;function ln(o,e){return zd.parse(o,e)}ln.options=ln.setOptions=function(o){return zd.setOptions(o),ln.defaults=zd.defaults,FN(ln.defaults),ln};ln.getDefaults=v0;ln.defaults=Jd;ln.use=function(...o){return zd.use(...o),ln.defaults=zd.defaults,FN(ln.defaults),ln};ln.walkTokens=function(o,e){return zd.walkTokens(o,e)};ln.parseInline=zd.parseInline;ln.Parser=ar;ln.parser=ar.parse;ln.Renderer=mv;ln.TextRenderer=I0;ln.Lexer=rr;ln.lexer=rr.lex;ln.Tokenizer=pv;ln.Hooks=Vg;ln.parse=ln;ln.options;ln.setOptions;ln.use;ln.walkTokens;ln.parseInline;ar.parse;rr.lex;var O8=B('<span class="chat-model svelte-10ayso4"><!></span>'),F8=B('<button class="clear-btn svelte-10ayso4" title="Clear conversation">✕</button>'),H8=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>'),W8=B('Chatting in context of <code class="svelte-10ayso4"> </code>',1),B8=B('<button class="chip svelte-10ayso4"> </button>'),z8=B('<div class="suggestions svelte-10ayso4"><p class="suggestions-hint svelte-10ayso4"><!></p> <!></div>'),V8=B('<div class="msg-content user-text svelte-10ayso4"> </div>'),Xk=B('<div class="text-block svelte-10ayso4"></div>'),U8=B('<button class="create-btn svelte-10ayso4">Save as new file…</button>'),j8=B('<span class="auto-badge svelte-10ayso4" title="Auto-applying AI code to this script in this session">auto ✓</span>'),$8=B('<button class="apply-auto-btn svelte-10ayso4" title="Apply and always apply for this script in this session">always</button>'),q8=B('<button class="apply-btn svelte-10ayso4">Apply</button> <!>',1),K8=B('<button class="expand-btn svelte-10ayso4"> </button>'),G8=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>'),Z8=B('<div class="msg-content svelte-10ayso4"></div>'),X8=B("<div><!></div>"),Y8=B('<span class="tool-args svelte-10ayso4"> </span>'),Q8=B('<div class="tool-event tool-call svelte-10ayso4"><span class="tool-icon svelte-10ayso4">🔧</span> <span class="tool-name svelte-10ayso4"> </span> <!></div>'),J8=B('<div class="tool-event tool-result svelte-10ayso4"><span class="tool-icon svelte-10ayso4">✓</span> <span class="tool-name svelte-10ayso4"> </span></div>'),eq=B('<div class="tool-events svelte-10ayso4"></div>'),tq=B('<div class="message assistant svelte-10ayso4"><div class="msg-content svelte-10ayso4"><span class="status-shimmer svelte-10ayso4"> </span></div></div>'),iq=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>'),nq=B('<div class="message assistant streaming svelte-10ayso4"><div class="msg-content svelte-10ayso4"></div></div>'),sq=B('<div class="chat-error svelte-10ayso4"> </div>'),oq=B('<button class="stop-btn svelte-10ayso4" title="Stop generation">■</button>'),rq=B('<button class="send-btn svelte-10ayso4">↑</button>'),aq=B('<option class="svelte-10ayso4"> </option>'),lq=B('<select class="model-select svelte-10ayso4"></select>'),cq=B('<span class="model-name svelte-10ayso4"> </span>'),dq=B('<button class="info-btn svelte-10ayso4" title="Model info">ℹ</button>'),hq=B('<div class="model-bar svelte-10ayso4"><span class="model-provider svelte-10ayso4"> </span> <!> <!></div>'),uq=B('<p class="info-status svelte-10ayso4">Loading…</p>'),gq=B('<p class="info-status info-err svelte-10ayso4"> </p>'),fq=B('<dt class="svelte-10ayso4">Ollama version</dt><dd class="svelte-10ayso4"> </dd>',1),pq=B('<dt class="svelte-10ayso4">Family</dt><dd class="svelte-10ayso4"> </dd>',1),mq=B('<dt class="svelte-10ayso4">Parameters</dt><dd class="svelte-10ayso4"> </dd>',1),_q=B('<dt class="svelte-10ayso4">Quantization</dt><dd class="svelte-10ayso4"> </dd>',1),vq=B('<dt class="svelte-10ayso4">Format</dt><dd class="svelte-10ayso4"> </dd>',1),bq=B('<div class="running-model svelte-10ayso4"> </div>'),wq=B('<dt class="svelte-10ayso4">Loaded</dt> <dd class="svelte-10ayso4"></dd>',1),yq=B('<dt class="svelte-10ayso4">Loaded</dt><dd class="dim svelte-10ayso4">Not in memory</dd>',1),Sq=B('<dl class="svelte-10ayso4"><!> <!> <!> <!> <!> <!></dl>'),Cq=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>'),xq=B('<div class="chat-panel svelte-10ayso4"><div class="chat-header svelte-10ayso4"><span class="chat-title svelte-10ayso4">AI Assistant</span> <!> <!></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"/> API ref</label> <label title="Include current MQTT state in context" class="svelte-10ayso4"><input type="checkbox" class="svelte-10ayso4"/> MQTT</label> <label title="Include sheDB document IDs in context" class="svelte-10ayso4"><input type="checkbox" class="svelte-10ayso4"/> DB</label> <label title="Include paired Matter devices in context" class="svelte-10ayso4"><input type="checkbox" class="svelte-10ayso4"/> Matter</label> <label title="Allow the AI to search MQTT topics, read scripts, and fetch logs on demand. Disables real-time streaming." class="svelte-10ayso4"><input type="checkbox" class="svelte-10ayso4"/> 🔧 Tools</label></div> <div class="input-row svelte-10ayso4"><div><textarea rows="3" class="svelte-10ayso4"></textarea></div> <!></div> <!></div> <!>',1);function Lq(o,e){ao(e,!0),gv.registerLanguage("javascript",ON),ln.use({breaks:!0,gfm:!0});let t=xf(e,"currentScript",3,null),i=j(Li([])),n=j(null),s=j(""),r=j(!1),a=j(""),c=j(null),h=j(Li([])),u=j(Li(localStorage.getItem("she:selectedModel")??"")),g=j(null);const f=Vt(()=>{var V;return m(g)!==null&&((V=t())==null?void 0:V.path)===m(g)});let v=j(Li(new Set)),_=j(!1),y=j(null),S=j(!1),x=j(""),E=null,M=j(0);const F=["[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 R=j(!0),Z=j(!1),q=j(!1),he=j(!1),pe=j(!1),Ce=j(Li([])),Pe,je;const qt=Vt(()=>({apiref:m(R),mqtt:m(Z),shedb:m(q),matter:m(he),tools:m(pe)})),Ge=Vt(()=>{var V;return((V=m(c))==null?void 0:V.configured)??!1});kn(()=>{var ue;const V=(ue=t())==null?void 0:ue.path;m(g)!==null&&V!==m(g)&&I(g,null)}),kn(()=>{var Me;if(!m(f))return;const V=m(i).at(-1);if(!V||V.role!=="assistant")return;const Le=Xt(V.content).find(Oe=>Oe.type==="code"&&Tt(Oe.lang));if(Le){const Oe=Lt(Le.text);(Me=e.onApply)==null||Me.call(e,Oe?Oe.code:Le.text)}}),kn(()=>{IN().then(V=>{I(c,V,!0),V.configured&&!m(u)&&I(u,V.model,!0)}).catch(()=>{})}),kn(()=>{m(u)&&localStorage.setItem("she:selectedModel",m(u))}),kn(()=>{var V;(V=m(c))!=null&&V.configured&&kN().then(ue=>{I(h,ue.models,!0)}).catch(()=>{})}),kn(()=>{m(u),I(y,null),I(x,"")}),kn(()=>{if(!m(r))return;I(M,Math.floor(Math.random()*F.length),!0);const V=setInterval(()=>{I(M,(m(M)+1)%F.length)},1e4);return()=>clearInterval(V)}),kn(()=>{var V;je&&(m(i).length+(((V=m(n))==null?void 0:V.length)??0),requestAnimationFrame(()=>{je&&(je.scrollTop=je.scrollHeight)}))});function Xt(V){const ue=V.replace(/(\n|^)(\/{2} @[a-z-]+:[^\n]+)\n(```\w*)\n/g,`$1$3
140
+ $2
141
+ `),Le=[],Me=/```(\w*)\n([\s\S]*?)```/g;let Oe=0,Ze;for(;(Ze=Me.exec(ue))!==null;)Ze.index>Oe&&Le.push({type:"text",text:ue.slice(Oe,Ze.index)}),Le.push({type:"code",lang:Ze[1]||"text",text:Ze[2].trimEnd()}),Oe=Ze.index+Ze[0].length;return Oe<ue.length&&Le.push({type:"text",text:ue.slice(Oe)}),Le}const pt=15;function Kt(V){return V.split(`
142
+ `).length>pt}function ae(V){const ue=new Set(m(v));ue.has(V)?ue.delete(V):ue.add(V),I(v,ue,!0)}function Te(V,ue){if(Tt(ue))try{return gv.highlight(V,{language:"javascript"}).value}catch{}return V.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ve(V){return ln.parse(V)}function lt(V){const ue=V.replace(/(\n|^)(\/{2} @[a-z-]+:[^\n]+)\n(```\w*)\n/g,`$1$3
143
+ $2
144
+ `),Le=[],Me=/```(\w*)\n([\s\S]*?)```/g;let Oe=0,Ze;for(;(Ze=Me.exec(ue))!==null;)Ze.index>Oe&&Le.push({type:"text",text:ue.slice(Oe,Ze.index)}),Le.push({type:"code",lang:Ze[1]||"text",text:Ze[2].trimEnd()}),Oe=Ze.index+Ze[0].length;const bt=ue.slice(Oe),Dt=bt.match(/```(\w*)\n([\s\S]*)$/);return Dt?(Dt.index>0&&Le.push({type:"text",text:bt.slice(0,Dt.index)}),Le.push({type:"code",lang:Dt[1]||"text",text:Dt[2]})):bt&&Le.push({type:"text",text:bt}),Le}function Qt(V){navigator.clipboard.writeText(V).catch(()=>{})}function It(V,ue=!1){var Le;ue&&t()&&I(g,t().path,!0),(Le=e.onApply)==null||Le.call(e,V)}function Tt(V){return!V||V==="js"||V==="javascript"}function Lt(V){const ue=V.match(/^\/\/ @new-file:\s*(\S+\.js)[ \t]*\n/);return ue?{filename:ue[1],code:V.slice(ue[0].length)}:null}function gt(V){return V>=1e9?`${(V/1e9).toFixed(1)} GB`:V>=1e6?`${(V/1e6).toFixed(0)} MB`:`${V} B`}async function Oi(){if(I(_,!0),!(m(y)||m(S))){I(S,!0),I(x,"");try{I(y,await DN(m(u)||m(c).model),!0)}catch(V){I(x,V.message,!0)}I(S,!1)}}async function Gt(){const V=m(s).trim();if(!V||m(r))return;I(s,""),I(a,""),I(r,!0);const ue={role:"user",content:V};I(i,[...m(i),ue],!0),E=new AbortController,I(Ce,[],!0);try{await EN({messages:m(i),currentScript:t(),context:m(qt),modelOverride:m(u)||void 0},Le=>{I(n,(m(n)??"")+Le)},E.signal,Le=>{I(Ce,[...m(Ce),Le],!0)}),I(i,[...m(i),{role:"assistant",content:m(n)??""}],!0)}catch(Le){if(Le.name==="AbortError"){const Me=m(n);Me&&Me.trim()&&I(i,[...m(i),{role:"assistant",content:Me+`
145
+
146
+ *[stopped]*`}],!0)}else I(a,Le.message,!0)}finally{E=null,I(n,null),I(r,!1)}}function Ae(){E==null||E.abort()}function Be(V){V.key==="Enter"&&!V.shiftKey&&(V.preventDefault(),Gt())}function Mt(){I(i,[],!0),I(a,"")}const kt=["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 pi(V){I(s,V,!0),Pe==null||Pe.focus()}var Nt=xq(),mi=Wt(Nt),Mi=k(mi),Ui=D(k(Mi),2);{var Fi=V=>{var ue=O8(),Le=k(ue);{var Me=Ze=>{var bt=Ma();se(()=>oe(bt,`${m(c).provider??""} · ${(m(u)||m(c).model)??""}`)),N(Ze,bt)},Oe=Ze=>{var bt=Ma("Not configured");N(Ze,bt)};J(Le,Ze=>{m(Ge)?Ze(Me):Ze(Oe,-1)})}se(()=>is(ue,"title",`Provider: ${m(c).provider??""}`)),N(V,ue)};J(Ui,V=>{m(c)&&V(Fi)})}var yi=D(Ui,2);{var cn=V=>{var ue=F8();de("click",ue,Mt),N(V,ue)};J(yi,V=>{m(i).length>0&&V(cn)})}var Zi=D(Mi,2),rn=k(Zi);{var bn=V=>{var ue=H8();N(V,ue)},_i=V=>{var ue=z8(),Le=k(ue),Me=k(Le);{var Oe=Dt=>{var Ht=W8(),ct=D(Wt(Ht)),me=k(ct);se(Ne=>oe(me,Ne),[()=>t().path.split("/").pop()]),N(Dt,Ht)},Ze=Dt=>{var Ht=Ma("No script open. Ask a general she scripting question.");N(Dt,Ht)};J(Me,Dt=>{t()?Dt(Oe):Dt(Ze,-1)})}var bt=D(Le,2);an(bt,17,()=>kt,ks,(Dt,Ht)=>{var ct=B8(),me=k(ct);se(()=>oe(me,m(Ht))),de("click",ct,()=>pi(m(Ht))),N(Dt,ct)}),N(V,ue)};J(rn,V=>{m(Ge)?m(i).length===0&&m(n)===null&&V(_i,1):V(bn)})}var _n=D(rn,2);an(_n,17,()=>m(i),ks,(V,ue,Le)=>{var Me=X8(),Oe=k(Me);{var Ze=Dt=>{var Ht=V8(),ct=k(Ht);se(()=>oe(ct,m(ue).content)),N(Dt,Ht)},bt=Dt=>{const Ht=Vt(()=>Xt(m(ue).content));var ct=Z8();an(ct,21,()=>m(Ht),ks,(me,Ne,De)=>{var ze=_s(),Ct=Wt(ze);{var et=at=>{var mt=Xk();_l(mt,()=>ve(m(Ne).text),!0),N(at,mt)},tt=at=>{const mt=Vt(()=>Tt(m(Ne).lang)?Lt(m(Ne).text):null),ui=Vt(()=>m(mt)?m(mt).code:m(Ne).text),ce=Vt(()=>`${Le}:${De}`),He=Vt(()=>Kt(m(ui))),dt=Vt(()=>m(v).has(m(ce)));var At=G8(),ei=k(At),ht=k(ei),st=k(ht),Ye=D(ht,2),Ee=k(Ye),Ot=D(Ee,2);{var Re=Et=>{var Qi=U8();de("click",Qi,()=>e.onCreateFile(m(mt).filename,m(mt).code)),N(Et,Qi)},Fe=Et=>{var Qi=q8(),Tn=Wt(Qi),Ft=D(Tn,2);{var Zo=Ci=>{var Os=j8();N(Ci,Os)},wn=Ci=>{var Os=$8();de("click",Os,()=>It(m(Ne).text,!0)),N(Ci,Os)};J(Ft,Ci=>{m(f)?Ci(Zo):Ci(wn,-1)})}de("click",Tn,()=>It(m(Ne).text)),N(Et,Qi)},zt=Vt(()=>Tt(m(Ne).lang)&&t());J(Ot,Et=>{m(mt)&&e.onCreateFile?Et(Re):m(zt)&&Et(Fe,1)})}var Yi=D(ei,2);let Ln;var un=k(Yi),Go=k(un);_l(Go,()=>Te(m(ui),m(Ne).lang??""),!0);var cs=D(un,2);{var ds=Et=>{var Qi=K8(),Tn=k(Qi);se(()=>oe(Tn,m(dt)?"▲ collapse":"▼ expand")),de("click",Qi,()=>ae(m(ce))),N(Et,Qi)};J(cs,Et=>{m(He)&&Et(ds)})}se(()=>{oe(st,m(mt)?`new: ${m(mt).filename}`:m(Ne).lang),Ln=ti(Yi,1,"code-body svelte-10ayso4",null,Ln,{collapsed:m(He)&&!m(dt)})}),de("click",Ee,()=>Qt(m(ui))),N(at,At)};J(Ct,at=>{m(Ne).type==="text"?at(et):at(tt,-1)})}N(me,ze)}),N(Dt,ct)};J(Oe,Dt=>{m(ue).role==="user"?Dt(Ze):Dt(bt,-1)})}se(()=>ti(Me,1,`message ${m(ue).role??""}`,"svelte-10ayso4")),N(V,Me)});var ki=D(_n,2);{var Ni=V=>{var ue=eq();an(ue,21,()=>m(Ce),ks,(Le,Me)=>{var Oe=_s(),Ze=Wt(Oe);{var bt=Ht=>{var ct=Q8(),me=D(k(ct),2),Ne=k(me),De=D(me,2);{var ze=et=>{var tt=Y8(),at=k(tt);se(mt=>oe(at,mt),[()=>Object.entries(m(Me).args).map(([mt,ui])=>`${mt}=${JSON.stringify(ui)}`).join(", ")]),N(et,tt)},Ct=Vt(()=>m(Me).args&&Object.keys(m(Me).args).length>0);J(De,et=>{m(Ct)&&et(ze)})}se(et=>oe(Ne,et),[()=>m(Me).name.replace(/_/g," ")]),N(Ht,ct)},Dt=Ht=>{var ct=J8(),me=D(k(ct),2),Ne=k(me);se(De=>oe(Ne,De),[()=>m(Me).name.replace(/_/g," ")]),N(Ht,ct)};J(Ze,Ht=>{m(Me).type==="tool_call"?Ht(bt):Ht(Dt,-1)})}N(Le,Oe)}),N(V,ue)};J(ki,V=>{m(Ce).length>0&&V(Ni)})}var fn=D(ki,2);{var On=V=>{var ue=tq(),Le=k(ue),Me=k(Le),Oe=k(Me);se(()=>oe(Oe,F[m(M)])),N(V,ue)};J(fn,V=>{m(r)&&m(n)===null&&V(On)})}var Vn=D(fn,2);{var Un=V=>{var ue=nq(),Le=k(ue);an(Le,21,()=>lt(m(n)),ks,(Me,Oe)=>{var Ze=_s(),bt=Wt(Ze);{var Dt=ct=>{var me=Xk();_l(me,()=>ve(m(Oe).text),!0),N(ct,me)},Ht=ct=>{var me=iq(),Ne=k(me),De=k(Ne),ze=k(De),Ct=D(Ne,2),et=k(Ct);_l(et,()=>Te(m(Oe).text,m(Oe).lang??""),!0),se(()=>oe(ze,m(Oe).lang)),N(ct,me)};J(bt,ct=>{m(Oe).type==="text"?ct(Dt):ct(Ht,-1)})}N(Me,Ze)}),N(V,ue)};J(Vn,V=>{m(n)!==null&&V(Un)})}bo(Zi,V=>je=V,()=>je);var Jt=D(Zi,2);{var be=V=>{var ue=sq(),Le=k(ue);se(()=>oe(Le,m(a))),N(V,ue)};J(Jt,V=>{m(a)&&V(be)})}var K=D(Jt,2),Ie=k(K),nt=k(Ie),Rt=D(Ie,2),vt=k(Rt),rt=D(Rt,2),ni=k(rt),ri=D(rt,2),Xi=k(ri),Hi=D(ri,2),A=k(Hi),te=D(K,2),H=k(te);let ee;var ke=k(H);bo(ke,V=>Pe=V,()=>Pe);var Ue=D(H,2);{var z=V=>{var ue=oq();de("click",ue,Ae),N(V,ue)},$=V=>{var ue=rq();se(Le=>ue.disabled=Le,[()=>!m(s).trim()||!m(Ge)]),de("click",ue,Gt),N(V,ue)};J(Ue,V=>{m(r)?V(z):V($,-1)})}var re=D(te,2);{var xe=V=>{var ue=hq(),Le=k(ue),Me=k(Le),Oe=D(Le,2);{var Ze=ct=>{var me=lq();an(me,21,()=>m(h),ks,(Ne,De)=>{var ze=aq(),Ct=k(ze),et={};se(()=>{oe(Ct,m(De)),et!==(et=m(De))&&(ze.value=(ze.__value=m(De))??"")}),N(Ne,ze)}),se(()=>me.disabled=m(r)),vl(me,()=>m(u),Ne=>I(u,Ne)),N(ct,me)},bt=ct=>{var me=cq(),Ne=k(me);se(()=>oe(Ne,m(u)||m(c).model)),N(ct,me)};J(Oe,ct=>{m(h).length>0?ct(Ze):ct(bt,-1)})}var Dt=D(Oe,2);{var Ht=ct=>{var me=dq();de("click",me,Oi),N(ct,me)};J(Dt,ct=>{m(c).provider==="ollama"&&ct(Ht)})}se(()=>oe(Me,m(c).provider)),N(V,ue)};J(re,V=>{m(Ge)&&m(c)&&V(xe)})}var _e=D(mi,2);{var X=V=>{var ue=Cq(),Le=k(ue),Me=k(Le),Oe=k(Me),Ze=k(Oe),bt=D(Oe,2),Dt=D(Me,2),Ht=k(Dt);{var ct=De=>{var ze=uq();N(De,ze)},me=De=>{var ze=gq(),Ct=k(ze);se(()=>oe(Ct,m(x))),N(De,ze)},Ne=De=>{var ze=Sq(),Ct=k(ze);{var et=Ye=>{var Ee=fq(),Ot=D(Wt(Ee)),Re=k(Ot);se(()=>oe(Re,m(y).version)),N(Ye,Ee)};J(Ct,Ye=>{m(y).version&&Ye(et)})}var tt=D(Ct,2);{var at=Ye=>{var Ee=pq(),Ot=D(Wt(Ee)),Re=k(Ot);se(()=>oe(Re,m(y).details.family)),N(Ye,Ee)};J(tt,Ye=>{var Ee;(Ee=m(y).details)!=null&&Ee.family&&Ye(at)})}var mt=D(tt,2);{var ui=Ye=>{var Ee=mq(),Ot=D(Wt(Ee)),Re=k(Ot);se(()=>oe(Re,m(y).details.parameter_size)),N(Ye,Ee)};J(mt,Ye=>{var Ee;(Ee=m(y).details)!=null&&Ee.parameter_size&&Ye(ui)})}var ce=D(mt,2);{var He=Ye=>{var Ee=_q(),Ot=D(Wt(Ee)),Re=k(Ot);se(()=>oe(Re,m(y).details.quantization_level)),N(Ye,Ee)};J(ce,Ye=>{var Ee;(Ee=m(y).details)!=null&&Ee.quantization_level&&Ye(He)})}var dt=D(ce,2);{var At=Ye=>{var Ee=vq(),Ot=D(Wt(Ee)),Re=k(Ot);se(()=>oe(Re,m(y).details.format)),N(Ye,Ee)};J(dt,Ye=>{var Ee;(Ee=m(y).details)!=null&&Ee.format&&Ye(At)})}var ei=D(dt,2);{var ht=Ye=>{var Ee=wq(),Ot=D(Wt(Ee),2);an(Ot,21,()=>m(y).running,ks,(Re,Fe)=>{var zt=bq(),Yi=k(zt);se(Ln=>oe(Yi,`${m(Fe).name??""} · ${Ln??""} VRAM`),[()=>gt(m(Fe).size_vram)]),N(Re,zt)}),N(Ye,Ee)},st=Ye=>{var Ee=yq();N(Ye,Ee)};J(ei,Ye=>{m(y).running&&m(y).running.length>0?Ye(ht):m(y).running!==null&&Ye(st,1)})}N(De,ze)};J(Ht,De=>{m(S)?De(ct):m(x)?De(me,1):m(y)&&De(Ne,2)})}se(()=>{var De;return oe(Ze,`Ollama · ${(m(u)||((De=m(c))==null?void 0:De.model))??""}`)}),de("click",ue,()=>I(_,!1)),de("click",Le,De=>De.stopPropagation()),de("click",bt,()=>I(_,!1)),N(V,ue)};J(_e,V=>{m(_)&&V(X)})}se(()=>{ee=ti(H,1,"textarea-wrap svelte-10ayso4",null,ee,{loading:m(r)}),is(ke,"placeholder",m(Ge)?"Ask anything… (Enter to send, Shift+Enter for newline)":"AI not configured"),ke.disabled=m(r)||!m(Ge)}),ms(nt,()=>m(R),V=>I(R,V)),ms(vt,()=>m(Z),V=>I(Z,V)),ms(ni,()=>m(q),V=>I(q,V)),ms(Xi,()=>m(he),V=>I(he,V)),ms(A,()=>m(pe),V=>I(pe,V)),de("keydown",ke,Be),Bi(ke,()=>m(s),V=>I(s,V)),N(o,Nt),lo()}Ko(["click","keydown"]);const Iq={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"]},kq={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 Nx=[],Rx=[],Ax=[];const _v=new Map;let KN=[];async function Yk(){try{Nx=(await LN()).map(e=>e.topic)}catch{}}async function Qk(){try{const[o,e]=await Promise.all([yN(),SN()]);Rx=o,Ax=e}catch{}}async function Jk(){try{const o=await CN();KN=o.map(e=>e.nodeId),await Promise.all(o.map(async e=>{if(!_v.has(e.nodeId))try{_v.set(e.nodeId,await xN(e.nodeId))}catch{}}))}catch{}}function Dq(o){const e=/(?:she\.mqtt\.(?:sub|pub|get|set|link|age|getProp)|she\.(?:link|age|getValue|setValue|getProp|combineBool|combineMax|timer))\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*$/,c=o.match(a);if(c){const h=c[1],u=Eq(h),g=Pq(h);if(u===0)return{type:"matter-nodeId",prefix:g};if(u===1){const f=Cm(h,0);if(f)return{type:"matter-endpointId",nodeId:f}}if(u===2){const f=Cm(h,0),v=eD(h,1);if(f&&v!==null)return{type:"matter-cluster",nodeId:f,endpointId:v}}if(u>=3){const f=Cm(h,0),v=eD(h,1),_=Cm(h,2),y=/she\.matter\.send\s*\(/.test(o);if(f&&v!==null&&_)return{type:"matter-attr",nodeId:f,endpointId:v,cluster:_,isSend:y}}}return null}function Eq(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 Pq(o){const e=o.match(/['"]([^'"]*)\s*$/);return e?e[1]:""}function Cm(o,e){var s;const i=(s=GN(o)[e])==null?void 0:s.trim();if(!i)return null;const n=i.match(/^['"](.*)['"]$/);return n?n[1]:null}function eD(o,e){var s;const i=(s=GN(o)[e])==null?void 0:s.trim();if(!i)return null;const n=parseInt(i,10);return isNaN(n)?null:n}function GN(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 Vd=uc.CompletionItemKind;function Tq(o,e){return(e?Nx.filter(i=>i.startsWith(e)):Nx).map(i=>({label:i,kind:Vd.Value,insertText:i,range:o,detail:"MQTT topic",sortText:"0"+i}))}function Mq(o,e,t){const i=t?[...Rx,...Ax]:Rx;return(e?i.filter(s=>s.startsWith(e)):i).map(s=>({label:s,kind:Vd.Value,insertText:s,range:o,detail:Ax.includes(s)?"sheDB view":"sheDB document",sortText:"0"+s}))}function Nq(o,e){return KN.filter(t=>t.startsWith(e)).map(t=>({label:t,kind:Vd.Value,insertText:t,range:o,detail:"Matter node",sortText:"0"+t}))}function Rq(o,e){const t=_v.get(e);return t?t.endpoints.map(i=>({label:String(i.endpointId),kind:Vd.Value,insertText:String(i.endpointId),range:o,detail:`Endpoint — clusters: ${i.clusters.join(", ")}`,sortText:"0"+String(i.endpointId).padStart(4,"0")})):[]}function Aq(o,e,t){const i=_v.get(e);if(!i)return[];const n=i.endpoints.find(s=>s.endpointId===t);return n?n.clusters.map(s=>({label:s,kind:Vd.Value,insertText:s,range:o,detail:"Matter cluster",sortText:"0"+s})):[]}function Oq(o,e,t){return(t?kq[e]??[]:Iq[e]??[]).map(n=>({label:n,kind:t?Vd.Function:Vd.Property,insertText:n,range:o,detail:t?`${e} command`:`${e} attribute`,sortText:"0"+n}))}function Fq(){Yk(),Qk(),Jk(),setInterval(Yk,15e3),setInterval(Qk,1e4),setInterval(Jk,6e4),uc.registerCompletionItemProvider("javascript",{triggerCharacters:["'",'"',"(",","," "],provideCompletionItems(o,e){const t=o.getValueInRange({startLineNumber:e.lineNumber,startColumn:1,endLineNumber:e.lineNumber,endColumn:e.column}),i=Dq(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:Tq(a,i.prefix)};case"db":return{suggestions:Mq(a,i.prefix,i.includeViews)};case"matter-nodeId":return{suggestions:Nq(a,i.prefix)};case"matter-endpointId":return{suggestions:Rq(a,i.nodeId)};case"matter-cluster":return{suggestions:Aq(a,i.nodeId,i.endpointId)};case"matter-attr":return{suggestions:Oq(a,i.cluster,i.isSend)};default:return null}}})}var Hq=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>',1),Wq=B('<button class="svelte-1pyfjii">Open</button> <button class="svelte-1pyfjii">Rename…</button> <hr class="svelte-1pyfjii"/> <button class="danger svelte-1pyfjii">Delete</button>',1),Bq=B('<div class="ctx-backdrop svelte-1pyfjii" role="presentation"></div> <div class="ctx-menu svelte-1pyfjii"><!></div>',1),zq=B('<ul class="tree-children svelte-1pyfjii"></ul>'),Vq=B('<li class="tree-dir svelte-1pyfjii"><div role="treeitem" tabindex="-1"><button>›</button> <span role="button" tabindex="0"> </span> <label class="lib-label svelte-1pyfjii"><input type="checkbox" class="svelte-1pyfjii"/> lib<span class="lib-info svelte-1pyfjii" title="Library directory — files here are not auto-loaded as scripts">ⓘ</span></label></div> <!></li>'),Uq=B('<span class="dirty-dot svelte-1pyfjii">●</span>'),jq=B('<span class="err-dot svelte-1pyfjii">●</span>'),$q=B('<li draggable="true"><button><span> </span> <span class="fname svelte-1pyfjii"> </span> <!> <!></button></li>'),qq=B('<div class="err svelte-1pyfjii"> </div>'),Kq=B('<span class="tab-dirty svelte-1pyfjii">●</span>'),Gq=B('<div role="button" tabindex="0"><span class="tab-label svelte-1pyfjii"> </span> <!> <button class="tab-close svelte-1pyfjii" title="Close">×</button></div>'),Zq=B('<div class="tab-bar svelte-1pyfjii"></div>'),Xq=B('<span class="git-changes svelte-1pyfjii"> </span>'),Yq=B('<span class="git-ahead svelte-1pyfjii"> </span>'),Qq=B('<span class="git-behind svelte-1pyfjii"> </span>'),Jq=B('<span class="git-status svelte-1pyfjii"><span class="git-branch svelte-1pyfjii"> </span> <!> <!> <!></span>'),eK=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 & Commit</button> <button class="svelte-1pyfjii">Push</button></div>',1),tK=B('<button class="danger svelte-1pyfjii">Delete</button>'),iK=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,
147
+ 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" target="_blank" rel="noopener" class="svelte-1pyfjii">README</a></div></div></div>`),nK=B('<button class="svelte-1pyfjii">Always accept in this session</button>'),sK=B('<button class="svelte-1pyfjii">Disable auto-accept</button>'),oK=B('<div class="split-backdrop svelte-1pyfjii" role="presentation"></div> <div class="split-menu svelte-1pyfjii"><!></div>',1),rK=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>'),aK=B('<div class="log-resize-handle svelte-1pyfjii" role="separator"></div>'),lK=B('<span class="log-file svelte-1pyfjii"> </span>'),cK=B('<button class="log-clear svelte-1pyfjii">Clear</button>'),dK=B('<div><span class="ts svelte-1pyfjii"> </span> <span class="lvl svelte-1pyfjii"> </span> <span class="msg svelte-1pyfjii"> </span></div>'),hK=B('<span class="log-empty svelte-1pyfjii">No log output for this script.</span>'),uK=B('<div class="log-body svelte-1pyfjii"><!> <!></div>'),gK=B('<div class="chat-resize-handle svelte-1pyfjii" role="separator"></div> <div class="chat-container svelte-1pyfjii"><!></div>',1),fK=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="Refresh" class="refresh svelte-1pyfjii">↻</button></div> <!> <ul class="tree svelte-1pyfjii"></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 pK(o,e){ao(e,!0);let t=j(Li([])),i=j(Li({})),n=j(null),s=j(null),r=j(null),a=j(null),c=j(Li([])),h=j(null),u=j(!1),g=j(""),f=j(!1),v=j(!0),_=j(null),y=j(void 0),S=j(Li(new Set));const x=new Set;let E,M,F,R=!1,Z=null,q=!1,he=!1,pe=j(!1),Ce=j(null),Pe=j(!1),je=j(!1),qt=j(void 0),Ge=null,Xt=null,pt=null,Kt=j(Li(parseInt(localStorage.getItem("she-scripts-sidebar-width")??"220",10))),ae=j(Li(parseInt(localStorage.getItem("she-scripts-log-height")??"130",10))),Te=j(Li(parseInt(localStorage.getItem("she-scripts-chat-width")??"340",10))),ve=!1,lt=0,Qt=0,It=!1,Tt=0,Lt=0,gt=!1,Oi=0,Gt=0;const Ae=Vt(()=>{var U;return m(h)&&m(kt)?{path:m(h),content:((U=m(kt).model)==null?void 0:U.getValue())??m(kt).savedContent}:null});let Be,Mt,kt=Vt(()=>m(c).find(U=>U.path===m(h))??null);const pi="she-tabs",Nt="she-active-tab",mi="she-log-open",Mi="she-chat-open";let Ui=xf(e,"active",3,!0);kn(()=>{he&&(localStorage.setItem(pi,JSON.stringify(m(c).map(U=>U.path))),m(h)?localStorage.setItem(Nt,m(h)):localStorage.removeItem(Nt))}),kn(()=>{he&&localStorage.setItem(Mi,String(m(pe)))}),kn(()=>{Ui()&&M&&M.layout()});const Fi=`
148
+ declare const she: {
149
+ log(...args: any[]): void;
150
+ info(...args: any[]): void;
151
+ debug(...args: any[]): void;
152
+ warn(...args: any[]): void;
153
+ error(...args: any[]): void;
154
+ now(): number;
155
+ /** Schedule with a cron string, Date, node-schedule literal, array of any of those,
156
+ * or a suncalc event name ('sunrise', 'sunset', 'dawn', 'dusk', …) for solar scheduling.
157
+ * opts.shift (seconds) offsets solar events; opts.random adds a random delay. */
158
+ schedule(pattern: string | Date | object | (string | Date | object)[], opts?: { shift?: number; random?: number }, cb?: () => void): void;
159
+ combineBool(srcs: string[], target: string): void;
160
+ combineMax(srcs: string[], target: string): void;
161
+ timer(src: string | string[], target: string, time: number): void;
162
+ mqtt: {
163
+ sub(topic: string | string[], opts?: any, cb?: (topic: string, val: any, obj: any, prev: any, msg: any) => void): void;
164
+ pub(topic: string | string[], payload: any, opts?: { qos?: number; retain?: boolean }): void;
165
+ get(topic: string): any;
166
+ set(topic: string | string[], val: any): void;
167
+ getProp(topic: string, ...prop: string[]): any;
168
+ link(source: string | string[], target: string | string[], value?: any): void;
169
+ age(topic: string): number;
170
+ };
171
+ api: {
172
+ get(path: string, handler: (req: any) => any): void;
173
+ post(path: string, handler: (req: any, body: any) => any): void;
174
+ put(path: string, handler: (req: any, body: any) => any): void;
175
+ delete(path: string, handler: (req: any) => any): void;
176
+ };
177
+ db: {
178
+ get(id: string): any;
179
+ set(id: string, doc: object): void;
180
+ extend(id: string, partial: object): void;
181
+ delete(id: string): void;
182
+ prop(id: string, method: 'set' | 'create' | 'del', prop: string, val?: any): void;
183
+ sub(pattern: string, callback: (id: string, doc: any) => void): void;
184
+ query(filter: string | null, mapFn: Function, reduceFn?: Function): any[];
185
+ };
186
+ matter: {
187
+ sub(nodeId: string, endpointId: number, cluster: string, attr: string, cb: (val: any, old: any) => void): number;
188
+ unsub(listenerId: number): void;
189
+ get(nodeId: string, endpointId: number, cluster: string, attr: string): Promise<any>;
190
+ send(nodeId: string, endpointId: number, cluster: string, command: string, args?: object): Promise<any>;
191
+ on(nodeId: string, endpointId: number, cluster: string, event: string, cb: (val: any) => void): number;
192
+ };
193
+ influx: {
194
+ query(fluxQuery: string): Promise<any[]>;
195
+ write(measurement: string, fields: object, tags?: object, timestamp?: number | Date): Promise<void>;
196
+ getLast(topic: string, n: number): Promise<Array<{ ts: number; val: any }>>;
197
+ getRange(topic: string, from: number | string | Date, to: number | string | Date): Promise<Array<{ ts: number; val: any }>>;
198
+ };
199
+ elastic: {
200
+ search(index: string, query: object): Promise<{ hits: any[]; total: number }>;
201
+ get(index: string, id: string): Promise<object | null>;
202
+ index(index: string, doc: object, id?: string): Promise<{ id: string }>;
203
+ find(index: string, field: string, text: string, size?: number): Promise<any[]>;
204
+ };
205
+ };
206
+ `;na(async()=>{var ft;I(v,localStorage.getItem(mi)!=="false"),I(pe,localStorage.getItem(Mi)==="true"),uc.typescript.javascriptDefaults.addExtraLib(Fi,"she-api.d.ts"),uc.typescript.javascriptDefaults.setCompilerOptions({target:uc.typescript.ScriptTarget.ES2022,allowNonTsExtensions:!0,checkJs:!0}),uc.typescript.javascriptDefaults.setDiagnosticsOptions({noSyntaxValidation:!1,noSemanticValidation:!0}),Fq(),F=pa.createModel("","javascript"),M=pa.create(E,{model:F,theme:"vs-dark",automaticLayout:!0,minimap:{enabled:!1},fontSize:14,lineNumbers:"on",scrollBeyondLastLine:!1}),M.onDidChangeModelContent(()=>{if(R)return;const Pt=m(c).find(gi=>gi.path===m(h));Pt&&(Pt.dirty=M.getValue()!==Pt.savedContent),ee&&clearTimeout(ee),ee=setTimeout(ke,600)}),Z=TN(Pt=>{const gi=Pt.msg.match(/^user::([^:]+):/);if(!gi)return;const ai=gi[1];if(Pt.level==="error")x.add(ai),m(S).has(ai)||I(S,new Set([...m(S),ai]),!0);else if(x.has(ai)){x.delete(ai);const fi=new Set(m(S));fi.delete(ai),I(S,fi,!0)}const ji=m(c).find(fi=>fi.path.split("/").pop()===ai);ji&&(ji.logEntries=[...ji.logEntries.slice(-199),Pt],ji.path===m(h)&&m(v)&&m(y)&&Hy().then(()=>{m(y)&&(m(y).scrollTop=m(y).scrollHeight)}))}),await yi(),ki();const U=JSON.parse(localStorage.getItem(pi)??"[]"),le=localStorage.getItem(Nt);for(const Pt of U)await rn(Pt,!1);const fe=le&&m(c).some(Pt=>Pt.path===le)?le:((ft=m(c)[0])==null?void 0:ft.path)??null;fe&&await _i(fe),he=!0}),x1(()=>{var U;ee&&clearTimeout(ee),Z==null||Z();for(const le of m(c))(U=le.model)==null||U.dispose();F==null||F.dispose(),M==null||M.dispose()});async function yi(){try{if(I(t,await f7(),!0),!q){let le=function(fe){for(const ft of fe)ft.type==="dir"&&(U[ft.path]=!0,ft.children&&le(ft.children))};q=!0;const U={};le(m(t)),I(i,U,!0)}I(g,"")}catch(U){I(g,U.message,!0)}}function cn(U){m(i)[U]=!m(i)[U]}async function Zi(U,le){try{le?await yh(`${U}/.shelib`,""):await cy(`${U}/.shelib`),await yi()}catch(fe){I(g,fe.message,!0)}}async function rn(U,le=!0){var fe;if(m(c).some(ft=>ft.path===U)){le&&await _i(U);return}try{const{content:ft}=await p7(U),Pt=pF.parse(`file:///she-scripts/${encodeURIComponent(U)}`);(fe=pa.getModel(Pt))==null||fe.dispose();const gi=pa.createModel(ft,H(U),Pt);I(c,[...m(c),{path:U,dirty:!1,savedContent:ft,model:gi,logEntries:[]}],!0),le&&await _i(U)}catch(ft){I(g,ft.message,!0)}}async function bn(U){await rn(U,!0)}async function _i(U){const le=m(c).find(fe=>fe.path===U);le!=null&&le.model&&(I(h,U,!0),R=!0,M.setModel(le.model),R=!1,ke())}async function _n(U){var ft;const le=m(c).find(Pt=>Pt.path===U);if(!le||le.dirty&&!await Be.show(`Discard unsaved changes to ${U}?`,{confirm:"Discard"}))return;const fe=m(c).findIndex(Pt=>Pt.path===U);if((ft=le.model)==null||ft.dispose(),I(c,m(c).filter(Pt=>Pt.path!==U),!0),m(h)===U){const Pt=m(c)[fe]??m(c)[fe-1]??null;Pt?await _i(Pt.path):(I(h,null),M.setModel(F))}}async function ki(){try{I(_,await _7(),!0)}catch{I(_,null)}}async function Ni(){if(!m(h))return;const U=m(c).find(le=>le.path===m(h));if(U){I(u,!0);try{const le=M.getValue();await yh(m(h),le),U.savedContent=le,U.dirty=!1,I(g,""),ki()}catch(le){I(g,le.message,!0)}finally{I(u,!1)}}}async function fn(){if(!m(h)||(await Ni(),m(g)))return;const U=await Mt.show("Commit message:",{placeholder:"Update script",confirm:"Commit"});if(U)try{await w7(m(h),U),ki()}catch(le){I(g,"Git: "+le.message)}}async function On(){I(f,!1);try{await y7(),await ki(),I(g,"")}catch(U){I(g,"Git push: "+U.message)}}async function Vn(){const U=m(n)?`${m(n)}/`:"",le=await Mt.show("New script name:",{placeholder:U?`${U}myscript.js`:"myscript.js",initial:U,confirm:"Create"});if(!le)return;const fe=le.endsWith(".js")?`/* global she */
207
+ 'use strict';
208
+
209
+ `:"";await yh(le,fe),await yi(),await rn(le,!0)}async function Un(){const U=m(n)?`${m(n)}/`:"",le=await Mt.show("New folder name:",{placeholder:U?`${U}subfolder`:"myfolder",initial:U,confirm:"Create"});le&&(await m7(le),m(i)[le]=!0,await yi())}function Jt(U,le){U.preventDefault(),I(s,{x:U.clientX,y:U.clientY,entry:le},!0)}function be(){I(s,null)}async function K(U){be(),I(n,U,!0),m(i)[U]=!0,await Vn()}async function Ie(U){be(),I(n,U,!0),await Un()}async function nt(U){be();const le=await Mt.show(U.type==="dir"?"Rename folder:":"Rename script:",{initial:U.path,placeholder:U.path,confirm:"Rename"});if(!le||le===U.path)return;const fe=le;try{await Hk(U.path,fe);const ft=m(c).find(Pt=>Pt.path===U.path);ft&&(ft.path=fe,m(h)===U.path&&I(h,fe,!0)),await yi()}catch(ft){I(g,ft.message,!0)}}async function Rt(U){be(),await Be.show(`Delete ${U.path}?`,{confirm:"Delete",danger:!0})&&(U.type==="file"&&(await _n(U.path),await cy(U.path)),await yi())}function vt(U,le){var fe;I(r,le,!0),(fe=U.dataTransfer)==null||fe.setData("text/plain",le)}function rt(U,le){U.preventDefault(),U.dataTransfer&&(U.dataTransfer.dropEffect="move"),I(a,le,!0)}function ni(){I(a,null)}async function ri(U,le){var gi,ai,ji;if(U.preventDefault(),I(a,null),(ai=(gi=U.dataTransfer)==null?void 0:gi.files)!=null&&ai.length){for(const fi of Array.from(U.dataTransfer.files)){const Ji=await fi.text(),ut=`${le}/${fi.name}`;await yh(ut,Ji)}await yi();return}const fe=m(r)??((ji=U.dataTransfer)==null?void 0:ji.getData("text/plain"));if(I(r,null),!fe||fe===le)return;const ft=fe.split("/").pop(),Pt=`${le}/${ft}`;if(Pt!==fe)try{await Hk(fe,Pt);const fi=m(c).find(Ji=>Ji.path===fe);fi&&(fi.path=Pt,m(h)===fe&&I(h,Pt)),await yi()}catch(fi){I(g,fi.message,!0)}}async function Xi(){if(!m(h)||!await Be.show(`Delete ${m(h)}?`,{confirm:"Delete",danger:!0}))return;const U=m(h);await _n(U),await cy(U),await yi()}function Hi(){m(kt)&&(m(kt).logEntries=[])}function A(){I(v,!m(v)),localStorage.setItem(mi,String(m(v)))}function te(U){return new Date(U).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function H(U){var ft;const le=((ft=U.split(".").pop())==null?void 0:ft.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"}[le]??"plaintext"}let ee=null;async function ke(){const U=m(c).find(fe=>fe.path===m(h));if(!(U!=null&&U.model))return;const le=U.model;try{const gi=(await(await(await uc.typescript.getJavaScriptWorker())(le.uri)).getSyntacticDiagnostics(le.uri.toString())).map(ai=>{const ji=le.getPositionAt(ai.start??0),fi=le.getPositionAt((ai.start??0)+(ai.length??0));return{severity:mF.Error,startLineNumber:ji.lineNumber,startColumn:ji.column,endLineNumber:fi.lineNumber,endColumn:fi.column,message:typeof ai.messageText=="string"?ai.messageText:JSON.stringify(ai.messageText),source:"she-syntax"}});pa.setModelMarkers(le,"she-syntax",gi)}catch{}}function Ue(U){ve=!0,lt=U.clientX,Qt=m(Kt),U.preventDefault()}function z(U){It=!0,Tt=U.clientY,Lt=m(ae),U.preventDefault()}function $(U){gt=!0,Oi=U.clientX,Gt=m(Te),U.preventDefault()}function re(U){ve&&I(Kt,Math.max(140,Math.min(500,Qt+U.clientX-lt)),!0),It&&I(ae,Math.max(60,Math.min(500,Lt-(U.clientY-Tt))),!0),gt&&I(Te,Math.max(200,Math.min(700,Gt-(U.clientX-Oi))),!0)}function xe(){ve&&(ve=!1,localStorage.setItem("she-scripts-sidebar-width",String(m(Kt)))),It&&(It=!1,localStorage.setItem("she-scripts-log-height",String(m(ae)))),gt&&(gt=!1,localStorage.setItem("she-scripts-chat-width",String(m(Te))))}function _e(U){(U.ctrlKey||U.metaKey)&&U.key==="s"&&(U.preventDefault(),Ni()),U.key==="Escape"&&(I(f,!1),I(s,null))}async function X(U,le){const fe=await Mt.show("Save new script as:",{placeholder:"myscript.js",initial:U,confirm:"Create"});if(fe)try{await yh(fe,le),await yi(),await rn(fe,!0)}catch(ft){I(g,ft.message,!0)}}async function V(U){var fe,ft;if(m(Pe)&&m(h)){I(Ce,U,!0),await ue();return}if(I(Ce,U,!0),await Hy(),!m(qt))return;Xt==null||Xt.dispose(),pt==null||pt.dispose(),Ge==null||Ge.dispose();const le=((ft=(fe=m(kt))==null?void 0:fe.model)==null?void 0:ft.getValue())??"";Xt=pa.createModel(le,"javascript"),pt=pa.createModel(U,"javascript"),Ge=pa.createDiffEditor(m(qt),{theme:"vs-dark",readOnly:!0,renderSideBySide:!0,automaticLayout:!0,minimap:{enabled:!1},fontSize:13,scrollBeyondLastLine:!1}),Ge.setModel({original:Xt,modified:pt})}kn(()=>{m(h),I(Pe,!1),I(je,!1)});async function ue(){if(m(Ce)===null||!m(h))return;const U=m(Ce);I(Ce,null);const le=m(c).find(fe=>fe.path===m(h));le!=null&&le.model&&(R=!0,le.model.setValue(U),R=!1,le.dirty=!1,le.savedContent=U);try{await yh(m(h),U),I(g,""),ki()}catch(fe){I(g,fe.message,!0)}Me()}function Le(){I(Ce,null),Me()}function Me(){Ge==null||Ge.dispose(),Ge=null,Xt==null||Xt.dispose(),Xt=null,pt==null||pt.dispose(),pt=null}var Oe=fK();_o("keydown",Tc,_e),_o("mousemove",Tc,re),_o("mouseup",Tc,xe);var Ze=Wt(Oe);bo(B7(Ze,{}),U=>Be=U,()=>Be);var bt=D(Ze,2);bo(V7(bt,{}),U=>Mt=U,()=>Mt);var Dt=D(bt,2);{var Ht=U=>{var le=Bq(),fe=Wt(le),ft=D(fe,2);let Pt;var gi=k(ft);{var ai=fi=>{var Ji=Hq(),ut=Wt(Ji),hi=D(ut,2),en=D(hi,4);de("click",ut,()=>K(m(s).entry.path)),de("click",hi,()=>Ie(m(s).entry.path)),de("click",en,()=>nt(m(s).entry)),N(fi,Ji)},ji=fi=>{var Ji=Wq(),ut=Wt(Ji),hi=D(ut,2),en=D(hi,4);de("click",ut,()=>bn(m(s).entry.path)),de("click",hi,()=>nt(m(s).entry)),de("click",en,()=>Rt(m(s).entry)),N(fi,Ji)};J(gi,fi=>{m(s).entry.type==="dir"?fi(ai):fi(ji,-1)})}se(()=>Pt=hs(ft,"",Pt,{left:`${m(s).x??""}px`,top:`${m(s).y??""}px`})),de("click",fe,be),de("contextmenu",fe,fi=>{fi.preventDefault(),be()}),N(U,le)};J(Dt,U=>{m(s)&&U(Ht)})}var ct=D(Dt,2),me=k(ct);let Ne;{const U=(le,fe=pl)=>{var ft=_s(),Pt=Wt(ft);{var gi=ji=>{var fi=Vq(),Ji=k(fi);let ut;var hi=k(Ji);let en;var Qn=D(hi,2);let So;var Xo=k(Qn),Jn=D(Qn,2),ra=k(Jn),xr=D(Ji,2);{var nc=Gn=>{var Lr=zq();an(Lr,21,()=>fe().children,aa=>aa.path,(aa,jn)=>{U(aa,()=>m(jn))}),N(Gn,Lr)};J(xr,Gn=>{m(i)[fe().path]&&fe().children&&Gn(nc)})}se(Gn=>{hs(fi,`--depth: ${Gn??""}`),ut=ti(Ji,1,"dir-row svelte-1pyfjii",null,ut,{"dir-selected":m(n)===fe().path,"drag-target":m(a)===fe().path}),is(Ji,"aria-selected",m(n)===fe().path),en=ti(hi,1,"chevron svelte-1pyfjii",null,en,{open:m(i)[fe().path]}),So=ti(Qn,1,"dir-name svelte-1pyfjii",null,So,{lib:fe().lib}),oe(Xo,fe().name),XH(ra,fe().lib)},[()=>fe().path.split("/").length-1]),_o("dragover",Ji,Gn=>rt(Gn,fe().path)),_o("dragleave",Ji,ni),_o("drop",Ji,Gn=>ri(Gn,fe().path)),de("contextmenu",Ji,Gn=>Jt(Gn,fe())),de("click",hi,()=>cn(fe().path)),de("click",Qn,()=>{I(n,fe().path,!0),m(i)[fe().path]=!0}),de("keydown",Qn,Gn=>Gn.key==="Enter"&&I(n,fe().path,!0)),de("change",ra,()=>Zi(fe().path,!fe().lib)),N(ji,fi)},ai=ji=>{const fi=Vt(()=>fe().name),Ji=Vt(()=>m(S).has(m(fi))),ut=Vt(()=>(fe().name.split(".").pop()??"txt").toUpperCase());var hi=$q();let en;var Qn=k(hi);let So;var Xo=k(Qn);let Jn;var ra=k(Xo),xr=D(Xo,2),nc=k(xr),Gn=D(xr,2);{var Lr=$n=>{var Is=Uq();N($n,Is)},aa=Vt(()=>{var $n;return($n=m(c).find(Is=>Is.path===fe().path))==null?void 0:$n.dirty});J(Gn,$n=>{m(aa)&&$n(Lr)})}var jn=D(Gn,2);{var la=$n=>{var Is=jq();N($n,Is)};J(jn,$n=>{m(Ji)&&$n(la)})}se(($n,Is,Op)=>{en=ti(hi,1,"tree-file svelte-1pyfjii",null,en,$n),hs(hi,`--depth: ${Is??""}`),So=ti(Qn,1,"svelte-1pyfjii",null,So,{lib:fe().lib}),Jn=ti(Xo,1,`badge badge-${Op??""}`,"svelte-1pyfjii",Jn,{"badge-shelib":fe().lib}),oe(ra,m(ut)),oe(nc,fe().name)},[()=>({active:m(c).some($n=>$n.path===fe().path),"active-tab":fe().path===m(h)}),()=>fe().path.split("/").length-1,()=>m(ut).toLowerCase()]),_o("dragstart",hi,$n=>vt($n,fe().path)),de("contextmenu",hi,$n=>Jt($n,fe())),de("click",Qn,()=>bn(fe().path)),N(ji,hi)};J(Pt,ji=>{fe().type==="dir"?ji(gi):ji(ai,-1)})}N(le,ft)};var De=k(me),ze=k(De),Ct=D(ze,2),et=D(Ct,2),tt=D(De,2);{var at=le=>{var fe=qq(),ft=k(fe);se(()=>oe(ft,m(g))),N(le,fe)};J(tt,le=>{m(g)&&le(at)})}var mt=D(tt,2);an(mt,21,()=>m(t),le=>le.path,(le,fe)=>{U(le,()=>m(fe))}),de("click",ze,Vn),de("click",Ct,Un),de("click",et,yi)}var ui=D(me,2),ce=D(ui,2),He=k(ce);{var dt=U=>{var le=Zq();an(le,21,()=>m(c),fe=>fe.path,(fe,ft)=>{var Pt=Gq();let gi;var ai=k(Pt),ji=k(ai),fi=D(ai,2);{var Ji=hi=>{var en=Kq();N(hi,en)};J(fi,hi=>{m(ft).dirty&&hi(Ji)})}var ut=D(fi,2);se(hi=>{gi=ti(Pt,1,"tab svelte-1pyfjii",null,gi,{active:m(ft).path===m(h)}),oe(ji,hi)},[()=>m(ft).path.split("/").pop()]),de("click",Pt,()=>_i(m(ft).path)),de("keydown",Pt,hi=>hi.key==="Enter"&&_i(m(ft).path)),de("click",ut,hi=>{hi.stopPropagation(),_n(m(ft).path)}),N(fe,Pt)}),N(U,le)};J(He,U=>{m(c).length>0&&U(dt)})}var At=D(He,2),ei=k(At),ht=k(ei),st=D(ei,2);{var Ye=U=>{var le=Jq(),fe=k(le),ft=k(fe),Pt=D(fe,2);{var gi=ut=>{var hi=Xq(),en=k(hi);se(()=>{is(hi,"title",`${m(_).changes.length??""} uncommitted change(s)`),oe(en,`✎${m(_).changes.length??""}`)}),N(ut,hi)};J(Pt,ut=>{m(_).changes.length>0&&ut(gi)})}var ai=D(Pt,2);{var ji=ut=>{var hi=Yq(),en=k(hi);se(()=>{is(hi,"title",`${m(_).ahead??""} commit(s) ahead of upstream`),oe(en,`↑${m(_).ahead??""}`)}),N(ut,hi)};J(ai,ut=>{m(_).ahead>0&&ut(ji)})}var fi=D(ai,2);{var Ji=ut=>{var hi=Qq(),en=k(hi);se(()=>{is(hi,"title",`${m(_).behind??""} commit(s) behind upstream`),oe(en,`↓${m(_).behind??""}`)}),N(ut,hi)};J(fi,ut=>{m(_).behind>0&&ut(Ji)})}se(()=>{is(fe,"title",`Branch: ${m(_).branch??""}`),oe(ft,`⎇ ${m(_).branch??""}`)}),N(U,le)};J(st,U=>{m(_)&&U(Ye)})}var Ee=D(st,2),Ot=k(Ee),Re=k(Ot),Fe=k(Re),zt=D(Re,2),Yi=D(Ot,2);{var Ln=U=>{var le=eK(),fe=Wt(le),ft=D(fe,2),Pt=k(ft),gi=D(Pt,2),ai=D(gi,2);se(()=>ai.disabled=!m(_)),de("click",fe,()=>I(f,!1)),de("click",Pt,()=>{I(f,!1),Ni()}),de("click",gi,()=>{I(f,!1),fn()}),de("click",ai,On),N(U,le)};J(Yi,U=>{m(f)&&U(Ln)})}var un=D(Ee,2);{var Go=U=>{var le=tK();de("click",le,Xi),N(U,le)};J(un,U=>{m(h)&&U(Go)})}var cs=D(un,2);let ds;var Et=D(At,2),Qi=k(Et),Tn=k(Qi),Ft=k(Tn);bo(Ft,U=>E=U,()=>E);var Zo=D(Ft,2);{var wn=U=>{var le=iK();N(U,le)};J(Zo,U=>{m(h)||U(wn)})}var Ci=D(Zo,2);{var Os=U=>{var le=rK(),fe=k(le),ft=k(fe),Pt=D(k(ft)),gi=k(Pt),ai=D(ft,2),ji=k(ai),fi=k(ji),Ji=k(fi),ut=k(Ji),hi=D(Ji,2),en=D(fi,2);{var Qn=Jn=>{var ra=oK(),xr=Wt(ra),nc=D(xr,2),Gn=k(nc);{var Lr=jn=>{var la=nK();de("click",la,()=>{I(je,!1),I(Pe,!0),ue()}),N(jn,la)},aa=jn=>{var la=sK();de("click",la,()=>{I(je,!1),I(Pe,!1)}),N(jn,la)};J(Gn,jn=>{m(Pe)?jn(aa,-1):jn(Lr)})}de("click",xr,()=>I(je,!1)),N(Jn,ra)};J(en,Jn=>{m(je)&&Jn(Qn)})}var So=D(ji,2),Xo=D(fe,2);bo(Xo,Jn=>I(qt,Jn),()=>m(qt)),se(Jn=>{oe(gi,Jn),oe(ut,m(Pe)?"Auto-accept ✓":"Accept")},[()=>{var Jn;return(Jn=m(h))==null?void 0:Jn.split("/").pop()}]),de("click",Ji,ue),de("click",hi,()=>I(je,!m(je))),de("click",So,Le),N(U,le)};J(Ci,U=>{m(Ce)!==null&&U(Os)})}var Ls=D(Tn,2);let Sr,Cr;var $e=k(Ls);{var wt=U=>{var le=aK();de("mousedown",le,z),N(U,le)};J($e,U=>{m(v)&&U(wt)})}var si=D($e,2),Wi=k(si),yt=k(Wi),Fn=D(yt);{var gn=U=>{var le=lK(),fe=k(le);se(ft=>oe(fe,`— ${ft??""}`),[()=>m(h).split("/").pop()]),N(U,le)};J(Fn,U=>{m(h)&&U(gn)})}var eh=D(Wi,2);{var ag=U=>{var le=cK();de("click",le,Hi),N(U,le)};J(eh,U=>{m(v)&&U(ag)})}var lg=D(si,2);{var cg=U=>{var le=uK(),fe=k(le);an(fe,17,()=>{var gi;return((gi=m(kt))==null?void 0:gi.logEntries)??[]},gi=>gi.ts+gi.msg,(gi,ai)=>{var ji=dK(),fi=k(ji),Ji=k(fi),ut=D(fi,2),hi=k(ut),en=D(ut,2),Qn=k(en);se((So,Xo)=>{ti(ji,1,`log-line ${m(ai).level??""}`,"svelte-1pyfjii"),oe(Ji,So),oe(hi,Xo),oe(Qn,m(ai).msg)},[()=>te(m(ai).ts),()=>m(ai).level.toUpperCase()]),N(gi,ji)});var ft=D(fe,2);{var Pt=gi=>{var ai=hK();N(gi,ai)};J(ft,gi=>{var ai;(((ai=m(kt))==null?void 0:ai.logEntries.length)??0)===0&&gi(Pt)})}bo(le,gi=>I(y,gi),()=>m(y)),N(U,le)};J(lg,U=>{m(v)&&U(cg)})}var oa=D(Qi,2);{var dg=U=>{var le=gK(),fe=Wt(le),ft=D(fe,2);let Pt;var gi=k(ft);Lq(gi,{get currentScript(){return m(Ae)},onApply:V,onCreateFile:X}),se(()=>Pt=hs(ft,"",Pt,{width:`${m(Te)??""}px`})),de("mousedown",fe,$),N(U,le)};J(oa,U=>{m(pe)&&U(dg)})}se(()=>{var U;Ne=hs(me,"",Ne,{width:`${m(Kt)??""}px`}),oe(ht,m(h)??"No file selected"),Re.disabled=!((U=m(kt))!=null&&U.dirty)||m(u),oe(Fe,m(u)?"Saving…":"Save"),zt.disabled=!m(h),ds=ti(cs,1,"ai-toggle svelte-1pyfjii",null,ds,{"ai-open":m(pe)}),is(cs,"title",m(pe)?"Close AI assistant":"Open AI assistant"),Sr=ti(Ls,1,"log-panel svelte-1pyfjii",null,Sr,{collapsed:!m(v)}),Cr=hs(Ls,"",Cr,{height:m(v)?`${m(ae)}px`:"26px"}),oe(yt,`${m(v)?"▾":"▸"} Script Log `)}),de("mousedown",ui,Ue),de("click",Re,Ni),de("click",zt,()=>I(f,!m(f))),de("click",cs,()=>I(pe,!m(pe))),de("click",Wi,A),N(o,Oe),lo()}Ko(["click","contextmenu","keydown","change","mousedown"]);const ZN="she-theme";function mK(){return localStorage.getItem(ZN)??"dark"}function _K(o){localStorage.setItem(ZN,o);const e=document.documentElement;o==="system"?e.removeAttribute("data-theme"):e.setAttribute("data-theme",o)}var Ug={exports:{}};/* @preserve
210
+ * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com
211
+ * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade
212
+ */var vK=Ug.exports,tD;function bK(){return tD||(tD=1,(function(o,e){(function(t,i){i(e)})(vK,(function(t){var i="1.9.4";function n(l){var d,p,b,C;for(p=1,b=arguments.length;p<b;p++){C=arguments[p];for(d in C)l[d]=C[d]}return l}var s=Object.create||(function(){function l(){}return function(d){return l.prototype=d,new l}})();function r(l,d){var p=Array.prototype.slice;if(l.bind)return l.bind.apply(l,p.call(arguments,1));var b=p.call(arguments,2);return function(){return l.apply(d,b.length?b.concat(p.call(arguments)):arguments)}}var a=0;function c(l){return"_leaflet_id"in l||(l._leaflet_id=++a),l._leaflet_id}function h(l,d,p){var b,C,P,W;return W=function(){b=!1,C&&(P.apply(p,C),C=!1)},P=function(){b?C=arguments:(l.apply(p,arguments),setTimeout(W,d),b=!0)},P}function u(l,d,p){var b=d[1],C=d[0],P=b-C;return l===b&&p?l:((l-C)%P+P)%P+C}function g(){return!1}function f(l,d){if(d===!1)return l;var p=Math.pow(10,d===void 0?6:d);return Math.round(l*p)/p}function v(l){return l.trim?l.trim():l.replace(/^\s+|\s+$/g,"")}function _(l){return v(l).split(/\s+/)}function y(l,d){Object.prototype.hasOwnProperty.call(l,"options")||(l.options=l.options?s(l.options):{});for(var p in d)l.options[p]=d[p];return l.options}function S(l,d,p){var b=[];for(var C in l)b.push(encodeURIComponent(p?C.toUpperCase():C)+"="+encodeURIComponent(l[C]));return(!d||d.indexOf("?")===-1?"?":"&")+b.join("&")}var x=/\{ *([\w_ -]+) *\}/g;function E(l,d){return l.replace(x,function(p,b){var C=d[b];if(C===void 0)throw new Error("No value provided for variable "+p);return typeof C=="function"&&(C=C(d)),C})}var M=Array.isArray||function(l){return Object.prototype.toString.call(l)==="[object Array]"};function F(l,d){for(var p=0;p<l.length;p++)if(l[p]===d)return p;return-1}var R="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function Z(l){return window["webkit"+l]||window["moz"+l]||window["ms"+l]}var q=0;function he(l){var d=+new Date,p=Math.max(0,16-(d-q));return q=d+p,window.setTimeout(l,p)}var pe=window.requestAnimationFrame||Z("RequestAnimationFrame")||he,Ce=window.cancelAnimationFrame||Z("CancelAnimationFrame")||Z("CancelRequestAnimationFrame")||function(l){window.clearTimeout(l)};function Pe(l,d,p){if(p&&pe===he)l.call(d);else return pe.call(window,r(l,d))}function je(l){l&&Ce.call(window,l)}var qt={__proto__:null,extend:n,create:s,bind:r,get lastId(){return a},stamp:c,throttle:h,wrapNum:u,falseFn:g,formatNum:f,trim:v,splitWords:_,setOptions:y,getParamString:S,template:E,isArray:M,indexOf:F,emptyImageUrl:R,requestFn:pe,cancelFn:Ce,requestAnimFrame:Pe,cancelAnimFrame:je};function Ge(){}Ge.extend=function(l){var d=function(){y(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},p=d.__super__=this.prototype,b=s(p);b.constructor=d,d.prototype=b;for(var C in this)Object.prototype.hasOwnProperty.call(this,C)&&C!=="prototype"&&C!=="__super__"&&(d[C]=this[C]);return l.statics&&n(d,l.statics),l.includes&&(Xt(l.includes),n.apply(null,[b].concat(l.includes))),n(b,l),delete b.statics,delete b.includes,b.options&&(b.options=p.options?s(p.options):{},n(b.options,l.options)),b._initHooks=[],b.callInitHooks=function(){if(!this._initHooksCalled){p.callInitHooks&&p.callInitHooks.call(this),this._initHooksCalled=!0;for(var P=0,W=b._initHooks.length;P<W;P++)b._initHooks[P].call(this)}},d},Ge.include=function(l){var d=this.prototype.options;return n(this.prototype,l),l.options&&(this.prototype.options=d,this.mergeOptions(l.options)),this},Ge.mergeOptions=function(l){return n(this.prototype.options,l),this},Ge.addInitHook=function(l){var d=Array.prototype.slice.call(arguments,1),p=typeof l=="function"?l:function(){this[l].apply(this,d)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(p),this};function Xt(l){if(!(typeof L>"u"||!L||!L.Mixin)){l=M(l)?l:[l];for(var d=0;d<l.length;d++)l[d]===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 pt={on:function(l,d,p){if(typeof l=="object")for(var b in l)this._on(b,l[b],d);else{l=_(l);for(var C=0,P=l.length;C<P;C++)this._on(l[C],d,p)}return this},off:function(l,d,p){if(!arguments.length)delete this._events;else if(typeof l=="object")for(var b in l)this._off(b,l[b],d);else{l=_(l);for(var C=arguments.length===1,P=0,W=l.length;P<W;P++)C?this._off(l[P]):this._off(l[P],d,p)}return this},_on:function(l,d,p,b){if(typeof d!="function"){console.warn("wrong listener type: "+typeof d);return}if(this._listens(l,d,p)===!1){p===this&&(p=void 0);var C={fn:d,ctx:p};b&&(C.once=!0),this._events=this._events||{},this._events[l]=this._events[l]||[],this._events[l].push(C)}},_off:function(l,d,p){var b,C,P;if(this._events&&(b=this._events[l],!!b)){if(arguments.length===1){if(this._firingCount)for(C=0,P=b.length;C<P;C++)b[C].fn=g;delete this._events[l];return}if(typeof d!="function"){console.warn("wrong listener type: "+typeof d);return}var W=this._listens(l,d,p);if(W!==!1){var Y=b[W];this._firingCount&&(Y.fn=g,this._events[l]=b=b.slice()),b.splice(W,1)}}},fire:function(l,d,p){if(!this.listens(l,p))return this;var b=n({},d,{type:l,target:this,sourceTarget:d&&d.sourceTarget||this});if(this._events){var C=this._events[l];if(C){this._firingCount=this._firingCount+1||1;for(var P=0,W=C.length;P<W;P++){var Y=C[P],ne=Y.fn;Y.once&&this.off(l,ne,Y.ctx),ne.call(Y.ctx||this,b)}this._firingCount--}}return p&&this._propagateEvent(b),this},listens:function(l,d,p,b){typeof l!="string"&&console.warn('"string" type argument expected');var C=d;typeof d!="function"&&(b=!!d,C=void 0,p=void 0);var P=this._events&&this._events[l];if(P&&P.length&&this._listens(l,C,p)!==!1)return!0;if(b){for(var W in this._eventParents)if(this._eventParents[W].listens(l,d,p,b))return!0}return!1},_listens:function(l,d,p){if(!this._events)return!1;var b=this._events[l]||[];if(!d)return!!b.length;p===this&&(p=void 0);for(var C=0,P=b.length;C<P;C++)if(b[C].fn===d&&b[C].ctx===p)return C;return!1},once:function(l,d,p){if(typeof l=="object")for(var b in l)this._on(b,l[b],d,!0);else{l=_(l);for(var C=0,P=l.length;C<P;C++)this._on(l[C],d,p,!0)}return this},addEventParent:function(l){return this._eventParents=this._eventParents||{},this._eventParents[c(l)]=l,this},removeEventParent:function(l){return this._eventParents&&delete this._eventParents[c(l)],this},_propagateEvent:function(l){for(var d in this._eventParents)this._eventParents[d].fire(l.type,n({layer:l.target,propagatedFrom:l.target},l),!0)}};pt.addEventListener=pt.on,pt.removeEventListener=pt.clearAllEventListeners=pt.off,pt.addOneTimeEventListener=pt.once,pt.fireEvent=pt.fire,pt.hasEventListeners=pt.listens;var Kt=Ge.extend(pt);function ae(l,d,p){this.x=p?Math.round(l):l,this.y=p?Math.round(d):d}var Te=Math.trunc||function(l){return l>0?Math.floor(l):Math.ceil(l)};ae.prototype={clone:function(){return new ae(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 ae(this.x*l.x,this.y*l.y)},unscaleBy:function(l){return new ae(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=Te(this.x),this.y=Te(this.y),this},distanceTo:function(l){l=ve(l);var d=l.x-this.x,p=l.y-this.y;return Math.sqrt(d*d+p*p)},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("+f(this.x)+", "+f(this.y)+")"}};function ve(l,d,p){return l instanceof ae?l:M(l)?new ae(l[0],l[1]):l==null?l:typeof l=="object"&&"x"in l&&"y"in l?new ae(l.x,l.y):new ae(l,d,p)}function lt(l,d){if(l)for(var p=d?[l,d]:l,b=0,C=p.length;b<C;b++)this.extend(p[b])}lt.prototype={extend:function(l){var d,p;if(!l)return this;if(l instanceof ae||typeof l[0]=="number"||"x"in l)d=p=ve(l);else if(l=Qt(l),d=l.min,p=l.max,!d||!p)return this;return!this.min&&!this.max?(this.min=d.clone(),this.max=p.clone()):(this.min.x=Math.min(d.x,this.min.x),this.max.x=Math.max(p.x,this.max.x),this.min.y=Math.min(d.y,this.min.y),this.max.y=Math.max(p.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 d,p;return typeof l[0]=="number"||l instanceof ae?l=ve(l):l=Qt(l),l instanceof lt?(d=l.min,p=l.max):d=p=l,d.x>=this.min.x&&p.x<=this.max.x&&d.y>=this.min.y&&p.y<=this.max.y},intersects:function(l){l=Qt(l);var d=this.min,p=this.max,b=l.min,C=l.max,P=C.x>=d.x&&b.x<=p.x,W=C.y>=d.y&&b.y<=p.y;return P&&W},overlaps:function(l){l=Qt(l);var d=this.min,p=this.max,b=l.min,C=l.max,P=C.x>d.x&&b.x<p.x,W=C.y>d.y&&b.y<p.y;return P&&W},isValid:function(){return!!(this.min&&this.max)},pad:function(l){var d=this.min,p=this.max,b=Math.abs(d.x-p.x)*l,C=Math.abs(d.y-p.y)*l;return Qt(ve(d.x-b,d.y-C),ve(p.x+b,p.y+C))},equals:function(l){return l?(l=Qt(l),this.min.equals(l.getTopLeft())&&this.max.equals(l.getBottomRight())):!1}};function Qt(l,d){return!l||l instanceof lt?l:new lt(l,d)}function It(l,d){if(l)for(var p=d?[l,d]:l,b=0,C=p.length;b<C;b++)this.extend(p[b])}It.prototype={extend:function(l){var d=this._southWest,p=this._northEast,b,C;if(l instanceof Lt)b=l,C=l;else if(l instanceof It){if(b=l._southWest,C=l._northEast,!b||!C)return this}else return l?this.extend(gt(l)||Tt(l)):this;return!d&&!p?(this._southWest=new Lt(b.lat,b.lng),this._northEast=new Lt(C.lat,C.lng)):(d.lat=Math.min(b.lat,d.lat),d.lng=Math.min(b.lng,d.lng),p.lat=Math.max(C.lat,p.lat),p.lng=Math.max(C.lng,p.lng)),this},pad:function(l){var d=this._southWest,p=this._northEast,b=Math.abs(d.lat-p.lat)*l,C=Math.abs(d.lng-p.lng)*l;return new It(new Lt(d.lat-b,d.lng-C),new Lt(p.lat+b,p.lng+C))},getCenter:function(){return new Lt((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 Lt(this.getNorth(),this.getWest())},getSouthEast:function(){return new Lt(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 Lt||"lat"in l?l=gt(l):l=Tt(l);var d=this._southWest,p=this._northEast,b,C;return l instanceof It?(b=l.getSouthWest(),C=l.getNorthEast()):b=C=l,b.lat>=d.lat&&C.lat<=p.lat&&b.lng>=d.lng&&C.lng<=p.lng},intersects:function(l){l=Tt(l);var d=this._southWest,p=this._northEast,b=l.getSouthWest(),C=l.getNorthEast(),P=C.lat>=d.lat&&b.lat<=p.lat,W=C.lng>=d.lng&&b.lng<=p.lng;return P&&W},overlaps:function(l){l=Tt(l);var d=this._southWest,p=this._northEast,b=l.getSouthWest(),C=l.getNorthEast(),P=C.lat>d.lat&&b.lat<p.lat,W=C.lng>d.lng&&b.lng<p.lng;return P&&W},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(l,d){return l?(l=Tt(l),this._southWest.equals(l.getSouthWest(),d)&&this._northEast.equals(l.getNorthEast(),d)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function Tt(l,d){return l instanceof It?l:new It(l,d)}function Lt(l,d,p){if(isNaN(l)||isNaN(d))throw new Error("Invalid LatLng object: ("+l+", "+d+")");this.lat=+l,this.lng=+d,p!==void 0&&(this.alt=+p)}Lt.prototype={equals:function(l,d){if(!l)return!1;l=gt(l);var p=Math.max(Math.abs(this.lat-l.lat),Math.abs(this.lng-l.lng));return p<=(d===void 0?1e-9:d)},toString:function(l){return"LatLng("+f(this.lat,l)+", "+f(this.lng,l)+")"},distanceTo:function(l){return Gt.distance(this,gt(l))},wrap:function(){return Gt.wrapLatLng(this)},toBounds:function(l){var d=180*l/40075017,p=d/Math.cos(Math.PI/180*this.lat);return Tt([this.lat-d,this.lng-p],[this.lat+d,this.lng+p])},clone:function(){return new Lt(this.lat,this.lng,this.alt)}};function gt(l,d,p){return l instanceof Lt?l:M(l)&&typeof l[0]!="object"?l.length===3?new Lt(l[0],l[1],l[2]):l.length===2?new Lt(l[0],l[1]):null:l==null?l:typeof l=="object"&&"lat"in l?new Lt(l.lat,"lng"in l?l.lng:l.lon,l.alt):d===void 0?null:new Lt(l,d,p)}var Oi={latLngToPoint:function(l,d){var p=this.projection.project(l),b=this.scale(d);return this.transformation._transform(p,b)},pointToLatLng:function(l,d){var p=this.scale(d),b=this.transformation.untransform(l,p);return this.projection.unproject(b)},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 d=this.projection.bounds,p=this.scale(l),b=this.transformation.transform(d.min,p),C=this.transformation.transform(d.max,p);return new lt(b,C)},infinite:!1,wrapLatLng:function(l){var d=this.wrapLng?u(l.lng,this.wrapLng,!0):l.lng,p=this.wrapLat?u(l.lat,this.wrapLat,!0):l.lat,b=l.alt;return new Lt(p,d,b)},wrapLatLngBounds:function(l){var d=l.getCenter(),p=this.wrapLatLng(d),b=d.lat-p.lat,C=d.lng-p.lng;if(b===0&&C===0)return l;var P=l.getSouthWest(),W=l.getNorthEast(),Y=new Lt(P.lat-b,P.lng-C),ne=new Lt(W.lat-b,W.lng-C);return new It(Y,ne)}},Gt=n({},Oi,{wrapLng:[-180,180],R:6371e3,distance:function(l,d){var p=Math.PI/180,b=l.lat*p,C=d.lat*p,P=Math.sin((d.lat-l.lat)*p/2),W=Math.sin((d.lng-l.lng)*p/2),Y=P*P+Math.cos(b)*Math.cos(C)*W*W,ne=2*Math.atan2(Math.sqrt(Y),Math.sqrt(1-Y));return this.R*ne}}),Ae=6378137,Be={R:Ae,MAX_LATITUDE:85.0511287798,project:function(l){var d=Math.PI/180,p=this.MAX_LATITUDE,b=Math.max(Math.min(p,l.lat),-p),C=Math.sin(b*d);return new ae(this.R*l.lng*d,this.R*Math.log((1+C)/(1-C))/2)},unproject:function(l){var d=180/Math.PI;return new Lt((2*Math.atan(Math.exp(l.y/this.R))-Math.PI/2)*d,l.x*d/this.R)},bounds:(function(){var l=Ae*Math.PI;return new lt([-l,-l],[l,l])})()};function Mt(l,d,p,b){if(M(l)){this._a=l[0],this._b=l[1],this._c=l[2],this._d=l[3];return}this._a=l,this._b=d,this._c=p,this._d=b}Mt.prototype={transform:function(l,d){return this._transform(l.clone(),d)},_transform:function(l,d){return d=d||1,l.x=d*(this._a*l.x+this._b),l.y=d*(this._c*l.y+this._d),l},untransform:function(l,d){return d=d||1,new ae((l.x/d-this._b)/this._a,(l.y/d-this._d)/this._c)}};function kt(l,d,p,b){return new Mt(l,d,p,b)}var pi=n({},Gt,{code:"EPSG:3857",projection:Be,transformation:(function(){var l=.5/(Math.PI*Be.R);return kt(l,.5,-l,.5)})()}),Nt=n({},pi,{code:"EPSG:900913"});function mi(l){return document.createElementNS("http://www.w3.org/2000/svg",l)}function Mi(l,d){var p="",b,C,P,W,Y,ne;for(b=0,P=l.length;b<P;b++){for(Y=l[b],C=0,W=Y.length;C<W;C++)ne=Y[C],p+=(C?"L":"M")+ne.x+" "+ne.y;p+=d?X.svg?"z":"x":""}return p||"M0 0"}var Ui=document.documentElement.style,Fi="ActiveXObject"in window,yi=Fi&&!document.addEventListener,cn="msLaunchUri"in navigator&&!("documentMode"in document),Zi=_e("webkit"),rn=_e("android"),bn=_e("android 2")||_e("android 3"),_i=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),_n=rn&&_e("Google")&&_i<537&&!("AudioNode"in window),ki=!!window.opera,Ni=!cn&&_e("chrome"),fn=_e("gecko")&&!Zi&&!ki&&!Fi,On=!Ni&&_e("safari"),Vn=_e("phantom"),Un="OTransition"in Ui,Jt=navigator.platform.indexOf("Win")===0,be=Fi&&"transition"in Ui,K="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!bn,Ie="MozPerspective"in Ui,nt=!window.L_DISABLE_3D&&(be||K||Ie)&&!Un&&!Vn,Rt=typeof orientation<"u"||_e("mobile"),vt=Rt&&Zi,rt=Rt&&K,ni=!window.PointerEvent&&window.MSPointerEvent,ri=!!(window.PointerEvent||ni),Xi="ontouchstart"in window||!!window.TouchEvent,Hi=!window.L_NO_TOUCH&&(Xi||ri),A=Rt&&ki,te=Rt&&fn,H=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,ee=(function(){var l=!1;try{var d=Object.defineProperty({},"passive",{get:function(){l=!0}});window.addEventListener("testPassiveEventSupport",g,d),window.removeEventListener("testPassiveEventSupport",g,d)}catch{}return l})(),ke=(function(){return!!document.createElement("canvas").getContext})(),Ue=!!(document.createElementNS&&mi("svg").createSVGRect),z=!!Ue&&(function(){var l=document.createElement("div");return l.innerHTML="<svg/>",(l.firstChild&&l.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),$=!Ue&&(function(){try{var l=document.createElement("div");l.innerHTML='<v:shape adj="1"/>';var d=l.firstChild;return d.style.behavior="url(#default#VML)",d&&typeof d.adj=="object"}catch{return!1}})(),re=navigator.platform.indexOf("Mac")===0,xe=navigator.platform.indexOf("Linux")===0;function _e(l){return navigator.userAgent.toLowerCase().indexOf(l)>=0}var X={ie:Fi,ielt9:yi,edge:cn,webkit:Zi,android:rn,android23:bn,androidStock:_n,opera:ki,chrome:Ni,gecko:fn,safari:On,phantom:Vn,opera12:Un,win:Jt,ie3d:be,webkit3d:K,gecko3d:Ie,any3d:nt,mobile:Rt,mobileWebkit:vt,mobileWebkit3d:rt,msPointer:ni,pointer:ri,touch:Hi,touchNative:Xi,mobileOpera:A,mobileGecko:te,retina:H,passiveEvents:ee,canvas:ke,svg:Ue,vml:$,inlineSvg:z,mac:re,linux:xe},V=X.msPointer?"MSPointerDown":"pointerdown",ue=X.msPointer?"MSPointerMove":"pointermove",Le=X.msPointer?"MSPointerUp":"pointerup",Me=X.msPointer?"MSPointerCancel":"pointercancel",Oe={touchstart:V,touchmove:ue,touchend:Le,touchcancel:Me},Ze={touchstart:et,touchmove:Ct,touchend:Ct,touchcancel:Ct},bt={},Dt=!1;function Ht(l,d,p){return d==="touchstart"&&ze(),Ze[d]?(p=Ze[d].bind(this,p),l.addEventListener(Oe[d],p,!1),p):(console.warn("wrong event specified:",d),g)}function ct(l,d,p){if(!Oe[d]){console.warn("wrong event specified:",d);return}l.removeEventListener(Oe[d],p,!1)}function me(l){bt[l.pointerId]=l}function Ne(l){bt[l.pointerId]&&(bt[l.pointerId]=l)}function De(l){delete bt[l.pointerId]}function ze(){Dt||(document.addEventListener(V,me,!0),document.addEventListener(ue,Ne,!0),document.addEventListener(Le,De,!0),document.addEventListener(Me,De,!0),Dt=!0)}function Ct(l,d){if(d.pointerType!==(d.MSPOINTER_TYPE_MOUSE||"mouse")){d.touches=[];for(var p in bt)d.touches.push(bt[p]);d.changedTouches=[d],l(d)}}function et(l,d){d.MSPOINTER_TYPE_TOUCH&&d.pointerType===d.MSPOINTER_TYPE_TOUCH&&le(d),Ct(l,d)}function tt(l){var d={},p,b;for(b in l)p=l[b],d[b]=p&&p.bind?p.bind(l):p;return l=d,d.type="dblclick",d.detail=2,d.isTrusted=!1,d._simulated=!0,d}var at=200;function mt(l,d){l.addEventListener("dblclick",d);var p=0,b;function C(P){if(P.detail!==1){b=P.detail;return}if(!(P.pointerType==="mouse"||P.sourceCapabilities&&!P.sourceCapabilities.firesTouchEvents)){var W=ft(P);if(!(W.some(function(ne){return ne instanceof HTMLLabelElement&&ne.attributes.for})&&!W.some(function(ne){return ne instanceof HTMLInputElement||ne instanceof HTMLSelectElement}))){var Y=Date.now();Y-p<=at?(b++,b===2&&d(tt(P))):b=1,p=Y}}}return l.addEventListener("click",C),{dblclick:d,simDblclick:C}}function ui(l,d){l.removeEventListener("dblclick",d.dblclick),l.removeEventListener("click",d.simDblclick)}var ce=cs(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),He=cs(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),dt=He==="webkitTransition"||He==="OTransition"?He+"End":"transitionend";function At(l){return typeof l=="string"?document.getElementById(l):l}function ei(l,d){var p=l.style[d]||l.currentStyle&&l.currentStyle[d];if((!p||p==="auto")&&document.defaultView){var b=document.defaultView.getComputedStyle(l,null);p=b?b[d]:null}return p==="auto"?null:p}function ht(l,d,p){var b=document.createElement(l);return b.className=d||"",p&&p.appendChild(b),b}function st(l){var d=l.parentNode;d&&d.removeChild(l)}function Ye(l){for(;l.firstChild;)l.removeChild(l.firstChild)}function Ee(l){var d=l.parentNode;d&&d.lastChild!==l&&d.appendChild(l)}function Ot(l){var d=l.parentNode;d&&d.firstChild!==l&&d.insertBefore(l,d.firstChild)}function Re(l,d){if(l.classList!==void 0)return l.classList.contains(d);var p=Ln(l);return p.length>0&&new RegExp("(^|\\s)"+d+"(\\s|$)").test(p)}function Fe(l,d){if(l.classList!==void 0)for(var p=_(d),b=0,C=p.length;b<C;b++)l.classList.add(p[b]);else if(!Re(l,d)){var P=Ln(l);Yi(l,(P?P+" ":"")+d)}}function zt(l,d){l.classList!==void 0?l.classList.remove(d):Yi(l,v((" "+Ln(l)+" ").replace(" "+d+" "," ")))}function Yi(l,d){l.className.baseVal===void 0?l.className=d:l.className.baseVal=d}function Ln(l){return l.correspondingElement&&(l=l.correspondingElement),l.className.baseVal===void 0?l.className:l.className.baseVal}function un(l,d){"opacity"in l.style?l.style.opacity=d:"filter"in l.style&&Go(l,d)}function Go(l,d){var p=!1,b="DXImageTransform.Microsoft.Alpha";try{p=l.filters.item(b)}catch{if(d===1)return}d=Math.round(d*100),p?(p.Enabled=d!==100,p.Opacity=d):l.style.filter+=" progid:"+b+"(opacity="+d+")"}function cs(l){for(var d=document.documentElement.style,p=0;p<l.length;p++)if(l[p]in d)return l[p];return!1}function ds(l,d,p){var b=d||new ae(0,0);l.style[ce]=(X.ie3d?"translate("+b.x+"px,"+b.y+"px)":"translate3d("+b.x+"px,"+b.y+"px,0)")+(p?" scale("+p+")":"")}function Et(l,d){l._leaflet_pos=d,X.any3d?ds(l,d):(l.style.left=d.x+"px",l.style.top=d.y+"px")}function Qi(l){return l._leaflet_pos||new ae(0,0)}var Tn,Ft,Zo;if("onselectstart"in document)Tn=function(){yt(window,"selectstart",le)},Ft=function(){gn(window,"selectstart",le)};else{var wn=cs(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);Tn=function(){if(wn){var l=document.documentElement.style;Zo=l[wn],l[wn]="none"}},Ft=function(){wn&&(document.documentElement.style[wn]=Zo,Zo=void 0)}}function Ci(){yt(window,"dragstart",le)}function Os(){gn(window,"dragstart",le)}var Ls,Sr;function Cr(l){for(;l.tabIndex===-1;)l=l.parentNode;l.style&&($e(),Ls=l,Sr=l.style.outlineStyle,l.style.outlineStyle="none",yt(window,"keydown",$e))}function $e(){Ls&&(Ls.style.outlineStyle=Sr,Ls=void 0,Sr=void 0,gn(window,"keydown",$e))}function wt(l){do l=l.parentNode;while((!l.offsetWidth||!l.offsetHeight)&&l!==document.body);return l}function si(l){var d=l.getBoundingClientRect();return{x:d.width/l.offsetWidth||1,y:d.height/l.offsetHeight||1,boundingClientRect:d}}var Wi={__proto__:null,TRANSFORM:ce,TRANSITION:He,TRANSITION_END:dt,get:At,getStyle:ei,create:ht,remove:st,empty:Ye,toFront:Ee,toBack:Ot,hasClass:Re,addClass:Fe,removeClass:zt,setClass:Yi,getClass:Ln,setOpacity:un,testProp:cs,setTransform:ds,setPosition:Et,getPosition:Qi,get disableTextSelection(){return Tn},get enableTextSelection(){return Ft},disableImageDrag:Ci,enableImageDrag:Os,preventOutline:Cr,restoreOutline:$e,getSizedParentNode:wt,getScale:si};function yt(l,d,p,b){if(d&&typeof d=="object")for(var C in d)lg(l,C,d[C],p);else{d=_(d);for(var P=0,W=d.length;P<W;P++)lg(l,d[P],p,b)}return this}var Fn="_leaflet_events";function gn(l,d,p,b){if(arguments.length===1)eh(l),delete l[Fn];else if(d&&typeof d=="object")for(var C in d)cg(l,C,d[C],p);else if(d=_(d),arguments.length===2)eh(l,function(Y){return F(d,Y)!==-1});else for(var P=0,W=d.length;P<W;P++)cg(l,d[P],p,b);return this}function eh(l,d){for(var p in l[Fn]){var b=p.split(/\d/)[0];(!d||d(b))&&cg(l,b,null,null,p)}}var ag={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function lg(l,d,p,b){var C=d+c(p)+(b?"_"+c(b):"");if(l[Fn]&&l[Fn][C])return this;var P=function(Y){return p.call(b||l,Y||window.event)},W=P;!X.touchNative&&X.pointer&&d.indexOf("touch")===0?P=Ht(l,d,P):X.touch&&d==="dblclick"?P=mt(l,P):"addEventListener"in l?d==="touchstart"||d==="touchmove"||d==="wheel"||d==="mousewheel"?l.addEventListener(ag[d]||d,P,X.passiveEvents?{passive:!1}:!1):d==="mouseenter"||d==="mouseleave"?(P=function(Y){Y=Y||window.event,ji(l,Y)&&W(Y)},l.addEventListener(ag[d],P,!1)):l.addEventListener(d,W,!1):l.attachEvent("on"+d,P),l[Fn]=l[Fn]||{},l[Fn][C]=P}function cg(l,d,p,b,C){C=C||d+c(p)+(b?"_"+c(b):"");var P=l[Fn]&&l[Fn][C];if(!P)return this;!X.touchNative&&X.pointer&&d.indexOf("touch")===0?ct(l,d,P):X.touch&&d==="dblclick"?ui(l,P):"removeEventListener"in l?l.removeEventListener(ag[d]||d,P,!1):l.detachEvent("on"+d,P),l[Fn][C]=null}function oa(l){return l.stopPropagation?l.stopPropagation():l.originalEvent?l.originalEvent._stopped=!0:l.cancelBubble=!0,this}function dg(l){return lg(l,"wheel",oa),this}function U(l){return yt(l,"mousedown touchstart dblclick contextmenu",oa),l._leaflet_disable_click=!0,this}function le(l){return l.preventDefault?l.preventDefault():l.returnValue=!1,this}function fe(l){return le(l),oa(l),this}function ft(l){if(l.composedPath)return l.composedPath();for(var d=[],p=l.target;p;)d.push(p),p=p.parentNode;return d}function Pt(l,d){if(!d)return new ae(l.clientX,l.clientY);var p=si(d),b=p.boundingClientRect;return new ae((l.clientX-b.left)/p.x-d.clientLeft,(l.clientY-b.top)/p.y-d.clientTop)}var gi=X.linux&&X.chrome?window.devicePixelRatio:X.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function ai(l){return X.edge?l.wheelDeltaY/2:l.deltaY&&l.deltaMode===0?-l.deltaY/gi: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 ji(l,d){var p=d.relatedTarget;if(!p)return!0;try{for(;p&&p!==l;)p=p.parentNode}catch{return!1}return p!==l}var fi={__proto__:null,on:yt,off:gn,stopPropagation:oa,disableScrollPropagation:dg,disableClickPropagation:U,preventDefault:le,stop:fe,getPropagationPath:ft,getMousePosition:Pt,getWheelDelta:ai,isExternalTarget:ji,addListener:yt,removeListener:gn},Ji=Kt.extend({run:function(l,d,p,b){this.stop(),this._el=l,this._inProgress=!0,this._duration=p||.25,this._easeOutPower=1/Math.max(b||.5,.2),this._startPos=Qi(l),this._offset=d.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=Pe(this._animate,this),this._step()},_step:function(l){var d=+new Date-this._startTime,p=this._duration*1e3;d<p?this._runFrame(this._easeOut(d/p),l):(this._runFrame(1),this._complete())},_runFrame:function(l,d){var p=this._startPos.add(this._offset.multiplyBy(l));d&&p._round(),Et(this._el,p),this.fire("step")},_complete:function(){je(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(l){return 1-Math.pow(1-l,this._easeOutPower)}}),ut=Kt.extend({options:{crs:pi,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,d){d=y(this,d),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(l),this._initLayout(),this._onResize=r(this._onResize,this),this._initEvents(),d.maxBounds&&this.setMaxBounds(d.maxBounds),d.zoom!==void 0&&(this._zoom=this._limitZoom(d.zoom)),d.center&&d.zoom!==void 0&&this.setView(gt(d.center),d.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=He&&X.any3d&&!X.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),yt(this._proxy,dt,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(l,d,p){if(d=d===void 0?this._zoom:this._limitZoom(d),l=this._limitCenter(gt(l),d,this.options.maxBounds),p=p||{},this._stop(),this._loaded&&!p.reset&&p!==!0){p.animate!==void 0&&(p.zoom=n({animate:p.animate},p.zoom),p.pan=n({animate:p.animate,duration:p.duration},p.pan));var b=this._zoom!==d?this._tryAnimatedZoom&&this._tryAnimatedZoom(l,d,p.zoom):this._tryAnimatedPan(l,p.pan);if(b)return clearTimeout(this._sizeTimer),this}return this._resetView(l,d,p.pan&&p.pan.noMoveStart),this},setZoom:function(l,d){return this._loaded?this.setView(this.getCenter(),l,{zoom:d}):(this._zoom=l,this)},zoomIn:function(l,d){return l=l||(X.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+l,d)},zoomOut:function(l,d){return l=l||(X.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-l,d)},setZoomAround:function(l,d,p){var b=this.getZoomScale(d),C=this.getSize().divideBy(2),P=l instanceof ae?l:this.latLngToContainerPoint(l),W=P.subtract(C).multiplyBy(1-1/b),Y=this.containerPointToLatLng(C.add(W));return this.setView(Y,d,{zoom:p})},_getBoundsCenterZoom:function(l,d){d=d||{},l=l.getBounds?l.getBounds():Tt(l);var p=ve(d.paddingTopLeft||d.padding||[0,0]),b=ve(d.paddingBottomRight||d.padding||[0,0]),C=this.getBoundsZoom(l,!1,p.add(b));if(C=typeof d.maxZoom=="number"?Math.min(d.maxZoom,C):C,C===1/0)return{center:l.getCenter(),zoom:C};var P=b.subtract(p).divideBy(2),W=this.project(l.getSouthWest(),C),Y=this.project(l.getNorthEast(),C),ne=this.unproject(W.add(Y).divideBy(2).add(P),C);return{center:ne,zoom:C}},fitBounds:function(l,d){if(l=Tt(l),!l.isValid())throw new Error("Bounds are not valid.");var p=this._getBoundsCenterZoom(l,d);return this.setView(p.center,p.zoom,d)},fitWorld:function(l){return this.fitBounds([[-90,-180],[90,180]],l)},panTo:function(l,d){return this.setView(l,this._zoom,{pan:d})},panBy:function(l,d){if(l=ve(l).round(),d=d||{},!l.x&&!l.y)return this.fire("moveend");if(d.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 Ji,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),d.noMoveStart||this.fire("movestart"),d.animate!==!1){Fe(this._mapPane,"leaflet-pan-anim");var p=this._getMapPanePos().subtract(l).round();this._panAnim.run(this._mapPane,p,d.duration||.25,d.easeLinearity)}else this._rawPanBy(l),this.fire("move").fire("moveend");return this},flyTo:function(l,d,p){if(p=p||{},p.animate===!1||!X.any3d)return this.setView(l,d,p);this._stop();var b=this.project(this.getCenter()),C=this.project(l),P=this.getSize(),W=this._zoom;l=gt(l),d=d===void 0?W:d;var Y=Math.max(P.x,P.y),ne=Y*this.getZoomScale(W,d),ye=C.distanceTo(b)||1,ot=1.42,Yt=ot*ot;function Ii(Zn){var Gp=Zn?-1:1,PR=Zn?ne:Y,TR=ne*ne-Y*Y+Gp*Yt*Yt*ye*ye,MR=2*PR*Yt*ye,fw=TR/MR,aL=Math.sqrt(fw*fw+1)-fw,NR=aL<1e-9?-18:Math.log(aL);return NR}function Fs(Zn){return(Math.exp(Zn)-Math.exp(-Zn))/2}function os(Zn){return(Math.exp(Zn)+Math.exp(-Zn))/2}function xo(Zn){return Fs(Zn)/os(Zn)}var Gs=Ii(0);function rh(Zn){return Y*(os(Gs)/os(Gs+ot*Zn))}function IR(Zn){return Y*(os(Gs)*xo(Gs+ot*Zn)-Fs(Gs))/Yt}function kR(Zn){return 1-Math.pow(1-Zn,1.5)}var DR=Date.now(),oL=(Ii(1)-Gs)/ot,ER=p.duration?1e3*p.duration:1e3*oL*.8;function rL(){var Zn=(Date.now()-DR)/ER,Gp=kR(Zn)*oL;Zn<=1?(this._flyToFrame=Pe(rL,this),this._move(this.unproject(b.add(C.subtract(b).multiplyBy(IR(Gp)/ye)),W),this.getScaleZoom(Y/rh(Gp),W),{flyTo:!0})):this._move(l,d)._moveEnd(!0)}return this._moveStart(!0,p.noMoveStart),rL.call(this),this},flyToBounds:function(l,d){var p=this._getBoundsCenterZoom(l,d);return this.flyTo(p.center,p.zoom,d)},setMaxBounds:function(l){return l=Tt(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 d=this.options.minZoom;return this.options.minZoom=l,this._loaded&&d!==l&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(l):this},setMaxZoom:function(l){var d=this.options.maxZoom;return this.options.maxZoom=l,this._loaded&&d!==l&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(l):this},panInsideBounds:function(l,d){this._enforcingBounds=!0;var p=this.getCenter(),b=this._limitCenter(p,this._zoom,Tt(l));return p.equals(b)||this.panTo(b,d),this._enforcingBounds=!1,this},panInside:function(l,d){d=d||{};var p=ve(d.paddingTopLeft||d.padding||[0,0]),b=ve(d.paddingBottomRight||d.padding||[0,0]),C=this.project(this.getCenter()),P=this.project(l),W=this.getPixelBounds(),Y=Qt([W.min.add(p),W.max.subtract(b)]),ne=Y.getSize();if(!Y.contains(P)){this._enforcingBounds=!0;var ye=P.subtract(Y.getCenter()),ot=Y.extend(P).getSize().subtract(ne);C.x+=ye.x<0?-ot.x:ot.x,C.y+=ye.y<0?-ot.y:ot.y,this.panTo(this.unproject(C),d),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 d=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var p=this.getSize(),b=d.divideBy(2).round(),C=p.divideBy(2).round(),P=b.subtract(C);return!P.x&&!P.y?this:(l.animate&&l.pan?this.panBy(P):(l.pan&&this._rawPanBy(P),this.fire("move"),l.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(r(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:d,newSize:p}))},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 d=r(this._handleGeolocationResponse,this),p=r(this._handleGeolocationError,this);return l.watch?this._locationWatchId=navigator.geolocation.watchPosition(d,p,l):navigator.geolocation.getCurrentPosition(d,p,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 d=l.code,p=l.message||(d===1?"permission denied":d===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:d,message:"Geolocation error: "+p+"."})}},_handleGeolocationResponse:function(l){if(this._container._leaflet_id){var d=l.coords.latitude,p=l.coords.longitude,b=new Lt(d,p),C=b.toBounds(l.coords.accuracy*2),P=this._locateOptions;if(P.setView){var W=this.getBoundsZoom(C);this.setView(b,P.maxZoom?Math.min(W,P.maxZoom):W)}var Y={latlng:b,bounds:C,timestamp:l.timestamp};for(var ne in l.coords)typeof l.coords[ne]=="number"&&(Y[ne]=l.coords[ne]);this.fire("locationfound",Y)}},addHandler:function(l,d){if(!d)return this;var p=this[l]=new d(this);return this._handlers.push(p),this.options[l]&&p.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(),st(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(je(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)st(this._panes[l]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(l,d){var p="leaflet-pane"+(l?" leaflet-"+l.replace("Pane","")+"-pane":""),b=ht("div",p,d||this._mapPane);return l&&(this._panes[l]=b),b},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(),d=this.unproject(l.getBottomLeft()),p=this.unproject(l.getTopRight());return new It(d,p)},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,d,p){l=Tt(l),p=ve(p||[0,0]);var b=this.getZoom()||0,C=this.getMinZoom(),P=this.getMaxZoom(),W=l.getNorthWest(),Y=l.getSouthEast(),ne=this.getSize().subtract(p),ye=Qt(this.project(Y,b),this.project(W,b)).getSize(),ot=X.any3d?this.options.zoomSnap:1,Yt=ne.x/ye.x,Ii=ne.y/ye.y,Fs=d?Math.max(Yt,Ii):Math.min(Yt,Ii);return b=this.getScaleZoom(Fs,b),ot&&(b=Math.round(b/(ot/100))*(ot/100),b=d?Math.ceil(b/ot)*ot:Math.floor(b/ot)*ot),Math.max(C,Math.min(P,b))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new ae(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(l,d){var p=this._getTopLeftPoint(l,d);return new lt(p,p.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,d){var p=this.options.crs;return d=d===void 0?this._zoom:d,p.scale(l)/p.scale(d)},getScaleZoom:function(l,d){var p=this.options.crs;d=d===void 0?this._zoom:d;var b=p.zoom(l*p.scale(d));return isNaN(b)?1/0:b},project:function(l,d){return d=d===void 0?this._zoom:d,this.options.crs.latLngToPoint(gt(l),d)},unproject:function(l,d){return d=d===void 0?this._zoom:d,this.options.crs.pointToLatLng(ve(l),d)},layerPointToLatLng:function(l){var d=ve(l).add(this.getPixelOrigin());return this.unproject(d)},latLngToLayerPoint:function(l){var d=this.project(gt(l))._round();return d._subtract(this.getPixelOrigin())},wrapLatLng:function(l){return this.options.crs.wrapLatLng(gt(l))},wrapLatLngBounds:function(l){return this.options.crs.wrapLatLngBounds(Tt(l))},distance:function(l,d){return this.options.crs.distance(gt(l),gt(d))},containerPointToLayerPoint:function(l){return ve(l).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(l){return ve(l).add(this._getMapPanePos())},containerPointToLatLng:function(l){var d=this.containerPointToLayerPoint(ve(l));return this.layerPointToLatLng(d)},latLngToContainerPoint:function(l){return this.layerPointToContainerPoint(this.latLngToLayerPoint(gt(l)))},mouseEventToContainerPoint:function(l){return Pt(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 d=this._container=At(l);if(d){if(d._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");yt(d,"scroll",this._onScroll,this),this._containerId=c(d)},_initLayout:function(){var l=this._container;this._fadeAnimated=this.options.fadeAnimation&&X.any3d,Fe(l,"leaflet-container"+(X.touch?" leaflet-touch":"")+(X.retina?" leaflet-retina":"")+(X.ielt9?" leaflet-oldie":"")+(X.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var d=ei(l,"position");d!=="absolute"&&d!=="relative"&&d!=="fixed"&&d!=="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),Et(this._mapPane,new ae(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(Fe(l.markerPane,"leaflet-zoom-hide"),Fe(l.shadowPane,"leaflet-zoom-hide"))},_resetView:function(l,d,p){Et(this._mapPane,new ae(0,0));var b=!this._loaded;this._loaded=!0,d=this._limitZoom(d),this.fire("viewprereset");var C=this._zoom!==d;this._moveStart(C,p)._move(l,d)._moveEnd(C),this.fire("viewreset"),b&&this.fire("load")},_moveStart:function(l,d){return l&&this.fire("zoomstart"),d||this.fire("movestart"),this},_move:function(l,d,p,b){d===void 0&&(d=this._zoom);var C=this._zoom!==d;return this._zoom=d,this._lastCenter=l,this._pixelOrigin=this._getNewPixelOrigin(l),b?p&&p.pinch&&this.fire("zoom",p):((C||p&&p.pinch)&&this.fire("zoom",p),this.fire("move",p)),this},_moveEnd:function(l){return l&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return je(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(l){Et(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[c(this._container)]=this;var d=l?gn:yt;d(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&d(window,"resize",this._onResize,this),X.any3d&&this.options.transform3DLimit&&(l?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){je(this._resizeRequest),this._resizeRequest=Pe(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,d){for(var p=[],b,C=d==="mouseout"||d==="mouseover",P=l.target||l.srcElement,W=!1;P;){if(b=this._targets[c(P)],b&&(d==="click"||d==="preclick")&&this._draggableMoved(b)){W=!0;break}if(b&&b.listens(d,!0)&&(C&&!ji(P,l)||(p.push(b),C))||P===this._container)break;P=P.parentNode}return!p.length&&!W&&!C&&this.listens(d,!0)&&(p=[this]),p},_isClickDisabled:function(l){for(;l&&l!==this._container;){if(l._leaflet_disable_click)return!0;l=l.parentNode}},_handleDOMEvent:function(l){var d=l.target||l.srcElement;if(!(!this._loaded||d._leaflet_disable_events||l.type==="click"&&this._isClickDisabled(d))){var p=l.type;p==="mousedown"&&Cr(d),this._fireDOMEvent(l,p)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(l,d,p){if(l.type==="click"){var b=n({},l);b.type="preclick",this._fireDOMEvent(b,b.type,p)}var C=this._findEventTargets(l,d);if(p){for(var P=[],W=0;W<p.length;W++)p[W].listens(d,!0)&&P.push(p[W]);C=P.concat(C)}if(C.length){d==="contextmenu"&&le(l);var Y=C[0],ne={originalEvent:l};if(l.type!=="keypress"&&l.type!=="keydown"&&l.type!=="keyup"){var ye=Y.getLatLng&&(!Y._radius||Y._radius<=10);ne.containerPoint=ye?this.latLngToContainerPoint(Y.getLatLng()):this.mouseEventToContainerPoint(l),ne.layerPoint=this.containerPointToLayerPoint(ne.containerPoint),ne.latlng=ye?Y.getLatLng():this.layerPointToLatLng(ne.layerPoint)}for(W=0;W<C.length;W++)if(C[W].fire(d,ne,!0),ne.originalEvent._stopped||C[W].options.bubblingMouseEvents===!1&&F(this._mouseEvents,d)!==-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,d=this._handlers.length;l<d;l++)this._handlers[l].disable()},whenReady:function(l,d){return this._loaded?l.call(d||this,{target:this}):this.on("load",l,d),this},_getMapPanePos:function(){return Qi(this._mapPane)||new ae(0,0)},_moved:function(){var l=this._getMapPanePos();return l&&!l.equals([0,0])},_getTopLeftPoint:function(l,d){var p=l&&d!==void 0?this._getNewPixelOrigin(l,d):this.getPixelOrigin();return p.subtract(this._getMapPanePos())},_getNewPixelOrigin:function(l,d){var p=this.getSize()._divideBy(2);return this.project(l,d)._subtract(p)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(l,d,p){var b=this._getNewPixelOrigin(p,d);return this.project(l,d)._subtract(b)},_latLngBoundsToNewLayerBounds:function(l,d,p){var b=this._getNewPixelOrigin(p,d);return Qt([this.project(l.getSouthWest(),d)._subtract(b),this.project(l.getNorthWest(),d)._subtract(b),this.project(l.getSouthEast(),d)._subtract(b),this.project(l.getNorthEast(),d)._subtract(b)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(l){return this.latLngToLayerPoint(l).subtract(this._getCenterLayerPoint())},_limitCenter:function(l,d,p){if(!p)return l;var b=this.project(l,d),C=this.getSize().divideBy(2),P=new lt(b.subtract(C),b.add(C)),W=this._getBoundsOffset(P,p,d);return Math.abs(W.x)<=1&&Math.abs(W.y)<=1?l:this.unproject(b.add(W),d)},_limitOffset:function(l,d){if(!d)return l;var p=this.getPixelBounds(),b=new lt(p.min.add(l),p.max.add(l));return l.add(this._getBoundsOffset(b,d))},_getBoundsOffset:function(l,d,p){var b=Qt(this.project(d.getNorthEast(),p),this.project(d.getSouthWest(),p)),C=b.min.subtract(l.min),P=b.max.subtract(l.max),W=this._rebound(C.x,-P.x),Y=this._rebound(C.y,-P.y);return new ae(W,Y)},_rebound:function(l,d){return l+d>0?Math.round(l-d)/2:Math.max(0,Math.ceil(l))-Math.max(0,Math.floor(d))},_limitZoom:function(l){var d=this.getMinZoom(),p=this.getMaxZoom(),b=X.any3d?this.options.zoomSnap:1;return b&&(l=Math.round(l/b)*b),Math.max(d,Math.min(p,l))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){zt(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(l,d){var p=this._getCenterOffset(l)._trunc();return(d&&d.animate)!==!0&&!this.getSize().contains(p)?!1:(this.panBy(p,d),!0)},_createAnimProxy:function(){var l=this._proxy=ht("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(l),this.on("zoomanim",function(d){var p=ce,b=this._proxy.style[p];ds(this._proxy,this.project(d.center,d.zoom),this.getZoomScale(d.zoom,1)),b===this._proxy.style[p]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){st(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var l=this.getCenter(),d=this.getZoom();ds(this._proxy,this.project(l,d),this.getZoomScale(d,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,d,p){if(this._animatingZoom)return!0;if(p=p||{},!this._zoomAnimated||p.animate===!1||this._nothingToAnimate()||Math.abs(d-this._zoom)>this.options.zoomAnimationThreshold)return!1;var b=this.getZoomScale(d),C=this._getCenterOffset(l)._divideBy(1-1/b);return p.animate!==!0&&!this.getSize().contains(C)?!1:(Pe(function(){this._moveStart(!0,p.noMoveStart||!1)._animateZoom(l,d,!0)},this),!0)},_animateZoom:function(l,d,p,b){this._mapPane&&(p&&(this._animatingZoom=!0,this._animateToCenter=l,this._animateToZoom=d,Fe(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:l,zoom:d,noUpdate:b}),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&&zt(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 hi(l,d){return new ut(l,d)}var en=Ge.extend({options:{position:"topright"},initialize:function(l){y(this,l)},getPosition:function(){return this.options.position},setPosition:function(l){var d=this._map;return d&&d.removeControl(this),this.options.position=l,d&&d.addControl(this),this},getContainer:function(){return this._container},addTo:function(l){this.remove(),this._map=l;var d=this._container=this.onAdd(l),p=this.getPosition(),b=l._controlCorners[p];return Fe(d,"leaflet-control"),p.indexOf("bottom")!==-1?b.insertBefore(d,b.firstChild):b.appendChild(d),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(st(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()}}),Qn=function(l){return new en(l)};ut.include({addControl:function(l){return l.addTo(this),this},removeControl:function(l){return l.remove(),this},_initControlPos:function(){var l=this._controlCorners={},d="leaflet-",p=this._controlContainer=ht("div",d+"control-container",this._container);function b(C,P){var W=d+C+" "+d+P;l[C+P]=ht("div",W,p)}b("top","left"),b("top","right"),b("bottom","left"),b("bottom","right")},_clearControlPos:function(){for(var l in this._controlCorners)st(this._controlCorners[l]);st(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var So=en.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(l,d,p,b){return p<b?-1:b<p?1:0}},initialize:function(l,d,p){y(this,p),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1;for(var b in l)this._addLayer(l[b],b);for(b in d)this._addLayer(d[b],b,!0)},onAdd:function(l){this._initLayout(),this._update(),this._map=l,l.on("zoomend",this._checkDisabledLayers,this);for(var d=0;d<this._layers.length;d++)this._layers[d].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(l){return en.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,d){return this._addLayer(l,d),this._map?this._update():this},addOverlay:function(l,d){return this._addLayer(l,d,!0),this._map?this._update():this},removeLayer:function(l){l.off("add remove",this._onLayerChange,this);var d=this._getLayer(c(l));return d&&this._layers.splice(this._layers.indexOf(d),1),this._map?this._update():this},expand:function(){Fe(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?(Fe(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=l+"px"):zt(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return zt(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var l="leaflet-control-layers",d=this._container=ht("div",l),p=this.options.collapsed;d.setAttribute("aria-haspopup",!0),U(d),dg(d);var b=this._section=ht("section",l+"-list");p&&(this._map.on("click",this.collapse,this),yt(d,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var C=this._layersLink=ht("a",l+"-toggle",d);C.href="#",C.title="Layers",C.setAttribute("role","button"),yt(C,{keydown:function(P){P.keyCode===13&&this._expandSafely()},click:function(P){le(P),this._expandSafely()}},this),p||this.expand(),this._baseLayersList=ht("div",l+"-base",b),this._separator=ht("div",l+"-separator",b),this._overlaysList=ht("div",l+"-overlays",b),d.appendChild(b)},_getLayer:function(l){for(var d=0;d<this._layers.length;d++)if(this._layers[d]&&c(this._layers[d].layer)===l)return this._layers[d]},_addLayer:function(l,d,p){this._map&&l.on("add remove",this._onLayerChange,this),this._layers.push({layer:l,name:d,overlay:p}),this.options.sortLayers&&this._layers.sort(r(function(b,C){return this.options.sortFunction(b.layer,C.layer,b.name,C.name)},this)),this.options.autoZIndex&&l.setZIndex&&(this._lastZIndex++,l.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;Ye(this._baseLayersList),Ye(this._overlaysList),this._layerControlInputs=[];var l,d,p,b,C=0;for(p=0;p<this._layers.length;p++)b=this._layers[p],this._addItem(b),d=d||b.overlay,l=l||!b.overlay,C+=b.overlay?0:1;return this.options.hideSingleBase&&(l=l&&C>1,this._baseLayersList.style.display=l?"":"none"),this._separator.style.display=d&&l?"":"none",this},_onLayerChange:function(l){this._handlingClick||this._update();var d=this._getLayer(c(l.target)),p=d.overlay?l.type==="add"?"overlayadd":"overlayremove":l.type==="add"?"baselayerchange":null;p&&this._map.fire(p,d)},_createRadioElement:function(l,d){var p='<input type="radio" class="leaflet-control-layers-selector" name="'+l+'"'+(d?' checked="checked"':"")+"/>",b=document.createElement("div");return b.innerHTML=p,b.firstChild},_addItem:function(l){var d=document.createElement("label"),p=this._map.hasLayer(l.layer),b;l.overlay?(b=document.createElement("input"),b.type="checkbox",b.className="leaflet-control-layers-selector",b.defaultChecked=p):b=this._createRadioElement("leaflet-base-layers_"+c(this),p),this._layerControlInputs.push(b),b.layerId=c(l.layer),yt(b,"click",this._onInputClick,this);var C=document.createElement("span");C.innerHTML=" "+l.name;var P=document.createElement("span");d.appendChild(P),P.appendChild(b),P.appendChild(C);var W=l.overlay?this._overlaysList:this._baseLayersList;return W.appendChild(d),this._checkDisabledLayers(),d},_onInputClick:function(){if(!this._preventClick){var l=this._layerControlInputs,d,p,b=[],C=[];this._handlingClick=!0;for(var P=l.length-1;P>=0;P--)d=l[P],p=this._getLayer(d.layerId).layer,d.checked?b.push(p):d.checked||C.push(p);for(P=0;P<C.length;P++)this._map.hasLayer(C[P])&&this._map.removeLayer(C[P]);for(P=0;P<b.length;P++)this._map.hasLayer(b[P])||this._map.addLayer(b[P]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var l=this._layerControlInputs,d,p,b=this._map.getZoom(),C=l.length-1;C>=0;C--)d=l[C],p=this._getLayer(d.layerId).layer,d.disabled=p.options.minZoom!==void 0&&b<p.options.minZoom||p.options.maxZoom!==void 0&&b>p.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var l=this._section;this._preventClick=!0,yt(l,"click",le),this.expand();var d=this;setTimeout(function(){gn(l,"click",le),d._preventClick=!1})}}),Xo=function(l,d,p){return new So(l,d,p)},Jn=en.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 d="leaflet-control-zoom",p=ht("div",d+" leaflet-bar"),b=this.options;return this._zoomInButton=this._createButton(b.zoomInText,b.zoomInTitle,d+"-in",p,this._zoomIn),this._zoomOutButton=this._createButton(b.zoomOutText,b.zoomOutTitle,d+"-out",p,this._zoomOut),this._updateDisabled(),l.on("zoomend zoomlevelschange",this._updateDisabled,this),p},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,d,p,b,C){var P=ht("a",p,b);return P.innerHTML=l,P.href="#",P.title=d,P.setAttribute("role","button"),P.setAttribute("aria-label",d),U(P),yt(P,"click",fe),yt(P,"click",C,this),yt(P,"click",this._refocusOnMap,this),P},_updateDisabled:function(){var l=this._map,d="leaflet-disabled";zt(this._zoomInButton,d),zt(this._zoomOutButton,d),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||l._zoom===l.getMinZoom())&&(Fe(this._zoomOutButton,d),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||l._zoom===l.getMaxZoom())&&(Fe(this._zoomInButton,d),this._zoomInButton.setAttribute("aria-disabled","true"))}});ut.mergeOptions({zoomControl:!0}),ut.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Jn,this.addControl(this.zoomControl))});var ra=function(l){return new Jn(l)},xr=en.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(l){var d="leaflet-control-scale",p=ht("div",d),b=this.options;return this._addScales(b,d+"-line",p),l.on(b.updateWhenIdle?"moveend":"move",this._update,this),l.whenReady(this._update,this),p},onRemove:function(l){l.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(l,d,p){l.metric&&(this._mScale=ht("div",d,p)),l.imperial&&(this._iScale=ht("div",d,p))},_update:function(){var l=this._map,d=l.getSize().y/2,p=l.distance(l.containerPointToLatLng([0,d]),l.containerPointToLatLng([this.options.maxWidth,d]));this._updateScales(p)},_updateScales:function(l){this.options.metric&&l&&this._updateMetric(l),this.options.imperial&&l&&this._updateImperial(l)},_updateMetric:function(l){var d=this._getRoundNum(l),p=d<1e3?d+" m":d/1e3+" km";this._updateScale(this._mScale,p,d/l)},_updateImperial:function(l){var d=l*3.2808399,p,b,C;d>5280?(p=d/5280,b=this._getRoundNum(p),this._updateScale(this._iScale,b+" mi",b/p)):(C=this._getRoundNum(d),this._updateScale(this._iScale,C+" ft",C/d))},_updateScale:function(l,d,p){l.style.width=Math.round(this.options.maxWidth*p)+"px",l.innerHTML=d},_getRoundNum:function(l){var d=Math.pow(10,(Math.floor(l)+"").length-1),p=l/d;return p=p>=10?10:p>=5?5:p>=3?3:p>=2?2:1,d*p}}),nc=function(l){return new xr(l)},Gn='<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>',Lr=en.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(X.inlineSvg?Gn+" ":"")+"Leaflet</a>"},initialize:function(l){y(this,l),this._attributions={}},onAdd:function(l){l.attributionControl=this,this._container=ht("div","leaflet-control-attribution"),U(this._container);for(var d in l._layers)l._layers[d].getAttribution&&this.addAttribution(l._layers[d].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 d in this._attributions)this._attributions[d]&&l.push(d);var p=[];this.options.prefix&&p.push(this.options.prefix),l.length&&p.push(l.join(", ")),this._container.innerHTML=p.join(' <span aria-hidden="true">|</span> ')}}});ut.mergeOptions({attributionControl:!0}),ut.addInitHook(function(){this.options.attributionControl&&new Lr().addTo(this)});var aa=function(l){return new Lr(l)};en.Layers=So,en.Zoom=Jn,en.Scale=xr,en.Attribution=Lr,Qn.layers=Xo,Qn.zoom=ra,Qn.scale=nc,Qn.attribution=aa;var jn=Ge.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}});jn.addTo=function(l,d){return l.addHandler(d,this),this};var la={Events:pt},$n=X.touch?"touchstart mousedown":"mousedown",Is=Kt.extend({options:{clickTolerance:3},initialize:function(l,d,p,b){y(this,b),this._element=l,this._dragStartTarget=d||l,this._preventOutline=p},enable:function(){this._enabled||(yt(this._dragStartTarget,$n,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Is._dragging===this&&this.finishDrag(!0),gn(this._dragStartTarget,$n,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(l){if(this._enabled&&(this._moved=!1,!Re(this._element,"leaflet-zoom-anim"))){if(l.touches&&l.touches.length!==1){Is._dragging===this&&this.finishDrag();return}if(!(Is._dragging||l.shiftKey||l.which!==1&&l.button!==1&&!l.touches)&&(Is._dragging=this,this._preventOutline&&Cr(this._element),Ci(),Tn(),!this._moving)){this.fire("down");var d=l.touches?l.touches[0]:l,p=wt(this._element);this._startPoint=new ae(d.clientX,d.clientY),this._startPos=Qi(this._element),this._parentScale=si(p);var b=l.type==="mousedown";yt(document,b?"mousemove":"touchmove",this._onMove,this),yt(document,b?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(l){if(this._enabled){if(l.touches&&l.touches.length>1){this._moved=!0;return}var d=l.touches&&l.touches.length===1?l.touches[0]:l,p=new ae(d.clientX,d.clientY)._subtract(this._startPoint);!p.x&&!p.y||Math.abs(p.x)+Math.abs(p.y)<this.options.clickTolerance||(p.x/=this._parentScale.x,p.y/=this._parentScale.y,le(l),this._moved||(this.fire("dragstart"),this._moved=!0,Fe(document.body,"leaflet-dragging"),this._lastTarget=l.target||l.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),Fe(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(p),this._moving=!0,this._lastEvent=l,this._updatePosition())}},_updatePosition:function(){var l={originalEvent:this._lastEvent};this.fire("predrag",l),Et(this._element,this._newPos),this.fire("drag",l)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(l){zt(document.body,"leaflet-dragging"),this._lastTarget&&(zt(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),gn(document,"mousemove touchmove",this._onMove,this),gn(document,"mouseup touchend touchcancel",this._onUp,this),Os(),Ft();var d=this._moved&&this._moving;this._moving=!1,Is._dragging=!1,d&&this.fire("dragend",{noInertia:l,distance:this._newPos.distanceTo(this._startPos)})}});function Op(l,d,p){var b,C=[1,4,2,8],P,W,Y,ne,ye,ot,Yt,Ii;for(P=0,ot=l.length;P<ot;P++)l[P]._code=sc(l[P],d);for(Y=0;Y<4;Y++){for(Yt=C[Y],b=[],P=0,ot=l.length,W=ot-1;P<ot;W=P++)ne=l[P],ye=l[W],ne._code&Yt?ye._code&Yt||(Ii=Fp(ye,ne,Yt,d,p),Ii._code=sc(Ii,d),b.push(Ii)):(ye._code&Yt&&(Ii=Fp(ye,ne,Yt,d,p),Ii._code=sc(Ii,d),b.push(Ii)),b.push(ne));l=b}return l}function M0(l,d){var p,b,C,P,W,Y,ne,ye,ot;if(!l||l.length===0)throw new Error("latlngs not passed");Co(l)||(console.warn("latlngs are not flat! Only the first ring will be used"),l=l[0]);var Yt=gt([0,0]),Ii=Tt(l),Fs=Ii.getNorthWest().distanceTo(Ii.getSouthWest())*Ii.getNorthEast().distanceTo(Ii.getNorthWest());Fs<1700&&(Yt=rw(l));var os=l.length,xo=[];for(p=0;p<os;p++){var Gs=gt(l[p]);xo.push(d.project(gt([Gs.lat-Yt.lat,Gs.lng-Yt.lng])))}for(Y=ne=ye=0,p=0,b=os-1;p<os;b=p++)C=xo[p],P=xo[b],W=C.y*P.x-P.y*C.x,ne+=(C.x+P.x)*W,ye+=(C.y+P.y)*W,Y+=W*3;Y===0?ot=xo[0]:ot=[ne/Y,ye/Y];var rh=d.unproject(ve(ot));return gt([rh.lat+Yt.lat,rh.lng+Yt.lng])}function rw(l){for(var d=0,p=0,b=0,C=0;C<l.length;C++){var P=gt(l[C]);d+=P.lat,p+=P.lng,b++}return gt([d/b,p/b])}var XN={__proto__:null,clipPolygon:Op,polygonCenter:M0,centroid:rw};function N0(l,d){if(!d||!l.length)return l.slice();var p=d*d;return l=JN(l,p),l=QN(l,p),l}function R0(l,d,p){return Math.sqrt(hg(l,d,p,!0))}function YN(l,d,p){return hg(l,d,p)}function QN(l,d){var p=l.length,b=typeof Uint8Array<"u"?Uint8Array:Array,C=new b(p);C[0]=C[p-1]=1,aw(l,C,d,0,p-1);var P,W=[];for(P=0;P<p;P++)C[P]&&W.push(l[P]);return W}function aw(l,d,p,b,C){var P=0,W,Y,ne;for(Y=b+1;Y<=C-1;Y++)ne=hg(l[Y],l[b],l[C],!0),ne>P&&(W=Y,P=ne);P>p&&(d[W]=1,aw(l,d,p,b,W),aw(l,d,p,W,C))}function JN(l,d){for(var p=[l[0]],b=1,C=0,P=l.length;b<P;b++)eR(l[b],l[C])>d&&(p.push(l[b]),C=b);return C<P-1&&p.push(l[P-1]),p}var A0;function O0(l,d,p,b,C){var P=b?A0:sc(l,p),W=sc(d,p),Y,ne,ye;for(A0=W;;){if(!(P|W))return[l,d];if(P&W)return!1;Y=P||W,ne=Fp(l,d,Y,p,C),ye=sc(ne,p),Y===P?(l=ne,P=ye):(d=ne,W=ye)}}function Fp(l,d,p,b,C){var P=d.x-l.x,W=d.y-l.y,Y=b.min,ne=b.max,ye,ot;return p&8?(ye=l.x+P*(ne.y-l.y)/W,ot=ne.y):p&4?(ye=l.x+P*(Y.y-l.y)/W,ot=Y.y):p&2?(ye=ne.x,ot=l.y+W*(ne.x-l.x)/P):p&1&&(ye=Y.x,ot=l.y+W*(Y.x-l.x)/P),new ae(ye,ot,C)}function sc(l,d){var p=0;return l.x<d.min.x?p|=1:l.x>d.max.x&&(p|=2),l.y<d.min.y?p|=4:l.y>d.max.y&&(p|=8),p}function eR(l,d){var p=d.x-l.x,b=d.y-l.y;return p*p+b*b}function hg(l,d,p,b){var C=d.x,P=d.y,W=p.x-C,Y=p.y-P,ne=W*W+Y*Y,ye;return ne>0&&(ye=((l.x-C)*W+(l.y-P)*Y)/ne,ye>1?(C=p.x,P=p.y):ye>0&&(C+=W*ye,P+=Y*ye)),W=l.x-C,Y=l.y-P,b?W*W+Y*Y:new ae(C,P)}function Co(l){return!M(l[0])||typeof l[0][0]!="object"&&typeof l[0][0]<"u"}function F0(l){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Co(l)}function H0(l,d){var p,b,C,P,W,Y,ne,ye;if(!l||l.length===0)throw new Error("latlngs not passed");Co(l)||(console.warn("latlngs are not flat! Only the first ring will be used"),l=l[0]);var ot=gt([0,0]),Yt=Tt(l),Ii=Yt.getNorthWest().distanceTo(Yt.getSouthWest())*Yt.getNorthEast().distanceTo(Yt.getNorthWest());Ii<1700&&(ot=rw(l));var Fs=l.length,os=[];for(p=0;p<Fs;p++){var xo=gt(l[p]);os.push(d.project(gt([xo.lat-ot.lat,xo.lng-ot.lng])))}for(p=0,b=0;p<Fs-1;p++)b+=os[p].distanceTo(os[p+1])/2;if(b===0)ye=os[0];else for(p=0,P=0;p<Fs-1;p++)if(W=os[p],Y=os[p+1],C=W.distanceTo(Y),P+=C,P>b){ne=(P-b)/C,ye=[Y.x-ne*(Y.x-W.x),Y.y-ne*(Y.y-W.y)];break}var Gs=d.unproject(ve(ye));return gt([Gs.lat+ot.lat,Gs.lng+ot.lng])}var tR={__proto__:null,simplify:N0,pointToSegmentDistance:R0,closestPointOnSegment:YN,clipSegment:O0,_getEdgeIntersection:Fp,_getBitCode:sc,_sqClosestPointOnSegment:hg,isFlat:Co,_flat:F0,polylineCenter:H0},lw={project:function(l){return new ae(l.lng,l.lat)},unproject:function(l){return new Lt(l.y,l.x)},bounds:new lt([-180,-90],[180,90])},cw={R:6378137,R_MINOR:6356752314245179e-9,bounds:new lt([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(l){var d=Math.PI/180,p=this.R,b=l.lat*d,C=this.R_MINOR/p,P=Math.sqrt(1-C*C),W=P*Math.sin(b),Y=Math.tan(Math.PI/4-b/2)/Math.pow((1-W)/(1+W),P/2);return b=-p*Math.log(Math.max(Y,1e-10)),new ae(l.lng*d*p,b)},unproject:function(l){for(var d=180/Math.PI,p=this.R,b=this.R_MINOR/p,C=Math.sqrt(1-b*b),P=Math.exp(-l.y/p),W=Math.PI/2-2*Math.atan(P),Y=0,ne=.1,ye;Y<15&&Math.abs(ne)>1e-7;Y++)ye=C*Math.sin(W),ye=Math.pow((1-ye)/(1+ye),C/2),ne=Math.PI/2-2*Math.atan(P*ye)-W,W+=ne;return new Lt(W*d,l.x*d/p)}},iR={__proto__:null,LonLat:lw,Mercator:cw,SphericalMercator:Be},nR=n({},Gt,{code:"EPSG:3395",projection:cw,transformation:(function(){var l=.5/(Math.PI*cw.R);return kt(l,.5,-l,.5)})()}),W0=n({},Gt,{code:"EPSG:4326",projection:lw,transformation:kt(1/180,1,-1/180,.5)}),sR=n({},Oi,{projection:lw,transformation:kt(1,0,-1,0),scale:function(l){return Math.pow(2,l)},zoom:function(l){return Math.log(l)/Math.LN2},distance:function(l,d){var p=d.lng-l.lng,b=d.lat-l.lat;return Math.sqrt(p*p+b*b)},infinite:!0});Oi.Earth=Gt,Oi.EPSG3395=nR,Oi.EPSG3857=pi,Oi.EPSG900913=Nt,Oi.EPSG4326=W0,Oi.Simple=sR;var Yo=Kt.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[c(l)]=this,this},removeInteractiveTarget:function(l){return delete this._map._targets[c(l)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(l){var d=l.target;if(d.hasLayer(this)){if(this._map=d,this._zoomAnimated=d._zoomAnimated,this.getEvents){var p=this.getEvents();d.on(p,this),this.once("remove",function(){d.off(p,this)},this)}this.onAdd(d),this.fire("add"),d.fire("layeradd",{layer:this})}}});ut.include({addLayer:function(l){if(!l._layerAdd)throw new Error("The provided object is not a Layer.");var d=c(l);return this._layers[d]?this:(this._layers[d]=l,l._mapToAdd=this,l.beforeAdd&&l.beforeAdd(this),this.whenReady(l._layerAdd,l),this)},removeLayer:function(l){var d=c(l);return this._layers[d]?(this._loaded&&l.onRemove(this),delete this._layers[d],this._loaded&&(this.fire("layerremove",{layer:l}),l.fire("remove")),l._map=l._mapToAdd=null,this):this},hasLayer:function(l){return c(l)in this._layers},eachLayer:function(l,d){for(var p in this._layers)l.call(d,this._layers[p]);return this},_addLayers:function(l){l=l?M(l)?l:[l]:[];for(var d=0,p=l.length;d<p;d++)this.addLayer(l[d])},_addZoomLimit:function(l){(!isNaN(l.options.maxZoom)||!isNaN(l.options.minZoom))&&(this._zoomBoundLayers[c(l)]=l,this._updateZoomLevels())},_removeZoomLimit:function(l){var d=c(l);this._zoomBoundLayers[d]&&(delete this._zoomBoundLayers[d],this._updateZoomLevels())},_updateZoomLevels:function(){var l=1/0,d=-1/0,p=this._getZoomSpan();for(var b in this._zoomBoundLayers){var C=this._zoomBoundLayers[b].options;l=C.minZoom===void 0?l:Math.min(l,C.minZoom),d=C.maxZoom===void 0?d:Math.max(d,C.maxZoom)}this._layersMaxZoom=d===-1/0?void 0:d,this._layersMinZoom=l===1/0?void 0:l,p!==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 th=Yo.extend({initialize:function(l,d){y(this,d),this._layers={};var p,b;if(l)for(p=0,b=l.length;p<b;p++)this.addLayer(l[p])},addLayer:function(l){var d=this.getLayerId(l);return this._layers[d]=l,this._map&&this._map.addLayer(l),this},removeLayer:function(l){var d=l in this._layers?l:this.getLayerId(l);return this._map&&this._layers[d]&&this._map.removeLayer(this._layers[d]),delete this._layers[d],this},hasLayer:function(l){var d=typeof l=="number"?l:this.getLayerId(l);return d in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(l){var d=Array.prototype.slice.call(arguments,1),p,b;for(p in this._layers)b=this._layers[p],b[l]&&b[l].apply(b,d);return this},onAdd:function(l){this.eachLayer(l.addLayer,l)},onRemove:function(l){this.eachLayer(l.removeLayer,l)},eachLayer:function(l,d){for(var p in this._layers)l.call(d,this._layers[p]);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 c(l)}}),oR=function(l,d){return new th(l,d)},ca=th.extend({addLayer:function(l){return this.hasLayer(l)?this:(l.addEventParent(this),th.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),th.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 It;for(var d in this._layers){var p=this._layers[d];l.extend(p.getBounds?p.getBounds():p.getLatLng())}return l}}),rR=function(l,d){return new ca(l,d)},ih=Ge.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,d){var p=this._getIconUrl(l);if(!p){if(l==="icon")throw new Error("iconUrl not set in Icon options (see the docs).");return null}var b=this._createImg(p,d&&d.tagName==="IMG"?d:null);return this._setIconStyles(b,l),(this.options.crossOrigin||this.options.crossOrigin==="")&&(b.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),b},_setIconStyles:function(l,d){var p=this.options,b=p[d+"Size"];typeof b=="number"&&(b=[b,b]);var C=ve(b),P=ve(d==="shadow"&&p.shadowAnchor||p.iconAnchor||C&&C.divideBy(2,!0));l.className="leaflet-marker-"+d+" "+(p.className||""),P&&(l.style.marginLeft=-P.x+"px",l.style.marginTop=-P.y+"px"),C&&(l.style.width=C.x+"px",l.style.height=C.y+"px")},_createImg:function(l,d){return d=d||document.createElement("img"),d.src=l,d},_getIconUrl:function(l){return X.retina&&this.options[l+"RetinaUrl"]||this.options[l+"Url"]}});function aR(l){return new ih(l)}var ug=ih.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 ug.imagePath!="string"&&(ug.imagePath=this._detectIconPath()),(this.options.imagePath||ug.imagePath)+ih.prototype._getIconUrl.call(this,l)},_stripUrl:function(l){var d=function(p,b,C){var P=b.exec(p);return P&&P[C]};return l=d(l,/^url\((['"])?(.+)\1\)$/,2),l&&d(l,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var l=ht("div","leaflet-default-icon-path",document.body),d=ei(l,"background-image")||ei(l,"backgroundImage");if(document.body.removeChild(l),d=this._stripUrl(d),d)return d;var p=document.querySelector('link[href$="leaflet.css"]');return p?p.href.substring(0,p.href.length-11-1):""}}),B0=jn.extend({initialize:function(l){this._marker=l},addHooks:function(){var l=this._marker._icon;this._draggable||(this._draggable=new Is(l,l,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),Fe(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&&zt(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(l){var d=this._marker,p=d._map,b=this._marker.options.autoPanSpeed,C=this._marker.options.autoPanPadding,P=Qi(d._icon),W=p.getPixelBounds(),Y=p.getPixelOrigin(),ne=Qt(W.min._subtract(Y).add(C),W.max._subtract(Y).subtract(C));if(!ne.contains(P)){var ye=ve((Math.max(ne.max.x,P.x)-ne.max.x)/(W.max.x-ne.max.x)-(Math.min(ne.min.x,P.x)-ne.min.x)/(W.min.x-ne.min.x),(Math.max(ne.max.y,P.y)-ne.max.y)/(W.max.y-ne.max.y)-(Math.min(ne.min.y,P.y)-ne.min.y)/(W.min.y-ne.min.y)).multiplyBy(b);p.panBy(ye,{animate:!1}),this._draggable._newPos._add(ye),this._draggable._startPos._add(ye),Et(d._icon,this._draggable._newPos),this._onDrag(l),this._panRequest=Pe(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&&(je(this._panRequest),this._panRequest=Pe(this._adjustPan.bind(this,l)))},_onDrag:function(l){var d=this._marker,p=d._shadow,b=Qi(d._icon),C=d._map.layerPointToLatLng(b);p&&Et(p,b),d._latlng=C,l.latlng=C,l.oldLatLng=this._oldLatLng,d.fire("move",l).fire("drag",l)},_onDragEnd:function(l){je(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",l)}}),Hp=Yo.extend({options:{icon:new ug,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,d){y(this,d),this._latlng=gt(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 d=this._latlng;return this._latlng=gt(l),this.update(),this.fire("move",{oldLatLng:d,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,d="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),p=l.icon.createIcon(this._icon),b=!1;p!==this._icon&&(this._icon&&this._removeIcon(),b=!0,l.title&&(p.title=l.title),p.tagName==="IMG"&&(p.alt=l.alt||"")),Fe(p,d),l.keyboard&&(p.tabIndex="0",p.setAttribute("role","button")),this._icon=p,l.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&yt(p,"focus",this._panOnFocus,this);var C=l.icon.createShadow(this._shadow),P=!1;C!==this._shadow&&(this._removeShadow(),P=!0),C&&(Fe(C,d),C.alt=""),this._shadow=C,l.opacity<1&&this._updateOpacity(),b&&this.getPane().appendChild(this._icon),this._initInteraction(),C&&P&&this.getPane(l.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&gn(this._icon,"focus",this._panOnFocus,this),st(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&st(this._shadow),this._shadow=null},_setPos:function(l){this._icon&&Et(this._icon,l),this._shadow&&Et(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 d=this._map._latLngToNewLayerPoint(this._latlng,l.zoom,l.center).round();this._setPos(d)},_initInteraction:function(){if(this.options.interactive&&(Fe(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),B0)){var l=this.options.draggable;this.dragging&&(l=this.dragging.enabled(),this.dragging.disable()),this.dragging=new B0(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&&un(this._icon,l),this._shadow&&un(this._shadow,l)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var l=this._map;if(l){var d=this.options.icon.options,p=d.iconSize?ve(d.iconSize):ve(0,0),b=d.iconAnchor?ve(d.iconAnchor):ve(0,0);l.panInside(this._latlng,{paddingTopLeft:b,paddingBottomRight:p.subtract(b)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function lR(l,d){return new Hp(l,d)}var Qa=Yo.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)}}),Wp=Qa.extend({options:{fill:!0,radius:10},initialize:function(l,d){y(this,d),this._latlng=gt(l),this._radius=this.options.radius},setLatLng:function(l){var d=this._latlng;return this._latlng=gt(l),this.redraw(),this.fire("move",{oldLatLng:d,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 d=l&&l.radius||this._radius;return Qa.prototype.setStyle.call(this,l),this.setRadius(d),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var l=this._radius,d=this._radiusY||l,p=this._clickTolerance(),b=[l+p,d+p];this._pxBounds=new lt(this._point.subtract(b),this._point.add(b))},_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 cR(l,d){return new Wp(l,d)}var dw=Wp.extend({initialize:function(l,d,p){if(typeof d=="number"&&(d=n({},p,{radius:d})),y(this,d),this._latlng=gt(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 It(this._map.layerPointToLatLng(this._point.subtract(l)),this._map.layerPointToLatLng(this._point.add(l)))},setStyle:Qa.prototype.setStyle,_project:function(){var l=this._latlng.lng,d=this._latlng.lat,p=this._map,b=p.options.crs;if(b.distance===Gt.distance){var C=Math.PI/180,P=this._mRadius/Gt.R/C,W=p.project([d+P,l]),Y=p.project([d-P,l]),ne=W.add(Y).divideBy(2),ye=p.unproject(ne).lat,ot=Math.acos((Math.cos(P*C)-Math.sin(d*C)*Math.sin(ye*C))/(Math.cos(d*C)*Math.cos(ye*C)))/C;(isNaN(ot)||ot===0)&&(ot=P/Math.cos(Math.PI/180*d)),this._point=ne.subtract(p.getPixelOrigin()),this._radius=isNaN(ot)?0:ne.x-p.project([ye,l-ot]).x,this._radiusY=ne.y-W.y}else{var Yt=b.unproject(b.project(this._latlng).subtract([this._mRadius,0]));this._point=p.latLngToLayerPoint(this._latlng),this._radius=this._point.x-p.latLngToLayerPoint(Yt).x}this._updateBounds()}});function dR(l,d,p){return new dw(l,d,p)}var da=Qa.extend({options:{smoothFactor:1,noClip:!1},initialize:function(l,d){y(this,d),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 d=1/0,p=null,b=hg,C,P,W=0,Y=this._parts.length;W<Y;W++)for(var ne=this._parts[W],ye=1,ot=ne.length;ye<ot;ye++){C=ne[ye-1],P=ne[ye];var Yt=b(l,C,P,!0);Yt<d&&(d=Yt,p=b(l,C,P))}return p&&(p.distance=Math.sqrt(d)),p},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return H0(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(l,d){return d=d||this._defaultShape(),l=gt(l),d.push(l),this._bounds.extend(l),this.redraw()},_setLatLngs:function(l){this._bounds=new It,this._latlngs=this._convertLatLngs(l)},_defaultShape:function(){return Co(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(l){for(var d=[],p=Co(l),b=0,C=l.length;b<C;b++)p?(d[b]=gt(l[b]),this._bounds.extend(d[b])):d[b]=this._convertLatLngs(l[b]);return d},_project:function(){var l=new lt;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(),d=new ae(l,l);this._rawPxBounds&&(this._pxBounds=new lt([this._rawPxBounds.min.subtract(d),this._rawPxBounds.max.add(d)]))},_projectLatlngs:function(l,d,p){var b=l[0]instanceof Lt,C=l.length,P,W;if(b){for(W=[],P=0;P<C;P++)W[P]=this._map.latLngToLayerPoint(l[P]),p.extend(W[P]);d.push(W)}else for(P=0;P<C;P++)this._projectLatlngs(l[P],d,p)},_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 d=this._parts,p,b,C,P,W,Y,ne;for(p=0,C=0,P=this._rings.length;p<P;p++)for(ne=this._rings[p],b=0,W=ne.length;b<W-1;b++)Y=O0(ne[b],ne[b+1],l,b,!0),Y&&(d[C]=d[C]||[],d[C].push(Y[0]),(Y[1]!==ne[b+1]||b===W-2)&&(d[C].push(Y[1]),C++))}},_simplifyPoints:function(){for(var l=this._parts,d=this.options.smoothFactor,p=0,b=l.length;p<b;p++)l[p]=N0(l[p],d)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(l,d){var p,b,C,P,W,Y,ne=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(l))return!1;for(p=0,P=this._parts.length;p<P;p++)for(Y=this._parts[p],b=0,W=Y.length,C=W-1;b<W;C=b++)if(!(!d&&b===0)&&R0(l,Y[C],Y[b])<=ne)return!0;return!1}});function hR(l,d){return new da(l,d)}da._flat=F0;var nh=da.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 M0(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(l){var d=da.prototype._convertLatLngs.call(this,l),p=d.length;return p>=2&&d[0]instanceof Lt&&d[0].equals(d[p-1])&&d.pop(),d},_setLatLngs:function(l){da.prototype._setLatLngs.call(this,l),Co(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Co(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var l=this._renderer._bounds,d=this.options.weight,p=new ae(d,d);if(l=new lt(l.min.subtract(p),l.max.add(p)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(l))){if(this.options.noClip){this._parts=this._rings;return}for(var b=0,C=this._rings.length,P;b<C;b++)P=Op(this._rings[b],l,!0),P.length&&this._parts.push(P)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(l){var d=!1,p,b,C,P,W,Y,ne,ye;if(!this._pxBounds||!this._pxBounds.contains(l))return!1;for(P=0,ne=this._parts.length;P<ne;P++)for(p=this._parts[P],W=0,ye=p.length,Y=ye-1;W<ye;Y=W++)b=p[W],C=p[Y],b.y>l.y!=C.y>l.y&&l.x<(C.x-b.x)*(l.y-b.y)/(C.y-b.y)+b.x&&(d=!d);return d||da.prototype._containsPoint.call(this,l,!0)}});function uR(l,d){return new nh(l,d)}var ha=ca.extend({initialize:function(l,d){y(this,d),this._layers={},l&&this.addData(l)},addData:function(l){var d=M(l)?l:l.features,p,b,C;if(d){for(p=0,b=d.length;p<b;p++)C=d[p],(C.geometries||C.geometry||C.features||C.coordinates)&&this.addData(C);return this}var P=this.options;if(P.filter&&!P.filter(l))return this;var W=Bp(l,P);return W?(W.feature=Up(l),W.defaultOptions=W.options,this.resetStyle(W),P.onEachFeature&&P.onEachFeature(l,W),this.addLayer(W)):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(d){this._setLayerStyle(d,l)},this)},_setLayerStyle:function(l,d){l.setStyle&&(typeof d=="function"&&(d=d(l.feature)),l.setStyle(d))}});function Bp(l,d){var p=l.type==="Feature"?l.geometry:l,b=p?p.coordinates:null,C=[],P=d&&d.pointToLayer,W=d&&d.coordsToLatLng||hw,Y,ne,ye,ot;if(!b&&!p)return null;switch(p.type){case"Point":return Y=W(b),z0(P,l,Y,d);case"MultiPoint":for(ye=0,ot=b.length;ye<ot;ye++)Y=W(b[ye]),C.push(z0(P,l,Y,d));return new ca(C);case"LineString":case"MultiLineString":return ne=zp(b,p.type==="LineString"?0:1,W),new da(ne,d);case"Polygon":case"MultiPolygon":return ne=zp(b,p.type==="Polygon"?1:2,W),new nh(ne,d);case"GeometryCollection":for(ye=0,ot=p.geometries.length;ye<ot;ye++){var Yt=Bp({geometry:p.geometries[ye],type:"Feature",properties:l.properties},d);Yt&&C.push(Yt)}return new ca(C);case"FeatureCollection":for(ye=0,ot=p.features.length;ye<ot;ye++){var Ii=Bp(p.features[ye],d);Ii&&C.push(Ii)}return new ca(C);default:throw new Error("Invalid GeoJSON object.")}}function z0(l,d,p,b){return l?l(d,p):new Hp(p,b&&b.markersInheritOptions&&b)}function hw(l){return new Lt(l[1],l[0],l[2])}function zp(l,d,p){for(var b=[],C=0,P=l.length,W;C<P;C++)W=d?zp(l[C],d-1,p):(p||hw)(l[C]),b.push(W);return b}function uw(l,d){return l=gt(l),l.alt!==void 0?[f(l.lng,d),f(l.lat,d),f(l.alt,d)]:[f(l.lng,d),f(l.lat,d)]}function Vp(l,d,p,b){for(var C=[],P=0,W=l.length;P<W;P++)C.push(d?Vp(l[P],Co(l[P])?0:d-1,p,b):uw(l[P],b));return!d&&p&&C.length>0&&C.push(C[0].slice()),C}function sh(l,d){return l.feature?n({},l.feature,{geometry:d}):Up(d)}function Up(l){return l.type==="Feature"||l.type==="FeatureCollection"?l:{type:"Feature",properties:{},geometry:l}}var gw={toGeoJSON:function(l){return sh(this,{type:"Point",coordinates:uw(this.getLatLng(),l)})}};Hp.include(gw),dw.include(gw),Wp.include(gw),da.include({toGeoJSON:function(l){var d=!Co(this._latlngs),p=Vp(this._latlngs,d?1:0,!1,l);return sh(this,{type:(d?"Multi":"")+"LineString",coordinates:p})}}),nh.include({toGeoJSON:function(l){var d=!Co(this._latlngs),p=d&&!Co(this._latlngs[0]),b=Vp(this._latlngs,p?2:d?1:0,!0,l);return d||(b=[b]),sh(this,{type:(p?"Multi":"")+"Polygon",coordinates:b})}}),th.include({toMultiPoint:function(l){var d=[];return this.eachLayer(function(p){d.push(p.toGeoJSON(l).geometry.coordinates)}),sh(this,{type:"MultiPoint",coordinates:d})},toGeoJSON:function(l){var d=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(d==="MultiPoint")return this.toMultiPoint(l);var p=d==="GeometryCollection",b=[];return this.eachLayer(function(C){if(C.toGeoJSON){var P=C.toGeoJSON(l);if(p)b.push(P.geometry);else{var W=Up(P);W.type==="FeatureCollection"?b.push.apply(b,W.features):b.push(W)}}}),p?sh(this,{geometries:b,type:"GeometryCollection"}):{type:"FeatureCollection",features:b}}});function V0(l,d){return new ha(l,d)}var gR=V0,jp=Yo.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(l,d,p){this._url=l,this._bounds=Tt(d),y(this,p)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(Fe(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){st(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&&Ee(this._image),this},bringToBack:function(){return this._map&&Ot(this._image),this},setUrl:function(l){return this._url=l,this._image&&(this._image.src=l),this},setBounds:function(l){return this._bounds=Tt(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",d=this._image=l?this._url:ht("img");if(Fe(d,"leaflet-image-layer"),this._zoomAnimated&&Fe(d,"leaflet-zoom-animated"),this.options.className&&Fe(d,this.options.className),d.onselectstart=g,d.onmousemove=g,d.onload=r(this.fire,this,"load"),d.onerror=r(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(d.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),l){this._url=d.src;return}d.src=this._url,d.alt=this.options.alt},_animateZoom:function(l){var d=this._map.getZoomScale(l.zoom),p=this._map._latLngBoundsToNewLayerBounds(this._bounds,l.zoom,l.center).min;ds(this._image,p,d)},_reset:function(){var l=this._image,d=new lt(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),p=d.getSize();Et(l,d.min),l.style.width=p.x+"px",l.style.height=p.y+"px"},_updateOpacity:function(){un(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()}}),fR=function(l,d,p){return new jp(l,d,p)},U0=jp.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var l=this._url.tagName==="VIDEO",d=this._image=l?this._url:ht("video");if(Fe(d,"leaflet-image-layer"),this._zoomAnimated&&Fe(d,"leaflet-zoom-animated"),this.options.className&&Fe(d,this.options.className),d.onselectstart=g,d.onmousemove=g,d.onloadeddata=r(this.fire,this,"load"),l){for(var p=d.getElementsByTagName("source"),b=[],C=0;C<p.length;C++)b.push(p[C].src);this._url=p.length>0?b:[d.src];return}M(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(d.style,"objectFit")&&(d.style.objectFit="fill"),d.autoplay=!!this.options.autoplay,d.loop=!!this.options.loop,d.muted=!!this.options.muted,d.playsInline=!!this.options.playsInline;for(var P=0;P<this._url.length;P++){var W=ht("source");W.src=this._url[P],d.appendChild(W)}}});function pR(l,d,p){return new U0(l,d,p)}var j0=jp.extend({_initImage:function(){var l=this._image=this._url;Fe(l,"leaflet-image-layer"),this._zoomAnimated&&Fe(l,"leaflet-zoom-animated"),this.options.className&&Fe(l,this.options.className),l.onselectstart=g,l.onmousemove=g}});function mR(l,d,p){return new j0(l,d,p)}var Ir=Yo.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(l,d){l&&(l instanceof Lt||M(l))?(this._latlng=gt(l),y(this,d)):(y(this,l),this._source=d),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&&un(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),l._fadeAnimated&&un(this._container,1),this.bringToFront(),this.options.interactive&&(Fe(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(l){l._fadeAnimated?(un(this._container,0),this._removeTimeout=setTimeout(r(st,void 0,this._container),200)):st(this._container),this.options.interactive&&(zt(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(l){return this._latlng=gt(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&&Ee(this._container),this},bringToBack:function(){return this._map&&Ot(this._container),this},_prepareOpen:function(l){var d=this._source;if(!d._map)return!1;if(d instanceof ca){d=null;var p=this._source._layers;for(var b in p)if(p[b]._map){d=p[b];break}if(!d)return!1;this._source=d}if(!l)if(d.getCenter)l=d.getCenter();else if(d.getLatLng)l=d.getLatLng();else if(d.getBounds)l=d.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,d=typeof this._content=="function"?this._content(this._source||this):this._content;if(typeof d=="string")l.innerHTML=d;else{for(;l.hasChildNodes();)l.removeChild(l.firstChild);l.appendChild(d)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var l=this._map.latLngToLayerPoint(this._latlng),d=ve(this.options.offset),p=this._getAnchor();this._zoomAnimated?Et(this._container,l.add(p)):d=d.add(l).add(p);var b=this._containerBottom=-d.y,C=this._containerLeft=-Math.round(this._containerWidth/2)+d.x;this._container.style.bottom=b+"px",this._container.style.left=C+"px"}},_getAnchor:function(){return[0,0]}});ut.include({_initOverlay:function(l,d,p,b){var C=d;return C instanceof l||(C=new l(b).setContent(d)),p&&C.setLatLng(p),C}}),Yo.include({_initOverlay:function(l,d,p,b){var C=p;return C instanceof l?(y(C,b),C._source=this):(C=d&&!b?d:new l(b,this),C.setContent(p)),C}});var $p=Ir.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,Ir.prototype.openOn.call(this,l)},onAdd:function(l){Ir.prototype.onAdd.call(this,l),l.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof Qa||this._source.on("preclick",oa))},onRemove:function(l){Ir.prototype.onRemove.call(this,l),l.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof Qa||this._source.off("preclick",oa))},getEvents:function(){var l=Ir.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",d=this._container=ht("div",l+" "+(this.options.className||"")+" leaflet-zoom-animated"),p=this._wrapper=ht("div",l+"-content-wrapper",d);if(this._contentNode=ht("div",l+"-content",p),U(d),dg(this._contentNode),yt(d,"contextmenu",oa),this._tipContainer=ht("div",l+"-tip-container",d),this._tip=ht("div",l+"-tip",this._tipContainer),this.options.closeButton){var b=this._closeButton=ht("a",l+"-close-button",d);b.setAttribute("role","button"),b.setAttribute("aria-label","Close popup"),b.href="#close",b.innerHTML='<span aria-hidden="true">&#215;</span>',yt(b,"click",function(C){le(C),this.close()},this)}},_updateLayout:function(){var l=this._contentNode,d=l.style;d.width="",d.whiteSpace="nowrap";var p=l.offsetWidth;p=Math.min(p,this.options.maxWidth),p=Math.max(p,this.options.minWidth),d.width=p+1+"px",d.whiteSpace="",d.height="";var b=l.offsetHeight,C=this.options.maxHeight,P="leaflet-popup-scrolled";C&&b>C?(d.height=C+"px",Fe(l,P)):zt(l,P),this._containerWidth=this._container.offsetWidth},_animateZoom:function(l){var d=this._map._latLngToNewLayerPoint(this._latlng,l.zoom,l.center),p=this._getAnchor();Et(this._container,d.add(p))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var l=this._map,d=parseInt(ei(this._container,"marginBottom"),10)||0,p=this._container.offsetHeight+d,b=this._containerWidth,C=new ae(this._containerLeft,-p-this._containerBottom);C._add(Qi(this._container));var P=l.layerPointToContainerPoint(C),W=ve(this.options.autoPanPadding),Y=ve(this.options.autoPanPaddingTopLeft||W),ne=ve(this.options.autoPanPaddingBottomRight||W),ye=l.getSize(),ot=0,Yt=0;P.x+b+ne.x>ye.x&&(ot=P.x+b-ye.x+ne.x),P.x-ot-Y.x<0&&(ot=P.x-Y.x),P.y+p+ne.y>ye.y&&(Yt=P.y+p-ye.y+ne.y),P.y-Yt-Y.y<0&&(Yt=P.y-Y.y),(ot||Yt)&&(this.options.keepInView&&(this._autopanning=!0),l.fire("autopanstart").panBy([ot,Yt]))}},_getAnchor:function(){return ve(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),_R=function(l,d){return new $p(l,d)};ut.mergeOptions({closePopupOnClick:!0}),ut.include({openPopup:function(l,d,p){return this._initOverlay($p,l,d,p).openOn(this),this},closePopup:function(l){return l=arguments.length?l:this._popup,l&&l.close(),this}}),Yo.include({bindPopup:function(l,d){return this._popup=this._initOverlay($p,this._popup,l,d),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 ca||(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)){fe(l);var d=l.layer||l.target;if(this._popup._source===d&&!(d instanceof Qa)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(l.latlng);return}this._popup._source=d,this.openPopup(l.latlng)}},_movePopup:function(l){this._popup.setLatLng(l.latlng)},_onKeyPress:function(l){l.originalEvent.keyCode===13&&this._openPopup(l)}});var qp=Ir.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(l){Ir.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){Ir.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=Ir.prototype.getEvents.call(this);return this.options.permanent||(l.preclick=this.close),l},_initLayout:function(){var l="leaflet-tooltip",d=l+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=ht("div",d),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+c(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(l){var d,p,b=this._map,C=this._container,P=b.latLngToContainerPoint(b.getCenter()),W=b.layerPointToContainerPoint(l),Y=this.options.direction,ne=C.offsetWidth,ye=C.offsetHeight,ot=ve(this.options.offset),Yt=this._getAnchor();Y==="top"?(d=ne/2,p=ye):Y==="bottom"?(d=ne/2,p=0):Y==="center"?(d=ne/2,p=ye/2):Y==="right"?(d=0,p=ye/2):Y==="left"?(d=ne,p=ye/2):W.x<P.x?(Y="right",d=0,p=ye/2):(Y="left",d=ne+(ot.x+Yt.x)*2,p=ye/2),l=l.subtract(ve(d,p,!0)).add(ot).add(Yt),zt(C,"leaflet-tooltip-right"),zt(C,"leaflet-tooltip-left"),zt(C,"leaflet-tooltip-top"),zt(C,"leaflet-tooltip-bottom"),Fe(C,"leaflet-tooltip-"+Y),Et(C,l)},_updatePosition:function(){var l=this._map.latLngToLayerPoint(this._latlng);this._setPosition(l)},setOpacity:function(l){this.options.opacity=l,this._container&&un(this._container,l)},_animateZoom:function(l){var d=this._map._latLngToNewLayerPoint(this._latlng,l.zoom,l.center);this._setPosition(d)},_getAnchor:function(){return ve(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),vR=function(l,d){return new qp(l,d)};ut.include({openTooltip:function(l,d,p){return this._initOverlay(qp,l,d,p).openOn(this),this},closeTooltip:function(l){return l.close(),this}}),Yo.include({bindTooltip:function(l,d){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(qp,this._tooltip,l,d),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 d=l?"off":"on",p={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?p.add=this._openTooltip:(p.mouseover=this._openTooltip,p.mouseout=this.closeTooltip,p.click=this._openTooltip,this._map?this._addFocusListeners():p.add=this._addFocusListeners),this._tooltip.options.sticky&&(p.mousemove=this._moveTooltip),this[d](p),this._tooltipHandlersAdded=!l}},openTooltip:function(l){return this._tooltip&&(this instanceof ca||(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 d=typeof l.getElement=="function"&&l.getElement();d&&(yt(d,"focus",function(){this._tooltip._source=l,this.openTooltip()},this),yt(d,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(l){var d=typeof l.getElement=="function"&&l.getElement();d&&d.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 d=this;this._map.once("moveend",function(){d._openOnceFlag=!1,d._openTooltip(l)});return}this._tooltip._source=l.layer||l.target,this.openTooltip(this._tooltip.options.sticky?l.latlng:void 0)}},_moveTooltip:function(l){var d=l.latlng,p,b;this._tooltip.options.sticky&&l.originalEvent&&(p=this._map.mouseEventToContainerPoint(l.originalEvent),b=this._map.containerPointToLayerPoint(p),d=this._map.layerPointToLatLng(b)),this._tooltip.setLatLng(d)}});var $0=ih.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(l){var d=l&&l.tagName==="DIV"?l:document.createElement("div"),p=this.options;if(p.html instanceof Element?(Ye(d),d.appendChild(p.html)):d.innerHTML=p.html!==!1?p.html:"",p.bgPos){var b=ve(p.bgPos);d.style.backgroundPosition=-b.x+"px "+-b.y+"px"}return this._setIconStyles(d,"icon"),d},createShadow:function(){return null}});function bR(l){return new $0(l)}ih.Default=ug;var gg=Yo.extend({options:{tileSize:256,opacity:1,updateWhenIdle:X.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(),st(this._container),l._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(Ee(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(Ot(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=h(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 ae?l:new ae(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 d=this.getPane().children,p=-l(-1/0,1/0),b=0,C=d.length,P;b<C;b++)P=d[b].style.zIndex,d[b]!==this._container&&P&&(p=l(p,+P));isFinite(p)&&(this.options.zIndex=p+l(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!X.ielt9){un(this._container,this.options.opacity);var l=+new Date,d=!1,p=!1;for(var b in this._tiles){var C=this._tiles[b];if(!(!C.current||!C.loaded)){var P=Math.min(1,(l-C.loaded)/200);un(C.el,P),P<1?d=!0:(C.active?p=!0:this._onOpaqueTile(C),C.active=!0)}}p&&!this._noPrune&&this._pruneTiles(),d&&(je(this._fadeFrame),this._fadeFrame=Pe(this._updateOpacity,this))}},_onOpaqueTile:g,_initContainer:function(){this._container||(this._container=ht("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,d=this.options.maxZoom;if(l!==void 0){for(var p in this._levels)p=Number(p),this._levels[p].el.children.length||p===l?(this._levels[p].el.style.zIndex=d-Math.abs(l-p),this._onUpdateLevel(p)):(st(this._levels[p].el),this._removeTilesAtZoom(p),this._onRemoveLevel(p),delete this._levels[p]);var b=this._levels[l],C=this._map;return b||(b=this._levels[l]={},b.el=ht("div","leaflet-tile-container leaflet-zoom-animated",this._container),b.el.style.zIndex=d,b.origin=C.project(C.unproject(C.getPixelOrigin()),l).round(),b.zoom=l,this._setZoomTransform(b,C.getCenter(),C.getZoom()),g(b.el.offsetWidth),this._onCreateLevel(b)),this._level=b,b}},_onUpdateLevel:g,_onRemoveLevel:g,_onCreateLevel:g,_pruneTiles:function(){if(this._map){var l,d,p=this._map.getZoom();if(p>this.options.maxZoom||p<this.options.minZoom){this._removeAllTiles();return}for(l in this._tiles)d=this._tiles[l],d.retain=d.current;for(l in this._tiles)if(d=this._tiles[l],d.current&&!d.active){var b=d.coords;this._retainParent(b.x,b.y,b.z,b.z-5)||this._retainChildren(b.x,b.y,b.z,b.z+2)}for(l in this._tiles)this._tiles[l].retain||this._removeTile(l)}},_removeTilesAtZoom:function(l){for(var d in this._tiles)this._tiles[d].coords.z===l&&this._removeTile(d)},_removeAllTiles:function(){for(var l in this._tiles)this._removeTile(l)},_invalidateAll:function(){for(var l in this._levels)st(this._levels[l].el),this._onRemoveLevel(Number(l)),delete this._levels[l];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(l,d,p,b){var C=Math.floor(l/2),P=Math.floor(d/2),W=p-1,Y=new ae(+C,+P);Y.z=+W;var ne=this._tileCoordsToKey(Y),ye=this._tiles[ne];return ye&&ye.active?(ye.retain=!0,!0):(ye&&ye.loaded&&(ye.retain=!0),W>b?this._retainParent(C,P,W,b):!1)},_retainChildren:function(l,d,p,b){for(var C=2*l;C<2*l+2;C++)for(var P=2*d;P<2*d+2;P++){var W=new ae(C,P);W.z=p+1;var Y=this._tileCoordsToKey(W),ne=this._tiles[Y];if(ne&&ne.active){ne.retain=!0;continue}else ne&&ne.loaded&&(ne.retain=!0);p+1<b&&this._retainChildren(C,P,p+1,b)}},_resetView:function(l){var d=l&&(l.pinch||l.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),d,d)},_animateZoom:function(l){this._setView(l.center,l.zoom,!0,l.noUpdate)},_clampZoom:function(l){var d=this.options;return d.minNativeZoom!==void 0&&l<d.minNativeZoom?d.minNativeZoom:d.maxNativeZoom!==void 0&&d.maxNativeZoom<l?d.maxNativeZoom:l},_setView:function(l,d,p,b){var C=Math.round(d);this.options.maxZoom!==void 0&&C>this.options.maxZoom||this.options.minZoom!==void 0&&C<this.options.minZoom?C=void 0:C=this._clampZoom(C);var P=this.options.updateWhenZooming&&C!==this._tileZoom;(!b||P)&&(this._tileZoom=C,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),C!==void 0&&this._update(l),p||this._pruneTiles(),this._noPrune=!!p),this._setZoomTransforms(l,d)},_setZoomTransforms:function(l,d){for(var p in this._levels)this._setZoomTransform(this._levels[p],l,d)},_setZoomTransform:function(l,d,p){var b=this._map.getZoomScale(p,l.zoom),C=l.origin.multiplyBy(b).subtract(this._map._getNewPixelOrigin(d,p)).round();X.any3d?ds(l.el,C,b):Et(l.el,C)},_resetGrid:function(){var l=this._map,d=l.options.crs,p=this._tileSize=this.getTileSize(),b=this._tileZoom,C=this._map.getPixelWorldBounds(this._tileZoom);C&&(this._globalTileRange=this._pxBoundsToTileRange(C)),this._wrapX=d.wrapLng&&!this.options.noWrap&&[Math.floor(l.project([0,d.wrapLng[0]],b).x/p.x),Math.ceil(l.project([0,d.wrapLng[1]],b).x/p.y)],this._wrapY=d.wrapLat&&!this.options.noWrap&&[Math.floor(l.project([d.wrapLat[0],0],b).y/p.x),Math.ceil(l.project([d.wrapLat[1],0],b).y/p.y)]},_onMoveEnd:function(){!this._map||this._map._animatingZoom||this._update()},_getTiledPixelBounds:function(l){var d=this._map,p=d._animatingZoom?Math.max(d._animateToZoom,d.getZoom()):d.getZoom(),b=d.getZoomScale(p,this._tileZoom),C=d.project(l,this._tileZoom).floor(),P=d.getSize().divideBy(b*2);return new lt(C.subtract(P),C.add(P))},_update:function(l){var d=this._map;if(d){var p=this._clampZoom(d.getZoom());if(l===void 0&&(l=d.getCenter()),this._tileZoom!==void 0){var b=this._getTiledPixelBounds(l),C=this._pxBoundsToTileRange(b),P=C.getCenter(),W=[],Y=this.options.keepBuffer,ne=new lt(C.getBottomLeft().subtract([Y,-Y]),C.getTopRight().add([Y,-Y]));if(!(isFinite(C.min.x)&&isFinite(C.min.y)&&isFinite(C.max.x)&&isFinite(C.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var ye in this._tiles){var ot=this._tiles[ye].coords;(ot.z!==this._tileZoom||!ne.contains(new ae(ot.x,ot.y)))&&(this._tiles[ye].current=!1)}if(Math.abs(p-this._tileZoom)>1){this._setView(l,p);return}for(var Yt=C.min.y;Yt<=C.max.y;Yt++)for(var Ii=C.min.x;Ii<=C.max.x;Ii++){var Fs=new ae(Ii,Yt);if(Fs.z=this._tileZoom,!!this._isValidTile(Fs)){var os=this._tiles[this._tileCoordsToKey(Fs)];os?os.current=!0:W.push(Fs)}}if(W.sort(function(Gs,rh){return Gs.distanceTo(P)-rh.distanceTo(P)}),W.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var xo=document.createDocumentFragment();for(Ii=0;Ii<W.length;Ii++)this._addTile(W[Ii],xo);this._level.el.appendChild(xo)}}}},_isValidTile:function(l){var d=this._map.options.crs;if(!d.infinite){var p=this._globalTileRange;if(!d.wrapLng&&(l.x<p.min.x||l.x>p.max.x)||!d.wrapLat&&(l.y<p.min.y||l.y>p.max.y))return!1}if(!this.options.bounds)return!0;var b=this._tileCoordsToBounds(l);return Tt(this.options.bounds).overlaps(b)},_keyToBounds:function(l){return this._tileCoordsToBounds(this._keyToTileCoords(l))},_tileCoordsToNwSe:function(l){var d=this._map,p=this.getTileSize(),b=l.scaleBy(p),C=b.add(p),P=d.unproject(b,l.z),W=d.unproject(C,l.z);return[P,W]},_tileCoordsToBounds:function(l){var d=this._tileCoordsToNwSe(l),p=new It(d[0],d[1]);return this.options.noWrap||(p=this._map.wrapLatLngBounds(p)),p},_tileCoordsToKey:function(l){return l.x+":"+l.y+":"+l.z},_keyToTileCoords:function(l){var d=l.split(":"),p=new ae(+d[0],+d[1]);return p.z=+d[2],p},_removeTile:function(l){var d=this._tiles[l];d&&(st(d.el),delete this._tiles[l],this.fire("tileunload",{tile:d.el,coords:this._keyToTileCoords(l)}))},_initTile:function(l){Fe(l,"leaflet-tile");var d=this.getTileSize();l.style.width=d.x+"px",l.style.height=d.y+"px",l.onselectstart=g,l.onmousemove=g,X.ielt9&&this.options.opacity<1&&un(l,this.options.opacity)},_addTile:function(l,d){var p=this._getTilePos(l),b=this._tileCoordsToKey(l),C=this.createTile(this._wrapCoords(l),r(this._tileReady,this,l));this._initTile(C),this.createTile.length<2&&Pe(r(this._tileReady,this,l,null,C)),Et(C,p),this._tiles[b]={el:C,coords:l,current:!0},d.appendChild(C),this.fire("tileloadstart",{tile:C,coords:l})},_tileReady:function(l,d,p){d&&this.fire("tileerror",{error:d,tile:p,coords:l});var b=this._tileCoordsToKey(l);p=this._tiles[b],p&&(p.loaded=+new Date,this._map._fadeAnimated?(un(p.el,0),je(this._fadeFrame),this._fadeFrame=Pe(this._updateOpacity,this)):(p.active=!0,this._pruneTiles()),d||(Fe(p.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:p.el,coords:l})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),X.ielt9||!this._map._fadeAnimated?Pe(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 d=new ae(this._wrapX?u(l.x,this._wrapX):l.x,this._wrapY?u(l.y,this._wrapY):l.y);return d.z=l.z,d},_pxBoundsToTileRange:function(l){var d=this.getTileSize();return new lt(l.min.unscaleBy(d).floor(),l.max.unscaleBy(d).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var l in this._tiles)if(!this._tiles[l].loaded)return!1;return!0}});function wR(l){return new gg(l)}var oh=gg.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(l,d){this._url=l,d=y(this,d),d.detectRetina&&X.retina&&d.maxZoom>0?(d.tileSize=Math.floor(d.tileSize/2),d.zoomReverse?(d.zoomOffset--,d.minZoom=Math.min(d.maxZoom,d.minZoom+1)):(d.zoomOffset++,d.maxZoom=Math.max(d.minZoom,d.maxZoom-1)),d.minZoom=Math.max(0,d.minZoom)):d.zoomReverse?d.minZoom=Math.min(d.maxZoom,d.minZoom):d.maxZoom=Math.max(d.minZoom,d.maxZoom),typeof d.subdomains=="string"&&(d.subdomains=d.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(l,d){return this._url===l&&d===void 0&&(d=!0),this._url=l,d||this.redraw(),this},createTile:function(l,d){var p=document.createElement("img");return yt(p,"load",r(this._tileOnLoad,this,d,p)),yt(p,"error",r(this._tileOnError,this,d,p)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(p.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(p.referrerPolicy=this.options.referrerPolicy),p.alt="",p.src=this.getTileUrl(l),p},getTileUrl:function(l){var d={r:X.retina?"@2x":"",s:this._getSubdomain(l),x:l.x,y:l.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var p=this._globalTileRange.max.y-l.y;this.options.tms&&(d.y=p),d["-y"]=p}return E(this._url,n(d,this.options))},_tileOnLoad:function(l,d){X.ielt9?setTimeout(r(l,this,null,d),0):l(null,d)},_tileOnError:function(l,d,p){var b=this.options.errorTileUrl;b&&d.getAttribute("src")!==b&&(d.src=b),l(p,d)},_onTileRemove:function(l){l.tile.onload=null},_getZoomForUrl:function(){var l=this._tileZoom,d=this.options.maxZoom,p=this.options.zoomReverse,b=this.options.zoomOffset;return p&&(l=d-l),l+b},_getSubdomain:function(l){var d=Math.abs(l.x+l.y)%this.options.subdomains.length;return this.options.subdomains[d]},_abortLoading:function(){var l,d;for(l in this._tiles)if(this._tiles[l].coords.z!==this._tileZoom&&(d=this._tiles[l].el,d.onload=g,d.onerror=g,!d.complete)){d.src=R;var p=this._tiles[l].coords;st(d),delete this._tiles[l],this.fire("tileabort",{tile:d,coords:p})}},_removeTile:function(l){var d=this._tiles[l];if(d)return d.el.setAttribute("src",R),gg.prototype._removeTile.call(this,l)},_tileReady:function(l,d,p){if(!(!this._map||p&&p.getAttribute("src")===R))return gg.prototype._tileReady.call(this,l,d,p)}});function q0(l,d){return new oh(l,d)}var K0=oh.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,d){this._url=l;var p=n({},this.defaultWmsParams);for(var b in d)b in this.options||(p[b]=d[b]);d=y(this,d);var C=d.detectRetina&&X.retina?2:1,P=this.getTileSize();p.width=P.x*C,p.height=P.y*C,this.wmsParams=p},onAdd:function(l){this._crs=this.options.crs||l.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var d=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[d]=this._crs.code,oh.prototype.onAdd.call(this,l)},getTileUrl:function(l){var d=this._tileCoordsToNwSe(l),p=this._crs,b=Qt(p.project(d[0]),p.project(d[1])),C=b.min,P=b.max,W=(this._wmsVersion>=1.3&&this._crs===W0?[C.y,C.x,P.y,P.x]:[C.x,C.y,P.x,P.y]).join(","),Y=oh.prototype.getTileUrl.call(this,l);return Y+S(this.wmsParams,Y,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+W},setParams:function(l,d){return n(this.wmsParams,l),d||this.redraw(),this}});function yR(l,d){return new K0(l,d)}oh.WMS=K0,q0.wms=yR;var ua=Yo.extend({options:{padding:.1},initialize:function(l){y(this,l),c(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),Fe(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,d){var p=this._map.getZoomScale(d,this._zoom),b=this._map.getSize().multiplyBy(.5+this.options.padding),C=this._map.project(this._center,d),P=b.multiplyBy(-p).add(C).subtract(this._map._getNewPixelOrigin(l,d));X.any3d?ds(this._container,P,p):Et(this._container,P)},_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,d=this._map.getSize(),p=this._map.containerPointToLayerPoint(d.multiplyBy(-l)).round();this._bounds=new lt(p,p.add(d.multiplyBy(1+l*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),G0=ua.extend({options:{tolerance:0},getEvents:function(){var l=ua.prototype.getEvents.call(this);return l.viewprereset=this._onViewPreReset,l},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){ua.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var l=this._container=document.createElement("canvas");yt(l,"mousemove",this._onMouseMove,this),yt(l,"click dblclick mousedown mouseup contextmenu",this._onClick,this),yt(l,"mouseout",this._handleMouseOut,this),l._leaflet_disable_events=!0,this._ctx=l.getContext("2d")},_destroyContainer:function(){je(this._redrawRequest),delete this._ctx,st(this._container),gn(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var l;this._redrawBounds=null;for(var d in this._layers)l=this._layers[d],l._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){ua.prototype._update.call(this);var l=this._bounds,d=this._container,p=l.getSize(),b=X.retina?2:1;Et(d,l.min),d.width=b*p.x,d.height=b*p.y,d.style.width=p.x+"px",d.style.height=p.y+"px",X.retina&&this._ctx.scale(2,2),this._ctx.translate(-l.min.x,-l.min.y),this.fire("update")}},_reset:function(){ua.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(l){this._updateDashArray(l),this._layers[c(l)]=l;var d=l._order={layer:l,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=d),this._drawLast=d,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(l){this._requestRedraw(l)},_removePath:function(l){var d=l._order,p=d.next,b=d.prev;p?p.prev=b:this._drawLast=b,b?b.next=p:this._drawFirst=p,delete l._order,delete this._layers[c(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 d=l.options.dashArray.split(/[, ]+/),p=[],b,C;for(C=0;C<d.length;C++){if(b=Number(d[C]),isNaN(b))return;p.push(b)}l.options._dashArray=p}else l.options._dashArray=l.options.dashArray},_requestRedraw:function(l){this._map&&(this._extendRedrawBounds(l),this._redrawRequest=this._redrawRequest||Pe(this._redraw,this))},_extendRedrawBounds:function(l){if(l._pxBounds){var d=(l.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new lt,this._redrawBounds.extend(l._pxBounds.min.subtract([d,d])),this._redrawBounds.extend(l._pxBounds.max.add([d,d]))}},_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 d=l.getSize();this._ctx.clearRect(l.min.x,l.min.y,d.x,d.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,d=this._redrawBounds;if(this._ctx.save(),d){var p=d.getSize();this._ctx.beginPath(),this._ctx.rect(d.min.x,d.min.y,p.x,p.y),this._ctx.clip()}this._drawing=!0;for(var b=this._drawFirst;b;b=b.next)l=b.layer,(!d||l._pxBounds&&l._pxBounds.intersects(d))&&l._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(l,d){if(this._drawing){var p,b,C,P,W=l._parts,Y=W.length,ne=this._ctx;if(Y){for(ne.beginPath(),p=0;p<Y;p++){for(b=0,C=W[p].length;b<C;b++)P=W[p][b],ne[b?"lineTo":"moveTo"](P.x,P.y);d&&ne.closePath()}this._fillStroke(ne,l)}}},_updateCircle:function(l){if(!(!this._drawing||l._empty())){var d=l._point,p=this._ctx,b=Math.max(Math.round(l._radius),1),C=(Math.max(Math.round(l._radiusY),1)||b)/b;C!==1&&(p.save(),p.scale(1,C)),p.beginPath(),p.arc(d.x,d.y/C,b,0,Math.PI*2,!1),C!==1&&p.restore(),this._fillStroke(p,l)}},_fillStroke:function(l,d){var p=d.options;p.fill&&(l.globalAlpha=p.fillOpacity,l.fillStyle=p.fillColor||p.color,l.fill(p.fillRule||"evenodd")),p.stroke&&p.weight!==0&&(l.setLineDash&&l.setLineDash(d.options&&d.options._dashArray||[]),l.globalAlpha=p.opacity,l.lineWidth=p.weight,l.strokeStyle=p.color,l.lineCap=p.lineCap,l.lineJoin=p.lineJoin,l.stroke())},_onClick:function(l){for(var d=this._map.mouseEventToLayerPoint(l),p,b,C=this._drawFirst;C;C=C.next)p=C.layer,p.options.interactive&&p._containsPoint(d)&&(!(l.type==="click"||l.type==="preclick")||!this._map._draggableMoved(p))&&(b=p);this._fireEvent(b?[b]:!1,l)},_onMouseMove:function(l){if(!(!this._map||this._map.dragging.moving()||this._map._animatingZoom)){var d=this._map.mouseEventToLayerPoint(l);this._handleMouseHover(l,d)}},_handleMouseOut:function(l){var d=this._hoveredLayer;d&&(zt(this._container,"leaflet-interactive"),this._fireEvent([d],l,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(l,d){if(!this._mouseHoverThrottled){for(var p,b,C=this._drawFirst;C;C=C.next)p=C.layer,p.options.interactive&&p._containsPoint(d)&&(b=p);b!==this._hoveredLayer&&(this._handleMouseOut(l),b&&(Fe(this._container,"leaflet-interactive"),this._fireEvent([b],l,"mouseover"),this._hoveredLayer=b)),this._fireEvent(this._hoveredLayer?[this._hoveredLayer]:!1,l),this._mouseHoverThrottled=!0,setTimeout(r(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(l,d,p){this._map._fireDOMEvent(d,p||d.type,l)},_bringToFront:function(l){var d=l._order;if(d){var p=d.next,b=d.prev;if(p)p.prev=b;else return;b?b.next=p:p&&(this._drawFirst=p),d.prev=this._drawLast,this._drawLast.next=d,d.next=null,this._drawLast=d,this._requestRedraw(l)}},_bringToBack:function(l){var d=l._order;if(d){var p=d.next,b=d.prev;if(b)b.next=p;else return;p?p.prev=b:b&&(this._drawLast=b),d.prev=null,d.next=this._drawFirst,this._drawFirst.prev=d,this._drawFirst=d,this._requestRedraw(l)}}});function Z0(l){return X.canvas?new G0(l):null}var fg=(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">')}})(),SR={_initContainer:function(){this._container=ht("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(ua.prototype._update.call(this),this.fire("update"))},_initPath:function(l){var d=l._container=fg("shape");Fe(d,"leaflet-vml-shape "+(this.options.className||"")),d.coordsize="1 1",l._path=fg("path"),d.appendChild(l._path),this._updateStyle(l),this._layers[c(l)]=l},_addPath:function(l){var d=l._container;this._container.appendChild(d),l.options.interactive&&l.addInteractiveTarget(d)},_removePath:function(l){var d=l._container;st(d),l.removeInteractiveTarget(d),delete this._layers[c(l)]},_updateStyle:function(l){var d=l._stroke,p=l._fill,b=l.options,C=l._container;C.stroked=!!b.stroke,C.filled=!!b.fill,b.stroke?(d||(d=l._stroke=fg("stroke")),C.appendChild(d),d.weight=b.weight+"px",d.color=b.color,d.opacity=b.opacity,b.dashArray?d.dashStyle=M(b.dashArray)?b.dashArray.join(" "):b.dashArray.replace(/( *, *)/g," "):d.dashStyle="",d.endcap=b.lineCap.replace("butt","flat"),d.joinstyle=b.lineJoin):d&&(C.removeChild(d),l._stroke=null),b.fill?(p||(p=l._fill=fg("fill")),C.appendChild(p),p.color=b.fillColor||b.color,p.opacity=b.fillOpacity):p&&(C.removeChild(p),l._fill=null)},_updateCircle:function(l){var d=l._point.round(),p=Math.round(l._radius),b=Math.round(l._radiusY||p);this._setPath(l,l._empty()?"M0 0":"AL "+d.x+","+d.y+" "+p+","+b+" 0,"+65535*360)},_setPath:function(l,d){l._path.v=d},_bringToFront:function(l){Ee(l._container)},_bringToBack:function(l){Ot(l._container)}},Kp=X.vml?fg:mi,pg=ua.extend({_initContainer:function(){this._container=Kp("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Kp("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){st(this._container),gn(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){ua.prototype._update.call(this);var l=this._bounds,d=l.getSize(),p=this._container;(!this._svgSize||!this._svgSize.equals(d))&&(this._svgSize=d,p.setAttribute("width",d.x),p.setAttribute("height",d.y)),Et(p,l.min),p.setAttribute("viewBox",[l.min.x,l.min.y,d.x,d.y].join(" ")),this.fire("update")}},_initPath:function(l){var d=l._path=Kp("path");l.options.className&&Fe(d,l.options.className),l.options.interactive&&Fe(d,"leaflet-interactive"),this._updateStyle(l),this._layers[c(l)]=l},_addPath:function(l){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(l._path),l.addInteractiveTarget(l._path)},_removePath:function(l){st(l._path),l.removeInteractiveTarget(l._path),delete this._layers[c(l)]},_updatePath:function(l){l._project(),l._update()},_updateStyle:function(l){var d=l._path,p=l.options;d&&(p.stroke?(d.setAttribute("stroke",p.color),d.setAttribute("stroke-opacity",p.opacity),d.setAttribute("stroke-width",p.weight),d.setAttribute("stroke-linecap",p.lineCap),d.setAttribute("stroke-linejoin",p.lineJoin),p.dashArray?d.setAttribute("stroke-dasharray",p.dashArray):d.removeAttribute("stroke-dasharray"),p.dashOffset?d.setAttribute("stroke-dashoffset",p.dashOffset):d.removeAttribute("stroke-dashoffset")):d.setAttribute("stroke","none"),p.fill?(d.setAttribute("fill",p.fillColor||p.color),d.setAttribute("fill-opacity",p.fillOpacity),d.setAttribute("fill-rule",p.fillRule||"evenodd")):d.setAttribute("fill","none"))},_updatePoly:function(l,d){this._setPath(l,Mi(l._parts,d))},_updateCircle:function(l){var d=l._point,p=Math.max(Math.round(l._radius),1),b=Math.max(Math.round(l._radiusY),1)||p,C="a"+p+","+b+" 0 1,0 ",P=l._empty()?"M0 0":"M"+(d.x-p)+","+d.y+C+p*2+",0 "+C+-p*2+",0 ";this._setPath(l,P)},_setPath:function(l,d){l._path.setAttribute("d",d)},_bringToFront:function(l){Ee(l._path)},_bringToBack:function(l){Ot(l._path)}});X.vml&&pg.include(SR);function X0(l){return X.svg||X.vml?new pg(l):null}ut.include({getRenderer:function(l){var d=l.options.renderer||this._getPaneRenderer(l.options.pane)||this.options.renderer||this._renderer;return d||(d=this._renderer=this._createRenderer()),this.hasLayer(d)||this.addLayer(d),d},_getPaneRenderer:function(l){if(l==="overlayPane"||l===void 0)return!1;var d=this._paneRenderers[l];return d===void 0&&(d=this._createRenderer({pane:l}),this._paneRenderers[l]=d),d},_createRenderer:function(l){return this.options.preferCanvas&&Z0(l)||X0(l)}});var Y0=nh.extend({initialize:function(l,d){nh.prototype.initialize.call(this,this._boundsToLatLngs(l),d)},setBounds:function(l){return this.setLatLngs(this._boundsToLatLngs(l))},_boundsToLatLngs:function(l){return l=Tt(l),[l.getSouthWest(),l.getNorthWest(),l.getNorthEast(),l.getSouthEast()]}});function CR(l,d){return new Y0(l,d)}pg.create=Kp,pg.pointsToPath=Mi,ha.geometryToLayer=Bp,ha.coordsToLatLng=hw,ha.coordsToLatLngs=zp,ha.latLngToCoords=uw,ha.latLngsToCoords=Vp,ha.getFeature=sh,ha.asFeature=Up,ut.mergeOptions({boxZoom:!0});var Q0=jn.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(){yt(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){gn(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){st(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(),Tn(),Ci(),this._startPoint=this._map.mouseEventToContainerPoint(l),yt(document,{contextmenu:fe,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(l){this._moved||(this._moved=!0,this._box=ht("div","leaflet-zoom-box",this._container),Fe(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(l);var d=new lt(this._point,this._startPoint),p=d.getSize();Et(this._box,d.min),this._box.style.width=p.x+"px",this._box.style.height=p.y+"px"},_finish:function(){this._moved&&(st(this._box),zt(this._container,"leaflet-crosshair")),Ft(),Os(),gn(document,{contextmenu:fe,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 d=new It(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(d).fire("boxzoomend",{boxZoomBounds:d})}},_onKeyDown:function(l){l.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});ut.addInitHook("addHandler","boxZoom",Q0),ut.mergeOptions({doubleClickZoom:!0});var J0=jn.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(l){var d=this._map,p=d.getZoom(),b=d.options.zoomDelta,C=l.originalEvent.shiftKey?p-b:p+b;d.options.doubleClickZoom==="center"?d.setZoom(C):d.setZoomAround(l.containerPoint,C)}});ut.addInitHook("addHandler","doubleClickZoom",J0),ut.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var eL=jn.extend({addHooks:function(){if(!this._draggable){var l=this._map;this._draggable=new Is(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))}Fe(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){zt(this._map._container,"leaflet-grab"),zt(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 d=Tt(this._map.options.maxBounds);this._offsetLimit=Qt(this._map.latLngToContainerPoint(d.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(d.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 d=this._lastTime=+new Date,p=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(p),this._times.push(d),this._prunePositions(d)}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),d=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=d.subtract(l).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(l,d){return l-(l-d)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var l=this._draggable._newPos.subtract(this._draggable._startPos),d=this._offsetLimit;l.x<d.min.x&&(l.x=this._viscousLimit(l.x,d.min.x)),l.y<d.min.y&&(l.y=this._viscousLimit(l.y,d.min.y)),l.x>d.max.x&&(l.x=this._viscousLimit(l.x,d.max.x)),l.y>d.max.y&&(l.y=this._viscousLimit(l.y,d.max.y)),this._draggable._newPos=this._draggable._startPos.add(l)}},_onPreDragWrap:function(){var l=this._worldWidth,d=Math.round(l/2),p=this._initialWorldOffset,b=this._draggable._newPos.x,C=(b-d+p)%l+d-p,P=(b+d+p)%l-d-p,W=Math.abs(C+p)<Math.abs(P+p)?C:P;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=W},_onDragEnd:function(l){var d=this._map,p=d.options,b=!p.inertia||l.noInertia||this._times.length<2;if(d.fire("dragend",l),b)d.fire("moveend");else{this._prunePositions(+new Date);var C=this._lastPos.subtract(this._positions[0]),P=(this._lastTime-this._times[0])/1e3,W=p.easeLinearity,Y=C.multiplyBy(W/P),ne=Y.distanceTo([0,0]),ye=Math.min(p.inertiaMaxSpeed,ne),ot=Y.multiplyBy(ye/ne),Yt=ye/(p.inertiaDeceleration*W),Ii=ot.multiplyBy(-Yt/2).round();!Ii.x&&!Ii.y?d.fire("moveend"):(Ii=d._limitOffset(Ii,d.options.maxBounds),Pe(function(){d.panBy(Ii,{duration:Yt,easeLinearity:W,noMoveStart:!0,animate:!0})}))}}});ut.addInitHook("addHandler","dragging",eL),ut.mergeOptions({keyboard:!0,keyboardPanDelta:80});var tL=jn.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"),yt(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(),gn(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,d=document.documentElement,p=l.scrollTop||d.scrollTop,b=l.scrollLeft||d.scrollLeft;this._map._container.focus(),window.scrollTo(b,p)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(l){var d=this._panKeys={},p=this.keyCodes,b,C;for(b=0,C=p.left.length;b<C;b++)d[p.left[b]]=[-1*l,0];for(b=0,C=p.right.length;b<C;b++)d[p.right[b]]=[l,0];for(b=0,C=p.down.length;b<C;b++)d[p.down[b]]=[0,l];for(b=0,C=p.up.length;b<C;b++)d[p.up[b]]=[0,-1*l]},_setZoomDelta:function(l){var d=this._zoomKeys={},p=this.keyCodes,b,C;for(b=0,C=p.zoomIn.length;b<C;b++)d[p.zoomIn[b]]=l;for(b=0,C=p.zoomOut.length;b<C;b++)d[p.zoomOut[b]]=-l},_addHooks:function(){yt(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){gn(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(l){if(!(l.altKey||l.ctrlKey||l.metaKey)){var d=l.keyCode,p=this._map,b;if(d in this._panKeys){if(!p._panAnim||!p._panAnim._inProgress)if(b=this._panKeys[d],l.shiftKey&&(b=ve(b).multiplyBy(3)),p.options.maxBounds&&(b=p._limitOffset(ve(b),p.options.maxBounds)),p.options.worldCopyJump){var C=p.wrapLatLng(p.unproject(p.project(p.getCenter()).add(b)));p.panTo(C)}else p.panBy(b)}else if(d in this._zoomKeys)p.setZoom(p.getZoom()+(l.shiftKey?3:1)*this._zoomKeys[d]);else if(d===27&&p._popup&&p._popup.options.closeOnEscapeKey)p.closePopup();else return;fe(l)}}});ut.addInitHook("addHandler","keyboard",tL),ut.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var iL=jn.extend({addHooks:function(){yt(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){gn(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(l){var d=ai(l),p=this._map.options.wheelDebounceTime;this._delta+=d,this._lastMousePos=this._map.mouseEventToContainerPoint(l),this._startTime||(this._startTime=+new Date);var b=Math.max(p-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(r(this._performZoom,this),b),fe(l)},_performZoom:function(){var l=this._map,d=l.getZoom(),p=this._map.options.zoomSnap||0;l._stop();var b=this._delta/(this._map.options.wheelPxPerZoomLevel*4),C=4*Math.log(2/(1+Math.exp(-Math.abs(b))))/Math.LN2,P=p?Math.ceil(C/p)*p:C,W=l._limitZoom(d+(this._delta>0?P:-P))-d;this._delta=0,this._startTime=null,W&&(l.options.scrollWheelZoom==="center"?l.setZoom(d+W):l.setZoomAround(this._lastMousePos,d+W))}});ut.addInitHook("addHandler","scrollWheelZoom",iL);var xR=600;ut.mergeOptions({tapHold:X.touchNative&&X.safari&&X.mobile,tapTolerance:15});var nL=jn.extend({addHooks:function(){yt(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){gn(this._map._container,"touchstart",this._onDown,this)},_onDown:function(l){if(clearTimeout(this._holdTimeout),l.touches.length===1){var d=l.touches[0];this._startPos=this._newPos=new ae(d.clientX,d.clientY),this._holdTimeout=setTimeout(r(function(){this._cancel(),this._isTapValid()&&(yt(document,"touchend",le),yt(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",d))},this),xR),yt(document,"touchend touchcancel contextmenu",this._cancel,this),yt(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function l(){gn(document,"touchend",le),gn(document,"touchend touchcancel",l)},_cancel:function(){clearTimeout(this._holdTimeout),gn(document,"touchend touchcancel contextmenu",this._cancel,this),gn(document,"touchmove",this._onMove,this)},_onMove:function(l){var d=l.touches[0];this._newPos=new ae(d.clientX,d.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(l,d){var p=new MouseEvent(l,{bubbles:!0,cancelable:!0,view:window,screenX:d.screenX,screenY:d.screenY,clientX:d.clientX,clientY:d.clientY});p._simulated=!0,d.target.dispatchEvent(p)}});ut.addInitHook("addHandler","tapHold",nL),ut.mergeOptions({touchZoom:X.touch,bounceAtZoomLimits:!0});var sL=jn.extend({addHooks:function(){Fe(this._map._container,"leaflet-touch-zoom"),yt(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){zt(this._map._container,"leaflet-touch-zoom"),gn(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(l){var d=this._map;if(!(!l.touches||l.touches.length!==2||d._animatingZoom||this._zooming)){var p=d.mouseEventToContainerPoint(l.touches[0]),b=d.mouseEventToContainerPoint(l.touches[1]);this._centerPoint=d.getSize()._divideBy(2),this._startLatLng=d.containerPointToLatLng(this._centerPoint),d.options.touchZoom!=="center"&&(this._pinchStartLatLng=d.containerPointToLatLng(p.add(b)._divideBy(2))),this._startDist=p.distanceTo(b),this._startZoom=d.getZoom(),this._moved=!1,this._zooming=!0,d._stop(),yt(document,"touchmove",this._onTouchMove,this),yt(document,"touchend touchcancel",this._onTouchEnd,this),le(l)}},_onTouchMove:function(l){if(!(!l.touches||l.touches.length!==2||!this._zooming)){var d=this._map,p=d.mouseEventToContainerPoint(l.touches[0]),b=d.mouseEventToContainerPoint(l.touches[1]),C=p.distanceTo(b)/this._startDist;if(this._zoom=d.getScaleZoom(C,this._startZoom),!d.options.bounceAtZoomLimits&&(this._zoom<d.getMinZoom()&&C<1||this._zoom>d.getMaxZoom()&&C>1)&&(this._zoom=d._limitZoom(this._zoom)),d.options.touchZoom==="center"){if(this._center=this._startLatLng,C===1)return}else{var P=p._add(b)._divideBy(2)._subtract(this._centerPoint);if(C===1&&P.x===0&&P.y===0)return;this._center=d.unproject(d.project(this._pinchStartLatLng,this._zoom).subtract(P),this._zoom)}this._moved||(d._moveStart(!0,!1),this._moved=!0),je(this._animRequest);var W=r(d._move,d,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=Pe(W,this,!0),le(l)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,je(this._animRequest),gn(document,"touchmove",this._onTouchMove,this),gn(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))}});ut.addInitHook("addHandler","touchZoom",sL),ut.BoxZoom=Q0,ut.DoubleClickZoom=J0,ut.Drag=eL,ut.Keyboard=tL,ut.ScrollWheelZoom=iL,ut.TapHold=nL,ut.TouchZoom=sL,t.Bounds=lt,t.Browser=X,t.CRS=Oi,t.Canvas=G0,t.Circle=dw,t.CircleMarker=Wp,t.Class=Ge,t.Control=en,t.DivIcon=$0,t.DivOverlay=Ir,t.DomEvent=fi,t.DomUtil=Wi,t.Draggable=Is,t.Evented=Kt,t.FeatureGroup=ca,t.GeoJSON=ha,t.GridLayer=gg,t.Handler=jn,t.Icon=ih,t.ImageOverlay=jp,t.LatLng=Lt,t.LatLngBounds=It,t.Layer=Yo,t.LayerGroup=th,t.LineUtil=tR,t.Map=ut,t.Marker=Hp,t.Mixin=la,t.Path=Qa,t.Point=ae,t.PolyUtil=XN,t.Polygon=nh,t.Polyline=da,t.Popup=$p,t.PosAnimation=Ji,t.Projection=iR,t.Rectangle=Y0,t.Renderer=ua,t.SVG=pg,t.SVGOverlay=j0,t.TileLayer=oh,t.Tooltip=qp,t.Transformation=Mt,t.Util=qt,t.VideoOverlay=U0,t.bind=r,t.bounds=Qt,t.canvas=Z0,t.circle=dR,t.circleMarker=cR,t.control=Qn,t.divIcon=bR,t.extend=n,t.featureGroup=rR,t.geoJSON=V0,t.geoJson=gR,t.gridLayer=wR,t.icon=aR,t.imageOverlay=fR,t.latLng=gt,t.latLngBounds=Tt,t.layerGroup=oR,t.map=hi,t.marker=lR,t.point=ve,t.polygon=uR,t.polyline=hR,t.popup=_R,t.rectangle=CR,t.setOptions=y,t.stamp=c,t.svg=X0,t.svgOverlay=mR,t.tileLayer=q0,t.tooltip=vR,t.transformation=kt,t.version=i,t.videoOverlay=pR;var LR=window.L;t.noConflict=function(){return window.L=LR,this},window.L=t}))})(Ug,Ug.exports)),Ug.exports}var wK=bK();const Ig=MN(wK),yK="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=",SK="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==",CK="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC",Mn=(o,e=pl)=>{var t=xK(),i=D(k(t),2),n=k(i);se(()=>oe(n,e())),N(o,t)};var xK=B('<span class="tip svelte-767znw"><span class="tip-icon svelte-767znw">ℹ</span> <span class="tip-box svelte-767znw"> </span></span>'),LK=B("<button> </button>"),IK=B('<span class="err svelte-767znw"> </span>'),kK=B('<span class="ok svelte-767znw"> </span>'),DK=B('<div class="loading svelte-767znw">Loading…</div>'),EK=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>'),PK=B('<section id="sec-mqtt" class="svelte-767znw"><h3 class="svelte-767znw">MQTT</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Broker URL <!></label> <input type="text" placeholder="mqtt://localhost:1883" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">Client name <!></label> <input type="text" placeholder="logic" 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>'),TK=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>'),MK=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>'),NK=B('<div class="field-error svelte-767znw"> </div>'),RK=B('<div class="field-ok svelte-767znw"> </div>'),AK=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"><label class="svelte-767znw"></label> <button class="save-auth-btn svelte-767znw"> </button></div></section>'),OK=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>'),FK=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" placeholder="~/.she/scripts (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> Disable file watching <!></label></div></section>'),HK=B('<div class="field svelte-767znw"><label class="map-label svelte-767znw">Map <span class="map-note svelte-767znw">(click or drag marker to set location — requires internet for tiles)</span></label> <div class="map-container svelte-767znw"></div></div>'),WK=B('<section id="sec-solar" class="svelte-767znw"><h3 class="svelte-767znw">Solar events</h3> <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"><label class="svelte-767znw"></label> <div class="geo-btns svelte-767znw"><button class="geo-btn svelte-767znw"><!></button> <button class="geo-btn svelte-767znw"> </button></div></div> <!></section>'),BK=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>'),zK=B('<div class="field field--check svelte-767znw"><span></span> <label><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> Retain document messages <!></label></div>'),VK=B('<section id="sec-shedb" class="svelte-767znw"><h3 class="svelte-767znw">sheDB</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Database path <!></label> <input type="text" placeholder="defaults to ~/.she/db" 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><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> Publish documents to MQTT <!></label></div> <!></section>'),UK=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>'),jK=B("<option> </option>"),$K=B('<span class="free-badge svelte-767znw">FREE</span> ',1),qK=B('&nbsp;— <a target="_blank" rel="noreferrer" class="svelte-767znw">Get API key ↗</a>',1),KK=B("<div><!> <!></div>"),GK=B('<div class="field svelte-767znw"><label class="svelte-767znw">Base URL <!></label> <input type="text" class="svelte-767znw"/></div>'),ZK=B('<div class="field svelte-767znw"><label class="svelte-767znw">API key <!></label> <input type="password" placeholder="sk-…" autocomplete="off" class="svelte-767znw"/></div>'),XK=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>'),YK=B('<div class="config-form svelte-767znw"><!> <!> <!> <!> <!> <!> <!> <!> <!> <!></div>'),QK=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>');function JK(o,e){ao(e,!0),delete Ig.Icon.Default.prototype._getIconUrl,Ig.Icon.Default.mergeOptions({iconUrl:yK,iconRetinaUrl:SK,shadowUrl:CK});let t=j(Li(mK())),i=j(""),n=j("logic"),s=j("var"),r=j(!1),a=j(8080),c=j(""),h=j("none"),u=j(""),g=j("X-Remote-User"),f=j(!1),v=j(""),_=j(""),y=j(""),S=j(!1),x=j(48.7408),E=j(9.1778),M=j(!1),F=j(void 0),R=j(!1),Z=j(null),q=j("info"),he=j(""),pe=j(""),Ce=j(!1),Pe=j(!1),je=j("");const qt=[{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 Ge=j("ollama"),Xt=j("ollama"),pt=j(""),Kt=j(""),ae=j("");const Te={};let ve="ollama";function lt(K,Ie){return K==="anthropic"?"anthropic":K==="ollama"?"ollama":Ie?Ie.includes("localhost:1234")?"lmstudio":Ie.includes("groq.com")?"groq":Ie.includes("googleapis.com")?"gemini":"openai":"openai"}function Qt(){Te[ve]={baseUrl:m(pt),model:m(Kt),apiKey:m(ae)};const K=qt.find(nt=>nt.id===m(Ge));if(!K)return;I(Xt,K.provider,!0);const Ie=Te[m(Ge)];I(pt,(Ie==null?void 0:Ie.baseUrl)??K.baseUrl,!0),I(Kt,(Ie==null?void 0:Ie.model)??K.defaultModel,!0),I(ae,(Ie==null?void 0:Ie.apiKey)??"",!0),ve=m(Ge)}const It=Vt(()=>qt.find(K=>K.id===m(Ge)));let Tt=j(Li({}));const Lt=new Set(["url","name","variablePrefix","disableVariables","port","bindAddress","auth","password","proxyHeader","dir","disableWatch","latitude","longitude","verbosity","dbPath","dbPrefix","dbPublish","dbRetain","redis","ai"]);kn(()=>{if(!m(F))return;const K=typeof m(x)=="number"?m(x):48.7408,Ie=typeof m(E)=="number"?m(E):9.1778,nt=Ig.map(m(F)).setView([K,Ie],10);Ig.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'}).addTo(nt);const Rt=Ig.marker([K,Ie],{draggable:!0}).addTo(nt);I(Z,Rt,!0);const vt=rt=>{I(x,+rt.lat.toFixed(6)),I(E,+rt.lng.toFixed(6))};return Rt.on("dragend",()=>vt(Rt.getLatLng())),nt.on("click",rt=>{Rt.setLatLng(rt.latlng),vt(rt.latlng)}),()=>{I(Z,null),nt.remove()}}),kn(()=>{!m(Z)||m(x)===""||m(E)===""||m(Z).setLatLng([Number(m(x)),Number(m(E))])});function gt(){if(!navigator.geolocation){alert("Geolocation is not supported by this browser.");return}I(R,!0),navigator.geolocation.getCurrentPosition(K=>{I(x,+K.coords.latitude.toFixed(6)),I(E,+K.coords.longitude.toFixed(6)),I(R,!1)},()=>{I(R,!1)})}let Oi=j(!0),Gt=j(!1),Ae=j(""),Be=j(""),Mt=j(""),kt=j("appearance");const pi=[{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"]},{id:"webserver",label:"Web server",terms:["port","http","server","bind","address"]},{id:"scripts",label:"Scripts",terms:["directory","watch","hot reload","dir"]},{id:"solar",label:"Solar events",terms:["latitude","longitude","sunrise","sunset","geo"]},{id:"logging",label:"Logging",terms:["verbosity","debug","info","warn","error"]},{id:"shedb",label:"sheDB",terms:["database","db","path","retain"]},{id:"redis",label:"Redis",terms:["redis","cache"]},{id:"ai",label:"AI Assistant",terms:["llm","ollama","openai","anthropic","model","provider","base url"]}];let Nt=Vt(()=>pi.filter(K=>{const Ie=m(Mt).trim().toLowerCase();return!Ie||K.label.toLowerCase().includes(Ie)||K.terms.some(nt=>nt.includes(Ie))}));function mi(K){var Ie;I(kt,K,!0),(Ie=document.getElementById("sec-"+K))==null||Ie.scrollIntoView({behavior:"smooth",block:"start"})}na(async()=>{try{const K=await S7();typeof K.url=="string"&&I(i,K.url,!0),typeof K.name=="string"&&I(n,K.name,!0),typeof K.variablePrefix=="string"&&I(s,K.variablePrefix,!0),typeof K.disableVariables=="boolean"&&I(r,K.disableVariables,!0),typeof K.port=="number"&&I(a,K.port,!0),typeof K.bindAddress=="string"&&I(c,K.bindAddress,!0),typeof K.auth=="string"&&I(h,K.auth,!0),typeof K.proxyHeader=="string"&&I(g,K.proxyHeader,!0),typeof K.dir=="string"&&I(y,K.dir,!0),typeof K.disableWatch=="boolean"&&I(S,K.disableWatch,!0),typeof K.latitude=="number"&&I(x,K.latitude,!0),typeof K.longitude=="number"&&I(E,K.longitude,!0),typeof K.verbosity=="string"&&I(q,K.verbosity,!0),typeof K.dbPath=="string"&&I(he,K.dbPath,!0),typeof K.dbPrefix=="string"&&I(pe,K.dbPrefix,!0),typeof K.dbPublish=="boolean"&&I(Ce,K.dbPublish,!0),typeof K.dbRetain=="boolean"&&I(Pe,K.dbRetain,!0);const Ie=K.redis;Ie!=null&&Ie.url&&I(je,Ie.url,!0);const nt=K.ai;nt!=null&&nt.provider&&I(Xt,nt.provider,!0),nt!=null&&nt.baseUrl&&I(pt,nt.baseUrl,!0),nt!=null&&nt.model&&I(Kt,nt.model,!0),nt!=null&&nt.apiKey&&I(ae,nt.apiKey,!0),I(Ge,lt(m(Xt),m(pt)),!0),ve=m(Ge),I(Tt,Object.fromEntries(Object.entries(K).filter(([Rt])=>!Lt.has(Rt))),!0)}catch(K){I(Be,K.message,!0)}finally{I(Oi,!1)}});async function Mi(){if(I(_,""),I(v,""),m(h)==="password"&&!m(u)){I(_,"A password is required to enable password authentication.");return}I(f,!0);try{await g7(m(h),m(h)==="password"?m(u):void 0,m(h)==="proxy"?m(g):void 0),I(u,""),I(v,"Authentication settings saved.")}catch(K){I(_,K.message,!0)}finally{I(f,!1)}}async function Ui(){I(Be,""),I(Ae,"");const K={...m(Tt)};m(i)&&(K.url=m(i)),K.name=m(n),K.variablePrefix=m(s),m(r)&&(K.disableVariables=!0),m(a)!==""&&(K.port=Number(m(a))),m(c)&&(K.bindAddress=m(c)),m(y)&&(K.dir=m(y)),m(S)&&(K.disableWatch=!0),m(x)!==""&&(K.latitude=Number(m(x))),m(E)!==""&&(K.longitude=Number(m(E))),K.verbosity=m(q),m(he)&&(K.dbPath=m(he),m(pe)&&(K.dbPrefix=m(pe)),m(Ce)&&(K.dbPublish=!0,m(Pe)&&(K.dbRetain=!0))),m(je)&&(K.redis={url:m(je)}),m(Xt)&&m(Kt)&&(K.ai={provider:m(Xt),...m(pt)?{baseUrl:m(pt)}:{},model:m(Kt),...m(ae)?{apiKey:m(ae)}:{}}),I(Gt,!0);try{const Ie=await C7(K);I(Ae,Ie.restartRequired?"Saved — restart required to apply changes.":"Saved.",!0)}catch(Ie){I(Be,Ie.message,!0)}finally{I(Gt,!1)}}var Fi=QK(),yi=k(Fi),cn=k(yi),Zi=D(k(cn),2),rn=D(cn,2);an(rn,21,()=>pi,K=>K.id,(K,Ie)=>{var nt=_s(),Rt=Wt(nt);{var vt=ni=>{var ri=LK();let Xi;var Hi=k(ri);se(()=>{Xi=ti(ri,1,"section-link svelte-767znw",null,Xi,{active:m(kt)===m(Ie).id}),oe(Hi,m(Ie).label)}),de("click",ri,()=>mi(m(Ie).id)),N(ni,ri)},rt=Vt(()=>m(Nt).some(ni=>ni.id===m(Ie).id));J(Rt,ni=>{m(rt)&&ni(vt)})}N(K,nt)});var bn=D(yi,2),_i=k(bn),_n=D(k(_i),2);{var ki=K=>{var Ie=IK(),nt=k(Ie);se(()=>oe(nt,m(Be))),N(K,Ie)};J(_n,K=>{m(Be)&&K(ki)})}var Ni=D(_n,2);{var fn=K=>{var Ie=kK(),nt=k(Ie);se(()=>oe(nt,m(Ae))),N(K,Ie)};J(Ni,K=>{m(Ae)&&K(fn)})}var On=D(Ni,2),Vn=k(On),Un=D(_i,2);{var Jt=K=>{var Ie=DK();N(K,Ie)},be=K=>{var Ie=YK(),nt=k(Ie);{var Rt=me=>{var Ne=EK(),De=D(k(Ne),2),ze=D(k(De),2),Ct=k(ze);Ct.value=Ct.__value="dark";var et=D(Ct);et.value=et.__value="light";var tt=D(et);tt.value=tt.__value="system",de("change",ze,()=>_K(m(t))),vl(ze,()=>m(t),at=>I(t,at)),N(me,Ne)},vt=Vt(()=>m(Nt).some(me=>me.id==="appearance"));J(nt,me=>{m(vt)&&me(Rt)})}var rt=D(nt,2);{var ni=me=>{var Ne=PK(),De=D(k(Ne),2),ze=k(De),Ct=D(k(ze));Mn(Ct,()=>"mqtt:// or mqtts:// URL of the broker. Leave empty to run without MQTT.");var et=D(ze,2),tt=D(De,2),at=k(tt),mt=D(k(at));Mn(mt,()=>'MQTT client ID and topic prefix used for the "connected" status message. Default: logic');var ui=D(at,2),ce=D(tt,2),He=k(ce),dt=D(k(He));Mn(dt,()=>"Topic prefix for the variable system (var/set/name → var/status/name). Default: var");var At=D(He,2),ei=D(ce,2),ht=D(k(ei),2),st=k(ht),Ye=D(st,4);Mn(Ye,()=>"When enabled, var/set/… messages are not processed and no var/status/… retained messages are published."),Bi(et,()=>m(i),Ee=>I(i,Ee)),Bi(ui,()=>m(n),Ee=>I(n,Ee)),Bi(At,()=>m(s),Ee=>I(s,Ee)),ms(st,()=>m(r),Ee=>I(r,Ee)),N(me,Ne)},ri=Vt(()=>m(Nt).some(me=>me.id==="mqtt"));J(rt,me=>{m(ri)&&me(ni)})}var Xi=D(rt,2);{var Hi=me=>{var Ne=AK(),De=D(k(Ne),2),ze=k(De),Ct=D(k(ze));Mn(Ct,()=>"none: no authentication required. password: single-user password login. proxy: trust a header set by nginx/authentik.");var et=D(ze,2),tt=k(et);tt.value=tt.__value="none";var at=D(tt);at.value=at.__value="password";var mt=D(at);mt.value=mt.__value="proxy";var ui=D(De,2);{var ce=Re=>{var Fe=TK(),zt=k(Fe),Yi=k(zt),Ln=D(Yi);Mn(Ln,()=>"Set a new password. Leave empty to keep the current password (if already set).");var un=D(zt,2);se(()=>oe(Yi,`${m(u)?"New password":"Password"} `)),Bi(un,()=>m(u),Go=>I(u,Go)),N(Re,Fe)};J(ui,Re=>{m(h)==="password"&&Re(ce)})}var He=D(ui,2);{var dt=Re=>{var Fe=MK(),zt=k(Fe),Yi=D(k(zt));Mn(Yi,()=>"The HTTP header that nginx/authentik sets after successful authentication. Default: X-Remote-User");var Ln=D(zt,2);Bi(Ln,()=>m(g),un=>I(g,un)),N(Re,Fe)};J(He,Re=>{m(h)==="proxy"&&Re(dt)})}var At=D(He,2);{var ei=Re=>{var Fe=NK(),zt=k(Fe);se(()=>oe(zt,m(_))),N(Re,Fe)};J(At,Re=>{m(_)&&Re(ei)})}var ht=D(At,2);{var st=Re=>{var Fe=RK(),zt=k(Fe);se(()=>oe(zt,m(v))),N(Re,Fe)};J(ht,Re=>{m(v)&&Re(st)})}var Ye=D(ht,2),Ee=D(k(Ye),2),Ot=k(Ee);se(()=>{Ee.disabled=m(f)||m(h)==="password"&&!m(u),oe(Ot,m(f)?"Saving…":"Apply authentication settings")}),vl(et,()=>m(h),Re=>I(h,Re)),de("click",Ee,Mi),N(me,Ne)},A=Vt(()=>m(Nt).some(me=>me.id==="auth"));J(Xi,me=>{m(A)&&me(Hi)})}var te=D(Xi,2);{var H=me=>{var Ne=OK(),De=D(k(Ne),2),ze=k(De),Ct=D(k(ze));Mn(Ct,()=>"HTTP server port. Use 0 to let the OS pick a free port. Default: 8080");var et=D(ze,2),tt=D(De,2),at=k(tt),mt=D(k(at));Mn(mt,()=>"Interface she listens on. Use 127.0.0.1 when running behind nginx (recommended with proxy auth). Default: 0.0.0.0");var ui=D(at,2);Bi(et,()=>m(a),ce=>I(a,ce)),Bi(ui,()=>m(c),ce=>I(c,ce)),N(me,Ne)},ee=Vt(()=>m(Nt).some(me=>me.id==="webserver"));J(te,me=>{m(ee)&&me(H)})}var ke=D(te,2);{var Ue=me=>{var Ne=FK(),De=D(k(Ne),2),ze=k(De),Ct=D(k(ze));Mn(Ct,()=>"Directory that is watched for .js script files. Defaults to ~/.she/scripts");var et=D(ze,2),tt=D(De,2),at=D(k(tt),2),mt=k(at),ui=D(mt,4);Mn(ui,()=>"When enabled the daemon will not watch for file changes and will not hot-reload scripts."),Bi(et,()=>m(y),ce=>I(y,ce)),ms(mt,()=>m(S),ce=>I(S,ce)),N(me,Ne)},z=Vt(()=>m(Nt).some(me=>me.id==="scripts"));J(ke,me=>{m(z)&&me(Ue)})}var $=D(ke,2);{var re=me=>{var Ne=WK(),De=D(k(Ne),2),ze=k(De),Ct=D(k(ze));Mn(Ct,()=>"Geographic latitude used for sunrise/sunset calculations. Default: 48.7408 (Stuttgart)");var et=D(ze,2),tt=D(De,2),at=k(tt),mt=D(k(at));Mn(mt,()=>"Geographic longitude used for sunrise/sunset calculations. Default: 9.1778 (Stuttgart)");var ui=D(at,2),ce=D(tt,2),He=D(k(ce),2),dt=k(He),At=k(dt);{var ei=Re=>{var Fe=Ma("…");N(Re,Fe)},ht=Re=>{var Fe=Ma("📍 Use my location");N(Re,Fe)};J(At,Re=>{m(R)?Re(ei):Re(ht,-1)})}var st=D(dt,2),Ye=k(st),Ee=D(ce,2);{var Ot=Re=>{var Fe=HK(),zt=D(k(Fe),2);bo(zt,Yi=>I(F,Yi),()=>m(F)),N(Re,Fe)};J(Ee,Re=>{m(M)&&Re(Ot)})}se(()=>{dt.disabled=m(R),oe(Ye,m(M)?"Hide map":"Pick on map")}),Bi(et,()=>m(x),Re=>I(x,Re)),Bi(ui,()=>m(E),Re=>I(E,Re)),de("click",dt,gt),de("click",st,()=>I(M,!m(M))),N(me,Ne)},xe=Vt(()=>m(Nt).some(me=>me.id==="solar"));J($,me=>{m(xe)&&me(re)})}var _e=D($,2);{var X=me=>{var Ne=BK(),De=D(k(Ne),2),ze=k(De),Ct=D(k(ze));Mn(Ct,()=>"Minimum log level. debug shows all messages including MQTT traffic details.");var et=D(ze,2),tt=k(et);tt.value=tt.__value="debug";var at=D(tt);at.value=at.__value="info";var mt=D(at);mt.value=mt.__value="warn";var ui=D(mt);ui.value=ui.__value="error",vl(et,()=>m(q),ce=>I(q,ce)),N(me,Ne)},V=Vt(()=>m(Nt).some(me=>me.id==="logging"));J(_e,me=>{m(V)&&me(X)})}var ue=D(_e,2);{var Le=me=>{var Ne=VK(),De=D(k(Ne),2),ze=k(De),Ct=D(k(ze));Mn(Ct,()=>"Path to the sheDB data directory. Defaults to ~/.she/db. Leave empty to disable sheDB.");var et=D(ze,2),tt=D(De,2),at=k(tt),mt=D(k(at));Mn(mt,()=>"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 ui=D(at,2),ce=D(tt,2),He=D(k(ce),2);let dt;var At=k(He),ei=D(At,4);Mn(ei,()=>'When enabled, every document change is published to {dbPrefix}doc/{id}. Individual views can publish independently via their own "mqttpub" setting.');var ht=D(ce,2);{var st=Ye=>{var Ee=zK(),Ot=D(k(Ee),2);let Re;var Fe=k(Ot),zt=D(Fe,4);Mn(zt,()=>"When enabled, MQTT messages for document changes are published as retained messages."),se(()=>{Re=ti(Ot,1,"check-label svelte-767znw",null,Re,{muted:!m(he)}),Fe.disabled=!m(he)}),ms(Fe,()=>m(Pe),Yi=>I(Pe,Yi)),N(Ye,Ee)};J(ht,Ye=>{m(Ce)&&Ye(st)})}se(()=>{ui.disabled=!m(he),dt=ti(He,1,"check-label svelte-767znw",null,dt,{muted:!m(he)}),At.disabled=!m(he)}),Bi(et,()=>m(he),Ye=>I(he,Ye)),Bi(ui,()=>m(pe),Ye=>I(pe,Ye)),ms(At,()=>m(Ce),Ye=>I(Ce,Ye)),N(me,Ne)},Me=Vt(()=>m(Nt).some(me=>me.id==="shedb"));J(ue,me=>{m(Me)&&me(Le)})}var Oe=D(ue,2);{var Ze=me=>{var Ne=UK(),De=D(k(Ne),2),ze=k(De),Ct=D(k(ze));Mn(Ct,()=>"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 et=D(ze,2);Bi(et,()=>m(je),tt=>I(je,tt)),N(me,Ne)},bt=Vt(()=>m(Nt).some(me=>me.id==="redis"));J(Oe,me=>{m(bt)&&me(Ze)})}var Dt=D(Oe,2);{var Ht=me=>{var Ne=XK(),De=D(k(Ne),2),ze=k(De),Ct=D(k(ze));Mn(Ct,()=>"Choose a provider. Free options need a free API key from the provider's website — no credit card required.");var et=D(ze,2);an(et,21,()=>qt,ks,(st,Ye)=>{var Ee=jK(),Ot=k(Ee),Re={};se(()=>{oe(Ot,m(Ye).label),Re!==(Re=m(Ye).id)&&(Ee.value=(Ee.__value=m(Ye).id)??"")}),N(st,Ee)});var tt=D(De,2);{var at=st=>{var Ye=KK();let Ee;var Ot=k(Ye);{var Re=Yi=>{var Ln=$K(),un=D(Wt(Ln));se(()=>oe(un,` ${m(It).freeNote??""}`)),N(Yi,Ln)};J(Ot,Yi=>{m(It).freeNote&&Yi(Re)})}var Fe=D(Ot,2);{var zt=Yi=>{var Ln=qK(),un=D(Wt(Ln));se(()=>is(un,"href",m(It).apiKeyUrl)),N(Yi,Ln)};J(Fe,Yi=>{m(It).apiKeyUrl&&Yi(zt)})}se(()=>Ee=ti(Ye,1,"preset-note svelte-767znw",null,Ee,{free:!!m(It).freeNote})),N(st,Ye)};J(tt,st=>{var Ye,Ee;((Ye=m(It))!=null&&Ye.freeNote||(Ee=m(It))!=null&&Ee.apiKeyUrl)&&st(at)})}var mt=D(tt,2);{var ui=st=>{var Ye=GK(),Ee=k(Ye),Ot=D(k(Ee));Mn(Ot,()=>"Base URL of the LLM API. Auto-filled for cloud presets. For Ollama: http://localhost:11434.");var Re=D(Ee,2);se(()=>{var Fe;return is(Re,"placeholder",m(Ge)==="ollama"?"http://localhost:11434":m(Ge)==="lmstudio"?"http://localhost:1234":((Fe=m(It))==null?void 0:Fe.baseUrl)??"")}),Bi(Re,()=>m(pt),Fe=>I(pt,Fe)),N(st,Ye)};J(mt,st=>{m(Ge)!=="anthropic"&&st(ui)})}var ce=D(mt,2),He=k(ce),dt=D(k(He));Mn(dt,()=>"Model identifier. Suggested default is filled in when you choose a preset.");var At=D(He,2),ei=D(ce,2);{var ht=st=>{var Ye=ZK(),Ee=k(Ye),Ot=D(k(Ee));Mn(Ot,()=>"Stored in config.json. Not needed for local providers.");var Re=D(Ee,2);Bi(Re,()=>m(ae),Fe=>I(ae,Fe)),N(st,Ye)};J(ei,st=>{m(Ge)!=="ollama"&&m(Ge)!=="lmstudio"&&st(ht)})}se(()=>{var st;return is(At,"placeholder",((st=m(It))==null?void 0:st.defaultModel)||"e.g. llama3.2")}),de("change",et,Qt),vl(et,()=>m(Ge),st=>I(Ge,st)),Bi(At,()=>m(Kt),st=>I(Kt,st)),N(me,Ne)},ct=Vt(()=>m(Nt).some(me=>me.id==="ai"));J(Dt,me=>{m(ct)&&me(Ht)})}N(K,Ie)};J(Un,K=>{m(Oi)?K(Jt):K(be,-1)})}se(()=>{On.disabled=m(Gt),oe(Vn,m(Gt)?"Saving…":"Save")}),Bi(Zi,()=>m(Mt),K=>I(Mt,K)),de("click",On,Ui),N(o,Fi),lo()}Ko(["click","change"]);var eG=B("<option> </option>"),tG=B('<div><span class="ts svelte-18loop9"> </span> <span class="lvl svelte-18loop9"> </span> <span class="msg svelte-18loop9"> </span></div>'),iG=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="cb svelte-18loop9" title="Interpret filter as a regular expression"><input type="checkbox"/> Regex</label> <label class="cb svelte-18loop9"><input type="checkbox"/> Auto-scroll</label> <button class="svelte-18loop9">Clear</button></div> <div class="log svelte-18loop9"></div></div>');function nG(o,e){ao(e,!0);let t=j(Li(F7())),i,n=j(!0),s=j("all"),r=j(""),a=j(!1);const c=["all","debug","info","warn","error"],h={debug:0,info:1,warn:2,error:3};TN(q=>{I(t,[...m(t).slice(-1999),q],!0)}),na(()=>{i&&(i.scrollTop=i.scrollHeight)}),kn(()=>{m(t).length,m(n)&&i&&(i.scrollTop=i.scrollHeight)});function u(){I(t,[],!0)}function g(q){if(m(s)!=="all"&&h[q.level]<h[m(s)])return!1;if(!m(r))return!0;if(m(a))try{return new RegExp(m(r),"i").test(q.msg)}catch{}return q.msg.toLowerCase().includes(m(r).toLowerCase())}function f(q){return new Date(q).toLocaleTimeString()}var v=iG(),_=k(v),y=D(k(_),2);an(y,21,()=>c,ks,(q,he)=>{var pe=eG(),Ce=k(pe),Pe={};se(()=>{oe(Ce,m(he)),Pe!==(Pe=m(he))&&(pe.value=(pe.__value=m(he))??"")}),N(q,pe)});var S=D(y,2),x=D(S,2),E=k(x),M=D(x,2),F=k(M),R=D(M,2),Z=D(_,2);an(Z,21,()=>m(t).filter(g),q=>q.ts+q.msg,(q,he)=>{var pe=tG(),Ce=k(pe),Pe=k(Ce),je=D(Ce,2),qt=k(je),Ge=D(je,2),Xt=k(Ge);se((pt,Kt)=>{ti(pe,1,`line ${m(he).level??""}`,"svelte-18loop9"),oe(Pe,pt),oe(qt,Kt),oe(Xt,m(he).msg)},[()=>f(m(he).ts),()=>m(he).level.toUpperCase()]),N(q,pe)}),bo(Z,q=>i=q,()=>i),vl(y,()=>m(s),q=>I(s,q)),Bi(S,()=>m(r),q=>I(r,q)),ms(E,()=>m(a),q=>I(a,q)),ms(F,()=>m(n),q=>I(n,q)),de("click",R,u),N(o,v),lo()}Ko(["click"]);var sG=B('<span class="chat-model svelte-1twuiul"><!></span>'),oG=B('<button class="clear-btn svelte-1twuiul" title="Clear conversation">✕</button>'),rG=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>'),aG=B('Working on view <code class="svelte-1twuiul"> </code>',1),lG=B('<button class="chip svelte-1twuiul"> </button>'),cG=B('<div class="suggestions svelte-1twuiul"><p class="suggestions-hint svelte-1twuiul"><!></p> <!></div>'),dG=B('<div class="msg-content user-text svelte-1twuiul"> </div>'),iD=B('<div class="text-block svelte-1twuiul"></div>'),hG=B('<button class="expand-btn svelte-1twuiul"> </button>'),uG=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>'),gG=B('<div class="apply-view-row svelte-1twuiul"><button class="apply-view-btn svelte-1twuiul"> </button></div>'),fG=B('<div class="msg-content svelte-1twuiul"><!> <!></div>'),pG=B("<div><!></div>"),mG=B('<div class="message assistant svelte-1twuiul"><div class="msg-content svelte-1twuiul"><span class="status-shimmer svelte-1twuiul"> </span></div></div>'),_G=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>'),vG=B('<div class="message assistant streaming svelte-1twuiul"><div class="msg-content svelte-1twuiul"></div></div>'),bG=B('<div class="chat-error svelte-1twuiul"> </div>'),wG=B('<button class="stop-btn svelte-1twuiul" title="Stop generation">■</button>'),yG=B('<button class="send-btn svelte-1twuiul">↑</button>'),SG=B('<option class="svelte-1twuiul"> </option>'),CG=B('<select class="model-select svelte-1twuiul"></select>'),xG=B('<span class="model-name svelte-1twuiul"> </span>'),LG=B('<button class="info-btn svelte-1twuiul" title="Model info">ℹ</button>'),IG=B('<div class="model-bar svelte-1twuiul"><span class="model-provider svelte-1twuiul"> </span> <!> <!></div>'),kG=B('<p class="info-status svelte-1twuiul">Loading…</p>'),DG=B('<p class="info-status info-err svelte-1twuiul"> </p>'),EG=B('<dt class="svelte-1twuiul">Ollama version</dt><dd class="svelte-1twuiul"> </dd>',1),PG=B('<dt class="svelte-1twuiul">Family</dt><dd class="svelte-1twuiul"> </dd>',1),TG=B('<dt class="svelte-1twuiul">Parameters</dt><dd class="svelte-1twuiul"> </dd>',1),MG=B('<dt class="svelte-1twuiul">Quantization</dt><dd class="svelte-1twuiul"> </dd>',1),NG=B('<div class="running-model svelte-1twuiul"> </div>'),RG=B('<dt class="svelte-1twuiul">Loaded</dt> <dd class="svelte-1twuiul"></dd>',1),AG=B('<dt class="svelte-1twuiul">Loaded</dt><dd class="dim svelte-1twuiul">Not in memory</dd>',1),OG=B('<dl class="svelte-1twuiul"><!> <!> <!> <!> <!></dl>'),FG=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>'),HG=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"/> Doc IDs</label> <label title="Include sample document content in context (first 10 docs)" class="svelte-1twuiul"><input type="checkbox" class="svelte-1twuiul"/> Sample docs</label> <label title="Include current MQTT state in context" class="svelte-1twuiul"><input type="checkbox" class="svelte-1twuiul"/> MQTT</label></div> <div class="input-row svelte-1twuiul"><div><textarea rows="3" class="svelte-1twuiul"></textarea></div> <!></div> <!></div> <!>',1);function WG(o,e){ao(e,!0),gv.registerLanguage("javascript",ON),ln.use({breaks:!0,gfm:!0});let t=xf(e,"currentView",3,null),i=j(Li([])),n=j(null),s=j(""),r=j(!1),a=j(""),c=j(null),h=j(Li([])),u=j(Li(localStorage.getItem("she:selectedModel")??"")),g=j(Li(new Set)),f=j(!1),v=j(null),_=j(!1),y=j(""),S=null,x=j(0);const E=["[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 M=j(!0),F=j(!0),R=j(!1),Z,q;const he=Vt(()=>({apiref:!1,mqtt:m(R),shedb:m(M),matter:!1,sampleDocs:m(F)})),pe=Vt(()=>{var H;return((H=m(c))==null?void 0:H.configured)??!1});kn(()=>{IN().then(H=>{I(c,H,!0),H.configured&&!m(u)&&I(u,H.model,!0)}).catch(()=>{})}),kn(()=>{m(u)&&localStorage.setItem("she:selectedModel",m(u))}),kn(()=>{var H;(H=m(c))!=null&&H.configured&&kN().then(ee=>{I(h,ee.models,!0)}).catch(()=>{})}),kn(()=>{m(u),I(v,null),I(y,"")}),kn(()=>{if(!m(r))return;I(x,Math.floor(Math.random()*E.length),!0);const H=setInterval(()=>{I(x,(m(x)+1)%E.length)},1e4);return()=>clearInterval(H)}),kn(()=>{var H;q&&(m(i).length+(((H=m(n))==null?void 0:H.length)??0),requestAnimationFrame(()=>{q&&(q.scrollTop=q.scrollHeight)}))});function Ce(H){const ee=[],ke=/```(\w*)\n([\s\S]*?)```/g;let Ue=0,z;for(;(z=ke.exec(H))!==null;)z.index>Ue&&ee.push({type:"text",text:H.slice(Ue,z.index)}),ee.push({type:"code",lang:z[1]||"text",text:z[2].trimEnd()}),Ue=z.index+z[0].length;return Ue<H.length&&ee.push({type:"text",text:H.slice(Ue)}),ee}function Pe(H){const ee=[],ke=/```(\w*)\n([\s\S]*?)```/g;let Ue=0,z;for(;(z=ke.exec(H))!==null;)z.index>Ue&&ee.push({type:"text",text:H.slice(Ue,z.index)}),ee.push({type:"code",lang:z[1]||"text",text:z[2].trimEnd()}),Ue=z.index+z[0].length;const $=H.slice(Ue),re=$.match(/```(\w*)\n([\s\S]*)$/);return re?(re.index>0&&ee.push({type:"text",text:$.slice(0,re.index)}),ee.push({type:"code",lang:re[1]||"text",text:re[2]})):$&&ee.push({type:"text",text:$}),ee}function je(H){const ee={};for(const ke of H)if(ke.type==="code"){if(ke.lang==="filter")ee.filter=ke.text.trim();else if(ve(ke.lang)){const Ue=ke.text.split(`
213
+ `)[0].trim();Ue==="// @view-map"?ee.map=ke.text.split(`
214
+ `).slice(1).join(`
215
+ `).trim():Ue==="// @view-reduce"&&(ee.reduce=ke.text.split(`
216
+ `).slice(1).join(`
217
+ `).trim())}}return ee}function qt(H){return H.filter!==void 0||H.map!==void 0||H.reduce!==void 0}function Ge(H){const ee=[];return H.filter!==void 0&&ee.push("filter"),H.map!==void 0&&ee.push("map"),H.reduce!==void 0&&ee.push("reduce"),`Apply ${ee.join(" + ")}`}const Xt=15;function pt(H){return H.split(`
218
+ `).length>Xt}function Kt(H){const ee=new Set(m(g));ee.has(H)?ee.delete(H):ee.add(H),I(g,ee,!0)}function ae(H,ee){if(ve(ee))try{return gv.highlight(H,{language:"javascript"}).value}catch{}return H.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Te(H){return ln.parse(H)}function ve(H){return!H||H==="js"||H==="javascript"}function lt(H){navigator.clipboard.writeText(H).catch(()=>{})}async function Qt(){if(I(f,!0),!(m(v)||m(_))){I(_,!0),I(y,"");try{I(v,await DN(m(u)||m(c).model),!0)}catch(H){I(y,H.message,!0)}I(_,!1)}}function It(H){return H>=1e9?`${(H/1e9).toFixed(1)} GB`:H>=1e6?`${(H/1e6).toFixed(0)} MB`:`${H} B`}async function Tt(){const H=m(s).trim();if(!(!H||m(r))){I(s,""),I(a,""),I(r,!0),I(i,[...m(i),{role:"user",content:H}],!0),S=new AbortController;try{await EN({messages:m(i),currentView:t(),context:m(he),modelOverride:m(u)||void 0},ee=>{I(n,(m(n)??"")+ee)},S.signal),I(i,[...m(i),{role:"assistant",content:m(n)??""}],!0)}catch(ee){if(ee.name==="AbortError"){const ke=m(n);ke!=null&&ke.trim()&&I(i,[...m(i),{role:"assistant",content:ke+`
219
+
220
+ *[stopped]*`}],!0)}else I(a,ee.message,!0)}finally{S=null,I(n,null),I(r,!1)}}}function Lt(){S==null||S.abort()}function gt(H){H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),Tt())}function Oi(){I(i,[],!0),I(a,"")}const Gt=["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 Ae(H){I(s,H,!0),Z==null||Z.focus()}var Be=HG(),Mt=Wt(Be),kt=k(Mt),pi=D(k(kt),2);{var Nt=H=>{var ee=sG(),ke=k(ee);{var Ue=$=>{var re=Ma();se(()=>oe(re,`${m(c).provider??""} · ${m(c).model??""}`)),N($,re)},z=$=>{var re=Ma("Not configured");N($,re)};J(ke,$=>{m(pe)?$(Ue):$(z,-1)})}se(()=>is(ee,"title",`Provider: ${m(c).provider??""}`)),N(H,ee)};J(pi,H=>{m(c)&&H(Nt)})}var mi=D(pi,2);{var Mi=H=>{var ee=oG();de("click",ee,Oi),N(H,ee)};J(mi,H=>{m(i).length>0&&H(Mi)})}var Ui=D(kt,2),Fi=k(Ui);{var yi=H=>{var ee=rG();N(H,ee)},cn=H=>{var ee=cG(),ke=k(ee),Ue=k(ke);{var z=xe=>{var _e=aG(),X=D(Wt(_e)),V=k(X);se(()=>oe(V,t().id)),N(xe,_e)},$=xe=>{var _e=Ma("No view selected. Ask a general sheDB view question.");N(xe,_e)};J(Ue,xe=>{t()?xe(z):xe($,-1)})}var re=D(ke,2);an(re,17,()=>Gt,ks,(xe,_e)=>{var X=lG(),V=k(X);se(()=>oe(V,m(_e))),de("click",X,()=>Ae(m(_e))),N(xe,X)}),N(H,ee)};J(Fi,H=>{m(pe)?m(i).length===0&&m(n)===null&&H(cn,1):H(yi)})}var Zi=D(Fi,2);an(Zi,17,()=>m(i),ks,(H,ee,ke)=>{var Ue=pG(),z=k(Ue);{var $=xe=>{var _e=dG(),X=k(_e);se(()=>oe(X,m(ee).content)),N(xe,_e)},re=xe=>{const _e=Vt(()=>Ce(m(ee).content)),X=Vt(()=>je(m(_e)));var V=fG(),ue=k(V);an(ue,17,()=>m(_e),ks,(Ze,bt,Dt)=>{var Ht=_s(),ct=Wt(Ht);{var me=De=>{var ze=iD();_l(ze,()=>Te(m(bt).text),!0),N(De,ze)},Ne=De=>{const ze=Vt(()=>`${ke}:${Dt}`),Ct=Vt(()=>pt(m(bt).text)),et=Vt(()=>m(g).has(m(ze))),tt=Vt(()=>m(bt).lang==="filter");var at=uG(),mt=k(at),ui=k(mt),ce=k(ui),He=D(ui,2),dt=k(He),At=D(mt,2);let ei;var ht=k(At),st=k(ht);_l(st,()=>ae(m(bt).text,m(bt).lang??""),!0);var Ye=D(ht,2);{var Ee=Ot=>{var Re=hG(),Fe=k(Re);se(()=>oe(Fe,m(et)?"▲ collapse":"▼ expand")),de("click",Re,()=>Kt(m(ze))),N(Ot,Re)};J(Ye,Ot=>{m(Ct)&&Ot(Ee)})}se(()=>{oe(ce,m(tt)?"filter":m(bt).lang),ei=ti(At,1,"code-body svelte-1twuiul",null,ei,{collapsed:m(Ct)&&!m(et)})}),de("click",dt,()=>lt(m(bt).text)),N(De,at)};J(ct,De=>{m(bt).type==="text"?De(me):De(Ne,-1)})}N(Ze,Ht)});var Le=D(ue,2);{var Me=Ze=>{var bt=gG(),Dt=k(bt),Ht=k(Dt);se(ct=>oe(Ht,ct),[()=>Ge(m(X))]),de("click",Dt,()=>e.onApplyView(m(X))),N(Ze,bt)},Oe=Vt(()=>qt(m(X))&&e.onApplyView);J(Le,Ze=>{m(Oe)&&Ze(Me)})}N(xe,V)};J(z,xe=>{m(ee).role==="user"?xe($):xe(re,-1)})}se(()=>ti(Ue,1,`message ${m(ee).role??""}`,"svelte-1twuiul")),N(H,Ue)});var rn=D(Zi,2);{var bn=H=>{var ee=mG(),ke=k(ee),Ue=k(ke),z=k(Ue);se(()=>oe(z,E[m(x)])),N(H,ee)};J(rn,H=>{m(r)&&m(n)===null&&H(bn)})}var _i=D(rn,2);{var _n=H=>{var ee=vG(),ke=k(ee);an(ke,21,()=>Pe(m(n)),ks,(Ue,z)=>{var $=_s(),re=Wt($);{var xe=X=>{var V=iD();_l(V,()=>Te(m(z).text),!0),N(X,V)},_e=X=>{var V=_G(),ue=k(V),Le=k(ue),Me=k(Le),Oe=D(ue,2),Ze=k(Oe);_l(Ze,()=>ae(m(z).text,m(z).lang??""),!0),se(()=>oe(Me,m(z).lang)),N(X,V)};J(re,X=>{m(z).type==="text"?X(xe):X(_e,-1)})}N(Ue,$)}),N(H,ee)};J(_i,H=>{m(n)!==null&&H(_n)})}bo(Ui,H=>q=H,()=>q);var ki=D(Ui,2);{var Ni=H=>{var ee=bG(),ke=k(ee);se(()=>oe(ke,m(a))),N(H,ee)};J(ki,H=>{m(a)&&H(Ni)})}var fn=D(ki,2),On=k(fn),Vn=k(On),Un=D(On,2),Jt=k(Un),be=D(Un,2),K=k(be),Ie=D(fn,2),nt=k(Ie);let Rt;var vt=k(nt);bo(vt,H=>Z=H,()=>Z);var rt=D(nt,2);{var ni=H=>{var ee=wG();de("click",ee,Lt),N(H,ee)},ri=H=>{var ee=yG();se(ke=>ee.disabled=ke,[()=>!m(s).trim()||!m(pe)]),de("click",ee,Tt),N(H,ee)};J(rt,H=>{m(r)?H(ni):H(ri,-1)})}var Xi=D(Ie,2);{var Hi=H=>{var ee=IG(),ke=k(ee),Ue=k(ke),z=D(ke,2);{var $=X=>{var V=CG();an(V,21,()=>m(h),ks,(ue,Le)=>{var Me=SG(),Oe=k(Me),Ze={};se(()=>{oe(Oe,m(Le)),Ze!==(Ze=m(Le))&&(Me.value=(Me.__value=m(Le))??"")}),N(ue,Me)}),se(()=>V.disabled=m(r)),vl(V,()=>m(u),ue=>I(u,ue)),N(X,V)},re=X=>{var V=xG(),ue=k(V);se(()=>oe(ue,m(u)||m(c).model)),N(X,V)};J(z,X=>{m(h).length>0?X($):X(re,-1)})}var xe=D(z,2);{var _e=X=>{var V=LG();de("click",V,Qt),N(X,V)};J(xe,X=>{m(c).provider==="ollama"&&X(_e)})}se(()=>oe(Ue,m(c).provider)),N(H,ee)};J(Xi,H=>{m(pe)&&m(c)&&H(Hi)})}var A=D(Mt,2);{var te=H=>{var ee=FG(),ke=k(ee),Ue=k(ke),z=k(Ue),$=k(z),re=D(z,2),xe=D(Ue,2),_e=k(xe);{var X=Le=>{var Me=kG();N(Le,Me)},V=Le=>{var Me=DG(),Oe=k(Me);se(()=>oe(Oe,m(y))),N(Le,Me)},ue=Le=>{var Me=OG(),Oe=k(Me);{var Ze=et=>{var tt=EG(),at=D(Wt(tt)),mt=k(at);se(()=>oe(mt,m(v).version)),N(et,tt)};J(Oe,et=>{m(v).version&&et(Ze)})}var bt=D(Oe,2);{var Dt=et=>{var tt=PG(),at=D(Wt(tt)),mt=k(at);se(()=>oe(mt,m(v).details.family)),N(et,tt)};J(bt,et=>{var tt;(tt=m(v).details)!=null&&tt.family&&et(Dt)})}var Ht=D(bt,2);{var ct=et=>{var tt=TG(),at=D(Wt(tt)),mt=k(at);se(()=>oe(mt,m(v).details.parameter_size)),N(et,tt)};J(Ht,et=>{var tt;(tt=m(v).details)!=null&&tt.parameter_size&&et(ct)})}var me=D(Ht,2);{var Ne=et=>{var tt=MG(),at=D(Wt(tt)),mt=k(at);se(()=>oe(mt,m(v).details.quantization_level)),N(et,tt)};J(me,et=>{var tt;(tt=m(v).details)!=null&&tt.quantization_level&&et(Ne)})}var De=D(me,2);{var ze=et=>{var tt=RG(),at=D(Wt(tt),2);an(at,21,()=>m(v).running,ks,(mt,ui)=>{var ce=NG(),He=k(ce);se(dt=>oe(He,`${m(ui).name??""} · ${dt??""} VRAM`),[()=>It(m(ui).size_vram)]),N(mt,ce)}),N(et,tt)},Ct=et=>{var tt=AG();N(et,tt)};J(De,et=>{m(v).running&&m(v).running.length>0?et(ze):m(v).running!==null&&et(Ct,1)})}N(Le,Me)};J(_e,Le=>{m(_)?Le(X):m(y)?Le(V,1):m(v)&&Le(ue,2)})}se(()=>{var Le;return oe($,`Ollama · ${(m(u)||((Le=m(c))==null?void 0:Le.model))??""}`)}),de("click",ee,()=>I(f,!1)),de("click",ke,Le=>Le.stopPropagation()),de("click",re,()=>I(f,!1)),N(H,ee)};J(A,H=>{m(f)&&H(te)})}se(()=>{Rt=ti(nt,1,"textarea-wrap svelte-1twuiul",null,Rt,{loading:m(r)}),is(vt,"placeholder",m(pe)?"Ask anything… (Enter to send, Shift+Enter for newline)":"AI not configured"),vt.disabled=m(r)||!m(pe)}),ms(Vn,()=>m(M),H=>I(M,H)),ms(Jt,()=>m(F),H=>I(F,H)),ms(K,()=>m(R),H=>I(R,H)),de("keydown",vt,gt),Bi(vt,()=>m(s),H=>I(s,H)),N(o,Be),lo()}Ko(["click","keydown"]);var BG=B('<div class="me svelte-1pxdb1"></div>');function uy(o,e){ao(e,!0);let t=xf(e,"value",15,""),i=xf(e,"language",3,"javascript"),n,s,r=!1;na(()=>{s=pa.create(n,{value:t(),language:i(),theme:"vs-dark",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}}),s.onDidChangeModelContent(()=>{r||t(s.getValue())})}),x1(()=>s==null?void 0:s.dispose()),kn(()=>{!s||s.getValue()===t()||(r=!0,s.setValue(t()),r=!1)});var a=BG();bo(a,c=>n=c,()=>n),N(o,a),lo()}const nD=o=>{var e=zG();N(o,e)};var sD=B('<ul class="tree-children svelte-rrt0o"><!></ul>'),oD=B('<li class="tree-dir svelte-rrt0o"><div class="dir-row svelte-rrt0o"><button class="chevron svelte-rrt0o"> </button> <span class="dir-name svelte-rrt0o"> </span></div> <!></li>'),rD=B('<li><button class="svelte-rrt0o"><span class="fname svelte-rrt0o"> </span></button></li>'),zG=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>'),aD=B('<div class="form-error svelte-rrt0o"> </div>'),VG=B('<div class="new-item-form svelte-rrt0o"><input placeholder="device/lamp1" class="svelte-rrt0o"/> <button class="svelte-rrt0o">Create</button></div> <!>',1),lD=B('<div class="error-bar svelte-rrt0o"> </div>'),cD=B('<div class="loading svelte-rrt0o">Loading…</div>'),UG=B('<div class="monaco-doc-wrap svelte-rrt0o"><!></div>'),jG=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),$G=B('<div class="panel svelte-rrt0o"><aside class="sidebar svelte-rrt0o"><div class="toolbar svelte-rrt0o"><button class="svelte-rrt0o">+ Doc</button></div> <!> <ul class="tree svelte-rrt0o"><!></ul></aside> <div class="resize-handle svelte-rrt0o" role="separator"></div> <main class="editor-area svelte-rrt0o"><!></main></div>'),qG=B('<div class="new-item-form svelte-rrt0o"><input placeholder="myView" class="svelte-rrt0o"/> <button class="svelte-rrt0o">Create</button></div> <!>',1),KG=B('<label class="opt-check svelte-rrt0o"><input type="checkbox" class="svelte-rrt0o"/> Retain <span class="section-hint svelte-rrt0o">— send as retained MQTT message</span></label>'),GG=B('<span class="badge-error svelte-rrt0o">error</span>'),ZG=B('<span class="badge-ok svelte-rrt0o"> </span>'),XG=B('<pre class="result-error svelte-rrt0o"> </pre>'),YG=B('<pre class="result-json svelte-rrt0o"> </pre>'),QG=B('<div class="view-result svelte-rrt0o"><div class="result-header svelte-rrt0o">Result <!></div> <!></div>'),JG=B('<div class="view-sections svelte-rrt0o"><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="devices/#"/></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(value)</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"/> Publish to MQTT <span class="section-hint svelte-rrt0o">— result published to <code> </code> topic under <code>/db/view/</code> on every update</span></label> <!></div> <!></div>'),eZ=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),tZ=B('<div class="chat-resize-handle svelte-rrt0o" role="separator"></div> <div class="chat-pane svelte-rrt0o"><!></div>',1),iZ=B('<div class="panel svelte-rrt0o"><aside class="sidebar svelte-rrt0o"><div class="toolbar svelte-rrt0o"><button class="svelte-rrt0o">+ View</button> <button title="AI assistant">AI</button></div> <!> <ul class="tree svelte-rrt0o"><!></ul></aside> <div class="resize-handle svelte-rrt0o" role="separator"></div> <main class="editor-area svelte-rrt0o"><!></main> <!></div>'),nZ=B('<div class="db-root svelte-rrt0o" role="presentation"><div class="panel-tabs svelte-rrt0o"><button>Documents</button> <button>Views</button></div> <!></div>');function sZ(o,e){ao(e,!0);const t=(be,K=pl,Ie=pl)=>{var nt=_s(),Rt=Wt(nt);an(Rt,17,K,vt=>vt.type==="leaf"?vt.id:vt.path,(vt,rt)=>{var ni=_s(),ri=Wt(ni);{var Xi=A=>{var te=oD(),H=k(te),ee=k(H),ke=k(ee),Ue=D(ee,2),z=k(Ue),$=D(H,2);{var re=xe=>{var _e=sD(),X=k(_e);t(X,()=>m(rt).children,()=>Ie()+1),N(xe,_e)};J($,xe=>{yi[m(rt).path]&&xe(re)})}se(()=>{hs(H,`--depth: ${Ie()??""}`),oe(ke,yi[m(rt).path]?"▾":"▸"),oe(z,m(rt).name)}),de("click",ee,()=>{yi[m(rt).path]=!yi[m(rt).path]}),N(A,te)},Hi=A=>{var te=rD();let H;var ee=k(te),ke=k(ee),Ue=k(ke);se(()=>{H=ti(te,1,"tree-file svelte-rrt0o",null,H,{"active-item":m(s)===m(rt).id}),hs(te,`--depth: ${Ie()??""}`),oe(Ue,m(rt).name)}),de("click",ee,()=>Be(m(rt).id)),N(A,te)};J(ri,A=>{m(rt).type==="folder"?A(Xi):A(Hi,-1)})}N(vt,ni)}),N(be,nt)},i=(be,K=pl,Ie=pl)=>{var nt=_s(),Rt=Wt(nt);an(Rt,17,K,vt=>vt.type==="leaf"?vt.id:vt.path,(vt,rt)=>{var ni=_s(),ri=Wt(ni);{var Xi=A=>{var te=oD(),H=k(te),ee=k(H),ke=k(ee),Ue=D(ee,2),z=k(Ue),$=D(H,2);{var re=xe=>{var _e=sD(),X=k(_e);i(X,()=>m(rt).children,()=>Ie()+1),N(xe,_e)};J($,xe=>{cn[m(rt).path]&&xe(re)})}se(()=>{hs(H,`--depth: ${Ie()??""}`),oe(ke,cn[m(rt).path]?"▾":"▸"),oe(z,m(rt).name)}),de("click",ee,()=>{cn[m(rt).path]=!cn[m(rt).path]}),N(A,te)},Hi=A=>{var te=rD();let H;var ee=k(te),ke=k(ee),Ue=k(ke);se(()=>{H=ti(te,1,"tree-file svelte-rrt0o",null,H,{"active-item":m(u)===m(rt).id}),hs(te,`--depth: ${Ie()??""}`),oe(Ue,m(rt).name)}),de("click",ee,()=>Nt(m(rt).id)),N(A,te)};J(ri,A=>{m(rt).type==="folder"?A(Xi):A(Hi,-1)})}N(vt,ni)}),N(be,nt)};let n=j(Li([])),s=j(null),r=j("{}"),a=j(!1),c=j(null),h=j(Li([])),u=j(null),g=j("#"),f=j("// emit(this.someProperty)"),v=j(""),_=j(!1),y=j(!1),S=j(null),x=j(!1),E=j(null),M=j("docs"),F=j(""),R=j(!1),Z=j(null),q=j(""),he=j(!1),pe=j(null);const Ce="she-db-sidebar-width";let Pe=j(Li(parseInt(localStorage.getItem(Ce)??"220",10))),je=!1,qt=0,Ge=0;const Xt="she-db-chat-width",pt="she-db-chat-open";let Kt=j(localStorage.getItem(pt)==="true"),ae=j(Li(parseInt(localStorage.getItem(Xt)??"320",10))),Te=!1,ve=0,lt=0;const Qt=Vt(()=>m(u)?{id:m(u),filter:m(g),map:m(f),reduce:m(v)}:null);function It(be){be.filter!==void 0&&I(g,be.filter,!0),be.map!==void 0&&I(f,be.map,!0),be.reduce!==void 0&&I(v,be.reduce,!0)}kn(()=>{localStorage.setItem(pt,String(m(Kt)))});function Tt(be){je=!0,qt=be.clientX,Ge=m(Pe),be.preventDefault()}function Lt(be){je&&I(Pe,Math.max(140,Math.min(500,Ge+be.clientX-qt)),!0),Te&&I(ae,Math.max(240,Math.min(600,lt-(be.clientX-ve))),!0)}function gt(){je&&(je=!1,localStorage.setItem(Ce,String(m(Pe)))),Te&&(Te=!1,localStorage.setItem(Xt,String(m(ae))))}function Oi(be){Te=!0,ve=be.clientX,lt=m(ae),be.preventDefault()}async function Gt(){try{I(n,await yN(),!0)}catch{}}async function Ae(){try{I(h,await SN(),!0)}catch{}}async function Be(be){I(s,be,!0),I(c,null),I(a,!0);try{const K=await x7(be);I(r,JSON.stringify(K,null,2),!0)}catch(K){I(c,K instanceof Error?K.message:String(K),!0)}finally{I(a,!1)}}async function Mt(){if(m(s)){I(c,null);try{const be=JSON.parse(m(r));await Wk(m(s),be)}catch(be){I(c,be instanceof Error?be.message:String(be),!0)}}}async function kt(){if(m(s)&&confirm(`Delete document "${m(s)}"?`))try{await L7(m(s)),I(s,null),I(r,"{}")}catch(be){I(c,be instanceof Error?be.message:String(be),!0)}}async function pi(){const be=m(F).trim();if(be){I(Z,null);try{await Wk(be,{}),I(R,!1),I(F,""),await Be(be)}catch(K){I(Z,K instanceof Error?K.message:String(K),!0)}}}async function Nt(be){I(u,be,!0),I(E,null),I(x,!0),I(S,null);try{const K=await I7(be);I(g,K.filter??"",!0),I(f,K.map,!0),I(v,K.reduce??"",!0),I(_,K.mqttpub??!1,!0),I(y,K.retain??!1,!0),I(S,await dy(be).catch(()=>null),!0)}catch(K){I(E,K instanceof Error?K.message:String(K),!0)}finally{I(x,!1)}}async function mi(){if(m(u)){I(E,null);try{const be={map:m(f)};m(g).trim()&&(be.filter=m(g).trim()),m(v).trim()&&(be.reduce=m(v).trim()),m(_)&&(be.mqttpub=!0),m(y)&&(be.retain=!0),await Bk(m(u),be)}catch(be){I(E,be instanceof Error?be.message:String(be),!0)}}}async function Mi(){if(m(u))try{I(S,await dy(m(u)),!0)}catch(be){I(E,be instanceof Error?be.message:String(be),!0)}}async function Ui(){if(m(u)&&confirm(`Delete view "${m(u)}"?`))try{await k7(m(u)),I(u,null),I(g,""),I(f,"// emit(this.someProperty)"),I(v,""),I(_,!1),I(y,!1),I(S,null)}catch(be){I(E,be instanceof Error?be.message:String(be),!0)}}async function Fi(){if(!m(q).trim())return;const be=m(q).trim();I(pe,null);try{await Bk(be,{map:"// emit(this.someProperty)"}),I(he,!1),I(q,""),await Nt(be)}catch(K){I(pe,K instanceof Error?K.message:String(K),!0)}}let yi=Li({}),cn=Li({});function Zi(be,K){const Ie=[],nt=new Map,Rt=[];for(const vt of be){const rt=K?vt.slice(K.length+1):vt,ni=rt.indexOf("/");if(ni===-1)Rt.push(vt);else{const ri=rt.slice(0,ni);nt.has(ri)||nt.set(ri,[]),nt.get(ri).push(vt)}}for(const[vt,rt]of nt){const ni=K?`${K}/${vt}`:vt;Ie.push({type:"folder",name:vt,path:ni,children:Zi(rt,ni)})}for(const vt of Rt)Ie.push({type:"leaf",name:K?vt.slice(K.length+1):vt,id:vt});return Ie}let rn=Vt(()=>Zi([...m(n)].sort(),"")),bn=Vt(()=>Zi([...m(h)].sort(),""));na(()=>{Gt(),Ae();const be=Vh("db:ids",Rt=>{I(n,Rt.ids??[],!0)}),K=Vh("db:viewIds",Rt=>{I(h,Rt.ids??[],!0)}),Ie=Vh("db:change",async Rt=>{const vt=Rt.id;m(s)===vt&&(Rt.doc===null?(I(s,null),I(r,"{}")):I(r,JSON.stringify(Rt.doc,null,2),!0))}),nt=Vh("db:viewUpdate",async Rt=>{const vt=Rt.id;m(u)===vt&&I(S,await dy(vt).catch(()=>null),!0)});return()=>{be(),K(),Ie(),nt()}});var _i=nZ(),_n=k(_i),ki=k(_n);let Ni;var fn=D(ki,2);let On;var Vn=D(_n,2);{var Un=be=>{var K=$G(),Ie=k(K);let nt;var Rt=k(Ie),vt=k(Rt),rt=D(Rt,2);{var ni=ke=>{var Ue=VG(),z=Wt(Ue),$=k(z),re=D($,2),xe=D(z,2);{var _e=X=>{var V=aD(),ue=k(V);se(()=>oe(ue,m(Z))),N(X,V)};J(xe,X=>{m(Z)&&X(_e)})}de("keydown",$,X=>X.key==="Enter"&&pi()),Bi($,()=>m(F),X=>I(F,X)),de("click",re,pi),N(ke,Ue)};J(rt,ke=>{m(R)&&ke(ni)})}var ri=D(rt,2),Xi=k(ri);t(Xi,()=>m(rn),()=>0);var Hi=D(Ie,2),A=D(Hi,2),te=k(A);{var H=ke=>{var Ue=jG(),z=Wt(Ue),$=k(z),re=k($),xe=D($,2),_e=D(xe,2),X=D(z,2);{var V=Oe=>{var Ze=lD(),bt=k(Ze);se(()=>oe(bt,m(c))),N(Oe,Ze)};J(X,Oe=>{m(c)&&Oe(V)})}var ue=D(X,2);{var Le=Oe=>{var Ze=cD();N(Oe,Ze)},Me=Oe=>{var Ze=UG(),bt=k(Ze);uy(bt,{language:"json",get value(){return m(r)},set value(Dt){I(r,Dt,!0)}}),N(Oe,Ze)};J(ue,Oe=>{m(a)?Oe(Le):Oe(Me,-1)})}se(()=>oe(re,m(s))),de("click",xe,Mt),de("click",_e,kt),N(ke,Ue)},ee=ke=>{nD(ke)};J(te,ke=>{m(s)?ke(H):ke(ee,-1)})}se(()=>nt=hs(Ie,"",nt,{width:`${m(Pe)??""}px`})),de("click",vt,()=>{I(R,!m(R)),I(Z,null)}),de("mousedown",Hi,Tt),N(be,K)},Jt=be=>{var K=iZ(),Ie=k(K);let nt;var Rt=k(Ie),vt=k(Rt),rt=D(vt,2);let ni;var ri=D(Rt,2);{var Xi=re=>{var xe=qG(),_e=Wt(xe),X=k(_e),V=D(X,2),ue=D(_e,2);{var Le=Me=>{var Oe=aD(),Ze=k(Oe);se(()=>oe(Ze,m(pe))),N(Me,Oe)};J(ue,Me=>{m(pe)&&Me(Le)})}de("keydown",X,Me=>Me.key==="Enter"&&Fi()),Bi(X,()=>m(q),Me=>I(q,Me)),de("click",V,Fi),N(re,xe)};J(ri,re=>{m(he)&&re(Xi)})}var Hi=D(ri,2),A=k(Hi);i(A,()=>m(bn),()=>0);var te=D(Ie,2),H=D(te,2),ee=k(H);{var ke=re=>{var xe=eZ(),_e=Wt(xe),X=k(_e),V=k(X),ue=D(X,2),Le=D(ue,2),Me=D(Le,2),Oe=D(_e,2);{var Ze=ct=>{var me=lD(),Ne=k(me);se(()=>oe(Ne,m(E))),N(ct,me)};J(Oe,ct=>{m(E)&&ct(Ze)})}var bt=D(Oe,2);{var Dt=ct=>{var me=cD();N(ct,me)},Ht=ct=>{var me=JG(),Ne=k(me),De=D(k(Ne),2),ze=k(De),Ct=D(Ne,2),et=D(k(Ct),2),tt=k(et);uy(tt,{language:"javascript",get value(){return m(f)},set value(Re){I(f,Re,!0)}});var at=D(Ct,2),mt=D(k(at),2),ui=k(mt);uy(ui,{language:"javascript",get value(){return m(v)},set value(Re){I(v,Re,!0)}});var ce=D(at,2),He=k(ce),dt=k(He),At=D(dt,2),ei=D(k(At)),ht=k(ei),st=D(He,2);{var Ye=Re=>{var Fe=KG(),zt=k(Fe);ms(zt,()=>m(y),Yi=>I(y,Yi)),N(Re,Fe)};J(st,Re=>{m(_)&&Re(Ye)})}var Ee=D(ce,2);{var Ot=Re=>{var Fe=QG(),zt=k(Fe),Yi=D(k(zt));{var Ln=Et=>{var Qi=GG();N(Et,Qi)},un=Et=>{var Qi=ZG(),Tn=k(Qi);se(()=>oe(Tn,`${m(S).length??0??""} items · rev ${m(S)._rev??""}`)),N(Et,Qi)};J(Yi,Et=>{m(S).error?Et(Ln):Et(un,-1)})}var Go=D(zt,2);{var cs=Et=>{var Qi=XG(),Tn=k(Qi);se(()=>oe(Tn,m(S).error)),N(Et,Qi)},ds=Et=>{var Qi=YG(),Tn=k(Qi);se(Ft=>oe(Tn,Ft),[()=>JSON.stringify(m(S).result,null,2)]),N(Et,Qi)};J(Go,Et=>{m(S).error?Et(cs):Et(ds,-1)})}N(Re,Fe)};J(Ee,Re=>{m(S)&&Re(Ot)})}se(()=>oe(ht,m(u))),Bi(ze,()=>m(g),Re=>I(g,Re)),ms(dt,()=>m(_),Re=>I(_,Re)),N(ct,me)};J(bt,ct=>{m(x)?ct(Dt):ct(Ht,-1)})}se(()=>oe(V,m(u))),de("click",ue,mi),de("click",Le,Mi),de("click",Me,Ui),N(re,xe)},Ue=re=>{nD(re)};J(ee,re=>{m(u)?re(ke):re(Ue,-1)})}var z=D(H,2);{var $=re=>{var xe=tZ(),_e=Wt(xe),X=D(_e,2);let V;var ue=k(X);WG(ue,{get currentView(){return m(Qt)},onApplyView:It}),se(()=>V=hs(X,"",V,{width:`${m(ae)??""}px`})),de("mousedown",_e,Oi),N(re,xe)};J(z,re=>{m(Kt)&&re($)})}se(()=>{nt=hs(Ie,"",nt,{width:`${m(Pe)??""}px`}),ni=ti(rt,1,"chat-toggle svelte-rrt0o",null,ni,{active:m(Kt)})}),de("click",vt,()=>{I(he,!m(he)),I(pe,null)}),de("click",rt,()=>I(Kt,!m(Kt))),de("mousedown",te,Tt),N(be,K)};J(Vn,be=>{m(M)==="docs"?be(Un):be(Jt,-1)})}se(()=>{Ni=ti(ki,1,"svelte-rrt0o",null,Ni,{active:m(M)==="docs"}),On=ti(fn,1,"svelte-rrt0o",null,On,{active:m(M)==="views"})}),de("mousemove",_i,Lt),de("mouseup",_i,gt),_o("mouseleave",_i,gt),de("click",ki,()=>I(M,"docs")),de("click",fn,()=>I(M,"views")),N(o,_i),lo()}Ko(["click","mousemove","mouseup","keydown","mousedown"]);var oZ=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),rZ=B('<label class="svelte-1ua3isv">Pairing Code / QR <input type="text" placeholder="MT:..." class="svelte-1ua3isv"/></label>'),dD=B('<p class="err svelte-1ua3isv"> </p>'),aZ=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>'),lZ=B('<span class="device-name svelte-1ua3isv"> </span> <span class="device-nodeid svelte-1ua3isv"> </span>',1),cZ=B('<span class="device-name svelte-1ua3isv"> </span>'),dZ=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>'),hZ=B('<li class="empty svelte-1ua3isv">No paired devices</li>'),uZ=B('<p class="info svelte-1ua3isv">Loading…</p>'),gZ=B('<p class="device-subtitle svelte-1ua3isv"> </p>'),fZ=B('<li class="svelte-1ua3isv"> </li>'),pZ=B('<details open="" class="svelte-1ua3isv"><summary class="svelte-1ua3isv"> <span class="ep-id svelte-1ua3isv"> </span></summary> <ul class="cluster-list svelte-1ua3isv"></ul></details>'),mZ=B('<div class="detail-hdr svelte-1ua3isv"><h2 class="svelte-1ua3isv"> </h2> <!> <p class="detail-nodeid svelte-1ua3isv"> </p></div> <!>',1),_Z=B('<p class="info svelte-1ua3isv">Select a device to view its endpoints.</p>'),vZ=B('<div class="matter-page 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>');function bZ(o,e){ao(e,!0);let t=j(Li([])),i=j(null),n=j(!1),s=j(null),r=j(!1),a=j("passcode"),c=j(""),h=j(""),u=j(""),g=j(!1),f=j(null),v=j("");async function _(){try{I(t,await CN(),!0)}catch{I(t,[],!0)}}async function y(ae){I(n,!0),I(s,null);try{I(i,await xN(ae),!0)}catch(Te){I(s,Te instanceof Error?Te.message:String(Te),!0)}finally{I(n,!1)}}async function S(ae){var Te;if(confirm(`Unpair device ${ae}?`))try{await R7(ae),((Te=m(i))==null?void 0:Te.nodeId)===ae&&I(i,null),await _()}catch(ve){I(s,ve instanceof Error?ve.message:String(ve),!0)}}async function x(){I(g,!0),I(f,null);try{let ae;m(a)==="passcode"?(ae={passcode:Number(m(c))},m(h)&&(ae={...ae,discriminator:Number(m(h))})):ae={pairingCode:m(u).trim()},m(v).trim()&&(ae={...ae,discoveryAddress:m(v).trim()}),await N7(ae),I(r,!1),I(c,""),I(h,""),I(u,""),I(v,""),await _()}catch(ae){I(f,ae instanceof Error?ae.message:String(ae),!0)}finally{I(g,!1)}}na(()=>(_(),Vh(Te=>{Te.type==="matter:deviceList"&&Array.isArray(Te.devices)?I(t,Te.devices,!0):Te.type==="matter:deviceStatus"&&Te.nodeId!==void 0&&I(t,m(t).map(ve=>ve.nodeId===Te.nodeId?{...ve,online:Te.online??!1}:ve),!0)})));var E=vZ(),M=k(E),F=k(M),R=D(k(F),2),Z=D(F,2);{var q=ae=>{var Te=aZ(),ve=k(Te),lt=k(ve);let Qt;var It=D(lt,2);let Tt;var Lt=D(ve,2);{var gt=Nt=>{var mi=oZ(),Mi=Wt(mi),Ui=D(k(Mi)),Fi=D(Mi,2),yi=D(k(Fi));Bi(Ui,()=>m(c),cn=>I(c,cn)),Bi(yi,()=>m(h),cn=>I(h,cn)),N(Nt,mi)},Oi=Nt=>{var mi=rZ(),Mi=D(k(mi));Bi(Mi,()=>m(u),Ui=>I(u,Ui)),N(Nt,mi)};J(Lt,Nt=>{m(a)==="passcode"?Nt(gt):Nt(Oi,-1)})}var Gt=D(Lt,2),Ae=D(k(Gt)),Be=D(Gt,2);{var Mt=Nt=>{var mi=dD(),Mi=k(mi);se(()=>oe(Mi,m(f))),N(Nt,mi)};J(Be,Nt=>{m(f)&&Nt(Mt)})}var kt=D(Be,2),pi=k(kt);se(()=>{Qt=ti(lt,1,"svelte-1ua3isv",null,Qt,{active:m(a)==="passcode"}),Tt=ti(It,1,"svelte-1ua3isv",null,Tt,{active:m(a)==="pairingCode"}),kt.disabled=m(g),oe(pi,m(g)?"Commissioning…":"Commission")}),de("click",lt,()=>I(a,"passcode")),de("click",It,()=>I(a,"pairingCode")),Bi(Ae,()=>m(v),Nt=>I(v,Nt)),de("click",kt,x),N(ae,Te)};J(Z,ae=>{m(r)&&ae(q)})}var he=D(Z,2),pe=k(he);an(pe,17,()=>m(t),ae=>ae.nodeId,(ae,Te)=>{var ve=dZ();let lt;var Qt=k(ve),It=k(Qt);let Tt;var Lt=D(It,2),gt=k(Lt);{var Oi=Be=>{var Mt=lZ(),kt=Wt(Mt),pi=k(kt),Nt=D(kt,2),mi=k(Nt);se(()=>{oe(pi,m(Te).name),oe(mi,`#${m(Te).nodeId??""}`)}),N(Be,Mt)},Gt=Be=>{var Mt=cZ(),kt=k(Mt);se(()=>oe(kt,`Node ${m(Te).nodeId??""}`)),N(Be,Mt)};J(gt,Be=>{m(Te).name?Be(Oi):Be(Gt,-1)})}var Ae=D(Qt,2);se(()=>{var Be;lt=ti(ve,1,"svelte-1ua3isv",null,lt,{selected:((Be=m(i))==null?void 0:Be.nodeId)===m(Te).nodeId}),Tt=ti(It,1,"status-dot svelte-1ua3isv",null,Tt,{online:m(Te).online})}),de("click",Qt,()=>y(m(Te).nodeId)),de("click",Ae,()=>S(m(Te).nodeId)),N(ae,ve)});var Ce=D(pe,2);{var Pe=ae=>{var Te=hZ();N(ae,Te)};J(Ce,ae=>{m(t).length===0&&ae(Pe)})}var je=D(M,2),qt=k(je);{var Ge=ae=>{var Te=uZ();N(ae,Te)},Xt=ae=>{var Te=dD(),ve=k(Te);se(()=>oe(ve,m(s))),N(ae,Te)},pt=ae=>{var Te=mZ(),ve=Wt(Te),lt=k(ve),Qt=k(lt),It=D(lt,2);{var Tt=Gt=>{var Ae=gZ(),Be=k(Ae);se(()=>oe(Be,m(i).subtitle)),N(Gt,Ae)};J(It,Gt=>{m(i).subtitle&&Gt(Tt)})}var Lt=D(It,2),gt=k(Lt),Oi=D(ve,2);an(Oi,17,()=>m(i).endpoints,Gt=>Gt.endpointId,(Gt,Ae)=>{var Be=pZ(),Mt=k(Be),kt=k(Mt),pi=D(kt),Nt=k(pi),mi=D(Mt,2);an(mi,21,()=>m(Ae).clusters,ks,(Mi,Ui)=>{var Fi=fZ(),yi=k(Fi);se(()=>oe(yi,m(Ui))),N(Mi,Fi)}),se(()=>{oe(kt,`${m(Ae).name??`Endpoint ${m(Ae).endpointId}`??""} `),oe(Nt,`ep${m(Ae).endpointId??""}`)}),N(Gt,Be)}),se(()=>{oe(Qt,m(i).name??`Node ${m(i).nodeId}`),oe(gt,`Node ID: ${m(i).nodeId??""}`)}),N(ae,Te)},Kt=ae=>{var Te=_Z();N(ae,Te)};J(qt,ae=>{m(n)?ae(Ge):m(s)?ae(Xt,1):m(i)?ae(pt,2):ae(Kt,-1)})}de("click",R,()=>I(r,!m(r))),N(o,E),lo()}Ko(["click"]);var wZ=B("<button>›</button>"),yZ=B('<span class="chev-ph svelte-1vejtrc"></span>'),SZ=B('<span class="tv svelte-1vejtrc"> </span> <span class="tt svelte-1vejtrc"> </span>',1),CZ=B('<div class="tc svelte-1vejtrc"></div>'),xZ=B('<div class="tn svelte-1vejtrc"><div class="tr svelte-1vejtrc"><!> <span class="seg svelte-1vejtrc"> </span> <!></div> <!></div>'),LZ=B('<span class="pub-ok svelte-1vejtrc">✓</span>'),IZ=B('<span class="pub-err svelte-1vejtrc"> </span>'),kZ=B('<div class="info svelte-1vejtrc">Loading…</div>'),DZ=B('<div class="info err svelte-1vejtrc"> </div>'),EZ=B('<div class="info svelte-1vejtrc">No topics match.</div>'),PZ=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>'),TZ=B('<div class="vs svelte-1vejtrc"><div><div class="vrows-abs svelte-1vejtrc"></div></div></div>'),MZ=B('<div class="info svelte-1vejtrc">No topics yet.</div>'),NZ=B('<div class="tree-wrap svelte-1vejtrc"><!></div>'),RZ=B('<span class="stream-badge"> </span>'),AZ=B('<span class="stream-empty svelte-1vejtrc">Waiting for messages…</span>'),OZ=B('<div class="sr svelte-1vejtrc"><span class="s-ts svelte-1vejtrc"> </span> <span class="s-topic svelte-1vejtrc"> </span> <span class="s-val svelte-1vejtrc"> </span></div>'),FZ=B('<div class="stream-body svelte-1vejtrc"><!></div>'),HZ=B('<div class="page svelte-1vejtrc"><div class="toolbar svelte-1vejtrc"><h2 class="svelte-1vejtrc">MQTT</h2> <input class="filter-in svelte-1vejtrc" type="search" placeholder="Filter topics…"/> <span class="count svelte-1vejtrc"><!> </span></div> <div class="pub-bar svelte-1vejtrc"><input class="pt svelte-1vejtrc" type="text" placeholder="topic"/> <input class="pp svelte-1vejtrc" type="text" placeholder="payload"/> <label class="rl svelte-1vejtrc"><input type="checkbox"/> 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="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 WZ(o,e){ao(e,!0);const t=(z,$=pl)=>{const re=Vt(()=>$().path.split("/").length-1),xe=Vt(()=>m(u).has($().path)),_e=Vt(()=>m(r)>=0&&$().children.size>0);var X=xZ(),V=k(X),ue=k(V);{var Le=Ne=>{var De=wZ();let ze;se(()=>{ze=ti(De,1,"chev svelte-1vejtrc",null,ze,{open:m(xe)}),is(De,"aria-label",m(xe)?"Collapse":"Expand")}),de("click",De,()=>g($().path)),N(Ne,De)},Me=Ne=>{var De=yZ();N(Ne,De)};J(ue,Ne=>{m(_e)?Ne(Le):Ne(Me,-1)})}var Oe=D(ue,2),Ze=k(Oe),bt=D(Oe,2);{var Dt=Ne=>{var De=SZ(),ze=Wt(De),Ct=k(ze),et=D(ze,2),tt=k(et);se((at,mt,ui)=>{is(ze,"title",at),oe(Ct,mt),oe(tt,ui)},[()=>{var at;return Gt((at=Mt($().path))==null?void 0:at.val)},()=>{var at;return Gt((at=Mt($().path))==null?void 0:at.val)},()=>{var at;return((at=Mt($().path))==null?void 0:at.ts)!=null?Ae(Mt($().path).ts):""}]),N(Ne,De)},Ht=Vt(()=>$().isLeaf&&i.has($().path));J(bt,Ne=>{m(Ht)&&Ne(Dt)})}var ct=D(V,2);{var me=Ne=>{var De=CZ();an(De,21,()=>[...$().children.values()].sort((ze,Ct)=>ze.seg.localeCompare(Ct.seg)),ze=>ze.path,(ze,Ct)=>{t(ze,()=>m(Ct))}),N(Ne,De)};J(ct,Ne=>{m(_e)&&m(xe)&&Ne(me)})}se(()=>{hs(X,`--d: ${m(re)??""}`),oe(Ze,$().seg)}),de("click",V,()=>{I(Pe,$().path+"/#")}),N(z,X)},i=new Map,n=new Set;let s=null,r=j(0);function a(){s===null&&(s=requestAnimationFrame(()=>{s=null;for(const z of n)h(z);n.clear(),UL(r)}))}const c=new Map;function h(z){const $=z.split("/");let re=c,xe="";for(let _e=0;_e<$.length;_e++){const X=$[_e];xe=_e===0?X:`${xe}/${X}`,re.has(X)||re.set(X,{seg:X,path:xe,children:new Map,isLeaf:!1});const V=re.get(X);_e===$.length-1&&(V.isLeaf=!0),re=V.children}}let u=j(Li(new Set));function g(z){const $=new Set(m(u));$.has(z)?$.delete(z):$.add(z),I(u,$,!0)}let f=j("");const v=24,_=5;let y=j(0),S=j(300),x=Vt(()=>{if(m(r),!m(f))return[];const z=m(f).toLowerCase().split(/\s+/).filter(Boolean),$=[];for(const[re,xe]of i){const _e=re.toLowerCase();z.every(X=>_e.includes(X))&&$.push({topic:re,...xe})}return $.sort((re,xe)=>re.topic.localeCompare(xe.topic))}),E=Vt(()=>{const z=m(x).length,$=Math.max(0,Math.floor(m(y)/v)-_),re=Math.min(z,Math.ceil((m(y)+m(S))/v)+_);return{start:$,end:re,totalH:z*v,top:$*v}});const M=1e3,F=200,R=20,Z=36;let q=0,he=j(Li([])),pe=j(Li([])),Ce=j(!0),Pe=j("#"),je=j(200);kn(()=>{const z=m(Pe).trim(),$=Xa(()=>m(he));I(pe,!z||z==="#"?$.slice(0,F):$.filter(re=>qt(z,re.topic)).slice(0,F),!0)});function qt(z,$){if(z==="#")return!0;const re=z.split("/"),xe=$.split("/");for(let _e=0;_e<re.length;_e++){if(re[_e]==="#")return!0;if(_e>=xe.length||re[_e]!=="+"&&re[_e]!==xe[_e])return!1}return re.length===xe.length}function Ge(z){z.preventDefault();const $=z.clientY,re=m(je);function xe(X){I(je,Math.max(60,Math.min(800,re+$-X.clientY)),!0)}function _e(){document.removeEventListener("mousemove",xe),document.removeEventListener("mouseup",_e)}document.addEventListener("mousemove",xe),document.addEventListener("mouseup",_e)}let Xt=Vt(()=>{const z=Math.max(1,Math.floor((m(je)-Z)/R)+1);return m(pe).slice(0,z)}),pt=j(!0),Kt=j(null);async function ae(){I(pt,!0),I(Kt,null);try{const z=await LN();for(const $ of z)i.set($.topic,{val:$.val,ts:$.ts}),h($.topic)}catch(z){I(Kt,z instanceof Error?z.message:String(z),!0)}finally{I(pt,!1),UL(r)}}const Te=Vh("mqtt",z=>{const{topic:$,val:re,ts:xe}=z;i.set($,{val:re,ts:xe}),n.add($),a();const _e={id:q++,topic:$,val:re,ts:xe};I(he,[_e,...m(he).slice(0,M-1)],!0);const X=m(Pe).trim();(!X||X==="#"||qt(X,$))&&I(pe,[_e,...m(pe).slice(0,F-1)],!0)});let ve=j(""),lt=j(""),Qt=j(!1),It=j(0),Tt=j(!1),Lt=j(null),gt=j(!1);async function Oi(){if(m(ve)){I(Tt,!0),I(Lt,null),I(gt,!1);try{await A7(m(ve),m(lt),m(Qt),m(It)),I(gt,!0),setTimeout(()=>{I(gt,!1)},2e3)}catch(z){I(Lt,z instanceof Error?z.message:String(z),!0)}finally{I(Tt,!1)}}}function Gt(z){return z==null?"":typeof z=="object"?JSON.stringify(z):String(z)}function Ae(z){return new Date(z).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Be(z){return new Date(z).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Mt(z){return m(r),i.get(z)}let kt=Vt(()=>(m(r),[...c.values()].sort((z,$)=>z.seg.localeCompare($.seg)))),pi=Vt(()=>(m(r),i.size));na(ae),x1(()=>{Te(),s!==null&&cancelAnimationFrame(s)});var Nt=HZ(),mi=k(Nt),Mi=D(k(mi),2),Ui=D(Mi,2),Fi=k(Ui);{var yi=z=>{var $=Ma();se(()=>oe($,`${m(x).length??""} /`)),N(z,$)};J(Fi,z=>{m(f)&&z(yi)})}var cn=D(Fi),Zi=D(mi,2),rn=k(Zi),bn=D(rn,2),_i=D(bn,2),_n=k(_i),ki=D(_i,2),Ni=k(ki);Ni.value=Ni.__value=0;var fn=D(Ni);fn.value=fn.__value=1;var On=D(fn);On.value=On.__value=2;var Vn=D(ki,2),Un=D(Vn,2);{var Jt=z=>{var $=LZ();N(z,$)};J(Un,z=>{m(gt)&&z(Jt)})}var be=D(Un,2);{var K=z=>{var $=IZ(),re=k($);se(()=>oe(re,m(Lt))),N(z,$)};J(be,z=>{m(Lt)&&z(K)})}var Ie=D(Zi,2);{var nt=z=>{var $=kZ();N(z,$)},Rt=z=>{var $=DZ(),re=k($);se(()=>oe(re,m(Kt))),N(z,$)},vt=z=>{var $=_s(),re=Wt($);{var xe=X=>{var V=EZ();N(X,V)},_e=X=>{var V=TZ(),ue=k(V),Le=k(ue);an(Le,21,()=>m(x).slice(m(E).start,m(E).end),Me=>Me.topic,(Me,Oe)=>{var Ze=PZ(),bt=k(Ze),Dt=k(bt),Ht=D(bt,2),ct=k(Ht),me=D(Ht,2),Ne=k(me);se((De,ze,Ct)=>{oe(Dt,m(Oe).topic),is(Ht,"title",De),oe(ct,ze),oe(Ne,Ct)},[()=>Gt(m(Oe).val),()=>Gt(m(Oe).val),()=>Ae(m(Oe).ts)]),N(Me,Ze)}),se(()=>{hs(ue,`height: ${m(E).totalH??""}px; position: relative;`),hs(Le,`top: ${m(E).top??""}px;`)}),_o("scroll",V,Me=>{I(y,Me.currentTarget.scrollTop,!0)}),JH(V,"clientHeight",Me=>I(S,Me)),N(X,V)};J(re,X=>{m(x).length===0?X(xe):X(_e,-1)})}N(z,$)},rt=z=>{var $=NZ(),re=k($);{var xe=X=>{var V=MZ();N(X,V)},_e=X=>{var V=_s(),ue=Wt(V);an(ue,17,()=>m(kt),Le=>Le.path,(Le,Me)=>{t(Le,()=>m(Me))}),N(X,V)};J(re,X=>{m(kt).length===0?X(xe):X(_e,-1)})}N(z,$)};J(Ie,z=>{m(pt)?z(nt):m(Kt)?z(Rt,1):m(f)?z(vt,2):z(rt,-1)})}var ni=D(Ie,2),ri=k(ni),Xi=D(ri,2),Hi=k(Xi),A=D(Hi,2);{var te=z=>{var $=RZ(),re=k($);se(()=>oe(re,m(pe).length)),N(z,$)};J(A,z=>{!m(Ce)&&m(pe).length>0&&z(te)})}var H=D(A,2),ee=k(H),ke=D(Xi,2);{var Ue=z=>{var $=FZ(),re=k($);{var xe=X=>{var V=AZ();N(X,V)},_e=X=>{var V=_s(),ue=Wt(V);an(ue,17,()=>m(Xt),Le=>Le.id,(Le,Me)=>{var Oe=OZ(),Ze=k(Oe),bt=k(Ze),Dt=D(Ze,2),Ht=k(Dt),ct=D(Dt,2),me=k(ct);se((Ne,De,ze)=>{oe(bt,Ne),oe(Ht,m(Me).topic),is(ct,"title",De),oe(me,ze)},[()=>Be(m(Me).ts),()=>Gt(m(Me).val),()=>Gt(m(Me).val)]),N(Le,Oe)}),N(X,V)};J(re,X=>{m(Xt).length===0?X(xe):X(_e,-1)})}N(z,$)};J(ke,z=>{m(Ce)&&z(Ue)})}se(()=>{oe(cn,` ${m(pi)??""}`),Vn.disabled=m(Tt)||!m(ve),hs(ni,m(Ce)?`height: ${m(je)}px;`:""),oe(ee,m(Ce)?"▾":"▸")}),Bi(Mi,()=>m(f),z=>I(f,z)),Bi(rn,()=>m(ve),z=>I(ve,z)),Bi(bn,()=>m(lt),z=>I(lt,z)),ms(_n,()=>m(Qt),z=>I(Qt,z)),vl(ki,()=>m(It),z=>I(It,z)),de("click",Vn,Oi),de("mousedown",ri,Ge),Bi(Hi,()=>m(Pe),z=>I(Pe,z)),de("click",H,()=>{I(Ce,!m(Ce))}),N(o,Nt),lo()}Ko(["click","mousedown"]);var BZ=B('<div class="restart-banner svelte-twakcj">⚠ Package changes require a daemon restart to take effect. Use the ↺ button in the topbar.</div>'),zZ=B('<div class="err svelte-twakcj"> </div>'),VZ=B('<p class="empty svelte-twakcj">No packages installed.</p>'),UZ=B('<p class="empty svelte-twakcj">No match.</p>'),jZ=MP('<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>'),$Z=MP('<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.65 2.35A8 8 0 1 0 15 8"></path><polyline points="15,2 15,8 9,8"></polyline></svg>'),qZ=B('<div><div class="dep-info svelte-twakcj"><span class="dep-name svelte-twakcj"> </span> <span class="dep-ver svelte-twakcj"> </span></div> <div class="dep-btns svelte-twakcj"><button class="icon-btn svelte-twakcj" title="Update to latest"><!></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>'),KZ=B('<span class="result-desc svelte-twakcj"> </span>'),GZ=B('<div class="result-row svelte-twakcj"><div class="result-info svelte-twakcj"><span class="result-name svelte-twakcj"> </span> <span class="result-ver svelte-twakcj"> </span> <!></div> <button class="install-btn svelte-twakcj"> </button></div>'),ZZ=B('<div class="results-list svelte-twakcj"></div>'),XZ=B('<pre class="npm-output svelte-twakcj"> </pre>'),YZ=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>`),QZ=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></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>');function JZ(o,e){ao(e,!0);let t=j(Li([])),i=j(""),n=j(""),s=j(Li([])),r=j(!1),a=j(!1),c=j(""),h=j(""),u=Li({});const g=Vt(()=>m(i).trim()?m(t).filter(Ae=>Ae.name.toLowerCase().includes(m(i).toLowerCase())):m(t));na(async()=>{await f()});async function f(){try{I(t,await D7(),!0),I(c,"")}catch(Ae){I(c,Ae.message,!0)}}async function v(){const Ae=m(n).trim();if(!Ae){I(s,[],!0);return}I(a,!0),I(c,"");try{I(s,await E7(Ae),!0)}catch(Be){I(c,Be.message,!0)}finally{I(a,!1)}}async function _(Ae,Be){u[Ae]=!0,I(c,""),I(h,"");try{const Mt=await P7(Ae,Be);I(h,Mt.stdout||Mt.stderr||"Done.",!0),I(r,!0),await f()}catch(Mt){I(c,Mt.message,!0)}finally{u[Ae]=!1}}async function y(Ae){u[Ae]=!0,I(c,""),I(h,"");try{const Be=await T7(Ae);I(h,Be.stdout||Be.stderr||"Done.",!0),I(r,!0),await f()}catch(Be){I(c,Be.message,!0)}finally{u[Ae]=!1}}async function S(Ae){u[Ae]=!0,I(c,""),I(h,"");try{const Be=await M7(Ae);I(h,Be.stdout||Be.stderr||"Done.",!0),I(r,!0),await f()}catch(Be){I(c,Be.message,!0)}finally{u[Ae]=!1}}var x=QZ(),E=k(x);{var M=Ae=>{var Be=BZ();N(Ae,Be)};J(E,Ae=>{m(r)&&Ae(M)})}var F=D(E,2);{var R=Ae=>{var Be=zZ(),Mt=k(Be);se(()=>oe(Mt,m(c))),N(Ae,Be)};J(F,Ae=>{m(c)&&Ae(R)})}var Z=D(F,2),q=k(Z),he=k(q),pe=D(k(he),2),Ce=k(pe),Pe=D(he,2),je=k(Pe),qt=D(Pe,2),Ge=k(qt);{var Xt=Ae=>{var Be=VZ();N(Ae,Be)},pt=Ae=>{var Be=UZ();N(Ae,Be)},Kt=Ae=>{var Be=_s(),Mt=Wt(Be);an(Mt,17,()=>m(g),kt=>kt.name,(kt,pi)=>{var Nt=qZ();let mi;var Mi=k(Nt),Ui=k(Mi),Fi=k(Ui),yi=D(Ui,2),cn=k(yi),Zi=D(Mi,2),rn=k(Zi),bn=k(rn);{var _i=Ni=>{var fn=jZ();N(Ni,fn)},_n=Ni=>{var fn=$Z();N(Ni,fn)};J(bn,Ni=>{u[m(pi).name]?Ni(_i):Ni(_n,-1)})}var ki=D(rn,2);se(()=>{mi=ti(Nt,1,"dep-row svelte-twakcj",null,mi,{"dep-busy":!!u[m(pi).name]}),oe(Fi,m(pi).name),oe(cn,m(pi).version),rn.disabled=!!u[m(pi).name],ki.disabled=!!u[m(pi).name]}),de("click",rn,()=>S(m(pi).name)),de("click",ki,()=>y(m(pi).name)),N(kt,Nt)}),N(Ae,Be)};J(Ge,Ae=>{m(t).length===0?Ae(Xt):m(g).length===0?Ae(pt,1):Ae(Kt,-1)})}var ae=D(q,2),Te=D(k(ae),2),ve=k(Te),lt=D(ve,2),Qt=k(lt),It=D(Te,2);{var Tt=Ae=>{var Be=ZZ();an(Be,21,()=>m(s),Mt=>Mt.name,(Mt,kt)=>{var pi=GZ(),Nt=k(pi),mi=k(Nt),Mi=k(mi),Ui=D(mi,2),Fi=k(Ui),yi=D(Ui,2);{var cn=bn=>{var _i=KZ(),_n=k(_i);se(()=>oe(_n,m(kt).description)),N(bn,_i)};J(yi,bn=>{m(kt).description&&bn(cn)})}var Zi=D(Nt,2),rn=k(Zi);se(()=>{oe(Mi,m(kt).name),oe(Fi,m(kt).version),Zi.disabled=!!u[m(kt).name],oe(rn,u[m(kt).name]?"Installing…":"Install")}),de("click",Zi,()=>_(m(kt).name)),N(Mt,pi)}),N(Ae,Be)};J(It,Ae=>{m(s).length>0&&Ae(Tt)})}var Lt=D(It,2);{var gt=Ae=>{var Be=XZ(),Mt=k(Be);se(()=>oe(Mt,m(h))),N(Ae,Be)};J(Lt,Ae=>{m(h)&&Ae(gt)})}var Oi=D(Lt,2);{var Gt=Ae=>{var Be=YZ();N(Ae,Be)};J(Oi,Ae=>{!m(s).length&&!m(h)&&Ae(Gt)})}se(()=>{oe(Ce,m(t).length),lt.disabled=m(a),oe(Qt,m(a)?"Searching…":"Search")}),Bi(je,()=>m(i),Ae=>I(i,Ae)),de("keydown",ve,Ae=>Ae.key==="Enter"&&v()),Bi(ve,()=>m(n),Ae=>I(n,Ae)),de("click",lt,v),N(o,x),lo()}Ko(["click","keydown"]);var e9=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),t9=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> <!></dl>'),i9=B('<span class="stats-empty svelte-1n46o8q">Loading…</span>'),n9=B('<div class="stats-popup svelte-1n46o8q"><!> <div class="stats-actions svelte-1n46o8q"><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"><path d="M18.36 6.64a9 9 0 1 1-12.73 0"></path><line x1="12" y1="2" x2="12" y2="12"></line></svg> Restart daemon</button></div></div>'),s9=B('<a class="update-badge svelte-1n46o8q" href="https://www.npmjs.com/package/smart-home-engine" target="_blank" rel="noopener"> </a>'),o9=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"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path><polyline points="16 17 21 12 16 7"></polyline><line x1="21" y1="12" x2="9" y2="12"></line></svg></button>'),r9=B('<div class="login-error svelte-1n46o8q"> </div>'),a9=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>'),l9=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"><polyline points="5,3 1,8 5,13"></polyline><polyline points="11,3 15,8 11,13"></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"><rect x="0.75" y="0.75" width="14.5" height="14.5" rx="1"></rect><path d="M2,11 V5 H5 V11"></path><path d="M6,12 V5 H9 V8 H6"></path><path d="M10,11 V5 H15 V11"></path><line x1="12.5" y1="5" x2="12.5" y2="11"></line></svg> Packages</button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" stroke="none" style="vertical-align: middle"><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"></path></svg> MQTT</button> <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"><path d="M8,2 L8,7"></path><path d="M6,5 L8,7.5 L10,5"></path><path d="M2.5,14 L6,10"></path><path d="M6.2,12.8 L6,10 L3.2,10.2"></path><path d="M13.5,14 L10,10"></path><path d="M9.8,12.8 L10,10 L12.8,10.2"></path></svg> Matter</button> <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"><ellipse cx="8" cy="4.5" rx="5" ry="1.8"></ellipse><path d="M3,4.5 v7 a5,1.8 0,0,0 10,0 v-7"></path><path d="M3,8 a5,1.8 0,0,0 10,0"></path></svg> DB</button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><line x1="2" y1="5" x2="14" y2="5"></line><line x1="2" y1="8" x2="14" y2="8"></line><line x1="2" y1="11" x2="9" y2="11"></line></svg> Logs</button> <div class="nav-spacer svelte-1n46o8q"></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"><line x1="18" y1="20" x2="18" y2="10"></line><line x1="12" y1="20" x2="12" y2="4"></line><line x1="6" y1="20" x2="6" y2="14"></line></svg></button> <!></div> <div class="nav-right svelte-1n46o8q"><span class="version svelte-1n46o8q"> <!></span> <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"><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"></path></svg></a> <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"><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"></path><circle cx="12" cy="12" r="3"></circle></svg></button> <!></div></nav> <main class="svelte-1n46o8q"><div><!></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div></main> <!></div>');function c9(o,e){ao(e,!0);const t=["scripts","mqtt","matter","db","logs","config","packages"];function i(){const Jt=location.hash.slice(1);return t.includes(Jt)?Jt:"scripts"}let n=j(Li(i())),s=j(null),r=j(null),a=j(!1),c=j("none"),h=j(!1),u=j(""),g=j(""),f=j(!1);l7(()=>{I(h,!0)});async function v(){I(g,""),I(f,!0);try{await h7(m(u)),I(u,""),I(h,!1)}catch(Jt){I(g,Jt.message??"Login failed",!0)}finally{I(f,!1)}}async function _(){await u7(),I(h,!0)}async function y(){if(confirm("Restart the she daemon? The page will reload after a moment."))try{await b7(),setTimeout(()=>location.reload(),2500)}catch{}}function S(Jt){I(n,Jt,!0),location.hash=Jt}na(async()=>{location.hash||(location.hash=m(n));const Jt=()=>{I(n,i(),!0)};window.addEventListener("hashchange",Jt);try{I(c,await d7(),!0),m(c)==="password"&&(await fetch("/she/scripts")).status===401&&I(h,!0)}catch{}fetch("https://registry.npmjs.org/smart-home-engine/latest").then(Ie=>Ie.json()).then(Ie=>{Ie.version&&Ie.version!=="0.14.0"&&I(s,Ie.version,!0)}).catch(()=>{});async function be(){try{I(r,await v7(),!0)}catch{}}be();const K=setInterval(be,5e3);return()=>{window.removeEventListener("hashchange",Jt),clearInterval(K)}});var x=l9();_o("click",hP,()=>{m(a)&&I(a,!1)});var E=k(x),M=D(k(E),2);let F;var R=D(M,2);let Z;var q=D(R,2);let he;var pe=D(q,2);let Ce;var Pe=D(pe,2);let je;var qt=D(Pe,2);let Ge;var Xt=D(qt,4),pt=k(Xt),Kt=D(pt,2);{var ae=Jt=>{var be=n9(),K=k(be);{var Ie=rt=>{var ni=t9(),ri=D(k(ni)),Xi=k(ri),Hi=D(ri,3),A=k(Hi),te=D(Hi,3),H=k(te),ee=D(te,2);{var ke=Ue=>{var z=e9(),$=D(Wt(z)),re=k($),xe=D($,3),_e=k(xe);se(()=>{oe(re,m(r).matterNodes??0),oe(_e,m(r).matterEndpoints??0)}),N(Ue,z)};J(ee,Ue=>{m(r).matterEnabled&&Ue(ke)})}se(()=>{oe(Xi,m(r).scripts),oe(A,m(r).topics),oe(H,m(r).mqttMsgPerSec??"—")}),N(rt,ni)},nt=rt=>{var ni=i9();N(rt,ni)};J(K,rt=>{m(r)?rt(Ie):rt(nt,-1)})}var Rt=D(K,2),vt=k(Rt);de("click",be,rt=>rt.stopPropagation()),de("click",vt,()=>{I(a,!1),y()}),N(Jt,be)};J(Kt,Jt=>{m(a)&&Jt(ae)})}var Te=D(Xt,2),ve=k(Te),lt=k(ve);lt.nodeValue="v0.14.0 ";var Qt=D(lt);{var It=Jt=>{var be=s9(),K=k(be);se(()=>{is(be,"title",`Update available: v${m(s)??""}`),oe(K,`↑ ${m(s)??""}`)}),N(Jt,be)};J(Qt,Jt=>{m(s)&&Jt(It)})}var Tt=D(ve,4);let Lt;var gt=D(Tt,2);{var Oi=Jt=>{var be=o9();de("click",be,_),N(Jt,be)};J(gt,Jt=>{m(c)==="password"&&Jt(Oi)})}var Gt=D(E,2),Ae=k(Gt);let Be;var Mt=k(Ae);{let Jt=Vt(()=>m(n)==="scripts");pK(Mt,{get active(){return m(Jt)}})}var kt=D(Ae,2);let pi;var Nt=k(kt);JZ(Nt,{});var mi=D(kt,2);let Mi;var Ui=k(mi);WZ(Ui,{});var Fi=D(mi,2);let yi;var cn=k(Fi);bZ(cn,{});var Zi=D(Fi,2);let rn;var bn=k(Zi);sZ(bn,{});var _i=D(Zi,2);let _n;var ki=k(_i);JK(ki,{});var Ni=D(_i,2);let fn;var On=k(Ni);nG(On,{});var Vn=D(Gt,2);{var Un=Jt=>{var be=a9(),K=k(be),Ie=D(k(K),4),nt=D(k(Ie),2),Rt=D(Ie,2);{var vt=ri=>{var Xi=r9(),Hi=k(Xi);se(()=>oe(Hi,m(g))),N(ri,Xi)};J(Rt,ri=>{m(g)&&ri(vt)})}var rt=D(Rt,2),ni=k(rt);se(()=>{nt.disabled=m(f),rt.disabled=m(f)||!m(u),oe(ni,m(f)?"Signing in…":"Sign in")}),_o("submit",K,ri=>{ri.preventDefault(),v()}),Bi(nt,()=>m(u),ri=>I(u,ri)),N(Jt,be)};J(Vn,Jt=>{m(h)&&Jt(Un)})}se(()=>{F=ti(M,1,"svelte-1n46o8q",null,F,{active:m(n)==="scripts"}),Z=ti(R,1,"svelte-1n46o8q",null,Z,{active:m(n)==="packages"}),he=ti(q,1,"svelte-1n46o8q",null,he,{active:m(n)==="mqtt"}),Ce=ti(pe,1,"svelte-1n46o8q",null,Ce,{active:m(n)==="matter"}),je=ti(Pe,1,"svelte-1n46o8q",null,je,{active:m(n)==="db"}),Ge=ti(qt,1,"svelte-1n46o8q",null,Ge,{active:m(n)==="logs"}),Lt=ti(Tt,1,"nav-settings svelte-1n46o8q",null,Lt,{active:m(n)==="config"}),Be=ti(Ae,1,"page-wrap svelte-1n46o8q",null,Be,{hidden:m(n)!=="scripts"}),pi=ti(kt,1,"page-wrap svelte-1n46o8q",null,pi,{hidden:m(n)!=="packages"}),Mi=ti(mi,1,"page-wrap svelte-1n46o8q",null,Mi,{hidden:m(n)!=="mqtt"}),yi=ti(Fi,1,"page-wrap svelte-1n46o8q",null,yi,{hidden:m(n)!=="matter"}),rn=ti(Zi,1,"page-wrap svelte-1n46o8q",null,rn,{hidden:m(n)!=="db"}),_n=ti(_i,1,"page-wrap svelte-1n46o8q",null,_n,{hidden:m(n)!=="config"}),fn=ti(Ni,1,"page-wrap svelte-1n46o8q",null,fn,{hidden:m(n)!=="logs"})}),de("click",M,()=>S("scripts")),de("click",R,()=>S("packages")),de("click",q,()=>S("mqtt")),de("click",pe,()=>S("matter")),de("click",Pe,()=>S("db")),de("click",qt,()=>S("logs")),de("click",pt,Jt=>{Jt.stopPropagation(),I(a,!m(a))}),de("click",Tt,()=>S("config")),N(o,x),lo()}Ko(["click"]);HH(c9,{target:document.getElementById("app")});export{UP as t};