smart-home-engine 0.27.7 → 0.28.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,225 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jsonMode-CXWNuhmR.js","assets/monaco-langs-BW2J83t5.js","assets/monaco-langs-DyX1CsEw.css","assets/tsMode-Z6Sa7F80.js"])))=>i.map(i=>d[i]);
2
+ var lA=Object.defineProperty;var jL=o=>{throw TypeError(o)};var cA=(o,e,t)=>e in o?lA(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var ji=(o,e,t)=>cA(o,typeof e!="symbol"?e+"":e,t),sw=(o,e,t)=>e.has(o)||jL("Cannot "+t);var te=(o,e,t)=>(sw(o,e,"read from private field"),t?t.call(o):e.get(o)),Mi=(o,e,t)=>e.has(o)?jL("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,t),Ni=(o,e,t,i)=>(sw(o,e,"write to private field"),i?i.call(o,t):e.set(o,t),t),In=(o,e,t)=>(sw(o,e,"access private method"),t);import{_ as oE,m as rE,l as kt,A as uo,C as le,I as Tn,D as Up,a as os,g as aE,M as lt,b as Qt,E as na,c as M,r as cn,d as kr,e as y,f as dA,h as Sn,R as Ri,S as Xt,i as $s,j as Ir,k as $i,n as _i,o as se,p as Se,K as cs,q as St,s as Ve,t as ms,u as B,v as ki,O as Ma,w as hs,P as Dt,x as ow,y as $p,z as lE,B as ll,F as sa,G as sS,H as Ps,U as un,J as Ju,L as Et,N as fl,Q as hA,T as ro,V as oS,W as uA,X as cE,$ as yt,Y as Xi,Z as Ui,a0 as jn,a1 as ai,a2 as Bo,a3 as Xf,a4 as Be,a5 as d_,a6 as gA,a7 as fA,a8 as ps,a9 as pA,aa as oa,ab as go,ac as Tt,ad as dE,ae as En,af as mA,ag as _A,ah as lo,ai as Eg,aj as ds,ak as Jb,al as Qs,am as Nc,an as P0,ao as Qb,ap as ks,aq as Qu,ar as Is,as as ey,at as ty,au as vA,av as qp,aw as Pg,ax as xl,ay as bA,az as Tg,aA as yA,aB as T0,aC as wA,aD as SA,aE as UL,aF as ss,aG as cl,aH as eo,aI as gi,aJ as nl,aK as CA,aL as Oa,aM as Fo,aN as ys,aO as ra,aP as M0,aQ as _s,aR as es,aS as F_,aT as ui,aU as hE,aV as xA,aW as N0,aX as iy,aY as R0,aZ as A0,a_ as ad,a$ as LA,b0 as O0,b1 as kA,b2 as F0,b3 as Ll,b4 as kl,b5 as eg,b6 as Yf,b7 as Lo,b8 as Kp,b9 as H_,ba as rw,bb as mn,bc as H0,bd as Gp,be as ny,bf as IA,bg as uE,bh as Jf,bi as tg,bj as Qf,bk as Zp,bl as sy,bm as Gi,bn as Rc,bo as Xp,bp as DA,bq as EA,br as W0,bs as PA,bt as W_,bu as nr,bv as B0,bw as ig,bx as Il,by as Mg,bz as xi,bA as ng,bB as gE,bC as Yp,bD as TA,bE as ld,bF as pt,bG as $L,bH as h_,bI as fE,bJ as Pr,bK as Jr,bL as bn,bM as sg,bN as yr,bO as og,bP as Vn,bQ as ep,bR as xh,bS as rS,bT as pE,bU as mE,bV as _E,bW as z0,bX as bo,bY as an,bZ as Jp,b_ as vE,b$ as dl,c0 as oy,c1 as MA,c2 as hu,c3 as qL,c4 as Qp,c5 as bE,c6 as uu,c7 as NA,c8 as gr,c9 as ry,ca as RA,cb as fo,cc as aa,cd as em,ce as tp,cf as yE,cg as er,ch as tm,ci as ay,cj as AA,ck as OA,cl as FA,cm as Ng,cn as Fa,co as ws,cp as HA,cq as V0,cr as WA,cs as BA,ct as KL,cu as zA,cv as im,cw as pl,cx as aS,cy as oh,cz as ml,cA as VA,cB as Na,cC as wr,cD as No,cE as GL,cF as Ks,cG as nm,cH as xc,cI as Ha,cJ as jA,cK as la,cL as ip,cM as ly,cN as wE,cO as UA,cP as $A,cQ as j0,cR as qA,cS as np,cT as KA,cU as Yl,cV as sp,cW as ZL,cX as GA,cY as ZA,cZ as za,c_ as XA,c$ as U0,d0 as SE,d1 as CE,d2 as xE,d3 as LE,d4 as YA,d5 as JA,d6 as kE,d7 as IE,d8 as QA,d9 as $0,da as eO,db as tO,dc as Kn,dd as iO,de as q0,df as nO,dg as gu,dh as XL,di as sO,dj as oO,dk as rO,dl as aO,dm as lO,dn as cO,dp as rg,dq as cy,dr as lS,ds as dO,dt as hO,du as YL,dv as cS,dw as uO,dx as JL,dy as aw,dz as gO,dA as DE,dB as fO,dC as EE,dD as dS,dE as pO,dF as mO,dG as _O,dH as PE,dI as TE,dJ as vO,dK as B_,dL as ME,dM as dy,dN as bO,dO as yO,dP as Lc,dQ as K0,dR as wO,dS as QL,dT as ek,dU as SO,dV as fu,dW as NE,dX as CO,dY as xO,dZ as LO,d_ as kO,d$ as RE,e0 as AE,e1 as OE,e2 as FE,e3 as IO,e4 as Ra,e5 as tk,e6 as DO,e7 as sm,e8 as EO,e9 as uf,ea as HE,eb as ik,ec as op,ed as WE,ee as z_,ef as PO,eg as BE,eh as TO,ei as zE,ej as MO,ek as NO,el as VE,em as jE,en as _l,eo as hy,ep as RO,eq as UE,er as Ho,es as cd,et as $E,eu as AO,ev as OO,ew as qE,ex as KE,ey as FO,ez as GE,eA as ZE,eB as rp,eC as HO,eD as WO,eE as BO,eF as zO,eG as ef,eH as nk,eI as VO,eJ as jO,eK as UO,eL as V_,eM as Rs,eN as $O,eO as hS,eP as Lh,eQ as qO,eR as il,eS as KO,eT as GO,eU as XE,eV as ZO,eW as Pf,eX as XO,eY as YO,eZ as JO,e_ as QO,e$ as sk,f0 as ok,f1 as rk,f2 as kh,f3 as G0,f4 as YE,f5 as uS,f6 as u_,f7 as JE,f8 as j_,f9 as e2,fa as t2,fb as i2,fc as n2,fd as Z0,fe as QE,ff as s2,fg as U_,fh as eP,fi as tP,fj as o2,fk as r2,fl as a2,fm as l2,fn as c2,fo as d2,fp as h2,fq as u2,fr as iP,fs as g2,ft as $_,fu as nP,fv as f2,fw as sP,fx as p2,fy as oP,fz as rP,fA as m2,fB as ak,fC as aP,fD as lk,fE as _2,fF as lw,fG as ck,fH as v2,fI as b2,fJ as y2,fK as La,fL as kc,fM as w2,fN as dk,fO as g_,fP as S2,fQ as sl,fR as uy,fS as gS,fT as C2,fU as lP,fV as cP,fW as Gs,fX as hk,fY as Nm,fZ as X0,f_ as x2,f$ as L2,g0 as k2,g1 as I2,g2 as D2,g3 as E2,g4 as P2,g5 as T2,g6 as uk,g7 as M2,g8 as N2,g9 as R2,ga as ag,gb as Tf,gc as dP,gd as A2,ge as Y0,gf as f_,gg as Rm,gh as cw,gi as O2,gj as F2,gk as hP,gl as H2,gm as J0,gn as W2,go as B2,gp as uP,gq as gy,gr as z2,gs as q_,gt as Q0,gu as e1,gv as t1,gw as gP,gx as fP,gy as pP,gz as mP,gA as _P,gB as vP,gC as bP,gD as gk,gE as yP,gF as jh,gG as V2,gH as j2,gI as U2,gJ as $2,gK as wP,gL as q2,gM as K2,gN as fk,gO as fS,gP as sc,gQ as G2,gR as Z2,gS as X2,gT as Y2,gU as J2,gV as Q2,gW as pk,gX as i1,gY as pS,gZ as eF,g_ as mS,g$ as tF,h0 as iF,h1 as nF,h2 as sF,h3 as n1,h4 as SP,h5 as mk,h6 as _k,h7 as oF,h8 as rF,h9 as aF,ha as vk,hb as dw,hc as lF,hd as cF,he as dF,hf as hw,hg as CP,hh as xP,hi as LP,hj as kP,hk as vl,hl as IP,hm as s1,hn as bk,ho as hF,hp as DP,hq as uF,hr as gF,hs as fy,ht as py,hu as Ih,hv as my,hw as om,hx as fF,hy as _y,hz as pF,hA as mF,hB as _F,hC as EP,hD as tf,hE as vF,hF as bF,hG as yF,hH as wF,hI as rm,hJ as SF,hK as PP,hL as TP,hM as MP,hN as _S,hO as CF,hP as xF,hQ as LF,hR as kF,hS as IF,hT as vS,hU as DF,hV as EF,hW as PF,hX as TF,hY as MF,hZ as NF,h_ as RF,h$ as AF,i0 as NP,i1 as OF,i2 as FF,i3 as HF,i4 as yk,i5 as WF,i6 as BF,i7 as Kc,i8 as cr,i9 as zF,ia as VF}from"./monaco-langs-BW2J83t5.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 RP=!1;var o1=Array.isArray,jF=Array.prototype.indexOf,K_=Array.prototype.includes,vy=Array.from,UF=Object.defineProperty,Eu=Object.getOwnPropertyDescriptor,$F=Object.getOwnPropertyDescriptors,qF=Object.prototype,KF=Array.prototype,AP=Object.getPrototypeOf,wk=Object.isExtensible;const by=()=>{};function GF(o){for(var e=0;e<o.length;e++)o[e]()}function OP(){var o,e,t=new Promise((i,n)=>{o=i,e=n});return{promise:t,resolve:o,reject:e}}function ZF(o,e,t=!1){return o===void 0?t?e():e:o}function Sk(o,e){if(Array.isArray(o))return o;if(!(Symbol.iterator in o))return Array.from(o);const t=[];for(const i of o)if(t.push(i),t.length===e)break;return t}const Ys=2,lg=4,yy=8,FP=1<<24,Qr=16,ia=32,Ic=64,bS=128,xr=512,As=1024,Vs=2048,Wa=4096,wo=8192,Lr=16384,Rg=32768,yS=1<<25,cg=65536,G_=1<<17,XF=1<<18,Ag=1<<19,YF=1<<20,Ea=1<<25,rh=65536,Z_=1<<21,Pu=1<<22,oc=1<<23,dd=Symbol("$state"),JF=Symbol("legacy props"),QF=Symbol(""),p_=Symbol("attributes"),wS=Symbol("class"),SS=Symbol("style"),gf=Symbol("text"),m_=Symbol("form reset"),wy=new class extends Error{constructor(){super(...arguments);ji(this,"name","StaleReactionError");ji(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function HP(o){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function eH(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function tH(o,e,t){throw new Error("https://svelte.dev/e/each_key_duplicate")}function iH(o){throw new Error("https://svelte.dev/e/effect_in_teardown")}function nH(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function sH(o){throw new Error("https://svelte.dev/e/effect_orphan")}function oH(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function rH(o){throw new Error("https://svelte.dev/e/props_invalid_value")}function aH(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function lH(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function cH(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function dH(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const hH=1,uH=2,WP=4,gH=8,fH=16,pH=1,mH=4,_H=8,vH=16,bH=1,yH=2,Ns=Symbol("uninitialized"),BP="http://www.w3.org/1999/xhtml",wH="http://www.w3.org/2000/svg",SH="http://www.w3.org/1998/Math/MathML";function CH(){console.warn("https://svelte.dev/e/derived_inert")}function xH(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function LH(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function zP(o){return o===this.v}function kH(o,e){return o!=o?e==e:o!==e||o!==null&&typeof o=="object"||typeof o=="function"}function VP(o){return!kH(o,this.v)}let IH=!1,Xs=null;function dg(o){Xs=o}function Vo(o,e=!1,t){Xs={p:Xs,i:!1,c:null,e:null,s:o,x:null,r:ln,l:null}}function jo(o){var e=Xs,t=e.e;if(t!==null){e.e=null;for(var i of t)dT(i)}return o!==void 0&&(e.x=o),e.i=!0,Xs=e.p,o??{}}function jP(){return!0}let Jc=[];function UP(){var o=Jc;Jc=[],GF(o)}function rc(o){if(Jc.length===0&&!Nf){var e=Jc;queueMicrotask(()=>{e===Jc&&UP()})}Jc.push(o)}function DH(){for(;Jc.length>0;)UP()}function $P(o){var e=ln;if(e===null)return rn.f|=oc,o;if((e.f&Rg)===0&&(e.f&lg)===0)throw o;Jl(o,e)}function Jl(o,e){for(;e!==null;){if((e.f&bS)!==0){if((e.f&Rg)===0)throw o;try{e.b.error(o);return}catch(t){o=t}}e=e.parent}throw o}const EH=-7169;function vs(o,e){o.f=o.f&EH|e}function r1(o){(o.f&xr)!==0||o.deps===null?vs(o,As):vs(o,Wa)}function qP(o){if(o!==null)for(const e of o)(e.f&Ys)===0||(e.f&rh)===0||(e.f^=rh,qP(e.deps))}function KP(o,e,t){(o.f&Vs)!==0?e.add(o):(o.f&Wa)!==0&&t.add(o),qP(o.deps),vs(o,As)}let Am=!1;function PH(o){var e=Am;try{return Am=!1,[o(),Am]}finally{Am=e}}let uw=null,Uh=null,hi=null,Mf=null,qs=null,CS=null,Nf=!1,gw=!1,pu=null,__=null;var Ck=0;let TH=1;var Ru,Gl,id,Au,Ou,Fu,Ja,Hu,Po,Hp,Qa,Vr,wa,Wu,nd,Gn,xS,ff,LS,GP,ZP,ou,MH,pf;const ob=class ob{constructor(){Mi(this,Gn);ji(this,"id",TH++);Mi(this,Ru,!1);ji(this,"linked",!0);Mi(this,Gl,null);Mi(this,id,null);ji(this,"async_deriveds",new Map);ji(this,"current",new Map);ji(this,"previous",new Map);Mi(this,Au,new Set);Mi(this,Ou,new Set);Mi(this,Fu,0);Mi(this,Ja,new Map);Mi(this,Hu,null);Mi(this,Po,[]);Mi(this,Hp,[]);Mi(this,Qa,new Set);Mi(this,Vr,new Set);Mi(this,wa,new Map);Mi(this,Wu,new Set);ji(this,"is_fork",!1);Mi(this,nd,!1);Uh===null?uw=Uh=this:(Ni(Uh,id,this),Ni(this,Gl,Uh)),Uh=this}skip_effect(e){te(this,wa).has(e)||te(this,wa).set(e,{d:[],m:[]}),te(this,Wu).delete(e)}unskip_effect(e,t=i=>this.schedule(i)){var i=te(this,wa).get(e);if(i){te(this,wa).delete(e);for(var n of i.d)vs(n,Vs),t(n);for(n of i.m)vs(n,Wa),t(n)}te(this,Wu).add(e)}capture(e,t,i=!1){e.v!==Ns&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&oc)===0&&(this.current.set(e,[t,i]),qs==null||qs.set(e,t)),this.is_fork||(e.v=t)}activate(){hi=this}deactivate(){hi=null,qs=null}flush(){try{gw=!0,hi=this,In(this,Gn,ff).call(this)}finally{Ck=0,CS=null,pu=null,__=null,gw=!1,hi=null,qs=null,hd.clear()}}discard(){var e;for(const t of te(this,Ou))t(this);te(this,Ou).clear(),In(this,Gn,pf).call(this),(e=te(this,Hu))==null||e.resolve()}register_created_effect(e){te(this,Hp).push(e)}increment(e,t){if(Ni(this,Fu,te(this,Fu)+1),e){let i=te(this,Ja).get(t)??0;te(this,Ja).set(t,i+1)}}decrement(e,t){if(Ni(this,Fu,te(this,Fu)-1),e){let i=te(this,Ja).get(t)??0;i===1?te(this,Ja).delete(t):te(this,Ja).set(t,i-1)}te(this,nd)||(Ni(this,nd,!0),rc(()=>{Ni(this,nd,!1),this.linked&&this.flush()}))}transfer_effects(e,t){for(const i of e)te(this,Qa).add(i);for(const i of t)te(this,Vr).add(i);e.clear(),t.clear()}oncommit(e){te(this,Au).add(e)}ondiscard(e){te(this,Ou).add(e)}settled(){return(te(this,Hu)??Ni(this,Hu,OP())).promise}static ensure(){if(hi===null){const e=hi=new ob;!gw&&!Nf&&rc(()=>{te(e,Ru)||e.flush()})}return hi}apply(){{qs=null;return}}schedule(e){var n;if(CS=e,(n=e.b)!=null&&n.is_pending&&(e.f&(lg|yy|FP))!==0&&(e.f&Rg)===0){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var i=t.f;if(pu!==null&&t===ln&&(rn===null||(rn.f&Ys)===0))return;if((i&(Ic|ia))!==0){if((i&As)===0)return;t.f^=As}}te(this,Po).push(t)}};Ru=new WeakMap,Gl=new WeakMap,id=new WeakMap,Au=new WeakMap,Ou=new WeakMap,Fu=new WeakMap,Ja=new WeakMap,Hu=new WeakMap,Po=new WeakMap,Hp=new WeakMap,Qa=new WeakMap,Vr=new WeakMap,wa=new WeakMap,Wu=new WeakMap,nd=new WeakMap,Gn=new WeakSet,xS=function(){if(this.is_fork)return!0;for(const i of te(this,Ja).keys()){for(var e=i,t=!1;e.parent!==null;){if(te(this,wa).has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1},ff=function(){var c,h,g,f;Ni(this,Ru,!0),Ck++>1e3&&(In(this,Gn,pf).call(this),RH());for(const p of te(this,Qa))te(this,Vr).delete(p),vs(p,Vs),this.schedule(p);for(const p of te(this,Vr))vs(p,Wa),this.schedule(p);const e=te(this,Po);Ni(this,Po,[]),this.apply();var t=pu=[],i=[],n=__=[];for(const p of e)try{In(this,Gn,LS).call(this,p,t,i)}catch(v){throw JP(p),In(this,Gn,xS).call(this)||this.discard(),v}if(hi=null,n.length>0){var s=ob.ensure();for(const p of n)s.schedule(p)}if(pu=null,__=null,In(this,Gn,xS).call(this)){In(this,Gn,ou).call(this,i),In(this,Gn,ou).call(this,t);for(const[p,v]of te(this,wa))YP(p,v);n.length>0&&In(c=hi,Gn,ff).call(c);return}const r=In(this,Gn,GP).call(this);if(r){In(this,Gn,ou).call(this,i),In(this,Gn,ou).call(this,t),In(h=r,Gn,ZP).call(h,this);return}te(this,Qa).clear(),te(this,Vr).clear();for(const p of te(this,Au))p(this);te(this,Au).clear(),Mf=this,xk(i),xk(t),Mf=null,(g=te(this,Hu))==null||g.resolve();var a=hi;if(te(this,Fu)===0&&(te(this,Po).length===0||a!==null)&&In(this,Gn,pf).call(this),te(this,Po).length>0)if(a!==null){const p=a;te(p,Po).push(...te(this,Po).filter(v=>!te(p,Po).includes(v)))}else a=this;a!==null&&In(f=a,Gn,ff).call(f)},LS=function(e,t,i){e.f^=As;for(var n=e.first;n!==null;){var s=n.f,r=(s&(ia|Ic))!==0,a=r&&(s&As)!==0,c=a||(s&wo)!==0||te(this,wa).has(n);if(!c&&n.fn!==null){r?n.f^=As:(s&lg)!==0?t.push(n):lm(n)&&((s&Qr)!==0&&te(this,Vr).add(n),ug(n));var h=n.first;if(h!==null){n=h;continue}}for(;n!==null;){var g=n.next;if(g!==null){n=g;break}n=n.parent}}},GP=function(){for(var e=te(this,Gl);e!==null;){if(!e.is_fork){for(const[t,[,i]]of this.current)if(e.current.has(t)&&!i)return e}e=te(e,Gl)}return null},ZP=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(te(e,Qa),te(e,Vr));const t=n=>{var s=n.reactions;if(s!==null)for(const c of s){var r=c.f;if((r&Ys)!==0)t(c);else{var a=c;r&(Pu|Qr)&&!this.async_deriveds.has(a)&&(te(this,Vr).delete(a),vs(a,Vs),this.schedule(a))}}};for(const n of this.current.keys())t(n);this.oncommit(()=>e.discard()),In(i=e,Gn,pf).call(i),hi=this,In(this,Gn,ff).call(this)},ou=function(e){for(var t=0;t<e.length;t+=1)KP(e[t],te(this,Qa),te(this,Vr))},MH=function(){var g;for(let f=uw;f!==null;f=te(f,id)){var e=f.id<this.id,t=[];for(const[p,[v,_]]of this.current){if(f.current.has(p)){var i=f.current.get(p)[0];if(e&&v!==i)f.current.set(p,[v,_]);else continue}t.push(p)}if(e)for(const[p,v]of this.async_deriveds){const _=f.async_deriveds.get(p);_&&v.promise.then(_.resolve).catch(_.reject)}if(te(f,Ru)){var n=[...f.current.keys()].filter(p=>!f.current.get(p)[1]&&!this.current.has(p));if(n.length===0)e&&f.discard();else if(t.length>0){if(e)for(const p of te(this,Wu))f.unskip_effect(p,v=>{var _;(v.f&(Qr|Pu))!==0?f.schedule(v):In(_=f,Gn,ou).call(_,[v])});f.activate();var s=new Set,r=new Map;for(var a of t)XP(a,n,s,r);r=new Map;var c=[...f.current].filter(([p,v])=>{const _=this.current.get(p);return _?_[0]!==v[0]||_[1]!==v[1]:!0}).map(([p])=>p);if(c.length>0)for(const p of te(this,Hp))(p.f&(Lr|wo|G_))===0&&a1(p,c,r)&&((p.f&(Pu|Qr))!==0?(vs(p,Vs),f.schedule(p)):te(f,Qa).add(p));if(te(f,Po).length>0&&!te(f,nd)){f.apply();for(var h of te(f,Po))In(g=f,Gn,LS).call(g,h,[],[]);Ni(f,Po,[])}f.deactivate()}}}},pf=function(){if(this.linked){var e=te(this,Gl),t=te(this,id);e===null?uw=t:Ni(e,id,t),t===null?Uh=e:Ni(t,Gl,e),this.linked=!1}};let ah=ob;function NH(o){var e=Nf;Nf=!0;try{for(var t;;){if(DH(),hi===null)return t;hi.flush()}}finally{Nf=e}}function RH(){try{oH()}catch(o){Jl(o,CS)}}let Wr=null;function xk(o){var e=o.length;if(e!==0){for(var t=0;t<e;){var i=o[t++];if((i.f&(Lr|wo))===0&&lm(i)&&(Wr=new Set,ug(i),i.deps===null&&i.first===null&&i.nodes===null&&i.teardown===null&&i.ac===null&&gT(i),(Wr==null?void 0:Wr.size)>0)){hd.clear();for(const n of Wr){if((n.f&(Lr|wo))!==0)continue;const s=[n];let r=n.parent;for(;r!==null;)Wr.has(r)&&(Wr.delete(r),s.push(r)),r=r.parent;for(let a=s.length-1;a>=0;a--){const c=s[a];(c.f&(Lr|wo))===0&&ug(c)}}Wr.clear()}}Wr=null}}function XP(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&Ys)!==0?XP(n,e,t,i):(s&(Pu|Qr))!==0&&(s&Vs)===0&&a1(n,e,i)&&(vs(n,Vs),l1(n))}}function a1(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(K_.call(e,n))return!0;if((n.f&Ys)!==0&&a1(n,e,t))return t.set(n,!0),!0}return t.set(o,!1),!1}function l1(o){hi.schedule(o)}function YP(o,e){if(!((o.f&ia)!==0&&(o.f&As)!==0)){(o.f&Vs)!==0?e.d.push(o):(o.f&Wa)!==0&&e.m.push(o),vs(o,As);for(var t=o.first;t!==null;)YP(t,e),t=t.next}}function JP(o){vs(o,As);for(var e=o.first;e!==null;)JP(e),e=e.next}function AH(o){let e=0,t=lh(0),i;return()=>{u1()&&(u(t),Cy(()=>(e===0&&(i=El(()=>o(()=>Rf(t)))),e+=1,()=>{rc(()=>{e-=1,e===0&&(i==null||i(),i=void 0,Rf(t))})})))}}var OH=cg|Ag;function FH(o,e,t,i){new HH(o,e,t,i)}var pr,E0,mr,sd,To,_r,_o,Xo,el,od,Zl,Bu,Wp,Bp,tl,rb,bs,WH,BH,zH,kS,v_,b_,IS,DS;class HH{constructor(e,t,i,n){Mi(this,bs);ji(this,"parent");ji(this,"is_pending",!1);ji(this,"transform_error");Mi(this,pr);Mi(this,E0,null);Mi(this,mr);Mi(this,sd);Mi(this,To);Mi(this,_r,null);Mi(this,_o,null);Mi(this,Xo,null);Mi(this,el,null);Mi(this,od,0);Mi(this,Zl,0);Mi(this,Bu,!1);Mi(this,Wp,new Set);Mi(this,Bp,new Set);Mi(this,tl,null);Mi(this,rb,AH(()=>(Ni(this,tl,lh(te(this,od))),()=>{Ni(this,tl,null)})));var s;Ni(this,pr,e),Ni(this,mr,t),Ni(this,sd,r=>{var a=ln;a.b=this,a.f|=bS,i(r)}),this.parent=ln.b,this.transform_error=n??((s=this.parent)==null?void 0:s.transform_error)??(r=>r),Ni(this,To,p1(()=>{In(this,bs,kS).call(this)},OH))}defer_effect(e){KP(e,te(this,Wp),te(this,Bp))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!te(this,mr).pending}update_pending_count(e,t){In(this,bs,IS).call(this,e,t),Ni(this,od,te(this,od)+e),!(!te(this,tl)||te(this,Bu))&&(Ni(this,Bu,!0),rc(()=>{Ni(this,Bu,!1),te(this,tl)&&hg(te(this,tl),te(this,od))}))}get_effect_pending(){return te(this,rb).call(this),u(te(this,tl))}error(e){if(!te(this,mr).onerror&&!te(this,mr).failed)throw e;hi!=null&&hi.is_fork?(te(this,_r)&&hi.skip_effect(te(this,_r)),te(this,_o)&&hi.skip_effect(te(this,_o)),te(this,Xo)&&hi.skip_effect(te(this,Xo)),hi.oncommit(()=>{In(this,bs,DS).call(this,e)})):In(this,bs,DS).call(this,e)}}pr=new WeakMap,E0=new WeakMap,mr=new WeakMap,sd=new WeakMap,To=new WeakMap,_r=new WeakMap,_o=new WeakMap,Xo=new WeakMap,el=new WeakMap,od=new WeakMap,Zl=new WeakMap,Bu=new WeakMap,Wp=new WeakMap,Bp=new WeakMap,tl=new WeakMap,rb=new WeakMap,bs=new WeakSet,WH=function(){try{Ni(this,_r,vr(()=>te(this,sd).call(this,te(this,pr))))}catch(e){this.error(e)}},BH=function(e){const t=te(this,mr).failed;t&&Ni(this,Xo,vr(()=>{t(te(this,pr),()=>e,()=>()=>{})}))},zH=function(){const e=te(this,mr).pending;e&&(this.is_pending=!0,Ni(this,_o,vr(()=>e(te(this,pr)))),rc(()=>{var t=Ni(this,el,document.createDocumentFragment()),i=hl();t.append(i),Ni(this,_r,In(this,bs,b_).call(this,()=>vr(()=>te(this,sd).call(this,i)))),te(this,Zl)===0&&(te(this,pr).before(t),Ni(this,el,null),gd(te(this,_o),()=>{Ni(this,_o,null)}),In(this,bs,v_).call(this,hi))}))},kS=function(){try{if(this.is_pending=this.has_pending_snippet(),Ni(this,Zl,0),Ni(this,od,0),Ni(this,_r,vr(()=>{te(this,sd).call(this,te(this,pr))})),te(this,Zl)>0){var e=Ni(this,el,document.createDocumentFragment());_1(te(this,_r),e);const t=te(this,mr).pending;Ni(this,_o,vr(()=>t(te(this,pr))))}else In(this,bs,v_).call(this,hi)}catch(t){this.error(t)}},v_=function(e){this.is_pending=!1,e.transfer_effects(te(this,Wp),te(this,Bp))},b_=function(e){var t=ln,i=rn,n=Xs;Ba(te(this,To)),Dr(te(this,To)),dg(te(this,To).ctx);try{return ah.ensure(),e()}catch(s){return $P(s),null}finally{Ba(t),Dr(i),dg(n)}},IS=function(e,t){var i;if(!this.has_pending_snippet()){this.parent&&In(i=this.parent,bs,IS).call(i,e,t);return}Ni(this,Zl,te(this,Zl)+e),te(this,Zl)===0&&(In(this,bs,v_).call(this,t),te(this,_o)&&gd(te(this,_o),()=>{Ni(this,_o,null)}),te(this,el)&&(te(this,pr).before(te(this,el)),Ni(this,el,null)))},DS=function(e){te(this,_r)&&(Wo(te(this,_r)),Ni(this,_r,null)),te(this,_o)&&(Wo(te(this,_o)),Ni(this,_o,null)),te(this,Xo)&&(Wo(te(this,Xo)),Ni(this,Xo,null));var t=te(this,mr).onerror;let i=te(this,mr).failed;var n=!1,s=!1;const r=()=>{if(n){LH();return}n=!0,s&&dH(),te(this,Xo)!==null&&gd(te(this,Xo),()=>{Ni(this,Xo,null)}),In(this,bs,b_).call(this,()=>{In(this,bs,kS).call(this)})},a=c=>{try{s=!0,t==null||t(c,r),s=!1}catch(h){Jl(h,te(this,To)&&te(this,To).parent)}i&&Ni(this,Xo,In(this,bs,b_).call(this,()=>{try{return vr(()=>{var h=ln;h.b=this,h.f|=bS,i(te(this,pr),()=>c,()=>r)})}catch(h){return Jl(h,te(this,To).parent),null}}))};rc(()=>{var c;try{c=this.transform_error(e)}catch(h){Jl(h,te(this,To)&&te(this,To).parent);return}c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(a,h=>Jl(h,te(this,To)&&te(this,To).parent)):a(c)})};function VH(o,e,t,i){const n=ap;var s=o.filter(p=>!p.settled);if(t.length===0&&s.length===0){i(e.map(n));return}var r=ln,a=jH(),c=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(p=>p.promise)):null;function h(p){if((r.f&Lr)===0){a();try{i(p)}catch(v){Jl(v,r)}X_()}}var g=QP();if(t.length===0){c.then(()=>h(e.map(n))).finally(g);return}function f(){Promise.all(t.map(p=>UH(p))).then(p=>h([...e.map(n),...p])).catch(p=>Jl(p,r)).finally(g)}c?c.then(()=>{a(),f(),X_()}):f()}function jH(){var o=ln,e=rn,t=Xs,i=hi;return function(s=!0){Ba(o),Dr(e),dg(t),s&&(o.f&Lr)===0&&(i==null||i.activate(),i==null||i.apply())}}function X_(o=!0){Ba(null),Dr(null),dg(null),o&&(hi==null||hi.deactivate())}function QP(){var o=ln,e=o.b,t=hi,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 ap(o){var e=Ys|Vs;return ln!==null&&(ln.f|=Ag),{ctx:Xs,deps:null,effects:null,equals:zP,f:e,fn:o,reactions:null,rv:0,v:Ns,wv:0,parent:ln,ac:null}}const Om=Symbol("obsolete");function UH(o,e,t){let i=ln;i===null&&eH();var n=void 0,s=lh(Ns),r=!rn,a=new Set;return iW(()=>{var v,_;var c=ln,h=OP();n=h.promise;try{Promise.resolve(o()).then(h.resolve,w=>{w!==wy&&h.reject(w)}).finally(X_)}catch(w){h.reject(w),X_()}var g=hi;if(r){if((c.f&Rg)!==0)var f=QP();if((v=i.b)!=null&&v.is_rendered())(_=g.async_deriveds.get(c))==null||_.reject(Om);else for(const w of a.values())w.reject(Om);a.add(h),g.async_deriveds.set(c,h)}const p=(w,S=void 0)=>{f==null||f(),a.delete(h),S!==Om&&(g.activate(),S?(s.f|=oc,hg(s,S)):((s.f&oc)!==0&&(s.f^=oc),hg(s,w)),g.deactivate())};h.promise.then(p,w=>p(null,w||"unknown"))}),g1(()=>{for(const c of a)c.reject(Om)}),new Promise(c=>{function h(g){function f(){g===n?c(s):h(n)}g.then(f,f)}h(n)})}function ot(o){const e=ap(o);return mT(e),e}function c1(o){const e=ap(o);return e.equals=VP,e}function $H(o){var e=o.effects;if(e!==null){o.effects=null;for(var t=0;t<e.length;t+=1)Wo(e[t])}}function d1(o){var e,t=ln,i=o.parent;if(!bl&&i!==null&&o.v!==Ns&&(i.f&(Lr|wo))!==0)return CH(),o.v;Ba(i);try{o.f&=~rh,$H(o),e=yT(o)}finally{Ba(t)}return e}function eT(o){var e=d1(o);if(!o.equals(e)&&(o.wv=vT(),(!(hi!=null&&hi.is_fork)||o.deps===null)&&(hi!==null?(hi.capture(o,e,!0),Mf==null||Mf.capture(o,e,!0)):o.v=e,o.deps===null))){vs(o,As);return}bl||(qs!==null?(u1()||hi!=null&&hi.is_fork)&&qs.set(o,e):r1(o))}function qH(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(wy),i.fn!==null&&(i.teardown=by),i.ac=null,lp(i,0),m1(i))}function tT(o){if(o.effects!==null)for(const e of o.effects)e.teardown&&e.fn!==null&&ug(e)}let Y_=new Set;const hd=new Map;let iT=!1;function lh(o,e){var t={f:0,v:o,reactions:null,equals:zP,rv:0,wv:0};return t}function W(o,e){const t=lh(o);return mT(t),t}function KH(o,e=!1,t=!0){const i=lh(o);return e||(i.equals=VP),i}function k(o,e,t=!1){rn!==null&&(!ea||(rn.f&G_)!==0)&&jP()&&(rn.f&(Ys|Qr|Pu|G_))!==0&&(Aa===null||!Aa.has(o))&&cH();let i=t?mi(e):e;return hg(o,i,__)}function hg(o,e,t=null){if(!o.equals(e)){hd.set(o,bl?e:o.v);var i=ah.ensure();if(i.capture(o,e),(o.f&Ys)!==0){const n=o;(o.f&Vs)!==0&&d1(n),qs===null&&r1(n)}o.wv=vT(),nT(o,Vs,t),ln!==null&&(ln.f&As)!==0&&(ln.f&(ia|Ic))===0&&(fr===null?sW([o]):fr.push(o)),!i.is_fork&&Y_.size>0&&!iT&&GH()}return e}function GH(){iT=!1;for(const o of Y_){(o.f&As)!==0&&vs(o,Wa);let e;try{e=lm(o)}catch{e=!0}e&&ug(o)}Y_.clear()}function Lk(o,e=1){var t=u(o),i=e===1?t++:t--;return k(o,t),i}function Rf(o){k(o,o.v+1)}function nT(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&Vs)===0;if(c&&vs(r,e),(a&G_)!==0)Y_.add(r);else if((a&Ys)!==0){var h=r;qs==null||qs.delete(h),(a&rh)===0&&(a&xr&&(ln===null||(ln.f&Z_)===0)&&(r.f|=rh),nT(h,Wa,t))}else if(c){var g=r;(a&Qr)!==0&&Wr!==null&&Wr.add(g),t!==null?t.push(g):l1(g)}}}function mi(o){if(typeof o!="object"||o===null||dd in o)return o;const e=AP(o);if(e!==qF&&e!==KF)return o;var t=new Map,i=o1(o),n=W(0),s=fd,r=a=>{if(fd===s)return a();var c=rn,h=fd;Dr(null),Ek(s);var g=a();return Dr(c),Ek(h),g};return i&&t.set("length",W(o.length)),new Proxy(o,{defineProperty(a,c,h){(!("value"in h)||h.configurable===!1||h.enumerable===!1||h.writable===!1)&&aH();var g=t.get(c);return g===void 0?r(()=>{var f=W(h.value);return t.set(c,f),f}):k(g,h.value,!0),!0},deleteProperty(a,c){var h=t.get(c);if(h===void 0){if(c in a){const g=r(()=>W(Ns));t.set(c,g),Rf(n)}}else k(h,Ns),Rf(n);return!0},get(a,c,h){var v;if(c===dd)return o;var g=t.get(c),f=c in a;if(g===void 0&&(!f||(v=Eu(a,c))!=null&&v.writable)&&(g=r(()=>{var _=mi(f?a[c]:Ns),w=W(_);return w}),t.set(c,g)),g!==void 0){var p=u(g);return p===Ns?void 0:p}return Reflect.get(a,c,h)},getOwnPropertyDescriptor(a,c){var h=Reflect.getOwnPropertyDescriptor(a,c);if(h&&"value"in h){var g=t.get(c);g&&(h.value=u(g))}else if(h===void 0){var f=t.get(c),p=f==null?void 0:f.v;if(f!==void 0&&p!==Ns)return{enumerable:!0,configurable:!0,value:p,writable:!0}}return h},has(a,c){var p;if(c===dd)return!0;var h=t.get(c),g=h!==void 0&&h.v!==Ns||Reflect.has(a,c);if(h!==void 0||ln!==null&&(!g||(p=Eu(a,c))!=null&&p.writable)){h===void 0&&(h=r(()=>{var v=g?mi(a[c]):Ns,_=W(v);return _}),t.set(c,h));var f=u(h);if(f===Ns)return!1}return g},set(a,c,h,g){var R;var f=t.get(c),p=c in a;if(i&&c==="length")for(var v=h;v<f.v;v+=1){var _=t.get(v+"");_!==void 0?k(_,Ns):v in a&&(_=r(()=>W(Ns)),t.set(v+"",_))}if(f===void 0)(!p||(R=Eu(a,c))!=null&&R.writable)&&(f=r(()=>W(void 0)),k(f,mi(h)),t.set(c,f));else{p=f.v!==Ns;var w=r(()=>mi(h));k(f,w)}var S=Reflect.getOwnPropertyDescriptor(a,c);if(S!=null&&S.set&&S.set.call(g,h),!p){if(i&&typeof c=="string"){var D=t.get("length"),E=Number(c);Number.isInteger(E)&&E>=D.v&&k(D,E+1)}Rf(n)}return!0},ownKeys(a){u(n);var c=Reflect.ownKeys(a).filter(f=>{var p=t.get(f);return p===void 0||p.v!==Ns});for(var[h,g]of t)g.v!==Ns&&!(h in a)&&c.push(h);return c},setPrototypeOf(){lH()}})}function kk(o){try{if(o!==null&&typeof o=="object"&&dd in o)return o[dd]}catch{}return o}function ZH(o,e){return Object.is(kk(o),kk(e))}var ud,sT,oT,rT,aT;function XH(){if(ud===void 0){ud=window,sT=document,oT=/Firefox/.test(navigator.userAgent);var o=Element.prototype,e=Node.prototype,t=Text.prototype;rT=Eu(e,"firstChild").get,aT=Eu(e,"nextSibling").get,wk(o)&&(o[wS]=void 0,o[p_]=null,o[SS]=void 0,o.__e=void 0),wk(t)&&(t[gf]=void 0)}}function hl(o=""){return document.createTextNode(o)}function Pa(o){return rT.call(o)}function am(o){return aT.call(o)}function C(o,e){return Pa(o)}function wt(o,e=!1){{var t=Pa(o);return t instanceof Comment&&t.data===""?am(t):t}}function x(o,e=1,t=!1){let i=o;for(;e--;)i=am(i);return i}function YH(o){o.textContent=""}function lT(){return!1}function cT(o,e,t){return e==null||e===BP?t?document.createElement(o,{is:t}):document.createElement(o):t?document.createElementNS(e,o,{is:t}):document.createElementNS(e,o)}let Ik=!1;function JH(){Ik||(Ik=!0,document.addEventListener("reset",o=>{Promise.resolve().then(()=>{var e;if(!o.defaultPrevented)for(const t of o.target.elements)(e=t[m_])==null||e.call(t)})},{capture:!0}))}function Sy(o){var e=rn,t=ln;Dr(null),Ba(null);try{return o()}finally{Dr(e),Ba(t)}}function h1(o,e,t,i=t){o.addEventListener(e,()=>Sy(t));const n=o[m_];n?o[m_]=()=>{n(),i(!0)}:o[m_]=()=>i(!0),JH()}function QH(o){ln===null&&(rn===null&&sH(),nH()),bl&&iH()}function eW(o,e){var t=e.last;t===null?e.last=e.first=o:(t.next=o,o.prev=t,e.last=o)}function Dl(o,e){var t=ln;t!==null&&(t.f&wo)!==0&&(o|=wo);var i={ctx:Xs,deps:null,nodes:null,f:o|Vs|xr,first:null,fn:e,last:null,next:null,parent:t,b:t&&t.b,prev:null,teardown:null,wv:0,ac:null};hi==null||hi.register_created_effect(i);var n=i;if((o&lg)!==0)pu!==null?pu.push(i):ah.ensure().schedule(i);else if(e!==null){try{ug(i)}catch(r){throw Wo(i),r}n.deps===null&&n.teardown===null&&n.nodes===null&&n.first===n.last&&(n.f&Ag)===0&&(n=n.first,(o&Qr)!==0&&(o&cg)!==0&&n!==null&&(n.f|=cg))}if(n!==null&&(n.parent=t,t!==null&&eW(n,t),rn!==null&&(rn.f&Ys)!==0&&(o&Ic)===0)){var s=rn;(s.effects??(s.effects=[])).push(n)}return i}function u1(){return rn!==null&&!ea}function g1(o){const e=Dl(yy,null);return vs(e,As),e.teardown=o,e}function An(o){QH();var e=ln.f,t=!rn&&(e&ia)!==0&&Xs!==null&&!Xs.i;if(t){var i=Xs;(i.e??(i.e=[])).push(o)}else return dT(o)}function dT(o){return Dl(lg|YF,o)}function tW(o){ah.ensure();const e=Dl(Ic|Ag,o);return(t={})=>new Promise(i=>{t.outro?gd(e,()=>{Wo(e),i(void 0)}):(Wo(e),i(void 0))})}function f1(o){return Dl(lg,o)}function iW(o){return Dl(Pu|Ag,o)}function Cy(o,e=0){return Dl(yy|e,o)}function G(o,e=[],t=[],i=[]){VH(i,e,t,n=>{Dl(yy,()=>o(...n.map(u)))})}function p1(o,e=0){var t=Dl(Qr|e,o);return t}function vr(o){return Dl(ia|Ag,o)}function hT(o){var e=o.teardown;if(e!==null){const t=bl,i=rn;Dk(!0),Dr(null);try{e.call(null)}finally{Dk(t),Dr(i)}}}function m1(o,e=!1){var t=o.first;for(o.first=o.last=null;t!==null;){const n=t.ac;n!==null&&Sy(()=>{n.abort(wy)});var i=t.next;(t.f&Ic)!==0?t.parent=null:Wo(t,e),t=i}}function nW(o){for(var e=o.first;e!==null;){var t=e.next;(e.f&ia)===0&&Wo(e),e=t}}function Wo(o,e=!0){var t=!1;(e||(o.f&XF)!==0)&&o.nodes!==null&&o.nodes.end!==null&&(uT(o.nodes.start,o.nodes.end),t=!0),vs(o,yS),m1(o,e&&!t),lp(o,0);var i=o.nodes&&o.nodes.t;if(i!==null)for(const s of i)s.stop();hT(o),o.f^=yS,o.f|=Lr;var n=o.parent;n!==null&&n.first!==null&&gT(o),o.next=o.prev=o.teardown=o.ctx=o.deps=o.fn=o.nodes=o.ac=o.b=null}function uT(o,e){for(;o!==null;){var t=o===e?null:am(o);o.remove(),o=t}}function gT(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 gd(o,e,t=!0){var i=[];fT(o,i,!0);var n=()=>{t&&Wo(o),e&&e()},s=i.length;if(s>0){var r=()=>--s||n();for(var a of i)a.out(r)}else n()}function fT(o,e,t){if((o.f&wo)===0){o.f^=wo;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&Ic)===0){var r=(n.f&cg)!==0||(n.f&ia)!==0&&(o.f&Qr)!==0;fT(n,e,r?t:!1)}n=s}}}function J_(o){pT(o,!0)}function pT(o,e){if((o.f&wo)!==0){o.f^=wo,(o.f&As)===0&&(vs(o,Vs),ah.ensure().schedule(o));for(var t=o.first;t!==null;){var i=t.next,n=(t.f&cg)!==0||(t.f&ia)!==0;pT(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 _1(o,e){if(o.nodes)for(var t=o.nodes.start,i=o.nodes.end;t!==null;){var n=t===i?null:am(t);e.append(t),t=n}}let y_=!1,bl=!1;function Dk(o){bl=o}let rn=null,ea=!1;function Dr(o){rn=o}let ln=null;function Ba(o){ln=o}let Aa=null;function mT(o){rn!==null&&(Aa??(Aa=new Set)).add(o)}let Mo=null,Go=0,fr=null;function sW(o){fr=o}let _T=1,Qc=0,fd=Qc;function Ek(o){fd=o}function vT(){return++_T}function lm(o){var e=o.f;if((e&Vs)!==0)return!0;if(e&Ys&&(o.f&=~rh),(e&Wa)!==0){for(var t=o.deps,i=t.length,n=0;n<i;n++){var s=t[n];if(lm(s)&&eT(s),s.wv>o.wv)return!0}(e&xr)!==0&&qs===null&&vs(o,As)}return!1}function bT(o,e,t=!0){var i=o.reactions;if(i!==null&&!(Aa!==null&&Aa.has(o)))for(var n=0;n<i.length;n++){var s=i[n];(s.f&Ys)!==0?bT(s,e,!1):e===s&&(t?vs(s,Vs):(s.f&As)!==0&&vs(s,Wa),l1(s))}}function yT(o){var w;var e=Mo,t=Go,i=fr,n=rn,s=Aa,r=Xs,a=ea,c=fd,h=o.f;Mo=null,Go=0,fr=null,rn=(h&(ia|Ic))===0?o:null,Aa=null,dg(o.ctx),ea=!1,fd=++Qc,o.ac!==null&&(Sy(()=>{o.ac.abort(wy)}),o.ac=null);try{o.f|=Z_;var g=o.fn,f=g();o.f|=Rg;var p=o.deps,v=hi==null?void 0:hi.is_fork;if(Mo!==null){var _;if(v||lp(o,Go),p!==null&&Go>0)for(p.length=Go+Mo.length,_=0;_<Mo.length;_++)p[Go+_]=Mo[_];else o.deps=p=Mo;if(u1()&&(o.f&xr)!==0)for(_=Go;_<p.length;_++)((w=p[_]).reactions??(w.reactions=[])).push(o)}else!v&&p!==null&&Go<p.length&&(lp(o,Go),p.length=Go);if(jP()&&fr!==null&&!ea&&p!==null&&(o.f&(Ys|Wa|Vs))===0)for(_=0;_<fr.length;_++)bT(fr[_],o);if(n!==null&&n!==o){if(Qc++,n.deps!==null)for(let S=0;S<t;S+=1)n.deps[S].rv=Qc;if(e!==null)for(const S of e)S.rv=Qc;fr!==null&&(i===null?i=fr:i.push(...fr))}return(o.f&oc)!==0&&(o.f^=oc),f}catch(S){return $P(S)}finally{o.f^=Z_,Mo=e,Go=t,fr=i,rn=n,Aa=s,dg(r),ea=a,fd=c}}function oW(o,e){let t=e.reactions;if(t!==null){var i=jF.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&Ys)!==0&&(Mo===null||!K_.call(Mo,e))){var s=e;(s.f&xr)!==0&&(s.f^=xr,s.f&=~rh),s.v!==Ns&&r1(s),qH(s),lp(s,0)}}function lp(o,e){var t=o.deps;if(t!==null)for(var i=e;i<t.length;i++)oW(o,t[i])}function ug(o){var e=o.f;if((e&Lr)===0){vs(o,As);var t=ln,i=y_;ln=o,y_=!0;try{(e&(Qr|FP))!==0?nW(o):m1(o),hT(o);var n=yT(o);o.teardown=typeof n=="function"?n:null,o.wv=_T;var s;RP&&IH&&(o.f&Vs)!==0&&o.deps}finally{y_=i,ln=t}}}async function w_(){await Promise.resolve(),NH()}function u(o){var e=o.f,t=(e&Ys)!==0;if(rn!==null&&!ea){var i=ln!==null&&(ln.f&Lr)!==0;if(!i&&(Aa===null||!Aa.has(o))){var n=rn.deps;if((rn.f&Z_)!==0)o.rv<Qc&&(o.rv=Qc,Mo===null&&n!==null&&n[Go]===o?Go++:Mo===null?Mo=[o]:Mo.push(o));else{rn.deps??(rn.deps=[]),K_.call(rn.deps,o)||rn.deps.push(o);var s=o.reactions;s===null?o.reactions=[rn]:K_.call(s,rn)||s.push(rn)}}}if(bl&&hd.has(o))return hd.get(o);if(t){var r=o;if(bl){var a=r.v;return((r.f&As)===0&&r.reactions!==null||ST(r))&&(a=d1(r)),hd.set(r,a),a}var c=(r.f&xr)===0&&!ea&&rn!==null&&(y_||(rn.f&xr)!==0),h=(r.f&Rg)===0;lm(r)&&(c&&(r.f|=xr),eT(r)),c&&!h&&(tT(r),wT(r))}if(qs!=null&&qs.has(o))return qs.get(o);if((o.f&oc)!==0)throw o.v;return o.v}function wT(o){if(o.f|=xr,o.deps!==null)for(const e of o.deps)(e.reactions??(e.reactions=[])).push(o),(e.f&Ys)!==0&&(e.f&xr)===0&&(tT(e),wT(e))}function ST(o){if(o.v===Ns)return!0;if(o.deps===null)return!1;for(const e of o.deps)if(hd.has(e)||(e.f&Ys)!==0&&ST(e))return!0;return!1}function El(o){var e=ea;try{return ea=!0,o()}finally{ea=e}}const rW=["touchstart","touchmove"];function aW(o){return rW.includes(o)}const ed=Symbol("events"),CT=new Set,ES=new Set;function lW(o,e,t,i={}){function n(s){if(i.capture||PS.call(e,s),!s.cancelBubble)return Sy(()=>t==null?void 0:t.call(this,s))}return o.startsWith("pointer")||o.startsWith("touch")||o==="wheel"?rc(()=>{e.addEventListener(o,n,i)}):e.addEventListener(o,n,i),n}function ls(o,e,t,i,n){var s={capture:i,passive:n},r=lW(o,e,t,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&g1(()=>{e.removeEventListener(o,r,s)})}function Q(o,e,t){(e[ed]??(e[ed]={}))[o]=t}function Tr(o){for(var e=0;e<o.length;e++)CT.add(o[e]);for(var t of ES)t(o)}let Pk=null;function PS(o){var w,S;var e=this,t=e.ownerDocument,i=o.type,n=((w=o.composedPath)==null?void 0:w.call(o))||[],s=n[0]||o.target;Pk=o;var r=0,a=Pk===o&&o[ed];if(a){var c=n.indexOf(a);if(c!==-1&&(e===document||e===window)){o[ed]=e;return}var h=n.indexOf(e);if(h===-1)return;c<=h&&(r=c)}if(s=n[r]||o.target,s!==e){UF(o,"currentTarget",{configurable:!0,get(){return s||t}});var g=rn,f=ln;Dr(null),Ba(null);try{for(var p,v=[];s!==null&&s!==e;){try{var _=(S=s[ed])==null?void 0:S[i];_!=null&&(!s.disabled||o.target===s)&&_.call(s,o)}catch(D){p?v.push(D):p=D}if(o.cancelBubble)break;r++,s=r<n.length?n[r]:null}if(p){for(let D of v)queueMicrotask(()=>{throw D});throw p}}finally{o[ed]=e,delete o.currentTarget,Dr(g),Ba(f)}}}var nE;const fw=((nE=globalThis==null?void 0:globalThis.window)==null?void 0:nE.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:o=>o});function cW(o){return(fw==null?void 0:fw.createHTML(o))??o}function xT(o){var e=cT("template");return e.innerHTML=cW(o.replaceAll("<!>","<!---->")),e.content}function ch(o,e){var t=ln;t.nodes===null&&(t.nodes={start:o,end:e,a:null,t:null})}function N(o,e){var t=(e&bH)!==0,i=(e&yH)!==0,n,s=!o.startsWith("<!>");return()=>{n===void 0&&(n=xT(s?o:"<!>"+o),t||(n=Pa(n)));var r=i||oT?document.importNode(n,!0):n.cloneNode(!0);if(t){var a=Pa(r),c=r.lastChild;ch(a,c)}else ch(r,r);return r}}function dW(o,e,t="svg"){var i=!o.startsWith("<!>"),n=`<${t}>${i?o:"<!>"+o}</${t}>`,s;return()=>{if(!s){var r=xT(n),a=Pa(r);s=Pa(a)}var c=s.cloneNode(!0);return ch(c,c),c}}function LT(o,e){return dW(o,e,"svg")}function ta(o=""){{var e=hl(o+"");return ch(e,e),e}}function js(){var o=document.createDocumentFragment(),e=document.createComment(""),t=hl();return o.append(e,t),ch(e,t),o}function T(o,e){o!==null&&o.before(e)}function $(o,e){var t=e==null?"":typeof e=="object"?`${e}`:e;t!==(o[gf]??(o[gf]=o.nodeValue))&&(o[gf]=t,o.nodeValue=`${t}`)}function hW(o,e){return uW(o,e)}const Fm=new Map;function uW(o,{target:e,anchor:t,props:i={},events:n,context:s,intro:r=!0,transformError:a}){XH();var c=void 0,h=tW(()=>{var g=t??e.appendChild(hl());FH(g,{pending:()=>{}},v=>{Vo({});var _=Xs;s&&(_.c=s),n&&(i.$$events=n),c=o(v,i)||{},jo()},a);var f=new Set,p=v=>{for(var _=0;_<v.length;_++){var w=v[_];if(!f.has(w)){f.add(w);var S=aW(w);for(const R of[e,document]){var D=Fm.get(R);D===void 0&&(D=new Map,Fm.set(R,D));var E=D.get(w);E===void 0?(R.addEventListener(w,PS,{passive:S}),D.set(w,1)):D.set(w,E+1)}}}};return p(vy(CT)),ES.add(p),()=>{var S;for(var v of f)for(const D of[e,document]){var _=Fm.get(D),w=_.get(v);--w==0?(D.removeEventListener(v,PS),_.delete(v),_.size===0&&Fm.delete(D)):_.set(v,w)}ES.delete(p),g!==t&&((S=g.parentNode)==null||S.removeChild(g))}});return gW.set(c,h),c}let gW=new WeakMap;var jr,Sa,Yo,rd,zp,Vp,ab;class fW{constructor(e,t=!0){ji(this,"anchor");Mi(this,jr,new Map);Mi(this,Sa,new Map);Mi(this,Yo,new Map);Mi(this,rd,new Set);Mi(this,zp,!0);Mi(this,Vp,e=>{if(te(this,jr).has(e)){var t=te(this,jr).get(e),i=te(this,Sa).get(t);if(i)J_(i),te(this,rd).delete(t);else{var n=te(this,Yo).get(t);n&&(J_(n.effect),te(this,Sa).set(t,n.effect),te(this,Yo).delete(t),n.fragment.lastChild.remove(),this.anchor.before(n.fragment),i=n.effect)}for(const[s,r]of te(this,jr)){if(te(this,jr).delete(s),s===e)break;const a=te(this,Yo).get(r);a&&(Wo(a.effect),te(this,Yo).delete(r))}for(const[s,r]of te(this,Sa)){if(s===t||te(this,rd).has(s))continue;const a=()=>{if(Array.from(te(this,jr).values()).includes(s)){var h=document.createDocumentFragment();_1(r,h),h.append(hl()),te(this,Yo).set(s,{effect:r,fragment:h})}else Wo(r);te(this,rd).delete(s),te(this,Sa).delete(s)};te(this,zp)||!i?(te(this,rd).add(s),gd(r,a,!1)):a()}}});Mi(this,ab,e=>{te(this,jr).delete(e);const t=Array.from(te(this,jr).values());for(const[i,n]of te(this,Yo))t.includes(i)||(Wo(n.effect),te(this,Yo).delete(i))});this.anchor=e,Ni(this,zp,t)}ensure(e,t){var i=hi,n=lT();if(t&&!te(this,Sa).has(e)&&!te(this,Yo).has(e))if(n){var s=document.createDocumentFragment(),r=hl();s.append(r),te(this,Yo).set(e,{effect:vr(()=>t(r)),fragment:s})}else te(this,Sa).set(e,vr(()=>t(this.anchor)));if(te(this,jr).set(i,e),n){for(const[a,c]of te(this,Sa))a===e?i.unskip_effect(c):i.skip_effect(c);for(const[a,c]of te(this,Yo))a===e?i.unskip_effect(c.effect):i.skip_effect(c.effect);i.oncommit(te(this,Vp)),i.ondiscard(te(this,ab))}else te(this,Vp).call(this,i)}}jr=new WeakMap,Sa=new WeakMap,Yo=new WeakMap,rd=new WeakMap,zp=new WeakMap,Vp=new WeakMap,ab=new WeakMap;function U(o,e,t=!1){var i=new fW(o),n=t?cg:0;function s(r,a){i.ensure(r,a)}p1(()=>{var r=!1;e((a,c=0)=>{r=!0,s(c,a)}),r||s(-1,null)},n)}function Dn(o,e){return e}function pW(o,e,t){for(var i=[],n=e.length,s,r=e.length,a=0;a<n;a++){let f=e[a];gd(f,()=>{if(s){if(s.pending.delete(f),s.done.add(f),s.pending.size===0){var p=o.outrogroups;TS(o,vy(s.done)),p.delete(s),p.size===0&&(o.outrogroups=null)}}else r-=1},!1)}if(r===0){var c=i.length===0&&t!==null;if(c){var h=t,g=h.parentNode;YH(g),g.append(h),o.items.clear()}TS(o,e,!c)}else s={pending:new Set(e),done:new Set},(o.outrogroups??(o.outrogroups=new Set)).add(s)}function TS(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|=Ea;const r=document.createDocumentFragment();_1(s,r)}else Wo(e[n],t)}}var Tk;function di(o,e,t,i,n,s=null){var r=o,a=new Map,c=(e&WP)!==0;if(c){var h=o;r=h.appendChild(hl())}var g=null,f=c1(()=>{var R=t();return o1(R)?R:R==null?[]:vy(R)}),p,v=new Map,_=!0;function w(R){(E.effect.f&Lr)===0&&(E.pending.delete(R),E.fallback=g,mW(E,p,r,e,i),g!==null&&(p.length===0?(g.f&Ea)===0?J_(g):(g.f^=Ea,mf(g,null,r)):gd(g,()=>{g=null})))}function S(R){E.pending.delete(R)}var D=p1(()=>{p=u(f);for(var R=p.length,z=new Set,H=hi,ee=lT(),X=0;X<R;X+=1){var me=p[X],Le=i(me,X),je=_?null:a.get(Le);je?(je.v&&hg(je.v,me),je.i&&hg(je.i,X),ee&&H.unskip_effect(je.e)):(je=_W(a,_?r:Tk??(Tk=hl()),me,Le,X,n,e,t),_||(je.e.f|=Ea),a.set(Le,je)),z.add(Le)}if(R===0&&s&&!g&&(_?g=vr(()=>s(r)):(g=vr(()=>s(Tk??(Tk=hl()))),g.f|=Ea)),R>z.size&&tH(),!_)if(v.set(H,z),ee){for(const[Ce,mt]of a)z.has(Ce)||H.skip_effect(mt.e);H.oncommit(w),H.ondiscard(S)}else w(H);u(f)}),E={effect:D,items:a,pending:v,outrogroups:null,fallback:g};_=!1}function nf(o){for(;o!==null&&(o.f&ia)===0;)o=o.next;return o}function mW(o,e,t,i,n){var je,Ce,mt,Lt,ct,li,zt,ei,qe;var s=(i&gH)!==0,r=e.length,a=o.items,c=nf(o.effect.first),h,g=null,f,p=[],v=[],_,w,S,D;if(s)for(D=0;D<r;D+=1)_=e[D],w=n(_,D),S=a.get(w).e,(S.f&Ea)===0&&((Ce=(je=S.nodes)==null?void 0:je.a)==null||Ce.measure(),(f??(f=new Set)).add(S));for(D=0;D<r;D+=1){if(_=e[D],w=n(_,D),S=a.get(w).e,o.outrogroups!==null)for(const Ye of o.outrogroups)Ye.pending.delete(S),Ye.done.delete(S);if((S.f&wo)!==0&&(J_(S),s&&((Lt=(mt=S.nodes)==null?void 0:mt.a)==null||Lt.unfix(),(f??(f=new Set)).delete(S))),(S.f&Ea)!==0)if(S.f^=Ea,S===c)mf(S,null,t);else{var E=g?g.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),Ol(o,g,S),Ol(o,S,E),mf(S,E,t),g=S,p=[],v=[],c=nf(g.next);continue}if(S!==c){if(h!==void 0&&h.has(S)){if(p.length<v.length){var R=v[0],z;g=R.prev;var H=p[0],ee=p[p.length-1];for(z=0;z<p.length;z+=1)mf(p[z],R,t);for(z=0;z<v.length;z+=1)h.delete(v[z]);Ol(o,H.prev,ee.next),Ol(o,g,H),Ol(o,ee,R),c=R,g=ee,D-=1,p=[],v=[]}else h.delete(S),mf(S,c,t),Ol(o,S.prev,S.next),Ol(o,S,g===null?o.effect.first:g.next),Ol(o,g,S),g=S;continue}for(p=[],v=[];c!==null&&c!==S;)(h??(h=new Set)).add(c),v.push(c),c=nf(c.next);if(c===null)continue}(S.f&Ea)===0&&p.push(S),g=S,c=nf(S.next)}if(o.outrogroups!==null){for(const Ye of o.outrogroups)Ye.pending.size===0&&(TS(o,vy(Ye.done)),(ct=o.outrogroups)==null||ct.delete(Ye));o.outrogroups.size===0&&(o.outrogroups=null)}if(c!==null||h!==void 0){var X=[];if(h!==void 0)for(S of h)(S.f&wo)===0&&X.push(S);for(;c!==null;)(c.f&wo)===0&&c!==o.fallback&&X.push(c),c=nf(c.next);var me=X.length;if(me>0){var Le=(i&WP)!==0&&r===0?t:null;if(s){for(D=0;D<me;D+=1)(zt=(li=X[D].nodes)==null?void 0:li.a)==null||zt.measure();for(D=0;D<me;D+=1)(qe=(ei=X[D].nodes)==null?void 0:ei.a)==null||qe.fix()}pW(o,X,Le)}}s&&rc(()=>{var Ye,Ne;if(f!==void 0)for(S of f)(Ne=(Ye=S.nodes)==null?void 0:Ye.a)==null||Ne.apply()})}function _W(o,e,t,i,n,s,r,a){var c=(r&hH)!==0?(r&fH)===0?KH(t,!1,!1):lh(t):null,h=(r&uH)!==0?lh(n):null;return{v:c,i:h,e:vr(()=>(s(e,c??t,h??n,a),()=>{o.delete(i)}))}}function mf(o,e,t){if(o.nodes)for(var i=o.nodes.start,n=o.nodes.end,s=e&&(e.f&Ea)===0?e.nodes.start:t;i!==null;){var r=am(i);if(s.before(i),i===n)return;i=r}}function Ol(o,e,t){e===null?o.effect.first=t:e.next=t,t===null?o.effect.last=e:t.prev=e}function Ql(o,e,t=!1,i=!1,n=!1,s=!1){var r=o,a="";if(t)var c=o;G(()=>{var h=ln;if(a!==(a=e()??"")){if(t){h.nodes=null,c.innerHTML=a,a!==""&&ch(Pa(c),c.lastChild);return}if(h.nodes!==null&&(uT(h.nodes.start,h.nodes.end),h.nodes=null),a!==""){var g=i?wH:n?SH:void 0,f=cT(i?"svg":n?"math":"template",g);f.innerHTML=a;var p=i||n?f:f.content;if(ch(Pa(p),p.lastChild),i||n)for(;Pa(p);)r.before(Pa(p));else r.before(p)}}})}const Mk=[...`
3
+ \r\f \v\uFEFF`];function vW(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||Mk.includes(i[r-1]))&&(a===i.length||Mk.includes(i[a]))?i=(r===0?"":i.substring(0,r))+i.substring(a+1):r=a}}return i===""?null:i}function Nk(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 pw(o){return o[0]!=="-"||o[1]!=="-"?o.toLowerCase():o}function bW(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(pw)),n&&c.push(...Object.keys(n).map(pw));var h=0,g=-1;const w=o.length;for(var f=0;f<w;f++){var p=o[f];if(a?p==="/"&&o[f-1]==="*"&&(a=!1):s?s===p&&(s=!1):p==="/"&&o[f+1]==="*"?a=!0:p==='"'||p==="'"?s=p:p==="("?r++:p===")"&&r--,!a&&s===!1&&r===0){if(p===":"&&g===-1)g=f;else if(p===";"||f===w-1){if(g!==-1){var v=pw(o.substring(h,g).trim());if(!c.includes(v)){p!==";"&&f++;var _=o.substring(h,f).trim();t+=" "+_+";"}}h=f+1,g=-1}}}}return i&&(t+=Nk(i)),n&&(t+=Nk(n,!0)),t=t.trim(),t===""?null:t}return o==null?null:String(o)}function Zt(o,e,t,i,n,s){var r=o[wS];if(r!==t||r===void 0){var a=vW(t,i,s);a==null?o.removeAttribute("class"):e?o.className=a:o.setAttribute("class",a),o[wS]=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 mw(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 Ro(o,e,t,i){var n=o[SS];if(n!==e){var s=bW(e,i);s==null?o.removeAttribute("style"):o.style.cssText=s,o[SS]=e}else i&&(Array.isArray(i)?(mw(o,t==null?void 0:t[0],i[0]),mw(o,t==null?void 0:t[1],i[1],"important")):mw(o,t,i));return i}function kT(o,e,t=!1){if(o.multiple){if(e==null)return;if(!o1(e))return xH();for(var i of o.options)i.selected=e.includes(Af(i));return}for(i of o.options){var n=Af(i);if(ZH(n,e)){i.selected=!0;return}}(!t||e!==void 0)&&(o.selectedIndex=-1)}function yW(o){var e=new MutationObserver(()=>{kT(o,o.__value)});e.observe(o,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),g1(()=>{e.disconnect()})}function qr(o,e,t=e){var i=new WeakSet,n=!0;h1(o,"change",s=>{var r=s?"[selected]":":checked",a;if(o.multiple)a=[].map.call(o.querySelectorAll(r),Af);else{var c=o.querySelector(r)??o.querySelector("option:not([disabled])");a=c&&Af(c)}t(a),o.__value=a,hi!==null&&i.add(hi)}),f1(()=>{var s=e();if(o===document.activeElement){var r=hi;if(i.has(r))return}if(kT(o,s,n),n&&s===void 0){var a=o.querySelector(":checked");a!==null&&(s=Af(a),t(s))}o.__value=s,n=!1}),yW(o)}function Af(o){return"__value"in o?o.__value:o.value}const wW=Symbol("is custom element"),SW=Symbol("is html");function _w(o,e){var t=IT(o);t.checked!==(t.checked=e??void 0)&&(o.checked=e)}function pn(o,e,t,i){var n=IT(o);n[e]!==(n[e]=t)&&(e==="loading"&&(o[QF]=t),t==null?o.removeAttribute(e):typeof t!="string"&&CW(o).includes(e)?o[e]=t:o.setAttribute(e,t))}function IT(o){return o[p_]??(o[p_]={[wW]:o.nodeName.includes("-"),[SW]:o.namespaceURI===BP})}var Rk=new Map;function CW(o){var e=o.getAttribute("is")||o.nodeName,t=Rk.get(e);if(t)return t;Rk.set(e,t=[]);for(var i,n=o,s=Element.prototype;s!==n;){i=$F(n);for(var r in i)i[r].set&&r!=="innerHTML"&&r!=="textContent"&&r!=="innerText"&&t.push(r);n=AP(n)}return t}function Ci(o,e,t=e){var i=new WeakSet;h1(o,"input",async n=>{var s=n?o.defaultValue:o.value;if(s=vw(o)?bw(s):s,t(s),hi!==null&&i.add(hi),await w_(),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))}}}),El(e)==null&&o.value&&(t(vw(o)?bw(o.value):o.value),hi!==null&&i.add(hi)),Cy(()=>{var n=e();if(o===document.activeElement){var s=hi;if(i.has(s))return}vw(o)&&n===bw(o.value)||o.type==="date"&&!n&&!o.value||n!==o.value&&(o.value=n??"")})}function zs(o,e,t=e){h1(o,"change",i=>{var n=i?o.defaultChecked:o.checked;t(n)}),El(e)==null&&t(o.checked),Cy(()=>{var i=e();o.checked=!!i})}function vw(o){var e=o.type;return e==="number"||e==="range"}function bw(o){return o===""?null:+o}var Xl,zu,jp,lb,DT;const cb=class cb{constructor(e){Mi(this,lb);Mi(this,Xl,new WeakMap);Mi(this,zu);Mi(this,jp);Ni(this,jp,e)}observe(e,t){var i=te(this,Xl).get(e)||new Set;return i.add(t),te(this,Xl).set(e,i),In(this,lb,DT).call(this).observe(e,te(this,jp)),()=>{var n=te(this,Xl).get(e);n.delete(t),n.size===0&&(te(this,Xl).delete(e),te(this,zu).unobserve(e))}}};Xl=new WeakMap,zu=new WeakMap,jp=new WeakMap,lb=new WeakSet,DT=function(){return te(this,zu)??Ni(this,zu,new ResizeObserver(e=>{for(var t of e){cb.entries.set(t.target,t);for(var i of te(this,Xl).get(t.target)||[])i(t)}}))},ji(cb,"entries",new WeakMap);let MS=cb;var xW=new MS({box:"border-box"});function LW(o,e,t){var i=xW.observe(o,()=>t(o[e]));f1(()=>(El(()=>t(o[e])),i))}function yw(o,e){return o===e||(o==null?void 0:o[dd])===e}function Ls(o={},e,t,i){var n=Xs.r,s=ln;return f1(()=>{var r,a;return Cy(()=>{r=a,a=[],El(()=>{yw(t(...a),o)||(e(o,...a),r&&yw(t(...r),o)&&e(null,...r))})}),()=>{let c=s;for(;c!==n&&c.parent!==null&&c.parent.f&yS;)c=c.parent;const h=()=>{a&&yw(t(...a),o)&&e(null,...a)},g=c.teardown;c.teardown=()=>{h(),g==null||g()}}}),o}function gg(o,e,t,i){var z;var n=!0,s=(t&_H)!==0,r=(t&vH)!==0,a=i,c=!0,h=void 0,g=()=>r&&n?(h??(h=ap(i)),u(h)):(c&&(c=!1,a=r?El(i):i),a);let f;if(s){var p=dd in o||JF in o;f=((z=Eu(o,e))==null?void 0:z.set)??(p&&e in o?H=>o[e]=H:void 0)}var v,_=!1;s?[v,_]=PH(()=>o[e]):v=o[e],v===void 0&&i!==void 0&&(v=g(),f&&(rH(),f(v)));var w;if(w=()=>{var H=o[e];return H===void 0?g():(c=!0,H)},(t&mH)===0)return w;if(f){var S=o.$$legacy;return(function(H,ee){return arguments.length>0?((!ee||S||_)&&f(ee?w():H),H):w()})}var D=!1,E=((t&pH)!==0?ap:c1)(()=>(D=!1,w()));s&&u(E);var R=ln;return(function(H,ee){if(arguments.length>0){const X=ee?u(E):s?mi(H):H;return k(E,X),D=!0,a!==void 0&&(a=X),H}return bl&&D||(R.f&Lr)!==0?E.v:u(E)})}function Mr(o){Xs===null&&HP(),An(()=>{const e=El(o);if(typeof e=="function")return e})}function xy(o){Xs===null&&HP(),Mr(()=>()=>El(o))}const kW="5";var sE;typeof window<"u"&&((sE=window.__svelte??(window.__svelte={})).v??(sE.v=new Set)).add(kW);/*!-----------------------------------------------------------------------------
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 IW=Object.defineProperty,DW=Object.getOwnPropertyDescriptor,EW=Object.getOwnPropertyNames,PW=Object.prototype.hasOwnProperty,TW=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of EW(e))!PW.call(o,n)&&n!==t&&IW(o,n,{get:()=>e[n],enumerable:!(i=DW(e,n))||i.enumerable});return o},MW=(o,e,t)=>(TW(o,e,"default"),t),cm={};MW(cm,rE);var NW=class{constructor(e,t,i){this._onDidChange=new cm.Emitter,this._languageId=e,this.setDiagnosticsOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}},RW={validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:"warning",schemaValidation:"warning",comments:"error",trailingCommas:"error"},AW={documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0},ET=new NW("json",RW,AW),OW=()=>PT().then(o=>o.getWorker());cm.languages.json={jsonDefaults:ET,getWorker:OW};function PT(){return oE(()=>import("./jsonMode-CXWNuhmR.js"),__vite__mapDeps([0,1,2]))}cm.languages.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]});cm.languages.onLanguage("json",()=>{PT().then(o=>o.setupMode(ET))});/*!-----------------------------------------------------------------------------
9
+ * Copyright (c) Microsoft Corporation. All rights reserved.
10
+ * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
11
+ * Released under the MIT license
12
+ * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
13
+ *-----------------------------------------------------------------------------*/var FW=Object.defineProperty,HW=Object.getOwnPropertyDescriptor,WW=Object.getOwnPropertyNames,BW=Object.prototype.hasOwnProperty,zW=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of WW(e))!BW.call(o,n)&&n!==t&&FW(o,n,{get:()=>e[n],enumerable:!(i=HW(e,n))||i.enumerable});return o},VW=(o,e,t)=>(zW(o,e,"default"),t),jW="5.4.5",fg={};VW(fg,rE);var TT=(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))(TT||{}),MT=(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))(MT||{}),NT=(o=>(o[o.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",o[o.LineFeed=1]="LineFeed",o))(NT||{}),RT=(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))(RT||{}),AT=(o=>(o[o.Classic=1]="Classic",o[o.NodeJs=2]="NodeJs",o))(AT||{}),OT=class{constructor(o,e,t,i,n){this._onDidChange=new fg.Emitter,this._onDidExtraLibsChange=new fg.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)}},UW=jW,FT={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},HT=new OT({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},FT),WT=new OT({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},FT),$W=()=>Ly().then(o=>o.getTypeScriptWorker()),qW=()=>Ly().then(o=>o.getJavaScriptWorker());fg.languages.typescript={ModuleKind:TT,JsxEmit:MT,NewLineKind:NT,ScriptTarget:RT,ModuleResolutionKind:AT,typescriptVersion:UW,typescriptDefaults:HT,javascriptDefaults:WT,getTypeScriptWorker:$W,getJavaScriptWorker:qW};function Ly(){return oE(()=>import("./tsMode-Z6Sa7F80.js"),__vite__mapDeps([3,1,2]))}fg.languages.onLanguage("typescript",()=>Ly().then(o=>o.setupTypeScript(HT)));fg.languages.onLanguage("javascript",()=>Ly().then(o=>o.setupJavaScript(WT)));class KW extends uo{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:kt("toggleCollapseUnchangedRegions","Toggle Collapse Unchanged Regions"),icon:Qt.map,toggled:le.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:le.has("isInDiffEditor"),menu:{when:le.has("isInDiffEditor"),id:lt.EditorTitle,order:22,group:"navigation"}})}run(e,...t){const i=e.get(Tn),n=!i.getValue("diffEditor.hideUnchangedRegions.enabled");i.updateValue("diffEditor.hideUnchangedRegions.enabled",n)}}class BT extends uo{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:kt("toggleShowMovedCodeBlocks","Toggle Show Moved Code Blocks"),precondition:le.has("isInDiffEditor")})}run(e,...t){const i=e.get(Tn),n=!i.getValue("diffEditor.experimental.showMoves");i.updateValue("diffEditor.experimental.showMoves",n)}}class zT extends uo{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:kt("toggleUseInlineViewWhenSpaceIsLimited","Toggle Use Inline View When Space Is Limited"),precondition:le.has("isInDiffEditor")})}run(e,...t){const i=e.get(Tn),n=!i.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");i.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",n)}}const dm=kt("diffEditor","Diff Editor");class GW extends na{constructor(){super({id:"diffEditor.switchSide",title:kt("switchSide","Switch Side"),icon:Qt.arrowSwap,precondition:le.has("isInDiffEditor"),f1:!0,category:dm})}runEditorCommand(e,t,i){const n=Og(e);if(n instanceof Up){if(i&&i.dryRun)return{destinationSelection:n.mapToOtherSide().destinationSelection};n.switchSide()}}}class ZW extends na{constructor(){super({id:"diffEditor.exitCompareMove",title:kt("exitCompareMove","Exit Compare Move"),icon:Qt.close,precondition:M.comparingMovedCode,f1:!1,category:dm,keybinding:{weight:1e4,primary:9}})}runEditorCommand(e,t,...i){const n=Og(e);n instanceof Up&&n.exitCompareMove()}}class XW extends na{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:kt("collapseAllUnchangedRegions","Collapse All Unchanged Regions"),icon:Qt.fold,precondition:le.has("isInDiffEditor"),f1:!0,category:dm})}runEditorCommand(e,t,...i){const n=Og(e);n instanceof Up&&n.collapseAllUnchangedRegions()}}class YW extends na{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:kt("showAllUnchangedRegions","Show All Unchanged Regions"),icon:Qt.unfold,precondition:le.has("isInDiffEditor"),f1:!0,category:dm})}runEditorCommand(e,t,...i){const n=Og(e);n instanceof Up&&n.showAllUnchangedRegions()}}class NS extends uo{constructor(){super({id:"diffEditor.revert",title:kt("revert","Revert"),f1:!1,category:dm})}run(e,t){const i=JW(e,t.originalUri,t.modifiedUri);i instanceof Up&&i.revertRangeMappings(t.mapping.innerChanges??[])}}const VT=kt("accessibleDiffViewer","Accessible Diff Viewer"),db=class db extends uo{constructor(){super({id:db.id,title:kt("editor.action.accessibleDiffViewer.next","Go to Next Difference"),category:VT,precondition:le.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(e){const t=Og(e);t==null||t.accessibleDiffViewerNext()}};db.id="editor.action.accessibleDiffViewer.next";let cp=db;const hb=class hb extends uo{constructor(){super({id:hb.id,title:kt("editor.action.accessibleDiffViewer.prev","Go to Previous Difference"),category:VT,precondition:le.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(e){const t=Og(e);t==null||t.accessibleDiffViewerPrev()}};hb.id="editor.action.accessibleDiffViewer.prev";let Q_=hb;function JW(o,e,t){return o.get(os).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 Og(o){const t=o.get(os).listDiffEditors(),i=aE();if(i)for(const n of t){const s=n.getContainerDomNode();if(QW(s,i))return n}return null}function QW(o,e){let t=e;for(;t;){if(t===o)return!0;t=t.parentElement}return!1}cn(KW);cn(BT);cn(zT);kr.appendMenuItem(lt.EditorTitle,{command:{id:new zT().desc.id,title:y("useInlineViewWhenSpaceIsLimited","Use Inline View When Space Is Limited"),toggled:le.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:le.has("isInDiffEditor")},order:11,group:"1_diff",when:le.and(M.diffEditorRenderSideBySideInlineBreakpointReached,le.has("isInDiffEditor"))});kr.appendMenuItem(lt.EditorTitle,{command:{id:new BT().desc.id,title:y("showMoves","Show Moved Code Blocks"),icon:Qt.move,toggled:dA.create("config.diffEditor.experimental.showMoves",!0),precondition:le.has("isInDiffEditor")},order:10,group:"1_diff",when:le.has("isInDiffEditor")});cn(NS);for(const o of[{icon:Qt.arrowRight,key:M.diffEditorInlineMode.toNegated()},{icon:Qt.discard,key:M.diffEditorInlineMode}])kr.appendMenuItem(lt.DiffEditorHunkToolbar,{command:{id:new NS().desc.id,title:y("revertHunk","Revert Block"),icon:o.icon},when:le.and(M.diffEditorModifiedWritable,o.key),order:5,group:"primary"}),kr.appendMenuItem(lt.DiffEditorSelectionToolbar,{command:{id:new NS().desc.id,title:y("revertSelection","Revert Selection"),icon:o.icon},when:le.and(M.diffEditorModifiedWritable,o.key),order:5,group:"primary"});cn(GW);cn(ZW);cn(XW);cn(YW);kr.appendMenuItem(lt.EditorTitle,{command:{id:cp.id,title:y("Open Accessible Diff Viewer","Open Accessible Diff Viewer"),precondition:le.has("isInDiffEditor")},order:10,group:"2_diff",when:le.and(M.accessibleDiffViewerVisible.negate(),le.has("isInDiffEditor"))});Sn.registerCommandAlias("editor.action.diffReview.next",cp.id);cn(cp);Sn.registerCommandAlias("editor.action.diffReview.prev",Q_.id);cn(Q_);var e3=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},t3=function(o,e){return function(t,i){e(t,i,o)}},RS;const ky=new Ri("selectionAnchorSet",!1);var vd;let Dc=(vd=class{static get(e){return e.getContribution(RS.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=ky.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(Xt.fromPositions(e,e),{description:"selection-anchor",stickiness:1,hoverMessage:new $s().appendText(y("selectionAnchor","Selection Anchor")),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),Ir(y("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(Xt.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()}},RS=vd,vd.ID="editor.contrib.selectionAnchorController",vd);Dc=RS=e3([t3(1,$i)],Dc);class i3 extends Se{constructor(){super({id:"editor.action.setSelectionAnchor",label:y("setSelectionAnchor","Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:cs(2089,2080),weight:100}})}async run(e,t){var i;(i=Dc.get(t))==null||i.setSelectionAnchor()}}class n3 extends Se{constructor(){super({id:"editor.action.goToSelectionAnchor",label:y("goToSelectionAnchor","Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:ky})}async run(e,t){var i;(i=Dc.get(t))==null||i.goToSelectionAnchor()}}class s3 extends Se{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:y("selectFromAnchorToCursor","Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:ky,kbOpts:{kbExpr:M.editorTextFocus,primary:cs(2089,2089),weight:100}})}async run(e,t){var i;(i=Dc.get(t))==null||i.selectFromAnchorToCursor()}}class o3 extends Se{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:y("cancelSelectionAnchor","Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:ky,kbOpts:{kbExpr:M.editorTextFocus,primary:9,weight:100}})}async run(e,t){var i;(i=Dc.get(t))==null||i.cancelSelectionAnchor()}}_i(Dc.ID,Dc,4);se(i3);se(n3);se(s3);se(o3);const r3=St("editorOverviewRuler.bracketMatchForeground","#A0A0A0",y("overviewRulerBracketMatchForeground","Overview ruler marker color for matching brackets."));class a3 extends Se{constructor(){super({id:"editor.action.jumpToBracket",label:y("smartSelect.jumpBracket","Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:3165,weight:100}})}run(e,t){var i;(i=dh.get(t))==null||i.jumpToBracket()}}class l3 extends Se{constructor(){super({id:"editor.action.selectToBracket",label:y("smartSelect.selectToBracket","Select to Bracket"),alias:"Select to Bracket",precondition:void 0,metadata:{description:kt("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=dh.get(t))==null||s.selectToBracket(n)}}class c3 extends Se{constructor(){super({id:"editor.action.removeBrackets",label:y("smartSelect.removeBrackets","Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:2561,weight:100}})}run(e,t){var i;(i=dh.get(t))==null||i.removeBrackets(this.id)}}class d3{constructor(e,t,i){this.position=e,this.brackets=t,this.options=i}}const jl=class jl extends Ve{static get(e){return e.getContribution(jl.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new ms(()=>this._updateBrackets(),50)),this._matchBrackets=this._editor.getOption(72),this._updateBracketsSoon.schedule(),this._register(e.onDidChangeCursorPosition(t=>{this._matchBrackets!=="never"&&this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelContent(t=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModel(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelLanguageConfiguration(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeConfiguration(t=>{t.hasChanged(72)&&(this._matchBrackets=this._editor.getOption(72),this._decorations.clear(),this._lastBracketsData=[],this._lastVersionId=0,this._updateBracketsSoon.schedule())})),this._register(e.onDidBlurEditorWidget(()=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidFocusEditorWidget(()=>{this._updateBracketsSoon.schedule()}))}jumpToBracket(){if(!this._editor.hasModel())return;const e=this._editor.getModel(),t=this._editor.getSelections().map(i=>{const n=i.getStartPosition(),s=e.bracketPairs.matchBracket(n);let r=null;if(s)s[0].containsPosition(n)&&!s[1].containsPosition(n)?r=s[1].getStartPosition():s[1].containsPosition(n)&&(r=s[0].getStartPosition());else{const a=e.bracketPairs.findEnclosingBrackets(n);if(a)r=a[1].getStartPosition();else{const c=e.bracketPairs.findNextBracket(n);c&&c.range&&(r=c.range.getStartPosition())}}return r?new Xt(r.lineNumber,r.column,r.lineNumber,r.column):new Xt(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(B.compareRangesUsingStarts);const[h,g]=r;if(a=e?h.getStartPosition():h.getEndPosition(),c=e?g.getEndPosition():g.getStartPosition(),g.containsPosition(s)){const f=a;a=c,c=f}}a&&c&&i.push(new Xt(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 f=0,p=e.length;f<p;f++){const v=e[f];v.isEmpty()&&(s[r++]=v.getStartPosition())}s.length>1&&s.sort(Dt.compare);const a=[];let c=0,h=0;const g=n.length;for(let f=0,p=s.length;f<p;f++){const v=s[f];for(;h<g&&n[h].position.isBefore(v);)h++;if(h<g&&n[h].position.equals(v))a[c++]=n[h];else{let _=t.bracketPairs.matchBracket(v,20),w=jl._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;!_&&this._matchBrackets==="always"&&(_=t.bracketPairs.findEnclosingBrackets(v,20),w=jl._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),a[c++]=new d3(v,_,w)}}this._lastBracketsData=a,this._lastVersionId=i}};jl.ID="editor.contrib.bracketMatchingController",jl._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=ki.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:hs(r3),position:Ma.Center}}),jl._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=ki.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"});let dh=jl;_i(dh.ID,dh,1);se(l3);se(a3);se(c3);kr.appendMenuItem(lt.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:y({key:"miGoToBracket",comment:["&& denotes a mnemonic"]},"Go to &&Bracket")},order:2});class h3{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 B(i,n-1,i,n),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new B(i,s,i,s),a)}else{const r=new B(i,s,i,s+1),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new B(i,n,i,n),a)}}computeCursorState(e,t){return this._isMovingLeft?new Xt(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new Xt(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class jT extends Se{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 h3(s,this.left));t.pushUndoStop(),t.executeCommands(this.id,i),t.pushUndoStop()}}class u3 extends jT{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:y("caret.moveLeft","Move Selected Text Left"),alias:"Move Selected Text Left",precondition:M.writable})}}class g3 extends jT{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:y("caret.moveRight","Move Selected Text Right"),alias:"Move Selected Text Right",precondition:M.writable})}}se(u3);se(g3);class f3 extends Se{constructor(){super({id:"editor.action.transposeLetters",label:y("transposeLetters.label","Transpose Letters"),alias:"Transpose Letters",precondition:M.writable,kbOpts:{kbExpr:M.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 g=c===h?r.getPosition():ow.rightPosition(i,r.getPosition().lineNumber,r.getPosition().column),f=ow.leftPosition(i,g),p=ow.leftPosition(i,f),v=i.getValueInRange(B.fromPositions(p,f)),_=i.getValueInRange(B.fromPositions(f,g)),w=B.fromPositions(p,g);n.push(new $p(w,_+v))}n.length>0&&(t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop())}}se(f3);const Iy=(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 v1(o){return{asString:async()=>o,asFile:()=>{},value:typeof o=="string"?o:void 0}}function p3(o,e,t){const i={id:Iy(),name:o,uri:e,data:t};return{asString:async()=>"",asFile:()=>i,value:void 0}}class UT{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 ll.some(this,([i,n])=>n.asFile())&&t.push("files"),qT(ev(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 ev(e)}}function ev(o){return o.toLowerCase()}function $T(o,e){return qT(ev(o),e.map(ev))}function qT(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 Dy=Object.freeze({create:o=>lE(o.map(e=>e.toString())).join(`\r
14
+ `),split:o=>o.split(`\r
15
+ `),parse:o=>Dy.split(o).filter(e=>!e.startsWith("#"))}),_a=class _a{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+_a.sep)}intersects(e){return this.contains(e)||e.contains(this)}append(...e){return new _a((this.value?[this.value,...e]:e).join(_a.sep))}};_a.sep=".",_a.None=new _a("@@none@@"),_a.Empty=new _a("");let Pn=_a;const Ak={EDITORS:"CodeEditors",FILES:"CodeFiles"};class m3{}const _3={DragAndDropContribution:"workbench.contributions.dragAndDrop"};sa.add(_3.DragAndDropContribution,new m3);const qf=class qf{constructor(){}static getInstance(){return qf.INSTANCE}hasData(e){return e&&e===this.proto}getData(e){if(this.hasData(e))return this.data}};qf.INSTANCE=new qf;let AS=qf;function KT(o){const e=new UT;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,v1(n))}else if(t.kind==="file"){const n=t.getAsFile();n&&e.append(i,v3(n))}}return e}function v3(o){const e=o.path?un.parse(o.path):void 0;return p3(o.name,e,async()=>new Uint8Array(await o.arrayBuffer()))}const b3=Object.freeze([Ak.EDITORS,Ak.FILES,sS.RESOURCES,sS.INTERNAL_URI_LIST]);function GT(o,e=!1){const t=KT(o),i=t.get(sS.INTERNAL_URI_LIST);if(i)t.replace(Ps.uriList,i);else if(e||!t.has(Ps.uriList)){const n=[];for(const s of o.items){const r=s.getAsFile();if(r){const a=r.path;try{a?n.push(un.file(a).toString()):n.push(un.parse(r.name,!0).toString())}catch{}}}n.length&&t.replace(Ps.uriList,v1(Dy.create(n)))}for(const n of b3)t.delete(n);return t}var b1=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},dp=function(o,e){return function(t,i){e(t,i,o)}};class y1{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 Kf=class Kf extends y1{constructor(){super(...arguments),this.kind=Kf.kind,this.dropMimeTypes=[Ps.text],this.pasteMimeTypes=[Ps.text]}async getEdit(e,t){const i=e.get(Ps.text);if(!i||e.has(Ps.uriList))return;const n=await i.asString();return{handledMimeType:Ps.text,title:y("text.label","Insert Plain Text"),insertText:n,kind:this.kind}}};Kf.id="text",Kf.kind=new Pn("text.plain");let hh=Kf;class ZT extends y1{constructor(){super(...arguments),this.kind=new Pn("uri.absolute"),this.dropMimeTypes=[Ps.uriList],this.pasteMimeTypes=[Ps.uriList]}async getEdit(e,t){const i=await XT(e);if(!i.length||t.isCancellationRequested)return;let n=0;const s=i.map(({uri:a,originalText:c})=>a.scheme===ro.file?a.fsPath:(n++,c)).join(" ");let r;return n>0?r=i.length>1?y("defaultDropProvider.uriList.uris","Insert Uris"):y("defaultDropProvider.uriList.uri","Insert Uri"):r=i.length>1?y("defaultDropProvider.uriList.paths","Insert Paths"):y("defaultDropProvider.uriList.path","Insert Path"),{handledMimeType:Ps.uriList,insertText:s,title:r,kind:this.kind}}}let tv=class extends y1{constructor(e){super(),this._workspaceContextService=e,this.kind=new Pn("uri.relative"),this.dropMimeTypes=[Ps.uriList],this.pasteMimeTypes=[Ps.uriList]}async getEdit(e,t){const i=await XT(e);if(!i.length||t.isCancellationRequested)return;const n=fl(i.map(({uri:s})=>{const r=this._workspaceContextService.getWorkspaceFolder(s);return r?hA(r.uri,s):void 0}));if(n.length)return{handledMimeType:Ps.uriList,insertText:n.join(" "),title:i.length>1?y("defaultDropProvider.uriList.relativePaths","Insert Relative Paths"):y("defaultDropProvider.uriList.relativePath","Insert Relative Path"),kind:this.kind}}};tv=b1([dp(0,Ju)],tv);class y3{constructor(){this.kind=new Pn("html"),this.pasteMimeTypes=["text/html"],this._yieldTo=[{mimeType:Ps.text}]}async provideDocumentPasteEdits(e,t,i,n,s){var c;if(n.triggerKind!==oS.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:y("pasteHtmlLabel","Insert HTML"),kind:this.kind}]}}}async function XT(o){const e=o.get(Ps.uriList);if(!e)return[];const t=await e.asString(),i=[];for(const n of Dy.parse(t))try{i.push({uri:un.parse(n),originalText:n})}catch{}return i}let OS=class extends Ve{constructor(e,t){super(),this._register(e.documentDropEditProvider.register("*",new hh)),this._register(e.documentDropEditProvider.register("*",new ZT)),this._register(e.documentDropEditProvider.register("*",new tv(t)))}};OS=b1([dp(0,Et),dp(1,Ju)],OS);let FS=class extends Ve{constructor(e,t){super(),this._register(e.documentPasteEditProvider.register("*",new hh)),this._register(e.documentPasteEditProvider.register("*",new ZT)),this._register(e.documentPasteEditProvider.register("*",new tv(t))),this._register(e.documentPasteEditProvider.register("*",new y3))}};FS=b1([dp(0,Et),dp(1,Ju)],FS);const dr=class dr{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=dr._table[i],typeof n=="number")return this.pos+=1,{type:n,pos:e,len:1};if(dr.isDigitCharacter(i)){n=8;do t+=1,i=this.value.charCodeAt(e+t);while(dr.isDigitCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}if(dr.isVariableCharacter(i)){n=9;do i=this.value.charCodeAt(e+ ++t);while(dr.isVariableCharacter(i)||dr.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 dr._table[i]>"u"&&!dr.isDigitCharacter(i)&&!dr.isVariableCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}};dr._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13};let HS=dr;class Fg{constructor(){this._children=[]}appendChild(e){return e instanceof yo&&this._children[this._children.length-1]instanceof yo?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 hm)return e;e=e.parent}}toString(){return this.children.reduce((e,t)=>e+t.toString(),"")}len(){return 0}}let yo=class YT extends Fg{constructor(e){super(),this.value=e}toString(){return this.value}len(){return this.value.length}clone(){return new YT(this.value)}};class JT extends Fg{}class tr extends JT{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 Hg?this._children[0]:void 0}clone(){const e=new tr(this.index);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}class Hg extends Fg{constructor(){super(...arguments),this.options=[]}appendChild(e){return e instanceof yo&&(e.parent=this,this.options.push(e)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const e=new Hg;return this.options.forEach(e.appendChild,e),e}}class w1 extends Fg{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 Ur&&!!s.elseValue)&&(n=this._replace([])),n}_replace(e){let t="";for(const i of this._children)if(i instanceof Ur){let n=e[i.index]||"";n=i.resolve(n),t+=n}else t+=i.toString();return t}toString(){return""}clone(){const e=new w1;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 Ur extends Fg{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 Ur(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class hp extends JT{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 yo(t)],!0):!1}clone(){const e=new hp(this.name);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}function Ok(o,e){const t=[...o];for(;t.length>0;){const i=t.shift();if(!e(i))break;t.unshift(...i.children)}}class hm extends Fg{get placeholderInfo(){if(!this._placeholders){const e=[];let t;this.walk(function(i){return i instanceof tr&&(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 Ok([e],i=>(t+=i.len(),!0)),t}enclosingPlaceholders(e){const t=[];let{parent:i}=e;for(;i;)i instanceof tr&&t.push(i),i=i.parent;return t}resolveVariables(e){return this.walk(t=>(t instanceof hp&&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 hm;return this._children=this.children.map(t=>t.clone()),e}walk(e){Ok(this.children,e)}}class uh{constructor(){this._scanner=new HS,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 hm;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 tr&&(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 g=n.get(c.index);if(!g)return;const f=new tr(c.index);f.transform=c.transform;for(const p of g){const v=p.clone();f.appendChild(v),v instanceof tr&&n.has(v.index)&&!h.has(v.index)&&(h.add(v.index),r(v,h),h.delete(v.index))}t.replace(c,[f])},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 tr(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 yo(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 tr(Number(t)):new hp(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 tr(Number(t));if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new yo("${"+t+":")),s.children.forEach(e.appendChild,e),!0}else if(s.index>0&&this._accept(7)){const r=new Hg;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 yo(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 hp(t);if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new yo("${"+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 w1;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 yo(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 Ur(Number(n))),!0;if(!this._accept(1))return this._backTo(t),!1}else return e.appendChild(new Ur(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 Ur(Number(n),s)),!0)}else if(this._accept(11)){const s=this._until(4);if(s)return e.appendChild(new Ur(Number(n),void 0,s,void 0)),!0}else if(this._accept(12)){const s=this._until(4);if(s)return e.appendChild(new Ur(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 Ur(Number(n),void 0,s,r)),!0}}else{const s=this._until(4);if(s)return e.appendChild(new Ur(Number(n),void 0,void 0,s)),!0}return this._backTo(t),!1}_parseAnything(e){return this._token.type!==14?(e.appendChild(new yo(this._scanner.tokenText(this._token))),this._accept(void 0),!0):!1}}function QT(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 uA(o,{range:s,text:typeof t.insertText=="string"?uh.escape(t.insertText)+"$0":t.insertText.snippet,insertAsSnippet:!0})),...((n=t.additionalEdit)==null?void 0:n.edits)??[]]}}function eM(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 w3=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},S3=function(o,e){return function(t,i){e(t,i,o)}};const C3=ki.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:cE,inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}}),ub=class ub extends Ve{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=yt(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=e;const t=yt("span.icon");this.domNode.append(t),t.classList.add(...Xi.asClassNameArray(Qt.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(Ui(this.domNode,jn.CLICK,n=>{this.delegate.cancel()}))}getId(){return ub.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)}};ub.baseId="editor.widget.inlineProgressWidget";let WS=ub,iv=class extends Ve{constructor(e,t,i){super(),this.id=e,this._editor=t,this._instantiationService=i,this._showDelay=500,this._showPromise=this._register(new Bo),this._currentWidget=this._register(new Bo),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=Xf(()=>{const a=B.fromPositions(e);this._currentDecorations.set([{range:a,options:C3}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(WS,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()}};iv=w3([S3(2,ai)],iv);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},Fk=function(o,e){return function(t,i){e(t,i,o)}},S_,lc;let So=(lc=class{static get(e){return e.getContribution(S_.ID)}constructor(e,t,i){this._openerService=i,this._messageWidget=new Bo,this._messageListeners=new Be,this._mouseOverMessage=!1,this._editor=e,this._visible=S_.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){Ir(d_(e)?e.value:e),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._message=d_(e)?gA(e,{actionHandler:{callback:n=>{this.closeMessage(),fA(this._openerService,n,d_(e)?e.isTrusted:void 0)},disposables:this._messageListeners}}):void 0,this._messageWidget.value=new Hk(this._editor,t,typeof e=="string"?e:this._message.element),this._messageListeners.add(ps.debounce(this._editor.onDidBlurEditorText,(n,s)=>s,0)(()=>{this._mouseOverMessage||this._messageWidget.value&&pA(aE(),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(Ui(this._messageWidget.value.getDomNode(),jn.MOUSE_ENTER,()=>this._mouseOverMessage=!0,!0)),this._messageListeners.add(Ui(this._messageWidget.value.getDomNode(),jn.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 B(t.lineNumber-3,1,n.target.position.lineNumber+3,1))}))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(Hk.fadeOut(this._messageWidget.value))}},S_=lc,lc.ID="editor.contrib.messageController",lc.MESSAGE_VISIBLE=new Ri("messageVisible",!1,y("messageVisible","Whether the editor is currently showing an inline message")),lc);So=S_=x3([Fk(1,$i),Fk(2,oa)],So);const L3=go.bindToContribution(So.get);Tt(new L3({id:"leaveEditorMessage",precondition:So.MESSAGE_VISIBLE,handler:o=>o.closeMessage(),kbOpts:{weight:130,primary:9}}));let Hk=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)}};_i(So.ID,So,4);function ww(o,e){return e&&(o.stack||o.stacktrace)?y("stackTrace.format","{0}: {1}",Bk(o),Wk(o.stack)||Wk(o.stacktrace)):Bk(o)}function Wk(o){return Array.isArray(o)?o.join(`
16
+ `):o}function Bk(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"?y("nodeExceptionMessage","A system error occurred ({0})",o.message):o.message||y("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}function nv(o=null,e=!1){if(!o)return y("error.defaultMessage","An unknown error occurred. Please consult the log for more details.");if(Array.isArray(o)){const t=fl(o),i=nv(t[0],e);return t.length>1?y("error.moreErrors","{0} ({1} errors in total)",i,t.length):i}if(dE(o))return o;if(o.detail){const t=o.detail;if(t.error)return ww(t.error,e);if(t.exception)return ww(t.exception,e)}return o.stack?ww(o,e):o.message?o.message:y("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}var tM=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Tu=function(o,e){return function(t,i){e(t,i,o)}},BS,bd;let zS=(bd=class extends Ve{constructor(e,t,i,n,s,r,a,c,h,g){super(),this.typeId=e,this.editor=t,this.showCommand=n,this.range=s,this.edits=r,this.onSelectNewEdit=a,this._contextMenuService=c,this._keybindingService=g,this.allowEditorOverflow=!0,this.suppressMouseDown=!0,this.create(),this.visibleContext=i.bindTo(h),this.visibleContext.set(!0),this._register(En(()=>this.visibleContext.reset())),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(En((()=>this.editor.removeContentWidget(this)))),this._register(this.editor.onDidChangeCursorPosition(f=>{s.containsPosition(f.position)||this.dispose()})),this._register(ps.runAndSubscribe(g.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=yt(".post-edit-widget"),this.button=this._register(new mA(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(Ui(this.domNode,jn.CLICK,()=>this.showSelector()))}getId(){return BS.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){this._contextMenuService.showContextMenu({getAnchor:()=>{const e=lo(this.button.element);return{x:e.left+e.width,y:e.top+e.height}},getActions:()=>this.edits.allEdits.map((e,t)=>_A({id:"",label:e.title,checked:t===this.edits.activeEditIndex,run:()=>{if(t!==this.edits.activeEditIndex)return this.onSelectNewEdit(t)}}))})}},BS=bd,bd.baseId="editor.widget.postEditWidget",bd);zS=BS=tM([Tu(7,Eg),Tu(8,$i),Tu(9,ds)],zS);let sv=class extends Ve{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 Bo),this._register(ps.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 D=this._editor.getModel();D&&(await D.undo(),this.applyEditAndShowIfNeeded(e,{activeEditIndex:S,allEdits:t.allEdits},i,n,s))},h=(S,D)=>{Nc(S)||(this._notificationService.error(D),i&&this.show(e[0],t,c))};let g;try{g=await n(a,s)}catch(S){return h(S,y("resolveError",`Error resolving edit '{0}':
17
+ {1}`,a.title,nv(S)))}if(s.isCancellationRequested)return;const f=QT(r.uri,e,g),p=e[0],v=r.deltaDecorations([],[{range:p,options:{description:"paste-line-suffix",stickiness:0}}]);this._editor.focus();let _,w;try{_=await this._bulkEditService.apply(f,{editor:this._editor,token:s}),w=r.getDecorationRange(v[0])}catch(S){return h(S,y("applyError",`Error applying edit '{0}':
18
+ {1}`,a.title,nv(S)))}finally{r.deltaDecorations(v,[])}s.isCancellationRequested||i&&_.isApplied&&t.allEdits.length>1&&this.show(w??p,t,c)}show(e,t,i){this.clear(),this._editor.hasModel()&&(this._currentWidget.value=this._instantiationService.createInstance(zS,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()}};sv=tM([Tu(4,ai),Tu(5,Jb),Tu(6,Qs)],sv);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},$h=function(o,e){return function(t,i){e(t,i,o)}},Uc;const iM="editor.changePasteType",S1=new Ri("pasteWidgetVisible",!1,y("pasteWidgetVisible","Whether the paste widget is showing")),Sw="application/vnd.code.copyMetadata";var yd;let yl=(yd=class extends Ve{static get(e){return e.getContribution(Uc.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(Ui(c,"copy",h=>this.handleCopy(h))),this._register(Ui(c,"cut",h=>this.handleCopy(h))),this._register(Ui(c,"paste",h=>this.handlePaste(h),!0)),this._pasteProgressManager=this._register(new iv("pasteIntoEditor",e,t)),this._postPasteWidgetManager=this._register(t.createInstance(sv,"pasteIntoEditor",e,S1,{id:iM,label:y("postPasteWidgetTitle","Show paste options...")}))}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}pasteAs(e){this._editor.focus();try{this._pasteAsActionContext={preferred:e},P0().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 w,S,D,E;if(!this._editor.hasTextFocus()||((S=(w=this._clipboardService).clearInternalState)==null||S.call(w),!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 B(s[0].startLineNumber,1,s[0].startLineNumber,1+t.getLineLength(s[0].startLineNumber))]}const a=(D=this._editor._getViewModel())==null?void 0:D.getPlainTextToCopy(i,n,Qb),h={multicursorText:Array.isArray(a)?a:null,pasteOnNewLine:r,mode:null},g=this._languageFeaturesService.documentPasteEditProvider.ordered(t).filter(R=>!!R.prepareDocumentPaste);if(!g.length){this.setCopyMetadata(e.clipboardData,{defaultPastePayload:h});return}const f=KT(e.clipboardData),p=g.flatMap(R=>R.copyMimeTypes??[]),v=Iy();this.setCopyMetadata(e.clipboardData,{id:v,providerCopyMimeTypes:p,defaultPastePayload:h});const _=ks(async R=>{const z=fl(await Promise.all(g.map(async H=>{try{return await H.prepareDocumentPaste(t,s,f,R)}catch(ee){console.error(ee);return}})));z.reverse();for(const H of z)for(const[ee,X]of H)f.replace(ee,X);return f});(E=Uc._currentCopyOperation)==null||E.dataTransferPromise.cancel(),Uc._currentCopyOperation={handle:v,dataTransferPromise:_}}async handlePaste(e){var c,h,g;if(!e.clipboardData||!this._editor.hasTextFocus())return;(c=So.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=GT(e.clipboardData);s.delete(Sw);const r=[...e.clipboardData.types,...(n==null?void 0:n.providerCopyMimeTypes)??[],Ps.uriList],a=this._languageFeaturesService.documentPasteEditProvider.ordered(t).filter(f=>{var v,_;const p=(v=this._pasteAsActionContext)==null?void 0:v.preferred;return p&&f.providedPasteEditKinds&&!this.providerMatchesPreference(f,p)?!1:(_=f.pasteMimeTypes)==null?void 0:_.some(w=>$T(w,r))});if(!a.length){(g=this._pasteAsActionContext)!=null&&g.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=So.get(this._editor))==null||i.showMessage(y("pasteAsError","No paste edits for '{0}' found",t instanceof Pn?t.value:t.providerId),e[0].getStartPosition())}doPasteInline(e,t,i,n,s){const r=this._editor;if(!r.hasModel())return;const a=new Qu(r,3,void 0),c=ks(async h=>{const g=this._editor;if(!g.hasModel())return;const f=g.getModel(),p=new Be,v=p.add(new Is(h));p.add(a.token.onCancellationRequested(()=>v.cancel()));const _=v.token;try{if(await this.mergeInDataFromCopy(i,n,_),_.isCancellationRequested)return;const w=e.filter(E=>this.isSupportedPasteProvider(E,i));if(!w.length||w.length===1&&w[0]instanceof hh)return this.applyDefaultPasteHandler(i,n,_,s);const S={triggerKind:oS.Automatic},D=await this.getPasteEdits(w,i,f,t,S,_);if(p.add(D),_.isCancellationRequested)return;if(D.edits.length===1&&D.edits[0].provider instanceof hh)return this.applyDefaultPasteHandler(i,n,_,s);if(D.edits.length){const E=g.getOption(85).showPasteSelector==="afterPaste";return this._postPasteWidgetManager.applyEditAndShowIfNeeded(t,{activeEditIndex:0,allEdits:D.edits},E,(R,z)=>new Promise((H,ee)=>{(async()=>{var X,me;try{const Le=(me=(X=R.provider).resolveDocumentPasteEdit)==null?void 0:me.call(X,R,z),je=new ey,Ce=Le&&await this._pasteProgressManager.showWhile(t[0].getEndPosition(),y("resolveProcess","Resolving paste edit. Click to cancel"),Promise.race([je.p,Le]),{cancel:()=>(je.cancel(),ee(new ty))},0);return Ce&&(R.additionalEdit=Ce.additionalEdit),H(R)}catch(Le){return ee(Le)}})()}),_)}await this.applyDefaultPasteHandler(i,n,_,s)}finally{p.dispose(),this._currentPasteOperation===c&&(this._currentPasteOperation=void 0)}});this._pasteProgressManager.showWhile(t[0].getEndPosition(),y("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=ks(async a=>{const c=this._editor;if(!c.hasModel())return;const h=c.getModel(),g=new Be,f=g.add(new Qu(c,3,void 0,a));try{if(await this.mergeInDataFromCopy(n,s,f.token),f.token.isCancellationRequested)return;let p=t.filter(D=>this.isSupportedPasteProvider(D,n,e));e&&(p=p.filter(D=>this.providerMatchesPreference(D,e)));const v={triggerKind:oS.PasteAs,only:e&&e instanceof Pn?e:void 0};let _=g.add(await this.getPasteEdits(p,n,h,i,v,f.token));if(f.token.isCancellationRequested)return;if(e&&(_={edits:_.edits.filter(D=>e instanceof Pn?e.contains(D.kind):e.providerId===D.provider.id),dispose:_.dispose}),!_.edits.length){v.only&&this.showPasteAsNoEditMessage(i,v.only);return}let w;if(e)w=_.edits.at(0);else{const D=await this._quickInputService.pick(_.edits.map(E=>{var R;return{label:E.title,description:(R=E.kind)==null?void 0:R.value,edit:E}}),{placeHolder:y("pasteAsPickerPlaceholder","Select Paste Action")});w=D==null?void 0:D.edit}if(!w)return;const S=QT(h.uri,i,w);await this._bulkEditService.apply(S,{editor:this._editor})}finally{g.dispose(),this._currentPasteOperation===r&&(this._currentPasteOperation=void 0)}});this._progressService.withProgress({location:10,title:y("pasteAsProgress","Running paste handlers")},()=>r)}setCopyMetadata(e,t){e.setData(Sw,JSON.stringify(t))}fetchCopyMetadata(e){if(!e.clipboardData)return;const t=e.clipboardData.getData(Sw);if(t)try{return JSON.parse(t)}catch{return}const[i,n]=vA.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=Uc._currentCopyOperation)==null?void 0:n.handle)===t.id){const s=await Uc._currentCopyOperation.dataTransferPromise;if(i.isCancellationRequested)return;for(const[r,a]of s)e.replace(r,a)}if(!e.has(Ps.uriList)){const s=await this._clipboardService.readResources();if(i.isCancellationRequested)return;s.length&&e.append(Ps.uriList,v1(Dy.create(s)))}}async getPasteEdits(e,t,i,n,s,r){const a=new Be,c=await qp(Promise.all(e.map(async g=>{var f,p;try{const v=await((f=g.provideDocumentPasteEdits)==null?void 0:f.call(g,i,n,t,s,r));return v&&a.add(v),(p=v==null?void 0:v.edits)==null?void 0:p.map(_=>({..._,provider:g}))}catch(v){Nc(v)||console.error(v);return}})),r),h=fl(c??[]).flat().filter(g=>!s.only||s.only.contains(g.kind));return{edits:eM(h),dispose:()=>a.dispose()}}async applyDefaultPasteHandler(e,t,i,n){const s=e.get(Ps.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 Pn?e.providedPasteEditKinds?e.providedPasteEditKinds.some(i=>t.contains(i)):!0:e.id===t.providerId}},Uc=yd,yd.ID="editor.contrib.copyPasteActionController",yd);yl=Uc=k3([$h(1,ai),$h(2,Jb),$h(3,Pg),$h(4,Et),$h(5,xl),$h(6,bA)],yl);const gh="9_cutcopypaste",I3=Tg||document.queryCommandSupported("cut"),nM=Tg||document.queryCommandSupported("copy"),D3=typeof navigator.clipboard>"u"||yA?document.queryCommandSupported("paste"):!0;function C1(o){return o.register(),o}const E3=I3?C1(new T0({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:Tg?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:lt.MenubarEditMenu,group:"2_ccp",title:y({key:"miCut",comment:["&& denotes a mnemonic"]},"Cu&&t"),order:1},{menuId:lt.EditorContext,group:gh,title:y("actions.clipboard.cutLabel","Cut"),when:M.writable,order:1},{menuId:lt.CommandPalette,group:"",title:y("actions.clipboard.cutLabel","Cut"),order:1},{menuId:lt.SimpleEditorContext,group:gh,title:y("actions.clipboard.cutLabel","Cut"),when:M.writable,order:1}]})):void 0,P3=nM?C1(new T0({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:Tg?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:lt.MenubarEditMenu,group:"2_ccp",title:y({key:"miCopy",comment:["&& denotes a mnemonic"]},"&&Copy"),order:2},{menuId:lt.EditorContext,group:gh,title:y("actions.clipboard.copyLabel","Copy"),order:2},{menuId:lt.CommandPalette,group:"",title:y("actions.clipboard.copyLabel","Copy"),order:1},{menuId:lt.SimpleEditorContext,group:gh,title:y("actions.clipboard.copyLabel","Copy"),order:2}]})):void 0;kr.appendMenuItem(lt.MenubarEditMenu,{submenu:lt.MenubarCopy,title:kt("copy as","Copy As"),group:"2_ccp",order:3});kr.appendMenuItem(lt.EditorContext,{submenu:lt.EditorContextCopy,title:kt("copy as","Copy As"),group:gh,order:3});kr.appendMenuItem(lt.EditorContext,{submenu:lt.EditorContextShare,title:kt("share","Share"),group:"11_share",order:-1,when:le.and(le.notEquals("resourceScheme","output"),M.editorTextFocus)});kr.appendMenuItem(lt.ExplorerContext,{submenu:lt.ExplorerContextShare,title:kt("share","Share"),group:"11_share",order:-1});const Cw=D3?C1(new T0({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:Tg?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:lt.MenubarEditMenu,group:"2_ccp",title:y({key:"miPaste",comment:["&& denotes a mnemonic"]},"&&Paste"),order:4},{menuId:lt.EditorContext,group:gh,title:y("actions.clipboard.pasteLabel","Paste"),when:M.writable,order:4},{menuId:lt.CommandPalette,group:"",title:y("actions.clipboard.pasteLabel","Paste"),order:1},{menuId:lt.SimpleEditorContext,group:gh,title:y("actions.clipboard.pasteLabel","Paste"),when:M.writable,order:4}]})):void 0;class T3 extends Se{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:y("actions.clipboard.copyWithSyntaxHighlightingLabel","Copy With Syntax Highlighting"),alias:"Copy With Syntax Highlighting",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:0,weight:100}})}run(e,t){!t.hasModel()||!t.getOption(37)&&t.getSelection().isEmpty()||(UL.forceCopyWithSyntaxHighlighting=!0,t.focus(),t.getContainerDomNode().ownerDocument.execCommand("copy"),UL.forceCopyWithSyntaxHighlighting=!1)}}function sM(o,e){o&&(o.addImplementation(1e4,"code-editor",(t,i)=>{const n=t.get(os).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)=>(P0().execCommand(e),!0)))}sM(E3,"cut");sM(P3,"copy");Cw&&(Cw.addImplementation(1e4,"code-editor",(o,e)=>{var s;const t=o.get(os),i=o.get(Pg),n=t.getFocusedCodeEditor();return n&&n.hasTextFocus()?n.getContainerDomNode().ownerDocument.execCommand("paste")?((s=yl.get(n))==null?void 0:s.finishedPaste())??Promise.resolve():wA?(async()=>{const a=await i.readText();if(a!==""){const c=SA.INSTANCE.get(a);let h=!1,g=null,f=null;c&&(h=n.getOption(37)&&!!c.isFromEmptySelection,g=typeof c.multicursorText<"u"?c.multicursorText:null,f=c.mode),n.trigger("keyboard","paste",{text:a,pasteOnNewLine:h,multicursorText:g,mode:f})}})():!0:!1}),Cw.addImplementation(0,"generic-dom",(o,e)=>(P0().execCommand("paste"),!0)));nM&&se(T3);const yn=new class{constructor(){this.QuickFix=new Pn("quickfix"),this.Refactor=new Pn("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 Pn("notebook"),this.Source=new Pn("source"),this.SourceOrganizeImports=this.Source.append("organizeImports"),this.SourceFixAll=this.Source.append("fixAll"),this.SurroundWith=this.Refactor.append("surround")}};var ko;(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"})(ko||(ko={}));function M3(o,e){return!(o.include&&!o.include.intersects(e)||o.excludes&&o.excludes.some(t=>oM(e,t,o.include))||!o.includeSourceActions&&yn.Source.contains(e))}function N3(o,e){const t=e.kind?new Pn(e.kind):void 0;return!(o.include&&(!t||!o.include.contains(t))||o.excludes&&t&&o.excludes.some(i=>oM(t,i,o.include))||!o.includeSourceActions&&t&&yn.Source.contains(t)||o.onlyIncludePreferredActions&&!e.isPreferred)}function oM(o,e,t){return!(!e.contains(o)||t&&e.contains(t))}class ka{static fromUser(e,t){return!e||typeof e!="object"?new ka(t.kind,t.apply,!1):new ka(ka.getKindFromUser(e,t.kind),ka.getApplyFromUser(e,t.apply),ka.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 Pn(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 R3{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){ss(n)}i&&(this.action.edit=i.edit)}return this}}const rM="editor.action.codeAction",x1="editor.action.quickFix",aM="editor.action.autoFix",lM="editor.action.refactor",cM="editor.action.sourceAction",VS="editor.action.organizeImports",jS="editor.action.fixAll";class Of extends Ve{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:Fo(e.diagnostics)?Fo(t.diagnostics)?Of.codeActionsPreferredComparator(e,t):-1:Fo(t.diagnostics)?1:Of.codeActionsPreferredComparator(e,t)}constructor(e,t,i){super(),this.documentation=t,this._register(i),this.allActions=[...e].sort(Of.codeActionsComparator),this.validActions=this.allActions.filter(({action:n})=>!n.disabled)}get hasAutoFix(){return this.validActions.some(({action:e})=>!!e.kind&&yn.QuickFix.contains(new Pn(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 zk={actions:[],documentation:void 0};async function mu(o,e,t,i,n,s){var w;const r=i.filter||{},a={...r,excludes:[...r.excludes||[],yn.Notebook]},c={only:(w=r.include)==null?void 0:w.value,trigger:i.type},h=new CA(e,s),g=i.type===2,f=A3(o,e,g?a:r),p=new Be,v=f.map(async S=>{try{n.report(S);const D=await S.provideCodeActions(e,t,c,h.token);if(D&&p.add(D),h.token.isCancellationRequested)return zk;const E=((D==null?void 0:D.actions)||[]).filter(z=>z&&N3(r,z)),R=F3(S,E,r.include);return{actions:E.map(z=>new R3(z,S)),documentation:R}}catch(D){if(Nc(D))throw D;return ss(D),zk}}),_=o.onDidChange(()=>{const S=o.all(e);Oa(S,f)||h.cancel()});try{const S=await Promise.all(v),D=S.map(R=>R.actions).flat(),E=[...fl(S.map(R=>R.documentation)),...O3(o,e,i,D)];return new Of(D,E,p)}finally{_.dispose(),h.dispose()}}function A3(o,e,t){return o.all(e).filter(i=>i.providedCodeActionKinds?i.providedCodeActionKinds.some(n=>M3(t,new Pn(n))):!0)}function*O3(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 F3(o,e,t){if(!o.documentation)return;const i=o.documentation.map(n=>({kind:new Pn(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 Pn(n.kind)))return s.command}}var td;(function(o){o.OnSave="onSave",o.FromProblemsView="fromProblemsView",o.FromCodeActions="fromCodeActions",o.FromAILightbulb="fromAILightbulb"})(td||(td={}));async function H3(o,e,t,i,n=gi.None){var h;const s=o.get(Jb),r=o.get(ys),a=o.get(ra),c=o.get(Qs);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!==td.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(g){const f=W3(g);c.error(typeof f=="string"?f:y("applyCodeActionFailed","An unknown error occurred while applying the code action"))}}function W3(o){return typeof o=="string"?o:o instanceof Error&&typeof o.message=="string"?o.message:void 0}Sn.registerCommand("_executeCodeActionProvider",async function(o,e,t,i,n){if(!(e instanceof un))throw cl();const{codeActionProvider:s}=o.get(Et),r=o.get(eo).getModel(e);if(!r)throw cl();const a=Xt.isISelection(t)?Xt.liftSelection(t):B.isIRange(t)?r.validateRange(t):void 0;if(!a)throw cl();const c=typeof i=="string"?new Pn(i):void 0,h=await mu(s,r,a,{type:1,triggerAction:ko.Default,filter:{includeSourceActions:!0,include:c}},nl.None,gi.None),g=[],f=Math.min(h.validActions.length,typeof n=="number"?n:0);for(let p=0;p<f;p++)g.push(h.validActions[p].resolve(gi.None));try{return await Promise.all(g),h.validActions.map(p=>p.action)}finally{setTimeout(()=>h.dispose(),100)}});var B3=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},z3=function(o,e){return function(t,i){e(t,i,o)}},US,wd;let $S=(wd=class{constructor(e){this.keybindingService=e}getResolver(){const e=new M0(()=>this.keybindingService.getKeybindings().filter(t=>US.codeActionCommands.indexOf(t.command)>=0).filter(t=>t.resolvedKeybinding).map(t=>{let i=t.commandArgs;return t.command===VS?i={kind:yn.SourceOrganizeImports.value}:t.command===jS&&(i={kind:yn.SourceFixAll.value}),{resolvedKeybinding:t.resolvedKeybinding,...ka.fromUser(i,{kind:Pn.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 Pn(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)}},US=wd,wd.codeActionCommands=[lM,rM,cM,VS,jS],wd);$S=US=B3([z3(0,ds)],$S);St("symbolIcon.arrayForeground",_s,y("symbolIcon.arrayForeground","The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.booleanForeground",_s,y("symbolIcon.booleanForeground","The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},y("symbolIcon.classForeground","The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.colorForeground",_s,y("symbolIcon.colorForeground","The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.constantForeground",_s,y("symbolIcon.constantForeground","The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},y("symbolIcon.constructorForeground","The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},y("symbolIcon.enumeratorForeground","The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},y("symbolIcon.enumeratorMemberForeground","The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},y("symbolIcon.eventForeground","The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},y("symbolIcon.fieldForeground","The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.fileForeground",_s,y("symbolIcon.fileForeground","The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.folderForeground",_s,y("symbolIcon.folderForeground","The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},y("symbolIcon.functionForeground","The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},y("symbolIcon.interfaceForeground","The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.keyForeground",_s,y("symbolIcon.keyForeground","The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.keywordForeground",_s,y("symbolIcon.keywordForeground","The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},y("symbolIcon.methodForeground","The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.moduleForeground",_s,y("symbolIcon.moduleForeground","The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.namespaceForeground",_s,y("symbolIcon.namespaceForeground","The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.nullForeground",_s,y("symbolIcon.nullForeground","The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.numberForeground",_s,y("symbolIcon.numberForeground","The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.objectForeground",_s,y("symbolIcon.objectForeground","The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.operatorForeground",_s,y("symbolIcon.operatorForeground","The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.packageForeground",_s,y("symbolIcon.packageForeground","The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.propertyForeground",_s,y("symbolIcon.propertyForeground","The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.referenceForeground",_s,y("symbolIcon.referenceForeground","The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.snippetForeground",_s,y("symbolIcon.snippetForeground","The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.stringForeground",_s,y("symbolIcon.stringForeground","The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.structForeground",_s,y("symbolIcon.structForeground","The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.textForeground",_s,y("symbolIcon.textForeground","The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.typeParameterForeground",_s,y("symbolIcon.typeParameterForeground","The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.unitForeground",_s,y("symbolIcon.unitForeground","The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));St("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},y("symbolIcon.variableForeground","The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));const dM=Object.freeze({kind:Pn.Empty,title:y("codeAction.widget.id.more","More Actions...")}),V3=Object.freeze([{kind:yn.QuickFix,title:y("codeAction.widget.id.quickfix","Quick Fix")},{kind:yn.RefactorExtract,title:y("codeAction.widget.id.extract","Extract"),icon:Qt.wrench},{kind:yn.RefactorInline,title:y("codeAction.widget.id.inline","Inline"),icon:Qt.wrench},{kind:yn.RefactorRewrite,title:y("codeAction.widget.id.convert","Rewrite"),icon:Qt.wrench},{kind:yn.RefactorMove,title:y("codeAction.widget.id.move","Move"),icon:Qt.wrench},{kind:yn.SurroundWith,title:y("codeAction.widget.id.surround","Surround With"),icon:Qt.surroundWith},{kind:yn.Source,title:y("codeAction.widget.id.source","Source Action"),icon:Qt.symbolFile},dM]);function j3(o,e,t){if(!e)return o.map(s=>{var r;return{kind:"action",item:s,group:dM,disabled:!!s.action.disabled,label:s.action.disabled||s.action.title,canPreview:!!((r=s.action.edit)!=null&&r.edits.length)}});const i=V3.map(s=>({group:s,actions:[]}));for(const s of o){const r=s.action.kind?new Pn(s.action.kind):Pn.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:Qt.sparkle}:a,label:r.action.title,disabled:!!r.action.disabled,keybinding:t(r.action)})}}return n}var U3=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},$3=function(o,e){return function(t,i){e(t,i,o)}},ru;const Vk=es("gutter-lightbulb",Qt.lightBulb,y("gutterLightbulbWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor.")),jk=es("gutter-lightbulb-auto-fix",Qt.lightbulbAutofix,y("gutterLightbulbAutoFixWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor and a quick fix is available.")),Uk=es("gutter-lightbulb-sparkle",Qt.lightbulbSparkle,y("gutterLightbulbAIFixWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix is available.")),$k=es("gutter-lightbulb-aifix-auto-fix",Qt.lightbulbSparkleAutofix,y("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.")),qk=es("gutter-lightbulb-sparkle-filled",Qt.sparkleFilled,y("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 Br;(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})(Br||(Br={}));var rl;let up=(rl=class extends Ve{constructor(e,t){super(),this._editor=e,this._keybindingService=t,this._onClick=this._register(new ui),this.onClick=this._onClick.event,this._state=Br.Hidden,this._gutterState=Br.Hidden,this._iconClasses=[],this.lightbulbClasses=["codicon-"+Vk.id,"codicon-"+$k.id,"codicon-"+jk.id,"codicon-"+Uk.id,"codicon-"+qk.id],this.gutterDecoration=ru.GUTTER_DECORATION,this._domNode=yt("div.lightBulbWidget"),this._domNode.role="listbox",this._register(hE.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(xA(this._domNode,i=>{if(this.state.type!==1)return;this._editor.focus(),i.preventDefault();const{top:n,height:s}=lo(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(Ui(this._domNode,"mouseenter",i=>{(i.buttons&1)===1&&this.hide()})),this._register(ps.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{var i,n;this._preferredKbLabel=((i=this._keybindingService.lookupKeybinding(aM))==null?void 0:i.getLabel())??void 0,this._quickFixKbLabel=((n=this._keybindingService.lookupKeybinding(x1))==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}=lo(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,g=this._editor.getOptions().get(50),f=r.getLineContent(a),p=N0(f,h),v=g.spaceWidth*p>22,_=H=>H>2&&this._editor.getTopForLineNumber(H)===this._editor.getTopForLineNumber(H-1),w=this._editor.getLineDecorations(a);let S=!1;if(w)for(const H of w){const ee=H.options.glyphMarginClassName;if(ee&&!this.lightbulbClasses.some(X=>ee.includes(X))){S=!0;break}}let D=a,E=1;if(!v){const H=ee=>{const X=r.getLineContent(ee);return/^\s*$|^\s+/.test(X)||X.length<=E};if(a>1&&!_(a-1)){const ee=r.getLineCount(),X=a===ee,me=a>1&&H(a-1),Le=!X&&H(a+1),je=H(a),Ce=!Le&&!me;if(!Le&&!me&&!S)return this.gutterState=new Br.Showing(e,t,i,{position:{lineNumber:D,column:E},preference:ru._posPref}),this.renderGutterLightbub(),this.hide();me||X||me&&!je?D-=1:(Le||Ce&&je)&&(D+=1)}else if(a===1&&(a===r.getLineCount()||!H(a+1)&&!H(a)))if(this.gutterState=new Br.Showing(e,t,i,{position:{lineNumber:D,column:E},preference:ru._posPref}),S)this.gutterHide();else return this.renderGutterLightbub(),this.hide();else if(a<r.getLineCount()&&!_(a+1))D+=1;else if(c*g.spaceWidth<22)return this.hide();E=/^\S\s*$/.test(r.getLineContent(D))?2:1}this.state=new Br.Showing(e,t,i,{position:{lineNumber:D,column:E},preference:ru._posPref}),this._gutterDecorationID&&(this._removeGutterDecoration(this._gutterDecorationID),this.gutterHide());const R=e.validActions,z=e.validActions[0].action.kind;if(R.length!==1||!z){this._editor.layoutContentWidget(this);return}this._editor.layoutContentWidget(this)}hide(){this.state!==Br.Hidden&&(this.state=Br.Hidden,this._editor.layoutContentWidget(this))}gutterHide(){this.gutterState!==Br.Hidden&&(this._gutterDecorationID&&this._removeGutterDecoration(this._gutterDecorationID),this.gutterState=Br.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=Qt.sparkleFilled,this.state.actions.validActions.length===1&&(t=!0)):this.state.actions.hasAutoFix?this.state.actions.hasAIFix?e=Qt.lightbulbSparkleAutofix:e=Qt.lightbulbAutofix:this.state.actions.hasAIFix?e=Qt.lightbulbSparkle:e=Qt.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=qk,this.gutterState.actions.validActions.length===1&&(t=!0)):this.gutterState.actions.hasAutoFix?this.gutterState.actions.hasAIFix?e=$k:e=jk:this.gutterState.actions.hasAIFix?e=Uk:e=Vk,this._updateLightbulbTitle(this.gutterState.actions.hasAutoFix,t);const i=ki.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:Xi.asClassName(e),glyphMargin:{position:F_.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 B(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 B(t,0,t,0)),i.changeDecorationOptions(e,this.gutterDecoration)})}_updateLightbulbTitle(e,t){this.state.type===1&&(t?this.title=y("codeActionAutoRun","Run: {0}",this.state.actions.validActions[0].action.title):e&&this._preferredKbLabel?this.title=y("preferredcodeActionWithKb","Show Code Actions. Preferred Quick Fix Available ({0})",this._preferredKbLabel):!e&&this._quickFixKbLabel?this.title=y("codeActionWithKb","Show Code Actions ({0})",this._quickFixKbLabel):e||(this.title=y("codeAction","Show Code Actions")))}set title(e){this._domNode.title=e}},ru=rl,rl.GUTTER_DECORATION=ki.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:Xi.asClassName(Qt.lightBulb),glyphMargin:{position:F_.Left},stickiness:1}),rl.ID="editor.contrib.lightbulbWidget",rl._posPref=[0],rl);up=ru=U3([$3(1,ds)],up);var hM=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},qS=function(o,e){return function(t,i){e(t,i,o)}};const uM="acceptSelectedCodeAction",gM="previewSelectedCodeAction";class q3{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 KS=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 R0(e,A0);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=ad(e.group.icon.color.id))):(i.icon.className=Xi.asClassName(Qt.lightBulb),i.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!e.item||!e.label)return;i.text.textContent=fM(e.label),i.keybinding.set(e.keybinding),LA(!!e.keybinding,i.keybinding.element);const n=(a=this._keybindingService.lookupKeybinding(uM))==null?void 0:a.getLabel(),s=(c=this._keybindingService.lookupKeybinding(gM))==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=y({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=y({key:"label",comment:['placeholder is a keybinding, e.g "F2 to Apply"']},"{0} to Apply",n):i.container.title=""}disposeTemplate(e){e.keybinding.dispose()}};KS=hM([qS(1,ds)],KS);class K3 extends UIEvent{constructor(){super("acceptSelectedAction")}}class Kk extends UIEvent{constructor(){super("previewSelectedAction")}}function G3(o){if(o.kind==="action")return o.label}let GS=class extends Ve{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 Is),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 O0(e,this.domNode,a,[new KS(t,this._keybindingService),new q3],{keyboardSupport:!1,typeNavigationEnabled:!0,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:G3},accessibilityProvider:{getAriaLabel:c=>{if(c.kind==="action"){let h=c.label?fM(c==null?void 0:c.label):"";return c.disabled&&(h=y({key:"customQuickFixWidget.labels",comment:["Action widget labels for accessibility."]},"{0}, Disabled Reason: {1}",h,c.disabled)),h}return null},getWidgetAriaLabel:()=>y({key:"customQuickFixWidget",comment:["An action widget option"]},"Action Widget"),getRole:c=>c.kind==="action"?"option":"separator",getWidgetRole:()=>"listbox"}})),this._list.style(kA),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,g)=>{const f=this.domNode.ownerDocument.getElementById(this._list.getElementID(g));if(f){f.style.width="auto";const p=f.getBoundingClientRect().width;return f.style.width="",p}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 Kk:new K3;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 Kk):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([])}};GS=hM([qS(4,iy),qS(5,ds)],GS);function fM(o){return o.replace(/\r\n|\r|\n/g," ")}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},xw=function(o,e){return function(t,i){e(t,i,o)}};St("actionBar.toggledBackground",F0,y("actionBar.toggledBackground","Background color for toggled action items in action bar."));const fh={Visible:new Ri("codeActionMenuVisible",!1,y("codeActionMenuVisible","Whether the action widget list is visible"))},Dh=Ll("actionWidgetService");let ph=class extends Ve{get isVisible(){return fh.Visible.getValue(this._contextKeyService)||!1}constructor(e,t,i){super(),this._contextViewService=e,this._contextKeyService=t,this._instantiationService=i,this._list=this._register(new Bo)}show(e,t,i,n,s,r,a){const c=fh.Visible.bindTo(this._contextKeyService),h=this._instantiationService.createInstance(GS,e,t,i,n);this._contextViewService.showContextView({getAnchor:()=>s,render:g=>(c.set(!0),this._renderWidget(g,h,a??[])),onHide:g=>{c.reset(),this._onWidgetClosed(g)}},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 Be,r=document.createElement("div"),a=e.appendChild(r);a.classList.add("context-view-block"),s.add(Ui(a,jn.MOUSE_DOWN,_=>_.stopPropagation()));const c=document.createElement("div"),h=e.appendChild(c);h.classList.add("context-view-pointerBlock"),s.add(Ui(h,jn.POINTER_MOVE,()=>h.remove())),s.add(Ui(h,jn.MOUSE_DOWN,()=>h.remove()));let g=0;if(i.length){const _=this._createActionBar(".action-widget-action-bar",i);_&&(n.appendChild(_.getContainer().parentElement),s.add(_),g=_.getContainer().offsetWidth)}const f=(v=this._list.value)==null?void 0:v.layout(g);n.style.width=`${f}px`;const p=s.add(eg(e));return s.add(p.onDidBlur(()=>this.hide(!0))),s}_createActionBar(e,t){if(!t.length)return;const i=yt(e),n=new Yf(i);return n.push(t,{icon:!1,label:!0}),n}_onWidgetClosed(e){var t;(t=this._list.value)==null||t.hide(e)}};ph=Z3([xw(0,iy),xw(1,$i),xw(2,ai)],ph);kl(Dh,ph,1);const um=1100;cn(class extends uo{constructor(){super({id:"hideCodeActionWidget",title:kt("hideCodeActionWidget.title","Hide action widget"),precondition:fh.Visible,keybinding:{weight:um,primary:9,secondary:[1033]}})}run(o){o.get(Dh).hide(!0)}});cn(class extends uo{constructor(){super({id:"selectPrevCodeAction",title:kt("selectPrevCodeAction.title","Select previous action"),precondition:fh.Visible,keybinding:{weight:um,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(o){const e=o.get(Dh);e instanceof ph&&e.focusPrevious()}});cn(class extends uo{constructor(){super({id:"selectNextCodeAction",title:kt("selectNextCodeAction.title","Select next action"),precondition:fh.Visible,keybinding:{weight:um,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(o){const e=o.get(Dh);e instanceof ph&&e.focusNext()}});cn(class extends uo{constructor(){super({id:uM,title:kt("acceptSelected.title","Accept selected action"),precondition:fh.Visible,keybinding:{weight:um,primary:3,secondary:[2137]}})}run(o){const e=o.get(Dh);e instanceof ph&&e.acceptSelected()}});cn(class extends uo{constructor(){super({id:gM,title:kt("previewSelected.title","Preview selected action"),precondition:fh.Visible,keybinding:{weight:um,primary:2051}})}run(o){const e=o.get(Dh);e instanceof ph&&e.acceptSelected(!0)}});const pM=new Ri("supportedCodeAction",""),Gk="_typescript.applyFixAllCodeAction";class X3 extends Ve{constructor(e,t,i,n=250){super(),this._editor=e,this._markerService=t,this._signalChange=i,this._delay=n,this._autoTriggerTimer=this._register(new Kp),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=>H_(i,t.uri))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet(()=>{this.trigger({type:2,triggerAction:ko.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!==rw.Off){{if(i===rw.On)return t;if(i===rw.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(Nc(r))return mM;throw r})}cancel(){this._cancellablePromise.cancel()}}o.Triggered=e})(Gc||(Gc={}));const mM=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1});class Y3 extends Ve{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 Bo),this._state=Gc.Empty,this._onDidChangeState=this._register(new ui),this.onDidChangeState=this._onDidChangeState.event,this._disposed=!1,this._supportedCodeActions=pM.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 X3(this._editor,this._markerService,i=>{var c;if(!i){this.setState(Gc.Empty);return}const n=i.selection.getStartPosition(),s=ks(async h=>{var g,f,p,v,_,w,S,D,E,R;if(this._settingEnabledNearbyQuickfixes()&&i.trigger.type===1&&(i.trigger.triggerAction===ko.QuickFix||(f=(g=i.trigger.filter)==null?void 0:g.include)!=null&&f.contains(yn.QuickFix))){const z=await mu(this._registry,e,i.selection,i.trigger,nl.None,h),H=[...z.allActions];if(h.isCancellationRequested)return mM;const ee=(p=z.validActions)==null?void 0:p.some(me=>me.action.kind?yn.QuickFix.contains(new Pn(me.action.kind)):!1),X=this._markerService.read({resource:e.uri});if(ee){for(const me of z.validActions)(_=(v=me.action.command)==null?void 0:v.arguments)!=null&&_.some(Le=>typeof Le=="string"&&Le.includes(Gk))&&(me.action.diagnostics=[...X.filter(Le=>Le.relatedInformation)]);return{validActions:z.validActions,allActions:H,documentation:z.documentation,hasAutoFix:z.hasAutoFix,hasAIFix:z.hasAIFix,allAIFixes:z.allAIFixes,dispose:()=>{z.dispose()}}}else if(!ee&&X.length>0){const me=i.selection.getPosition();let Le=me,je=Number.MAX_VALUE;const Ce=[...z.validActions];for(const Lt of X){const ct=Lt.endColumn,li=Lt.endLineNumber,zt=Lt.startLineNumber;if(li===me.lineNumber||zt===me.lineNumber){Le=new Dt(li,ct);const ei={type:i.trigger.type,triggerAction:i.trigger.triggerAction,filter:{include:(w=i.trigger.filter)!=null&&w.include?(S=i.trigger.filter)==null?void 0:S.include:yn.QuickFix},autoApply:i.trigger.autoApply,context:{notAvailableMessage:((D=i.trigger.context)==null?void 0:D.notAvailableMessage)||"",position:Le}},qe=new Xt(Le.lineNumber,Le.column,Le.lineNumber,Le.column),Ye=await mu(this._registry,e,qe,ei,nl.None,h);if(Ye.validActions.length!==0){for(const Ne of Ye.validActions)(R=(E=Ne.action.command)==null?void 0:E.arguments)!=null&&R.some(st=>typeof st=="string"&&st.includes(Gk))&&(Ne.action.diagnostics=[...X.filter(st=>st.relatedInformation)]);z.allActions.length===0&&H.push(...Ye.allActions),Math.abs(me.column-ct)<je?Ce.unshift(...Ye.validActions):Ce.push(...Ye.validActions)}je=Math.abs(me.column-ct)}}const mt=Ce.filter((Lt,ct,li)=>li.findIndex(zt=>zt.action.title===Lt.action.title)===ct);return mt.sort((Lt,ct)=>Lt.action.isPreferred&&!ct.action.isPreferred?-1:!Lt.action.isPreferred&&ct.action.isPreferred||Lt.action.isAI&&!ct.action.isAI?1:!Lt.action.isAI&&ct.action.isAI?-1:0),{validActions:mt,allActions:H,documentation:z.documentation,hasAutoFix:z.hasAutoFix,hasAIFix:z.hasAIFix,allAIFixes:z.allAIFixes,dispose:()=>{z.dispose()}}}}if(i.trigger.type===1){const z=new Lo,H=await mu(this._registry,e,i.selection,i.trigger,nl.None,h);return this._telemetryService&&this._telemetryService.publicLog2("codeAction.invokedDurations",{codeActions:H.validActions.length,duration:z.elapsed()}),H}return mu(this._registry,e,i.selection,i.trigger,nl.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:ko.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 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},ua=function(o,e){return function(t,i){e(t,i,o)}},au;const Q3="quickfix-edit-highlight";var cc;let pg=(cc=class extends Ve{static get(e){return e.getContribution(au.ID)}constructor(e,t,i,n,s,r,a,c,h,g,f){super(),this._commandService=a,this._configurationService=c,this._actionWidgetService=h,this._instantiationService=g,this._telemetryService=f,this._activeCodeActions=this._register(new Bo),this._showDisabled=!1,this._disposed=!1,this._editor=e,this._model=this._register(new Y3(this._editor,s.codeActionProvider,t,i,r,c,this._telemetryService)),this._register(this._model.onDidChangeState(p=>this.update(p))),this._lightBulbWidget=new M0(()=>{const p=this._editor.getContribution(up.ID);return p&&this._register(p.onClick(v=>this.showCodeActionsFromLightbulb(v.actions,v))),p}),this._resolver=n.createInstance($S),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,td.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=So.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(H3,e,n,{preview:i,editor:this._editor})}finally{t&&this._trigger({type:2,triggerAction:ko.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){mn(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 g=this.tryGetValidActionToApply(e.trigger,t);if(g){try{this.hideLightBulbWidget(),await this._applyCodeAction(g,!1,!1,td.FromCodeActions)}finally{t.dispose()}return}if(e.trigger.context){const f=this.getInvalidActionThatWouldHaveBeenApplied(e.trigger,t);if(f&&f.action.disabled){(r=So.get(this._editor))==null||r.showMessage(f.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=So.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=Dt.isIPosition(t)?this.toCoords(t):t,c={onSelect:async(h,g)=>{this._applyCodeAction(h,!0,!!g,i.fromLightbulb?td.FromAILightbulb:td.FromCodeActions),this._actionWidgetService.hide(!1),n.clear()},onHide:h=>{var g;(g=this._editor)==null||g.focus(),n.clear()},onHover:async(h,g)=>{var v;if(g.isCancellationRequested)return;let f=!1;const p=h.action.kind;if(p){const _=new Pn(p);f=[yn.RefactorExtract,yn.RefactorInline,yn.RefactorRewrite,yn.RefactorMove,yn.Source].some(S=>S.contains(_))}return{canPreview:f||!!((v=h.action.edit)!=null&&v.edits.length)}},onFocus:h=>{var g,f;if(h&&h.action){const p=h.action.ranges,v=h.action.diagnostics;if(n.clear(),p&&p.length>0){const _=v&&(v==null?void 0:v.length)>1?v.map(w=>({range:w,options:au.DECORATION})):p.map(w=>({range:w,options:au.DECORATION}));n.set(_)}else if(v&&v.length>0){const _=v.map(S=>({range:S,options:au.DECORATION}));n.set(_);const w=v[0];if(w.startLineNumber&&w.startColumn){const S=(f=(g=this._editor.getModel())==null?void 0:g.getWordAtPosition({lineNumber:w.startLineNumber,column:w.startColumn}))==null?void 0:f.word;tg(y("editingNewSelection","Context: {0} at line {1} and column {2}.",S,w.startLineNumber,w.startColumn))}}}else n.clear()}};this._actionWidgetService.show("codeActionWidget",!0,j3(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=lo(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:y("hideMoreActions","Hide Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(e,t,i))}:{id:"showMoreActions",label:y("showMoreActions","Show Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(e,t,i))}),n}},au=cc,cc.ID="editor.contrib.codeActionController",cc.DECORATION=ki.register({description:"quickfix-highlight",className:Q3}),cc);pg=au=J3([ua(1,H0),ua(2,$i),ua(3,ai),ua(4,Et),ua(5,Gp),ua(6,ys),ua(7,Tn),ua(8,Dh),ua(9,ai),ua(10,ra)],pg);ny((o,e)=>{((n,s)=>{s&&e.addRule(`.monaco-editor ${n} { background-color: ${s}; }`)})(".quickfix-edit-highlight",o.getColor(IA));const i=o.getColor(uE);i&&e.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${Jf(o.type)?"dotted":"solid"} ${i}; box-sizing: border-box; }`)});function gm(o){return le.regex(pM.keys()[0],new RegExp("(\\s|^)"+Qf(o.value)+"\\b"))}const L1={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:y("args.schema.kind","Kind of the code action to run.")},apply:{type:"string",description:y("args.schema.apply","Controls when the returned actions are applied."),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[y("args.schema.apply.first","Always apply the first returned code action."),y("args.schema.apply.ifSingle","Apply the first returned code action if it is the only one."),y("args.schema.apply.never","Do not apply the returned code actions.")]},preferred:{type:"boolean",default:!1,description:y("args.schema.preferred","Controls if only preferred code actions should be returned.")}}};function Eh(o,e,t,i,n=ko.Default){if(o.hasModel()){const s=pg.get(o);s==null||s.manualTriggerAtCurrentPosition(e,n,t,i)}}class eB extends Se{constructor(){super({id:x1,label:y("quickfix.trigger.label","Quick Fix..."),alias:"Quick Fix...",precondition:le.and(M.writable,M.hasCodeActionsProvider),kbOpts:{kbExpr:M.textInputFocus,primary:2137,weight:100}})}run(e,t){return Eh(t,y("editor.action.quickFix.noneMessage","No code actions available"),void 0,void 0,ko.QuickFix)}}class tB extends go{constructor(){super({id:rM,precondition:le.and(M.writable,M.hasCodeActionsProvider),metadata:{description:"Trigger a code action",args:[{name:"args",schema:L1}]}})}runEditorCommand(e,t,i){const n=ka.fromUser(i,{kind:Pn.Empty,apply:"ifSingle"});return Eh(t,typeof(i==null?void 0:i.kind)=="string"?n.preferred?y("editor.action.codeAction.noneMessage.preferred.kind","No preferred code actions for '{0}' available",i.kind):y("editor.action.codeAction.noneMessage.kind","No code actions for '{0}' available",i.kind):n.preferred?y("editor.action.codeAction.noneMessage.preferred","No preferred code actions available"):y("editor.action.codeAction.noneMessage","No code actions available"),{include:n.kind,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply)}}class iB extends Se{constructor(){super({id:lM,label:y("refactor.label","Refactor..."),alias:"Refactor...",precondition:le.and(M.writable,M.hasCodeActionsProvider),kbOpts:{kbExpr:M.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:le.and(M.writable,gm(yn.Refactor))},metadata:{description:"Refactor...",args:[{name:"args",schema:L1}]}})}run(e,t,i){const n=ka.fromUser(i,{kind:yn.Refactor,apply:"never"});return Eh(t,typeof(i==null?void 0:i.kind)=="string"?n.preferred?y("editor.action.refactor.noneMessage.preferred.kind","No preferred refactorings for '{0}' available",i.kind):y("editor.action.refactor.noneMessage.kind","No refactorings for '{0}' available",i.kind):n.preferred?y("editor.action.refactor.noneMessage.preferred","No preferred refactorings available"):y("editor.action.refactor.noneMessage","No refactorings available"),{include:yn.Refactor.contains(n.kind)?n.kind:Pn.None,onlyIncludePreferredActions:n.preferred},n.apply,ko.Refactor)}}class nB extends Se{constructor(){super({id:cM,label:y("source.label","Source Action..."),alias:"Source Action...",precondition:le.and(M.writable,M.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:le.and(M.writable,gm(yn.Source))},metadata:{description:"Source Action...",args:[{name:"args",schema:L1}]}})}run(e,t,i){const n=ka.fromUser(i,{kind:yn.Source,apply:"never"});return Eh(t,typeof(i==null?void 0:i.kind)=="string"?n.preferred?y("editor.action.source.noneMessage.preferred.kind","No preferred source actions for '{0}' available",i.kind):y("editor.action.source.noneMessage.kind","No source actions for '{0}' available",i.kind):n.preferred?y("editor.action.source.noneMessage.preferred","No preferred source actions available"):y("editor.action.source.noneMessage","No source actions available"),{include:yn.Source.contains(n.kind)?n.kind:Pn.None,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply,ko.SourceAction)}}class sB extends Se{constructor(){super({id:VS,label:y("organizeImports.label","Organize Imports"),alias:"Organize Imports",precondition:le.and(M.writable,gm(yn.SourceOrganizeImports)),kbOpts:{kbExpr:M.textInputFocus,primary:1581,weight:100}})}run(e,t){return Eh(t,y("editor.action.organize.noneMessage","No organize imports action available"),{include:yn.SourceOrganizeImports,includeSourceActions:!0},"ifSingle",ko.OrganizeImports)}}class oB extends Se{constructor(){super({id:jS,label:y("fixAll.label","Fix All"),alias:"Fix All",precondition:le.and(M.writable,gm(yn.SourceFixAll))})}run(e,t){return Eh(t,y("fixAll.noneMessage","No fix all action available"),{include:yn.SourceFixAll,includeSourceActions:!0},"ifSingle",ko.FixAll)}}class rB extends Se{constructor(){super({id:aM,label:y("autoFix.label","Auto Fix..."),alias:"Auto Fix...",precondition:le.and(M.writable,gm(yn.QuickFix)),kbOpts:{kbExpr:M.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(e,t){return Eh(t,y("editor.action.autoFix.noneMessage","No auto fixes available"),{include:yn.QuickFix,onlyIncludePreferredActions:!0},"ifSingle",ko.AutoFix)}}_i(pg.ID,pg,3);_i(up.ID,up,4);se(eB);se(iB);se(nB);se(sB);se(rB);se(oB);Tt(new tB);sa.as(Zp.Configuration).registerConfiguration({...sy,properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:5,description:y("showCodeActionHeaders","Enable/disable showing group headers in the Code Action menu."),default:!0}}});sa.as(Zp.Configuration).registerConfiguration({...sy,properties:{"editor.codeActionWidget.includeNearbyQuickFixes":{type:"boolean",scope:5,description:y("includeNearbyQuickFixes","Enable/disable showing nearest Quick Fix within a line when not currently on a diagnostic."),default:!0}}});sa.as(Zp.Configuration).registerConfiguration({...sy,properties:{"editor.codeActions.triggerOnFocusChange":{type:"boolean",scope:5,markdownDescription:y("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 ZS{constructor(){this.lenses=[],this._disposables=new Be}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 _M(o,e,t){const i=o.ordered(e),n=new Map,s=new ZS,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){ss(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}Sn.registerCommand("_executeCodeLensProvider",function(o,...e){let[t,i]=e;Gi(un.isUri(t)),Gi(typeof i=="number"||!i);const{codeLensProvider:n}=o.get(Et),s=o.get(eo).getModel(t);if(!s)throw cl();const r=[],a=new Be;return _M(n,s,gi.None).then(c=>{a.add(c);const h=[];for(const g of c.lenses)i==null||g.symbol.command?r.push(g.symbol):i-- >0&&g.provider.resolveCodeLens&&h.push(Promise.resolve(g.provider.resolveCodeLens(s,g.symbol,gi.None)).then(f=>r.push(f||g.symbol)));return Promise.all(h)}).then(()=>r).finally(()=>{setTimeout(()=>a.dispose(),100)})});var aB=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},lB=function(o,e){return function(t,i){e(t,i,o)}};const vM=Ll("ICodeLensCache");class Zk{constructor(e,t){this.lineCount=e,this.data=t}}let XS=class{constructor(e){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}},this._cache=new Xp(20,.75);const t="codelens/cache";DA(EA,()=>e.remove(t,1));const i="codelens/cache2",n=e.get(i,1,"{}");this._deserialize(n);const s=ps.filter(e.onWillSaveState,r=>r.reason===W0.SHUTDOWN);ps.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 ZS;n.add({lenses:i,dispose:()=>{}},this._fakeProvider);const s=new Zk(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 B(a,1,a,11)});const r=new ZS;r.add({lenses:s,dispose(){}},this._fakeProvider),this._cache.set(i,new Zk(n.lineCount,r))}}catch{}}};XS=aB([lB(0,Rc)],XS);kl(vM,XS,1);class cB{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 Gf=class Gf{constructor(e,t){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=e,this._id=`codelens.widget-${Gf._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=PA(r.command.title.trim());if(r.command.id){const c=`c${Gf._idPool++}`;i.push(yt("a",{id:c,title:r.command.tooltip,role:"button"},...a)),this._commands.set(c,r.command)}else i.push(yt("span",{title:r.command.tooltip},...a));s+1<e.length&&i.push(yt("span",void 0," | "))}}n?(W_(this._domNode,...i),this._isEmpty&&t&&this._domNode.classList.add("fadein"),this._isEmpty=!1):W_(this._domNode,yt("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}};Gf._idPool=0;let YS=Gf;class Lw{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 Xk=ki.register({collapseOnReplaceEdit:!0,description:"codelens"});class Yk{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,g)=>{h.symbol.command&&c.push(h.symbol),i.addDecoration({range:h.symbol.range,options:Xk},f=>this._decorationIds[g]=f),a?a=B.plusRange(a,h.symbol.range):a=B.lift(h.symbol.range)}),this._viewZone=new cB(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 YS(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&&B.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:Xk},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},sf=function(o,e){return function(t,i){e(t,i,o)}},Vu;let gp=(Vu=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 Be,this._localToDispose=new Be,this._lenses=[],this._oldCodeLensModels=new Be,this._provideCodeLensDebounce=i.for(t.codeLensProvider,"CodeLensProvide",{min:250}),this._resolveCodeLensesDebounce=i.for(t.codeLensProvider,"CodeLensResolve",{min:250,salt:"resolve"}),this._resolveCodeLensesScheduler=new ms(()=>this._resolveCodeLensesInViewport(),this._resolveCodeLensesDebounce.default()),this._disposables.add(this._editor.onDidChangeModel(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeConfiguration(a=>{(a.hasChanged(50)||a.hasChanged(19)||a.hasChanged(18))&&this._updateLensStyle(),a.hasChanged(17)&&this._onModelChange()})),this._disposables.add(t.codeLensProvider.onDidChange(this._onModelChange,this)),this._onModelChange(),this._updateLensStyle()}dispose(){var e;this._localDispose(),this._disposables.dispose(),this._oldCodeLensModels.dispose(),(e=this._currentCodeLensModel)==null||e.dispose()}_getLayoutInfo(){const e=Math.max(1.3,this._editor.getOption(67)/this._editor.getOption(52));let t=this._editor.getOption(19);return(!t||t<5)&&(t=this._editor.getOption(52)*.9|0),{fontSize:t,codeLensHeight:t*e|0}}_updateLensStyle(){const{codeLensHeight:e,fontSize:t}=this._getLayoutInfo(),i=this._editor.getOption(18),n=this._editor.getOption(50),{style:s}=this._editor.getContainerDomNode();s.setProperty("--vscode-editorCodeLens-lineHeight",`${e}px`),s.setProperty("--vscode-editorCodeLens-fontSize",`${t}px`),s.setProperty("--vscode-editorCodeLens-fontFeatureSettings",n.fontFeatureSettings),i&&(s.setProperty("--vscode-editorCodeLens-fontFamily",i),s.setProperty("--vscode-editorCodeLens-fontFamilyDefault",B0.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&&Xf(()=>{const n=this._codeLensCache.get(e);t===n&&(this._codeLensCache.delete(e),this._onModelChange())},30*1e3,this._localToDispose);return}for(const n of this._languageFeaturesService.codeLensProvider.all(e))if(typeof n.onDidChange=="function"){const s=n.onDidChange(()=>i.schedule());this._localToDispose.add(s)}const i=new ms(()=>{var s;const n=Date.now();(s=this._getCodeLensModelPromise)==null||s.cancel(),this._getCodeLensModelPromise=ks(r=>_M(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()},mn)},this._provideCodeLensDebounce.get(e));this._localToDispose.add(i),this._localToDispose.add(En(()=>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(g=>{!g.isValid()||c===g.getLineNumber()?a.push(g):(g.update(r),c=g.getLineNumber())});const h=new Lw;a.forEach(g=>{g.dispose(h,r),this._lenses.splice(this._lenses.indexOf(g),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(En(()=>{if(this._editor.getModel()){const n=ig.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 Lw;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=ig.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations(a=>{this._editor.changeViewZones(c=>{const h=new Lw;let g=0,f=0;for(;f<i.length&&g<this._lenses.length;){const p=i[f][0].symbol.range.startLineNumber,v=this._lenses[g].getLineNumber();v<p?(this._lenses[g].dispose(h,c),this._lenses.splice(g,1)):v===p?(this._lenses[g].updateCodeLensSymbols(i[f],h),f++,g++):(this._lenses.splice(g,0,new Yk(i[f],this._editor,h,c,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),g++,f++)}for(;g<this._lenses.length;)this._lenses[g].dispose(h,c),this._lenses.splice(g,1);for(;f<i.length;)this._lenses.push(new Yk(i[f],this._editor,h,c,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),f++;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=ks(a=>{const c=t.map((h,g)=>{const f=new Array(h.length),p=h.map((v,_)=>!v.symbol.command&&typeof v.provider.resolveCodeLens=="function"?Promise.resolve(v.provider.resolveCodeLens(e,v.symbol,a)).then(w=>{f[_]=w},ss):(f[_]=v.symbol,Promise.resolve(void 0)));return Promise.all(p).then(()=>{!a.isCancellationRequested&&!i[g].isDisposed()&&i[g].updateCommands(f)})});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=>{mn(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}},Vu.ID="css.editor.codeLens",Vu);gp=dB([sf(1,Et),sf(2,nr),sf(3,ys),sf(4,Qs),sf(5,vM)],gp);_i(gp.ID,gp,1);se(class extends Se{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:M.hasCodeLensProvider,label:y("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(xl),n=e.get(ys),s=e.get(Qs),r=t.getSelection().positionLineNumber,a=t.getContribution(gp.ID);if(!a)return;const c=await a.getModel();if(!c)return;const h=[];for(const p of c.lenses)p.symbol.command&&p.symbol.range.startLineNumber===r&&h.push({label:p.symbol.command.title,command:p.symbol.command});if(h.length===0)return;const g=await i.pick(h,{canPickMany:!1,placeHolder:y("placeHolder","Select a command")});if(!g)return;let f=g.command;if(c.isDisposed){const p=await a.getModel(),v=p==null?void 0:p.lenses.find(_=>{var w;return _.symbol.range.startLineNumber===r&&((w=_.symbol.command)==null?void 0:w.title)===f.title});if(!v||!v.symbol.command)return;f=v.symbol.command}try{await n.executeCommand(f.id,...f.arguments||[])}catch(p){s.error(p)}}});var bM=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},JS=function(o,e){return function(t,i){e(t,i,o)}};let fp=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 xi(new ng(Math.round(255*s.red),Math.round(255*s.green),Math.round(255*s.blue),r)),c=r?xi.Format.CSS.formatRGB(a):xi.Format.CSS.formatRGBA(a),h=r?xi.Format.CSS.formatHSL(a):xi.Format.CSS.formatHSLA(a),g=r?xi.Format.CSS.formatHex(a):xi.Format.CSS.formatHexA(a),f=[];return f.push({label:c,textEdit:{range:n,text:c}}),f.push({label:h,textEdit:{range:n,text:h}}),f.push({label:g,textEdit:{range:n,text:g}}),f}};fp=bM([JS(0,Il)],fp);let QS=class extends Ve{constructor(e,t){super(),this._register(e.colorProvider.register("*",new fp(t)))}};QS=bM([JS(0,Et),JS(1,Il)],QS);Mg(QS);async function yM(o,e,t,i=!0){return k1(new hB,o,e,t,i)}function wM(o,e,t,i){return Promise.resolve(t.provideColorPresentations(o,e,i))}class hB{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 uB{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 gB{constructor(e){this.colorInfo=e}async compute(e,t,i,n){const s=await e.provideColorPresentations(t,this.colorInfo,gi.None);return Array.isArray(s)&&n.push(...s),Array.isArray(s)}}async function k1(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 g=c[h];if(g instanceof fp)r=g;else try{await o.compute(g,t,i,a)&&(s=!0)}catch(f){ss(f)}}return s?a:r&&n?(await o.compute(r,t,i,a),a):[]}function SM(o,e){const{colorProvider:t}=o.get(Et),i=o.get(eo).getModel(e);if(!i)throw cl();const n=o.get(Tn).getValue("editor.defaultColorDecorators",{resource:e});return{model:i,colorProviderRegistry:t,isDefaultColorDecoratorsEnabled:n}}Sn.registerCommand("_executeDocumentColorProvider",function(o,...e){const[t]=e;if(!(t instanceof un))throw cl();const{model:i,colorProviderRegistry:n,isDefaultColorDecoratorsEnabled:s}=SM(o,t);return k1(new uB,n,i,gi.None,s)});Sn.registerCommand("_executeColorPresentationProvider",function(o,...e){const[t,i]=e,{uri:n,range:s}=i;if(!(n instanceof un)||!Array.isArray(t)||t.length!==4||!B.isIRange(s))throw cl();const{model:r,colorProviderRegistry:a,isDefaultColorDecoratorsEnabled:c}=SM(o,n),[h,g,f,p]=t;return k1(new gB({range:s,color:{red:h,green:g,blue:f,alpha:p}}),a,r,gi.None,c)});var fB=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},kw=function(o,e){return function(t,i){e(t,i,o)}},eC;const CM=Object.create({});var dc;let mg=(dc=class extends Ve{constructor(e,t,i,n){super(),this._editor=e,this._configurationService=t,this._languageFeaturesService=i,this._localToDispose=this._register(new Be),this._decorationsIds=[],this._colorDatas=new Map,this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=new gE(this._editor),this._decoratorLimitReporter=new pB,this._colorDecorationClassRefs=this._register(new Be),this._debounceInformation=n.for(i.colorProvider,"Document Colors",{min:eC.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 Kp,this._timeoutTimer.cancelAndSet(()=>{this._timeoutTimer=null,this.beginCompute()},this._debounceInformation.get(e)))})),this.beginCompute())}async beginCompute(){this._computePromise=ks(async e=>{const t=this._editor.getModel();if(!t)return[];const i=new Lo(!1),n=await yM(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){mn(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:ki.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,g=new ng(Math.round(r*255),Math.round(a*255),Math.round(c*255),h),f=`rgba(${g.r}, ${g.g}, ${g.b}, ${g.a})`,p=this._colorDecorationClassRefs.add(this._ruleFactory.createClassNameRef({backgroundColor:f}));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:cE,inlineClassName:`${p.className} colorpicker-color-decoration`,inlineClassNameAffectsLetterSpacing:!0,attachedData:CM}}})}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(B.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)}},eC=dc,dc.ID="editor.contrib.colorDetector",dc.RECOMPUTE_TIME=1e3,dc);mg=eC=fB([kw(1,Tn),kw(2,Et),kw(3,nr)],mg);class pB{constructor(){this._onDidChange=new ui,this._computed=0,this._limited=!1}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}}_i(mg.ID,mg,1);class mB{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 ui,this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=new ui,this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=new ui,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 Oo=yt;class _B extends Ve{constructor(e,t,i,n=!1){super(),this.model=t,this.showingStandaloneColorPicker=n,this._closeButton=null,this._domNode=Oo(".colorpicker-header"),pt(e,this._domNode),this._pickedColorNode=pt(this._domNode,Oo(".picked-color")),pt(this._pickedColorNode,Oo("span.codicon.codicon-color-mode")),this._pickedColorPresentation=pt(this._pickedColorNode,document.createElement("span")),this._pickedColorPresentation.classList.add("picked-color-presentation");const s=y("clickToToggleColorOptions","Click to toggle color options (rgb/hsl/hex)");this._pickedColorNode.setAttribute("title",s),this._originalColorNode=pt(this._domNode,Oo(".original-color")),this._originalColorNode.style.backgroundColor=xi.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=i.getColorTheme().getColor($L)||xi.white,this._register(i.onDidColorThemeChange(r=>{this.backgroundColor=r.getColor($L)||xi.white})),this._register(Ui(this._pickedColorNode,jn.CLICK,()=>this.model.selectNextColorPresentation())),this._register(Ui(this._originalColorNode,jn.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=xi.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 vB(this._domNode)))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(e){this._pickedColorNode.style.backgroundColor=xi.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 vB extends Ve{constructor(e){super(),this._onClicked=this._register(new ui),this.onClicked=this._onClicked.event,this._button=document.createElement("div"),this._button.classList.add("close-button"),pt(e,this._button);const t=document.createElement("div");t.classList.add("close-button-inner-div"),pt(this._button,t),pt(t,Oo(".button"+Xi.asCSSSelector(es("color-picker-close",Qt.close,y("closeIcon","Icon to close the color picker"))))).classList.add("close-icon"),this._register(Ui(this._button,jn.CLICK,()=>{this._onClicked.fire()}))}}class bB extends Ve{constructor(e,t,i,n=!1){super(),this.model=t,this.pixelRatio=i,this._insertButton=null,this._domNode=Oo(".colorpicker-body"),pt(e,this._domNode),this._saturationBox=new yB(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 SB(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 CB(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 xi(new h_(i.h,e,t,i.a))}onDidOpacityChange(e){const t=this.model.color.hsva;this.model.color=new xi(new h_(t.h,t.s,t.v,e))}onDidHueChange(e){const t=this.model.color.hsva,i=(1-e)*360;this.model.color=new xi(new h_(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 yB extends Ve{constructor(e,t,i){super(),this.model=t,this.pixelRatio=i,this._onDidChange=new ui,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new ui,this.onColorFlushed=this._onColorFlushed.event,this._domNode=Oo(".saturation-wrap"),pt(e,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",pt(this._domNode,this._canvas),this.selection=Oo(".saturation-selection"),pt(this._domNode,this.selection),this.layout(),this._register(Ui(this._domNode,jn.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 fE);const t=lo(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=Ui(e.target.ownerDocument,jn.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 xi(new h_(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=xi.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 xM extends Ve{constructor(e,t,i=!1){super(),this.model=t,this._onDidChange=new ui,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new ui,this.onColorFlushed=this._onColorFlushed.event,i?(this.domNode=pt(e,Oo(".standalone-strip")),this.overlay=pt(this.domNode,Oo(".standalone-overlay"))):(this.domNode=pt(e,Oo(".strip")),this.overlay=pt(this.domNode,Oo(".overlay"))),this.slider=pt(this.domNode,Oo(".slider")),this.slider.style.top="0px",this._register(Ui(this.domNode,jn.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 fE),i=lo(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=Ui(e.target.ownerDocument,jn.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 xM{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 xi(new ng(t,i,n,1)),r=new xi(new ng(t,i,n,0));this.overlay.style.background=`linear-gradient(to bottom, ${s} 0%, ${r} 100%)`}getValue(e){return e.hsva.a}}class SB extends xM{constructor(e,t,i=!1){super(e,t,i),this.domNode.classList.add("hue-strip")}getValue(e){return 1-e.hsva.h/360}}class CB extends Ve{constructor(e){super(),this._onClicked=this._register(new ui),this.onClicked=this._onClicked.event,this._button=pt(e,document.createElement("button")),this._button.classList.add("insert-button"),this._button.textContent="Insert",this._register(Ui(this._button,jn.CLICK,()=>{this._onClicked.fire()}))}get button(){return this._button}}class xB extends Yp{constructor(e,t,i,n,s=!1){super(),this.model=t,this.pixelRatio=i,this._register(TA.getInstance(ld(e)).onDidChange(()=>this.layout())),this._domNode=Oo(".colorpicker-widget"),e.appendChild(this._domNode),this.header=this._register(new _B(this._domNode,this.model,n,s)),this.body=this._register(new bB(this._domNode,this.model,this.pixelRatio,s))}layout(){this.body.layout()}get domNode(){return this._domNode}}class Iw{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 C_{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 mh{constructor(e){this.renderedHoverParts=e}dispose(){for(const e of this.renderedHoverParts)e.dispose()}}const Ph=new class{constructor(){this._participants=[]}register(e){this._participants.push(e)}getAll(){return this._participants}};var LM=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)}};class LB{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 pp=class{constructor(e,t){this._editor=e,this._themeService=t,this.hoverOrdinal=2}computeSync(e,t){return[]}computeAsync(e,t,i){return Jr.fromPromise(this._computeAsync(e,t,i))}async _computeAsync(e,t,i){if(!this._editor.hasModel())return[];const n=mg.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 IM(this,this._editor.getModel(),r.colorInfo,r.provider)]}return[]}renderHoverParts(e,t){const i=DM(this,this._editor,this._themeService,t,e);if(!i)return new mh([]);this._colorPicker=i.colorPicker;const n={hoverPart:i.hoverPart,hoverElement:this._colorPicker.domNode,dispose(){i.disposables.dispose()}};return new mh([n])}handleResize(){var e;(e=this._colorPicker)==null||e.layout()}isColorPickerVisible(){return!!this._colorPicker}};pp=LM([kM(1,Pr)],pp);class kB{constructor(e,t,i,n){this.owner=e,this.range=t,this.model=i,this.provider=n}}let mp=class{constructor(e,t){this._editor=e,this._themeService=t,this._color=null}async createColorHover(e,t,i){if(!this._editor.hasModel()||!mg.get(this._editor))return null;const s=await yM(i,this._editor.getModel(),gi.None);let r=null,a=null;for(const f of s){const p=f.colorInfo;B.containsRange(p.range,e.range)&&(r=p,a=f.provider)}const c=r??e,h=a??t,g=!!r;return{colorHover:await IM(this,this._editor.getModel(),c,h),foundInEditor:g}}async updateEditorModel(e){if(!this._editor.hasModel())return;const t=e.model;let i=new B(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn);this._color&&(await x_(this._editor.getModel(),t,this._color,i,e),i=EM(this._editor,i,t))}renderHoverParts(e,t){return DM(this,this._editor,this._themeService,t,e)}set color(e){this._color=e}get color(){return this._color}};mp=LM([kM(1,Pr)],mp);async function IM(o,e,t,i){const n=e.getValueInRange(t.range),{red:s,green:r,blue:a,alpha:c}=t.color,h=new ng(Math.round(s*255),Math.round(r*255),Math.round(a*255),c),g=new xi(h),f=await wM(e,t,i,gi.None),p=new mB(g,[],0);return p.colorPresentations=f||[],p.guessColorPresentation(g,n),o instanceof pp?new LB(o,B.lift(t.range),p,i):new kB(o,B.lift(t.range),p,i)}function DM(o,e,t,i,n){if(i.length===0||!e.hasModel())return;if(n.setMinimumDimensions){const p=e.getOption(67)+8;n.setMinimumDimensions(new bn(302,p))}const s=new Be,r=i[0],a=e.getModel(),c=r.model,h=s.add(new xB(n.fragment,c,e.getOption(144),t,o instanceof mp));let g=!1,f=new B(r.range.startLineNumber,r.range.startColumn,r.range.endLineNumber,r.range.endColumn);if(o instanceof mp){const p=r.model.color;o.color=p,x_(a,c,p,f,r),s.add(c.onColorFlushed(v=>{o.color=v}))}else s.add(c.onColorFlushed(async p=>{await x_(a,c,p,f,r),g=!0,f=EM(e,f,c)}));return s.add(c.onDidChangeColor(p=>{x_(a,c,p,f,r)})),s.add(e.onDidChangeModelContent(p=>{g?g=!1:(n.hide(),e.focus())})),{hoverPart:r,colorPicker:h,disposables:s}}function EM(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=B.lift(n.range),r=o.getModel()._setTrackedRange(null,s,3);return o.executeEdits("colorpicker",i),o.pushUndoStop(),o.getModel()._getTrackedRange(r)??s}async function x_(o,e,t,i,n){const s=await wM(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,gi.None);e.colorPresentations=s||[]}const PM="editor.action.showHover",IB="editor.action.showDefinitionPreviewHover",DB="editor.action.scrollUpHover",EB="editor.action.scrollDownHover",PB="editor.action.scrollLeftHover",TB="editor.action.scrollRightHover",MB="editor.action.pageUpHover",NB="editor.action.pageDownHover",RB="editor.action.goToTopHover",AB="editor.action.goToBottomHover",Ey="editor.action.increaseHoverVerbosityLevel",OB=y({key:"increaseHoverVerbosityLevel",comment:["Label for action that will increase the hover verbosity level."]},"Increase Hover Verbosity Level"),Py="editor.action.decreaseHoverVerbosityLevel",FB=y({key:"decreaseHoverVerbosityLevel",comment:["Label for action that will decrease the hover verbosity level."]},"Decrease Hover Verbosity Level"),TM="editor.action.inlineSuggest.commit",MM="editor.action.inlineSuggest.showPrevious",NM="editor.action.inlineSuggest.showNext";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},br=function(o,e){return function(t,i){e(t,i,o)}},L_;let tC=class extends Ve{constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=bo(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).showToolbar==="always"),this.sessionPosition=void 0,this.position=an(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 Dt(s.lineNumber,Math.min(r,((h=this.sessionPosition)==null?void 0:h.column)??Number.MAX_SAFE_INTEGER));return this.sessionPosition=a,a}),this._register(Jp((n,s)=>{const r=this.model.read(n);if(!r||!this.alwaysShowToolbar.read(n))return;const a=vE((h,g)=>{const f=g.add(this.instantiationService.createInstance(_g,this.editor,!0,this.position,r.selectedInlineCompletionIndex,r.inlineCompletionsCount,r.activeCommands));return e.addContentWidget(f),g.add(En(()=>e.removeContentWidget(f))),g.add(Vn(p=>{this.position.read(p)&&r.lastTriggerKind.read(p)!==dl.Explicit&&r.triggerExplicitly()})),f}),c=oy(this,(h,g)=>!!this.position.read(h)||!!g);s.add(Vn(h=>{c.read(h)&&a.read(h)}))}))}};tC=I1([br(2,ai)],tC);const HB=es("inline-suggestion-hints-next",Qt.chevronRight,y("parameterHintsNextIcon","Icon for show next parameter hint.")),WB=es("inline-suggestion-hints-previous",Qt.chevronLeft,y("parameterHintsPreviousIcon","Icon for show previous parameter hint."));var hc;let _g=(hc=class extends Ve{static get dropDownVisible(){return this._dropDownVisible}createCommandAction(e,t,i){const n=new sg(e,t,i,!0,()=>this._commandService.executeCommand(e)),s=this.keybindingService.lookupKeybinding(e,this._contextKeyService);let r=t;return s&&(r=y({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,g,f){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=g,this._menuService=f,this.id=`InlineSuggestionHintsContentWidget${L_.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=yr("div.inlineSuggestionsHints",{className:this.withBorder?".withBorder":""},[yr("div@toolBar")]),this.previousAction=this.createCommandAction(MM,y("previous","Previous"),Xi.asClassName(WB)),this.availableSuggestionCountAction=new sg("inlineSuggestionHints.availableSuggestionCount","",void 0,!1),this.nextAction=this.createCommandAction(NM,y("next","Next"),Xi.asClassName(HB)),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(lt.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new ms(()=>{this.availableSuggestionCountAction.label=""},100)),this.disableButtonsDebounced=this._register(new ms(()=>{this.previousAction.enabled=this.nextAction.enabled=!1},100)),this.toolBar=this._register(c.createInstance(iC,this.nodes.toolBar,lt.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:p=>p.startsWith("primary")},actionViewItemProvider:(p,v)=>{if(p instanceof og)return c.createInstance(zB,p,void 0);if(p===this.availableSuggestionCountAction){const _=new BB(void 0,p,{label:!0,icon:!1});return _.setClass("availableSuggestionCount"),_}},telemetrySource:"InlineSuggestionToolbar"})),this.toolBar.setPrependedPrimaryActions([this.previousAction,this.availableSuggestionCountAction,this.nextAction]),this._register(this.toolBar.onDidChangeDropdownVisibility(p=>{L_._dropDownVisible=p})),this._register(Vn(p=>{this._position.read(p),this.editor.layoutContentWidget(this)})),this._register(Vn(p=>{const v=this._suggestionCount.read(p),_=this._currentSuggestionIdx.read(p);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(Vn(p=>{const _=this._extraCommands.read(p).map(w=>({class:void 0,id:w.id,enabled:!0,tooltip:w.tooltip||"",label:w.title,run:S=>this._commandService.executeCommand(w.id)}));for(const[w,S]of this.inlineCompletionsActionsMenus.getActions())for(const D of S)D instanceof og&&_.push(D);_.length>0&&_.unshift(new ep),this.toolBar.setAdditionalSecondaryActions(_)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}},L_=hc,hc._dropDownVisible=!1,hc.id=0,hc);_g=L_=I1([br(6,ys),br(7,ai),br(8,ds),br(9,$i),br(10,xh)],_g);class BB extends rS{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 zB=class extends pE{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=yr("div.keybinding").root;this._register(new R0(t,A0,{disableTitle:!0,...mE})).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}updateTooltip(){}},iC=class extends _E{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=[];z0(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){Oa(this.prependedPrimaryActions,e,(t,i)=>t===i)||(this.prependedPrimaryActions=e,this.updateToolbar())}setAdditionalSecondaryActions(e){Oa(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};iC=I1([br(3,xh),br(4,$i),br(5,Eg),br(6,ds),br(7,ys),br(8,ra)],iC);function Ty(o,e,t){const i=lo(o);return!(e<i.left||e>i.left+i.width||t<i.top||t>i.top+i.height)}let VB=class{constructor(e,t,i){this.value=e,this.isComplete=t,this.hasLoadingMessage=i}};class RM extends Ve{constructor(e,t){super(),this._editor=e,this._computer=t,this._onResult=this._register(new ui),this.onResult=this._onResult.event,this._firstWaitScheduler=this._register(new ms(()=>this._triggerAsyncComputation(),0)),this._secondWaitScheduler=this._register(new ms(()=>this._triggerSyncComputation(),0)),this._loadingMessageScheduler=this._register(new ms(()=>this._triggerLoadingMessage(),0)),this._state=0,this._asyncIterable=null,this._asyncIterableDone=!1,this._result=[]}dispose(){this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),super.dispose()}get _hoverTime(){return this._editor.getOption(60).delay}get _firstWaitTime(){return this._hoverTime/2}get _secondWaitTime(){return this._hoverTime-this._firstWaitTime}get _loadingMessageTime(){return 3*this._hoverTime}_setState(e,t=!0){this._state=e,t&&this._fireResult()}_triggerAsyncComputation(){this._setState(2),this._secondWaitScheduler.schedule(this._secondWaitTime),this._computer.computeAsync?(this._asyncIterableDone=!1,this._asyncIterable=MA(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){mn(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 VB(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 D1{constructor(){this._onDidWillResize=new ui,this.onDidWillResize=this._onDidWillResize.event,this._onDidResize=new ui,this.onDidResize=this._onDidResize.event,this._sashListener=new Be,this._size=new bn(0,0),this._minSize=new bn(0,0),this._maxSize=new bn(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),this.domNode=document.createElement("div"),this._eastSash=new hu(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new hu(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new hu(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:qL.North}),this._southSash=new hu(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:qL.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(ps.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(ps.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(ps.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(ps.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 bn(t,e);bn.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 jB=30,UB=24;class $B extends Ve{constructor(e,t=new bn(10,10)){super(),this._editor=e,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._resizableNode=this._register(new D1),this._contentPosition=null,this._isResizing=!1,this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=bn.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 bn(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?Dt.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);return!t||!i?void 0:lo(t).top+i.top-jB}_availableVerticalSpaceBelow(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);if(!t||!i)return;const n=lo(t),s=Qp(t.ownerDocument.body),r=n.top+i.top+i.height;return s.height-r-UB}_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 qB=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Hm=function(o,e){return function(t,i){e(t,i,o)}},pa;const Jk=30,KB=6;var uc;let nC=(uc=class extends $B{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 bn(a,r);super(e,c),this._configurationService=i,this._accessibilityService=n,this._keybindingService=s,this._hover=this._register(new bE),this._onDidResize=this._register(new ui),this.onDidResize=this._onDidResize.event,this._minimumSize=c,this._hoverVisibleKey=M.hoverVisible.bindTo(t),this._hoverFocusedKey=M.hoverFocused.bindTo(t),pt(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(g=>{g.hasChanged(50)&&this._updateFont()}));const h=this._register(eg(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 pa.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 pa._applyDimensions(i,e,t)}_setContainerDomNodeDimensions(e,t){const i=this._hover.containerDomNode;return pa._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){pa._applyMaxDimensions(this._hover.contentsDomNode,e,t),pa._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 bn(e,t),this._setHoverWidgetMaxDimensions(e,t)}_resize(e){pa._lastDimensions=new bn(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=KB;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?Qp(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=lo(this.getDomNode());this._renderedHover.closestMouseDistance===void 0&&(this._renderedHover.closestMouseDistance=Qk(this._renderedHover.initialMousePosX,this._renderedHover.initialMousePosY,i.left,i.top,i.width,i.height));const n=Qk(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,pa._lastDimensions.height),t=Math.max(this._editor.getLayoutInfo().width*.66,500,pa._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=uu(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&&NA(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 bn(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 bn(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 bn(e,this._minimumSize.height)}onContentsChanged(){var n;this._removeConstraintsRenderNormally();const e=this._hover.containerDomNode;let t=uu(e),i=gr(e);if(this._resizableNode.layout(t,i),this._setHoverWidgetDimensions(i,t),t=uu(e),i=gr(e),this._contentWidth=i,this._updateMinimumWidth(),this._resizableNode.layout(t,i),(n=this._renderedHover)!=null&&n.showAtPosition){const s=uu(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-Jk})}scrollRight(){const e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e+Jk})}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})}},pa=uc,uc.ID="editor.contrib.resizableContentHoverWidget",uc._lastDimensions=new bn(0,0),uc);nC=pa=qB([Hm(1,$i),Hm(2,Tn),Hm(3,ry),Hm(4,ds)],nC);function Qk(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 ov{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 Jr.EMPTY;const i=ov._getLineDecorations(this._editor,t);return Jr.merge(this._participants.map(n=>n.computeAsync?n.computeAsync(t,i,e):Jr.EMPTY))}computeSync(){if(!this._editor.hasModel()||!this._anchor)return[];const e=ov._getLineDecorations(this._editor,this._anchor);let t=[];for(const i of this._participants)t=t.concat(i.computeSync(this._anchor,e));return fl(t)}}class AM{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 GB(this,this.anchor,t,this.isComplete)}}class GB extends AM{constructor(e,t,i,n){super(t,i,n),this.original=e}filter(e){return this.original.filter(e)}}var ZB=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},XB=function(o,e){return function(t,i){e(t,i,o)}};const eI=yt;let rv=class extends Ve{get hasContent(){return this._hasContent}constructor(e){super(),this._keybindingService=e,this.actions=[],this._hasContent=!1,this.hoverElement=eI("div.hover-row.status-bar"),this.hoverElement.tabIndex=0,this.actionsElement=pt(this.hoverElement,eI("div.actions"))}addAction(e){const t=this._keybindingService.lookupKeybinding(e.commandId),i=t?t.getLabel():null;this._hasContent=!0;const n=this._register(RA.render(this.actionsElement,e,i));return this.actions.push(n),n}append(e){const t=pt(this.actionsElement,e);return this._hasContent=!0,t}};rv=ZB([XB(0,ds)],rv);class YB{constructor(e,t,i){this.provider=e,this.hover=t,this.ordinal=i}}async function JB(o,e,t,i,n){const s=await Promise.resolve(o.provideHover(t,i,n)).catch(ss);if(!(!s||!QB(s)))return new YB(o,s,e)}function E1(o,e,t,i,n=!1){const r=o.ordered(e,n).map((a,c)=>JB(a,c,e,t,i));return Jr.fromPromises(r).coalesce()}function OM(o,e,t,i,n=!1){return E1(o,e,t,i,n).map(s=>s.hover).toPromise()}fo("_executeHoverProvider",(o,e,t)=>{const i=o.get(Et);return OM(i.hoverProvider,e,t,gi.None)});fo("_executeHoverProvider_recursive",(o,e,t)=>{const i=o.get(Et);return OM(i.hoverProvider,e,t,gi.None,!0)});function QB(o){const e=typeof o.range<"u",t=typeof o.contents<"u"&&o.contents&&o.contents.length>0;return e&&t}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},Wc=function(o,e){return function(t,i){e(t,i,o)}};const _u=yt,t4=es("hover-increase-verbosity",Qt.add,y("increaseHoverVerbosity","Icon for increaseing hover verbosity.")),i4=es("hover-decrease-verbosity",Qt.remove,y("decreaseHoverVerbosity","Icon for decreasing hover verbosity."));class Sr{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 FM{constructor(e,t,i){this.hover=e,this.hoverProvider=t,this.hoverPosition=i}supportsVerbosityAction(e){switch(e){case er.Increase:return this.hover.canIncreaseVerbosity??!1;case er.Decrease:return this.hover.canDecreaseVerbosity??!1}}}let _p=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 Sr(this,e.range,[new $s().appendText(y("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),g=this._editor.getOption(118),f=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:h});let p=!1;g>=0&&c>g&&e.range.startColumn>=g&&(p=!0,r.push(new Sr(this,e.range,[{value:y("stopped rendering","Rendering paused for long line for performance reasons. This can be configured via `editor.stopRenderingLineAfter`.")}],!1,a++))),!p&&typeof f=="number"&&c>=f&&r.push(new Sr(this,e.range,[{value:y("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 w=_.range.startLineNumber===n?_.range.startColumn:1,S=_.range.endLineNumber===n?_.range.endColumn:s,D=_.options.hoverMessage;if(!D||tp(D))continue;_.options.beforeContentClassName&&(v=!0);const E=new B(e.range.startLineNumber,w,e.range.startLineNumber,S);r.push(new Sr(this,E,yE(D),v,a++))}return r}computeAsync(e,t,i){if(!this._editor.hasModel()||e.type!==1)return Jr.EMPTY;const n=this._editor.getModel(),s=this._languageFeaturesService.hoverProvider;return s.has(n)?this._getMarkdownHovers(s,n,e,i):Jr.EMPTY}_getMarkdownHovers(e,t,i,n){const s=i.range.getStartPosition();return E1(e,t,s,n).filter(c=>!tp(c.hover.contents)).map(c=>{const h=c.hover.range?B.lift(c.hover.range):i.range,g=new FM(c.hover,c.provider,s);return new Sr(this,h,c.hover.contents,!1,c.ordinal,g)})}renderHoverParts(e,t){return this._renderedHoverParts=new n4(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))}};_p=e4([Wc(1,aa),Wc(2,oa),Wc(3,Tn),Wc(4,Et),Wc(5,ds),Wc(6,em),Wc(7,ys)],_p);class Wm{constructor(e,t,i){this.hoverPart=e,this.hoverElement=t,this.disposables=i}dispose(){this.disposables.dispose()}}class n4{constructor(e,t,i,n,s,r,a,c,h,g,f){this._hoverParticipant=i,this._editor=n,this._languageService=s,this._openerService=r,this._commandService=a,this._keybindingService=c,this._hoverService=h,this._configurationService=g,this._onFinishedRendering=f,this._ongoingHoverOperations=new Map,this._disposables=new Be,this.renderedHoverParts=this._renderHoverParts(e,t,this._onFinishedRendering),this._disposables.add(En(()=>{this.renderedHoverParts.forEach(p=>{p.dispose()}),this._ongoingHoverOperations.forEach(p=>{p.tokenSource.dispose(!0)})}))}_renderHoverParts(e,t,i){return e.sort(tm(n=>n.ordinal,ay)),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 Be;if(r.add(i),!s)return new Wm(e,n,r);const a=s.supportsVerbosityAction(er.Increase),c=s.supportsVerbosityAction(er.Decrease);if(!a&&!c)return new Wm(e,n,r);const h=_u("div.verbosity-actions");return n.prepend(h),r.add(this._renderHoverExpansionAction(h,er.Increase,a)),r.add(this._renderHoverExpansionAction(h,er.Decrease,c)),new Wm(e,n,r)}_renderMarkdownHover(e,t){return HM(this._editor,e,this._languageService,this._openerService,t)}_renderHoverExpansionAction(e,t,i){const n=new Be,s=t===er.Increase,r=pt(e,_u(Xi.asCSSSelector(s?t4:i4)));r.tabIndex=0;const a=new AA("mouse",!1,{target:e,position:{hoverPosition:0}},this._configurationService,this._hoverService);if(n.add(this._hoverService.setupManagedHover(a,r,o4(this._keybindingService,t))),!i)return r.classList.add("disabled"),n;r.classList.add("enabled");const c=()=>this._commandService.executeCommand(t===er.Increase?Ey:Py);return n.add(new OA(r,c)),n.add(new FA(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 FM(a,r.hoverProvider,r.hoverPosition),h=s.hoverPart,g=new Sr(this._hoverParticipant,h.range,a.contents,h.isBeforeContent,h.ordinal,c),f=this._renderHoverPart(g,this._onFinishedRendering);return this._replaceRenderedHoverPartAtIndex(t,f,g),i&&this._focusOnHoverPartWithIndex(t),{hoverPart:g,hoverElement:f.hoverElement}}async _fetchHover(e,t,i){let n=i===er.Increase?1:-1;const s=e.hoverProvider,r=this._ongoingHoverOperations.get(s);r&&(r.tokenSource.cancel(),n+=r.verbosityDelta);const a=new Is;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(g){ss(g)}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 Wm(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 s4(o,e,t,i,n){e.sort(tm(r=>r.ordinal,ay));const s=[];for(const r of e)s.push(HM(t,r,i,n,o.onContentsChanged));return new mh(s)}function HM(o,e,t,i,n){const s=new Be,r=_u("div.hover-row"),a=_u("div.hover-row-contents");r.appendChild(a);const c=e.contents;for(const g of c){if(tp(g))continue;const f=_u("div.markdown-hover"),p=pt(f,_u("div.hover-contents")),v=s.add(new Ng({editor:o},t,i));s.add(v.onDidRenderAsync(()=>{p.className="hover-contents code-hover-contents",n()}));const _=s.add(v.render(g));p.appendChild(_.element),a.appendChild(f)}return{hoverPart:e,hoverElement:r,dispose(){s.dispose()}}}function o4(o,e){switch(e){case er.Increase:{const t=o.lookupKeybinding(Ey);return t?y("increaseVerbosityWithKb","Increase Hover Verbosity ({0})",t.getLabel()):y("increaseVerbosity","Increase Hover Verbosity")}case er.Decrease:{const t=o.lookupKeybinding(Py);return t?y("decreaseVerbosityWithKb","Decrease Hover Verbosity ({0})",t.getLabel()):y("decreaseVerbosity","Decrease Hover Verbosity")}}}function sC(o,e){return!!o[e]}class Dw{constructor(e,t){this.target=e.target,this.isLeftClick=e.event.leftButton,this.isMiddleClick=e.event.middleButton,this.isRightClick=e.event.rightButton,this.hasTriggerModifier=sC(e.event,t.triggerModifier),this.hasSideBySideModifier=sC(e.event,t.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=e.event.detail<=1}}class tI{constructor(e,t){this.keyCodeIsTriggerKey=e.keyCode===t.triggerKey,this.keyCodeIsSideBySideKey=e.keyCode===t.triggerSideBySideKey,this.hasTriggerModifier=sC(e,t.triggerModifier)}}class Bm{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 iI(o){return o==="altKey"?Fa?new Bm(57,"metaKey",6,"altKey"):new Bm(5,"ctrlKey",6,"altKey"):Fa?new Bm(6,"altKey",57,"metaKey"):new Bm(6,"altKey",5,"ctrlKey")}class My extends Ve{constructor(e,t){super(),this._onMouseMoveOrRelevantKeyDown=this._register(new ui),this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event,this._onExecute=this._register(new ui),this.onExecute=this._onExecute.event,this._onCancel=this._register(new ui),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=iI(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=iI(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 Dw(i,this._opts)))),this._register(this._editor.onMouseDown(i=>this._onEditorMouseDown(new Dw(i,this._opts)))),this._register(this._editor.onMouseUp(i=>this._onEditorMouseUp(new Dw(i,this._opts)))),this._register(this._editor.onKeyDown(i=>this._onEditorKeyDown(new tI(i,this._opts)))),this._register(this._editor.onKeyUp(i=>this._onEditorKeyUp(new tI(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 WM{constructor(e,t){this.range=e,this.direction=t}}class P1{constructor(e,t,i){this.hint=e,this.anchor=t,this.provider=i,this._isResolved=!1}with(e){const t=new P1(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){ss(t),this._isResolved=!1}}}const xu=class xu{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??xu._emptyInlayHintList,a])}catch(h){ss(h)}}));if(await Promise.all(r.flat()),n.isCancellationRequested||t.isDisposed())throw new ty;return new xu(i,s,t)}constructor(e,t,i){this._disposables=new Be,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 g=xu._getRangeAtPosition(i,c);let f;g.getStartPosition().isBefore(c)?(f=B.fromPositions(g.getStartPosition(),c),h="after"):(f=B.fromPositions(c,g.getEndPosition()),h="before"),n.push(new P1(a,new WM(f,h),r))}}this.items=n.sort((s,r)=>Dt.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 B(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 B(i,c+1,i,h+1)}};xu._emptyInlayHintList=Object.freeze({dispose(){},hints:[]});let av=xu;function r4(o){return un.from({scheme:ro.command,path:o.id,query:o.arguments&&encodeURIComponent(JSON.stringify(o.arguments))}).toString()}var a4=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},Ka=function(o,e){return function(t,i){e(t,i,o)}};let Er=class extends HA{constructor(e,t,i,n,s,r,a,c,h,g,f,p,v){super(e,{...n.getRawOptions(),overflowWidgetsDomNode:n.getOverflowWidgetsDomNode()},i,s,r,a,c,h,g,f,p,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){V0(this._overwriteOptions,e,!0),super.updateOptions(this._overwriteOptions)}};Er=a4([Ka(4,ai),Ka(5,os),Ka(6,ys),Ka(7,$i),Ka(8,Pr),Ka(9,Qs),Ka(10,ry),Ka(11,ws),Ka(12,Et)],Er);const nI=new xi(new ng(0,122,204)),l4={showArrow:!0,showFrame:!0,className:"",frameColor:nI,arrowColor:nI,keepEditorSelection:!1},c4="vs.editor.contrib.zoneWidget";class d4{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 h4{constructor(e,t){this._id=e,this._domNode=t}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}}const gb=class gb{constructor(e){this._editor=e,this._ruleName=gb._IdGenerator.nextId(),this._decorations=this._editor.createDecorationsCollection(),this._color=null,this._height=-1}dispose(){this.hide(),KL(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(){KL(this._ruleName),zA(`.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:B.fromPositions(e),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}};gb._IdGenerator=new BA(".arrow-decoration-");let oC=gb;class u4{constructor(e,t={}){this._arrow=null,this._overlayWidget=null,this._resizeSash=null,this._viewZone=null,this._disposables=new Be,this.container=null,this._isShowing=!1,this.editor=e,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=WA(t),V0(this.options,l4,!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 oC(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=B.isIRange(e)?B.lift(e):B.fromPositions(e);this._isShowing=!0,this._showImpl(i,t),this._isShowing=!1,this._positionMarkerId.set([{range:i,options:ki.EMPTY}])}hide(){var e;this._viewZone&&(this.editor.changeViewZones(t=>{this._viewZone&&t.removeZone(this._viewZone.id)}),this._viewZone=null),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),(e=this._arrow)==null||e.hide(),this._positionMarkerId.clear()}_decoratingElementsHeight(){const e=this.editor.getOption(67);let t=0;if(this.options.showArrow){const i=Math.round(e/3);t+=2*i}if(this.options.showFrame){const i=Math.round(e/9);t+=2*i}return t}_showImpl(e,t){const i=e.getStartPosition(),n=this.editor.getLayoutInfo(),s=this._getWidth(n);this.domNode.style.width=`${s}px`,this.domNode.style.left=this._getLeft(n)+"px";const r=document.createElement("div");r.style.overflow="hidden";const a=this.editor.getOption(67);if(!this.options.allowUnlimitedHeight){const p=Math.max(12,this.editor.getLayoutInfo().height/a*.8);t=Math.min(t,p)}let 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(p=>{this._viewZone&&p.removeZone(this._viewZone.id),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this.domNode.style.top="-1000px",this._viewZone=new d4(r,i.lineNumber,i.column,t,v=>this._onViewZoneTop(v),v=>this._onViewZoneHeight(v),this.options.showInHiddenAreas,this.options.ordinal),this._viewZone.id=p.addZone(this._viewZone),this._overlayWidget=new h4(c4+this._viewZone.id,this.domNode),this.editor.addOverlayWidget(this._overlayWidget)}),this.container&&this.options.showFrame){const p=this.options.frameWidth?this.options.frameWidth:h;this.container.style.borderTopWidth=p+"px",this.container.style.borderBottomWidth=p+"px"}const g=t*a-this._decoratingElementsHeight();this.container&&(this.container.style.top=c+"px",this.container.style.height=g+"px",this.container.style.overflow="hidden"),this._doLayout(g,s),this.options.keepEditorSelection||this.editor.setSelection(e);const f=this.editor.getModel();if(f){const p=f.validateRange(new B(e.startLineNumber,1,e.endLineNumber+1,1));this.revealRange(p,p.startLineNumber===f.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 hu(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 BM=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},zM=function(o,e){return function(t,i){e(t,i,o)}};const VM=Ll("IPeekViewService");kl(VM,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 co;(function(o){o.inPeekEditor=new Ri("inReferenceSearchEditor",!0,y("inReferenceSearchEditor","Whether the current code editor is embedded inside peek")),o.notInPeekEditor=o.inPeekEditor.toNegated()})(co||(co={}));var ju;let lv=(ju=class{constructor(e,t){e instanceof Er&&co.inPeekEditor.bindTo(t)}dispose(){}},ju.ID="editor.contrib.referenceController",ju);lv=BM([zM(1,$i)],lv);_i(lv.ID,lv,0);function g4(o){const e=o.get(os).getFocusedCodeEditor();return e instanceof Er?e.getParentEditor():e}const f4={headerBackgroundColor:xi.white,primaryHeadingColor:xi.fromHex("#333333"),secondaryHeadingColor:xi.fromHex("#6c6c6cb3")};let cv=class extends u4{constructor(e,t,i){super(e,t),this.instantiationService=i,this._onDidClose=new ui,this.onDidClose=this._onDidClose.event,V0(this.options,f4,!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=yt(".head"),this._bodyElement=yt(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),e.appendChild(this._headElement),e.appendChild(this._bodyElement)}_fillHead(e,t){this._titleElement=yt(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),ml(this._titleElement,"click",s=>this._onTitleClick(s))),pt(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=yt("span.filename"),this._secondaryHeading=yt("span.dirname"),this._metaHeading=yt("span.meta"),pt(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);const i=yt(".peekview-actions");pt(this._headElement,i);const n=this._getActionBarOptions();this._actionbarWidget=new Yf(i,n),this._disposables.add(this._actionbarWidget),t||this._actionbarWidget.push(new sg("peekview.close",y("label.close","Close"),Xi.asClassName(Qt.close),!0,()=>(this.dispose(),Promise.resolve())),{label:!1,icon:!0})}_fillTitleIcon(e){}_getActionBarOptions(){return{actionViewItemProvider:VA.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:Na(this._secondaryHeading))}setMetaTitle(e){this._metaHeading&&(e?(this._metaHeading.innerText=e,wr(this._metaHeading)):No(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`)}};cv=BM([zM(2,ai)],cv);const p4=St("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:xi.black,hcLight:xi.white},y("peekViewTitleBackground","Background color of the peek view title area.")),jM=St("peekViewTitleLabel.foreground",{dark:xi.white,light:xi.black,hcDark:xi.white,hcLight:im},y("peekViewTitleForeground","Color of the peek view title.")),UM=St("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},y("peekViewTitleInfoForeground","Color of the peek view title info.")),m4=St("peekView.border",{dark:aS,light:aS,hcDark:pl,hcLight:pl},y("peekViewBorder","Color of the peek view borders and arrow.")),_4=St("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:xi.black,hcLight:xi.white},y("peekViewResultsBackground","Background color of the peek view result list."));St("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:xi.white,hcLight:im},y("peekViewResultsMatchForeground","Foreground color for line nodes in the peek view result list."));St("peekViewResult.fileForeground",{dark:xi.white,light:"#1E1E1E",hcDark:xi.white,hcLight:im},y("peekViewResultsFileForeground","Foreground color for file nodes in the peek view result list."));St("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},y("peekViewResultsSelectionBackground","Background color of the selected entry in the peek view result list."));St("peekViewResult.selectionForeground",{dark:xi.white,light:"#6C6C6C",hcDark:xi.white,hcLight:im},y("peekViewResultsSelectionForeground","Foreground color of the selected entry in the peek view result list."));const $M=St("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:xi.black,hcLight:xi.white},y("peekViewEditorBackground","Background color of the peek view editor."));St("peekViewEditorGutter.background",$M,y("peekViewEditorGutterBackground","Background color of the gutter in the peek view editor."));St("peekViewEditorStickyScroll.background",$M,y("peekViewEditorStickScrollBackground","Background color of sticky scroll in the peek view editor."));St("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},y("peekViewResultsMatchHighlight","Match highlight color in the peek view result list."));St("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},y("peekViewEditorMatchHighlight","Match highlight color in the peek view editor."));St("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:oh,hcLight:oh},y("peekViewEditorMatchHighlightBorder","Match highlight border in the peek view editor."));class Ec{constructor(e,t,i,n){this.isProviderFirst=e,this.parent=t,this.link=i,this._rangeCallback=n,this.id=jA.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?y({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,Ha(this.uri),this.range.startLineNumber,this.range.startColumn):y("aria.oneReference","in {0} on line {1} at column {2}",Ha(this.uri),this.range.startLineNumber,this.range.startColumn)}}class v4{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 B(n,c.startColumn,n,s),g=new B(r,a,r,1073741824),f=i.getValueInRange(h).replace(/^\s+/,""),p=i.getValueInRange(e),v=i.getValueInRange(g).replace(/\s+$/,"");return{value:f+p+v,highlight:{start:f.length,end:f.length+p.length}}}}class vp{constructor(e,t){this.parent=e,this.uri=t,this.children=[],this._previews=new xc}dispose(){Ks(this._previews.values()),this._previews.clear()}getPreview(e){return this._previews.get(e.uri)}get ariaMessage(){const e=this.children.length;return e===1?y("aria.fileReferences.1","1 symbol in {0}, full path {1}",Ha(this.uri),this.uri.fsPath):y("aria.fileReferences.N","{0} symbols in {1}, full path {2}",e,Ha(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 v4(i))}catch(i){mn(i)}return this}}class Co{constructor(e,t){this.groups=[],this.references=[],this._onDidChangeReferenceRange=new ui,this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event,this._links=e,this._title=t;const[i]=e;e.sort(Co._compareReferences);let n;for(const s of e)if((!n||!GL.isEqual(n.uri,s.uri,!0))&&(n=new vp(this,s.uri),this.groups.push(n)),n.children.length===0||Co._compareReferences(s,n.children[n.children.length-1])!==0){const r=new Ec(i===s,n,s,a=>this._onDidChangeReferenceRange.fire(a));this.references.push(r),n.children.push(r)}}dispose(){Ks(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new Co(this._links,this._title)}get title(){return this._title}get isEmpty(){return this.groups.length===0}get ariaMessage(){return this.isEmpty?y("aria.result.0","No results found"):this.references.length===1?y("aria.result.1","Found 1 symbol in {0}",this.references[0].uri.fsPath):this.groups.length===1?y("aria.result.n1","Found {0} symbols in {1}",this.references.length,this.groups[0].uri.fsPath):y("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:nm(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()&&B.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)||B.compareRangesUsingStarts(e.range,t.range)}}var Ny=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},Ry=function(o,e){return function(t,i){e(t,i,o)}},rC;let aC=class{constructor(e){this._resolverService=e}hasChildren(e){return e instanceof Co||e instanceof vp}getChildren(e){if(e instanceof Co)return e.groups;if(e instanceof vp)return e.resolve(this._resolverService).then(t=>t.children);throw new Error("bad tree")}};aC=Ny([Ry(0,la)],aC);class b4{getHeight(){return 23}getTemplateId(e){return e instanceof vp?dv.id:hv.id}}let lC=class{constructor(e){this._keybindingService=e}getKeyboardNavigationLabel(e){var t;if(e instanceof Ec){const i=(t=e.parent.getPreview(e))==null?void 0:t.preview(e.range);if(i)return i.value}return Ha(e.uri)}};lC=Ny([Ry(0,ds)],lC);class y4{getId(e){return e instanceof Ec?e.id:e.uri}}let cC=class extends Ve{constructor(e,t){super(),this._labelService=t;const i=document.createElement("div");i.classList.add("reference-file"),this.file=this._register(new wE(i,{supportHighlights:!0})),this.badge=new UA(pt(i,yt(".count")),{},$A),e.appendChild(i)}set(e,t){const i=j0(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(y("referencesCount","{0} references",n)):this.badge.setTitleFormat(y("referenceCount","{0} reference",n))}};cC=Ny([Ry(1,ip)],cC);var Sd;let dv=(Sd=class{constructor(e){this._instantiationService=e,this.templateId=rC.id}renderTemplate(e){return this._instantiationService.createInstance(cC,e)}renderElement(e,t,i){i.set(e.element,ly(e.filterData))}disposeTemplate(e){e.dispose()}},rC=Sd,Sd.id="FileReferencesRenderer",Sd);dv=rC=Ny([Ry(0,ai)],dv);class w4 extends Ve{constructor(e){super(),this.label=this._register(new qA(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(`${Ha(e.uri)}:${e.range.startLineNumber+1}:${e.range.startColumn+1}`);else{const{value:s,highlight:r}=i;t&&!np.isDefault(t)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(s,ly(t))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(s,[r]))}}}const fb=class fb{constructor(){this.templateId=fb.id}renderTemplate(e){return new w4(e)}renderElement(e,t,i){i.set(e.element,e.filterData)}disposeTemplate(e){e.dispose()}};fb.id="OneReferenceRenderer";let hv=fb;class S4{getWidgetAriaLabel(){return y("treeAriaLabel","References")}getAriaLabel(e){return e.ariaMessage}}var C4=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 pb=class pb{constructor(e,t){this._editor=e,this._model=t,this._decorations=new Map,this._decorationIgnoreSet=new Set,this._callOnDispose=new Be,this._callOnModelChange=new Be,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:pb.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(!B.equalsRange(s,n.range)){if(B.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()}};pb.DecorationOptions=ki.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"});let dC=pb;class x4{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 L4 extends ZA{}let hC=class extends cv{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 Be,this._callOnDispose=new Be,this._onDidSelectReference=new ui,this.onDidSelectReference=this._onDidSelectReference.event,this._dim=new bn(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(),Ks(this._preview),Ks(this._previewNotAvailableMessage),Ks(this._tree),Ks(this._previewModelReference),this._splitView.dispose(),super.dispose()}_applyTheme(e){const t=e.getColor(m4)||xi.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(p4)||xi.transparent,primaryHeadingColor:e.getColor(jM),secondaryHeadingColor:e.getColor(UM)})}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=pt(e,yt("div.messages")),No(this._messageContainer),this._splitView=new KA(e,{orientation:1}),this._previewContainer=pt(e,yt("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(Er,this._previewContainer,t,{},this.editor),No(this._previewContainer),this._previewNotAvailableMessage=this._instantiationService.createInstance(Yl,y("missingPreviewMessage","no preview available"),sp,Yl.DEFAULT_CREATION_OPTIONS,null),this._treeContainer=pt(e,yt("div.ref-tree.inline"));const i={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new S4,keyboardNavigationLabelProvider:this._instantiationService.createInstance(lC),identityProvider:new y4,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:_4}};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(ml(this._treeContainer,"keydown",s=>{s.equals(9)&&(this._keybindingService.dispatchEvent(s,s.target),s.stopPropagation())},!0)),this._tree=this._instantiationService.createInstance(L4,"ReferencesWidget",this._treeContainer,new b4,[this._instantiationService.createInstance(dv),this._instantiationService.createInstance(hv)],this._instantiationService.createInstance(aC),i),this._splitView.addView({onDidChange:ps.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:s=>{this._preview.layout({height:this._dim.height,width:s})}},ZL.Distribute),this._splitView.addView({onDidChange:ps.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)}},ZL.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 Ec&&(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")})),No(this._treeContainer)}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._dim=new bn(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=y("noResults","No results"),wr(this._messageContainer),Promise.resolve(void 0)):(No(this._messageContainer),this._decorationsManager=new dC(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"),wr(this._treeContainer),wr(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 Ec)return e;if(e instanceof vp&&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!==ro.inMemory?this.setTitle(GA(e.uri),this._uriLabel.getUriLabel(j0(e.uri))):this.setTitle(y("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}Ks(this._previewModelReference);const s=n.object;if(s){const r=this._preview.getModel()===s.textEditorModel?0:1,a=B.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()}};hC=C4([qh(3,Pr),qh(4,la),qh(5,ai),qh(6,VM),qh(7,ip),qh(8,ds)],hC);var k4=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Kh=function(o,e){return function(t,i){e(t,i,o)}},k_;const Th=new Ri("referenceSearchVisible",!1,y("referenceSearchVisible","Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));var Cd;let _h=(Cd=class{static get(e){return e.getContribution(k_.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 Be,this._requestIdPool=0,this._ignoreModelChangeEvent=!1,this._referenceSearchVisible=Th.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=x4.fromJSON(this._storageService.get(s,0,"{}"));this._widget=this._instantiationService.createInstance(hC,this._editor,this._defaultTreeKeyboardSupport,r),this._widget.setTitle(y("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:g}=c;if(h)switch(g){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(y("metaTitle.N","{0} ({1})",this._model.title,this._model.references.length));const g=this._editor.getModel().uri,f=new Dt(e.startLineNumber,e.startColumn),p=this._model.nearestReference(g,f);if(p)return this._widget.setSelection(p).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=B.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=k_.get(s),a=this._model.clone();this.closeWidget(),s.focus(),r==null||r.toggleWidget(i,ks(c=>Promise.resolve(a)),this._peekMode??!1)}},s=>{this._ignoreModelChangeEvent=!1,mn(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)}},k_=Cd,Cd.ID="editor.contrib.referencesController",Cd);_h=k_=k4([Kh(2,$i),Kh(3,os),Kh(4,Qs),Kh(5,ai),Kh(6,Rc),Kh(7,Tn)],_h);function Mh(o,e){const t=g4(o);if(!t)return;const i=_h.get(t);i&&e(i)}za.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:cs(2089,60),when:le.or(Th,co.inPeekEditor),handler(o){Mh(o,e=>{e.changeFocusBetweenPreviewAndReferences()})}});za.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:le.or(Th,co.inPeekEditor),handler(o){Mh(o,e=>{e.goToNextOrPreviousReference(!0)})}});za.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:le.or(Th,co.inPeekEditor),handler(o){Mh(o,e=>{e.goToNextOrPreviousReference(!1)})}});Sn.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference");Sn.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference");Sn.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch");Sn.registerCommand("closeReferenceSearch",o=>Mh(o,e=>e.closeWidget()));za.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:le.and(co.inPeekEditor,le.not("config.editor.stablePeek"))});za.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:le.and(Th,le.not("config.editor.stablePeek"),le.or(M.editorTextFocus,XA.negate()))});za.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:le.and(Th,SE,CE.negate(),xE.negate()),handler(o){var i;const t=(i=o.get(U0).lastFocusedList)==null?void 0:i.getFocus();Array.isArray(t)&&t[0]instanceof Ec&&Mh(o,n=>n.revealReference(t[0]))}});za.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:le.and(Th,SE,CE.negate(),xE.negate()),handler(o){var i;const t=(i=o.get(U0).lastFocusedList)==null?void 0:i.getFocus();Array.isArray(t)&&t[0]instanceof Ec&&Mh(o,n=>n.openReference(t[0],!0,!0))}});Sn.registerCommand("openReference",o=>{var i;const t=(i=o.get(U0).lastFocusedList)==null?void 0:i.getFocus();Array.isArray(t)&&t[0]instanceof Ec&&Mh(o,n=>n.openReference(t[0],!1,!0))});var qM=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},_f=function(o,e){return function(t,i){e(t,i,o)}};const T1=new Ri("hasSymbols",!1,y("hasSymbols","Whether there are symbol locations that can be navigated via keyboard-only.")),Ay=Ll("ISymbolNavigationService");let uC=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=T1.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 gC(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,g=!1;for(const f of t.references)if(H_(f.uri,a.uri))h=!0,g=g||B.containsPosition(f.range,c);else if(h)break;(!h||!g)&&this.reset()});this._currentState=LE(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:B.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?y("location.kb","Symbol {0} of {1}, {2} for next",this._currentIdx+1,this._currentModel.references.length,e.getLabel()):y("location","Symbol {0} of {1}",this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(t)}};uC=qM([_f(0,$i),_f(1,os),_f(2,Qs),_f(3,ds)],uC);kl(Ay,uC,1);Tt(new class extends go{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:T1,kbOpts:{weight:100,primary:70}})}runEditorCommand(o,e){return o.get(Ay).revealNext(e)}});za.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:T1,primary:9,handler(o){o.get(Ay).reset()}});let gC=class{constructor(e){this._listener=new Map,this._disposables=new Be,this._onDidChange=new ui,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(),Ks(this._listener.values())}_onDidAddEditor(e){this._listener.set(e,LE(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)}};gC=qM([_f(0,os)],gC);function fC(o,e){return e.uri.scheme===o.uri.scheme?!0:!YA(e.uri,ro.walkThroughSnippet,ro.vscodeChatCodeBlock,ro.vscodeChatCodeCompareBlock)}async function fm(o,e,t,i,n){const r=t.ordered(o,i).map(c=>Promise.resolve(n(c,o,e)).then(void 0,h=>{ss(h)})),a=await Promise.all(r);return fl(a.flat()).filter(c=>fC(o,c))}function pm(o,e,t,i,n){return fm(e,t,o,i,(s,r,a)=>s.provideDefinition(r,a,n))}function M1(o,e,t,i,n){return fm(e,t,o,i,(s,r,a)=>s.provideDeclaration(r,a,n))}function N1(o,e,t,i,n){return fm(e,t,o,i,(s,r,a)=>s.provideImplementation(r,a,n))}function R1(o,e,t,i,n){return fm(e,t,o,i,(s,r,a)=>s.provideTypeDefinition(r,a,n))}function mm(o,e,t,i,n,s){return fm(e,t,o,n,async(r,a,c)=>{var f,p;const h=(f=await r.provideReferences(a,c,{includeDeclaration:!0},s))==null?void 0:f.filter(v=>fC(a,v));if(!i||!h||h.length!==2)return h;const g=(p=await r.provideReferences(a,c,{includeDeclaration:!1},s))==null?void 0:p.filter(v=>fC(a,v));return g&&g.length===1?g:h})}async function Va(o){const e=await o(),t=new Co(e,""),i=t.references.map(n=>n.link);return t.dispose(),i}fo("_executeDefinitionProvider",(o,e,t)=>{const i=o.get(Et),n=pm(i.definitionProvider,e,t,!1,gi.None);return Va(()=>n)});fo("_executeDefinitionProvider_recursive",(o,e,t)=>{const i=o.get(Et),n=pm(i.definitionProvider,e,t,!0,gi.None);return Va(()=>n)});fo("_executeTypeDefinitionProvider",(o,e,t)=>{const i=o.get(Et),n=R1(i.typeDefinitionProvider,e,t,!1,gi.None);return Va(()=>n)});fo("_executeTypeDefinitionProvider_recursive",(o,e,t)=>{const i=o.get(Et),n=R1(i.typeDefinitionProvider,e,t,!0,gi.None);return Va(()=>n)});fo("_executeDeclarationProvider",(o,e,t)=>{const i=o.get(Et),n=M1(i.declarationProvider,e,t,!1,gi.None);return Va(()=>n)});fo("_executeDeclarationProvider_recursive",(o,e,t)=>{const i=o.get(Et),n=M1(i.declarationProvider,e,t,!0,gi.None);return Va(()=>n)});fo("_executeReferenceProvider",(o,e,t)=>{const i=o.get(Et),n=mm(i.referenceProvider,e,t,!1,!1,gi.None);return Va(()=>n)});fo("_executeReferenceProvider_recursive",(o,e,t)=>{const i=o.get(Et),n=mm(i.referenceProvider,e,t,!1,!0,gi.None);return Va(()=>n)});fo("_executeImplementationProvider",(o,e,t)=>{const i=o.get(Et),n=N1(i.implementationProvider,e,t,!1,gi.None);return Va(()=>n)});fo("_executeImplementationProvider_recursive",(o,e,t)=>{const i=o.get(Et),n=N1(i.implementationProvider,e,t,!0,gi.None);return Va(()=>n)});kr.appendMenuItem(lt.EditorContext,{submenu:lt.EditorContextPeek,title:y("peek.submenu","Peek"),group:"navigation",order:100});class vg{static is(e){return!e||typeof e!="object"?!1:!!(e instanceof vg||Dt.isIPosition(e.position)&&e.model)}constructor(e,t){this.model=e,this.position=t}}const hr=class hr extends na{static all(){return hr._allSymbolNavigationCommands.values()}static _patchConfig(e){const t={...e,f1:!0};if(t.menu)for(const i of ll.wrap(t.menu))(i.id===lt.EditorContext||i.id===lt.EditorContextPeek)&&(i.when=le.and(e.precondition,i.when));return t}constructor(e,t){super(hr._patchConfig(t)),this.configuration=e,hr._allSymbolNavigationCommands.set(t.id,this)}runEditorCommand(e,t,i,n){if(!t.hasModel())return Promise.resolve(void 0);const s=e.get(Qs),r=e.get(os),a=e.get(Gp),c=e.get(Ay),h=e.get(Et),g=e.get(ai),f=t.getModel(),p=t.getPosition(),v=vg.is(i)?i:new vg(f,p),_=new Qu(t,5),w=qp(this._getLocationModel(h,v.model,v.position,_.token),_.token).then(async S=>{var R;if(!S||_.token.isCancellationRequested)return;Ir(S.ariaMessage);let D;if(S.referenceAt(f.uri,p)){const z=this._getAlternativeCommand(t);!hr._activeAlternativeCommands.has(z)&&hr._allSymbolNavigationCommands.has(z)&&(D=hr._allSymbolNavigationCommands.get(z))}const E=S.references.length;if(E===0){if(!this.configuration.muteMessage){const z=f.getWordAtPosition(p);(R=So.get(t))==null||R.showMessage(this._getNoResultFoundMessage(z),p)}}else if(E===1&&D)hr._activeAlternativeCommands.add(this.desc.id),g.invokeFunction(z=>D.runEditorCommand(z,t,i,n).finally(()=>{hr._activeAlternativeCommands.delete(this.desc.id)}));else return this._onResult(r,c,t,S,n)},S=>{s.error(S)}).finally(()=>{_.dispose()});return a.showWhile(w,250),w}async _onResult(e,t,i,n,s){const r=this._getGoToPreference(i);if(!(i instanceof Er)&&(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(JA(i)&&(r=i.targetSelectionRange),r||(r=i.range),!r)return;const a=await t.openCodeEditor({resource:i.uri,options:{selection:B.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=_h.get(e);n&&e.hasModel()?n.toggleWidget(i??e.getSelection(),ks(s=>Promise.resolve(t)),this.configuration.openInPeek):t.dispose()}};hr._allSymbolNavigationCommands=new Map,hr._activeAlternativeCommands=new Set;let wl=hr;class _m extends wl{async _getLocationModel(e,t,i,n){return new Co(await pm(e.definitionProvider,t,i,!1,n),y("def.title","Definitions"))}_getNoResultFoundMessage(e){return e&&e.word?y("noResultWord","No definition found for '{0}'",e.word):y("generic.noResults","No definition found")}_getAlternativeCommand(e){return e.getOption(58).alternativeDefinitionCommand}_getGoToPreference(e){return e.getOption(58).multipleDefinitions}}var gc;cn((gc=class extends _m{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:gc.id,title:{...kt("actions.goToDecl.label","Go to Definition"),mnemonicTitle:y({key:"miGotoDefinition",comment:["&& denotes a mnemonic"]},"Go to &&Definition")},precondition:M.hasDefinitionProvider,keybinding:[{when:M.editorTextFocus,primary:70,weight:100},{when:le.and(M.editorTextFocus,kE),primary:2118,weight:100}],menu:[{id:lt.EditorContext,group:"navigation",order:1.1},{id:lt.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),Sn.registerCommandAlias("editor.action.goToDeclaration",gc.id)}},gc.id="editor.action.revealDefinition",gc));var fc;cn((fc=class extends _m{constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:fc.id,title:kt("actions.goToDeclToSide.label","Open Definition to the Side"),precondition:le.and(M.hasDefinitionProvider,M.isInEmbeddedEditor.toNegated()),keybinding:[{when:M.editorTextFocus,primary:cs(2089,70),weight:100},{when:le.and(M.editorTextFocus,kE),primary:cs(2089,2118),weight:100}]}),Sn.registerCommandAlias("editor.action.openDeclarationToTheSide",fc.id)}},fc.id="editor.action.revealDefinitionAside",fc));var pc;cn((pc=class extends _m{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:pc.id,title:kt("actions.previewDecl.label","Peek Definition"),precondition:le.and(M.hasDefinitionProvider,co.notInPeekEditor,M.isInEmbeddedEditor.toNegated()),keybinding:{when:M.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:lt.EditorContextPeek,group:"peek",order:2}}),Sn.registerCommandAlias("editor.action.previewDeclaration",pc.id)}},pc.id="editor.action.peekDefinition",pc));class KM extends wl{async _getLocationModel(e,t,i,n){return new Co(await M1(e.declarationProvider,t,i,!1,n),y("decl.title","Declarations"))}_getNoResultFoundMessage(e){return e&&e.word?y("decl.noResultWord","No declaration found for '{0}'",e.word):y("decl.generic.noResults","No declaration found")}_getAlternativeCommand(e){return e.getOption(58).alternativeDeclarationCommand}_getGoToPreference(e){return e.getOption(58).multipleDeclarations}}var xd;cn((xd=class extends KM{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:xd.id,title:{...kt("actions.goToDeclaration.label","Go to Declaration"),mnemonicTitle:y({key:"miGotoDeclaration",comment:["&& denotes a mnemonic"]},"Go to &&Declaration")},precondition:le.and(M.hasDeclarationProvider,M.isInEmbeddedEditor.toNegated()),menu:[{id:lt.EditorContext,group:"navigation",order:1.3},{id:lt.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}_getNoResultFoundMessage(e){return e&&e.word?y("decl.noResultWord","No declaration found for '{0}'",e.word):y("decl.generic.noResults","No declaration found")}},xd.id="editor.action.revealDeclaration",xd));cn(class extends KM{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:kt("actions.peekDecl.label","Peek Declaration"),precondition:le.and(M.hasDeclarationProvider,co.notInPeekEditor,M.isInEmbeddedEditor.toNegated()),menu:{id:lt.EditorContextPeek,group:"peek",order:3}})}});class GM extends wl{async _getLocationModel(e,t,i,n){return new Co(await R1(e.typeDefinitionProvider,t,i,!1,n),y("typedef.title","Type Definitions"))}_getNoResultFoundMessage(e){return e&&e.word?y("goToTypeDefinition.noResultWord","No type definition found for '{0}'",e.word):y("goToTypeDefinition.generic.noResults","No type definition found")}_getAlternativeCommand(e){return e.getOption(58).alternativeTypeDefinitionCommand}_getGoToPreference(e){return e.getOption(58).multipleTypeDefinitions}}var Ld;cn((Ld=class extends GM{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Ld.ID,title:{...kt("actions.goToTypeDefinition.label","Go to Type Definition"),mnemonicTitle:y({key:"miGotoTypeDefinition",comment:["&& denotes a mnemonic"]},"Go to &&Type Definition")},precondition:M.hasTypeDefinitionProvider,keybinding:{when:M.editorTextFocus,primary:0,weight:100},menu:[{id:lt.EditorContext,group:"navigation",order:1.4},{id:lt.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}},Ld.ID="editor.action.goToTypeDefinition",Ld));var kd;cn((kd=class extends GM{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:kd.ID,title:kt("actions.peekTypeDefinition.label","Peek Type Definition"),precondition:le.and(M.hasTypeDefinitionProvider,co.notInPeekEditor,M.isInEmbeddedEditor.toNegated()),menu:{id:lt.EditorContextPeek,group:"peek",order:4}})}},kd.ID="editor.action.peekTypeDefinition",kd));class ZM extends wl{async _getLocationModel(e,t,i,n){return new Co(await N1(e.implementationProvider,t,i,!1,n),y("impl.title","Implementations"))}_getNoResultFoundMessage(e){return e&&e.word?y("goToImplementation.noResultWord","No implementation found for '{0}'",e.word):y("goToImplementation.generic.noResults","No implementation found")}_getAlternativeCommand(e){return e.getOption(58).alternativeImplementationCommand}_getGoToPreference(e){return e.getOption(58).multipleImplementations}}var Id;cn((Id=class extends ZM{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Id.ID,title:{...kt("actions.goToImplementation.label","Go to Implementations"),mnemonicTitle:y({key:"miGotoImplementation",comment:["&& denotes a mnemonic"]},"Go to &&Implementations")},precondition:M.hasImplementationProvider,keybinding:{when:M.editorTextFocus,primary:2118,weight:100},menu:[{id:lt.EditorContext,group:"navigation",order:1.45},{id:lt.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}},Id.ID="editor.action.goToImplementation",Id));var Dd;cn((Dd=class extends ZM{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Dd.ID,title:kt("actions.peekImplementation.label","Peek Implementations"),precondition:le.and(M.hasImplementationProvider,co.notInPeekEditor,M.isInEmbeddedEditor.toNegated()),keybinding:{when:M.editorTextFocus,primary:3142,weight:100},menu:{id:lt.EditorContextPeek,group:"peek",order:5}})}},Dd.ID="editor.action.peekImplementation",Dd));class XM extends wl{_getNoResultFoundMessage(e){return e?y("references.no","No references found for '{0}'",e.word):y("references.noGeneric","No references found")}_getAlternativeCommand(e){return e.getOption(58).alternativeReferenceCommand}_getGoToPreference(e){return e.getOption(58).multipleReferences}}cn(class extends XM{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{...kt("goToReferences.label","Go to References"),mnemonicTitle:y({key:"miGotoReference",comment:["&& denotes a mnemonic"]},"Go to &&References")},precondition:le.and(M.hasReferenceProvider,co.notInPeekEditor,M.isInEmbeddedEditor.toNegated()),keybinding:{when:M.editorTextFocus,primary:1094,weight:100},menu:[{id:lt.EditorContext,group:"navigation",order:1.45},{id:lt.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}async _getLocationModel(e,t,i,n){return new Co(await mm(e.referenceProvider,t,i,!0,!1,n),y("ref.title","References"))}});cn(class extends XM{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:kt("references.action.label","Peek References"),precondition:le.and(M.hasReferenceProvider,co.notInPeekEditor,M.isInEmbeddedEditor.toNegated()),menu:{id:lt.EditorContextPeek,group:"peek",order:6}})}async _getLocationModel(e,t,i,n){return new Co(await mm(e.referenceProvider,t,i,!1,!1,n),y("ref.title","References"))}});class I4 extends wl{constructor(e,t,i){super(e,{id:"editor.action.goToLocation",title:kt("label.generic","Go to Any Symbol"),precondition:le.and(co.notInPeekEditor,M.isInEmbeddedEditor.toNegated())}),this._references=t,this._gotoMultipleBehaviour=i}async _getLocationModel(e,t,i,n){return new Co(this._references,y("generic.title","Locations"))}_getNoResultFoundMessage(e){return e&&y("generic.noResult","No results for '{0}'",e.word)||""}_getGoToPreference(e){return this._gotoMultipleBehaviour??e.getOption(58).multipleReferences}_getAlternativeCommand(){return""}}Sn.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:un},{name:"position",description:"The position at which to start",constraint:Dt.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)=>{Gi(un.isUri(e)),Gi(Dt.isIPosition(t)),Gi(Array.isArray(i)),Gi(typeof n>"u"||typeof n=="string"),Gi(typeof r>"u"||typeof r=="boolean");const a=o.get(os),c=await a.openCodeEditor({resource:e},a.getFocusedCodeEditor());if(IE(c))return c.setPosition(t),c.revealPositionInCenterIfOutsideViewport(t,0),c.invokeWithinContext(h=>{const g=new class extends I4{_getNoResultFoundMessage(f){return s||super._getNoResultFoundMessage(f)}}({muteMessage:!s,openInPeek:!!r,openToSide:!1},i,n);h.get(ai).invokeFunction(g.run.bind(g),c)})}});Sn.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:un},{name:"position",description:"The position at which to start",constraint:Dt.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(ys).executeCommand("editor.action.goToLocations",e,t,i,n,void 0,!0)}});Sn.registerCommand({id:"editor.action.findReferences",handler:(o,e,t)=>{Gi(un.isUri(e)),Gi(Dt.isIPosition(t));const i=o.get(Et),n=o.get(os);return n.openCodeEditor({resource:e},n.getFocusedCodeEditor()).then(s=>{if(!IE(s)||!s.hasModel())return;const r=_h.get(s);if(!r)return;const a=ks(h=>mm(i.referenceProvider,s.getModel(),Dt.lift(t),!1,!1,h).then(g=>new Co(g,y("ref.title","References")))),c=new B(t.lineNumber,t.column,t.lineNumber,t.column);return Promise.resolve(r.toggleWidget(c,a,!1))})}});Sn.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");async function D4(o,e,t,i){const n=o.get(la),s=o.get(Eg),r=o.get(ys),a=o.get(ai),c=o.get(Qs);if(await i.item.resolve(gi.None),!i.part.location)return;const h=i.part.location,g=[],f=new Set(kr.getMenuItems(lt.EditorContext).map(v=>QA(v)?v.command.id:Iy()));for(const v of wl.all())f.has(v.desc.id)&&g.push(new sg(v.desc.id,og.label(v.desc,{renderShortTitle:!0}),void 0,!0,async()=>{const _=await n.createModelReference(h.uri);try{const w=new vg(_.object.textEditorModel,B.getStartPosition(h.range)),S=i.item.anchor.range;await a.invokeFunction(v.runEditorCommand.bind(v),e,w,S)}finally{_.dispose()}}));if(i.part.command){const{command:v}=i.part;g.push(new ep),g.push(new sg(v.id,v.title,void 0,!0,async()=>{try{await r.executeCommand(v.id,...v.arguments??[])}catch(_){c.notify({severity:$0.Error,source:i.item.provider.displayName,message:_})}}))}const p=e.getOption(128);s.showContextMenu({domForShadowRoot:p?e.getDomNode()??void 0:void 0,getAnchor:()=>{const v=lo(t);return{x:v.left,y:v.top+v.height+8}},getActions:()=>g,onHide:()=>{e.focus()},autoSelectFirstItem:!0})}async function YM(o,e,t,i){const s=await o.get(la).createModelReference(i.uri);await t.invokeWithinContext(async r=>{const a=e.hasSideBySideModifier,c=r.get($i),h=co.inPeekEditor.getValue(c),g=!a&&t.getOption(89)&&!h;return new _m({openToSide:a,openInPeek:g,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(r,new vg(s.object.textEditorModel,B.getStartPosition(i.range)),B.lift(i.range))}),s.dispose()}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},Gh=function(o,e){return function(t,i){e(t,i,o)}},lu;class uv{constructor(){this._entries=new Xp(50)}get(e){const t=uv._key(e);return this._entries.get(t)}set(e,t){const i=uv._key(e);this._entries.set(i,t)}static _key(e){return`${e.uri.toString()}/${e.getVersionId()}`}}const JM=Ll("IInlayHintsCache");kl(JM,uv,1);class pC{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 P4{constructor(e,t){this.part=e,this.hasTriggerModifier=t}}var al;let bp=(al=class{static get(e){return e.getContribution(lu.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 Be,this._sessionDisposables=new Be,this._decorationsMetadata=new Map,this._ruleFactory=new gE(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(eO.getInstance().event(h=>{if(!this._editor.hasModel())return;const g=h.altKey&&h.ctrlKey&&!(h.shiftKey||h.metaKey)?c:a;if(g!==this._activeRenderMode){this._activeRenderMode=g;const f=this._editor.getModel(),p=this._copyInlayHintsWithCurrentAnchor(f);this._updateHintsDecorators([f.getFullModelRange()],p),r.schedule(0)}}))}const i=this._inlayHintsCache.get(t);i&&this._updateHintsDecorators([t.getFullModelRange()],i),this._sessionDisposables.add(En(()=>{t.isDisposed()||this._cacheHintsForFastRestore(t)}));let n;const s=new Set,r=new ms(async()=>{const a=Date.now();n==null||n.dispose(!0),n=new Is;const c=t.onWillDispose(()=>n==null?void 0:n.cancel());try{const h=n.token,g=await av.create(this._languageFeaturesService.inlayHintsProvider,t,this._getHintsRanges(),h);if(r.delay=this._debounceInfo.update(t,Date.now()-a),h.isCancellationRequested){g.dispose();return}for(const f of g.provider)typeof f.onDidChangeInlayHints=="function"&&!s.has(f)&&(s.add(f),this._sessionDisposables.add(f.onDidChangeInlayHints(()=>{r.isScheduled()||r.schedule()})));this._sessionDisposables.add(g),this._updateHintsDecorators(g.ranges,g.items),this._cacheHintsForFastRestore(t)}catch(h){mn(h)}finally{n.dispose(),c.dispose()}},this._debounceInfo.get(t));this._sessionDisposables.add(r),this._sessionDisposables.add(En(()=>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 Be,t=e.add(new My(this._editor)),i=new Be;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 Is;i.add(En(()=>c.dispose(!0))),r.item.resolve(c.token),this._activeInlayHintPart=r.part.command||r.part.location?new P4(r,s.hasTriggerModifier):void 0;const h=a.validatePosition(r.item.hint.position).lineNumber,g=new B(h,1,h,a.getLineMaxColumn(h)),f=this._getInlineHintsForRange(g);this._updateHintsDecorators([g],f),i.add(En(()=>{this._activeInlayHintPart=void 0,this._updateHintsDecorators([g],f)}))})),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(YM,n,this._editor,r.location):tO.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(gi.None),Fo(i.item.hint.textEdits))){const n=i.item.hint.textEdits.map(s=>Kn.replace(B.lift(s.range),s.text));this._editor.executeEdits("inlayHint.default",n),e()}})}_installContextMenu(){return this._editor.onContextMenu(async e=>{if(!iO(e.event.target))return;const t=this._getInlayHintLabelPart(e);t&&await this._instaService.invokeFunction(D4,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 q0&&(t==null?void 0:t.attachedData)instanceof pC)return t.attachedData}async _invokeCommand(e,t){try{await this._commandService.executeCommand(e.id,...e.arguments??[])}catch(i){this._notificationService.notify({severity:$0.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 WM(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(B.compareRangesUsingStarts)){const r=t.validateRange(new B(s.startLineNumber-30,s.startColumn,s.endLineNumber+30,s.endColumn));n.length===0||!B.areIntersectingOrTouching(n[n.length-1],r)?n.push(r):n[n.length-1]=B.plusRange(n[n.length-1],r)}return n}_updateHintsDecorators(e,t){var _,w;const i=[],n=(S,D,E,R,z)=>{const H={content:E,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:D.className,cursorStops:R,attachedData:z};i.push({item:S,classNameRef:D,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?H:void 0}}})},s=(S,D)=>{const E=this._ruleFactory.createClassNameRef({width:`${r/3|0}px`,display:"inline-block"});n(S,E," ",D?gu.Right:gu.None)},{fontSize:r,fontFamily:a,padding:c,isUniform:h}=this._getLayoutInfo(),g="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(g,a);let f={line:0,totalLen:0};for(const S of t){if(f.line!==S.anchor.range.startLineNumber&&(f={line:S.anchor.range.startLineNumber,totalLen:0}),f.totalLen>lu._MAX_LABEL_LEN)continue;S.hint.paddingLeft&&s(S,!1);const D=typeof S.hint.label=="string"?[{label:S.hint.label}]:S.hint.label;for(let E=0;E<D.length;E++){const R=D[E],z=E===0,H=E===D.length-1,ee={fontSize:`${r}px`,fontFamily:`var(${g}), ${B0.fontFamily}`,verticalAlign:h?"baseline":"middle",unicodeBidi:"isolate"};Fo(S.hint.textEdits)&&(ee.cursor="default"),this._fillInColors(ee,S.hint),(R.command||R.location)&&((_=this._activeInlayHintPart)==null?void 0:_.part.item)===S&&this._activeInlayHintPart.part.index===E&&(ee.textDecoration="underline",this._activeInlayHintPart.hasTriggerModifier&&(ee.color=hs(nO),ee.cursor="pointer")),c&&(z&&H?(ee.padding=`1px ${Math.max(1,r/4)|0}px`,ee.borderRadius=`${r/4|0}px`):z?(ee.padding=`1px 0 1px ${Math.max(1,r/4)|0}px`,ee.borderRadius=`${r/4|0}px 0 0 ${r/4|0}px`):H?(ee.padding=`1px ${Math.max(1,r/4)|0}px 1px 0`,ee.borderRadius=`0 ${r/4|0}px ${r/4|0}px 0`):ee.padding="1px 0 1px 0");let X=R.label;f.totalLen+=X.length;let me=!1;const Le=f.totalLen-lu._MAX_LABEL_LEN;if(Le>0&&(X=X.slice(0,-Le)+"…",me=!0),n(S,this._ruleFactory.createClassNameRef(ee),T4(X),H&&!S.hint.paddingRight?gu.Right:gu.None,new pC(S,E)),me)break}if(S.hint.paddingRight&&s(S,!0),i.length>lu._MAX_DECORATORS)break}const p=[];for(const[S,D]of this._decorationsMetadata){const E=(w=this._editor.getModel())==null?void 0:w.getDecorationRange(S);E&&e.some(R=>R.containsRange(E))&&(p.push(S),D.classNameRef.dispose(),this._decorationsMetadata.delete(S))}const v=ig.capture(this._editor);this._editor.changeDecorations(S=>{const D=S.deltaDecorations(p,i.map(E=>E.decoration));for(let E=0;E<D.length;E++){const R=i[E];this._decorationsMetadata.set(D[E],R)}}),v.restore(this._editor)}_fillInColors(e,t){t.kind===XL.Parameter?(e.backgroundColor=hs(sO),e.color=hs(oO)):t.kind===XL.Type?(e.backgroundColor=hs(rO),e.color=hs(aO)):(e.backgroundColor=hs(lO),e.color=hs(cO))}_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()}},lu=al,al.ID="editor.contrib.InlayHints",al._MAX_DECORATORS=1500,al._MAX_LABEL_LEN=43,al);bp=lu=E4([Gh(1,Et),Gh(2,nr),Gh(3,JM),Gh(4,ys),Gh(5,Qs),Gh(6,ai)],bp);function T4(o){return o.replace(/[ \t]/g," ")}Sn.registerCommand("_executeInlayHintProvider",async(o,...e)=>{const[t,i]=e;Gi(un.isUri(t)),Gi(B.isIRange(i));const{inlayHintsProvider:n}=o.get(Et),s=await o.get(la).createModelReference(t);try{const r=await av.create(n,s.object.textEditorModel,[B.lift(i)],gi.None),a=r.items.map(c=>c.hint);return setTimeout(()=>r.dispose(),0),a}finally{s.dispose()}});var M4=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},Fl=function(o,e){return function(t,i){e(t,i,o)}};class sI extends C_{constructor(e,t,i,n){super(10,t,e.item.anchor.range,i,n,!0),this.part=e}}let gv=class extends _p{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(!bp.get(this._editor)||e.target.type!==6)return null;const i=(n=e.target.detail.injectedText)==null?void 0:n.options;return i instanceof q0&&i.attachedData instanceof pC?new sI(i.attachedData,this,e.event.posx,e.event.posy):null}computeSync(){return[]}computeAsync(e,t,i){return e instanceof sI?new Jr(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 $s().appendText(s.item.hint.tooltip):s.item.hint.tooltip&&(r=s.item.hint.tooltip),r&&n.emitOne(new Sr(this,e.range,[r],!1,0)),Fo(s.item.hint.textEdits)&&n.emitOne(new Sr(this,e.range,[new $s().appendText(y("hint.dbl","Double-click to insert"))],!1,10001));let a;if(typeof s.part.tooltip=="string"?a=new $s().appendText(s.part.tooltip):s.part.tooltip&&(a=s.part.tooltip),a&&n.emitOne(new Sr(this,e.range,[a],!1,1)),s.part.location||s.part.command){let h;const f=this._editor.getOption(78)==="altKey"?Fa?y("links.navigate.kb.meta.mac","cmd + click"):y("links.navigate.kb.meta","ctrl + click"):Fa?y("links.navigate.kb.alt.mac","option + click"):y("links.navigate.kb.alt","alt + click");s.part.location&&s.part.command?h=new $s().appendText(y("hint.defAndCommand","Go to Definition ({0}), right click for more",f)):s.part.location?h=new $s().appendText(y("hint.def","Go to Definition ({0})",f)):s.part.command&&(h=new $s(`[${y("hint.cmd","Execute Command")}](${r4(s.part.command)} "${s.part.command.title}") (${f})`,{isTrusted:!0})),h&&n.emitOne(new Sr(this,e.range,[h],!1,1e4))}const c=await this._resolveInlayHintLabelPartHover(s,i);for await(const h of c)n.emitOne(h)}):Jr.EMPTY}async _resolveInlayHintLabelPartHover(e,t){if(!e.part.location)return Jr.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)?E1(this._languageFeaturesService.hoverProvider,r,new Dt(n.startLineNumber,n.startColumn),t).filter(a=>!tp(a.hover.contents)).map(a=>new Sr(this,e.item.anchor.range,a.hover.contents,!1,2+a.ordinal)):Jr.EMPTY}finally{s.dispose()}}};gv=M4([Fl(1,aa),Fl(2,oa),Fl(3,ds),Fl(4,em),Fl(5,Tn),Fl(6,la),Fl(7,Et),Fl(8,ys)],gv);class A1 extends Ve{constructor(e,t,i,n,s,r){super();const a=t.anchor,c=t.hoverParts;this._renderedHoverParts=this._register(new mC(e,i,c,r,s));const{showAtPosition:h,showAtSecondaryPosition:g}=A1.computeHoverPositions(e,a.range,c);this.shouldAppearBeforeContent=c.some(f=>f.isBeforeContent),this.showAtPosition=h,this.showAtSecondaryPosition=g,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 g=e._getViewModel(),f=g.coordinatesConverter,p=f.convertModelRangeToViewRange(t),v=g.getLineMinColumn(p.startLineNumber),_=new Dt(p.startLineNumber,v);n=f.convertViewPositionToModelPosition(_).column}const s=t.startLineNumber;let r=t.startColumn,a;for(const g of i){const f=g.range,p=f.startLineNumber===s,v=f.endLineNumber===s;if(p&&v){const w=f.startColumn,S=Math.min(r,w);r=Math.max(S,n)}g.forceShowAtRange&&(a=f)}let c,h;if(a){const g=a.getStartPosition();c=g,h=g}else c=t.getStartPosition(),h=new Dt(s,r);return{showAtPosition:c,showAtSecondaryPosition:h}}}class N4{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 mb=class mb extends Ve{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 Ve.None;let i=t[0].range;for(const s of t){const r=s.range;i=B.plusRange(i,r)}const n=e.createDecorationsCollection();return n.set([{range:i,options:mb._DECORATION_OPTIONS}]),En(()=>{n.clear()})}_renderParts(e,t,i,n){const s=new rv(n),r={fragment:this._fragment,statusBar:s,...i},a=new Be;for(const h of e){const g=this._renderHoverPartsForParticipant(t,h,r);a.add(g);for(const f of g.renderedHoverParts)this._renderedParts.push({type:"hoverPart",participant:h,hoverPart:f.hoverPart,hoverElement:f.hoverElement})}const c=this._renderStatusBar(this._fragment,s);return c&&(a.add(c),this._renderedParts.push({type:"statusBar",hoverElement:c.hoverElement,actions:c.actions})),En(()=>{a.dispose()})}_renderHoverPartsForParticipant(e,t,i){const n=e.filter(r=>r.owner===t);return n.length>0?t.renderHoverParts(i,n):new mh([])}_renderStatusBar(e,t){if(t.hasContent)return new N4(e,t)}_registerListenersOnRenderedParts(){const e=new Be;return this._renderedParts.forEach((t,i)=>{const n=t.hoverElement;n.tabIndex=0,e.add(Ui(n,jn.FOCUS_IN,s=>{s.stopPropagation(),this._focusedHoverPartIndex=i})),e.add(Ui(n,jn.FOCUS_OUT,s=>{s.stopPropagation(),this._focusedHoverPartIndex=-1}))}),e}_updateMarkdownAndColorParticipantInfo(e){const t=e.find(i=>i instanceof _p&&!(i instanceof gv));t&&(this._markdownHoverParticipant=t),this._colorHoverParticipant=e.find(i=>i instanceof pp)}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 rg;return t-s}get domNode(){return this._fragment}get domNodeHasChildren(){return this._fragment.hasChildNodes()}get focusedHoverPartIndex(){return this._focusedHoverPartIndex}};mb._DECORATION_OPTIONS=ki.register({description:"content-hover-highlight",className:"hoverHighlight"});let mC=mb;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},oI=function(o,e){return function(t,i){e(t,i,o)}};let _C=class extends Ve{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._currentResult=null,this._onContentsChanged=this._register(new ui),this.onContentsChanged=this._onContentsChanged.event,this._contentHoverWidget=this._register(this._instantiationService.createInstance(nC,this._editor)),this._participants=this._initializeHoverParticipants(),this._computer=new ov(this._editor,this._participants),this._hoverOperation=this._register(new RM(this._editor,this._computer)),this._registerListeners()}_initializeHoverParticipants(){const e=[];for(const t of Ph.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 AM(this._computer.anchor,i,t.isComplete))}));const e=this._contentHoverWidget.getDomNode();this._register(ml(e,"keydown",t=>{t.equals(9)&&this.hide()})),this._register(ml(e,"mouseleave",t=>{this._onMouseLeave(t)})),this._register(cy.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 A1(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 Iw(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 Iw(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||!Ty(t,e.x,e.y))&&this.hide()}startShowingAtRange(e,t,i,n){this._startShowingOrUpdateHover(new Iw(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}};_C=R4([oI(1,ai),oI(2,ds)],_C);var A4=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},rI=function(o,e){return function(t,i){e(t,i,o)}},vC,Ed;let Us=(Ed=class extends Ve{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._onHoverContentsChanged=this._register(new ui),this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new Be,this._hoverState={mouseDown:!1,activatedByDecoratorClick:!1},this._reactToEditorMouseMoveRunner=this._register(new ms(()=>this._reactToEditorMouseMove(this._mouseMoveEvent),0)),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(60)&&(this._unhookListeners(),this._hookListeners())}))}static get(e){return e.getContribution(vC.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?Ty(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,g,f;return(a&&((h=this._contentWidget)==null?void 0:h.containsNode((c=r.event.browserEvent.view)==null?void 0:c.document.activeElement))&&!((f=(g=r.event.browserEvent.view)==null?void 0:g.getSelection())!=null&&f.isCollapsed))??!1};return i(e,t)||n(e)||s(e,t)}_onEditorMouseMove(e){var a,c,h,g;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(((g=this._contentWidget)==null?void 0:g.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===PM||t.commandId===Ey||t.commandId===Py)&&((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)||_g.dropDownVisible||(this._hoverState.activatedByDecoratorClick=!1,(t=this._contentWidget)==null||t.hide())}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance(_C,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()}},vC=Ed,Ed.ID="editor.contrib.contentHover",Ed);Us=vC=A4([rI(1,ai),rI(2,ds)],Us);const wL=class wL extends Ve{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!==CM||!i.range)return;const n=this._editor.getContribution(Us.ID);if(n&&!n.isColorPickerVisible){const s=new B(i.range.startLineNumber,i.range.startColumn+1,i.range.endLineNumber,i.range.endColumn+1);n.showContentHover(s,1,0,!1,!0)}}};wL.ID="editor.contrib.colorContribution";let fv=wL;_i(fv.ID,fv,2);Ph.register(pp);var QM=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},vu=function(o,e){return function(t,i){e(t,i,o)}},bC,yC,Pd;let vh=(Pd=class extends Ve{constructor(e,t,i){super(),this._editor=e,this._instantiationService=i,this._standaloneColorPickerWidget=null,this._standaloneColorPickerVisible=M.standaloneColorPickerVisible.bindTo(t),this._standaloneColorPickerFocused=M.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(wC,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(bC.ID)}},bC=Pd,Pd.ID="editor.contrib.standaloneColorPickerController",Pd);vh=bC=QM([vu(1,$i),vu(2,ai)],vh);_i(vh.ID,vh,1);const aI=8,O4=22;var Td;let wC=(Td=class extends Ve{constructor(e,t,i,n,s,r,a){var f;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 ui),this.onResult=this._onResult.event,this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=n.createInstance(mp,this._editor),this._position=(f=this._editor._getViewModel())==null?void 0:f.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},g=this._register(eg(this._body));this._register(g.onDidBlur(p=>{this.hide()})),this._register(g.onDidFocus(p=>{this.focus()})),this._register(this._editor.onDidChangeCursorPosition(()=>{this._selectionSetInEditor?this._selectionSetInEditor=!1:this.hide()})),this._register(this._editor.onMouseMove(p=>{var _;const v=(_=p.target.element)==null?void 0:_.classList;v&&v.contains("colorpicker-color-decoration")&&this.hide()})),this._register(this.onResult(p=>{this._render(p.value,p.foundInEditor)})),this._start(h),this._body.style.zIndex="50",this._editor.addContentWidget(this)}updateEditor(){this._colorHover&&this._standaloneColorPickerParticipant.updateEditorModel(this._colorHover)}getId(){return yC.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 F4(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 fp(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 rv(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,g=c.domNode.clientWidth-h-O4-aI,f=a.body.enterButton;f==null||f.onClicked(()=>{this.updateEditor(),this.hide()});const p=a.header,v=p.pickedColorNode;v.style.width=h+aI+"px";const _=p.originalColorNode;_.style.width=g+"px";const w=a.header.closeButton;w==null||w.onClicked(()=>{this.hide()}),t&&(f&&(f.button.textContent="Replace"),this._selectionSetInEditor=!0,this._editor.setSelection(e.range)),this._editor.layoutContentWidget(this)}},yC=Td,Td.ID="editor.contrib.standaloneColorPickerWidget",Td);wC=yC=QM([vu(3,ai),vu(4,ds),vu(5,Et),vu(6,Il)],wC);class F4{constructor(e,t){this.value=e,this.foundInEditor=t}}class H4 extends na{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{...kt("showOrFocusStandaloneColorPicker","Show or Focus Standalone Color Picker"),mnemonicTitle:y({key:"mishowOrFocusStandaloneColorPicker",comment:["&& denotes a mnemonic"]},"&&Show or Focus Standalone Color Picker")},precondition:void 0,menu:[{id:lt.CommandPalette}],metadata:{description:kt("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=vh.get(t))==null||i.showOrFocus()}}class W4 extends Se{constructor(){super({id:"editor.action.hideColorPicker",label:y({key:"hideColorPicker",comment:["Action that hides the color picker"]},"Hide the Color Picker"),alias:"Hide the Color Picker",precondition:M.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100},metadata:{description:kt("hideColorPickerDescription","Hide the standalone color picker.")}})}run(e,t){var i;(i=vh.get(t))==null||i.hide()}}class B4 extends Se{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:y({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:M.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100},metadata:{description:kt("insertColorWithStandaloneColorPickerDescription","Insert hex/rgb/hsl colors with the focused standalone color picker.")}})}run(e,t){var i;(i=vh.get(t))==null||i.insertColor()}}se(W4);se(B4);cn(H4);class ec{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,g=e.endColumn,f=s.getLineContent(a),p=s.getLineContent(h);let v=f.lastIndexOf(t,c-1+t.length),_=p.indexOf(i,g-1-i.length);if(v!==-1&&_!==-1)if(a===h)f.substring(v+t.length,_).indexOf(i)>=0&&(v=-1,_=-1);else{const S=f.substring(v+t.length),D=p.substring(0,_);(S.indexOf(i)>=0||D.indexOf(i)>=0)&&(v=-1,_=-1)}let w;v!==-1&&_!==-1?(n&&v+t.length<f.length&&f.charCodeAt(v+t.length)===32&&(t=t+" "),n&&_>0&&p.charCodeAt(_-1)===32&&(i=" "+i,_-=1),w=ec._createRemoveBlockCommentOperations(new B(a,v+t.length+1,h,_+1),t,i)):(w=ec._createAddBlockCommentOperations(e,t,i,this._insertSpace),this._usedEndToken=w.length===1?i:null);for(const S of w)r.addTrackedEditOperation(S.range,S.text)}static _createRemoveBlockCommentOperations(e,t,i){const n=[];return B.isEmpty(e)?n.push(Kn.delete(new B(e.startLineNumber,e.startColumn-t.length,e.endLineNumber,e.endColumn+i.length))):(n.push(Kn.delete(new B(e.startLineNumber,e.startColumn-t.length,e.startLineNumber,e.startColumn))),n.push(Kn.delete(new B(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn+i.length)))),n}static _createAddBlockCommentOperations(e,t,i,n){const s=[];return B.isEmpty(e)?s.push(Kn.replace(new B(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),t+" "+i)):(s.push(Kn.insert(new Dt(e.startLineNumber,e.startColumn),t+(n?" ":""))),s.push(Kn.insert(new Dt(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 Xt(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 Xt(n.endLineNumber,n.endColumn+s,n.endLineNumber,n.endColumn+s)}}}class Za{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,g=i-t+1;h<g;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,g;e===0?g=!0:e===1?g=!1:g=!0;for(let f=0,p=n.length;f<p;f++){const v=n[f],_=s+f;if(_===s&&a){v.ignore=!0;continue}const w=i.getLineContent(_),S=lS(w);if(S===-1){v.ignore=r,v.commentStrOffset=w.length;continue}if(h=!1,v.ignore=!1,v.commentStrOffset=S,g&&!ec._haystackHasNeedleAtOffset(w,v.commentStr,S)&&(e===0?g=!1:e===1||(v.ignore=!0)),g&&t){const D=S+v.commentStrLength;D<w.length&&w.charCodeAt(D)===32&&(v.commentStrLength+=1)}}if(e===0&&h){g=!1;for(let f=0,p=n.length;f<p;f++)n[f].ignore=!1}return{supported:!0,shouldRemoveComments:g,lines:n}}static _gatherPreflightData(e,t,i,n,s,r,a,c){const h=Za._gatherPreflightCommentStrings(i,n,s,c);return h===null?{supported:!1}:Za._analyzeLines(e,t,i,h,n,r,a,c)}_executeLineComments(e,t,i,n){let s;i.shouldRemoveComments?s=Za._createRemoveLineCommentsOperations(i.lines,n.startLineNumber):(Za._normalizeInsertionPoint(e,i.lines,n.startLineNumber,this._indentSize),s=this._createAddLineCommentsOperations(i.lines,n.startLineNumber));const r=new Dt(n.positionLineNumber,n.positionColumn);for(let a=0,c=s.length;a<c;a++)t.addEditOperation(s[a].range,s[a].text),B.isEmpty(s[a].range)&&B.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?ec._createRemoveBlockCommentOperations(new B(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 g=lS(h);g===-1&&(g=h.length),c=ec._createAddBlockCommentOperations(new B(i.startLineNumber,g+1,i.startLineNumber,h.length+1),r,a,this._insertSpace)}else c=ec._createAddBlockCommentOperations(new B(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 B(i.startLineNumber,e.getLineMaxColumn(i.startLineNumber),i.startLineNumber+1,1),i.startLineNumber===e.getLineCount()?"":`
19
+ `),this._selectionId=t.trackSelection(i);return}i.startLineNumber<i.endLineNumber&&i.endColumn===1&&(this._moveEndPositionDown=!0,i=i.setEndPosition(i.endLineNumber-1,e.getLineMaxColumn(i.endLineNumber-1)));const n=Za._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 Xt(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(Kn.delete(new B(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(Kn.insert(new Dt(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 g=e.getLineContent(i+c);let f=0;for(let p=0,v=t[c].commentStrOffset;f<s&&p<v;p++)f=Za.nextVisibleColumn(f,n,g.charCodeAt(p)===9,1);f<s&&(s=f)}s=Math.floor(s/n)*n;for(let c=0,h=t.length;c<h;c++){if(t[c].ignore)continue;const g=e.getLineContent(i+c);let f=0;for(r=0,a=t[c].commentStrOffset;f<s&&r<a;r++)f=Za.nextVisibleColumn(f,n,g.charCodeAt(r)===9,1);f>s?t[c].commentStrOffset=r-1:t[c].commentStrOffset=r}}}class O1 extends Se{constructor(e,t){super(t),this._type=e}run(e,t){const i=e.get(ws);if(!t.hasModel())return;const n=t.getModel(),s=[],r=n.getOptions(),a=t.getOption(23),c=t.getSelections().map((g,f)=>({selection:g,index:f,ignoreFirstLine:!1}));c.sort((g,f)=>B.compareRangesUsingStarts(g.selection,f.selection));let h=c[0];for(let g=1;g<c.length;g++){const f=c[g];h.selection.endLineNumber===f.selection.startLineNumber&&(h.index<f.index?f.ignoreFirstLine=!0:(h.ignoreFirstLine=!0,h=f))}for(const g of c)s.push(new Za(i,g.selection,r.indentSize,this._type,a.insertSpace,a.ignoreEmptyLines,g.ignoreFirstLine));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class z4 extends O1{constructor(){super(0,{id:"editor.action.commentLine",label:y("comment.line","Toggle Line Comment"),alias:"Toggle Line Comment",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:lt.MenubarEditMenu,group:"5_insert",title:y({key:"miToggleLineComment",comment:["&& denotes a mnemonic"]},"&&Toggle Line Comment"),order:1}})}}class V4 extends O1{constructor(){super(1,{id:"editor.action.addCommentLine",label:y("comment.line.add","Add Line Comment"),alias:"Add Line Comment",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:cs(2089,2081),weight:100}})}}class j4 extends O1{constructor(){super(2,{id:"editor.action.removeCommentLine",label:y("comment.line.remove","Remove Line Comment"),alias:"Remove Line Comment",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:cs(2089,2099),weight:100}})}}class U4 extends Se{constructor(){super({id:"editor.action.blockComment",label:y("comment.block","Toggle Block Comment"),alias:"Toggle Block Comment",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:lt.MenubarEditMenu,group:"5_insert",title:y({key:"miToggleBlockComment",comment:["&& denotes a mnemonic"]},"Toggle &&Block Comment"),order:2}})}run(e,t){const i=e.get(ws);if(!t.hasModel())return;const n=t.getOption(23),s=[],r=t.getSelections();for(const a of r)s.push(new ec(a,n.insertSpace,i));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}se(z4);se(V4);se(j4);se(U4);var $4=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},Bc=function(o,e){return function(t,i){e(t,i,o)}},SC,Md;let bg=(Md=class{static get(e){return e.getContribution(SC.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 Be,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 g=this._contextViewService.getContextViewElement(),f=h.srcElement;f.shadowRoot&&dO(g)===f.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 hO){const h=this._getMenuActions(e,c.item.submenu);h.length>0&&(i.push(new YL(c.id,c.label,h)),a++)}else i.push(c),a++;a&&i.push(new ep)}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=lo(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)&&!cS;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 rS(r,r,{label:!0,keybinding:a.getLabel(),isMenu:!0});const c=r;return typeof c.getActionViewItem=="function"?c.getActionViewItem():new rS(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()||uO(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,g)=>new YL(`menu-action-${++i}`,h,g,void 0),r=(h,g,f,p,v)=>{if(!g)return n({label:h,enabled:g,run:()=>{}});const _=S=>()=>{this._configurationService.updateValue(f,S)},w=[];for(const S of v)w.push(n({label:S.label,checked:p===S.value,run:_(S.value)}));return s(h,w)},a=[];a.push(n({label:y("context.minimap.minimap","Minimap"),checked:t.enabled,run:()=>{this._configurationService.updateValue("editor.minimap.enabled",!t.enabled)}})),a.push(new ep),a.push(n({label:y("context.minimap.renderCharacters","Render Characters"),enabled:t.enabled,checked:t.renderCharacters,run:()=>{this._configurationService.updateValue("editor.minimap.renderCharacters",!t.renderCharacters)}})),a.push(r(y("context.minimap.size","Vertical size"),t.enabled,"editor.minimap.size",t.size,[{label:y("context.minimap.size.proportional","Proportional"),value:"proportional"},{label:y("context.minimap.size.fill","Fill"),value:"fill"},{label:y("context.minimap.size.fit","Fit"),value:"fit"}])),a.push(r(y("context.minimap.slider","Slider"),t.enabled,"editor.minimap.showSlider",t.showSlider,[{label:y("context.minimap.slider.mouseover","Mouse Over"),value:"mouseover"},{label:y("context.minimap.slider.always","Always"),value:"always"}]));const c=this._editor.getOption(128)&&!cS;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()}},SC=Md,Md.ID="editor.contrib.contextmenu",Md);bg=SC=$4([Bc(1,Eg),Bc(2,iy),Bc(3,$i),Bc(4,ds),Bc(5,xh),Bc(6,Tn),Bc(7,Ju)],bg);class q4 extends Se{constructor(){super({id:"editor.action.showContextMenu",label:y("action.showContextMenu.label","Show Editor Context Menu"),alias:"Show Editor Context Menu",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:1092,weight:100}})}run(e,t){var i;(i=bg.get(t))==null||i.showContextMenu()}}_i(bg.ID,bg,2);se(q4);class Ew{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 Pw{constructor(e,t,i){this.cursorState=e,this.scrollTop=t,this.scrollLeft=i}}const _b=class _b extends Ve{static get(e){return e.getContribution(_b.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 Ew(t.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(i)||(this._undoStack.push(new Pw(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 Pw(new Ew(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 Pw(new Ew(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}};_b.ID="editor.contrib.cursorUndoRedoController";let yg=_b;class K4 extends Se{constructor(){super({id:"cursorUndo",label:y("cursor.undo","Cursor Undo"),alias:"Cursor Undo",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:2099,weight:100}})}run(e,t,i){var n;(n=yg.get(t))==null||n.cursorUndo()}}class G4 extends Se{constructor(){super({id:"cursorRedo",label:y("cursor.redo","Cursor Redo"),alias:"Cursor Redo",precondition:void 0})}run(e,t,i){var n;(n=yg.get(t))==null||n.cursorRedo()}}_i(yg.ID,yg,0);se(K4);se(G4);class Z4{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 B(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 Xt(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 Xt(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 Xt(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 Xt(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 Xt(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 Zh(o){return Fa?o.altKey:o.ctrlKey}const Ul=class Ul extends Ve{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)||(Zh(e)&&(this._modifierPressed=!0),this._mouseDown&&Zh(e)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(e){!this._editor.getOption(35)||this._editor.getOption(22)||(Zh(e)&&(this._modifierPressed=!1),this._mouseDown&&e.keyCode===Ul.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}Zh(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 Dt(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 Xt(s,r,t.lineNumber,t.column)]}}else i=(this._editor.getSelections()||[]).map(n=>n.containsPosition(t)?new Xt(t.lineNumber,t.column,t.lineNumber,t.column):n);this._editor.setSelections(i||[],"mouse",3)}else(!this._dragSelection.containsPosition(t)||(Zh(e.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(t)||this._dragSelection.getStartPosition().equals(t)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(Ul.ID,new Z4(this._dragSelection,t,Zh(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 B(e.lineNumber,e.column,e.lineNumber,e.column),options:Ul._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()}};Ul.ID="editor.contrib.dragAndDrop",Ul.TRIGGER_KEY_VALUE=Fa?6:5,Ul._DECORATION_OPTIONS=ki.register({description:"dnd-target",className:"dnd-target"});let pv=Ul;_i(pv.ID,pv,2);_i(yl.ID,yl,0);Mg(FS);Tt(new class extends go{constructor(){super({id:iM,precondition:S1,kbOpts:{weight:100,primary:2137}})}runEditorCommand(o,e){var t;return(t=yl.get(e))==null?void 0:t.changePasteType()}});Tt(new class extends go{constructor(){super({id:"editor.hidePasteWidget",precondition:S1,kbOpts:{weight:100,primary:9}})}runEditorCommand(o,e){var t;(t=yl.get(e))==null||t.clearWidgets()}});var Nd;se((Nd=class extends Se{constructor(){super({id:"editor.action.pasteAs",label:y("pasteAs","Paste As..."),alias:"Paste As...",precondition:M.writable,metadata:{description:"Paste as",args:[{name:"args",schema:Nd.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=yl.get(t))==null?void 0:s.pasteAs(n?new Pn(n):void 0)}},Nd.argsSchema={type:"object",properties:{kind:{type:"string",description:y("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.")}}},Nd));se(class extends Se{constructor(){super({id:"editor.action.pasteAsText",label:y("pasteAsText","Paste as Text"),alias:"Paste as Text",precondition:M.writable})}run(o,e){var t;return(t=yl.get(e))==null?void 0:t.pasteAs({providerId:hh.id})}});class X4{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 lI{constructor(e){this.identifier=e}}const eN=Ll("treeViewsDndService");kl(eN,X4,1);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},zm=function(o,e){return function(t,i){e(t,i,o)}},CC;const tN="editor.experimental.dropIntoEditor.defaultProvider",iN="editor.changeDropType",F1=new Ri("dropWidgetVisible",!1,y("dropWidgetVisible","Whether the drop widget is showing"));var Rd;let wg=(Rd=class extends Ve{static get(e){return e.getContribution(CC.ID)}constructor(e,t,i,n,s){super(),this._configService=i,this._languageFeaturesService=n,this._treeViewsDragAndDropService=s,this.treeItemsTransfer=AS.getInstance(),this._dropProgressManager=this._register(t.createInstance(iv,"dropIntoEditor",e)),this._postDropWidgetManager=this._register(t.createInstance(sv,"dropIntoEditor",e,F1,{id:iN,label:y("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=ks(async r=>{const a=new Be,c=a.add(new Qu(e,1,void 0,r));try{const h=await this.extractDataTransferData(i);if(h.size===0||c.token.isCancellationRequested)return;const g=e.getModel();if(!g)return;const f=this._languageFeaturesService.documentDropEditProvider.ordered(g).filter(v=>v.dropMimeTypes?v.dropMimeTypes.some(_=>h.matches(_)):!0),p=a.add(await this.getDropEdits(f,g,t,h,c));if(c.token.isCancellationRequested)return;if(p.edits.length){const v=this.getInitialActiveEditIndex(g,p.edits),_=e.getOption(36).showDropSelector==="afterDrop";await this._postDropWidgetManager.applyEditAndShowIfNeeded([B.fromPositions(t)],{activeEditIndex:v,allEdits:p.edits},_,async w=>w,r)}}finally{a.dispose(),this._currentOperation===n&&(this._currentOperation=void 0)}});this._dropProgressManager.showWhile(t,y("dropIntoEditorProgress","Running drop handlers. Click to cancel"),n,{cancel:()=>n.cancel()}),this._currentOperation=n}async getDropEdits(e,t,i,n,s){const r=new Be,a=await qp(Promise.all(e.map(async h=>{try{const g=await h.provideDocumentDropEdits(t,i,n,s.token);return g&&r.add(g),g==null?void 0:g.edits.map(f=>({...f,providerId:h.id}))}catch(g){console.error(g)}})),s.token),c=fl(a??[]).flat();return{edits:eM(c),dispose:()=>r.dispose()}}getInitialActiveEditIndex(e,t){const i=this._configService.getValue(tN,{resource:e.uri});for(const[n,s]of Object.entries(i)){const r=new Pn(s),a=t.findIndex(c=>r.value===c.providerId&&c.handledMimeType&&$T(n,[c.handledMimeType]));if(a>=0)return a}return 0}async extractDataTransferData(e){if(!e.dataTransfer)return new UT;const t=GT(e.dataTransfer);if(this.treeItemsTransfer.hasData(lI.prototype)){const i=this.treeItemsTransfer.getData(lI.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}},CC=Rd,Rd.ID="editor.contrib.dropIntoEditorController",Rd);wg=CC=Y4([zm(1,ai),zm(2,Tn),zm(3,Et),zm(4,eN)],wg);_i(wg.ID,wg,2);Mg(OS);Tt(new class extends go{constructor(){super({id:iN,precondition:F1,kbOpts:{weight:100,primary:2137}})}runEditorCommand(o,e,t){var i;(i=wg.get(e))==null||i.changeDropType()}});Tt(new class extends go{constructor(){super({id:"editor.hideDropWidget",precondition:F1,kbOpts:{weight:100,primary:9}})}runEditorCommand(o,e,t){var i;(i=wg.get(e))==null||i.clearWidgets()}});sa.as(Zp.Configuration).registerConfiguration({...sy,properties:{[tN]:{type:"object",scope:5,description:y("defaultProviderDescription","Configures the default drop provider to use for content of a given mime type."),default:{},additionalProperties:{type:"string"}}}});const Bs=class Bs{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===Bs._FIND_MATCH_DECORATION||n===Bs._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,Bs._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),t!==null&&(this._highlightedDecorationId=t,n.changeDecorationOptions(this._highlightedDecorationId,Bs._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 B(s.startLineNumber,s.startColumn,r,a)}this._rangeHighlightDecorationId=n.addDecoration(s,Bs._RANGE_HIGHLIGHT_DECORATION)}}),i}set(e,t){this._editor.changeDecorations(i=>{let n=Bs._FIND_MATCH_DECORATION;const s=[];if(e.length>1e3){n=Bs._FIND_MATCH_NO_OVERVIEW_DECORATION;const a=this._editor.getModel().getLineCount(),h=this._editor.getLayoutInfo().height/a,g=Math.max(2,Math.ceil(3/h));let f=e[0].range.startLineNumber,p=e[0].range.endLineNumber;for(let v=1,_=e.length;v<_;v++){const w=e[v].range;p+g>=w.startLineNumber?w.endLineNumber>p&&(p=w.endLineNumber):(s.push({range:new B(f,1,p,1),options:Bs._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),f=w.startLineNumber,p=w.endLineNumber)}s.push({range:new B(f,1,p,1),options:Bs._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,Bs._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}};Bs._CURRENT_FIND_MATCH_DECORATION=ki.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",inlineClassName:"currentFindMatchInline",showIfCollapsed:!0,overviewRuler:{color:hs(aw),position:Ma.Center},minimap:{color:hs(JL),position:1}}),Bs._FIND_MATCH_DECORATION=ki.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",inlineClassName:"findMatchInline",showIfCollapsed:!0,overviewRuler:{color:hs(aw),position:Ma.Center},minimap:{color:hs(JL),position:1}}),Bs._FIND_MATCH_NO_OVERVIEW_DECORATION=ki.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0}),Bs._FIND_MATCH_ONLY_OVERVIEW_DECORATION=ki.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:hs(aw),position:Ma.Center}}),Bs._RANGE_HIGHLIGHT_DECORATION=ki.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0}),Bs._FIND_SCOPE_DECORATION=ki.register({description:"find-scope",className:"findScope",isWholeLine:!0});let xC=Bs;class J4{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)=>B.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 nN(o,e){if(o&&o[0]!==""){const t=cI(o,e,"-"),i=cI(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():gO(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 cI(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+=nN([n[a]],r)+t}),s.slice(0,-1)}class hI{constructor(e){this.staticValue=e,this.kind=0}}class Q4{constructor(e){this.pieces=e,this.kind=1}}class Sg{static fromStaticValue(e){return new Sg([pd.staticValue(e)])}get hasReplacementPatterns(){return this._state.kind===1}constructor(e){!e||e.length===0?this._state=new hI(""):e.length===1&&e[0].staticValue!==null?this._state=new hI(e[0].staticValue):this._state=new Q4(e)}buildReplaceString(e,t){if(this._state.kind===0)return t?nN(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=Sg._substitute(r.matchIndex,e);if(r.caseOps!==null&&r.caseOps.length>0){const c=[],h=r.caseOps.length;let g=0;for(let f=0,p=a.length;f<p;f++){if(g>=h){c.push(a.slice(f));break}switch(r.caseOps[g]){case"U":c.push(a[f].toUpperCase());break;case"u":c.push(a[f].toUpperCase()),g++;break;case"L":c.push(a[f].toLowerCase());break;case"l":c.push(a[f].toLowerCase()),g++;break;default:c.push(a[f])}}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 pd{static staticValue(e){return new pd(e,-1,null)}static caseOps(e,t){return new pd(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 ez{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++]=pd.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=pd.caseOps(e,i),this._lastCharIndex=t}finalize(){return this.emitUnchanged(this._source.length),this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=pd.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new Sg(this._result)}}function tz(o){if(!o||o.length===0)return new Sg(null);const e=[],t=new ez(o);for(let i=0,n=o.length;i<n;i++){const s=o.charCodeAt(i);if(s===92){if(i++,i>=n)break;const r=o.charCodeAt(i);switch(r){case 92:t.emitUnchanged(i-1),t.emitStatic("\\",i+1);break;case 110:t.emitUnchanged(i-1),t.emitStatic(`
20
+ `,i+1);break;case 116:t.emitUnchanged(i-1),t.emitStatic(" ",i+1);break;case 117:case 85:case 108:case 76:t.emitUnchanged(i-1),t.emitStatic("",i+1),e.push(String.fromCharCode(r));break}continue}if(s===36){if(i++,i>=n)break;const r=o.charCodeAt(i);if(r===36){t.emitUnchanged(i-1),t.emitStatic("$",i+1);continue}if(r===48||r===38){t.emitUnchanged(i-1),t.emitMatchIndex(0,i+1,e),e.length=0;continue}if(49<=r&&r<=57){let a=r-48;if(i+1<n){const 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 Pl=new Ri("findWidgetVisible",!1);Pl.toNegated();const Oy=new Ri("findInputFocussed",!1),H1=new Ri("replaceInputFocussed",!1),Vm={primary:545,mac:{primary:2593}},jm={primary:565,mac:{primary:2613}},Um={primary:560,mac:{primary:2608}},$m={primary:554,mac:{primary:2602}},qm={primary:558,mac:{primary:2606}},fn={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"},tc=19999,iz=240;class Ff{constructor(e,t){this._toDispose=new Be,this._editor=e,this._state=t,this._isDisposed=!1,this._startSearchingTimer=new Kp,this._decorations=new xC(e),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new ms(()=>{if(this._editor.hasModel())return this.research(!1)},100),this._toDispose.add(this._updateDecorationsScheduler),this._toDispose.add(this._editor.onDidChangeCursorPosition(i=>{(i.reason===3||i.reason===5||i.reason===6)&&this._decorations.setStartPosition(this._editor.getPosition())})),this._ignoreModelContentChanged=!1,this._toDispose.add(this._editor.onDidChangeModelContent(i=>{this._ignoreModelContentChanged||(i.isFlush&&this._decorations.reset(),this._decorations.setStartPosition(this._editor.getPosition()),this._updateDecorationsScheduler.schedule())})),this._toDispose.add(this._state.onFindReplaceStateChange(i=>this._onStateChanged(i))),this.research(!1,this._state.searchScope)}dispose(){this._isDisposed=!0,Ks(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)},iz)):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 B(a.startLineNumber,1,c,this._editor.getModel().getLineMaxColumn(c))}return a}));const n=this._findMatches(i,!1,tc);this._decorations.set(n,i);const s=this._editor.getSelection();let r=this._decorations.getCurrentMatchesPosition(s);if(r===0&&n.length>0){const a=DE(n.map(c=>c.range),c=>B.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 Dt(i,n)}_moveToPrevMatch(e,t=!1){if(!this._state.canNavigateBack()){const g=this._decorations.matchAfterPosition(e);g&&this._setCurrentFindMatch(g);return}if(this._decorations.getCount()<tc){let g=this._decorations.matchBeforePosition(e);g&&g.isEmpty()&&g.getStartPosition().equals(e)&&(e=this._prevSearchPosition(e),g=this._decorations.matchBeforePosition(e)),g&&this._setCurrentFindMatch(g);return}if(this._cannotFind())return;const i=this._decorations.getFindScope(),n=Ff._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 Dt(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 Dt(i,n)}_moveToNextMatch(e){if(!this._state.canNavigateForward()){const i=this._decorations.matchBeforePosition(e);i&&this._setCurrentFindMatch(i);return}if(this._decorations.getCount()<tc){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=Ff._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 g=new Dt(a,c),f=h.findNextMatch(this._state.searchString,g,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null,t);return i&&f&&f.range.isEmpty()&&f.range.getStartPosition().equals(g)&&(g=this._nextSearchPosition(g),f=h.findNextMatch(this._state.searchString,g,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null,t)),f?!n&&!r.containsRange(f.range)?this._getNextMatch(f.range.getEndPosition(),t,i,!0):f: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?tz(this._state.replaceString):Sg.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 $p(t,n);this._executeEditorCommand("replace",s),this._decorations.setStartPosition(new Dt(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=>Ff._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>=tc?this._largeReplaceAll():this._regularReplaceAll(e),this.research(!1)}_largeReplaceAll(){const t=new fO(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 f="mu";i.ignoreCase&&(f+="i"),i.global&&(f+="g"),i=new RegExp(i.source,f)}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 g=new EE(r,c,this._editor.getSelection());this._executeEditorCommand("replaceAll",g)}_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 J4(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 Xt(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 vb=class vb extends Yp{constructor(e,t,i){super(),this._hideSoon=this._register(new ms(()=>this._hide(),2e3)),this._isVisible=!1,this._editor=e,this._state=t,this._keybindingService=i,this._domNode=document.createElement("div"),this._domNode.className="findOptionsWidget",this._domNode.style.display="none",this._domNode.style.top="10px",this._domNode.style.zIndex="12",this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true");const n={inputActiveOptionBorder:ad(TE),inputActiveOptionForeground:ad(PE),inputActiveOptionBackground:ad(F0)},s=this._register(dS());this.caseSensitive=this._register(new pO({appendTitle:this._keybindingLabelFor(fn.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 mO({appendTitle:this._keybindingLabelFor(fn.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 _O({appendTitle:this._keybindingLabelFor(fn.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(Ui(this._domNode,jn.MOUSE_LEAVE,r=>this._onMouseLeave())),this._register(Ui(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 vb.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")}};vb.ID="editor.contrib.findOptionsWidget";let LC=vb;function Km(o,e){return o===1?!0:o===2?!1:e}class nz extends Ve{get searchString(){return this._searchString}get replaceString(){return this._replaceString}get isRevealed(){return this._isRevealed}get isReplaceRevealed(){return this._isReplaceRevealed}get isRegex(){return Km(this._isRegexOverride,this._isRegex)}get wholeWord(){return Km(this._wholeWordOverride,this._wholeWord)}get matchCase(){return Km(this._matchCaseOverride,this._matchCase)}get preserveCase(){return Km(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 ui),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"&&(B.equalsRange(this._currentMatch,i)||(this._currentMatch=i,n.currentMatch=!0,s=!0)),s&&this._onFindReplaceStateChange.fire(n)}change(e,t,i=!0){var g;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"&&((g=e.searchScope)!=null&&g.every(f=>{var p;return(p=this._searchScope)==null?void 0:p.some(v=>!B.equalsRange(v,f))})||(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>=tc}}const sz=y("defaultLabel","input"),oz=y("label.preserveCaseToggle","Preserve Case");class rz extends ME{constructor(e){super({icon:Qt.preserveCase,title:oz+e.appendTitle,isChecked:e.isChecked,hoverDelegate:e.hoverDelegate??dy("element"),inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}class az extends Yp{constructor(e,t,i,n){super(),this._showOptionButtons=i,this.fixFocusOnOptionClickEnabled=!0,this.cachedOptionsWidth=0,this._onDidOptionChange=this._register(new ui),this.onDidOptionChange=this._onDidOptionChange.event,this._onKeyDown=this._register(new ui),this.onKeyDown=this._onKeyDown.event,this._onMouseDown=this._register(new ui),this._onInput=this._register(new ui),this._onKeyUp=this._register(new ui),this._onPreserveCaseKeyDown=this._register(new ui),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 vO(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 rz({appendTitle:s,isChecked:!1,...n.toggleStyles})),this._register(this.preserveCase.onChange(p=>{this._onDidOptionChange.fire(p),!p&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.preserveCase.onKeyDown(p=>{this._onPreserveCaseKeyDown.fire(p)})),this._showOptionButtons?this.cachedOptionsWidth=this.preserveCase.width():this.cachedOptionsWidth=0;const g=[this.preserveCase.domNode];this.onkeydown(this.domNode,p=>{if(p.equals(15)||p.equals(17)||p.equals(9)){const v=g.indexOf(this.domNode.ownerDocument.activeElement);if(v>=0){let _=-1;p.equals(17)?_=(v+1)%g.length:p.equals(15)&&(v===0?_=g.length-1:_=v-1),p.equals(9)?(g[v].blur(),this.inputBox.focus()):_>=0&&g[_].focus(),B_.stop(p,!0)}}});const f=document.createElement("div");f.className="controls",f.style.display=this._showOptionButtons?"block":"none",f.appendChild(this.preserveCase.domNode),this.domNode.appendChild(f),e==null||e.appendChild(this.domNode),this.onkeydown(this.inputBox.inputElement,p=>this._onKeyDown.fire(p)),this.onkeyup(this.inputBox.inputElement,p=>this._onKeyUp.fire(p)),this.oninput(this.inputBox.inputElement,p=>this._onInput.fire()),this.onmousedown(this.inputBox.inputElement,p=>this._onMouseDown.fire(p))}enable(){this.domNode.classList.remove("disabled"),this.inputBox.enable(),this.preserveCase.enable()}disable(){this.domNode.classList.add("disabled"),this.inputBox.disable(),this.preserveCase.disable()}setEnabled(e){e?this.enable():this.disable()}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getPreserveCase(){return this.preserveCase.checked}setPreserveCase(e){this.preserveCase.checked=e}focusOnPreserve(){this.preserveCase.focus()}validate(){var e;(e=this.inputBox)==null||e.validate()}set width(e){this.inputBox.paddingRight=this.cachedOptionsWidth,this.domNode.style.width=e+"px"}dispose(){super.dispose()}}var 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 W1=new Ri("suggestWidgetVisible",!1,y("suggestWidgetVisible","Whether suggestion are visible")),B1="historyNavigationWidgetFocus",rN="historyNavigationForwardsEnabled",aN="historyNavigationBackwardsEnabled";let ul;const Gm=[];function lN(o,e){if(Gm.includes(e))throw new Error("Cannot register the same widget multiple times");Gm.push(e);const t=new Be,i=new Ri(B1,!1).bindTo(o),n=new Ri(rN,!0).bindTo(o),s=new Ri(aN,!0).bindTo(o),r=()=>{i.set(!0),ul=e},a=()=>{i.set(!1),ul===e&&(ul=void 0)};return yO(e.element)&&r(),t.add(e.onDidFocus(()=>r())),t.add(e.onDidBlur(()=>a())),t.add(En(()=>{Gm.splice(Gm.indexOf(e),1),a()})),{historyNavigationForwardsEnablement:n,historyNavigationBackwardsEnablement:s,dispose(){t.dispose()}}}let kC=class extends bO{constructor(e,t,i,n){super(e,t,i);const s=this._register(n.createScoped(this.inputBox.element));this._register(lN(s,this.inputBox))}};kC=sN([oN(3,$i)],kC);let IC=class extends az{constructor(e,t,i,n,s=!1){super(e,t,s,i);const r=this._register(n.createScoped(this.inputBox.element));this._register(lN(r,this.inputBox))}};IC=sN([oN(3,$i)],IC);za.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:le.and(le.has(B1),le.equals(aN,!0),le.not("isComposing"),W1.isEqualTo(!1)),primary:16,secondary:[528],handler:o=>{ul==null||ul.showPreviousValue()}});za.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:le.and(le.has(B1),le.equals(rN,!0),le.not("isComposing"),W1.isEqualTo(!1)),primary:18,secondary:[530],handler:o=>{ul==null||ul.showNextValue()}});function uI(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 gI=es("find-collapsed",Qt.chevronRight,y("findCollapsedIcon","Icon to indicate that the editor find widget is collapsed.")),fI=es("find-expanded",Qt.chevronDown,y("findExpandedIcon","Icon to indicate that the editor find widget is expanded.")),lz=es("find-selection",Qt.selection,y("findSelectionIcon","Icon for 'Find in Selection' in the editor find widget.")),cz=es("find-replace",Qt.replace,y("findReplaceIcon","Icon for 'Replace' in the editor find widget.")),dz=es("find-replace-all",Qt.replaceAll,y("findReplaceAllIcon","Icon for 'Replace All' in the editor find widget.")),hz=es("find-previous-match",Qt.arrowUp,y("findPreviousMatchIcon","Icon for 'Find Previous' in the editor find widget.")),uz=es("find-next-match",Qt.arrowDown,y("findNextMatchIcon","Icon for 'Find Next' in the editor find widget.")),gz=y("label.findDialog","Find / Replace"),fz=y("label.find","Find"),pz=y("placeholder.find","Find"),mz=y("label.previousMatchButton","Previous Match"),_z=y("label.nextMatchButton","Next Match"),vz=y("label.toggleSelectionFind","Find in Selection"),bz=y("label.closeButton","Close"),yz=y("label.replace","Replace"),wz=y("placeholder.replace","Replace"),Sz=y("label.replaceButton","Replace"),Cz=y("label.replaceAllButton","Replace All"),xz=y("label.toggleReplaceButton","Toggle Replace"),Lz=y("title.matchesCountLimit","Only the first {0} results are highlighted, but all find operations work on the entire text.",tc),kz=y("label.matchesLocation","{0} of {1}"),pI=y("label.noResults","No results"),ga=419,Iz=275,Dz=Iz-54;let of=69;const Ez=33,mI="ctrlEnterReplaceAll.windows.donotask",_I=Fa?256:2048;class Tw{constructor(e){this.afterLineNumber=e,this.heightInPx=Ez,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}}function vI(o,e,t){const i=!!e.match(/\n/);if(t&&i&&t.selectionStart>0){o.stopPropagation();return}}function bI(o,e,t){const i=!!e.match(/\n/);if(t&&i&&t.selectionEnd<t.value.length){o.stopPropagation();return}}const bb=class bb extends Yp{constructor(e,t,i,n,s,r,a,c,h,g){super(),this._hoverService=g,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(mI,0),this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._updateHistoryDelayer=new Lc(500),this._register(En(()=>this._updateHistoryDelayer.cancel())),this._register(this._state.onFindReplaceStateChange(f=>this._onStateChanged(f))),this._buildDomNode(),this._updateButtons(),this._tryUpdateWidgetWidth(),this._findInput.inputBox.layout(),this._register(this._codeEditor.onDidChangeConfiguration(f=>{if(f.hasChanged(92)&&(this._codeEditor.getOption(92)&&this._state.change({isReplaceRevealed:!1},!1),this._updateButtons()),f.hasChanged(146)&&this._tryUpdateWidgetWidth(),f.hasChanged(2)&&this.updateAccessibilitySupport(),f.hasChanged(41)){const p=this._codeEditor.getOption(41).loop;this._state.change({loop:p},!1);const v=this._codeEditor.getOption(41).addExtraSpaceOnTop;v&&!this._viewZone&&(this._viewZone=new Tw(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 f=await this._controller.getGlobalBufferTerm();f&&f!==this._state.searchString&&(this._state.change({searchString:f},!1),this._findInput.select())}})),this._findInputFocused=Oy.bindTo(r),this._findFocusTracker=this._register(eg(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=H1.bindTo(r),this._replaceFocusTracker=this._register(eg(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 Tw(0)),this._register(this._codeEditor.onDidChangeModel(()=>{this._isVisible&&(this._viewZoneId=void 0)})),this._register(this._codeEditor.onDidScrollChange(f=>{if(f.scrollTopChanged){this._layoutViewZone();return}setTimeout(()=>{this._layoutViewZone()},0)}))}getId(){return bb.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=gr(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,mn)}_updateHistory(){this._state.searchString&&this._findInput.inputBox.addToHistory(),this._state.replaceString&&this._replaceInput.inputBox.addToHistory()}_updateMatchesCount(){var t;this._matchesCount.style.minWidth=of+"px",this._state.matchesCount>=tc?this._matchesCount.title=Lz: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>=tc&&(i+="+");let n=String(this._state.matchesPosition);n==="0"&&(n="?"),e=K0(kz,n,i)}else e=pI;this._matchesCount.appendChild(document.createTextNode(e)),Ir(this._getAriaLabel(e,this._state.currentMatch,this._state.searchString)),of=Math.max(of,this._matchesCount.clientWidth)}_getAriaLabel(e,t,i){if(e===pI)return i===""?y("ariaSearchNoResultEmpty","{0} found",e):y("ariaSearchNoResult","{0} found for '{1}'",e,i);if(t){const n=y("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 y("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=lo(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=wO(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 Tw(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&&gr(this._domNode)>ga){this._domNode.style.maxWidth=`${i-28-n-15}px`,this._replaceInput.width=gr(this._findInput.domNode);return}if(ga+28+n>=i&&(r=!0),ga+28+n-of>=i&&(a=!0),ga+28+n-of>=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=gr(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&&!B.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(_I|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{this._findInput.inputBox.insertAtCursor(`
21
+ `),e.preventDefault();return}if(e.equals(2)){this._isReplaceVisible?this._replaceInput.focus():this._findInput.focusOnCaseSensitive(),e.preventDefault();return}if(e.equals(2066)){this._codeEditor.focus(),e.preventDefault();return}if(e.equals(16))return vI(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"));if(e.equals(18))return bI(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"))}_onReplaceInputKeyDown(e){if(e.equals(_I|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{Qb&&Tg&&!this._ctrlEnterReplaceAllWarningPrompted&&(this._notificationService.info(y("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(mI,!0,0,0)),this._replaceInput.inputBox.insertAtCursor(`
22
+ `),e.preventDefault();return}if(e.equals(2)){this._findInput.focusOnCaseSensitive(),e.preventDefault();return}if(e.equals(1026)){this._findInput.focus(),e.preventDefault();return}if(e.equals(2066)){this._codeEditor.focus(),e.preventDefault();return}if(e.equals(16))return vI(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"));if(e.equals(18))return bI(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 kC(null,this._contextViewProvider,{width:Dz,label:fz,placeholder:pz,appendCaseSensitiveLabel:this._keybindingLabelFor(fn.ToggleCaseSensitiveCommand),appendWholeWordsLabel:this._keybindingLabelFor(fn.ToggleWholeWordCommand),appendRegexLabel:this._keybindingLabelFor(fn.ToggleRegexCommand),validation:g=>{if(g.length===0||!this._findInput.getRegex())return null;try{return new RegExp(g,"gu"),null}catch(f){return{content:f.message}}},flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showCommonFindToggles:!0,showHistoryHint:()=>uI(this._keybindingService),inputBoxStyles:ek,toggleStyles:QL},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(g=>this._onFindInputKeyDown(g))),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(g=>{g.equals(1026)&&this._isReplaceVisible&&(this._replaceInput.focus(),g.preventDefault())})),this._register(this._findInput.onRegexKeyDown(g=>{g.equals(2)&&this._isReplaceVisible&&(this._replaceInput.focusOnPreserve(),g.preventDefault())})),this._register(this._findInput.inputBox.onDidHeightChange(g=>{this._tryUpdateHeight()&&this._showViewZone()})),SO&&this._register(this._findInput.onMouseDown(g=>this._onFindInputMouseDown(g))),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._updateMatchesCount();const i=this._register(dS());this._prevBtn=this._register(new Xh({label:mz+this._keybindingLabelFor(fn.PreviousMatchFindAction),icon:hz,hoverDelegate:i,onTrigger:()=>{fu(this._codeEditor.getAction(fn.PreviousMatchFindAction)).run().then(void 0,mn)}},this._hoverService)),this._nextBtn=this._register(new Xh({label:_z+this._keybindingLabelFor(fn.NextMatchFindAction),icon:uz,hoverDelegate:i,onTrigger:()=>{fu(this._codeEditor.getAction(fn.NextMatchFindAction)).run().then(void 0,mn)}},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 ME({icon:lz,title:vz+this._keybindingLabelFor(fn.ToggleSearchScopeCommand),isChecked:!1,hoverDelegate:i,inputActiveOptionBackground:ad(F0),inputActiveOptionBorder:ad(TE),inputActiveOptionForeground:ad(PE)})),this._register(this._toggleSelectionFind.onChange(()=>{if(this._toggleSelectionFind.checked){if(this._codeEditor.hasModel()){let g=this._codeEditor.getSelections();g=g.map(f=>(f.endColumn===1&&f.endLineNumber>f.startLineNumber&&(f=f.setEndPosition(f.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(f.endLineNumber-1))),f.isEmpty()?null:f)).filter(f=>!!f),g.length&&this._state.change({searchScope:g},!0)}}else this._state.change({searchScope:null},!0)})),s.appendChild(this._toggleSelectionFind.domNode),this._closeBtn=this._register(new Xh({label:bz+this._keybindingLabelFor(fn.CloseFindWidgetCommand),icon:NE,hoverDelegate:i,onTrigger:()=>{this._state.change({isRevealed:!1,searchScope:null},!1)},onKeyDown:g=>{g.equals(2)&&this._isReplaceVisible&&(this._replaceBtn.isEnabled()?this._replaceBtn.focus():this._codeEditor.focus(),g.preventDefault())}},this._hoverService)),this._replaceInput=this._register(new IC(null,void 0,{label:yz,placeholder:wz,appendPreserveCaseLabel:this._keybindingLabelFor(fn.TogglePreserveCaseCommand),history:[],flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>uI(this._keybindingService),inputBoxStyles:ek,toggleStyles:QL},this._contextKeyService,!0)),this._replaceInput.setPreserveCase(!!this._state.preserveCase),this._register(this._replaceInput.onKeyDown(g=>this._onReplaceInputKeyDown(g))),this._register(this._replaceInput.inputBox.onDidChange(()=>{this._state.change({replaceString:this._replaceInput.inputBox.value},!1)})),this._register(this._replaceInput.inputBox.onDidHeightChange(g=>{this._isReplaceVisible&&this._tryUpdateHeight()&&this._showViewZone()})),this._register(this._replaceInput.onDidOptionChange(()=>{this._state.change({preserveCase:this._replaceInput.getPreserveCase()},!0)})),this._register(this._replaceInput.onPreserveCaseKeyDown(g=>{g.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(),g.preventDefault())}));const r=this._register(dS());this._replaceBtn=this._register(new Xh({label:Sz+this._keybindingLabelFor(fn.ReplaceOneAction),icon:cz,hoverDelegate:r,onTrigger:()=>{this._controller.replace()},onKeyDown:g=>{g.equals(1026)&&(this._closeBtn.focus(),g.preventDefault())}},this._hoverService)),this._replaceAllBtn=this._register(new Xh({label:Cz+this._keybindingLabelFor(fn.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 Xh({label:xz,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=gr(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=gz,this._domNode.role="dialog",this._domNode.style.width=`${ga}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 hu(this._domNode,this,{orientation:0,size:2})),this._resized=!1;let h=ga;this._register(this._resizeSash.onDidStart(()=>{h=gr(this._domNode)})),this._register(this._resizeSash.onDidChange(g=>{this._resized=!0;const f=h+g.startX-g.currentX;if(f<ga)return;const p=parseFloat(CO(this._domNode).maxWidth)||0;f>p||(this._domNode.style.width=`${f}px`,this._isReplaceVisible&&(this._replaceInput.width=gr(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())})),this._register(this._resizeSash.onDidReset(()=>{const g=gr(this._domNode);if(g<ga)return;let f=ga;if(!this._resized||g===ga){const p=this._codeEditor.getLayoutInfo();f=p.width-28-p.minimap.minimapWidth-15,this._resized=!0}this._domNode.style.width=`${f}px`,this._isReplaceVisible&&(this._replaceInput.width=gr(this._findInput.domNode)),this._findInput.inputBox.layout()}))}updateAccessibilitySupport(){const e=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(e!==2)}};bb.ID="editor.contrib.findWidget";let DC=bb;class Xh extends Yp{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??dy("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(gI)),this._domNode.classList.add(...Xi.asClassNameArray(fI))):(this._domNode.classList.remove(...Xi.asClassNameArray(fI)),this._domNode.classList.add(...Xi.asClassNameArray(gI)))}}ny((o,e)=>{const t=o.getColor(uE);t&&e.addRule(`.monaco-editor .findMatch { border: 1px ${Jf(o.type)?"dotted":"solid"} ${t}; box-sizing: border-box; }`);const i=o.getColor(xO);i&&e.addRule(`.monaco-editor .findScope { border: 1px ${Jf(o.type)?"dashed":"solid"} ${i}; }`);const n=o.getColor(pl);n&&e.addRule(`.monaco-editor .find-widget { border: 1px solid ${n}; }`);const s=o.getColor(LO);s&&e.addRule(`.monaco-editor .findMatchInline { color: ${s}; }`);const r=o.getColor(kO);r&&e.addRule(`.monaco-editor .currentFindMatchInline { color: ${r}; }`)});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},Jo=function(o,e){return function(t,i){e(t,i,o)}},EC;const Pz=524288;function PC(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)<Pz)return o.getModel().getValueInRange(i)}return null}var Ad;let ho=(Ad=class extends Ve{get editor(){return this._editor}static get(e){return e.getContribution(EC.ID)}constructor(e,t,i,n,s,r){super(),this._editor=e,this._findWidgetVisible=Pl.bindTo(t),this._contextKeyService=t,this._storageService=i,this._clipboardService=n,this._notificationService=s,this._hoverService=r,this._updateHistoryDelayer=new Lc(500),this._state=this._register(new nz),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!!Oy.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=Qf(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=PC(this._editor,e.seedSearchStringFromSelection,e.seedSearchStringFromNonEmptySelection);n&&(this._state.isRegex?i.searchString=Qf(n):i.searchString=n)}else if(e.seedSearchStringFromSelection==="multiple"&&!e.updateSearchScope){const n=PC(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 Ff(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(y("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)}},EC=Ad,Ad.ID="editor.contrib.findController",Ad);ho=EC=cN([Jo(1,$i),Jo(2,Rc),Jo(3,Pg),Jo(4,Qs),Jo(5,em)],ho);let TC=class extends ho{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 DC(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._themeService,this._storageService,this._notificationService,this._hoverService)),this._findOptionsWidget=this._register(new LC(this._editor,this._state,this._keybindingService))}};TC=cN([Jo(1,iy),Jo(2,$i),Jo(3,ds),Jo(4,Pr),Jo(5,Qs),Jo(6,Rc),Jo(7,Pg),Jo(8,em)],TC);const Tz=RE(new AE({id:fn.StartFindAction,label:y("startFindAction","Find"),alias:"Find",precondition:le.or(M.focus,le.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:lt.MenubarEditMenu,group:"3_find",title:y({key:"miFind",comment:["&& denotes a mnemonic"]},"&&Find"),order:1}}));Tz.addImplementation(0,(o,e,t)=>{const i=ho.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 Mz={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 Nz extends Se{constructor(){super({id:fn.StartFindWithArgs,label:y("startFindWithArgsAction","Find With Arguments"),alias:"Find With Arguments",precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},metadata:Mz})}async run(e,t,i){const n=ho.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 Rz extends Se{constructor(){super({id:fn.StartFindWithSelection,label:y("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=ho.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 dN extends Se{async run(e,t){const i=ho.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 Az extends dN{constructor(){super({id:fn.NextMatchFindAction,label:y("findNextMatchAction","Find Next"),alias:"Find Next",precondition:void 0,kbOpts:[{kbExpr:M.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:le.and(M.focus,Oy),primary:3,weight:100}]})}_run(e){return e.moveToNextMatch()?(e.editor.pushUndoStop(),!0):!1}}class Oz extends dN{constructor(){super({id:fn.PreviousMatchFindAction,label:y("findPreviousMatchAction","Find Previous"),alias:"Find Previous",precondition:void 0,kbOpts:[{kbExpr:M.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:le.and(M.focus,Oy),primary:1027,weight:100}]})}_run(e){return e.moveToPrevMatch()}}class Fz extends Se{constructor(){super({id:fn.GoToMatchFindAction,label:y("findMatchAction.goToMatch","Go to Match..."),alias:"Go to Match...",precondition:Pl}),this._highlightDecorations=[]}run(e,t,i){const n=ho.get(t);if(!n)return;const s=n.getState().matchesCount;if(s<1){e.get(Qs).notify({severity:$0.Warning,message:y("findMatchAction.noResults","No matches. Try searching for something else.")});return}const r=e.get(xl),a=new Be,c=a.add(r.createInputBox());c.placeholder=y("findMatchAction.inputPlaceHolder","Type a number to go to a specific match (between 1 and {0})",s);const h=f=>{const p=parseInt(f);if(isNaN(p))return;const v=n.getState().matchesCount;if(p>0&&p<=v)return p-1;if(p<0&&p>=-v)return v+p},g=f=>{const p=h(f);if(typeof p=="number"){c.validationMessage=void 0,n.goToMatch(p);const v=n.getState().currentMatch;v&&this.addDecorations(t,v)}else c.validationMessage=y("findMatchAction.inputValidationMessage","Please type a number between 1 and {0}",n.getState().matchesCount),this.clearDecorations(t)};a.add(c.onDidChangeValue(f=>{g(f)})),a.add(c.onDidAccept(()=>{const f=h(c.value);typeof f=="number"?(n.goToMatch(f),c.hide()):c.validationMessage=y("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:hs(OE),position:Ma.Full}}}])})}}class hN extends Se{async run(e,t){const i=ho.get(t);if(!i)return;const n=PC(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 Hz extends hN{constructor(){super({id:fn.NextSelectionMatchFindAction,label:y("nextSelectionMatchFindAction","Find Next Selection"),alias:"Find Next Selection",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:2109,weight:100}})}_run(e){return e.moveToNextMatch()}}class Wz extends hN{constructor(){super({id:fn.PreviousSelectionMatchFindAction,label:y("previousSelectionMatchFindAction","Find Previous Selection"),alias:"Find Previous Selection",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:3133,weight:100}})}_run(e){return e.moveToPrevMatch()}}const Bz=RE(new AE({id:fn.StartFindReplaceAction,label:y("startReplace","Replace"),alias:"Replace",precondition:le.or(M.focus,le.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:lt.MenubarEditMenu,group:"3_find",title:y({key:"miReplace",comment:["&& denotes a mnemonic"]},"&&Replace"),order:2}}));Bz.addImplementation(0,(o,e,t)=>{if(!e.hasModel()||e.getOption(92))return!1;const i=ho.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})});_i(ho.ID,TC,0);se(Nz);se(Rz);se(Az);se(Oz);se(Fz);se(Hz);se(Wz);const ca=go.bindToContribution(ho.get);Tt(new ca({id:fn.CloseFindWidgetCommand,precondition:Pl,handler:o=>o.closeFindWidget(),kbOpts:{weight:105,kbExpr:le.and(M.focus,le.not("isComposing")),primary:9,secondary:[1033]}}));Tt(new ca({id:fn.ToggleCaseSensitiveCommand,precondition:void 0,handler:o=>o.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:M.focus,primary:Vm.primary,mac:Vm.mac,win:Vm.win,linux:Vm.linux}}));Tt(new ca({id:fn.ToggleWholeWordCommand,precondition:void 0,handler:o=>o.toggleWholeWords(),kbOpts:{weight:105,kbExpr:M.focus,primary:jm.primary,mac:jm.mac,win:jm.win,linux:jm.linux}}));Tt(new ca({id:fn.ToggleRegexCommand,precondition:void 0,handler:o=>o.toggleRegex(),kbOpts:{weight:105,kbExpr:M.focus,primary:Um.primary,mac:Um.mac,win:Um.win,linux:Um.linux}}));Tt(new ca({id:fn.ToggleSearchScopeCommand,precondition:void 0,handler:o=>o.toggleSearchScope(),kbOpts:{weight:105,kbExpr:M.focus,primary:$m.primary,mac:$m.mac,win:$m.win,linux:$m.linux}}));Tt(new ca({id:fn.TogglePreserveCaseCommand,precondition:void 0,handler:o=>o.togglePreserveCase(),kbOpts:{weight:105,kbExpr:M.focus,primary:qm.primary,mac:qm.mac,win:qm.win,linux:qm.linux}}));Tt(new ca({id:fn.ReplaceOneAction,precondition:Pl,handler:o=>o.replace(),kbOpts:{weight:105,kbExpr:M.focus,primary:3094}}));Tt(new ca({id:fn.ReplaceOneAction,precondition:Pl,handler:o=>o.replace(),kbOpts:{weight:105,kbExpr:le.and(M.focus,H1),primary:3}}));Tt(new ca({id:fn.ReplaceAllAction,precondition:Pl,handler:o=>o.replaceAll(),kbOpts:{weight:105,kbExpr:M.focus,primary:2563}}));Tt(new ca({id:fn.ReplaceAllAction,precondition:Pl,handler:o=>o.replaceAll(),kbOpts:{weight:105,kbExpr:le.and(M.focus,H1),primary:void 0,mac:{primary:2051}}}));Tt(new ca({id:fn.SelectAllMatchesAction,precondition:Pl,handler:o=>o.selectAllMatches(),kbOpts:{weight:105,kbExpr:M.focus,primary:515}}));const zz={0:" ",1:"u",2:"r"},yI=65535,$r=16777215,wI=4278190080;class Mw{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 Ao{constructor(e,t,i){if(e.length!==t.length||e.length>yI)throw new Error("invalid startIndexes or endIndexes size");this._startIndexes=e,this._endIndexes=t,this._collapseStates=new Mw(e.length),this._userDefinedStates=new Mw(e.length),this._recoveredStates=new Mw(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>$r||r>$r)throw new Error("startLineNumber or endLineNumber must not exceed "+$r);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]&$r}getEndLineNumber(e){return this._endIndexes[e]&$r}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 Vz(this,e)}getParentIndex(e){this.ensureParentIndices();const t=((this._startIndexes[e]&wI)>>>24)+((this._endIndexes[e]&wI)>>>16);return t===yI?-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]=`[${zz[this.getSource(t)]}${this.isCollapsed(t)?"+":"-"}] ${this.getStartLineNumber(t)}/${this.getEndLineNumber(t)}`;return e.join(", ")}toFoldRange(e){return{startLineNumber:this._startIndexes[e]&$r,endLineNumber:this._endIndexes[e]&$r,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 Ao(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,D)=>Array.isArray(S)?(E=>E<D?S[E]:void 0):(E=>E<D?S.toFoldRange(E):void 0),r=s(e,e.length),a=s(t,t.length);let c=0,h=0,g=r(0),f=a(0);const p=[];let v,_=0;const w=[];for(;g||f;){let S;if(f&&(!g||g.startLineNumber>=f.startLineNumber))g&&g.startLineNumber===f.startLineNumber?(f.source===1?S=f:(S=g,S.isCollapsed=f.isCollapsed&&(g.endLineNumber===f.endLineNumber||!(n!=null&&n.startsInside(g.startLineNumber+1,g.endLineNumber+1))),S.source=0),g=r(++c)):(S=f,f.isCollapsed&&f.source===0&&(S.source=2)),f=a(++h);else{let D=h,E=f;for(;;){if(!E||E.startLineNumber>g.endLineNumber){S=g;break}if(E.source===1&&E.endLineNumber>g.endLineNumber)break;E=a(++D)}g=r(++c)}if(S){for(;v&&v.endLineNumber<S.startLineNumber;)v=p.pop();S.endLineNumber>S.startLineNumber&&S.startLineNumber>_&&S.endLineNumber<=i&&(!v||v.endLineNumber>=S.endLineNumber)&&(w.push(S),_=S.startLineNumber,v&&p.push(v),v=S)}}return w}}class Vz{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 jz{get regions(){return this._regions}get textModel(){return this._textModel}constructor(e,t){this._updateEventEmitter=new ui,this.onDidChange=this._updateEventEmitter.event,this._textModel=e,this._decorationProvider=t,this._regions=new Ao(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),g=this._regions.isCollapsed(n);if(h<=s){const f=this.regions.getSource(n)!==0;i.changeDecorationOptions(this._editorDecorationIds[n],this._decorationProvider.getDecorationOption(g,h<=r,f))}g&&h>r&&(r=h),n++}};for(const c of e){const h=c.regionIndex,g=this._editorDecorationIds[h];if(g&&!t[g]){t[g]=!0,a(h);const f=!this._regions.isCollapsed(h);this._regions.setCollapsed(h,f),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(Ao.fromFoldRanges(t))}update(e,t){const i=this._currentFoldedOrManualRanges(t),n=Ao.sanitizeAndMerge(e,i,this._textModel.getLineCount(),t);this.updatePost(Ao.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,g={startLineNumber:r,startColumn:this._textModel.getLineMaxColumn(r),endLineNumber:a,endColumn:this._textModel.getLineMaxColumn(a)+1};t.push({range:g,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=Ao.sanitizeAndMerge(this._regions,t,i);this.updatePost(Ao.fromFoldRanges(n))}_getLinesChecksum(e,t){return FE(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 z1(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 Wg(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 uN(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 Uz(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 $z(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 gN(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 V1(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 j1(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 qz(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 Kz(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 Gz(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 Zz{get onDidChange(){return this._updateEventEmitter.event}get hiddenRanges(){return this._hiddenRanges}constructor(e){this._updateEventEmitter=new ui,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||IO(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 B(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 SI(this._hiddenRanges,e)!==null}adjustSelections(e){let t=!1;const i=this._foldingModel.textModel;let n=null;const s=r=>((!n||!Xz(r,n))&&(n=SI(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 g=s(c.endLineNumber);g&&(c=c.setEndPosition(g,i.getLineMaxColumn(g)),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 Xz(o,e){return o>=e.startLineNumber&&o<=e.endLineNumber}function SI(o,e){const t=DE(o,i=>e<i.startLineNumber)-1;return t>=0&&o[t].endLineNumber>=e?o[t]:null}const Yz=5e3,Jz="indent";class U1{constructor(e,t,i){this.editorModel=e,this.languageConfigurationService=t,this.foldingRangesLimit=i,this.id=Jz}dispose(){}compute(e){const t=this.languageConfigurationService.getLanguageConfiguration(this.editorModel.getLanguageId()).foldingRules,i=t&&!!t.offSide,n=t&&t.markers;return Promise.resolve(tV(this.editorModel,i,n,this.foldingRangesLimit))}}let Qz=class{constructor(e){this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=e}insertFirst(e,t,i){if(e>$r||t>$r)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 Ao(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 g=this._startIndexes[c],f=e.getLineContent(g),p=N0(f,s);(p<n||p===n&&i++<t)&&(r[h]=g,a[h]=this._endIndexes[c],h++)}return new Ao(r,a)}}};const eV={limit:Yz,update:()=>{}};function tV(o,e,t,i=eV){const n=o.getOptions().tabSize,s=new Qz(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 g=o.getLineContent(h),f=N0(g,n);let p=a[a.length-1];if(f===-1){e&&(p.endAbove=h);continue}let v;if(r&&(v=g.match(r)))if(v[1]){let _=a.length-1;for(;_>0&&a[_].indent!==-2;)_--;if(_>0){a.length=_+1,p=a[_],s.insertFirst(h,p.line,f),p.line=h,p.indent=f,p.endAbove=h;continue}}else{a.push({indent:-2,endAbove:h,line:h});continue}if(p.indent>f){do a.pop(),p=a[a.length-1];while(p.indent>f);const _=p.endAbove-1;_-h>=1&&s.insertFirst(h,_,f)}p.indent===f?p.endAbove=h:a.push({indent:f,endAbove:h,line:h})}return s.toIndentRanges(o)}const iV=St("editor.foldBackground",{light:Ra(tk,.3),dark:Ra(tk,.3),hcDark:null,hcLight:null},y("foldBackgroundBackground","Background color behind folded ranges. The color must not be opaque so as not to hide underlying decorations."),!0);St("editor.foldPlaceholderForeground",{light:"#808080",dark:"#808080",hcDark:null,hcLight:null},y("collapsedTextColor","Color of the collapsed text after the first line of a folded range."));St("editorGutter.foldingControlForeground",DO,y("editorGutter.foldingControlForeground","Color of the folding control in the editor gutter."));const mv=es("folding-expanded",Qt.chevronDown,y("foldingExpandedIcon","Icon for expanded ranges in the editor glyph margin.")),_v=es("folding-collapsed",Qt.chevronRight,y("foldingCollapsedIcon","Icon for collapsed ranges in the editor glyph margin.")),CI=es("folding-manual-collapsed",_v,y("foldingManualCollapedIcon","Icon for manually collapsed ranges in the editor glyph margin.")),xI=es("folding-manual-expanded",mv,y("foldingManualExpandedIcon","Icon for manually expanded ranges in the editor glyph margin.")),Nw={color:hs(iV),position:1},Yh=y("linesCollapsed","Click to expand the range."),Zm=y("linesExpanded","Click to collapse the range."),ns=class ns{constructor(e){this.editor=e,this.showFoldingControls="mouseover",this.showFoldingHighlights=!0}getDecorationOption(e,t,i){return t?ns.HIDDEN_RANGE_DECORATION:this.showFoldingControls==="never"?e?this.showFoldingHighlights?ns.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:ns.NO_CONTROLS_COLLAPSED_RANGE_DECORATION:ns.NO_CONTROLS_EXPANDED_RANGE_DECORATION:e?i?this.showFoldingHighlights?ns.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:ns.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?ns.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:ns.COLLAPSED_VISUAL_DECORATION:this.showFoldingControls==="mouseover"?i?ns.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:ns.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:i?ns.MANUALLY_EXPANDED_VISUAL_DECORATION:ns.EXPANDED_VISUAL_DECORATION}changeDecorations(e){return this.editor.changeDecorations(e)}removeDecorations(e){this.editor.removeDecorations(e)}};ns.COLLAPSED_VISUAL_DECORATION=ki.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:Yh,firstLineDecorationClassName:Xi.asClassName(_v)}),ns.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=ki.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Nw,isWholeLine:!0,linesDecorationsTooltip:Yh,firstLineDecorationClassName:Xi.asClassName(_v)}),ns.MANUALLY_COLLAPSED_VISUAL_DECORATION=ki.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:Yh,firstLineDecorationClassName:Xi.asClassName(CI)}),ns.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=ki.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Nw,isWholeLine:!0,linesDecorationsTooltip:Yh,firstLineDecorationClassName:Xi.asClassName(CI)}),ns.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=ki.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:Yh}),ns.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=ki.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Nw,isWholeLine:!0,linesDecorationsTooltip:Yh}),ns.EXPANDED_VISUAL_DECORATION=ki.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+Xi.asClassName(mv),linesDecorationsTooltip:Zm}),ns.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=ki.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:Xi.asClassName(mv),linesDecorationsTooltip:Zm}),ns.MANUALLY_EXPANDED_VISUAL_DECORATION=ki.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+Xi.asClassName(xI),linesDecorationsTooltip:Zm}),ns.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=ki.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:Xi.asClassName(xI),linesDecorationsTooltip:Zm}),ns.NO_CONTROLS_EXPANDED_RANGE_DECORATION=ki.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0}),ns.HIDDEN_RANGE_DECORATION=ki.register({description:"folding-hidden-range-decoration",stickiness:1});let MC=ns;const nV={},sV="syntax";class $1{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 Be,s&&this.disposables.add(s);for(const r of t)typeof r.onDidChange=="function"&&this.disposables.add(r.onDidChange(i))}compute(e){return oV(this.providers,this.editorModel,e).then(t=>{var i;return t?aV(t,this.foldingRangesLimit):((i=this.fallbackRangeProvider)==null?void 0:i.compute(e))??null})}dispose(){this.disposables.dispose()}}function oV(o,e,t){let i=null;const n=o.map((s,r)=>Promise.resolve(s.provideFoldingRanges(e,nV,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})}},ss));return Promise.all(n).then(s=>i)}class rV{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>$r||t>$r)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 Ao(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 Ao(n,s,r)}}}function aV(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 rV(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 lV=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},rf=function(o,e){return function(t,i){e(t,i,o)}},$c;const Ts=new Ri("foldingEnabled",!1);var Od;let Pc=(Od=class extends Ve{static get(e){return e.getContribution($c.ID)}static getFoldingRangeProviders(e,t){var n;const i=e.foldingRangeProvider.ordered(t);return((n=$c._foldingRangeSelector)==null?void 0:n.call($c,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 Be),this.editor=e,this._foldingLimitReporter=new fN(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 MC(e),this.foldingDecorationProvider.showFoldingControls=a.get(111),this.foldingDecorationProvider.showFoldingHighlights=a.get(45),this.foldingEnabled=Ts.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 jz(e,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new Zz(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange(t=>this.onHiddenRangesChanges(t))),this.updateScheduler=new Lc(this.updateDebounceInfo.get(e)),this.cursorChangedScheduler=new ms(()=>this.revealCursor(),200),this.localToDispose.add(this.cursorChangedScheduler),this.localToDispose.add(this.languageFeaturesService.foldingRangeProvider.onDidChange(()=>this.onFoldingStrategyChanged())),this.localToDispose.add(this.editor.onDidChangeModelLanguageConfiguration(()=>this.onFoldingStrategyChanged())),this.localToDispose.add(this.editor.onDidChangeModelContent(t=>this.onDidChangeModelContent(t))),this.localToDispose.add(this.editor.onDidChangeCursorPosition(()=>this.onCursorPositionChanged())),this.localToDispose.add(this.editor.onMouseDown(t=>this.onEditorMouseDown(t))),this.localToDispose.add(this.editor.onMouseUp(t=>this.onEditorMouseUp(t))),this.localToDispose.add({dispose:()=>{var t,i;this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),(t=this.updateScheduler)==null||t.cancel(),this.updateScheduler=null,this.foldingModel=null,this.foldingModelPromise=null,this.hiddenRangeModel=null,this.cursorChangedScheduler=null,(i=this.rangeProvider)==null||i.dispose(),this.rangeProvider=null}}),this.triggerFoldingModelChanged())}onFoldingStrategyChanged(){var e;(e=this.rangeProvider)==null||e.dispose(),this.rangeProvider=null,this.triggerFoldingModelChanged()}getRangeProvider(e){if(this.rangeProvider)return this.rangeProvider;const t=new U1(e,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=t,this._useFoldingProviders&&this.foldingModel){const i=$c.getFoldingRangeProviders(this.languageFeaturesService,e);i.length>0&&(this.rangeProvider=new $1(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 Lo,i=this.getRangeProvider(e.textModel),n=this.foldingRegionPromise=ks(s=>i.compute(s));return n.then(s=>{if(s&&n===this.foldingRegionPromise){let r;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){const h=s.setCollapsedAllOfType(sm.Imports.value,!0);h&&(r=ig.capture(this.editor),this._currentModelHasFoldedImports=h)}const a=this.editor.getSelections();e.update(s,cV(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=>(mn(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,mn)}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 g=p=>!p.containedBy(r)&&!r.containedBy(p),f=t.getRegionsInside(null,g);for(const p of f)p.isCollapsed&&h.push(p);h.length===0&&(h=f)}else{const g=e.event.middleButton||e.event.shiftKey;if(g)for(const f of t.getRegionsInside(r))f.isCollapsed===a&&h.push(f);(a||!g||h.length===0)&&h.push(r)}t.toggleCollapseState(h),this.reveal({lineNumber:i,column:1})}}}reveal(e){this.editor.revealPositionInCenterIfOutsideViewport(e,0)}},$c=Od,Od.ID="editor.contrib.folding",Od);Pc=$c=lV([rf(1,$i),rf(2,ws),rf(3,Qs),rf(4,nr),rf(5,Et)],Pc);class fN{constructor(e){this.editor=e,this._onDidChange=new ui,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 Os extends Se{runEditorCommand(e,t,i){const n=e.get(ws),s=Pc.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 cV(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 pN(o){if(!uf(o)){if(!HE(o))return!1;const e=o;if(!uf(e.levels)&&!ik(e.levels)||!uf(e.direction)&&!dE(e.direction)||!uf(e.selectionLines)&&(!Array.isArray(e.selectionLines)||!e.selectionLines.every(ik)))return!1}return!0}class dV extends Os{constructor(){super({id:"editor.unfold",label:y("unfoldAction.label","Unfold"),alias:"Unfold",precondition:Ts,kbOpts:{kbExpr:M.editorTextFocus,primary:3166,mac:{primary:2654},weight:100},metadata:{description:"Unfold the content in the editor",args:[{name:"Unfold editor argument",description:`Property-value pairs that can be passed through this argument:
23
+ * 'levels': Number of levels to unfold. If not set, defaults to 1.
24
+ * 'direction': If 'up', unfold given number of levels up otherwise unfolds down.
25
+ * 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the unfold action to. If not set, the active selection(s) will be used.
26
+ `,constraint:pN,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"?uN(t,!1,s,r):Wg(t,!1,s,r)}}class hV extends Os{constructor(){super({id:"editor.unfoldRecursively",label:y("unFoldRecursivelyAction.label","Unfold Recursively"),alias:"Unfold Recursively",precondition:Ts,kbOpts:{kbExpr:M.editorTextFocus,primary:cs(2089,2142),weight:100}})}invoke(e,t,i,n){Wg(t,!1,Number.MAX_VALUE,this.getSelectedLines(i))}}class uV extends Os{constructor(){super({id:"editor.fold",label:y("foldAction.label","Fold"),alias:"Fold",precondition:Ts,kbOpts:{kbExpr:M.editorTextFocus,primary:3164,mac:{primary:2652},weight:100},metadata:{description:"Fold the content in the editor",args:[{name:"Fold editor argument",description:`Property-value pairs that can be passed through this argument:
27
+ * 'levels': Number of levels to fold.
28
+ * 'direction': If 'up', folds given number of levels up otherwise folds down.
29
+ * 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the fold action to. If not set, the active selection(s) will be used.
30
+ If no levels or direction is set, folds the region at the locations or if already collapsed, the first uncollapsed parent instead.
31
+ `,constraint:pN,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"?Uz(t,!0,s):a==="up"?uN(t,!0,r||1,s):Wg(t,!0,r||1,s)}}class gV extends Os{constructor(){super({id:"editor.toggleFold",label:y("toggleFoldAction.label","Toggle Fold"),alias:"Toggle Fold",precondition:Ts,kbOpts:{kbExpr:M.editorTextFocus,primary:cs(2089,2090),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);z1(t,1,n)}}class fV extends Os{constructor(){super({id:"editor.foldRecursively",label:y("foldRecursivelyAction.label","Fold Recursively"),alias:"Fold Recursively",precondition:Ts,kbOpts:{kbExpr:M.editorTextFocus,primary:cs(2089,2140),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);Wg(t,!0,Number.MAX_VALUE,n)}}class pV extends Os{constructor(){super({id:"editor.toggleFoldRecursively",label:y("toggleFoldRecursivelyAction.label","Toggle Fold Recursively"),alias:"Toggle Fold Recursively",precondition:Ts,kbOpts:{kbExpr:M.editorTextFocus,primary:cs(2089,3114),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);z1(t,Number.MAX_VALUE,n)}}class mV extends Os{constructor(){super({id:"editor.foldAllBlockComments",label:y("foldAllBlockComments.label","Fold All Block Comments"),alias:"Fold All Block Comments",precondition:Ts,kbOpts:{kbExpr:M.editorTextFocus,primary:cs(2089,2138),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())j1(t,sm.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*"+Qf(a.blockCommentStartToken));V1(t,c,!0)}}}}class _V extends Os{constructor(){super({id:"editor.foldAllMarkerRegions",label:y("foldAllMarkerRegions.label","Fold All Regions"),alias:"Fold All Regions",precondition:Ts,kbOpts:{kbExpr:M.editorTextFocus,primary:cs(2089,2077),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())j1(t,sm.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);V1(t,c,!0)}}}}class vV extends Os{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:y("unfoldAllMarkerRegions.label","Unfold All Regions"),alias:"Unfold All Regions",precondition:Ts,kbOpts:{kbExpr:M.editorTextFocus,primary:cs(2089,2078),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())j1(t,sm.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);V1(t,c,!1)}}}}class bV extends Os{constructor(){super({id:"editor.foldAllExcept",label:y("foldAllExcept.label","Fold All Except Selected"),alias:"Fold All Except Selected",precondition:Ts,kbOpts:{kbExpr:M.editorTextFocus,primary:cs(2089,2136),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);gN(t,!0,n)}}class yV extends Os{constructor(){super({id:"editor.unfoldAllExcept",label:y("unfoldAllExcept.label","Unfold All Except Selected"),alias:"Unfold All Except Selected",precondition:Ts,kbOpts:{kbExpr:M.editorTextFocus,primary:cs(2089,2134),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);gN(t,!1,n)}}class wV extends Os{constructor(){super({id:"editor.foldAll",label:y("foldAllAction.label","Fold All"),alias:"Fold All",precondition:Ts,kbOpts:{kbExpr:M.editorTextFocus,primary:cs(2089,2069),weight:100}})}invoke(e,t,i){Wg(t,!0)}}class SV extends Os{constructor(){super({id:"editor.unfoldAll",label:y("unfoldAllAction.label","Unfold All"),alias:"Unfold All",precondition:Ts,kbOpts:{kbExpr:M.editorTextFocus,primary:cs(2089,2088),weight:100}})}invoke(e,t,i){Wg(t,!1)}}const Lu=class Lu extends Os{getFoldingLevel(){return parseInt(this.id.substr(Lu.ID_PREFIX.length))}invoke(e,t,i){$z(t,this.getFoldingLevel(),!0,this.getSelectedLines(i))}};Lu.ID_PREFIX="editor.foldLevel",Lu.ID=e=>Lu.ID_PREFIX+e;let vv=Lu;class CV extends Os{constructor(){super({id:"editor.gotoParentFold",label:y("gotoParentFold.label","Go to Parent Fold"),alias:"Go to Parent Fold",precondition:Ts,kbOpts:{kbExpr:M.editorTextFocus,weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);if(n.length>0){const s=qz(n[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class xV extends Os{constructor(){super({id:"editor.gotoPreviousFold",label:y("gotoPreviousFold.label","Go to Previous Folding Range"),alias:"Go to Previous Folding Range",precondition:Ts,kbOpts:{kbExpr:M.editorTextFocus,weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);if(n.length>0){const s=Kz(n[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class LV extends Os{constructor(){super({id:"editor.gotoNextFold",label:y("gotoNextFold.label","Go to Next Folding Range"),alias:"Go to Next Folding Range",precondition:Ts,kbOpts:{kbExpr:M.editorTextFocus,weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);if(n.length>0){const s=Gz(n[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class kV extends Os{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:y("createManualFoldRange.label","Create Folding Range from Selection"),alias:"Create Folding Range from Selection",precondition:Ts,kbOpts:{kbExpr:M.editorTextFocus,primary:cs(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=Ao.sanitizeAndMerge(t.regions,n,(r=i.getModel())==null?void 0:r.getLineCount());t.updatePost(Ao.fromFoldRanges(a))}}}}class IV extends Os{constructor(){super({id:"editor.removeManualFoldingRanges",label:y("removeManualFoldingRanges.label","Remove Manual Folding Ranges"),alias:"Remove Manual Folding Ranges",precondition:Ts,kbOpts:{kbExpr:M.editorTextFocus,primary:cs(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()}}}_i(Pc.ID,Pc,0);se(dV);se(hV);se(uV);se(fV);se(pV);se(wV);se(SV);se(mV);se(_V);se(vV);se(bV);se(yV);se(gV);se(CV);se(xV);se(LV);se(kV);se(IV);for(let o=1;o<=7;o++)EO(new vv({id:vv.ID(o),label:y("foldLevelAction.label","Fold Level {0}",o),alias:`Fold Level ${o}`,precondition:Ts,kbOpts:{kbExpr:M.editorTextFocus,primary:cs(2089,2048|21+o),weight:100}}));Sn.registerCommand("_executeFoldingRangeProvider",async function(o,...e){const[t]=e;if(!(t instanceof un))throw cl();const i=o.get(Et),n=o.get(eo).getModel(t);if(!n)throw cl();const s=o.get(Tn);if(!s.getValue("editor.folding",{resource:t}))return[];const r=o.get(ws),a=s.getValue("editor.foldingStrategy",{resource:t}),c={get limit(){return s.getValue("editor.foldingMaximumRegions",{resource:t})},update:(v,_)=>{}},h=new U1(n,r,c);let g=h;if(a!=="indentation"){const v=Pc.getFoldingRangeProviders(i,n);v.length&&(g=new $1(n,v,()=>{},c,h))}const f=await g.compute(gi.None),p=[];try{if(f)for(let v=0;v<f.length;v++){const _=f.getType(v);p.push({start:f.getStartLineNumber(v),end:f.getEndLineNumber(v),kind:_?sm.fromValue(_):void 0})}return p}finally{g.dispose()}});class DV extends Se{constructor(){super({id:"editor.action.fontZoomIn",label:y("EditorFontZoomIn.label","Increase Editor Font Size"),alias:"Increase Editor Font Size",precondition:void 0})}run(e,t){op.setZoomLevel(op.getZoomLevel()+1)}}class EV extends Se{constructor(){super({id:"editor.action.fontZoomOut",label:y("EditorFontZoomOut.label","Decrease Editor Font Size"),alias:"Decrease Editor Font Size",precondition:void 0})}run(e,t){op.setZoomLevel(op.getZoomLevel()-1)}}class PV extends Se{constructor(){super({id:"editor.action.fontZoomReset",label:y("EditorFontZoomReset.label","Reset Editor Font Size"),alias:"Reset Editor Font Size",precondition:void 0})}run(e,t){op.setZoomLevel(0)}}se(DV);se(EV);se(PV);var mN=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Hf=function(o,e){return function(t,i){e(t,i,o)}},Uu;let bv=(Uu=class{constructor(e,t,i,n){this._editor=e,this._languageFeaturesService=t,this._workerService=i,this._accessibilitySignalService=n,this._disposables=new Be,this._sessionDisposables=new Be,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 z_;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 Is,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}});PO(this._workerService,this._languageFeaturesService,t,i,e,t.getFormattingOptions(),n.token).then(r=>{n.token.isCancellationRequested||Fo(r)&&(this._accessibilitySignalService.playSignal(BE.format,{userGesture:!1}),TO.execute(this._editor,r,!0))}).finally(()=>{s.dispose()})}},Uu.ID="editor.contrib.autoFormat",Uu);bv=mN([Hf(1,Et),Hf(2,Il),Hf(3,WE)],bv);var $u;let yv=($u=class{constructor(e,t,i){this.editor=e,this._languageFeaturesService=t,this._instantiationService=i,this._callOnDispose=new Be,this._callOnModel=new Be,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(zE,this.editor,e,2,nl.None,gi.None,!1).catch(mn))}},$u.ID="editor.contrib.formatOnPaste",$u);yv=mN([Hf(1,Et),Hf(2,ai)],yv);class TV extends Se{constructor(){super({id:"editor.action.formatDocument",label:y("formatDocument.label","Format Document"),alias:"Format Document",precondition:le.and(M.notInCompositeEditor,M.writable,M.hasDocumentFormattingProvider),kbOpts:{kbExpr:M.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(ai);await e.get(Gp).showWhile(i.invokeFunction(MO,t,1,nl.None,gi.None,!0),250)}}}class MV extends Se{constructor(){super({id:"editor.action.formatSelection",label:y("formatSelection.label","Format Selection"),alias:"Format Selection",precondition:le.and(M.writable,M.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:M.editorTextFocus,primary:cs(2089,2084),weight:100},contextMenuOpts:{when:M.hasNonEmptySelection,group:"1_modification",order:1.31}})}async run(e,t){if(!t.hasModel())return;const i=e.get(ai),n=t.getModel(),s=t.getSelections().map(a=>a.isEmpty()?new B(a.startLineNumber,1,a.startLineNumber,n.getLineMaxColumn(a.startLineNumber)):a);await e.get(Gp).showWhile(i.invokeFunction(zE,t,s,1,nl.None,gi.None,!0),250)}}_i(bv.ID,bv,2);_i(yv.ID,yv,2);se(TV);se(MV);Sn.registerCommand("editor.action.format",async o=>{const e=o.get(os).getFocusedCodeEditor();if(!e||!e.hasModel())return;const t=o.get(ys);e.getSelection().isEmpty()?await t.executeCommand("editor.action.formatDocument"):await t.executeCommand("editor.action.formatSelection")});var NV=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)}};class bu{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 NC extends bu{constructor(e,t,i){super(),this.id=e,this.parent=t,this.symbol=i,this.children=new Map}}class _N extends bu{constructor(e,t,i,n){super(),this.id=e,this.parent=t,this.label=i,this.order=n,this.children=new Map}}class Ya extends bu{static create(e,t,i){const n=new Is(i),s=new Ya(t.uri),r=e.ordered(t),a=r.map((h,g)=>{const f=bu.findId(`provider_${g}`,s),p=new _N(f,s,h.displayName??"Unknown Outline Provider",g);return Promise.resolve(h.provideDocumentSymbols(t,n.token)).then(v=>{for(const _ of v||[])Ya._makeOutlineElement(_,p);return p},v=>(ss(v),p)).then(v=>{bu.empty(v)?v.remove():s._groups.set(f,v)})}),c=e.onDidChange(()=>{const h=e.ordered(t);Oa(h,r)||n.cancel()});return Promise.all(a).then(()=>n.token.isCancellationRequested&&!i.isCancellationRequested?Ya.create(e,t,i):s._compact()).finally(()=>{n.dispose(),c.dispose(),n.dispose()})}static _makeOutlineElement(e,t){const i=bu.findId(e,t),n=new NC(i,t,e);if(e.children)for(const s of e.children)Ya._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=ll.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 NC?e.push(t.symbol):e.push(...ll.map(t.children.values(),i=>i.symbol));return e.sort((t,i)=>B.compareRangesUsingStarts(t.range,i.range))}asListOfDocumentSymbols(){const e=this.getTopLevelSymbols(),t=[];return Ya._flattenDocumentSymbols(t,e,""),t.sort((i,n)=>Dt.compare(B.getStartPosition(i.range),B.getStartPosition(n.range))||Dt.compare(B.getEndPosition(n.range),B.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&&Ya._flattenDocumentSymbols(e,n.children,n.name)}}const vm=Ll("IOutlineModelService");let RC=class{constructor(e,t,i){this._languageFeaturesService=e,this._disposables=new Be,this._cache=new Xp(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()||!Oa(s.provider,n)){const a=new Is;s={versionId:e.getVersionId(),provider:n,promiseCnt:0,source:a,promise:Ya.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()}}};RC=NV([Rw(0,Et),Rw(1,nr),Rw(2,eo)],RC);kl(vm,RC,1);Sn.registerCommand("_executeDocumentSymbolProvider",async function(o,...e){const[t]=e;Gi(un.isUri(t));const i=o.get(vm),s=await o.get(la).createModelReference(t);try{return(await i.getOrCreate(s.object.textEditorModel,gi.None)).getTopLevelSymbols()}finally{s.dispose()}});const va=class va extends Ve{constructor(e,t){super(),this.contextKeyService=e,this.model=t,this.inlineCompletionVisible=va.inlineSuggestionVisible.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentation=va.inlineSuggestionHasIndentation.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentationLessThanTabSize=va.inlineSuggestionHasIndentationLessThanTabSize.bindTo(this.contextKeyService),this.suppressSuggestions=va.suppressSuggestions.bindTo(this.contextKeyService),this._register(Vn(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(Vn(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],g=h[0],f=n.textModel.getLineIndentColumn(a.lineNumber);if(c<=f){let v=lS(g);v===-1&&(v=g.length-1),s=v>0;const _=n.textModel.getOptions().tabSize;r=NO.visibleColumnFromColumn(g,v+1,_)<_}}this.inlineCompletionSuggestsIndentation.set(s),this.inlineCompletionSuggestsIndentationLessThanTabSize.set(r)}))}};va.inlineSuggestionVisible=new Ri("inlineSuggestionVisible",!1,y("inlineSuggestionVisible","Whether an inline suggestion is visible")),va.inlineSuggestionHasIndentation=new Ri("inlineSuggestionHasIndentation",!1,y("inlineSuggestionHasIndentation","Whether the inline suggestion starts with whitespace")),va.inlineSuggestionHasIndentationLessThanTabSize=new Ri("inlineSuggestionHasIndentationLessThanTabSize",!0,y("inlineSuggestionHasIndentationLessThanTabSize","Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab")),va.suppressSuggestions=new Ri("inlineSuggestionSuppressSuggestions",void 0,y("suppressSuggestions","Whether suggestions should be suppressed for the current suggestion"));let xo=va;function RV(o){const e=new Be,t=e.add(VE());return e.add(Vn(i=>{t.setStyle(o.read(i))})),e}class yp{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 jE([...this.parts.map(s=>new _l(B.fromPositions(new Dt(1,s.column)),s.lines.join(`
32
+ `)))]).applyToString(i).substring(this.parts[0].column-1)}isEmpty(){return this.parts.every(e=>e.lines.length===0)}get lineCount(){return 1+this.parts.reduce((e,t)=>e+t.lines.length-1,0)}}class wv{constructor(e,t,i){this.column=e,this.text=t,this.preview=i,this.lines=hy(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 AC{constructor(e,t,i,n=0){this.lineNumber=e,this.columnRange=t,this.text=i,this.additionalReservedLineCount=n,this.parts=[new wv(this.columnRange.endColumnExclusive,this.text,!1)],this.newLines=hy(this.text)}renderForScreenReader(e){return this.newLines.join(`
33
+ `)}get lineCount(){return this.newLines.length}isEmpty(){return this.parts.every(e=>e.lines.length===0)}equals(e){return this.lineNumber===e.lineNumber&&this.columnRange.equals(e.columnRange)&&this.newLines.length===e.newLines.length&&this.newLines.every((t,i)=>t===e.newLines[i])&&this.additionalReservedLineCount===e.additionalReservedLineCount}}function LI(o,e){return Oa(o,e,vN)}function vN(o,e){return o===e?!0:!o||!e?!1:o instanceof yp&&e instanceof yp||o instanceof AC&&e instanceof AC?o.equals(e):!1}const AV=[];function OV(){return AV}class bN{constructor(e,t){if(this.startColumn=e,this.endColumnExclusive=t,e>t)throw new rg(`startColumn ${e} cannot be after endColumnExclusive ${t}`)}toRange(e){return new B(e,this.startColumn,e,this.endColumnExclusive)}equals(e){return this.startColumn===e.startColumn&&this.endColumnExclusive===e.endColumnExclusive}}function yN(o,e){const t=new Be,i=o.createDecorationsCollection();return t.add(RO({debugName:()=>`Apply decorations from ${e.debugName}`},n=>{const s=e.read(n);i.set(s)})),t.add({dispose:()=>{i.clear()}}),t}function FV(o,e){return new Dt(o.lineNumber+e.lineNumber-1,e.lineNumber===1?o.column+e.column-1:e.column)}function kI(o,e){return new Dt(o.lineNumber-e.lineNumber+1,o.lineNumber-e.lineNumber===0?o.column-e.column+1:o.column)}var HV=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},WV=function(o,e){return function(t,i){e(t,i,o)}};const II="ghost-text";let OC=class extends Ve{constructor(e,t,i){super(),this.editor=e,this.model=t,this.languageService=i,this.isDisposed=Ho(this,!1),this.currentTextModel=bo(this,this.editor.onDidChangeModel,()=>this.editor.getModel()),this.uiState=an(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 AC?r.columnRange:void 0,c=[],h=[];function g(w,S){if(h.length>0){const D=h[h.length-1];S&&D.decorations.push(new rp(D.content.length+1,D.content.length+1+w[0].length,S,0)),D.content+=w[0],w=w.slice(1)}for(const D of w)h.push({content:D,decorations:S?[new rp(1,D.length+1,S,0)]:[]})}const f=s.getLineContent(r.lineNumber);let p,v=0;for(const w of r.parts){let S=w.lines;p===void 0?(c.push({column:w.column,text:S[0],preview:w.preview}),S=S.slice(1)):g([f.substring(v,w.column-1)],void 0),S.length>0&&(g(S,II),p===void 0&&w.column<=f.length&&(p=w.column)),v=w.column-1}p!==void 0&&g([f.substring(v)],void 0);const _=p!==void 0?new bN(p,f.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=an(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:B.fromPositions(new Dt(s.lineNumber,a.column)),options:{description:II,after:{content:a.text,inlineClassName:a.preview?"ghost-text-decoration-preview":"ghost-text-decoration",cursorStops:gu.Left},showIfCollapsed:!0}});return r}),this.additionalLinesWidget=this._register(new BV(this.editor,this.languageService.languageIdCodec,an(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(En(()=>{this.isDisposed.set(!0,void 0)})),this._register(yN(this.editor,this.decorations))}ownsViewZone(e){return this.additionalLinesWidget.viewZoneId===e}};OC=HV([WV(2,aa)],OC);class BV extends Ve{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=cd("editorOptionChanged",ps.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(Vn(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");zV(c,s,t,this.editor.getOptions(),this.languageIdCodec),this._viewZoneId=r.addZone({afterLineNumber:e,heightInLines:a,domNode:c,afterColumnAffinity:1})}})}}function zV(o,e,t,i,n){const s=i.get(33),r=i.get(118),a="none",c=i.get(95),h=i.get(51),g=i.get(50),f=i.get(67),p=new $E(1e4);p.appendString('<div class="suggest-preview-text">');for(let w=0,S=t.length;w<S;w++){const D=t[w],E=D.content;p.appendString('<div class="view-line'),p.appendString('" style="top:'),p.appendString(String(w*f)),p.appendString('px;width:1000000px;">');const R=ZE(E),z=AO(E),H=OO.createEmpty(E,n);qE(new KE(g.isMonospace&&!s,g.canUseHalfwidthRightwardsArrow,E,!1,R,z,0,H,D.decorations,e,0,g.spaceWidth,g.middotWidth,g.wsmiddotWidth,r,a,c,h!==FO.OFF,null),p),p.appendString("</div>")}p.appendString("</div>"),GE(o,g);const v=p.build(),_=DI?DI.createHTML(v):v;o.innerHTML=_}const DI=UE("editorGhostText",{createHTML:o=>o});function VV(o,e){const t=new zO,i=new WO(t,h=>e.getLanguageConfiguration(h)),n=new HO(new jV([o]),i),s=BO(n,[],void 0,!0);let r="";const a=o.getLineContent();function c(h,g){if(h.kind===2)if(c(h.openingBracket,g),g=ef(g,h.openingBracket.length),h.child&&(c(h.child,g),g=ef(g,h.child.length)),h.closingBracket)c(h.closingBracket,g),g=ef(g,h.closingBracket.length);else{const p=i.getSingleLanguageBracketTokens(h.openingBracket.languageId).findClosingTokenText(h.openingBracket.bracketIds);r+=p}else if(h.kind!==3){if(h.kind===0||h.kind===1)r+=a.substring(nk(g),nk(ef(g,h.length)));else if(h.kind===4)for(const f of h.children)c(f,g),g=ef(g,f.length)}}return c(s,VO),r}class jV{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 wN(o,e,t,i,n=gi.None,s){const r=e instanceof Dt?qV(e,t):e,a=o.all(t),c=new jO;for(const D of a)D.groupId&&c.add(D.groupId,D);function h(D){if(!D.yieldsToGroupIds)return[];const E=[];for(const R of D.yieldsToGroupIds||[]){const z=c.get(R);for(const H of z)E.push(H)}return E}const g=new Map,f=new Set;function p(D,E){if(E=[...E,D],f.has(D))return E;f.add(D);try{const R=h(D);for(const z of R){const H=p(z,E);if(H)return H}}finally{f.delete(D)}}function v(D){const E=g.get(D);if(E)return E;const R=p(D,[]);R&&ss(new Error(`Inline completions: cyclic yield-to dependency detected. Path: ${R.map(H=>H.toString?H.toString():""+H).join(" -> ")}`));const z=new ey;return g.set(D,z.p),(async()=>{var H;if(!R){const ee=h(D);for(const X of ee){const me=await v(X);if(me&&me.items.length>0)return}}try{return e instanceof Dt?await D.provideInlineCompletions(t,e,i,n):await((H=D.provideInlineEdits)==null?void 0:H.call(D,t,e,i,n))}catch(ee){ss(ee);return}})().then(H=>z.complete(H),H=>z.error(H)),z.p}const _=await Promise.all(a.map(async D=>({provider:D,completions:await v(D)}))),w=new Map,S=[];for(const D of _){const E=D.completions;if(!E)continue;const R=new $V(E,D.provider);S.push(R);for(const z of E.items){const H=Sv.from(z,R,r,t,s);w.set(H.hash(),H)}}return new UV(Array.from(w.values()),new Set(w.keys()),S)}class UV{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 $V{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 Sv{static from(e,t,i,n,s){let r,a,c=e.range?B.lift(e.range):i;if(typeof e.insertText=="string"){if(r=e.insertText,s&&e.completeBracketPairs){r=EI(r,c.getStartPosition(),n,s);const h=r.length-e.insertText.length;h!==0&&(c=new B(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=EI(e.insertText.snippet,c.getStartPosition(),n,s);const f=e.insertText.snippet.length-h;f!==0&&(c=new B(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn+f))}const g=new uh().parse(e.insertText.snippet);g.children.length===1&&g.children[0]instanceof yo?(r=g.children[0].value,a=void 0):(r=g.toString(),a={snippet:e.insertText.snippet,range:c})}else UO(e.insertText);return new Sv(r,e.command,c,r,a,e.additionalTextEdits||OV(),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,`
34
+ `),n=e.replace(/\r\n|\r/g,`
35
+ `)}withRange(e){return new Sv(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 _l(this.range,this.insertText)}}function qV(o,e){const t=e.getWordAtPosition(o),i=e.getLineMaxColumn(o.lineNumber);return t?new B(o.lineNumber,t.startColumn,o.lineNumber,i):B.fromPositions(o,o.with(void 0,i))}function EI(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?VV(a,i):o}function md(o,e,t){const i=t?o.range.intersectRanges(t):o.range;if(!i)return o;const n=e.getValueInRange(i,1),s=nm(n,o.text),r=V_.ofText(n.substring(0,s)).addToPosition(o.range.getStartPosition()),a=o.text.substring(s),c=B.fromPositions(r,o.range.getEndPosition());return new _l(c,a)}function SN(o,e){return o.text.startsWith(e.text)&&KV(o.range,e.range)}function PI(o,e,t,i,n=0){let s=md(o,e);if(s.range.endLineNumber!==s.range.startLineNumber)return;const r=e.getLineContent(s.range.startLineNumber),a=Rs(r).length;if(s.range.startColumn-1<=a){const _=Rs(s.text).length,w=r.substring(s.range.startColumn-1,a),[S,D]=[s.range.getStartPosition(),s.range.getEndPosition()],E=S.column+w.length<=D.column?S.delta(0,w.length):D,R=B.fromPositions(E,D),z=s.text.startsWith(w)?s.text.substring(w.length):s.text.substring(_);s=new _l(R,z)}const h=e.getValueInRange(s.range),g=GV(h,s.text);if(!g)return;const f=s.range.startLineNumber,p=new Array;if(t==="prefix"){const _=g.filter(w=>w.originalLength===0);if(_.length>1||_.length===1&&_[0].originalStart!==h.length)return}const v=s.text.length-n;for(const _ of g){const w=s.range.startColumn+_.originalStart+_.originalLength;if(t==="subwordSmart"&&i&&i.lineNumber===s.range.startLineNumber&&w<i.column||_.originalLength>0)return;if(_.modifiedLength===0)continue;const S=_.modifiedStart+_.modifiedLength,D=Math.max(_.modifiedStart,Math.min(S,v)),E=s.text.substring(_.modifiedStart,D),R=s.text.substring(D,Math.max(_.modifiedStart,S));E.length>0&&p.push(new wv(w,E,!1)),R.length>0&&p.push(new wv(w,R,!0))}return new yp(f,p)}function KV(o,e){return e.getStartPosition().equals(o.getStartPosition())&&e.getEndPosition().isBeforeOrEqual(o.getEndPosition())}let fa;function GV(o,e){if((fa==null?void 0:fa.originalValue)===o&&(fa==null?void 0:fa.newValue)===e)return fa==null?void 0:fa.changes;{let t=MI(o,e,!0);if(t){const i=TI(t);if(i>0){const n=MI(o,e,!1);n&&TI(n)<i&&(t=n)}}return fa={originalValue:o,newValue:e,changes:t},t}}function TI(o){let e=0;for(const t of o)e+=t.originalLength;return e}function MI(o,e,t){if(o.length>5e3||e.length>5e3)return;function i(h){let g=0;for(let f=0,p=h.length;f<p;f++){const v=h.charCodeAt(f);v>g&&(g=v)}return g}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 g=0,f=0;const p=new Int32Array(h.length);for(let v=0,_=h.length;v<_;v++)if(t&&h[v]==="("){const w=f*100+g;p[v]=s(2*w),g++}else if(t&&h[v]===")"){g=Math.max(g-1,0);const w=f*100+g;p[v]=s(2*w+1),g===0&&f++}else p[v]=h.charCodeAt(v);return p}const a=r(o),c=r(e);return new $O({getElements:()=>a},{getElements:()=>c}).ComputeDiff(!1).changes}var ZV=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},NI=function(o,e){return function(t,i){e(t,i,o)}};let FC=class extends Ve{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 Bo),this.inlineCompletions=hS("inlineCompletions",void 0),this.suggestWidgetInlineCompletions=hS("suggestWidgetInlineCompletions",void 0),this._register(this.textModel.onDidChangeContent(()=>{this._updateOperation.clear()}))}fetch(e,t,i){var g,f;const n=new YV(e,t,this.textModel.getVersionId()),s=t.selectedSuggestionInfo?this.suggestWidgetInlineCompletions:this.inlineCompletions;if((g=this._updateOperation.value)!=null&&g.request.satisfies(n))return this._updateOperation.value.promise;if((f=s.get())!=null&&f.request.satisfies(n))return Promise.resolve(!0);const r=!!this._updateOperation.value;this._updateOperation.clear();const a=new Is,c=(async()=>{if((r||t.triggerKind===dl.Automatic)&&await XV(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 wN(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 w=new Date;this._debounceValue.update(this.textModel,w.getTime()-v.getTime());const S=new QV(_,n,this.textModel,this.versionId);if(i){const D=i.toInlineCompletion(void 0);i.canBeReused(this.textModel,e)&&!_.has(D)&&S.prepend(i.inlineCompletion,D.range,!0)}return this._updateOperation.clear(),Lh(D=>{s.set(S,D)}),!0})(),h=new JV(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()}};FC=ZV([NI(3,Et),NI(4,ws)],FC);function XV(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 YV{constructor(e,t,i){this.position=e,this.context=t,this.versionId=i}satisfies(e){return this.position.equals(e.position)&&qO(this.context.selectedSuggestionInfo,e.context.selectedSuggestionInfo,GO())&&(e.context.triggerKind===dl.Automatic||this.context.triggerKind===dl.Explicit)&&this.versionId===e.versionId}}class JV{constructor(e,t,i){this.request=e,this.cancellationTokenSource=t,this.promise=i}dispose(){this.cancellationTokenSource.cancel()}}class QV{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 RI(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 RI(e,n,this._textModel,this._versionId)),this._prependedInlineCompletionItems.push(e)}}class RI{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=il({owner:this,equalsFn:B.equalsRange},s=>(this._modelVersion.read(s),this._textModel.getDecorationRange(this.decorationId)))}toInlineCompletion(e){return this.inlineCompletion.withRange(this._updatedRange.read(e)??Aw)}toSingleTextEdit(e){return new _l(this._updatedRange.read(e)??Aw,this.inlineCompletion.insertText)}isVisible(e,t,i){const n=md(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),g=a.substring(c),f=r.substring(0,c),p=r.substring(c);const v=e.getLineIndentColumn(n.range.startLineNumber);return n.range.startColumn<=v&&(f=f.trimStart(),f.length===0&&(p=p.trimStart()),h=h.trimStart(),h.length===0&&(g=g.trimStart())),h.startsWith(f)&&!!KO(p,g)}canBeReused(e,t){const i=this._updatedRange.read(void 0);return!!i&&i.containsPosition(t)&&this.isVisible(e,t,void 0)&&V_.ofRange(i).isGreaterThanOrEqualTo(V_.ofRange(this.inlineCompletion.range))}_toFilterTextReplacement(e){return new _l(this._updatedRange.read(e)??Aw,this.inlineCompletion.filterText)}}const Aw=new B(1,1,1,1),Jt={Visible:W1,HasFocusedSuggestion:new Ri("suggestWidgetHasFocusedSuggestion",!1,y("suggestWidgetHasSelection","Whether any suggestion is focused")),DetailsVisible:new Ri("suggestWidgetDetailsVisible",!1,y("suggestWidgetDetailsVisible","Whether suggestion details are visible")),MultipleSuggestions:new Ri("suggestWidgetMultipleSuggestions",!1,y("suggestWidgetMultipleSuggestions","Whether there are multiple suggestions to pick from")),MakesTextEdit:new Ri("suggestionMakesTextEdit",!0,y("suggestionMakesTextEdit","Whether inserting the current suggestion yields in a change or has everything already been typed")),AcceptSuggestionsOnEnter:new Ri("acceptSuggestionOnEnter",!0,y("acceptSuggestionOnEnter","Whether suggestions are inserted when pressing Enter")),HasInsertAndReplaceRange:new Ri("suggestionHasInsertAndReplaceRange",!1,y("suggestionHasInsertAndReplaceRange","Whether the current suggestion has insert and replace behaviour")),InsertMode:new Ri("suggestionInsertMode",void 0,{type:"string",description:y("suggestionInsertMode","Whether the default behaviour is to insert or replace")}),CanResolve:new Ri("suggestionCanResolve",!1,y("suggestionCanResolve","Whether the current suggestion supports to resolve further details"))},ac=new lt("suggestWidgetStatusBar");class ej{constructor(e,t,i,n){var s;this.position=e,this.completion=t,this.container=i,this.provider=n,this.isInvalid=!1,this.score=np.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,B.isIRange(t.range)?(this.editStart=new Dt(t.range.startLineNumber,t.range.startColumn),this.editInsertEnd=new Dt(t.range.endLineNumber,t.range.endColumn),this.editReplaceEnd=new Dt(t.range.endLineNumber,t.range.endColumn),this.isInvalid=this.isInvalid||B.spansMultipleLines(t.range)||t.range.startLineNumber!==e.lineNumber):(this.editStart=new Dt(t.range.insert.startLineNumber,t.range.insert.startColumn),this.editInsertEnd=new Dt(t.range.insert.endLineNumber,t.range.insert.endColumn),this.editReplaceEnd=new Dt(t.range.replace.endLineNumber,t.range.replace.endColumn),this.isInvalid=this.isInvalid||B.spansMultipleLines(t.range.insert)||B.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 Lo(!0);this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,e)).then(n=>{Object.assign(this.completion,n),this._resolveDuration=i.elapsed()},n=>{Nc(n)&&(this._resolveCache=void 0,this._resolveDuration=void 0)}).finally(()=>{t.dispose()})}return this._resolveCache}}const yb=class yb{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}};yb.default=new yb;let wp=yb;class tj{constructor(e,t,i,n){this.items=e,this.needsClipboard=t,this.durations=i,this.disposable=n}}async function q1(o,e,t,i=wp.default,n={triggerKind:0},s=gi.None){const r=new Lo;t=t.clone();const a=e.getWordAtPosition(t),c=a?new B(t.lineNumber,a.startColumn,t.lineNumber,a.endColumn):B.fromPositions(t),h={replace:c,insert:c.setEndPosition(t.lineNumber,t.column)},g=[],f=new Be,p=[];let v=!1;const _=(S,D,E)=>{var z;let R=!1;if(!D)return R;for(const H of D.suggestions)if(!i.kindFilter.has(H.kind)){if(!i.showDeprecated&&((z=H==null?void 0:H.tags)!=null&&z.includes(1)))continue;H.range||(H.range=h),H.sortText||(H.sortText=typeof H.label=="string"?H.label:H.label.label),!v&&H.insertTextRules&&H.insertTextRules&4&&(v=uh.guessNeedsClipboard(H.insertText)),g.push(new ej(t,H,D,S)),R=!0}return XE(D)&&f.add(D),p.push({providerName:S._debugDisplayName??"unknown_provider",elapsedProvider:D.duration??-1,elapsedOverall:E.elapsed()}),R},w=(async()=>{})();for(const S of o.orderedGroups(e)){let D=!1;if(await Promise.all(S.map(async E=>{if(i.providerItemsToReuse.has(E)){const R=i.providerItemsToReuse.get(E);R.forEach(z=>g.push(z)),D=D||R.length>0;return}if(!(i.providerFilter.size>0&&!i.providerFilter.has(E)))try{const R=new Lo,z=await E.provideCompletionItems(e,t,n,s);D=_(E,z,R)||D}catch(R){ss(R)}})),D||s.isCancellationRequested)break}return await w,s.isCancellationRequested?(f.dispose(),Promise.reject(new ty)):new tj(g.sort(sj(i.snippetSortOrder)),v,{entries:p,elapsed:r.elapsed()},f)}function K1(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 ij(o,e){if(o.completion.kind!==e.completion.kind){if(o.completion.kind===27)return-1;if(e.completion.kind===27)return 1}return K1(o,e)}function nj(o,e){if(o.completion.kind!==e.completion.kind){if(o.completion.kind===27)return 1;if(e.completion.kind===27)return-1}return K1(o,e)}const Fy=new Map;Fy.set(0,ij);Fy.set(2,nj);Fy.set(1,K1);function sj(o){return Fy.get(o)}Sn.registerCommand("_executeCompletionItemProvider",async(o,...e)=>{const[t,i,n,s]=e;Gi(un.isUri(t)),Gi(Dt.isIPosition(i)),Gi(typeof n=="string"||!n),Gi(typeof s=="number"||!s);const{completionProvider:r}=o.get(Et),a=await o.get(la).createModelReference(t);try{const c={incomplete:!1,suggestions:[]},h=[],g=a.object.textEditorModel.validatePosition(i),f=await q1(r,a.object.textEditorModel,g,void 0,{triggerCharacter:n??void 0,triggerKind:n?1:0});for(const p of f.items)h.length<(s??0)&&h.push(p.resolve(gi.None)),c.incomplete=c.incomplete||p.container.incomplete,c.suggestions.push(p.completion);try{return await Promise.all(h),c}finally{setTimeout(()=>f.disposable.dispose(),100)}}finally{a.dispose()}});function oj(o,e){var t;(t=o.getContribution("editor.contrib.suggestController"))==null||t.triggerSuggest(new Set().add(e),void 0,!0)}class yu{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 AI(o,e=Qb){return ZO(o,e)?o.charAt(0).toUpperCase()+o.slice(1):o}var rj=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},aj=function(o,e){return function(t,i){e(t,i,o)}};class OI{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 FI{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=Rs(s,0,this._selection.startColumn-1);let a=r;e.snippet.walk(h=>h===e?!1:(h instanceof yo&&(a=Rs(hy(h.value).pop())),!0));const c=nm(a,r);i=i.replace(/(\r\n|\r|\n)(.*)/g,(h,g,f)=>`${g}${a.substr(c)}${f}`)}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 HI{constructor(e,t){this._labelService=e,this._model=t}resolve(e){const{name:t}=e;if(t==="TM_FILENAME")return Pf(this._model.uri.fsPath);if(t==="TM_FILENAME_BASE"){const i=Pf(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(j0(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 WI{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=>!YO(n));if(i.length===this._selectionCount)return i[this._selectionIdx]}return t}}}let Cv=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}}};Cv=rj([aj(2,ws)],Cv);const ba=class ba{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 ba.dayNames[this._date.getDay()];if(t==="CURRENT_DAY_NAME_SHORT")return ba.dayNamesShort[this._date.getDay()];if(t==="CURRENT_MONTH_NAME")return ba.monthNames[this._date.getMonth()];if(t==="CURRENT_MONTH_NAME_SHORT")return ba.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}}};ba.dayNames=[y("Sunday","Sunday"),y("Monday","Monday"),y("Tuesday","Tuesday"),y("Wednesday","Wednesday"),y("Thursday","Thursday"),y("Friday","Friday"),y("Saturday","Saturday")],ba.dayNamesShort=[y("SundayShort","Sun"),y("MondayShort","Mon"),y("TuesdayShort","Tue"),y("WednesdayShort","Wed"),y("ThursdayShort","Thu"),y("FridayShort","Fri"),y("SaturdayShort","Sat")],ba.monthNames=[y("January","January"),y("February","February"),y("March","March"),y("April","April"),y("May","May"),y("June","June"),y("July","July"),y("August","August"),y("September","September"),y("October","October"),y("November","November"),y("December","December")],ba.monthNamesShort=[y("JanuaryShort","Jan"),y("FebruaryShort","Feb"),y("MarchShort","Mar"),y("AprilShort","Apr"),y("MayShort","May"),y("JuneShort","Jun"),y("JulyShort","Jul"),y("AugustShort","Aug"),y("SeptemberShort","Sep"),y("OctoberShort","Oct"),y("NovemberShort","Nov"),y("DecemberShort","Dec")];let xv=ba;class BI{constructor(e){this._workspaceService=e}resolve(e){if(!this._workspaceService)return;const t=JO(this._workspaceService.getWorkspace());if(!QO(t)){if(e.name==="WORKSPACE_NAME")return this._resolveWorkspaceName(t);if(e.name==="WORKSPACE_FOLDER")return this._resoveWorkspacePath(t)}}_resolveWorkspaceName(e){if(sk(e))return Pf(e.uri.path);let t=Pf(e.configPath.path);return t.endsWith(ok)&&(t=t.substr(0,t.length-ok.length-1)),t}_resoveWorkspacePath(e){if(sk(e))return AI(e.uri.fsPath);const t=Pf(e.configPath.path);let i=e.configPath.fsPath;return i.endsWith(t)&&(i=i.substr(0,i.length-t.length-1)),i?AI(i):"/"}}class zI{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 Iy()}}var lj=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},cj=function(o,e){return function(t,i){e(t,i,o)}},Hr;const ur=class ur{constructor(e,t,i){this._editor=e,this._snippet=t,this._snippetLineLeadingWhitespace=i,this._offset=-1,this._nestingLevel=1,this._placeholderGroups=rk(t.placeholders,tr.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=B.fromPositions(e.getPositionAt(this._offset+n),e.getPositionAt(this._offset+n+s)),a=i.isFinalTabstop?ur._decor.inactiveFinal:ur._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 g=1;g<h.length;g++)h[g]=this._editor.getModel().normalizeIndentation(this._snippetLineLeadingWhitespace+h[g]);n.push(Kn.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 Xt(h.startLineNumber,h.startColumn,h.endLineNumber,h.endColumn)),t=t&&this._hasPlaceholderBeenCollapsed(a),n.changeDecorationOptions(c,a.isFinalTabstop?ur._decor.activeFinal:ur._decor.active),s.add(a);for(const g of this._snippet.enclosingPlaceholders(a)){const f=this._placeholderDecorations.get(g);n.changeDecorationOptions(f,g.isFinalTabstop?ur._decor.activeFinal:ur._decor.active),s.add(g)}}for(const[a,c]of this._placeholderDecorations)s.has(a)||n.changeDecorationOptions(c,a.isFinalTabstop?ur._decor.inactiveFinal:ur._decor.inactive);return r});return t?this.move(e):i??[]}_hasPlaceholderBeenCollapsed(e){let t=e;for(;t;){if(t instanceof tr){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 Hg,!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),g=s._snippet.fullLen(c),f=B.fromPositions(t.getPositionAt(s._offset+h),t.getPositionAt(s._offset+h+g)),p=i.addDecoration(f,ur._decor.inactive);this._placeholderDecorations.set(c,p)}}this._placeholderGroups=rk(this._snippet.placeholders,tr.compareByIndex)})}};ur._decor={active:ki.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:ki.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:ki.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:ki.register({description:"snippet-placeholder-4",stickiness:1,className:"finish-snippet-placeholder"})};let Lv=ur;const VI={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let kv=Hr=class{static adjustWhitespace(e,t,i,n,s){const r=e.getLineContent(t.lineNumber),a=Rs(r,0,t.column-1);let c;return n.walk(h=>{if(!(h instanceof yo)||h.parent instanceof Hg||s&&!s.has(h))return!0;const g=h.value.split(/\r\n|\r|\n/);if(i){const p=n.offset(h);if(p===0)g[0]=e.normalizeIndentation(g[0]);else{c=c??n.toString();const v=c.charCodeAt(p-1);(v===10||v===13)&&(g[0]=e.normalizeIndentation(a+g[0]))}for(let v=1;v<g.length;v++)g[v]=e.normalizeIndentation(a+g[v])}const f=g.join(e.getEOL());return f!==h.value&&(h.parent.replace(h,[new yo(f)]),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=Xt.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 g=[],f=[];if(!e.hasModel())return{edits:g,snippets:f};const p=e.getModel(),v=e.invokeWithinContext(z=>z.get(Ju)),_=e.invokeWithinContext(z=>new HI(z.get(ip),p)),w=()=>a,S=p.getValueInRange(Hr.adjustSelection(p,e.getSelection(),i,0)),D=p.getValueInRange(Hr.adjustSelection(p,e.getSelection(),0,n)),E=p.getLineFirstNonWhitespaceColumn(e.getSelection().positionLineNumber),R=e.getSelections().map((z,H)=>({selection:z,idx:H})).sort((z,H)=>B.compareRangesUsingStarts(z.selection,H.selection));for(const{selection:z,idx:H}of R){let ee=Hr.adjustSelection(p,z,i,0),X=Hr.adjustSelection(p,z,0,n);S!==p.getValueInRange(ee)&&(ee=z),D!==p.getValueInRange(X)&&(X=z);const me=z.setStartPosition(ee.startLineNumber,ee.startColumn).setEndPosition(X.endLineNumber,X.endColumn),Le=new uh().parse(t,!0,s),je=me.getStartPosition(),Ce=Hr.adjustWhitespace(p,je,r||H>0&&E!==p.getLineFirstNonWhitespaceColumn(z.positionLineNumber),Le);Le.resolveVariables(new OI([_,new WI(w,H,R.length,e.getOption(79)==="spread"),new FI(p,z,H,c),new Cv(p,z,h),new xv,new BI(v),new zI])),g[H]=Kn.replace(me,Le.toString()),g[H].identifier={major:H,minor:0},g[H]._isTracked=!0,f[H]=new Lv(e,Le,Ce)}return{edits:g,snippets:f}}static createEditsAndSnippetsFromEdits(e,t,i,n,s,r,a){if(!e.hasModel()||t.length===0)return{edits:[],snippets:[]};const c=[],h=e.getModel(),g=new uh,f=new hm,p=new OI([e.invokeWithinContext(_=>new HI(_.get(ip),h)),new WI(()=>s,0,e.getSelections().length,e.getOption(79)==="spread"),new FI(h,e.getSelection(),0,r),new Cv(h,e.getSelection(),a),new xv,new BI(e.invokeWithinContext(_=>_.get(Ju))),new zI]);t=t.sort((_,w)=>B.compareRangesUsingStarts(_.range,w.range));let v=0;for(let _=0;_<t.length;_++){const{range:w,template:S}=t[_];if(_>0){const H=t[_-1].range,ee=B.fromPositions(H.getEndPosition(),w.getStartPosition()),X=new yo(h.getValueInRange(ee));f.appendChild(X),v+=X.value.length}const D=g.parseFragment(S,f);Hr.adjustWhitespace(h,w.getStartPosition(),!0,f,new Set(D)),f.resolveVariables(p);const E=f.toString(),R=E.slice(v);v=E.length;const z=Kn.replace(w,R);z.identifier={major:_,minor:0},z._isTracked=!0,c.push(z)}return g.ensureFinalTabstop(f,i,!0),{edits:c,snippets:[new Lv(e,f,"")]}}constructor(e,t,i=VI,n){this._editor=e,this._template=t,this._options=i,this._languageConfigurationService=n,this._templateMerges=[],this._snippets=[]}dispose(){Ks(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"?Hr.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):Hr.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=>Xt.fromPositions(s.range.getEndPosition()))}),this._editor.revealRange(this._editor.getSelections()[0])}merge(e,t=VI){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,e]);const{edits:i,snippets:n}=Hr.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=>Xt.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(B.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(B.compareRangesUsingStarts);for(const[i,n]of t){if(n.length!==e.length){t.delete(i);continue}n.sort(B.compareRangesUsingStarts);for(let s=0;s<n.length;s++)if(!n[s].containsRange(e[s])){t.delete(i);continue}}return t.size>0}};kv=Hr=lj([cj(3,ws)],kv);var dj=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},Xm=function(o,e){return function(t,i){e(t,i,o)}},cu;const jI={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};var Ia;let Js=(Ia=class{static get(e){return e.getContribution(cu.ID)}constructor(e,t,i,n,s){this._editor=e,this._logService=t,this._languageFeaturesService=i,this._languageConfigurationService=s,this._snippetListener=new Be,this._modelVersionId=-1,this._inSnippet=cu.InSnippetMode.bindTo(n),this._hasNextTabstop=cu.HasNextTabstop.bindTo(n),this._hasPrevTabstop=cu.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"?jI:{...jI,...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?(Gi(typeof e=="string"),this._session.merge(e,t)):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new kv(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:(g,f)=>{if(!this._session||g!==this._editor.getModel()||!Dt.equals(this._editor.getPosition(),f))return;const{activeChoice:p}=this._session;if(!p||p.choice.options.length===0)return;const v=g.getValueInRange(p.range),_=!!p.choice.options.find(S=>S.value===v),w=[];for(let S=0;S<p.choice.options.length;S++){const D=p.choice.options[S];w.push({kind:13,label:D.value,insertText:D.value,sortText:"a".repeat(S+1),range:p.range,filterText:_?`${v}_${D.value}`:void 0,command:{id:"jumpToNextSnippetPlaceholder",title:y("next","Go to next placeholder...")}})}return{suggestions:w}}},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(()=>{oj(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()}},cu=Ia,Ia.ID="snippetController2",Ia.InSnippetMode=new Ri("inSnippetMode",!1,y("inSnippetMode","Whether the editor in current in snippet mode")),Ia.HasNextTabstop=new Ri("hasNextTabstop",!1,y("hasNextTabstop","Whether there is a next tab stop when in snippet mode")),Ia.HasPrevTabstop=new Ri("hasPrevTabstop",!1,y("hasPrevTabstop","Whether there is a previous tab stop when in snippet mode")),Ia);Js=cu=dj([Xm(1,kh),Xm(2,Et),Xm(3,$i),Xm(4,ws)],Js);_i(Js.ID,Js,4);const Hy=go.bindToContribution(Js.get);Tt(new Hy({id:"jumpToNextSnippetPlaceholder",precondition:le.and(Js.InSnippetMode,Js.HasNextTabstop),handler:o=>o.next(),kbOpts:{weight:130,kbExpr:M.textInputFocus,primary:2}}));Tt(new Hy({id:"jumpToPrevSnippetPlaceholder",precondition:le.and(Js.InSnippetMode,Js.HasPrevTabstop),handler:o=>o.prev(),kbOpts:{weight:130,kbExpr:M.textInputFocus,primary:1026}}));Tt(new Hy({id:"leaveSnippet",precondition:Js.InSnippetMode,handler:o=>o.cancel(!0),kbOpts:{weight:130,kbExpr:M.textInputFocus,primary:9,secondary:[1033]}}));Tt(new Hy({id:"acceptSnippet",precondition:Js.InSnippetMode,handler:o=>o.finish()}));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},Ow=function(o,e){return function(t,i){e(t,i,o)}};let HC=class extends Ve{get isAcceptingPartially(){return this._isAcceptingPartially}constructor(e,t,i,n,s,r,a,c,h,g,f,p){super(),this.textModel=e,this.selectedSuggestItem=t,this._textModelVersionId=i,this._positions=n,this._debounceValue=s,this._suggestPreviewEnabled=r,this._suggestPreviewMode=a,this._inlineSuggestMode=c,this._enabled=h,this._instantiationService=g,this._commandService=f,this._languageConfigurationService=p,this._source=this._register(this._instantiationService.createInstance(FC,this.textModel,this._textModelVersionId,this._debounceValue)),this._isActive=Ho(this,!1),this._forceUpdateExplicitlySignal=G0(this),this._selectedInlineCompletionId=Ho(this,void 0),this._primaryPosition=an(this,_=>this._positions.read(_)[0]??new Dt(1,1)),this._isAcceptingPartially=!1,this._preserveCurrentCompletionReasons=new Set([Xa.Redo,Xa.Undo,Xa.AcceptWord]),this._fetchInlineCompletionsPromise=YE({owner:this,createEmptyChangeSummary:()=>({preserveCurrentCompletion:!1,inlineCompletionTriggerKind:dl.Automatic}),handleChange:(_,w)=>(_.didChange(this._textModelVersionId)&&this._preserveCurrentCompletionReasons.has(this._getReason(_.change))?w.preserveCurrentCompletion=!0:_.didChange(this._forceUpdateExplicitlySignal)&&(w.inlineCompletionTriggerKind=dl.Explicit),!0)},(_,w)=>{if(this._forceUpdateExplicitlySignal.read(_),!(this._enabled.read(_)&&this.selectedSuggestItem.read(_)||this._isActive.read(_))){this._source.cancelUpdate();return}this._textModelVersionId.read(_);const D=this._source.suggestWidgetInlineCompletions.get(),E=this.selectedSuggestItem.read(_);if(D&&!E){const X=this._source.inlineCompletions.get();Lh(me=>{(!X||D.request.versionId>X.request.versionId)&&this._source.inlineCompletions.set(D.clone(),me),this._source.clearSuggestWidgetInlineCompletions(me)})}const R=this._primaryPosition.read(_),z={triggerKind:w.inlineCompletionTriggerKind,selectedSuggestionInfo:E==null?void 0:E.toSelectedSuggestionInfo()},H=this.selectedInlineCompletion.get(),ee=w.preserveCurrentCompletion||H!=null&&H.forwardStable?H:void 0;return this._source.fetch(R,z,ee)}),this._filteredInlineCompletionItems=il({owner:this,equalsFn:uS()},_=>{const w=this._source.inlineCompletions.read(_);if(!w)return[];const S=this._primaryPosition.read(_);return w.inlineCompletions.filter(E=>E.isVisible(this.textModel,S,_))}),this.selectedInlineCompletionIndex=an(this,_=>{const w=this._selectedInlineCompletionId.read(_),S=this._filteredInlineCompletionItems.read(_),D=this._selectedInlineCompletionId===void 0?-1:S.findIndex(E=>E.semanticId===w);return D===-1?(this._selectedInlineCompletionId.set(void 0,void 0),0):D}),this.selectedInlineCompletion=an(this,_=>{const w=this._filteredInlineCompletionItems.read(_),S=this.selectedInlineCompletionIndex.read(_);return w[S]}),this.activeCommands=il({owner:this,equalsFn:uS()},_=>{var w;return((w=this.selectedInlineCompletion.read(_))==null?void 0:w.inlineCompletion.source.inlineCompletions.commands)??[]}),this.lastTriggerKind=this._source.inlineCompletions.map(this,_=>_==null?void 0:_.request.context.triggerKind),this.inlineCompletionsCount=an(this,_=>{if(this.lastTriggerKind.read(_)===dl.Explicit)return this._filteredInlineCompletionItems.read(_).length}),this.state=il({owner:this,equalsFn:(_,w)=>!_||!w?_===w:LI(_.ghostTexts,w.ghostTexts)&&_.inlineCompletion===w.inlineCompletion&&_.suggestItem===w.suggestItem},_=>{const w=this.textModel,S=this.selectedSuggestItem.read(_);if(S){const D=md(S.toSingleTextEdit(),w),E=this._computeAugmentation(D,_);if(!this._suggestPreviewEnabled.read(_)&&!E)return;const z=(E==null?void 0:E.edit)??D,H=E?E.edit.text.length-D.text.length:0,ee=this._suggestPreviewMode.read(_),X=this._positions.read(_),me=[z,...Fw(this.textModel,X,z)],Le=me.map((Ce,mt)=>PI(Ce,w,ee,X[mt],H)).filter(u_),je=Le[0]??new yp(z.range.endLineNumber,[]);return{edits:me,primaryGhostText:je,ghostTexts:Le,inlineCompletion:E==null?void 0:E.completion,suggestItem:S}}else{if(!this._isActive.read(_))return;const D=this.selectedInlineCompletion.read(_);if(!D)return;const E=D.toSingleTextEdit(_),R=this._inlineSuggestMode.read(_),z=this._positions.read(_),H=[E,...Fw(this.textModel,z,E)],ee=H.map((X,me)=>PI(X,w,R,z[me],0)).filter(u_);return ee[0]?{edits:H,primaryGhostText:ee[0],ghostTexts:ee,inlineCompletion:D,suggestItem:void 0}:void 0}}),this.ghostTexts=il({owner:this,equalsFn:LI},_=>{const w=this.state.read(_);if(w)return w.ghostTexts}),this.primaryGhostText=il({owner:this,equalsFn:vN},_=>{const w=this.state.read(_);if(w)return w==null?void 0:w.primaryGhostText}),this._register(JE(this._fetchInlineCompletionsPromise));let v;this._register(Vn(_=>{var D,E;const w=this.state.read(_),S=w==null?void 0:w.inlineCompletion;if((S==null?void 0:S.semanticId)!==(v==null?void 0:v.semanticId)&&(v=S,S)){const R=S.inlineCompletion,z=R.source;(E=(D=z.provider).handleItemDidShow)==null||E.call(D,z.inlineCompletions,R.sourceInlineCompletion,R.insertText)}}))}_getReason(e){return e!=null&&e.isUndoing?Xa.Undo:e!=null&&e.isRedoing?Xa.Redo:this.isAcceptingPartially?Xa.AcceptWord:Xa.Other}async trigger(e){this._isActive.set(!0,e),await this._fetchInlineCompletionsPromise.get()}async triggerExplicitly(e){j_(e,t=>{this._isActive.set(!0,t),this._forceUpdateExplicitlySignal.trigger(t)}),await this._fetchInlineCompletionsPromise.get()}stop(e){j_(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(u_);return e2(s,a=>{let c=a.toSingleTextEdit(t);return c=md(c,i,B.fromPositions(c.range.getStartPosition(),e.range.getEndPosition())),SN(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 rg;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",[Kn.replace(i.range,""),...i.additionalTextEdits]),e.setPosition(i.snippetInfo.range.getStartPosition(),"inlineCompletionAccept"),(n=Js.get(e))==null||n.insert(i.snippetInfo.snippet,{undoStopBefore:!1});else{const s=t.edits,r=UI(s).map(a=>Xt.fromPositions(a));e.executeEdits("inlineSuggestion.accept",[...s.map(a=>Kn.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,ss),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 g=/\s+/g.exec(i);return g&&g.index!==void 0&&g.index+g[0].length<c&&(c=g.index+g[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 rg;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 Dt(s.lineNumber,a.column),h=a.text,g=t(c,h);if(g===h.length&&s.parts.length===1){this.accept(e);return}const f=h.substring(0,g),p=this._positions.get(),v=p[0];r.source.addRef();try{this._isAcceptingPartially=!0;try{e.pushUndoStop();const _=B.fromPositions(v,c),w=e.getModel().getValueInRange(_)+f,S=new _l(_,w),D=[S,...Fw(this.textModel,p,S)],E=UI(D).map(R=>Xt.fromPositions(R));e.executeEdits("inlineSuggestion.accept",D.map(R=>Kn.replace(R.range,R.text))),e.setSelections(E,"inlineCompletionPartialAccept"),e.revealPositionInCenterIfOutsideViewport(e.getPosition(),1)}finally{this._isAcceptingPartially=!1}if(r.source.provider.handlePartialAccept){const _=B.fromPositions(r.range.getStartPosition(),V_.ofText(f).addToPosition(c)),w=e.getModel().getValueInRange(_,1);r.source.provider.handlePartialAccept(r.source.inlineCompletions,r.sourceInlineCompletion,w.length,{kind:i})}}finally{r.source.removeRef()}}handleSuggestAccepted(e){var s,r;const t=md(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})}};HC=hj([Ow(9,ai),Ow(10,ys),Ow(11,ws)],HC);var Xa;(function(o){o[o.Undo=0]="Undo",o[o.Redo=1]="Redo",o[o.AcceptWord=2]="AcceptWord",o[o.Other=3]="Other"})(Xa||(Xa={}));function Fw(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(B.fromPositions(i,r)),c=kI(i,s);if(c.lineNumber<1)return mn(new rg(`positionWithinTextEdit line number should be bigger than 0.
36
+ Invalid subtraction between ${i.toString()} and ${s.toString()}`)),[];const h=uj(t.text,c);return n.map(g=>{const f=FV(kI(g,s),r),p=o.getValueInRange(B.fromPositions(g,f)),v=nm(a,p),_=B.fromPositions(g,g.delta(0,v));return new _l(_,h)})}function uj(o,e){let t="";const i=i2(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 UI(o){const e=t2.createSortPermutation(o,tm(s=>s.range,B.compareRangesUsingStarts)),i=new jE(e.apply(o)).getNewRanges();return e.inverse().apply(i).map(s=>s.getEndPosition())}var gj=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},$I=function(o,e){return function(t,i){e(t,i,o)}},vf;class G1{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 qI extends G1{constructor(){super("first")}memorize(e,t,i){}toJSON(){}fromJSON(){}}class fj extends G1{constructor(){super("recentlyUsed"),this._cache=new Xp(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 g=`${e.getLanguageId()}/${i[h].textLabel}`,f=this._cache.peek(g);if(f&&f.touch>c&&f.type===i[h].completion.kind&&f.insertText===i[h].completion.insertText&&(c=f.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:Z0.fromString(n.type),this._cache.set(i,n);this._seq=this._cache.size}}class pj extends G1{constructor(){super("recentlyUsedByPrefix"),this._trie=n2.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:Z0.fromString(i.type),this._trie.set(t,i)}}}var mc;let WC=(mc=class{constructor(e,t){this._storageService=e,this._configService=t,this._disposables=new Be,this._persistSoon=new ms(()=>this._saveState(),500),this._disposables.add(e.onWillSaveState(i=>{i.reason===W0.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=vf._strategyCtors.get(i)||qI;this._strategy=new s;try{const a=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,c=this._storageService.get(`${vf._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(`${vf._storagePrefix}/${this._strategy.name}`,i,t,1)}}},vf=mc,mc._strategyCtors=new Map([["recentlyUsedByPrefix",pj],["recentlyUsed",fj],["first",qI]]),mc._storagePrefix="suggest/memories",mc);WC=vf=gj([$I(0,Rc),$I(1,Tn)],WC);const Wy=Ll("ISuggestMemories");kl(Wy,WC,1);var mj=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},_j=function(o,e){return function(t,i){e(t,i,o)}},BC,Fd;let Iv=(Fd=class{constructor(e,t){this._editor=e,this._enabled=!1,this._ckAtEnd=BC.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)}},BC=Fd,Fd.AtEnd=new Ri("atEndOfWord",!1),Fd);Iv=BC=mj([_j(1,$i)],Iv);var vj=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},bj=function(o,e){return function(t,i){e(t,i,o)}},bf,Hd;let Cg=(Hd=class{constructor(e,t){this._editor=e,this._index=0,this._ckOtherSuggestions=bf.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(bf._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=bf._moveIndex(e,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}},bf=Hd,Hd.OtherSuggestions=new Ri("hasOtherSuggestions",!1),Hd);Cg=bf=vj([bj(1,$i)],Cg);class yj{constructor(e,t,i,n){this._disposables=new Be,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||!Fo(e.item.completion.commitCharacters)){this.reset();return}if(this._active&&this._active.item.item===e.item)return;const t=new z_;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 Zo=class Zo{async provideSelectionRanges(e,t){const i=[];for(const n of t){const s=[];i.push(s);const r=new Map;await new Promise(a=>Zo._bracketsRightYield(a,0,e,n,r)),await new Promise(a=>Zo._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>=Zo._maxRounds){e();break}if(!n){e();break}const c=i.bracketPairs.findNextBracket(n);if(!c){e();break}if(Date.now()-a>Zo._maxDuration){setTimeout(()=>Zo._bracketsRightYield(e,t+1,i,n,s));break}if(c.bracketInfo.isOpeningBracket){const g=c.bracketInfo.bracketText,f=r.has(g)?r.get(g):0;r.set(g,f+1)}else{const g=c.bracketInfo.getOpeningBrackets()[0].bracketText;let f=r.has(g)?r.get(g):0;if(f-=1,r.set(g,Math.max(0,f)),f<0){let p=s.get(g);p||(p=new QE,s.set(g,p)),p.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>=Zo._maxRounds&&s.size===0){e();break}if(!n){e();break}const h=i.bracketPairs.findPrevBracket(n);if(!h){e();break}if(Date.now()-c>Zo._maxDuration){setTimeout(()=>Zo._bracketsLeftYield(e,t+1,i,n,s,r));break}if(h.bracketInfo.isOpeningBracket){const f=h.bracketInfo.bracketText;let p=a.has(f)?a.get(f):0;if(p-=1,a.set(f,Math.max(0,p)),p<0){const v=s.get(f);if(v){const _=v.shift();v.size===0&&s.delete(f);const w=B.fromPositions(h.range.getEndPosition(),_.getStartPosition()),S=B.fromPositions(h.range.getStartPosition(),_.getEndPosition());r.push({range:w}),r.push({range:S}),Zo._addBracketLeading(i,S,r)}}}else{const f=h.bracketInfo.getOpeningBrackets()[0].bracketText,p=a.has(f)?a.get(f):0;a.set(f,p+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:B.fromPositions(new Dt(n,s),t.getEndPosition())}),i.push({range:B.fromPositions(new Dt(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:B.fromPositions(new Dt(r,a),t.getEndPosition())}),i.push({range:B.fromPositions(new Dt(r,1),t.getEndPosition())}))}}};Zo._maxDuration=30,Zo._maxRounds=2;let Dv=Zo;const ya=class ya{static async create(e,t){if(!t.getOption(119).localityBonus||!t.hasModel())return ya.None;const i=t.getModel(),n=t.getPosition();if(!e.canComputeWordRanges(i.uri))return ya.None;const[s]=await new Dv().provideSelectionRanges(i,[n]);if(s.length===0)return ya.None;const r=await e.computeWordRanges(i.uri,s[0].range);if(!r)return ya.None;const a=i.getWordUntilPosition(n);return delete r[a.word],new class extends ya{distance(c,h){if(!n.equals(t.getPosition()))return 0;if(h.kind===17)return 2<<20;const g=typeof h.label=="string"?h.label:h.label.label,f=r[g];if(s2(f))return 2<<20;const p=U_(f,B.fromPositions(c),B.compareRangesUsingStarts),v=p>=0?f[p]:f[Math.max(0,~p-1)];let _=s.length;for(const w of s){if(!B.containsRange(w.range,v))break;_-=1}return _}}}};ya.None=new class extends ya{distance(){return 0}};let Ev=ya,KI=class{constructor(e,t){this.leadingLineContent=e,this.characterCountDelta=t}};class ql{constructor(e,t,i,n,s,r,a=eP.default,c=void 0){this.clipboardText=c,this._snippetCompareFn=ql._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=ql._compareCompletionItemsSnippetsUp:r==="bottom"&&(this._snippetCompareFn=ql._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?tP:o2;for(let h=0;h<r.length;h++){const g=r[h];if(g.isInvalid)continue;const f=this._itemsByProvider.get(g.provider);f?f.push(g):this._itemsByProvider.set(g.provider,[g]);const p=g.position.column-g.editStart.column,v=p+i-(g.position.column-this._column);if(n.length!==v&&(n=v===0?"":t.slice(-v),s=n.toLowerCase()),g.word=n,v===0)g.score=np.Default;else{let _=0;for(;_<p;){const w=n.charCodeAt(_);if(w===32||w===9)_+=1;else break}if(_>=v)g.score=np.Default;else if(typeof g.completion.filterText=="string"){const w=c(n,s,_,g.completion.filterText,g.filterTextLow,0,this._fuzzyScoreOptions);if(!w)continue;r2(g.completion.filterText,g.textLabel)===0?g.score=w:(g.score=a2(n,s,_,g.textLabel,g.labelLow,0),g.score[0]=w[0])}else{const w=c(n,s,_,g.textLabel,g.labelLow,0,this._fuzzyScoreOptions);if(!w)continue;g.score=w}}g.idx=h,g.distance=this._wordDistance.distance(g.position,g.completion),a.push(g),e.push(g.textLabel.length)}this._filteredItems=a.sort(this._snippetCompareFn),this._refilterKind=0,this._stats={pLabelLen:e.length?l2(e.length-.85,e,(h,g)=>h-g):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 ql._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 ql._compareCompletionItems(e,t)}}var wj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Hl=function(o,e){return function(t,i){e(t,i,o)}},zC;class zc{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 Sj(o,e,t){if(!e.getContextKeyValue(xo.inlineSuggestionVisible.key))return!0;const i=e.getContextKeyValue(xo.suppressSuggestions.key);return i!==void 0?!i:!o.getOption(62).suppressSuggestions}function Cj(o,e,t){if(!e.getContextKeyValue("inlineSuggestionVisible"))return!0;const i=e.getContextKeyValue(xo.suppressSuggestions.key);return i!==void 0?!i:!o.getOption(62).suppressSuggestions}let Pv=zC=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 Be,this._triggerCharacterListener=new Be,this._triggerQuickSuggest=new Kp,this._triggerState=void 0,this._completionDisposables=new Be,this._onDidCancel=new ui,this._onDidTrigger=new ui,this._onDidSuggest=new ui,this.onDidCancel=this._onDidCancel.event,this.onDidTrigger=this._onDidTrigger.event,this.onDidSuggest=this._onDidSuggest.event,this._telemetryGate=0,this._currentSelection=this._editor.getSelection()||new Xt(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 g=!1;this._toDispose.add(this._editor.onDidCompositionStart(()=>{g=!0})),this._toDispose.add(this._editor.onDidCompositionEnd(()=>{g=!1,this._onCompositionEnd()})),this._toDispose.add(this._editor.onDidChangeCursorSelection(f=>{g||this._onCursorChange(f)})),this._toDispose.add(this._editor.onDidChangeModelContent(()=>{!g&&this._triggerState!==void 0&&this._refilterCompletionItems()})),this._updateTriggerCharacters()}dispose(){Ks(this._triggerCharacterListener),Ks([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(!Cj(this._editor,this._contextKeyService,this._configurationService)||zc.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="";d2(i.charCodeAt(i.length-1))?h2(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;yu.isAllOff(this._editor.getOption(90))||this._editor.getOption(119).snippetsPreventQuickSuggestions&&((e=Js.get(this._editor))!=null&&e.isInSnippet())||(this.cancel(),this._triggerQuickSuggest.cancelAndSet(()=>{if(this._triggerState!==void 0||!zc.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(!yu.isAllOff(n)){if(!yu.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(yu.valueFor(n,r)!=="on")return}Sj(this._editor,this._contextKeyService,this._configurationService)&&this._languageFeaturesService.completionProvider.has(t)&&this.trigger({auto:!0})}},this._editor.getOption(91)))}_refilterCompletionItems(){Gi(this._editor.hasModel()),Gi(this._triggerState!==void 0);const e=this._editor.getModel(),t=this._editor.getPosition(),i=new zc(e,t,{...this._triggerState,refilter:!0});this._onNewContext(i)}trigger(e){var p,v,_;if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=new zc(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 Is;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}=zC.createSuggestFilter(this._editor),h=new wp(r,((p=e.completionOptions)==null?void 0:p.kindFilter)??a,(v=e.completionOptions)==null?void 0:v.providerFilter,(_=e.completionOptions)==null?void 0:_.providerItemsToReuse,c),g=Ev.create(this._editorWorkerService,this._editor),f=q1(this._languageFeaturesService.completionProvider,t,this._editor.getPosition(),h,n,this._requestToken.token);Promise.all([f,g]).then(async([w,S])=>{var H;if((H=this._requestToken)==null||H.dispose(),!this._editor.hasModel())return;let D=e==null?void 0:e.clipboardText;if(!D&&w.needsClipboard&&(D=await this._clipboardService.readText()),this._triggerState===void 0)return;const E=this._editor.getModel(),R=new zc(E,this._editor.getPosition(),e),z={...eP.default,firstMatchCanBeWeak:!this._editor.getOption(119).matchOnWordStartOnly};if(this._completionModel=new ql(w.items,this._context.column,{leadingLineContent:R.leadingLineContent,characterCountDelta:R.column-this._context.column},S,this._editor.getOption(119),this._editor.getOption(113),z,D),this._completionDisposables.add(w.disposable),this._onNewContext(R),this._reportDurationsTelemetry(w.durations),!this._envService.isBuilt||this._envService.isExtensionDevelopment)for(const ee of w.items)ee.isInvalid&&this._logService.warn(`[suggest] did IGNORE invalid completion item from ${ee.provider._debugDisplayName}`,ee.completion)}).catch(mn)}_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(Rs(e.leadingLineContent)!==Rs(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(zc.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=zc.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})}}}}};Pv=zC=wj([Hl(1,Il),Hl(2,Pg),Hl(3,ra),Hl(4,kh),Hl(5,$i),Hl(6,Tn),Hl(7,Et),Hl(8,c2)],Pv);const wb=class wb{constructor(e,t){this._disposables=new Be,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)>wb._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()}};wb._maxSelectionLength=51200;let VC=wb;var xj=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},Hw=function(o,e){return function(t,i){e(t,i,o)}};let jC=class{constructor(e,t,i,n,s){this._menuId=t,this._menuService=n,this._contextKeyService=s,this._menuDisposables=new Be,this.element=pt(e,yt(".suggest-status-bar"));const r=(a=>a instanceof og?i.createInstance(u2,a,{useComma:!0}):void 0);this._leftActions=new Yf(this.element,{actionViewItemProvider:r}),this._rightActions=new Yf(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()}};jC=xj([Hw(2,ai),Hw(3,xh),Hw(4,$i)],jC);var Lj=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},kj=function(o,e){return function(t,i){e(t,i,o)}};function Z1(o){return!!o&&!!(o.completion.documentation||o.completion.detail&&o.completion.detail!==o.completion.label)}let UC=class{constructor(e,t){this._editor=e,this._onDidClose=new ui,this.onDidClose=this._onDidClose.event,this._onDidChangeContents=new ui,this.onDidChangeContents=this._onDidChangeContents.event,this._disposables=new Be,this._renderDisposeable=new Be,this._borderWidth=1,this._size=new bn(330,0),this.domNode=yt(".suggest-details"),this.domNode.classList.add("no-docs"),this._markdownRenderer=t.createInstance(Ng,{editor:e}),this._body=yt(".body"),this._scrollbar=new iP(this._body,{alwaysConsumeMouseWheel:!0}),pt(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=pt(this._body,yt(".header")),this._close=pt(this._header,yt("span"+Xi.asCSSSelector(Qt.close))),this._close.title=y("details.close","Close"),this._type=pt(this._header,yt("p.type")),this._docs=pt(this._body,yt("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=y("loading","Loading..."),this._docs.textContent="",this.domNode.classList.remove("no-docs","no-type"),this.layout(this.size.width,this.getLayoutInfo().lineHeight*2),this._onDidChangeContents.fire(this)}renderItem(e,t){var s;this._renderDisposeable.clear();let{detail:i,documentation:n}=e.completion;if(t){let r="";r+=`score: ${e.score[0]}
37
+ `,r+=`prefix: ${e.word??"(no prefix)"}
38
+ `,r+=`word: ${e.completion.filterText?e.completion.filterText+" (filterText)":e.textLabel}
39
+ `,r+=`distance: ${e.distance} (localityBonus-setting)
40
+ `,r+=`index: ${e.idx}, based on ${e.completion.sortText&&`sortText: "${e.completion.sortText}"`||"label"}
41
+ `,r+=`commit_chars: ${(s=e.completion.commitCharacters)==null?void 0:s.join("")}
42
+ `,n=new $s().appendCodeblock("empty",r),i=`Provider: ${e.provider._debugDisplayName}`}if(!t&&!Z1(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,wr(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gmi.test(r))}else Na(this._type),this._type.title="",No(this._type),this.domNode.classList.add("no-type");if(Na(this._docs),typeof n=="string")this._docs.classList.remove("markdown-docs"),this._docs.textContent=n;else if(n){this._docs.classList.add("markdown-docs"),Na(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 bn(e,t);bn.equals(i,this._size)||(this._size=i,g2(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}};UC=Lj([kj(1,ai)],UC);class Ij{constructor(e,t){this.widget=e,this._editor=t,this.allowEditorOverflow=!0,this._disposables=new Be,this._added=!1,this._preferAlignAtTop=!0,this._resizable=new D1,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=Qp(this.getDomNode().ownerDocument.body),s=this.widget.getLayoutInfo(),r=new bn(220,2*s.lineHeight),a=e.top,c=(function(){const H=n.width-(e.left+e.width+s.borderWidth+s.horizontalPadding),ee=-s.borderWidth+e.left+e.width,X=new bn(H,n.height-e.top-s.borderHeight-s.verticalPadding),me=X.with(void 0,e.top+e.height-s.borderHeight-s.verticalPadding);return{top:a,left:ee,fit:H-t.width,maxSizeTop:X,maxSizeBottom:me,minSize:r.with(Math.min(H,r.width))}})(),h=(function(){const H=e.left-s.borderWidth-s.horizontalPadding,ee=Math.max(s.horizontalPadding,e.left-t.width-s.borderWidth),X=new bn(H,n.height-e.top-s.borderHeight-s.verticalPadding),me=X.with(void 0,e.top+e.height-s.borderHeight-s.verticalPadding);return{top:a,left:ee,fit:H-t.width,maxSizeTop:X,maxSizeBottom:me,minSize:r.with(Math.min(H,r.width))}})(),g=(function(){const H=e.left,ee=-s.borderWidth+e.top+e.height,X=new bn(e.width-s.borderHeight,n.height-e.top-e.height-s.verticalPadding);return{top:ee,left:H,fit:X.height-t.height,maxSizeBottom:X,maxSizeTop:X,minSize:r.with(X.width)}})(),f=[c,h,g],p=f.find(H=>H.fit>=0)??f.sort((H,ee)=>ee.fit-H.fit)[0],v=e.top+e.height-s.borderHeight;let _,w=t.height;const S=Math.max(p.maxSizeTop.height,p.maxSizeBottom.height);w>S&&(w=S);let D;i?w<=p.maxSizeTop.height?(_=!0,D=p.maxSizeTop):(_=!1,D=p.maxSizeBottom):w<=p.maxSizeBottom.height?(_=!1,D=p.maxSizeBottom):(_=!0,D=p.maxSizeTop);let{top:E,left:R}=p;!_&&w>e.height&&(E=v-w);const z=this._editor.getDomNode();if(z){const H=z.getBoundingClientRect();E-=H.top,R-=H.left}this._applyTopLeft({left:R,top:E}),this._resizable.enableSashes(!_,p===c,_,p!==c),this._resizable.minSize=p.minSize,this._resizable.maxSize=D,this._resizable.layout(w,Math.min(D.width,t.width)),this.widget.layout(this._resizable.size.width,this._resizable.size.height)}_applyTopLeft(e){this._topLeft=e,this._editor.layoutOverlayWidget(this)}}var Ta;(function(o){o[o.FILE=0]="FILE",o[o.FOLDER=1]="FOLDER",o[o.ROOT_FOLDER=2]="ROOT_FOLDER"})(Ta||(Ta={}));const Dj=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function Ym(o,e,t,i,n){if(Xi.isThemeIcon(n))return[`codicon-${n.id}`,"predefined-file-icon"];if(un.isUri(n))return[];const s=i===Ta.ROOT_FOLDER?["rootfolder-icon"]:i===Ta.FOLDER?["folder-icon"]:["file-icon"];if(t){let r;if(t.scheme===ro.data)r=$_.parseMetaData(t).get($_.META_DATA_LABEL);else{const a=t.path.match(Dj);a?(r=Jm(a[2].toLowerCase()),a[1]&&s.push(`${Jm(a[1].toLowerCase())}-name-dir-icon`)):r=Jm(t.authority.toLowerCase())}if(i===Ta.ROOT_FOLDER)s.push(`${r}-root-name-folder-icon`);else if(i===Ta.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=Ej(o,e,t);a&&s.push(`${Jm(a)}-lang-file-icon`)}}return s}function Ej(o,e,t){if(!t)return null;let i=null;if(t.scheme===ro.data){const s=$_.parseMetaData(t).get($_.META_DATA_MIME);s&&(i=e.getLanguageIdByMimeType(s))}else{const n=o.getModel(t);n&&(i=n.getLanguageId())}return i&&i!==sp?i:e.guessLanguageIdByFilepathOrFirstLine(t)}function Jm(o){return o.replace(/[\s]/g,"/")}var Pj=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},Ww=function(o,e){return function(t,i){e(t,i,o)}};function CN(o){return`suggest-aria-id:${o}`}const Tj=es("suggest-more-info",Qt.chevronRight,y("suggestMoreInfoIcon","Icon for more information in the suggest widget."));var Zr;const Mj=new(Zr=class{extract(e,t){if(e.textLabel.match(Zr._regexStrict))return t[0]=e.textLabel,!0;if(e.completion.detail&&e.completion.detail.match(Zr._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=Zr._regexRelaxed.exec(i);if(n&&(n.index===0||n.index+n[0].length===i.length))return t[0]=n[0],!0}return!1}},Zr._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*\))/,Zr._regexStrict=new RegExp(`^${Zr._regexRelaxed.source}$`,"i"),Zr);let $C=class{constructor(e,t,i,n){this._editor=e,this._modelService=t,this._languageService=i,this._themeService=n,this._onDidToggleDetails=new ui,this.onDidToggleDetails=this._onDidToggleDetails.event,this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(e){const t=new Be,i=e;i.classList.add("show-file-icons");const n=pt(e,yt(".icon")),s=pt(n,yt("span.colorspan")),r=pt(e,yt(".contents")),a=pt(r,yt(".main")),c=pt(a,yt(".icon-label.codicon")),h=pt(a,yt("span.left")),g=pt(a,yt("span.right")),f=new wE(h,{supportHighlights:!0,supportIcons:!0});t.add(f);const p=pt(h,yt("span.signature-label")),v=pt(h,yt("span.qualifier-label")),_=pt(g,yt("span.details-label")),w=pt(g,yt("span.readMore"+Xi.asCSSSelector(Tj)));return w.title=y("readMore","Read More"),{root:i,left:h,right:g,icon:n,colorspan:s,iconLabel:f,iconContainer:c,parametersLabel:p,qualifierLabel:v,detailsLabel:_,readMore:w,disposables:t,configureFont:()=>{const D=this._editor.getOptions(),E=D.get(50),R=E.getMassagedFontFamily(),z=E.fontFeatureSettings,H=D.get(120)||E.fontSize,ee=D.get(121)||E.lineHeight,X=E.fontWeight,me=E.letterSpacing,Le=`${H}px`,je=`${ee}px`,Ce=`${me}px`;i.style.fontSize=Le,i.style.fontWeight=X,i.style.letterSpacing=Ce,a.style.fontFamily=R,a.style.fontFeatureSettings=z,a.style.lineHeight=je,n.style.height=je,n.style.width=je,w.style.height=je,w.style.width=je}}}renderElement(e,t,i){i.configureFont();const{completion:n}=e;i.root.id=CN(t),i.colorspan.style.backgroundColor="";const s={labelEscapeNewLines:!0,matches:ly(e.score)},r=[];if(n.kind===19&&Mj.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=Ym(this._modelService,this._languageService,un.from({scheme:"fake",path:e.textLabel}),Ta.FILE),c=Ym(this._modelService,this._languageService,un.from({scheme:"fake",path:n.detail}),Ta.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=[Ym(this._modelService,this._languageService,un.from({scheme:"fake",path:e.textLabel}),Ta.FOLDER),Ym(this._modelService,this._languageService,un.from({scheme:"fake",path:n.detail}),Ta.FOLDER)].flat()):(i.icon.className="icon hide",i.iconContainer.className="",i.iconContainer.classList.add("suggest-icon",...Xi.asClassNameArray(Z0.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=Bw(n.detail||""),i.root.classList.add("string-label")):(i.parametersLabel.textContent=Bw(n.label.detail||""),i.detailsLabel.textContent=Bw(n.label.description||""),i.root.classList.remove("string-label")),this._editor.getOption(119).showInlineDetails?wr(i.detailsLabel):No(i.detailsLabel),Z1(e)?(i.right.classList.add("can-expand-details"),wr(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"),No(i.readMore),i.readMore.onmousedown=null,i.readMore.onclick=null)}disposeTemplate(e){e.disposables.dispose()}};$C=Pj([Ww(1,eo),Ww(2,aa),Ww(3,Pr)],$C);function Bw(o){return o.replace(/\r\n|\r|\n/g,"")}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},Qm=function(o,e){return function(t,i){e(t,i,o)}},du;St("editorSuggestWidget.background",nP,y("editorSuggestWidgetBackground","Background color of the suggest widget."));St("editorSuggestWidget.border",f2,y("editorSuggestWidgetBorder","Border color of the suggest widget."));const Rj=St("editorSuggestWidget.foreground",im,y("editorSuggestWidgetForeground","Foreground color of the suggest widget."));St("editorSuggestWidget.selectedForeground",sP,y("editorSuggestWidgetSelectedForeground","Foreground color of the selected entry in the suggest widget."));St("editorSuggestWidget.selectedIconForeground",p2,y("editorSuggestWidgetSelectedIconForeground","Icon foreground color of the selected entry in the suggest widget."));const Aj=St("editorSuggestWidget.selectedBackground",oP,y("editorSuggestWidgetSelectedBackground","Background color of the selected entry in the suggest widget."));St("editorSuggestWidget.highlightForeground",rP,y("editorSuggestWidgetHighlightForeground","Color of the match highlights in the suggest widget."));St("editorSuggestWidget.focusHighlightForeground",m2,y("editorSuggestWidgetFocusHighlightForeground","Color of the match highlights in the suggest widget when an item is focused."));St("editorSuggestWidgetStatus.foreground",Ra(Rj,.5),y("editorSuggestWidgetStatusForeground","Foreground color of the suggest widget status."));class Oj{constructor(e,t){this._service=e,this._key=`suggestWidget.size/${t.getEditorType()}/${t instanceof Er}`}restore(){const e=this._service.get(this._key,0)??"";try{const t=JSON.parse(e);if(bn.is(t))return bn.lift(t)}catch{}}store(e){this._service.store(this._key,JSON.stringify(e),0,1)}reset(){this._service.remove(this._key,0)}}var _c;let qC=(_c=class{constructor(e,t,i,n,s){this.editor=e,this._storageService=t,this._state=0,this._isAuto=!1,this._pendingLayout=new Bo,this._pendingShowDetails=new Bo,this._ignoreFocusEvents=!1,this._forceRenderingAbove=!1,this._explainMode=!1,this._showTimeout=new Kp,this._disposables=new Be,this._onDidSelect=new ak,this._onDidFocus=new ak,this._onDidHide=new ui,this._onDidShow=new ui,this.onDidSelect=this._onDidSelect.event,this.onDidFocus=this._onDidFocus.event,this.onDidHide=this._onDidHide.event,this.onDidShow=this._onDidShow.event,this._onDetailsKeydown=new ui,this.onDetailsKeyDown=this._onDetailsKeydown.event,this.element=new D1,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new Fj(this,e),this._persistedSize=new Oj(t,e);class r{constructor(v,_,w=!1,S=!1){this.persistedSize=v,this.currentSize=_,this.persistHeight=w,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(p=>{var v,_;if(this._resize(p.dimension.width,p.dimension.height),a&&(a.persistHeight=a.persistHeight||!!p.north||!!p.south,a.persistWidth=a.persistWidth||!!p.east||!!p.west),!!p.done){if(a){const{itemHeight:w,defaultSize:S}=this.getLayoutInfo(),D=Math.round(w/2);let{width:E,height:R}=this.element.size;(!a.persistHeight||Math.abs(a.currentSize.height-R)<=D)&&(R=((v=a.persistedSize)==null?void 0:v.height)??S.height),(!a.persistWidth||Math.abs(a.currentSize.width-E)<=D)&&(E=((_=a.persistedSize)==null?void 0:_.width)??S.width),this._persistedSize.store(new bn(E,R))}this._contentWidget.unlockPreference(),a=void 0}})),this._messageElement=pt(this.element.domNode,yt(".message")),this._listElement=pt(this.element.domNode,yt(".tree"));const c=this._disposables.add(s.createInstance(UC,this.editor));c.onDidClose(this.toggleDetails,this,this._disposables),this._details=new Ij(c,this.editor);const h=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(119).showIcons);h();const g=s.createInstance($C,this.editor);this._disposables.add(g),this._disposables.add(g.onDidToggleDetails(()=>this.toggleDetails())),this._list=new O0("SuggestWidget",this._listElement,{getHeight:p=>this.getLayoutInfo().itemHeight,getTemplateId:p=>"suggestion"},[g],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>"option",getWidgetAriaLabel:()=>y("suggest","Suggest"),getWidgetRole:()=>"listbox",getAriaLabel:p=>{let v=p.textLabel;if(typeof p.completion.label!="string"){const{detail:D,description:E}=p.completion.label;D&&E?v=y("label.full","{0} {1}, {2}",v,D,E):D?v=y("label.detail","{0} {1}",v,D):E&&(v=y("label.desc","{0}, {1}",v,E))}if(!p.isResolved||!this._isDetailsVisible())return v;const{documentation:_,detail:w}=p.completion,S=K0("{0}{1}",w||"",_?typeof _=="string"?_:_.value:"");return y("ariaCurrenttSuggestionReadDetails","{0}, docs: {1}",v,S)}}}),this._list.style(aP({listInactiveFocusBackground:Aj,listInactiveFocusOutline:oh})),this._status=s.createInstance(jC,this.element.domNode,ac);const f=()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(119).showStatusBar);f(),this._disposables.add(n.onDidColorThemeChange(p=>this._onThemeChange(p))),this._onThemeChange(n.getColorTheme()),this._disposables.add(this._list.onMouseDown(p=>this._onListMouseDownOrTap(p))),this._disposables.add(this._list.onTap(p=>this._onListMouseDownOrTap(p))),this._disposables.add(this._list.onDidChangeSelection(p=>this._onListSelection(p))),this._disposables.add(this._list.onDidChangeFocus(p=>this._onListFocus(p))),this._disposables.add(this.editor.onDidChangeCursorSelection(()=>this._onCursorSelectionChanged())),this._disposables.add(this.editor.onDidChangeConfiguration(p=>{p.hasChanged(119)&&(f(),h()),this._completionModel&&(p.hasChanged(50)||p.hasChanged(120)||p.hasChanged(121))&&this._list.splice(0,this._list.length,this._completionModel.items)})),this._ctxSuggestWidgetVisible=Jt.Visible.bindTo(i),this._ctxSuggestWidgetDetailsVisible=Jt.DetailsVisible.bindTo(i),this._ctxSuggestWidgetMultipleSuggestions=Jt.MultipleSuggestions.bindTo(i),this._ctxSuggestWidgetHasFocusedSuggestion=Jt.HasFocusedSuggestion.bindTo(i),this._disposables.add(ml(this._details.widget.domNode,"keydown",p=>{this._onDetailsKeydown.fire(p)})),this._disposables.add(this.editor.onMouseDown(p=>this._onEditorMouseDown(p)))}dispose(){var e;this._details.widget.dispose(),this._details.dispose(),this._list.dispose(),this._status.dispose(),this._disposables.dispose(),(e=this._loadingTimeout)==null||e.dispose(),this._pendingLayout.dispose(),this._pendingShowDetails.dispose(),this._showTimeout.dispose(),this._contentWidget.dispose(),this.element.dispose()}_onEditorMouseDown(e){this._details.widget.domNode.contains(e.target.element)?this._details.widget.domNode.focus():this.element.domNode.contains(e.target.element)&&this.editor.focus()}_onCursorSelectionChanged(){this._state!==0&&this._contentWidget.layout()}_onListMouseDownOrTap(e){typeof e.element>"u"||typeof e.index>"u"||(e.browserEvent.preventDefault(),e.browserEvent.stopPropagation(),this._select(e.element,e.index))}_onListSelection(e){e.elements.length&&this._select(e.elements[0],e.indexes[0])}_select(e,t){const i=this._completionModel;i&&(this._onDidSelect.fire({item:e,index:t,model:i}),this.editor.focus())}_onThemeChange(e){this._details.widget.borderWidth=Jf(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=ks(async s=>{const r=Xf(()=>{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:CN(i)}))}).catch(mn)),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:No(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=du.LOADING_MESSAGE,No(this._listElement,this._status.element),wr(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,tg(du.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=du.NO_SUGGESTIONS_MESSAGE,No(this._listElement,this._status.element),wr(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,tg(du.NO_SUGGESTIONS_MESSAGE);break;case 3:No(this._messageElement),wr(this._listElement,this._status.element),this._show();break;case 4:No(this._messageElement),wr(this._listElement,this._status.element),this._show();break;case 5:No(this._messageElement),wr(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=Xf(()=>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=lk(ld(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")):(Z1(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=lk(ld(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=Qp(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 bn(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,g=i.statusBarHeight+this._list.contentHeight+i.borderHeight,f=i.itemHeight+i.statusBarHeight,p=lo(this.editor.getDomNode()),v=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),_=p.top+v.top+v.height,w=Math.min(t.height-_-i.verticalPadding,g),S=p.top+v.top-i.verticalPadding,D=Math.min(S,g);let E=Math.min(Math.max(D,w)+i.borderHeight,g);n===((r=this._cappedHeight)==null?void 0:r.capped)&&(n=this._cappedHeight.wanted),n<f&&(n=f),n>E&&(n=E),n>w||this._forceRenderingAbove&&S>150?(this._contentWidget.setPreference(1),this.element.enableSashes(!0,!0,!1,!1),E=D):(this._contentWidget.setPreference(2),this.element.enableSashes(!1,!0,!0,!1),E=w),this.element.preferredSize=new bn(h,i.defaultSize.height),this.element.maxSize=new bn(c,E),this.element.minSize=new bn(220,f),this._cappedHeight=n===g?{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=_2(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 bn(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}},du=_c,_c.LOADING_MESSAGE=y("suggestWidget.loading","Loading..."),_c.NO_SUGGESTIONS_MESSAGE=y("suggestWidget.noSuggestions","No suggestions."),_c);qC=du=Nj([Qm(1,Rc),Qm(2,$i),Qm(3,Pr),Qm(4,ai)],qC);class Fj{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 bn(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 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},Jh=function(o,e){return function(t,i){e(t,i,o)}},KC;class Wj{constructor(e,t){if(this._model=e,this._position=t,this._decorationOptions=ki.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(B.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 Wd;let Cr=(Wd=class{static get(e){return e.getContribution(KC.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 Bo,this._toDispose=new Be,this._selectors=new Bj(f=>f.priority),this._onWillInsertSuggestItem=new ui,this.onWillInsertSuggestItem=this._onWillInsertSuggestItem.event,this.editor=e,this.model=s.createInstance(Pv,this.editor),this._selectors.register({priority:0,select:(f,p,v)=>this._memoryService.select(f,p,v)});const c=Jt.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 lw(ld(e.getDomNode()),()=>{const f=this._instantiationService.createInstance(qC,this.editor);this._toDispose.add(f),this._toDispose.add(f.onDidSelect(S=>this._insertSuggestion(S,0),this));const p=new yj(this.editor,f,this.model,S=>this._insertSuggestion(S,2));this._toDispose.add(p);const v=Jt.MakesTextEdit.bindTo(this._contextKeyService),_=Jt.HasInsertAndReplaceRange.bindTo(this._contextKeyService),w=Jt.CanResolve.bindTo(this._contextKeyService);return this._toDispose.add(En(()=>{v.reset(),_.reset(),w.reset()})),this._toDispose.add(f.onDidFocus(({item:S})=>{const D=this.editor.getPosition(),E=S.editStart.column,R=D.column;let z=!0;this.editor.getOption(1)==="smart"&&this.model.state===2&&!S.completion.additionalTextEdits&&!(S.completion.insertTextRules&4)&&R-E===S.completion.insertText.length&&(z=this.editor.getModel().getValueInRange({startLineNumber:D.lineNumber,startColumn:E,endLineNumber:D.lineNumber,endColumn:R})!==S.completion.insertText),v.set(z),_.set(!Dt.equals(S.editInsertEnd,S.editReplaceEnd)),w.set(!!S.provider.resolveCompletionItem||!!S.completion.documentation||S.completion.detail!==S.completion.label)})),this._toDispose.add(f.onDetailsKeyDown(S=>{if(S.toKeyCodeChord().equals(new ck(!0,!1,!1,!1,33))||Fa&&S.toKeyCodeChord().equals(new ck(!1,!1,!1,!0,33))){S.stopPropagation();return}S.toKeyCodeChord().isModifierKey()||this.editor.focus()})),f})),this._overtypingCapturer=this._toDispose.add(new lw(ld(e.getDomNode()),()=>this._toDispose.add(new VC(this.editor,this.model)))),this._alternatives=this._toDispose.add(new lw(ld(e.getDomNode()),()=>this._toDispose.add(new Cg(this.editor,this._contextKeyService)))),this._toDispose.add(s.createInstance(Iv,e)),this._toDispose.add(this.model.onDidTrigger(f=>{this.widget.value.showTriggered(f.auto,f.shy?250:50),this._lineSuffix.value=new Wj(this.editor.getModel(),f.position)})),this._toDispose.add(this.model.onDidSuggest(f=>{if(f.triggerOptions.shy)return;let p=-1;for(const _ of this._selectors.itemsOrderedByPriorityDesc)if(p=_.select(this.editor.getModel(),this.editor.getPosition(),f.completionModel.items),p!==-1)break;if(p===-1&&(p=0),this.model.state===0)return;let v=!1;if(f.triggerOptions.auto){const _=this.editor.getOption(119);_.selectionMode==="never"||_.selectionMode==="always"?v=_.selectionMode==="never":_.selectionMode==="whenTriggerCharacter"?v=f.triggerOptions.triggerKind!==1:_.selectionMode==="whenQuickSuggestion"&&(v=f.triggerOptions.triggerKind===1&&!f.triggerOptions.refilter)}this.widget.value.showSuggestions(f.completionModel,p,f.isFrozen,f.triggerOptions.auto,v)})),this._toDispose.add(this.model.onDidCancel(f=>{f.retrigger||this.widget.value.hideWidget()})),this._toDispose.add(this.editor.onDidBlurEditorWidget(()=>{this.model.cancel(),this.model.clear()}));const h=Jt.AcceptSuggestionsOnEnter.bindTo(n),g=()=>{const f=this.editor.getOption(1);h.set(f==="on"||f==="smart")};this._toDispose.add(this.editor.onDidChangeConfiguration(()=>g())),g()}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=Js.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 Is;t&1||this.editor.pushUndoStop();const h=this.getOverwriteInfo(r,!!(t&8));this._memoryService.memorize(n,this.editor.getPosition(),r);const g=r.isResolved;let f=-1,p=-1;if(Array.isArray(r.completion.additionalTextEdits)){this.model.cancel();const _=ig.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",r.completion.additionalTextEdits.map(w=>{let S=B.lift(w.range);if(S.startLineNumber===r.position.lineNumber&&S.startColumn>r.position.column){const D=this.editor.getPosition().column-r.position.column,E=D,R=B.spansMultipleLines(S)?0:D;S=new B(S.startLineNumber,S.startColumn+E,S.endLineNumber,S.endColumn+R)}return Kn.replaceMove(S,w.text)})),_.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!g){const _=new Lo;let w;const S=n.onDidChangeContent(z=>{if(z.isFlush){c.cancel(),S.dispose();return}for(const H of z.changes){const ee=B.getEndPosition(H.range);(!w||Dt.isBefore(ee,w))&&(w=ee)}}),D=t;t|=2;let E=!1;const R=this.editor.onWillType(()=>{R.dispose(),E=!0,D&2||this.editor.pushUndoStop()});a.push(r.resolve(c.token).then(()=>{if(!r.completion.additionalTextEdits||c.token.isCancellationRequested)return;if(w&&r.completion.additionalTextEdits.some(H=>Dt.isBefore(w,B.getStartPosition(H.range))))return!1;E&&this.editor.pushUndoStop();const z=ig.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map(H=>Kn.replaceMove(B.lift(H.range),H.text))),z.restoreRelativeVerticalPositionOfCursor(this.editor),(E||!(D&2))&&this.editor.pushUndoStop(),!0}).then(z=>{this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)",_.elapsed(),z),p=z===!0?1:z===!1?0:-2}).finally(()=>{S.dispose(),R.dispose()}))}let{insertText:v}=r.completion;if(r.completion.insertTextRules&4||(v=uh.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===Tv.id)this.model.trigger({auto:!0,retrigger:!0});else{const _=new Lo;a.push(this._commandService.executeCommand(r.completion.command.id,...r.completion.command.arguments?[...r.completion.command.arguments]:[]).catch(w=>{r.completion.extensionId?ss(w):mn(w)}).finally(()=>{f=_.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,g,f,p,e.index,e.model.items),this.model.clear(),c.dispose()})}_reportSuggestionAcceptedTelemetry(e,t,i,n,s,r,a){var p;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),f=h&&h.length>1?h[0]:-1;this._telemetryService.publicLog2("suggest.acceptedSuggestion",{extensionId:((p=e.extensionId)==null?void 0:p.value)??"unknown",providerId:e.provider._debugDisplayName??"unknown",kind:e.completion.kind,basenameHash:FE(Ha(t.uri)).toString(16),languageId:t.getLanguageId(),fileExtension:v2(t.uri),resolveInfo:e.provider.resolveCompletionItem?i?1:0:-1,resolveDuration:e.resolveDuration,commandDuration:n,additionalEditsAsync:s,index:r,firstIndex:f})}getOverwriteInfo(e,t){Gi(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(Fo(e.completion.additionalTextEdits)){const t=y("aria.alert.snippet","Accepting '{0}' made {1} additional edits",e.textLabel,e.completion.additionalTextEdits.length);Ir(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};ps.once(this.model.onDidTrigger)(s=>{const r=[];ps.any(this.model.onDidTrigger,this.model.onDidCancel)(()=>{Ks(r),i()},void 0,r),this.model.onDidSuggest(({completionModel:a})=>{if(Ks(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)}},KC=Wd,Wd.ID="editor.contrib.suggestController",Wd);Cr=KC=Hj([Jh(1,Wy),Jh(2,ys),Jh(3,$i),Jh(4,ai),Jh(5,kh),Jh(6,ra)],Cr);class Bj{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 Sb=class Sb extends Se{constructor(){super({id:Sb.id,label:y("suggest.trigger.label","Trigger Suggest"),alias:"Trigger Suggest",precondition:le.and(M.writable,M.hasCompletionItemProvider,Jt.Visible.toNegated()),kbOpts:{kbExpr:M.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(e,t,i){const n=Cr.get(t);if(!n)return;let s;i&&typeof i=="object"&&i.auto===!0&&(s=!0),n.triggerSuggest(void 0,s,void 0)}};Sb.id="editor.action.triggerSuggest";let Tv=Sb;_i(Cr.ID,Cr,2);se(Tv);const zo=190,to=go.bindToContribution(Cr.get);Tt(new to({id:"acceptSelectedSuggestion",precondition:le.and(Jt.Visible,Jt.HasFocusedSuggestion),handler(o){o.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:le.and(Jt.Visible,M.textInputFocus),weight:zo},{primary:3,kbExpr:le.and(Jt.Visible,M.textInputFocus,Jt.AcceptSuggestionsOnEnter,Jt.MakesTextEdit),weight:zo}],menuOpts:[{menuId:ac,title:y("accept.insert","Insert"),group:"left",order:1,when:Jt.HasInsertAndReplaceRange.toNegated()},{menuId:ac,title:y("accept.insert","Insert"),group:"left",order:1,when:le.and(Jt.HasInsertAndReplaceRange,Jt.InsertMode.isEqualTo("insert"))},{menuId:ac,title:y("accept.replace","Replace"),group:"left",order:1,when:le.and(Jt.HasInsertAndReplaceRange,Jt.InsertMode.isEqualTo("replace"))}]}));Tt(new to({id:"acceptAlternativeSelectedSuggestion",precondition:le.and(Jt.Visible,M.textInputFocus,Jt.HasFocusedSuggestion),kbOpts:{weight:zo,kbExpr:M.textInputFocus,primary:1027,secondary:[1026]},handler(o){o.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:ac,group:"left",order:2,when:le.and(Jt.HasInsertAndReplaceRange,Jt.InsertMode.isEqualTo("insert")),title:y("accept.replace","Replace")},{menuId:ac,group:"left",order:2,when:le.and(Jt.HasInsertAndReplaceRange,Jt.InsertMode.isEqualTo("replace")),title:y("accept.insert","Insert")}]}));Sn.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion");Tt(new to({id:"hideSuggestWidget",precondition:Jt.Visible,handler:o=>o.cancelSuggestWidget(),kbOpts:{weight:zo,kbExpr:M.textInputFocus,primary:9,secondary:[1033]}}));Tt(new to({id:"selectNextSuggestion",precondition:le.and(Jt.Visible,le.or(Jt.MultipleSuggestions,Jt.HasFocusedSuggestion.negate())),handler:o=>o.selectNextSuggestion(),kbOpts:{weight:zo,kbExpr:M.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}}));Tt(new to({id:"selectNextPageSuggestion",precondition:le.and(Jt.Visible,le.or(Jt.MultipleSuggestions,Jt.HasFocusedSuggestion.negate())),handler:o=>o.selectNextPageSuggestion(),kbOpts:{weight:zo,kbExpr:M.textInputFocus,primary:12,secondary:[2060]}}));Tt(new to({id:"selectLastSuggestion",precondition:le.and(Jt.Visible,le.or(Jt.MultipleSuggestions,Jt.HasFocusedSuggestion.negate())),handler:o=>o.selectLastSuggestion()}));Tt(new to({id:"selectPrevSuggestion",precondition:le.and(Jt.Visible,le.or(Jt.MultipleSuggestions,Jt.HasFocusedSuggestion.negate())),handler:o=>o.selectPrevSuggestion(),kbOpts:{weight:zo,kbExpr:M.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}}));Tt(new to({id:"selectPrevPageSuggestion",precondition:le.and(Jt.Visible,le.or(Jt.MultipleSuggestions,Jt.HasFocusedSuggestion.negate())),handler:o=>o.selectPrevPageSuggestion(),kbOpts:{weight:zo,kbExpr:M.textInputFocus,primary:11,secondary:[2059]}}));Tt(new to({id:"selectFirstSuggestion",precondition:le.and(Jt.Visible,le.or(Jt.MultipleSuggestions,Jt.HasFocusedSuggestion.negate())),handler:o=>o.selectFirstSuggestion()}));Tt(new to({id:"focusSuggestion",precondition:le.and(Jt.Visible,Jt.HasFocusedSuggestion.negate()),handler:o=>o.focusSuggestion(),kbOpts:{weight:zo,kbExpr:M.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}}));Tt(new to({id:"focusAndAcceptSuggestion",precondition:le.and(Jt.Visible,Jt.HasFocusedSuggestion.negate()),handler:o=>{o.focusSuggestion(),o.acceptSelectedSuggestion(!0,!1)}}));Tt(new to({id:"toggleSuggestionDetails",precondition:le.and(Jt.Visible,Jt.HasFocusedSuggestion),handler:o=>o.toggleSuggestionDetails(),kbOpts:{weight:zo,kbExpr:M.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:ac,group:"right",order:1,when:le.and(Jt.DetailsVisible,Jt.CanResolve),title:y("detail.more","Show Less")},{menuId:ac,group:"right",order:1,when:le.and(Jt.DetailsVisible.toNegated(),Jt.CanResolve),title:y("detail.less","Show More")}]}));Tt(new to({id:"toggleExplainMode",precondition:Jt.Visible,handler:o=>o.toggleExplainMode(),kbOpts:{weight:100,primary:2138}}));Tt(new to({id:"toggleSuggestionFocus",precondition:Jt.Visible,handler:o=>o.toggleSuggestionFocus(),kbOpts:{weight:zo,kbExpr:M.textInputFocus,primary:2570,mac:{primary:778}}}));Tt(new to({id:"insertBestCompletion",precondition:le.and(M.textInputFocus,le.equals("config.editor.tabCompletion","on"),Iv.AtEnd,Jt.Visible.toNegated(),Cg.OtherSuggestions.toNegated(),Js.InSnippetMode.toNegated()),handler:(o,e)=>{o.triggerSuggestAndAcceptBest(HE(e)?{fallback:"tab",...e}:{fallback:"tab"})},kbOpts:{weight:zo,primary:2}}));Tt(new to({id:"insertNextSuggestion",precondition:le.and(M.textInputFocus,le.equals("config.editor.tabCompletion","on"),Cg.OtherSuggestions,Jt.Visible.toNegated(),Js.InSnippetMode.toNegated()),handler:o=>o.acceptNextSuggestion(),kbOpts:{weight:zo,kbExpr:M.textInputFocus,primary:2}}));Tt(new to({id:"insertPrevSuggestion",precondition:le.and(M.textInputFocus,le.equals("config.editor.tabCompletion","on"),Cg.OtherSuggestions,Jt.Visible.toNegated(),Js.InSnippetMode.toNegated()),handler:o=>o.acceptPrevSuggestion(),kbOpts:{weight:zo,kbExpr:M.textInputFocus,primary:1026}}));se(class extends Se{constructor(){super({id:"editor.action.resetSuggestSize",label:y("suggest.reset.label","Reset Suggest Widget Size"),alias:"Reset Suggest Widget Size",precondition:void 0})}run(o,e){var t;(t=Cr.get(e))==null||t.resetWidgetSize()}});class zj extends Ve{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 ui),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=Cr.get(this.editor);if(n){this._register(n.registerSelector({priority:100,select:(a,c,h)=>{const g=this.editor.getModel();if(!g)return-1;const f=this.suggestControllerPreselector(),p=f?md(f,g):void 0;if(!p)return-1;const v=Dt.lift(c),_=h.map((S,D)=>{const E=Wf.fromSuggestion(n,g,v,S,this.isShiftKeyPressed),R=md(E.toSingleTextEdit(),g),z=SN(p,R);return{index:D,valid:z,prefixLength:R.text.length,suggestItem:S}}).filter(S=>S&&S.valid&&S.prefixLength>0),w=b2(_,tm(S=>S.prefixLength,ay));return w?w.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(ps.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 g=Wf.fromSuggestion(n,h,c,a.item,this.isShiftKeyPressed);this.onWillAccept(g)}))}this.update(this._isActive)}update(e){const t=this.getSuggestItemInfo();(this._isActive!==e||!Vj(this._currentSuggestItemInfo,t))&&(this._isActive=e,this._currentSuggestItemInfo=t,this._onDidSelectedItemChange.fire())}getSuggestItemInfo(){const e=Cr.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 Wf.fromSuggestion(e,n,i,t.item,this.isShiftKeyPressed)}stopForceRenderingAbove(){const e=Cr.get(this.editor);e==null||e.stopForceRenderingAbove()}forceRenderingAbove(){const e=Cr.get(this.editor);e==null||e.forceRenderingAbove()}}class Wf{static fromSuggestion(e,t,i,n,s){let{insertText:r}=n.completion,a=!1;if(n.completion.insertTextRules&4){const h=new uh().parse(r);h.children.length<100&&kv.adjustWhitespace(t,i,!0,h),r=h.toString(),a=!0}const c=e.getOverwriteInfo(n,s);return new Wf(B.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 y2(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}toSingleTextEdit(){return new _l(this.range,this.insertText)}}function Vj(o,e){return o===e?!0:!o||!e?!1:o.equals(e)}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},Ga=function(o,e){return function(t,i){e(t,i,o)}},GC,Bd;let ir=(Bd=class extends Ve{static get(e){return e.getContribution(GC.ID)}constructor(e,t,i,n,s,r,a,c,h,g){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=g,this._editorObs=La(this.editor),this._positions=an(this,p=>{var v;return((v=this._editorObs.selections.read(p))==null?void 0:v.map(_=>_.getEndPosition()))??[new Dt(1,1)]}),this._suggestWidgetAdaptor=this._register(new zj(this.editor,()=>{var p,v;return this._editorObs.forceUpdate(),(v=(p=this.model.get())==null?void 0:p.selectedInlineCompletion.get())==null?void 0:v.toSingleTextEdit(void 0)},p=>this._editorObs.forceUpdate(v=>{var _;(_=this.model.get())==null||_.handleSuggestAccepted(p)}))),this._suggestWidgetSelectedItem=bo(this,p=>this._suggestWidgetAdaptor.onDidSelectedItemChange(()=>{this._editorObs.forceUpdate(v=>p(void 0))}),()=>this._suggestWidgetAdaptor.selectedItem),this._enabledInConfig=bo(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).enabled),this._isScreenReaderEnabled=bo(this,this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this._editorDictationInProgress=bo(this,this._contextKeyService.onDidChangeContext,()=>this._contextKeyService.getContext(this.editor.getDomNode()).getValue("editorDictation.inProgress")===!0),this._enabled=an(this,p=>this._enabledInConfig.read(p)&&(!this._isScreenReaderEnabled.read(p)||!this._editorDictationInProgress.read(p))),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineCompletionsDebounce",{min:50,max:50}),this.model=kc(this,p=>{if(this._editorObs.isReadonly.read(p))return;const v=this._editorObs.model.read(p);return v?this._instantiationService.createInstance(HC,v,this._suggestWidgetSelectedItem,this._editorObs.versionId,this._positions,this._debounceValue,bo(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(119).preview),bo(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(119).previewMode),bo(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).mode),this._enabled):void 0}).recomputeInitiallyAndOnChange(this._store),this._ghostTexts=an(this,p=>{const v=this.model.read(p);return(v==null?void 0:v.ghostTexts.read(p))??[]}),this._stablizedGhostTexts=Uj(this._ghostTexts,this._store),this._ghostTextWidgets=w2(this,this._stablizedGhostTexts,(p,v)=>v.add(this._instantiationService.createInstance(OC,this.editor,{ghostText:p,minReservedLineCount:sl(0),targetTextModel:this.model.map(_=>_==null?void 0:_.textModel)}))).recomputeInitiallyAndOnChange(this._store),this._playAccessibilitySignal=G0(this),this._fontFamily=bo(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).fontFamily),this._register(new xo(this._contextKeyService,this.model)),this._register(dk(this._editorObs.onDidType,(p,v)=>{var _;this._enabled.get()&&((_=this.model.get())==null||_.trigger())})),this._register(this._commandService.onDidExecuteCommand(p=>{new Set([g_.Tab.id,g_.DeleteLeft.id,g_.DeleteRight.id,TM,"acceptSelectedSuggestion"]).has(p.commandId)&&e.hasTextFocus()&&this._enabled.get()&&this._editorObs.forceUpdate(_=>{var w;(w=this.model.get())==null||w.trigger(_)})})),this._register(dk(this._editorObs.selections,(p,v)=>{var _;v.some(w=>w.reason===3||w.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||_g.dropDownVisible||Lh(p=>{var v;(v=this.model.get())==null||v.stop(p)})})),this._register(Vn(p=>{var _;const v=(_=this.model.read(p))==null?void 0:_.state.read(p);v!=null&&v.suggestItem?v.primaryGhostText.lineCount>=2&&this._suggestWidgetAdaptor.forceRenderingAbove():this._suggestWidgetAdaptor.stopForceRenderingAbove()})),this._register(En(()=>{this._suggestWidgetAdaptor.stopForceRenderingAbove()}));const f=oy(this,(p,v)=>{var S;const _=this.model.read(p),w=_==null?void 0:_.state.read(p);return this._suggestWidgetSelectedItem.get()?v:(S=w==null?void 0:w.inlineCompletion)==null?void 0:S.semanticId});this._register(S2(an(p=>(this._playAccessibilitySignal.read(p),f.read(p),{})),async(p,v,_)=>{const w=this.model.get(),S=w==null?void 0:w.state.get();if(!S||!w)return;const D=w.textModel.getLineContent(S.primaryGhostText.lineNumber);await uy(50,gS(_)),await C2(this._suggestWidgetSelectedItem,uf,()=>!1,gS(_)),await this._accessibilitySignalService.playSignal(BE.inlineSuggestion),this.editor.getOption(8)&&this._provideScreenReaderUpdate(S.primaryGhostText.renderForScreenReader(D))})),this._register(new tC(this.editor,this.model,this._instantiationService)),this._register(RV(an(p=>{const v=this._fontFamily.read(p);return v===""||v==="default"?"":`
43
+ .monaco-editor .ghost-text-decoration,
44
+ .monaco-editor .ghost-text-decoration-preview,
45
+ .monaco-editor .ghost-text {
46
+ font-family: ${v};
47
+ }`}))),this._register(this._configurationService.onDidChangeConfiguration(p=>{p.affectsConfiguration("accessibility.verbosity.inlineCompletions")&&this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})})),this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})}playAccessibilitySignal(e){this._playAccessibilitySignal.trigger(e)}_provideScreenReaderUpdate(e){const t=this._contextKeyService.getContextKeyValue("accessibleViewIsShown"),i=this._keybindingService.lookupKeybinding("editor.action.accessibleView");let n;!t&&i&&this.editor.getOption(150)&&(n=y("showAccessibleViewHint","Inspect this in the accessible view ({0})",i.getAriaLabel())),Ir(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 Dt(t.lineNumber,n.column))):!1}shouldShowHoverAtViewZone(e){var t;return((t=this._ghostTextWidgets.get()[0])==null?void 0:t.ownsViewZone(e))??!1}},GC=Bd,Bd.ID="editor.contrib.inlineCompletionsController",Bd);ir=GC=jj([Ga(1,ai),Ga(2,$i),Ga(3,Tn),Ga(4,ys),Ga(5,nr),Ga(6,Et),Ga(7,WE),Ga(8,ds),Ga(9,ry)],ir);function Uj(o,e){const t=Ho("result",[]),i=[];return e.add(Vn(n=>{const s=o.read(n);Lh(r=>{if(s.length!==i.length){i.length=s.length;for(let a=0;a<i.length;a++)i[a]||(i[a]=Ho("item",s[a]));t.set([...i],r)}i.forEach((a,c)=>a.set(s[c],r))})})),t}const Cb=class Cb extends Se{constructor(){super({id:Cb.ID,label:y("action.inlineSuggest.showNext","Show Next Inline Suggestion"),alias:"Show Next Inline Suggestion",precondition:le.and(M.writable,xo.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}async run(e,t){var n;const i=ir.get(t);(n=i==null?void 0:i.model.get())==null||n.next()}};Cb.ID=NM;let ZC=Cb;const xb=class xb extends Se{constructor(){super({id:xb.ID,label:y("action.inlineSuggest.showPrevious","Show Previous Inline Suggestion"),alias:"Show Previous Inline Suggestion",precondition:le.and(M.writable,xo.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}async run(e,t){var n;const i=ir.get(t);(n=i==null?void 0:i.model.get())==null||n.previous()}};xb.ID=MM;let XC=xb;class $j extends Se{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:y("action.inlineSuggest.trigger","Trigger Inline Suggestion"),alias:"Trigger Inline Suggestion",precondition:M.writable})}async run(e,t){const i=ir.get(t);await lP(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 qj extends Se{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:y("action.inlineSuggest.acceptNextWord","Accept Next Word Of Inline Suggestion"),alias:"Accept Next Word Of Inline Suggestion",precondition:le.and(M.writable,xo.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:le.and(M.writable,xo.inlineSuggestionVisible)},menuOpts:[{menuId:lt.InlineSuggestionToolbar,title:y("acceptWord","Accept Word"),group:"primary",order:2}]})}async run(e,t){var n;const i=ir.get(t);await((n=i==null?void 0:i.model.get())==null?void 0:n.acceptNextWord(i.editor))}}class Kj extends Se{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:y("action.inlineSuggest.acceptNextLine","Accept Next Line Of Inline Suggestion"),alias:"Accept Next Line Of Inline Suggestion",precondition:le.and(M.writable,xo.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:lt.InlineSuggestionToolbar,title:y("acceptLine","Accept Line"),group:"secondary",order:2}]})}async run(e,t){var n;const i=ir.get(t);await((n=i==null?void 0:i.model.get())==null?void 0:n.acceptNextLine(i.editor))}}class Gj extends Se{constructor(){super({id:TM,label:y("action.inlineSuggest.accept","Accept Inline Suggestion"),alias:"Accept Inline Suggestion",precondition:xo.inlineSuggestionVisible,menuOpts:[{menuId:lt.InlineSuggestionToolbar,title:y("accept","Accept"),group:"primary",order:1}],kbOpts:{primary:2,weight:200,kbExpr:le.and(xo.inlineSuggestionVisible,M.tabMovesFocus.toNegated(),xo.inlineSuggestionHasIndentationLessThanTabSize,Jt.Visible.toNegated(),M.hoverFocused.toNegated())}})}async run(e,t){var n;const i=ir.get(t);i&&((n=i.model.get())==null||n.accept(i.editor),i.editor.focus())}}const Lb=class Lb extends Se{constructor(){super({id:Lb.ID,label:y("action.inlineSuggest.hide","Hide Inline Suggestion"),alias:"Hide Inline Suggestion",precondition:xo.inlineSuggestionVisible,kbOpts:{weight:100,primary:9}})}async run(e,t){const i=ir.get(t);Lh(n=>{var s;(s=i==null?void 0:i.model.get())==null||s.stop(n)})}};Lb.ID="editor.action.inlineSuggest.hide";let YC=Lb;const kb=class kb extends uo{constructor(){super({id:kb.ID,title:y("action.inlineSuggest.alwaysShowToolbar","Always Show Toolbar"),f1:!1,precondition:void 0,menu:[{id:lt.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:le.equals("config.editor.inlineSuggest.showToolbar","always")})}async run(e,t){const i=e.get(Tn),s=i.getValue("editor.inlineSuggest.showToolbar")==="always"?"onHover":"always";i.updateValue("editor.inlineSuggest.showToolbar",s)}};kb.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar";let JC=kb;var Zj=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},af=function(o,e){return function(t,i){e(t,i,o)}};class Xj{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 QC=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=ir.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 C_(1e3,this,B.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 C_(1e3,this,i.range,e.event.posx,e.event.posy,!1):i.type===6&&i.detail.mightBeForeignElement&&t.shouldShowHoverAt(i.range)?new C_(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=ir.get(this._editor);return i&&i.shouldShowHoverAt(e.range)?[new Xj(this,e.range,i)]:[]}renderHoverParts(e,t){const i=new Be,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(_g,this._editor,!1,sl(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 mh([c])}renderScreenReaderText(e,t){const i=new Be,n=yt,s=n("div.hover-row.markdown-hover"),r=pt(s,n("div.hover-contents",{"aria-live":"assertive"})),a=i.add(new Ng({editor:this._editor},this._languageService,this._openerService)),c=h=>{i.add(a.onDidRenderAsync(()=>{r.className="hover-contents code-hover-contents",e.onContentsChanged()}));const g=y("inlineSuggestionFollows","Suggestion:"),f=i.add(a.render(new $s().appendText(g).appendCodeblock("text",h)));r.replaceChildren(f.element)};return i.add(Vn(h=>{var f;const g=(f=t.controller.model.read(h))==null?void 0:f.primaryGhostText.read(h);if(g){const p=this._editor.getModel().getLineContent(g.lineNumber);c(g.renderForScreenReader(p))}else W_(r)})),e.fragment.appendChild(s),i}};QC=Zj([af(1,aa),af(2,oa),af(3,ry),af(4,ai),af(5,ra)],QC);class Yj{}const By=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}};_i(ir.ID,ir,3);se($j);se(ZC);se(XC);se(qj);se(Kj);se(Gj);se(YC);cn(JC);Ph.register(QC);By.register(new Yj);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},zw=function(o,e){return function(t,i){e(t,i,o)}},yf,vc;let Sp=(vc=class{constructor(e,t,i,n){this.textModelResolverService=t,this.languageService=i,this.languageFeaturesService=n,this.toUnhook=new Be,this.toUnhookForKeyboard=new Be,this.currentWordAtPosition=null,this.previousPromise=null,this.editor=e,this.linkDecorations=this.editor.createDecorationsCollection();const s=new My(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=>{mn(a)}).finally(()=>{this.removeLinkDecorations()})})),this.toUnhook.add(s.onCancel(()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null}))}static get(e){return e.getContribution(yf.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 cP(this.editor,15);this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=ks(a=>this.findDefinition(e,a));let n;try{n=await this.previousPromise}catch(a){mn(a);return}if(!n||!n.length||!i.validate(this.editor)){this.removeLinkDecorations();return}const s=n[0].originSelectionRange?B.lift(n[0].originSelectionRange):new B(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn);if(n.length>1){let a=s;for(const{originSelectionRange:c}of n)c&&(a=B.plusRange(a,c));this.addDecoration(a,new $s().appendText(y("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:g}=a.range;if(g<1||g>h.getLineCount()){c.dispose();return}const f=this.getPreviewValue(h,g,a),p=this.languageService.guessLanguageIdByFilepathOrFirstLine(h.uri);this.addDecoration(s,f?new $s().appendCodeblock(p||"",f):void 0),c.dispose()})}}getPreviewValue(e,t,i){let n=i.range;return n.endLineNumber-n.startLineNumber>=yf.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+yf.MAX_SOURCE_PREVIEW_LINES);let s=t+1;for(;s<n;s++){const r=e.getLineFirstNonWhitespaceColumn(s);if(i===r)break}return new B(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 q0)&&(e.hasTriggerModifier||(t?t.keyCodeIsTriggerKey:!1))&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(e,t){const i=this.editor.getModel();return i?pm(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 _m({openToSide:t,openInPeek:n,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(i)})}isInPeekEditor(e){const t=e.get($i);return co.inPeekEditor.getValue(t)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}},yf=vc,vc.ID="editor.contrib.gotodefinitionatposition",vc.MAX_SOURCE_PREVIEW_LINES=8,vc);Sp=yf=Jj([zw(1,la),zw(2,aa),zw(3,Et)],Sp);_i(Sp.ID,Sp,2);var xN=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Mv=function(o,e){return function(t,i){e(t,i,o)}};class GI{constructor(e,t,i){this.marker=e,this.index=t,this.total=i}}let ex=class{constructor(e,t,i){this._markerService=t,this._configService=i,this._onDidChange=new ui,this.onDidChange=this._onDidChange.event,this._dispoables=new Be,this._markers=[],this._nextIdx=-1,un.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=hk(a.resource.toString(),c.resource.toString());return h===0&&(n==="position"?h=B.compareRangesUsingStarts(a,c)||Gs.compare(a.severity,c.severity):h=Gs.compare(a.severity,c.severity)||B.compareRangesUsingStarts(a,c)),h},r=()=>{this._markers=this._markerService.read({resource:un.isUri(e)?e:void 0,severities:Gs.Error|Gs.Warning|Gs.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 GI(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=U_(this._markers,{resource:e.uri},(r,a)=>hk(r.resource.toString(),a.resource.toString())),s<0&&(s=~s));for(let r=s;r<this._markers.length;r++){let a=B.lift(this._markers[r]);if(a.isEmpty()){const c=e.getWordAtPosition(a.getStartPosition());c&&(a=new B(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(B.containsPosition(this._markers[i],t))return new GI(this._markers[i],i+1,this._markers.length)}}};ex=xN([Mv(1,H0),Mv(2,Tn)],ex);const LN=Ll("IMarkerNavigationService");let tx=class{constructor(e,t){this._markerService=e,this._configService=t,this._provider=new QE}getMarkerList(e){for(const t of this._provider){const i=t.getMarkerList(e);if(i)return i}return new ex(e,this._markerService,this._configService)}};tx=xN([Mv(0,H0),Mv(1,Tn)],tx);kl(LN,tx,1);var ix;(function(o){function e(t){switch(t){case Nm.Ignore:return"severity-ignore "+Xi.asClassName(Qt.info);case Nm.Info:return Xi.asClassName(Qt.info);case Nm.Warning:return Xi.asClassName(Qt.warning);case Nm.Error:return Xi.asClassName(Qt.error);default:return""}}o.className=e})(ix||(ix={}));var Qj=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)}},nx;class e6{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 Be,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(ml(this._relatedBlock,"click",a=>{a.preventDefault();const c=this._relatedDiagnostics.get(a.target);c&&i(c)})),this._scrollable=new P2(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(){Ks(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=hy(i);this._lines=a.length,this._longestLineLength=0;for(const p of a)this._longestLineLength=Math.max(p.length+r,this._longestLineLength);Na(this._messageBlock),this._messageBlock.setAttribute("aria-label",this.getAriaLabel(e)),this._editor.applyFontInfo(this._messageBlock);let c=this._messageBlock;for(const p of a)c=document.createElement("div"),c.innerText=p,p===""&&(c.style.height=this._messageBlock.style.lineHeight),this._messageBlock.appendChild(c);if(t||s){const p=document.createElement("span");if(p.classList.add("details"),c.appendChild(p),t){const v=document.createElement("span");v.innerText=t,v.classList.add("source"),p.appendChild(v)}if(s)if(typeof s=="string"){const v=document.createElement("span");v.innerText=`(${s})`,v.classList.add("code"),p.appendChild(v)}else{this._codeLink=yt("a.code-link"),this._codeLink.setAttribute("href",`${s.target.toString()}`),this._codeLink.onclick=_=>{this._openerService.open(s.target,{allowCommands:!0}),_.preventDefault(),_.stopPropagation()};const v=pt(this._codeLink,yt("span"));v.innerText=s.value,p.appendChild(this._codeLink)}}if(Na(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),Fo(n)){const p=this._relatedBlock.appendChild(document.createElement("div"));p.style.paddingTop=`${Math.floor(this._editor.getOption(67)*.66)}px`,this._lines+=1;for(const v of n){const _=document.createElement("div"),w=document.createElement("a");w.classList.add("filename"),w.innerText=`${this._labelService.getUriBasenameLabel(v.resource)}(${v.startLineNumber}, ${v.startColumn}): `,w.title=this._labelService.getUriLabel(v.resource),this._relatedDiagnostics.set(w,v);const S=document.createElement("span");S.innerText=v.message,_.appendChild(w),_.appendChild(S),this._lines+=1,p.appendChild(_)}}const h=this._editor.getOption(50),g=Math.ceil(h.typicalFullwidthCharacterWidth*this._longestLineLength*.75),f=h.lineHeight*this._lines;this._scrollable.setScrollDimensions({scrollWidth:g,scrollHeight:f})}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 Gs.Error:t=y("Error","Error");break;case Gs.Warning:t=y("Warning","Warning");break;case Gs.Info:t=y("Info","Info");break;case Gs.Hint:t=y("Hint","Hint");break}let i=y("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 zd;let Cp=(zd=class extends cv{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 Be,this._onDidSelectRelatedInformation=new ui,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=Gs.Warning,this._backgroundColor=xi.white,this._applyTheme(t.getColorTheme()),this._callOnDispose.add(t.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(e){this._backgroundColor=e.getColor(s6);let t=sx,i=t6;this._severity===Gs.Warning?(t=I_,i=i6):this._severity===Gs.Info&&(t=ox,i=n6);const n=e.getColor(t),s=e.getColor(i);this.style({arrowColor:n,frameColor:n,headerBackgroundColor:s,primaryHeadingColor:e.getColor(jM),secondaryHeadingColor:e.getColor(UM)})}_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(nx.TitleMenu,this._contextKeyService);z0(i,t),this._actionbarWidget.push(t,{label:!1,icon:!0,index:0})}_fillTitleIcon(e){this._icon=pt(e,yt(""))}_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 e6(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=B.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?y("problems","{0} of {1} problems",t,i):y("change","{0} of {1} problem",t,i);this.setTitle(Ha(a.uri),c)}this._icon.className=`codicon ${ix.className(Gs.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()}},nx=zd,zd.TitleMenu=new lt("gotoErrorTitleMenu"),zd);Cp=nx=Qj([Qh(1,Pr),Qh(2,oa),Qh(3,xh),Qh(4,ai),Qh(5,$i),Qh(6,ip)],Cp);const ZI=X0(L2,x2),XI=X0(I2,k2),YI=X0(aS,D2),sx=St("editorMarkerNavigationError.background",{dark:ZI,light:ZI,hcDark:pl,hcLight:pl},y("editorMarkerNavigationError","Editor marker navigation widget error color.")),t6=St("editorMarkerNavigationError.headerBackground",{dark:Ra(sx,.1),light:Ra(sx,.1),hcDark:null,hcLight:null},y("editorMarkerNavigationErrorHeaderBackground","Editor marker navigation widget error heading background.")),I_=St("editorMarkerNavigationWarning.background",{dark:XI,light:XI,hcDark:pl,hcLight:pl},y("editorMarkerNavigationWarning","Editor marker navigation widget warning color.")),i6=St("editorMarkerNavigationWarning.headerBackground",{dark:Ra(I_,.1),light:Ra(I_,.1),hcDark:"#0C141F",hcLight:Ra(I_,.2)},y("editorMarkerNavigationWarningBackground","Editor marker navigation widget warning heading background.")),ox=St("editorMarkerNavigationInfo.background",{dark:YI,light:YI,hcDark:pl,hcLight:pl},y("editorMarkerNavigationInfo","Editor marker navigation widget info color.")),n6=St("editorMarkerNavigationInfo.headerBackground",{dark:Ra(ox,.1),light:Ra(ox,.1),hcDark:null,hcLight:null},y("editorMarkerNavigationInfoHeaderBackground","Editor marker navigation widget info heading background.")),s6=St("editorMarkerNavigation.background",E2,y("editorMarkerNavigationBackground","Editor marker navigation widget background."));var o6=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)}},wf,Vd;let bh=(Vd=class{static get(e){return e.getContribution(wf.ID)}constructor(e,t,i,n,s){this._markerNavigationService=t,this._contextKeyService=i,this._editorService=n,this._instantiationService=s,this._sessionDispoables=new Be,this._editor=e,this._widgetVisible=kN.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(Cp,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)||!B.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:B.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 Dt(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=wf.get(r))==null||i.close(),(n=wf.get(r))==null||n.nagivate(e,t))}else this._widget.showAtMarker(s.selected.marker,s.selected.index,s.selected.total)}}},wf=Vd,Vd.ID="editor.contrib.markerController",Vd);bh=wf=o6([e_(1,LN),e_(2,$i),e_(3,os),e_(4,ai)],bh);class zy extends Se{constructor(e,t,i){super(i),this._next=e,this._multiFile=t}async run(e,t){var i;t.hasModel()&&((i=bh.get(t))==null||i.nagivate(this._next,this._multiFile))}}const Xc=class Xc extends zy{constructor(){super(!0,!1,{id:Xc.ID,label:Xc.LABEL,alias:"Go to Next Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:578,weight:100},menuOpts:{menuId:Cp.TitleMenu,title:Xc.LABEL,icon:es("marker-navigation-next",Qt.arrowDown,y("nextMarkerIcon","Icon for goto next marker.")),group:"navigation",order:1}})}};Xc.ID="editor.action.marker.next",Xc.LABEL=y("markerAction.next.label","Go to Next Problem (Error, Warning, Info)");let Nv=Xc;const Yc=class Yc extends zy{constructor(){super(!1,!1,{id:Yc.ID,label:Yc.LABEL,alias:"Go to Previous Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:1602,weight:100},menuOpts:{menuId:Cp.TitleMenu,title:Yc.LABEL,icon:es("marker-navigation-previous",Qt.arrowUp,y("previousMarkerIcon","Icon for goto previous marker.")),group:"navigation",order:2}})}};Yc.ID="editor.action.marker.prev",Yc.LABEL=y("markerAction.previous.label","Go to Previous Problem (Error, Warning, Info)");let rx=Yc;class r6 extends zy{constructor(){super(!0,!0,{id:"editor.action.marker.nextInFiles",label:y("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:M.focus,primary:66,weight:100},menuOpts:{menuId:lt.MenubarGoMenu,title:y({key:"miGotoNextProblem",comment:["&& denotes a mnemonic"]},"Next &&Problem"),group:"6_problem_nav",order:1}})}}class a6 extends zy{constructor(){super(!1,!0,{id:"editor.action.marker.prevInFiles",label:y("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:M.focus,primary:1090,weight:100},menuOpts:{menuId:lt.MenubarGoMenu,title:y({key:"miGotoPreviousProblem",comment:["&& denotes a mnemonic"]},"Previous &&Problem"),group:"6_problem_nav",order:2}})}}_i(bh.ID,bh,4);se(Nv);se(rx);se(r6);se(a6);const kN=new Ri("markersNavigationVisible",!1),l6=go.bindToContribution(bh.get);Tt(new l6({id:"closeMarkersNavigation",precondition:kN,handler:o=>o.close(),kbOpts:{weight:150,kbExpr:M.focus,primary:9,secondary:[1033]}}));var zr;(function(o){o.NoAutoFocus="noAutoFocus",o.FocusIfVisible="focusIfVisible",o.AutoFocusImmediately="autoFocusImmediately"})(zr||(zr={}));class c6 extends Se{constructor(){super({id:PM,label:y({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:kt("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:[zr.NoAutoFocus,zr.FocusIfVisible,zr.AutoFocusImmediately],enumDescriptions:[y("showOrFocusHover.focus.noAutoFocus","The hover will not automatically take focus."),y("showOrFocusHover.focus.focusIfVisible","The hover will take focus only if it is already visible."),y("showOrFocusHover.focus.autoFocusImmediately","The hover will automatically take focus when it appears.")],default:zr.FocusIfVisible}}}}]},alias:"Show or Focus Hover",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:cs(2089,2087),weight:100}})}run(e,t,i){if(!t.hasModel())return;const n=Us.get(t);if(!n)return;const s=i==null?void 0:i.focus;let r=zr.FocusIfVisible;Object.values(zr).includes(s)?r=s:typeof s=="boolean"&&s&&(r=zr.AutoFocusImmediately);const a=h=>{const g=t.getPosition(),f=new B(g.lineNumber,g.column,g.lineNumber,g.column);n.showContentHover(f,1,1,h)},c=t.getOption(2)===2;n.isHoverVisible?r!==zr.NoAutoFocus?n.focus():a(c):a(c||r===zr.AutoFocusImmediately)}}class d6 extends Se{constructor(){super({id:IB,label:y({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:kt("showDefinitionPreviewHoverDescription","Show the definition preview hover in the editor.")}})}run(e,t){const i=Us.get(t);if(!i)return;const n=t.getPosition();if(!n)return;const s=new B(n.lineNumber,n.column,n.lineNumber,n.column),r=Sp.get(t);if(!r)return;r.startFindDefinitionFromCursor(n).then(()=>{i.showContentHover(s,1,1,!0)})}}class h6 extends Se{constructor(){super({id:DB,label:y({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:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:16,weight:100},metadata:{description:kt("scrollUpHoverDescription","Scroll up the editor hover.")}})}run(e,t){const i=Us.get(t);i&&i.scrollUp()}}class u6 extends Se{constructor(){super({id:EB,label:y({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:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:18,weight:100},metadata:{description:kt("scrollDownHoverDescription","Scroll down the editor hover.")}})}run(e,t){const i=Us.get(t);i&&i.scrollDown()}}class g6 extends Se{constructor(){super({id:PB,label:y({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:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:15,weight:100},metadata:{description:kt("scrollLeftHoverDescription","Scroll left the editor hover.")}})}run(e,t){const i=Us.get(t);i&&i.scrollLeft()}}class f6 extends Se{constructor(){super({id:TB,label:y({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:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:17,weight:100},metadata:{description:kt("scrollRightHoverDescription","Scroll right the editor hover.")}})}run(e,t){const i=Us.get(t);i&&i.scrollRight()}}class p6 extends Se{constructor(){super({id:MB,label:y({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:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:11,secondary:[528],weight:100},metadata:{description:kt("pageUpHoverDescription","Page up the editor hover.")}})}run(e,t){const i=Us.get(t);i&&i.pageUp()}}class m6 extends Se{constructor(){super({id:NB,label:y({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:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:12,secondary:[530],weight:100},metadata:{description:kt("pageDownHoverDescription","Page down the editor hover.")}})}run(e,t){const i=Us.get(t);i&&i.pageDown()}}class _6 extends Se{constructor(){super({id:RB,label:y({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:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:14,secondary:[2064],weight:100},metadata:{description:kt("goToTopHoverDescription","Go to the top of the editor hover.")}})}run(e,t){const i=Us.get(t);i&&i.goToTop()}}class v6 extends Se{constructor(){super({id:AB,label:y({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:M.hoverFocused,kbOpts:{kbExpr:M.hoverFocused,primary:13,secondary:[2066],weight:100},metadata:{description:kt("goToBottomHoverDescription","Go to the bottom of the editor hover.")}})}run(e,t){const i=Us.get(t);i&&i.goToBottom()}}class b6 extends Se{constructor(){super({id:Ey,label:OB,alias:"Increase Hover Verbosity Level",precondition:M.hoverVisible})}run(e,t,i){const n=Us.get(t);if(!n)return;const s=(i==null?void 0:i.index)!==void 0?i.index:n.focusedHoverPartIndex();n.updateHoverVerbosityLevel(er.Increase,s,i==null?void 0:i.focus)}}class y6 extends Se{constructor(){super({id:Py,label:FB,alias:"Decrease Hover Verbosity Level",precondition:M.hoverVisible})}run(e,t,i){var r;const n=Us.get(t);if(!n)return;const s=(i==null?void 0:i.index)!==void 0?i.index:n.focusedHoverPartIndex();(r=Us.get(t))==null||r.updateHoverVerbosityLevel(er.Decrease,s,i==null?void 0:i.focus)}}var w6=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},Vw=function(o,e){return function(t,i){e(t,i,o)}};const lr=yt;class S6{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 JI={type:1,filter:{include:yn.QuickFix},triggerAction:ko.QuickFixHover};let ax=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,g=this._markerDecorationsService.getMarker(i.uri,a);if(!g)continue;const f=new B(e.range.startLineNumber,c,e.range.startLineNumber,h);r.push(new S6(this,f,g))}return r}renderHoverParts(e,t){if(!t.length)return new mh([]);const i=new Be,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)=>Gs.compare(r.marker.severity,a.marker.severity))[0];return this.renderMarkerStatusbar(e,s,i),new mh(n)}_renderMarkerHover(e){const t=new Be,i=lr("div.hover-row"),n=pt(i,lr("div.marker.hover-contents")),{source:s,message:r,code:a,relatedInformation:c}=e.marker;this._editor.applyFontInfo(n);const h=pt(n,lr("span"));if(h.style.whiteSpace="pre-wrap",h.innerText=r,s||a)if(a&&typeof a!="string"){const f=lr("span");if(s){const w=pt(f,lr("span"));w.innerText=s}const p=pt(f,lr("a.code-link"));p.setAttribute("href",a.target.toString()),t.add(Ui(p,"click",w=>{this._openerService.open(a.target,{allowCommands:!0}),w.preventDefault(),w.stopPropagation()}));const v=pt(p,lr("span"));v.innerText=a.value;const _=pt(n,f);_.style.opacity="0.6",_.style.paddingLeft="6px"}else{const f=pt(n,lr("span"));f.style.opacity="0.6",f.style.paddingLeft="6px",f.innerText=s&&a?`${s}(${a})`:s||`(${a})`}if(Fo(c))for(const{message:f,resource:p,startLineNumber:v,startColumn:_}of c){const w=pt(n,lr("div"));w.style.marginTop="8px";const S=pt(w,lr("a"));S.innerText=`${Ha(p)}(${v}, ${_}): `,S.style.cursor="pointer",t.add(Ui(S,"click",E=>{if(E.stopPropagation(),E.preventDefault(),this._openerService){const R={selection:{startLineNumber:v,startColumn:_}};this._openerService.open(p,{fromUserGesture:!0,editorOptions:R}).catch(mn)}}));const D=pt(w,lr("span"));D.innerText=f,this._editor.applyFontInfo(D)}return{hoverPart:e,hoverElement:i,dispose:()=>t.dispose()}}renderMarkerStatusbar(e,t,i){if(t.marker.severity===Gs.Error||t.marker.severity===Gs.Warning||t.marker.severity===Gs.Info){const n=bh.get(this._editor);n&&e.statusBar.addAction({label:y("view problem","View Problem"),commandId:Nv.ID,run:()=>{e.hide(),n.showAtMarker(t.marker),this._editor.focus()}})}if(!this._editor.getOption(92)){const n=e.statusBar.append(lr("div"));this.recentMarkerCodeActionsInfo&&(uk.makeKey(this.recentMarkerCodeActionsInfo.marker)===uk.makeKey(t.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||(n.textContent=y("noQuickFixes","No quick fixes available")):this.recentMarkerCodeActionsInfo=void 0);const s=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?Ve.None:Xf(()=>n.textContent=y("checkingForQuickFixes","Checking for quick fixes..."),200,i);n.textContent||(n.textContent=" ");const r=this.getCodeActions(t.marker);i.add(En(()=>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=y("noQuickFixes","No quick fixes available");return}n.style.display="none";let c=!1;i.add(En(()=>{c||a.dispose()})),e.statusBar.addAction({label:y("quick fixes","Quick Fix..."),commandId:x1,run:h=>{c=!0;const g=pg.get(this._editor),f=lo(h);e.hide(),g==null||g.showCodeActions(JI,a,{x:f.left,y:f.top,width:f.width,height:f.height})}})},mn)}}getCodeActions(e){return ks(t=>mu(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new B(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),JI,nl.None,t))}};ax=w6([Vw(1,T2),Vw(2,oa),Vw(3,Et)],ax);class C6{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=F_.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)??F_.Center;if(!n&&a!==this._laneOrLine)continue;const c=n?r.options.lineNumberHoverMessage:r.options.glyphMarginHoverMessage;!c||tp(c)||i.push(...yE(c).map(e))}return i}}var x6=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},QI=function(o,e){return function(t,i){e(t,i,o)}},lx;const eD=yt;var jd;let cx=(jd=class extends Ve{constructor(e,t,i){super(),this._renderDisposeables=this._register(new Be),this._editor=e,this._isVisible=!1,this._messages=[],this._hover=this._register(new bE),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._markdownRenderer=this._register(new Ng({editor:this._editor},t,i)),this._computer=new C6(this._editor),this._hoverOperation=this._register(new RM(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(ml(this._hover.containerDomNode,"mouseleave",n=>{this._onMouseLeave(n)})),this._editor.addOverlayWidget(this)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return lx.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=eD("div.hover-row.markdown-hover"),r=pt(s,eD("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||!Ty(t,e.x,e.y))&&this.hide()}},lx=jd,jd.ID="editor.contrib.modesGlyphHoverWidget",jd);cx=lx=x6([QI(1,aa),QI(2,oa)],cx);var L6=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},k6=function(o,e){return function(t,i){e(t,i,o)}},qu;let Rv=(qu=class extends Ve{constructor(e,t){super(),this._editor=e,this._instantiationService=t,this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new Be,this._hoverState={mouseDown:!1},this._reactToEditorMouseMoveRunner=this._register(new ms(()=>this._reactToEditorMouseMove(this._mouseMoveEvent),0)),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration(i=>{i.hasChanged(60)&&(this._unhookListeners(),this._hookListeners())}))}_hookListeners(){const e=this._editor.getOption(60);this._hoverSettings={enabled:e.enabled,sticky:e.sticky,hidingDelay:e.hidingDelay},e.enabled?(this._listenersStore.add(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))):(this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))),this._listenersStore.add(this._editor.onMouseLeave(t=>this._onEditorMouseLeave(t))),this._listenersStore.add(this._editor.onDidChangeModel(()=>{this._cancelScheduler(),this._hideWidgets()})),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange(t=>this._onEditorScrollChanged(t)))}_unhookListeners(){this._listenersStore.clear()}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_onEditorScrollChanged(e){(e.scrollTopChanged||e.scrollLeftChanged)&&this._hideWidgets()}_onEditorMouseDown(e){this._hoverState.mouseDown=!0,!this._isMouseOnMarginHoverWidget(e)&&this._hideWidgets()}_isMouseOnMarginHoverWidget(e){var i;const t=(i=this._glyphWidget)==null?void 0:i.getDomNode();return t?Ty(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(cx,this._editor)),this._glyphWidget}dispose(){var e;super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),(e=this._glyphWidget)==null||e.dispose()}},qu.ID="editor.contrib.marginHover",qu);Rv=L6([k6(1,ai)],Rv);class I6{}class D6{}class E6{}_i(Us.ID,Us,2);_i(Rv.ID,Rv,2);se(c6);se(d6);se(h6);se(u6);se(g6);se(f6);se(p6);se(m6);se(_6);se(v6);se(b6);se(y6);Ph.register(_p);Ph.register(ax);ny((o,e)=>{const t=o.getColor(M2);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)}; }`))});By.register(new I6);By.register(new D6);By.register(new E6);function vo(o,e){let t=0;for(let i=0;i<o.length;i++)o.charAt(i)===" "?t+=e:t++;return t}function Bf(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 IN(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 N2(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=(w,S)=>(S=S||1,ag.shiftIndent(w,w.length+S,r,a,c)),g=(w,S)=>(S=S||1,ag.unshiftIndent(w,w.length+S,r,a,c)),f=[],p=o.getLineContent(t);let v=Rs(p),_=v;s.shouldIncrease(t)?(_=h(_),v=h(v)):s.shouldIndentNextLine(t)&&(_=h(_)),t++;for(let w=t;w<=i;w++){if(P6(o,w))continue;const S=o.getLineContent(w),D=Rs(S),E=_;s.shouldDecrease(w,E)&&(_=g(_),v=g(v)),D!==_&&f.push(Kn.replaceMove(new Xt(w,1,w,D.length+1),R2(_,a,c))),!s.shouldIgnore(w)&&(s.shouldIncrease(w,E)?(v=h(v),_=v):s.shouldIndentNextLine(w,E)?_=h(_):_=v)}return f}function P6(o,e){return o.tokenization.isCheapToTokenize(e)?o.tokenization.getLineTokens(e).getStandardTokenType(0)===2:!1}var T6=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},M6=function(o,e){return function(t,i){e(t,i,o)}};const Ib=class Ib extends Se{constructor(){super({id:Ib.ID,label:y("indentationToSpaces","Convert Indentation to Spaces"),alias:"Convert Indentation to Spaces",precondition:M.writable,metadata:{description:kt("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 F6(s,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!0})}};Ib.ID="editor.action.indentationToSpaces";let dx=Ib;const Db=class Db extends Se{constructor(){super({id:Db.ID,label:y("indentationToTabs","Convert Indentation to Tabs"),alias:"Convert Indentation to Tabs",precondition:M.writable,metadata:{description:kt("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 H6(s,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!1})}};Db.ID="editor.action.indentationToTabs";let hx=Db;class X1 extends Se{constructor(e,t,i){super(i),this.insertSpaces=e,this.displaySizeOnly=t}run(e,t){const i=e.get(xl),n=e.get(eo),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(g=>({id:g.toString(),label:g.toString(),description:g===r.tabSize&&g===a.tabSize?y("configuredTabSize","Configured Tab Size"):g===r.tabSize?y("defaultTabSize","Default Tab Size"):g===a.tabSize?y("currentTabSize","Current Tab Size"):void 0})),h=Math.min(s.getOptions().tabSize-1,7);setTimeout(()=>{i.pick(c,{placeHolder:y({key:"selectTabWidth",comment:["Tab corresponds to the tab key"]},"Select Tab Size for Current File"),activeItem:c[h]}).then(g=>{if(g&&s&&!s.isDisposed()){const f=parseInt(g.label,10);this.displaySizeOnly?s.updateOptions({tabSize:f}):s.updateOptions({tabSize:f,indentSize:f,insertSpaces:this.insertSpaces})}})},50)}}const Eb=class Eb extends X1{constructor(){super(!1,!1,{id:Eb.ID,label:y("indentUsingTabs","Indent Using Tabs"),alias:"Indent Using Tabs",precondition:void 0,metadata:{description:kt("indentUsingTabsDescription","Use indentation with tabs.")}})}};Eb.ID="editor.action.indentUsingTabs";let ux=Eb;const Pb=class Pb extends X1{constructor(){super(!0,!1,{id:Pb.ID,label:y("indentUsingSpaces","Indent Using Spaces"),alias:"Indent Using Spaces",precondition:void 0,metadata:{description:kt("indentUsingSpacesDescription","Use indentation with spaces.")}})}};Pb.ID="editor.action.indentUsingSpaces";let gx=Pb;const Tb=class Tb extends X1{constructor(){super(!0,!0,{id:Tb.ID,label:y("changeTabDisplaySize","Change Tab Display Size"),alias:"Change Tab Display Size",precondition:void 0,metadata:{description:kt("changeTabDisplaySizeDescription","Change the space size equivalent of the tab.")}})}};Tb.ID="editor.action.changeTabDisplaySize";let fx=Tb;const Mb=class Mb extends Se{constructor(){super({id:Mb.ID,label:y("detectIndentation","Detect Indentation from Content"),alias:"Detect Indentation from Content",precondition:void 0,metadata:{description:kt("detectIndentationDescription","Detect the indentation from content.")}})}run(e,t){const i=e.get(eo),n=t.getModel();if(!n)return;const s=i.getCreationOptions(n.getLanguageId(),n.uri,n.isForSimpleWidget);n.detectIndentation(s.insertSpaces,s.tabSize)}};Mb.ID="editor.action.detectIndentation";let px=Mb;class N6 extends Se{constructor(){super({id:"editor.action.reindentlines",label:y("editor.reindentlines","Reindent Lines"),alias:"Reindent Lines",precondition:M.writable,metadata:{description:kt("editor.reindentlinesDescription","Reindent the lines of the editor.")}})}run(e,t){const i=e.get(ws),n=t.getModel();if(!n)return;const s=IN(n,i,1,n.getLineCount());s.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,s),t.pushUndoStop())}}class R6 extends Se{constructor(){super({id:"editor.action.reindentselectedlines",label:y("editor.reindentselectedlines","Reindent Selected Lines"),alias:"Reindent Selected Lines",precondition:M.writable,metadata:{description:kt("editor.reindentselectedlinesDescription","Reindent the selected lines of the editor.")}})}run(e,t){const i=e.get(ws),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 g=IN(n,i,c,h);r.push(...g)}r.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,r),t.pushUndoStop())}}class A6{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(B.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 Ku;let Av=(Ku=class{constructor(e,t){this.editor=e,this._languageConfigurationService=t,this.callOnDispose=new Be,this.callOnModel=new Be,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)||O6(i,e)||!i.tokenization.isCheapToTokenize(e.getStartPosition().lineNumber))return;const s=this.editor.getOption(12),{tabSize:r,indentSize:a,insertSpaces:c}=i.getOptions(),h=[],g={shiftIndent:_=>ag.shiftIndent(_,_.length+1,r,a,c),unshiftIndent:_=>ag.unshiftIndent(_,_.length+1,r,a,c)};let f=e.startLineNumber;for(;f<=e.endLineNumber;){if(this.shouldIgnoreLine(i,f)){f++;continue}break}if(f>e.endLineNumber)return;let p=i.getLineContent(f);if(!/\S/.test(p.substring(0,e.startColumn-1))){const _=Tf(s,i,i.getLanguageId(),f,g,this._languageConfigurationService);if(_!==null){const w=Rs(p),S=vo(_,r),D=vo(w,r);if(S!==D){const E=Bf(S,r,c);h.push({range:new B(f,1,f,w.length+1),text:E}),p=E+p.substring(w.length)}else{const E=dP(i,f,this._languageConfigurationService);if(E===0||E===8)return}}}const v=f;for(;f<e.endLineNumber;){if(!/\S/.test(i.getLineContent(f+1))){f++;continue}break}if(f!==e.endLineNumber){const w=Tf(s,{tokenization:{getLineTokens:S=>i.tokenization.getLineTokens(S),getLanguageId:()=>i.getLanguageId(),getLanguageIdAtPosition:(S,D)=>i.getLanguageIdAtPosition(S,D)},getLineContent:S=>S===v?p:i.getLineContent(S)},i.getLanguageId(),f+1,g,this._languageConfigurationService);if(w!==null){const S=vo(w,r),D=vo(Rs(i.getLineContent(f+1)),r);if(S!==D){const E=S-D;for(let R=f+1;R<=e.endLineNumber;R++){const z=i.getLineContent(R),H=Rs(z),X=vo(H,r)+E,me=Bf(X,r,c);me!==H&&h.push({range:new B(R,1,R,H.length+1),text:me})}}}}if(h.length>0){this.editor.pushUndoStop();const _=new A6(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()}},Ku.ID="editor.contrib.autoIndentOnPaste",Ku);Av=T6([M6(1,ws)],Av);function O6(o,e){const t=i=>A2(o,i)===2;return t(e.getStartPosition())||t(e.getEndPosition())}function DN(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 B(r,1,r,c),g=o.getValueInRange(h),f=i?g.replace(/\t/ig,n):g.replace(s," ");e.addEditOperation(h,f)}}class F6{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),DN(e,t,this.tabSize,!0)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}class H6{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),DN(e,t,this.tabSize,!1)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}_i(Av.ID,Av,2);se(dx);se(hx);se(ux);se(gx);se(fx);se(px);se(N6);se(R6);_i(bp.ID,bp,1);Ph.register(gv);class W6{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 Xt(n.endLineNumber,Math.min(this._originalSelection.positionColumn,n.endColumn),n.endLineNumber,Math.min(this._originalSelection.positionColumn,n.endColumn)):new Xt(n.endLineNumber,n.endColumn-this._text.length,n.endLineNumber,n.endColumn)}}var B6=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)}},D_,bc;let xg=(bc=class{static get(e){return e.getContribution(D_.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 cP(this.editor,5),a=n.uri;return this.editorWorkerService.canNavigateValueSet(a)?(this.currentRequest=ks(h=>this.editorWorkerService.navigateValueSet(a,s,t)),this.currentRequest.then(h=>{var _;if(!h||!h.range||!h.value||!r.validate(this.editor))return;const g=B.lift(h.range);let f=h.range;const p=h.value.length-(s.endColumn-s.startColumn);f={startLineNumber:f.startLineNumber,startColumn:f.startColumn,endLineNumber:f.endLineNumber,endColumn:f.startColumn+h.value.length},p>1&&(s=new Xt(s.startLineNumber,s.startColumn,s.endLineNumber,s.endColumn+p-1));const v=new W6(g,s,h.value);this.editor.pushUndoStop(),this.editor.executeCommand(e,v),this.editor.pushUndoStop(),this.decorations.set([{range:f,options:D_.DECORATION}]),(_=this.decorationRemover)==null||_.cancel(),this.decorationRemover=uy(350),this.decorationRemover.then(()=>this.decorations.clear()).catch(mn)}).catch(mn)):Promise.resolve(void 0)}},D_=bc,bc.ID="editor.contrib.inPlaceReplaceController",bc.DECORATION=ki.register({description:"in-place-replace",className:"valueSetReplacement"}),bc);xg=D_=B6([z6(1,Il)],xg);class V6 extends Se{constructor(){super({id:"editor.action.inPlaceReplace.up",label:y("InPlaceReplaceAction.previous.label","Replace with Previous Value"),alias:"Replace with Previous Value",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:3159,weight:100}})}run(e,t){const i=xg.get(t);return i?i.run(this.id,!1):Promise.resolve(void 0)}}class j6 extends Se{constructor(){super({id:"editor.action.inPlaceReplace.down",label:y("InPlaceReplaceAction.next.label","Replace with Next Value"),alias:"Replace with Next Value",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:3161,weight:100}})}run(e,t){const i=xg.get(t);return i?i.run(this.id,!0):Promise.resolve(void 0)}}_i(xg.ID,xg,4);se(V6);se(j6);class U6 extends Se{constructor(){super({id:"expandLineSelection",label:y("expandLineSelection","Expand Line Selection"),alias:"Expand Line Selection",precondition:void 0,kbOpts:{weight:0,kbExpr:M.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,Y0.expandLineSelection(n,n.getCursorStates())),n.revealAllCursors(i.source,!0)}}se(U6);class $6{constructor(e,t,i){this._selection=e,this._cursors=t,this._selectionId=null,this._trimInRegexesAndStrings=i}getEditOperations(e,t){const i=q6(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 q6(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),g=h.length+1;let f=0;if(s<r&&e[s].lineNumber===a&&(f=e[s].column,s++,f===g)||h.length===0)continue;const p=f_(h);let v=0;if(p===-1)v=1;else if(p!==h.length-1)v=p+2;else continue;if(!t){if(!o.tokenization.hasAccurateTokensForLine(a))continue;const _=o.tokenization.getLineTokens(a),w=_.getStandardTokenType(_.findTokenIndexAtOffset(v));if(w===2||w===3)continue}v=Math.max(f,v),i[n++]=Kn.delete(new B(a,v,a,g))}return i}class EN{constructor(e,t,i){this._selection=e,this._isCopyingDown=t,this._noop=i||!1,this._selectionDirection=0,this._selectionId=null,this._startLineNumberDelta=0,this._endLineNumberDelta=0}getEditOperations(e,t){let i=this._selection;this._startLineNumberDelta=0,this._endLineNumberDelta=0,i.startLineNumber<i.endLineNumber&&i.endColumn===1&&(this._endLineNumberDelta=1,i=i.setEndPosition(i.endLineNumber-1,e.getLineMaxColumn(i.endLineNumber-1)));const n=[];for(let r=i.startLineNumber;r<=i.endLineNumber;r++)n.push(e.getLineContent(r));const s=n.join(`
48
+ `);s===""&&this._isCopyingDown&&(this._startLineNumberDelta++,this._endLineNumberDelta++),this._noop?t.addEditOperation(new B(i.endLineNumber,e.getLineMaxColumn(i.endLineNumber),i.endLineNumber+1,1),i.endLineNumber===e.getLineCount()?"":`
49
+ `):this._isCopyingDown?t.addEditOperation(new B(i.startLineNumber,1,i.startLineNumber,1),s+`
50
+ `):t.addEditOperation(new B(i.endLineNumber,e.getLineMaxColumn(i.endLineNumber),i.endLineNumber,e.getLineMaxColumn(i.endLineNumber)),`
51
+ `+s),this._selectionId=t.trackSelection(i),this._selectionDirection=this._selection.getDirection()}computeCursorState(e,t){let i=t.getTrackedSelection(this._selectionId);if(this._startLineNumberDelta!==0||this._endLineNumberDelta!==0){let n=i.startLineNumber,s=i.startColumn,r=i.endLineNumber,a=i.endColumn;this._startLineNumberDelta!==0&&(n=n+this._startLineNumberDelta,s=1),this._endLineNumberDelta!==0&&(r=r+this._endLineNumberDelta,a=1),i=Xt.createWithDirection(n,s,r,a,this._selectionDirection)}return i}}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},G6=function(o,e){return function(t,i){e(t,i,o)}};let mx=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=(f,p)=>e.getLanguageIdAtPosition(f,p),s=e.getLineCount();if(this._isMovingDown&&this._selection.endLineNumber===s){this._selectionId=t.trackSelection(this._selection);return}if(!this._isMovingDown&&this._selection.startLineNumber===1){this._selectionId=t.trackSelection(this._selection);return}this._moveEndPositionDown=!1;let r=this._selection;r.startLineNumber<r.endLineNumber&&r.endColumn===1&&(this._moveEndPositionDown=!0,r=r.setEndPosition(r.endLineNumber-1,e.getLineMaxColumn(r.endLineNumber-1)));const{tabSize:a,indentSize:c,insertSpaces:h}=e.getOptions(),g=this.buildIndentConverter(a,c,h);if(r.startLineNumber===r.endLineNumber&&e.getLineMaxColumn(r.startLineNumber)===1){const f=r.startLineNumber,p=this._isMovingDown?f+1:f-1;e.getLineMaxColumn(p)===1?t.addEditOperation(new B(1,1,1,1),null):(t.addEditOperation(new B(f,1,f,1),e.getLineContent(p)),t.addEditOperation(new B(p,1,p,e.getLineMaxColumn(p)),null)),r=new Xt(p,1,p,1)}else{let f,p;if(this._isMovingDown){f=r.endLineNumber+1,p=e.getLineContent(f),t.addEditOperation(new B(f-1,e.getLineMaxColumn(f-1),f,e.getLineMaxColumn(f)),null);let v=p;if(this.shouldAutoIndent(e,r)){const _=this.matchEnterRule(e,g,a,f,r.startLineNumber-1);if(_!==null){const S=Rs(e.getLineContent(f)),D=_+vo(S,a);v=Bf(D,a,h)+this.trimStart(p)}else{const S={tokenization:{getLineTokens:E=>E===r.startLineNumber?e.tokenization.getLineTokens(f):e.tokenization.getLineTokens(E),getLanguageId:i,getLanguageIdAtPosition:n},getLineContent:E=>E===r.startLineNumber?e.getLineContent(f):e.getLineContent(E)},D=Tf(this._autoIndent,S,e.getLanguageIdAtPosition(f,1),r.startLineNumber,g,this._languageConfigurationService);if(D!==null){const E=Rs(e.getLineContent(f)),R=vo(D,a),z=vo(E,a);R!==z&&(v=Bf(R,a,h)+this.trimStart(p))}}t.addEditOperation(new B(r.startLineNumber,1,r.startLineNumber,1),v+`
52
+ `);const w=this.matchEnterRuleMovingDown(e,g,a,r.startLineNumber,f,v);if(w!==null)w!==0&&this.getIndentEditsOfMovingBlock(e,t,r,a,h,w);else{const S={tokenization:{getLineTokens:E=>E===r.startLineNumber?e.tokenization.getLineTokens(f):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)},D=Tf(this._autoIndent,S,e.getLanguageIdAtPosition(f,1),r.startLineNumber+1,g,this._languageConfigurationService);if(D!==null){const E=Rs(e.getLineContent(r.startLineNumber)),R=vo(D,a),z=vo(E,a);if(R!==z){const H=R-z;this.getIndentEditsOfMovingBlock(e,t,r,a,h,H)}}}}else t.addEditOperation(new B(r.startLineNumber,1,r.startLineNumber,1),v+`
53
+ `)}else if(f=r.startLineNumber-1,p=e.getLineContent(f),t.addEditOperation(new B(f,1,f+1,1),null),t.addEditOperation(new B(r.endLineNumber,e.getLineMaxColumn(r.endLineNumber),r.endLineNumber,e.getLineMaxColumn(r.endLineNumber)),`
54
+ `+p),this.shouldAutoIndent(e,r)){const v={tokenization:{getLineTokens:w=>w===f?e.tokenization.getLineTokens(r.startLineNumber):e.tokenization.getLineTokens(w),getLanguageId:i,getLanguageIdAtPosition:n},getLineContent:w=>w===f?e.getLineContent(r.startLineNumber):e.getLineContent(w)},_=this.matchEnterRule(e,g,a,r.startLineNumber,r.startLineNumber-2);if(_!==null)_!==0&&this.getIndentEditsOfMovingBlock(e,t,r,a,h,_);else{const w=Tf(this._autoIndent,v,e.getLanguageIdAtPosition(r.startLineNumber,1),f,g,this._languageConfigurationService);if(w!==null){const S=Rs(e.getLineContent(r.startLineNumber)),D=vo(w,a),E=vo(S,a);if(D!==E){const R=D-E;this.getIndentEditsOfMovingBlock(e,t,r,a,h,R)}}}}}this._selectionId=t.trackSelection(r)}buildIndentConverter(e,t,i){return{shiftIndent:n=>ag.shiftIndent(n,n.length+1,e,t,i),unshiftIndent:n=>ag.unshiftIndent(n,n.length+1,e,t,i)}}parseEnterResult(e,t,i,n,s){if(s){let r=s.indentation;s.indentAction===Rm.None||s.indentAction===Rm.Indent?r=s.indentation+s.appendText:s.indentAction===Rm.IndentOutdent?r=s.indentation:s.indentAction===Rm.Outdent&&(r=t.unshiftIndent(s.indentation)+s.appendText);const a=e.getLineContent(n);if(this.trimStart(a).indexOf(this.trimStart(r))>=0){const c=Rs(e.getLineContent(n));let h=Rs(r);const g=dP(e,n,this._languageConfigurationService);g!==null&&g&2&&(h=t.unshiftIndent(h));const f=vo(h,i),p=vo(c,i);return f-p}}return null}matchEnterRuleMovingDown(e,t,i,n,s,r){if(f_(r)>=0){const a=e.getLineMaxColumn(s),c=cw(this._autoIndent,e,new B(s,a,s,a),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,c)}else{let a=n-1;for(;a>=1;){const g=e.getLineContent(a);if(f_(g)>=0)break;a--}if(a<1||n>e.getLineCount())return null;const c=e.getLineMaxColumn(a),h=cw(this._autoIndent,e,new B(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 g;if(a===s&&r!==void 0?g=r:g=e.getLineContent(a),f_(g)>=0)break;a--}if(a<1||n>e.getLineCount())return null;const c=e.getLineMaxColumn(a),h=cw(this._autoIndent,e,new B(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=Rs(c),f=vo(h,n)+r,p=Bf(f,n,s);p!==h&&(t.addEditOperation(new B(a,1,a,h.length+1),p),a===i.endLineNumber&&i.endColumn<=h.length+1&&p===""&&(this._moveEndLineSelectionShrink=!0))}}computeCursorState(e,t){let i=t.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(i=i.setEndPosition(i.endLineNumber+1,1)),this._moveEndLineSelectionShrink&&i.startLineNumber<i.endLineNumber&&(i=i.setEndPosition(i.endLineNumber,2)),i}};mx=K6([G6(3,ws)],mx);const ku=class ku{static getCollator(){return ku._COLLATOR||(ku._COLLATOR=new Intl.Collator),ku._COLLATOR}constructor(e,t){this.selection=e,this.descending=t,this.selectionId=null}getEditOperations(e,t){const i=Z6(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=PN(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}};ku._COLLATOR=null;let xp=ku;function PN(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(xp.getCollator().compare),t===!0&&(r=r.reverse()),{startLineNumber:i,endLineNumber:n,before:s,after:r}}function Z6(o,e,t){const i=PN(o,e,t);return i?Kn.replace(new B(i.startLineNumber,1,i.endLineNumber,o.getLineMaxColumn(i.endLineNumber)),i.after.join(`
55
+ `)):null}class TN extends Se{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)=>B.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 EN(r.selection,this.down,r.ignore));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class X6 extends TN{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:y("lines.copyUp","Copy Line Up"),alias:"Copy Line Up",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:lt.MenubarSelectionMenu,group:"2_line",title:y({key:"miCopyLinesUp",comment:["&& denotes a mnemonic"]},"&&Copy Line Up"),order:1}})}}class Y6 extends TN{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:y("lines.copyDown","Copy Line Down"),alias:"Copy Line Down",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:lt.MenubarSelectionMenu,group:"2_line",title:y({key:"miCopyLinesDown",comment:["&& denotes a mnemonic"]},"Co&&py Line Down"),order:2}})}}class J6 extends Se{constructor(){super({id:"editor.action.duplicateSelection",label:y("duplicateSelection","Duplicate Selection"),alias:"Duplicate Selection",precondition:M.writable,menuOpts:{menuId:lt.MenubarSelectionMenu,group:"2_line",title:y({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 EN(a,!0));else{const c=new Xt(a.endLineNumber,a.endColumn,a.endLineNumber,a.endColumn);n.push(new O2(c,r.getValueInRange(a)))}t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}class MN extends Se{constructor(e,t){super(t),this.down=e}run(e,t){const i=e.get(ws),n=[],s=t.getSelections()||[],r=t.getOption(12);for(const a of s)n.push(new mx(a,this.down,r,i));t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}class Q6 extends MN{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:y("lines.moveUp","Move Line Up"),alias:"Move Line Up",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:lt.MenubarSelectionMenu,group:"2_line",title:y({key:"miMoveLinesUp",comment:["&& denotes a mnemonic"]},"Mo&&ve Line Up"),order:3}})}}class eU extends MN{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:y("lines.moveDown","Move Line Down"),alias:"Move Line Down",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:lt.MenubarSelectionMenu,group:"2_line",title:y({key:"miMoveLinesDown",comment:["&& denotes a mnemonic"]},"Move &&Line Down"),order:4}})}}class NN extends Se{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 Xt(1,1,i.getLineCount(),i.getLineMaxColumn(i.getLineCount()))]);for(const r of n)if(!xp.canRun(t.getModel(),r,this.descending))return;const s=[];for(let r=0,a=n.length;r<a;r++)s[r]=new xp(n[r],this.descending);t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class tU extends NN{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:y("lines.sortAscending","Sort Lines Ascending"),alias:"Sort Lines Ascending",precondition:M.writable})}}class iU extends NN{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:y("lines.sortDescending","Sort Lines Descending"),alias:"Sort Lines Descending",precondition:M.writable})}}class nU extends Se{constructor(){super({id:"editor.action.removeDuplicateLines",label:y("lines.deleteDuplicates","Delete Duplicate Lines"),alias:"Delete Duplicate Lines",precondition:M.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 Xt(1,1,i.getLineCount(),i.getLineMaxColumn(i.getLineCount()))],a=!1);for(const h of c){const g=new Set,f=[];for(let w=h.startLineNumber;w<=h.endLineNumber;w++){const S=i.getLineContent(w);g.has(S)||(f.push(S),g.add(S))}const p=new Xt(h.startLineNumber,1,h.endLineNumber,i.getLineMaxColumn(h.endLineNumber)),v=h.startLineNumber-r,_=new Xt(v,1,v+f.length-1,f[f.length-1].length);n.push(Kn.replace(p,f.join(`
56
+ `))),s.push(_),r+=h.endLineNumber-h.startLineNumber+1-f.length}t.pushUndoStop(),t.executeEdits(this.id,n,a?s:void 0),t.pushUndoStop()}}const Nb=class Nb extends Se{constructor(){super({id:Nb.ID,label:y("lines.trimTrailingWhitespace","Trim Trailing Whitespace"),alias:"Trim Trailing Whitespace",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:cs(2089,2102),weight:100}})}run(e,t,i){let n=[];i.reason==="auto-save"&&(n=(t.getSelections()||[]).map(g=>new Dt(g.positionLineNumber,g.positionColumn)));const s=t.getSelection();if(s===null)return;const r=e.get(Tn),a=t.getModel(),c=r.getValue("files.trimTrailingWhitespaceInRegexAndStrings",{overrideIdentifier:a==null?void 0:a.getLanguageId(),resource:a==null?void 0:a.uri}),h=new $6(s,n,c);t.pushUndoStop(),t.executeCommands(this.id,[h]),t.pushUndoStop()}};Nb.ID="editor.action.trimTrailingWhitespace";let _x=Nb;class sU extends Se{constructor(){super({id:"editor.action.deleteLines",label:y("lines.delete","Delete Line"),alias:"Delete Line",precondition:M.writable,kbOpts:{kbExpr:M.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 g=i[c];let f=g.startLineNumber,p=g.endLineNumber,v=1,_=n.getLineMaxColumn(p);p<n.getLineCount()?(p+=1,_=1):f>1&&(f-=1,v=n.getLineMaxColumn(f)),r.push(Kn.replace(new Xt(f,v,p,_),"")),a.push(new Xt(f-s,g.positionColumn,f-s,g.positionColumn)),s+=g.endLineNumber-g.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 oU extends Se{constructor(){super({id:"editor.action.indentLines",label:y("lines.indent","Indent Line"),alias:"Indent Line",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:2142,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,F2.indent(i.cursorConfig,t.getModel(),t.getSelections())),t.pushUndoStop())}}class rU extends Se{constructor(){super({id:"editor.action.outdentLines",label:y("lines.outdent","Outdent Line"),alias:"Outdent Line",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:2140,weight:100}})}run(e,t){g_.Outdent.runEditorCommand(e,t,null)}}class aU extends Se{constructor(){super({id:"editor.action.insertLineBefore",label:y("lines.insertBefore","Insert Line Above"),alias:"Insert Line Above",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:3075,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,hP.lineInsertBefore(i.cursorConfig,t.getModel(),t.getSelections())))}}class lU extends Se{constructor(){super({id:"editor.action.insertLineAfter",label:y("lines.insertAfter","Insert Line Below"),alias:"Insert Line Below",precondition:M.writable,kbOpts:{kbExpr:M.editorTextFocus,primary:2051,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,hP.lineInsertAfter(i.cursorConfig,t.getModel(),t.getSelections())))}}class RN extends Se{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 g=n[c],f=n[c+1];B.intersectRanges(g,f)===null?s.push(g):n[c+1]=B.plusRange(g,f)}s.push(n[n.length-1]);const r=this._getEndCursorState(i,s),a=s.map(c=>Kn.replace(c,""));t.pushUndoStop(),t.executeEdits(this.id,a,r),t.pushUndoStop()}}class cU extends RN{constructor(){super({id:"deleteAllLeft",label:y("lines.deleteAllLeft","Delete All Left"),alias:"Delete All Left",precondition:M.writable,kbOpts:{kbExpr:M.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 Xt(c,r.startColumn,c,r.startColumn)}else a=new Xt(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(B.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 B(r,a,s.startLineNumber,1)}else return new B(s.startLineNumber,1,s.startLineNumber,s.startColumn);else return new B(s.startLineNumber,1,s.endLineNumber,s.endColumn)}),i)}}class dU extends RN{constructor(){super({id:"deleteAllRight",label:y("lines.deleteAllRight","Delete All Right"),alias:"Delete All Right",precondition:M.writable,kbOpts:{kbExpr:M.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 Xt(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 B(s.startLineNumber,s.startColumn,s.startLineNumber+1,1):new B(s.startLineNumber,s.startColumn,s.startLineNumber,r)}return s});return n.sort(B.compareRangesUsingStarts),n}}class hU extends Se{constructor(){super({id:"editor.action.joinLines",label:y("lines.joinLines","Join Lines"),alias:"Join Lines",precondition:M.writable,kbOpts:{kbExpr:M.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(B.compareRangesUsingStarts);const s=[],r=i.reduce((p,v)=>p.isEmpty()?p.endLineNumber===v.startLineNumber?(n.equalsSelection(p)&&(n=v),v):v.startLineNumber>p.endLineNumber+1?(s.push(p),v):new Xt(p.startLineNumber,p.startColumn,v.endLineNumber,v.endColumn):v.startLineNumber>p.endLineNumber?(s.push(p),v):new Xt(p.startLineNumber,p.startColumn,v.endLineNumber,v.endColumn));s.push(r);const a=t.getModel();if(a===null)return;const c=[],h=[];let g=n,f=0;for(let p=0,v=s.length;p<v;p++){const _=s[p],w=_.startLineNumber,S=1;let D=0,E,R;const z=a.getLineLength(_.endLineNumber)-_.endColumn;if(_.isEmpty()||_.startLineNumber===_.endLineNumber){const X=_.getStartPosition();X.lineNumber<a.getLineCount()?(E=w+1,R=a.getLineMaxColumn(E)):(E=X.lineNumber,R=a.getLineMaxColumn(X.lineNumber))}else E=_.endLineNumber,R=a.getLineMaxColumn(E);let H=a.getLineContent(w);for(let X=w+1;X<=E;X++){const me=a.getLineContent(X),Le=a.getLineFirstNonWhitespaceColumn(X);if(Le>=1){let je=!0;H===""&&(je=!1),je&&(H.charAt(H.length-1)===" "||H.charAt(H.length-1)===" ")&&(je=!1,H=H.replace(/[\s\uFEFF\xA0]+$/g," "));const Ce=me.substr(Le-1);H+=(je?" ":"")+Ce,je?D=Ce.length+1:D=Ce.length}else D=0}const ee=new B(w,S,E,R);if(!ee.isEmpty()){let X;_.isEmpty()?(c.push(Kn.replace(ee,H)),X=new Xt(ee.startLineNumber-f,H.length-D+1,w-f,H.length-D+1)):_.startLineNumber===_.endLineNumber?(c.push(Kn.replace(ee,H)),X=new Xt(_.startLineNumber-f,_.startColumn,_.endLineNumber-f,_.endColumn)):(c.push(Kn.replace(ee,H)),X=new Xt(_.startLineNumber-f,_.startColumn,_.startLineNumber-f,H.length-z)),B.intersectRanges(ee,n)!==null?g=X:h.push(X)}f+=ee.endLineNumber-ee.startLineNumber}h.unshift(g),t.pushUndoStop(),t.executeEdits(this.id,c,h),t.pushUndoStop()}}class uU extends Se{constructor(){super({id:"editor.action.transpose",label:y("editor.transpose","Transpose Characters around the Cursor"),alias:"Transpose Characters around the Cursor",precondition:M.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(),g=n.getLineMaxColumn(h.lineNumber);if(h.column>=g){if(h.lineNumber===n.getLineCount())continue;const f=new B(h.lineNumber,Math.max(1,h.column-1),h.lineNumber+1,1),p=n.getValueInRange(f).split("").reverse().join("");s.push(new $p(new Xt(h.lineNumber,Math.max(1,h.column-1),h.lineNumber+1,1),p))}else{const f=new B(h.lineNumber,Math.max(1,h.column-1),h.lineNumber,h.column+1),p=n.getValueInRange(f).split("").reverse().join("");s.push(new EE(f,p,new Xt(h.lineNumber,h.column+1,h.lineNumber,h.column+1)))}}t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class Nh extends Se{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 g=new B(c.lineNumber,h.startColumn,c.lineNumber,h.endColumn),f=n.getValueInRange(g);r.push(Kn.replace(g,this._modifyText(f,s)))}else{const c=n.getValueInRange(a);r.push(Kn.replace(a,this._modifyText(c,s)))}t.pushUndoStop(),t.executeEdits(this.id,r),t.pushUndoStop()}}class gU extends Nh{constructor(){super({id:"editor.action.transformToUppercase",label:y("editor.transformToUppercase","Transform to Uppercase"),alias:"Transform to Uppercase",precondition:M.writable})}_modifyText(e,t){return e.toLocaleUpperCase()}}class fU extends Nh{constructor(){super({id:"editor.action.transformToLowercase",label:y("editor.transformToLowercase","Transform to Lowercase"),alias:"Transform to Lowercase",precondition:M.writable})}_modifyText(e,t){return e.toLocaleLowerCase()}}class gl{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 Rb=class Rb extends Nh{constructor(){super({id:"editor.action.transformToTitlecase",label:y("editor.transformToTitlecase","Transform to Title Case"),alias:"Transform to Title Case",precondition:M.writable})}_modifyText(e,t){const i=Rb.titleBoundary.get();return i?e.toLocaleLowerCase().replace(i,n=>n.toLocaleUpperCase()):e}};Rb.titleBoundary=new gl("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu");let Ov=Rb;const Iu=class Iu extends Nh{constructor(){super({id:"editor.action.transformToSnakecase",label:y("editor.transformToSnakecase","Transform to Snake Case"),alias:"Transform to Snake Case",precondition:M.writable})}_modifyText(e,t){const i=Iu.caseBoundary.get(),n=Iu.singleLetters.get();return!i||!n?e:e.replace(i,"$1_$2").replace(n,"$1_$2$3").toLocaleLowerCase()}};Iu.caseBoundary=new gl("(\\p{Ll})(\\p{Lu})","gmu"),Iu.singleLetters=new gl("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu");let zf=Iu;const Ab=class Ab extends Nh{constructor(){super({id:"editor.action.transformToCamelcase",label:y("editor.transformToCamelcase","Transform to Camel Case"),alias:"Transform to Camel Case",precondition:M.writable})}_modifyText(e,t){const i=Ab.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("")}};Ab.wordBoundary=new gl("[_\\s-]","gm");let Fv=Ab;const Du=class Du extends Nh{constructor(){super({id:"editor.action.transformToPascalcase",label:y("editor.transformToPascalcase","Transform to Pascal Case"),alias:"Transform to Pascal Case",precondition:M.writable})}_modifyText(e,t){const i=Du.wordBoundary.get(),n=Du.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("")}};Du.wordBoundary=new gl("[_\\s-]","gm"),Du.wordBoundaryToMaintain=new gl("(?<=\\.)","gm");let Hv=Du;const $l=class $l extends Nh{static isSupported(){return[this.caseBoundary,this.singleLetters,this.underscoreBoundary].every(t=>t.isSupported())}constructor(){super({id:"editor.action.transformToKebabcase",label:y("editor.transformToKebabcase","Transform to Kebab Case"),alias:"Transform to Kebab Case",precondition:M.writable})}_modifyText(e,t){const i=$l.caseBoundary.get(),n=$l.singleLetters.get(),s=$l.underscoreBoundary.get();return!i||!n||!s?e:e.replace(s,"$1-$3").replace(i,"$1-$2").replace(n,"$1-$2").toLocaleLowerCase()}};$l.caseBoundary=new gl("(\\p{Ll})(\\p{Lu})","gmu"),$l.singleLetters=new gl("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu"),$l.underscoreBoundary=new gl("(\\S)(_)(\\S)","gm");let Wv=$l;se(X6);se(Y6);se(J6);se(Q6);se(eU);se(tU);se(iU);se(nU);se(_x);se(sU);se(oU);se(rU);se(aU);se(lU);se(cU);se(dU);se(hU);se(uU);se(gU);se(fU);zf.caseBoundary.isSupported()&&zf.singleLetters.isSupported()&&se(zf);Fv.wordBoundary.isSupported()&&se(Fv);Hv.wordBoundary.isSupported()&&se(Hv);Ov.titleBoundary.isSupported()&&se(Ov);Wv.isSupported()&&se(Wv);var pU=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},t_=function(o,e){return function(t,i){e(t,i,o)}},E_;const AN=new Ri("LinkedEditingInputVisible",!1),mU="linked-editing-decoration";var yc;let Lg=(yc=class extends Ve{static get(e){return e.getContribution(E_.ID)}constructor(e,t,i,n,s){super(),this.languageConfigurationService=n,this._syncRangesToken=0,this._localToDispose=this._register(new Be),this._editor=e,this._providers=i.linkedEditingRangeProvider,this._enabled=!1,this._visibleContextKey=AN.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 Be),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(ps.runAndSubscribe(t.onDidChangeLanguageConfiguration,()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(t.getLanguageId()).getWordDefinition()}));const n=new Lc(this._debounceInformation.get(t)),s=()=>{this._rangeUpdateTriggerPromise=n.trigger(()=>this.updateRanges(),this._debounceDuration??this._debounceInformation.get(t))},r=new Lc(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(g=>h.intersectRanges(g.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),g=n,f=c.startColumn,p=c.endColumn;const v=nm(h,g);f+=v,h=h.substr(v),g=g.substr(v);const _=H2(h,g);p-=_,h=h.substr(0,h.length-_),g=g.substr(0,g.length-_),(f!==p||g.length!==0)&&s.push({range:new B(c.startLineNumber,f,c.endLineNumber,p),text:g})}}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 Is;try{const r=new Lo(!1),a=await ON(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 f=0,p=c.length;f<p;f++)if(B.containsPosition(c[f],t)){if(h=!0,f!==0){const v=c[f];c.splice(f,1),c.unshift(v)}break}if(!h){this.clearRanges();return}const g=c.map(f=>({range:f,options:E_.DECORATION}));this._visibleContextKey.set(!0),this._currentDecorations.set(g),this._syncRangesToken++}catch(r){Nc(r)||mn(r),(this._currentRequestCts===s||!this._currentRequestCts)&&this.clearRanges()}}},E_=yc,yc.ID="editor.contrib.linkedEditing",yc.DECORATION=ki.register({description:"linked-editing",stickiness:0,className:mU}),yc);Lg=E_=pU([t_(1,$i),t_(2,Et),t_(3,ws),t_(4,nr)],Lg);class _U extends Se{constructor(){super({id:"editor.action.linkedEditing",label:y("linkedEditing.label","Start Linked Editing"),alias:"Start Linked Editing",precondition:le.and(M.writable,M.hasRenameProvider),kbOpts:{kbExpr:M.editorTextFocus,primary:3132,weight:100}})}runCommand(e,t){const i=e.get(os),[n,s]=Array.isArray(t)&&t||[void 0,void 0];return un.isUri(n)&&Dt.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))))},mn):super.runCommand(e,t)}run(e,t){const i=Lg.get(t);return i?Promise.resolve(i.updateRanges(!0)):Promise.resolve()}}const vU=go.bindToContribution(Lg.get);Tt(new vU({id:"cancelLinkedEditingInput",precondition:AN,handler:o=>o.clearRanges(),kbOpts:{kbExpr:M.editorTextFocus,weight:199,primary:9,secondary:[1033]}}));function ON(o,e,t,i){const n=o.ordered(e);return J0(n.map(s=>async()=>{try{return await s.provideLinkedEditingRanges(e,t,i)}catch(r){ss(r);return}}),s=>!!s&&Fo(s==null?void 0:s.ranges))}St("editor.linkedEditingBackground",{dark:xi.fromHex("#f00").transparent(.3),light:xi.fromHex("#f00").transparent(.3),hcDark:xi.fromHex("#f00").transparent(.3),hcLight:xi.white},y("editorLinkedEditingBackground","Background color when the editor auto renames on type."));fo("_executeLinkedEditingProvider",(o,e,t)=>{const{linkedEditingRangeProvider:i}=o.get(Et);return ON(i,e,t,gi.None)});_i(Lg.ID,Lg,1);se(_U);let bU=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 Bv{constructor(e){this._disposables=new Be;let t=[];for(const[i,n]of e){const s=i.links.map(r=>new bU(r,n));t=Bv._union(t,s),XE(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(B.areIntersectingOrTouching(c.range,h.range)){n++;continue}B.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 FN(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])},ss));return Promise.all(n).then(()=>{const s=new Bv(fl(i));return t.isCancellationRequested?(s.dispose(),new Bv([])):s})}Sn.registerCommand("_executeLinkProvider",async(o,...e)=>{let[t,i]=e;Gi(t instanceof un),typeof i!="number"&&(i=0);const{linkProvider:n}=o.get(Et),s=o.get(eo).getModel(t);if(!s)return[];const r=await FN(n,s,gi.None);if(!r)return[];for(let c=0;c<Math.min(i,r.links.length);c++)await r.links[c].resolve(gi.None);const a=r.links.slice(0);return r.dispose(),a});var yU=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},i_=function(o,e){return function(t,i){e(t,i,o)}},vx,Ud;let Lp=(Ud=class extends Ve{static get(e){return e.getContribution(vx.ID)}constructor(e,t,i,n,s){super(),this.editor=e,this.openerService=t,this.notificationService=i,this.languageFeaturesService=n,this.providers=this.languageFeaturesService.linkProvider,this.debounceInformation=s.for(this.providers,"Links",{min:1e3,max:4e3}),this.computeLinks=this._register(new ms(()=>this.computeLinksNow(),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;const r=this._register(new My(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=ks(t=>FN(this.providers,e,t));try{const t=new Lo(!1);if(this.activeLinksList=await this.computePromise,this.debounceInformation.update(e,t.elapsed()),e.isDisposed())return;this.updateDecorations(this.activeLinksList.links)}catch(t){mn(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(Mu.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 g=new Mu(e[c],a[c]);this.currentOccurrences[g.decorationId]=g}})}_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(gi.None).then(s=>{if(typeof s=="string"&&this.editor.hasModel()){const r=this.editor.getModel().uri;if(r.scheme===ro.file&&s.startsWith(`${ro.file}:`)){const a=un.parse(s);if(a.scheme===ro.file){const c=W2(a);let h=null;c.startsWith("/./")||c.startsWith("\\.\\")?h=`.${c.substr(1)}`:(c.startsWith("//./")||c.startsWith("\\\\.\\"))&&(h=`.${c.substr(2)}`),h&&(s=B2(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(y("invalid.url","Failed to open this link because it is not well-formed: {0}",n.url.toString())):r==="missing"?this.notificationService.warn(y("missing.url","Failed to open this link because its target is missing.")):mn(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()}},vx=Ud,Ud.ID="editor.linkDetector",Ud);Lp=vx=yU([i_(1,oa),i_(2,Qs),i_(3,Et),i_(4,nr)],Lp);const tD={general:ki.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),active:ki.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"})};class Mu{static decoration(e,t){return{range:e.range,options:Mu._getOptions(e,t,!1)}}static _getOptions(e,t,i){const n={...i?tD.active:tD.general};return n.hoverMessage=wU(e,t),n}constructor(e,t){this.link=e,this.decorationId=t}activate(e,t){e.changeDecorationOptions(this.decorationId,Mu._getOptions(this.link,t,!0))}deactivate(e,t){e.changeDecorationOptions(this.decorationId,Mu._getOptions(this.link,t,!1))}}function wU(o,e){const t=o.url&&/^command:/i.test(o.url.toString()),i=o.tooltip?o.tooltip:t?y("links.navigate.executeCmd","Execute command"):y("links.navigate.follow","Follow link"),n=e?Fa?y("links.navigate.kb.meta.mac","cmd + click"):y("links.navigate.kb.meta","ctrl + click"):Fa?y("links.navigate.kb.alt.mac","option + click"):y("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=y("tooltip.explanation","Execute command {0}",c)}}return new $s("",!0).appendLink(o.url.toString(!0).replace(/ /g,"%20"),i,s).appendMarkdown(` (${n})`)}else return new $s().appendText(`${i} (${n})`)}class SU extends Se{constructor(){super({id:"editor.action.openLink",label:y("label","Open Link"),alias:"Open Link",precondition:void 0})}run(e,t){const i=Lp.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)}}}_i(Lp.ID,Lp,1);se(SU);const SL=class SL extends Ve{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})}))}};SL.ID="editor.contrib.longLinesHelper";let zv=SL;_i(zv.ID,zv,2);const CU=St("editor.wordHighlightBackground",{dark:"#575757B8",light:"#57575740",hcDark:null,hcLight:null},y("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);St("editor.wordHighlightStrongBackground",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},y("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);St("editor.wordHighlightTextBackground",CU,y("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 xU=St("editor.wordHighlightBorder",{light:null,dark:null,hcDark:oh,hcLight:oh},y("wordHighlightBorder","Border color of a symbol during read-access, like reading a variable."));St("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:oh,hcLight:oh},y("wordHighlightStrongBorder","Border color of a symbol during write-access, like writing to a variable."));St("editor.wordHighlightTextBorder",xU,y("wordHighlightTextBorder","Border color of a textual occurrence for a symbol."));const LU=St("editorOverviewRuler.wordHighlightForeground","#A0A0A0CC",y("overviewRulerWordHighlightForeground","Overview ruler marker color for symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),kU=St("editorOverviewRuler.wordHighlightStrongForeground","#C0A0C0CC",y("overviewRulerWordHighlightStrongForeground","Overview ruler marker color for write-access symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),IU=St("editorOverviewRuler.wordHighlightTextForeground",uP,y("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),DU=ki.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:hs(kU),position:Ma.Center},minimap:{color:hs(gy),position:1}}),EU=ki.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:hs(IU),position:Ma.Center},minimap:{color:hs(gy),position:1}}),PU=ki.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:hs(uP),position:Ma.Center},minimap:{color:hs(gy),position:1}}),TU=ki.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),MU=ki.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:hs(LU),position:Ma.Center},minimap:{color:hs(gy),position:1}});function NU(o){return o===q_.Write?DU:o===q_.Text?EU:MU}function RU(o){return o?TU:PU}ny((o,e)=>{const t=o.getColor(z2);t&&e.addRule(`.monaco-editor .selectionHighlight { background-color: ${t.transparent(.5)}; }`)});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},OU=function(o,e){return function(t,i){e(t,i,o)}},bx;function Ac(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?y("cursorAdded","Cursor added: {0}",i):y("cursorsAdded","Cursors added: {0}",i);tg(n)}}class FU extends Se{constructor(){super({id:"editor.action.insertCursorAbove",label:y("mutlicursor.insertAbove","Add Cursor Above"),alias:"Add Cursor Above",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:lt.MenubarSelectionMenu,group:"3_multi",title:y({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,Y0.addCursorUp(s,r,n)),s.revealTopMostCursor(i.source),Ac(r,s.getCursorStates())}}class HU extends Se{constructor(){super({id:"editor.action.insertCursorBelow",label:y("mutlicursor.insertBelow","Add Cursor Below"),alias:"Add Cursor Below",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:lt.MenubarSelectionMenu,group:"3_multi",title:y({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,Y0.addCursorDown(s,r,n)),s.revealBottomMostCursor(i.source),Ac(r,s.getCursorStates())}}class WU extends Se{constructor(){super({id:"editor.action.insertCursorAtEndOfEachLineSelected",label:y("mutlicursor.insertAtEndOfEachLineSelected","Add Cursors to Line Ends"),alias:"Add Cursors to Line Ends",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:lt.MenubarSelectionMenu,group:"3_multi",title:y({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 Xt(n,s,n,s))}e.endColumn>1&&i.push(new Xt(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),Ac(r,s.getCursorStates())}}class BU extends Se{constructor(){super({id:"editor.action.addCursorsToBottom",label:y("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 Xt(c,i[0].startColumn,c,i[0].endColumn));const r=t._getViewModel(),a=r.getCursorStates();s.length>0&&t.setSelections(s),Ac(a,r.getCursorStates())}}class zU extends Se{constructor(){super({id:"editor.action.addCursorsToTop",label:y("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 Xt(a,i[0].startColumn,a,i[0].endColumn));const s=t._getViewModel(),r=s.getCursorStates();n.length>0&&t.setSelections(n),Ac(r,s.getCursorStates())}}class n_{constructor(e,t,i){this.selections=e,this.revealRange=t,this.revealScrollType=i}}class kp{static create(e,t){if(!e.hasModel())return null;const i=t.getState();if(!e.hasTextFocus()&&i.isRevealed&&i.searchString.length>0)return new kp(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,g=null;if(c.isEmpty()){const f=e.getConfiguredWordAtPosition(c.getStartPosition());if(!f)return null;h=f.word,g=new Xt(c.startLineNumber,f.startColumn,c.startLineNumber,f.endColumn)}else h=e.getModel().getValueInRange(c).replace(/\r\n/g,`
57
+ `);return new kp(e,t,n,h,s,r,g)}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 n_(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 n_(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 Xt(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 n_(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 n_(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 Xt(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 Ob=class Ob extends Ve{static get(e){return e.getContribution(Ob.ID)}constructor(e){super(),this._sessionDispose=this._register(new Be),this._editor=e,this._ignoreSelectionChange=!1,this._session=null}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(e){if(!this._session){const t=kp.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 Xt(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(!HN(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 Xt(s.range.startLineNumber,s.range.startColumn,s.range.endLineNumber,s.range.endColumn)))}}};Ob.ID="editor.contrib.multiCursorController";let kg=Ob;class Bg extends Se{run(e,t){const i=kg.get(t);if(!i)return;const n=t._getViewModel();if(n){const s=n.getCursorStates(),r=ho.get(t);if(r)this._run(i,r);else{const a=e.get(ai).createInstance(ho,t);this._run(i,a),a.dispose()}Ac(s,n.getCursorStates())}}}class VU extends Bg{constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:y("addSelectionToNextFindMatch","Add Selection To Next Find Match"),alias:"Add Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:2082,weight:100},menuOpts:{menuId:lt.MenubarSelectionMenu,group:"3_multi",title:y({key:"miAddSelectionToNextFindMatch",comment:["&& denotes a mnemonic"]},"Add &&Next Occurrence"),order:5}})}_run(e,t){e.addSelectionToNextFindMatch(t)}}class jU extends Bg{constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:y("addSelectionToPreviousFindMatch","Add Selection To Previous Find Match"),alias:"Add Selection To Previous Find Match",precondition:void 0,menuOpts:{menuId:lt.MenubarSelectionMenu,group:"3_multi",title:y({key:"miAddSelectionToPreviousFindMatch",comment:["&& denotes a mnemonic"]},"Add P&&revious Occurrence"),order:6}})}_run(e,t){e.addSelectionToPreviousFindMatch(t)}}class UU extends Bg{constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:y("moveSelectionToNextFindMatch","Move Last Selection To Next Find Match"),alias:"Move Last Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:cs(2089,2082),weight:100}})}_run(e,t){e.moveSelectionToNextFindMatch(t)}}class $U extends Bg{constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:y("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 qU extends Bg{constructor(){super({id:"editor.action.selectHighlights",label:y("selectAllOccurrencesOfFindMatch","Select All Occurrences of Find Match"),alias:"Select All Occurrences of Find Match",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:3114,weight:100},menuOpts:{menuId:lt.MenubarSelectionMenu,group:"3_multi",title:y({key:"miSelectHighlights",comment:["&& denotes a mnemonic"]},"Select All &&Occurrences"),order:7}})}_run(e,t){e.selectAll(t)}}class KU extends Bg{constructor(){super({id:"editor.action.changeAll",label:y("changeAll.label","Change All Occurrences"),alias:"Change All Occurrences",precondition:le.and(M.writable,M.editorTextFocus),kbOpts:{kbExpr:M.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(e,t){e.selectAll(t)}}class GU{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(B.compareRangesUsingStarts)),this._cachedFindMatches}}var $d;let Vv=($d=class extends Ve{constructor(e,t){super(),this._languageFeaturesService=t,this.editor=e,this._isEnabled=e.getOption(109),this._decorations=e.createDecorationsCollection(),this.updateSoon=this._register(new ms(()=>this._update(),300)),this.state=null,this._register(e.onDidChangeConfiguration(n=>{this._isEnabled=e.getOption(109)})),this._register(e.onDidChangeCursorSelection(n=>{this._isEnabled&&(n.selection.isEmpty()?n.reason===3?(this.state&&this._setState(null),this.updateSoon.schedule()):this._setState(null):this._update())})),this._register(e.onDidChangeModel(n=>{this._setState(null)})),this._register(e.onDidChangeModelContent(n=>{this._isEnabled&&this.updateSoon.schedule()}));const i=ho.get(e);i&&this._register(i.getState().onFindReplaceStateChange(n=>{this._update()})),this.updateSoon.schedule()}_update(){this._setState(bx._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=kg.get(i);if(!s)return null;const r=ho.get(i);if(!r)return null;let a=s.getSession(r);if(!a){const g=i.getSelections();if(g.length>1){const p=r.getState().matchCase;if(!HN(i.getModel(),g,p))return null}a=kp.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 g=c.searchString;h||(g=g.toLowerCase());let f=a.searchText;if(h||(f=f.toLowerCase()),g===f&&a.matchCase===c.matchCase&&a.wholeWord===c.wholeWord&&!c.isRegex)return null}return new GU(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(B.compareRangesUsingStarts);const s=[];for(let h=0,g=0,f=i.length,p=n.length;h<f;){const v=i[h];if(g>=p)s.push(v),h++;else{const _=B.compareRangesUsingStarts(v,n[g]);_<0?((n[g].isEmpty()||!B.areIntersecting(v,n[g]))&&s.push(v),h++):(_>0||h++,g++)}}const r=this.editor.getOption(81)!=="off",a=this._languageFeaturesService.documentHighlightProvider.has(t)&&r,c=s.map(h=>({range:h,options:RU(a)}));this._decorations.set(c)}dispose(){this._setState(null),super.dispose()}},bx=$d,$d.ID="editor.contrib.selectionHighlighter",$d);Vv=bx=AU([OU(1,Et)],Vv);function HN(o,e,t){const i=iD(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=iD(o,r,!t);if(i!==a)return!1}return!0}function iD(o,e,t){const i=o.getValueInRange(e);return t?i.toLowerCase():i}class ZU extends Se{constructor(){super({id:"editor.action.focusNextCursor",label:y("mutlicursor.focusNextCursor","Focus Next Cursor"),metadata:{description:y("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),Ac(s,n.getCursorStates()))}}class XU extends Se{constructor(){super({id:"editor.action.focusPreviousCursor",label:y("mutlicursor.focusPreviousCursor","Focus Previous Cursor"),metadata:{description:y("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),Ac(s,n.getCursorStates()))}}_i(kg.ID,kg,4);_i(Vv.ID,Vv,1);se(FU);se(HU);se(WU);se(VU);se(jU);se(UU);se($U);se(qU);se(KU);se(BU);se(zU);se(ZU);se(XU);const YU="editor.action.inlineEdit.accept",JU="editor.action.inlineEdit.reject",QU="editor.action.inlineEdit.jumpTo",e$="editor.action.inlineEdit.jumpBack";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},i$=function(o,e){return function(t,i){e(t,i,o)}};const jw="inline-edit";let yx=class extends Ve{constructor(e,t,i){super(),this.editor=e,this.model=t,this.languageService=i,this.isDisposed=Ho(this,!1),this.currentTextModel=bo(this,this.editor.onDidChangeModel,()=>this.editor.getModel()),this.uiState=an(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(R=>R.length===0),g=[],f=[];function p(R,z){if(f.length>0){const H=f[f.length-1];z&&H.decorations.push(new rp(H.content.length+1,H.content.length+1+R[0].length,z,0)),H.content+=R[0],R=R.slice(1)}for(const H of R)f.push({content:H,decorations:z?[new rp(1,H.length+1,z,0)]:[]})}const v=s.getLineContent(r.lineNumber);let _,w=0;if(!h&&(c||!a)){for(const R of r.parts){let z=R.lines;a&&!c&&(p(z,jw),z=[]),_===void 0?(g.push({column:R.column,text:z[0],preview:R.preview}),z=z.slice(1)):p([v.substring(w,R.column-1)],void 0),z.length>0&&(p(z,jw),_===void 0&&R.column<=v.length&&(_=R.column)),w=R.column-1}_!==void 0&&p([v.substring(w)],void 0)}const S=_!==void 0?new bN(_,v.length+1):void 0,D=c||!a?r.lineNumber:a.endLineNumber-1;return{inlineTexts:g,additionalLines:f,hiddenRange:S,lineNumber:D,additionalReservedLineCount:this.model.minReservedLineCount.read(n),targetTextModel:s,range:a,isSingleLine:c,isPureRemove:h}}),this.decorations=an(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 g=s.range.startLineNumber+h,f=s.targetTextModel.getLineFirstNonWhitespaceColumn(g),p=s.targetTextModel.getLineLastNonWhitespaceColumn(g),v=new B(g,f,g,p);a.push(v)}}for(const c of a)r.push({range:c,options:Q0})}if(s.range&&!s.isSingleLine&&s.isPureRemove){const a=new B(s.range.startLineNumber,1,s.range.endLineNumber-1,1);r.push({range:a,options:e1})}for(const a of s.inlineTexts)r.push({range:B.fromPositions(new Dt(s.lineNumber,a.column)),options:{description:jw,after:{content:a.text,inlineClassName:a.preview?"inline-edit-decoration-preview":"inline-edit-decoration",cursorStops:gu.Left},showIfCollapsed:!0}});return r}),this._register(En(()=>{this.isDisposed.set(!0,void 0)})),this._register(yN(this.editor,this.decorations))}};yx=t$([i$(2,aa)],yx);var Y1=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},Ca=function(o,e){return function(t,i){e(t,i,o)}},P_;let wx=class extends Ve{constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=bo(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).showToolbar==="always"),this.sessionPosition=void 0,this.position=an(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 Dt(s.lineNumber,Math.min(r,((h=this.sessionPosition)==null?void 0:h.column)??Number.MAX_SAFE_INTEGER));return this.sessionPosition=a,a}),this._register(Jp((n,s)=>{if(!this.model.read(n)||!this.alwaysShowToolbar.read(n))return;const a=s.add(this.instantiationService.createInstance(Sx,this.editor,!0,this.position));e.addContentWidget(a),s.add(En(()=>e.removeContentWidget(a)))}))}};wx=Y1([Ca(2,ai)],wx);var wc;let Sx=(wc=class extends Ve{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${P_.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=yr("div.inlineEditHints",{className:this.withBorder?".withBorder":""},[yr("div@toolBar")]),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(lt.InlineEditActions,this._contextKeyService)),this.toolBar=this._register(n.createInstance(Cx,this.nodes.toolBar,this.editor,lt.InlineEditToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:a=>a.startsWith("primary")},actionViewItemProvider:(a,c)=>{if(a instanceof og)return n.createInstance(n$,a,void 0)},telemetrySource:"InlineEditToolbar"})),this._register(this.toolBar.onDidChangeDropdownVisibility(a=>{P_._dropDownVisible=a})),this._register(Vn(a=>{this._position.read(a),this.editor.layoutContentWidget(this)})),this._register(Vn(a=>{const c=[];for(const[h,g]of this.inlineCompletionsActionsMenus.getActions())for(const f of g)f instanceof og&&c.push(f);c.length>0&&c.unshift(new ep),this.toolBar.setAdditionalSecondaryActions(c)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}},P_=wc,wc._dropDownVisible=!1,wc.id=0,wc);Sx=P_=Y1([Ca(3,ai),Ca(4,$i),Ca(5,xh)],Sx);class n$ extends pE{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=yr("div.keybinding").root;this._register(new R0(t,A0,{disableTitle:!0,...mE})).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add("inlineEditStatusBarItemLabel")}}updateTooltip(){}}let Cx=class extends _E{constructor(e,t,i,n,s,r,a,c,h,g){super(e,{resetMenu:i,...n},s,r,a,c,h,g),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=[];z0(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){Oa(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};Cx=Y1([Ca(4,xh),Ca(5,$i),Ca(6,Eg),Ca(7,ds),Ca(8,ys),Ca(9,ra)],Cx);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},T_=function(o,e){return function(t,i){e(t,i,o)}},Sf,xx;function*s$(o,e,t=1){e===void 0&&([e,o]=[o,0]);for(let i=o;i<e;i+=t)yield i}function Uw(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 qd;let Lx=(qd=class extends Ve{static _createUniqueUri(){return un.from({scheme:"inline-edit-widget",path:new Date().toString()+String(Sf._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=an(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)),g=h.map(w=>c.getLineLastNonWhitespaceColumn(w)),f=Math.max(...g),p=h[g.indexOf(f)],v=new Dt(p,f);return{top:a.range.startLineNumber,left:v}}),this._text=an(this,r=>{const a=this._model.read(r);if(!a)return{text:"",shift:0};const c=Uw(a.text.split(`
58
+ `));return{text:c.text.join(`
59
+ `),shift:c.shift}}),this._originalModel=kc(()=>this._modelService.createModel("",null,Sf._createUniqueUri())).keepObserved(this._store),this._modifiedModel=kc(()=>this._modelService.createModel("",null,Sf._createUniqueUri())).keepObserved(this._store),this._diff=an(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=an(this,r=>{const a=this._model.read(r);if(!a)return;const c=this._editor.getModel();if(!c)return;const h=Uw(c.getValueInRange(a.range).split(`
60
+ `)).text.join(`
61
+ `),g=Uw(a.text.split(`
62
+ `)).text.join(`
63
+ `);this._originalModel.get().setValue(h),this._modifiedModel.get().setValue(g);const f=this._diffProviderFactoryService.createDiffProvider({diffAlgorithm:"advanced"});return gP.fromFn(async()=>{const p=await f.computeDiff(this._originalModel.get(),this._modifiedModel.get(),{computeMoves:!1,ignoreTrimWhitespace:!1,maxComputationTimeMs:1e3},gi.None);if(!p.identical)return p.changes})}),this._register(Jp((r,a)=>{if(!this._model.read(r)||this._position.get()===null)return;const h=a.add(this._instantiationService.createInstance(kx,this._editor,this._position,this._text.map(g=>g.text),this._text.map(g=>g.shift),this._diff));e.addOverlayWidget(h),a.add(En(()=>e.removeOverlayWidget(h)))}))}},Sf=qd,qd._modelId=0,qd);Lx=Sf=WN([T_(2,ai),T_(3,t1),T_(4,eo)],Lx);var Kd;let kx=(Kd=class extends Ve{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${xx.id++}`,this.allowEditorOverflow=!1,this._nodes=yt("div.inlineEditSideBySide",void 0),this._scrollChanged=cd("editor.onDidScrollChange",this._editor.onDidScrollChange),this._previewEditor=this._register(this._instantiationService.createInstance(Er,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=La(this._previewEditor),this._editorObs=La(this._editor),this._previewTextModel=this._register(this._instantiationService.createInstance(Yl,"",((a=this._editor.getModel())==null?void 0:a.getLanguageId())??sp,Yl.DEFAULT_CREATION_OPTIONS,null)),this._setText=an(c=>{const h=this._text.read(c);h&&this._previewTextModel.setValue(h)}).recomputeInitiallyAndOnChange(this._store),this._decorations=an(this,c=>{this._setText.read(c);const h=this._position.read(c);if(!h)return{org:[],mod:[]};const g=this._diff.read(c);if(!g)return{org:[],mod:[]};const f=[],p=[];if(g.length===1&&g[0].innerChanges[0].modifiedRange.equalsRange(this._previewTextModel.getFullModelRange()))return{org:[],mod:[]};const v=this._shift.get(),_=w=>new B(w.startLineNumber+h.top-1,w.startColumn+v,w.endLineNumber+h.top-1,w.endColumn+v);for(const w of g)if(w.original.isEmpty||f.push({range:_(w.original.toInclusiveRange()),options:e1}),w.modified.isEmpty||p.push({range:w.modified.toInclusiveRange(),options:fP}),w.modified.isEmpty||w.original.isEmpty)w.original.isEmpty||f.push({range:_(w.original.toInclusiveRange()),options:pP}),w.modified.isEmpty||p.push({range:w.modified.toInclusiveRange(),options:mP});else for(const S of w.innerChanges||[])w.original.contains(S.originalRange.startLineNumber)&&f.push({range:_(S.originalRange),options:S.originalRange.isEmpty()?_P:Q0}),w.modified.contains(S.modifiedRange.startLineNumber)&&p.push({range:S.modifiedRange,options:S.modifiedRange.isEmpty()?vP:bP});return{org:f,mod:p}}),this._originalDecorations=an(this,c=>this._decorations.read(c).org),this._modifiedDecorations=an(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(Vn(c=>{const h=this._previewEditorObs.contentWidth.read(c),g=this._text.read(c).split(`
64
+ `).length-1,f=this._editor.getOption(67)*g;h<=0||this._previewEditor.layout({height:f,width:h})})),this._register(Vn(c=>{this._position.read(c),this._editor.layoutOverlayWidget(this)})),this._register(Vn(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 Dt(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}}}},xx=Kd,Kd.id=0,Kd);kx=xx=WN([T_(5,ai)],kx);var o$=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Vc=function(o,e){return function(t,i){e(t,i,o)}},Cf,Qo;let Zs=(Qo=class extends Ve{static get(e){return e.getContribution(Cf.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=Cf.inlineEditVisibleContext.bindTo(this.contextKeyService),this._isCursorAtInlineEditContext=Cf.cursorAtInlineEditContext.bindTo(this.contextKeyService),this._currentEdit=Ho(this,void 0),this._currentWidget=kc(this._currentEdit,_=>{const w=this._currentEdit.read(_);if(!w)return;const S=w.range.endLineNumber,D=w.range.endColumn,E=w.text.endsWith(`
65
+ `)&&!(w.range.startLineNumber===w.range.endLineNumber&&w.range.startColumn===w.range.endColumn)?w.text.slice(0,-1):w.text,R=new yp(S,[new wv(D,E,!1)]),z=w.range.startLineNumber===w.range.endLineNumber&&R.parts.length===1&&R.parts[0].lines.length===1,H=w.text==="";return!z&&!H?void 0:this.instantiationService.createInstance(yx,this.editor,{ghostText:sl(R),minReservedLineCount:sl(0),targetTextModel:sl(this.editor.getModel()??void 0),range:sl(w.range)})}),this._isAccepting=Ho(this,!1),this._enabled=bo(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).enabled),this._fontFamily=bo(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).fontFamily);const h=cd("InlineEditController.modelContentChangedSignal",e.onDidChangeModelContent);this._register(Vn(_=>{this._enabled.read(_)&&(h.read(_),!this._isAccepting.read(_)&&this.getInlineEdit(e,!0))}));const g=bo(this,e.onDidChangeCursorPosition,()=>e.getPosition());this._register(Vn(_=>{if(!this._enabled.read(_))return;const w=g.read(_);w&&this.checkCursorPosition(w)})),this._register(Vn(_=>{const w=this._currentEdit.read(_);if(this._isCursorAtInlineEditContext.set(!1),!w){this._isVisibleContext.set(!1);return}this._isVisibleContext.set(!0);const S=e.getPosition();S&&this.checkCursorPosition(S)}));const f=cd("InlineEditController.editorBlurSignal",e.onDidBlurEditorWidget);this._register(Vn(async _=>{var w;this._enabled.read(_)&&(f.read(_),!(this._configurationService.getValue("editor.experimentalInlineEdit.keepOnBlur")||e.getOption(63).keepOnBlur)&&((w=this._currentRequestCts)==null||w.dispose(!0),this._currentRequestCts=void 0,await this.clear(!1)))}));const p=cd("InlineEditController.editorFocusSignal",e.onDidFocusEditorText);this._register(Vn(_=>{this._enabled.read(_)&&(p.read(_),this.getInlineEdit(e,!0))}));const v=this._register(VE());this._register(Vn(_=>{const w=this._fontFamily.read(_);v.setStyle(w===""||w==="default"?"":`
66
+ .monaco-editor .inline-edit-decoration,
67
+ .monaco-editor .inline-edit-decoration-preview,
68
+ .monaco-editor .inline-edit {
69
+ font-family: ${w};
70
+ }`)})),this._register(new wx(this.editor,this._currentWidget,this.instantiationService)),this._register(new Lx(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(B.containsPosition(t.range,e))}validateInlineEdit(e,t){var i;if(t.text.includes(`
71
+ `)&&t.range.startLineNumber!==t.range.endLineNumber&&t.range.startColumn!==t.range.endColumn){if(t.range.startColumn!==1)return!1;const s=t.range.endLineNumber,r=t.range.endColumn,a=((i=e.getModel())==null?void 0:i.getLineLength(s))??0;if(r!==a+1)return!1}return!0}async fetchInlineEdit(e,t){this._currentRequestCts&&this._currentRequestCts.dispose(!0);const i=e.getModel();if(!i)return;const n=i.getVersionId(),s=this.languageFeaturesService.inlineEditProvider.all(i);if(s.length===0)return;const r=s[0];this._currentRequestCts=new Is;const a=this._currentRequestCts.token,c=t?gk.Automatic:gk.Invoke;if(t&&await r$(50,a),a.isCancellationRequested||i.isDisposed()||i.getVersionId()!==n)return;const g=await r.provideInlineEdit(i,{triggerKind:c},a);if(g&&!(a.isCancellationRequested||i.isDisposed()||i.getVersionId()!==n)&&this.validateInlineEdit(e,g))return g}async getInlineEdit(e,t){this._isCursorAtInlineEditContext.set(!1),await this.clear();const i=await this.fetchInlineEdit(e,t);i&&this._currentEdit.set(i,void 0)}async trigger(){await this.getInlineEdit(this.editor,!1)}async jumpBack(){this._jumpBackPosition&&(this.editor.setPosition(this._jumpBackPosition),this.editor.revealPositionInCenterIfOutsideViewport(this._jumpBackPosition))}async accept(){this._isAccepting.set(!0,void 0);const e=this._currentEdit.get();if(!e)return;let t=e.text;e.text.startsWith(`
72
+ `)&&(t=e.text.substring(1)),this.editor.pushUndoStop(),this.editor.executeEdits("acceptCurrent",[Kn.replace(B.lift(e.range),t)]),e.accepted&&await this._commandService.executeCommand(e.accepted.id,...e.accepted.arguments||[]).then(void 0,ss),this.freeEdit(e),Lh(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=Dt.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,ss),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)}},Cf=Qo,Qo.ID="editor.contrib.inlineEditController",Qo.inlineEditVisibleKey="inlineEditVisible",Qo.inlineEditVisibleContext=new Ri(Qo.inlineEditVisibleKey,!1),Qo.cursorAtInlineEditKey="cursorAtInlineEdit",Qo.cursorAtInlineEditContext=new Ri(Qo.cursorAtInlineEditKey,!1),Qo);Zs=Cf=o$([Vc(1,ai),Vc(2,$i),Vc(3,Et),Vc(4,ys),Vc(5,Tn),Vc(6,t1),Vc(7,eo)],Zs);function r$(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 a$=class extends Se{constructor(){super({id:YU,label:"Accept Inline Edit",alias:"Accept Inline Edit",precondition:le.and(M.writable,Zs.inlineEditVisibleContext),kbOpts:[{weight:101,primary:2,kbExpr:le.and(M.writable,Zs.inlineEditVisibleContext,Zs.cursorAtInlineEditContext)}],menuOpts:[{menuId:lt.InlineEditToolbar,title:"Accept",group:"primary",order:1}]})}async run(e,t){const i=Zs.get(t);await(i==null?void 0:i.accept())}};class l$ extends Se{constructor(){const e=le.and(M.writable,le.not(Zs.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=Zs.get(t);i==null||i.trigger()}}class c$ extends Se{constructor(){const e=le.and(M.writable,Zs.inlineEditVisibleContext,le.not(Zs.cursorAtInlineEditKey));super({id:QU,label:"Jump to Inline Edit",alias:"Jump to Inline Edit",precondition:e,kbOpts:{weight:101,primary:2646,kbExpr:e},menuOpts:[{menuId:lt.InlineEditToolbar,title:"Jump To Edit",group:"primary",order:3,when:e}]})}async run(e,t){const i=Zs.get(t);i==null||i.jumpToCurrent()}}class d$ extends Se{constructor(){const e=le.and(M.writable,Zs.cursorAtInlineEditContext);super({id:e$,label:"Jump Back from Inline Edit",alias:"Jump Back from Inline Edit",precondition:e,kbOpts:{weight:110,primary:2646,kbExpr:e},menuOpts:[{menuId:lt.InlineEditToolbar,title:"Jump Back",group:"primary",order:3,when:e}]})}async run(e,t){const i=Zs.get(t);i==null||i.jumpBack()}}class h$ extends Se{constructor(){const e=le.and(M.writable,Zs.inlineEditVisibleContext);super({id:JU,label:"Reject Inline Edit",alias:"Reject Inline Edit",precondition:e,kbOpts:{weight:100,primary:9,kbExpr:e},menuOpts:[{menuId:lt.InlineEditToolbar,title:"Reject",group:"secondary",order:2}]})}async run(e,t){const i=Zs.get(t);await(i==null?void 0:i.clear())}}se(a$);se(h$);se(c$);se(d$);se(l$);_i(Zs.ID,Zs,3);const u$="editor.action.inlineEdits.accept",g$="editor.action.inlineEdits.showPrevious",f$="editor.action.inlineEdits.showNext",Ig=new Ri("inlineEditsVisible",!1,y("inlineEditsVisible","Whether an inline edit is visible")),p$=new Ri("inlineEditsIsPinned",!1,y("isPinned","Whether an inline edit is visible")),CL=class CL extends Ve{constructor(e){super(),this._editor=e,this._editorObs=La(this._editor),this._placeholderText=this._editorObs.getOption(88),this._state=il({owner:this,equalsFn:yP},t=>{const i=this._placeholderText.read(t);if(i&&this._editorObs.valueIsEmpty.read(t))return{placeholder:i}}),this._shouldViewBeAlive=m$(this,t=>{var i;return((i=this._state.read(t))==null?void 0:i.placeholder)!==void 0}),this._view=vE((t,i)=>{if(!this._shouldViewBeAlive.read(t))return;const n=yr("div.editorPlaceholder");i.add(Vn(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(Vn(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(Vn(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:sl(0),position:sl(null),domNode:n.root}))}),this._view.recomputeInitiallyAndOnChange(this._store)}};CL.ID="editor.contrib.placeholderText";let Ip=CL;function m$(o,e){return oy(o,(t,i)=>i===!0?!0:e(t))}var _$=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},v$=function(o,e){return function(t,i){e(t,i,o)}};class b${constructor(e,t,i){this.range=e,this.newLines=t,this.changes=i}}let Ix=class extends Ve{constructor(e,t,i,n){super(),this._editor=e,this._edit=t,this._userPrompt=i,this._instantiationService=n,this._editorObs=La(this._editor),this._elements=yr("div.inline-edits-widget",{style:{position:"absolute",overflow:"visible",top:"0px",left:"0px"}},[yr("div@editorContainer",{style:{position:"absolute",top:"0px",left:"0px",width:"500px",height:"500px"}},[yr("div.toolbar@toolbar",{style:{position:"absolute",top:"-25px",left:"0px"}}),yr("div.promptEditor@promptEditor",{style:{position:"absolute",top:"-25px",left:"80px",width:"300px",height:"22px"}}),yr("div.preview@editor",{style:{position:"absolute",top:"0px",left:"0px"}})]),jh("svg",{style:{overflow:"visible",pointerEvents:"none"}},[jh("defs",[jh("linearGradient",{id:"Gradient2",x1:"0",y1:"0",x2:"1",y2:"0"},[jh("stop",{offset:"0%",class:"gradient-stop"}),jh("stop",{offset:"100%",class:"gradient-stop"})])]),jh("path@path",{d:"",fill:"url(#Gradient2)"})])]),this._previewTextModel=this._register(this._instantiationService.createInstance(Yl,"",sp,Yl.DEFAULT_CREATION_OPTIONS,null)),this._setText=an(r=>{const a=this._edit.read(r);a&&this._previewTextModel.setValue(a.newLines.join(`
73
+ `))}).recomputeInitiallyAndOnChange(this._store),this._promptTextModel=this._register(this._instantiationService.createInstance(Yl,"",sp,Yl.DEFAULT_CREATION_OPTIONS,null)),this._promptEditor=this._register(this._instantiationService.createInstance(Er,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:V2},{contributions:j2.getSomeEditorContributions([Cr.ID,Ip.ID,bg.ID]),isSimpleWidget:!0},this._editor)),this._previewEditor=this._register(this._instantiationService.createInstance(Er,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=La(this._previewEditor),this._decorations=an(this,r=>{var g;this._setText.read(r);const a=(g=this._edit.read(r))==null?void 0:g.changes;if(!a)return[];const c=[],h=[];if(a.length===1&&a[0].innerChanges[0].modifiedRange.equalsRange(this._previewTextModel.getFullModelRange()))return[];for(const f of a)if(f.original.isEmpty||c.push({range:f.original.toInclusiveRange(),options:e1}),f.modified.isEmpty||h.push({range:f.modified.toInclusiveRange(),options:fP}),f.modified.isEmpty||f.original.isEmpty)f.original.isEmpty||c.push({range:f.original.toInclusiveRange(),options:pP}),f.modified.isEmpty||h.push({range:f.modified.toInclusiveRange(),options:mP});else for(const p of f.innerChanges||[])f.original.contains(p.originalRange.startLineNumber)&&c.push({range:p.originalRange,options:p.originalRange.isEmpty()?_P:Q0}),f.modified.contains(p.modifiedRange.startLineNumber)&&h.push({range:p.modifiedRange,options:p.modifiedRange.isEmpty()?vP:bP});return h}),this._layout1=an(this,r=>{const a=this._editor.getModel(),c=this._edit.read(r);if(!c)return null;const h=c.range;let g=0;for(let v=h.startLineNumber;v<h.endLineNumberExclusive;v++){const _=a.getLineMaxColumn(v),w=this._editor.getOffsetForColumn(v,_);g=Math.max(g,w)}return{left:this._editor.getLayoutInfo().contentLeft+g}}),this._layout=an(this,r=>{const a=this._edit.read(r);if(!a)return null;const c=a.range,h=this._editorObs.scrollLeft.read(r),g=this._layout1.read(r).left+20-h,f=this._editor.getTopForLineNumber(c.startLineNumber)-this._editorObs.scrollTop.read(r),p=this._editor.getTopForLineNumber(c.endLineNumberExclusive)-this._editorObs.scrollTop.read(r),v=new wu(g,f),_=new wu(g,p),w=p-f,S=50,D=this._editor.getOption(67)*a.newLines.length,E=w-D,R=new wu(g+S,f+E/2),z=new wu(g+S,p-E/2);return{topCode:v,bottomCode:_,codeHeight:w,topEdit:R,bottomEdit:z,editHeight:D}});const s=an(this,r=>this._edit.read(r)!==void 0||this._userPrompt.read(r)!==void 0);this._register(U2(this._elements.root,{display:an(this,r=>s.read(r)?"block":"none")})),this._register($2(this._editor.getDomNode(),this._elements.root)),this._register(La(e).createOverlayWidget({domNode:this._elements.root,position:sl(null),allowEditorOverflow:!1,minContentWidthInPx:an(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(Vn(r=>{const a=this._layout.read(r);if(!a)return;const{topCode:c,bottomCode:h,topEdit:g,bottomEdit:f,editHeight:p}=a,v=10,_=0,w=40,S=new w$().moveTo(c).lineTo(c.deltaX(v)).curveTo(c.deltaX(v+w),g.deltaX(-w-_),g.deltaX(-_)).lineTo(g).lineTo(f).lineTo(f.deltaX(-_)).curveTo(f.deltaX(-w-_),h.deltaX(v+w),h.deltaX(v)).lineTo(h).build();this._elements.path.setAttribute("d",S),this._elements.editorContainer.style.top=`${g.y}px`,this._elements.editorContainer.style.left=`${g.x}px`,this._elements.editorContainer.style.height=`${p}px`;const D=this._previewEditorObs.contentWidth.read(r);this._previewEditor.layout({height:p,width:D})})),this._promptEditor.setModel(this._promptTextModel),this._promptEditor.layout(),this._register(S$(y$(this._userPrompt,r=>r??"",r=>r),La(this._promptEditor).value)),this._register(Vn(r=>{const a=La(this._promptEditor).isFocused.read(r);this._elements.root.classList.toggle("focused",a)}))}};Ix=_$([v$(3,ai)],Ix);function y$(o,e,t){return wP(void 0,i=>e(o.read(i)),(i,n)=>o.set(t(i),n))}class wu{constructor(e,t){this.x=e,this.y=t}deltaX(e){return new wu(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 S$(o,e){const t=new Be;return t.add(Vn(i=>{const n=o.read(i);e.set(n,void 0)})),t.add(Vn(i=>{const n=e.read(i);o.set(n,void 0)})),t}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},$w=function(o,e){return function(t,i){e(t,i,o)}},xf,Gd;let Dx=(Gd=class extends Ve{static _createUniqueUri(){return un.from({scheme:"inline-edits",path:new Date().toString()+String(xf._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=G0(this),this._selectedInlineCompletionId=Ho(this,void 0),this._isActive=Ho(this,!1),this._originalModel=kc(()=>this._modelService.createModel("",null,xf._createUniqueUri())).keepObserved(this._store),this._modifiedModel=kc(()=>this._modelService.createModel("",null,xf._createUniqueUri())).keepObserved(this._store),this._pinnedRange=new L$(this.textModel,this._textModelVersionId),this.isPinned=this._pinnedRange.range.map(c=>!!c),this.userPrompt=Ho(this,void 0),this.inlineEdit=an(this,c=>{var h,g;return(g=(h=this._inlineEdit.read(c))==null?void 0:h.promiseResult.read(c))==null?void 0:g.data}),this._inlineEdit=an(this,c=>{const h=this.selectedInlineEdit.read(c);if(!h)return;const g=h.inlineCompletion.range;if(h.inlineCompletion.insertText.trim()==="")return;let f=h.inlineCompletion.insertText.split(/\r\n|\r|\n/);function p(S){var E;const D=((E=S[0].match(/^\s*/))==null?void 0:E[0])??"";return S.map(R=>R.replace(new RegExp("^"+D),""))}f=p(f);let _=this.textModel.getValueInRange(g).split(/\r\n|\r|\n/);_=p(_),this._originalModel.get().setValue(_.join(`
74
+ `)),this._modifiedModel.get().setValue(f.join(`
75
+ `));const w=this._diffProviderFactoryService.createDiffProvider({diffAlgorithm:"advanced"});return gP.fromFn(async()=>{const S=await w.computeDiff(this._originalModel.get(),this._modifiedModel.get(),{computeMoves:!1,ignoreTrimWhitespace:!1,maxComputationTimeMs:1e3},gi.None);if(!S.identical)return new b$(q2.fromRangeInclusive(g),p(f),S.changes)})}),this._fetchStore=this._register(new Be),this._inlineEditsFetchResult=hS(this,void 0),this._inlineEdits=il({owner:this,equalsFn:yP},c=>{var h;return((h=this._inlineEditsFetchResult.read(c))==null?void 0:h.completions.map(g=>new x$(g)))??[]}),this._fetchInlineEditsPromise=YE({owner:this,createEmptyChangeSummary:()=>({inlineCompletionTriggerKind:dl.Automatic}),handleChange:(c,h)=>(c.didChange(this._forceUpdateExplicitlySignal)&&(h.inlineCompletionTriggerKind=dl.Explicit),!0)},async(c,h)=>{this._fetchStore.clear(),this._forceUpdateExplicitlySignal.read(c),this._textModelVersionId.read(c);function g(w,S){return S(w)}const f=this._pinnedRange.range.read(c)??g(this._selection.read(c),w=>w.isEmpty()?void 0:w);if(!f){this._inlineEditsFetchResult.set(void 0,void 0),this.userPrompt.set(void 0,void 0);return}const p={triggerKind:h.inlineCompletionTriggerKind,selectedSuggestionInfo:void 0,userPrompt:this.userPrompt.read(c)},v=gS(this._fetchStore);await uy(200,v);const _=await wN(this.languageFeaturesService.inlineCompletionsProvider,f,this.textModel,p,v);v.isCancellationRequested||this._inlineEditsFetchResult.set(_,void 0)}),this._filteredInlineEditItems=il({owner:this,equalsFn:uS()},c=>this._inlineEdits.read(c)),this.selectedInlineCompletionIndex=an(this,c=>{const h=this._selectedInlineCompletionId.read(c),g=this._filteredInlineEditItems.read(c),f=this._selectedInlineCompletionId===void 0?-1:g.findIndex(p=>p.semanticId===h);return f===-1?(this._selectedInlineCompletionId.set(void 0,void 0),0):f}),this.selectedInlineEdit=an(this,c=>{const h=this._filteredInlineEditItems.read(c),g=this.selectedInlineCompletionIndex.read(c);return h[g]}),this._register(JE(this._fetchInlineEditsPromise))}async triggerExplicitly(e){j_(e,t=>{this._isActive.set(!0,t),this._forceUpdateExplicitlySignal.trigger(t)}),await this._fetchInlineEditsPromise.get()}stop(e){j_(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 rg;const t=this.selectedInlineEdit.get();t&&(e.pushUndoStop(),e.executeEdits("inlineSuggestion.accept",[t.inlineCompletion.toSingleTextEdit().toSingleEditOperation()]),this.stop())}},xf=Gd,Gd._modelId=0,Gd);Dx=xf=C$([$w(4,Et),$w(5,t1),$w(6,eo)],Dx);class x${constructor(e){this.inlineCompletion=e,this.semanticId=this.inlineCompletion.hash()}}class L$ extends Ve{constructor(e,t){super(),this._textModel=e,this._versionId=t,this._decorations=Ho(this,[]),this.range=an(this,i=>{this._versionId.read(i);const n=this._decorations.read(i)[0];return n?this._textModel.getDecorationRange(n)??null:null}),this._register(En(()=>{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 k$=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},lf=function(o,e){return function(t,i){e(t,i,o)}},Ex,Zd;let Sl=(Zd=class extends Ve{static get(e){return e.getContribution(Ex.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=K2("editor.inlineEdits.enabled",!1,this._configurationService),this._editorObs=La(this.editor),this._selection=an(this,a=>this._editorObs.cursorSelection.read(a)??new Xt(1,1,1,1)),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineEditsDebounce",{min:50,max:50}),this.model=kc(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(fS(Dx,a),c,this._editorObs.versionId,this._selection,this._debounceValue):void 0}),this._hadInlineEdit=oy(this,(a,c)=>{var h;return c||((h=this.model.read(a))==null?void 0:h.inlineEdit.read(a))!==void 0}),this._widget=kc(this,a=>{if(this._hadInlineEdit.read(a))return this._instantiationService.createInstance(fS(Ix,a),this.editor,this.model.map((c,h)=>c==null?void 0:c.inlineEdit.read(h)),I$(c=>{var h;return((h=this.model.read(c))==null?void 0:h.userPrompt)??Ho("empty","")}))}),this._register(fk(Ig,this._contextKeyService,a=>{var c;return!!((c=this.model.read(a))!=null&&c.inlineEdit.read(a))})),this._register(fk(p$,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)}},Ex=Zd,Zd.ID="editor.contrib.inlineEditsController",Zd);Sl=Ex=k$([lf(1,ai),lf(2,$i),lf(3,nr),lf(4,Et),lf(5,Tn)],Sl);function I$(o){return wP(void 0,e=>o(e).read(e),(e,t)=>{o(void 0).set(e,t)})}function bm(o){return{label:o.value,alias:o.original}}const Fb=class Fb extends Se{constructor(){super({id:Fb.ID,...bm(kt("action.inlineEdits.showNext","Show Next Inline Edit")),precondition:le.and(M.writable,Ig),kbOpts:{weight:100,primary:606}})}async run(e,t){var n;const i=Sl.get(t);(n=i==null?void 0:i.model.get())==null||n.next()}};Fb.ID=f$;let Px=Fb;const Hb=class Hb extends Se{constructor(){super({id:Hb.ID,...bm(kt("action.inlineEdits.showPrevious","Show Previous Inline Edit")),precondition:le.and(M.writable,Ig),kbOpts:{weight:100,primary:604}})}async run(e,t){var n;const i=Sl.get(t);(n=i==null?void 0:i.model.get())==null||n.previous()}};Hb.ID=g$;let Tx=Hb;class D$ extends Se{constructor(){super({id:"editor.action.inlineEdits.trigger",...bm(kt("action.inlineEdits.trigger","Trigger Inline Edit")),precondition:M.writable})}async run(e,t){const i=Sl.get(t);await lP(async n=>{var s;await((s=i==null?void 0:i.model.get())==null?void 0:s.triggerExplicitly(n))})}}class E$ extends Se{constructor(){super({id:u$,...bm(kt("action.inlineEdits.accept","Accept Inline Edit")),precondition:Ig,menuOpts:{menuId:lt.InlineEditsActions,title:y("inlineEditsActions","Accept Inline Edit"),group:"primary",order:1,icon:Qt.check},kbOpts:{primary:2058,weight:2e4,kbExpr:Ig}})}async run(e,t){var n;t instanceof Er&&(t=t.getParentEditor());const i=Sl.get(t);i&&((n=i.model.get())==null||n.accept(i.editor),i.editor.focus())}}const Wb=class Wb extends Se{constructor(){super({id:Wb.ID,...bm(kt("action.inlineEdits.hide","Hide Inline Edit")),precondition:Ig,kbOpts:{weight:100,primary:9}})}async run(e,t){const i=Sl.get(t);Lh(n=>{var s;(s=i==null?void 0:i.model.get())==null||s.stop(n)})}};Wb.ID="editor.action.inlineEdits.hide";let Mx=Wb;_i(Sl.ID,Sl,3);se(D$);se(Px);se(Tx);se(E$);se(Mx);const yh={Visible:new Ri("parameterHintsVisible",!1),MultipleSignatures:new Ri("parameterHintsMultipleSignatures",!1)};async function BN(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){ss(a)}}Sn.registerCommand("_executeSignatureHelpProvider",async(o,...e)=>{const[t,i,n]=e;Gi(un.isUri(t)),Gi(Dt.isIPosition(i)),Gi(typeof n=="string"||!n);const s=o.get(Et),r=await o.get(la).createModelReference(t);try{const a=await BN(s.signatureHelpProvider,r.object.textEditorModel,Dt.lift(i),{triggerKind:sc.Invoke,isRetrigger:!1,triggerCharacter:n},gi.None);return a?(setTimeout(()=>a.dispose(),0),a.value):void 0}finally{r.dispose()}});var Vl;(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})(Vl||(Vl={}));const Bb=class Bb extends Ve{constructor(e,t,i=Bb.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new ui),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=Vl.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new Bo),this.triggerChars=new z_,this.retriggerChars=new z_,this.triggerId=0,this.editor=e,this.providers=t,this.throttledDelayer=new Lc(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=Vl.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(mn)}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 Vl.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(P$);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 Vl.Pending(ks(c=>BN(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 Vl.Active(c.value),this._lastSignatureHelpResult.value=c,this._onChangedHints.fire(this.state.hints),!0)}catch(c){return e===this.triggerId&&(this.state=Vl.Default),mn(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:sc.TriggerCharacter,triggerCharacter:e.charAt(t)})}onCursorChange(e){e.source==="mouse"?this.cancel():this.isTriggered&&this.trigger({triggerKind:sc.ContentChange})}onModelContentChange(){this.isTriggered&&this.trigger({triggerKind:sc.ContentChange})}onEditorConfigurationChange(){this.triggerOnType=this.editor.getOption(86).enabled,this.triggerOnType||this.cancel()}dispose(){this.cancel(!0),super.dispose()}};Bb.DEFAULT_DELAY=120;let Nx=Bb;function P$(o,e){switch(e.triggerKind){case sc.Invoke:return e;case sc.ContentChange:return o;case sc.TriggerCharacter:default:return e}}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},s_=function(o,e){return function(t,i){e(t,i,o)}},Rx;const Eo=yt,M$=es("parameter-hints-next",Qt.chevronDown,y("parameterHintsNextIcon","Icon for show next parameter hint.")),N$=es("parameter-hints-previous",Qt.chevronUp,y("parameterHintsPreviousIcon","Icon for show previous parameter hint."));var Xd;let Ax=(Xd=class extends Ve{constructor(e,t,i,n,s,r){super(),this.editor=e,this.model=t,this.telemetryService=r,this.renderDisposeables=this._register(new Be),this.visible=!1,this.announcedLabel=null,this.allowEditorOverflow=!0,this.markdownRenderer=this._register(new Ng({editor:e},s,n)),this.keyVisible=yh.Visible.bindTo(i),this.keyMultipleSignatures=yh.MultipleSignatures.bindTo(i)}createParameterHintDOMNodes(){const e=Eo(".editor-widget.parameter-hints-widget"),t=pt(e,Eo(".phwrapper"));t.tabIndex=-1;const i=pt(t,Eo(".controls")),n=pt(i,Eo(".button"+Xi.asCSSSelector(N$))),s=pt(i,Eo(".overloads")),r=pt(i,Eo(".button"+Xi.asCSSSelector(M$)));this._register(Ui(n,"click",p=>{B_.stop(p),this.previous()})),this._register(Ui(r,"click",p=>{B_.stop(p),this.next()}));const a=Eo(".body"),c=new iP(a,{alwaysConsumeMouseWheel:!0});this._register(c),t.appendChild(c.getDomNode());const h=pt(a,Eo(".signature")),g=pt(a,Eo(".docs"));e.style.userSelect="text",this.domNodes={element:e,signature:h,overloads:s,docs:g,scrollbar:c},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection(p=>{this.visible&&this.editor.layoutContentWidget(this)}));const f=()=>{if(!this.domNodes)return;const p=this.editor.getOption(50),v=this.domNodes.element;v.style.fontSize=`${p.fontSize}px`,v.style.lineHeight=`${p.lineHeight/p.fontSize}`,v.style.setProperty("--vscode-parameterHintsWidget-editorFontFamily",p.fontFamily),v.style.setProperty("--vscode-parameterHintsWidget-editorFontFamilyDefault",B0.fontFamily)};f(),this._register(ps.chain(this.editor.onDidChangeConfiguration.bind(this.editor),p=>p.filter(v=>v.hasChanged(50)))(f)),this._register(this.editor.onDidLayoutChange(p=>this.updateMaxHeight())),this.updateMaxHeight()}show(){this.visible||(this.domNodes||this.createParameterHintDOMNodes(),this.keyVisible.set(!0),this.visible=!0,setTimeout(()=>{var e;(e=this.domNodes)==null||e.element.classList.add("visible")},100),this.editor.layoutContentWidget(this))}hide(){var e;this.renderDisposeables.clear(),this.visible&&(this.keyVisible.reset(),this.visible=!1,this.announcedLabel=null,(e=this.domNodes)==null||e.element.classList.remove("visible"),this.editor.layoutContentWidget(this))}getPosition(){return this.visible?{position:this.editor.getPosition(),preference:[1,2]}:null}render(e){if(this.renderDisposeables.clear(),!this.domNodes)return;const t=e.signatures.length>1;this.domNodes.element.classList.toggle("multiple",t),this.keyMultipleSignatures.set(t),this.domNodes.signature.innerText="",this.domNodes.docs.innerText="";const i=e.signatures[e.activeSignature];if(!i)return;const n=pt(this.domNodes.signature,Eo(".code")),s=i.parameters.length>0,r=i.activeParameter??e.activeParameter;if(s)this.renderParameters(n,i,r);else{const h=pt(n,Eo("span"));h.textContent=i.label}const a=i.parameters[r];if(a!=null&&a.documentation){const h=Eo("span.documentation");if(typeof a.documentation=="string")h.textContent=a.documentation;else{const g=this.renderMarkdownDocs(a.documentation);h.appendChild(g.element)}pt(this.domNodes.docs,Eo("p",{},h))}if(i.documentation!==void 0)if(typeof i.documentation=="string")pt(this.domNodes.docs,Eo("p",{},i.documentation));else{const h=this.renderMarkdownDocs(i.documentation);pt(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 g=i.parameters[r];Array.isArray(g.label)?h=i.label.substring(g.label[0],g.label[1]):h=g.label,g.documentation&&(h+=typeof g.documentation=="string"?`, ${g.documentation}`:`, ${g.documentation.value}`),i.documentation&&(h+=typeof i.documentation=="string"?`, ${i.documentation}`:`, ${i.documentation.value}`),this.announcedLabel!==h&&(Ir(y("hint","{0}, hint",h)),this.announcedLabel=h)}this.editor.layoutContentWidget(this),this.domNodes.scrollbar.scanDomNode()}renderMarkdownDocs(e){const t=new Lo,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"&&fu(t.documentation).length>0||t&&typeof t.documentation=="object"&&fu(t.documentation).value.length>0||e.documentation&&typeof e.documentation=="string"&&fu(e.documentation).length>0||e.documentation&&typeof e.documentation=="object"&&fu(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),pt(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|^)${Qf(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 Rx.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)}},Rx=Xd,Xd.ID="editor.widget.parameterHintsWidget",Xd);Ax=Rx=T$([s_(2,$i),s_(3,oa),s_(4,aa),s_(5,ra)],Ax);St("editorHoverWidget.highlightForeground",rP,y("editorHoverWidgetHighlightForeground","Foreground color of the active item in the parameter hint."));var R$=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},nD=function(o,e){return function(t,i){e(t,i,o)}},Ox,Yd;let Dg=(Yd=class extends Ve{static get(e){return e.getContribution(Ox.ID)}constructor(e,t,i){super(),this.editor=e,this.model=this._register(new Nx(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 M0(()=>this._register(t.createInstance(Ax,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)}},Ox=Yd,Yd.ID="editor.controller.parameterHints",Yd);Dg=Ox=R$([nD(1,ai),nD(2,Et)],Dg);class A$ extends Se{constructor(){super({id:"editor.action.triggerParameterHints",label:y("parameterHints.trigger.label","Trigger Parameter Hints"),alias:"Trigger Parameter Hints",precondition:M.hasSignatureHelpProvider,kbOpts:{kbExpr:M.editorTextFocus,primary:3082,weight:100}})}run(e,t){const i=Dg.get(t);i==null||i.trigger({triggerKind:sc.Invoke})}}_i(Dg.ID,Dg,2);se(A$);const J1=175,Q1=go.bindToContribution(Dg.get);Tt(new Q1({id:"closeParameterHints",precondition:yh.Visible,handler:o=>o.cancel(),kbOpts:{weight:J1,kbExpr:M.focus,primary:9,secondary:[1033]}}));Tt(new Q1({id:"showPrevParameterHint",precondition:le.and(yh.Visible,yh.MultipleSignatures),handler:o=>o.previous(),kbOpts:{weight:J1,kbExpr:M.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}}));Tt(new Q1({id:"showNextParameterHint",precondition:le.and(yh.Visible,yh.MultipleSignatures),handler:o=>o.next(),kbOpts:{weight:J1,kbExpr:M.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var O$=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},F$=function(o,e){return function(t,i){e(t,i,o)}};class H${constructor(e){this.instantiationService=e}init(...e){}}function W$(o,e){return class extends e{constructor(){super(...arguments),this._autorun=void 0}init(...i){this._autorun=Jp((n,s)=>{const r=fS(o(),n);s.add(this.instantiationService.createInstance(r,...i))})}dispose(){var i;(i=this._autorun)==null||i.dispose()}}}function B$(o){return G2()?W$(o,Fx):o()}let Fx=class extends H${constructor(e,t){super(t),this.init(e)}};Fx=O$([F$(1,ai)],Fx);_i(Ip.ID,B$(()=>Ip),0);St("editor.placeholder.foreground",Z2,y("placeholderForeground","Foreground color of the placeholder text in the editor."));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},o_=function(o,e){return function(t,i){e(t,i,o)}};const zg=new Ri("renameInputVisible",!1,y("renameInputVisible","Whether the rename input widget is visible"));new Ri("renameInputFocused",!1,y("renameInputFocused","Whether the rename input widget is focused"));let Hx=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 Be,this._visibleContextKey=zg.bindTo(s),this._isEditingRenameCandidate=!1,this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,this._candidates=new Set,this._beforeFirstInputFieldEditSW=new Lo,this._inputWithButton=new V$,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 eL(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(Y2);this._domNode.style.backgroundColor=String(e.getColor(nP)??""),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(J2)??"");const n=e.getColor(Q2);this._inputWithButton.domNode.style.backgroundColor=String(e.getColor(pk)??""),this._inputWithButton.input.style.backgroundColor=String(e.getColor(pk)??""),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;Gi(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=Qp(this.getDomNode().ownerDocument.body),t=lo(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}=Dp.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=y({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;Gi(this._renameCandidateListView),Gi(this._nPxAvailableAbove!==void 0),Gi(this._nPxAvailableBelow!==void 0);const t=uu(this._inputWithButton.domNode),i=uu(this._label);let n;e===2?n=this._nPxAvailableBelow:n=this._nPxAvailableAbove,this._renameCandidateListView.layout({height:n-i-t,width:gr(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 Be;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(Ui(this._inputWithButton.button,"click",()=>this._requestRenameCandidates(t,!0))),c.add(Ui(this._inputWithButton.button,jn.KEY_DOWN,g=>{const f=new i1(g);(f.equals(3)||f.equals(10))&&(f.stopPropagation(),f.preventDefault(),this._requestRenameCandidates(t,!0))}))),this._isEditingRenameCandidate=!1,this._domNode.classList.toggle("preview",i),this._position=new Dt(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(En(()=>{this._renameCts=void 0,s.dispose(!0)})),c.add(En(()=>{this._renameCandidateProvidersCts!==void 0&&(this._renameCandidateProvidersCts.dispose(!0),this._renameCandidateProvidersCts=void 0)})),c.add(En(()=>this._candidates.clear()));const h=new ey;return h.p.finally(()=>{c.dispose(),this._hide()}),this._currentCancelInput=g=>{var f;return this._trace("invoking _currentCancelInput"),this._currentAcceptInput=void 0,this._currentCancelInput=void 0,(f=this._renameCandidateListView)==null||f.clearCandidates(),h.complete(g),!0},this._currentAcceptInput=g=>{this._trace("invoking _currentAcceptInput"),Gi(this._renameCandidateListView!==void 0);const f=this._renameCandidateListView.nCandidates;let p,v;const _=this._renameCandidateListView.focusedCandidate;if(_!==void 0?(this._trace("using new name from renameSuggestion"),p=_,v={k:"renameSuggestion"}):(this._trace("using new name from inputField"),p=this._inputWithButton.input.value,v=this._isEditingRenameCandidate?{k:"userEditedRenameSuggestion"}:{k:"inputField"}),p===t||p.trim().length===0){this.cancelInput(!0,"_currentAcceptInput (because newName === value || newName.trim().length === 0)");return}this._currentAcceptInput=void 0,this._currentCancelInput=void 0,this._renameCandidateListView.clearCandidates(),h.complete({newName:p,wantsPreview:i&&g,stats:{source:v,nRenameSuggestions:f,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 g;return this.cancelInput(!((g=this._domNode)!=null&&g.ownerDocument.hasFocus()),"editor.onDidBlurEditorWidget")})),this._show(),h.p}_requestRenameCandidates(e,t){if(this._requestRenameCandidatesOnce!==void 0&&(this._renameCandidateProvidersCts!==void 0&&this._renameCandidateProvidersCts.dispose(!0),Gi(this._renameCts),this._inputWithButton.buttonState!=="stop")){this._renameCandidateProvidersCts=new Is;const i=t?pS.Invoke:pS.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){Gi(this._editor.hasModel());const i=this._editor.getSelection();let n=0,s=t.length;return!B.isEmpty(i)&&!B.spansMultipleLines(i)&&B.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 qp(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"&&u_(h.value)?h.value:[]);n(`received updateRenameCandidates results - total (unfiltered) ${r.length} candidates.`);const a=lE(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)}};Hx=z$([o_(2,Pr),o_(3,ds),o_(4,$i),o_(5,kh)],Hx);class eL{constructor(e,t){this._disposables=new Be,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=eL._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(aP({listInactiveFocusForeground:sP,listInactiveFocusBackground:oP}))}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`,tg(y("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}=Dp.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 Dp(r,i)}renderElement(r,a,c){c.populate(r)}disposeTemplate(r){r.dispose()}};return new O0("NewSymbolNameCandidates",e,n,[s],{keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!1})}}class V${constructor(){this._onDidInputChange=new ui,this.onDidInputChange=this._onDidInputChange.event,this._disposables=new Be}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",y("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=y("generateRenameSuggestionsButton","Generate new name suggestions"),this._buttonCancelHoverText=y("cancelRenameSuggestionsButton","Cancel"),this._buttonHover=eF().setupManagedHover(dy("element"),this._buttonNode,this._buttonGenHoverText),this._disposables.add(this._buttonHover),this._domNode.appendChild(this._buttonNode),this._disposables.add(Ui(this.input,jn.INPUT,()=>this._onDidInputChange.fire())),this._disposables.add(Ui(this.input,jn.KEY_DOWN,e=>{const t=new i1(e);(t.keyCode===15||t.keyCode===17)&&this._onDidInputChange.fire()})),this._disposables.add(Ui(this.input,jn.CLICK,()=>this._onDidInputChange.fire())),this._disposables.add(Ui(this.input,jn.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(Ui(this.input,jn.BLUR,()=>{this.domNode.style.outline="none"}))),this._domNode}get input(){return Gi(this._inputNode),this._inputNode}get button(){return Gi(this._buttonNode),this._buttonNode}get buttonState(){return this._buttonState}setSparkleButton(){var e;this._buttonState="sparkle",this._sparkleIcon??(this._sparkleIcon=mS(Qt.sparkle)),Na(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=mS(Qt.primitiveSquare)),Na(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 Zf=class Zf{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=`${Zf._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=mS(Qt.sparkle),this._icon.style.display="none",i.appendChild(this._icon),this._label=document.createElement("div"),GE(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(tF.AIGenerated));this._icon.style.display=t?"inherit":"none"}_updateLabel(e){this._label.innerText=e.newSymbolName}static getLayoutInfo({lineHeight:e}){return{totalHeight:e+Zf._PADDING*2}}dispose(){}};Zf._PADDING=2;let Dp=Zf;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},Wl=function(o,e){return function(t,i){e(t,i,o)}},Wx;class tL{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 B(this.position.lineNumber,i.startColumn,this.position.lineNumber,i.endColumn),text:i.word,rejectReason:t.length>0?t.join(`
76
+ `):void 0}:{range:B.fromPositions(this.position),text:"",rejectReason:t.length>0?t.join(`
77
+ `):void 0}}async provideRenameEdits(e,t){return this._provideRenameEdits(e,this._providerRenameIdx,[],t)}async _provideRenameEdits(e,t,i,n){const s=this._providers[t];if(!s)return{edits:[],rejectReason:i.join(`
78
+ `)};const r=await s.provideRenameEdits(this.model,this.position,e,n);if(r){if(r.rejectReason)return this._provideRenameEdits(e,t+1,i.concat(r.rejectReason),n)}else return this._provideRenameEdits(e,t+1,i.concat(y("no result","No result.")),n);return r}}async function U$(o,e,t,i){const n=new tL(e,t,o),s=await n.resolveRenameLocation(gi.None);return s!=null&&s.rejectReason?{edits:[],rejectReason:s.rejectReason}:n.provideRenameEdits(i,gi.None)}var Jd;let Tc=(Jd=class{static get(e){return e.getContribution(Wx.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 Be,this._cts=new Is,this._renameWidget=this._disposableStore.add(this._instaService.createInstance(Hx,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}async run(){var _,w;const e=this._logService.trace.bind(this._logService,"[rename]");if(this._cts.dispose(!0),this._cts=new Is,!this.editor.hasModel()){e("editor has no model");return}const t=this.editor.getPosition(),i=new tL(this.editor.getModel(),t,this._languageFeaturesService.renameProvider);if(!i.hasProvider()){e("skeleton has no provider");return}const n=new Qu(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 ty?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"||d_(S))&&((_=So.get(this.editor))==null||_.showMessage(S||y("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),(w=So.get(this.editor))==null||w.showMessage(s.rejectReason,t);return}if(n.token.isCancellationRequested){e("returning early - cts1 cancelled");return}const r=new Qu(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])),g=(S,D)=>{let E=h.slice();return S===pS.Automatic&&(E=E.filter(([R,z])=>z)),E.map(([R])=>R.provideNewSymbolNames(a,s.range,S,D))};e("creating rename input field and awaiting its result");const f=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),p=await this._renameWidget.getInput(s.range,s.text,f,c.length>0?g:void 0,r);if(e("received response from rename input field"),c.length>0&&this._reportTelemetry(c.length,a.getLanguageId(),p),typeof p=="boolean"){e(`returning early - rename input field response - ${p}`),p&&this.editor.focus(),r.dispose();return}this.editor.focus(),e("requesting rename edits");const v=qp(i.provideRenameEdits(p.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(B.fromPositions(this.editor.getSelection().getPosition())),e("applying edits"),this._bulkEditService.apply(S,{editor:this.editor,showPreview:p.wantsPreview,label:y("label","Renaming '{0}' to '{1}'",s==null?void 0:s.text,p.newName),code:"undoredo.rename",quotableLabel:y("quotableLabel","Renaming {0} to {1}",s==null?void 0:s.text,p.newName),respectAutoSaveConfig:!0}).then(D=>{e("edits applied"),D.ariaSummary&&Ir(y("aria","Successfully renamed '{0}' to '{1}'. Summary: {2}",s.text,p.newName,D.ariaSummary))}).catch(D=>{e(`error when applying edits ${JSON.stringify(D,null," ")}`),this._notificationService.error(y("rename.failedApply","Rename failed to apply edits")),this._logService.error(D)})},S=>{e("error when providing rename edits",JSON.stringify(S,null," ")),this._notificationService.error(y("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)}},Wx=Jd,Jd.ID="editor.contrib.renameController",Jd);Tc=Wx=j$([Wl(1,ai),Wl(2,Qs),Wl(3,Jb),Wl(4,Gp),Wl(5,kh),Wl(6,iF),Wl(7,Et),Wl(8,ra)],Tc);class $$ extends Se{constructor(){super({id:"editor.action.rename",label:y("rename.label","Rename Symbol"),alias:"Rename Symbol",precondition:le.and(M.writable,M.hasRenameProvider),kbOpts:{kbExpr:M.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(e,t){const i=e.get(os),[n,s]=Array.isArray(t)&&t||[void 0,void 0];return un.isUri(n)&&Dt.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))))},mn):super.runCommand(e,t)}run(e,t){const i=e.get(kh),n=Tc.get(t);return n?(i.trace("[RenameAction] got controller, running..."),n.run()):(i.trace("[RenameAction] returning early - controller missing"),Promise.resolve())}}_i(Tc.ID,Tc,4);se($$);const iL=go.bindToContribution(Tc.get);Tt(new iL({id:"acceptRenameInput",precondition:zg,handler:o=>o.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:le.and(M.focus,le.not("isComposing")),primary:3}}));Tt(new iL({id:"acceptRenameInputWithPreview",precondition:le.and(zg,le.has("config.editor.rename.enablePreview")),handler:o=>o.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:le.and(M.focus,le.not("isComposing")),primary:2051}}));Tt(new iL({id:"cancelRenameInput",precondition:zg,handler:o=>o.cancelRenameInput(),kbOpts:{weight:199,kbExpr:M.focus,primary:9,secondary:[1033]}}));cn(class extends uo{constructor(){super({id:"focusNextRenameSuggestion",title:{...kt("focusNextRenameSuggestion","Focus Next Rename Suggestion")},precondition:zg,keybinding:[{primary:18,weight:199}]})}run(e){const t=e.get(os).getFocusedCodeEditor();if(!t)return;const i=Tc.get(t);i&&i.focusNextRenameSuggestion()}});cn(class extends uo{constructor(){super({id:"focusPreviousRenameSuggestion",title:{...kt("focusPreviousRenameSuggestion","Focus Previous Rename Suggestion")},precondition:zg,keybinding:[{primary:16,weight:199}]})}run(e){const t=e.get(os).getFocusedCodeEditor();if(!t)return;const i=Tc.get(t);i&&i.focusPreviousRenameSuggestion()}});fo("_executeDocumentRenameProvider",function(o,e,t,...i){const[n]=i;Gi(typeof n=="string");const{renameProvider:s}=o.get(Et);return U$(s,e,t,n)});fo("_executePrepareRename",async function(o,e,t){const{renameProvider:i}=o.get(Et),s=await new tL(e,t,i).resolveRenameLocation(gi.None);if(s!=null&&s.rejectReason)throw new Error(s.rejectReason);return s});sa.as(Zp.Configuration).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:5,description:y("enablePreview","Enable/disable the ability to preview changes before renaming"),default:!0,type:"boolean"}}});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},sD=function(o,e){return function(t,i){e(t,i,o)}},Gu;let jv=(Gu=class extends Ve{constructor(e,t,i){super(),this.editor=e,this.languageConfigurationService=t,this.editorWorkerService=i,this.decorations=this.editor.createDecorationsCollection(),this.options=this.createOptions(e.getOption(73)),this.computePromise=null,this.currentOccurrences={},this._register(e.onDidChangeModel(n=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(73)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(e.onDidChangeModelLanguage(n=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(73)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(t.onDidChange(n=>{var r;const s=(r=this.editor.getModel())==null?void 0:r.getLanguageId();s&&n.affects(s)&&(this.currentOccurrences={},this.options=this.createOptions(e.getOption(73)),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(e.onDidChangeConfiguration(n=>{this.options&&!n.hasChanged(73)||(this.options=this.createOptions(e.getOption(73)),this.updateDecorations([]),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(this.editor.onDidChangeModelContent(n=>{this.computeSectionHeaders.schedule()})),this._register(e.onDidChangeModelTokens(n=>{this.computeSectionHeaders.isScheduled()||this.computeSectionHeaders.schedule(1e3)})),this.computeSectionHeaders=this._register(new ms(()=>{this.findSectionHeaders()},250)),this.computeSectionHeaders.schedule(0)}createOptions(e){if(!e||!this.editor.hasModel())return;const t=this.editor.getModel().getLanguageId();if(!t)return;const i=this.languageConfigurationService.getLanguageConfiguration(t).comments,n=this.languageConfigurationService.getLanguageConfiguration(t).foldingRules;if(!(!i&&!(n!=null&&n.markers)))return{foldingRules:n,findMarkSectionHeaders:e.showMarkSectionHeaders,findRegionSectionHeaders:e.showRegionSectionHeaders}}findSectionHeaders(){var i,n;if(!this.editor.hasModel()||!((i=this.options)!=null&&i.findMarkSectionHeaders)&&!((n=this.options)!=null&&n.findRegionSectionHeaders))return;const e=this.editor.getModel();if(e.isDisposed()||e.isTooLargeForSyncing())return;const t=e.getVersionId();this.editorWorkerService.findSectionHeaders(e.uri,this.options).then(s=>{e.isDisposed()||e.getVersionId()!==t||this.updateDecorations(s)})}updateDecorations(e){const t=this.editor.getModel();t&&(e=e.filter(s=>{if(!s.shouldBeInComments)return!0;const r=t.validateRange(s.range),a=t.tokenization.getLineTokens(r.startLineNumber),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=>K$(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);jv=q$([sD(1,ws),sD(2,Il)],jv);function K$(o){return{range:o.range,options:ki.createDynamic({description:"section-header",stickiness:3,collapseOnReplaceEdit:!0,minimap:{color:void 0,position:1,sectionHeaderStyle:o.hasSeparatorLine?2:1,sectionHeaderText:o.text}})}}_i(jv.ID,jv,1);function G$(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 Z$(o){const e=new Uint8Array(o.buffer,o.byteOffset,o.length*4);return nF()||G$(e),sF.wrap(e)}function zN(o){const e=new Uint32Array(X$(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 Z$(e)}function X$(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 Vy(o){return o&&!!o.data}function VN(o){return o&&Array.isArray(o.edits)}class Y${constructor(e,t,i){this.provider=e,this.tokens=t,this.error=i}}function jN(o,e){return o.has(e)}function J$(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:[]}async function UN(o,e,t,i,n){const s=J$(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(g){h=g,c=null}return(!c||!Vy(c)&&!VN(c))&&(c=null),new Y$(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 Q$(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:null}class e5{constructor(e,t){this.provider=e,this.tokens=t}}function t5(o,e){return o.has(e)}function $N(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:[]}async function nL(o,e,t,i){const n=$N(o,e),s=await Promise.all(n.map(async r=>{let a;try{a=await r.provideDocumentRangeSemanticTokens(e,t,i)}catch(c){ss(c),a=null}return(!a||!Vy(a))&&(a=null),new e5(r,a)}));for(const r of s)if(r.tokens)return r;return s.length>0?s[0]:null}Sn.registerCommand("_provideDocumentSemanticTokensLegend",async(o,...e)=>{const[t]=e;Gi(t instanceof un);const i=o.get(eo).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=o.get(Et),s=Q$(n,i);return s?s[0].getLegend():o.get(ys).executeCommand("_provideDocumentRangeSemanticTokensLegend",t)});Sn.registerCommand("_provideDocumentSemanticTokens",async(o,...e)=>{const[t]=e;Gi(t instanceof un);const i=o.get(eo).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=o.get(Et);if(!jN(n,i))return o.get(ys).executeCommand("_provideDocumentRangeSemanticTokens",t,i.getFullModelRange());const s=await UN(n,i,null,null,gi.None);if(!s)return;const{provider:r,tokens:a}=s;if(!a||!Vy(a))return;const c=zN({id:0,type:"full",data:a.data});return a.resultId&&r.releaseDocumentSemanticTokens(a.resultId),c});Sn.registerCommand("_provideDocumentRangeSemanticTokensLegend",async(o,...e)=>{const[t,i]=e;Gi(t instanceof un);const n=o.get(eo).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=o.get(Et),r=$N(s,n);if(r.length===0)return;if(r.length===1)return r[0].getLegend();if(!i||!B.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 nL(s,n,B.lift(i),gi.None);if(a)return a.provider.getLegend()});Sn.registerCommand("_provideDocumentRangeSemanticTokens",async(o,...e)=>{const[t,i]=e;Gi(t instanceof un),Gi(B.isIRange(i));const n=o.get(eo).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=o.get(Et),r=await nL(s,n,B.lift(i),gi.None);if(!(!r||!r.tokens))return zN({id:0,type:"full",data:r.tokens.data})});const sL="editor.semanticHighlighting";function M_(o,e,t){var n;const i=(n=t.getValue(sL,{overrideIdentifier:o.getLanguageId(),resource:o.uri}))==null?void 0:n.enabled;return typeof i=="boolean"?i:e.getColorTheme().semanticHighlighting}var qN=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},xa=function(o,e){return function(t,i){e(t,i,o)}},zl;let Bx=class extends Ve{constructor(e,t,i,n,s,r){super(),this._watchers=Object.create(null);const a=g=>{this._watchers[g.uri.toString()]=new zx(g,e,i,s,r)},c=(g,f)=>{f.dispose(),delete this._watchers[g.uri.toString()]},h=()=>{for(const g of t.getModels()){const f=this._watchers[g.uri.toString()];M_(g,i,n)?f||a(g):f&&c(g,f)}};t.getModels().forEach(g=>{M_(g,i,n)&&a(g)}),this._register(t.onModelAdded(g=>{M_(g,i,n)&&a(g)})),this._register(t.onModelRemoved(g=>{const f=this._watchers[g.uri.toString()];f&&c(g,f)})),this._register(n.onDidChangeConfiguration(g=>{g.affectsConfiguration(sL)&&h()})),this._register(i.onDidColorThemeChange(h))}dispose(){for(const e of Object.values(this._watchers))e.dispose();super.dispose()}};Bx=qN([xa(0,n1),xa(1,eo),xa(2,Pr),xa(3,Tn),xa(4,nr),xa(5,Et)],Bx);var Sc;let zx=(Sc=class extends Ve{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:zl.REQUEST_MIN_DELAY,max:zl.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new ms(()=>this._fetchDocumentSemanticTokensNow(),zl.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=()=>{Ks(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),Ks(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[],this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!jN(this._provider,this._model)){this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1);return}if(!this._model.isAttachedToEditor())return;const e=new Is,t=this._currentDocumentResponse?this._currentDocumentResponse.provider:null,i=this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,n=UN(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 Lo(!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:g}=c,f=this._semanticTokensStylingService.getStyling(h);this._setDocumentSemanticTokens(h,g||null,f,s)}},c=>{c&&(Nc(c)||typeof c.message=="string"&&c.message.indexOf("busy")!==-1)||mn(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(VN(t)){if(!s){this._model.tokenization.setSemanticTokens(null,!0);return}if(t.edits.length===0)t={resultId:t.resultId,data:s.data};else{let a=0;for(const p of t.edits)a+=(p.data?p.data.length:0)-p.deleteCount;const c=s.data,h=new Uint32Array(c.length+a);let g=c.length,f=h.length;for(let p=t.edits.length-1;p>=0;p--){const v=t.edits[p];if(v.start>c.length){i.warnInvalidEditStart(s.resultId,t.resultId,p,v.start,c.length),this._model.tokenization.setSemanticTokens(null,!0);return}const _=g-(v.start+v.deleteCount);_>0&&(zl._copy(c,g-_,h,f-_,_),f-=_),v.data&&(zl._copy(v.data,0,h,f-v.data.length,v.data.length),f-=v.data.length),g=v.start}g>0&&zl._copy(c,0,h,0,g),t={resultId:t.resultId,data:h}}}if(Vy(t)){this._currentDocumentResponse=new i5(e,t.resultId,t.data);const a=SP(t,i,this._model.getLanguageId());if(n.length>0)for(const c of n)for(const h of a)for(const g of c.changes)h.applyEdit(g.range,g.text);this._model.tokenization.setSemanticTokens(a,!0)}else this._model.tokenization.setSemanticTokens(null,!0);r()}},zl=Sc,Sc.REQUEST_MIN_DELAY=300,Sc.REQUEST_MAX_DELAY=2e3,Sc);zx=zl=qN([xa(1,n1),xa(2,Pr),xa(3,nr),xa(4,Et)],zx);class i5{constructor(e,t,i){this.provider=e,this.resultId=t,this.data=i}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}Mg(Bx);var n5=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},cf=function(o,e){return function(t,i){e(t,i,o)}},Zu;let Uv=(Zu=class extends Ve{constructor(e,t,i,n,s,r){super(),this._semanticTokensStylingService=t,this._themeService=i,this._configurationService=n,this._editor=e,this._provider=r.documentRangeSemanticTokensProvider,this._debounceInformation=s.for(this._provider,"DocumentRangeSemanticTokens",{min:100,max:500}),this._tokenizeViewport=this._register(new ms(()=>this._tokenizeViewportNow(),100)),this._outstandingRequests=[];const a=()=>{this._editor.hasModel()&&this._tokenizeViewport.schedule(this._debounceInformation.get(this._editor.getModel()))};this._register(this._editor.onDidScrollChange(()=>{a()})),this._register(this._editor.onDidChangeModel(()=>{this._cancelAll(),a()})),this._register(this._editor.onDidChangeModelContent(c=>{this._cancelAll(),a()})),this._register(this._provider.onDidChange(()=>{this._cancelAll(),a()})),this._register(this._configurationService.onDidChangeConfiguration(c=>{c.affectsConfiguration(sL)&&(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(!M_(e,this._themeService,this._configurationService)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}if(!t5(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=ks(r=>Promise.resolve(nL(this._provider,e,t,r))),s=new Lo(!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,SP(c,h,e.getLanguageId()))}).then(()=>this._removeOutstandingRequest(n),()=>this._removeOutstandingRequest(n)),n}},Zu.ID="editor.contrib.viewportSemanticTokens",Zu);Uv=n5([cf(1,n1),cf(2,Pr),cf(3,Tn),cf(4,nr),cf(5,Et)],Uv);_i(Uv.ID,Uv,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,g=0;for(;c>=0;c--){const f=s.charCodeAt(c);if(c!==a&&(f===95||f===45))break;if(mk(f)&&_k(g))break;g=f}for(c+=1;h<s.length;h++){const f=s.charCodeAt(h);if(_k(f)&&mk(g))break;if(f===95||f===45)break;g=f}c<h&&e.push({range:new B(i.lineNumber,r+c,i.lineNumber,r+h)})}_addWordRanges(e,t,i){const n=t.getWordAtPosition(i);n&&e.push({range:new B(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 B(i.lineNumber,1,i.lineNumber,t.getLineMaxColumn(i.lineNumber))})}}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},r5=function(o,e){return function(t,i){e(t,i,o)}},Vx;class oL{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 oL(t,this.ranges);return i.ranges[t].equalsRange(this.ranges[this.index])?i.mov(e):i}}var Qd;let Ep=(Qd=class{static get(e){return e.getContribution(Vx.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 GN(this._languageFeaturesService.selectionRangeProvider,i,t.map(s=>s.getPosition()),this._editor.getOption(114),gi.None).then(s=>{var r;if(!(!Fo(s)||s.length!==t.length)&&!(!this._editor.hasModel()||!Oa(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 oL(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=>Xt.fromPositions(s.ranges[s.index].getStartPosition(),s.ranges[s.index].getEndPosition()));this._ignoreSelection=!0;try{this._editor.setSelections(n)}finally{this._ignoreSelection=!1}}},Vx=Qd,Qd.ID="editor.contrib.smartSelectController",Qd);Ep=Vx=o5([r5(1,Et)],Ep);class KN extends Se{constructor(e,t){super(t),this._forward=e}async run(e,t){const i=Ep.get(t);i&&await i.run(this._forward)}}class a5 extends KN{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:y("smartSelect.expand","Expand Selection"),alias:"Expand Selection",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:lt.MenubarSelectionMenu,group:"1_basic",title:y({key:"miSmartSelectGrow",comment:["&& denotes a mnemonic"]},"&&Expand Selection"),order:2}})}}Sn.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand");class l5 extends KN{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:y("smartSelect.shrink","Shrink Selection"),alias:"Shrink Selection",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:lt.MenubarSelectionMenu,group:"1_basic",title:y({key:"miSmartSelectShrink",comment:["&& denotes a mnemonic"]},"&&Shrink Selection"),order:3}})}}_i(Ep.ID,Ep,4);se(a5);se(l5);async function GN(o,e,t,i,n){const s=o.all(e).concat(new s5(i.selectSubwords));s.length===1&&s.unshift(new Dv);const r=[],a=[];for(const c of s)r.push(Promise.resolve(c.provideSelectionRanges(e,t,n)).then(h=>{if(Fo(h)&&h.length===t.length)for(let g=0;g<t.length;g++){a[g]||(a[g]=[]);for(const f of h[g])B.isIRange(f.range)&&B.containsPosition(f.range,t[g])&&a[g].push(B.lift(f.range))}},ss));return await Promise.all(r),a.map(c=>{if(c.length===0)return[];c.sort((p,v)=>Dt.isBefore(p.getStartPosition(),v.getStartPosition())?1:Dt.isBefore(v.getStartPosition(),p.getStartPosition())||Dt.isBefore(p.getEndPosition(),v.getEndPosition())?-1:Dt.isBefore(v.getEndPosition(),p.getEndPosition())?1:0);const h=[];let g;for(const p of c)(!g||B.containsRange(p,g)&&!B.equalsRange(p,g))&&(h.push(p),g=p);if(!i.selectLeadingAndTrailingWhitespace)return h;const f=[h[0]];for(let p=1;p<h.length;p++){const v=h[p-1],_=h[p];if(_.startLineNumber!==v.startLineNumber||_.endLineNumber!==v.endLineNumber){const w=new B(v.startLineNumber,e.getLineFirstNonWhitespaceColumn(v.startLineNumber),v.endLineNumber,e.getLineLastNonWhitespaceColumn(v.endLineNumber));w.containsRange(v)&&!w.equalsRange(v)&&_.containsRange(w)&&!_.equalsRange(w)&&f.push(w);const S=new B(v.startLineNumber,1,v.endLineNumber,e.getLineMaxColumn(v.endLineNumber));S.containsRange(v)&&!S.equalsRange(w)&&_.containsRange(S)&&!_.equalsRange(S)&&f.push(S)}f.push(_)}return f})}Sn.registerCommand("_executeSelectionRangeProvider",async function(o,...e){const[t,i]=e;Gi(un.isUri(t));const n=o.get(Et).selectionRangeProvider,s=await o.get(la).createModelReference(t);try{return GN(n,s.object.textEditorModel,i,{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},gi.None)}finally{s.dispose()}});const c5=Object.freeze({View:kt("view","View"),Help:kt("help","Help"),Test:kt("test","Test"),File:kt("file","File"),Preferences:kt("preferences","Preferences"),Developer:kt({key:"developer",comment:["A developer on Code itself or someone diagnosing issues in Code"]},"Developer")});class Vf{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&&Oa(this.startLineNumbers,e.startLineNumbers)&&Oa(this.endLineNumbers,e.endLineNumbers)}static get Empty(){return new Vf([],[],0)}}const oD=UE("stickyScrollViewLayer",{createHTML:o=>o}),qw="data-sticky-line-index",rD="data-sticky-is-line",d5="data-sticky-is-line-number",aD="data-sticky-is-folding-icon";class h5 extends Ve{constructor(e){super(),this._editor=e,this._foldingIconStore=new Be,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 Er),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(Ui(this._lineNumbersDomNode,jn.MOUSE_ENTER,()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)})),this._foldingIconStore.add(Ui(this._lineNumbersDomNode,jn.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 Dt(t,1)).lineNumber,a=s.getViewLineRenderingData(r),c=this._editor.getOption(68);let h;try{h=rp.filter(a.inlineDecorations,r,a.minColumn,a.maxColumn)}catch{h=[]}const g=new KE(!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),f=new $E(2e3),p=qE(g,f);let v;oD?v=oD.createHTML(f.build()):v=f.build();const _=document.createElement("span");_.setAttribute(qw,String(e)),_.setAttribute(rD,""),_.setAttribute("role","listitem"),_.tabIndex=0,_.className="sticky-line-content",_.classList.add(`stickyLine${t}`),_.style.lineHeight=`${this._lineHeight}px`,_.innerHTML=v;const w=document.createElement("span");w.setAttribute(qw,String(e)),w.setAttribute(d5,""),w.className="sticky-line-number",w.style.lineHeight=`${this._lineHeight}px`;const S=n.contentLeft;w.style.width=`${S}px`;const D=document.createElement("span");c.renderType===1||c.renderType===3&&t%10===0?D.innerText=t.toString():c.renderType===2&&(D.innerText=Math.abs(t-this._editor.getPosition().lineNumber).toString()),D.className="sticky-line-number-inner",D.style.lineHeight=`${this._lineHeight}px`,D.style.width=`${n.lineNumbersWidth}px`,D.style.paddingLeft=`${n.lineNumbersLeft}px`,w.appendChild(D);const E=this._renderFoldingIconForLine(i,t);E&&w.appendChild(E.domNode),this._editor.applyFontInfo(_),this._editor.applyFontInfo(D),w.style.lineHeight=`${this._lineHeight}px`,_.style.lineHeight=`${this._lineHeight}px`,w.style.height=`${this._lineHeight}px`,_.style.height=`${this._lineHeight}px`;const R=new u5(e,t,_,w,E,p.characterMapping,_.scrollWidth);return this._updateTopAndZIndexOfStickyLine(R)}_updateTopAndZIndexOfStickyLine(e){var g;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+((g=e.foldingIcon)!=null&&g.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 g5(c,r,n.getEndLineNumber(s),this._lineHeight);return h.setVisible(this._isOnGlyphMargin?!0:c||i==="always"),h.domNode.setAttribute(aD,""),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=oF(t.characterMapping,e,0);return new Dt(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,qw);return t?parseInt(t,10):null}isInStickyLine(e){return this._getAttributeValue(e,rD)!==void 0}isInFoldingIconDomNode(e){return this._getAttributeValue(e,aD)!==void 0}_getAttributeValue(e,t){for(;e&&e!==this._rootDomNode;){const i=e.getAttribute(t);if(i!==null)return i;e=e.parentElement}}}class u5{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 g5{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?_v:mv)}setVisible(e){this.domNode.style.cursor=e?"pointer":"default",this.domNode.style.opacity=e?"1":"0"}}class jf{constructor(e,t){this.startLineNumber=e,this.endLineNumber=t}}class $v{constructor(e,t,i){this.range=e,this.children=t,this.parent=i}}class ZN{constructor(e,t,i,n){this.uri=e,this.version=t,this.element=i,this.outlineProviderId=n}}var jy=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},Pp=function(o,e){return function(t,i){e(t,i,o)}},Uf;(function(o){o.OUTLINE_MODEL="outlineModel",o.FOLDING_PROVIDER_MODEL="foldingProviderModel",o.INDENTATION_MODEL="indentationModel"})(Uf||(Uf={}));var ic;(function(o){o[o.VALID=0]="VALID",o[o.INVALID=1]="INVALID",o[o.CANCELED=2]="CANCELED"})(ic||(ic={}));let jx=class extends Ve{constructor(e,t,i,n){switch(super(),this._editor=e,this._modelProviders=[],this._modelPromise=null,this._updateScheduler=this._register(new Lc(300)),this._updateOperation=this._register(new Be),this._editor.getOption(116).defaultModel){case Uf.OUTLINE_MODEL:this._modelProviders.push(new Ux(this._editor,n));case Uf.FOLDING_PROVIDER_MODEL:this._modelProviders.push(new qx(this._editor,t,n));case Uf.INDENTATION_MODEL:this._modelProviders.push(new $x(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 ic.CANCELED:return this._updateOperation.clear(),null;case ic.VALID:return t.stickyModel}}return null}).catch(t=>(mn(t),null))}};jx=jy([Pp(2,ai),Pp(3,Et)],jx);class XN extends Ve{constructor(e){super(),this._editor=e,this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,ic.INVALID}computeStickyModel(e){if(e.isCancellationRequested||!this.isProviderValid())return{statusPromise:this._invalid(),modelPromise:null};const t=ks(i=>this.createModelFromProvider(i));return{statusPromise:t.then(i=>this.isModelValid(i)?e.isCancellationRequested?ic.CANCELED:(this._stickyModel=this.createStickyModel(e,i),ic.VALID):this._invalid()).then(void 0,i=>(mn(i),ic.CANCELED)),modelPromise:t}}isModelValid(e){return!0}isProviderValid(){return!0}}let Ux=class extends XN{constructor(e,t){super(e),this._languageFeaturesService=t}createModelFromProvider(e){return Ya.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 ZN(s.uri,s.getVersionId(),i,n)}isModelValid(e){return e&&e.children.size>0}_stickyModelFromOutlineModel(e,t){let i;if(ll.first(e.children.values())instanceof _N){const a=ll.find(e.children.values(),c=>c.id===t);if(a)i=a.children;else{let c="",h=-1,g;for(const[f,p]of e.children.entries()){const v=this._findSumOfRangesOfGroup(p);v>h&&(g=p,h=v,c=p.id)}t=c,i=g.children}}else i=e.children;const n=[],s=Array.from(i.values()).sort((a,c)=>{const h=new jf(a.symbol.range.startLineNumber,a.symbol.range.endLineNumber),g=new jf(c.symbol.range.startLineNumber,c.symbol.range.endLineNumber);return this._comparator(h,g)});for(const a of s)n.push(this._stickyModelFromOutlineElement(a,a.symbol.selectionRange.startLineNumber));return{stickyOutlineElement:new $v(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 jf(e.symbol.selectionRange.startLineNumber,e.symbol.range.endLineNumber);return new $v(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 NC?t+e.symbol.range.endLineNumber-e.symbol.selectionRange.startLineNumber:t}};Ux=jy([Pp(1,Et)],Ux);class YN extends XN{constructor(e){super(e),this._foldingLimitReporter=new fN(e)}createStickyModel(e,t){const i=this._fromFoldingRegions(t),n=this._editor.getModel();return new ZN(n.uri,n.getVersionId(),i,void 0)}isModelValid(e){return e!==null}_fromFoldingRegions(e){const t=e.length,i=[],n=new $v(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 $v(new jf(e.getStartLineNumber(s),e.getEndLineNumber(s)+1),[],a);a.children.push(c),i.push(c)}return n}}let $x=class extends YN{constructor(e,t){super(e),this._languageConfigurationService=t,this.provider=this._register(new U1(e.getModel(),this._languageConfigurationService,this._foldingLimitReporter))}async createModelFromProvider(e){return this.provider.compute(e)}};$x=jy([Pp(1,ws)],$x);let qx=class extends YN{constructor(e,t,i){super(e),this._languageFeaturesService=i;const n=Pc.getFoldingRangeProviders(this._languageFeaturesService,e.getModel());n.length>0&&(this.provider=this._register(new $1(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}};qx=jy([Pp(2,Et)],qx);var f5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},lD=function(o,e){return function(t,i){e(t,i,o)}};class p5{constructor(e,t,i){this.startLineNumber=e,this.endLineNumber=t,this.nestingDepth=i}}let Kx=class extends Ve{constructor(e,t,i){super(),this._languageFeaturesService=t,this._languageConfigurationService=i,this._onDidChangeStickyScroll=this._register(new ui),this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event,this._model=null,this._cts=null,this._stickyModelProvider=null,this._editor=e,this._sessionStore=this._register(new Be),this._updateSoon=this._register(new ms(()=>this.update(),50)),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(116)&&this.readConfiguration()})),this.readConfiguration()}readConfiguration(){this._sessionStore.clear(),this._editor.getOption(116).enabled&&(this._sessionStore.add(this._editor.onDidChangeModel(()=>{this._model=null,this.updateStickyModelProvider(),this._onDidChangeStickyScroll.fire(),this.update()})),this._sessionStore.add(this._editor.onDidChangeHiddenAreas(()=>this.update())),this._sessionStore.add(this._editor.onDidChangeModelContent(()=>this._updateSoon.schedule())),this._sessionStore.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>this.update())),this._sessionStore.add(En(()=>{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 jx(e,()=>this._updateSoon.schedule(),this._languageConfigurationService,this._languageFeaturesService))}async update(){var e;(e=this._cts)==null||e.dispose(!0),this._cts=new Is,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 g=0;g<t.children.length;g++){const f=t.children[g];f.range&&a.push(f.range.startLineNumber)}const c=this.updateIndex(U_(a,e.startLineNumber,(g,f)=>g-f)),h=this.updateIndex(U_(a,e.startLineNumber+n,(g,f)=>g-f));for(let g=c;g<=h;g++){const f=t.children[g];if(!f)return;if(f.range){const p=f.range.startLineNumber,v=f.range.endLineNumber;e.startLineNumber<=v+1&&p-1<=e.endLineNumber&&p!==r&&(r=p,i.push(new p5(p,v-1,n+1)),this.getCandidateStickyLinesIntersectingFromStickyModel(e,f,i,n+1,p))}else this.getCandidateStickyLinesIntersectingFromStickyModel(e,f,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}};Kx=f5([lD(1,Et),lD(2,ws)],Kx);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},eu=function(o,e){return function(t,i){e(t,i,o)}},Gx,eh;let Cl=(eh=class extends Ve{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 Be,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 h5(this._editor),this._stickyLineCandidateProvider=new Kx(this._editor,i,s),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=Vf.Empty,this._onDidResize(),this._readConfiguration();const c=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeConfiguration(g=>{this._readConfigurationChange(g)})),this._register(Ui(c,jn.CONTEXT_MENU,async g=>{this._onContextMenu(ld(c),g)})),this._stickyScrollFocusedContextKey=M.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=M.stickyScrollVisible.bindTo(this._contextKeyService);const h=this._register(eg(c));this._register(h.onDidBlur(g=>{this._positionRevealed===!1&&c.clientHeight===0?(this._focusedStickyElementIndex=-1,this.focus()):this._disposeFocusStickyScrollStore()})),this._register(h.onDidFocus(g=>{this.focus()})),this._registerMouseListeners(),this._register(Ui(c,jn.MOUSE_DOWN,g=>{this._onMouseDown=!0}))}static get(e){return e.getContribution(Gx.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 Be,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(B.fromPositions(e)),this._editor.focus()}_registerMouseListeners(){const e=this._register(new Be),t=this._register(new My(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 B(a.lineNumber,a.column,a.lineNumber,a.column+r.innerText.length),textElement:r}:null},n=this._stickyScrollWidget.getDomNode();this._register(ml(n,jn.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 g=new Dt(this._endLineNumbers[h],1);this._revealLineInCenterIfOutsideViewport(g);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 Dt(h,1)}this._revealPosition(c)})),this._register(ml(n,jn.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(Ui(n,jn.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 g=new Is;e.add(En(()=>g.dispose(!0)));let f;pm(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new Dt(c.startLineNumber,c.startColumn+1),!1,g.token).then((p=>{if(!g.token.isCancellationRequested)if(p.length!==0){this._candidateDefinitionsLength=p.length;const v=h;f!==v?(e.clear(),f=v,f.style.textDecoration="underline",e.add(En(()=>{f.style.textDecoration="none"}))):f||(f=v,f.style.textDecoration="underline",e.add(En(()=>{f.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(YM,s,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor})))}))}_onContextMenu(e,t){const i=new rF(e,t);this._contextMenuService.showContextMenu({menuId:lt.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;z1(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=Pc.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=Vf.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 jf(a[0].startLineNumber,a[a.length-1].endLineNumber),h=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(c);for(const g of h){const f=g.startLineNumber,p=g.endLineNumber,v=g.nestingDepth;if(p-f>0){const _=(v-1)*e,w=v*e,S=this._editor.getBottomForLineNumber(f)-i,D=this._editor.getTopForLineNumber(p)-i,E=this._editor.getBottomForLineNumber(p)-i;if(_>D&&_<=E){s.push(f),r.push(p+1),n=E-w;break}else w>S&&w<=E&&(s.push(f),r.push(p+1));if(s.length===t)break}}}return this._endLineNumbers=r,new Vf(s,r,n,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}},Gx=eh,eh.ID="store.contrib.stickyScrollController",eh);Cl=Gx=m5([eu(1,Eg),eu(2,Et),eu(3,ai),eu(4,ws),eu(5,nr),eu(6,$i)],Cl);class _5 extends uo{constructor(){super({id:"editor.action.toggleStickyScroll",title:{...kt("toggleEditorStickyScroll","Toggle Editor Sticky Scroll"),mnemonicTitle:y({key:"mitoggleStickyScroll",comment:["&& denotes a mnemonic"]},"&&Toggle Editor Sticky Scroll")},metadata:{description:kt("toggleEditorStickyScroll.description","Toggle/enable the editor sticky scroll which shows the nested scopes at the top of the viewport")},category:c5.View,toggled:{condition:le.equals("config.editor.stickyScroll.enabled",!0),title:y("stickyScroll","Sticky Scroll"),mnemonicTitle:y({key:"miStickyScroll",comment:["&& denotes a mnemonic"]},"&&Sticky Scroll")},menu:[{id:lt.CommandPalette},{id:lt.MenubarAppearanceMenu,group:"4_editor",order:3},{id:lt.StickyScrollContext}]})}async run(e){const t=e.get(Tn),i=!t.getValue("editor.stickyScroll.enabled");return t.updateValue("editor.stickyScroll.enabled",i)}}const Uy=100;class v5 extends na{constructor(){super({id:"editor.action.focusStickyScroll",title:{...kt("focusStickyScroll","Focus on the editor sticky scroll"),mnemonicTitle:y({key:"mifocusStickyScroll",comment:["&& denotes a mnemonic"]},"&&Focus Sticky Scroll")},precondition:le.and(le.has("config.editor.stickyScroll.enabled"),M.stickyScrollVisible),menu:[{id:lt.CommandPalette}]})}runEditorCommand(e,t){var i;(i=Cl.get(t))==null||i.focus()}}class b5 extends na{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:kt("selectNextStickyScrollLine.title","Select the next editor sticky scroll line"),precondition:M.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:Uy,primary:18}})}runEditorCommand(e,t){var i;(i=Cl.get(t))==null||i.focusNext()}}class y5 extends na{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:kt("selectPreviousStickyScrollLine.title","Select the previous sticky scroll line"),precondition:M.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:Uy,primary:16}})}runEditorCommand(e,t){var i;(i=Cl.get(t))==null||i.focusPrevious()}}class w5 extends na{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:kt("goToFocusedStickyScrollLine.title","Go to the focused sticky scroll line"),precondition:M.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:Uy,primary:3}})}runEditorCommand(e,t){var i;(i=Cl.get(t))==null||i.goToFocused()}}class S5 extends na{constructor(){super({id:"editor.action.selectEditor",title:kt("selectEditor.title","Select Editor"),precondition:M.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:Uy,primary:9}})}runEditorCommand(e,t){var i;(i=Cl.get(t))==null||i.selectEditor()}}_i(Cl.ID,Cl,1);cn(_5);cn(v5);cn(y5);cn(b5);cn(w5);cn(S5);var JN=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},Lf=function(o,e){return function(t,i){e(t,i,o)}};class C5{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 Zx=class extends aF{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=ll.slice(t,i),s=ll.slice(t,0,i);let r=5;for(const a of ll.concat(n,s)){if(a.score===np.Default)continue;const c=new B(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 C5(c,h,a.filterTextLow??a.labelLow,a.completion.additionalTextEdits,a.completion.command,a)),r-->=0&&a.resolve(gi.None)}return e}};Zx=JN([Lf(5,Wy)],Zx);let Xx=class extends Ve{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(yu.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(yu.valueFor(r,c)!=="inline")return;let h=e.getWordAtPosition(t),g;if(h!=null&&h.word||(g=this._getTriggerCharacterInfo(e,t)),!(h!=null&&h.word)&&!g||(h||(h=e.getWordUntilPosition(t)),h.endColumn!==t.column))return;let f;const p=e.getValueInRange(new B(t.lineNumber,1,t.lineNumber,t.column));if(!g&&((v=this._lastResult)!=null&&v.canBeReused(e,t.lineNumber,h))){const _=new KI(p,t.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=_,this._lastResult.acquire(),f=this._lastResult}else{const _=await q1(this._languageFeatureService.completionProvider,e,t,new wp(void 0,Pv.createSuggestFilter(s).itemKind,g==null?void 0:g.providers),g&&{triggerKind:1,triggerCharacter:g.ch},n);let w;_.needsClipboard&&(w=await this._clipboardService.readText());const S=new ql(_.items,t.column,new KI(p,0),Ev.None,s.getOption(119),s.getOption(113),{boostFullMatch:!1,firstMatchCanBeWeak:!1},w);f=new Zx(e,t.lineNumber,h,S,_,this._suggestMemoryService)}return this._lastResult=f,f}handleItemDidShow(e,t){t.completion.resolve(gi.None)}freeInlineCompletions(e){e.release()}_getTriggerCharacterInfo(e,t){var s;const i=e.getValueInRange(B.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}}};Xx=JN([Lf(0,Et),Lf(1,Pg),Lf(2,Wy),Lf(3,os)],Xx);Mg(Xx);class x5 extends Se{constructor(){super({id:"editor.action.forceRetokenize",label:y("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 Lo;i.tokenization.forceTokenization(i.getLineCount()),n.stop(),console.log(`tokenization took ${n.elapsed()}`)}}se(x5);const zb=class zb extends uo{constructor(){super({id:zb.ID,title:kt({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:kt("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=!vk.getTabFocusMode();vk.setTabFocusMode(t),t?Ir(y("toggle.tabMovesFocus.on","Pressing Tab will now move focus to the next focusable element")):Ir(y("toggle.tabMovesFocus.off","Pressing Tab will now insert the tab character"))}};zb.ID="editor.action.toggleTabFocusMode";let Yx=zb;cn(Yx);var L5=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},cD=function(o,e){return function(t,i){e(t,i,o)}};let Jx=class extends Ve{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=pt(e,yt("a.monaco-link",{tabIndex:t.tabIndex??0,href:t.href},t.label)),this.hoverDelegate=i.hoverDelegate??dy("mouse"),this.setTooltip(t.title),this.el.setAttribute("role","button");const r=this._register(new dw(this.el,"click")),a=this._register(new dw(this.el,"keypress")),c=ps.chain(a.event,f=>f.map(p=>new i1(p)).filter(p=>p.keyCode===3)),h=this._register(new dw(this.el,lF.Tap)).event;this._register(hE.addTarget(this.el));const g=ps.any(r.event,c,h);this._register(g(f=>{this.enabled&&(B_.stop(f,!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)}};Jx=L5([cD(3,em),cD(4,oa)],Jx);var QN=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},eR=function(o,e){return function(t,i){e(t,i,o)}};const k5=26;let Qx=class extends Ve{constructor(e,t){super(),this._editor=e,this.instantiationService=t,this.banner=this._register(this.instantiationService.createInstance(e0))}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,k5)}};Qx=QN([eR(1,ai)],Qx);let e0=class extends Ve{constructor(e){super(),this.instantiationService=e,this.markdownRenderer=this.instantiationService.createInstance(Ng,{}),this.element=yt("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=yt("span");return t.innerText=e,t}return this.markdownRenderer.render(e).element}clear(){Na(this.element)}show(e){Na(this.element);const t=this.getAriaLabel(e);t&&this.element.setAttribute("aria-label",t);const i=pt(this.element,yt("div.icon-container"));i.setAttribute("aria-hidden","true"),e.icon&&i.appendChild(yt(`div${Xi.asCSSSelector(e.icon)}`));const n=pt(this.element,yt("div.message-container"));if(n.setAttribute("aria-hidden","true"),n.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=pt(this.element,yt("div.message-actions-container")),e.actions)for(const r of e.actions)this._register(this.instantiationService.createInstance(Jx,this.messageActionsContainer,{...r,tabIndex:-1},{}));const s=pt(this.element,yt("div.action-container"));this.actionBar=this._register(new Yf(s)),this.actionBar.push(this._register(new sg("banner.close","Close Banner",Xi.asClassName(NE),!0,()=>{typeof e.onClose=="function"&&e.onClose()})),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};e0=QN([eR(0,ai)],e0);var rL=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},Nu=function(o,e){return function(t,i){e(t,i,o)}};const I5=es("extensions-warning-message",Qt.warning,y("warningIcon","Icon shown with a warning message in the extensions editor."));var Xu;let Tp=(Xu=class extends Ve{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:y("unicodeHighlighting.thisDocumentHasManyNonBasicAsciiUnicodeCharacters","This document contains many non-basic ASCII unicode characters"),command:new Np};else if(s.ambiguousCharacterCount>=r)a={message:y("unicodeHighlighting.thisDocumentHasManyAmbiguousUnicodeCharacters","This document contains many ambiguous unicode characters"),command:new wh};else if(s.invisibleCharacterCount>=r)a={message:y("unicodeHighlighting.thisDocumentHasManyInvisibleUnicodeCharacters","This document contains many invisible unicode characters"),command:new Mp};else throw new Error("Unreachable");this._bannerController.show({id:"unicodeHighlightBanner",message:a.message,icon:I5,actions:[{label:a.command.shortLabel,href:`command:${a.command.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(n.createInstance(Qx,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=D5(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"?cF:i)};this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?this._highlighter=new t0(this._editor,t,this._updateState,this._editorWorkerService):this._highlighter=new E5(this._editor,t,this._updateState)}getDecorationInfo(e){return this._highlighter?this._highlighter.getDecorationInfo(e):null}},Xu.ID="editor.contrib.unicodeHighlighter",Xu);Tp=rL([Nu(1,Il),Nu(2,dF),Nu(3,ai)],Tp);function D5(o,e){return{nonBasicASCII:e.nonBasicASCII===hw?!o:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments===hw?!o:e.includeComments,includeStrings:e.includeStrings===hw?!o:e.includeStrings,allowedCharacters:e.allowedCharacters,allowedLocales:e.allowedLocales}}let t0=class extends Ve{constructor(e,t,i,n){super(),this._editor=e,this._options=t,this._updateState=i,this._editorWorkerService=n,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new ms(()=>this._update(),250)),this._register(this._editor.onDidChangeModelContent(()=>{this._updateSoon.schedule()})),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII()){this._decorations.clear();return}const e=this._model.getVersionId();this._editorWorkerService.computedUnicodeHighlights(this._model.uri,this._options).then(t=>{if(this._model.isDisposed()||this._model.getVersionId()!==e)return;this._updateState(t);const i=[];if(!t.hasMore)for(const n of t.ranges)i.push({range:n,options:qv.instance.getDecorationFromOptions(this._options)});this._decorations.set(i)})}getDecorationInfo(e){if(!this._decorations.has(e))return null;const t=this._editor.getModel();if(!CP(t,e))return null;const i=t.getValueInRange(e.range);return{reason:iR(i,this._options),inComment:LP(t,e),inString:xP(t,e)}}};t0=rL([Nu(3,Il)],t0);class E5 extends Ve{constructor(e,t,i){super(),this._editor=e,this._options=t,this._updateState=i,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new ms(()=>this._update(),250)),this._register(this._editor.onDidLayoutChange(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidScrollChange(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidChangeHiddenAreas(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidChangeModelContent(()=>{this._updateSoon.schedule()})),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII()){this._decorations.clear();return}const e=this._editor.getVisibleRanges(),t=[],i={ranges:[],ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0,hasMore:!1};for(const n of e){const s=kP.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:qv.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 CP(t,e)?{reason:iR(i,this._options),inComment:LP(t,e),inString:xP(t,e)}:null}}const tR=y("unicodeHighlight.configureUnicodeHighlightOptions","Configure Unicode Highlight Options");let i0=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(Tp.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 f=i.getValueInRange(c.range).codePointAt(0),p=Kw(f);let v;switch(h.reason.kind){case 0:{ZE(h.reason.confusableWith)?v=y("unicodeHighlight.characterIsAmbiguousASCII","The character {0} could be confused with the ASCII character {1}, which is more common in source code.",p,Kw(h.reason.confusableWith.codePointAt(0))):v=y("unicodeHighlight.characterIsAmbiguous","The character {0} could be confused with the character {1}, which is more common in source code.",p,Kw(h.reason.confusableWith.codePointAt(0)));break}case 1:v=y("unicodeHighlight.characterIsInvisible","The character {0} is invisible.",p);break;case 2:v=y("unicodeHighlight.characterIsNonBasicAscii","The character {0} is not a basic ASCII character.",p);break}if(r.has(v))continue;r.add(v);const _={codePoint:f,reason:h.reason,inComment:h.inComment,inString:h.inString},w=y("unicodeHighlight.adjustSettings","Adjust settings"),S=`command:${Kv.ID}?${encodeURIComponent(JSON.stringify(_))}`,D=new $s("",!0).appendMarkdown(v).appendText(" ").appendLink(S,w,tR);s.push(new Sr(this,c.range,[D],!1,a++))}return s}renderHoverParts(e,t){return s4(e,t,this._editor,this._languageService,this._openerService)}};i0=rL([Nu(1,aa),Nu(2,oa)],i0);function n0(o){return`U+${o.toString(16).padStart(4,"0")}`}function Kw(o){let e=`\`${n0(o)}\``;return IP.isInvisibleCharacter(o)||(e+=` "${`${P5(o)}`}"`),e}function P5(o){return o===96?"`` ` ``":"`"+String.fromCodePoint(o)+"`"}function iR(o,e){return kP.computeUnicodeHighlightReason(o,e)}const Vb=class Vb{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=ki.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}};Vb.instance=new Vb;let qv=Vb;class T5 extends Se{constructor(){super({id:wh.ID,label:y("action.unicodeHighlight.disableHighlightingInComments","Disable highlighting of characters in comments"),alias:"Disable highlighting of characters in comments",precondition:void 0}),this.shortLabel=y("unicodeHighlight.disableHighlightingInComments.shortLabel","Disable Highlight In Comments")}async run(e,t,i){const n=e==null?void 0:e.get(Tn);n&&this.runAction(n)}async runAction(e){await e.updateValue(vl.includeComments,!1,2)}}class M5 extends Se{constructor(){super({id:wh.ID,label:y("action.unicodeHighlight.disableHighlightingInStrings","Disable highlighting of characters in strings"),alias:"Disable highlighting of characters in strings",precondition:void 0}),this.shortLabel=y("unicodeHighlight.disableHighlightingInStrings.shortLabel","Disable Highlight In Strings")}async run(e,t,i){const n=e==null?void 0:e.get(Tn);n&&this.runAction(n)}async runAction(e){await e.updateValue(vl.includeStrings,!1,2)}}const jb=class jb extends Se{constructor(){super({id:jb.ID,label:y("action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters","Disable highlighting of ambiguous characters"),alias:"Disable highlighting of ambiguous characters",precondition:void 0}),this.shortLabel=y("unicodeHighlight.disableHighlightingOfAmbiguousCharacters.shortLabel","Disable Ambiguous Highlight")}async run(e,t,i){const n=e==null?void 0:e.get(Tn);n&&this.runAction(n)}async runAction(e){await e.updateValue(vl.ambiguousCharacters,!1,2)}};jb.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters";let wh=jb;const Ub=class Ub extends Se{constructor(){super({id:Ub.ID,label:y("action.unicodeHighlight.disableHighlightingOfInvisibleCharacters","Disable highlighting of invisible characters"),alias:"Disable highlighting of invisible characters",precondition:void 0}),this.shortLabel=y("unicodeHighlight.disableHighlightingOfInvisibleCharacters.shortLabel","Disable Invisible Highlight")}async run(e,t,i){const n=e==null?void 0:e.get(Tn);n&&this.runAction(n)}async runAction(e){await e.updateValue(vl.invisibleCharacters,!1,2)}};Ub.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters";let Mp=Ub;const $b=class $b extends Se{constructor(){super({id:$b.ID,label:y("action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters","Disable highlighting of non basic ASCII characters"),alias:"Disable highlighting of non basic ASCII characters",precondition:void 0}),this.shortLabel=y("unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters.shortLabel","Disable Non ASCII Highlight")}async run(e,t,i){const n=e==null?void 0:e.get(Tn);n&&this.runAction(n)}async runAction(e){await e.updateValue(vl.nonBasicASCII,!1,2)}};$b.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters";let Np=$b;const qb=class qb extends Se{constructor(){super({id:qb.ID,label:y("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(xl),g=e.get(Tn);function f(_){return IP.isInvisibleCharacter(_)?y("unicodeHighlight.excludeInvisibleCharFromBeingHighlighted","Exclude {0} (invisible character) from being highlighted",n0(_)):y("unicodeHighlight.excludeCharFromBeingHighlighted","Exclude {0} from being highlighted",`${n0(_)} "${c}"`)}const p=[];if(s.kind===0)for(const _ of s.notAmbiguousInLocales)p.push({label:y("unicodeHighlight.allowCommonCharactersInLanguage",'Allow unicode characters that are more common in the language "{0}".',_),run:async()=>{R5(g,[_])}});if(p.push({label:f(n),run:()=>N5(g,[n])}),a){const _=new T5;p.push({label:_.label,run:async()=>_.runAction(g)})}else if(r){const _=new M5;p.push({label:_.label,run:async()=>_.runAction(g)})}if(s.kind===0){const _=new wh;p.push({label:_.label,run:async()=>_.runAction(g)})}else if(s.kind===1){const _=new Mp;p.push({label:_.label,run:async()=>_.runAction(g)})}else if(s.kind===2){const _=new Np;p.push({label:_.label,run:async()=>_.runAction(g)})}else A5(s);const v=await h.pick(p,{title:tR});v&&await v.run()}};qb.ID="editor.action.unicodeHighlight.showExcludeOptions";let Kv=qb;async function N5(o,e){const t=o.getValue(vl.allowedCharacters);let i;typeof t=="object"&&t?i=t:i={};for(const n of e)i[String.fromCodePoint(n)]=!0;await o.updateValue(vl.allowedCharacters,i,2)}async function R5(o,e){var n;const t=(n=o.inspect(vl.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(vl.allowedLocales,i,2)}function A5(o){throw new Error(`Unexpected value: ${o}`)}se(wh);se(Mp);se(Np);se(Kv);_i(Tp.ID,Tp,1);Ph.register(i0);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},dD=function(o,e){return function(t,i){e(t,i,o)}};const nR="ignoreUnusualLineTerminators";function F5(o,e,t){o.setModelProperty(e.uri,nR,t)}function H5(o,e){return o.getModelProperty(e.uri,nR)}var Yu;let Gv=(Yu=class extends Ve{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()||H5(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:y("unusualLineTerminators.title","Unusual Line Terminators"),message:y("unusualLineTerminators.message","Detected unusual line terminators"),detail:y("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`.",Ha(e.uri)),primaryButton:y({key:"unusualLineTerminators.fix",comment:["&& denotes a mnemonic"]},"&&Remove Unusual Line Terminators"),cancelButton:y("unusualLineTerminators.ignore","Ignore")})}finally{this._isPresentingDialog=!1}if(!i.confirmed){F5(this._codeEditorService,e,!0);return}e.removeUnusualLineTerminators(this._editor.getSelections())}},Yu.ID="editor.contrib.unusualLineTerminatorsDetector",Yu);Gv=O5([dD(1,s1),dD(2,os)],Gv);_i(Gv.ID,Gv,1);var W5=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},B5=function(o,e){return function(t,i){e(t,i,o)}};class hD{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,bk,!1).map(a=>({range:a.range,kind:q_.Text})):Promise.resolve(n)}provideMultiDocumentHighlights(e,t,i,n){const s=new xc,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,bk,!1).map(g=>({range:g.range,kind:q_.Text}));h&&s.set(a.uri,h)}return s}}let s0=class extends Ve{constructor(e){super(),this._register(e.documentHighlightProvider.register("*",new hD)),this._register(e.multiDocumentHighlightProvider.register("*",new hD))}};s0=W5([B5(0,Et)],s0);var sR=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},N_=function(o,e){return function(t,i){e(t,i,o)}},Jn,o0;const aL=new Ri("hasWordHighlights",!1);function oR(o,e,t,i){const n=o.ordered(e);return J0(n.map(s=>()=>Promise.resolve(s.provideDocumentHighlights(e,t,i)).then(void 0,ss)),s=>s!=null).then(s=>{if(s){const r=new xc;return r.set(e.uri,s),r}return new xc})}function z5(o,e,t,i,n,s){const r=o.ordered(e);return J0(r.map(a=>()=>{const c=s.filter(h=>uF(h)).filter(h=>gF(a.selector,h.uri,h.getLanguageId(),!0,void 0,void 0)>0);return Promise.resolve(a.provideMultiDocumentHighlights(e,t,c,n)).then(void 0,ss)}),a=>a!=null)}class rR{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=ks(e=>this._compute(this._model,this._selection,this._wordSeparators,e))),this._result}_getCurrentWordRange(e,t){const i=e.getWordAtPosition(t.getPosition());return i?new B(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,g=i.length;!c&&h<g;h++){const f=i.getRange(h);f&&f.startLineNumber===n&&f.startColumn<=s&&f.endColumn>=r&&(c=!0)}return c}cancel(){this.result.cancel()}}class V5 extends rR{constructor(e,t,i,n){super(e,t,i),this._providers=n}_compute(e,t,i,n){return oR(this._providers,e,t.getPosition(),n).then(s=>s||new xc)}}class j5 extends rR{constructor(e,t,i,n,s){super(e,t,i),this._providers=n,this._otherModels=s}_compute(e,t,i,n){return z5(this._providers,e,t.getPosition(),i,n,this._otherModels).then(s=>s||new xc)}}function U5(o,e,t,i,n){return new V5(e,t,n,o)}function $5(o,e,t,i,n,s){return new j5(e,t,n,o,s)}fo("_executeDocumentHighlights",async(o,e,t)=>{const i=o.get(Et),n=await oR(i.documentHighlightProvider,e,t,gi.None);return n==null?void 0:n.get(e.uri)});var Cc;let r0=(Cc=class{constructor(e,t,i,n,s){this.toUnhook=new Be,this.workerRequestTokenId=0,this.workerRequestCompleted=!1,this.workerRequestValue=new xc,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,this.runDelayer=this.toUnhook.add(new Lc(50)),this.editor=e,this.providers=t,this.multiDocumentProviders=i,this.codeEditorService=s,this._hasWordHighlights=aL.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=>{hF(this.model.uri,"output")||this._stopAll()})),this.toUnhook.add(e.onDidChangeModel(r=>{!r.newModelUrl&&r.oldModelUrl?this._stopSingular():Jn.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=Jn.query)==null?void 0:c.modelInfo)==null?void 0:h.model);break;case"multiFile":Jn.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,Jn.query&&this._run()}hasDecorations(){return this.decorations.length>0}restore(){this.occurrencesHighlight!=="off"&&(this.runDelayer.cancel(),this._run())}_getSortedHighlights(){return this.decorations.getRanges().sort(B.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);Ir(`${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);Ir(`${r}, ${i+1} of ${e.length} for '${s.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}_removeSingleDecorations(){if(!this.editor.hasModel())return;const e=Jn.storedDecorationIDs.get(this.editor.getModel().uri);e&&(this.editor.removeDecorations(e),Jn.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()||H_(n.getModel().uri,e==null?void 0:e.uri))continue;const s=Jn.storedDecorationIDs.get(n.getModel().uri);if(!s)continue;n.removeDecorations(s),i.push(n.getModel().uri);const r=Mc.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)Jn.storedDecorationIDs.delete(n)}_stopSingular(){var e,t,i,n;this._removeSingleDecorations(),this.editor.hasTextFocus()&&(((e=this.editor.getModel())==null?void 0:e.uri.scheme)!==ro.vscodeNotebookCell&&((i=(t=Jn.query)==null?void 0:t.modelInfo)==null?void 0:i.model.uri.scheme)!==ro.vscodeNotebookCell?(Jn.query=null,this._run()):(n=Jn.query)!=null&&n.modelInfo&&(Jn.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)!==ro.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===ro.vscodeNotebookCell){const s=[],r=this.codeEditorService.listCodeEditors();for(const a of r){const c=a.getModel();c&&c!==e&&c.uri.scheme===ro.vscodeNotebookCell&&s.push(c)}return s}const i=[],n=this.codeEditorService.listCodeEditors();for(const s of n){if(!DP(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){Jn.query=null,this._stopAll();return}const a=r.startColumn,c=r.endColumn,h=this._getWord();if(!h||h.startColumn>a||h.endColumn<c){Jn.query=null,this._stopAll();return}t=this.workerRequest&&this.workerRequest.isValid(this.model,r,this.decorations),Jn.query={modelInfo:{model:this.model,selection:r},word:h}}else if(!Jn.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(H_(this.editor.getModel().uri,(n=Jn.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(!Jn.query||!Jn.query.modelInfo||Jn.query.modelInfo.model.isDisposed())return;this.workerRequest=this.computeWithModel(Jn.query.modelInfo.model,Jn.query.modelInfo.selection,Jn.query.word,a),(s=this.workerRequest)==null||s.result.then(c=>{r===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=c||[],this._beginRenderDecorations())},mn)}}computeWithModel(e,t,i,n){return n.length?$5(this.multiDocumentProviders,e,t,i,this.editor.getOption(132),n):U5(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=Mc.get(s);if(!r)continue;const a=[],c=(t=s.getModel())==null?void 0:t.uri;if(c&&this.workerRequestValue.has(c)){const h=Jn.storedDecorationIDs.get(c),g=this.workerRequestValue.get(c);if(g)for(const p of g)p.range&&a.push({range:p.range,options:NU(p.kind)});let f=[];s.changeDecorations(p=>{f=p.deltaDecorations(h??[],a)}),Jn.storedDecorationIDs=Jn.storedDecorationIDs.set(c,f),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()}},Jn=Cc,Cc.storedDecorationIDs=new xc,Cc.query=null,Cc);r0=Jn=sR([N_(4,os)],r0);var th;let Mc=(th=class extends Ve{static get(e){return e.getContribution(o0.ID)}constructor(e,t,i,n){super(),this._wordHighlighter=null;const s=()=>{e.hasModel()&&!e.getModel().isTooLargeForTokenization()&&(this._wordHighlighter=new r0(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()}},o0=th,th.ID="editor.contrib.wordHighlighter",th);Mc=o0=sR([N_(1,$i),N_(2,Et),N_(3,os)],Mc);class aR extends Se{constructor(e,t){super(t),this._isNext=e}run(e,t){const i=Mc.get(t);i&&(this._isNext?i.moveNext():i.moveBack())}}class q5 extends aR{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:y("wordHighlight.next.label","Go to Next Symbol Highlight"),alias:"Go to Next Symbol Highlight",precondition:aL,kbOpts:{kbExpr:M.editorTextFocus,primary:65,weight:100}})}}class K5 extends aR{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:y("wordHighlight.previous.label","Go to Previous Symbol Highlight"),alias:"Go to Previous Symbol Highlight",precondition:aL,kbOpts:{kbExpr:M.editorTextFocus,primary:1089,weight:100}})}}class G5 extends Se{constructor(){super({id:"editor.action.wordHighlight.trigger",label:y("wordHighlight.trigger.label","Trigger Symbol Highlight"),alias:"Trigger Symbol Highlight",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:0,weight:100}})}run(e,t,i){const n=Mc.get(t);n&&n.restoreViewState(!0)}}_i(Mc.ID,Mc,0);se(q5);se(K5);se(G5);Mg(s0);class $y extends go{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){if(!t.hasModel())return;const n=Ih(t.getOption(132),t.getOption(131)),s=t.getModel(),r=t.getSelections(),a=r.length>1,c=r.map(h=>{const g=new Dt(h.positionLineNumber,h.positionColumn),f=this._move(n,s,g,this._wordNavigationType,a);return this._moveTo(h,f,this._inSelectionMode)});if(s.pushStackElement(),t._getViewModel().setCursorStates("moveWordCommand",3,c.map(h=>fF.fromModelSelection(h))),c.length===1){const h=new Dt(c[0].positionLineNumber,c[0].positionColumn);t.revealPosition(h,0)}}_moveTo(e,t,i){return i?new Xt(e.selectionStartLineNumber,e.selectionStartColumn,t.lineNumber,t.column):new Xt(t.lineNumber,t.column,t.lineNumber,t.column)}}class Oc extends $y{_move(e,t,i,n,s){return om.moveWordLeft(e,t,i,n,s)}}class Fc extends $y{_move(e,t,i,n,s){return om.moveWordRight(e,t,i,n)}}class Z5 extends Oc{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}class X5 extends Oc{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}class Y5 extends Oc{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:le.and(M.textInputFocus,(e=le.and(fy,py))==null?void 0:e.negate()),primary:2063,mac:{primary:527},weight:100}})}}class J5 extends Oc{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}class Q5 extends Oc{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}class e8 extends Oc{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:le.and(M.textInputFocus,(e=le.and(fy,py))==null?void 0:e.negate()),primary:3087,mac:{primary:1551},weight:100}})}}class t8 extends Oc{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(e,t,i,n,s){return super._move(Ih(my.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class i8 extends Oc{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(e,t,i,n,s){return super._move(Ih(my.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class n8 extends Fc{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}class s8 extends Fc{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:le.and(M.textInputFocus,(e=le.and(fy,py))==null?void 0:e.negate()),primary:2065,mac:{primary:529},weight:100}})}}class o8 extends Fc{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}class r8 extends Fc{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}class a8 extends Fc{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:le.and(M.textInputFocus,(e=le.and(fy,py))==null?void 0:e.negate()),primary:3089,mac:{primary:1553},weight:100}})}}class l8 extends Fc{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}class c8 extends Fc{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(e,t,i,n,s){return super._move(Ih(my.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class d8 extends Fc{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(e,t,i,n,s){return super._move(Ih(my.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class qy extends go{constructor(e){super(e),this._whitespaceHeuristics=e.whitespaceHeuristics,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){const n=e.get(ws);if(!t.hasModel())return;const s=Ih(t.getOption(132),t.getOption(131)),r=t.getModel(),a=t.getSelections(),c=t.getOption(6),h=t.getOption(11),g=n.getLanguageConfiguration(r.getLanguageId()).getAutoClosingPairs(),f=t._getViewModel(),p=a.map(v=>{const _=this._delete({wordSeparators:s,model:r,selection:v,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:t.getOption(9),autoClosingBrackets:c,autoClosingQuotes:h,autoClosingPairs:g,autoClosedCharacters:f.getCursorAutoClosedCharacters()},this._wordNavigationType);return new $p(_,"")});t.pushUndoStop(),t.executeCommands(this.id,p),t.pushUndoStop()}}class lL extends qy{_delete(e,t){const i=om.deleteWordLeft(e,t);return i||new B(1,1,1,1)}}class cL extends qy{_delete(e,t){const i=om.deleteWordRight(e,t);if(i)return i;const n=e.model.getLineCount(),s=e.model.getLineMaxColumn(n);return new B(n,s,n,s)}}class h8 extends lL{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:M.writable})}}class u8 extends lL{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:M.writable})}}class g8 extends lL{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:M.writable,kbOpts:{kbExpr:M.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}class f8 extends cL{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:M.writable})}}class p8 extends cL{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:M.writable})}}class m8 extends cL{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:M.writable,kbOpts:{kbExpr:M.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}class _8 extends Se{constructor(){super({id:"deleteInsideWord",precondition:M.writable,label:y("deleteInsideWord","Delete Word"),alias:"Delete Word"})}run(e,t,i){if(!t.hasModel())return;const n=Ih(t.getOption(132),t.getOption(131)),s=t.getModel(),a=t.getSelections().map(c=>{const h=om.deleteInsideWord(n,s,c);return new $p(h,"")});t.pushUndoStop(),t.executeCommands(this.id,a),t.pushUndoStop()}}Tt(new Z5);Tt(new X5);Tt(new Y5);Tt(new J5);Tt(new Q5);Tt(new e8);Tt(new n8);Tt(new s8);Tt(new o8);Tt(new r8);Tt(new a8);Tt(new l8);Tt(new t8);Tt(new i8);Tt(new c8);Tt(new d8);Tt(new h8);Tt(new u8);Tt(new g8);Tt(new f8);Tt(new p8);Tt(new m8);se(_8);class v8 extends qy{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:M.writable,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(e,t){const i=_y.deleteWordPartLeft(e);return i||new B(1,1,1,1)}}class b8 extends qy{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:M.writable,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(e,t){const i=_y.deleteWordPartRight(e);if(i)return i;const n=e.model.getLineCount(),s=e.model.getLineMaxColumn(n);return new B(n,s,n,s)}}class lR extends $y{_move(e,t,i,n,s){return _y.moveWordPartLeft(e,t,i,s)}}class y8 extends lR{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}Sn.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft");class w8 extends lR{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}Sn.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class cR extends $y{_move(e,t,i,n,s){return _y.moveWordPartRight(e,t,i)}}class S8 extends cR{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}class C8 extends cR{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:M.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}}Tt(new v8);Tt(new b8);Tt(new y8);Tt(new w8);Tt(new S8);Tt(new C8);const xL=class xL extends Ve{constructor(e){super(),this.editor=e,this._register(this.editor.onDidAttemptReadOnlyEdit(()=>this._onDidAttemptReadOnlyEdit()))}_onDidAttemptReadOnlyEdit(){const e=So.get(this.editor);if(e&&this.editor.hasModel()){let t=this.editor.getOptions().get(93);t||(this.editor.isSimpleWidget?t=new $s(y("editor.simple.readonly","Cannot edit in read-only input")):t=new $s(y("editor.readonly","Cannot edit in read-only editor"))),e.showMessage(t,this.editor.getPosition())}}};xL.ID="editor.contrib.readOnlyMessageController";let Zv=xL;_i(Zv.ID,Zv,2);var x8=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},uD=function(o,e){return function(t,i){e(t,i,o)}};let a0=class extends Ve{constructor(e,t,i){super(),this._textModel=e,this._languageFeaturesService=t,this._outlineModelService=i,this._currentModel=Ho(this,void 0);const n=cd("documentSymbolProvider.onDidChange",this._languageFeaturesService.documentSymbolProvider.onDidChange),s=cd("_textModel.onDidChangeContent",ps.debounce(r=>this._textModel.onDidChangeContent(r),()=>{},100));this._register(Jp(async(r,a)=>{n.read(r),s.read(r);const c=a.add(new _F),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(mF(tm(s=>s.range.endLineNumber-s.range.startLineNumber,ay))),n.map(s=>({name:s.name,kind:s.kind,startLineNumber:s.range.startLineNumber}))}};a0=x8([uD(1,Et),uD(2,vm)],a0);pF.setBreadcrumbsSourceFactory((o,e)=>e.createInstance(a0,o));const LL=class LL extends Ve{constructor(e){super(),this.editor=e,this.widget=null,cS&&(this._register(e.onDidChangeConfiguration(()=>this.update())),this.update())}update(){const e=!this.editor.getOption(92);!this.widget&&e?this.widget=new l0(this.editor):this.widget&&!e&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&(this.widget.dispose(),this.widget=null)}};LL.ID="editor.contrib.iPadShowKeyboard";let Xv=LL;const Kb=class Kb extends Ve{constructor(e){super(),this.editor=e,this._domNode=document.createElement("textarea"),this._domNode.className="iPadShowKeyboard",this._register(Ui(this._domNode,"touchstart",t=>{this.editor.focus()})),this._register(Ui(this._domNode,"focus",t=>{this.editor.focus()})),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return Kb.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}};Kb.ID="editor.contrib.ShowKeyboardWidget";let l0=Kb;_i(Xv.ID,Xv,3);var L8=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},gD=function(o,e){return function(t,i){e(t,i,o)}},c0,ih;let Rp=(ih=class extends Ve{static get(e){return e.getContribution(c0.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(cy.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 d0(this._editor,this._languageService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}},c0=ih,ih.ID="editor.contrib.inspectTokens",ih);Rp=c0=L8([gD(1,EP),gD(2,aa)],Rp);class k8 extends Se{constructor(){super({id:"editor.action.inspectTokens",label:wF.inspectTokensAction,alias:"Developer: Inspect Tokens",precondition:void 0})}run(e,t){const i=Rp.get(t);i==null||i.launch()}}function I8(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 D8(o,e){const t=cy.get(e);if(t)return t;const i=o.encodeLanguageId(e);return{getInitialState:()=>vF,tokenize:(n,s,r)=>yF(e,r),tokenizeEncoded:(n,s,r)=>bF(i,r)}}const Gb=class Gb extends Ve{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=D8(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 Gb._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)}W_(this._domNode,yt("h2.tm-token",void 0,I8(r),yt("span.tm-token-length",void 0,`${r.length} ${r.length===1?"char":"chars"}`))),pt(this._domNode,yt("hr.tokens-inspect-separator",{style:"clear:both"}));const a=(n<<1)+1<t.tokens2.length?this._decodeMetadata(t.tokens2[(n<<1)+1]):null;pt(this._domNode,yt("table.tm-metadata-table",void 0,yt("tbody",void 0,yt("tr",void 0,yt("td.tm-metadata-key",void 0,"language"),yt("td.tm-metadata-value",void 0,`${a?a.languageId:"-?-"}`)),yt("tr",void 0,yt("td.tm-metadata-key",void 0,"token type"),yt("td.tm-metadata-value",void 0,`${a?this._tokenTypeToString(a.tokenType):"-?-"}`)),yt("tr",void 0,yt("td.tm-metadata-key",void 0,"font style"),yt("td.tm-metadata-value",void 0,`${a?this._fontStyleToString(a.fontStyle):"-?-"}`)),yt("tr",void 0,yt("td.tm-metadata-key",void 0,"foreground"),yt("td.tm-metadata-value",void 0,`${a?xi.Format.CSS.formatHex(a.foreground):"-?-"}`)),yt("tr",void 0,yt("td.tm-metadata-key",void 0,"background"),yt("td.tm-metadata-value",void 0,`${a?xi.Format.CSS.formatHex(a.background):"-?-"}`))))),pt(this._domNode,yt("hr.tokens-inspect-separator")),i<t.tokens1.length&&pt(this._domNode,yt("span.tm-token-type",void 0,t.tokens1[i].type)),this._editor.layoutContentWidget(this)}_decodeMetadata(e){const t=cy.getColorMap(),i=tf.getLanguageId(e),n=tf.getTokenType(e),s=tf.getFontStyle(e),r=tf.getForeground(e),a=tf.getBackground(e);return{languageId:this._languageService.languageIdCodec.decodeLanguageId(i),tokenType:n,fontStyle:s,foreground:t[r],background:t[a]}}_tokenTypeToString(e){switch(e){case 0:return"Other";case 1:return"Comment";case 2:return"String";case 3:return"RegEx";default:return"??"}}_fontStyleToString(e){let t="";return e&1&&(t+="italic "),e&2&&(t+="bold "),e&4&&(t+="underline "),e&8&&(t+="strikethrough "),t.length===0&&(t="---"),t}_getTokensAtLine(e){const t=this._getStateBeforeLine(e),i=this._tokenizationSupport.tokenize(this._model.getLineContent(e),!0,t),n=this._tokenizationSupport.tokenizeEncoded(this._model.getLineContent(e),!0,t);return{startState:t,tokens1:i.tokens,tokens2:n.tokens,endState:i.endState}}_getStateBeforeLine(e){let t=this._tokenizationSupport.getInitialState();for(let i=1;i<e;i++)t=this._tokenizationSupport.tokenize(this._model.getLineContent(i),!0,t).endState;return t}getDomNode(){return this._domNode}getPosition(){return{position:this._editor.getPosition(),preference:[2,1]}}};Gb._ID="editor.contrib.inspectTokensWidget";let d0=Gb;_i(Rp.ID,Rp,4);se(k8);var E8=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},fD=function(o,e){return function(t,i){e(t,i,o)}},kf,nh;let h0=(nh=class{constructor(e,t){this.quickInputService=e,this.keybindingService=t,this.registry=sa.as(rm.Quickaccess)}provide(e){const t=new Be;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(kf.PREFIX.length));n&&n.prefix&&n.prefix!==kf.PREFIX&&this.quickInputService.quickAccess.show(n.prefix,{preserveValue:!0})})),e.items=this.getQuickAccessProviders().filter(i=>i.prefix!==kf.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:y("helpPickAriaLabel","{0}, {1}",n,t.description),description:t.description}})}},kf=nh,nh.PREFIX="?",nh);h0=kf=E8([fD(0,xl),fD(1,ds)],h0);sa.as(rm.Quickaccess).registerQuickAccessProvider({ctor:h0,prefix:"",helpEntries:[{description:SF.helpQuickAccessActionLabel}]});class dR{constructor(e){this.options=e,this.rangeHighlightDecorationId=void 0}provide(e,t,i){var r;const n=new Be;e.canAcceptInBackground=!!((r=this.options)!=null&&r.canAcceptInBackground),e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;const s=n.add(new Bo);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 Be,s=this.activeTextEditorControl;if(s&&this.canProvideWithTextEditor(s)){const r={editor:s},a=PP(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(TP(t.onCancellationRequested)(()=>{var h;return(h=r.restoreViewState)==null?void 0:h.call(r)}))}n.add(En(()=>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&&tg(`${i.getLineContent(t.range.startLineNumber)}`)}getModel(e){var t;return DP(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:hs(OE),position:Ma.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 Zb=class Zb extends dR{constructor(){super({canAcceptInBackground:!0})}provideWithoutTextEditor(e){const t=y("cannotRunGotoLine","Open a text editor first to go to a line.");return e.items=[{label:t}],e.ariaLabel=t,Ve.None}provideWithTextEditor(e,t,i){const n=e.editor,s=new Be;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(Zb.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 g=this.toRange(c.lineNumber,c.column);n.revealRangeInCenter(g,0),this.addDecorations(n,g)};r(),s.add(t.onDidChangeValue(()=>r()));const a=PP(n);return a&&a.getOptions().get(68).renderType===2&&(a.updateOptions({lineNumbers:"on"}),s.add(En(()=>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)?y("gotoLineColumnLabel","Go to line {0} and character {1}.",t,i):y("gotoLineLabel","Go to line {0}.",t);const n=e.getPosition()||{lineNumber:1,column:1},s=this.lineCount(e);return s>1?y("gotoLineLabelEmptyWithLimit","Current Line: {0}, Character: {1}. Type a line number between 1 and {2} to navigate to.",n.lineNumber,n.column,s):y("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}};Zb.PREFIX=":";let u0=Zb;var P8=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},T8=function(o,e){return function(t,i){e(t,i,o)}};let Ap=class extends u0{constructor(e){super(),this.editorService=e,this.onDidActiveTextEditorControlChange=ps.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};Ap=P8([T8(0,os)],Ap);var sh;let hR=(sh=class extends Se{constructor(){super({id:sh.ID,label:MP.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:2085,mac:{primary:293},weight:100}})}run(e){e.get(xl).quickAccess.show(Ap.PREFIX)}},sh.ID="editor.action.gotoLine",sh);se(hR);sa.as(rm.Quickaccess).registerQuickAccessProvider({ctor:Ap,prefix:Ap.PREFIX,helpEntries:[{description:MP.gotoLineActionLabel,commandId:hR.ID}]});const uR=[void 0,[]];function Gw(o,e,t=0,i=0){const n=e;return n.values&&n.values.length>1?M8(o,n.values,t,i):gR(o,e,t,i)}function M8(o,e,t,i){let n=0;const s=[];for(const r of e){const[a,c]=gR(o,r,t,i);if(typeof a!="number")return uR;n+=a,s.push(...c)}return[n,N8(s)]}function gR(o,e,t,i){const n=tP(e.original,e.originalLowercase,t,o,o.toLowerCase(),i,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return n?[n[0],ly(n)]:uR}function N8(o){const e=o.sort((n,s)=>n.start-s.start),t=[];let i;for(const n of e)!i||!R8(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 R8(o,e){return!(o.end<e.start||e.end<o.start)}function pD(o){return o.startsWith('"')&&o.endsWith('"')}const fR=" ";function g0(o){typeof o!="string"&&(o="");const e=o.toLowerCase(),{pathNormalized:t,normalized:i,normalizedLowercase:n}=mD(o),s=t.indexOf(_S)>=0,r=pD(o);let a;const c=o.split(fR);if(c.length>1)for(const h of c){const g=pD(h),{pathNormalized:f,normalized:p,normalizedLowercase:v}=mD(h);p&&(a||(a=[]),a.push({original:h,originalLowercase:h.toLowerCase(),pathNormalized:f,normalized:p,normalizedLowercase:v,expectContiguousMatch:g}))}return{original:o,originalLowercase:e,pathNormalized:t,normalized:i,normalizedLowercase:n,values:a,containsPathSeparator:s,expectContiguousMatch:r}}function mD(o){let e;Qb?e=o.replace(/\//g,_S):e=o.replace(/\\/g,_S);const t=CF(e).replace(/\s|"/g,"");return{pathNormalized:e,normalized:t,normalizedLowercase:t.toLowerCase()}}function _D(o){return Array.isArray(o)?g0(o.map(e=>e.original).join(fR)):g0(o.original)}var A8=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},vD=function(o,e){return function(t,i){e(t,i,o)}},R_,Xr;let _d=(Xr=class extends dR{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,y("cannotRunGotoSymbolWithoutEditor","To go to a symbol, first open a text editor with symbol information.")),Ve.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):Ve.None}doProvideWithoutEditorSymbols(e,t,i,n){const s=new Be;return this.provideLabelPick(i,y("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 ey,n=t.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>{this._languageFeaturesService.documentSymbolProvider.has(e)&&(n.dispose(),i.complete(!0))}));return t.add(En(()=>i.complete(!1))),i.p}doProvideWithEditorSymbols(e,t,i,n,s){var f;const r=e.editor,a=new Be;a.add(i.onDidAccept(p=>{var _;const[v]=i.selectedItems;v&&v.range&&(this.gotoLocation(e,{range:v.range.selection,keyMods:i.keyMods,preserveFocus:p.inBackground}),(_=s==null?void 0:s.handleAccept)==null||_.call(s,v),p.inBackground||i.hide())})),a.add(i.onDidTriggerItemButton(({item:p})=>{p&&p.range&&(this.gotoLocation(e,{range:p.range.selection,keyMods:i.keyMods,forceSideBySide:!0}),i.hide())}));const c=this.getDocumentSymbols(t,n);let h;const g=async p=>{h==null||h.dispose(!0),i.busy=!1,h=new Is(n),i.busy=!0;try{const v=g0(i.value.substr(R_.PREFIX.length).trim()),_=await this.doGetSymbolPicks(c,v,void 0,h.token,t);if(n.isCancellationRequested)return;if(_.length>0){if(i.items=_,p&&v.original.length===0){const w=IF(_,S=>!!(S.type!=="separator"&&S.range&&B.containsPosition(S.range.decoration,p)));w&&(i.activeItems=[w])}}else v.original.length>0?this.provideLabelPick(i,y("noMatchingSymbolResults","No matching editor symbols")):this.provideLabelPick(i,y("noSymbolResults","No editor symbols"))}finally{n.isCancellationRequested||(i.busy=!1)}};return a.add(i.onDidChangeValue(()=>g(void 0))),g((f=r.getSelection())==null?void 0:f.getPosition()),a.add(i.onDidChangeActive(()=>{const[p]=i.activeItems;p&&p.range&&(r.revealRangeInCenter(p.range.selection,0),this.addDecorations(r,p.range.decoration))})),a}async doGetSymbolPicks(e,t,i,n,s){var S,D;const r=await e;if(n.isCancellationRequested)return[];const a=t.original.indexOf(R_.SCOPE_PREFIX)===0,c=a?1:0;let h,g;t.values&&t.values.length>1?(h=_D(t.values[0]),g=_D(t.values.slice(1))):h=t;let f;const p=(D=(S=this.options)==null?void 0:S.openSideBySideDirection)==null?void 0:D.call(S);p&&(f=[{iconClass:p==="right"?Xi.asClassName(Qt.splitHorizontal):Xi.asClassName(Qt.splitVertical),tooltip:p==="right"?y("openToSide","Open to the Side"):y("openToBottom","Open to the Bottom")}]);const v=[];for(let E=0;E<r.length;E++){const R=r[E],z=xF(R.name),H=`$(${LF.toIcon(R.kind).id}) ${z}`,ee=H.length-z.length;let X=R.containerName;i!=null&&i.extraContainerLabel&&(X?X=`${i.extraContainerLabel} • ${X}`:X=i.extraContainerLabel);let me,Le,je,Ce;if(t.original.length>c){let Lt=!1;if(h!==t&&([me,Le]=Gw(H,{...t,values:void 0},c,ee),typeof me=="number"&&(Lt=!0)),typeof me!="number"&&([me,Le]=Gw(H,h,c,ee),typeof me!="number"))continue;if(!Lt&&g){if(X&&g.original.length>0&&([je,Ce]=Gw(X,g)),typeof je!="number")continue;typeof me=="number"&&(me+=je)}}const mt=R.tags&&R.tags.indexOf(1)>=0;v.push({index:E,kind:R.kind,score:me,label:H,ariaLabel:kF(R.name,R.kind),description:X,highlights:mt?void 0:{label:Le,description:Ce},range:{selection:B.collapseToStart(R.selectionRange),decoration:R.range},uri:s.uri,symbolName:z,strikethrough:mt,buttons:f})}const _=v.sort((E,R)=>a?this.compareByKindAndScore(E,R):this.compareByScore(E,R));let w=[];if(a){let H=function(){R&&typeof E=="number"&&z>0&&(R.label=K0(Xw[E]||Zw,z))},E,R,z=0;for(const ee of _)E!==ee.kind?(H(),E=ee.kind,z=1,R={type:"separator"},w.push(R)):z++,w.push(ee);H()}else _.length>0&&(w=[{label:y("symbols","symbols ({0})",v.length),type:"separator"},..._]);return w}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=Xw[e.kind]||Zw,n=Xw[t.kind]||Zw,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()}},R_=Xr,Xr.PREFIX="@",Xr.SCOPE_PREFIX=":",Xr.PREFIX_BY_CATEGORY=`${Xr.PREFIX}${Xr.SCOPE_PREFIX}`,Xr);_d=R_=A8([vD(0,Et),vD(1,vm)],_d);const Zw=y("property","properties ({0})"),Xw={5:y("method","methods ({0})"),11:y("function","functions ({0})"),8:y("_constructor","constructors ({0})"),12:y("variable","variables ({0})"),4:y("class","classes ({0})"),22:y("struct","structs ({0})"),23:y("event","events ({0})"),24:y("operator","operators ({0})"),10:y("interface","interfaces ({0})"),2:y("namespace","namespaces ({0})"),3:y("package","packages ({0})"),25:y("typeParameter","type parameters ({0})"),1:y("modules","modules ({0})"),6:y("property","properties ({0})"),9:y("enum","enumerations ({0})"),21:y("enumMember","enumeration members ({0})"),14:y("string","strings ({0})"),0:y("file","files ({0})"),17:y("array","arrays ({0})"),15:y("number","numbers ({0})"),16:y("boolean","booleans ({0})"),18:y("object","objects ({0})"),19:y("key","keys ({0})"),7:y("field","fields ({0})"),13:y("constant","constants ({0})")};var O8=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)}};let f0=class extends _d{constructor(e,t,i){super(t,i),this.editorService=e,this.onDidActiveTextEditorControlChange=ps.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};f0=O8([Yw(0,os),Yw(1,Et),Yw(2,vm)],f0);const Xb=class Xb extends Se{constructor(){super({id:Xb.ID,label:vS.quickOutlineActionLabel,alias:"Go to Symbol...",precondition:M.hasDocumentSymbolProvider,kbOpts:{kbExpr:M.focus,primary:3117,weight:100},contextMenuOpts:{group:"navigation",order:3}})}run(e){e.get(xl).quickAccess.show(_d.PREFIX,{itemActivation:DF.NONE})}};Xb.ID="editor.action.quickOutline";let Yv=Xb;se(Yv);sa.as(rm.Quickaccess).registerQuickAccessProvider({ctor:f0,prefix:_d.PREFIX,helpEntries:[{description:vS.quickOutlineActionLabel,prefix:_d.PREFIX,commandId:Yv.ID},{description:vS.quickOutlineByCategoryActionLabel,prefix:_d.PREFIX_BY_CATEGORY}]});function F8(o){const e=new Map;for(const t of o)e.set(t,(e.get(t)??0)+1);return e}class $f{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 F8($f.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=$f.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=$f.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 H8(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 Su;(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"})(Su||(Su={}));function Jw(o){return Array.isArray(o.items)}function bD(o){const e=o;return!!e.picks&&e.additionalPicks instanceof Promise}class W8 extends Ve{constructor(e,t){super(),this.prefix=e,this.options=t}provide(e,t,i){var h;const n=new Be;e.canAcceptInBackground=!!((h=this.options)!=null&&h.canAcceptInBackground),e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;let s;const r=n.add(new Bo),a=async()=>{var S;const g=r.value=new Be;s==null||s.dispose(!0),e.busy=!1,s=new Is(t);const f=s.token;let p=e.value.substring(this.prefix.length);(S=this.options)!=null&&S.shouldSkipTrimPickFilter||(p=p.trim());const v=this._getPicks(p,g,f,i),_=(D,E)=>{var H;let R,z;if(Jw(D)?(R=D.items,z=D.active):R=D,R.length===0){if(E)return!1;(p.length>0||e.hideInput)&&((H=this.options)!=null&&H.noResultsPick)&&(EF(this.options.noResultsPick)?R=[this.options.noResultsPick(p)]:R=[this.options.noResultsPick])}return e.items=R,z&&(e.activeItems=[z]),!0},w=async D=>{let E=!1,R=!1;await Promise.all([(async()=>{typeof D.mergeDelay=="number"&&(await uy(D.mergeDelay),f.isCancellationRequested)||R||(E=_(D.picks,!0))})(),(async()=>{e.busy=!0;try{const z=await D.additionalPicks;if(f.isCancellationRequested)return;let H,ee;Jw(D.picks)?(H=D.picks.items,ee=D.picks.active):H=D.picks;let X,me;if(Jw(z)?(X=z.items,me=z.active):X=z,X.length>0||!E){let Le;if(!ee&&!me){const je=e.activeItems[0];je&&H.indexOf(je)!==-1&&(Le=je)}_({items:[...H,...X],active:ee||me||Le})}}finally{f.isCancellationRequested||(e.busy=!1),R=!0}})()])};if(v!==null)if(bD(v))await w(v);else if(!(v instanceof Promise))_(v);else{e.busy=!0;try{const D=await v;if(f.isCancellationRequested)return;bD(D)?await w(D):_(D)}finally{f.isCancellationRequested||(e.busy=!1)}}};n.add(e.onDidChangeValue(()=>a())),a(),n.add(e.onDidAccept(g=>{var p;if(i!=null&&i.handleAccept){g.inBackground||e.hide(),(p=i.handleAccept)==null||p.call(i,e.activeItems[0]);return}const[f]=e.selectedItems;typeof(f==null?void 0:f.accept)=="function"&&(g.inBackground||e.hide(),f.accept(e.keyMods,g))}));const c=async(g,f)=>{var v;if(typeof f.trigger!="function")return;const p=((v=f.buttons)==null?void 0:v.indexOf(g))??-1;if(p>=0){const _=f.trigger(p,e.keyMods),w=typeof _=="number"?_:await _;if(t.isCancellationRequested)return;switch(w){case Su.NO_ACTION:break;case Su.CLOSE_PICKER:e.hide();break;case Su.REFRESH_PICKER:a();break;case Su.REMOVE_ITEM:{const S=e.items.indexOf(f);if(S!==-1){const D=e.items.slice(),E=D.splice(S,1),R=e.activeItems.filter(H=>H!==E[0]),z=e.keepScrollPosition;e.keepScrollPosition=!0,e.items=D,R&&(e.activeItems=R),e.keepScrollPosition=z}break}}}};return n.add(e.onDidTriggerItemButton(({button:g,item:f})=>c(g,f))),n.add(e.onDidTriggerSeparatorButton(({button:g,separator:f})=>c(g,f))),n}}var pR=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Kl=function(o,e){return function(t,i){e(t,i,o)}},qc,as,Da;let p0=(Da=class extends W8{constructor(e,t,i,n,s,r){super(qc.PREFIX,e),this.instantiationService=t,this.keybindingService=i,this.commandService=n,this.telemetryService=s,this.dialogService=r,this.commandsHistory=this._register(this.instantiationService.createInstance(m0)),this.options=e}async _getPicks(e,t,i,n){var v,_;const s=await this.getCommandPicks(i);if(i.isCancellationRequested)return[];const r=TP(()=>{const w=new $f;w.updateDocuments(s.map(D=>({key:D.commandId,textChunks:[this.getTfIdfChunk(D)]})));const S=w.calculateScores(e,i);return H8(S).filter(D=>D.score>qc.TFIDF_THRESHOLD).slice(0,qc.TFIDF_MAX_RESULTS)}),a=[];for(const w of s){const S=qc.WORD_FILTER(e,w.label)??void 0,D=w.commandAlias?qc.WORD_FILTER(e,w.commandAlias)??void 0:void 0;if(S||D)w.highlights={label:S,detail:this.options.showAlias?D:void 0},a.push(w);else if(e===w.commandId)a.push(w);else if(e.length>=3){const E=r();if(i.isCancellationRequested)return[];const R=E.find(z=>z.key===w.commandId);R&&(w.tfIdfScore=R.score,a.push(w))}}const c=new Map;for(const w of a){const S=c.get(w.label);S?(w.description=w.commandId,S.description=S.commandId):c.set(w.label,w)}a.sort((w,S)=>{if(w.tfIdfScore&&S.tfIdfScore)return w.tfIdfScore===S.tfIdfScore?w.label.localeCompare(S.label):S.tfIdfScore-w.tfIdfScore;if(w.tfIdfScore)return 1;if(S.tfIdfScore)return-1;const D=this.commandsHistory.peek(w.commandId),E=this.commandsHistory.peek(S.commandId);if(D&&E)return D>E?-1:1;if(D)return-1;if(E)return 1;if(this.options.suggestedCommandIds){const R=this.options.suggestedCommandIds.has(w.commandId),z=this.options.suggestedCommandIds.has(S.commandId);if(R&&z)return 0;if(R)return-1;if(z)return 1}return w.label.localeCompare(S.label)});const h=[];let g=!1,f=!0,p=!!this.options.suggestedCommandIds;for(let w=0;w<a.length;w++){const S=a[w];w===0&&this.commandsHistory.peek(S.commandId)&&(h.push({type:"separator",label:y("recentlyUsed","recently used")}),g=!0),f&&S.tfIdfScore!==void 0&&(h.push({type:"separator",label:y("suggested","similar commands")}),f=!1),p&&S.tfIdfScore===void 0&&!this.commandsHistory.peek(S.commandId)&&((v=this.options.suggestedCommandIds)!=null&&v.has(S.commandId))&&(h.push({type:"separator",label:y("commonlyUsed","commonly used")}),g=!0,p=!1),g&&S.tfIdfScore===void 0&&!this.commandsHistory.peek(S.commandId)&&!((_=this.options.suggestedCommandIds)!=null&&_.has(S.commandId))&&(h.push({type:"separator",label:y("morecCommands","other commands")}),g=!1),h.push(this.toCommandPick(S,n))}return this.hasAdditionalCommandPicks(e,i)?{picks:h,additionalPicks:(async()=>{var D;const w=await this.getAdditionalCommandPicks(s,a,e,i);if(i.isCancellationRequested)return[];const S=w.map(E=>this.toCommandPick(E,n));return f&&((D=S[0])==null?void 0:D.type)!=="separator"&&S.unshift({type:"separator",label:y("suggested","similar commands")}),S})()}:h}toCommandPick(e,t){if(e.type==="separator")return e;const i=this.keybindingService.lookupKeybinding(e.commandId),n=i?y("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){Nc(r)||this.dialogService.error(y("canNotRun","Command '{0}' resulted in an error",e.label),nv(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}},qc=Da,Da.PREFIX=">",Da.TFIDF_THRESHOLD=.5,Da.TFIDF_MAX_RESULTS=5,Da.WORD_FILTER=PF(NF,MF,TF),Da);p0=qc=pR([Kl(1,ai),Kl(2,ds),Kl(3,ys),Kl(4,ra),Kl(5,s1)],p0);var Yr;let m0=(Yr=class extends Ve{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===W0.SHUTDOWN&&this.saveState()}))}updateConfiguration(e){e&&!e.affectsConfiguration("workbench.commandPalette.history")||(this.configuredCommandsHistoryLength=as.getConfiguredCommandHistoryLength(this.configurationService),as.cache&&as.cache.limit!==this.configuredCommandsHistoryLength&&(as.cache.limit=this.configuredCommandsHistoryLength,as.hasChanges=!0))}load(){const e=this.storageService.get(as.PREF_KEY_CACHE,0);let t;if(e)try{t=JSON.parse(e)}catch(n){this.logService.error(`[CommandsHistory] invalid data: ${n}`)}const i=as.cache=new Xp(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))}as.counter=this.storageService.getNumber(as.PREF_KEY_COUNTER,0,as.counter)}push(e){as.cache&&(as.cache.set(e,as.counter++),as.hasChanges=!0)}peek(e){var t;return(t=as.cache)==null?void 0:t.peek(e)}saveState(){if(!as.cache||!as.hasChanges)return;const e={usesLRU:!0,entries:[]};as.cache.forEach((t,i)=>e.entries.push({key:i,value:t})),this.storageService.store(as.PREF_KEY_CACHE,JSON.stringify(e),0,0),this.storageService.store(as.PREF_KEY_COUNTER,as.counter,0,0),as.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:as.DEFAULT_COMMANDS_HISTORY_LENGTH}},as=Yr,Yr.DEFAULT_COMMANDS_HISTORY_LENGTH=50,Yr.PREF_KEY_CACHE="commandPalette.mru.cache",Yr.PREF_KEY_COUNTER="commandPalette.mru.counter",Yr.counter=1,Yr.hasChanges=!1,Yr);m0=as=pR([Kl(0,Rc),Kl(1,Tn),Kl(2,kh)],m0);class B8 extends p0{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&&(RF(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:AF(n.label)||n.id})}return t}}var z8=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},tu=function(o,e){return function(t,i){e(t,i,o)}};let Op=class extends B8{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[]}};Op=z8([tu(0,ai),tu(1,os),tu(2,ds),tu(3,ys),tu(4,ra),tu(5,s1)],Op);const Yb=class Yb extends Se{constructor(){super({id:Yb.ID,label:NP.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:M.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(e){e.get(xl).quickAccess.show(Op.PREFIX)}};Yb.ID="editor.action.quickCommand";let Jv=Yb;se(Jv);sa.as(rm.Quickaccess).registerQuickAccessProvider({ctor:Op,prefix:Op.PREFIX,helpEntries:[{description:NP.quickCommandHelp,commandId:Jv.ID}]});var V8=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},iu=function(o,e){return function(t,i){e(t,i,o)}};let _0=class extends _h{constructor(e,t,i,n,s,r,a){super(!0,e,t,i,n,s,r,a)}};_0=V8([iu(1,$i),iu(2,os),iu(3,Qs),iu(4,ai),iu(5,Rc),iu(6,Tn)],_0);_i(_h.ID,_0,4);class j8 extends Se{constructor(){super({id:"editor.action.toggleHighContrast",label:OF.toggleHighContrast,alias:"Toggle High Contrast Theme",precondition:void 0}),this._originalThemeName=null}run(e,t){const i=e.get(EP),n=i.getColorTheme();Jf(n.type)?(i.setTheme(this._originalThemeName||(yk(n.type)?FF:HF)),this._originalThemeName=null):(i.setTheme(yk(n.type)?WF:BF),this._originalThemeName=n.themeName)}}se(j8);let v0=null;function U8(o){v0=o}function $8(o={}){return{"Content-Type":"application/json",...o}}async function vi(o,e,t){const i=await fetch(e,{method:o,headers:$8(),body:t!==void 0?JSON.stringify(t):void 0});if(i.status===401)throw v0&&v0(),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 q8(){return await(await fetch("/she/auth/mode")).json()}async function K8(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 G8(){await fetch("/she/auth/logout",{method:"POST"})}async function Z8(o,e,t,i){const n=await fetch("/she/auth/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:o,password:e,proxyHeader:t,proxyLogoutUrl:i})});if(!n.ok){const s=await n.json().catch(()=>({error:n.statusText}));throw new Error(s.error??"Setup failed")}}function X8(){return vi("GET","/she/scripts/tree")}function Qw(o){return vi("GET",`/she/scripts/${o}`)}function jc(o,e){return vi("PUT",`/she/scripts/${o}`,{content:e})}function r_(o){return vi("DELETE",`/she/scripts/${o}`)}function yD(o,e){return vi("POST",`/she/scripts/${o}/rename`,{newPath:e})}function Y8(o){return vi("POST","/she/scripts/mkdir",{path:o})}function J8(){return vi("GET","/she/git/status")}function If(){return vi("GET","/she/status")}function mR(){return vi("POST","/she/restart")}function Q8(){return vi("POST","/she/update")}function e7(){return vi("POST","/she/check-update")}function t7(o,e){return vi("POST","/she/git/commit",{path:o,message:e})}function i7(o,e){return vi("POST","/she/git/commit",{files:o,message:e})}function wD(o){return vi("POST","/she/git/commit",{message:o})}function a_(o){return vi("POST","/she/git/push",{remote:o})}function n7(o,e){return vi("GET",`/she/git/log?path=${encodeURIComponent(o)}&limit=${e}`)}function s7(o,e){return vi("GET",`/she/git/show?hash=${encodeURIComponent(o)}&path=${encodeURIComponent(e)}`)}function dL(){return vi("GET","/she/config")}function o7(o){return vi("PUT","/she/config",o)}function _R(){return vi("GET","/she/db/docs")}function r7(o){return vi("GET",`/she/db/docs/${o}`)}function SD(o,e){return vi("PUT",`/she/db/docs/${o}`,e)}function a7(o){return vi("DELETE",`/she/db/docs/${o}`)}function vR(){return vi("GET","/she/db/views")}function l7(o){return vi("GET",`/she/db/views/${o}`)}function CD(o,e){return vi("PUT",`/she/db/views/${o}`,e)}function c7(o){return vi("DELETE",`/she/db/views/${o}`)}function d7(){return vi("GET","/she/deps")}function h7(o){return vi("GET",`/she/deps/search?q=${encodeURIComponent(o)}`)}function u7(o,e){return vi("POST","/she/deps/install",{name:o,version:null})}function g7(o){return vi("POST","/she/deps/remove",{name:o})}function f7(o){return vi("POST","/she/deps/update",{name:o})}function p7(){return vi("GET","/she/deps/outdated")}function m7(){return vi("POST","/she/deps/check-outdated")}function _7(){return vi("GET","/she/ai/conversations")}function xD(o){return vi("GET",`/she/ai/conversations/${encodeURIComponent(o)}`)}function v7(o,e,t){return vi("PUT",`/she/ai/conversations/${encodeURIComponent(o)}`,{title:e,messages:t})}function b7(o){return vi("DELETE",`/she/ai/conversations/${encodeURIComponent(o)}`)}function eS(o){return vi("GET",`/she/db/views/${o}/result`)}function bR(){return vi("GET","/she/matter/devices")}function A_(o){return vi("GET",`/she/matter/devices/${o}`)}function y7(o){return vi("POST","/she/matter/commission",o)}function w7(o){return vi("DELETE",`/she/matter/devices/${o}`)}function S7(o,e,t,i,n){return vi("POST",`/she/matter/devices/${o}/command`,{endpointId:e,clusterName:t,command:i,args:n})}function yR(){return vi("GET","/she/mqtt/state")}function LD(o,e,t=!1,i=0){return vi("POST","/she/mqtt/publish",{topic:o,payload:e,retain:t,qos:i})}function wR(){return vi("GET","/she/ai/config")}function SR(){return vi("GET","/she/ai/models")}function b0(o){return vi("GET",`/she/ai/model-info?model=${encodeURIComponent(o)}`)}function CR(o){return vi("POST","/she/ai/prompt",o)}async function xR(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:g}=await r.read();if(h)break;c+=a.decode(g,{stream:!0});const f=c.split(`
79
+ `);c=f.pop()??"";for(const p of f){if(!p.startsWith("data: "))continue;const v=p.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 C7=2e3,O_=[];function x7(){return O_.slice()}let nc=null;const Qv=new Set,Cu=new Map;let y0=null;function Fp(){let o=Qv.size;for(const e of Cu.values())o+=e.size;return o}function L7(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/she/ws`}function hL(){if(nc)return;const o=L7(),e=new WebSocket(o);nc=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};O_.length>=C7&&O_.shift(),O_.push(s),Qv.forEach(r=>r(s))}const n=Cu.get(i.type);n&&n.forEach(s=>s(i))}catch{}},e.onclose=()=>{nc===e&&(nc=null),Fp()>0&&(y0=setTimeout(hL,3e3))},e.onerror=()=>{e.close()}}function LR(){y0&&clearTimeout(y0),nc==null||nc.close(),nc=null}function kR(o){return Qv.add(o),Fp()===1&&hL(),()=>{Qv.delete(o),Fp()===0&&LR()}}function ol(o,e){return Cu.has(o)||Cu.set(o,new Set),Cu.get(o).add(e),Fp()===1&&hL(),()=>{var t;(t=Cu.get(o))==null||t.delete(e),Fp()===0&&LR()}}var k7=N('<button class="cancel svelte-1eh8v5n">Cancel</button>'),I7=N('<div class="backdrop svelte-1eh8v5n" role="presentation"></div> <div class="dialog svelte-1eh8v5n" role="dialog" aria-modal="true"><p class="svelte-1eh8v5n"> </p> <div class="actions svelte-1eh8v5n"><!> <button> </button></div></div>',1);function Vg(o,e){Vo(e,!0);let t=W(!1),i=W(""),n=W("Confirm"),s=W(!1),r=W(!1),a=null;function c(w,S){return k(i,w,!0),k(n,(S==null?void 0:S.confirm)??(S!=null&&S.alert?"OK":"Confirm"),!0),k(s,(S==null?void 0:S.danger)??!1,!0),k(r,(S==null?void 0:S.alert)??!1,!0),k(t,!0),new Promise(D=>a=D)}function h(w){k(t,!1),a==null||a(w),a=null}function g(w){u(t)&&(w.key==="Escape"&&h(!1),w.key==="Enter"&&h(!0))}var f={show:c},p=js();ls("keydown",ud,g);var v=wt(p);{var _=w=>{var S=I7(),D=wt(S),E=x(D,2),R=C(E),z=C(R),H=x(R,2),ee=C(H);{var X=Ce=>{var mt=k7();Q("click",mt,()=>h(!1)),T(Ce,mt)};U(ee,Ce=>{u(r)||Ce(X)})}var me=x(ee,2);let Le;var je=C(me);G(()=>{$(z,u(i)),Le=Zt(me,1,"svelte-1eh8v5n",null,Le,{danger:u(s)}),$(je,u(n))}),Q("click",D,()=>h(!1)),Q("click",me,()=>h(!0)),T(w,S)};U(v,w=>{u(t)&&w(_)})}return T(o,p),jo(f)}Tr(["click"]);var D7=N('<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 E7(o,e){Vo(e,!0);let t=W(!1),i=W(""),n=W(""),s=W("OK"),r=W(""),a=null,c=W(void 0);function h(D,E){return k(i,D,!0),k(n,(E==null?void 0:E.placeholder)??"",!0),k(s,(E==null?void 0:E.confirm)??"OK",!0),k(r,(E==null?void 0:E.initial)??"",!0),k(t,!0),setTimeout(()=>{if(u(c)){u(c).focus();const R=u(c).value.length;u(c).setSelectionRange(R,R)}},0),new Promise(R=>a=R)}function g(){const D=u(r).trim();D&&(k(t,!1),a==null||a(D),a=null,k(r,""))}function f(){k(t,!1),a==null||a(null),a=null,k(r,"")}function p(D){u(t)&&D.key==="Escape"&&(D.stopPropagation(),f())}var v={show:h},_=js();ls("keydown",ud,p);var w=wt(_);{var S=D=>{var E=D7(),R=wt(E),z=x(R,2),H=C(z),ee=C(H),X=x(H,2);Ls(X,mt=>k(c,mt),()=>u(c));var me=x(X,2),Le=C(me),je=x(Le,2),Ce=C(je);G(mt=>{$(ee,u(i)),pn(X,"placeholder",u(n)),je.disabled=mt,$(Ce,u(s))},[()=>!u(r).trim()]),Q("click",R,f),Q("keydown",X,mt=>{mt.key==="Enter"&&(mt.preventDefault(),g())}),Ci(X,()=>u(r),mt=>k(r,mt)),Q("click",Le,f),Q("click",je,g),T(D,E)};U(w,D=>{u(t)&&D(S)})}return T(o,_),jo(v)}Tr(["click","keydown"]);function IR(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var tS,kD;function P7(){if(kD)return tS;kD=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(ie=>{const ve=A[ie],Ze=typeof ve;(Ze==="object"||Ze==="function")&&!Object.isFrozen(ve)&&o(ve)}),A}class e{constructor(ie){ie.data===void 0&&(ie.data={}),this.data=ie.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,...ie){const ve=Object.create(null);for(const Ze in A)ve[Ze]=A[Ze];return ie.forEach(function(Ze){for(const gt in Ze)ve[gt]=Ze[gt]}),ve}const n="</span>",s=A=>!!A.scope,r=(A,{prefix:ie})=>{if(A.startsWith("language:"))return A.replace("language:","language-");if(A.includes(".")){const ve=A.split(".");return[`${ie}${ve.shift()}`,...ve.map((Ze,gt)=>`${Ze}${"_".repeat(gt+1)}`)].join(" ")}return`${ie}${A}`};class a{constructor(ie,ve){this.buffer="",this.classPrefix=ve.classPrefix,ie.walk(this)}addText(ie){this.buffer+=t(ie)}openNode(ie){if(!s(ie))return;const ve=r(ie.scope,{prefix:this.classPrefix});this.span(ve)}closeNode(ie){s(ie)&&(this.buffer+=n)}value(){return this.buffer}span(ie){this.buffer+=`<span class="${ie}">`}}const c=(A={})=>{const ie={children:[]};return Object.assign(ie,A),ie};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(ie){this.top.children.push(ie)}openNode(ie){const ve=c({scope:ie});this.add(ve),this.stack.push(ve)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(ie){return this.constructor._walk(ie,this.rootNode)}static _walk(ie,ve){return typeof ve=="string"?ie.addText(ve):ve.children&&(ie.openNode(ve),ve.children.forEach(Ze=>this._walk(ie,Ze)),ie.closeNode(ve)),ie}static _collapse(ie){typeof ie!="string"&&ie.children&&(ie.children.every(ve=>typeof ve=="string")?ie.children=[ie.children.join("")]:ie.children.forEach(ve=>{h._collapse(ve)}))}}class g extends h{constructor(ie){super(),this.options=ie}addText(ie){ie!==""&&this.add(ie)}startScope(ie){this.openNode(ie)}endScope(){this.closeNode()}__addSublanguage(ie,ve){const Ze=ie.root;ve&&(Ze.scope=`language:${ve}`),this.add(Ze)}toHTML(){return new a(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function f(A){return A?typeof A=="string"?A:A.source:null}function p(A){return w("(?=",A,")")}function v(A){return w("(?:",A,")*")}function _(A){return w("(?:",A,")?")}function w(...A){return A.map(ve=>f(ve)).join("")}function S(A){const ie=A[A.length-1];return typeof ie=="object"&&ie.constructor===Object?(A.splice(A.length-1,1),ie):{}}function D(...A){return"("+(S(A).capture?"":"?:")+A.map(Ze=>f(Ze)).join("|")+")"}function E(A){return new RegExp(A.toString()+"|").exec("").length-1}function R(A,ie){const ve=A&&A.exec(ie);return ve&&ve.index===0}const z=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function H(A,{joinWith:ie}){let ve=0;return A.map(Ze=>{ve+=1;const gt=ve;let q=f(Ze),re="";for(;q.length>0;){const ue=z.exec(q);if(!ue){re+=q;break}re+=q.substring(0,ue.index),q=q.substring(ue.index+ue[0].length),ue[0][0]==="\\"&&ue[1]?re+="\\"+String(Number(ue[1])+gt):(re+=ue[0],ue[0]==="("&&ve++)}return re}).map(Ze=>`(${Ze})`).join(ie)}const ee=/\b\B/,X="[a-zA-Z]\\w*",me="[a-zA-Z_]\\w*",Le="\\b\\d+(\\.\\d+)?",je="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Ce="\\b(0b[01]+)",mt="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Lt=(A={})=>{const ie=/^#![ ]*\//;return A.binary&&(A.begin=w(ie,/.*\b/,A.binary,/\b.*/)),i({scope:"meta",begin:ie,end:/$/,relevance:0,"on:begin":(ve,Ze)=>{ve.index!==0&&Ze.ignoreMatch()}},A)},ct={begin:"\\\\[\\s\\S]",relevance:0},li={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[ct]},zt={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[ct]},ei={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/},qe=function(A,ie,ve={}){const Ze=i({scope:"comment",begin:A,end:ie,contains:[]},ve);Ze.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const gt=D("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 Ze.contains.push({begin:w(/[ ]+/,"(",gt,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Ze},Ye=qe("//","$"),Ne=qe("/\\*","\\*/"),st=qe("#","$"),Mt={scope:"number",begin:Le,relevance:0},ni={scope:"number",begin:je,relevance:0},ci={scope:"number",begin:Ce,relevance:0},Vt={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[ct,{begin:/\[/,end:/\]/,relevance:0,contains:[ct]}]},ut={scope:"title",begin:X,relevance:0},Ii={scope:"title",begin:me,relevance:0},fi={begin:"\\.\\s*"+me,relevance:0};var Fi=Object.freeze({__proto__:null,APOS_STRING_MODE:li,BACKSLASH_ESCAPE:ct,BINARY_NUMBER_MODE:ci,BINARY_NUMBER_RE:Ce,COMMENT:qe,C_BLOCK_COMMENT_MODE:Ne,C_LINE_COMMENT_MODE:Ye,C_NUMBER_MODE:ni,C_NUMBER_RE:je,END_SAME_AS_BEGIN:function(A){return Object.assign(A,{"on:begin":(ie,ve)=>{ve.data._beginMatch=ie[1]},"on:end":(ie,ve)=>{ve.data._beginMatch!==ie[1]&&ve.ignoreMatch()}})},HASH_COMMENT_MODE:st,IDENT_RE:X,MATCH_NOTHING_RE:ee,METHOD_GUARD:fi,NUMBER_MODE:Mt,NUMBER_RE:Le,PHRASAL_WORDS_MODE:ei,QUOTE_STRING_MODE:zt,REGEXP_MODE:Vt,RE_STARTERS_RE:mt,SHEBANG:Lt,TITLE_MODE:ut,UNDERSCORE_IDENT_RE:me,UNDERSCORE_TITLE_MODE:Ii});function Mn(A,ie){A.input[A.index-1]==="."&&ie.ignoreMatch()}function Yi(A,ie){A.className!==void 0&&(A.scope=A.className,delete A.className)}function Ji(A,ie){ie&&A.beginKeywords&&(A.begin="\\b("+A.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",A.__beforeBegin=Mn,A.keywords=A.keywords||A.beginKeywords,delete A.beginKeywords,A.relevance===void 0&&(A.relevance=0))}function Fn(A,ie){Array.isArray(A.illegal)&&(A.illegal=D(...A.illegal))}function Ai(A,ie){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 Nn(A,ie){A.relevance===void 0&&(A.relevance=1)}const nn=(A,ie)=>{if(!A.beforeMatch)return;if(A.starts)throw new Error("beforeMatch cannot be used with starts");const ve=Object.assign({},A);Object.keys(A).forEach(Ze=>{delete A[Ze]}),A.keywords=ve.keywords,A.begin=w(ve.beforeMatch,p(ve.begin)),A.starts={relevance:0,contains:[Object.assign(ve,{endsParent:!0})]},A.relevance=0,delete ve.beforeMatch},Hi=["of","and","for","in","not","or","if","then","parent","list","value"],Rn="keyword";function Un(A,ie,ve=Rn){const Ze=Object.create(null);return typeof A=="string"?gt(ve,A.split(" ")):Array.isArray(A)?gt(ve,A):Object.keys(A).forEach(function(q){Object.assign(Ze,Un(A[q],ie,q))}),Ze;function gt(q,re){ie&&(re=re.map(ue=>ue.toLowerCase())),re.forEach(function(ue){const tt=ue.split("|");Ze[tt[0]]=[q,Hn(tt[0],tt[1])]})}}function Hn(A,ie){return ie?Number(ie):Wn(A)?0:1}function Wn(A){return Hi.includes(A.toLowerCase())}const dn={},sn=A=>{console.error(A)},ts=(A,...ie)=>{console.log(`WARN: ${A}`,...ie)},Ke=(A,ie)=>{dn[`${A}/${ie}`]||(console.log(`Deprecated as of ${A}. ${ie}`),dn[`${A}/${ie}`]=!0)},_t=new Error;function ri(A,ie,{key:ve}){let Ze=0;const gt=A[ve],q={},re={};for(let ue=1;ue<=ie.length;ue++)re[ue+Ze]=gt[ue],q[ue+Ze]=!0,Ze+=E(ie[ue-1]);A[ve]=re,A[ve]._emit=q,A[ve]._multi=!0}function Di(A){if(Array.isArray(A.begin)){if(A.skip||A.excludeBegin||A.returnBegin)throw sn("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),_t;if(typeof A.beginScope!="object"||A.beginScope===null)throw sn("beginScope must be object"),_t;ri(A,A.begin,{key:"beginScope"}),A.begin=H(A.begin,{joinWith:""})}}function wi(A){if(Array.isArray(A.end)){if(A.skip||A.excludeEnd||A.returnEnd)throw sn("skip, excludeEnd, returnEnd not compatible with endScope: {}"),_t;if(typeof A.endScope!="object"||A.endScope===null)throw sn("endScope must be object"),_t;ri(A,A.end,{key:"endScope"}),A.end=H(A.end,{joinWith:""})}}function gn(A){A.scope&&typeof A.scope=="object"&&A.scope!==null&&(A.beginScope=A.scope,delete A.scope)}function _n(A){gn(A),typeof A.beginScope=="string"&&(A.beginScope={_wrap:A.beginScope}),typeof A.endScope=="string"&&(A.endScope={_wrap:A.endScope}),Di(A),wi(A)}function Bn(A){function ie(re,ue){return new RegExp(f(re),"m"+(A.case_insensitive?"i":"")+(A.unicodeRegex?"u":"")+(ue?"g":""))}class ve{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(ue,tt){tt.position=this.position++,this.matchIndexes[this.matchAt]=tt,this.regexes.push([tt,ue]),this.matchAt+=E(ue)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const ue=this.regexes.map(tt=>tt[1]);this.matcherRe=ie(H(ue,{joinWith:"|"}),!0),this.lastIndex=0}exec(ue){this.matcherRe.lastIndex=this.lastIndex;const tt=this.matcherRe.exec(ue);if(!tt)return null;const Ht=tt.findIndex((fe,dt)=>dt>0&&fe!==void 0),bt=this.matchIndexes[Ht];return tt.splice(0,Ht),Object.assign(tt,bt)}}class Ze{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(ue){if(this.multiRegexes[ue])return this.multiRegexes[ue];const tt=new ve;return this.rules.slice(ue).forEach(([Ht,bt])=>tt.addRule(Ht,bt)),tt.compile(),this.multiRegexes[ue]=tt,tt}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(ue,tt){this.rules.push([ue,tt]),tt.type==="begin"&&this.count++}exec(ue){const tt=this.getMatcher(this.regexIndex);tt.lastIndex=this.lastIndex;let Ht=tt.exec(ue);if(this.resumingScanAtSamePosition()&&!(Ht&&Ht.index===this.lastIndex)){const bt=this.getMatcher(0);bt.lastIndex=this.lastIndex+1,Ht=bt.exec(ue)}return Ht&&(this.regexIndex+=Ht.position+1,this.regexIndex===this.count&&this.considerAll()),Ht}}function gt(re){const ue=new Ze;return re.contains.forEach(tt=>ue.addRule(tt.begin,{rule:tt,type:"begin"})),re.terminatorEnd&&ue.addRule(re.terminatorEnd,{type:"end"}),re.illegal&&ue.addRule(re.illegal,{type:"illegal"}),ue}function q(re,ue){const tt=re;if(re.isCompiled)return tt;[Yi,Ai,_n,nn].forEach(bt=>bt(re,ue)),A.compilerExtensions.forEach(bt=>bt(re,ue)),re.__beforeBegin=null,[Ji,Fn,Nn].forEach(bt=>bt(re,ue)),re.isCompiled=!0;let Ht=null;return typeof re.keywords=="object"&&re.keywords.$pattern&&(re.keywords=Object.assign({},re.keywords),Ht=re.keywords.$pattern,delete re.keywords.$pattern),Ht=Ht||/\w+/,re.keywords&&(re.keywords=Un(re.keywords,A.case_insensitive)),tt.keywordPatternRe=ie(Ht,!0),ue&&(re.begin||(re.begin=/\B|\b/),tt.beginRe=ie(tt.begin),!re.end&&!re.endsWithParent&&(re.end=/\B|\b/),re.end&&(tt.endRe=ie(tt.end)),tt.terminatorEnd=f(tt.end)||"",re.endsWithParent&&ue.terminatorEnd&&(tt.terminatorEnd+=(re.end?"|":"")+ue.terminatorEnd)),re.illegal&&(tt.illegalRe=ie(re.illegal)),re.contains||(re.contains=[]),re.contains=[].concat(...re.contains.map(function(bt){return Zn(bt==="self"?re:bt)})),re.contains.forEach(function(bt){q(bt,tt)}),re.starts&&q(re.starts,ue),tt.matcher=gt(tt),tt}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||{}),q(A)}function Cn(A){return A?A.endsWithParent||Cn(A.starts):!1}function Zn(A){return A.variants&&!A.cachedVariants&&(A.cachedVariants=A.variants.map(function(ie){return i(A,{variants:null},ie)})),A.cachedVariants?A.cachedVariants:Cn(A)?i(A,{starts:A.starts?i(A.starts):null}):Object.isFrozen(A)?i(A):A}var Xn="11.11.1";class xn extends Error{constructor(ie,ve){super(ie),this.name="HTMLInjectionError",this.html=ve}}const Ue=t,Z=i,Fe=Symbol("nomatch"),vt=7,Ct=function(A){const ie=Object.create(null),ve=Object.create(null),Ze=[];let gt=!0;const q="Could not find the language '{}', did you forget to load/include a language module?",re={disableAutodetect:!0,name:"Plain text",contains:[]};let ue={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:g};function tt(F){return ue.noHighlightRe.test(F)}function Ht(F){let K=F.className+" ";K+=F.parentNode?F.parentNode.className:"";const De=ue.languageDetectRe.exec(K);if(De){const Re=ii(De[1]);return Re||(ts(q.replace("{}",De[1])),ts("Falling back to no-highlight mode for this block.",F)),Re?De[1]:"no-highlight"}return K.split(/\s+/).find(Re=>tt(Re)||ii(Re))}function bt(F,K,De){let Re="",$e="";typeof K=="object"?(Re=F,De=K.ignoreIllegals,$e=K.language):(Ke("10.7.0","highlight(lang, code, ...args) has been deprecated."),Ke("10.7.0",`Please use highlight(code, options) instead.
80
+ https://github.com/highlightjs/highlight.js/issues/2277`),$e=F,Re=K),De===void 0&&(De=!0);const Me={code:Re,language:$e};si("before:highlight",Me);const Ge=Me.result?Me.result:fe(Me.language,Me.code,De);return Ge.code=Me.code,si("after:highlight",Ge),Ge}function fe(F,K,De,Re){const $e=Object.create(null);function Me(ce,He){return ce.keywords[He]}function Ge(){if(!Te.keywords){Ae.addText(_e);return}let ce=0;Te.keywordPatternRe.lastIndex=0;let He=Te.keywordPatternRe.exec(_e),rt="";for(;He;){rt+=_e.substring(ce,He.index);const Ot=ke.case_insensitive?He[0].toLowerCase():He[0],et=Me(Te,Ot);if(et){const[Ut,Gt]=et;if(Ae.addText(rt),rt="",$e[Ot]=($e[Ot]||0)+1,$e[Ot]<=vt&&(we+=Gt),Ut.startsWith("_"))rt+=He[0];else{const Ln=ke.classNameAliases[Ut]||Ut;xe(He[0],Ln)}}else rt+=He[0];ce=Te.keywordPatternRe.lastIndex,He=Te.keywordPatternRe.exec(_e)}rt+=_e.substring(ce),Ae.addText(rt)}function Yt(){if(_e==="")return;let ce=null;if(typeof Te.subLanguage=="string"){if(!ie[Te.subLanguage]){Ae.addText(_e);return}ce=fe(Te.subLanguage,_e,!0,ht[Te.subLanguage]),ht[Te.subLanguage]=ce._top}else ce=jt(_e,Te.subLanguage.length?Te.subLanguage:null);Te.relevance>0&&(we+=ce.relevance),Ae.__addSublanguage(ce._emitter,ce.language)}function ge(){Te.subLanguage!=null?Yt():Ge(),_e=""}function xe(ce,He){ce!==""&&(Ae.startScope(He),Ae.addText(ce),Ae.endScope())}function ft(ce,He){let rt=1;const Ot=He.length-1;for(;rt<=Ot;){if(!ce._emit[rt]){rt++;continue}const et=ke.classNameAliases[ce[rt]]||ce[rt],Ut=He[rt];et?xe(Ut,et):(_e=Ut,Ge(),_e=""),rt++}}function Ee(ce,He){return ce.scope&&typeof ce.scope=="string"&&Ae.openNode(ke.classNameAliases[ce.scope]||ce.scope),ce.beginScope&&(ce.beginScope._wrap?(xe(_e,ke.classNameAliases[ce.beginScope._wrap]||ce.beginScope._wrap),_e=""):ce.beginScope._multi&&(ft(ce.beginScope,He),_e="")),Te=Object.create(ce,{parent:{value:Te}}),Te}function at(ce,He,rt){let Ot=R(ce.endRe,rt);if(Ot){if(ce["on:end"]){const et=new e(ce);ce["on:end"](He,et),et.isMatchIgnored&&(Ot=!1)}if(Ot){for(;ce.endsParent&&ce.parent;)ce=ce.parent;return ce}}if(ce.endsWithParent)return at(ce.parent,He,rt)}function Kt(ce){return Te.matcher.regexIndex===0?(_e+=ce[0],1):(nt=!0,0)}function V(ce){const He=ce[0],rt=ce.rule,Ot=new e(rt),et=[rt.__beforeBegin,rt["on:begin"]];for(const Ut of et)if(Ut&&(Ut(ce,Ot),Ot.isMatchIgnored))return Kt(He);return rt.skip?_e+=He:(rt.excludeBegin&&(_e+=He),ge(),!rt.returnBegin&&!rt.excludeBegin&&(_e=He)),Ee(rt,ce),rt.returnBegin?0:He.length}function Y(ce){const He=ce[0],rt=K.substring(ce.index),Ot=at(Te,ce,rt);if(!Ot)return Fe;const et=Te;Te.endScope&&Te.endScope._wrap?(ge(),xe(He,Te.endScope._wrap)):Te.endScope&&Te.endScope._multi?(ge(),ft(Te.endScope,ce)):et.skip?_e+=He:(et.returnEnd||et.excludeEnd||(_e+=He),ge(),et.excludeEnd&&(_e=He));do Te.scope&&Ae.closeNode(),!Te.skip&&!Te.subLanguage&&(we+=Te.relevance),Te=Te.parent;while(Te!==Ot.parent);return Ot.starts&&Ee(Ot.starts,ce),et.returnEnd?0:He.length}function Pe(){const ce=[];for(let He=Te;He!==ke;He=He.parent)He.scope&&ce.unshift(He.scope);ce.forEach(He=>Ae.openNode(He))}let We={};function Ie(ce,He){const rt=He&&He[0];if(_e+=ce,rt==null)return ge(),0;if(We.type==="begin"&&He.type==="end"&&We.index===He.index&&rt===""){if(_e+=K.slice(He.index,He.index+1),!gt){const Ot=new Error(`0 width match regex (${F})`);throw Ot.languageName=F,Ot.badRule=We.rule,Ot}return 1}if(We=He,He.type==="begin")return V(He);if(He.type==="illegal"&&!De){const Ot=new Error('Illegal lexeme "'+rt+'" for mode "'+(Te.scope||"<unnamed>")+'"');throw Ot.mode=Te,Ot}else if(He.type==="end"){const Ot=Y(He);if(Ot!==Fe)return Ot}if(He.type==="illegal"&&rt==="")return _e+=`
81
+ `,1;if(pe>1e5&&pe>He.index*3)throw new Error("potential infinite loop, way more iterations than matches");return _e+=rt,rt.length}const ke=ii(F);if(!ke)throw sn(q.replace("{}",F)),new Error('Unknown language: "'+F+'"');const xt=Bn(ke);let Qe="",Te=Re||xt;const ht={},Ae=new ue.__emitter(ue);Pe();let _e="",we=0,ye=0,pe=0,nt=!1;try{if(ke.__emitTokens)ke.__emitTokens(K,Ae);else{for(Te.matcher.considerAll();;){pe++,nt?nt=!1:Te.matcher.considerAll(),Te.matcher.lastIndex=ye;const ce=Te.matcher.exec(K);if(!ce)break;const He=K.substring(ye,ce.index),rt=Ie(He,ce);ye=ce.index+rt}Ie(K.substring(ye))}return Ae.finalize(),Qe=Ae.toHTML(),{language:F,value:Qe,relevance:we,illegal:!1,_emitter:Ae,_top:Te}}catch(ce){if(ce.message&&ce.message.includes("Illegal"))return{language:F,value:Ue(K),illegal:!0,relevance:0,_illegalBy:{message:ce.message,index:ye,context:K.slice(ye-100,ye+100),mode:ce.mode,resultSoFar:Qe},_emitter:Ae};if(gt)return{language:F,value:Ue(K),illegal:!1,relevance:0,errorRaised:ce,_emitter:Ae,_top:Te};throw ce}}function dt(F){const K={value:Ue(F),illegal:!1,relevance:0,_top:re,_emitter:new ue.__emitter(ue)};return K._emitter.addText(F),K}function jt(F,K){K=K||ue.languages||Object.keys(ie);const De=dt(F),Re=K.filter(ii).filter(At).map(ge=>fe(ge,F,!1));Re.unshift(De);const $e=Re.sort((ge,xe)=>{if(ge.relevance!==xe.relevance)return xe.relevance-ge.relevance;if(ge.language&&xe.language){if(ii(ge.language).supersetOf===xe.language)return 1;if(ii(xe.language).supersetOf===ge.language)return-1}return 0}),[Me,Ge]=$e,Yt=Me;return Yt.secondBest=Ge,Yt}function Bt(F,K,De){const Re=K&&ve[K]||De;F.classList.add("hljs"),F.classList.add(`language-${Re}`)}function oi(F){let K=null;const De=Ht(F);if(tt(De))return;if(si("before:highlightElement",{el:F,language:De}),F.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",F);return}if(F.children.length>0&&(ue.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(F)),ue.throwUnescapedHTML))throw new xn("One of your code blocks includes unescaped HTML.",F.innerHTML);K=F;const Re=K.textContent,$e=De?bt(Re,{language:De,ignoreIllegals:!0}):jt(Re);F.innerHTML=$e.value,F.dataset.highlighted="yes",Bt(F,De,$e.language),F.result={language:$e.language,re:$e.relevance,relevance:$e.relevance},$e.secondBest&&(F.secondBest={language:$e.secondBest.language,relevance:$e.secondBest.relevance}),si("after:highlightElement",{el:F,result:$e,text:Re})}function ti(F){ue=Z(ue,F)}const J=()=>{it(),Ke("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function he(){it(),Ke("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Oe=!1;function it(){function F(){it()}if(document.readyState==="loading"){Oe||window.addEventListener("DOMContentLoaded",F,!1),Oe=!0;return}document.querySelectorAll(ue.cssSelector).forEach(oi)}function It(F,K){let De=null;try{De=K(A)}catch(Re){if(sn("Language definition for '{}' could not be registered.".replace("{}",F)),gt)sn(Re);else throw Re;De=re}De.name||(De.name=F),ie[F]=De,De.rawDefinition=K.bind(null,A),De.aliases&&Wt(De.aliases,{languageName:F})}function Je(F){delete ie[F];for(const K of Object.keys(ve))ve[K]===F&&delete ve[K]}function Nt(){return Object.keys(ie)}function ii(F){return F=(F||"").toLowerCase(),ie[F]||ie[ve[F]]}function Wt(F,{languageName:K}){typeof F=="string"&&(F=[F]),F.forEach(De=>{ve[De.toLowerCase()]=K})}function At(F){const K=ii(F);return K&&!K.disableAutodetect}function zi(F){F["before:highlightBlock"]&&!F["before:highlightElement"]&&(F["before:highlightElement"]=K=>{F["before:highlightBlock"](Object.assign({block:K.el},K))}),F["after:highlightBlock"]&&!F["after:highlightElement"]&&(F["after:highlightElement"]=K=>{F["after:highlightBlock"](Object.assign({block:K.el},K))})}function on(F){zi(F),Ze.push(F)}function Oi(F){const K=Ze.indexOf(F);K!==-1&&Ze.splice(K,1)}function si(F,K){const De=F;Ze.forEach(function(Re){Re[De]&&Re[De](K)})}function Vi(F){return Ke("10.7.0","highlightBlock will be removed entirely in v12.0"),Ke("10.7.0","Please use highlightElement now."),oi(F)}Object.assign(A,{highlight:bt,highlightAuto:jt,highlightAll:it,highlightElement:oi,highlightBlock:Vi,configure:ti,initHighlighting:J,initHighlightingOnLoad:he,registerLanguage:It,unregisterLanguage:Je,listLanguages:Nt,getLanguage:ii,registerAliases:Wt,autoDetection:At,inherit:Z,addPlugin:on,removePlugin:Oi}),A.debugMode=function(){gt=!1},A.safeMode=function(){gt=!0},A.versionString=Xn,A.regex={concat:w,lookahead:p,either:D,optional:_,anyNumberOfTimes:v};for(const F in Fi)typeof Fi[F]=="object"&&o(Fi[F]);return Object.assign(A,Fi),A},qt=Ct({});return qt.newInstance=()=>Ct({}),tS=qt,qt.HighlightJS=qt,qt.default=qt,tS}var T7=P7();const eb=IR(T7),ID="[A-Za-z$_][0-9A-Za-z$_]*",M7=["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"],N7=["true","false","null","undefined","NaN","Infinity"],DR=["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"],ER=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],PR=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],R7=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],A7=[].concat(PR,DR,ER);function TR(o){const e=o.regex,t=(qe,{after:Ye})=>{const Ne="</"+qe[0].slice(1);return qe.input.indexOf(Ne,Ye)!==-1},i=ID,n={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,r={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(qe,Ye)=>{const Ne=qe[0].length+qe.index,st=qe.input[Ne];if(st==="<"||st===","){Ye.ignoreMatch();return}st===">"&&(t(qe,{after:Ne})||Ye.ignoreMatch());let Mt;const ni=qe.input.substring(Ne);if(Mt=ni.match(/^\s*=/)){Ye.ignoreMatch();return}if((Mt=ni.match(/^\s+extends\s+/))&&Mt.index===0){Ye.ignoreMatch();return}}},a={$pattern:ID,keyword:M7,literal:N7,built_in:A7,"variable.language":R7},c="[0-9](_?[0-9])*",h=`\\.(${c})`,g="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${g})((${h})|\\.)?|(${h}))[eE][+-]?(${c})\\b`},{begin:`\\b(${g})\\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},p={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},v={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[o.BACKSLASH_ESCAPE,p],subLanguage:"xml"}},_={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[o.BACKSLASH_ESCAPE,p],subLanguage:"css"}},w={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[o.BACKSLASH_ESCAPE,p],subLanguage:"graphql"}},S={className:"string",begin:"`",end:"`",contains:[o.BACKSLASH_ESCAPE,p]},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]},R=[o.APOS_STRING_MODE,o.QUOTE_STRING_MODE,v,_,w,S,{match:/\$\d+/},f];p.contains=R.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(R)});const z=[].concat(E,p.contains),H=z.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(z)}]),ee={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:H},X={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"}}]},me={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:{_:[...DR,...ER]}},Le={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},je={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[ee],illegal:/%/},Ce={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function mt(qe){return e.concat("(?!",qe.join("|"),")")}const Lt={match:e.concat(/\b/,mt([...PR,"super","import"].map(qe=>`${qe}\\s*\\(`)),i,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},ct={begin:e.concat(/\./,e.lookahead(e.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},li={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},ee]},zt="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+o.UNDERSCORE_IDENT_RE+")\\s*=>",ei={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(zt)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[ee]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:H,CLASS_REFERENCE:me},illegal:/#(?![$_A-z])/,contains:[o.SHEBANG({label:"shebang",binary:"node",relevance:5}),Le,o.APOS_STRING_MODE,o.QUOTE_STRING_MODE,v,_,w,S,E,{match:/\$\d+/},f,me,{scope:"attr",match:i+e.lookahead(":"),relevance:0},ei,{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:zt,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:H}]}]},{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"]}]}]},je,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+o.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[ee,o.inherit(o.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},ct,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[ee]},Lt,Ce,X,li,{match:/\$[(.]/}]}}function uL(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Rh=uL();function MR(o){Rh=o}var Zc={exec:()=>null};function nu(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 wn(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(ao.caret,"$1"),t=t.replace(n,r),i},getRegex:()=>new RegExp(t,e)};return i}var O7=((o="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+o)}catch{return!1}})(),ao={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:nu(o=>new RegExp(`^ {0,${o}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:nu(o=>new RegExp(`^ {0,${o}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:nu(o=>new RegExp(`^ {0,${o}}(?:\`\`\`|~~~)`)),headingBeginRegex:nu(o=>new RegExp(`^ {0,${o}}#`)),htmlBeginRegex:nu(o=>new RegExp(`^ {0,${o}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:nu(o=>new RegExp(`^ {0,${o}}>`))},F7=/^(?:[ \t]*(?:\n|$))+/,H7=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,W7=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ym=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,B7=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,gL=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,NR=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,RR=wn(NR).replace(/bull/g,gL).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(),z7=wn(NR).replace(/bull/g,gL).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(),fL=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,V7=/^[^\n]+/,pL=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,j7=wn(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",pL).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),U7=wn(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,gL).getRegex(),Ky="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",mL=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,$7=wn("^ {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",mL).replace("tag",Ky).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),AR=wn(fL).replace("hr",ym).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",Ky).getRegex(),q7=wn(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",AR).getRegex(),_L={blockquote:q7,code:H7,def:j7,fences:W7,heading:B7,hr:ym,html:$7,lheading:RR,list:U7,newline:F7,paragraph:AR,table:Zc,text:V7},DD=wn("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ym).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",Ky).getRegex(),K7={..._L,lheading:z7,table:DD,paragraph:wn(fL).replace("hr",ym).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",DD).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",Ky).getRegex()},G7={..._L,html:wn(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",mL).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:Zc,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:wn(fL).replace("hr",ym).replace("heading",` *#{1,6} *[^
82
+ ]`).replace("lheading",RR).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Z7=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,X7=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,OR=/^( {2,}|\\)\n(?!\s*$)/,Y7=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,jg=/[\p{P}\p{S}]/u,Gy=/[\s\p{P}\p{S}]/u,vL=/[^\s\p{P}\p{S}]/u,J7=wn(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Gy).getRegex(),FR=/(?!~)[\p{P}\p{S}]/u,Q7=/(?!~)[\s\p{P}\p{S}]/u,eq=/(?:[^\s\p{P}\p{S}]|~)/u,tq=wn(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",O7?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),HR=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,iq=wn(HR,"u").replace(/punct/g,jg).getRegex(),nq=wn(HR,"u").replace(/punct/g,FR).getRegex(),WR="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",sq=wn(WR,"gu").replace(/notPunctSpace/g,vL).replace(/punctSpace/g,Gy).replace(/punct/g,jg).getRegex(),oq=wn(WR,"gu").replace(/notPunctSpace/g,eq).replace(/punctSpace/g,Q7).replace(/punct/g,FR).getRegex(),rq=wn("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,vL).replace(/punctSpace/g,Gy).replace(/punct/g,jg).getRegex(),aq=wn(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,jg).getRegex(),lq="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",cq=wn(lq,"gu").replace(/notPunctSpace/g,vL).replace(/punctSpace/g,Gy).replace(/punct/g,jg).getRegex(),dq=wn(/\\(punct)/,"gu").replace(/punct/g,jg).getRegex(),hq=wn(/^<(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(),uq=wn(mL).replace("(?:-->|$)","-->").getRegex(),gq=wn("^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",uq).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),tb=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,fq=wn(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",tb).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),BR=wn(/^!?\[(label)\]\[(ref)\]/).replace("label",tb).replace("ref",pL).getRegex(),zR=wn(/^!?\[(ref)\](?:\[\])?/).replace("ref",pL).getRegex(),pq=wn("reflink|nolink(?!\\()","g").replace("reflink",BR).replace("nolink",zR).getRegex(),ED=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,bL={_backpedal:Zc,anyPunctuation:dq,autolink:hq,blockSkip:tq,br:OR,code:X7,del:Zc,delLDelim:Zc,delRDelim:Zc,emStrongLDelim:iq,emStrongRDelimAst:sq,emStrongRDelimUnd:rq,escape:Z7,link:fq,nolink:zR,punctuation:J7,reflink:BR,reflinkSearch:pq,tag:gq,text:Y7,url:Zc},mq={...bL,link:wn(/^!?\[(label)\]\((.*?)\)/).replace("label",tb).getRegex(),reflink:wn(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",tb).getRegex()},w0={...bL,emStrongRDelimAst:oq,emStrongLDelim:nq,delLDelim:aq,delRDelim:cq,url:wn(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ED).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:wn(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",ED).getRegex()},_q={...w0,br:wn(OR).replace("{2,}","*").getRegex(),text:wn(w0.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},l_={normal:_L,gfm:K7,pedantic:G7},df={normal:bL,gfm:w0,breaks:_q,pedantic:mq},vq={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},PD=o=>vq[o];function ma(o,e){if(e){if(ao.escapeTest.test(o))return o.replace(ao.escapeReplace,PD)}else if(ao.escapeTestNoEncode.test(o))return o.replace(ao.escapeReplaceNoEncode,PD);return o}function TD(o){try{o=encodeURI(o).replace(ao.percentDecode,"%")}catch{return null}return o}function MD(o,e){var s;let t=o.replace(ao.findPipe,(r,a,c)=>{let h=!1,g=a;for(;--g>=0&&c[g]==="\\";)h=!h;return h?"|":" |"}),i=t.split(ao.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(ao.slashPipe,"|");return i}function Bl(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 ND(o){let e=o.split(`
83
+ `),t=e.length-1;for(;t>=0&&ao.blankLine.test(e[t]);)t--;return e.length-t<=2?o:e.slice(0,t+1).join(`
84
+ `)}function bq(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 yq(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 RD(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 wq(o,e,t){let i=o.match(t.other.indentCodeCompensation);if(i===null)return e;let n=i[1];return e.split(`
85
+ `).map(s=>{let r=s.match(t.other.beginningSpace);if(r===null)return s;let[a]=r;return a.length>=n.length?s.slice(n.length):s}).join(`
86
+ `)}var ib=class{constructor(o){ji(this,"options");ji(this,"rules");ji(this,"lexer");this.options=o||Rh}space(o){let e=this.rules.block.newline.exec(o);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(o){let e=this.rules.block.code.exec(o);if(e){let t=this.options.pedantic?e[0]:ND(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=wq(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=Bl(t,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(t=i.trim())}return{type:"heading",raw:Bl(e[0],`
87
+ `),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(o){let e=this.rules.block.hr.exec(o);if(e)return{type:"hr",raw:Bl(e[0],`
88
+ `)}}blockquote(o){let e=this.rules.block.blockquote.exec(o);if(e){let t=Bl(e[0],`
89
+ `).split(`
90
+ `),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(`
91
+ `),g=h.replace(this.rules.other.blockquoteSetextReplace,`
92
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
93
+ ${h}`:h,n=n?`${n}
94
+ ${g}`:g;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(g,s,!0),this.lexer.state.top=f,t.length===0)break;let p=s.at(-1);if((p==null?void 0:p.type)==="code")break;if((p==null?void 0:p.type)==="blockquote"){let v=p,_=v.raw+`
95
+ `+t.join(`
96
+ `),w=this.blockquote(_);s[s.length-1]=w,i=i.substring(0,i.length-v.raw.length)+w.raw,n=n.substring(0,n.length-v.text.length)+w.text;break}else if((p==null?void 0:p.type)==="list"){let v=p,_=v.raw+`
97
+ `+t.join(`
98
+ `),w=this.list(_);s[s.length-1]=w,i=i.substring(0,i.length-p.raw.length)+w.raw,n=n.substring(0,n.length-v.raw.length)+w.raw,t=_.substring(s.at(-1).raw.length).split(`
99
+ `);continue}}return{type:"blockquote",raw:i,tokens:s,text:n}}}list(o){let e=this.rules.block.list.exec(o);if(e){let t=e[1].trim(),i=t.length>1,n={type:"list",raw:"",ordered:i,start:i?+t.slice(0,-1):"",loose:!1,items:[]};t=i?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=i?t:"[*+-]");let s=this.rules.other.listItemRegex(t),r=!1;for(;o;){let c=!1,h="",g="";if(!(e=s.exec(o))||this.rules.block.hr.test(o))break;h=e[0],o=o.substring(h.length);let f=yq(e[2].split(`
100
+ `,1)[0],e[1].length),p=o.split(`
101
+ `,1)[0],v=!f.trim(),_=0;if(this.options.pedantic?(_=2,g=f.trimStart()):v?_=e[1].length+1:(_=f.search(this.rules.other.nonSpaceChar),_=_>4?1:_,g=f.slice(_),_+=e[1].length),v&&this.rules.other.blankLine.test(p)&&(h+=p+`
102
+ `,o=o.substring(p.length+1),c=!0),!c){let w=this.rules.other.nextBulletRegex(_),S=this.rules.other.hrRegex(_),D=this.rules.other.fencesBeginRegex(_),E=this.rules.other.headingBeginRegex(_),R=this.rules.other.htmlBeginRegex(_),z=this.rules.other.blockquoteBeginRegex(_);for(;o;){let H=o.split(`
103
+ `,1)[0],ee;if(p=H,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),ee=p):ee=p.replace(this.rules.other.tabCharGlobal," "),D.test(p)||E.test(p)||R.test(p)||z.test(p)||w.test(p)||S.test(p))break;if(ee.search(this.rules.other.nonSpaceChar)>=_||!p.trim())g+=`
104
+ `+ee.slice(_);else{if(v||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||D.test(f)||E.test(f)||S.test(f))break;g+=`
105
+ `+p}v=!p.trim(),h+=H+`
106
+ `,o=o.substring(H.length+1),f=ee.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(g),loose:!1,text:g,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 f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}let g=this.rules.other.listTaskCheckbox.exec(c.raw);if(g){let f={type:"checkbox",raw:g[0]+" ",checked:g[0]!=="[ ]"};c.checked=f.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=f.raw+c.tokens[0].raw,c.tokens[0].text=f.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(f)):c.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):c.tokens.unshift(f)}}else c.task&&(c.task=!1);if(!n.loose){let g=c.tokens.filter(p=>p.type==="space"),f=g.length>0&&g.some(p=>this.rules.other.anyLine.test(p.raw));n.loose=f}}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=ND(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:Bl(e[0],`
107
+ `),href:i,title:n}}}table(o){var r;let e=this.rules.block.table.exec(o);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=MD(e[1]),i=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=(r=e[3])!=null&&r.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
108
+ `):[],s={type:"table",raw:Bl(e[0],`
109
+ `),header:[],align:[],rows:[]};if(t.length===i.length){for(let a of i)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a<t.length;a++)s.header.push({text:t[a],tokens:this.lexer.inline(t[a]),header:!0,align:s.align[a]});for(let a of n)s.rows.push(MD(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:Bl(e[0],`
110
+ `),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(o){let e=this.rules.block.paragraph.exec(o);if(e){let t=e[1].charAt(e[1].length-1)===`
111
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(o){let e=this.rules.block.text.exec(o);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(o){let e=this.rules.inline.escape.exec(o);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(o){let e=this.rules.inline.tag.exec(o);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(o){let e=this.rules.inline.link.exec(o);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let s=Bl(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=bq(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)),RD(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 RD(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 g=[...i[0]][0].length,f=o.slice(0,n+i.index+g+r);if(Math.min(n,r)%2){let v=f.slice(1,-1);return{type:"em",raw:f,text:v,tokens:this.lexer.inlineTokens(v)}}let p=f.slice(2,-2);return{type:"strong",raw:f,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(o){let e=this.rules.inline.code.exec(o);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(t),n=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return i&&n&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(o){let e=this.rules.inline.br.exec(o);if(e)return{type:"br",raw:e[0]}}del(o,e,t=""){let i=this.rules.inline.delLDelim.exec(o);if(i&&(!i[1]||!t||this.rules.inline.punctuation.exec(t))){let n=[...i[0]].length-1,s,r,a=n,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,g=o.slice(0,n+i.index+h+r),f=g.slice(n,-n);return{type:"del",raw:g,text:f,tokens:this.lexer.inlineTokens(f)}}}}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}}}},Kr=class S0{constructor(e){ji(this,"tokens");ji(this,"options");ji(this,"state");ji(this,"inlineQueue");ji(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Rh,this.options.tokenizer=this.options.tokenizer||new ib,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:ao,block:l_.normal,inline:df.normal};this.options.pedantic?(t.block=l_.pedantic,t.inline=df.pedantic):this.options.gfm&&(t.block=l_.gfm,this.options.breaks?t.inline=df.breaks:t.inline=df.gfm),this.tokenizer.rules=t}static get rules(){return{block:l_,inline:df}}static lex(e,t){return new S0(t).lex(e)}static lexInline(e,t){return new S0(t).inlineTokens(e)}lex(e){e=e.replace(ao.carriageReturn,`
112
+ `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let i=this.inlineQueue[t];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],i=!1){var s,r,a;this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(ao.tabCharGlobal," ").replace(ao.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(g=>(c=g.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 g=t.at(-1);c.raw.length===1&&g!==void 0?g.raw+=`
113
+ `:t.push(c);continue}if(c=this.tokenizer.code(e)){e=e.substring(c.raw.length);let g=t.at(-1);(g==null?void 0:g.type)==="paragraph"||(g==null?void 0:g.type)==="text"?(g.raw+=(g.raw.endsWith(`
114
+ `)?"":`
115
+ `)+c.raw,g.text+=`
116
+ `+c.text,this.inlineQueue.at(-1).src=g.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 g=t.at(-1);(g==null?void 0:g.type)==="paragraph"||(g==null?void 0:g.type)==="text"?(g.raw+=(g.raw.endsWith(`
117
+ `)?"":`
118
+ `)+c.raw,g.text+=`
119
+ `+c.raw,this.inlineQueue.at(-1).src=g.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 g=1/0,f=e.slice(1),p;this.options.extensions.startBlock.forEach(v=>{p=v.call({lexer:this},f),typeof p=="number"&&p>=0&&(g=Math.min(g,p))}),g<1/0&&g>=0&&(h=e.substring(0,g+1))}if(this.state.top&&(c=this.tokenizer.paragraph(h))){let g=t.at(-1);i&&(g==null?void 0:g.type)==="paragraph"?(g.raw+=(g.raw.endsWith(`
120
+ `)?"":`
121
+ `)+c.raw,g.text+=`
122
+ `+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=g.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 g=t.at(-1);(g==null?void 0:g.type)==="text"?(g.raw+=(g.raw.endsWith(`
123
+ `)?"":`
124
+ `)+c.raw,g.text+=`
125
+ `+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=g.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,g,f,p,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=((g=(h=this.options.hooks)==null?void 0:h.emStrongMask)==null?void 0:g.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((p=(f=this.options.extensions)==null?void 0:f.inline)!=null&&p.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 w=e;if((v=this.options.extensions)!=null&&v.startInline){let S=1/0,D=e.slice(1),E;this.options.extensions.startInline.forEach(R=>{E=R.call({lexer:this},D),typeof E=="number"&&E>=0&&(S=Math.min(S,E))}),S<1/0&&S>=0&&(w=e.substring(0,S+1))}if(_=this.tokenizer.inlineText(w)){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)}},nb=class{constructor(o){ji(this,"options");ji(this,"parser");this.options=o||Rh}space(o){return""}code({text:o,lang:e,escaped:t}){var s;let i=(s=(e||"").match(ao.notSpaceStart))==null?void 0:s[0],n=o.replace(ao.endingNewline,"")+`
126
+ `;return i?'<pre><code class="language-'+ma(i)+'">'+(t?n:ma(n,!0))+`</code></pre>
127
+ `:"<pre><code>"+(t?n:ma(n,!0))+`</code></pre>
128
+ `}blockquote({tokens:o}){return`<blockquote>
129
+ ${this.parser.parse(o)}</blockquote>
130
+ `}html({text:o}){return o}def(o){return""}heading({tokens:o,depth:e}){return`<h${e}>${this.parser.parseInline(o)}</h${e}>
131
+ `}hr(o){return`<hr>
132
+ `}list(o){let e=o.ordered,t=o.start,i="";for(let r=0;r<o.items.length;r++){let a=o.items[r];i+=this.listitem(a)}let n=e?"ol":"ul",s=e&&t!==1?' start="'+t+'"':"";return"<"+n+s+`>
133
+ `+i+"</"+n+`>
134
+ `}listitem(o){return`<li>${this.parser.parse(o.tokens)}</li>
135
+ `}checkbox({checked:o}){return"<input "+(o?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:o}){return`<p>${this.parser.parseInline(o)}</p>
136
+ `}table(o){let e="",t="";for(let n=0;n<o.header.length;n++)t+=this.tablecell(o.header[n]);e+=this.tablerow({text:t});let i="";for(let n=0;n<o.rows.length;n++){let s=o.rows[n];t="";for(let r=0;r<s.length;r++)t+=this.tablecell(s[r]);i+=this.tablerow({text:t})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
137
+ <thead>
138
+ `+e+`</thead>
139
+ `+i+`</table>
140
+ `}tablerow({text:o}){return`<tr>
141
+ ${o}</tr>
142
+ `}tablecell(o){let e=this.parser.parseInline(o.tokens),t=o.header?"th":"td";return(o.align?`<${t} align="${o.align}">`:`<${t}>`)+e+`</${t}>
143
+ `}strong({tokens:o}){return`<strong>${this.parser.parseInline(o)}</strong>`}em({tokens:o}){return`<em>${this.parser.parseInline(o)}</em>`}codespan({text:o}){return`<code>${ma(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=TD(o);if(n===null)return i;o=n;let s='<a href="'+o+'"';return e&&(s+=' title="'+ma(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=TD(o);if(n===null)return ma(t);o=n;let s=`<img src="${o}" alt="${ma(t)}"`;return e&&(s+=` title="${ma(e)}"`),s+=">",s}text(o){return"tokens"in o&&o.tokens?this.parser.parseInline(o.tokens):"escaped"in o&&o.escaped?o.text:ma(o.text)}},yL=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}},Gr=class C0{constructor(e){ji(this,"options");ji(this,"renderer");ji(this,"textRenderer");this.options=e||Rh,this.options.renderer=this.options.renderer||new nb,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new yL}static parse(e,t){return new C0(t).parse(e)}static parseInline(e,t){return new C0(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}},c_,Df=(c_=class{constructor(o){ji(this,"options");ji(this,"block");this.options=o||Rh}preprocess(o){return o}postprocess(o){return o}processAllTokens(o){return o}emStrongMask(o){return o}provideLexer(o=this.block){return o?Kr.lex:Kr.lexInline}provideParser(o=this.block){return o?Gr.parse:Gr.parseInline}},ji(c_,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ji(c_,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),c_),Sq=class{constructor(...o){ji(this,"defaults",uL());ji(this,"options",this.setOptions);ji(this,"parse",this.parseMarkdown(!0));ji(this,"parseInline",this.parseMarkdown(!1));ji(this,"Parser",Gr);ji(this,"Renderer",nb);ji(this,"TextRenderer",yL);ji(this,"Lexer",Kr);ji(this,"Tokenizer",ib);ji(this,"Hooks",Df);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 nb(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 g=a.apply(n,h);return g===!1&&(g=c.apply(n,h)),g||""}}i.renderer=n}if(t.tokenizer){let n=this.defaults.tokenizer||new ib(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 g=a.apply(n,h);return g===!1&&(g=c.apply(n,h)),g}}i.tokenizer=n}if(t.hooks){let n=this.defaults.hooks||new Df;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];Df.passThroughHooks.has(s)?n[r]=h=>{if(this.defaults.async&&Df.passThroughHooksRespectAsync.has(s))return(async()=>{let f=await a.call(n,h);return c.call(n,f)})();let g=a.call(n,h);return c.call(n,g)}:n[r]=(...h)=>{if(this.defaults.async)return(async()=>{let f=await a.apply(n,h);return f===!1&&(f=await c.apply(n,h)),f})();let g=a.apply(n,h);return g===!1&&(g=c.apply(n,h)),g}}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 Kr.lex(o,e??this.defaults)}parser(o,e){return Gr.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?Kr.lex:Kr.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?Gr.parse:Gr.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?Kr.lex:Kr.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?Gr.parse:Gr.parseInline)(r,n);return n.hooks&&(a=n.hooks.postprocess(a)),a}catch(r){return s(r)}}}onError(o,e){return t=>{if(t.message+=`
144
+ Please report this to https://github.com/markedjs/marked.`,o){let i="<p>An error occurred:</p><pre>"+ma(t.message+"",!0)+"</pre>";return e?Promise.resolve(i):i}if(e)return Promise.reject(t);throw t}}},Sh=new Sq;function On(o,e){return Sh.parse(o,e)}On.options=On.setOptions=function(o){return Sh.setOptions(o),On.defaults=Sh.defaults,MR(On.defaults),On};On.getDefaults=uL;On.defaults=Rh;On.use=function(...o){return Sh.use(...o),On.defaults=Sh.defaults,MR(On.defaults),On};On.walkTokens=function(o,e){return Sh.walkTokens(o,e)};On.parseInline=Sh.parseInline;On.Parser=Gr;On.parser=Gr.parse;On.Renderer=nb;On.TextRenderer=yL;On.Lexer=Kr;On.lexer=Kr.lex;On.Tokenizer=ib;On.Hooks=Df;On.parse=On;On.options;On.setOptions;On.use;On.walkTokens;On.parseInline;Gr.parse;Kr.lex;var Cq=N('<span class="chat-model svelte-10ayso4"><!></span>'),xq=N('<button class="clear-btn svelte-10ayso4" title="New conversation">+</button>'),Lq=N('<p class="history-empty svelte-10ayso4">No saved conversations.</p>'),kq=N('<li><button class="history-load svelte-10ayso4"> </button> <button class="history-del svelte-10ayso4" title="Delete">✕</button></li>'),Iq=N('<ul class="history-list svelte-10ayso4"></ul>'),Dq=N('<div class="history-panel svelte-10ayso4"><div class="history-hdr svelte-10ayso4"><span class="svelte-10ayso4">Conversations</span> <button class="new-conv-btn svelte-10ayso4">+ New</button></div> <!></div>'),Eq=N('<div class="unconfigured svelte-10ayso4">Configure an AI provider in the <strong class="svelte-10ayso4">Config</strong> tab to use the AI assistant.</div>'),Pq=N('Chatting in context of <code class="svelte-10ayso4"> </code>',1),Tq=N('<button class="chip svelte-10ayso4"> </button>'),Mq=N('<div class="suggestions svelte-10ayso4"><p class="suggestions-hint svelte-10ayso4"><!></p> <!></div>'),Nq=N('<div class="msg-content user-text svelte-10ayso4"> </div>'),AD=N('<span class="tool-args svelte-10ayso4"> </span>'),OD=N('<div class="tool-event tool-call svelte-10ayso4"><span class="tool-icon svelte-10ayso4">🔧</span> <span class="tool-name svelte-10ayso4"> </span> <!></div>'),FD=N('<div class="tool-event tool-result svelte-10ayso4"><span class="tool-icon svelte-10ayso4">✓</span> <span class="tool-name svelte-10ayso4"> </span></div>'),HD=N('<div class="tool-events svelte-10ayso4"></div>'),WD=N('<div class="text-block svelte-10ayso4"></div>'),Rq=N('<button class="create-btn svelte-10ayso4">Save as new file…</button>'),Aq=N('<span class="auto-badge svelte-10ayso4" title="Auto-applying AI code to this script in this session">auto ✓</span>'),Oq=N('<button class="apply-auto-btn svelte-10ayso4" title="Apply and always apply for this script in this session">always</button>'),Fq=N('<button class="apply-btn svelte-10ayso4">Apply</button> <!>',1),Hq=N('<button class="expand-btn svelte-10ayso4"> </button>'),Wq=N('<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>'),Bq=N('<!> <div class="msg-content svelte-10ayso4"></div>',1),zq=N("<div><!></div>"),Vq=N('<div class="message assistant svelte-10ayso4"><div class="msg-content svelte-10ayso4"><span class="status-shimmer svelte-10ayso4"> </span></div></div>'),jq=N('<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>'),Uq=N('<div class="message assistant streaming svelte-10ayso4"><div class="msg-content svelte-10ayso4"></div></div>'),$q=N('<div class="chat-error svelte-10ayso4"> </div>'),qq=N('<span class="ctx-indicator svelte-10ayso4"><svg width="12" height="12" viewBox="0 0 12 12" class="svelte-10ayso4"><circle cx="6" cy="6" r="5" fill="none" stroke="var(--border-sub)" stroke-width="2" class="svelte-10ayso4"></circle><circle cx="6" cy="6" r="5" fill="none" stroke-width="2" stroke-dashoffset="7.85" stroke-linecap="round" class="svelte-10ayso4"></circle></svg></span>'),Kq=N('<span><span> </span> <span class="chip-name svelte-10ayso4"> </span> <button class="chip-remove svelte-10ayso4"> </button></span>'),Gq=N('<span class="file-chip svelte-10ayso4"><span> </span> <span class="chip-name svelte-10ayso4"> </span> <button class="chip-remove svelte-10ayso4" title="Remove from context">×</button></span>'),Zq=N('<button class="stop-btn svelte-10ayso4" title="Stop generation">■</button>'),Xq=N('<button class="send-btn svelte-10ayso4">↑</button>'),Yq=N('<option class="svelte-10ayso4"> </option>'),Jq=N('<select class="model-select svelte-10ayso4"></select>'),Qq=N('<span class="model-name svelte-10ayso4"> </span>'),eK=N('<button class="info-btn svelte-10ayso4" title="Model info">ℹ</button>'),tK=N('<div class="model-bar svelte-10ayso4"><span class="model-provider svelte-10ayso4"> </span> <!> <!></div>'),iK=N('<p class="info-status svelte-10ayso4">Loading…</p>'),nK=N('<p class="info-status info-err svelte-10ayso4"> </p>'),sK=N('<dt class="svelte-10ayso4">Ollama version</dt><dd class="svelte-10ayso4"> </dd>',1),oK=N('<dt class="svelte-10ayso4">Family</dt><dd class="svelte-10ayso4"> </dd>',1),rK=N('<dt class="svelte-10ayso4">Parameters</dt><dd class="svelte-10ayso4"> </dd>',1),aK=N('<dt class="svelte-10ayso4">Quantization</dt><dd class="svelte-10ayso4"> </dd>',1),lK=N('<dt class="svelte-10ayso4">Format</dt><dd class="svelte-10ayso4"> </dd>',1),cK=N('<div class="running-model svelte-10ayso4"> </div>'),dK=N('<dt class="svelte-10ayso4">Loaded</dt> <dd class="svelte-10ayso4"></dd>',1),hK=N('<dt class="svelte-10ayso4">Loaded</dt><dd class="dim svelte-10ayso4">Not in memory</dd>',1),uK=N('<dl class="svelte-10ayso4"><!> <!> <!> <!> <!> <!></dl>'),gK=N('<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>'),fK=N('<div class="chat-panel svelte-10ayso4"><div class="chat-header svelte-10ayso4"><span class="chat-title svelte-10ayso4">AI Assistant</span> <!> <button title="Conversation history"><svg width="13" height="13" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" class="svelte-10ayso4"><circle cx="8" cy="8" r="6" class="svelte-10ayso4"></circle><polyline points="8,5 8,8 10,10" class="svelte-10ayso4"></polyline></svg></button> <!></div> <!> <div class="messages svelte-10ayso4"><!> <!> <!> <!> <!></div> <!> <div class="context-row svelte-10ayso4"><label title="Include she API reference in context" class="svelte-10ayso4"><input type="checkbox" class="svelte-10ayso4"/><span class="checkmark svelte-10ayso4"></span> she API</label> <label title="Let the AI query MQTT state, sheDB documents and Matter devices on demand. Disables real-time streaming." class="svelte-10ayso4"><input type="checkbox" class="svelte-10ayso4"/><span class="checkmark svelte-10ayso4"></span> 😎 Agent</label> <span class="req-size svelte-10ayso4"> <!></span></div> <div class="files-row svelte-10ayso4"><!> <!> <button class="add-file-btn svelte-10ayso4" title="Attach file to context">+</button> <input type="file" multiple="" class="file-input-hidden svelte-10ayso4"/></div> <div><div><textarea rows="3" class="svelte-10ayso4"></textarea></div> <!></div> <!></div> <!>',1);function pK(o,e){Vo(e,!0),eb.registerLanguage("javascript",TR),On.use({breaks:!0,gfm:!0});let t=gg(e,"currentScript",3,null),i=gg(e,"extraFiles",31,()=>mi([])),n=W(mi([])),s=W(null),r=W(""),a=W(!1),c=W(""),h=W(null);const g="she:conversationId";function f(){return crypto.randomUUID().replace(/-/g,"").slice(0,16)}let p=W(mi(localStorage.getItem(g)??f())),v=W(mi([])),_=W(!1);An(()=>{localStorage.setItem(g,u(p))});let w=W(mi([])),S=W(mi(localStorage.getItem("she:selectedModel")??"")),D=W(null);const E=ot(()=>{var V;return u(D)!==null&&((V=t())==null?void 0:V.path)===u(D)});let R=W(mi(new Set)),z=W(!1),H=W(null),ee=W(!1),X=W(""),me=W(0),Le=null,je=W(0);const Ce=["[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 mt=W(!0),Lt=W(!0),ct=W(!0),li=W(!1),zt,ei=W(mi([])),qe,Ye;const Ne=ot(()=>({apiref:u(mt),tools:u(Lt)})),st=ot(()=>{var V;return((V=u(h))==null?void 0:V.configured)??!1}),Mt=ot(()=>{var V;return u(st)||!!((V=u(h))!=null&&V.provider)&&!!u(S)}),ni=ot(()=>u(me)+new TextEncoder().encode(u(r)).length),ci=ot(()=>u(ct)?t():null);An(()=>{var Y;const V=(Y=t())==null?void 0:Y.path;k(ct,!0),u(D)!==null&&V!==u(D)&&k(D,null)}),An(()=>{var We;if(!u(E))return;const V=u(n).at(-1);if(!V||V.role!=="assistant")return;const Pe=ut(V.content).find(Ie=>Ie.type==="code"&&Ai(Ie.lang));if(Pe){const Ie=Nn(Pe.text);(We=e.onApply)==null||We.call(e,Ie?Ie.code:Pe.text)}});async function Vt(){try{const V=await wR();k(h,V,!0),V.configured&&!u(S)&&k(S,V.model,!0)}catch{}}An(()=>(window.addEventListener("she:config-changed",Vt),()=>window.removeEventListener("she:config-changed",Vt))),An(()=>{u(S)&&localStorage.setItem("she:selectedModel",u(S))}),An(()=>{var V;(V=u(h))!=null&&V.provider&&SR().then(Y=>{k(w,Y.models,!0),!u(S)&&Y.models.length>0&&k(S,Y.models[0],!0)}).catch(()=>{})}),An(()=>{u(S),k(H,null),k(X,"")}),An(()=>{var Y,Pe;if(((Y=u(h))==null?void 0:Y.provider)!=="ollama")return;const V=u(S)||((Pe=u(h))==null?void 0:Pe.model);!V||u(H)||b0(V).then(We=>{k(H,We,!0)}).catch(()=>{})}),An(()=>{if(!u(a))return;k(je,Math.floor(Math.random()*Ce.length),!0);const V=setInterval(()=>{k(je,(u(je)+1)%Ce.length)},1e4);return()=>clearInterval(V)}),An(()=>{var V;Ye&&(u(n).length+(((V=u(s))==null?void 0:V.length)??0),requestAnimationFrame(()=>{Ye&&(Ye.scrollTop=Ye.scrollHeight)}))}),An(()=>{const V=u(Ne),Y=u(ci),Pe=i();u(Mt)&&CR({context:V,currentScript:Y??null,extraFiles:Pe.length>0?Pe:void 0}).then(We=>{k(me,new TextEncoder().encode(We.prompt).length,!0)}).catch(()=>{})});function ut(V){const Y=V.replace(/(\n|^)(\/{2} @[a-z-]+:[^\n]+)\n(```\w*)\n/g,`$1$3
145
+ $2
146
+ `),Pe=[],We=/```(\w*)\n([\s\S]*?)```/g;let Ie=0,ke;for(;(ke=We.exec(Y))!==null;)ke.index>Ie&&Pe.push({type:"text",text:Y.slice(Ie,ke.index)}),Pe.push({type:"code",lang:ke[1]||"text",text:ke[2].trimEnd()}),Ie=ke.index+ke[0].length;return Ie<Y.length&&Pe.push({type:"text",text:Y.slice(Ie)}),Pe}const Ii=15;function fi(V){return V.split(`
147
+ `).length>Ii}function tn(V){const Y=new Set(u(R));Y.has(V)?Y.delete(V):Y.add(V),k(R,Y,!0)}function Fi(V,Y){if(Ai(Y))try{return eb.highlight(V,{language:"javascript"}).value}catch{}return V.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Mn(V){return On.parse(V)}function Yi(V){const Y=V.replace(/(\n|^)(\/{2} @[a-z-]+:[^\n]+)\n(```\w*)\n/g,`$1$3
148
+ $2
149
+ `),Pe=[],We=/```(\w*)\n([\s\S]*?)```/g;let Ie=0,ke;for(;(ke=We.exec(Y))!==null;)ke.index>Ie&&Pe.push({type:"text",text:Y.slice(Ie,ke.index)}),Pe.push({type:"code",lang:ke[1]||"text",text:ke[2].trimEnd()}),Ie=ke.index+ke[0].length;const xt=Y.slice(Ie),Qe=xt.match(/```(\w*)\n([\s\S]*)$/);return Qe?(Qe.index>0&&Pe.push({type:"text",text:xt.slice(0,Qe.index)}),Pe.push({type:"code",lang:Qe[1]||"text",text:Qe[2]})):xt&&Pe.push({type:"text",text:xt}),Pe}function Ji(V){navigator.clipboard.writeText(V).catch(()=>{})}function Fn(V,Y=!1){var Pe;Y&&t()&&k(D,t().path,!0),(Pe=e.onApply)==null||Pe.call(e,V)}function Ai(V){return!V||V==="js"||V==="javascript"}function Nn(V){const Y=V.match(/^\/\/ @new-file:\s*(\S+\.js)[ \t]*\n/);return Y?{filename:Y[1],code:V.slice(Y[0].length)}:null}function nn(V){return V>=1e9?`${(V/1e9).toFixed(1)} GB`:V>=1e6?`${(V/1e6).toFixed(0)} MB`:V>=1024?`${(V/1024).toFixed(1)} kB`:`${V} B`}async function Hi(){if(k(z,!0),!(u(H)||u(ee))){k(ee,!0),k(X,"");try{k(H,await b0(u(S)||u(h).model),!0)}catch(V){k(X,V.message,!0)}k(ee,!1)}}function Rn(V){const Y=V.match(/\.([^.]+)$/);return Y?Y[1].toUpperCase():"?"}function Un(V){switch(V){case"SH":case"BASH":return"$";case"MD":case"MARKDOWN":return"⇓";case"JSON":case"JSONC":return"{}";default:return V}}function Hn(V){i(i().filter((Y,Pe)=>Pe!==V))}function Wn(){zt.click()}async function dn(V){if(!(!V||V.length===0))for(const Y of Array.from(V)){const Pe=await Y.text();i([...i(),{name:Y.name,content:Pe}])}}function sn(V){const Y=V.target;dn(Y.files),Y.value=""}function ts(V){var Y;V.preventDefault(),k(li,!1),dn(((Y=V.dataTransfer)==null?void 0:Y.files)??null)}function Ke(V){var Y;(Y=V.dataTransfer)!=null&&Y.types.includes("Files")&&(V.preventDefault(),k(li,!0))}function _t(){k(li,!1)}async function ri(){try{k(v,await _7(),!0)}catch{}}async function Di(){var Y;if(u(n).length===0)return;const V=((Y=u(n).find(Pe=>Pe.role==="user"))==null?void 0:Y.content.slice(0,80))??u(p);try{await v7(u(p),V,u(n)),await ri()}catch{}}async function wi(V){try{const Y=await xD(V);k(n,Y.messages,!0),k(p,V,!0),k(_,!1),k(c,"")}catch{}}async function gn(V){try{await b7(V),await ri(),V===u(p)&&_n()}catch{}}function _n(){k(n,[],!0),k(c,""),k(p,f(),!0),k(_,!1)}Mr(async()=>{Vt();try{const V=await xD(u(p));k(n,V.messages,!0)}catch{}await ri()});async function Bn(){const V=u(r).trim();if(!V||u(a))return;k(r,""),k(c,""),k(a,!0);const Y={role:"user",content:V};k(n,[...u(n),Y],!0),Le=new AbortController,k(ei,[],!0);try{await xR({messages:u(n),currentScript:u(ci),context:u(Ne),modelOverride:u(S)||void 0,extraFiles:i().length>0?i():void 0},Pe=>{k(s,(u(s)??"")+Pe)},Le.signal,Pe=>{k(ei,[...u(ei),Pe],!0)}),k(n,[...u(n),{role:"assistant",content:u(s)??"",toolEvents:u(ei).length>0?[...u(ei)]:void 0}],!0),k(ei,[],!0)}catch(Pe){if(Pe.name==="AbortError"){const We=u(s);We&&We.trim()&&k(n,[...u(n),{role:"assistant",content:We+`
150
+
151
+ *[stopped]*`,toolEvents:u(ei).length>0?[...u(ei)]:void 0}],!0)}else k(c,Pe.message,!0)}finally{Le=null,k(s,null),k(ei,[],!0),k(a,!1),Di()}}function Cn(){Le==null||Le.abort()}function Zn(V){V.key==="Enter"&&!V.shiftKey&&(V.preventDefault(),Bn())}function Xn(){_n()}const xn=["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 Ue(V){k(r,V,!0),qe==null||qe.focus()}var Z=fK(),Fe=wt(Z),vt=C(Fe),Ct=x(C(vt),2);{var qt=V=>{var Y=Cq(),Pe=C(Y);{var We=xt=>{var Qe=ta();G(()=>$(Qe,`${u(h).provider??""} · ${(u(S)||u(h).model)??""}`)),T(xt,Qe)},Ie=xt=>{var Qe=ta();G(()=>$(Qe,`${u(h).provider??""} · pick a model below`)),T(xt,Qe)},ke=xt=>{var Qe=ta("Not configured");T(xt,Qe)};U(Pe,xt=>{u(Mt)?xt(We):u(h).provider?xt(Ie,1):xt(ke,-1)})}G(()=>pn(Y,"title",`Provider: ${u(h).provider??""}`)),T(V,Y)};U(Ct,V=>{u(h)&&V(qt)})}var A=x(Ct,2);let ie;var ve=x(A,2);{var Ze=V=>{var Y=xq();Q("click",Y,Xn),T(V,Y)};U(ve,V=>{u(n).length>0&&V(Ze)})}var gt=x(vt,2);{var q=V=>{var Y=Dq(),Pe=C(Y),We=x(C(Pe),2),Ie=x(Pe,2);{var ke=Qe=>{var Te=Lq();T(Qe,Te)},xt=Qe=>{var Te=Iq();di(Te,21,()=>u(v),ht=>ht.id,(ht,Ae)=>{var _e=kq();let we;var ye=C(_e),pe=C(ye),nt=x(ye,2);G(()=>{we=Zt(_e,1,"history-item svelte-10ayso4",null,we,{"history-active":u(Ae).id===u(p)}),pn(ye,"title",u(Ae).id),$(pe,u(Ae).title||u(Ae).id)}),Q("click",ye,()=>wi(u(Ae).id)),Q("click",nt,()=>gn(u(Ae).id)),T(ht,_e)}),T(Qe,Te)};U(Ie,Qe=>{u(v).length===0?Qe(ke):Qe(xt,-1)})}Q("click",We,_n),T(V,Y)};U(gt,V=>{u(_)&&V(q)})}var re=x(gt,2),ue=C(re);{var tt=V=>{var Y=Eq();T(V,Y)},Ht=V=>{var Y=Mq(),Pe=C(Y),We=C(Pe);{var Ie=Qe=>{var Te=Pq(),ht=x(wt(Te)),Ae=C(ht);G(_e=>$(Ae,_e),[()=>t().path.split("/").pop()]),T(Qe,Te)},ke=Qe=>{var Te=ta("No script open. Ask a general she scripting question.");T(Qe,Te)};U(We,Qe=>{t()?Qe(Ie):Qe(ke,-1)})}var xt=x(Pe,2);di(xt,17,()=>xn,Dn,(Qe,Te)=>{var ht=Tq(),Ae=C(ht);G(()=>$(Ae,u(Te))),Q("click",ht,()=>Ue(u(Te))),T(Qe,ht)}),T(V,Y)};U(ue,V=>{u(st)?u(n).length===0&&u(s)===null&&V(Ht,1):V(tt)})}var bt=x(ue,2);di(bt,17,()=>u(n),Dn,(V,Y,Pe)=>{var We=zq(),Ie=C(We);{var ke=Qe=>{var Te=Nq(),ht=C(Te);G(()=>$(ht,u(Y).content)),T(Qe,Te)},xt=Qe=>{const Te=ot(()=>ut(u(Y).content));var ht=Bq(),Ae=wt(ht);{var _e=ye=>{var pe=HD();di(pe,21,()=>u(Y).toolEvents,Dn,(nt,ce)=>{var He=js(),rt=wt(He);{var Ot=Ut=>{var Gt=OD(),Ln=x(C(Gt),2),Wi=C(Ln),kn=x(Ln,2);{var qn=$t=>{var qi=AD(),Ei=C(qi);G(us=>$(Ei,us),[()=>Object.entries(u(ce).args).map(([us,io])=>`${us}=${JSON.stringify(io)}`).join(", ")]),T($t,qi)},pi=ot(()=>u(ce).args&&Object.keys(u(ce).args).length>0);U(kn,$t=>{u(pi)&&$t(qn)})}G($t=>$(Wi,$t),[()=>u(ce).name.replace(/_/g," ")]),T(Ut,Gt)},et=Ut=>{var Gt=FD(),Ln=x(C(Gt),2),Wi=C(Ln);G(kn=>$(Wi,kn),[()=>u(ce).name.replace(/_/g," ")]),T(Ut,Gt)};U(rt,Ut=>{u(ce).type==="tool_call"?Ut(Ot):Ut(et,-1)})}T(nt,He)}),T(ye,pe)};U(Ae,ye=>{var pe;(pe=u(Y).toolEvents)!=null&&pe.length&&ye(_e)})}var we=x(Ae,2);di(we,21,()=>u(Te),Dn,(ye,pe,nt)=>{var ce=js(),He=wt(ce);{var rt=et=>{var Ut=WD();Ql(Ut,()=>Mn(u(pe).text),!0),T(et,Ut)},Ot=et=>{const Ut=ot(()=>Ai(u(pe).lang)?Nn(u(pe).text):null),Gt=ot(()=>u(Ut)?u(Ut).code:u(pe).text),Ln=ot(()=>`${Pe}:${nt}`),Wi=ot(()=>fi(u(Gt))),kn=ot(()=>u(R).has(u(Ln)));var qn=Wq(),pi=C(qn),$t=C(pi),qi=C($t),Ei=x($t,2),us=C(Ei),io=x(us,2);{var sr=Ss=>{var Hs=Rq();Q("click",Hs,()=>e.onCreateFile(u(Ut).filename,u(Ut).code)),T(Ss,Hs)},Nr=Ss=>{var Hs=Fq(),Rr=wt(Hs),Ua=x(Rr,2);{var Tl=Uo=>{var Ar=Aq();T(Uo,Ar)},$a=Uo=>{var Ar=Oq();Q("click",Ar,()=>Fn(u(pe).text,!0)),T(Uo,Ar)};U(Ua,Uo=>{u(E)?Uo(Tl):Uo($a,-1)})}Q("click",Rr,()=>Fn(u(pe).text)),T(Ss,Hs)},or=ot(()=>Ai(u(pe).lang)&&t());U(io,Ss=>{u(Ut)&&e.onCreateFile?Ss(sr):u(or)&&Ss(Nr,1)})}var Yn=x(pi,2);let ja;var da=C(Yn),Bi=C(da);Ql(Bi,()=>Fi(u(Gt),u(pe).lang??""),!0);var Hc=x(da,2);{var Fs=Ss=>{var Hs=Hq(),Rr=C(Hs);G(()=>$(Rr,u(kn)?"▲ collapse":"▼ expand")),Q("click",Hs,()=>tn(u(Ln))),T(Ss,Hs)};U(Hc,Ss=>{u(Wi)&&Ss(Fs)})}G(()=>{$(qi,u(Ut)?`new: ${u(Ut).filename}`:u(pe).lang),ja=Zt(Yn,1,"code-body svelte-10ayso4",null,ja,{collapsed:u(Wi)&&!u(kn)})}),Q("click",us,()=>Ji(u(Gt))),T(et,qn)};U(He,et=>{u(pe).type==="text"?et(rt):et(Ot,-1)})}T(ye,ce)}),T(Qe,ht)};U(Ie,Qe=>{u(Y).role==="user"?Qe(ke):Qe(xt,-1)})}G(()=>Zt(We,1,`message ${u(Y).role??""}`,"svelte-10ayso4")),T(V,We)});var fe=x(bt,2);{var dt=V=>{var Y=HD();di(Y,21,()=>u(ei),Dn,(Pe,We)=>{var Ie=js(),ke=wt(Ie);{var xt=Te=>{var ht=OD(),Ae=x(C(ht),2),_e=C(Ae),we=x(Ae,2);{var ye=nt=>{var ce=AD(),He=C(ce);G(rt=>$(He,rt),[()=>Object.entries(u(We).args).map(([rt,Ot])=>`${rt}=${JSON.stringify(Ot)}`).join(", ")]),T(nt,ce)},pe=ot(()=>u(We).args&&Object.keys(u(We).args).length>0);U(we,nt=>{u(pe)&&nt(ye)})}G(nt=>$(_e,nt),[()=>u(We).name.replace(/_/g," ")]),T(Te,ht)},Qe=Te=>{var ht=FD(),Ae=x(C(ht),2),_e=C(Ae);G(we=>$(_e,we),[()=>u(We).name.replace(/_/g," ")]),T(Te,ht)};U(ke,Te=>{u(We).type==="tool_call"?Te(xt):Te(Qe,-1)})}T(Pe,Ie)}),T(V,Y)};U(fe,V=>{u(ei).length>0&&V(dt)})}var jt=x(fe,2);{var Bt=V=>{var Y=Vq(),Pe=C(Y),We=C(Pe),Ie=C(We);G(()=>$(Ie,Ce[u(je)])),T(V,Y)};U(jt,V=>{u(a)&&u(s)===null&&u(ei).length===0&&V(Bt)})}var oi=x(jt,2);{var ti=V=>{var Y=Uq(),Pe=C(Y);di(Pe,21,()=>Yi(u(s)),Dn,(We,Ie)=>{var ke=js(),xt=wt(ke);{var Qe=ht=>{var Ae=WD();Ql(Ae,()=>Mn(u(Ie).text),!0),T(ht,Ae)},Te=ht=>{var Ae=jq(),_e=C(Ae),we=C(_e),ye=C(we),pe=x(_e,2),nt=C(pe);Ql(nt,()=>Fi(u(Ie).text,u(Ie).lang??""),!0),G(()=>$(ye,u(Ie).lang)),T(ht,Ae)};U(xt,ht=>{u(Ie).type==="text"?ht(Qe):ht(Te,-1)})}T(We,ke)}),T(V,Y)};U(oi,V=>{u(s)!==null&&V(ti)})}Ls(re,V=>Ye=V,()=>Ye);var J=x(re,2);{var he=V=>{var Y=$q(),Pe=C(Y);G(()=>$(Pe,u(c))),T(V,Y)};U(J,V=>{u(c)&&V(he)})}var Oe=x(J,2),it=C(Oe),It=C(it),Je=x(it,2),Nt=C(Je),ii=x(Je,2),Wt=C(ii),At=x(Wt);{var zi=V=>{const Y=ot(()=>Math.min(100,Math.round(u(ni)/4/u(H).contextLength*100)));var Pe=qq(),We=C(Pe),Ie=x(C(We));G((ke,xt)=>{pn(Pe,"title",`~${u(Y)??""}% of ${ke??""} token context window used`),pn(Ie,"stroke",u(Y)>80?"var(--fg-err)":u(Y)>50?"var(--fg-warn)":"var(--fg-ok)"),pn(Ie,"stroke-dasharray",`${xt??""} 31.4`)},[()=>u(H).contextLength.toLocaleString(),()=>(u(Y)/100*31.4).toFixed(1)]),T(V,Pe)};U(At,V=>{var Y;(Y=u(H))!=null&&Y.contextLength&&V(zi)})}var on=x(Oe,2),Oi=C(on);{var si=V=>{const Y=ot(()=>Rn(t().path.split("/").pop()??t().path));var Pe=Kq();let We;var Ie=C(Pe),ke=C(Ie),xt=x(Ie,2),Qe=C(xt),Te=x(xt,2),ht=C(Te);G((Ae,_e)=>{We=Zt(Pe,1,"file-chip svelte-10ayso4",null,We,{inactive:!u(ct)}),Zt(Ie,1,`badge badge-${Ae??""}`,"svelte-10ayso4"),$(ke,_e),$(Qe,t().path),pn(Te,"title",u(ct)?"Remove from context":"Re-add to context"),$(ht,u(ct)?"×":"+")},[()=>u(Y).toLowerCase(),()=>Un(u(Y))]),Q("click",Te,()=>k(ct,!u(ct))),T(V,Pe)};U(Oi,V=>{t()&&V(si)})}var Vi=x(Oi,2);di(Vi,17,i,Dn,(V,Y,Pe)=>{const We=ot(()=>Rn(u(Y).name));var Ie=Gq(),ke=C(Ie),xt=C(ke),Qe=x(ke,2),Te=C(Qe),ht=x(Qe,2);G((Ae,_e)=>{Zt(ke,1,`badge badge-${Ae??""}`,"svelte-10ayso4"),$(xt,_e),$(Te,u(Y).name)},[()=>u(We).toLowerCase(),()=>Un(u(We))]),Q("click",ht,()=>Hn(Pe)),T(V,Ie)});var F=x(Vi,2),K=x(F,2);Ls(K,V=>zt=V,()=>zt);var De=x(on,2);let Re;var $e=C(De);let Me;var Ge=C($e);Ls(Ge,V=>qe=V,()=>qe);var Yt=x($e,2);{var ge=V=>{var Y=Zq();Q("click",Y,Cn),T(V,Y)},xe=V=>{var Y=Xq();G(Pe=>Y.disabled=Pe,[()=>!u(r).trim()||!u(Mt)]),Q("click",Y,Bn),T(V,Y)};U(Yt,V=>{u(a)?V(ge):V(xe,-1)})}var ft=x(De,2);{var Ee=V=>{var Y=tK(),Pe=C(Y),We=C(Pe),Ie=x(Pe,2);{var ke=ht=>{var Ae=Jq();di(Ae,21,()=>u(w),Dn,(_e,we)=>{var ye=Yq(),pe=C(ye),nt={};G(()=>{$(pe,u(we)),nt!==(nt=u(we))&&(ye.value=(ye.__value=u(we))??"")}),T(_e,ye)}),G(()=>Ae.disabled=u(a)),qr(Ae,()=>u(S),_e=>k(S,_e)),T(ht,Ae)},xt=ht=>{var Ae=Qq(),_e=C(Ae);G(()=>$(_e,u(S)||u(h).model)),T(ht,Ae)};U(Ie,ht=>{u(w).length>0?ht(ke):ht(xt,-1)})}var Qe=x(Ie,2);{var Te=ht=>{var Ae=eK();Q("click",Ae,Hi),T(ht,Ae)};U(Qe,ht=>{u(h).provider==="ollama"&&ht(Te)})}G(()=>$(We,u(h).provider)),T(V,Y)};U(ft,V=>{var Y;(Y=u(h))!=null&&Y.provider&&(u(st)||u(w).length>0)&&V(Ee)})}var at=x(Fe,2);{var Kt=V=>{var Y=gK(),Pe=C(Y),We=C(Pe),Ie=C(We),ke=C(Ie),xt=x(Ie,2),Qe=x(We,2),Te=C(Qe);{var ht=we=>{var ye=iK();T(we,ye)},Ae=we=>{var ye=nK(),pe=C(ye);G(()=>$(pe,u(X))),T(we,ye)},_e=we=>{var ye=uK(),pe=C(ye);{var nt=pi=>{var $t=sK(),qi=x(wt($t)),Ei=C(qi);G(()=>$(Ei,u(H).version)),T(pi,$t)};U(pe,pi=>{u(H).version&&pi(nt)})}var ce=x(pe,2);{var He=pi=>{var $t=oK(),qi=x(wt($t)),Ei=C(qi);G(()=>$(Ei,u(H).details.family)),T(pi,$t)};U(ce,pi=>{var $t;($t=u(H).details)!=null&&$t.family&&pi(He)})}var rt=x(ce,2);{var Ot=pi=>{var $t=rK(),qi=x(wt($t)),Ei=C(qi);G(()=>$(Ei,u(H).details.parameter_size)),T(pi,$t)};U(rt,pi=>{var $t;($t=u(H).details)!=null&&$t.parameter_size&&pi(Ot)})}var et=x(rt,2);{var Ut=pi=>{var $t=aK(),qi=x(wt($t)),Ei=C(qi);G(()=>$(Ei,u(H).details.quantization_level)),T(pi,$t)};U(et,pi=>{var $t;($t=u(H).details)!=null&&$t.quantization_level&&pi(Ut)})}var Gt=x(et,2);{var Ln=pi=>{var $t=lK(),qi=x(wt($t)),Ei=C(qi);G(()=>$(Ei,u(H).details.format)),T(pi,$t)};U(Gt,pi=>{var $t;($t=u(H).details)!=null&&$t.format&&pi(Ln)})}var Wi=x(Gt,2);{var kn=pi=>{var $t=dK(),qi=x(wt($t),2);di(qi,21,()=>u(H).running,Dn,(Ei,us)=>{var io=cK(),sr=C(io);G(Nr=>$(sr,`${u(us).name??""} · ${Nr??""} VRAM`),[()=>nn(u(us).size_vram)]),T(Ei,io)}),T(pi,$t)},qn=pi=>{var $t=hK();T(pi,$t)};U(Wi,pi=>{u(H).running&&u(H).running.length>0?pi(kn):u(H).running!==null&&pi(qn,1)})}T(we,ye)};U(Te,we=>{u(ee)?we(ht):u(X)?we(Ae,1):u(H)&&we(_e,2)})}G(()=>{var we;return $(ke,`Ollama · ${(u(S)||((we=u(h))==null?void 0:we.model))??""}`)}),Q("click",Y,()=>k(z,!1)),Q("click",Pe,we=>we.stopPropagation()),Q("click",xt,()=>k(z,!1)),T(V,Y)};U(at,V=>{u(z)&&V(Kt)})}G(V=>{ie=Zt(A,1,"icon-hdr-btn svelte-10ayso4",null,ie,{active:u(_)}),$(Wt,V),Re=Zt(De,1,"input-row svelte-10ayso4",null,Re,{"drag-over":u(li)}),Me=Zt($e,1,"textarea-wrap svelte-10ayso4",null,Me,{loading:u(a)}),pn(Ge,"placeholder",u(Mt)?"Ask anything… (Enter to send, Shift+Enter for newline, drag & drop files to add context)":u(st)?"Select a model above to start chatting":"AI not configured"),Ge.disabled=u(a)||!u(Mt)},[()=>nn(u(ni))]),Q("click",A,()=>k(_,!u(_))),zs(It,()=>u(mt),V=>k(mt,V)),zs(Nt,()=>u(Lt),V=>k(Lt,V)),Q("click",F,Wn),Q("change",K,sn),ls("dragover",De,Ke),ls("dragleave",De,_t),ls("drop",De,ts),Q("keydown",Ge,Zn),Ci(Ge,()=>u(r),V=>k(r,V)),T(o,Z),jo()}Tr(["click","change","keydown"]);const mK={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"]},_K={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 x0=[],L0=[],k0=[];const sb=new Map;let VR=[];const I0=new Map,D0=new Map;async function BD(){try{x0=(await yR()).map(e=>e.topic)}catch{}}async function zD(){try{const[o,e]=await Promise.all([_R(),vR()]);L0=o,k0=e}catch{}}async function VD(){try{const o=await bR();VR=o.map(e=>e.nodeId),I0.clear(),D0.clear();for(const e of o)e.name&&(I0.set(e.nodeId,e.name),D0.set(e.name,e.nodeId));await Promise.all(o.map(async e=>{if(!sb.has(e.nodeId))try{sb.set(e.nodeId,await A_(e.nodeId))}catch{}}))}catch{}}function vK(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],g=bK(h),f=yK(h);if(g===0)return{type:"matter-nodeId",prefix:f};if(g===1){const p=su(h,0);if(p)return{type:"matter-endpointId",nodeId:p}}if(g===2){const p=su(h,0),v=jD(h,1)??su(h,1);if(p&&v!==null)return{type:"matter-cluster",nodeId:p,endpointId:v}}if(g>=3){const p=su(h,0),v=jD(h,1)??su(h,1),_=su(h,2),w=/she\.matter\.send\s*\(/.test(o);if(p&&v!==null&&_)return{type:"matter-attr",nodeId:p,endpointId:v,cluster:_,isSend:w}}}return null}function bK(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 yK(o){const e=o.match(/['"]([^'"]*)\s*$/);return e?e[1]:""}function su(o,e){var s;const i=(s=jR(o)[e])==null?void 0:s.trim();if(!i)return null;const n=i.match(/^['"](.*)['"]$/);return n?n[1]:null}function jD(o,e){var s;const i=(s=jR(o)[e])==null?void 0:s.trim();if(!i)return null;const n=parseInt(i,10);return isNaN(n)?null:n}function jR(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 Ch=Kc.CompletionItemKind;function wK(o,e){return(e?x0.filter(i=>i.startsWith(e)):x0).map(i=>({label:i,kind:Ch.Value,insertText:i,range:o,detail:"MQTT topic",sortText:"0"+i}))}function SK(o,e,t){const i=t?[...L0,...k0]:L0;return(e?i.filter(s=>s.startsWith(e)):i).map(s=>({label:s,kind:Ch.Value,insertText:s,range:o,detail:k0.includes(s)?"sheDB view":"sheDB document",sortText:"0"+s}))}function CK(o,e){return VR.map(t=>{const i=I0.get(t)??t;return e&&!i.startsWith(e)&&!t.startsWith(e)?null:{label:i,kind:Ch.Value,insertText:i,range:o,detail:i!==t?`Node ID: ${t}`:"Matter node",sortText:"0"+i}}).filter(Boolean)}function UR(o){return D0.get(o)??o}function xK(o,e){if(typeof e=="number")return o.endpoints.find(i=>i.endpointId===e);const t=parseInt(e,10);return isNaN(t)?o.endpoints.find(i=>i.name===e):o.endpoints.find(i=>i.endpointId===t)}function LK(o,e){const t=sb.get(UR(e));return t?t.endpoints.map(i=>{const n=i.name??String(i.endpointId),s=i.clusters.map(r=>r.name).join(", ");return{label:n,kind:Ch.Value,insertText:n,range:o,detail:i.name?`Endpoint ${i.endpointId} — ${s}`:`Clusters: ${s}`,sortText:"0"+String(i.endpointId).padStart(4,"0")}}):[]}function kK(o,e,t){const i=sb.get(UR(e));if(!i)return[];const n=xK(i,t);return n?n.clusters.map(s=>({label:s.name,kind:Ch.Value,insertText:s.name,range:o,detail:"Matter cluster",sortText:"0"+s.name})):[]}function IK(o,e,t){return(t?_K[e]??[]:mK[e]??[]).map(n=>({label:n,kind:t?Ch.Function:Ch.Property,insertText:n,range:o,detail:t?`${e} command`:`${e} attribute`,sortText:"0"+n}))}let UD=!1;function DK(){UD||(UD=!0,BD(),zD(),VD(),setInterval(BD,15e3),setInterval(zD,1e4),setInterval(VD,6e4),Kc.registerCompletionItemProvider("javascript",{triggerCharacters:["'",'"',"(",","," "],provideCompletionItems(o,e){const t=o.getValueInRange({startLineNumber:e.lineNumber,startColumn:1,endLineNumber:e.lineNumber,endColumn:e.column}),i=vK(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:wK(a,i.prefix)};case"db":return{suggestions:SK(a,i.prefix,i.includeViews)};case"matter-nodeId":return{suggestions:CK(a,i.prefix)};case"matter-endpointId":return{suggestions:LK(a,i.nodeId)};case"matter-cluster":return{suggestions:kK(a,i.nodeId,i.endpointId)};case"matter-attr":return{suggestions:IK(a,i.cluster,i.isSend)};default:return null}}}))}var EK=N('<button class="svelte-1pyfjii">New file here</button> <button class="svelte-1pyfjii">New subfolder here</button> <hr class="svelte-1pyfjii"/> <button class="svelte-1pyfjii">Rename folder…</button> <button class="danger svelte-1pyfjii">Delete folder…</button>',1),PK=N('<button class="svelte-1pyfjii">Show git history</button>'),TK=N('<button class="svelte-1pyfjii">Open</button> <button class="svelte-1pyfjii">Rename…</button> <button class="svelte-1pyfjii">Add to AI context</button> <!> <hr class="svelte-1pyfjii"/> <button class="danger svelte-1pyfjii">Delete</button>',1),MK=N('<div class="ctx-backdrop svelte-1pyfjii" role="presentation"></div> <div class="ctx-menu svelte-1pyfjii"><!></div>',1),NK=N('<div class="lib-tip-float svelte-1pyfjii">Library directory — files here are not auto-loaded as scripts</div>'),$D=N('<span class="git-mod svelte-1pyfjii" title="Uncommitted changes">M</span>'),RK=N('<ul class="tree-children svelte-1pyfjii"></ul>'),AK=N('<li class="tree-dir svelte-1pyfjii"><div role="treeitem" tabindex="-1" draggable="true"><button>›</button> <span role="button" tabindex="0"> </span> <!> <label class="lib-label svelte-1pyfjii" title="Library directory — files here are not auto-loaded as scripts"><input type="checkbox" class="svelte-1pyfjii"/> <span class="lib-checkmark svelte-1pyfjii"></span> <svg width="11" height="11" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 3h8a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H3V3z"></path><line x1="3" y1="12" x2="13" y2="12"></line><line x1="6" y1="3" x2="6" y2="12"></line></svg></label> <label class="dis-label svelte-1pyfjii" title="Disable — scripts in this folder will not be executed"><input type="checkbox" class="svelte-1pyfjii"/> <span class="dis-checkmark svelte-1pyfjii"></span> <svg width="11" height="11" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"><circle cx="8" cy="8" r="6"></circle><line x1="3.8" y1="12.2" x2="12.2" y2="3.8"></line></svg></label></div> <!></li>'),OK=N('<span class="dirty-dot svelte-1pyfjii">●</span>'),FK=N('<span class="err-dot svelte-1pyfjii">●</span>'),HK=N('<label><input type="checkbox" class="svelte-1pyfjii"/> <span class="dis-checkmark svelte-1pyfjii"></span> <svg width="11" height="11" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"><circle cx="8" cy="8" r="6"></circle><line x1="3.8" y1="12.2" x2="12.2" y2="3.8"></line></svg></label>'),WK=N('<span class="dis-spacer svelte-1pyfjii"></span>'),BK=N('<li draggable="true"><div class="file-row svelte-1pyfjii"><button><span> </span> <span class="fname svelte-1pyfjii"> </span> <!><!> <!></button> <!></div></li>'),zK=N('<div class="err svelte-1pyfjii"> </div>'),VK=N('<div class="history-empty svelte-1pyfjii">Loading…</div>'),jK=N('<div class="history-empty svelte-1pyfjii">No commits found.</div>'),UK=N('<button class="history-row svelte-1pyfjii"><span class="history-subject svelte-1pyfjii"> </span> <span class="history-meta svelte-1pyfjii"> </span></button>'),$K=N('<button class="history-load-more svelte-1pyfjii"> </button>'),qK=N("<!> <!>",1),KK=N('<div class="history-panel svelte-1pyfjii"><div class="history-resize-handle svelte-1pyfjii" role="separator"></div> <div class="history-hdr svelte-1pyfjii"><span class="history-title svelte-1pyfjii"> </span> <button class="history-close svelte-1pyfjii">✕</button></div> <div class="history-body svelte-1pyfjii"><!></div></div>'),GK=N('<span class="tab-dirty svelte-1pyfjii">●</span>'),ZK=N('<div role="button" tabindex="0"><span class="tab-label svelte-1pyfjii"> </span> <!> <button class="tab-close svelte-1pyfjii" title="Close">×</button></div>'),XK=N('<div class="tab-bar svelte-1pyfjii"></div>'),YK=N('<li class="changes-item svelte-1pyfjii"><span class="changes-status svelte-1pyfjii"> </span> <span class="changes-file svelte-1pyfjii"> </span></li>'),JK=N('<div class="changes-err svelte-1pyfjii"> </div>'),QK=N('<div class="changes-backdrop svelte-1pyfjii" role="presentation"></div> <div class="changes-popup svelte-1pyfjii"><div class="changes-popup-hdr svelte-1pyfjii">Uncommitted changes</div> <ul class="changes-list svelte-1pyfjii"></ul> <div class="changes-commit-row svelte-1pyfjii"><input class="changes-msg-input svelte-1pyfjii" type="text" placeholder="Commit message…"/> <button class="changes-commit-btn svelte-1pyfjii"> </button></div> <!></div>',1),eG=N('<div class="changes-wrap svelte-1pyfjii"><button class="git-changes svelte-1pyfjii"> </button> <!></div>'),tG=N('<span class="git-ahead svelte-1pyfjii"> </span>'),iG=N('<span class="git-behind svelte-1pyfjii"> </span>'),nG=N('<span class="git-status svelte-1pyfjii"><span class="git-branch svelte-1pyfjii"> </span> <!> <!> <!></span>'),sG=N('<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),oG=N('<button class="danger svelte-1pyfjii">Delete</button>'),rG=N(`<div class="welcome svelte-1pyfjii"><div class="welcome-inner svelte-1pyfjii"><div class="welcome-logo svelte-1pyfjii">she</div> <p class="welcome-sub svelte-1pyfjii">Smart Home Engine — a scriptable smart home automation engine</p> <div class="welcome-hint svelte-1pyfjii"><strong>Quick start:</strong> click <kbd class="svelte-1pyfjii">+ File</kbd> in the sidebar to create your first script,
152
+ or click an existing file to open it. Scripts run in a sandboxed VM with access to the <code class="svelte-1pyfjii">she</code> object for MQTT, scheduling, and more.</div> <div class="welcome-links svelte-1pyfjii"><a href="https://github.com/hobbyquaker/she" target="_blank" rel="noopener" class="svelte-1pyfjii">GitHub</a> <span class="svelte-1pyfjii">·</span> <a href="https://github.com/hobbyquaker/she/blob/main/doc/sandbox-api.md" target="_blank" rel="noopener" class="svelte-1pyfjii">API reference</a> <span class="svelte-1pyfjii">·</span> <a href="https://github.com/hobbyquaker/she/blob/main/README.md" target="_blank" rel="noopener" class="svelte-1pyfjii">README</a></div> <div class="welcome-shortcuts svelte-1pyfjii"><div class="welcome-shortcuts-title svelte-1pyfjii">Keyboard shortcuts</div> <div class="welcome-shortcuts-grid svelte-1pyfjii"><span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Ctrl</kbd><kbd class="svelte-1pyfjii">S</kbd></span><span class="svelte-1pyfjii">Save</span> <span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Ctrl</kbd><kbd class="svelte-1pyfjii">F</kbd></span><span class="svelte-1pyfjii">Find</span> <span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Ctrl</kbd><kbd class="svelte-1pyfjii">H</kbd></span><span class="svelte-1pyfjii">Find &amp; Replace</span> <span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Ctrl</kbd><kbd class="svelte-1pyfjii">G</kbd></span><span class="svelte-1pyfjii">Go to line</span> <span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Ctrl</kbd><kbd class="svelte-1pyfjii">Z</kbd></span><span class="svelte-1pyfjii">Undo</span> <span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Ctrl</kbd><kbd class="svelte-1pyfjii">Shift</kbd><kbd class="svelte-1pyfjii">Z</kbd></span><span class="svelte-1pyfjii">Redo</span> <span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Ctrl</kbd><kbd class="svelte-1pyfjii">/</kbd></span><span class="svelte-1pyfjii">Toggle comment</span> <span class="keys svelte-1pyfjii"><kbd class="svelte-1pyfjii">Alt</kbd><kbd class="svelte-1pyfjii">↑ / ↓</kbd></span><span class="svelte-1pyfjii">Move line up / down</span></div></div></div></div>`),aG=N('<button class="svelte-1pyfjii">Always accept in this session</button>'),lG=N('<button class="svelte-1pyfjii">Disable auto-accept</button>'),cG=N('<div class="split-backdrop svelte-1pyfjii" role="presentation"></div> <div class="split-menu svelte-1pyfjii"><!></div>',1),dG=N('<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>'),hG=N('<div class="history-diff-notice svelte-1pyfjii">Binary file — diff not available.</div>'),uG=N('<div class="diff-container svelte-1pyfjii"></div>'),gG=N('<div class="diff-overlay svelte-1pyfjii"><div class="diff-bar svelte-1pyfjii"><span class="diff-title svelte-1pyfjii">Commit <code> </code> → current — <em class="svelte-1pyfjii"> </em></span> <div class="diff-actions svelte-1pyfjii"><button class="discard-btn svelte-1pyfjii">Close</button></div></div> <!></div>'),fG=N('<div class="log-resize-handle svelte-1pyfjii" role="separator"></div>'),pG=N('<span class="log-file svelte-1pyfjii"> </span>'),mG=N("<option> </option>"),_G=N('<select class="log-filter-level svelte-1pyfjii"></select> <input class="log-filter-text svelte-1pyfjii" type="search" placeholder="Filter…"/> <label class="log-filter-regex svelte-1pyfjii" title="Interpret filter as a regular expression"><input type="checkbox" class="svelte-1pyfjii"/> <span class="log-filter-checkmark svelte-1pyfjii"></span> Regex</label> <button class="log-clear svelte-1pyfjii">Clear</button>',1),vG=N('<div><span class="ts svelte-1pyfjii"> </span> <span class="lvl svelte-1pyfjii"> </span> <span class="msg svelte-1pyfjii"> </span></div>'),bG=N('<span class="log-empty svelte-1pyfjii">No log output for this script.</span>'),yG=N('<div class="log-body svelte-1pyfjii"><!> <!></div>'),wG=N('<div class="chat-resize-handle svelte-1pyfjii" role="separator"></div> <div class="chat-container svelte-1pyfjii"><!></div>',1),SG=N('<!> <!> <!> <!> <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"><li role="presentation"></li> <!></ul> <!></aside> <div class="sidebar-resize-handle svelte-1pyfjii" role="separator"></div> <div class="editor-area svelte-1pyfjii"><!> <div class="editor-toolbar svelte-1pyfjii"><span class="filename svelte-1pyfjii"> </span> <!> <div class="split-wrap svelte-1pyfjii"><div class="split-btn svelte-1pyfjii"><button class="split-main svelte-1pyfjii"> </button> <button class="split-arrow svelte-1pyfjii" aria-label="Save options">▾</button></div> <!></div> <!> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"><line x1="5.5" y1="5" x2="4" y2="2.5"></line><line x1="10.5" y1="5" x2="12" y2="2.5"></line><path d="M3 11 V7 A5 3.5 0 0 0 13 7 V11 Z" stroke-linejoin="round"></path><circle cx="6" cy="8.2" r="0.7" fill="currentColor" stroke="none"></circle><circle cx="10" cy="8.2" r="0.7" fill="currentColor" stroke="none"></circle></svg> AI</button></div> <div class="editor-body svelte-1pyfjii"><div class="editor-left svelte-1pyfjii"><div class="editor-stack svelte-1pyfjii"><div class="editor-container svelte-1pyfjii"></div> <!> <!> <!></div> <div><!> <div class="log-header svelte-1pyfjii"><button class="log-toggle svelte-1pyfjii"> <!></button> <!></div> <!></div></div> <!></div></div></div>',1);function CG(o,e){Vo(e,!0);let t=W(mi([])),i=W(mi({})),n=W(null),s=W(null),r=W(null),a=W(null),c=W(mi([])),h=W(null),g=W(!1),f=W(""),p=W(!1),v=W(!0),_=W(null),w=W(!1),S=W(!1),D=W(null),E=W(mi([])),R=W(!1),z=W(30),H=W(void 0),ee=null,X=null,me=null,Le=W(!1),je=W(""),Ce=W(!1),mt=W(void 0),Lt=W(mi(new Set));const ct=new Set;let li=W(mi([])),zt=W("all"),ei=W(""),qe=W(!1);const Ye=["all","debug","info","warn","error"],Ne={debug:0,info:1,warn:2,error:3};function st(O){if(u(zt)!=="all"&&Ne[O.level]<Ne[u(zt)])return!1;if(!u(ei))return!0;if(u(qe))try{return new RegExp(u(ei),"i").test(O.msg)}catch{}return O.msg.toLowerCase().includes(u(ei).toLowerCase())}let Mt=W(null);function ni(O){const oe=O.currentTarget.getBoundingClientRect();k(Mt,{x:oe.left,y:oe.top},!0)}function ci(){k(Mt,null)}let Vt,ut,Ii,fi=!1,tn=null,Fi=!1,Mn=!1,Yi=W(!1),Ji=W(null),Fn=W(!1),Ai=W(!1),Nn=W(void 0),nn=null,Hi=null,Rn=null,Un=W(mi(parseInt(localStorage.getItem("she-scripts-sidebar-width")??"220",10))),Hn=W(mi(parseInt(localStorage.getItem("she-scripts-log-height")??"130",10))),Wn=W(mi(parseInt(localStorage.getItem("she-scripts-chat-width")??"340",10))),dn=W(mi(parseInt(localStorage.getItem("she-scripts-history-height")??"220",10))),sn=!1,ts=0,Ke=0,_t=!1,ri=0,Di=0,wi=!1,gn=0,_n=0,Bn=!1,Cn=0,Zn=0;const Xn=ot(()=>{var O;return u(h)&&u(ve)?{path:u(h),content:((O=u(ve).model)==null?void 0:O.getValue())??u(ve).savedContent}:null}),xn=ot(()=>{var O;return new Set(((O=u(_))==null?void 0:O.changes.map(oe=>oe.file))??[])}),Ue=ot(()=>{const O=new Set;for(const oe of u(xn)){const be=oe.split("/");for(let ae=1;ae<be.length;ae++)O.add(be.slice(0,ae).join("/"))}return O});let Z=W(!1),Fe=W(""),vt=W(!1),Ct=W("");async function qt(){if(u(Fe).trim()){k(vt,!0),k(Ct,"");try{if(await wD(u(Fe).trim()),u(S))try{await a_()}catch{}k(Fe,""),k(Z,!1),await he()}catch(O){k(Ct,O.message,!0)}finally{k(vt,!1)}}}let A,ie,ve=ot(()=>u(c).find(O=>O.path===u(h))??null);const Ze="she-tabs",gt="she-active-tab",q="she-log-open",re="she-chat-open";let ue=gg(e,"active",3,!0);An(()=>{Mn&&(localStorage.setItem(Ze,JSON.stringify(u(c).map(O=>O.path))),u(h)?localStorage.setItem(gt,u(h)):localStorage.removeItem(gt))}),An(()=>{Mn&&localStorage.setItem(re,String(u(Yi)))}),An(()=>{ue()&&ut&&ut.layout()});const tt=`
153
+ declare const she: {
154
+ log(...args: any[]): void;
155
+ info(...args: any[]): void;
156
+ debug(...args: any[]): void;
157
+ warn(...args: any[]): void;
158
+ error(...args: any[]): void;
159
+ now(): number;
160
+ /** Schedule with a cron string, Date, node-schedule literal, array of any of those,
161
+ * or a suncalc event name ('sunrise', 'sunset', 'dawn', 'dusk', …) for solar scheduling.
162
+ * opts.shift (seconds) offsets solar events; opts.random adds a random delay. */
163
+ schedule(pattern: string | Date | object | (string | Date | object)[], opts?: { shift?: number; random?: number }, cb?: () => void): void;
164
+ combineBool(srcs: string[], target: string): void;
165
+ combineMax(srcs: string[], target: string): void;
166
+ timer(src: string | string[], target: string, time: number): void;
167
+ mqtt: {
168
+ sub(topic: string | string[], opts?: any, cb?: (topic: string, val: any, obj: any, prev: any, msg: any) => void): void;
169
+ pub(topic: string | string[], payload: any, opts?: { qos?: number; retain?: boolean }): void;
170
+ get(topic: string): any;
171
+ set(topic: string | string[], val: any): void;
172
+ getProp(topic: string, ...prop: string[]): any;
173
+ link(source: string | string[], target: string | string[], value?: any): void;
174
+ age(topic: string): number;
175
+ };
176
+ api: {
177
+ get(path: string, handler: (req: any) => any): void;
178
+ post(path: string, handler: (req: any, body: any) => any): void;
179
+ put(path: string, handler: (req: any, body: any) => any): void;
180
+ delete(path: string, handler: (req: any) => any): void;
181
+ };
182
+ db: {
183
+ get(id: string): any;
184
+ set(id: string, doc: object): void;
185
+ extend(id: string, partial: object): void;
186
+ delete(id: string): void;
187
+ prop(id: string, method: 'set' | 'create' | 'del', prop: string, val?: any): void;
188
+ sub(pattern: string, callback: (id: string, doc: any) => void): void;
189
+ query(filter: string | null, mapFn: Function, reduceFn?: Function): any[];
190
+ };
191
+ matter: {
192
+ sub(nodeId: string, endpointId: number, cluster: string, attr: string, cb: (val: any, old: any) => void): number;
193
+ unsub(listenerId: number): void;
194
+ get(nodeId: string, endpointId: number, cluster: string, attr: string): Promise<any>;
195
+ send(nodeId: string, endpointId: number, cluster: string, command: string, args?: object): Promise<any>;
196
+ on(nodeId: string, endpointId: number, cluster: string, event: string, cb: (val: any) => void): number;
197
+ };
198
+ influx: {
199
+ query(fluxQuery: string): Promise<any[]>;
200
+ write(measurement: string, fields: object, tags?: object, timestamp?: number | Date): Promise<void>;
201
+ getLast(topic: string, n: number): Promise<Array<{ ts: number; val: any }>>;
202
+ getRange(topic: string, from: number | string | Date, to: number | string | Date): Promise<Array<{ ts: number; val: any }>>;
203
+ };
204
+ elastic: {
205
+ search(index: string, query: object): Promise<{ hits: any[]; total: number }>;
206
+ get(index: string, id: string): Promise<object | null>;
207
+ index(index: string, doc: object, id?: string): Promise<{ id: string }>;
208
+ find(index: string, field: string, text: string, size?: number): Promise<any[]>;
209
+ };
210
+ };
211
+ `;Mr(async()=>{var ae;k(v,localStorage.getItem(q)!=="false"),k(Yi,localStorage.getItem(re)==="true"),Kc.typescript.javascriptDefaults.addExtraLib(tt,"she-api.d.ts"),Kc.typescript.javascriptDefaults.setCompilerOptions({target:Kc.typescript.ScriptTarget.ES2022,allowNonTsExtensions:!0,checkJs:!0}),Kc.typescript.javascriptDefaults.setDiagnosticsOptions({noSyntaxValidation:!1,noSemanticValidation:!0}),DK(),Ii=cr.createModel("","javascript"),ut=cr.create(Vt,{model:Ii,theme:"vs-dark",automaticLayout:!0,minimap:{enabled:!1},fontSize:14,lineNumbers:"on",scrollBeyondLastLine:!1}),ut.onDidChangeModelContent(()=>{if(fi)return;const Xe=u(c).find(Pt=>Pt.path===u(h));Xe&&(Xe.dirty=ut.getValue()!==Xe.savedContent),Ie&&clearTimeout(Ie),Ie=setTimeout(ke,600)}),tn=kR(Xe=>{const Pt=Xe.msg.match(/^([^:\n]+\.js):\s/);if(!Pt)return;const Rt=Pt[1];if(Xe.level==="error")ct.add(Rt),u(Lt).has(Rt)||k(Lt,new Set([...u(Lt),Rt]),!0);else if(ct.has(Rt)){ct.delete(Rt);const bi=new Set(u(Lt));bi.delete(Rt),k(Lt,bi,!0)}const Pi=u(c).find(bi=>bi.path===Rt);Pi&&(Pi.logEntries=[...Pi.logEntries.slice(-199),Xe],Pi.path===u(h)&&u(v)&&u(mt)&&w_().then(()=>{u(mt)&&(u(mt).scrollTop=u(mt).scrollHeight)}))}),await Ht(),he();try{const Xe=await dL();typeof Xe.gitAutoCommit=="boolean"&&k(w,Xe.gitAutoCommit,!0),typeof Xe.gitAutoPush=="boolean"&&k(S,Xe.gitAutoPush,!0)}catch{}const O=JSON.parse(localStorage.getItem(Ze)??"[]"),oe=localStorage.getItem(gt);for(const Xe of O)await Bt(Xe,!1);const be=oe&&u(c).some(Xe=>Xe.path===oe)?oe:((ae=u(c)[0])==null?void 0:ae.path)??null;be&&await ti(be),Mn=!0}),xy(()=>{var O;Ie&&clearTimeout(Ie),tn==null||tn();for(const oe of u(c))(O=oe.model)==null||O.dispose();Ii==null||Ii.dispose(),ut==null||ut.dispose()});async function Ht(){try{if(k(t,await X8(),!0),!Fi){let oe=function(be){for(const ae of be)ae.type==="dir"&&(O[ae.path]=!0,ae.children&&oe(ae.children))};Fi=!0;const O={};oe(u(t)),k(i,O,!0)}k(f,"")}catch(O){k(f,O.message,!0)}}function bt(O){u(i)[O]=!u(i)[O]}function fe(O){switch(O){case"SH":case"BASH":return"$";case"MD":case"MARKDOWN":return"⇓";case"JSON":case"JSONC":return"{}";default:return O}}async function dt(O,oe){try{oe?await jc(`${O}/.shelib`,""):await r_(`${O}/.shelib`),await Ht(),await Oe("all",oe?`lib ${O}`:`unlib ${O}`)}catch(be){k(f,be.message,!0)}}async function jt(O,oe){const be=O.split("/").pop(),ae=O.includes("/")?O.slice(0,O.lastIndexOf("/")):"",Xe=ae?`${ae}/.shedisable-${be}`:`.shedisable-${be}`;try{oe?await jc(Xe,""):await r_(Xe),await Ht(),await Oe("all",oe?`disable ${O}`:`enable ${O}`)}catch(Pt){k(f,Pt.message,!0)}}async function Bt(O,oe=!0){var be;if(u(c).some(ae=>ae.path===O)){oe&&await ti(O);return}try{const{content:ae}=await Qw(O),Xe=zF.parse(`file:///she-scripts/${encodeURIComponent(O)}`);(be=cr.getModel(Xe))==null||be.dispose();const Pt=cr.createModel(ae,We(O),Xe);k(c,[...u(c),{path:O,dirty:!1,savedContent:ae,model:Pt,logEntries:[]}],!0),oe&&await ti(O)}catch(ae){k(f,ae.message,!0)}}async function oi(O){await Bt(O,!0)}async function ti(O){const oe=u(c).find(be=>be.path===O);oe!=null&&oe.model&&(Oi(),k(Ji,null),k(h,O,!0),fi=!0,ut.setModel(oe.model),fi=!1,ke())}async function J(O){var ae;const oe=u(c).find(Xe=>Xe.path===O);if(!oe||oe.dirty&&!await A.show(`Discard unsaved changes to ${O}?`,{confirm:"Discard"}))return;const be=u(c).findIndex(Xe=>Xe.path===O);if((ae=oe.model)==null||ae.dispose(),k(c,u(c).filter(Xe=>Xe.path!==O),!0),u(h)===O){const Xe=u(c)[be]??u(c)[be-1]??null;Xe?await ti(Xe.path):(k(h,null),ut.setModel(Ii))}}async function he(){try{k(_,await J8(),!0)}catch{k(_,null)}}async function Oe(O,oe){if(u(_))try{if(O==="all"?await wD(oe):await i7(O,oe),u(S))try{await a_()}catch{}await he()}catch{}}async function it(){if(!u(h))return;const O=u(c).find(oe=>oe.path===u(h));if(O){k(g,!0);try{const oe=ut.getValue();await jc(u(h),oe),O.savedContent=oe,O.dirty=!1,k(f,""),u(w)?await Oe([u(h)],`update ${u(h)}`):he()}catch(oe){k(f,oe.message,!0)}finally{k(g,!1)}}}async function It(){if(!u(h)||(await it(),u(f)))return;const O=await ie.show("Commit message:",{initial:`update ${u(h)}`,placeholder:"Update script",confirm:"Commit"});if(O)try{if(await t7(u(h),O),u(S))try{await a_()}catch{}he()}catch(oe){k(f,"Git: "+oe.message)}}async function Je(){k(p,!1);try{await a_(),await he(),k(f,"")}catch(O){k(f,"Git push: "+O.message)}}function Nt(O){const oe=Date.now()-new Date(O).getTime(),be=Math.floor(oe/1e3);if(be<60)return"just now";const ae=Math.floor(be/60);if(ae<60)return`${ae}m ago`;const Xe=Math.floor(ae/60);if(Xe<24)return`${Xe}h ago`;const Pt=Math.floor(Xe/24);if(Pt<30)return`${Pt}d ago`;const Rt=Math.floor(Pt/30);return Rt<12?`${Rt}mo ago`:`${Math.floor(Rt/12)}y ago`}async function ii(O){K(),k(D,O,!0),k(E,[],!0),k(z,30),await Wt()}async function Wt(){if(u(D)){k(R,!0);try{k(E,await n7(u(D).path,u(z)),!0)}catch{}finally{k(R,!1)}}}async function At(){k(z,u(z)+30),await Wt()}function zi(){k(D,null),k(E,[],!0),Oi()}async function on(O){if(!u(D))return;Oi(),await oi(u(D).path);let oe;try{oe=await s7(O.hash,u(D).path)}catch{return}if(k(je,O.hash,!0),k(Ce,oe.binary,!0),k(Le,!0),oe.binary||oe.content===null)return;let be="";const ae=u(c).find(Pt=>Pt.path===u(D).path);if(ae!=null&&ae.model)be=ae.model.getValue();else try{be=(await Qw(u(D).path)).content}catch{}if(await w_(),!u(H))return;const Xe=We(u(D).path);X=cr.createModel(oe.content,Xe),me=cr.createModel(be,Xe),ee=cr.createDiffEditor(u(H),{theme:"vs-dark",readOnly:!0,renderSideBySide:!0,automaticLayout:!0,minimap:{enabled:!1},fontSize:13,scrollBeyondLastLine:!1}),ee.setModel({original:X,modified:me})}function Oi(){k(Le,!1),k(Ce,!1),ee==null||ee.dispose(),ee=null,X==null||X.dispose(),X=null,me==null||me.dispose(),me=null}async function si(){const O=u(n)?`${u(n)}/`:"",oe=await ie.show("New script name:",{placeholder:O?`${O}myscript.js`:"myscript.js",initial:O,confirm:"Create"});if(!oe)return;const be=oe.endsWith(".js")?`/* global she */
212
+ 'use strict';
213
+
214
+ `:"";await jc(oe,be),await Ht(),await Bt(oe,!0)}async function Vi(){const O=u(n)?`${u(n)}/`:"",oe=await ie.show("New folder name:",{placeholder:O?`${O}subfolder`:"myfolder",initial:O,confirm:"Create"});oe&&(await Y8(oe),u(i)[oe]=!0,await Ht())}function F(O,oe){O.preventDefault(),k(s,{x:O.clientX,y:O.clientY,entry:oe},!0)}function K(){k(s,null)}async function De(O){K(),k(n,O,!0),u(i)[O]=!0,await si()}async function Re(O){K(),k(n,O,!0),await Vi()}async function $e(O){K();const oe=O.path.includes("/")?O.path.slice(0,O.path.lastIndexOf("/")+1):"",be=await ie.show(O.type==="dir"?"Rename folder:":"Rename script:",{initial:O.name,placeholder:O.name,confirm:"Rename"});if(!be||be===O.name)return;const ae=oe+be;try{await yD(O.path,ae);const Xe=u(c).find(Pt=>Pt.path===O.path);Xe&&(Xe.path=ae,u(h)===O.path&&k(h,ae)),await Ht(),await Oe("all",`rename ${O.path} → ${ae}`)}catch(Xe){k(f,Xe.message,!0)}}function Me(O){if(!O.children)return 0;let oe=0;for(const be of O.children)oe++,be.type==="dir"&&(oe+=Me(be));return oe}async function Ge(O){K();let oe=`Delete ${O.type==="dir"?"folder":"file"} "${O.path}"?`;if(O.type==="dir"){const be=Me(O);be>0&&(oe+=` This will also delete ${be} item${be===1?"":"s"} inside.`)}if(await A.show(oe,{confirm:"Delete",danger:!0})){if(O.type==="dir")for(const be of[...u(c)])be.path.startsWith(O.path+"/")&&await J(be.path);else await J(O.path);await r_(O.path),await Ht(),await Oe("all",`delete ${O.path}`)}}async function Yt(O){K();const{content:oe}=await Qw(O.path);u(li).some(be=>be.name===O.path)||k(li,[...u(li),{name:O.path,content:oe}],!0),k(Yi,!0)}function ge(O,oe){var be;k(r,oe,!0),(be=O.dataTransfer)==null||be.setData("text/plain",oe)}function xe(O,oe){if(O.preventDefault(),u(r)&&(u(r)===oe||oe.startsWith(u(r)+"/"))){O.dataTransfer&&(O.dataTransfer.dropEffect="none"),k(a,null);return}O.dataTransfer&&(O.dataTransfer.dropEffect="move"),k(a,oe,!0)}function ft(){k(a,null)}async function Ee(O,oe){var Rt,Pi,bi;O.preventDefault(),k(a,null);const be=Array.from(((Rt=O.dataTransfer)==null?void 0:Rt.items)??[]).filter(Li=>Li.kind==="file");if(be.length>0&&!u(r)){for(const Li of be){const Ti=(Pi=Li.webkitGetAsEntry)==null?void 0:Pi.call(Li);Ti&&await at(Ti,oe,!0)}await Ht();return}const ae=u(r)??((bi=O.dataTransfer)==null?void 0:bi.getData("text/plain"));if(k(r,null),!ae||ae===oe||oe.startsWith(ae+"/"))return;const Xe=ae.split("/").pop(),Pt=oe?`${oe}/${Xe}`:Xe;if(Pt!==ae)try{await yD(ae,Pt);for(const Li of u(c))if(Li.path===ae)u(h)===ae&&k(h,Pt,!0),Li.path=Pt;else if(Li.path.startsWith(ae+"/")){const Ti=Pt+Li.path.slice(ae.length);u(h)===Li.path&&k(h,Ti),Li.path=Ti}await Ht(),await Oe("all",`rename ${ae} → ${Pt}`)}catch(Li){k(f,Li.message,!0)}}async function at(O,oe,be){if(O.isFile){const Xe=await(await new Promise((Rt,Pi)=>O.file(Rt,Pi))).text(),Pt=oe?`${oe}/${O.name}`:O.name;await jc(Pt,Xe),be&&O.name.endsWith(".js")&&await jt(Pt,!0)}else if(O.isDirectory){const ae=O.createReader();let Xe=[],Pt;do Pt=await new Promise((Rt,Pi)=>ae.readEntries(Rt,Pi)),Xe=[...Xe,...Pt];while(Pt.length>0);for(const Rt of Xe)await at(Rt,oe?`${oe}/${O.name}`:O.name,!1);if(be){const Rt=oe?`${oe}/${O.name}`:O.name;await jt(Rt,!0)}}}async function Kt(){if(!u(h)||!await A.show(`Delete ${u(h)}?`,{confirm:"Delete",danger:!0}))return;const O=u(h);await J(O),await r_(O),await Ht(),await Oe("all",`delete ${O}`)}function V(){u(ve)&&(u(ve).logEntries=[])}function Y(){k(v,!u(v)),localStorage.setItem(q,String(u(v)))}function Pe(O){return new Date(O).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function We(O){var ae;const oe=((ae=O.split(".").pop())==null?void 0:ae.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"}[oe]??"plaintext"}let Ie=null;async function ke(){const O=u(c).find(be=>be.path===u(h));if(!(O!=null&&O.model))return;const oe=O.model;try{const Pt=(await(await(await Kc.typescript.getJavaScriptWorker())(oe.uri)).getSyntacticDiagnostics(oe.uri.toString())).map(Rt=>{const Pi=oe.getPositionAt(Rt.start??0),bi=oe.getPositionAt((Rt.start??0)+(Rt.length??0));return{severity:VF.Error,startLineNumber:Pi.lineNumber,startColumn:Pi.column,endLineNumber:bi.lineNumber,endColumn:bi.column,message:typeof Rt.messageText=="string"?Rt.messageText:JSON.stringify(Rt.messageText),source:"she-syntax"}});if(cr.setModelMarkers(oe,"she-syntax",Pt),u(h)){if(Pt.length>0)ct.add(u(h)),u(Lt).has(u(h))||k(Lt,new Set([...u(Lt),u(h)]),!0);else if(ct.has(u(h))){ct.delete(u(h));const Rt=new Set(u(Lt));Rt.delete(u(h)),k(Lt,Rt,!0)}}}catch{}}function xt(O){sn=!0,ts=O.clientX,Ke=u(Un),O.preventDefault()}function Qe(O){_t=!0,ri=O.clientY,Di=u(Hn),O.preventDefault()}function Te(O){wi=!0,gn=O.clientX,_n=u(Wn),O.preventDefault()}function ht(O){Bn=!0,Cn=O.clientY,Zn=u(dn),O.preventDefault()}function Ae(O){sn&&k(Un,Math.max(140,Math.min(500,Ke+O.clientX-ts)),!0),_t&&k(Hn,Math.max(60,Math.min(500,Di-(O.clientY-ri))),!0),wi&&k(Wn,Math.max(200,Math.min(700,_n-(O.clientX-gn))),!0),Bn&&k(dn,Math.max(80,Math.min(600,Zn-(O.clientY-Cn))),!0)}function _e(){sn&&(sn=!1,localStorage.setItem("she-scripts-sidebar-width",String(u(Un)))),_t&&(_t=!1,localStorage.setItem("she-scripts-log-height",String(u(Hn)))),wi&&(wi=!1,localStorage.setItem("she-scripts-chat-width",String(u(Wn)))),Bn&&(Bn=!1,localStorage.setItem("she-scripts-history-height",String(u(dn))))}function we(O){(O.ctrlKey||O.metaKey)&&O.key==="s"&&(O.preventDefault(),it()),O.key==="Escape"&&(k(p,!1),k(s,null))}async function ye(O,oe){const be=await ie.show("Save new script as:",{placeholder:"myscript.js",initial:O,confirm:"Create"});if(be)try{await jc(be,oe),await Ht(),await Bt(be,!0)}catch(ae){k(f,ae.message,!0)}}async function pe(O){var be,ae;if(u(Fn)&&u(h)){k(Ji,O,!0),await nt();return}if(k(Ji,O,!0),await w_(),!u(Nn))return;Hi==null||Hi.dispose(),Rn==null||Rn.dispose(),nn==null||nn.dispose();const oe=((ae=(be=u(ve))==null?void 0:be.model)==null?void 0:ae.getValue())??"";Hi=cr.createModel(oe,"javascript"),Rn=cr.createModel(O,"javascript"),nn=cr.createDiffEditor(u(Nn),{theme:"vs-dark",readOnly:!0,renderSideBySide:!0,automaticLayout:!0,minimap:{enabled:!1},fontSize:13,scrollBeyondLastLine:!1}),nn.setModel({original:Hi,modified:Rn})}An(()=>{u(h),k(Fn,!1),k(Ai,!1)});async function nt(){if(u(Ji)===null||!u(h))return;const O=u(Ji);k(Ji,null);const oe=u(c).find(be=>be.path===u(h));oe!=null&&oe.model&&(fi=!0,oe.model.setValue(O),fi=!1,oe.dirty=!1,oe.savedContent=O);try{await jc(u(h),O),k(f,""),u(w)?await Oe([u(h)],`update ${u(h)}`):he()}catch(be){k(f,be.message,!0)}He()}function ce(){k(Ji,null),He()}function He(){nn==null||nn.dispose(),nn=null,Hi==null||Hi.dispose(),Hi=null,Rn==null||Rn.dispose(),Rn=null}var rt=SG();ls("keydown",ud,we),ls("mousemove",ud,Ae),ls("mouseup",ud,_e);var Ot=wt(rt);Ls(Vg(Ot,{}),O=>A=O,()=>A);var et=x(Ot,2);Ls(E7(et,{}),O=>ie=O,()=>ie);var Ut=x(et,2);{var Gt=O=>{var oe=MK(),be=wt(oe),ae=x(be,2);let Xe;var Pt=C(ae);{var Rt=bi=>{var Li=EK(),Ti=wt(Li),Si=x(Ti,2),Qi=x(Si,4),hn=x(Qi,2);Q("click",Ti,()=>De(u(s).entry.path)),Q("click",Si,()=>Re(u(s).entry.path)),Q("click",Qi,()=>$e(u(s).entry)),Q("click",hn,()=>Ge(u(s).entry)),T(bi,Li)},Pi=bi=>{var Li=TK(),Ti=wt(Li),Si=x(Ti,2),Qi=x(Si,2),hn=x(Qi,2);{var is=Zi=>{var Qn=PK();Q("click",Qn,()=>ii(u(s).entry)),T(Zi,Qn)};U(hn,Zi=>{u(_)&&Zi(is)})}var zn=x(hn,4);Q("click",Ti,()=>oi(u(s).entry.path)),Q("click",Si,()=>$e(u(s).entry)),Q("click",Qi,()=>Yt(u(s).entry)),Q("click",zn,()=>Ge(u(s).entry)),T(bi,Li)};U(Pt,bi=>{u(s).entry.type==="dir"?bi(Rt):bi(Pi,-1)})}G(()=>Xe=Ro(ae,"",Xe,{left:`${u(s).x??""}px`,top:`${u(s).y??""}px`})),Q("click",be,K),Q("contextmenu",be,bi=>{bi.preventDefault(),K()}),T(O,oe)};U(Ut,O=>{u(s)&&O(Gt)})}var Ln=x(Ut,2);{var Wi=O=>{var oe=NK();let be;G(()=>be=Ro(oe,"",be,{left:`${u(Mt).x??""}px`,top:`${u(Mt).y-4}px`})),T(O,oe)};U(Ln,O=>{u(Mt)&&O(Wi)})}var kn=x(Ln,2),qn=C(kn);let pi;{const O=(be,ae=by,Xe)=>{let Pt=c1(()=>ZF(Xe==null?void 0:Xe(),!1));var Rt=js(),Pi=wt(Rt);{var bi=Ti=>{var Si=AK(),Qi=C(Si);let hn;var is=C(Qi);let zn;var Zi=x(is,2);let Qn;var no=C(Zi),so=x(Zi,2);{var Cs=$n=>{var oo=$D();T($n,oo)},rs=ot(()=>u(xn).has(ae().path)||u(Ue).has(ae().path));U(so,$n=>{u(rs)&&$n(Cs)})}var gs=x(so,2),fs=C(gs),xs=x(gs,2),Ko=C(xs),rr=x(Qi,2);{var Ds=$n=>{var oo=RK();di(oo,21,()=>ae().children,ha=>ha.path,(ha,Rl)=>{O(ha,()=>u(Rl),()=>ae().disabled||u(Pt))}),T($n,oo)};U(rr,$n=>{u(i)[ae().path]&&ae().children&&$n(Ds)})}G(()=>{hn=Zt(Qi,1,"dir-row svelte-1pyfjii",null,hn,{"dir-selected":u(n)===ae().path,"drag-target":u(a)===ae().path}),pn(Qi,"aria-selected",u(n)===ae().path),zn=Zt(is,1,"chevron svelte-1pyfjii",null,zn,{open:u(i)[ae().path]}),Qn=Zt(Zi,1,"dir-name svelte-1pyfjii",null,Qn,{lib:ae().lib}),$(no,ae().name),_w(fs,ae().lib),_w(Ko,ae().disabled)}),ls("dragstart",Qi,$n=>ge($n,ae().path)),ls("dragover",Qi,$n=>xe($n,ae().path)),ls("dragleave",Qi,ft),ls("drop",Qi,$n=>Ee($n,ae().path)),Q("contextmenu",Qi,$n=>F($n,ae())),Q("click",is,()=>bt(ae().path)),Q("click",Zi,()=>{k(n,ae().path,!0),u(i)[ae().path]=!0}),Q("keydown",Zi,$n=>$n.key==="Enter"&&k(n,ae().path,!0)),ls("mouseenter",gs,ni),ls("mouseleave",gs,ci),Q("change",fs,()=>dt(ae().path,!ae().lib)),Q("change",Ko,()=>jt(ae().path,!ae().disabled)),T(Ti,Si)},Li=Ti=>{const Si=ot(()=>u(Lt).has(ae().path)),Qi=ot(()=>u(xn).has(ae().path)),hn=ot(()=>u(c).some(Ki=>Ki.path===ae().path&&Ki.dirty)),is=ot(()=>(ae().name.split(".").pop()??"txt").toUpperCase()),zn=ot(()=>ae().name.endsWith(".js"));var Zi=BK();let Qn;var no=C(Zi),so=C(no);let Cs;var rs=C(so);let gs;var fs=C(rs),xs=x(rs,2),Ko=C(xs),rr=x(xs,2);{var Ds=Ki=>{var Ms=$D();T(Ki,Ms)};U(rr,Ki=>{u(Qi)&&Ki(Ds)})}var $n=x(rr);{var oo=Ki=>{var Ms=OK();T(Ki,Ms)};U($n,Ki=>{u(hn)&&Ki(oo)})}var ha=x($n,2);{var Rl=Ki=>{var Ms=FK();T(Ki,Ms)};U(ha,Ki=>{u(Si)&&Ki(Rl)})}var Xg=x(so,2);{var Wh=Ki=>{var Ms=HK();let Bh;var Al=C(Ms);G(()=>{Bh=Zt(Ms,1,"dis-label svelte-1pyfjii",null,Bh,{"dis-locked":u(Pt)}),pn(Ms,"title",u(Pt)?"Disabled by parent directory":"Disable — this script will not be executed"),_w(Al,ae().disabled),Al.disabled=u(Pt)}),Q("change",Al,()=>jt(ae().path,!ae().disabled)),T(Ki,Ms)},iw=Ki=>{var Ms=WK();T(Ki,Ms)};U(Xg,Ki=>{u(zn)?Ki(Wh):Ki(iw,-1)})}G((Ki,Ms,Bh)=>{Qn=Zt(Zi,1,"tree-file svelte-1pyfjii",null,Qn,Ki),Cs=Zt(so,1,"svelte-1pyfjii",null,Cs,{lib:ae().lib,dis:ae().disabled,err:u(Si)}),gs=Zt(rs,1,`badge badge-${Ms??""}`,"svelte-1pyfjii",gs,{"badge-shelib":ae().lib}),$(fs,Bh),$(Ko,ae().name)},[()=>({active:u(c).some(Ki=>Ki.path===ae().path),"active-tab":ae().path===u(h)}),()=>u(is).toLowerCase(),()=>fe(u(is))]),ls("dragstart",Zi,Ki=>ge(Ki,ae().path)),Q("contextmenu",Zi,Ki=>F(Ki,ae())),Q("click",so,()=>oi(ae().path)),T(Ti,Zi)};U(Pi,Ti=>{ae().type==="dir"?Ti(bi):Ti(Li,-1)})}T(be,Rt)};var $t=C(qn),qi=C($t),Ei=x(qi,2),us=x(Ei,2),io=x($t,2);{var sr=be=>{var ae=zK(),Xe=C(ae);G(()=>$(Xe,u(f))),T(be,ae)};U(io,be=>{u(f)&&be(sr)})}var Nr=x(io,2),or=C(Nr);let oe;var Yn=x(or,2);di(Yn,17,()=>u(t),be=>be.path,(be,ae)=>{O(be,()=>u(ae))});var ja=x(Nr,2);{var da=be=>{var ae=KK();let Xe;var Pt=C(ae),Rt=x(Pt,2),Pi=C(Rt),bi=C(Pi),Li=x(Pi,2),Ti=x(Rt,2),Si=C(Ti);{var Qi=zn=>{var Zi=VK();T(zn,Zi)},hn=zn=>{var Zi=jK();T(zn,Zi)},is=zn=>{var Zi=qK(),Qn=wt(Zi);di(Qn,17,()=>u(E),Cs=>Cs.hash,(Cs,rs)=>{var gs=UK(),fs=C(gs),xs=C(fs),Ko=x(fs,2),rr=C(Ko);G((Ds,$n)=>{$(xs,u(rs).subject),$(rr,`${Ds??""} · ${$n??""}`)},[()=>u(rs).hash.slice(0,7),()=>Nt(u(rs).date)]),Q("click",gs,()=>on(u(rs))),T(Cs,gs)});var no=x(Qn,2);{var so=Cs=>{var rs=$K(),gs=C(rs);G(()=>{rs.disabled=u(R),$(gs,u(R)?"Loading…":"Load more")}),Q("click",rs,At),T(Cs,rs)};U(no,Cs=>{u(E).length>=u(z)&&Cs(so)})}T(zn,Zi)};U(Si,zn=>{u(R)&&u(E).length===0?zn(Qi):u(E).length===0?zn(hn,1):zn(is,-1)})}G(()=>{Xe=Ro(ae,"",Xe,{height:`${u(dn)??""}px`}),pn(Pi,"title",u(D).path),$(bi,`History: ${u(D).name??""}`)}),Q("mousedown",Pt,ht),Q("click",Li,zi),T(be,ae)};U(ja,be=>{u(D)&&be(da)})}G(()=>oe=Zt(or,1,"tree-root-drop svelte-1pyfjii",null,oe,{"drag-target":u(a)===""})),Q("click",qi,si),Q("click",Ei,Vi),Q("click",us,Ht),ls("dragover",or,be=>xe(be,"")),ls("dragleave",or,ft),ls("drop",or,be=>Ee(be,""))}var Bi=x(qn,2),Hc=x(Bi,2),Fs=C(Hc);{var Ss=O=>{var oe=XK();di(oe,21,()=>u(c),be=>be.path,(be,ae)=>{var Xe=ZK();let Pt;var Rt=C(Xe),Pi=C(Rt),bi=x(Rt,2);{var Li=Si=>{var Qi=GK();T(Si,Qi)};U(bi,Si=>{u(ae).dirty&&Si(Li)})}var Ti=x(bi,2);G(Si=>{Pt=Zt(Xe,1,"tab svelte-1pyfjii",null,Pt,{active:u(ae).path===u(h)}),$(Pi,Si)},[()=>u(ae).path.split("/").pop()]),Q("click",Xe,()=>ti(u(ae).path)),Q("keydown",Xe,Si=>Si.key==="Enter"&&ti(u(ae).path)),Q("click",Ti,Si=>{Si.stopPropagation(),J(u(ae).path)}),T(be,Xe)}),T(O,oe)};U(Fs,O=>{u(c).length>0&&O(Ss)})}var Hs=x(Fs,2),Rr=C(Hs),Ua=C(Rr),Tl=x(Rr,2);{var $a=O=>{var oe=nG(),be=C(oe),ae=C(be),Xe=x(be,2);{var Pt=Ti=>{var Si=eG(),Qi=C(Si),hn=C(Qi),is=x(Qi,2);{var zn=Zi=>{var Qn=QK(),no=wt(Qn),so=x(no,2),Cs=x(C(so),2);di(Cs,21,()=>u(_).changes,Dn,(Ds,$n)=>{var oo=YK(),ha=C(oo),Rl=C(ha),Xg=x(ha,2),Wh=C(Xg);G(()=>{$(Rl,u($n).status),$(Wh,u($n).file)}),T(Ds,oo)});var rs=x(Cs,2),gs=C(rs),fs=x(gs,2),xs=C(fs),Ko=x(rs,2);{var rr=Ds=>{var $n=JK(),oo=C($n);G(()=>$(oo,u(Ct))),T(Ds,$n)};U(Ko,Ds=>{u(Ct)&&Ds(rr)})}G(Ds=>{fs.disabled=Ds,$(xs,u(vt)?"…":"Commit all")},[()=>!u(Fe).trim()||u(vt)]),Q("click",no,()=>k(Z,!1)),Q("keydown",gs,Ds=>Ds.key==="Enter"&&qt()),Ci(gs,()=>u(Fe),Ds=>k(Fe,Ds)),Q("click",fs,qt),T(Zi,Qn)};U(is,Zi=>{u(Z)&&Zi(zn)})}G(()=>{pn(Qi,"title",`${u(_).changes.length??""} uncommitted change(s) — click to view`),$(hn,`✎${u(_).changes.length??""}`)}),Q("click",Qi,()=>{k(Z,!u(Z)),k(Ct,"")}),T(Ti,Si)};U(Xe,Ti=>{u(_).changes.length>0&&Ti(Pt)})}var Rt=x(Xe,2);{var Pi=Ti=>{var Si=tG(),Qi=C(Si);G(()=>{pn(Si,"title",`${u(_).ahead??""} commit(s) ahead of upstream`),$(Qi,`↑${u(_).ahead??""}`)}),T(Ti,Si)};U(Rt,Ti=>{u(_).ahead>0&&Ti(Pi)})}var bi=x(Rt,2);{var Li=Ti=>{var Si=iG(),Qi=C(Si);G(()=>{pn(Si,"title",`${u(_).behind??""} commit(s) behind upstream`),$(Qi,`↓${u(_).behind??""}`)}),T(Ti,Si)};U(bi,Ti=>{u(_).behind>0&&Ti(Li)})}G(()=>{pn(be,"title",`Branch: ${u(_).branch??""}`),$(ae,`⎇ ${u(_).branch??""}`)}),T(O,oe)};U(Tl,O=>{u(_)&&O($a)})}var Uo=x(Tl,2),Ar=C(Uo),Io=C(Ar),Zy=C(Io),$o=x(Io,2),Xy=x(Ar,2);{var wm=O=>{var oe=sG(),be=wt(oe),ae=x(be,2),Xe=C(ae),Pt=x(Xe,2),Rt=x(Pt,2);G(()=>Rt.disabled=!u(_)),Q("click",be,()=>k(p,!1)),Q("click",Xe,()=>{k(p,!1),it()}),Q("click",Pt,()=>{k(p,!1),It()}),Q("click",Rt,Je),T(O,oe)};U(Xy,O=>{u(p)&&O(wm)})}var Or=x(Uo,2);{var Sm=O=>{var oe=oG();Q("click",oe,Kt),T(O,oe)};U(Or,O=>{u(h)&&O(Sm)})}var Ah=x(Or,2);let Oh;var Yy=x(Hs,2),Ug=C(Yy),$g=C(Ug),Cm=C($g);Ls(Cm,O=>Vt=O,()=>Vt);var xm=x(Cm,2);{var qg=O=>{var oe=rG();T(O,oe)};U(xm,O=>{u(h)||O(qg)})}var Lm=x(xm,2);{var km=O=>{var oe=dG(),be=C(oe),ae=C(be),Xe=x(C(ae)),Pt=C(Xe),Rt=x(ae,2),Pi=C(Rt),bi=C(Pi),Li=C(bi),Ti=C(Li),Si=x(Li,2),Qi=x(bi,2);{var hn=Zi=>{var Qn=cG(),no=wt(Qn),so=x(no,2),Cs=C(so);{var rs=fs=>{var xs=aG();Q("click",xs,()=>{k(Ai,!1),k(Fn,!0),nt()}),T(fs,xs)},gs=fs=>{var xs=lG();Q("click",xs,()=>{k(Ai,!1),k(Fn,!1)}),T(fs,xs)};U(Cs,fs=>{u(Fn)?fs(gs,-1):fs(rs)})}Q("click",no,()=>k(Ai,!1)),T(Zi,Qn)};U(Qi,Zi=>{u(Ai)&&Zi(hn)})}var is=x(Pi,2),zn=x(be,2);Ls(zn,Zi=>k(Nn,Zi),()=>u(Nn)),G(Zi=>{$(Pt,Zi),$(Ti,u(Fn)?"Auto-accept ✓":"Accept")},[()=>{var Zi;return(Zi=u(h))==null?void 0:Zi.split("/").pop()}]),Q("click",Li,nt),Q("click",Si,()=>k(Ai,!u(Ai))),Q("click",is,ce),T(O,oe)};U(Lm,O=>{u(Ji)!==null&&O(km)})}var Im=x(Lm,2);{var Fh=O=>{var oe=gG(),be=C(oe),ae=C(be),Xe=x(C(ae)),Pt=C(Xe),Rt=x(Xe,2),Pi=C(Rt),bi=x(ae,2),Li=C(bi),Ti=x(be,2);{var Si=hn=>{var is=hG();T(hn,is)},Qi=hn=>{var is=uG();Ls(is,zn=>k(H,zn),()=>u(H)),T(hn,is)};U(Ti,hn=>{u(Ce)?hn(Si):hn(Qi,-1)})}G(hn=>{var is;$(Pt,hn),$(Pi,(is=u(D))==null?void 0:is.name)},[()=>u(je).slice(0,7)]),Q("click",Li,Oi),T(O,oe)};U(Im,O=>{u(Le)&&O(Fh)})}var Fr=x($g,2);let Dm,Ml;var po=C(Fr);{var Em=O=>{var oe=fG();Q("mousedown",oe,Qe),T(O,oe)};U(po,O=>{u(v)&&O(Em)})}var Kg=x(po,2),Gg=C(Kg),Hh=C(Gg),Zg=x(Hh);{var Jy=O=>{var oe=pG(),be=C(oe);G(ae=>$(be,`— ${ae??""}`),[()=>u(h).split("/").pop()]),T(O,oe)};U(Zg,O=>{u(h)&&O(Jy)})}var Qy=x(Gg,2);{var Pm=O=>{var oe=_G(),be=wt(oe);di(be,21,()=>Ye,Dn,(Pi,bi)=>{var Li=mG(),Ti=C(Li),Si={};G(()=>{$(Ti,u(bi)),Si!==(Si=u(bi))&&(Li.value=(Li.__value=u(bi))??"")}),T(Pi,Li)});var ae=x(be,2),Xe=x(ae,2),Pt=C(Xe),Rt=x(Xe,2);qr(be,()=>u(zt),Pi=>k(zt,Pi)),Ci(ae,()=>u(ei),Pi=>k(ei,Pi)),zs(Pt,()=>u(qe),Pi=>k(qe,Pi)),Q("click",Rt,V),T(O,oe)};U(Qy,O=>{u(v)&&O(Pm)})}var ew=x(Kg,2);{var qo=O=>{var oe=yG(),be=C(oe);di(be,17,()=>{var Pt;return(((Pt=u(ve))==null?void 0:Pt.logEntries)??[]).filter(st)},Pt=>Pt.ts+Pt.msg,(Pt,Rt)=>{var Pi=vG(),bi=C(Pi),Li=C(bi),Ti=x(bi,2),Si=C(Ti),Qi=x(Ti,2),hn=C(Qi);G((is,zn)=>{Zt(Pi,1,`log-line ${u(Rt).level??""}`,"svelte-1pyfjii"),$(Li,is),$(Si,zn),$(hn,u(Rt).msg)},[()=>Pe(u(Rt).ts),()=>u(Rt).level.toUpperCase()]),T(Pt,Pi)});var ae=x(be,2);{var Xe=Pt=>{var Rt=bG();T(Pt,Rt)};U(ae,Pt=>{var Rt;(((Rt=u(ve))==null?void 0:Rt.logEntries.length)??0)===0&&Pt(Xe)})}Ls(oe,Pt=>k(mt,Pt),()=>u(mt)),T(O,oe)};U(ew,O=>{u(v)&&O(qo)})}var Nl=x(Ug,2);{var tw=O=>{var oe=wG(),be=wt(oe),ae=x(be,2);let Xe;var Pt=C(ae);pK(Pt,{get currentScript(){return u(Xn)},onApply:pe,onCreateFile:ye,get extraFiles(){return u(li)},set extraFiles(Rt){k(li,Rt,!0)}}),G(()=>Xe=Ro(ae,"",Xe,{width:`${u(Wn)??""}px`})),Q("mousedown",be,Te),T(O,oe)};U(Nl,O=>{u(Yi)&&O(tw)})}G(()=>{var O;pi=Ro(qn,"",pi,{width:`${u(Un)??""}px`}),$(Ua,u(h)??"No file selected"),Io.disabled=!((O=u(ve))!=null&&O.dirty)||u(g),$(Zy,u(g)?"Saving…":"Save"),$o.disabled=!u(h),Oh=Zt(Ah,1,"ai-toggle svelte-1pyfjii",null,Oh,{"ai-open":u(Yi)}),pn(Ah,"title",u(Yi)?"Close AI assistant":"Open AI assistant"),Dm=Zt(Fr,1,"log-panel svelte-1pyfjii",null,Dm,{collapsed:!u(v)}),Ml=Ro(Fr,"",Ml,{height:u(v)?`${u(Hn)}px`:"26px"}),$(Hh,`${u(v)?"▾":"▸"} Script Log `)}),Q("mousedown",Bi,xt),Q("click",Io,it),Q("click",$o,()=>k(p,!u(p))),Q("click",Ah,()=>k(Yi,!u(Yi))),Q("click",Gg,Y),T(o,rt),jo()}Tr(["click","contextmenu","keydown","change","mousedown"]);const $R="she-theme";function xG(){return localStorage.getItem($R)??"dark"}function LG(o){localStorage.setItem($R,o);const e=document.documentElement;o==="system"?e.removeAttribute("data-theme"):e.setAttribute("data-theme",o)}var Ef={exports:{}};/* @preserve
215
+ * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com
216
+ * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade
217
+ */var kG=Ef.exports,qD;function IG(){return qD||(qD=1,(function(o,e){(function(t,i){i(e)})(kG,(function(t){var i="1.9.4";function n(l){var d,m,b,I;for(m=1,b=arguments.length;m<b;m++){I=arguments[m];for(d in I)l[d]=I[d]}return l}var s=Object.create||(function(){function l(){}return function(d){return l.prototype=d,new l}})();function r(l,d){var m=Array.prototype.slice;if(l.bind)return l.bind.apply(l,m.call(arguments,1));var b=m.call(arguments,2);return function(){return l.apply(d,b.length?b.concat(m.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,m){var b,I,P,j;return j=function(){b=!1,I&&(P.apply(m,I),I=!1)},P=function(){b?I=arguments:(l.apply(m,arguments),setTimeout(j,d),b=!0)},P}function g(l,d,m){var b=d[1],I=d[0],P=b-I;return l===b&&m?l:((l-I)%P+P)%P+I}function f(){return!1}function p(l,d){if(d===!1)return l;var m=Math.pow(10,d===void 0?6:d);return Math.round(l*m)/m}function v(l){return l.trim?l.trim():l.replace(/^\s+|\s+$/g,"")}function _(l){return v(l).split(/\s+/)}function w(l,d){Object.prototype.hasOwnProperty.call(l,"options")||(l.options=l.options?s(l.options):{});for(var m in d)l.options[m]=d[m];return l.options}function S(l,d,m){var b=[];for(var I in l)b.push(encodeURIComponent(m?I.toUpperCase():I)+"="+encodeURIComponent(l[I]));return(!d||d.indexOf("?")===-1?"?":"&")+b.join("&")}var D=/\{ *([\w_ -]+) *\}/g;function E(l,d){return l.replace(D,function(m,b){var I=d[b];if(I===void 0)throw new Error("No value provided for variable "+m);return typeof I=="function"&&(I=I(d)),I})}var R=Array.isArray||function(l){return Object.prototype.toString.call(l)==="[object Array]"};function z(l,d){for(var m=0;m<l.length;m++)if(l[m]===d)return m;return-1}var H="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function ee(l){return window["webkit"+l]||window["moz"+l]||window["ms"+l]}var X=0;function me(l){var d=+new Date,m=Math.max(0,16-(d-X));return X=d+m,window.setTimeout(l,m)}var Le=window.requestAnimationFrame||ee("RequestAnimationFrame")||me,je=window.cancelAnimationFrame||ee("CancelAnimationFrame")||ee("CancelRequestAnimationFrame")||function(l){window.clearTimeout(l)};function Ce(l,d,m){if(m&&Le===me)l.call(d);else return Le.call(window,r(l,d))}function mt(l){l&&je.call(window,l)}var Lt={__proto__:null,extend:n,create:s,bind:r,get lastId(){return a},stamp:c,throttle:h,wrapNum:g,falseFn:f,formatNum:p,trim:v,splitWords:_,setOptions:w,getParamString:S,template:E,isArray:R,indexOf:z,emptyImageUrl:H,requestFn:Le,cancelFn:je,requestAnimFrame:Ce,cancelAnimFrame:mt};function ct(){}ct.extend=function(l){var d=function(){w(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},m=d.__super__=this.prototype,b=s(m);b.constructor=d,d.prototype=b;for(var I in this)Object.prototype.hasOwnProperty.call(this,I)&&I!=="prototype"&&I!=="__super__"&&(d[I]=this[I]);return l.statics&&n(d,l.statics),l.includes&&(li(l.includes),n.apply(null,[b].concat(l.includes))),n(b,l),delete b.statics,delete b.includes,b.options&&(b.options=m.options?s(m.options):{},n(b.options,l.options)),b._initHooks=[],b.callInitHooks=function(){if(!this._initHooksCalled){m.callInitHooks&&m.callInitHooks.call(this),this._initHooksCalled=!0;for(var P=0,j=b._initHooks.length;P<j;P++)b._initHooks[P].call(this)}},d},ct.include=function(l){var d=this.prototype.options;return n(this.prototype,l),l.options&&(this.prototype.options=d,this.mergeOptions(l.options)),this},ct.mergeOptions=function(l){return n(this.prototype.options,l),this},ct.addInitHook=function(l){var d=Array.prototype.slice.call(arguments,1),m=typeof l=="function"?l:function(){this[l].apply(this,d)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(m),this};function li(l){if(!(typeof L>"u"||!L||!L.Mixin)){l=R(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 zt={on:function(l,d,m){if(typeof l=="object")for(var b in l)this._on(b,l[b],d);else{l=_(l);for(var I=0,P=l.length;I<P;I++)this._on(l[I],d,m)}return this},off:function(l,d,m){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 I=arguments.length===1,P=0,j=l.length;P<j;P++)I?this._off(l[P]):this._off(l[P],d,m)}return this},_on:function(l,d,m,b){if(typeof d!="function"){console.warn("wrong listener type: "+typeof d);return}if(this._listens(l,d,m)===!1){m===this&&(m=void 0);var I={fn:d,ctx:m};b&&(I.once=!0),this._events=this._events||{},this._events[l]=this._events[l]||[],this._events[l].push(I)}},_off:function(l,d,m){var b,I,P;if(this._events&&(b=this._events[l],!!b)){if(arguments.length===1){if(this._firingCount)for(I=0,P=b.length;I<P;I++)b[I].fn=f;delete this._events[l];return}if(typeof d!="function"){console.warn("wrong listener type: "+typeof d);return}var j=this._listens(l,d,m);if(j!==!1){var ne=b[j];this._firingCount&&(ne.fn=f,this._events[l]=b=b.slice()),b.splice(j,1)}}},fire:function(l,d,m){if(!this.listens(l,m))return this;var b=n({},d,{type:l,target:this,sourceTarget:d&&d.sourceTarget||this});if(this._events){var I=this._events[l];if(I){this._firingCount=this._firingCount+1||1;for(var P=0,j=I.length;P<j;P++){var ne=I[P],de=ne.fn;ne.once&&this.off(l,de,ne.ctx),de.call(ne.ctx||this,b)}this._firingCount--}}return m&&this._propagateEvent(b),this},listens:function(l,d,m,b){typeof l!="string"&&console.warn('"string" type argument expected');var I=d;typeof d!="function"&&(b=!!d,I=void 0,m=void 0);var P=this._events&&this._events[l];if(P&&P.length&&this._listens(l,I,m)!==!1)return!0;if(b){for(var j in this._eventParents)if(this._eventParents[j].listens(l,d,m,b))return!0}return!1},_listens:function(l,d,m){if(!this._events)return!1;var b=this._events[l]||[];if(!d)return!!b.length;m===this&&(m=void 0);for(var I=0,P=b.length;I<P;I++)if(b[I].fn===d&&b[I].ctx===m)return I;return!1},once:function(l,d,m){if(typeof l=="object")for(var b in l)this._on(b,l[b],d,!0);else{l=_(l);for(var I=0,P=l.length;I<P;I++)this._on(l[I],d,m,!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)}};zt.addEventListener=zt.on,zt.removeEventListener=zt.clearAllEventListeners=zt.off,zt.addOneTimeEventListener=zt.once,zt.fireEvent=zt.fire,zt.hasEventListeners=zt.listens;var ei=ct.extend(zt);function qe(l,d,m){this.x=m?Math.round(l):l,this.y=m?Math.round(d):d}var Ye=Math.trunc||function(l){return l>0?Math.floor(l):Math.ceil(l)};qe.prototype={clone:function(){return new qe(this.x,this.y)},add:function(l){return this.clone()._add(Ne(l))},_add:function(l){return this.x+=l.x,this.y+=l.y,this},subtract:function(l){return this.clone()._subtract(Ne(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 qe(this.x*l.x,this.y*l.y)},unscaleBy:function(l){return new qe(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=Ye(this.x),this.y=Ye(this.y),this},distanceTo:function(l){l=Ne(l);var d=l.x-this.x,m=l.y-this.y;return Math.sqrt(d*d+m*m)},equals:function(l){return l=Ne(l),l.x===this.x&&l.y===this.y},contains:function(l){return l=Ne(l),Math.abs(l.x)<=Math.abs(this.x)&&Math.abs(l.y)<=Math.abs(this.y)},toString:function(){return"Point("+p(this.x)+", "+p(this.y)+")"}};function Ne(l,d,m){return l instanceof qe?l:R(l)?new qe(l[0],l[1]):l==null?l:typeof l=="object"&&"x"in l&&"y"in l?new qe(l.x,l.y):new qe(l,d,m)}function st(l,d){if(l)for(var m=d?[l,d]:l,b=0,I=m.length;b<I;b++)this.extend(m[b])}st.prototype={extend:function(l){var d,m;if(!l)return this;if(l instanceof qe||typeof l[0]=="number"||"x"in l)d=m=Ne(l);else if(l=Mt(l),d=l.min,m=l.max,!d||!m)return this;return!this.min&&!this.max?(this.min=d.clone(),this.max=m.clone()):(this.min.x=Math.min(d.x,this.min.x),this.max.x=Math.max(m.x,this.max.x),this.min.y=Math.min(d.y,this.min.y),this.max.y=Math.max(m.y,this.max.y)),this},getCenter:function(l){return Ne((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,l)},getBottomLeft:function(){return Ne(this.min.x,this.max.y)},getTopRight:function(){return Ne(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,m;return typeof l[0]=="number"||l instanceof qe?l=Ne(l):l=Mt(l),l instanceof st?(d=l.min,m=l.max):d=m=l,d.x>=this.min.x&&m.x<=this.max.x&&d.y>=this.min.y&&m.y<=this.max.y},intersects:function(l){l=Mt(l);var d=this.min,m=this.max,b=l.min,I=l.max,P=I.x>=d.x&&b.x<=m.x,j=I.y>=d.y&&b.y<=m.y;return P&&j},overlaps:function(l){l=Mt(l);var d=this.min,m=this.max,b=l.min,I=l.max,P=I.x>d.x&&b.x<m.x,j=I.y>d.y&&b.y<m.y;return P&&j},isValid:function(){return!!(this.min&&this.max)},pad:function(l){var d=this.min,m=this.max,b=Math.abs(d.x-m.x)*l,I=Math.abs(d.y-m.y)*l;return Mt(Ne(d.x-b,d.y-I),Ne(m.x+b,m.y+I))},equals:function(l){return l?(l=Mt(l),this.min.equals(l.getTopLeft())&&this.max.equals(l.getBottomRight())):!1}};function Mt(l,d){return!l||l instanceof st?l:new st(l,d)}function ni(l,d){if(l)for(var m=d?[l,d]:l,b=0,I=m.length;b<I;b++)this.extend(m[b])}ni.prototype={extend:function(l){var d=this._southWest,m=this._northEast,b,I;if(l instanceof Vt)b=l,I=l;else if(l instanceof ni){if(b=l._southWest,I=l._northEast,!b||!I)return this}else return l?this.extend(ut(l)||ci(l)):this;return!d&&!m?(this._southWest=new Vt(b.lat,b.lng),this._northEast=new Vt(I.lat,I.lng)):(d.lat=Math.min(b.lat,d.lat),d.lng=Math.min(b.lng,d.lng),m.lat=Math.max(I.lat,m.lat),m.lng=Math.max(I.lng,m.lng)),this},pad:function(l){var d=this._southWest,m=this._northEast,b=Math.abs(d.lat-m.lat)*l,I=Math.abs(d.lng-m.lng)*l;return new ni(new Vt(d.lat-b,d.lng-I),new Vt(m.lat+b,m.lng+I))},getCenter:function(){return new Vt((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 Vt(this.getNorth(),this.getWest())},getSouthEast:function(){return new Vt(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 Vt||"lat"in l?l=ut(l):l=ci(l);var d=this._southWest,m=this._northEast,b,I;return l instanceof ni?(b=l.getSouthWest(),I=l.getNorthEast()):b=I=l,b.lat>=d.lat&&I.lat<=m.lat&&b.lng>=d.lng&&I.lng<=m.lng},intersects:function(l){l=ci(l);var d=this._southWest,m=this._northEast,b=l.getSouthWest(),I=l.getNorthEast(),P=I.lat>=d.lat&&b.lat<=m.lat,j=I.lng>=d.lng&&b.lng<=m.lng;return P&&j},overlaps:function(l){l=ci(l);var d=this._southWest,m=this._northEast,b=l.getSouthWest(),I=l.getNorthEast(),P=I.lat>d.lat&&b.lat<m.lat,j=I.lng>d.lng&&b.lng<m.lng;return P&&j},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(l,d){return l?(l=ci(l),this._southWest.equals(l.getSouthWest(),d)&&this._northEast.equals(l.getNorthEast(),d)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function ci(l,d){return l instanceof ni?l:new ni(l,d)}function Vt(l,d,m){if(isNaN(l)||isNaN(d))throw new Error("Invalid LatLng object: ("+l+", "+d+")");this.lat=+l,this.lng=+d,m!==void 0&&(this.alt=+m)}Vt.prototype={equals:function(l,d){if(!l)return!1;l=ut(l);var m=Math.max(Math.abs(this.lat-l.lat),Math.abs(this.lng-l.lng));return m<=(d===void 0?1e-9:d)},toString:function(l){return"LatLng("+p(this.lat,l)+", "+p(this.lng,l)+")"},distanceTo:function(l){return fi.distance(this,ut(l))},wrap:function(){return fi.wrapLatLng(this)},toBounds:function(l){var d=180*l/40075017,m=d/Math.cos(Math.PI/180*this.lat);return ci([this.lat-d,this.lng-m],[this.lat+d,this.lng+m])},clone:function(){return new Vt(this.lat,this.lng,this.alt)}};function ut(l,d,m){return l instanceof Vt?l:R(l)&&typeof l[0]!="object"?l.length===3?new Vt(l[0],l[1],l[2]):l.length===2?new Vt(l[0],l[1]):null:l==null?l:typeof l=="object"&&"lat"in l?new Vt(l.lat,"lng"in l?l.lng:l.lon,l.alt):d===void 0?null:new Vt(l,d,m)}var Ii={latLngToPoint:function(l,d){var m=this.projection.project(l),b=this.scale(d);return this.transformation._transform(m,b)},pointToLatLng:function(l,d){var m=this.scale(d),b=this.transformation.untransform(l,m);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,m=this.scale(l),b=this.transformation.transform(d.min,m),I=this.transformation.transform(d.max,m);return new st(b,I)},infinite:!1,wrapLatLng:function(l){var d=this.wrapLng?g(l.lng,this.wrapLng,!0):l.lng,m=this.wrapLat?g(l.lat,this.wrapLat,!0):l.lat,b=l.alt;return new Vt(m,d,b)},wrapLatLngBounds:function(l){var d=l.getCenter(),m=this.wrapLatLng(d),b=d.lat-m.lat,I=d.lng-m.lng;if(b===0&&I===0)return l;var P=l.getSouthWest(),j=l.getNorthEast(),ne=new Vt(P.lat-b,P.lng-I),de=new Vt(j.lat-b,j.lng-I);return new ni(ne,de)}},fi=n({},Ii,{wrapLng:[-180,180],R:6371e3,distance:function(l,d){var m=Math.PI/180,b=l.lat*m,I=d.lat*m,P=Math.sin((d.lat-l.lat)*m/2),j=Math.sin((d.lng-l.lng)*m/2),ne=P*P+Math.cos(b)*Math.cos(I)*j*j,de=2*Math.atan2(Math.sqrt(ne),Math.sqrt(1-ne));return this.R*de}}),tn=6378137,Fi={R:tn,MAX_LATITUDE:85.0511287798,project:function(l){var d=Math.PI/180,m=this.MAX_LATITUDE,b=Math.max(Math.min(m,l.lat),-m),I=Math.sin(b*d);return new qe(this.R*l.lng*d,this.R*Math.log((1+I)/(1-I))/2)},unproject:function(l){var d=180/Math.PI;return new Vt((2*Math.atan(Math.exp(l.y/this.R))-Math.PI/2)*d,l.x*d/this.R)},bounds:(function(){var l=tn*Math.PI;return new st([-l,-l],[l,l])})()};function Mn(l,d,m,b){if(R(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=m,this._d=b}Mn.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 qe((l.x/d-this._b)/this._a,(l.y/d-this._d)/this._c)}};function Yi(l,d,m,b){return new Mn(l,d,m,b)}var Ji=n({},fi,{code:"EPSG:3857",projection:Fi,transformation:(function(){var l=.5/(Math.PI*Fi.R);return Yi(l,.5,-l,.5)})()}),Fn=n({},Ji,{code:"EPSG:900913"});function Ai(l){return document.createElementNS("http://www.w3.org/2000/svg",l)}function Nn(l,d){var m="",b,I,P,j,ne,de;for(b=0,P=l.length;b<P;b++){for(ne=l[b],I=0,j=ne.length;I<j;I++)de=ne[I],m+=(I?"L":"M")+de.x+" "+de.y;m+=d?fe.svg?"z":"x":""}return m||"M0 0"}var nn=document.documentElement.style,Hi="ActiveXObject"in window,Rn=Hi&&!document.addEventListener,Un="msLaunchUri"in navigator&&!("documentMode"in document),Hn=bt("webkit"),Wn=bt("android"),dn=bt("android 2")||bt("android 3"),sn=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),ts=Wn&&bt("Google")&&sn<537&&!("AudioNode"in window),Ke=!!window.opera,_t=!Un&&bt("chrome"),ri=bt("gecko")&&!Hn&&!Ke&&!Hi,Di=!_t&&bt("safari"),wi=bt("phantom"),gn="OTransition"in nn,_n=navigator.platform.indexOf("Win")===0,Bn=Hi&&"transition"in nn,Cn="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!dn,Zn="MozPerspective"in nn,Xn=!window.L_DISABLE_3D&&(Bn||Cn||Zn)&&!gn&&!wi,xn=typeof orientation<"u"||bt("mobile"),Ue=xn&&Hn,Z=xn&&Cn,Fe=!window.PointerEvent&&window.MSPointerEvent,vt=!!(window.PointerEvent||Fe),Ct="ontouchstart"in window||!!window.TouchEvent,qt=!window.L_NO_TOUCH&&(Ct||vt),A=xn&&Ke,ie=xn&&ri,ve=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,Ze=(function(){var l=!1;try{var d=Object.defineProperty({},"passive",{get:function(){l=!0}});window.addEventListener("testPassiveEventSupport",f,d),window.removeEventListener("testPassiveEventSupport",f,d)}catch{}return l})(),gt=(function(){return!!document.createElement("canvas").getContext})(),q=!!(document.createElementNS&&Ai("svg").createSVGRect),re=!!q&&(function(){var l=document.createElement("div");return l.innerHTML="<svg/>",(l.firstChild&&l.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),ue=!q&&(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}})(),tt=navigator.platform.indexOf("Mac")===0,Ht=navigator.platform.indexOf("Linux")===0;function bt(l){return navigator.userAgent.toLowerCase().indexOf(l)>=0}var fe={ie:Hi,ielt9:Rn,edge:Un,webkit:Hn,android:Wn,android23:dn,androidStock:ts,opera:Ke,chrome:_t,gecko:ri,safari:Di,phantom:wi,opera12:gn,win:_n,ie3d:Bn,webkit3d:Cn,gecko3d:Zn,any3d:Xn,mobile:xn,mobileWebkit:Ue,mobileWebkit3d:Z,msPointer:Fe,pointer:vt,touch:qt,touchNative:Ct,mobileOpera:A,mobileGecko:ie,retina:ve,passiveEvents:Ze,canvas:gt,svg:q,vml:ue,inlineSvg:re,mac:tt,linux:Ht},dt=fe.msPointer?"MSPointerDown":"pointerdown",jt=fe.msPointer?"MSPointerMove":"pointermove",Bt=fe.msPointer?"MSPointerUp":"pointerup",oi=fe.msPointer?"MSPointerCancel":"pointercancel",ti={touchstart:dt,touchmove:jt,touchend:Bt,touchcancel:oi},J={touchstart:zi,touchmove:At,touchend:At,touchcancel:At},he={},Oe=!1;function it(l,d,m){return d==="touchstart"&&Wt(),J[d]?(m=J[d].bind(this,m),l.addEventListener(ti[d],m,!1),m):(console.warn("wrong event specified:",d),f)}function It(l,d,m){if(!ti[d]){console.warn("wrong event specified:",d);return}l.removeEventListener(ti[d],m,!1)}function Je(l){he[l.pointerId]=l}function Nt(l){he[l.pointerId]&&(he[l.pointerId]=l)}function ii(l){delete he[l.pointerId]}function Wt(){Oe||(document.addEventListener(dt,Je,!0),document.addEventListener(jt,Nt,!0),document.addEventListener(Bt,ii,!0),document.addEventListener(oi,ii,!0),Oe=!0)}function At(l,d){if(d.pointerType!==(d.MSPOINTER_TYPE_MOUSE||"mouse")){d.touches=[];for(var m in he)d.touches.push(he[m]);d.changedTouches=[d],l(d)}}function zi(l,d){d.MSPOINTER_TYPE_TOUCH&&d.pointerType===d.MSPOINTER_TYPE_TOUCH&&Ei(d),At(l,d)}function on(l){var d={},m,b;for(b in l)m=l[b],d[b]=m&&m.bind?m.bind(l):m;return l=d,d.type="dblclick",d.detail=2,d.isTrusted=!1,d._simulated=!0,d}var Oi=200;function si(l,d){l.addEventListener("dblclick",d);var m=0,b;function I(P){if(P.detail!==1){b=P.detail;return}if(!(P.pointerType==="mouse"||P.sourceCapabilities&&!P.sourceCapabilities.firesTouchEvents)){var j=io(P);if(!(j.some(function(de){return de instanceof HTMLLabelElement&&de.attributes.for})&&!j.some(function(de){return de instanceof HTMLInputElement||de instanceof HTMLSelectElement}))){var ne=Date.now();ne-m<=Oi?(b++,b===2&&d(on(P))):b=1,m=ne}}}return l.addEventListener("click",I),{dblclick:d,simDblclick:I}}function Vi(l,d){l.removeEventListener("dblclick",d.dblclick),l.removeEventListener("click",d.simDblclick)}var F=We(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),K=We(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),De=K==="webkitTransition"||K==="OTransition"?K+"End":"transitionend";function Re(l){return typeof l=="string"?document.getElementById(l):l}function $e(l,d){var m=l.style[d]||l.currentStyle&&l.currentStyle[d];if((!m||m==="auto")&&document.defaultView){var b=document.defaultView.getComputedStyle(l,null);m=b?b[d]:null}return m==="auto"?null:m}function Me(l,d,m){var b=document.createElement(l);return b.className=d||"",m&&m.appendChild(b),b}function Ge(l){var d=l.parentNode;d&&d.removeChild(l)}function Yt(l){for(;l.firstChild;)l.removeChild(l.firstChild)}function ge(l){var d=l.parentNode;d&&d.lastChild!==l&&d.appendChild(l)}function xe(l){var d=l.parentNode;d&&d.firstChild!==l&&d.insertBefore(l,d.firstChild)}function ft(l,d){if(l.classList!==void 0)return l.classList.contains(d);var m=V(l);return m.length>0&&new RegExp("(^|\\s)"+d+"(\\s|$)").test(m)}function Ee(l,d){if(l.classList!==void 0)for(var m=_(d),b=0,I=m.length;b<I;b++)l.classList.add(m[b]);else if(!ft(l,d)){var P=V(l);Kt(l,(P?P+" ":"")+d)}}function at(l,d){l.classList!==void 0?l.classList.remove(d):Kt(l,v((" "+V(l)+" ").replace(" "+d+" "," ")))}function Kt(l,d){l.className.baseVal===void 0?l.className=d:l.className.baseVal=d}function V(l){return l.correspondingElement&&(l=l.correspondingElement),l.className.baseVal===void 0?l.className:l.className.baseVal}function Y(l,d){"opacity"in l.style?l.style.opacity=d:"filter"in l.style&&Pe(l,d)}function Pe(l,d){var m=!1,b="DXImageTransform.Microsoft.Alpha";try{m=l.filters.item(b)}catch{if(d===1)return}d=Math.round(d*100),m?(m.Enabled=d!==100,m.Opacity=d):l.style.filter+=" progid:"+b+"(opacity="+d+")"}function We(l){for(var d=document.documentElement.style,m=0;m<l.length;m++)if(l[m]in d)return l[m];return!1}function Ie(l,d,m){var b=d||new qe(0,0);l.style[F]=(fe.ie3d?"translate("+b.x+"px,"+b.y+"px)":"translate3d("+b.x+"px,"+b.y+"px,0)")+(m?" scale("+m+")":"")}function ke(l,d){l._leaflet_pos=d,fe.any3d?Ie(l,d):(l.style.left=d.x+"px",l.style.top=d.y+"px")}function xt(l){return l._leaflet_pos||new qe(0,0)}var Qe,Te,ht;if("onselectstart"in document)Qe=function(){et(window,"selectstart",Ei)},Te=function(){Gt(window,"selectstart",Ei)};else{var Ae=We(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);Qe=function(){if(Ae){var l=document.documentElement.style;ht=l[Ae],l[Ae]="none"}},Te=function(){Ae&&(document.documentElement.style[Ae]=ht,ht=void 0)}}function _e(){et(window,"dragstart",Ei)}function we(){Gt(window,"dragstart",Ei)}var ye,pe;function nt(l){for(;l.tabIndex===-1;)l=l.parentNode;l.style&&(ce(),ye=l,pe=l.style.outlineStyle,l.style.outlineStyle="none",et(window,"keydown",ce))}function ce(){ye&&(ye.style.outlineStyle=pe,ye=void 0,pe=void 0,Gt(window,"keydown",ce))}function He(l){do l=l.parentNode;while((!l.offsetWidth||!l.offsetHeight)&&l!==document.body);return l}function rt(l){var d=l.getBoundingClientRect();return{x:d.width/l.offsetWidth||1,y:d.height/l.offsetHeight||1,boundingClientRect:d}}var Ot={__proto__:null,TRANSFORM:F,TRANSITION:K,TRANSITION_END:De,get:Re,getStyle:$e,create:Me,remove:Ge,empty:Yt,toFront:ge,toBack:xe,hasClass:ft,addClass:Ee,removeClass:at,setClass:Kt,getClass:V,setOpacity:Y,testProp:We,setTransform:Ie,setPosition:ke,getPosition:xt,get disableTextSelection(){return Qe},get enableTextSelection(){return Te},disableImageDrag:_e,enableImageDrag:we,preventOutline:nt,restoreOutline:ce,getSizedParentNode:He,getScale:rt};function et(l,d,m,b){if(d&&typeof d=="object")for(var I in d)kn(l,I,d[I],m);else{d=_(d);for(var P=0,j=d.length;P<j;P++)kn(l,d[P],m,b)}return this}var Ut="_leaflet_events";function Gt(l,d,m,b){if(arguments.length===1)Ln(l),delete l[Ut];else if(d&&typeof d=="object")for(var I in d)qn(l,I,d[I],m);else if(d=_(d),arguments.length===2)Ln(l,function(ne){return z(d,ne)!==-1});else for(var P=0,j=d.length;P<j;P++)qn(l,d[P],m,b);return this}function Ln(l,d){for(var m in l[Ut]){var b=m.split(/\d/)[0];(!d||d(b))&&qn(l,b,null,null,m)}}var Wi={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function kn(l,d,m,b){var I=d+c(m)+(b?"_"+c(b):"");if(l[Ut]&&l[Ut][I])return this;var P=function(ne){return m.call(b||l,ne||window.event)},j=P;!fe.touchNative&&fe.pointer&&d.indexOf("touch")===0?P=it(l,d,P):fe.touch&&d==="dblclick"?P=si(l,P):"addEventListener"in l?d==="touchstart"||d==="touchmove"||d==="wheel"||d==="mousewheel"?l.addEventListener(Wi[d]||d,P,fe.passiveEvents?{passive:!1}:!1):d==="mouseenter"||d==="mouseleave"?(P=function(ne){ne=ne||window.event,Yn(l,ne)&&j(ne)},l.addEventListener(Wi[d],P,!1)):l.addEventListener(d,j,!1):l.attachEvent("on"+d,P),l[Ut]=l[Ut]||{},l[Ut][I]=P}function qn(l,d,m,b,I){I=I||d+c(m)+(b?"_"+c(b):"");var P=l[Ut]&&l[Ut][I];if(!P)return this;!fe.touchNative&&fe.pointer&&d.indexOf("touch")===0?It(l,d,P):fe.touch&&d==="dblclick"?Vi(l,P):"removeEventListener"in l?l.removeEventListener(Wi[d]||d,P,!1):l.detachEvent("on"+d,P),l[Ut][I]=null}function pi(l){return l.stopPropagation?l.stopPropagation():l.originalEvent?l.originalEvent._stopped=!0:l.cancelBubble=!0,this}function $t(l){return kn(l,"wheel",pi),this}function qi(l){return et(l,"mousedown touchstart dblclick contextmenu",pi),l._leaflet_disable_click=!0,this}function Ei(l){return l.preventDefault?l.preventDefault():l.returnValue=!1,this}function us(l){return Ei(l),pi(l),this}function io(l){if(l.composedPath)return l.composedPath();for(var d=[],m=l.target;m;)d.push(m),m=m.parentNode;return d}function sr(l,d){if(!d)return new qe(l.clientX,l.clientY);var m=rt(d),b=m.boundingClientRect;return new qe((l.clientX-b.left)/m.x-d.clientLeft,(l.clientY-b.top)/m.y-d.clientTop)}var Nr=fe.linux&&fe.chrome?window.devicePixelRatio:fe.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function or(l){return fe.edge?l.wheelDeltaY/2:l.deltaY&&l.deltaMode===0?-l.deltaY/Nr: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 Yn(l,d){var m=d.relatedTarget;if(!m)return!0;try{for(;m&&m!==l;)m=m.parentNode}catch{return!1}return m!==l}var ja={__proto__:null,on:et,off:Gt,stopPropagation:pi,disableScrollPropagation:$t,disableClickPropagation:qi,preventDefault:Ei,stop:us,getPropagationPath:io,getMousePosition:sr,getWheelDelta:or,isExternalTarget:Yn,addListener:et,removeListener:Gt},da=ei.extend({run:function(l,d,m,b){this.stop(),this._el=l,this._inProgress=!0,this._duration=m||.25,this._easeOutPower=1/Math.max(b||.5,.2),this._startPos=xt(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=Ce(this._animate,this),this._step()},_step:function(l){var d=+new Date-this._startTime,m=this._duration*1e3;d<m?this._runFrame(this._easeOut(d/m),l):(this._runFrame(1),this._complete())},_runFrame:function(l,d){var m=this._startPos.add(this._offset.multiplyBy(l));d&&m._round(),ke(this._el,m),this.fire("step")},_complete:function(){mt(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(l){return 1-Math.pow(1-l,this._easeOutPower)}}),Bi=ei.extend({options:{crs:Ji,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=w(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(ut(d.center),d.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=K&&fe.any3d&&!fe.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),et(this._proxy,De,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(l,d,m){if(d=d===void 0?this._zoom:this._limitZoom(d),l=this._limitCenter(ut(l),d,this.options.maxBounds),m=m||{},this._stop(),this._loaded&&!m.reset&&m!==!0){m.animate!==void 0&&(m.zoom=n({animate:m.animate},m.zoom),m.pan=n({animate:m.animate,duration:m.duration},m.pan));var b=this._zoom!==d?this._tryAnimatedZoom&&this._tryAnimatedZoom(l,d,m.zoom):this._tryAnimatedPan(l,m.pan);if(b)return clearTimeout(this._sizeTimer),this}return this._resetView(l,d,m.pan&&m.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||(fe.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+l,d)},zoomOut:function(l,d){return l=l||(fe.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-l,d)},setZoomAround:function(l,d,m){var b=this.getZoomScale(d),I=this.getSize().divideBy(2),P=l instanceof qe?l:this.latLngToContainerPoint(l),j=P.subtract(I).multiplyBy(1-1/b),ne=this.containerPointToLatLng(I.add(j));return this.setView(ne,d,{zoom:m})},_getBoundsCenterZoom:function(l,d){d=d||{},l=l.getBounds?l.getBounds():ci(l);var m=Ne(d.paddingTopLeft||d.padding||[0,0]),b=Ne(d.paddingBottomRight||d.padding||[0,0]),I=this.getBoundsZoom(l,!1,m.add(b));if(I=typeof d.maxZoom=="number"?Math.min(d.maxZoom,I):I,I===1/0)return{center:l.getCenter(),zoom:I};var P=b.subtract(m).divideBy(2),j=this.project(l.getSouthWest(),I),ne=this.project(l.getNorthEast(),I),de=this.unproject(j.add(ne).divideBy(2).add(P),I);return{center:de,zoom:I}},fitBounds:function(l,d){if(l=ci(l),!l.isValid())throw new Error("Bounds are not valid.");var m=this._getBoundsCenterZoom(l,d);return this.setView(m.center,m.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=Ne(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 da,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),d.noMoveStart||this.fire("movestart"),d.animate!==!1){Ee(this._mapPane,"leaflet-pan-anim");var m=this._getMapPanePos().subtract(l).round();this._panAnim.run(this._mapPane,m,d.duration||.25,d.easeLinearity)}else this._rawPanBy(l),this.fire("move").fire("moveend");return this},flyTo:function(l,d,m){if(m=m||{},m.animate===!1||!fe.any3d)return this.setView(l,d,m);this._stop();var b=this.project(this.getCenter()),I=this.project(l),P=this.getSize(),j=this._zoom;l=ut(l),d=d===void 0?j:d;var ne=Math.max(P.x,P.y),de=ne*this.getZoomScale(j,d),ze=I.distanceTo(b)||1,Ft=1.42,yi=Ft*Ft;function en(Es){var Mm=Es?-1:1,sA=Es?de:ne,oA=de*de-ne*ne+Mm*yi*yi*ze*ze,rA=2*sA*yi*ze,nw=oA/rA,VL=Math.sqrt(nw*nw+1)-nw,aA=VL<1e-9?-18:Math.log(VL);return aA}function mo(Es){return(Math.exp(Es)-Math.exp(-Es))/2}function Ws(Es){return(Math.exp(Es)+Math.exp(-Es))/2}function ar(Es){return mo(Es)/Ws(Es)}var Do=en(0);function Vh(Es){return ne*(Ws(Do)/Ws(Do+Ft*Es))}function eA(Es){return ne*(Ws(Do)*ar(Do+Ft*Es)-mo(Do))/yi}function tA(Es){return 1-Math.pow(1-Es,1.5)}var iA=Date.now(),BL=(en(1)-Do)/Ft,nA=m.duration?1e3*m.duration:1e3*BL*.8;function zL(){var Es=(Date.now()-iA)/nA,Mm=tA(Es)*BL;Es<=1?(this._flyToFrame=Ce(zL,this),this._move(this.unproject(b.add(I.subtract(b).multiplyBy(eA(Mm)/ze)),j),this.getScaleZoom(ne/Vh(Mm),j),{flyTo:!0})):this._move(l,d)._moveEnd(!0)}return this._moveStart(!0,m.noMoveStart),zL.call(this),this},flyToBounds:function(l,d){var m=this._getBoundsCenterZoom(l,d);return this.flyTo(m.center,m.zoom,d)},setMaxBounds:function(l){return l=ci(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 m=this.getCenter(),b=this._limitCenter(m,this._zoom,ci(l));return m.equals(b)||this.panTo(b,d),this._enforcingBounds=!1,this},panInside:function(l,d){d=d||{};var m=Ne(d.paddingTopLeft||d.padding||[0,0]),b=Ne(d.paddingBottomRight||d.padding||[0,0]),I=this.project(this.getCenter()),P=this.project(l),j=this.getPixelBounds(),ne=Mt([j.min.add(m),j.max.subtract(b)]),de=ne.getSize();if(!ne.contains(P)){this._enforcingBounds=!0;var ze=P.subtract(ne.getCenter()),Ft=ne.extend(P).getSize().subtract(de);I.x+=ze.x<0?-Ft.x:Ft.x,I.y+=ze.y<0?-Ft.y:Ft.y,this.panTo(this.unproject(I),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 m=this.getSize(),b=d.divideBy(2).round(),I=m.divideBy(2).round(),P=b.subtract(I);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:m}))},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),m=r(this._handleGeolocationError,this);return l.watch?this._locationWatchId=navigator.geolocation.watchPosition(d,m,l):navigator.geolocation.getCurrentPosition(d,m,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,m=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: "+m+"."})}},_handleGeolocationResponse:function(l){if(this._container._leaflet_id){var d=l.coords.latitude,m=l.coords.longitude,b=new Vt(d,m),I=b.toBounds(l.coords.accuracy*2),P=this._locateOptions;if(P.setView){var j=this.getBoundsZoom(I);this.setView(b,P.maxZoom?Math.min(j,P.maxZoom):j)}var ne={latlng:b,bounds:I,timestamp:l.timestamp};for(var de in l.coords)typeof l.coords[de]=="number"&&(ne[de]=l.coords[de]);this.fire("locationfound",ne)}},addHandler:function(l,d){if(!d)return this;var m=this[l]=new d(this);return this._handlers.push(m),this.options[l]&&m.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(),Ge(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(mt(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)Ge(this._panes[l]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(l,d){var m="leaflet-pane"+(l?" leaflet-"+l.replace("Pane","")+"-pane":""),b=Me("div",m,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()),m=this.unproject(l.getTopRight());return new ni(d,m)},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,m){l=ci(l),m=Ne(m||[0,0]);var b=this.getZoom()||0,I=this.getMinZoom(),P=this.getMaxZoom(),j=l.getNorthWest(),ne=l.getSouthEast(),de=this.getSize().subtract(m),ze=Mt(this.project(ne,b),this.project(j,b)).getSize(),Ft=fe.any3d?this.options.zoomSnap:1,yi=de.x/ze.x,en=de.y/ze.y,mo=d?Math.max(yi,en):Math.min(yi,en);return b=this.getScaleZoom(mo,b),Ft&&(b=Math.round(b/(Ft/100))*(Ft/100),b=d?Math.ceil(b/Ft)*Ft:Math.floor(b/Ft)*Ft),Math.max(I,Math.min(P,b))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new qe(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(l,d){var m=this._getTopLeftPoint(l,d);return new st(m,m.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 m=this.options.crs;return d=d===void 0?this._zoom:d,m.scale(l)/m.scale(d)},getScaleZoom:function(l,d){var m=this.options.crs;d=d===void 0?this._zoom:d;var b=m.zoom(l*m.scale(d));return isNaN(b)?1/0:b},project:function(l,d){return d=d===void 0?this._zoom:d,this.options.crs.latLngToPoint(ut(l),d)},unproject:function(l,d){return d=d===void 0?this._zoom:d,this.options.crs.pointToLatLng(Ne(l),d)},layerPointToLatLng:function(l){var d=Ne(l).add(this.getPixelOrigin());return this.unproject(d)},latLngToLayerPoint:function(l){var d=this.project(ut(l))._round();return d._subtract(this.getPixelOrigin())},wrapLatLng:function(l){return this.options.crs.wrapLatLng(ut(l))},wrapLatLngBounds:function(l){return this.options.crs.wrapLatLngBounds(ci(l))},distance:function(l,d){return this.options.crs.distance(ut(l),ut(d))},containerPointToLayerPoint:function(l){return Ne(l).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(l){return Ne(l).add(this._getMapPanePos())},containerPointToLatLng:function(l){var d=this.containerPointToLayerPoint(Ne(l));return this.layerPointToLatLng(d)},latLngToContainerPoint:function(l){return this.layerPointToContainerPoint(this.latLngToLayerPoint(ut(l)))},mouseEventToContainerPoint:function(l){return sr(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=Re(l);if(d){if(d._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");et(d,"scroll",this._onScroll,this),this._containerId=c(d)},_initLayout:function(){var l=this._container;this._fadeAnimated=this.options.fadeAnimation&&fe.any3d,Ee(l,"leaflet-container"+(fe.touch?" leaflet-touch":"")+(fe.retina?" leaflet-retina":"")+(fe.ielt9?" leaflet-oldie":"")+(fe.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var d=$e(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),ke(this._mapPane,new qe(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(Ee(l.markerPane,"leaflet-zoom-hide"),Ee(l.shadowPane,"leaflet-zoom-hide"))},_resetView:function(l,d,m){ke(this._mapPane,new qe(0,0));var b=!this._loaded;this._loaded=!0,d=this._limitZoom(d),this.fire("viewprereset");var I=this._zoom!==d;this._moveStart(I,m)._move(l,d)._moveEnd(I),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,m,b){d===void 0&&(d=this._zoom);var I=this._zoom!==d;return this._zoom=d,this._lastCenter=l,this._pixelOrigin=this._getNewPixelOrigin(l),b?m&&m.pinch&&this.fire("zoom",m):((I||m&&m.pinch)&&this.fire("zoom",m),this.fire("move",m)),this},_moveEnd:function(l){return l&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return mt(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(l){ke(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?Gt:et;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),fe.any3d&&this.options.transform3DLimit&&(l?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){mt(this._resizeRequest),this._resizeRequest=Ce(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 m=[],b,I=d==="mouseout"||d==="mouseover",P=l.target||l.srcElement,j=!1;P;){if(b=this._targets[c(P)],b&&(d==="click"||d==="preclick")&&this._draggableMoved(b)){j=!0;break}if(b&&b.listens(d,!0)&&(I&&!Yn(P,l)||(m.push(b),I))||P===this._container)break;P=P.parentNode}return!m.length&&!j&&!I&&this.listens(d,!0)&&(m=[this]),m},_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 m=l.type;m==="mousedown"&&nt(d),this._fireDOMEvent(l,m)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(l,d,m){if(l.type==="click"){var b=n({},l);b.type="preclick",this._fireDOMEvent(b,b.type,m)}var I=this._findEventTargets(l,d);if(m){for(var P=[],j=0;j<m.length;j++)m[j].listens(d,!0)&&P.push(m[j]);I=P.concat(I)}if(I.length){d==="contextmenu"&&Ei(l);var ne=I[0],de={originalEvent:l};if(l.type!=="keypress"&&l.type!=="keydown"&&l.type!=="keyup"){var ze=ne.getLatLng&&(!ne._radius||ne._radius<=10);de.containerPoint=ze?this.latLngToContainerPoint(ne.getLatLng()):this.mouseEventToContainerPoint(l),de.layerPoint=this.containerPointToLayerPoint(de.containerPoint),de.latlng=ze?ne.getLatLng():this.layerPointToLatLng(de.layerPoint)}for(j=0;j<I.length;j++)if(I[j].fire(d,de,!0),de.originalEvent._stopped||I[j].options.bubblingMouseEvents===!1&&z(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 xt(this._mapPane)||new qe(0,0)},_moved:function(){var l=this._getMapPanePos();return l&&!l.equals([0,0])},_getTopLeftPoint:function(l,d){var m=l&&d!==void 0?this._getNewPixelOrigin(l,d):this.getPixelOrigin();return m.subtract(this._getMapPanePos())},_getNewPixelOrigin:function(l,d){var m=this.getSize()._divideBy(2);return this.project(l,d)._subtract(m)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(l,d,m){var b=this._getNewPixelOrigin(m,d);return this.project(l,d)._subtract(b)},_latLngBoundsToNewLayerBounds:function(l,d,m){var b=this._getNewPixelOrigin(m,d);return Mt([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,m){if(!m)return l;var b=this.project(l,d),I=this.getSize().divideBy(2),P=new st(b.subtract(I),b.add(I)),j=this._getBoundsOffset(P,m,d);return Math.abs(j.x)<=1&&Math.abs(j.y)<=1?l:this.unproject(b.add(j),d)},_limitOffset:function(l,d){if(!d)return l;var m=this.getPixelBounds(),b=new st(m.min.add(l),m.max.add(l));return l.add(this._getBoundsOffset(b,d))},_getBoundsOffset:function(l,d,m){var b=Mt(this.project(d.getNorthEast(),m),this.project(d.getSouthWest(),m)),I=b.min.subtract(l.min),P=b.max.subtract(l.max),j=this._rebound(I.x,-P.x),ne=this._rebound(I.y,-P.y);return new qe(j,ne)},_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(),m=this.getMaxZoom(),b=fe.any3d?this.options.zoomSnap:1;return b&&(l=Math.round(l/b)*b),Math.max(d,Math.min(m,l))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){at(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(l,d){var m=this._getCenterOffset(l)._trunc();return(d&&d.animate)!==!0&&!this.getSize().contains(m)?!1:(this.panBy(m,d),!0)},_createAnimProxy:function(){var l=this._proxy=Me("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(l),this.on("zoomanim",function(d){var m=F,b=this._proxy.style[m];Ie(this._proxy,this.project(d.center,d.zoom),this.getZoomScale(d.zoom,1)),b===this._proxy.style[m]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){Ge(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var l=this.getCenter(),d=this.getZoom();Ie(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,m){if(this._animatingZoom)return!0;if(m=m||{},!this._zoomAnimated||m.animate===!1||this._nothingToAnimate()||Math.abs(d-this._zoom)>this.options.zoomAnimationThreshold)return!1;var b=this.getZoomScale(d),I=this._getCenterOffset(l)._divideBy(1-1/b);return m.animate!==!0&&!this.getSize().contains(I)?!1:(Ce(function(){this._moveStart(!0,m.noMoveStart||!1)._animateZoom(l,d,!0)},this),!0)},_animateZoom:function(l,d,m,b){this._mapPane&&(m&&(this._animatingZoom=!0,this._animateToCenter=l,this._animateToZoom=d,Ee(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&&at(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function Hc(l,d){return new Bi(l,d)}var Fs=ct.extend({options:{position:"topright"},initialize:function(l){w(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),m=this.getPosition(),b=l._controlCorners[m];return Ee(d,"leaflet-control"),m.indexOf("bottom")!==-1?b.insertBefore(d,b.firstChild):b.appendChild(d),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(Ge(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()}}),Ss=function(l){return new Fs(l)};Bi.include({addControl:function(l){return l.addTo(this),this},removeControl:function(l){return l.remove(),this},_initControlPos:function(){var l=this._controlCorners={},d="leaflet-",m=this._controlContainer=Me("div",d+"control-container",this._container);function b(I,P){var j=d+I+" "+d+P;l[I+P]=Me("div",j,m)}b("top","left"),b("top","right"),b("bottom","left"),b("bottom","right")},_clearControlPos:function(){for(var l in this._controlCorners)Ge(this._controlCorners[l]);Ge(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var Hs=Fs.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(l,d,m,b){return m<b?-1:b<m?1:0}},initialize:function(l,d,m){w(this,m),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 Fs.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(){Ee(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?(Ee(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=l+"px"):at(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return at(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var l="leaflet-control-layers",d=this._container=Me("div",l),m=this.options.collapsed;d.setAttribute("aria-haspopup",!0),qi(d),$t(d);var b=this._section=Me("section",l+"-list");m&&(this._map.on("click",this.collapse,this),et(d,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var I=this._layersLink=Me("a",l+"-toggle",d);I.href="#",I.title="Layers",I.setAttribute("role","button"),et(I,{keydown:function(P){P.keyCode===13&&this._expandSafely()},click:function(P){Ei(P),this._expandSafely()}},this),m||this.expand(),this._baseLayersList=Me("div",l+"-base",b),this._separator=Me("div",l+"-separator",b),this._overlaysList=Me("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,m){this._map&&l.on("add remove",this._onLayerChange,this),this._layers.push({layer:l,name:d,overlay:m}),this.options.sortLayers&&this._layers.sort(r(function(b,I){return this.options.sortFunction(b.layer,I.layer,b.name,I.name)},this)),this.options.autoZIndex&&l.setZIndex&&(this._lastZIndex++,l.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;Yt(this._baseLayersList),Yt(this._overlaysList),this._layerControlInputs=[];var l,d,m,b,I=0;for(m=0;m<this._layers.length;m++)b=this._layers[m],this._addItem(b),d=d||b.overlay,l=l||!b.overlay,I+=b.overlay?0:1;return this.options.hideSingleBase&&(l=l&&I>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)),m=d.overlay?l.type==="add"?"overlayadd":"overlayremove":l.type==="add"?"baselayerchange":null;m&&this._map.fire(m,d)},_createRadioElement:function(l,d){var m='<input type="radio" class="leaflet-control-layers-selector" name="'+l+'"'+(d?' checked="checked"':"")+"/>",b=document.createElement("div");return b.innerHTML=m,b.firstChild},_addItem:function(l){var d=document.createElement("label"),m=this._map.hasLayer(l.layer),b;l.overlay?(b=document.createElement("input"),b.type="checkbox",b.className="leaflet-control-layers-selector",b.defaultChecked=m):b=this._createRadioElement("leaflet-base-layers_"+c(this),m),this._layerControlInputs.push(b),b.layerId=c(l.layer),et(b,"click",this._onInputClick,this);var I=document.createElement("span");I.innerHTML=" "+l.name;var P=document.createElement("span");d.appendChild(P),P.appendChild(b),P.appendChild(I);var j=l.overlay?this._overlaysList:this._baseLayersList;return j.appendChild(d),this._checkDisabledLayers(),d},_onInputClick:function(){if(!this._preventClick){var l=this._layerControlInputs,d,m,b=[],I=[];this._handlingClick=!0;for(var P=l.length-1;P>=0;P--)d=l[P],m=this._getLayer(d.layerId).layer,d.checked?b.push(m):d.checked||I.push(m);for(P=0;P<I.length;P++)this._map.hasLayer(I[P])&&this._map.removeLayer(I[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,m,b=this._map.getZoom(),I=l.length-1;I>=0;I--)d=l[I],m=this._getLayer(d.layerId).layer,d.disabled=m.options.minZoom!==void 0&&b<m.options.minZoom||m.options.maxZoom!==void 0&&b>m.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var l=this._section;this._preventClick=!0,et(l,"click",Ei),this.expand();var d=this;setTimeout(function(){Gt(l,"click",Ei),d._preventClick=!1})}}),Rr=function(l,d,m){return new Hs(l,d,m)},Ua=Fs.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",m=Me("div",d+" leaflet-bar"),b=this.options;return this._zoomInButton=this._createButton(b.zoomInText,b.zoomInTitle,d+"-in",m,this._zoomIn),this._zoomOutButton=this._createButton(b.zoomOutText,b.zoomOutTitle,d+"-out",m,this._zoomOut),this._updateDisabled(),l.on("zoomend zoomlevelschange",this._updateDisabled,this),m},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,m,b,I){var P=Me("a",m,b);return P.innerHTML=l,P.href="#",P.title=d,P.setAttribute("role","button"),P.setAttribute("aria-label",d),qi(P),et(P,"click",us),et(P,"click",I,this),et(P,"click",this._refocusOnMap,this),P},_updateDisabled:function(){var l=this._map,d="leaflet-disabled";at(this._zoomInButton,d),at(this._zoomOutButton,d),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||l._zoom===l.getMinZoom())&&(Ee(this._zoomOutButton,d),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||l._zoom===l.getMaxZoom())&&(Ee(this._zoomInButton,d),this._zoomInButton.setAttribute("aria-disabled","true"))}});Bi.mergeOptions({zoomControl:!0}),Bi.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Ua,this.addControl(this.zoomControl))});var Tl=function(l){return new Ua(l)},$a=Fs.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(l){var d="leaflet-control-scale",m=Me("div",d),b=this.options;return this._addScales(b,d+"-line",m),l.on(b.updateWhenIdle?"moveend":"move",this._update,this),l.whenReady(this._update,this),m},onRemove:function(l){l.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(l,d,m){l.metric&&(this._mScale=Me("div",d,m)),l.imperial&&(this._iScale=Me("div",d,m))},_update:function(){var l=this._map,d=l.getSize().y/2,m=l.distance(l.containerPointToLatLng([0,d]),l.containerPointToLatLng([this.options.maxWidth,d]));this._updateScales(m)},_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),m=d<1e3?d+" m":d/1e3+" km";this._updateScale(this._mScale,m,d/l)},_updateImperial:function(l){var d=l*3.2808399,m,b,I;d>5280?(m=d/5280,b=this._getRoundNum(m),this._updateScale(this._iScale,b+" mi",b/m)):(I=this._getRoundNum(d),this._updateScale(this._iScale,I+" ft",I/d))},_updateScale:function(l,d,m){l.style.width=Math.round(this.options.maxWidth*m)+"px",l.innerHTML=d},_getRoundNum:function(l){var d=Math.pow(10,(Math.floor(l)+"").length-1),m=l/d;return m=m>=10?10:m>=5?5:m>=3?3:m>=2?2:1,d*m}}),Uo=function(l){return new $a(l)},Ar='<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>',Io=Fs.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(fe.inlineSvg?Ar+" ":"")+"Leaflet</a>"},initialize:function(l){w(this,l),this._attributions={}},onAdd:function(l){l.attributionControl=this,this._container=Me("div","leaflet-control-attribution"),qi(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 m=[];this.options.prefix&&m.push(this.options.prefix),l.length&&m.push(l.join(", ")),this._container.innerHTML=m.join(' <span aria-hidden="true">|</span> ')}}});Bi.mergeOptions({attributionControl:!0}),Bi.addInitHook(function(){this.options.attributionControl&&new Io().addTo(this)});var Zy=function(l){return new Io(l)};Fs.Layers=Hs,Fs.Zoom=Ua,Fs.Scale=$a,Fs.Attribution=Io,Ss.layers=Rr,Ss.zoom=Tl,Ss.scale=Uo,Ss.attribution=Zy;var $o=ct.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}});$o.addTo=function(l,d){return l.addHandler(d,this),this};var Xy={Events:zt},wm=fe.touch?"touchstart mousedown":"mousedown",Or=ei.extend({options:{clickTolerance:3},initialize:function(l,d,m,b){w(this,b),this._element=l,this._dragStartTarget=d||l,this._preventOutline=m},enable:function(){this._enabled||(et(this._dragStartTarget,wm,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Or._dragging===this&&this.finishDrag(!0),Gt(this._dragStartTarget,wm,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(l){if(this._enabled&&(this._moved=!1,!ft(this._element,"leaflet-zoom-anim"))){if(l.touches&&l.touches.length!==1){Or._dragging===this&&this.finishDrag();return}if(!(Or._dragging||l.shiftKey||l.which!==1&&l.button!==1&&!l.touches)&&(Or._dragging=this,this._preventOutline&&nt(this._element),_e(),Qe(),!this._moving)){this.fire("down");var d=l.touches?l.touches[0]:l,m=He(this._element);this._startPoint=new qe(d.clientX,d.clientY),this._startPos=xt(this._element),this._parentScale=rt(m);var b=l.type==="mousedown";et(document,b?"mousemove":"touchmove",this._onMove,this),et(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,m=new qe(d.clientX,d.clientY)._subtract(this._startPoint);!m.x&&!m.y||Math.abs(m.x)+Math.abs(m.y)<this.options.clickTolerance||(m.x/=this._parentScale.x,m.y/=this._parentScale.y,Ei(l),this._moved||(this.fire("dragstart"),this._moved=!0,Ee(document.body,"leaflet-dragging"),this._lastTarget=l.target||l.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),Ee(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(m),this._moving=!0,this._lastEvent=l,this._updatePosition())}},_updatePosition:function(){var l={originalEvent:this._lastEvent};this.fire("predrag",l),ke(this._element,this._newPos),this.fire("drag",l)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(l){at(document.body,"leaflet-dragging"),this._lastTarget&&(at(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),Gt(document,"mousemove touchmove",this._onMove,this),Gt(document,"mouseup touchend touchcancel",this._onUp,this),we(),Te();var d=this._moved&&this._moving;this._moving=!1,Or._dragging=!1,d&&this.fire("dragend",{noInertia:l,distance:this._newPos.distanceTo(this._startPos)})}});function Sm(l,d,m){var b,I=[1,4,2,8],P,j,ne,de,ze,Ft,yi,en;for(P=0,Ft=l.length;P<Ft;P++)l[P]._code=Fr(l[P],d);for(ne=0;ne<4;ne++){for(yi=I[ne],b=[],P=0,Ft=l.length,j=Ft-1;P<Ft;j=P++)de=l[P],ze=l[j],de._code&yi?ze._code&yi||(en=Fh(ze,de,yi,d,m),en._code=Fr(en,d),b.push(en)):(ze._code&yi&&(en=Fh(ze,de,yi,d,m),en._code=Fr(en,d),b.push(en)),b.push(de));l=b}return l}function Ah(l,d){var m,b,I,P,j,ne,de,ze,Ft;if(!l||l.length===0)throw new Error("latlngs not passed");po(l)||(console.warn("latlngs are not flat! Only the first ring will be used"),l=l[0]);var yi=ut([0,0]),en=ci(l),mo=en.getNorthWest().distanceTo(en.getSouthWest())*en.getNorthEast().distanceTo(en.getNorthWest());mo<1700&&(yi=Oh(l));var Ws=l.length,ar=[];for(m=0;m<Ws;m++){var Do=ut(l[m]);ar.push(d.project(ut([Do.lat-yi.lat,Do.lng-yi.lng])))}for(ne=de=ze=0,m=0,b=Ws-1;m<Ws;b=m++)I=ar[m],P=ar[b],j=I.y*P.x-P.y*I.x,de+=(I.x+P.x)*j,ze+=(I.y+P.y)*j,ne+=j*3;ne===0?Ft=ar[0]:Ft=[de/ne,ze/ne];var Vh=d.unproject(Ne(Ft));return ut([Vh.lat+yi.lat,Vh.lng+yi.lng])}function Oh(l){for(var d=0,m=0,b=0,I=0;I<l.length;I++){var P=ut(l[I]);d+=P.lat,m+=P.lng,b++}return ut([d/b,m/b])}var Yy={__proto__:null,clipPolygon:Sm,polygonCenter:Ah,centroid:Oh};function Ug(l,d){if(!d||!l.length)return l.slice();var m=d*d;return l=Lm(l,m),l=xm(l,m),l}function $g(l,d,m){return Math.sqrt(Ml(l,d,m,!0))}function Cm(l,d,m){return Ml(l,d,m)}function xm(l,d){var m=l.length,b=typeof Uint8Array<"u"?Uint8Array:Array,I=new b(m);I[0]=I[m-1]=1,qg(l,I,d,0,m-1);var P,j=[];for(P=0;P<m;P++)I[P]&&j.push(l[P]);return j}function qg(l,d,m,b,I){var P=0,j,ne,de;for(ne=b+1;ne<=I-1;ne++)de=Ml(l[ne],l[b],l[I],!0),de>P&&(j=ne,P=de);P>m&&(d[j]=1,qg(l,d,m,b,j),qg(l,d,m,j,I))}function Lm(l,d){for(var m=[l[0]],b=1,I=0,P=l.length;b<P;b++)Dm(l[b],l[I])>d&&(m.push(l[b]),I=b);return I<P-1&&m.push(l[P-1]),m}var km;function Im(l,d,m,b,I){var P=b?km:Fr(l,m),j=Fr(d,m),ne,de,ze;for(km=j;;){if(!(P|j))return[l,d];if(P&j)return!1;ne=P||j,de=Fh(l,d,ne,m,I),ze=Fr(de,m),ne===P?(l=de,P=ze):(d=de,j=ze)}}function Fh(l,d,m,b,I){var P=d.x-l.x,j=d.y-l.y,ne=b.min,de=b.max,ze,Ft;return m&8?(ze=l.x+P*(de.y-l.y)/j,Ft=de.y):m&4?(ze=l.x+P*(ne.y-l.y)/j,Ft=ne.y):m&2?(ze=de.x,Ft=l.y+j*(de.x-l.x)/P):m&1&&(ze=ne.x,Ft=l.y+j*(ne.x-l.x)/P),new qe(ze,Ft,I)}function Fr(l,d){var m=0;return l.x<d.min.x?m|=1:l.x>d.max.x&&(m|=2),l.y<d.min.y?m|=4:l.y>d.max.y&&(m|=8),m}function Dm(l,d){var m=d.x-l.x,b=d.y-l.y;return m*m+b*b}function Ml(l,d,m,b){var I=d.x,P=d.y,j=m.x-I,ne=m.y-P,de=j*j+ne*ne,ze;return de>0&&(ze=((l.x-I)*j+(l.y-P)*ne)/de,ze>1?(I=m.x,P=m.y):ze>0&&(I+=j*ze,P+=ne*ze)),j=l.x-I,ne=l.y-P,b?j*j+ne*ne:new qe(I,P)}function po(l){return!R(l[0])||typeof l[0][0]!="object"&&typeof l[0][0]<"u"}function Em(l){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),po(l)}function Kg(l,d){var m,b,I,P,j,ne,de,ze;if(!l||l.length===0)throw new Error("latlngs not passed");po(l)||(console.warn("latlngs are not flat! Only the first ring will be used"),l=l[0]);var Ft=ut([0,0]),yi=ci(l),en=yi.getNorthWest().distanceTo(yi.getSouthWest())*yi.getNorthEast().distanceTo(yi.getNorthWest());en<1700&&(Ft=Oh(l));var mo=l.length,Ws=[];for(m=0;m<mo;m++){var ar=ut(l[m]);Ws.push(d.project(ut([ar.lat-Ft.lat,ar.lng-Ft.lng])))}for(m=0,b=0;m<mo-1;m++)b+=Ws[m].distanceTo(Ws[m+1])/2;if(b===0)ze=Ws[0];else for(m=0,P=0;m<mo-1;m++)if(j=Ws[m],ne=Ws[m+1],I=j.distanceTo(ne),P+=I,P>b){de=(P-b)/I,ze=[ne.x-de*(ne.x-j.x),ne.y-de*(ne.y-j.y)];break}var Do=d.unproject(Ne(ze));return ut([Do.lat+Ft.lat,Do.lng+Ft.lng])}var Gg={__proto__:null,simplify:Ug,pointToSegmentDistance:$g,closestPointOnSegment:Cm,clipSegment:Im,_getEdgeIntersection:Fh,_getBitCode:Fr,_sqClosestPointOnSegment:Ml,isFlat:po,_flat:Em,polylineCenter:Kg},Hh={project:function(l){return new qe(l.lng,l.lat)},unproject:function(l){return new Vt(l.y,l.x)},bounds:new st([-180,-90],[180,90])},Zg={R:6378137,R_MINOR:6356752314245179e-9,bounds:new st([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(l){var d=Math.PI/180,m=this.R,b=l.lat*d,I=this.R_MINOR/m,P=Math.sqrt(1-I*I),j=P*Math.sin(b),ne=Math.tan(Math.PI/4-b/2)/Math.pow((1-j)/(1+j),P/2);return b=-m*Math.log(Math.max(ne,1e-10)),new qe(l.lng*d*m,b)},unproject:function(l){for(var d=180/Math.PI,m=this.R,b=this.R_MINOR/m,I=Math.sqrt(1-b*b),P=Math.exp(-l.y/m),j=Math.PI/2-2*Math.atan(P),ne=0,de=.1,ze;ne<15&&Math.abs(de)>1e-7;ne++)ze=I*Math.sin(j),ze=Math.pow((1-ze)/(1+ze),I/2),de=Math.PI/2-2*Math.atan(P*ze)-j,j+=de;return new Vt(j*d,l.x*d/m)}},Jy={__proto__:null,LonLat:Hh,Mercator:Zg,SphericalMercator:Fi},Qy=n({},fi,{code:"EPSG:3395",projection:Zg,transformation:(function(){var l=.5/(Math.PI*Zg.R);return Yi(l,.5,-l,.5)})()}),Pm=n({},fi,{code:"EPSG:4326",projection:Hh,transformation:Yi(1/180,1,-1/180,.5)}),ew=n({},Ii,{projection:Hh,transformation:Yi(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 m=d.lng-l.lng,b=d.lat-l.lat;return Math.sqrt(m*m+b*b)},infinite:!0});Ii.Earth=fi,Ii.EPSG3395=Qy,Ii.EPSG3857=Ji,Ii.EPSG900913=Fn,Ii.EPSG4326=Pm,Ii.Simple=ew;var qo=ei.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 m=this.getEvents();d.on(m,this),this.once("remove",function(){d.off(m,this)},this)}this.onAdd(d),this.fire("add"),d.fire("layeradd",{layer:this})}}});Bi.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 m in this._layers)l.call(d,this._layers[m]);return this},_addLayers:function(l){l=l?R(l)?l:[l]:[];for(var d=0,m=l.length;d<m;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,m=this._getZoomSpan();for(var b in this._zoomBoundLayers){var I=this._zoomBoundLayers[b].options;l=I.minZoom===void 0?l:Math.min(l,I.minZoom),d=I.maxZoom===void 0?d:Math.max(d,I.maxZoom)}this._layersMaxZoom=d===-1/0?void 0:d,this._layersMinZoom=l===1/0?void 0:l,m!==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 Nl=qo.extend({initialize:function(l,d){w(this,d),this._layers={};var m,b;if(l)for(m=0,b=l.length;m<b;m++)this.addLayer(l[m])},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),m,b;for(m in this._layers)b=this._layers[m],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 m in this._layers)l.call(d,this._layers[m]);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)}}),tw=function(l,d){return new Nl(l,d)},O=Nl.extend({addLayer:function(l){return this.hasLayer(l)?this:(l.addEventParent(this),Nl.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),Nl.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 ni;for(var d in this._layers){var m=this._layers[d];l.extend(m.getBounds?m.getBounds():m.getLatLng())}return l}}),oe=function(l,d){return new O(l,d)},be=ct.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(l){w(this,l)},createIcon:function(l){return this._createIcon("icon",l)},createShadow:function(l){return this._createIcon("shadow",l)},_createIcon:function(l,d){var m=this._getIconUrl(l);if(!m){if(l==="icon")throw new Error("iconUrl not set in Icon options (see the docs).");return null}var b=this._createImg(m,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 m=this.options,b=m[d+"Size"];typeof b=="number"&&(b=[b,b]);var I=Ne(b),P=Ne(d==="shadow"&&m.shadowAnchor||m.iconAnchor||I&&I.divideBy(2,!0));l.className="leaflet-marker-"+d+" "+(m.className||""),P&&(l.style.marginLeft=-P.x+"px",l.style.marginTop=-P.y+"px"),I&&(l.style.width=I.x+"px",l.style.height=I.y+"px")},_createImg:function(l,d){return d=d||document.createElement("img"),d.src=l,d},_getIconUrl:function(l){return fe.retina&&this.options[l+"RetinaUrl"]||this.options[l+"Url"]}});function ae(l){return new be(l)}var Xe=be.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 Xe.imagePath!="string"&&(Xe.imagePath=this._detectIconPath()),(this.options.imagePath||Xe.imagePath)+be.prototype._getIconUrl.call(this,l)},_stripUrl:function(l){var d=function(m,b,I){var P=b.exec(m);return P&&P[I]};return l=d(l,/^url\((['"])?(.+)\1\)$/,2),l&&d(l,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var l=Me("div","leaflet-default-icon-path",document.body),d=$e(l,"background-image")||$e(l,"backgroundImage");if(document.body.removeChild(l),d=this._stripUrl(d),d)return d;var m=document.querySelector('link[href$="leaflet.css"]');return m?m.href.substring(0,m.href.length-11-1):""}}),Pt=$o.extend({initialize:function(l){this._marker=l},addHooks:function(){var l=this._marker._icon;this._draggable||(this._draggable=new Or(l,l,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),Ee(l,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&at(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(l){var d=this._marker,m=d._map,b=this._marker.options.autoPanSpeed,I=this._marker.options.autoPanPadding,P=xt(d._icon),j=m.getPixelBounds(),ne=m.getPixelOrigin(),de=Mt(j.min._subtract(ne).add(I),j.max._subtract(ne).subtract(I));if(!de.contains(P)){var ze=Ne((Math.max(de.max.x,P.x)-de.max.x)/(j.max.x-de.max.x)-(Math.min(de.min.x,P.x)-de.min.x)/(j.min.x-de.min.x),(Math.max(de.max.y,P.y)-de.max.y)/(j.max.y-de.max.y)-(Math.min(de.min.y,P.y)-de.min.y)/(j.min.y-de.min.y)).multiplyBy(b);m.panBy(ze,{animate:!1}),this._draggable._newPos._add(ze),this._draggable._startPos._add(ze),ke(d._icon,this._draggable._newPos),this._onDrag(l),this._panRequest=Ce(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&&(mt(this._panRequest),this._panRequest=Ce(this._adjustPan.bind(this,l)))},_onDrag:function(l){var d=this._marker,m=d._shadow,b=xt(d._icon),I=d._map.layerPointToLatLng(b);m&&ke(m,b),d._latlng=I,l.latlng=I,l.oldLatLng=this._oldLatLng,d.fire("move",l).fire("drag",l)},_onDragEnd:function(l){mt(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",l)}}),Rt=qo.extend({options:{icon:new Xe,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){w(this,d),this._latlng=ut(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=ut(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"),m=l.icon.createIcon(this._icon),b=!1;m!==this._icon&&(this._icon&&this._removeIcon(),b=!0,l.title&&(m.title=l.title),m.tagName==="IMG"&&(m.alt=l.alt||"")),Ee(m,d),l.keyboard&&(m.tabIndex="0",m.setAttribute("role","button")),this._icon=m,l.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&et(m,"focus",this._panOnFocus,this);var I=l.icon.createShadow(this._shadow),P=!1;I!==this._shadow&&(this._removeShadow(),P=!0),I&&(Ee(I,d),I.alt=""),this._shadow=I,l.opacity<1&&this._updateOpacity(),b&&this.getPane().appendChild(this._icon),this._initInteraction(),I&&P&&this.getPane(l.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Gt(this._icon,"focus",this._panOnFocus,this),Ge(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&Ge(this._shadow),this._shadow=null},_setPos:function(l){this._icon&&ke(this._icon,l),this._shadow&&ke(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&&(Ee(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),Pt)){var l=this.options.draggable;this.dragging&&(l=this.dragging.enabled(),this.dragging.disable()),this.dragging=new Pt(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&&Y(this._icon,l),this._shadow&&Y(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,m=d.iconSize?Ne(d.iconSize):Ne(0,0),b=d.iconAnchor?Ne(d.iconAnchor):Ne(0,0);l.panInside(this._latlng,{paddingTopLeft:b,paddingBottomRight:m.subtract(b)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function Pi(l,d){return new Rt(l,d)}var bi=qo.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 w(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)}}),Li=bi.extend({options:{fill:!0,radius:10},initialize:function(l,d){w(this,d),this._latlng=ut(l),this._radius=this.options.radius},setLatLng:function(l){var d=this._latlng;return this._latlng=ut(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 bi.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,m=this._clickTolerance(),b=[l+m,d+m];this._pxBounds=new st(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 Ti(l,d){return new Li(l,d)}var Si=Li.extend({initialize:function(l,d,m){if(typeof d=="number"&&(d=n({},m,{radius:d})),w(this,d),this._latlng=ut(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 ni(this._map.layerPointToLatLng(this._point.subtract(l)),this._map.layerPointToLatLng(this._point.add(l)))},setStyle:bi.prototype.setStyle,_project:function(){var l=this._latlng.lng,d=this._latlng.lat,m=this._map,b=m.options.crs;if(b.distance===fi.distance){var I=Math.PI/180,P=this._mRadius/fi.R/I,j=m.project([d+P,l]),ne=m.project([d-P,l]),de=j.add(ne).divideBy(2),ze=m.unproject(de).lat,Ft=Math.acos((Math.cos(P*I)-Math.sin(d*I)*Math.sin(ze*I))/(Math.cos(d*I)*Math.cos(ze*I)))/I;(isNaN(Ft)||Ft===0)&&(Ft=P/Math.cos(Math.PI/180*d)),this._point=de.subtract(m.getPixelOrigin()),this._radius=isNaN(Ft)?0:de.x-m.project([ze,l-Ft]).x,this._radiusY=de.y-j.y}else{var yi=b.unproject(b.project(this._latlng).subtract([this._mRadius,0]));this._point=m.latLngToLayerPoint(this._latlng),this._radius=this._point.x-m.latLngToLayerPoint(yi).x}this._updateBounds()}});function Qi(l,d,m){return new Si(l,d,m)}var hn=bi.extend({options:{smoothFactor:1,noClip:!1},initialize:function(l,d){w(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,m=null,b=Ml,I,P,j=0,ne=this._parts.length;j<ne;j++)for(var de=this._parts[j],ze=1,Ft=de.length;ze<Ft;ze++){I=de[ze-1],P=de[ze];var yi=b(l,I,P,!0);yi<d&&(d=yi,m=b(l,I,P))}return m&&(m.distance=Math.sqrt(d)),m},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return Kg(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(l,d){return d=d||this._defaultShape(),l=ut(l),d.push(l),this._bounds.extend(l),this.redraw()},_setLatLngs:function(l){this._bounds=new ni,this._latlngs=this._convertLatLngs(l)},_defaultShape:function(){return po(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(l){for(var d=[],m=po(l),b=0,I=l.length;b<I;b++)m?(d[b]=ut(l[b]),this._bounds.extend(d[b])):d[b]=this._convertLatLngs(l[b]);return d},_project:function(){var l=new st;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 qe(l,l);this._rawPxBounds&&(this._pxBounds=new st([this._rawPxBounds.min.subtract(d),this._rawPxBounds.max.add(d)]))},_projectLatlngs:function(l,d,m){var b=l[0]instanceof Vt,I=l.length,P,j;if(b){for(j=[],P=0;P<I;P++)j[P]=this._map.latLngToLayerPoint(l[P]),m.extend(j[P]);d.push(j)}else for(P=0;P<I;P++)this._projectLatlngs(l[P],d,m)},_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,m,b,I,P,j,ne,de;for(m=0,I=0,P=this._rings.length;m<P;m++)for(de=this._rings[m],b=0,j=de.length;b<j-1;b++)ne=Im(de[b],de[b+1],l,b,!0),ne&&(d[I]=d[I]||[],d[I].push(ne[0]),(ne[1]!==de[b+1]||b===j-2)&&(d[I].push(ne[1]),I++))}},_simplifyPoints:function(){for(var l=this._parts,d=this.options.smoothFactor,m=0,b=l.length;m<b;m++)l[m]=Ug(l[m],d)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(l,d){var m,b,I,P,j,ne,de=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(l))return!1;for(m=0,P=this._parts.length;m<P;m++)for(ne=this._parts[m],b=0,j=ne.length,I=j-1;b<j;I=b++)if(!(!d&&b===0)&&$g(l,ne[I],ne[b])<=de)return!0;return!1}});function is(l,d){return new hn(l,d)}hn._flat=Em;var zn=hn.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 Ah(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(l){var d=hn.prototype._convertLatLngs.call(this,l),m=d.length;return m>=2&&d[0]instanceof Vt&&d[0].equals(d[m-1])&&d.pop(),d},_setLatLngs:function(l){hn.prototype._setLatLngs.call(this,l),po(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return po(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var l=this._renderer._bounds,d=this.options.weight,m=new qe(d,d);if(l=new st(l.min.subtract(m),l.max.add(m)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(l))){if(this.options.noClip){this._parts=this._rings;return}for(var b=0,I=this._rings.length,P;b<I;b++)P=Sm(this._rings[b],l,!0),P.length&&this._parts.push(P)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(l){var d=!1,m,b,I,P,j,ne,de,ze;if(!this._pxBounds||!this._pxBounds.contains(l))return!1;for(P=0,de=this._parts.length;P<de;P++)for(m=this._parts[P],j=0,ze=m.length,ne=ze-1;j<ze;ne=j++)b=m[j],I=m[ne],b.y>l.y!=I.y>l.y&&l.x<(I.x-b.x)*(l.y-b.y)/(I.y-b.y)+b.x&&(d=!d);return d||hn.prototype._containsPoint.call(this,l,!0)}});function Zi(l,d){return new zn(l,d)}var Qn=O.extend({initialize:function(l,d){w(this,d),this._layers={},l&&this.addData(l)},addData:function(l){var d=R(l)?l:l.features,m,b,I;if(d){for(m=0,b=d.length;m<b;m++)I=d[m],(I.geometries||I.geometry||I.features||I.coordinates)&&this.addData(I);return this}var P=this.options;if(P.filter&&!P.filter(l))return this;var j=no(l,P);return j?(j.feature=Ko(l),j.defaultOptions=j.options,this.resetStyle(j),P.onEachFeature&&P.onEachFeature(l,j),this.addLayer(j)):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 no(l,d){var m=l.type==="Feature"?l.geometry:l,b=m?m.coordinates:null,I=[],P=d&&d.pointToLayer,j=d&&d.coordsToLatLng||Cs,ne,de,ze,Ft;if(!b&&!m)return null;switch(m.type){case"Point":return ne=j(b),so(P,l,ne,d);case"MultiPoint":for(ze=0,Ft=b.length;ze<Ft;ze++)ne=j(b[ze]),I.push(so(P,l,ne,d));return new O(I);case"LineString":case"MultiLineString":return de=rs(b,m.type==="LineString"?0:1,j),new hn(de,d);case"Polygon":case"MultiPolygon":return de=rs(b,m.type==="Polygon"?1:2,j),new zn(de,d);case"GeometryCollection":for(ze=0,Ft=m.geometries.length;ze<Ft;ze++){var yi=no({geometry:m.geometries[ze],type:"Feature",properties:l.properties},d);yi&&I.push(yi)}return new O(I);case"FeatureCollection":for(ze=0,Ft=m.features.length;ze<Ft;ze++){var en=no(m.features[ze],d);en&&I.push(en)}return new O(I);default:throw new Error("Invalid GeoJSON object.")}}function so(l,d,m,b){return l?l(d,m):new Rt(m,b&&b.markersInheritOptions&&b)}function Cs(l){return new Vt(l[1],l[0],l[2])}function rs(l,d,m){for(var b=[],I=0,P=l.length,j;I<P;I++)j=d?rs(l[I],d-1,m):(m||Cs)(l[I]),b.push(j);return b}function gs(l,d){return l=ut(l),l.alt!==void 0?[p(l.lng,d),p(l.lat,d),p(l.alt,d)]:[p(l.lng,d),p(l.lat,d)]}function fs(l,d,m,b){for(var I=[],P=0,j=l.length;P<j;P++)I.push(d?fs(l[P],po(l[P])?0:d-1,m,b):gs(l[P],b));return!d&&m&&I.length>0&&I.push(I[0].slice()),I}function xs(l,d){return l.feature?n({},l.feature,{geometry:d}):Ko(d)}function Ko(l){return l.type==="Feature"||l.type==="FeatureCollection"?l:{type:"Feature",properties:{},geometry:l}}var rr={toGeoJSON:function(l){return xs(this,{type:"Point",coordinates:gs(this.getLatLng(),l)})}};Rt.include(rr),Si.include(rr),Li.include(rr),hn.include({toGeoJSON:function(l){var d=!po(this._latlngs),m=fs(this._latlngs,d?1:0,!1,l);return xs(this,{type:(d?"Multi":"")+"LineString",coordinates:m})}}),zn.include({toGeoJSON:function(l){var d=!po(this._latlngs),m=d&&!po(this._latlngs[0]),b=fs(this._latlngs,m?2:d?1:0,!0,l);return d||(b=[b]),xs(this,{type:(m?"Multi":"")+"Polygon",coordinates:b})}}),Nl.include({toMultiPoint:function(l){var d=[];return this.eachLayer(function(m){d.push(m.toGeoJSON(l).geometry.coordinates)}),xs(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 m=d==="GeometryCollection",b=[];return this.eachLayer(function(I){if(I.toGeoJSON){var P=I.toGeoJSON(l);if(m)b.push(P.geometry);else{var j=Ko(P);j.type==="FeatureCollection"?b.push.apply(b,j.features):b.push(j)}}}),m?xs(this,{geometries:b,type:"GeometryCollection"}):{type:"FeatureCollection",features:b}}});function Ds(l,d){return new Qn(l,d)}var $n=Ds,oo=qo.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(l,d,m){this._url=l,this._bounds=ci(d),w(this,m)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(Ee(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){Ge(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&&ge(this._image),this},bringToBack:function(){return this._map&&xe(this._image),this},setUrl:function(l){return this._url=l,this._image&&(this._image.src=l),this},setBounds:function(l){return this._bounds=ci(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:Me("img");if(Ee(d,"leaflet-image-layer"),this._zoomAnimated&&Ee(d,"leaflet-zoom-animated"),this.options.className&&Ee(d,this.options.className),d.onselectstart=f,d.onmousemove=f,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),m=this._map._latLngBoundsToNewLayerBounds(this._bounds,l.zoom,l.center).min;Ie(this._image,m,d)},_reset:function(){var l=this._image,d=new st(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),m=d.getSize();ke(l,d.min),l.style.width=m.x+"px",l.style.height=m.y+"px"},_updateOpacity:function(){Y(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()}}),ha=function(l,d,m){return new oo(l,d,m)},Rl=oo.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:Me("video");if(Ee(d,"leaflet-image-layer"),this._zoomAnimated&&Ee(d,"leaflet-zoom-animated"),this.options.className&&Ee(d,this.options.className),d.onselectstart=f,d.onmousemove=f,d.onloadeddata=r(this.fire,this,"load"),l){for(var m=d.getElementsByTagName("source"),b=[],I=0;I<m.length;I++)b.push(m[I].src);this._url=m.length>0?b:[d.src];return}R(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 j=Me("source");j.src=this._url[P],d.appendChild(j)}}});function Xg(l,d,m){return new Rl(l,d,m)}var Wh=oo.extend({_initImage:function(){var l=this._image=this._url;Ee(l,"leaflet-image-layer"),this._zoomAnimated&&Ee(l,"leaflet-zoom-animated"),this.options.className&&Ee(l,this.options.className),l.onselectstart=f,l.onmousemove=f}});function iw(l,d,m){return new Wh(l,d,m)}var Ki=qo.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(l,d){l&&(l instanceof Vt||R(l))?(this._latlng=ut(l),w(this,d)):(w(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&&Y(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),l._fadeAnimated&&Y(this._container,1),this.bringToFront(),this.options.interactive&&(Ee(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(l){l._fadeAnimated?(Y(this._container,0),this._removeTimeout=setTimeout(r(Ge,void 0,this._container),200)):Ge(this._container),this.options.interactive&&(at(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(l){return this._latlng=ut(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&&ge(this._container),this},bringToBack:function(){return this._map&&xe(this._container),this},_prepareOpen:function(l){var d=this._source;if(!d._map)return!1;if(d instanceof O){d=null;var m=this._source._layers;for(var b in m)if(m[b]._map){d=m[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=Ne(this.options.offset),m=this._getAnchor();this._zoomAnimated?ke(this._container,l.add(m)):d=d.add(l).add(m);var b=this._containerBottom=-d.y,I=this._containerLeft=-Math.round(this._containerWidth/2)+d.x;this._container.style.bottom=b+"px",this._container.style.left=I+"px"}},_getAnchor:function(){return[0,0]}});Bi.include({_initOverlay:function(l,d,m,b){var I=d;return I instanceof l||(I=new l(b).setContent(d)),m&&I.setLatLng(m),I}}),qo.include({_initOverlay:function(l,d,m,b){var I=m;return I instanceof l?(w(I,b),I._source=this):(I=d&&!b?d:new l(b,this),I.setContent(m)),I}});var Ms=Ki.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,Ki.prototype.openOn.call(this,l)},onAdd:function(l){Ki.prototype.onAdd.call(this,l),l.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof bi||this._source.on("preclick",pi))},onRemove:function(l){Ki.prototype.onRemove.call(this,l),l.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof bi||this._source.off("preclick",pi))},getEvents:function(){var l=Ki.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=Me("div",l+" "+(this.options.className||"")+" leaflet-zoom-animated"),m=this._wrapper=Me("div",l+"-content-wrapper",d);if(this._contentNode=Me("div",l+"-content",m),qi(d),$t(this._contentNode),et(d,"contextmenu",pi),this._tipContainer=Me("div",l+"-tip-container",d),this._tip=Me("div",l+"-tip",this._tipContainer),this.options.closeButton){var b=this._closeButton=Me("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>',et(b,"click",function(I){Ei(I),this.close()},this)}},_updateLayout:function(){var l=this._contentNode,d=l.style;d.width="",d.whiteSpace="nowrap";var m=l.offsetWidth;m=Math.min(m,this.options.maxWidth),m=Math.max(m,this.options.minWidth),d.width=m+1+"px",d.whiteSpace="",d.height="";var b=l.offsetHeight,I=this.options.maxHeight,P="leaflet-popup-scrolled";I&&b>I?(d.height=I+"px",Ee(l,P)):at(l,P),this._containerWidth=this._container.offsetWidth},_animateZoom:function(l){var d=this._map._latLngToNewLayerPoint(this._latlng,l.zoom,l.center),m=this._getAnchor();ke(this._container,d.add(m))},_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($e(this._container,"marginBottom"),10)||0,m=this._container.offsetHeight+d,b=this._containerWidth,I=new qe(this._containerLeft,-m-this._containerBottom);I._add(xt(this._container));var P=l.layerPointToContainerPoint(I),j=Ne(this.options.autoPanPadding),ne=Ne(this.options.autoPanPaddingTopLeft||j),de=Ne(this.options.autoPanPaddingBottomRight||j),ze=l.getSize(),Ft=0,yi=0;P.x+b+de.x>ze.x&&(Ft=P.x+b-ze.x+de.x),P.x-Ft-ne.x<0&&(Ft=P.x-ne.x),P.y+m+de.y>ze.y&&(yi=P.y+m-ze.y+de.y),P.y-yi-ne.y<0&&(yi=P.y-ne.y),(Ft||yi)&&(this.options.keepInView&&(this._autopanning=!0),l.fire("autopanstart").panBy([Ft,yi]))}},_getAnchor:function(){return Ne(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Bh=function(l,d){return new Ms(l,d)};Bi.mergeOptions({closePopupOnClick:!0}),Bi.include({openPopup:function(l,d,m){return this._initOverlay(Ms,l,d,m).openOn(this),this},closePopup:function(l){return l=arguments.length?l:this._popup,l&&l.close(),this}}),qo.include({bindPopup:function(l,d){return this._popup=this._initOverlay(Ms,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 O||(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)){us(l);var d=l.layer||l.target;if(this._popup._source===d&&!(d instanceof bi)){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 Al=Ki.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(l){Ki.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){Ki.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=Ki.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=Me("div",d),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+c(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(l){var d,m,b=this._map,I=this._container,P=b.latLngToContainerPoint(b.getCenter()),j=b.layerPointToContainerPoint(l),ne=this.options.direction,de=I.offsetWidth,ze=I.offsetHeight,Ft=Ne(this.options.offset),yi=this._getAnchor();ne==="top"?(d=de/2,m=ze):ne==="bottom"?(d=de/2,m=0):ne==="center"?(d=de/2,m=ze/2):ne==="right"?(d=0,m=ze/2):ne==="left"?(d=de,m=ze/2):j.x<P.x?(ne="right",d=0,m=ze/2):(ne="left",d=de+(Ft.x+yi.x)*2,m=ze/2),l=l.subtract(Ne(d,m,!0)).add(Ft).add(yi),at(I,"leaflet-tooltip-right"),at(I,"leaflet-tooltip-left"),at(I,"leaflet-tooltip-top"),at(I,"leaflet-tooltip-bottom"),Ee(I,"leaflet-tooltip-"+ne),ke(I,l)},_updatePosition:function(){var l=this._map.latLngToLayerPoint(this._latlng);this._setPosition(l)},setOpacity:function(l){this.options.opacity=l,this._container&&Y(this._container,l)},_animateZoom:function(l){var d=this._map._latLngToNewLayerPoint(this._latlng,l.zoom,l.center);this._setPosition(d)},_getAnchor:function(){return Ne(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),qR=function(l,d){return new Al(l,d)};Bi.include({openTooltip:function(l,d,m){return this._initOverlay(Al,l,d,m).openOn(this),this},closeTooltip:function(l){return l.close(),this}}),qo.include({bindTooltip:function(l,d){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(Al,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",m={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?m.add=this._openTooltip:(m.mouseover=this._openTooltip,m.mouseout=this.closeTooltip,m.click=this._openTooltip,this._map?this._addFocusListeners():m.add=this._addFocusListeners),this._tooltip.options.sticky&&(m.mousemove=this._moveTooltip),this[d](m),this._tooltipHandlersAdded=!l}},openTooltip:function(l){return this._tooltip&&(this instanceof O||(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&&(et(d,"focus",function(){this._tooltip._source=l,this.openTooltip()},this),et(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,m,b;this._tooltip.options.sticky&&l.originalEvent&&(m=this._map.mouseEventToContainerPoint(l.originalEvent),b=this._map.containerPointToLayerPoint(m),d=this._map.layerPointToLatLng(b)),this._tooltip.setLatLng(d)}});var kL=be.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"),m=this.options;if(m.html instanceof Element?(Yt(d),d.appendChild(m.html)):d.innerHTML=m.html!==!1?m.html:"",m.bgPos){var b=Ne(m.bgPos);d.style.backgroundPosition=-b.x+"px "+-b.y+"px"}return this._setIconStyles(d,"icon"),d},createShadow:function(){return null}});function KR(l){return new kL(l)}be.Default=Xe;var Yg=qo.extend({options:{tileSize:256,opacity:1,updateWhenIdle:fe.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){w(this,l)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(l){l._addZoomLimit(this)},onRemove:function(l){this._removeAllTiles(),Ge(this._container),l._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(ge(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(xe(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 qe?l:new qe(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,m=-l(-1/0,1/0),b=0,I=d.length,P;b<I;b++)P=d[b].style.zIndex,d[b]!==this._container&&P&&(m=l(m,+P));isFinite(m)&&(this.options.zIndex=m+l(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!fe.ielt9){Y(this._container,this.options.opacity);var l=+new Date,d=!1,m=!1;for(var b in this._tiles){var I=this._tiles[b];if(!(!I.current||!I.loaded)){var P=Math.min(1,(l-I.loaded)/200);Y(I.el,P),P<1?d=!0:(I.active?m=!0:this._onOpaqueTile(I),I.active=!0)}}m&&!this._noPrune&&this._pruneTiles(),d&&(mt(this._fadeFrame),this._fadeFrame=Ce(this._updateOpacity,this))}},_onOpaqueTile:f,_initContainer:function(){this._container||(this._container=Me("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 m in this._levels)m=Number(m),this._levels[m].el.children.length||m===l?(this._levels[m].el.style.zIndex=d-Math.abs(l-m),this._onUpdateLevel(m)):(Ge(this._levels[m].el),this._removeTilesAtZoom(m),this._onRemoveLevel(m),delete this._levels[m]);var b=this._levels[l],I=this._map;return b||(b=this._levels[l]={},b.el=Me("div","leaflet-tile-container leaflet-zoom-animated",this._container),b.el.style.zIndex=d,b.origin=I.project(I.unproject(I.getPixelOrigin()),l).round(),b.zoom=l,this._setZoomTransform(b,I.getCenter(),I.getZoom()),f(b.el.offsetWidth),this._onCreateLevel(b)),this._level=b,b}},_onUpdateLevel:f,_onRemoveLevel:f,_onCreateLevel:f,_pruneTiles:function(){if(this._map){var l,d,m=this._map.getZoom();if(m>this.options.maxZoom||m<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)Ge(this._levels[l].el),this._onRemoveLevel(Number(l)),delete this._levels[l];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(l,d,m,b){var I=Math.floor(l/2),P=Math.floor(d/2),j=m-1,ne=new qe(+I,+P);ne.z=+j;var de=this._tileCoordsToKey(ne),ze=this._tiles[de];return ze&&ze.active?(ze.retain=!0,!0):(ze&&ze.loaded&&(ze.retain=!0),j>b?this._retainParent(I,P,j,b):!1)},_retainChildren:function(l,d,m,b){for(var I=2*l;I<2*l+2;I++)for(var P=2*d;P<2*d+2;P++){var j=new qe(I,P);j.z=m+1;var ne=this._tileCoordsToKey(j),de=this._tiles[ne];if(de&&de.active){de.retain=!0;continue}else de&&de.loaded&&(de.retain=!0);m+1<b&&this._retainChildren(I,P,m+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,m,b){var I=Math.round(d);this.options.maxZoom!==void 0&&I>this.options.maxZoom||this.options.minZoom!==void 0&&I<this.options.minZoom?I=void 0:I=this._clampZoom(I);var P=this.options.updateWhenZooming&&I!==this._tileZoom;(!b||P)&&(this._tileZoom=I,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),I!==void 0&&this._update(l),m||this._pruneTiles(),this._noPrune=!!m),this._setZoomTransforms(l,d)},_setZoomTransforms:function(l,d){for(var m in this._levels)this._setZoomTransform(this._levels[m],l,d)},_setZoomTransform:function(l,d,m){var b=this._map.getZoomScale(m,l.zoom),I=l.origin.multiplyBy(b).subtract(this._map._getNewPixelOrigin(d,m)).round();fe.any3d?Ie(l.el,I,b):ke(l.el,I)},_resetGrid:function(){var l=this._map,d=l.options.crs,m=this._tileSize=this.getTileSize(),b=this._tileZoom,I=this._map.getPixelWorldBounds(this._tileZoom);I&&(this._globalTileRange=this._pxBoundsToTileRange(I)),this._wrapX=d.wrapLng&&!this.options.noWrap&&[Math.floor(l.project([0,d.wrapLng[0]],b).x/m.x),Math.ceil(l.project([0,d.wrapLng[1]],b).x/m.y)],this._wrapY=d.wrapLat&&!this.options.noWrap&&[Math.floor(l.project([d.wrapLat[0],0],b).y/m.x),Math.ceil(l.project([d.wrapLat[1],0],b).y/m.y)]},_onMoveEnd:function(){!this._map||this._map._animatingZoom||this._update()},_getTiledPixelBounds:function(l){var d=this._map,m=d._animatingZoom?Math.max(d._animateToZoom,d.getZoom()):d.getZoom(),b=d.getZoomScale(m,this._tileZoom),I=d.project(l,this._tileZoom).floor(),P=d.getSize().divideBy(b*2);return new st(I.subtract(P),I.add(P))},_update:function(l){var d=this._map;if(d){var m=this._clampZoom(d.getZoom());if(l===void 0&&(l=d.getCenter()),this._tileZoom!==void 0){var b=this._getTiledPixelBounds(l),I=this._pxBoundsToTileRange(b),P=I.getCenter(),j=[],ne=this.options.keepBuffer,de=new st(I.getBottomLeft().subtract([ne,-ne]),I.getTopRight().add([ne,-ne]));if(!(isFinite(I.min.x)&&isFinite(I.min.y)&&isFinite(I.max.x)&&isFinite(I.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var ze in this._tiles){var Ft=this._tiles[ze].coords;(Ft.z!==this._tileZoom||!de.contains(new qe(Ft.x,Ft.y)))&&(this._tiles[ze].current=!1)}if(Math.abs(m-this._tileZoom)>1){this._setView(l,m);return}for(var yi=I.min.y;yi<=I.max.y;yi++)for(var en=I.min.x;en<=I.max.x;en++){var mo=new qe(en,yi);if(mo.z=this._tileZoom,!!this._isValidTile(mo)){var Ws=this._tiles[this._tileCoordsToKey(mo)];Ws?Ws.current=!0:j.push(mo)}}if(j.sort(function(Do,Vh){return Do.distanceTo(P)-Vh.distanceTo(P)}),j.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var ar=document.createDocumentFragment();for(en=0;en<j.length;en++)this._addTile(j[en],ar);this._level.el.appendChild(ar)}}}},_isValidTile:function(l){var d=this._map.options.crs;if(!d.infinite){var m=this._globalTileRange;if(!d.wrapLng&&(l.x<m.min.x||l.x>m.max.x)||!d.wrapLat&&(l.y<m.min.y||l.y>m.max.y))return!1}if(!this.options.bounds)return!0;var b=this._tileCoordsToBounds(l);return ci(this.options.bounds).overlaps(b)},_keyToBounds:function(l){return this._tileCoordsToBounds(this._keyToTileCoords(l))},_tileCoordsToNwSe:function(l){var d=this._map,m=this.getTileSize(),b=l.scaleBy(m),I=b.add(m),P=d.unproject(b,l.z),j=d.unproject(I,l.z);return[P,j]},_tileCoordsToBounds:function(l){var d=this._tileCoordsToNwSe(l),m=new ni(d[0],d[1]);return this.options.noWrap||(m=this._map.wrapLatLngBounds(m)),m},_tileCoordsToKey:function(l){return l.x+":"+l.y+":"+l.z},_keyToTileCoords:function(l){var d=l.split(":"),m=new qe(+d[0],+d[1]);return m.z=+d[2],m},_removeTile:function(l){var d=this._tiles[l];d&&(Ge(d.el),delete this._tiles[l],this.fire("tileunload",{tile:d.el,coords:this._keyToTileCoords(l)}))},_initTile:function(l){Ee(l,"leaflet-tile");var d=this.getTileSize();l.style.width=d.x+"px",l.style.height=d.y+"px",l.onselectstart=f,l.onmousemove=f,fe.ielt9&&this.options.opacity<1&&Y(l,this.options.opacity)},_addTile:function(l,d){var m=this._getTilePos(l),b=this._tileCoordsToKey(l),I=this.createTile(this._wrapCoords(l),r(this._tileReady,this,l));this._initTile(I),this.createTile.length<2&&Ce(r(this._tileReady,this,l,null,I)),ke(I,m),this._tiles[b]={el:I,coords:l,current:!0},d.appendChild(I),this.fire("tileloadstart",{tile:I,coords:l})},_tileReady:function(l,d,m){d&&this.fire("tileerror",{error:d,tile:m,coords:l});var b=this._tileCoordsToKey(l);m=this._tiles[b],m&&(m.loaded=+new Date,this._map._fadeAnimated?(Y(m.el,0),mt(this._fadeFrame),this._fadeFrame=Ce(this._updateOpacity,this)):(m.active=!0,this._pruneTiles()),d||(Ee(m.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:m.el,coords:l})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),fe.ielt9||!this._map._fadeAnimated?Ce(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 qe(this._wrapX?g(l.x,this._wrapX):l.x,this._wrapY?g(l.y,this._wrapY):l.y);return d.z=l.z,d},_pxBoundsToTileRange:function(l){var d=this.getTileSize();return new st(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 GR(l){return new Yg(l)}var zh=Yg.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=w(this,d),d.detectRetina&&fe.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 m=document.createElement("img");return et(m,"load",r(this._tileOnLoad,this,d,m)),et(m,"error",r(this._tileOnError,this,d,m)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(m.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(m.referrerPolicy=this.options.referrerPolicy),m.alt="",m.src=this.getTileUrl(l),m},getTileUrl:function(l){var d={r:fe.retina?"@2x":"",s:this._getSubdomain(l),x:l.x,y:l.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var m=this._globalTileRange.max.y-l.y;this.options.tms&&(d.y=m),d["-y"]=m}return E(this._url,n(d,this.options))},_tileOnLoad:function(l,d){fe.ielt9?setTimeout(r(l,this,null,d),0):l(null,d)},_tileOnError:function(l,d,m){var b=this.options.errorTileUrl;b&&d.getAttribute("src")!==b&&(d.src=b),l(m,d)},_onTileRemove:function(l){l.tile.onload=null},_getZoomForUrl:function(){var l=this._tileZoom,d=this.options.maxZoom,m=this.options.zoomReverse,b=this.options.zoomOffset;return m&&(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=f,d.onerror=f,!d.complete)){d.src=H;var m=this._tiles[l].coords;Ge(d),delete this._tiles[l],this.fire("tileabort",{tile:d,coords:m})}},_removeTile:function(l){var d=this._tiles[l];if(d)return d.el.setAttribute("src",H),Yg.prototype._removeTile.call(this,l)},_tileReady:function(l,d,m){if(!(!this._map||m&&m.getAttribute("src")===H))return Yg.prototype._tileReady.call(this,l,d,m)}});function IL(l,d){return new zh(l,d)}var DL=zh.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 m=n({},this.defaultWmsParams);for(var b in d)b in this.options||(m[b]=d[b]);d=w(this,d);var I=d.detectRetina&&fe.retina?2:1,P=this.getTileSize();m.width=P.x*I,m.height=P.y*I,this.wmsParams=m},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,zh.prototype.onAdd.call(this,l)},getTileUrl:function(l){var d=this._tileCoordsToNwSe(l),m=this._crs,b=Mt(m.project(d[0]),m.project(d[1])),I=b.min,P=b.max,j=(this._wmsVersion>=1.3&&this._crs===Pm?[I.y,I.x,P.y,P.x]:[I.x,I.y,P.x,P.y]).join(","),ne=zh.prototype.getTileUrl.call(this,l);return ne+S(this.wmsParams,ne,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+j},setParams:function(l,d){return n(this.wmsParams,l),d||this.redraw(),this}});function ZR(l,d){return new DL(l,d)}zh.WMS=DL,IL.wms=ZR;var qa=qo.extend({options:{padding:.1},initialize:function(l){w(this,l),c(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),Ee(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 m=this._map.getZoomScale(d,this._zoom),b=this._map.getSize().multiplyBy(.5+this.options.padding),I=this._map.project(this._center,d),P=b.multiplyBy(-m).add(I).subtract(this._map._getNewPixelOrigin(l,d));fe.any3d?Ie(this._container,P,m):ke(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(),m=this._map.containerPointToLayerPoint(d.multiplyBy(-l)).round();this._bounds=new st(m,m.add(d.multiplyBy(1+l*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),EL=qa.extend({options:{tolerance:0},getEvents:function(){var l=qa.prototype.getEvents.call(this);return l.viewprereset=this._onViewPreReset,l},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){qa.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var l=this._container=document.createElement("canvas");et(l,"mousemove",this._onMouseMove,this),et(l,"click dblclick mousedown mouseup contextmenu",this._onClick,this),et(l,"mouseout",this._handleMouseOut,this),l._leaflet_disable_events=!0,this._ctx=l.getContext("2d")},_destroyContainer:function(){mt(this._redrawRequest),delete this._ctx,Ge(this._container),Gt(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)){qa.prototype._update.call(this);var l=this._bounds,d=this._container,m=l.getSize(),b=fe.retina?2:1;ke(d,l.min),d.width=b*m.x,d.height=b*m.y,d.style.width=m.x+"px",d.style.height=m.y+"px",fe.retina&&this._ctx.scale(2,2),this._ctx.translate(-l.min.x,-l.min.y),this.fire("update")}},_reset:function(){qa.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,m=d.next,b=d.prev;m?m.prev=b:this._drawLast=b,b?b.next=m:this._drawFirst=m,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(/[, ]+/),m=[],b,I;for(I=0;I<d.length;I++){if(b=Number(d[I]),isNaN(b))return;m.push(b)}l.options._dashArray=m}else l.options._dashArray=l.options.dashArray},_requestRedraw:function(l){this._map&&(this._extendRedrawBounds(l),this._redrawRequest=this._redrawRequest||Ce(this._redraw,this))},_extendRedrawBounds:function(l){if(l._pxBounds){var d=(l.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new st,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 m=d.getSize();this._ctx.beginPath(),this._ctx.rect(d.min.x,d.min.y,m.x,m.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 m,b,I,P,j=l._parts,ne=j.length,de=this._ctx;if(ne){for(de.beginPath(),m=0;m<ne;m++){for(b=0,I=j[m].length;b<I;b++)P=j[m][b],de[b?"lineTo":"moveTo"](P.x,P.y);d&&de.closePath()}this._fillStroke(de,l)}}},_updateCircle:function(l){if(!(!this._drawing||l._empty())){var d=l._point,m=this._ctx,b=Math.max(Math.round(l._radius),1),I=(Math.max(Math.round(l._radiusY),1)||b)/b;I!==1&&(m.save(),m.scale(1,I)),m.beginPath(),m.arc(d.x,d.y/I,b,0,Math.PI*2,!1),I!==1&&m.restore(),this._fillStroke(m,l)}},_fillStroke:function(l,d){var m=d.options;m.fill&&(l.globalAlpha=m.fillOpacity,l.fillStyle=m.fillColor||m.color,l.fill(m.fillRule||"evenodd")),m.stroke&&m.weight!==0&&(l.setLineDash&&l.setLineDash(d.options&&d.options._dashArray||[]),l.globalAlpha=m.opacity,l.lineWidth=m.weight,l.strokeStyle=m.color,l.lineCap=m.lineCap,l.lineJoin=m.lineJoin,l.stroke())},_onClick:function(l){for(var d=this._map.mouseEventToLayerPoint(l),m,b,I=this._drawFirst;I;I=I.next)m=I.layer,m.options.interactive&&m._containsPoint(d)&&(!(l.type==="click"||l.type==="preclick")||!this._map._draggableMoved(m))&&(b=m);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&&(at(this._container,"leaflet-interactive"),this._fireEvent([d],l,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(l,d){if(!this._mouseHoverThrottled){for(var m,b,I=this._drawFirst;I;I=I.next)m=I.layer,m.options.interactive&&m._containsPoint(d)&&(b=m);b!==this._hoveredLayer&&(this._handleMouseOut(l),b&&(Ee(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,m){this._map._fireDOMEvent(d,m||d.type,l)},_bringToFront:function(l){var d=l._order;if(d){var m=d.next,b=d.prev;if(m)m.prev=b;else return;b?b.next=m:m&&(this._drawFirst=m),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 m=d.next,b=d.prev;if(b)b.next=m;else return;m?m.prev=b:b&&(this._drawLast=b),d.prev=null,d.next=this._drawFirst,this._drawFirst.prev=d,this._drawFirst=d,this._requestRedraw(l)}}});function PL(l){return fe.canvas?new EL(l):null}var Jg=(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">')}})(),XR={_initContainer:function(){this._container=Me("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(qa.prototype._update.call(this),this.fire("update"))},_initPath:function(l){var d=l._container=Jg("shape");Ee(d,"leaflet-vml-shape "+(this.options.className||"")),d.coordsize="1 1",l._path=Jg("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;Ge(d),l.removeInteractiveTarget(d),delete this._layers[c(l)]},_updateStyle:function(l){var d=l._stroke,m=l._fill,b=l.options,I=l._container;I.stroked=!!b.stroke,I.filled=!!b.fill,b.stroke?(d||(d=l._stroke=Jg("stroke")),I.appendChild(d),d.weight=b.weight+"px",d.color=b.color,d.opacity=b.opacity,b.dashArray?d.dashStyle=R(b.dashArray)?b.dashArray.join(" "):b.dashArray.replace(/( *, *)/g," "):d.dashStyle="",d.endcap=b.lineCap.replace("butt","flat"),d.joinstyle=b.lineJoin):d&&(I.removeChild(d),l._stroke=null),b.fill?(m||(m=l._fill=Jg("fill")),I.appendChild(m),m.color=b.fillColor||b.color,m.opacity=b.fillOpacity):m&&(I.removeChild(m),l._fill=null)},_updateCircle:function(l){var d=l._point.round(),m=Math.round(l._radius),b=Math.round(l._radiusY||m);this._setPath(l,l._empty()?"M0 0":"AL "+d.x+","+d.y+" "+m+","+b+" 0,"+65535*360)},_setPath:function(l,d){l._path.v=d},_bringToFront:function(l){ge(l._container)},_bringToBack:function(l){xe(l._container)}},Tm=fe.vml?Jg:Ai,Qg=qa.extend({_initContainer:function(){this._container=Tm("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Tm("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){Ge(this._container),Gt(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){qa.prototype._update.call(this);var l=this._bounds,d=l.getSize(),m=this._container;(!this._svgSize||!this._svgSize.equals(d))&&(this._svgSize=d,m.setAttribute("width",d.x),m.setAttribute("height",d.y)),ke(m,l.min),m.setAttribute("viewBox",[l.min.x,l.min.y,d.x,d.y].join(" ")),this.fire("update")}},_initPath:function(l){var d=l._path=Tm("path");l.options.className&&Ee(d,l.options.className),l.options.interactive&&Ee(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){Ge(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,m=l.options;d&&(m.stroke?(d.setAttribute("stroke",m.color),d.setAttribute("stroke-opacity",m.opacity),d.setAttribute("stroke-width",m.weight),d.setAttribute("stroke-linecap",m.lineCap),d.setAttribute("stroke-linejoin",m.lineJoin),m.dashArray?d.setAttribute("stroke-dasharray",m.dashArray):d.removeAttribute("stroke-dasharray"),m.dashOffset?d.setAttribute("stroke-dashoffset",m.dashOffset):d.removeAttribute("stroke-dashoffset")):d.setAttribute("stroke","none"),m.fill?(d.setAttribute("fill",m.fillColor||m.color),d.setAttribute("fill-opacity",m.fillOpacity),d.setAttribute("fill-rule",m.fillRule||"evenodd")):d.setAttribute("fill","none"))},_updatePoly:function(l,d){this._setPath(l,Nn(l._parts,d))},_updateCircle:function(l){var d=l._point,m=Math.max(Math.round(l._radius),1),b=Math.max(Math.round(l._radiusY),1)||m,I="a"+m+","+b+" 0 1,0 ",P=l._empty()?"M0 0":"M"+(d.x-m)+","+d.y+I+m*2+",0 "+I+-m*2+",0 ";this._setPath(l,P)},_setPath:function(l,d){l._path.setAttribute("d",d)},_bringToFront:function(l){ge(l._path)},_bringToBack:function(l){xe(l._path)}});fe.vml&&Qg.include(XR);function TL(l){return fe.svg||fe.vml?new Qg(l):null}Bi.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&&PL(l)||TL(l)}});var ML=zn.extend({initialize:function(l,d){zn.prototype.initialize.call(this,this._boundsToLatLngs(l),d)},setBounds:function(l){return this.setLatLngs(this._boundsToLatLngs(l))},_boundsToLatLngs:function(l){return l=ci(l),[l.getSouthWest(),l.getNorthWest(),l.getNorthEast(),l.getSouthEast()]}});function YR(l,d){return new ML(l,d)}Qg.create=Tm,Qg.pointsToPath=Nn,Qn.geometryToLayer=no,Qn.coordsToLatLng=Cs,Qn.coordsToLatLngs=rs,Qn.latLngToCoords=gs,Qn.latLngsToCoords=fs,Qn.getFeature=xs,Qn.asFeature=Ko,Bi.mergeOptions({boxZoom:!0});var NL=$o.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(){et(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Gt(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){Ge(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(),Qe(),_e(),this._startPoint=this._map.mouseEventToContainerPoint(l),et(document,{contextmenu:us,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(l){this._moved||(this._moved=!0,this._box=Me("div","leaflet-zoom-box",this._container),Ee(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(l);var d=new st(this._point,this._startPoint),m=d.getSize();ke(this._box,d.min),this._box.style.width=m.x+"px",this._box.style.height=m.y+"px"},_finish:function(){this._moved&&(Ge(this._box),at(this._container,"leaflet-crosshair")),Te(),we(),Gt(document,{contextmenu:us,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 ni(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())}});Bi.addInitHook("addHandler","boxZoom",NL),Bi.mergeOptions({doubleClickZoom:!0});var RL=$o.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,m=d.getZoom(),b=d.options.zoomDelta,I=l.originalEvent.shiftKey?m-b:m+b;d.options.doubleClickZoom==="center"?d.setZoom(I):d.setZoomAround(l.containerPoint,I)}});Bi.addInitHook("addHandler","doubleClickZoom",RL),Bi.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var AL=$o.extend({addHooks:function(){if(!this._draggable){var l=this._map;this._draggable=new Or(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))}Ee(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){at(this._map._container,"leaflet-grab"),at(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var l=this._map;if(l._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var d=ci(this._map.options.maxBounds);this._offsetLimit=Mt(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,m=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(m),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),m=this._initialWorldOffset,b=this._draggable._newPos.x,I=(b-d+m)%l+d-m,P=(b+d+m)%l-d-m,j=Math.abs(I+m)<Math.abs(P+m)?I:P;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=j},_onDragEnd:function(l){var d=this._map,m=d.options,b=!m.inertia||l.noInertia||this._times.length<2;if(d.fire("dragend",l),b)d.fire("moveend");else{this._prunePositions(+new Date);var I=this._lastPos.subtract(this._positions[0]),P=(this._lastTime-this._times[0])/1e3,j=m.easeLinearity,ne=I.multiplyBy(j/P),de=ne.distanceTo([0,0]),ze=Math.min(m.inertiaMaxSpeed,de),Ft=ne.multiplyBy(ze/de),yi=ze/(m.inertiaDeceleration*j),en=Ft.multiplyBy(-yi/2).round();!en.x&&!en.y?d.fire("moveend"):(en=d._limitOffset(en,d.options.maxBounds),Ce(function(){d.panBy(en,{duration:yi,easeLinearity:j,noMoveStart:!0,animate:!0})}))}}});Bi.addInitHook("addHandler","dragging",AL),Bi.mergeOptions({keyboard:!0,keyboardPanDelta:80});var OL=$o.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"),et(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(),Gt(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,m=l.scrollTop||d.scrollTop,b=l.scrollLeft||d.scrollLeft;this._map._container.focus(),window.scrollTo(b,m)}},_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={},m=this.keyCodes,b,I;for(b=0,I=m.left.length;b<I;b++)d[m.left[b]]=[-1*l,0];for(b=0,I=m.right.length;b<I;b++)d[m.right[b]]=[l,0];for(b=0,I=m.down.length;b<I;b++)d[m.down[b]]=[0,l];for(b=0,I=m.up.length;b<I;b++)d[m.up[b]]=[0,-1*l]},_setZoomDelta:function(l){var d=this._zoomKeys={},m=this.keyCodes,b,I;for(b=0,I=m.zoomIn.length;b<I;b++)d[m.zoomIn[b]]=l;for(b=0,I=m.zoomOut.length;b<I;b++)d[m.zoomOut[b]]=-l},_addHooks:function(){et(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){Gt(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(l){if(!(l.altKey||l.ctrlKey||l.metaKey)){var d=l.keyCode,m=this._map,b;if(d in this._panKeys){if(!m._panAnim||!m._panAnim._inProgress)if(b=this._panKeys[d],l.shiftKey&&(b=Ne(b).multiplyBy(3)),m.options.maxBounds&&(b=m._limitOffset(Ne(b),m.options.maxBounds)),m.options.worldCopyJump){var I=m.wrapLatLng(m.unproject(m.project(m.getCenter()).add(b)));m.panTo(I)}else m.panBy(b)}else if(d in this._zoomKeys)m.setZoom(m.getZoom()+(l.shiftKey?3:1)*this._zoomKeys[d]);else if(d===27&&m._popup&&m._popup.options.closeOnEscapeKey)m.closePopup();else return;us(l)}}});Bi.addInitHook("addHandler","keyboard",OL),Bi.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var FL=$o.extend({addHooks:function(){et(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){Gt(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(l){var d=or(l),m=this._map.options.wheelDebounceTime;this._delta+=d,this._lastMousePos=this._map.mouseEventToContainerPoint(l),this._startTime||(this._startTime=+new Date);var b=Math.max(m-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(r(this._performZoom,this),b),us(l)},_performZoom:function(){var l=this._map,d=l.getZoom(),m=this._map.options.zoomSnap||0;l._stop();var b=this._delta/(this._map.options.wheelPxPerZoomLevel*4),I=4*Math.log(2/(1+Math.exp(-Math.abs(b))))/Math.LN2,P=m?Math.ceil(I/m)*m:I,j=l._limitZoom(d+(this._delta>0?P:-P))-d;this._delta=0,this._startTime=null,j&&(l.options.scrollWheelZoom==="center"?l.setZoom(d+j):l.setZoomAround(this._lastMousePos,d+j))}});Bi.addInitHook("addHandler","scrollWheelZoom",FL);var JR=600;Bi.mergeOptions({tapHold:fe.touchNative&&fe.safari&&fe.mobile,tapTolerance:15});var HL=$o.extend({addHooks:function(){et(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Gt(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 qe(d.clientX,d.clientY),this._holdTimeout=setTimeout(r(function(){this._cancel(),this._isTapValid()&&(et(document,"touchend",Ei),et(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",d))},this),JR),et(document,"touchend touchcancel contextmenu",this._cancel,this),et(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function l(){Gt(document,"touchend",Ei),Gt(document,"touchend touchcancel",l)},_cancel:function(){clearTimeout(this._holdTimeout),Gt(document,"touchend touchcancel contextmenu",this._cancel,this),Gt(document,"touchmove",this._onMove,this)},_onMove:function(l){var d=l.touches[0];this._newPos=new qe(d.clientX,d.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(l,d){var m=new MouseEvent(l,{bubbles:!0,cancelable:!0,view:window,screenX:d.screenX,screenY:d.screenY,clientX:d.clientX,clientY:d.clientY});m._simulated=!0,d.target.dispatchEvent(m)}});Bi.addInitHook("addHandler","tapHold",HL),Bi.mergeOptions({touchZoom:fe.touch,bounceAtZoomLimits:!0});var WL=$o.extend({addHooks:function(){Ee(this._map._container,"leaflet-touch-zoom"),et(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){at(this._map._container,"leaflet-touch-zoom"),Gt(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 m=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(m.add(b)._divideBy(2))),this._startDist=m.distanceTo(b),this._startZoom=d.getZoom(),this._moved=!1,this._zooming=!0,d._stop(),et(document,"touchmove",this._onTouchMove,this),et(document,"touchend touchcancel",this._onTouchEnd,this),Ei(l)}},_onTouchMove:function(l){if(!(!l.touches||l.touches.length!==2||!this._zooming)){var d=this._map,m=d.mouseEventToContainerPoint(l.touches[0]),b=d.mouseEventToContainerPoint(l.touches[1]),I=m.distanceTo(b)/this._startDist;if(this._zoom=d.getScaleZoom(I,this._startZoom),!d.options.bounceAtZoomLimits&&(this._zoom<d.getMinZoom()&&I<1||this._zoom>d.getMaxZoom()&&I>1)&&(this._zoom=d._limitZoom(this._zoom)),d.options.touchZoom==="center"){if(this._center=this._startLatLng,I===1)return}else{var P=m._add(b)._divideBy(2)._subtract(this._centerPoint);if(I===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),mt(this._animRequest);var j=r(d._move,d,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=Ce(j,this,!0),Ei(l)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,mt(this._animRequest),Gt(document,"touchmove",this._onTouchMove,this),Gt(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))}});Bi.addInitHook("addHandler","touchZoom",WL),Bi.BoxZoom=NL,Bi.DoubleClickZoom=RL,Bi.Drag=AL,Bi.Keyboard=OL,Bi.ScrollWheelZoom=FL,Bi.TapHold=HL,Bi.TouchZoom=WL,t.Bounds=st,t.Browser=fe,t.CRS=Ii,t.Canvas=EL,t.Circle=Si,t.CircleMarker=Li,t.Class=ct,t.Control=Fs,t.DivIcon=kL,t.DivOverlay=Ki,t.DomEvent=ja,t.DomUtil=Ot,t.Draggable=Or,t.Evented=ei,t.FeatureGroup=O,t.GeoJSON=Qn,t.GridLayer=Yg,t.Handler=$o,t.Icon=be,t.ImageOverlay=oo,t.LatLng=Vt,t.LatLngBounds=ni,t.Layer=qo,t.LayerGroup=Nl,t.LineUtil=Gg,t.Map=Bi,t.Marker=Rt,t.Mixin=Xy,t.Path=bi,t.Point=qe,t.PolyUtil=Yy,t.Polygon=zn,t.Polyline=hn,t.Popup=Ms,t.PosAnimation=da,t.Projection=Jy,t.Rectangle=ML,t.Renderer=qa,t.SVG=Qg,t.SVGOverlay=Wh,t.TileLayer=zh,t.Tooltip=Al,t.Transformation=Mn,t.Util=Lt,t.VideoOverlay=Rl,t.bind=r,t.bounds=Mt,t.canvas=PL,t.circle=Qi,t.circleMarker=Ti,t.control=Ss,t.divIcon=KR,t.extend=n,t.featureGroup=oe,t.geoJSON=Ds,t.geoJson=$n,t.gridLayer=GR,t.icon=ae,t.imageOverlay=ha,t.latLng=ut,t.latLngBounds=ci,t.layerGroup=tw,t.map=Hc,t.marker=Pi,t.point=Ne,t.polygon=Zi,t.polyline=is,t.popup=Bh,t.rectangle=YR,t.setOptions=w,t.stamp=c,t.svg=TL,t.svgOverlay=iw,t.tileLayer=IL,t.tooltip=qR,t.transformation=Yi,t.version=i,t.videoOverlay=Xg;var QR=window.L;t.noConflict=function(){return window.L=QR,this},window.L=t}))})(Ef,Ef.exports)),Ef.exports}var DG=IG();const hf=IR(DG),EG="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=",PG="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==",TG="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC",vn=(o,e=by)=>{var t=MG(),i=x(C(t),2),n=C(i);G(()=>$(n,e())),T(o,t)};var MG=N('<span class="tip svelte-767znw"><span class="tip-icon svelte-767znw">ℹ</span> <span class="tip-box svelte-767znw"> </span></span>'),NG=N("<button> </button>"),RG=N('<span class="err svelte-767znw"> </span>'),AG=N('<span class="ok svelte-767znw"> </span>'),OG=N('<div class="loading svelte-767znw">Loading…</div>'),FG=N('<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>'),HG=N('<div class="field svelte-767znw"><label class="svelte-767znw">CA certificate <!></label> <textarea rows="4" placeholder="-----BEGIN CERTIFICATE----- … -----END CERTIFICATE-----" spellcheck="false" class="svelte-767znw"></textarea></div> <div class="field svelte-767znw"><label class="svelte-767znw">Client certificate <!></label> <textarea rows="4" placeholder="-----BEGIN CERTIFICATE----- … -----END CERTIFICATE-----" spellcheck="false" class="svelte-767znw"></textarea></div> <div class="field svelte-767znw"><label class="svelte-767znw">Client private key <!></label> <textarea rows="4" placeholder="-----BEGIN PRIVATE KEY----- … -----END PRIVATE KEY-----" spellcheck="false" class="svelte-767znw"></textarea></div>',1),WG=N('<section id="sec-mqtt" class="svelte-767znw"><h3 class="svelte-767znw">MQTT</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Protocol <!></label> <select class="svelte-767znw"><option>mqtt (plain TCP)</option><option>mqtts (TLS)</option><option>ws (WebSocket)</option><option>wss (WebSocket + TLS)</option></select></div> <div class="field svelte-767znw"><label class="svelte-767znw">Broker address <!></label> <input type="text" placeholder="localhost:1883" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">Username <!></label> <input type="text" placeholder="(optional)" autocomplete="off" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">Password <!></label> <input type="password" placeholder="(optional)" autocomplete="new-password" class="svelte-767znw"/></div> <!> <div class="field svelte-767znw"><label class="svelte-767znw">MQTT protocol version <!></label> <select class="svelte-767znw"><option>3.1.1 (default)</option><option>5.0</option></select></div> <div class="field svelte-767znw"><label class="svelte-767znw">Client name <!></label> <input type="text" placeholder="she" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">Variable prefix <!></label> <input type="text" placeholder="var" class="svelte-767znw"/></div> <div class="field field--check svelte-767znw"><span></span> <label class="check-label svelte-767znw"><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> Disable variable system <!></label></div></section>'),BG=N('<div class="field svelte-767znw"><label class="svelte-767znw"> <!></label> <input type="password" placeholder="Enter new password" autocomplete="new-password" class="svelte-767znw"/></div>'),zG=N('<div class="field svelte-767znw"><label class="svelte-767znw">Proxy user header <!></label> <input type="text" placeholder="X-Remote-User" class="svelte-767znw"/></div> <div class="field svelte-767znw"><label class="svelte-767znw">Logout URL <!></label> <input type="text" placeholder="https://auth.example.com/…/end-session/" class="svelte-767znw"/></div>',1),VG=N('<div class="field-error svelte-767znw"> </div>'),jG=N('<div class="field-ok svelte-767znw"> </div>'),UG=N('<section id="sec-auth" class="svelte-767znw"><h3 class="svelte-767znw">Authentication</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Mode <!></label> <select class="svelte-767znw"><option>None (open)</option><option>Password</option><option>Proxy header (nginx / authentik)</option></select></div> <!> <!> <!> <!> <div class="field svelte-767znw"><span></span> <button class="save-auth-btn svelte-767znw"> </button></div></section>'),$G=N('<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>'),KD=N("<option> </option>"),qG=N('<section id="sec-scripts" class="svelte-767znw"><h3 class="svelte-767znw">Scripts</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Timezone <!></label> <input type="text" list="tz-list" placeholder="(system default)" autocomplete="off" spellcheck="false" class="svelte-767znw"/> <datalist id="tz-list"></datalist></div> <div class="field svelte-767znw"><label class="svelte-767znw">Scripts directory <!></label> <input type="text" class="svelte-767znw"/></div> <div class="field field--check svelte-767znw"><span></span> <label class="check-label svelte-767znw"><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> Disable file watching <!></label></div></section>'),KG=N('<section id="sec-git" class="svelte-767znw"><h3 class="svelte-767znw">Git</h3> <div class="field field--check svelte-767znw"><span></span> <label class="check-label svelte-767znw"><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> Auto-commit on save <!></label></div> <div class="field field--check svelte-767znw"><span></span> <label class="check-label svelte-767znw"><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> Auto-push after commit <!></label></div></section>'),GG=N('<div class="field svelte-767znw"><div class="map-label svelte-767znw">Map <span class="map-note svelte-767znw">(click or drag marker to set location — requires internet for tiles)</span></div> <div class="map-container svelte-767znw"></div></div>'),ZG=N('<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"><span></span> <div class="geo-btns svelte-767znw"><button class="geo-btn svelte-767znw"><!></button> <button class="geo-btn svelte-767znw"> </button></div></div> <!></section>'),XG=N('<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>'),YG=N('<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>'),JG=N('<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" 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>'),QG=N('<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>'),e9=N('<span class="free-badge svelte-767znw">FREE</span> ',1),t9=N('&nbsp;— <a target="_blank" rel="noreferrer" class="svelte-767znw">Get API key ↗</a>',1),i9=N("<div><!> <!></div>"),n9=N('<div class="field svelte-767znw"><label class="svelte-767znw">Base URL <!></label> <input type="text" class="svelte-767znw"/></div>'),s9=N('<div class="field svelte-767znw"><label class="svelte-767znw">API key <!></label> <input type="password" placeholder="sk-…" autocomplete="off" class="svelte-767znw"/></div>'),o9=N('<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>'),r9=N('<div class="config-form svelte-767znw"><!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!></div>'),a9=N('<!> <div class="config-root svelte-767znw"><aside class="config-sidebar svelte-767znw"><div class="sidebar-search svelte-767znw"><svg class="search-icon svelte-767znw" width="13" height="13" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><circle cx="6.5" cy="6.5" r="4.5"></circle><line x1="10" y1="10" x2="14" y2="14"></line></svg> <input class="search-input svelte-767znw" type="search" placeholder="Filter settings…" autocomplete="off" spellcheck="false"/></div> <nav class="section-nav svelte-767znw"></nav></aside> <div class="config-main svelte-767znw"><div class="config-topbar svelte-767znw"><span class="topbar-title svelte-767znw">Settings</span> <!> <!> <button class="save-btn svelte-767znw"> </button></div> <!></div></div>',1);function l9(o,e){Vo(e,!0),delete hf.Icon.Default.prototype._getIconUrl,hf.Icon.Default.mergeOptions({iconUrl:EG,iconRetinaUrl:PG,shadowUrl:TG});let t=W(mi(xG())),i=W("~/.she"),n=W("mqtt"),s=W(""),r=W(""),a=W(""),c=W(""),h=W(""),g=W(""),f=W("logic"),p=W("var"),v=W(""),_=W(!1),w=W(8080),S=W(""),D=W("none"),E=W(""),R=W("X-Remote-User"),z=W(""),H=W(!1),ee=W(""),X=W(""),me=W(""),Le=W(!1),je=W(!1),Ce=W(!1),mt=W(""),Lt=W(48.7408),ct=W(9.1778),li=W(!1),zt=W(void 0),ei=W(!1),qe=W(null),Ye=W("info"),Ne=W(""),st=W(""),Mt=W(!1),ni=W(!1),ci=W("");const Vt=[{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 ut=W("ollama"),Ii=W("ollama"),fi=W(""),tn=W(""),Fi=W("");const Mn={};let Yi="ollama";function Ji(q,re){return q==="anthropic"?"anthropic":q==="ollama"?"ollama":re?re.includes("localhost:1234")?"lmstudio":re.includes("groq.com")?"groq":re.includes("googleapis.com")?"gemini":"openai":"openai"}function Fn(){Mn[Yi]={baseUrl:u(fi),model:u(tn),apiKey:u(Fi)};const q=Vt.find(ue=>ue.id===u(ut));if(!q)return;k(Ii,q.provider,!0);const re=Mn[u(ut)];k(fi,(re==null?void 0:re.baseUrl)??q.baseUrl,!0),k(tn,(re==null?void 0:re.model)??q.defaultModel,!0),k(Fi,(re==null?void 0:re.apiKey)??"",!0),Yi=u(ut)}const Ai=ot(()=>Vt.find(q=>q.id===u(ut)));let Nn=W(mi({}));const nn=new Set(["url","name","variablePrefix","disableVariables","mqttUsername","mqttPassword","mqttCa","mqttCert","mqttKey","mqttVersion","port","bindAddress","auth","password","proxyHeader","proxyLogoutUrl","dir","disableWatch","gitAutoCommit","gitAutoPush","latitude","longitude","timezone","verbosity","dbPath","dbPrefix","dbPublish","dbRetain","redis","ai"]);An(()=>{if(!u(zt))return;const q=typeof u(Lt)=="number"?u(Lt):48.7408,re=typeof u(ct)=="number"?u(ct):9.1778,ue=hf.map(u(zt)).setView([q,re],10);hf.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'}).addTo(ue);const tt=hf.marker([q,re],{draggable:!0}).addTo(ue);k(qe,tt,!0);const Ht=bt=>{k(Lt,+bt.lat.toFixed(6)),k(ct,+bt.lng.toFixed(6))};return tt.on("dragend",()=>Ht(tt.getLatLng())),ue.on("click",bt=>{tt.setLatLng(bt.latlng),Ht(bt.latlng)}),()=>{k(qe,null),ue.remove()}}),An(()=>{!u(qe)||u(Lt)===""||u(ct)===""||u(qe).setLatLng([Number(u(Lt)),Number(u(ct))])});let Hi;function Rn(){if(!navigator.geolocation){Hi.show("Geolocation is not supported by this browser.",{alert:!0});return}k(ei,!0),navigator.geolocation.getCurrentPosition(q=>{k(Lt,+q.coords.latitude.toFixed(6)),k(ct,+q.coords.longitude.toFixed(6)),k(ei,!1)},()=>{k(ei,!1)})}let Un=W(!0),Hn=W(!1),Wn=W(""),dn=W(""),sn=W(""),ts=W("appearance");const Ke=[{id:"appearance",label:"Appearance",terms:["theme","color","dark","light"]},{id:"auth",label:"Authentication",terms:["auth","password","login","proxy","header","nginx","authentik","secure"]},{id:"mqtt",label:"MQTT",terms:["broker","url","client","name","variable","prefix","protocol","version","mqtt5"]},{id:"webserver",label:"Web server",terms:["port","http","server","bind","address"]},{id:"scripts",label:"Scripts",terms:["directory","watch","hot reload","dir","timezone","time zone","iana","schedule"]},{id:"git",label:"Git",terms:["git","auto commit","auto push","commit","push","repository"]},{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 _t=ot(()=>Ke.filter(q=>{const re=u(sn).trim().toLowerCase();return!re||q.label.toLowerCase().includes(re)||q.terms.some(ue=>ue.includes(re))}));function ri(q){var re;k(ts,q,!0),(re=document.getElementById("sec-"+q))==null||re.scrollIntoView({behavior:"smooth",block:"start"})}Mr(async()=>{try{const q=await If();q.dataDir&&k(i,q.dataDir,!0)}catch{}try{const q=await dL();if(typeof q.url=="string"&&q.url)try{const tt=new URL(q.url);k(n,tt.protocol.replace(":",""),!0),k(s,tt.host,!0)}catch{k(s,q.url,!0)}typeof q.mqttUsername=="string"&&k(r,q.mqttUsername,!0),typeof q.mqttPassword=="string"&&k(a,q.mqttPassword,!0),typeof q.mqttCa=="string"&&k(c,q.mqttCa,!0),typeof q.mqttCert=="string"&&k(h,q.mqttCert,!0),typeof q.mqttKey=="string"&&k(g,q.mqttKey,!0),typeof q.mqttVersion=="string"&&k(v,q.mqttVersion,!0),typeof q.name=="string"&&k(f,q.name,!0),typeof q.variablePrefix=="string"&&k(p,q.variablePrefix,!0),typeof q.disableVariables=="boolean"&&k(_,q.disableVariables,!0),typeof q.port=="number"&&k(w,q.port,!0),typeof q.bindAddress=="string"&&k(S,q.bindAddress,!0),typeof q.auth=="string"&&k(D,q.auth,!0),typeof q.proxyHeader=="string"&&k(R,q.proxyHeader,!0),typeof q.proxyLogoutUrl=="string"&&k(z,q.proxyLogoutUrl,!0),typeof q.dir=="string"&&k(me,q.dir,!0),typeof q.disableWatch=="boolean"&&k(Le,q.disableWatch,!0),typeof q.gitAutoCommit=="boolean"&&k(je,q.gitAutoCommit,!0),typeof q.gitAutoPush=="boolean"&&k(Ce,q.gitAutoPush,!0),typeof q.latitude=="number"&&k(Lt,q.latitude,!0),typeof q.longitude=="number"&&k(ct,q.longitude,!0),typeof q.timezone=="string"&&k(mt,q.timezone,!0),typeof q.verbosity=="string"&&k(Ye,q.verbosity,!0),typeof q.dbPath=="string"&&k(Ne,q.dbPath,!0),typeof q.dbPrefix=="string"&&k(st,q.dbPrefix,!0),typeof q.dbPublish=="boolean"&&k(Mt,q.dbPublish,!0),typeof q.dbRetain=="boolean"&&k(ni,q.dbRetain,!0);const re=q.redis;re!=null&&re.url&&k(ci,re.url,!0);const ue=q.ai;ue!=null&&ue.provider&&k(Ii,ue.provider,!0),ue!=null&&ue.baseUrl&&k(fi,ue.baseUrl,!0),ue!=null&&ue.model&&k(tn,ue.model,!0),ue!=null&&ue.apiKey&&k(Fi,ue.apiKey,!0),k(ut,Ji(u(Ii),u(fi)),!0),Yi=u(ut),k(Nn,Object.fromEntries(Object.entries(q).filter(([tt])=>!nn.has(tt))),!0)}catch(q){k(dn,q.message,!0)}finally{k(Un,!1)}});async function Di(){if(k(X,""),k(ee,""),u(D)==="password"&&!u(E)){k(X,"A password is required to enable password authentication.");return}k(H,!0);try{await Z8(u(D),u(D)==="password"?u(E):void 0,u(D)==="proxy"?u(R):void 0,u(D)==="proxy"?u(z):void 0),k(E,""),k(ee,"Authentication settings saved.")}catch(q){k(X,q.message,!0)}finally{k(H,!1)}}async function wi(){k(dn,""),k(Wn,"");const q={...u(Nn)};u(s)&&(q.url=`${u(n)}://${u(s)}`),q.name=u(f),q.variablePrefix=u(p),u(v)&&(q.mqttVersion=u(v)),u(_)&&(q.disableVariables=!0),u(r)&&(q.mqttUsername=u(r)),u(a)&&(q.mqttPassword=u(a)),u(c)&&(q.mqttCa=u(c)),u(h)&&(q.mqttCert=u(h)),u(g)&&(q.mqttKey=u(g)),u(w)!==""&&(q.port=Number(u(w))),u(S)&&(q.bindAddress=u(S)),u(me)&&(q.dir=u(me)),u(Le)&&(q.disableWatch=!0),u(je)&&(q.gitAutoCommit=!0),u(Ce)&&(q.gitAutoPush=!0),u(Lt)!==""&&(q.latitude=Number(u(Lt))),u(ct)!==""&&(q.longitude=Number(u(ct))),u(mt)&&(q.timezone=u(mt)),q.verbosity=u(Ye),u(Ne)&&(q.dbPath=u(Ne),u(st)&&(q.dbPrefix=u(st)),u(Mt)&&(q.dbPublish=!0,u(ni)&&(q.dbRetain=!0))),u(ci)&&(q.redis={url:u(ci)}),u(Ii)&&(q.ai={provider:u(Ii),...u(fi)?{baseUrl:u(fi)}:{},...u(tn)?{model:u(tn)}:{},...u(Fi)?{apiKey:u(Fi)}:{}}),k(Hn,!0);try{const re=await o7(q);window.dispatchEvent(new CustomEvent("she:config-changed")),k(Wn,re.restartRequired?"Saved — restart required to apply changes.":"Saved.",!0)}catch(re){k(dn,re.message,!0)}finally{k(Hn,!1)}}var gn=a9(),_n=wt(gn);Ls(Vg(_n,{}),q=>Hi=q,()=>Hi);var Bn=x(_n,2),Cn=C(Bn),Zn=C(Cn),Xn=x(C(Zn),2),xn=x(Zn,2);di(xn,21,()=>Ke,q=>q.id,(q,re)=>{var ue=js(),tt=wt(ue);{var Ht=fe=>{var dt=NG();let jt;var Bt=C(dt);G(()=>{jt=Zt(dt,1,"section-link svelte-767znw",null,jt,{active:u(ts)===u(re).id}),$(Bt,u(re).label)}),Q("click",dt,()=>ri(u(re).id)),T(fe,dt)},bt=ot(()=>u(_t).some(fe=>fe.id===u(re).id));U(tt,fe=>{u(bt)&&fe(Ht)})}T(q,ue)});var Ue=x(Cn,2),Z=C(Ue),Fe=x(C(Z),2);{var vt=q=>{var re=RG(),ue=C(re);G(()=>$(ue,u(dn))),T(q,re)};U(Fe,q=>{u(dn)&&q(vt)})}var Ct=x(Fe,2);{var qt=q=>{var re=AG(),ue=C(re);G(()=>$(ue,u(Wn))),T(q,re)};U(Ct,q=>{u(Wn)&&q(qt)})}var A=x(Ct,2),ie=C(A),ve=x(Z,2);{var Ze=q=>{var re=OG();T(q,re)},gt=q=>{var re=r9(),ue=C(re);{var tt=ge=>{var xe=FG(),ft=x(C(xe),2),Ee=x(C(ft),2),at=C(Ee);at.value=at.__value="dark";var Kt=x(at);Kt.value=Kt.__value="light";var V=x(Kt);V.value=V.__value="system",Q("change",Ee,()=>LG(u(t))),qr(Ee,()=>u(t),Y=>k(t,Y)),T(ge,xe)},Ht=ot(()=>u(_t).some(ge=>ge.id==="appearance"));U(ue,ge=>{u(Ht)&&ge(tt)})}var bt=x(ue,2);{var fe=ge=>{var xe=WG(),ft=x(C(xe),2),Ee=C(ft),at=x(C(Ee));vn(at,()=>"Transport protocol. Use mqtts or wss for TLS encryption.");var Kt=x(Ee,2),V=C(Kt);V.value=V.__value="mqtt";var Y=x(V);Y.value=Y.__value="mqtts";var Pe=x(Y);Pe.value=Pe.__value="ws";var We=x(Pe);We.value=We.__value="wss";var Ie=x(ft,2),ke=C(Ie),xt=x(C(ke));vn(xt,()=>"Hostname and optional port of the MQTT broker. Example: 192.168.1.1:1883. Leave empty to run without MQTT.");var Qe=x(ke,2),Te=x(Ie,2),ht=C(Te),Ae=x(C(ht));vn(Ae,()=>"MQTT broker username. Leave empty if the broker does not require authentication.");var _e=x(ht,2),we=x(Te,2),ye=C(we),pe=x(C(ye));vn(pe,()=>"MQTT broker password. Stored in plain text in config.json.");var nt=x(ye,2),ce=x(we,2);{var He=Yn=>{var ja=HG(),da=wt(ja),Bi=C(da),Hc=x(C(Bi));vn(Hc,()=>"PEM-encoded CA certificate to verify the broker's TLS certificate. Leave empty to use the system's default CA store.");var Fs=x(Bi,2),Ss=x(da,2),Hs=C(Ss),Rr=x(C(Hs));vn(Rr,()=>"PEM-encoded client certificate for mutual TLS authentication.");var Ua=x(Hs,2),Tl=x(Ss,2),$a=C(Tl),Uo=x(C($a));vn(Uo,()=>"PEM-encoded private key matching the client certificate.");var Ar=x($a,2);Ci(Fs,()=>u(c),Io=>k(c,Io)),Ci(Ua,()=>u(h),Io=>k(h,Io)),Ci(Ar,()=>u(g),Io=>k(g,Io)),T(Yn,ja)};U(ce,Yn=>{(u(n)==="mqtts"||u(n)==="wss")&&Yn(He)})}var rt=x(ce,2),Ot=C(rt),et=x(C(Ot));vn(et,()=>"MQTT protocol version used when connecting to the broker. Choose 5 only if your broker supports MQTT 5.0. Default: 3.1.1 (mqtt.js default).");var Ut=x(Ot,2),Gt=C(Ut);Gt.value=Gt.__value="";var Ln=x(Gt);Ln.value=Ln.__value="5";var Wi=x(rt,2),kn=C(Wi),qn=x(C(kn));vn(qn,()=>'MQTT client ID and topic prefix used for the "connected" status message. Default: she');var pi=x(kn,2),$t=x(Wi,2),qi=C($t),Ei=x(C(qi));vn(Ei,()=>"Topic prefix for the variable system (var/set/name → var/status/name). Default: var");var us=x(qi,2),io=x($t,2),sr=x(C(io),2),Nr=C(sr),or=x(Nr,4);vn(or,()=>"When enabled, var/set/… messages are not processed and no var/status/… retained messages are published."),qr(Kt,()=>u(n),Yn=>k(n,Yn)),Ci(Qe,()=>u(s),Yn=>k(s,Yn)),Ci(_e,()=>u(r),Yn=>k(r,Yn)),Ci(nt,()=>u(a),Yn=>k(a,Yn)),qr(Ut,()=>u(v),Yn=>k(v,Yn)),Ci(pi,()=>u(f),Yn=>k(f,Yn)),Ci(us,()=>u(p),Yn=>k(p,Yn)),zs(Nr,()=>u(_),Yn=>k(_,Yn)),T(ge,xe)},dt=ot(()=>u(_t).some(ge=>ge.id==="mqtt"));U(bt,ge=>{u(dt)&&ge(fe)})}var jt=x(bt,2);{var Bt=ge=>{var xe=UG(),ft=x(C(xe),2),Ee=C(ft),at=x(C(Ee));vn(at,()=>"none: no authentication required. password: single-user password login. proxy: trust a header set by nginx/authentik.");var Kt=x(Ee,2),V=C(Kt);V.value=V.__value="none";var Y=x(V);Y.value=Y.__value="password";var Pe=x(Y);Pe.value=Pe.__value="proxy";var We=x(ft,2);{var Ie=pe=>{var nt=BG(),ce=C(nt),He=C(ce),rt=x(He);vn(rt,()=>"Set a new password. Leave empty to keep the current password (if already set).");var Ot=x(ce,2);G(()=>$(He,`${u(E)?"New password":"Password"} `)),Ci(Ot,()=>u(E),et=>k(E,et)),T(pe,nt)};U(We,pe=>{u(D)==="password"&&pe(Ie)})}var ke=x(We,2);{var xt=pe=>{var nt=zG(),ce=wt(nt),He=C(ce),rt=x(C(He));vn(rt,()=>"The HTTP header that nginx/authentik sets after successful authentication. Default: X-Remote-User");var Ot=x(He,2),et=x(ce,2),Ut=C(et),Gt=x(C(Ut));vn(Gt,()=>"URL to redirect to when the user clicks Logout (e.g. https://auth.example.com/application/o/she/end-session/ for Authentik). Leave empty to do nothing on logout.");var Ln=x(Ut,2);Ci(Ot,()=>u(R),Wi=>k(R,Wi)),Ci(Ln,()=>u(z),Wi=>k(z,Wi)),T(pe,nt)};U(ke,pe=>{u(D)==="proxy"&&pe(xt)})}var Qe=x(ke,2);{var Te=pe=>{var nt=VG(),ce=C(nt);G(()=>$(ce,u(X))),T(pe,nt)};U(Qe,pe=>{u(X)&&pe(Te)})}var ht=x(Qe,2);{var Ae=pe=>{var nt=jG(),ce=C(nt);G(()=>$(ce,u(ee))),T(pe,nt)};U(ht,pe=>{u(ee)&&pe(Ae)})}var _e=x(ht,2),we=x(C(_e),2),ye=C(we);G(()=>{we.disabled=u(H)||u(D)==="password"&&!u(E),$(ye,u(H)?"Saving…":"Apply authentication settings")}),qr(Kt,()=>u(D),pe=>k(D,pe)),Q("click",we,Di),T(ge,xe)},oi=ot(()=>u(_t).some(ge=>ge.id==="auth"));U(jt,ge=>{u(oi)&&ge(Bt)})}var ti=x(jt,2);{var J=ge=>{var xe=$G(),ft=x(C(xe),2),Ee=C(ft),at=x(C(Ee));vn(at,()=>"HTTP server port. Use 0 to let the OS pick a free port. Default: 8080");var Kt=x(Ee,2),V=x(ft,2),Y=C(V),Pe=x(C(Y));vn(Pe,()=>"Interface she listens on. Use 127.0.0.1 when running behind nginx (recommended with proxy auth). Default: 0.0.0.0");var We=x(Y,2);Ci(Kt,()=>u(w),Ie=>k(w,Ie)),Ci(We,()=>u(S),Ie=>k(S,Ie)),T(ge,xe)},he=ot(()=>u(_t).some(ge=>ge.id==="webserver"));U(ti,ge=>{u(he)&&ge(J)})}var Oe=x(ti,2);{var it=ge=>{var xe=qG(),ft=x(C(xe),2),Ee=C(ft),at=x(C(Ee));vn(at,()=>"IANA timezone for cron scheduling (e.g. Europe/Berlin). Leave empty to use the system timezone. Requires daemon restart.");var Kt=x(Ee,2),V=x(Kt,2);di(V,20,()=>{var ht;return((ht=Intl.supportedValuesOf)==null?void 0:ht.call(Intl,"timeZone"))??[]},Dn,(ht,Ae)=>{var _e=KD(),we=C(_e),ye={};G(()=>{$(we,Ae),ye!==(ye=Ae)&&(_e.value=(_e.__value=Ae)??"")}),T(ht,_e)});var Y=x(ft,2),Pe=C(Y),We=x(C(Pe));vn(We,()=>"Directory that is watched for .js script files. Defaults to {dataDir}/scripts");var Ie=x(Pe,2),ke=x(Y,2),xt=x(C(ke),2),Qe=C(xt),Te=x(Qe,4);vn(Te,()=>"When enabled the daemon will not watch for file changes and will not hot-reload scripts."),G(()=>pn(Ie,"placeholder",`${u(i)??""}/scripts (default)`)),Ci(Kt,()=>u(mt),ht=>k(mt,ht)),Ci(Ie,()=>u(me),ht=>k(me,ht)),zs(Qe,()=>u(Le),ht=>k(Le,ht)),T(ge,xe)},It=ot(()=>u(_t).some(ge=>ge.id==="scripts"));U(Oe,ge=>{u(It)&&ge(it)})}var Je=x(Oe,2);{var Nt=ge=>{var xe=KG(),ft=x(C(xe),2),Ee=x(C(ft),2),at=C(Ee),Kt=x(at,4);vn(Kt,()=>"When enabled, saving or renaming/deleting a script automatically creates a git commit. Only effective when the scripts directory is inside a git repository.");var V=x(ft,2),Y=x(C(V),2),Pe=C(Y),We=x(Pe,4);vn(We,()=>"When enabled, every commit (manual or automatic) is immediately pushed to the remote."),zs(at,()=>u(je),Ie=>k(je,Ie)),zs(Pe,()=>u(Ce),Ie=>k(Ce,Ie)),T(ge,xe)},ii=ot(()=>u(_t).some(ge=>ge.id==="git"));U(Je,ge=>{u(ii)&&ge(Nt)})}var Wt=x(Je,2);{var At=ge=>{var xe=ZG(),ft=x(C(xe),2),Ee=C(ft),at=x(C(Ee));vn(at,()=>"Geographic latitude used for sunrise/sunset calculations. Default: 48.7408 (Stuttgart)");var Kt=x(Ee,2),V=x(ft,2),Y=C(V),Pe=x(C(Y));vn(Pe,()=>"Geographic longitude used for sunrise/sunset calculations. Default: 9.1778 (Stuttgart)");var We=x(Y,2),Ie=x(V,2),ke=x(C(Ie),2),xt=C(ke),Qe=C(xt);{var Te=pe=>{var nt=ta("…");T(pe,nt)},ht=pe=>{var nt=ta("📍 Use my location");T(pe,nt)};U(Qe,pe=>{u(ei)?pe(Te):pe(ht,-1)})}var Ae=x(xt,2),_e=C(Ae),we=x(Ie,2);{var ye=pe=>{var nt=GG(),ce=x(C(nt),2);Ls(ce,He=>k(zt,He),()=>u(zt)),T(pe,nt)};U(we,pe=>{u(li)&&pe(ye)})}G(()=>{xt.disabled=u(ei),$(_e,u(li)?"Hide map":"Pick on map")}),Ci(Kt,()=>u(Lt),pe=>k(Lt,pe)),Ci(We,()=>u(ct),pe=>k(ct,pe)),Q("click",xt,Rn),Q("click",Ae,()=>k(li,!u(li))),T(ge,xe)},zi=ot(()=>u(_t).some(ge=>ge.id==="solar"));U(Wt,ge=>{u(zi)&&ge(At)})}var on=x(Wt,2);{var Oi=ge=>{var xe=XG(),ft=x(C(xe),2),Ee=C(ft),at=x(C(Ee));vn(at,()=>"Minimum log level. debug shows all messages including MQTT traffic details.");var Kt=x(Ee,2),V=C(Kt);V.value=V.__value="debug";var Y=x(V);Y.value=Y.__value="info";var Pe=x(Y);Pe.value=Pe.__value="warn";var We=x(Pe);We.value=We.__value="error",qr(Kt,()=>u(Ye),Ie=>k(Ye,Ie)),T(ge,xe)},si=ot(()=>u(_t).some(ge=>ge.id==="logging"));U(on,ge=>{u(si)&&ge(Oi)})}var Vi=x(on,2);{var F=ge=>{var xe=JG(),ft=x(C(xe),2),Ee=C(ft),at=x(C(Ee));vn(at,()=>"Path to the sheDB data directory. Defaults to {dataDir}/db. Leave empty to disable sheDB.");var Kt=x(Ee,2),V=x(ft,2),Y=C(V),Pe=x(C(Y));vn(Pe,()=>"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 We=x(Y,2),Ie=x(V,2),ke=x(C(Ie),2);let xt;var Qe=C(ke),Te=x(Qe,4);vn(Te,()=>'When enabled, every document change is published to {dbPrefix}doc/{id}. Individual views can publish independently via their own "mqttpub" setting.');var ht=x(Ie,2);{var Ae=_e=>{var we=YG(),ye=x(C(we),2);let pe;var nt=C(ye),ce=x(nt,4);vn(ce,()=>"When enabled, MQTT messages for document changes are published as retained messages."),G(()=>{pe=Zt(ye,1,"check-label svelte-767znw",null,pe,{muted:!u(Ne)}),nt.disabled=!u(Ne)}),zs(nt,()=>u(ni),He=>k(ni,He)),T(_e,we)};U(ht,_e=>{u(Mt)&&_e(Ae)})}G(()=>{pn(Kt,"placeholder",`defaults to ${u(i)??""}/db`),We.disabled=!u(Ne),xt=Zt(ke,1,"check-label svelte-767znw",null,xt,{muted:!u(Ne)}),Qe.disabled=!u(Ne)}),Ci(Kt,()=>u(Ne),_e=>k(Ne,_e)),Ci(We,()=>u(st),_e=>k(st,_e)),zs(Qe,()=>u(Mt),_e=>k(Mt,_e)),T(ge,xe)},K=ot(()=>u(_t).some(ge=>ge.id==="shedb"));U(Vi,ge=>{u(K)&&ge(F)})}var De=x(Vi,2);{var Re=ge=>{var xe=QG(),ft=x(C(xe),2),Ee=C(ft),at=x(C(Ee));vn(at,()=>"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 Kt=x(Ee,2);Ci(Kt,()=>u(ci),V=>k(ci,V)),T(ge,xe)},$e=ot(()=>u(_t).some(ge=>ge.id==="redis"));U(De,ge=>{u($e)&&ge(Re)})}var Me=x(De,2);{var Ge=ge=>{var xe=o9(),ft=x(C(xe),2),Ee=C(ft),at=x(C(Ee));vn(at,()=>"Choose a provider. Free options need a free API key from the provider's website — no credit card required.");var Kt=x(Ee,2);di(Kt,21,()=>Vt,Dn,(Ae,_e)=>{var we=KD(),ye=C(we),pe={};G(()=>{$(ye,u(_e).label),pe!==(pe=u(_e).id)&&(we.value=(we.__value=u(_e).id)??"")}),T(Ae,we)});var V=x(ft,2);{var Y=Ae=>{var _e=i9();let we;var ye=C(_e);{var pe=He=>{var rt=e9(),Ot=x(wt(rt));G(()=>$(Ot,` ${u(Ai).freeNote??""}`)),T(He,rt)};U(ye,He=>{u(Ai).freeNote&&He(pe)})}var nt=x(ye,2);{var ce=He=>{var rt=t9(),Ot=x(wt(rt));G(()=>pn(Ot,"href",u(Ai).apiKeyUrl)),T(He,rt)};U(nt,He=>{u(Ai).apiKeyUrl&&He(ce)})}G(()=>we=Zt(_e,1,"preset-note svelte-767znw",null,we,{free:!!u(Ai).freeNote})),T(Ae,_e)};U(V,Ae=>{var _e,we;((_e=u(Ai))!=null&&_e.freeNote||(we=u(Ai))!=null&&we.apiKeyUrl)&&Ae(Y)})}var Pe=x(V,2);{var We=Ae=>{var _e=n9(),we=C(_e),ye=x(C(we));vn(ye,()=>"Base URL of the LLM API. Auto-filled for cloud presets. For Ollama: http://localhost:11434.");var pe=x(we,2);G(()=>{var nt;return pn(pe,"placeholder",u(ut)==="ollama"?"http://localhost:11434":u(ut)==="lmstudio"?"http://localhost:1234":((nt=u(Ai))==null?void 0:nt.baseUrl)??"")}),Ci(pe,()=>u(fi),nt=>k(fi,nt)),T(Ae,_e)};U(Pe,Ae=>{u(ut)!=="anthropic"&&Ae(We)})}var Ie=x(Pe,2),ke=C(Ie),xt=x(C(ke));vn(xt,()=>"Model identifier. Suggested default is filled in when you choose a preset.");var Qe=x(ke,2),Te=x(Ie,2);{var ht=Ae=>{var _e=s9(),we=C(_e),ye=x(C(we));vn(ye,()=>"Stored in config.json. Not needed for local providers.");var pe=x(we,2);Ci(pe,()=>u(Fi),nt=>k(Fi,nt)),T(Ae,_e)};U(Te,Ae=>{u(ut)!=="ollama"&&u(ut)!=="lmstudio"&&Ae(ht)})}G(()=>{var Ae;return pn(Qe,"placeholder",((Ae=u(Ai))==null?void 0:Ae.defaultModel)||"e.g. llama3.2")}),Q("change",Kt,Fn),qr(Kt,()=>u(ut),Ae=>k(ut,Ae)),Ci(Qe,()=>u(tn),Ae=>k(tn,Ae)),T(ge,xe)},Yt=ot(()=>u(_t).some(ge=>ge.id==="ai"));U(Me,ge=>{u(Yt)&&ge(Ge)})}T(q,re)};U(ve,q=>{u(Un)?q(Ze):q(gt,-1)})}G(()=>{A.disabled=u(Hn),$(ie,u(Hn)?"Saving…":"Save")}),Ci(Xn,()=>u(sn),q=>k(sn,q)),Q("click",A,wi),T(o,gn),jo()}Tr(["click","change"]);var c9=N("<option> </option>"),d9=N('<div><span class="ts svelte-18loop9"> </span> <span class="lvl svelte-18loop9"> </span> <span class="msg svelte-18loop9"> </span></div>'),h9=N('<div class="page svelte-18loop9"><div class="toolbar svelte-18loop9"><h2 class="svelte-18loop9">Logs</h2> <select class="svelte-18loop9"></select> <input class="filter-in svelte-18loop9" type="search" placeholder="Filter messages…"/> <label class="check-label svelte-18loop9" title="Interpret filter as a regular expression"><input type="checkbox" class="svelte-18loop9"/> <span class="checkmark svelte-18loop9"></span> Regex</label> <label class="check-label svelte-18loop9"><input type="checkbox" class="svelte-18loop9"/> <span class="checkmark svelte-18loop9"></span> Auto-scroll</label> <button class="svelte-18loop9">Clear</button></div> <div class="log svelte-18loop9"></div></div>');function u9(o,e){Vo(e,!0);let t=W(mi(x7())),i,n=W(!0),s=W("all"),r=W(""),a=W(!1);const c=["all","debug","info","warn","error"],h={debug:0,info:1,warn:2,error:3};kR(X=>{k(t,[...u(t).slice(-1999),X],!0)}),Mr(()=>{i&&(i.scrollTop=i.scrollHeight)}),An(()=>{u(t).length,u(n)&&i&&(i.scrollTop=i.scrollHeight)});function g(){k(t,[],!0)}function f(X){if(u(s)!=="all"&&h[X.level]<h[u(s)])return!1;if(!u(r))return!0;if(u(a))try{return new RegExp(u(r),"i").test(X.msg)}catch{}return X.msg.toLowerCase().includes(u(r).toLowerCase())}function p(X){return new Date(X).toLocaleTimeString()}var v=h9(),_=C(v),w=x(C(_),2);di(w,21,()=>c,Dn,(X,me)=>{var Le=c9(),je=C(Le),Ce={};G(()=>{$(je,u(me)),Ce!==(Ce=u(me))&&(Le.value=(Le.__value=u(me))??"")}),T(X,Le)});var S=x(w,2),D=x(S,2),E=C(D),R=x(D,2),z=C(R),H=x(R,2),ee=x(_,2);di(ee,21,()=>u(t).filter(f),X=>X.ts+X.msg,(X,me)=>{var Le=d9(),je=C(Le),Ce=C(je),mt=x(je,2),Lt=C(mt),ct=x(mt,2),li=C(ct);G((zt,ei)=>{Zt(Le,1,`line ${u(me).level??""}`,"svelte-18loop9"),$(Ce,zt),$(Lt,ei),$(li,u(me).msg)},[()=>p(u(me).ts),()=>u(me).level.toUpperCase()]),T(X,Le)}),Ls(ee,X=>i=X,()=>i),qr(w,()=>u(s),X=>k(s,X)),Ci(S,()=>u(r),X=>k(r,X)),zs(E,()=>u(a),X=>k(a,X)),zs(z,()=>u(n),X=>k(n,X)),Q("click",H,g),T(o,v),jo()}Tr(["click"]);var g9=N('<span class="chat-model svelte-1twuiul"><!></span>'),f9=N('<button class="clear-btn svelte-1twuiul" title="Clear conversation">✕</button>'),p9=N('<div class="unconfigured svelte-1twuiul">Configure an AI provider in the <strong class="svelte-1twuiul">Config</strong> tab to use the AI assistant.</div>'),m9=N('Working on view <code class="svelte-1twuiul"> </code>',1),_9=N('<button class="chip svelte-1twuiul"> </button>'),v9=N('<div class="suggestions svelte-1twuiul"><p class="suggestions-hint svelte-1twuiul"><!></p> <!></div>'),b9=N('<div class="msg-content user-text svelte-1twuiul"> </div>'),GD=N('<div class="tool-event tool-call svelte-1twuiul"><span class="tool-icon svelte-1twuiul">🔧</span><span class="tool-name svelte-1twuiul"> </span></div>'),ZD=N('<div class="tool-event tool-result svelte-1twuiul"><span class="tool-icon svelte-1twuiul">✓</span><span class="tool-name svelte-1twuiul"> </span></div>'),XD=N('<div class="tool-events svelte-1twuiul"></div>'),YD=N('<div class="text-block svelte-1twuiul"></div>'),y9=N('<button class="expand-btn svelte-1twuiul"> </button>'),w9=N('<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>'),S9=N('<div class="apply-view-row svelte-1twuiul"><button class="apply-view-btn svelte-1twuiul"> </button></div>'),C9=N('<!> <div class="msg-content svelte-1twuiul"><!> <!></div>',1),x9=N("<div><!></div>"),L9=N('<div class="message assistant svelte-1twuiul"><div class="msg-content svelte-1twuiul"><span class="status-shimmer svelte-1twuiul"> </span></div></div>'),k9=N('<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>'),I9=N('<div class="message assistant streaming svelte-1twuiul"><div class="msg-content svelte-1twuiul"></div></div>'),D9=N('<div class="chat-error svelte-1twuiul"> </div>'),E9=N('<span><span class="badge badge-db svelte-1twuiul">db</span> <span class="chip-name svelte-1twuiul"> </span> <button class="chip-remove svelte-1twuiul"> </button></span>'),P9=N('<span class="file-chip svelte-1twuiul"><span> </span> <span class="chip-name svelte-1twuiul"> </span> <button class="chip-remove svelte-1twuiul" title="Remove from context">×</button></span>'),T9=N('<button class="stop-btn svelte-1twuiul" title="Stop generation">■</button>'),M9=N('<button class="send-btn svelte-1twuiul">↑</button>'),N9=N('<option class="svelte-1twuiul"> </option>'),R9=N('<select class="model-select svelte-1twuiul"></select>'),A9=N('<span class="model-name svelte-1twuiul"> </span>'),O9=N('<button class="info-btn svelte-1twuiul" title="Model info">ℹ</button>'),F9=N('<div class="model-bar svelte-1twuiul"><span class="model-provider svelte-1twuiul"> </span> <!> <!></div>'),H9=N('<p class="info-status svelte-1twuiul">Loading…</p>'),W9=N('<p class="info-status info-err svelte-1twuiul"> </p>'),B9=N('<dt class="svelte-1twuiul">Ollama version</dt><dd class="svelte-1twuiul"> </dd>',1),z9=N('<dt class="svelte-1twuiul">Family</dt><dd class="svelte-1twuiul"> </dd>',1),V9=N('<dt class="svelte-1twuiul">Parameters</dt><dd class="svelte-1twuiul"> </dd>',1),j9=N('<dt class="svelte-1twuiul">Quantization</dt><dd class="svelte-1twuiul"> </dd>',1),U9=N('<div class="running-model svelte-1twuiul"> </div>'),$9=N('<dt class="svelte-1twuiul">Loaded</dt> <dd class="svelte-1twuiul"></dd>',1),q9=N('<dt class="svelte-1twuiul">Loaded</dt><dd class="dim svelte-1twuiul">Not in memory</dd>',1),K9=N('<dl class="svelte-1twuiul"><!> <!> <!> <!> <!></dl>'),G9=N('<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>'),Z9=N('<div class="chat-panel svelte-1twuiul"><div class="chat-header svelte-1twuiul"><span class="chat-title svelte-1twuiul">AI — View assistant</span> <!> <!></div> <div class="messages svelte-1twuiul"><!> <!> <!> <!> <!></div> <!> <div class="context-row svelte-1twuiul"><label title="Include sheDB document IDs in context" class="svelte-1twuiul"><input type="checkbox" class="svelte-1twuiul"/><span class="checkmark svelte-1twuiul"></span> Doc IDs</label> <label title="Include sample document content in context (first 10 docs)" class="svelte-1twuiul"><input type="checkbox" class="svelte-1twuiul"/><span class="checkmark svelte-1twuiul"></span> Sample docs</label> <label title="Let the AI query sheDB documents on demand. Disables real-time streaming." class="svelte-1twuiul"><input type="checkbox" class="svelte-1twuiul"/><span class="checkmark svelte-1twuiul"></span> 😎 Agent</label> <span class="req-size svelte-1twuiul"> </span></div> <div class="files-row svelte-1twuiul"><!> <!> <button class="add-file-btn svelte-1twuiul" title="Attach file to context">+</button> <input type="file" multiple="" class="file-input-hidden svelte-1twuiul"/></div> <div><div><textarea rows="3" class="svelte-1twuiul"></textarea></div> <!></div> <!></div> <!>',1);function X9(o,e){Vo(e,!0),eb.registerLanguage("javascript",TR),On.use({breaks:!0,gfm:!0});let t=gg(e,"currentView",3,null);const i="she:viewchat:messages";let n=W(mi(JSON.parse(localStorage.getItem(i)??"[]"))),s=W(null),r=W(""),a=W(!1),c=W(""),h=W(null),g=W(mi([])),f=W(mi(localStorage.getItem("she:selectedModel")??""));An(()=>{localStorage.setItem(i,JSON.stringify(u(n)))});let p=W(mi(new Set)),v=W(!1),_=W(null),w=W(!1),S=W(""),D=null,E=W(0);const R=["[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 z=W(!0),H=W(!0),ee=W(!0),X=W(mi([])),me=W(!0),Le=W(!1),je,Ce=W(mi([])),mt=W(0),Lt,ct;const li=ot(()=>({apiref:!1,shedb:u(z),sampleDocs:u(H),tools:u(ee)})),zt=ot(()=>{var F;return((F=u(h))==null?void 0:F.configured)??!1}),ei=ot(()=>u(mt)+new TextEncoder().encode(u(r)).length),qe=ot(()=>u(me)?t():null);async function Ye(){try{const F=await wR();k(h,F,!0),F.configured&&!u(f)&&k(f,F.model,!0)}catch{}}An(()=>(window.addEventListener("she:config-changed",Ye),()=>window.removeEventListener("she:config-changed",Ye))),Mr(()=>{Ye()}),An(()=>{u(f)&&localStorage.setItem("she:selectedModel",u(f))}),An(()=>{var F;(F=u(h))!=null&&F.provider&&SR().then(K=>{k(g,K.models,!0),!u(f)&&K.models.length>0&&k(f,K.models[0],!0)}).catch(()=>{})}),An(()=>{u(f),k(_,null),k(S,"")}),An(()=>{const F=u(li),K=u(qe),De=u(X);u(zt)&&CR({context:F,currentView:K??null,extraFiles:De.length>0?De:void 0}).then(Re=>{k(mt,new TextEncoder().encode(Re.prompt).length,!0)}).catch(()=>{})}),An(()=>{if(!u(a))return;k(E,Math.floor(Math.random()*R.length),!0);const F=setInterval(()=>{k(E,(u(E)+1)%R.length)},1e4);return()=>clearInterval(F)}),An(()=>{var F;ct&&(u(n).length+(((F=u(s))==null?void 0:F.length)??0),requestAnimationFrame(()=>{ct&&(ct.scrollTop=ct.scrollHeight)}))});function Ne(F){const K=[],De=/```(\w*)\n([\s\S]*?)```/g;let Re=0,$e;for(;($e=De.exec(F))!==null;)$e.index>Re&&K.push({type:"text",text:F.slice(Re,$e.index)}),K.push({type:"code",lang:$e[1]||"text",text:$e[2].trimEnd()}),Re=$e.index+$e[0].length;return Re<F.length&&K.push({type:"text",text:F.slice(Re)}),K}function st(F){const K=[],De=/```(\w*)\n([\s\S]*?)```/g;let Re=0,$e;for(;($e=De.exec(F))!==null;)$e.index>Re&&K.push({type:"text",text:F.slice(Re,$e.index)}),K.push({type:"code",lang:$e[1]||"text",text:$e[2].trimEnd()}),Re=$e.index+$e[0].length;const Me=F.slice(Re),Ge=Me.match(/```(\w*)\n([\s\S]*)$/);return Ge?(Ge.index>0&&K.push({type:"text",text:Me.slice(0,Ge.index)}),K.push({type:"code",lang:Ge[1]||"text",text:Ge[2]})):Me&&K.push({type:"text",text:Me}),K}function Mt(F){const K={};for(const De of F)if(De.type==="code"){if(De.lang==="filter")K.filter=De.text.trim();else if(Fi(De.lang)){const Re=De.text.split(`
218
+ `)[0].trim();Re==="// @view-map"?K.map=De.text.split(`
219
+ `).slice(1).join(`
220
+ `).trim():Re==="// @view-reduce"&&(K.reduce=De.text.split(`
221
+ `).slice(1).join(`
222
+ `).trim())}}return K}function ni(F){return F.filter!==void 0||F.map!==void 0||F.reduce!==void 0}function ci(F){const K=[];return F.filter!==void 0&&K.push("filter"),F.map!==void 0&&K.push("map"),F.reduce!==void 0&&K.push("reduce"),`Apply ${K.join(" + ")}`}const Vt=15;function ut(F){return F.split(`
223
+ `).length>Vt}function Ii(F){const K=new Set(u(p));K.has(F)?K.delete(F):K.add(F),k(p,K,!0)}function fi(F,K){if(Fi(K))try{return eb.highlight(F,{language:"javascript"}).value}catch{}return F.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function tn(F){return On.parse(F)}function Fi(F){return!F||F==="js"||F==="javascript"}function Mn(F){navigator.clipboard.writeText(F).catch(()=>{})}async function Yi(){if(k(v,!0),!(u(_)||u(w))){k(w,!0),k(S,"");try{k(_,await b0(u(f)||u(h).model),!0)}catch(F){k(S,F.message,!0)}k(w,!1)}}function Ji(F){return F>=1e9?`${(F/1e9).toFixed(1)} GB`:F>=1e6?`${(F/1e6).toFixed(0)} MB`:`${F} B`}function Fn(F){const K=F.match(/\.([^.]+)$/);return K?K[1].toUpperCase():"?"}function Ai(F){switch(F){case"SH":case"BASH":return"$";case"MD":case"MARKDOWN":return"↓";case"JSON":case"JSONC":return"{}";default:return F}}function Nn(F){k(X,u(X).filter((K,De)=>De!==F),!0)}function nn(){je.click()}async function Hi(F){if(!(!F||F.length===0))for(const K of Array.from(F)){const De=await K.text();k(X,[...u(X),{name:K.name,content:De}],!0)}}function Rn(F){const K=F.target;Hi(K.files),K.value=""}function Un(F){var K;F.preventDefault(),k(Le,!1),Hi(((K=F.dataTransfer)==null?void 0:K.files)??null)}function Hn(F){var K;(K=F.dataTransfer)!=null&&K.types.includes("Files")&&(F.preventDefault(),k(Le,!0))}function Wn(){k(Le,!1)}async function dn(){const F=u(r).trim();if(!(!F||u(a))){k(r,""),k(c,""),k(a,!0),k(n,[...u(n),{role:"user",content:F}],!0),D=new AbortController,k(Ce,[],!0);try{await xR({messages:u(n),currentView:u(qe),context:u(li),modelOverride:u(f)||void 0,extraFiles:u(X).length>0?u(X):void 0},K=>{k(s,(u(s)??"")+K)},D.signal,K=>{k(Ce,[...u(Ce),K],!0)}),k(n,[...u(n),{role:"assistant",content:u(s)??"",toolEvents:u(Ce).length>0?[...u(Ce)]:void 0}],!0),k(Ce,[],!0)}catch(K){if(K.name==="AbortError"){const De=u(s);De!=null&&De.trim()&&k(n,[...u(n),{role:"assistant",content:De+`
224
+
225
+ *[stopped]*`,toolEvents:u(Ce).length>0?[...u(Ce)]:void 0}],!0)}else k(c,K.message,!0)}finally{D=null,k(s,null),k(Ce,[],!0),k(a,!1)}}}function sn(){D==null||D.abort()}function ts(F){F.key==="Enter"&&!F.shiftKey&&(F.preventDefault(),dn())}function Ke(){k(n,[],!0),k(c,"")}const _t=["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 ri(F){k(r,F,!0),Lt==null||Lt.focus()}var Di=Z9(),wi=wt(Di),gn=C(wi),_n=x(C(gn),2);{var Bn=F=>{var K=g9(),De=C(K);{var Re=Me=>{var Ge=ta();G(()=>$(Ge,`${u(h).provider??""} · ${(u(f)||u(h).model)??""}`)),T(Me,Ge)},$e=Me=>{var Ge=ta("Not configured");T(Me,Ge)};U(De,Me=>{u(zt)?Me(Re):Me($e,-1)})}G(()=>pn(K,"title",`Provider: ${u(h).provider??""}`)),T(F,K)};U(_n,F=>{u(h)&&F(Bn)})}var Cn=x(_n,2);{var Zn=F=>{var K=f9();Q("click",K,Ke),T(F,K)};U(Cn,F=>{u(n).length>0&&F(Zn)})}var Xn=x(gn,2),xn=C(Xn);{var Ue=F=>{var K=p9();T(F,K)},Z=F=>{var K=v9(),De=C(K),Re=C(De);{var $e=Yt=>{var ge=m9(),xe=x(wt(ge)),ft=C(xe);G(()=>$(ft,t().id)),T(Yt,ge)},Me=Yt=>{var ge=ta("No view selected. Ask a general sheDB view question.");T(Yt,ge)};U(Re,Yt=>{t()?Yt($e):Yt(Me,-1)})}var Ge=x(De,2);di(Ge,17,()=>_t,Dn,(Yt,ge)=>{var xe=_9(),ft=C(xe);G(()=>$(ft,u(ge))),Q("click",xe,()=>ri(u(ge))),T(Yt,xe)}),T(F,K)};U(xn,F=>{u(zt)?u(n).length===0&&u(s)===null&&F(Z,1):F(Ue)})}var Fe=x(xn,2);di(Fe,17,()=>u(n),Dn,(F,K,De)=>{var Re=x9(),$e=C(Re);{var Me=Yt=>{var ge=b9(),xe=C(ge);G(()=>$(xe,u(K).content)),T(Yt,ge)},Ge=Yt=>{const ge=ot(()=>Ne(u(K).content)),xe=ot(()=>Mt(u(ge)));var ft=C9(),Ee=wt(ft);{var at=Ie=>{var ke=XD();di(ke,21,()=>u(K).toolEvents,Dn,(xt,Qe)=>{var Te=js(),ht=wt(Te);{var Ae=we=>{var ye=GD(),pe=x(C(ye)),nt=C(pe);G(ce=>$(nt,ce),[()=>u(Qe).name.replace(/_/g," ")]),T(we,ye)},_e=we=>{var ye=ZD(),pe=x(C(ye)),nt=C(pe);G(ce=>$(nt,ce),[()=>u(Qe).name.replace(/_/g," ")]),T(we,ye)};U(ht,we=>{u(Qe).type==="tool_call"?we(Ae):we(_e,-1)})}T(xt,Te)}),T(Ie,ke)};U(Ee,Ie=>{var ke;(ke=u(K).toolEvents)!=null&&ke.length&&Ie(at)})}var Kt=x(Ee,2),V=C(Kt);di(V,17,()=>u(ge),Dn,(Ie,ke,xt)=>{var Qe=js(),Te=wt(Qe);{var ht=_e=>{var we=YD();Ql(we,()=>tn(u(ke).text),!0),T(_e,we)},Ae=_e=>{const we=ot(()=>`${De}:${xt}`),ye=ot(()=>ut(u(ke).text)),pe=ot(()=>u(p).has(u(we))),nt=ot(()=>u(ke).lang==="filter");var ce=w9(),He=C(ce),rt=C(He),Ot=C(rt),et=x(rt,2),Ut=C(et),Gt=x(He,2);let Ln;var Wi=C(Gt),kn=C(Wi);Ql(kn,()=>fi(u(ke).text,u(ke).lang??""),!0);var qn=x(Wi,2);{var pi=$t=>{var qi=y9(),Ei=C(qi);G(()=>$(Ei,u(pe)?"▲ collapse":"▼ expand")),Q("click",qi,()=>Ii(u(we))),T($t,qi)};U(qn,$t=>{u(ye)&&$t(pi)})}G(()=>{$(Ot,u(nt)?"filter":u(ke).lang),Ln=Zt(Gt,1,"code-body svelte-1twuiul",null,Ln,{collapsed:u(ye)&&!u(pe)})}),Q("click",Ut,()=>Mn(u(ke).text)),T(_e,ce)};U(Te,_e=>{u(ke).type==="text"?_e(ht):_e(Ae,-1)})}T(Ie,Qe)});var Y=x(V,2);{var Pe=Ie=>{var ke=S9(),xt=C(ke),Qe=C(xt);G(Te=>$(Qe,Te),[()=>ci(u(xe))]),Q("click",xt,()=>e.onApplyView(u(xe))),T(Ie,ke)},We=ot(()=>ni(u(xe))&&e.onApplyView);U(Y,Ie=>{u(We)&&Ie(Pe)})}T(Yt,ft)};U($e,Yt=>{u(K).role==="user"?Yt(Me):Yt(Ge,-1)})}G(()=>Zt(Re,1,`message ${u(K).role??""}`,"svelte-1twuiul")),T(F,Re)});var vt=x(Fe,2);{var Ct=F=>{var K=XD();di(K,21,()=>u(Ce),Dn,(De,Re)=>{var $e=js(),Me=wt($e);{var Ge=ge=>{var xe=GD(),ft=x(C(xe)),Ee=C(ft);G(at=>$(Ee,at),[()=>u(Re).name.replace(/_/g," ")]),T(ge,xe)},Yt=ge=>{var xe=ZD(),ft=x(C(xe)),Ee=C(ft);G(at=>$(Ee,at),[()=>u(Re).name.replace(/_/g," ")]),T(ge,xe)};U(Me,ge=>{u(Re).type==="tool_call"?ge(Ge):ge(Yt,-1)})}T(De,$e)}),T(F,K)};U(vt,F=>{u(Ce).length>0&&F(Ct)})}var qt=x(vt,2);{var A=F=>{var K=L9(),De=C(K),Re=C(De),$e=C(Re);G(()=>$($e,R[u(E)])),T(F,K)};U(qt,F=>{u(a)&&u(s)===null&&u(Ce).length===0&&F(A)})}var ie=x(qt,2);{var ve=F=>{var K=I9(),De=C(K);di(De,21,()=>st(u(s)),Dn,(Re,$e)=>{var Me=js(),Ge=wt(Me);{var Yt=xe=>{var ft=YD();Ql(ft,()=>tn(u($e).text),!0),T(xe,ft)},ge=xe=>{var ft=k9(),Ee=C(ft),at=C(Ee),Kt=C(at),V=x(Ee,2),Y=C(V);Ql(Y,()=>fi(u($e).text,u($e).lang??""),!0),G(()=>$(Kt,u($e).lang)),T(xe,ft)};U(Ge,xe=>{u($e).type==="text"?xe(Yt):xe(ge,-1)})}T(Re,Me)}),T(F,K)};U(ie,F=>{u(s)!==null&&F(ve)})}Ls(Xn,F=>ct=F,()=>ct);var Ze=x(Xn,2);{var gt=F=>{var K=D9(),De=C(K);G(()=>$(De,u(c))),T(F,K)};U(Ze,F=>{u(c)&&F(gt)})}var q=x(Ze,2),re=C(q),ue=C(re),tt=x(re,2),Ht=C(tt),bt=x(tt,2),fe=C(bt),dt=x(bt,2),jt=C(dt),Bt=x(q,2),oi=C(Bt);{var ti=F=>{var K=E9();let De;var Re=x(C(K),2),$e=C(Re),Me=x(Re,2),Ge=C(Me);G(()=>{De=Zt(K,1,"file-chip svelte-1twuiul",null,De,{inactive:!u(me)}),$($e,t().id),pn(Me,"title",u(me)?"Remove from context":"Re-add to context"),$(Ge,u(me)?"×":"+")}),Q("click",Me,()=>k(me,!u(me))),T(F,K)};U(oi,F=>{t()&&F(ti)})}var J=x(oi,2);di(J,17,()=>u(X),Dn,(F,K,De)=>{const Re=ot(()=>Fn(u(K).name));var $e=P9(),Me=C($e),Ge=C(Me),Yt=x(Me,2),ge=C(Yt),xe=x(Yt,2);G((ft,Ee)=>{Zt(Me,1,`badge badge-${ft??""}`,"svelte-1twuiul"),$(Ge,Ee),$(ge,u(K).name)},[()=>u(Re).toLowerCase(),()=>Ai(u(Re))]),Q("click",xe,()=>Nn(De)),T(F,$e)});var he=x(J,2),Oe=x(he,2);Ls(Oe,F=>je=F,()=>je);var it=x(Bt,2);let It;var Je=C(it);let Nt;var ii=C(Je);Ls(ii,F=>Lt=F,()=>Lt);var Wt=x(Je,2);{var At=F=>{var K=T9();Q("click",K,sn),T(F,K)},zi=F=>{var K=M9();G(De=>K.disabled=De,[()=>!u(r).trim()||!u(zt)]),Q("click",K,dn),T(F,K)};U(Wt,F=>{u(a)?F(At):F(zi,-1)})}var on=x(it,2);{var Oi=F=>{var K=F9(),De=C(K),Re=C(De),$e=x(De,2);{var Me=xe=>{var ft=R9();di(ft,21,()=>u(g),Dn,(Ee,at)=>{var Kt=N9(),V=C(Kt),Y={};G(()=>{$(V,u(at)),Y!==(Y=u(at))&&(Kt.value=(Kt.__value=u(at))??"")}),T(Ee,Kt)}),G(()=>ft.disabled=u(a)),qr(ft,()=>u(f),Ee=>k(f,Ee)),T(xe,ft)},Ge=xe=>{var ft=A9(),Ee=C(ft);G(()=>$(Ee,u(f)||u(h).model)),T(xe,ft)};U($e,xe=>{u(g).length>0?xe(Me):xe(Ge,-1)})}var Yt=x($e,2);{var ge=xe=>{var ft=O9();Q("click",ft,Yi),T(xe,ft)};U(Yt,xe=>{u(h).provider==="ollama"&&xe(ge)})}G(()=>$(Re,u(h).provider)),T(F,K)};U(on,F=>{u(zt)&&u(h)&&F(Oi)})}var si=x(wi,2);{var Vi=F=>{var K=G9(),De=C(K),Re=C(De),$e=C(Re),Me=C($e),Ge=x($e,2),Yt=x(Re,2),ge=C(Yt);{var xe=at=>{var Kt=H9();T(at,Kt)},ft=at=>{var Kt=W9(),V=C(Kt);G(()=>$(V,u(S))),T(at,Kt)},Ee=at=>{var Kt=K9(),V=C(Kt);{var Y=_e=>{var we=B9(),ye=x(wt(we)),pe=C(ye);G(()=>$(pe,u(_).version)),T(_e,we)};U(V,_e=>{u(_).version&&_e(Y)})}var Pe=x(V,2);{var We=_e=>{var we=z9(),ye=x(wt(we)),pe=C(ye);G(()=>$(pe,u(_).details.family)),T(_e,we)};U(Pe,_e=>{var we;(we=u(_).details)!=null&&we.family&&_e(We)})}var Ie=x(Pe,2);{var ke=_e=>{var we=V9(),ye=x(wt(we)),pe=C(ye);G(()=>$(pe,u(_).details.parameter_size)),T(_e,we)};U(Ie,_e=>{var we;(we=u(_).details)!=null&&we.parameter_size&&_e(ke)})}var xt=x(Ie,2);{var Qe=_e=>{var we=j9(),ye=x(wt(we)),pe=C(ye);G(()=>$(pe,u(_).details.quantization_level)),T(_e,we)};U(xt,_e=>{var we;(we=u(_).details)!=null&&we.quantization_level&&_e(Qe)})}var Te=x(xt,2);{var ht=_e=>{var we=$9(),ye=x(wt(we),2);di(ye,21,()=>u(_).running,Dn,(pe,nt)=>{var ce=U9(),He=C(ce);G(rt=>$(He,`${u(nt).name??""} · ${rt??""} VRAM`),[()=>Ji(u(nt).size_vram)]),T(pe,ce)}),T(_e,we)},Ae=_e=>{var we=q9();T(_e,we)};U(Te,_e=>{u(_).running&&u(_).running.length>0?_e(ht):u(_).running!==null&&_e(Ae,1)})}T(at,Kt)};U(ge,at=>{u(w)?at(xe):u(S)?at(ft,1):u(_)&&at(Ee,2)})}G(()=>{var at;return $(Me,`Ollama · ${(u(f)||((at=u(h))==null?void 0:at.model))??""}`)}),Q("click",K,()=>k(v,!1)),Q("click",De,at=>at.stopPropagation()),Q("click",Ge,()=>k(v,!1)),T(F,K)};U(si,F=>{u(v)&&F(Vi)})}G(F=>{$(jt,F),It=Zt(it,1,"input-row svelte-1twuiul",null,It,{"drag-over":u(Le)}),Nt=Zt(Je,1,"textarea-wrap svelte-1twuiul",null,Nt,{loading:u(a)}),pn(ii,"placeholder",u(zt)?"Ask anything… (Enter to send, Shift+Enter for newline, drag & drop files to add context)":"AI not configured"),ii.disabled=u(a)||!u(zt)},[()=>Ji(u(ei))]),zs(ue,()=>u(z),F=>k(z,F)),zs(Ht,()=>u(H),F=>k(H,F)),zs(fe,()=>u(ee),F=>k(ee,F)),Q("click",he,nn),Q("change",Oe,Rn),ls("dragover",it,Hn),ls("dragleave",it,Wn),ls("drop",it,Un),Q("keydown",ii,ts),Ci(ii,()=>u(r),F=>k(r,F)),T(o,Di),jo()}Tr(["click","change","keydown"]);var Y9=N('<div class="me svelte-1pxdb1"></div>');function iS(o,e){Vo(e,!0);let t=gg(e,"value",15,""),i=gg(e,"language",3,"javascript"),n,s,r=!1;Mr(()=>{const c=i()==="json"?{formatOnPaste:!0,autoIndent:"full"}:{};s=cr.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},...c}),s.onDidChangeModelContent(()=>{r||t(s.getValue())})}),xy(()=>s==null?void 0:s.dispose()),An(()=>{!s||s.getValue()===t()||(r=!0,s.setValue(t()),r=!1)});var a=Y9();Ls(a,c=>n=c,()=>n),T(o,a),jo()}var J9=N('<!> <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>',1),Q9=N('<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>'),JD=N('<div class="form-error svelte-rrt0o"> </div>'),eZ=N('<div class="new-item-form svelte-rrt0o"><input placeholder="device/lamp1" class="svelte-rrt0o"/> <button class="svelte-rrt0o">Create</button></div> <!>',1),QD=N("<li> </li>"),eE=N('<div class="error-bar svelte-rrt0o"> </div>'),tE=N('<div class="loading svelte-rrt0o">Loading…</div>'),tZ=N('<div class="monaco-doc-wrap svelte-rrt0o"><!></div>'),iZ=N('<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),nZ=N('<div class="panel svelte-rrt0o"><aside class="sidebar svelte-rrt0o"><div class="toolbar svelte-rrt0o"><button class="svelte-rrt0o">+ Doc</button></div> <!> <div class="sidebar-search svelte-rrt0o"><input type="search" placeholder="Filter…" class="svelte-rrt0o"/></div> <ul class="flat-list svelte-rrt0o"></ul></aside> <div class="resize-handle svelte-rrt0o" role="separator"></div> <main class="editor-area svelte-rrt0o"><!></main></div>'),sZ=N('<div class="new-item-form svelte-rrt0o"><input placeholder="myView" class="svelte-rrt0o"/> <button class="svelte-rrt0o">Create</button></div> <!>',1),oZ=N('<label class="opt-check svelte-rrt0o"><input type="checkbox" class="svelte-rrt0o"/> <span class="checkmark svelte-rrt0o"></span> Retain <span class="section-hint svelte-rrt0o">— send as retained MQTT message</span></label>'),rZ=N('<span class="badge-error svelte-rrt0o">error</span>'),aZ=N('<span class="badge-ok svelte-rrt0o"> </span>'),lZ=N('<pre class="result-error svelte-rrt0o"> </pre>'),cZ=N('<pre class="result-json svelte-rrt0o"> </pre>'),dZ=N('<div class="view-result svelte-rrt0o"><div class="result-header svelte-rrt0o">Result <!></div> <!></div>'),hZ=N('<div class="view-sections svelte-rrt0o"><div class="view-section svelte-rrt0o"><div class="section-title svelte-rrt0o">Description <span class="section-hint svelte-rrt0o">— optional, shown in sidebar</span></div> <div class="section-body svelte-rrt0o"><input class="filter-input svelte-rrt0o" placeholder="(optional description)"/></div></div> <div class="view-section svelte-rrt0o"><div class="section-title svelte-rrt0o">Filter <span class="section-hint svelte-rrt0o">— MQTT wildcard, optional</span></div> <div class="section-body svelte-rrt0o"><input class="filter-input svelte-rrt0o" placeholder="#"/></div></div> <div class="view-section svelte-rrt0o"><div class="section-title svelte-rrt0o">Map <span class="section-hint svelte-rrt0o">— <code>this</code> = document &nbsp;·&nbsp; call <code>emit(this)</code> to include in result</span></div> <div class="monaco-view-wrap monaco-view-wrap--map svelte-rrt0o"><!></div></div> <div class="view-section svelte-rrt0o"><div class="section-title svelte-rrt0o">Reduce <span class="section-hint svelte-rrt0o">— receives <code>result</code> array, must <code>return</code> new value (optional)</span></div> <div class="monaco-view-wrap monaco-view-wrap--reduce svelte-rrt0o"><!></div></div> <div class="view-section view-section--options svelte-rrt0o"><label class="opt-check svelte-rrt0o"><input type="checkbox" class="svelte-rrt0o"/> <span class="checkmark svelte-rrt0o"></span> Publish to MQTT <span class="section-hint svelte-rrt0o">— publish view to MQTT topic <code> </code></span></label> <!></div> <!></div>'),uZ=N('<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),gZ=N('<div class="chat-resize-handle svelte-rrt0o" role="separator"></div> <div class="chat-pane svelte-rrt0o"><!></div>',1),fZ=N('<div class="panel svelte-rrt0o"><aside class="sidebar svelte-rrt0o"><div class="toolbar svelte-rrt0o"><button class="svelte-rrt0o">+ View</button></div> <!> <div class="sidebar-search svelte-rrt0o"><input type="search" placeholder="Filter…" class="svelte-rrt0o"/></div> <ul class="flat-list svelte-rrt0o"></ul></aside> <div class="resize-handle svelte-rrt0o" role="separator"></div> <main class="editor-area svelte-rrt0o"><!></main> <!></div>'),pZ=N('<div class="db-root svelte-rrt0o" role="presentation"><div class="panel-tabs svelte-rrt0o"><button>Documents</button> <button>Views</button> <!></div> <!></div>');function mZ(o,e){Vo(e,!0);const t=Ue=>{var Z=J9(),Fe=wt(Z);Ls(Vg(Fe,{}),vt=>Ai=vt,()=>Ai),T(Ue,Z)};let i=W(mi([])),n=W(null),s=W("{}"),r=W(!1),a=W(null);const c="she-db-selected-view";let h=W(mi([])),g=W(mi(localStorage.getItem(c))),f=W("#"),p=W("// emit(this.someProperty)"),v=W(""),_=W(""),w=W(!1),S=W(!1),D=W(null),E=W(!1),R=W(null),z=W("she/db/view/");const H="she-db-panel";let ee=W(mi(localStorage.getItem(H)??"docs")),X=W(""),me=W(!1),Le=W(null),je=W(""),Ce=W(!1),mt=W(null);const Lt="she-db-sidebar-width";let ct=W(mi(parseInt(localStorage.getItem(Lt)??"220",10))),li=!1,zt=0,ei=0;const qe="she-db-chat-width",Ye="she-db-chat-open";let Ne=W(localStorage.getItem(Ye)==="true"),st=W(mi(parseInt(localStorage.getItem(qe)??"320",10))),Mt=!1,ni=0,ci=0;const Vt=ot(()=>u(g)?{id:u(g),filter:u(f),map:u(p),reduce:u(v)}:null);function ut(Ue){Ue.filter!==void 0&&k(f,Ue.filter,!0),Ue.map!==void 0&&k(p,Ue.map,!0),Ue.reduce!==void 0&&k(v,Ue.reduce,!0)}An(()=>{localStorage.setItem(Ye,String(u(Ne)))}),An(()=>{localStorage.setItem(H,u(ee))}),An(()=>{u(g)?localStorage.setItem(c,u(g)):localStorage.removeItem(c)});function Ii(Ue){li=!0,zt=Ue.clientX,ei=u(ct),Ue.preventDefault()}function fi(Ue){li&&k(ct,Math.max(140,Math.min(500,ei+Ue.clientX-zt)),!0),Mt&&k(st,Math.max(240,Math.min(600,ci-(Ue.clientX-ni))),!0)}function tn(){li&&(li=!1,localStorage.setItem(Lt,String(u(ct)))),Mt&&(Mt=!1,localStorage.setItem(qe,String(u(st))))}function Fi(Ue){Mt=!0,ni=Ue.clientX,ci=u(st),Ue.preventDefault()}async function Mn(){try{k(i,await _R(),!0)}catch{}}async function Yi(){try{k(h,await vR(),!0)}catch{}}async function Ji(Ue){k(n,Ue,!0),k(a,null),k(r,!0);try{const Z=await r7(Ue);k(s,JSON.stringify(Z,null,2),!0)}catch(Z){k(a,Z instanceof Error?Z.message:String(Z),!0)}finally{k(r,!1)}}async function Fn(){if(u(n)){k(a,null);try{const Ue=JSON.parse(u(s));await SD(u(n),Ue)}catch(Ue){k(a,Ue instanceof Error?Ue.message:String(Ue),!0)}}}let Ai;async function Nn(){if(u(n)&&await Ai.show(`Delete document "${u(n)}"?`,{confirm:"Delete",danger:!0}))try{await a7(u(n)),k(n,null),k(s,"{}")}catch(Ue){k(a,Ue instanceof Error?Ue.message:String(Ue),!0)}}async function nn(){const Ue=u(X).trim();if(Ue){k(Le,null);try{await SD(Ue,{}),k(me,!1),k(X,""),await Ji(Ue)}catch(Z){k(Le,Z instanceof Error?Z.message:String(Z),!0)}}}async function Hi(Ue){k(g,Ue,!0),k(R,null),k(E,!0),k(D,null);try{const Z=await l7(Ue);k(f,Z.filter??"",!0),k(p,Z.map,!0),k(v,Z.reduce??"",!0),k(_,Z.description??"",!0),k(w,Z.mqttpub??!1,!0),k(S,Z.retain??!1,!0),k(D,await eS(Ue).catch(()=>null),!0)}catch(Z){k(R,Z instanceof Error?Z.message:String(Z),!0)}finally{k(E,!1)}}async function Rn(){if(u(g)){k(R,null);try{const Ue={map:u(p)};u(f).trim()&&(Ue.filter=u(f).trim()),u(v).trim()&&(Ue.reduce=u(v).trim()),u(_).trim()&&(Ue.description=u(_).trim()),u(w)&&(Ue.mqttpub=!0),u(S)&&(Ue.retain=!0),await CD(u(g),Ue)}catch(Ue){k(R,Ue instanceof Error?Ue.message:String(Ue),!0)}}}async function Un(){if(u(g))try{k(D,await eS(u(g)),!0)}catch(Ue){k(R,Ue instanceof Error?Ue.message:String(Ue),!0)}}async function Hn(){if(u(g)&&await Ai.show(`Delete view "${u(g)}"?`,{confirm:"Delete",danger:!0}))try{await c7(u(g)),k(g,null),k(f,""),k(p,"// emit(this.someProperty)"),k(v,""),k(_,""),k(w,!1),k(S,!1),k(D,null)}catch(Ue){k(R,Ue instanceof Error?Ue.message:String(Ue),!0)}}async function Wn(){if(!u(je).trim())return;const Ue=u(je).trim();k(mt,null);try{await CD(Ue,{map:"// emit(this.someProperty)"}),k(Ce,!1),k(je,""),await Yi(),await Hi(Ue)}catch(Z){k(mt,Z instanceof Error?Z.message:String(Z),!0)}}let dn=W(""),sn=W(""),ts=ot(()=>[...u(i)].filter(Ue=>!u(dn)||Ue.toLowerCase().includes(u(dn).toLowerCase())).sort()),Ke=ot(()=>[...u(h)].filter(Ue=>!u(sn)||Ue.toLowerCase().includes(u(sn).toLowerCase())).sort());Mr(()=>{Mn(),Yi().then(()=>{u(g)&&u(h).includes(u(g))?Hi(u(g)):k(g,null)}),dL().then(Ct=>{const qt=Ct.dbPrefix||"she/db/",A=qt.endsWith("/")?qt:qt+"/";k(z,A+"view/")}).catch(()=>{});const Ue=ol("db:ids",Ct=>{k(i,Ct.ids??[],!0)}),Z=ol("db:viewIds",Ct=>{k(h,Ct.ids??[],!0)}),Fe=ol("db:change",async Ct=>{const qt=Ct.id;u(n)===qt&&(Ct.doc===null?(k(n,null),k(s,"{}")):k(s,JSON.stringify(Ct.doc,null,2),!0))}),vt=ol("db:viewUpdate",async Ct=>{const qt=Ct.id;u(g)===qt&&k(D,await eS(qt).catch(()=>null),!0)});return()=>{Ue(),Z(),Fe(),vt()}});var _t=pZ(),ri=C(_t),Di=C(ri);let wi;var gn=x(Di,2);let _n;var Bn=x(gn,2);{var Cn=Ue=>{var Z=Q9();let Fe;G(()=>{Fe=Zt(Z,1,"ai-toggle svelte-rrt0o",null,Fe,{"ai-open":u(Ne)}),pn(Z,"title",u(Ne)?"Close AI assistant":"Open AI assistant")}),Q("click",Z,()=>k(Ne,!u(Ne))),T(Ue,Z)};U(Bn,Ue=>{u(ee)==="views"&&Ue(Cn)})}var Zn=x(ri,2);{var Xn=Ue=>{var Z=nZ(),Fe=C(Z);let vt;var Ct=C(Fe),qt=C(Ct),A=x(Ct,2);{var ie=bt=>{var fe=eZ(),dt=wt(fe),jt=C(dt),Bt=x(jt,2),oi=x(dt,2);{var ti=J=>{var he=JD(),Oe=C(he);G(()=>$(Oe,u(Le))),T(J,he)};U(oi,J=>{u(Le)&&J(ti)})}Q("keydown",jt,J=>J.key==="Enter"&&nn()),Ci(jt,()=>u(X),J=>k(X,J)),Q("click",Bt,nn),T(bt,fe)};U(A,bt=>{u(me)&&bt(ie)})}var ve=x(A,2),Ze=C(ve),gt=x(ve,2);di(gt,20,()=>u(ts),bt=>bt,(bt,fe)=>{var dt=QD();let jt;var Bt=C(dt);G(()=>{jt=Zt(dt,1,"flat-item svelte-rrt0o",null,jt,{"active-item":u(n)===fe}),$(Bt,fe)}),Q("click",dt,()=>Ji(fe)),T(bt,dt)});var q=x(Fe,2),re=x(q,2),ue=C(re);{var tt=bt=>{var fe=iZ(),dt=wt(fe),jt=C(dt),Bt=C(jt),oi=x(jt,2),ti=x(oi,2),J=x(dt,2);{var he=Je=>{var Nt=eE(),ii=C(Nt);G(()=>$(ii,u(a))),T(Je,Nt)};U(J,Je=>{u(a)&&Je(he)})}var Oe=x(J,2);{var it=Je=>{var Nt=tE();T(Je,Nt)},It=Je=>{var Nt=tZ(),ii=C(Nt);iS(ii,{language:"json",get value(){return u(s)},set value(Wt){k(s,Wt,!0)}}),T(Je,Nt)};U(Oe,Je=>{u(r)?Je(it):Je(It,-1)})}G(()=>$(Bt,u(n))),Q("click",oi,Fn),Q("click",ti,Nn),T(bt,fe)},Ht=bt=>{t(bt)};U(ue,bt=>{u(n)?bt(tt):bt(Ht,-1)})}G(()=>vt=Ro(Fe,"",vt,{width:`${u(ct)??""}px`})),Q("click",qt,()=>{k(me,!u(me)),k(Le,null)}),Ci(Ze,()=>u(dn),bt=>k(dn,bt)),Q("mousedown",q,Ii),T(Ue,Z)},xn=Ue=>{var Z=fZ(),Fe=C(Z);let vt;var Ct=C(Fe),qt=C(Ct),A=x(Ct,2);{var ie=dt=>{var jt=sZ(),Bt=wt(jt),oi=C(Bt),ti=x(oi,2),J=x(Bt,2);{var he=Oe=>{var it=JD(),It=C(it);G(()=>$(It,u(mt))),T(Oe,it)};U(J,Oe=>{u(mt)&&Oe(he)})}Q("keydown",oi,Oe=>Oe.key==="Enter"&&Wn()),Ci(oi,()=>u(je),Oe=>k(je,Oe)),Q("click",ti,Wn),T(dt,jt)};U(A,dt=>{u(Ce)&&dt(ie)})}var ve=x(A,2),Ze=C(ve),gt=x(ve,2);di(gt,20,()=>u(Ke),dt=>dt,(dt,jt)=>{var Bt=QD();let oi;var ti=C(Bt);G(()=>{oi=Zt(Bt,1,"flat-item svelte-rrt0o",null,oi,{"active-item":u(g)===jt}),$(ti,jt)}),Q("click",Bt,()=>Hi(jt)),T(dt,Bt)});var q=x(Fe,2),re=x(q,2),ue=C(re);{var tt=dt=>{var jt=uZ(),Bt=wt(jt),oi=C(Bt),ti=C(oi),J=x(oi,2),he=x(J,2),Oe=x(he,2),it=x(Bt,2);{var It=Wt=>{var At=eE(),zi=C(At);G(()=>$(zi,u(R))),T(Wt,At)};U(it,Wt=>{u(R)&&Wt(It)})}var Je=x(it,2);{var Nt=Wt=>{var At=tE();T(Wt,At)},ii=Wt=>{var At=hZ(),zi=C(At),on=x(C(zi),2),Oi=C(on),si=x(zi,2),Vi=x(C(si),2),F=C(Vi),K=x(si,2),De=x(C(K),2),Re=C(De);iS(Re,{language:"javascript",get value(){return u(p)},set value(We){k(p,We,!0)}});var $e=x(K,2),Me=x(C($e),2),Ge=C(Me);iS(Ge,{language:"javascript",get value(){return u(v)},set value(We){k(v,We,!0)}});var Yt=x($e,2),ge=C(Yt),xe=C(ge),ft=x(xe,4),Ee=x(C(ft)),at=C(Ee),Kt=x(ge,2);{var V=We=>{var Ie=oZ(),ke=C(Ie);zs(ke,()=>u(S),xt=>k(S,xt)),T(We,Ie)};U(Kt,We=>{u(w)&&We(V)})}var Y=x(Yt,2);{var Pe=We=>{var Ie=dZ(),ke=C(Ie),xt=x(C(ke));{var Qe=we=>{var ye=rZ();T(we,ye)},Te=we=>{var ye=aZ(),pe=C(ye);G(()=>$(pe,`${u(D).length??0??""} items · rev ${u(D)._rev??""}`)),T(we,ye)};U(xt,we=>{u(D).error?we(Qe):we(Te,-1)})}var ht=x(ke,2);{var Ae=we=>{var ye=lZ(),pe=C(ye);G(()=>$(pe,u(D).error)),T(we,ye)},_e=we=>{var ye=cZ(),pe=C(ye);G(nt=>$(pe,nt),[()=>JSON.stringify(u(D).result,null,2)]),T(we,ye)};U(ht,we=>{u(D).error?we(Ae):we(_e,-1)})}T(We,Ie)};U(Y,We=>{u(D)&&We(Pe)})}G(()=>$(at,`${u(z)??""}${u(g)??""} on every update`)),Ci(Oi,()=>u(_),We=>k(_,We)),Ci(F,()=>u(f),We=>k(f,We)),zs(xe,()=>u(w),We=>k(w,We)),T(Wt,At)};U(Je,Wt=>{u(E)?Wt(Nt):Wt(ii,-1)})}G(()=>$(ti,u(g))),Q("click",J,Rn),Q("click",he,Un),Q("click",Oe,Hn),T(dt,jt)},Ht=dt=>{t(dt)};U(ue,dt=>{u(g)?dt(tt):dt(Ht,-1)})}var bt=x(re,2);{var fe=dt=>{var jt=gZ(),Bt=wt(jt),oi=x(Bt,2);let ti;var J=C(oi);X9(J,{get currentView(){return u(Vt)},onApplyView:ut}),G(()=>ti=Ro(oi,"",ti,{width:`${u(st)??""}px`})),Q("mousedown",Bt,Fi),T(dt,jt)};U(bt,dt=>{u(Ne)&&dt(fe)})}G(()=>vt=Ro(Fe,"",vt,{width:`${u(ct)??""}px`})),Q("click",qt,()=>{k(Ce,!u(Ce)),k(mt,null)}),Ci(Ze,()=>u(sn),dt=>k(sn,dt)),Q("mousedown",q,Ii),T(Ue,Z)};U(Zn,Ue=>{u(ee)==="docs"?Ue(Xn):Ue(xn,-1)})}G(()=>{wi=Zt(Di,1,"svelte-rrt0o",null,wi,{active:u(ee)==="docs"}),_n=Zt(gn,1,"svelte-rrt0o",null,_n,{active:u(ee)==="views"})}),Q("mousemove",_t,fi),Q("mouseup",_t,tn),ls("mouseleave",_t,tn),Q("click",Di,()=>k(ee,"docs")),Q("click",gn,()=>k(ee,"views")),T(o,_t),jo()}Tr(["mousemove","mouseup","click","keydown","mousedown"]);var _Z=N('<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),vZ=N('<label class="svelte-1ua3isv">Pairing Code / QR <input type="text" placeholder="MT:..." class="svelte-1ua3isv"/></label>'),iE=N('<p class="err svelte-1ua3isv"> </p>'),bZ=N('<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>'),yZ=N('<span class="device-name svelte-1ua3isv"> </span> <span class="device-nodeid svelte-1ua3isv"> </span>',1),wZ=N('<span class="device-name svelte-1ua3isv"> </span>'),SZ=N('<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>'),CZ=N('<li class="empty svelte-1ua3isv">No paired devices</li>'),xZ=N('<p class="info svelte-1ua3isv">Loading…</p>'),LZ=N('<p class="device-subtitle svelte-1ua3isv"> </p>'),kZ=N('<span class="ep-chip svelte-1ua3isv"> </span>'),IZ=N('<span class="attr-id svelte-1ua3isv"> </span>'),DZ=N('<button class="attr-action-btn svelte-1ua3isv"> </button>'),EZ=N('<div class="attr-actions svelte-1ua3isv"></div>'),PZ=N('<span class="cmd-sep svelte-1ua3isv">,</span>'),TZ=N('<span class="cmd-name svelte-1ua3isv"> </span><span class="cmd-id svelte-1ua3isv"> </span>',1),MZ=N('<span class="cmd-id svelte-1ua3isv"> </span>'),NZ=N("<!> <!>",1),RZ=N('<span class="cmd-list svelte-1ua3isv"></span>'),AZ=N(' <span class="cmd-id svelte-1ua3isv"> </span>',1),OZ=N('<tr class="svelte-1ua3isv"><td class="svelte-1ua3isv"><!></td><td class="svelte-1ua3isv"> </td></tr>'),FZ=N('<table class="attr-arr-table svelte-1ua3isv"><thead class="svelte-1ua3isv"><tr class="svelte-1ua3isv"><th class="svelte-1ua3isv">deviceType</th><th class="svelte-1ua3isv">revision</th></tr></thead><tbody class="svelte-1ua3isv"></tbody></table>'),HZ=N('<th class="svelte-1ua3isv"> </th>'),WZ=N('<td class="svelte-1ua3isv"> </td>'),BZ=N('<tr class="svelte-1ua3isv"></tr>'),zZ=N('<table class="attr-arr-table svelte-1ua3isv"><thead class="svelte-1ua3isv"><tr class="svelte-1ua3isv"></tr></thead><tbody class="svelte-1ua3isv"></tbody></table>'),VZ=N('<tr class="svelte-1ua3isv"><td class="attr-obj-key svelte-1ua3isv"> </td><td class="attr-obj-val svelte-1ua3isv"> </td></tr>'),jZ=N('<table class="attr-obj-table svelte-1ua3isv"><tbody class="svelte-1ua3isv"></tbody></table>'),UZ=N('<a class="attr-link svelte-1ua3isv" target="_blank" rel="noopener noreferrer"> </a>'),$Z=N('<span class="attr-val svelte-1ua3isv"> </span>'),qZ=N('<tr class="svelte-1ua3isv"><td class="attr-name-cell svelte-1ua3isv"><span class="attr-key svelte-1ua3isv"> </span><!></td><td class="attr-actions-cell svelte-1ua3isv"><!></td><td class="attr-val-cell svelte-1ua3isv"><!></td></tr>'),KZ=N('<tr class="cluster-hdr-row svelte-1ua3isv"><td colspan="3" class="cluster-hdr-cell svelte-1ua3isv"> </td></tr> <!>',1),GZ=N('<table class="cluster-table svelte-1ua3isv"><colgroup><col class="col-attr-name svelte-1ua3isv"/><col class="col-attr-actions svelte-1ua3isv"/><col class="col-attr-val"/></colgroup><tbody class="svelte-1ua3isv"></tbody></table>'),ZZ=N('<p class="no-clusters svelte-1ua3isv">No clusters</p>'),XZ=N('<details class="svelte-1ua3isv"><summary class="svelte-1ua3isv"> <span class="ep-id svelte-1ua3isv"> </span> <span class="ep-chips svelte-1ua3isv"></span></summary> <!></details>'),YZ=N('<div class="detail-hdr svelte-1ua3isv"><h2 class="svelte-1ua3isv"> </h2> <!> <p class="detail-nodeid svelte-1ua3isv"> </p></div> <!>',1),JZ=N('<p class="info svelte-1ua3isv">Select a device to view its endpoints.</p>'),QZ=N('<span class="stream-badge svelte-1ua3isv"> </span>'),eX=N('<span class="stream-empty svelte-1ua3isv">Waiting for events…</span>'),nS=N('&nbsp;<span class="e-sub svelte-1ua3isv"> </span>',1),tX=N('<span class="e-badge e-badge-status svelte-1ua3isv">status</span> <span class="e-node svelte-1ua3isv"> <!></span> <span> </span>',1),iX=N('<span class="e-badge e-badge-attr svelte-1ua3isv">attr</span> <span class="e-node svelte-1ua3isv"> <!></span> <span class="e-ep svelte-1ua3isv"> <!></span> <span class="e-cluster svelte-1ua3isv"> </span> <span class="e-attr svelte-1ua3isv"> </span> <span class="e-val svelte-1ua3isv"> </span>',1),nX=N('<div class="er svelte-1ua3isv"><span class="e-ts svelte-1ua3isv"> </span> <!></div>'),sX=N('<div class="stream-body svelte-1ua3isv"><!></div>'),oX=N('<!> <div class="matter-page svelte-1ua3isv"><div class="matter-main svelte-1ua3isv"><div class="sidebar svelte-1ua3isv"><div class="sidebar-header svelte-1ua3isv"><span class="sidebar-title svelte-1ua3isv">Matter Devices</span> <button class="add-btn svelte-1ua3isv" title="Commission new device">+</button></div> <!> <ul class="device-list svelte-1ua3isv"><!> <!></ul></div> <div class="detail svelte-1ua3isv"><!></div></div> <div class="stream-panel svelte-1ua3isv"><div class="stream-resize svelte-1ua3isv"></div> <div class="stream-hdr-row svelte-1ua3isv"><span class="stream-title svelte-1ua3isv">Matter Events</span> <!> <button class="stream-toggle svelte-1ua3isv" title="Toggle event feed"> </button></div> <!></div></div>',1);function rX(o,e){Vo(e,!0);const t={onOff:{onOff:[{label:"On",command:"on"},{label:"Off",command:"off"},{label:"Toggle",command:"toggle"}]},levelControl:{currentLevel:[{label:"Step ▲",command:"stepWithOnOff",args:{stepMode:0,stepSize:25,transitionTime:5}},{label:"Step ▼",command:"stepWithOnOff",args:{stepMode:1,stepSize:25,transitionTime:5}}]},windowCovering:{currentPositionLiftPercent100ths:[{label:"Open",command:"upOrOpen"},{label:"Close",command:"downOrClose"},{label:"Stop",command:"stopMotion"}],currentPositionTiltPercent100ths:[{label:"Open",command:"upOrOpen"},{label:"Close",command:"downOrClose"},{label:"Stop",command:"stopMotion"}]}};async function i(Z,Fe,vt,Ct,qt){try{await S7(Z,Fe,vt,Ct,qt)}catch(A){console.error("matter command failed",A)}}const n={identify:{0:"identify",1:"triggerEffect"},groups:{0:"addGroup",1:"viewGroup",2:"getGroupMembership",3:"removeGroup",4:"removeAllGroups",5:"addGroupIfIdentifying"},scenes:{0:"addScene",1:"viewScene",2:"removeScene",3:"removeAllScenes",4:"storeScene",5:"recallScene",6:"getSceneMembership",64:"enhancedAddScene",65:"enhancedViewScene",66:"copyScene"},onOff:{0:"off",1:"on",2:"toggle",64:"offWithEffect",65:"onWithRecallGlobalScene",66:"onWithTimedOff"},levelControl:{0:"moveToLevel",1:"move",2:"step",3:"stop",4:"moveToLevelWithOnOff",5:"moveWithOnOff",6:"stepWithOnOff",7:"stopWithOnOff",8:"moveToClosestFrequency"},colorControl:{0:"moveToHue",1:"moveHue",2:"stepHue",3:"moveToSaturation",4:"moveSaturation",5:"stepSaturation",6:"moveToHueAndSaturation",7:"moveToColor",8:"moveColor",9:"stepColor",10:"moveToColorTemperature",64:"enhancedMoveToHue",65:"enhancedMoveHue",66:"enhancedStepHue",67:"enhancedMoveToHueAndSaturation",68:"colorLoopSet",71:"stopMoveStep",75:"moveColorTemperature",76:"stepColorTemperature"},thermostat:{0:"setpointRaiseLower",1:"setWeeklySchedule",2:"getWeeklySchedule",3:"clearWeeklySchedule"},doorLock:{0:"lockDoor",1:"unlockDoor",3:"unlockWithTimeout",11:"setWeekDaySchedule",12:"getWeekDaySchedule",13:"clearWeekDaySchedule",14:"setYearDaySchedule",15:"getYearDaySchedule",16:"clearYearDaySchedule",17:"setHolidaySchedule",18:"getHolidaySchedule",19:"clearHolidaySchedule",26:"setUser",27:"getUser",28:"clearUser",34:"setCredential",36:"getCredential",38:"clearCredential"},windowCovering:{0:"upOrOpen",1:"downOrClose",2:"stopMotion",4:"goToLiftValue",5:"goToLiftPercentage",7:"goToTiltValue",8:"goToTiltPercentage"},fanControl:{0:"step"}};function s(Z,Fe){const vt=n[Z];return Fe.map(Ct=>{const qt=typeof Ct=="number"?Ct:Number(Ct);return{id:qt,name:(vt==null?void 0:vt[qt])??null}})}const r={10:"Door Lock",11:"Door Lock Controller",14:"Aggregator",15:"Generic Switch",17:"On/Off Plug-In Unit",18:"Dimmable Plug-In Unit",19:"Pump",20:"On/Off Light Switch",21:"Dimmer Switch",22:"Color Dimmer Switch",23:"Control Bridge",24:"Pump Controller",256:"On/Off Light",257:"Dimmable Light",268:"Extended Color Light",269:"Color Temperature Light",262:"Light Sensor",263:"Occupancy Sensor",514:"Window Covering",515:"Window Covering Controller",768:"Heating/Cooling Unit",769:"Thermostat",770:"Temperature Sensor",771:"Pressure Sensor",772:"Flow Sensor",773:"Humidity Sensor",774:"On/Off Sensor",2112:"Air Quality Sensor"},a={generatedCommandList:65528,acceptedCommandList:65529,eventList:65530,attributeList:65531,featureMap:65532,clusterRevision:65533},c={descriptor:{deviceTypeList:0,serverList:1,clientList:2,partsList:3,tagList:4},basicInformation:{dataModelRevision:0,vendorName:1,vendorID:2,vendorId:2,productName:3,productID:4,productId:4,nodeLabel:5,location:6,hardwareVersion:7,hardwareVersionString:8,softwareVersion:9,softwareVersionString:10,manufacturingDate:11,partNumber:12,productURL:13,productUrl:13,productLabel:14,serialNumber:15,localConfigDisabled:16,reachable:17,uniqueID:18,uniqueId:18,capabilityMinima:19,productAppearance:20,specificationVersion:21,maxPathsPerInvoke:22},bridgedDeviceBasicInformation:{vendorName:1,vendorID:2,vendorId:2,productName:3,productId:4,nodeLabel:5,hardwareVersion:7,hardwareVersionString:8,softwareVersion:9,softwareVersionString:10,manufacturingDate:11,partNumber:12,productURL:13,productUrl:13,productLabel:14,serialNumber:15,reachable:17,uniqueID:18,uniqueId:18,productAppearance:20},identify:{identifyTime:0,identifyType:1},groups:{nameSupport:0},onOff:{onOff:0,globalSceneControl:16384,onTime:16385,offWaitTime:16386,startUpOnOff:16387},levelControl:{currentLevel:0,remainingTime:1,minLevel:2,maxLevel:3,currentFrequency:4,minFrequency:5,maxFrequency:6,options:15,onOffTransitionTime:16,onLevel:17,onTransitionTime:18,offTransitionTime:19,defaultMoveRate:20,startUpCurrentLevel:16384},colorControl:{currentHue:0,currentSaturation:1,remainingTime:2,currentX:3,currentY:4,colorTemperatureMireds:7,colorMode:8,options:15,enhancedCurrentHue:16384,enhancedColorMode:16385,colorLoopActive:16386,colorLoopDirection:16387,colorLoopTime:16388,colorCapabilities:16394,colorTempPhysicalMinMireds:16395,colorTempPhysicalMaxMireds:16396,coupleColorTempToLevelMinMireds:16397,startUpColorTemperatureMireds:16400},thermostat:{localTemperature:0,outdoorTemperature:1,occupancy:2,absMinHeatSetpointLimit:3,absMaxHeatSetpointLimit:4,absMinCoolSetpointLimit:5,absMaxCoolSetpointLimit:6,piCoolingDemand:7,piHeatingDemand:8,localTemperatureCalibration:16,occupiedCoolingSetpoint:17,occupiedHeatingSetpoint:18,unoccupiedCoolingSetpoint:19,unoccupiedHeatingSetpoint:20,minHeatSetpointLimit:21,maxHeatSetpointLimit:22,minCoolSetpointLimit:23,maxCoolSetpointLimit:24,minSetpointDeadBand:25,remoteSensing:26,controlSequenceOfOperation:27,systemMode:28,thermostatRunningMode:30,startOfWeek:32,numberOfWeeklyTransitions:33,numberOfDailyTransitions:34,temperatureSetpointHold:35,temperatureSetpointHoldDuration:36,thermostatProgrammingOperationMode:37,thermostatRunningState:41,setpointChangeSource:48,setpointChangeAmount:49,setpointChangeSourceTimestamp:50,occupiedSetback:52,unoccupiedSetback:55,emergencyHeatDelta:58},windowCovering:{type:0,physicalClosedLimitLift:1,physicalClosedLimitTilt:2,currentPositionLift:3,currentPositionTilt:4,numberOfActuationsLift:5,numberOfActuationsTilt:6,configStatus:7,currentPositionLiftPercentage:8,currentPositionTiltPercentage:9,operationalStatus:10,targetPositionLiftPercent100ths:11,targetPositionTiltPercent100ths:12,endProductType:13,currentPositionLiftPercent100ths:14,currentPositionTiltPercent100ths:15,installedOpenLimitLift:16,installedClosedLimitLift:17,installedOpenLimitTilt:18,installedClosedLimitTilt:19,mode:23,safetyStatus:26},doorLock:{lockState:0,lockType:1,actuatorEnabled:2,doorState:3,numberOfTotalUsersSupported:17,numberOfPINUsersSupported:18,maxPINCodeLength:23,minPINCodeLength:24,language:33,autoRelockTime:35,soundVolume:36,operatingMode:37,supportedOperatingModes:38,wrongCodeEntryLimit:48},fanControl:{fanMode:0,fanModeSequence:1,percentSetting:2,percentCurrent:3,speedMax:4,speedSetting:5,speedCurrent:6,rockSupport:7,rockSetting:8,windSupport:9,windSetting:10,airflowDirectionSupport:11,airflowDirection:12},occupancySensing:{occupancy:0,occupancySensorType:1,occupancySensorTypeBitmap:2,holdTime:3,pirOccupiedToUnoccupiedDelay:16,pirUnoccupiedToOccupiedDelay:17},illuminanceMeasurement:{measuredValue:0,minMeasuredValue:1,maxMeasuredValue:2,tolerance:3,lightSensorType:4},temperatureMeasurement:{measuredValue:0,minMeasuredValue:1,maxMeasuredValue:2,tolerance:3},pressureMeasurement:{measuredValue:0,minMeasuredValue:1,maxMeasuredValue:2,tolerance:3,scaledValue:16,minScaledValue:17,maxScaledValue:18,scale:20},flowMeasurement:{measuredValue:0,minMeasuredValue:1,maxMeasuredValue:2,tolerance:3},relativeHumidityMeasurement:{measuredValue:0,minMeasuredValue:1,maxMeasuredValue:2,tolerance:3},powerSource:{status:0,order:1,description:2,batVoltage:11,batPercentRemaining:12,batTimeRemaining:13,batChargeLevel:14,batReplacementNeeded:15,batReplaceability:16,batPresent:17,activeBatFaults:18,batChargeState:26}};function h(Z){return"0x"+Z.toString(16).toUpperCase().padStart(4,"0")}let g=W(mi([])),f=mi(new Map);function p(Z){if(Z==null)return"—";if(typeof Z=="boolean"||typeof Z=="number")return String(Z);if(typeof Z=="string")return Z.length>50?Z.slice(0,47)+"…":Z;const Fe=JSON.stringify(Z);return Fe.length>60?Fe.slice(0,57)+"…":Fe}function v(Z){return Z==null?"—":typeof Z=="boolean"||typeof Z=="number"?String(Z):typeof Z=="string"?Z:JSON.stringify(Z)}function _(Z){return Z!==null&&typeof Z=="object"&&!Array.isArray(Z)}function w(Z){return Array.isArray(Z)&&Z.length>0&&Z.every(_)}function S(Z,Fe){return!!(Fe==="attributeList"||Array.isArray(Z)&&Z.length===0||_(Z)&&Object.keys(Z).length===0)}function D(Z){return new Date(Z).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}const E=500,R=20,z=32;let H=0,ee=W(mi([])),X=W(!0),me=W(180),Le=ot(()=>{const Z=Math.max(1,Math.floor((u(me)-z)/R)+1);return u(ee).slice(0,Z)});function je(Z){Z.preventDefault();const Fe=Z.clientY,vt=u(me);function Ct(A){k(me,Math.max(60,Math.min(600,vt+Fe-A.clientY)),!0)}function qt(){document.removeEventListener("mousemove",Ct),document.removeEventListener("mouseup",qt)}document.addEventListener("mousemove",Ct),document.addEventListener("mouseup",qt)}let Ce=W(null),mt=W(!1),Lt=W(null),ct=W(!1),li=W("passcode"),zt=W(""),ei=W(""),qe=W(""),Ye=W(!1),Ne=W(null),st=W("");const Mt="she:matter:selectedNodeId";async function ni(){try{k(g,await bR(),!0);for(const Z of u(g))A_(Z.nodeId).then(Fe=>{f.set(Z.nodeId,Fe)}).catch(()=>{});if(u(g).length>0&&!u(Ce)){const Z=localStorage.getItem(Mt),Fe=Z&&u(g).find(vt=>vt.nodeId===Z)?Z:u(g)[0].nodeId;ci(Fe)}}catch{k(g,[],!0)}}async function ci(Z){k(mt,!0),k(Lt,null);try{k(Ce,await A_(Z),!0),f.set(Z,u(Ce)),localStorage.setItem(Mt,Z)}catch(Fe){k(Lt,Fe instanceof Error?Fe.message:String(Fe),!0)}finally{k(mt,!1)}}let Vt;async function ut(Z){var Fe;if(await Vt.show(`Unpair device ${Z}?`,{confirm:"Unpair",danger:!0}))try{await w7(Z),((Fe=u(Ce))==null?void 0:Fe.nodeId)===Z&&k(Ce,null),await ni()}catch(vt){k(Lt,vt instanceof Error?vt.message:String(vt),!0)}}async function Ii(){k(Ye,!0),k(Ne,null);try{let Z;u(li)==="passcode"?(Z={passcode:Number(u(zt))},u(ei)&&(Z={...Z,discriminator:Number(u(ei))})):Z={pairingCode:u(qe).trim()},u(st).trim()&&(Z={...Z,discoveryAddress:u(st).trim()}),await y7(Z),k(ct,!1),k(zt,""),k(ei,""),k(qe,""),k(st,""),await ni()}catch(Z){k(Ne,Z instanceof Error?Z.message:String(Z),!0)}finally{k(Ye,!1)}}Mr(()=>{ni()});const fi=ol("matter:deviceList",Z=>{if(!Array.isArray(Z.devices))return;const Fe=Z.devices;for(const vt of Fe)f.has(vt.nodeId)||A_(vt.nodeId).then(Ct=>{f.set(vt.nodeId,Ct)}).catch(()=>{});k(g,Fe,!0)}),tn=ol("matter:deviceStatus",Z=>{if(Z.nodeId===void 0)return;const Fe=String(Z.nodeId),vt=!!Z.online;k(g,u(g).map(Ct=>Ct.nodeId===Fe?{...Ct,online:vt}:Ct),!0),k(ee,[{id:H++,kind:"status",nodeId:Fe,online:vt,ts:Date.now()},...u(ee).slice(0,E-1)],!0)}),Fi=ol("matter:attr",Z=>{const Fe=String(Z.nodeId),vt=Z.endpointId,Ct=String(Z.clusterName),qt=String(Z.attrName),A=Z.value;if(u(Ce)&&u(Ce).nodeId===Fe){const ve=u(Ce).endpoints.find(gt=>gt.endpointId===vt),Ze=ve==null?void 0:ve.clusters.find(gt=>gt.name===Ct);Ze&&(Ze.attrs[qt]=A)}const ie=f.get(Fe);if(ie){const ve=ie.endpoints.find(gt=>gt.endpointId===vt),Ze=ve==null?void 0:ve.clusters.find(gt=>gt.name===Ct);Ze&&(Ze.attrs[qt]=A)}k(ee,[{id:H++,kind:"attr",nodeId:Fe,endpointId:vt,clusterName:Ct,attrName:qt,value:A,ts:Z.ts??Date.now()},...u(ee).slice(0,E-1)],!0)});xy(()=>{fi(),tn(),Fi()});var Mn=oX(),Yi=wt(Mn);Ls(Vg(Yi,{}),Z=>Vt=Z,()=>Vt);var Ji=x(Yi,2),Fn=C(Ji),Ai=C(Fn),Nn=C(Ai),nn=x(C(Nn),2),Hi=x(Nn,2);{var Rn=Z=>{var Fe=bZ(),vt=C(Fe),Ct=C(vt);let qt;var A=x(Ct,2);let ie;var ve=x(vt,2);{var Ze=fe=>{var dt=_Z(),jt=wt(dt),Bt=x(C(jt)),oi=x(jt,2),ti=x(C(oi));Ci(Bt,()=>u(zt),J=>k(zt,J)),Ci(ti,()=>u(ei),J=>k(ei,J)),T(fe,dt)},gt=fe=>{var dt=vZ(),jt=x(C(dt));Ci(jt,()=>u(qe),Bt=>k(qe,Bt)),T(fe,dt)};U(ve,fe=>{u(li)==="passcode"?fe(Ze):fe(gt,-1)})}var q=x(ve,2),re=x(C(q)),ue=x(q,2);{var tt=fe=>{var dt=iE(),jt=C(dt);G(()=>$(jt,u(Ne))),T(fe,dt)};U(ue,fe=>{u(Ne)&&fe(tt)})}var Ht=x(ue,2),bt=C(Ht);G(()=>{qt=Zt(Ct,1,"svelte-1ua3isv",null,qt,{active:u(li)==="passcode"}),ie=Zt(A,1,"svelte-1ua3isv",null,ie,{active:u(li)==="pairingCode"}),Ht.disabled=u(Ye),$(bt,u(Ye)?"Commissioning…":"Commission")}),Q("click",Ct,()=>k(li,"passcode")),Q("click",A,()=>k(li,"pairingCode")),Ci(re,()=>u(st),fe=>k(st,fe)),Q("click",Ht,Ii),T(Z,Fe)};U(Hi,Z=>{u(ct)&&Z(Rn)})}var Un=x(Hi,2),Hn=C(Un);di(Hn,17,()=>u(g),Z=>Z.nodeId,(Z,Fe)=>{var vt=SZ();let Ct;var qt=C(vt),A=C(qt);let ie;var ve=x(A,2),Ze=C(ve);{var gt=ue=>{var tt=yZ(),Ht=wt(tt),bt=C(Ht),fe=x(Ht,2),dt=C(fe);G(()=>{$(bt,u(Fe).name),$(dt,`#${u(Fe).nodeId??""}`)}),T(ue,tt)},q=ue=>{var tt=wZ(),Ht=C(tt);G(()=>$(Ht,`Node ${u(Fe).nodeId??""}`)),T(ue,tt)};U(Ze,ue=>{u(Fe).name?ue(gt):ue(q,-1)})}var re=x(qt,2);G(()=>{var ue;Ct=Zt(vt,1,"svelte-1ua3isv",null,Ct,{selected:((ue=u(Ce))==null?void 0:ue.nodeId)===u(Fe).nodeId}),ie=Zt(A,1,"status-dot svelte-1ua3isv",null,ie,{online:u(Fe).online})}),Q("click",qt,()=>ci(u(Fe).nodeId)),Q("click",re,()=>ut(u(Fe).nodeId)),T(Z,vt)});var Wn=x(Hn,2);{var dn=Z=>{var Fe=CZ();T(Z,Fe)};U(Wn,Z=>{u(g).length===0&&Z(dn)})}var sn=x(Ai,2),ts=C(sn);{var Ke=Z=>{var Fe=xZ();T(Z,Fe)},_t=Z=>{var Fe=iE(),vt=C(Fe);G(()=>$(vt,u(Lt))),T(Z,Fe)},ri=Z=>{var Fe=YZ(),vt=wt(Fe),Ct=C(vt),qt=C(Ct),A=x(Ct,2);{var ie=q=>{var re=LZ(),ue=C(re);G(()=>$(ue,u(Ce).subtitle)),T(q,re)};U(A,q=>{u(Ce).subtitle&&q(ie)})}var ve=x(A,2),Ze=C(ve),gt=x(vt,2);di(gt,17,()=>u(Ce).endpoints,q=>q.endpointId,(q,re)=>{var ue=XZ(),tt=C(ue),Ht=C(tt),bt=x(Ht),fe=C(bt),dt=x(bt,2);di(dt,21,()=>u(re).clusters,Dn,(ti,J)=>{var he=kZ(),Oe=C(he);G(()=>$(Oe,u(J).name)),T(ti,he)});var jt=x(tt,2);{var Bt=ti=>{var J=GZ(),he=x(C(J));di(he,21,()=>u(re).clusters,Dn,(Oe,it)=>{var It=KZ(),Je=wt(It),Nt=C(Je),ii=C(Nt),Wt=x(Je,2);di(Wt,17,()=>Object.entries(u(it).attrs),Dn,(At,zi)=>{var on=ot(()=>Sk(u(zi),2));let Oi=()=>u(on)[0],si=()=>u(on)[1];var Vi=js(),F=wt(Vi);{var K=Re=>{const $e=ot(()=>{var ye;return(ye=t[u(it).name])==null?void 0:ye[Oi()]}),Me=ot(()=>(Oi()==="acceptedCommandList"||Oi()==="generatedCommandList")&&Array.isArray(si())),Ge=ot(()=>{var ye;return((ye=c[u(it).name])==null?void 0:ye[Oi()])??a[Oi()]});var Yt=qZ(),ge=C(Yt),xe=C(ge),ft=C(xe),Ee=x(xe);{var at=ye=>{var pe=IZ(),nt=C(pe);G(ce=>$(nt,`(${ce??""})`),[()=>h(u(Ge))]),T(ye,pe)};U(Ee,ye=>{u(Ge)!==void 0&&ye(at)})}var Kt=x(ge),V=C(Kt);{var Y=ye=>{var pe=EZ();di(pe,21,()=>u($e),Dn,(nt,ce)=>{var He=DZ(),rt=C(He);G(()=>$(rt,u(ce).label)),Q("click",He,()=>i(u(Ce).nodeId,u(re).endpointId,u(it).name,u(ce).command,u(ce).args)),T(nt,He)}),T(ye,pe)};U(V,ye=>{u($e)&&ye(Y)})}var Pe=x(Kt),We=C(Pe);{var Ie=ye=>{var pe=RZ();di(pe,21,()=>s(u(it).name,si()),Dn,(nt,ce,He)=>{var rt=NZ(),Ot=wt(rt);{var et=Wi=>{var kn=PZ();T(Wi,kn)};U(Ot,Wi=>{He>0&&Wi(et)})}var Ut=x(Ot,2);{var Gt=Wi=>{var kn=TZ(),qn=wt(kn),pi=C(qn),$t=x(qn),qi=C($t);G(()=>{$(pi,u(ce).name),$(qi,`(${u(ce).id??""})`)}),T(Wi,kn)},Ln=Wi=>{var kn=MZ(),qn=C(kn);G(()=>$(qn,u(ce).id)),T(Wi,kn)};U(Ut,Wi=>{u(ce).name?Wi(Gt):Wi(Ln,-1)})}T(nt,rt)}),T(ye,pe)},ke=ye=>{var pe=FZ(),nt=x(C(pe));di(nt,21,si,Dn,(ce,He)=>{const rt=ot(()=>u(He)),Ot=ot(()=>u(rt).deviceType),et=ot(()=>r[u(Ot)]);var Ut=OZ(),Gt=C(Ut),Ln=C(Gt);{var Wi=$t=>{var qi=AZ(),Ei=wt(qi),us=x(Ei),io=C(us);G(sr=>{$(Ei,`${u(et)??""} `),$(io,`(${sr??""})`)},[()=>h(u(Ot))]),T($t,qi)},kn=$t=>{var qi=ta();G(Ei=>$(qi,Ei),[()=>h(u(Ot))]),T($t,qi)};U(Ln,$t=>{u(et)?$t(Wi):$t(kn,-1)})}var qn=x(Gt),pi=C(qn);G($t=>$(pi,$t),[()=>v(u(rt).revision)]),T(ce,Ut)}),T(ye,pe)},xt=ot(()=>Oi()==="deviceTypeList"&&Array.isArray(si())),Qe=ye=>{const pe=ot(()=>[...new Set(si().flatMap(Ot=>Object.keys(Ot)))]);var nt=zZ(),ce=C(nt),He=C(ce);di(He,21,()=>u(pe),Dn,(Ot,et)=>{var Ut=HZ(),Gt=C(Ut);G(()=>$(Gt,u(et))),T(Ot,Ut)});var rt=x(ce);di(rt,21,si,Dn,(Ot,et)=>{var Ut=BZ();di(Ut,21,()=>u(pe),Dn,(Gt,Ln)=>{var Wi=WZ(),kn=C(Wi);G(qn=>$(kn,qn),[()=>v(u(et)[u(Ln)])]),T(Gt,Wi)}),T(Ot,Ut)}),T(ye,nt)},Te=ot(()=>w(si())),ht=ye=>{var pe=jZ(),nt=C(pe);di(nt,21,()=>Object.entries(si()),Dn,(ce,He)=>{var rt=ot(()=>Sk(u(He),2));let Ot=()=>u(rt)[0],et=()=>u(rt)[1];var Ut=VZ(),Gt=C(Ut),Ln=C(Gt),Wi=x(Gt),kn=C(Wi);G(qn=>{$(Ln,Ot()),$(kn,qn)},[()=>v(et())]),T(ce,Ut)}),T(ye,pe)},Ae=ot(()=>_(si())),_e=ye=>{var pe=UZ(),nt=C(pe);G(()=>{pn(pe,"href",si()),$(nt,si())}),T(ye,pe)},we=ye=>{var pe=$Z(),nt=C(pe);G(ce=>$(nt,ce),[()=>v(si())]),T(ye,pe)};U(We,ye=>{u(Me)?ye(Ie):u(xt)?ye(ke,1):u(Te)?ye(Qe,2):u(Ae)?ye(ht,3):(Oi()==="productUrl"||Oi()==="productURL")&&typeof si()=="string"?ye(_e,4):ye(we,-1)})}G(()=>{pn(ge,"title",Oi()),$(ft,Oi())}),T(Re,Yt)},De=ot(()=>!S(si(),Oi()));U(F,Re=>{u(De)&&Re(K)})}T(At,Vi)}),G(()=>$(ii,u(it).name)),T(Oe,It)}),T(ti,J)},oi=ti=>{var J=ZZ();T(ti,J)};U(jt,ti=>{u(re).clusters.length>0?ti(Bt):ti(oi,-1)})}G(()=>{$(Ht,`${u(re).name??`Endpoint ${u(re).endpointId}`??""} `),$(fe,`ep${u(re).endpointId??""}`)}),T(q,ue)}),G(()=>{$(qt,u(Ce).name??`Node ${u(Ce).nodeId}`),$(Ze,`Node ID: ${u(Ce).nodeId??""}`)}),T(Z,Fe)},Di=Z=>{var Fe=JZ();T(Z,Fe)};U(ts,Z=>{u(mt)?Z(Ke):u(Lt)?Z(_t,1):u(Ce)?Z(ri,2):Z(Di,-1)})}var wi=x(Fn,2),gn=C(wi),_n=x(gn,2),Bn=x(C(_n),2);{var Cn=Z=>{var Fe=QZ(),vt=C(Fe);G(()=>$(vt,u(ee).length)),T(Z,Fe)};U(Bn,Z=>{!u(X)&&u(ee).length>0&&Z(Cn)})}var Zn=x(Bn,2),Xn=C(Zn),xn=x(_n,2);{var Ue=Z=>{var Fe=sX(),vt=C(Fe);{var Ct=A=>{var ie=eX();T(A,ie)},qt=A=>{var ie=js(),ve=wt(ie);di(ve,17,()=>u(Le),Ze=>Ze.id,(Ze,gt)=>{const q=ot(()=>{var Bt,oi;return((Bt=f.get(u(gt).nodeId))==null?void 0:Bt.name)??((oi=u(g).find(ti=>ti.nodeId===u(gt).nodeId))==null?void 0:oi.name)??null}),re=ot(()=>{var Bt,oi;return u(gt).endpointId!==void 0?((oi=(Bt=f.get(u(gt).nodeId))==null?void 0:Bt.endpoints.find(ti=>ti.endpointId===u(gt).endpointId))==null?void 0:oi.name)??null:null}),ue=ot(()=>u(gt).attrName??u(gt).clusterName);var tt=nX(),Ht=C(tt),bt=C(Ht),fe=x(Ht,2);{var dt=Bt=>{var oi=tX(),ti=x(wt(oi),2),J=C(ti),he=x(J);{var Oe=Nt=>{var ii=nS(),Wt=x(wt(ii)),At=C(Wt);G(()=>$(At,`(#${u(gt).nodeId??""})`)),T(Nt,ii)};U(he,Nt=>{u(q)&&Nt(Oe)})}var it=x(ti,2);let It;var Je=C(it);G(()=>{$(J,u(q)??`#${u(gt).nodeId}`),It=Zt(it,1,"e-val svelte-1ua3isv",null,It,{"e-online":u(gt).online,"e-offline":!u(gt).online}),$(Je,u(gt).online?"online":"offline")}),T(Bt,oi)},jt=Bt=>{var oi=iX(),ti=x(wt(oi),2),J=C(ti),he=x(J);{var Oe=si=>{var Vi=nS(),F=x(wt(Vi)),K=C(F);G(()=>$(K,`(#${u(gt).nodeId??""})`)),T(si,Vi)};U(he,si=>{u(q)&&si(Oe)})}var it=x(ti,2),It=C(it),Je=x(It);{var Nt=si=>{var Vi=nS(),F=x(wt(Vi)),K=C(F);G(()=>$(K,`(ep ${u(gt).endpointId??""})`)),T(si,Vi)};U(Je,si=>{u(re)&&si(Nt)})}var ii=x(it,2),Wt=C(ii),At=x(ii,2),zi=C(At),on=x(At,2),Oi=C(on);G(si=>{$(J,u(q)??`#${u(gt).nodeId}`),$(It,u(re)??`ep${u(gt).endpointId}`),$(Wt,u(gt).clusterName),$(zi,u(ue)),$(Oi,si)},[()=>p(u(gt).value)]),T(Bt,oi)};U(fe,Bt=>{u(gt).kind==="status"?Bt(dt):Bt(jt,-1)})}G(Bt=>$(bt,Bt),[()=>D(u(gt).ts)]),T(Ze,tt)}),T(A,ie)};U(vt,A=>{u(Le).length===0?A(Ct):A(qt,-1)})}T(Z,Fe)};U(xn,Z=>{u(X)&&Z(Ue)})}G(()=>{Ro(wi,u(X)?`height: ${u(me)}px;`:""),$(Xn,u(X)?"▾":"▸")}),Q("click",nn,()=>k(ct,!u(ct))),Q("mousedown",gn,je),Q("click",Zn,()=>{k(X,!u(X))}),T(o,Mn),jo()}Tr(["click","mousedown"]);var aX=N("<button>›</button>"),lX=N('<span class="chev-ph svelte-1vejtrc"></span>'),cX=N('<span class="tv svelte-1vejtrc"> </span> <span class="tt svelte-1vejtrc"> </span>',1),dX=N('<div class="tc svelte-1vejtrc"></div>'),hX=N('<div class="tn svelte-1vejtrc"><div><!> <span class="seg svelte-1vejtrc"> </span> <!></div> <!></div>'),uX=N("<option></option>"),gX=N('<span class="pub-ok svelte-1vejtrc">✓</span>'),fX=N('<span class="pub-err svelte-1vejtrc"> </span>'),pX=N('<div class="info svelte-1vejtrc">Loading…</div>'),mX=N('<div class="info err svelte-1vejtrc"> </div>'),_X=N('<div class="info svelte-1vejtrc">No topics match.</div>'),vX=N('<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>'),bX=N('<div class="vs svelte-1vejtrc"><div><div class="vrows-abs svelte-1vejtrc"></div></div></div>'),yX=N('<div class="info svelte-1vejtrc">No topics yet.</div>'),wX=N('<div class="tree-wrap svelte-1vejtrc"><!></div>'),SX=N('<span class="stream-badge"> </span>'),CX=N('<span class="stream-empty svelte-1vejtrc">Waiting for messages…</span>'),xX=N('<span class="s-ret svelte-1vejtrc" title="retained snapshot">&#x229B;</span>'),LX=N('<div><span class="s-ts svelte-1vejtrc"> </span> <!> <span class="s-topic svelte-1vejtrc"> </span> <span class="s-val svelte-1vejtrc"> </span></div>'),kX=N('<div class="stream-body svelte-1vejtrc"><!></div>'),IX=N('<div class="ctx-bd svelte-1vejtrc"></div> <div class="ctx-menu svelte-1vejtrc"><button class="svelte-1vejtrc">Copy topic</button> <button class="svelte-1vejtrc">Clear retained</button></div>',1),DX=N('<label class="modal-check svelte-1vejtrc"><input type="checkbox" class="svelte-1vejtrc"/> <span class="checkmark svelte-1vejtrc"></span> Recursive — also clear all child topics</label>'),EX=N('<div class="modal-bd svelte-1vejtrc"></div> <div class="modal svelte-1vejtrc"><div class="modal-title svelte-1vejtrc">Clear retained</div> <div class="modal-body svelte-1vejtrc"><p class="svelte-1vejtrc">Clear retained value for <code class="svelte-1vejtrc"> </code>?</p> <!></div> <div class="modal-footer svelte-1vejtrc"><button class="btn-cancel svelte-1vejtrc">Cancel</button> <button class="btn-confirm svelte-1vejtrc">Clear</button></div></div>',1),PX=N('<div class="page svelte-1vejtrc"><div class="toolbar svelte-1vejtrc"><h2 class="svelte-1vejtrc">MQTT</h2></div> <div class="main-group svelte-1vejtrc"><div class="pub-bar svelte-1vejtrc"><input class="pt svelte-1vejtrc" type="text" placeholder="topic" list="pub-topic-list" autocomplete="off"/> <datalist id="pub-topic-list"></datalist> <input class="pp svelte-1vejtrc" type="text" placeholder="payload"/> <label class="rl svelte-1vejtrc"><input type="checkbox" class="svelte-1vejtrc"/> <span class="checkmark svelte-1vejtrc"></span> retain</label> <select class="svelte-1vejtrc"><option>QoS 0</option><option>QoS 1</option><option>QoS 2</option></select> <button class="svelte-1vejtrc">Publish</button> <!> <!></div> <div class="tree-filter-bar svelte-1vejtrc"><input class="filter-in svelte-1vejtrc" type="search" placeholder="Filter topics…"/> <span class="count svelte-1vejtrc"><!> </span></div> <!></div> <div class="stream-panel svelte-1vejtrc"><div class="stream-resize svelte-1vejtrc"></div> <div class="stream-hdr-row svelte-1vejtrc"><input class="filter-in stream-filter-in svelte-1vejtrc" type="search" placeholder="Live stream filter (MQTT wildcard, default: #)"/> <!> <button class="stream-toggle svelte-1vejtrc" title="Toggle live stream"> </button></div> <!></div> <!> <!></div>');function TX(o,e){Vo(e,!0);const t=(J,he=by)=>{const Oe=ot(()=>u(f).has(he().path)),it=ot(()=>u(a)>=0&&he().children.size>0),It=ot(()=>u(a)>=0&&he().isLeaf&&!n.has(he().path));var Je=hX(),Nt=C(Je);let ii;var Wt=C(Nt);{var At=Re=>{var $e=aX();let Me;G(()=>{Me=Zt($e,1,"chev svelte-1vejtrc",null,Me,{open:u(Oe)}),pn($e,"aria-label",u(Oe)?"Collapse":"Expand")}),Q("click",$e,()=>p(he().path)),T(Re,$e)},zi=Re=>{var $e=lX();T(Re,$e)};U(Wt,Re=>{u(it)?Re(At):Re(zi,-1)})}var on=x(Wt,2),Oi=C(on),si=x(on,2);{var Vi=Re=>{var $e=cX(),Me=wt($e),Ge=C(Me),Yt=x(Me,2),ge=C(Yt);G((xe,ft,Ee)=>{pn(Me,"title",xe),$(Ge,ft),$(ge,Ee)},[()=>{var xe;return Ji((xe=Nn(he().path))==null?void 0:xe.val)},()=>{var xe;return Ji((xe=Nn(he().path))==null?void 0:xe.val)},()=>{var xe;return((xe=Nn(he().path))==null?void 0:xe.ts)!=null?Fn(Nn(he().path).ts):""}]),T(Re,$e)},F=ot(()=>he().isLeaf&&i.has(he().path));U(si,Re=>{u(F)&&Re(Vi)})}var K=x(Nt,2);{var De=Re=>{var $e=dX();di($e,21,()=>[...he().children.values()].sort((Me,Ge)=>Me.seg.localeCompare(Ge.seg)),Me=>Me.path,(Me,Ge)=>{t(Me,()=>u(Ge))}),T(Re,$e)};U(K,Re=>{u(it)&&u(Oe)&&Re(De)})}G(()=>{ii=Zt(Nt,1,"tr svelte-1vejtrc",null,ii,{stale:u(It)}),$(Oi,he().seg)}),Q("click",Nt,()=>{k(mt,he().path+"/#")}),Q("contextmenu",Nt,Re=>{Re.preventDefault(),k(st,{x:Re.clientX,y:Re.clientY,topic:he().path},!0)}),T(J,Je)},i=new Map,n=new Set,s=new Set;let r=null,a=W(0);function c(){r===null&&(r=requestAnimationFrame(()=>{r=null;for(const J of s)g(J);s.clear(),Lk(a)}))}const h=new Map;function g(J){const he=J.split("/");let Oe=h,it="";for(let It=0;It<he.length;It++){const Je=he[It];it=It===0?Je:`${it}/${Je}`,Oe.has(Je)||Oe.set(Je,{seg:Je,path:it,children:new Map,isLeaf:!1});const Nt=Oe.get(Je);It===he.length-1&&(Nt.isLeaf=!0),Oe=Nt.children}}let f=W(mi(new Set));function p(J){const he=new Set(u(f));he.has(J)?he.delete(J):he.add(J),k(f,he,!0)}let v=W("");const _=24,w=5;let S=W(0),D=W(300),E=ot(()=>{if(u(a),!u(v))return[];const J=u(v).toLowerCase().split(/\s+/).filter(Boolean),he=[];for(const[Oe,it]of i){const It=Oe.toLowerCase();J.every(Je=>It.includes(Je))&&he.push({topic:Oe,...it})}return he.sort((Oe,it)=>Oe.topic.localeCompare(it.topic))}),R=ot(()=>{const J=u(E).length,he=Math.max(0,Math.floor(u(S)/_)-w),Oe=Math.min(J,Math.ceil((u(S)+u(D))/_)+w);return{start:he,end:Oe,totalH:J*_,top:he*_}});const z=1e3,H=200,ee=20,X=36;let me=0,Le=W(mi([])),je=W(mi([])),Ce=W(!0),mt=W("#"),Lt=W(200);An(()=>{const J=u(mt).trim(),he=El(()=>u(Le)),Oe=!J||J==="#"?he.slice(0,H):he.filter(it=>ct(J,it.topic)).slice(0,H);if(J&&J!=="#"){const it=new Set(Oe.map(Je=>Je.topic)),It=[];for(const[Je,Nt]of i)it.has(Je)||ct(J,Je)&&It.push({id:-(It.length+1),topic:Je,val:Nt.val,ts:Nt.ts,retained:!0});It.sort((Je,Nt)=>Je.topic.localeCompare(Nt.topic)),k(je,[...Oe,...It],!0)}else k(je,Oe,!0)});function ct(J,he){if(J==="#")return!0;const Oe=J.split("/"),it=he.split("/");for(let It=0;It<Oe.length;It++){if(Oe[It]==="#")return!0;if(It>=it.length||Oe[It]!=="+"&&Oe[It]!==it[It])return!1}return Oe.length===it.length}function li(J){J.preventDefault();const he=J.clientY,Oe=u(Lt);function it(Je){k(Lt,Math.max(60,Math.min(800,Oe+he-Je.clientY)),!0)}function It(){document.removeEventListener("mousemove",it),document.removeEventListener("mouseup",It)}document.addEventListener("mousemove",it),document.addEventListener("mouseup",It)}let zt=ot(()=>{const J=Math.max(1,Math.floor((u(Lt)-X)/ee)+1);return u(je).slice(0,J)}),ei=W(!0),qe=W(null);async function Ye(){k(ei,!0),k(qe,null);try{const J=await yR();for(const he of J)i.set(he.topic,{val:he.val,ts:he.ts}),g(he.topic)}catch(J){k(qe,J instanceof Error?J.message:String(J),!0)}finally{k(ei,!1),Lk(a)}}const Ne=ol("mqtt",J=>{const{topic:he,val:Oe,ts:it}=J;i.set(he,{val:Oe,ts:it}),n.add(he),s.add(he),c();const It={id:me++,topic:he,val:Oe,ts:it};k(Le,[It,...u(Le).slice(0,z-1)],!0);const Je=u(mt).trim();(!Je||Je==="#"||ct(Je,he))&&k(je,[It,...u(je).filter(Nt=>!(Nt.retained&&Nt.topic===he)).slice(0,H-1)],!0)});let st=W(null),Mt=W(null);async function ni(J,he){const Oe=[J];if(he){const it=J+"/";for(const It of i.keys())It.startsWith(it)&&Oe.push(It)}for(const it of Oe)await LD(it,"",!0,0)}let ci=ot(()=>(u(a),[...i.keys()].sort())),Vt=W(""),ut=W(""),Ii=W(!1),fi=W(0),tn=W(!1),Fi=W(null),Mn=W(!1);async function Yi(){if(u(Vt)){k(tn,!0),k(Fi,null),k(Mn,!1);try{await LD(u(Vt),u(ut),u(Ii),u(fi)),k(Mn,!0),setTimeout(()=>{k(Mn,!1)},2e3)}catch(J){k(Fi,J instanceof Error?J.message:String(J),!0)}finally{k(tn,!1)}}}function Ji(J){return J==null?"":typeof J=="object"?JSON.stringify(J):String(J)}function Fn(J){return new Date(J).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Ai(J){return new Date(J).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Nn(J){return u(a),i.get(J)}let nn=ot(()=>(u(a),[...h.values()].sort((J,he)=>J.seg.localeCompare(he.seg)))),Hi=ot(()=>(u(a),i.size));Mr(Ye),xy(()=>{Ne(),r!==null&&cancelAnimationFrame(r)});var Rn=PX(),Un=x(C(Rn),2),Hn=C(Un),Wn=C(Hn),dn=x(Wn,2);di(dn,20,()=>u(ci),J=>J,(J,he)=>{var Oe=uX(),it={};G(()=>{it!==(it=he)&&(Oe.value=(Oe.__value=he)??"")}),T(J,Oe)});var sn=x(dn,2),ts=x(sn,2),Ke=C(ts),_t=x(ts,2),ri=C(_t);ri.value=ri.__value=0;var Di=x(ri);Di.value=Di.__value=1;var wi=x(Di);wi.value=wi.__value=2;var gn=x(_t,2),_n=x(gn,2);{var Bn=J=>{var he=gX();T(J,he)};U(_n,J=>{u(Mn)&&J(Bn)})}var Cn=x(_n,2);{var Zn=J=>{var he=fX(),Oe=C(he);G(()=>$(Oe,u(Fi))),T(J,he)};U(Cn,J=>{u(Fi)&&J(Zn)})}var Xn=x(Hn,2),xn=C(Xn),Ue=x(xn,2),Z=C(Ue);{var Fe=J=>{var he=ta();G(()=>$(he,`${u(E).length??""} /`)),T(J,he)};U(Z,J=>{u(v)&&J(Fe)})}var vt=x(Z),Ct=x(Xn,2);{var qt=J=>{var he=pX();T(J,he)},A=J=>{var he=mX(),Oe=C(he);G(()=>$(Oe,u(qe))),T(J,he)},ie=J=>{var he=js(),Oe=wt(he);{var it=Je=>{var Nt=_X();T(Je,Nt)},It=Je=>{var Nt=bX(),ii=C(Nt),Wt=C(ii);di(Wt,21,()=>u(E).slice(u(R).start,u(R).end),At=>At.topic,(At,zi)=>{var on=vX(),Oi=C(on),si=C(Oi),Vi=x(Oi,2),F=C(Vi),K=x(Vi,2),De=C(K);G((Re,$e,Me)=>{$(si,u(zi).topic),pn(Vi,"title",Re),$(F,$e),$(De,Me)},[()=>Ji(u(zi).val),()=>Ji(u(zi).val),()=>Fn(u(zi).ts)]),T(At,on)}),G(()=>{Ro(ii,`height: ${u(R).totalH??""}px; position: relative;`),Ro(Wt,`top: ${u(R).top??""}px;`)}),ls("scroll",Nt,At=>{k(S,At.currentTarget.scrollTop,!0)}),LW(Nt,"clientHeight",At=>k(D,At)),T(Je,Nt)};U(Oe,Je=>{u(E).length===0?Je(it):Je(It,-1)})}T(J,he)},ve=J=>{var he=wX(),Oe=C(he);{var it=Je=>{var Nt=yX();T(Je,Nt)},It=Je=>{var Nt=js(),ii=wt(Nt);di(ii,17,()=>u(nn),Wt=>Wt.path,(Wt,At)=>{t(Wt,()=>u(At))}),T(Je,Nt)};U(Oe,Je=>{u(nn).length===0?Je(it):Je(It,-1)})}T(J,he)};U(Ct,J=>{u(ei)?J(qt):u(qe)?J(A,1):u(v)?J(ie,2):J(ve,-1)})}var Ze=x(Un,2),gt=C(Ze),q=x(gt,2),re=C(q),ue=x(re,2);{var tt=J=>{var he=SX(),Oe=C(he);G(()=>$(Oe,u(je).length)),T(J,he)};U(ue,J=>{!u(Ce)&&u(je).length>0&&J(tt)})}var Ht=x(ue,2),bt=C(Ht),fe=x(q,2);{var dt=J=>{var he=kX(),Oe=C(he);{var it=Je=>{var Nt=CX();T(Je,Nt)},It=Je=>{var Nt=js(),ii=wt(Nt);di(ii,17,()=>u(zt),Wt=>Wt.id,(Wt,At)=>{var zi=LX();let on;var Oi=C(zi),si=C(Oi),Vi=x(Oi,2);{var F=Me=>{var Ge=xX();T(Me,Ge)};U(Vi,Me=>{u(At).retained&&Me(F)})}var K=x(Vi,2),De=C(K),Re=x(K,2),$e=C(Re);G((Me,Ge,Yt)=>{on=Zt(zi,1,"sr svelte-1vejtrc",null,on,{retained:u(At).retained}),$(si,Me),$(De,u(At).topic),pn(Re,"title",Ge),$($e,Yt)},[()=>Ai(u(At).ts),()=>Ji(u(At).val),()=>Ji(u(At).val)]),T(Wt,zi)}),T(Je,Nt)};U(Oe,Je=>{u(zt).length===0?Je(it):Je(It,-1)})}T(J,he)};U(fe,J=>{u(Ce)&&J(dt)})}var jt=x(Ze,2);{var Bt=J=>{var he=IX(),Oe=wt(he),it=x(Oe,2);let It;var Je=C(it),Nt=x(Je,2);G(()=>It=Ro(it,"",It,{left:`${u(st).x??""}px`,top:`${u(st).y??""}px`})),Q("click",Oe,()=>k(st,null)),Q("contextmenu",Oe,ii=>{ii.preventDefault(),k(st,null)}),Q("click",Je,()=>{navigator.clipboard.writeText(u(st).topic),k(st,null)}),Q("click",Nt,()=>{const ii=u(st).topic,Wt=ii+"/",At=[...i.keys()].some(zi=>zi.startsWith(Wt));k(Mt,{topic:ii,hasChildren:At,recursive:!1},!0),k(st,null)}),T(J,he)};U(jt,J=>{u(st)&&J(Bt)})}var oi=x(jt,2);{var ti=J=>{var he=EX(),Oe=wt(he),it=x(Oe,2),It=x(C(it),2),Je=C(It),Nt=x(C(Je)),ii=C(Nt),Wt=x(Je,2);{var At=si=>{var Vi=DX(),F=C(Vi);zs(F,()=>u(Mt).recursive,K=>u(Mt).recursive=K),T(si,Vi)};U(Wt,si=>{u(Mt).hasChildren&&si(At)})}var zi=x(It,2),on=C(zi),Oi=x(on,2);G(()=>$(ii,u(Mt).topic)),Q("click",Oe,()=>k(Mt,null)),Q("click",on,()=>k(Mt,null)),Q("click",Oi,()=>{const{topic:si,recursive:Vi}=u(Mt);k(Mt,null),ni(si,Vi)}),T(J,he)};U(oi,J=>{u(Mt)&&J(ti)})}G(()=>{gn.disabled=u(tn)||!u(Vt),$(vt,` ${u(Hi)??""}`),Ro(Ze,u(Ce)?`height: ${u(Lt)}px;`:""),$(bt,u(Ce)?"▾":"▸")}),Ci(Wn,()=>u(Vt),J=>k(Vt,J)),Ci(sn,()=>u(ut),J=>k(ut,J)),zs(Ke,()=>u(Ii),J=>k(Ii,J)),qr(_t,()=>u(fi),J=>k(fi,J)),Q("click",gn,Yi),Ci(xn,()=>u(v),J=>k(v,J)),Q("mousedown",gt,li),Ci(re,()=>u(mt),J=>k(mt,J)),Q("click",Ht,()=>{k(Ce,!u(Ce))}),T(o,Rn),jo()}Tr(["click","contextmenu","mousedown"]);var MX=N('<div class="restart-banner restart-banner--restarting svelte-twakcj">Restarting daemon…</div>'),NX=N('<div class="restart-banner svelte-twakcj">⚠ Package changes require a daemon restart to take effect. <button class="restart-btn svelte-twakcj">Restart now</button></div>'),RX=N('<div class="err svelte-twakcj"> </div>'),AX=N('<span class="pane-count pane-count--warn svelte-twakcj"> </span>'),OX=N('<p class="empty svelte-twakcj">No packages installed.</p>'),FX=N('<p class="empty svelte-twakcj">No match.</p>'),HX=N('<span class="dep-latest svelte-twakcj"> </span>'),WX=LT('<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>'),BX=LT('<svg width="12" height="12" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M13 8A5 5 0 1 1 10.5 3.67"></path><polyline points="10.5,1.5 10.5,4 13,4"></polyline></svg>'),zX=N('<div><div class="dep-info svelte-twakcj"><a class="dep-name svelte-twakcj" target="_blank" rel="noopener noreferrer"> </a> <span class="dep-ver svelte-twakcj"> </span> <!></div> <div class="dep-btns svelte-twakcj"><button><!></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>'),VX=N('<span class="result-author svelte-twakcj"> </span>'),jX=N('<span class="result-date svelte-twakcj"> </span>'),UX=N('<span class="result-desc svelte-twakcj"> </span>'),$X=N('<div class="result-row svelte-twakcj"><div class="result-info svelte-twakcj"><a class="result-name svelte-twakcj" target="_blank" rel="noopener noreferrer"> </a> <span class="result-ver svelte-twakcj"> </span> <!> <!> <!></div> <button class="install-btn svelte-twakcj"> </button></div>'),qX=N('<div class="results-list svelte-twakcj"></div>'),KX=N('<pre class="npm-output svelte-twakcj"> </pre>'),GX=N(`<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>`),ZX=N('<!> <div class="pkg-shell svelte-twakcj"><!> <!> <div class="pkg-body svelte-twakcj"><div class="pkg-left svelte-twakcj"><div class="pane-hdr svelte-twakcj"><span class="pane-title svelte-twakcj">Installed</span> <span class="pane-count svelte-twakcj"> </span> <!> <button class="icon-btn check-outdated-btn svelte-twakcj" title="Check for package updates"><svg width="12" height="12" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M13 8A5 5 0 1 1 10.5 3.67"></path><polyline points="10.5,1.5 10.5,4 13,4"></polyline></svg></button></div> <div class="filter-row svelte-twakcj"><input class="filter-in svelte-twakcj" type="search" placeholder="Filter…"/></div> <div class="installed-list svelte-twakcj"><!></div></div> <div class="pkg-right svelte-twakcj"><div class="pane-hdr svelte-twakcj"><span class="pane-title svelte-twakcj">Search npm</span></div> <div class="search-row svelte-twakcj"><input class="search-in svelte-twakcj" type="text" placeholder="Package name, e.g. axios, lodash…"/> <button class="search-btn svelte-twakcj"> </button></div> <!> <!> <!></div></div></div>',1);function XX(o,e){Vo(e,!0);let t=W(mi([])),i=W(""),n=W(mi({})),s=W(!1),r=W(""),a=W(mi([])),c=W(!1),h=W(!1),g=W(!1),f=W(""),p=W(""),v=mi({});const _=ot(()=>u(i).trim()?u(t).filter(Ke=>Ke.name.toLowerCase().includes(u(i).toLowerCase())):u(t)),w=ot(()=>Object.keys(u(n)).length);Mr(async()=>{await Promise.all([S(),D()])});async function S(){try{k(t,await d7(),!0),k(f,"")}catch(Ke){k(f,Ke.message,!0)}}async function D(){try{k(n,await p7(),!0)}catch{}}async function E(){k(s,!0);try{k(n,await m7(),!0)}catch{}finally{k(s,!1)}}async function R(){const Ke=u(r).trim();if(!Ke){k(a,[],!0);return}k(g,!0),k(f,"");try{k(a,await h7(Ke),!0)}catch(_t){k(f,_t.message,!0)}finally{k(g,!1)}}function z(Ke){if(!Ke)return"";try{return new Date(Ke).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}async function H(Ke,_t){v[Ke]=!0,k(f,""),k(p,"");try{const ri=await u7(Ke,_t);k(p,ri.stdout||ri.stderr||"Done.",!0),k(c,!0),await S()}catch(ri){k(f,ri.message,!0)}finally{v[Ke]=!1}}async function ee(Ke){v[Ke]=!0,k(f,""),k(p,"");try{const _t=await g7(Ke);k(p,_t.stdout||_t.stderr||"Done.",!0),k(c,!0);const ri={...u(n)};delete ri[Ke],k(n,ri,!0),await S()}catch(_t){k(f,_t.message,!0)}finally{v[Ke]=!1}}async function X(Ke){v[Ke]=!0,k(f,""),k(p,"");try{const _t=await f7(Ke);k(p,_t.stdout||_t.stderr||"Done.",!0),k(c,!0);const ri={...u(n)};delete ri[Ke],k(n,ri,!0),await S()}catch(_t){k(f,_t.message,!0)}finally{v[Ke]=!1}}let me;async function Le(){if(await me.show("Restart the she daemon? The page will reload after a moment.",{confirm:"Restart"})){k(h,!0);try{await mR()}catch{}setTimeout(()=>{window.location.reload()},3e3)}}var je=ZX(),Ce=wt(je);Ls(Vg(Ce,{}),Ke=>me=Ke,()=>me);var mt=x(Ce,2),Lt=C(mt);{var ct=Ke=>{var _t=MX();T(Ke,_t)},li=Ke=>{var _t=NX(),ri=x(C(_t));Q("click",ri,Le),T(Ke,_t)};U(Lt,Ke=>{u(h)?Ke(ct):u(c)&&Ke(li,1)})}var zt=x(Lt,2);{var ei=Ke=>{var _t=RX(),ri=C(_t);G(()=>$(ri,u(f))),T(Ke,_t)};U(zt,Ke=>{u(f)&&Ke(ei)})}var qe=x(zt,2),Ye=C(qe),Ne=C(Ye),st=x(C(Ne),2),Mt=C(st),ni=x(st,2);{var ci=Ke=>{var _t=AX(),ri=C(_t);G(()=>$(ri,`${u(w)??""} outdated`)),T(Ke,_t)};U(ni,Ke=>{u(w)>0&&Ke(ci)})}var Vt=x(ni,2),ut=C(Vt);let Ii;var fi=x(Ne,2),tn=C(fi),Fi=x(fi,2),Mn=C(Fi);{var Yi=Ke=>{var _t=OX();T(Ke,_t)},Ji=Ke=>{var _t=FX();T(Ke,_t)},Fn=Ke=>{var _t=js(),ri=wt(_t);di(ri,17,()=>u(_),Di=>Di.name,(Di,wi)=>{var gn=zX();let _n;var Bn=C(gn),Cn=C(Bn),Zn=C(Cn),Xn=x(Cn,2),xn=C(Xn),Ue=x(Xn,2);{var Z=Ze=>{var gt=HX(),q=C(gt);G(()=>$(q,`→ v${u(n)[u(wi).name].latest??""}`)),T(Ze,gt)};U(Ue,Ze=>{u(n)[u(wi).name]&&Ze(Z)})}var Fe=x(Bn,2),vt=C(Fe);let Ct;var qt=C(vt);{var A=Ze=>{var gt=WX();T(Ze,gt)},ie=Ze=>{var gt=BX();T(Ze,gt)};U(qt,Ze=>{v[u(wi).name]?Ze(A):Ze(ie,-1)})}var ve=x(vt,2);G(()=>{_n=Zt(gn,1,"dep-row svelte-twakcj",null,_n,{"dep-busy":!!v[u(wi).name]}),pn(Cn,"href",u(wi).url??`https://www.npmjs.com/package/${u(wi).name}`),$(Zn,u(wi).name),$(xn,u(wi).installedVersion??u(wi).version),Ct=Zt(vt,1,"icon-btn svelte-twakcj",null,Ct,{"icon-btn--update":!!u(n)[u(wi).name]}),vt.disabled=!!v[u(wi).name],pn(vt,"title",u(n)[u(wi).name]?`Update to v${u(n)[u(wi).name].latest}`:"Update to latest"),ve.disabled=!!v[u(wi).name]}),Q("click",vt,()=>X(u(wi).name)),Q("click",ve,()=>ee(u(wi).name)),T(Di,gn)}),T(Ke,_t)};U(Mn,Ke=>{u(t).length===0?Ke(Yi):u(_).length===0?Ke(Ji,1):Ke(Fn,-1)})}var Ai=x(Ye,2),Nn=x(C(Ai),2),nn=C(Nn),Hi=x(nn,2),Rn=C(Hi),Un=x(Nn,2);{var Hn=Ke=>{var _t=qX();di(_t,21,()=>u(a),ri=>ri.name,(ri,Di)=>{var wi=$X(),gn=C(wi),_n=C(gn),Bn=C(_n),Cn=x(_n,2),Zn=C(Cn),Xn=x(Cn,2);{var xn=A=>{var ie=VX(),ve=C(ie);G(()=>$(ve,u(Di).author)),T(A,ie)};U(Xn,A=>{u(Di).author&&A(xn)})}var Ue=x(Xn,2);{var Z=A=>{var ie=jX(),ve=C(ie);G(Ze=>{pn(ie,"title",u(Di).date),$(ve,Ze)},[()=>z(u(Di).date)]),T(A,ie)};U(Ue,A=>{u(Di).date&&A(Z)})}var Fe=x(Ue,2);{var vt=A=>{var ie=UX(),ve=C(ie);G(()=>$(ve,u(Di).description)),T(A,ie)};U(Fe,A=>{u(Di).description&&A(vt)})}var Ct=x(gn,2),qt=C(Ct);G(()=>{pn(_n,"href",u(Di).url??`https://www.npmjs.com/package/${u(Di).name}`),$(Bn,u(Di).name),$(Zn,u(Di).version),Ct.disabled=!!v[u(Di).name],$(qt,v[u(Di).name]?"Installing…":"Install")}),Q("click",Ct,()=>H(u(Di).name)),T(ri,wi)}),T(Ke,_t)};U(Un,Ke=>{u(a).length>0&&Ke(Hn)})}var Wn=x(Un,2);{var dn=Ke=>{var _t=KX(),ri=C(_t);G(()=>$(ri,u(p))),T(Ke,_t)};U(Wn,Ke=>{u(p)&&Ke(dn)})}var sn=x(Wn,2);{var ts=Ke=>{var _t=GX();T(Ke,_t)};U(sn,Ke=>{!u(a).length&&!u(p)&&Ke(ts)})}G(()=>{$(Mt,u(t).length),Vt.disabled=u(s),Ii=Zt(ut,0,"svelte-twakcj",null,Ii,{spinning:u(s)}),Hi.disabled=u(g),$(Rn,u(g)?"Searching…":"Search")}),Q("click",Vt,E),Ci(tn,()=>u(i),Ke=>k(i,Ke)),Q("keydown",nn,Ke=>Ke.key==="Enter"&&R()),Ci(nn,()=>u(r),Ke=>k(r,Ke)),Q("click",Hi,R),T(o,je),jo()}Tr(["click","keydown"]);var YX=N('<span class="mqtt-dot svelte-1n46o8q" title="Waiting for retained MQTT state"></span>'),JX=N('<span class="update-dot svelte-1n46o8q" title="Update available"></span>'),QX=N('<dt class="svelte-1n46o8q">Latest</dt><dd style="color: #f90" class="svelte-1n46o8q"> </dd>',1),eY=N('<dt class="svelte-1n46o8q">Latest</dt><dd class="svelte-1n46o8q">up to date</dd>',1),tY=N('<button class="svelte-1n46o8q"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-1n46o8q"><polyline points="4 4 4 10 10 10" class="svelte-1n46o8q"></polyline><path d="M4 10A9 9 0 1 0 6.5 5" class="svelte-1n46o8q"></path></svg> </button>'),iY=N('<div class="version-popup svelte-1n46o8q"><dl class="svelte-1n46o8q"><dt class="svelte-1n46o8q">Installed</dt><dd class="svelte-1n46o8q"></dd> <!></dl> <div class="version-actions svelte-1n46o8q"><!> <button class="check-btn svelte-1n46o8q" title="Check for updates now"><svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 4 4 10 10 10" class="svelte-1n46o8q"></polyline><path d="M4 10A9 9 0 1 0 6.5 5" class="svelte-1n46o8q"></path></svg> </button></div></div>'),nY=N('<dt class="svelte-1n46o8q">Uptime</dt><dd class="svelte-1n46o8q"> </dd>',1),sY=N('<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),oY=N('<dt class="svelte-1n46o8q">DB docs</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">DB views</dt><dd class="svelte-1n46o8q"> </dd>',1),rY=N('<dl class="svelte-1n46o8q"><!> <dt class="svelte-1n46o8q">Scripts</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">MQTT topics</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">MQTT msg/s</dt><dd class="svelte-1n46o8q"> </dd> <!> <!> <dt class="svelte-1n46o8q">Handlers</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">Memory</dt><dd class="svelte-1n46o8q"> </dd> <dt class="svelte-1n46o8q">CPU</dt><dd class="svelte-1n46o8q"> </dd></dl>'),aY=N('<span class="stats-empty svelte-1n46o8q">Loading…</span>'),lY=N('<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" class="svelte-1n46o8q"><path d="M18.36 6.64a9 9 0 1 1-12.73 0" class="svelte-1n46o8q"></path><line x1="12" y1="2" x2="12" y2="12" class="svelte-1n46o8q"></line></svg> Restart daemon</button></div></div>'),cY=N('<button class="nav-logout svelte-1n46o8q" title="Logout"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-1n46o8q"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" class="svelte-1n46o8q"></path><polyline points="16 17 21 12 16 7" class="svelte-1n46o8q"></polyline><line x1="21" y1="12" x2="9" y2="12" class="svelte-1n46o8q"></line></svg></button>'),dY=N('<div class="shell svelte-1n46o8q"><nav class="svelte-1n46o8q"><span class="brand svelte-1n46o8q">she</span> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="svelte-1n46o8q"><polyline points="5,3 1,8 5,13" class="svelte-1n46o8q"></polyline><polyline points="11,3 15,8 11,13" class="svelte-1n46o8q"></polyline></svg> Scripts</button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="square" stroke-linejoin="miter" class="svelte-1n46o8q"><rect x="0.75" y="0.75" width="14.5" height="14.5" rx="1" class="svelte-1n46o8q"></rect><path d="M2,11 V5 H5 V11" class="svelte-1n46o8q"></path><path d="M6,12 V5 H9 V8 H6" class="svelte-1n46o8q"></path><path d="M10,11 V5 H15 V11" class="svelte-1n46o8q"></path><line x1="12.5" y1="5" x2="12.5" y2="11" class="svelte-1n46o8q"></line></svg> Packages</button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" stroke="none" style="vertical-align: middle" class="svelte-1n46o8q"><path fill-rule="evenodd" d="M2,0 H14 A2,2 0 0,1 16,2 V14 A2,2 0 0,1 14,16 H0 V2 A2,2 0 0,1 2,0 Z M0,16 L0,12 A4,4 0 0,1 4,16 Z M0,10.5 A5.5,5.5 0 0,1 5.5,16 L9,16 A9,9 0 0,0 0,7 Z M0,5.5 A10.5,10.5 0 0,1 10.5,16 L13.5,16 A13.5,13.5 0 0,0 0,2.5 Z" class="svelte-1n46o8q"></path></svg> MQTT <!></button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" class="svelte-1n46o8q"><path d="M8,2 L8,7" class="svelte-1n46o8q"></path><path d="M6,5 L8,7.5 L10,5" class="svelte-1n46o8q"></path><path d="M2.5,14 L6,10" class="svelte-1n46o8q"></path><path d="M6.2,12.8 L6,10 L3.2,10.2" class="svelte-1n46o8q"></path><path d="M13.5,14 L10,10" class="svelte-1n46o8q"></path><path d="M9.8,12.8 L10,10 L12.8,10.2" class="svelte-1n46o8q"></path></svg> Matter</button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="svelte-1n46o8q"><ellipse cx="8" cy="4.5" rx="5" ry="1.8" class="svelte-1n46o8q"></ellipse><path d="M3,4.5 v7 a5,1.8 0,0,0 10,0 v-7" class="svelte-1n46o8q"></path><path d="M3,8 a5,1.8 0,0,0 10,0" class="svelte-1n46o8q"></path></svg> DB</button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" class="svelte-1n46o8q"><line x1="2" y1="5" x2="14" y2="5" class="svelte-1n46o8q"></line><line x1="2" y1="8" x2="14" y2="8" class="svelte-1n46o8q"></line><line x1="2" y1="11" x2="9" y2="11" class="svelte-1n46o8q"></line></svg> Logs</button> <div class="nav-spacer svelte-1n46o8q"></div> <div class="nav-right svelte-1n46o8q"><a class="nav-icon svelte-1n46o8q" href="https://github.com/hobbyquaker/she" target="_blank" rel="noopener" title="GitHub"><svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" class="svelte-1n46o8q"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z" class="svelte-1n46o8q"></path></svg></a> <div class="version-wrap svelte-1n46o8q"><button class="version svelte-1n46o8q"> <!></button> <!></div> <div class="stats-wrap svelte-1n46o8q"><button class="nav-icon svelte-1n46o8q" title="Daemon status"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-1n46o8q"><line x1="18" y1="20" x2="18" y2="10" class="svelte-1n46o8q"></line><line x1="12" y1="20" x2="12" y2="4" class="svelte-1n46o8q"></line><line x1="6" y1="20" x2="6" y2="14" class="svelte-1n46o8q"></line></svg></button> <!></div> <button title="Settings"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-1n46o8q"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" class="svelte-1n46o8q"></path><circle cx="12" cy="12" r="3" class="svelte-1n46o8q"></circle></svg></button> <!></div></nav> <main class="svelte-1n46o8q"><!> <div><!></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div></main></div>'),hY=N('<div class="login-error svelte-1n46o8q"> </div>'),uY=N('<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>'),gY=N('<div class="updating-overlay svelte-1n46o8q"><div class="updating-box svelte-1n46o8q"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-1n46o8q"><polyline points="4 4 4 10 10 10" class="svelte-1n46o8q"></polyline><path d="M4 10A9 9 0 1 0 6.5 5" class="svelte-1n46o8q"></path></svg> Restarting smart-home-engine…</div></div>'),fY=N('<div class="updating-overlay svelte-1n46o8q"><div class="updating-box svelte-1n46o8q"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-1n46o8q"><polyline points="4 4 4 10 10 10" class="svelte-1n46o8q"></polyline><path d="M4 10A9 9 0 1 0 6.5 5" class="svelte-1n46o8q"></path></svg> Updating smart-home-engine…</div></div>'),pY=N("<!> <!> <!> <!>",1);function mY(o,e){Vo(e,!0);const t=["scripts","mqtt","matter","db","logs","config","packages"];function i(){const Ye=location.hash.slice(1);return t.includes(Ye)?Ye:"scripts"}let n=W(mi(i())),s=W(null),r=W(!1),a=W(!1),c=W(!1),h=W(!1),g=W("none"),f=W(""),p=W(!1),v=W(""),_=W(""),w=W(!1),S=W(!1);U8(()=>{k(p,!0)});async function D(){k(_,""),k(w,!0);try{await K8(u(v)),k(v,""),k(p,!1)}catch(Ye){k(_,Ye.message??"Login failed",!0)}finally{k(w,!1)}}async function E(){if(u(g)==="proxy"&&u(f)){window.location.href=u(f);return}await G8(),k(p,!0)}let R=W(null),z=W(!1),H=W(!1);async function ee(){if(!await u(R).show("Restart the she daemon? The page will reload after a moment.",{confirm:"Restart"}))return;k(z,!0);let Ye;try{Ye=(await If()).startedAt}catch{}try{await mR()}catch{}const Ne=Date.now()+6e4;for(;Date.now()<Ne;){await new Promise(st=>setTimeout(st,250));try{const st=await If();if(Ye===void 0||st.startedAt!==Ye){location.reload();return}}catch{}}location.reload()}async function X(){k(c,!0);try{const Ye=await e7();u(s)&&k(s,{...u(s),latestVersion:Ye.latestVersion??void 0},!0)}catch{}finally{k(c,!1)}}async function me(){var st,Mt;if(!await u(R).show(`Update to v${(st=u(s))==null?void 0:st.latestVersion}? The daemon will restart after the update completes.`,{confirm:"Update"}))return;k(a,!1),k(h,!0);const Ye=(Mt=u(s))==null?void 0:Mt.startedAt;try{await Q8()}catch{}const Ne=Date.now()+18e4;for(;Date.now()<Ne;){await new Promise(ni=>setTimeout(ni,1e3));try{const ni=await If();if(Ye===void 0||ni.startedAt!==Ye){location.reload();return}}catch{k(h,!1),k(z,!0)}}location.reload()}function Le(Ye){k(n,Ye,!0),location.hash=Ye}Mr(async()=>{location.hash||(location.hash=u(n));const Ye=()=>{k(n,i(),!0)};window.addEventListener("hashchange",Ye);try{const ni=await q8();k(g,ni.mode,!0),k(f,ni.proxyLogoutUrl??"",!0),u(g)==="password"&&(await fetch("/she/scripts")).status===401&&k(p,!0)}catch{}k(S,!0);async function Ne(){try{k(s,await If(),!0)}catch{}}Ne();const st=setInterval(Ne,5e3),Mt=ol("mqtt:status",ni=>{k(H,ni.ready===!1)});return()=>{window.removeEventListener("hashchange",Ye),clearInterval(st),Mt()}});var je=pY();ls("click",sT,()=>{u(r)&&k(r,!1),u(a)&&k(a,!1)});var Ce=wt(je);{var mt=Ye=>{var Ne=dY(),st=C(Ne),Mt=x(C(st),2);let ni;var ci=x(Mt,2);let Vt;var ut=x(ci,2);let Ii;var fi=x(C(ut),2);{var tn=fe=>{var dt=YX();T(fe,dt)};U(fi,fe=>{u(H)&&fe(tn)})}var Fi=x(ut,2);let Mn;var Yi=x(Fi,2);let Ji;var Fn=x(Yi,2);let Ai;var Nn=x(Fn,4),nn=x(C(Nn),2),Hi=C(nn),Rn=C(Hi);Rn.nodeValue="v0.28.0 ";var Un=x(Rn);{var Hn=fe=>{var dt=JX();T(fe,dt)};U(Un,fe=>{var dt;(dt=u(s))!=null&&dt.latestVersion&&fe(Hn)})}var Wn=x(Hi,2);{var dn=fe=>{var dt=iY(),jt=C(dt),Bt=x(C(jt));Bt.textContent="v0.28.0";var oi=x(Bt,2);{var ti=Wt=>{var At=QX(),zi=x(wt(At)),on=C(zi);G(()=>$(on,`v${u(s).latestVersion??""}`)),T(Wt,At)},J=Wt=>{var At=eY();T(Wt,At)};U(oi,Wt=>{var At;(At=u(s))!=null&&At.latestVersion?Wt(ti):Wt(J,-1)})}var he=x(jt,2),Oe=C(he);{var it=Wt=>{var At=tY(),zi=x(C(At));G(()=>$(zi,` Update to v${u(s).latestVersion??""}`)),Q("click",At,me),T(Wt,At)};U(Oe,Wt=>{var At;(At=u(s))!=null&&At.latestVersion&&Wt(it)})}var It=x(Oe,2),Je=C(It);let Nt;var ii=x(Je);G(()=>{It.disabled=u(c),Nt=Zt(Je,0,"svelte-1n46o8q",null,Nt,{spinning:u(c)}),$(ii,` ${u(c)?"Checking…":"Check for updates"}`)}),Q("click",dt,Wt=>Wt.stopPropagation()),Q("click",It,X),T(fe,dt)};U(Wn,fe=>{u(a)&&fe(dn)})}var sn=x(nn,2),ts=C(sn),Ke=x(ts,2);{var _t=fe=>{var dt=lY(),jt=C(dt);{var Bt=he=>{var Oe=rY(),it=C(Oe);{var It=Ge=>{const Yt=ot(()=>Math.floor((Date.now()-u(s).startedAt)/1e3)),ge=ot(()=>Math.floor(u(Yt)/86400)),xe=ot(()=>Math.floor(u(Yt)%86400/3600)),ft=ot(()=>Math.floor(u(Yt)%3600/60));var Ee=nY(),at=x(wt(Ee)),Kt=C(at);G(()=>$(Kt,`${u(ge)>0?u(ge)+"d ":""}${u(xe)>0||u(ge)>0?u(xe)+"h ":""}${u(ft)??""}m`)),T(Ge,Ee)};U(it,Ge=>{u(s).startedAt&&Ge(It)})}var Je=x(it,3),Nt=C(Je),ii=x(Je,3),Wt=C(ii),At=x(ii,3),zi=C(At),on=x(At,2);{var Oi=Ge=>{var Yt=sY(),ge=x(wt(Yt)),xe=C(ge),ft=x(ge,3),Ee=C(ft);G(()=>{$(xe,u(s).matterNodes??0),$(Ee,u(s).matterEndpoints??0)}),T(Ge,Yt)};U(on,Ge=>{u(s).matterEnabled&&Ge(Oi)})}var si=x(on,2);{var Vi=Ge=>{var Yt=oY(),ge=x(wt(Yt)),xe=C(ge),ft=x(ge,3),Ee=C(ft);G(()=>{$(xe,u(s).dbDocs??"—"),$(Ee,u(s).dbViews??"—")}),T(Ge,Yt)};U(si,Ge=>{u(s).dbEnabled&&Ge(Vi)})}var F=x(si,3),K=C(F),De=x(F,3),Re=C(De),$e=x(De,3),Me=C($e);G(()=>{$(Nt,u(s).scripts),$(Wt,u(s).topics),$(zi,u(s).mqttMsgPerSec??"—"),$(K,u(s).handlers??"—"),$(Re,u(s).memMb!=null?u(s).memMb+" MB":"—"),$(Me,u(s).cpuPercent!=null?u(s).cpuPercent+" %":"—")}),T(he,Oe)},oi=he=>{var Oe=aY();T(he,Oe)};U(jt,he=>{u(s)?he(Bt):he(oi,-1)})}var ti=x(jt,2),J=C(ti);Q("click",dt,he=>he.stopPropagation()),Q("click",J,()=>{k(r,!1),ee()}),T(fe,dt)};U(Ke,fe=>{u(r)&&fe(_t)})}var ri=x(sn,2);let Di;var wi=x(ri,2);{var gn=fe=>{var dt=cY();Q("click",dt,E),T(fe,dt)};U(wi,fe=>{u(g)==="password"&&fe(gn)})}var _n=x(st,2),Bn=C(_n);Ls(Vg(Bn,{}),fe=>k(R,fe,!0),()=>u(R));var Cn=x(Bn,2);let Zn;var Xn=C(Cn);{let fe=ot(()=>u(n)==="scripts");CG(Xn,{get active(){return u(fe)}})}var xn=x(Cn,2);let Ue;var Z=C(xn);XX(Z,{});var Fe=x(xn,2);let vt;var Ct=C(Fe);TX(Ct,{});var qt=x(Fe,2);let A;var ie=C(qt);rX(ie,{});var ve=x(qt,2);let Ze;var gt=C(ve);mZ(gt,{});var q=x(ve,2);let re;var ue=C(q);l9(ue,{});var tt=x(q,2);let Ht;var bt=C(tt);u9(bt,{}),G(()=>{ni=Zt(Mt,1,"svelte-1n46o8q",null,ni,{active:u(n)==="scripts"}),Vt=Zt(ci,1,"svelte-1n46o8q",null,Vt,{active:u(n)==="packages"}),Ii=Zt(ut,1,"svelte-1n46o8q",null,Ii,{active:u(n)==="mqtt"}),Mn=Zt(Fi,1,"svelte-1n46o8q",null,Mn,{active:u(n)==="matter"}),Ji=Zt(Yi,1,"svelte-1n46o8q",null,Ji,{active:u(n)==="db"}),Ai=Zt(Fn,1,"svelte-1n46o8q",null,Ai,{active:u(n)==="logs"}),Di=Zt(ri,1,"nav-settings svelte-1n46o8q",null,Di,{active:u(n)==="config"}),Zn=Zt(Cn,1,"page-wrap svelte-1n46o8q",null,Zn,{hidden:u(n)!=="scripts"}),Ue=Zt(xn,1,"page-wrap svelte-1n46o8q",null,Ue,{hidden:u(n)!=="packages"}),vt=Zt(Fe,1,"page-wrap svelte-1n46o8q",null,vt,{hidden:u(n)!=="mqtt"}),A=Zt(qt,1,"page-wrap svelte-1n46o8q",null,A,{hidden:u(n)!=="matter"}),Ze=Zt(ve,1,"page-wrap svelte-1n46o8q",null,Ze,{hidden:u(n)!=="db"}),re=Zt(q,1,"page-wrap svelte-1n46o8q",null,re,{hidden:u(n)!=="config"}),Ht=Zt(tt,1,"page-wrap svelte-1n46o8q",null,Ht,{hidden:u(n)!=="logs"})}),Q("click",Mt,()=>Le("scripts")),Q("click",ci,()=>Le("packages")),Q("click",ut,()=>Le("mqtt")),Q("click",Fi,()=>Le("matter")),Q("click",Yi,()=>Le("db")),Q("click",Fn,()=>Le("logs")),Q("click",Hi,fe=>{fe.stopPropagation(),k(a,!u(a)),k(r,!1)}),Q("click",ts,fe=>{fe.stopPropagation(),k(r,!u(r)),k(a,!1)}),Q("click",ri,()=>Le("config")),T(Ye,Ne)};U(Ce,Ye=>{u(S)&&!u(p)&&Ye(mt)})}var Lt=x(Ce,2);{var ct=Ye=>{var Ne=uY(),st=C(Ne),Mt=x(C(st),4),ni=x(C(Mt),2),ci=x(Mt,2);{var Vt=fi=>{var tn=hY(),Fi=C(tn);G(()=>$(Fi,u(_))),T(fi,tn)};U(ci,fi=>{u(_)&&fi(Vt)})}var ut=x(ci,2),Ii=C(ut);G(()=>{ni.disabled=u(w),ut.disabled=u(w)||!u(v),$(Ii,u(w)?"Signing in…":"Sign in")}),ls("submit",st,fi=>{fi.preventDefault(),D()}),Ci(ni,()=>u(v),fi=>k(v,fi)),T(Ye,Ne)};U(Lt,Ye=>{u(p)&&Ye(ct)})}var li=x(Lt,2);{var zt=Ye=>{var Ne=gY();T(Ye,Ne)};U(li,Ye=>{u(z)&&Ye(zt)})}var ei=x(li,2);{var qe=Ye=>{var Ne=fY();T(Ye,Ne)};U(ei,Ye=>{u(h)&&Ye(qe)})}T(o,je),jo()}Tr(["click"]);hW(mY,{target:document.getElementById("app")});export{HT as t};