smart-home-engine 0.27.5 → 0.27.7
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.
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
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-CIoeFEdg.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var rA=Object.defineProperty;var FL=o=>{throw TypeError(o)};var aA=(o,e,t)=>e in o?rA(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var Bi=(o,e,t)=>aA(o,typeof e!="symbol"?e+"":e,t),Xy=(o,e,t)=>e.has(o)||FL("Cannot "+t);var ee=(o,e,t)=>(Xy(o,e,"read from private field"),t?t.call(o):e.get(o)),Ti=(o,e,t)=>e.has(o)?FL("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,t),Mi=(o,e,t,i)=>(Xy(o,e,"write to private field"),i?i.call(o,t):e.set(o,t),t),In=(o,e,t)=>(Xy(o,e,"access private method"),t);import{_ as YD,m as JD,l as Lt,A as io,C as ae,I as Pn,D as Hp,a as ns,g as QD,M as lt,b as Yt,E as qr,c as M,r as tn,d as vr,e as y,f as lA,h as wn,R as Ri,S as qt,i as Ws,j as br,k as Vi,n as bi,o as ne,p as Se,K as rs,q as _t,s as Ve,t as hs,u as z,v as Di,O as xa,w as ls,P as kt,x as Yy,y as Wp,z as eE,B as el,F as Kr,G as Yw,H as Cs,U as cn,J as Gu,L as It,N as rl,Q as cA,T as Ys,V as Jw,W as dA,X as tE,$ as mt,Y as Ki,Z as zi,a0 as Un,a1 as hi,a2 as Mo,a3 as Uf,a4 as He,a5 as r_,a6 as hA,a7 as uA,a8 as ds,a9 as gA,aa as Gr,ab as no,ac as Mt,ad as iE,ae as Dn,af as fA,ag as pA,ah as Qs,ai as Lg,aj as as,ak as Gb,al as Ks,am as xc,an as S0,ao as Zb,ap as ys,aq as Zu,ar as ws,as as Xb,at as Yb,au as mA,av as Bp,aw as kg,ax as ml,ay as _A,az as Ig,aA as vA,aB as C0,aC as bA,aD as yA,aE as HL,aF as is,aG as tl,aH as Gs,aI as mi,aJ as Za,aK as wA,aL as Da,aM as Eo,aN as ms,aO as Zr,aP as x0,aQ as us,aR as Qn,aS as N_,aT as pi,aU as nE,aV as SA,aW as L0,aX as Jb,aY as k0,aZ as I0,a_ as id,a$ as CA,b0 as D0,b1 as xA,b2 as E0,b3 as _l,b4 as vl,b5 as Xu,b6 as $f,b7 as vo,b8 as zp,b9 as R_,ba as Jy,bb as fn,bc as P0,bd as Vp,be as Qb,bf as LA,bg as sE,bh as qf,bi as Yu,bj as Kf,bk as jp,bl as ey,bm as Ui,bn as Lc,bo as Up,bp as kA,bq as IA,br as T0,bs as DA,bt as A_,bu as Zo,bv as M0,bw as Ju,bx as bl,by as Dg,bz as ki,bA as Qu,bB as oE,bC as $p,bD as EA,bE as nd,bF as ct,bG as WL,bH as a_,bI as rE,bJ as Sr,bK as zr,bL as vn,bM as eg,bN as ur,bO as tg,bP as jn,bQ as Gf,bR as bh,bS as Qw,bT as aE,bU as lE,bV as cE,bW as N0,bX as uo,bY as Qi,bZ as qp,b_ as dE,b$ as il,c0 as ty,c1 as PA,c2 as au,c3 as BL,c4 as Kp,c5 as hE,c6 as lu,c7 as TA,c8 as or,c9 as iy,ca as MA,cb as so,cc as Xr,cd as Gp,ce as Zf,cf as uE,cg as $o,ch as Zp,ci as ny,cj as NA,ck as RA,cl as AA,cm as Eg,cn as Ea,co as _s,cp as OA,cq as R0,cr as FA,cs as HA,ct as zL,cu as WA,cv as Xp,cw as al,cx as eS,cy as eh,cz as ll,cA as BA,cB as La,cC as gr,cD as ko,cE as VL,cF as zs,cG as Yp,cH as pc,cI as Pa,cJ as zA,cK as Yr,cL as Xf,cM as sy,cN as gE,cO as VA,cP as jA,cQ as A0,cR as UA,cS as Yf,cT as $A,cU as Vl,cV as Jf,cW as jL,cX as qA,cY as KA,cZ as Na,c_ as GA,c$ as O0,d0 as fE,d1 as pE,d2 as mE,d3 as _E,d4 as ZA,d5 as XA,d6 as vE,d7 as bE,d8 as YA,d9 as F0,da as JA,db as QA,dc as Xn,dd as eO,de as H0,df as tO,dg as cu,dh as UL,di as iO,dj as nO,dk as sO,dl as oO,dm as rO,dn as aO,dp as ig,dq as oy,dr as tS,ds as lO,dt as cO,du as $L,dv as iS,dw as dO,dx as qL,dy as Qy,dz as hO,dA as yE,dB as uO,dC as wE,dD as nS,dE as gO,dF as fO,dG as pO,dH as SE,dI as CE,dJ as mO,dK as O_,dL as xE,dM as ry,dN as _O,dO as vO,dP as mc,dQ as W0,dR as bO,dS as KL,dT as GL,dU as yO,dV as du,dW as LE,dX as wO,dY as SO,dZ as CO,d_ as xO,d$ as kE,e0 as IE,e1 as DE,e2 as EE,e3 as LO,e4 as ka,e5 as ZL,e6 as kO,e7 as Jp,e8 as IO,e9 as rf,ea as PE,eb as XL,ec as Qf,ed as TE,ee as F_,ef as DO,eg as ME,eh as EO,ei as NE,ej as PO,ek as TO,el as RE,em as AE,en as cl,eo as ay,ep as MO,eq as OE,er as Po,es as sd,et as FE,eu as NO,ev as RO,ew as HE,ex as WE,ey as AO,ez as BE,eA as zE,eB as ep,eC as OO,eD as FO,eE as HO,eF as WO,eG as Gg,eH as YL,eI as BO,eJ as zO,eK as VO,eL as H_,eM as Is,eN as jO,eO as sS,eP as yh,eQ as UO,eR as Ga,eS as $O,eT as qO,eU as VE,eV as KO,eW as xf,eX as GO,eY as ZO,eZ as XO,e_ as YO,e$ as JL,f0 as QL,f1 as ek,f2 as wh,f3 as B0,f4 as jE,f5 as oS,f6 as l_,f7 as UE,f8 as W_,f9 as JO,fa as QO,fb as e2,fc as t2,fd as z0,fe as $E,ff as i2,fg as B_,fh as qE,fi as KE,fj as n2,fk as s2,fl as o2,fm as r2,fn as a2,fo as l2,fp as c2,fq as d2,fr as GE,fs as h2,ft as z_,fu as ZE,fv as u2,fw as XE,fx as g2,fy as YE,fz as JE,fA as f2,fB as tk,fC as QE,fD as ik,fE as p2,fF as ew,fG as nk,fH as m2,fI as _2,fJ as v2,fK as ma,fL as _c,fM as b2,fN as sk,fO as c_,fP as y2,fQ as Xa,fR as ly,fS as rS,fT as w2,fU as eP,fV as tP,fW as Vs,fX as ok,fY as Pm,fZ as V0,f_ as S2,f$ as C2,g0 as x2,g1 as L2,g2 as k2,g3 as I2,g4 as D2,g5 as E2,g6 as rk,g7 as P2,g8 as T2,g9 as M2,ga as ng,gb as Lf,gc as iP,gd as N2,ge as j0,gf as d_,gg as Tm,gh as tw,gi as R2,gj as A2,gk as nP,gl as O2,gm as U0,gn as F2,go as H2,gp as sP,gq as cy,gr as W2,gs as V_,gt as $0,gu as q0,gv as K0,gw as oP,gx as rP,gy as aP,gz as lP,gA as cP,gB as dP,gC as hP,gD as ak,gE as uP,gF as Wh,gG as B2,gH as z2,gI as V2,gJ as j2,gK as gP,gL as U2,gM as $2,gN as lk,gO as aS,gP as Zl,gQ as q2,gR as K2,gS as G2,gT as Z2,gU as X2,gV as Y2,gW as ck,gX as G0,gY as lS,gZ as J2,g_ as cS,g$ as Q2,h0 as eF,h1 as tF,h2 as iF,h3 as Z0,h4 as fP,h5 as dk,h6 as hk,h7 as nF,h8 as sF,h9 as oF,ha as uk,hb as iw,hc as rF,hd as aF,he as lF,hf as nw,hg as pP,hh as mP,hi as _P,hj as vP,hk as dl,hl as bP,hm as X0,hn as gk,ho as cF,hp as yP,hq as dF,hr as hF,hs as dy,ht as hy,hu as Sh,hv as uy,hw as Qp,hx as uF,hy as gy,hz as gF,hA as fF,hB as pF,hC as wP,hD as Zg,hE as mF,hF as _F,hG as vF,hH as bF,hI as em,hJ as yF,hK as SP,hL as CP,hM as xP,hN as dS,hO as wF,hP as SF,hQ as CF,hR as xF,hS as LF,hT as hS,hU as kF,hV as IF,hW as DF,hX as EF,hY as PF,hZ as TF,h_ as MF,h$ as NF,i0 as LP,i1 as RF,i2 as AF,i3 as OF,i4 as fk,i5 as FF,i6 as HF,i7 as Vc,i8 as tr,i9 as WF,ia as BF}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 kP=!1;var Y0=Array.isArray,zF=Array.prototype.indexOf,j_=Array.prototype.includes,fy=Array.from,VF=Object.defineProperty,Lu=Object.getOwnPropertyDescriptor,jF=Object.getOwnPropertyDescriptors,UF=Object.prototype,$F=Array.prototype,IP=Object.getPrototypeOf,pk=Object.isExtensible;const py=()=>{};function qF(o){for(var e=0;e<o.length;e++)o[e]()}function DP(){var o,e,t=new Promise((i,n)=>{o=i,e=n});return{promise:t,resolve:o,reject:e}}function KF(o,e,t=!1){return o===void 0?t?e():e:o}function mk(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 $s=2,sg=4,my=8,EP=1<<24,Vr=16,$r=32,vc=64,uS=128,mr=512,Ds=1024,Os=2048,Ta=4096,fo=8192,_r=16384,Pg=32768,gS=1<<25,og=65536,U_=1<<17,GF=1<<18,Tg=1<<19,ZF=1<<20,wa=1<<25,th=65536,$_=1<<21,ku=1<<22,Xl=1<<23,od=Symbol("$state"),XF=Symbol("legacy props"),YF=Symbol(""),h_=Symbol("attributes"),fS=Symbol("class"),pS=Symbol("style"),af=Symbol("text"),u_=Symbol("form reset"),_y=new class extends Error{constructor(){super(...arguments);Bi(this,"name","StaleReactionError");Bi(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function PP(o){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function JF(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function QF(o,e,t){throw new Error("https://svelte.dev/e/each_key_duplicate")}function eH(o){throw new Error("https://svelte.dev/e/effect_in_teardown")}function tH(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function iH(o){throw new Error("https://svelte.dev/e/effect_orphan")}function nH(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function sH(o){throw new Error("https://svelte.dev/e/props_invalid_value")}function oH(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function rH(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function aH(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function lH(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const cH=1,dH=2,TP=4,hH=8,uH=16,gH=1,fH=4,pH=8,mH=16,_H=1,vH=2,ks=Symbol("uninitialized"),MP="http://www.w3.org/1999/xhtml",bH="http://www.w3.org/2000/svg",yH="http://www.w3.org/1998/Math/MathML";function wH(){console.warn("https://svelte.dev/e/derived_inert")}function SH(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function CH(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function NP(o){return o===this.v}function xH(o,e){return o!=o?e==e:o!==e||o!==null&&typeof o=="object"||typeof o=="function"}function RP(o){return!xH(o,this.v)}let LH=!1,Us=null;function rg(o){Us=o}function Ro(o,e=!1,t){Us={p:Us,i:!1,c:null,e:null,s:o,x:null,r:en,l:null}}function Ao(o){var e=Us,t=e.e;if(t!==null){e.e=null;for(var i of t)iT(i)}return o!==void 0&&(e.x=o),e.i=!0,Us=e.p,o??{}}function AP(){return!0}let Kc=[];function OP(){var o=Kc;Kc=[],qF(o)}function Yl(o){if(Kc.length===0&&!If){var e=Kc;queueMicrotask(()=>{e===Kc&&OP()})}Kc.push(o)}function kH(){for(;Kc.length>0;)OP()}function FP(o){var e=en;if(e===null)return Ji.f|=Xl,o;if((e.f&Pg)===0&&(e.f&sg)===0)throw o;jl(o,e)}function jl(o,e){for(;e!==null;){if((e.f&uS)!==0){if((e.f&Pg)===0)throw o;try{e.b.error(o);return}catch(t){o=t}}e=e.parent}throw o}const IH=-7169;function fs(o,e){o.f=o.f&IH|e}function J0(o){(o.f&mr)!==0||o.deps===null?fs(o,Ds):fs(o,Ta)}function HP(o){if(o!==null)for(const e of o)(e.f&$s)===0||(e.f&th)===0||(e.f^=th,HP(e.deps))}function WP(o,e,t){(o.f&Os)!==0?e.add(o):(o.f&Ta)!==0&&t.add(o),HP(o.deps),fs(o,Ds)}let Mm=!1;function DH(o){var e=Mm;try{return Mm=!1,[o(),Mm]}finally{Mm=e}}let sw=null,Bh=null,gi=null,kf=null,Bs=null,mS=null,If=!1,ow=!1,hu=null,g_=null;var _k=0;let EH=1;var Pu,Wl,Yc,Tu,Mu,Nu,Ua,Ru,Co,Mp,$a,Mr,ua,Au,Jc,Yn,_S,lf,vS,BP,zP,tu,PH,cf;const tb=class tb{constructor(){Ti(this,Yn);Bi(this,"id",EH++);Ti(this,Pu,!1);Bi(this,"linked",!0);Ti(this,Wl,null);Ti(this,Yc,null);Bi(this,"async_deriveds",new Map);Bi(this,"current",new Map);Bi(this,"previous",new Map);Ti(this,Tu,new Set);Ti(this,Mu,new Set);Ti(this,Nu,0);Ti(this,Ua,new Map);Ti(this,Ru,null);Ti(this,Co,[]);Ti(this,Mp,[]);Ti(this,$a,new Set);Ti(this,Mr,new Set);Ti(this,ua,new Map);Ti(this,Au,new Set);Bi(this,"is_fork",!1);Ti(this,Jc,!1);Bh===null?sw=Bh=this:(Mi(Bh,Yc,this),Mi(this,Wl,Bh)),Bh=this}skip_effect(e){ee(this,ua).has(e)||ee(this,ua).set(e,{d:[],m:[]}),ee(this,Au).delete(e)}unskip_effect(e,t=i=>this.schedule(i)){var i=ee(this,ua).get(e);if(i){ee(this,ua).delete(e);for(var n of i.d)fs(n,Os),t(n);for(n of i.m)fs(n,Ta),t(n)}ee(this,Au).add(e)}capture(e,t,i=!1){e.v!==ks&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&Xl)===0&&(this.current.set(e,[t,i]),Bs==null||Bs.set(e,t)),this.is_fork||(e.v=t)}activate(){gi=this}deactivate(){gi=null,Bs=null}flush(){try{ow=!0,gi=this,In(this,Yn,lf).call(this)}finally{_k=0,mS=null,hu=null,g_=null,ow=!1,gi=null,Bs=null,rd.clear()}}discard(){var e;for(const t of ee(this,Mu))t(this);ee(this,Mu).clear(),In(this,Yn,cf).call(this),(e=ee(this,Ru))==null||e.resolve()}register_created_effect(e){ee(this,Mp).push(e)}increment(e,t){if(Mi(this,Nu,ee(this,Nu)+1),e){let i=ee(this,Ua).get(t)??0;ee(this,Ua).set(t,i+1)}}decrement(e,t){if(Mi(this,Nu,ee(this,Nu)-1),e){let i=ee(this,Ua).get(t)??0;i===1?ee(this,Ua).delete(t):ee(this,Ua).set(t,i-1)}ee(this,Jc)||(Mi(this,Jc,!0),Yl(()=>{Mi(this,Jc,!1),this.linked&&this.flush()}))}transfer_effects(e,t){for(const i of e)ee(this,$a).add(i);for(const i of t)ee(this,Mr).add(i);e.clear(),t.clear()}oncommit(e){ee(this,Tu).add(e)}ondiscard(e){ee(this,Mu).add(e)}settled(){return(ee(this,Ru)??Mi(this,Ru,DP())).promise}static ensure(){if(gi===null){const e=gi=new tb;!ow&&!If&&Yl(()=>{ee(e,Pu)||e.flush()})}return gi}apply(){{Bs=null;return}}schedule(e){var n;if(mS=e,(n=e.b)!=null&&n.is_pending&&(e.f&(sg|my|EP))!==0&&(e.f&Pg)===0){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var i=t.f;if(hu!==null&&t===en&&(Ji===null||(Ji.f&$s)===0))return;if((i&(vc|$r))!==0){if((i&Ds)===0)return;t.f^=Ds}}ee(this,Co).push(t)}};Pu=new WeakMap,Wl=new WeakMap,Yc=new WeakMap,Tu=new WeakMap,Mu=new WeakMap,Nu=new WeakMap,Ua=new WeakMap,Ru=new WeakMap,Co=new WeakMap,Mp=new WeakMap,$a=new WeakMap,Mr=new WeakMap,ua=new WeakMap,Au=new WeakMap,Jc=new WeakMap,Yn=new WeakSet,_S=function(){if(this.is_fork)return!0;for(const i of ee(this,Ua).keys()){for(var e=i,t=!1;e.parent!==null;){if(ee(this,ua).has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1},lf=function(){var c,h,g,f;Mi(this,Pu,!0),_k++>1e3&&(In(this,Yn,cf).call(this),MH());for(const p of ee(this,$a))ee(this,Mr).delete(p),fs(p,Os),this.schedule(p);for(const p of ee(this,Mr))fs(p,Ta),this.schedule(p);const e=ee(this,Co);Mi(this,Co,[]),this.apply();var t=hu=[],i=[],n=g_=[];for(const p of e)try{In(this,Yn,vS).call(this,p,t,i)}catch(v){throw UP(p),In(this,Yn,_S).call(this)||this.discard(),v}if(gi=null,n.length>0){var s=tb.ensure();for(const p of n)s.schedule(p)}if(hu=null,g_=null,In(this,Yn,_S).call(this)){In(this,Yn,tu).call(this,i),In(this,Yn,tu).call(this,t);for(const[p,v]of ee(this,ua))jP(p,v);n.length>0&&In(c=gi,Yn,lf).call(c);return}const r=In(this,Yn,BP).call(this);if(r){In(this,Yn,tu).call(this,i),In(this,Yn,tu).call(this,t),In(h=r,Yn,zP).call(h,this);return}ee(this,$a).clear(),ee(this,Mr).clear();for(const p of ee(this,Tu))p(this);ee(this,Tu).clear(),kf=this,vk(i),vk(t),kf=null,(g=ee(this,Ru))==null||g.resolve();var a=gi;if(ee(this,Nu)===0&&(ee(this,Co).length===0||a!==null)&&In(this,Yn,cf).call(this),ee(this,Co).length>0)if(a!==null){const p=a;ee(p,Co).push(...ee(this,Co).filter(v=>!ee(p,Co).includes(v)))}else a=this;a!==null&&In(f=a,Yn,lf).call(f)},vS=function(e,t,i){e.f^=Ds;for(var n=e.first;n!==null;){var s=n.f,r=(s&($r|vc))!==0,a=r&&(s&Ds)!==0,c=a||(s&fo)!==0||ee(this,ua).has(n);if(!c&&n.fn!==null){r?n.f^=Ds:(s&sg)!==0?t.push(n):im(n)&&((s&Vr)!==0&&ee(this,Mr).add(n),lg(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}}},BP=function(){for(var e=ee(this,Wl);e!==null;){if(!e.is_fork){for(const[t,[,i]]of this.current)if(e.current.has(t)&&!i)return e}e=ee(e,Wl)}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(ee(e,$a),ee(e,Mr));const t=n=>{var s=n.reactions;if(s!==null)for(const c of s){var r=c.f;if((r&$s)!==0)t(c);else{var a=c;r&(ku|Vr)&&!this.async_deriveds.has(a)&&(ee(this,Mr).delete(a),fs(a,Os),this.schedule(a))}}};for(const n of this.current.keys())t(n);this.oncommit(()=>e.discard()),In(i=e,Yn,cf).call(i),gi=this,In(this,Yn,lf).call(this)},tu=function(e){for(var t=0;t<e.length;t+=1)WP(e[t],ee(this,$a),ee(this,Mr))},PH=function(){var g;for(let f=sw;f!==null;f=ee(f,Yc)){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(ee(f,Pu)){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 ee(this,Au))f.unskip_effect(p,v=>{var _;(v.f&(Vr|ku))!==0?f.schedule(v):In(_=f,Yn,tu).call(_,[v])});f.activate();var s=new Set,r=new Map;for(var a of t)VP(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 ee(this,Mp))(p.f&(_r|fo|U_))===0&&Q0(p,c,r)&&((p.f&(ku|Vr))!==0?(fs(p,Os),f.schedule(p)):ee(f,$a).add(p));if(ee(f,Co).length>0&&!ee(f,Jc)){f.apply();for(var h of ee(f,Co))In(g=f,Yn,vS).call(g,h,[],[]);Mi(f,Co,[])}f.deactivate()}}}},cf=function(){if(this.linked){var e=ee(this,Wl),t=ee(this,Yc);e===null?sw=t:Mi(e,Yc,t),t===null?Bh=e:Mi(t,Wl,e),this.linked=!1}};let ih=tb;function TH(o){var e=If;If=!0;try{for(var t;;){if(kH(),gi===null)return t;gi.flush()}}finally{If=e}}function MH(){try{nH()}catch(o){jl(o,mS)}}let Er=null;function vk(o){var e=o.length;if(e!==0){for(var t=0;t<e;){var i=o[t++];if((i.f&(_r|fo))===0&&im(i)&&(Er=new Set,lg(i),i.deps===null&&i.first===null&&i.nodes===null&&i.teardown===null&&i.ac===null&&oT(i),(Er==null?void 0:Er.size)>0)){rd.clear();for(const n of Er){if((n.f&(_r|fo))!==0)continue;const s=[n];let r=n.parent;for(;r!==null;)Er.has(r)&&(Er.delete(r),s.push(r)),r=r.parent;for(let a=s.length-1;a>=0;a--){const c=s[a];(c.f&(_r|fo))===0&&lg(c)}}Er.clear()}}Er=null}}function VP(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&$s)!==0?VP(n,e,t,i):(s&(ku|Vr))!==0&&(s&Os)===0&&Q0(n,e,i)&&(fs(n,Os),e1(n))}}function Q0(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(j_.call(e,n))return!0;if((n.f&$s)!==0&&Q0(n,e,t))return t.set(n,!0),!0}return t.set(o,!1),!1}function e1(o){gi.schedule(o)}function jP(o,e){if(!((o.f&$r)!==0&&(o.f&Ds)!==0)){(o.f&Os)!==0?e.d.push(o):(o.f&Ta)!==0&&e.m.push(o),fs(o,Ds);for(var t=o.first;t!==null;)jP(t,e),t=t.next}}function UP(o){fs(o,Ds);for(var e=o.first;e!==null;)UP(e),e=e.next}function NH(o){let e=0,t=nh(0),i;return()=>{s1()&&(u(t),by(()=>(e===0&&(i=wl(()=>o(()=>Df(t)))),e+=1,()=>{Yl(()=>{e-=1,e===0&&(i==null||i(),i=void 0,Df(t))})})))}}var RH=og|Tg;function AH(o,e,t,i){new OH(o,e,t,i)}var ar,w0,lr,Qc,xo,cr,co,zo,qa,ed,Bl,Ou,Np,Rp,Ka,ib,ps,FH,HH,WH,bS,f_,p_,yS,wS;class OH{constructor(e,t,i,n){Ti(this,ps);Bi(this,"parent");Bi(this,"is_pending",!1);Bi(this,"transform_error");Ti(this,ar);Ti(this,w0,null);Ti(this,lr);Ti(this,Qc);Ti(this,xo);Ti(this,cr,null);Ti(this,co,null);Ti(this,zo,null);Ti(this,qa,null);Ti(this,ed,0);Ti(this,Bl,0);Ti(this,Ou,!1);Ti(this,Np,new Set);Ti(this,Rp,new Set);Ti(this,Ka,null);Ti(this,ib,NH(()=>(Mi(this,Ka,nh(ee(this,ed))),()=>{Mi(this,Ka,null)})));var s;Mi(this,ar,e),Mi(this,lr,t),Mi(this,Qc,r=>{var a=en;a.b=this,a.f|=uS,i(r)}),this.parent=en.b,this.transform_error=n??((s=this.parent)==null?void 0:s.transform_error)??(r=>r),Mi(this,xo,a1(()=>{In(this,ps,bS).call(this)},RH))}defer_effect(e){WP(e,ee(this,Np),ee(this,Rp))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!ee(this,lr).pending}update_pending_count(e,t){In(this,ps,yS).call(this,e,t),Mi(this,ed,ee(this,ed)+e),!(!ee(this,Ka)||ee(this,Ou))&&(Mi(this,Ou,!0),Yl(()=>{Mi(this,Ou,!1),ee(this,Ka)&&ag(ee(this,Ka),ee(this,ed))}))}get_effect_pending(){return ee(this,ib).call(this),u(ee(this,Ka))}error(e){if(!ee(this,lr).onerror&&!ee(this,lr).failed)throw e;gi!=null&&gi.is_fork?(ee(this,cr)&&gi.skip_effect(ee(this,cr)),ee(this,co)&&gi.skip_effect(ee(this,co)),ee(this,zo)&&gi.skip_effect(ee(this,zo)),gi.oncommit(()=>{In(this,ps,wS).call(this,e)})):In(this,ps,wS).call(this,e)}}ar=new WeakMap,w0=new WeakMap,lr=new WeakMap,Qc=new WeakMap,xo=new WeakMap,cr=new WeakMap,co=new WeakMap,zo=new WeakMap,qa=new WeakMap,ed=new WeakMap,Bl=new WeakMap,Ou=new WeakMap,Np=new WeakMap,Rp=new WeakMap,Ka=new WeakMap,ib=new WeakMap,ps=new WeakSet,FH=function(){try{Mi(this,cr,dr(()=>ee(this,Qc).call(this,ee(this,ar))))}catch(e){this.error(e)}},HH=function(e){const t=ee(this,lr).failed;t&&Mi(this,zo,dr(()=>{t(ee(this,ar),()=>e,()=>()=>{})}))},WH=function(){const e=ee(this,lr).pending;e&&(this.is_pending=!0,Mi(this,co,dr(()=>e(ee(this,ar)))),Yl(()=>{var t=Mi(this,qa,document.createDocumentFragment()),i=nl();t.append(i),Mi(this,cr,In(this,ps,p_).call(this,()=>dr(()=>ee(this,Qc).call(this,i)))),ee(this,Bl)===0&&(ee(this,ar).before(t),Mi(this,qa,null),ld(ee(this,co),()=>{Mi(this,co,null)}),In(this,ps,f_).call(this,gi))}))},bS=function(){try{if(this.is_pending=this.has_pending_snippet(),Mi(this,Bl,0),Mi(this,ed,0),Mi(this,cr,dr(()=>{ee(this,Qc).call(this,ee(this,ar))})),ee(this,Bl)>0){var e=Mi(this,qa,document.createDocumentFragment());c1(ee(this,cr),e);const t=ee(this,lr).pending;Mi(this,co,dr(()=>t(ee(this,ar))))}else In(this,ps,f_).call(this,gi)}catch(t){this.error(t)}},f_=function(e){this.is_pending=!1,e.transfer_effects(ee(this,Np),ee(this,Rp))},p_=function(e){var t=en,i=Ji,n=Us;Ma(ee(this,xo)),yr(ee(this,xo)),rg(ee(this,xo).ctx);try{return ih.ensure(),e()}catch(s){return FP(s),null}finally{Ma(t),yr(i),rg(n)}},yS=function(e,t){var i;if(!this.has_pending_snippet()){this.parent&&In(i=this.parent,ps,yS).call(i,e,t);return}Mi(this,Bl,ee(this,Bl)+e),ee(this,Bl)===0&&(In(this,ps,f_).call(this,t),ee(this,co)&&ld(ee(this,co),()=>{Mi(this,co,null)}),ee(this,qa)&&(ee(this,ar).before(ee(this,qa)),Mi(this,qa,null)))},wS=function(e){ee(this,cr)&&(To(ee(this,cr)),Mi(this,cr,null)),ee(this,co)&&(To(ee(this,co)),Mi(this,co,null)),ee(this,zo)&&(To(ee(this,zo)),Mi(this,zo,null));var t=ee(this,lr).onerror;let i=ee(this,lr).failed;var n=!1,s=!1;const r=()=>{if(n){CH();return}n=!0,s&&lH(),ee(this,zo)!==null&&ld(ee(this,zo),()=>{Mi(this,zo,null)}),In(this,ps,p_).call(this,()=>{In(this,ps,bS).call(this)})},a=c=>{try{s=!0,t==null||t(c,r),s=!1}catch(h){jl(h,ee(this,xo)&&ee(this,xo).parent)}i&&Mi(this,zo,In(this,ps,p_).call(this,()=>{try{return dr(()=>{var h=en;h.b=this,h.f|=uS,i(ee(this,ar),()=>c,()=>r)})}catch(h){return jl(h,ee(this,xo).parent),null}}))};Yl(()=>{var c;try{c=this.transform_error(e)}catch(h){jl(h,ee(this,xo)&&ee(this,xo).parent);return}c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(a,h=>jl(h,ee(this,xo)&&ee(this,xo).parent)):a(c)})};function BH(o,e,t,i){const n=tp;var s=o.filter(p=>!p.settled);if(t.length===0&&s.length===0){i(e.map(n));return}var r=en,a=zH(),c=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(p=>p.promise)):null;function h(p){if((r.f&_r)===0){a();try{i(p)}catch(v){jl(v,r)}q_()}}var g=$P();if(t.length===0){c.then(()=>h(e.map(n))).finally(g);return}function f(){Promise.all(t.map(p=>VH(p))).then(p=>h([...e.map(n),...p])).catch(p=>jl(p,r)).finally(g)}c?c.then(()=>{a(),f(),q_()}):f()}function zH(){var o=en,e=Ji,t=Us,i=gi;return function(s=!0){Ma(o),yr(e),rg(t),s&&(o.f&_r)===0&&(i==null||i.activate(),i==null||i.apply())}}function q_(o=!0){Ma(null),yr(null),rg(null),o&&(gi==null||gi.deactivate())}function $P(){var o=en,e=o.b,t=gi,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 tp(o){var e=$s|Os;return en!==null&&(en.f|=Tg),{ctx:Us,deps:null,effects:null,equals:NP,f:e,fn:o,reactions:null,rv:0,v:ks,wv:0,parent:en,ac:null}}const Nm=Symbol("obsolete");function VH(o,e,t){let i=en;i===null&&JF();var n=void 0,s=nh(ks),r=!Ji,a=new Set;return eW(()=>{var v,_;var c=en,h=DP();n=h.promise;try{Promise.resolve(o()).then(h.resolve,w=>{w!==_y&&h.reject(w)}).finally(q_)}catch(w){h.reject(w),q_()}var g=gi;if(r){if((c.f&Pg)!==0)var f=$P();if((v=i.b)!=null&&v.is_rendered())(_=g.async_deriveds.get(c))==null||_.reject(Nm);else for(const w of a.values())w.reject(Nm);a.add(h),g.async_deriveds.set(c,h)}const p=(w,S=void 0)=>{f==null||f(),a.delete(h),S!==Nm&&(g.activate(),S?(s.f|=Xl,ag(s,S)):((s.f&Xl)!==0&&(s.f^=Xl),ag(s,w)),g.deactivate())};h.promise.then(p,w=>p(null,w||"unknown"))}),o1(()=>{for(const c of a)c.reject(Nm)}),new Promise(c=>{function h(g){function f(){g===n?c(s):h(n)}g.then(f,f)}h(n)})}function rt(o){const e=tp(o);return lT(e),e}function t1(o){const e=tp(o);return e.equals=RP,e}function jH(o){var e=o.effects;if(e!==null){o.effects=null;for(var t=0;t<e.length;t+=1)To(e[t])}}function i1(o){var e,t=en,i=o.parent;if(!hl&&i!==null&&o.v!==ks&&(i.f&(_r|fo))!==0)return wH(),o.v;Ma(i);try{o.f&=~th,jH(o),e=uT(o)}finally{Ma(t)}return e}function qP(o){var e=i1(o);if(!o.equals(e)&&(o.wv=dT(),(!(gi!=null&&gi.is_fork)||o.deps===null)&&(gi!==null?(gi.capture(o,e,!0),kf==null||kf.capture(o,e,!0)):o.v=e,o.deps===null))){fs(o,Ds);return}hl||(Bs!==null?(s1()||gi!=null&&gi.is_fork)&&Bs.set(o,e):J0(o))}function UH(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(_y),i.fn!==null&&(i.teardown=py),i.ac=null,ip(i,0),l1(i))}function KP(o){if(o.effects!==null)for(const e of o.effects)e.teardown&&e.fn!==null&&lg(e)}let K_=new Set;const rd=new Map;let GP=!1;function nh(o,e){var t={f:0,v:o,reactions:null,equals:NP,rv:0,wv:0};return t}function B(o,e){const t=nh(o);return lT(t),t}function $H(o,e=!1,t=!0){const i=nh(o);return e||(i.equals=RP),i}function k(o,e,t=!1){Ji!==null&&(!jr||(Ji.f&U_)!==0)&&AP()&&(Ji.f&($s|Vr|ku|U_))!==0&&(Ia===null||!Ia.has(o))&&aH();let i=t?Si(e):e;return ag(o,i,g_)}function ag(o,e,t=null){if(!o.equals(e)){rd.set(o,hl?e:o.v);var i=ih.ensure();if(i.capture(o,e),(o.f&$s)!==0){const n=o;(o.f&Os)!==0&&i1(n),Bs===null&&J0(n)}o.wv=dT(),ZP(o,Os,t),en!==null&&(en.f&Ds)!==0&&(en.f&($r|vc))===0&&(rr===null?iW([o]):rr.push(o)),!i.is_fork&&K_.size>0&&!GP&&qH()}return e}function qH(){GP=!1;for(const o of K_){(o.f&Ds)!==0&&fs(o,Ta);let e;try{e=im(o)}catch{e=!0}e&&lg(o)}K_.clear()}function bk(o,e=1){var t=u(o),i=e===1?t++:t--;return k(o,t),i}function Df(o){k(o,o.v+1)}function ZP(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&Os)===0;if(c&&fs(r,e),(a&U_)!==0)K_.add(r);else if((a&$s)!==0){var h=r;Bs==null||Bs.delete(h),(a&th)===0&&(a&mr&&(en===null||(en.f&$_)===0)&&(r.f|=th),ZP(h,Ta,t))}else if(c){var g=r;(a&Vr)!==0&&Er!==null&&Er.add(g),t!==null?t.push(g):e1(g)}}}function Si(o){if(typeof o!="object"||o===null||od in o)return o;const e=IP(o);if(e!==UF&&e!==$F)return o;var t=new Map,i=Y0(o),n=B(0),s=cd,r=a=>{if(cd===s)return a();var c=Ji,h=cd;yr(null),Ck(s);var g=a();return yr(c),Ck(h),g};return i&&t.set("length",B(o.length)),new Proxy(o,{defineProperty(a,c,h){(!("value"in h)||h.configurable===!1||h.enumerable===!1||h.writable===!1)&&oH();var g=t.get(c);return g===void 0?r(()=>{var f=B(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(()=>B(ks));t.set(c,g),Df(n)}}else k(h,ks),Df(n);return!0},get(a,c,h){var v;if(c===od)return o;var g=t.get(c),f=c in a;if(g===void 0&&(!f||(v=Lu(a,c))!=null&&v.writable)&&(g=r(()=>{var _=Si(f?a[c]:ks),w=B(_);return w}),t.set(c,g)),g!==void 0){var p=u(g);return p===ks?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!==ks)return{enumerable:!0,configurable:!0,value:p,writable:!0}}return h},has(a,c){var p;if(c===od)return!0;var h=t.get(c),g=h!==void 0&&h.v!==ks||Reflect.has(a,c);if(h!==void 0||en!==null&&(!g||(p=Lu(a,c))!=null&&p.writable)){h===void 0&&(h=r(()=>{var v=g?Si(a[c]):ks,_=B(v);return _}),t.set(c,h));var f=u(h);if(f===ks)return!1}return g},set(a,c,h,g){var N;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(_,ks):v in a&&(_=r(()=>B(ks)),t.set(v+"",_))}if(f===void 0)(!p||(N=Lu(a,c))!=null&&N.writable)&&(f=r(()=>B(void 0)),k(f,Si(h)),t.set(c,f));else{p=f.v!==ks;var w=r(()=>Si(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"),P=Number(c);Number.isInteger(P)&&P>=D.v&&k(D,P+1)}Df(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!==ks});for(var[h,g]of t)g.v!==ks&&!(h in a)&&c.push(h);return c},setPrototypeOf(){rH()}})}function yk(o){try{if(o!==null&&typeof o=="object"&&od in o)return o[od]}catch{}return o}function KH(o,e){return Object.is(yk(o),yk(e))}var ad,XP,YP,JP,QP;function GH(){if(ad===void 0){ad=window,XP=document,YP=/Firefox/.test(navigator.userAgent);var o=Element.prototype,e=Node.prototype,t=Text.prototype;JP=Lu(e,"firstChild").get,QP=Lu(e,"nextSibling").get,pk(o)&&(o[fS]=void 0,o[h_]=null,o[pS]=void 0,o.__e=void 0),pk(t)&&(t[af]=void 0)}}function nl(o=""){return document.createTextNode(o)}function Sa(o){return JP.call(o)}function tm(o){return QP.call(o)}function C(o,e){return Sa(o)}function bt(o,e=!1){{var t=Sa(o);return t instanceof Comment&&t.data===""?tm(t):t}}function x(o,e=1,t=!1){let i=o;for(;e--;)i=tm(i);return i}function ZH(o){o.textContent=""}function eT(){return!1}function tT(o,e,t){return e==null||e===MP?t?document.createElement(o,{is:t}):document.createElement(o):t?document.createElementNS(e,o,{is:t}):document.createElementNS(e,o)}let wk=!1;function XH(){wk||(wk=!0,document.addEventListener("reset",o=>{Promise.resolve().then(()=>{var e;if(!o.defaultPrevented)for(const t of o.target.elements)(e=t[u_])==null||e.call(t)})},{capture:!0}))}function vy(o){var e=Ji,t=en;yr(null),Ma(null);try{return o()}finally{yr(e),Ma(t)}}function n1(o,e,t,i=t){o.addEventListener(e,()=>vy(t));const n=o[u_];n?o[u_]=()=>{n(),i(!0)}:o[u_]=()=>i(!0),XH()}function YH(o){en===null&&(Ji===null&&iH(),tH()),hl&&eH()}function JH(o,e){var t=e.last;t===null?e.last=e.first=o:(t.next=o,o.prev=t,e.last=o)}function yl(o,e){var t=en;t!==null&&(t.f&fo)!==0&&(o|=fo);var i={ctx:Us,deps:null,nodes:null,f:o|Os|mr,first:null,fn:e,last:null,next:null,parent:t,b:t&&t.b,prev:null,teardown:null,wv:0,ac:null};gi==null||gi.register_created_effect(i);var n=i;if((o&sg)!==0)hu!==null?hu.push(i):ih.ensure().schedule(i);else if(e!==null){try{lg(i)}catch(r){throw To(i),r}n.deps===null&&n.teardown===null&&n.nodes===null&&n.first===n.last&&(n.f&Tg)===0&&(n=n.first,(o&Vr)!==0&&(o&og)!==0&&n!==null&&(n.f|=og))}if(n!==null&&(n.parent=t,t!==null&&JH(n,t),Ji!==null&&(Ji.f&$s)!==0&&(o&vc)===0)){var s=Ji;(s.effects??(s.effects=[])).push(n)}return i}function s1(){return Ji!==null&&!jr}function o1(o){const e=yl(my,null);return fs(e,Ds),e.teardown=o,e}function zn(o){YH();var e=en.f,t=!Ji&&(e&$r)!==0&&Us!==null&&!Us.i;if(t){var i=Us;(i.e??(i.e=[])).push(o)}else return iT(o)}function iT(o){return yl(sg|ZF,o)}function QH(o){ih.ensure();const e=yl(vc|Tg,o);return(t={})=>new Promise(i=>{t.outro?ld(e,()=>{To(e),i(void 0)}):(To(e),i(void 0))})}function r1(o){return yl(sg,o)}function eW(o){return yl(ku|Tg,o)}function by(o,e=0){return yl(my|e,o)}function G(o,e=[],t=[],i=[]){BH(i,e,t,n=>{yl(my,()=>o(...n.map(u)))})}function a1(o,e=0){var t=yl(Vr|e,o);return t}function dr(o){return yl($r|Tg,o)}function nT(o){var e=o.teardown;if(e!==null){const t=hl,i=Ji;Sk(!0),yr(null);try{e.call(null)}finally{Sk(t),yr(i)}}}function l1(o,e=!1){var t=o.first;for(o.first=o.last=null;t!==null;){const n=t.ac;n!==null&&vy(()=>{n.abort(_y)});var i=t.next;(t.f&vc)!==0?t.parent=null:To(t,e),t=i}}function tW(o){for(var e=o.first;e!==null;){var t=e.next;(e.f&$r)===0&&To(e),e=t}}function To(o,e=!0){var t=!1;(e||(o.f&GF)!==0)&&o.nodes!==null&&o.nodes.end!==null&&(sT(o.nodes.start,o.nodes.end),t=!0),fs(o,gS),l1(o,e&&!t),ip(o,0);var i=o.nodes&&o.nodes.t;if(i!==null)for(const s of i)s.stop();nT(o),o.f^=gS,o.f|=_r;var n=o.parent;n!==null&&n.first!==null&&oT(o),o.next=o.prev=o.teardown=o.ctx=o.deps=o.fn=o.nodes=o.ac=o.b=null}function sT(o,e){for(;o!==null;){var t=o===e?null:tm(o);o.remove(),o=t}}function oT(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 ld(o,e,t=!0){var i=[];rT(o,i,!0);var n=()=>{t&&To(o),e&&e()},s=i.length;if(s>0){var r=()=>--s||n();for(var a of i)a.out(r)}else n()}function rT(o,e,t){if((o.f&fo)===0){o.f^=fo;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&vc)===0){var r=(n.f&og)!==0||(n.f&$r)!==0&&(o.f&Vr)!==0;rT(n,e,r?t:!1)}n=s}}}function G_(o){aT(o,!0)}function aT(o,e){if((o.f&fo)!==0){o.f^=fo,(o.f&Ds)===0&&(fs(o,Os),ih.ensure().schedule(o));for(var t=o.first;t!==null;){var i=t.next,n=(t.f&og)!==0||(t.f&$r)!==0;aT(t,n?e:!1),t=i}var s=o.nodes&&o.nodes.t;if(s!==null)for(const r of s)(r.is_global||e)&&r.in()}}function c1(o,e){if(o.nodes)for(var t=o.nodes.start,i=o.nodes.end;t!==null;){var n=t===i?null:tm(t);e.append(t),t=n}}let m_=!1,hl=!1;function Sk(o){hl=o}let Ji=null,jr=!1;function yr(o){Ji=o}let en=null;function Ma(o){en=o}let Ia=null;function lT(o){Ji!==null&&(Ia??(Ia=new Set)).add(o)}let Lo=null,Wo=0,rr=null;function iW(o){rr=o}let cT=1,Gc=0,cd=Gc;function Ck(o){cd=o}function dT(){return++cT}function im(o){var e=o.f;if((e&Os)!==0)return!0;if(e&$s&&(o.f&=~th),(e&Ta)!==0){for(var t=o.deps,i=t.length,n=0;n<i;n++){var s=t[n];if(im(s)&&qP(s),s.wv>o.wv)return!0}(e&mr)!==0&&Bs===null&&fs(o,Ds)}return!1}function hT(o,e,t=!0){var i=o.reactions;if(i!==null&&!(Ia!==null&&Ia.has(o)))for(var n=0;n<i.length;n++){var s=i[n];(s.f&$s)!==0?hT(s,e,!1):e===s&&(t?fs(s,Os):(s.f&Ds)!==0&&fs(s,Ta),e1(s))}}function uT(o){var w;var e=Lo,t=Wo,i=rr,n=Ji,s=Ia,r=Us,a=jr,c=cd,h=o.f;Lo=null,Wo=0,rr=null,Ji=(h&($r|vc))===0?o:null,Ia=null,rg(o.ctx),jr=!1,cd=++Gc,o.ac!==null&&(vy(()=>{o.ac.abort(_y)}),o.ac=null);try{o.f|=$_;var g=o.fn,f=g();o.f|=Pg;var p=o.deps,v=gi==null?void 0:gi.is_fork;if(Lo!==null){var _;if(v||ip(o,Wo),p!==null&&Wo>0)for(p.length=Wo+Lo.length,_=0;_<Lo.length;_++)p[Wo+_]=Lo[_];else o.deps=p=Lo;if(s1()&&(o.f&mr)!==0)for(_=Wo;_<p.length;_++)((w=p[_]).reactions??(w.reactions=[])).push(o)}else!v&&p!==null&&Wo<p.length&&(ip(o,Wo),p.length=Wo);if(AP()&&rr!==null&&!jr&&p!==null&&(o.f&($s|Ta|Os))===0)for(_=0;_<rr.length;_++)hT(rr[_],o);if(n!==null&&n!==o){if(Gc++,n.deps!==null)for(let S=0;S<t;S+=1)n.deps[S].rv=Gc;if(e!==null)for(const S of e)S.rv=Gc;rr!==null&&(i===null?i=rr:i.push(...rr))}return(o.f&Xl)!==0&&(o.f^=Xl),f}catch(S){return FP(S)}finally{o.f^=$_,Lo=e,Wo=t,rr=i,Ji=n,Ia=s,rg(r),jr=a,cd=c}}function nW(o,e){let t=e.reactions;if(t!==null){var i=zF.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&$s)!==0&&(Lo===null||!j_.call(Lo,e))){var s=e;(s.f&mr)!==0&&(s.f^=mr,s.f&=~th),s.v!==ks&&J0(s),UH(s),ip(s,0)}}function ip(o,e){var t=o.deps;if(t!==null)for(var i=e;i<t.length;i++)nW(o,t[i])}function lg(o){var e=o.f;if((e&_r)===0){fs(o,Ds);var t=en,i=m_;en=o,m_=!0;try{(e&(Vr|EP))!==0?tW(o):l1(o),nT(o);var n=uT(o);o.teardown=typeof n=="function"?n:null,o.wv=cT;var s;kP&&LH&&(o.f&Os)!==0&&o.deps}finally{m_=i,en=t}}}async function __(){await Promise.resolve(),TH()}function u(o){var e=o.f,t=(e&$s)!==0;if(Ji!==null&&!jr){var i=en!==null&&(en.f&_r)!==0;if(!i&&(Ia===null||!Ia.has(o))){var n=Ji.deps;if((Ji.f&$_)!==0)o.rv<Gc&&(o.rv=Gc,Lo===null&&n!==null&&n[Wo]===o?Wo++:Lo===null?Lo=[o]:Lo.push(o));else{Ji.deps??(Ji.deps=[]),j_.call(Ji.deps,o)||Ji.deps.push(o);var s=o.reactions;s===null?o.reactions=[Ji]:j_.call(s,Ji)||s.push(Ji)}}}if(hl&&rd.has(o))return rd.get(o);if(t){var r=o;if(hl){var a=r.v;return((r.f&Ds)===0&&r.reactions!==null||fT(r))&&(a=i1(r)),rd.set(r,a),a}var c=(r.f&mr)===0&&!jr&&Ji!==null&&(m_||(Ji.f&mr)!==0),h=(r.f&Pg)===0;im(r)&&(c&&(r.f|=mr),qP(r)),c&&!h&&(KP(r),gT(r))}if(Bs!=null&&Bs.has(o))return Bs.get(o);if((o.f&Xl)!==0)throw o.v;return o.v}function gT(o){if(o.f|=mr,o.deps!==null)for(const e of o.deps)(e.reactions??(e.reactions=[])).push(o),(e.f&$s)!==0&&(e.f&mr)===0&&(KP(e),gT(e))}function fT(o){if(o.v===ks)return!0;if(o.deps===null)return!1;for(const e of o.deps)if(rd.has(e)||(e.f&$s)!==0&&fT(e))return!0;return!1}function wl(o){var e=jr;try{return jr=!0,o()}finally{jr=e}}const sW=["touchstart","touchmove"];function oW(o){return sW.includes(o)}const Zc=Symbol("events"),pT=new Set,SS=new Set;function rW(o,e,t,i={}){function n(s){if(i.capture||CS.call(e,s),!s.cancelBubble)return vy(()=>t==null?void 0:t.call(this,s))}return o.startsWith("pointer")||o.startsWith("touch")||o==="wheel"?Yl(()=>{e.addEventListener(o,n,i)}):e.addEventListener(o,n,i),n}function os(o,e,t,i,n){var s={capture:i,passive:n},r=rW(o,e,t,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&o1(()=>{e.removeEventListener(o,r,s)})}function te(o,e,t){(e[Zc]??(e[Zc]={}))[o]=t}function Cr(o){for(var e=0;e<o.length;e++)pT.add(o[e]);for(var t of SS)t(o)}let xk=null;function CS(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;xk=o;var r=0,a=xk===o&&o[Zc];if(a){var c=n.indexOf(a);if(c!==-1&&(e===document||e===window)){o[Zc]=e;return}var h=n.indexOf(e);if(h===-1)return;c<=h&&(r=c)}if(s=n[r]||o.target,s!==e){VF(o,"currentTarget",{configurable:!0,get(){return s||t}});var g=Ji,f=en;yr(null),Ma(null);try{for(var p,v=[];s!==null&&s!==e;){try{var _=(S=s[Zc])==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[Zc]=e,delete o.currentTarget,yr(g),Ma(f)}}}var ZD;const rw=((ZD=globalThis==null?void 0:globalThis.window)==null?void 0:ZD.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:o=>o});function aW(o){return(rw==null?void 0:rw.createHTML(o))??o}function mT(o){var e=tT("template");return e.innerHTML=aW(o.replaceAll("<!>","<!---->")),e.content}function sh(o,e){var t=en;t.nodes===null&&(t.nodes={start:o,end:e,a:null,t:null})}function R(o,e){var t=(e&_H)!==0,i=(e&vH)!==0,n,s=!o.startsWith("<!>");return()=>{n===void 0&&(n=mT(s?o:"<!>"+o),t||(n=Sa(n)));var r=i||YP?document.importNode(n,!0):n.cloneNode(!0);if(t){var a=Sa(r),c=r.lastChild;sh(a,c)}else sh(r,r);return r}}function lW(o,e,t="svg"){var i=!o.startsWith("<!>"),n=`<${t}>${i?o:"<!>"+o}</${t}>`,s;return()=>{if(!s){var r=mT(n),a=Sa(r);s=Sa(a)}var c=s.cloneNode(!0);return sh(c,c),c}}function _T(o,e){return lW(o,e,"svg")}function Ur(o=""){{var e=nl(o+"");return sh(e,e),e}}function Fs(){var o=document.createDocumentFragment(),e=document.createComment(""),t=nl();return o.append(e,t),sh(e,t),o}function T(o,e){o!==null&&o.before(e)}function q(o,e){var t=e==null?"":typeof e=="object"?`${e}`:e;t!==(o[af]??(o[af]=o.nodeValue))&&(o[af]=t,o.nodeValue=`${t}`)}function cW(o,e){return dW(o,e)}const Rm=new Map;function dW(o,{target:e,anchor:t,props:i={},events:n,context:s,intro:r=!0,transformError:a}){GH();var c=void 0,h=QH(()=>{var g=t??e.appendChild(nl());AH(g,{pending:()=>{}},v=>{Ro({});var _=Us;s&&(_.c=s),n&&(i.$$events=n),c=o(v,i)||{},Ao()},a);var f=new Set,p=v=>{for(var _=0;_<v.length;_++){var w=v[_];if(!f.has(w)){f.add(w);var S=oW(w);for(const N of[e,document]){var D=Rm.get(N);D===void 0&&(D=new Map,Rm.set(N,D));var P=D.get(w);P===void 0?(N.addEventListener(w,CS,{passive:S}),D.set(w,1)):D.set(w,P+1)}}}};return p(fy(pT)),SS.add(p),()=>{var S;for(var v of f)for(const D of[e,document]){var _=Rm.get(D),w=_.get(v);--w==0?(D.removeEventListener(v,CS),_.delete(v),_.size===0&&Rm.delete(D)):_.set(v,w)}SS.delete(p),g!==t&&((S=g.parentNode)==null||S.removeChild(g))}});return hW.set(c,h),c}let hW=new WeakMap;var Nr,ga,Vo,td,Ap,Op,nb;class uW{constructor(e,t=!0){Bi(this,"anchor");Ti(this,Nr,new Map);Ti(this,ga,new Map);Ti(this,Vo,new Map);Ti(this,td,new Set);Ti(this,Ap,!0);Ti(this,Op,e=>{if(ee(this,Nr).has(e)){var t=ee(this,Nr).get(e),i=ee(this,ga).get(t);if(i)G_(i),ee(this,td).delete(t);else{var n=ee(this,Vo).get(t);n&&(G_(n.effect),ee(this,ga).set(t,n.effect),ee(this,Vo).delete(t),n.fragment.lastChild.remove(),this.anchor.before(n.fragment),i=n.effect)}for(const[s,r]of ee(this,Nr)){if(ee(this,Nr).delete(s),s===e)break;const a=ee(this,Vo).get(r);a&&(To(a.effect),ee(this,Vo).delete(r))}for(const[s,r]of ee(this,ga)){if(s===t||ee(this,td).has(s))continue;const a=()=>{if(Array.from(ee(this,Nr).values()).includes(s)){var h=document.createDocumentFragment();c1(r,h),h.append(nl()),ee(this,Vo).set(s,{effect:r,fragment:h})}else To(r);ee(this,td).delete(s),ee(this,ga).delete(s)};ee(this,Ap)||!i?(ee(this,td).add(s),ld(r,a,!1)):a()}}});Ti(this,nb,e=>{ee(this,Nr).delete(e);const t=Array.from(ee(this,Nr).values());for(const[i,n]of ee(this,Vo))t.includes(i)||(To(n.effect),ee(this,Vo).delete(i))});this.anchor=e,Mi(this,Ap,t)}ensure(e,t){var i=gi,n=eT();if(t&&!ee(this,ga).has(e)&&!ee(this,Vo).has(e))if(n){var s=document.createDocumentFragment(),r=nl();s.append(r),ee(this,Vo).set(e,{effect:dr(()=>t(r)),fragment:s})}else ee(this,ga).set(e,dr(()=>t(this.anchor)));if(ee(this,Nr).set(i,e),n){for(const[a,c]of ee(this,ga))a===e?i.unskip_effect(c):i.skip_effect(c);for(const[a,c]of ee(this,Vo))a===e?i.unskip_effect(c.effect):i.skip_effect(c.effect);i.oncommit(ee(this,Op)),i.ondiscard(ee(this,nb))}else ee(this,Op).call(this,i)}}Nr=new WeakMap,ga=new WeakMap,Vo=new WeakMap,td=new WeakMap,Ap=new WeakMap,Op=new WeakMap,nb=new WeakMap;function $(o,e,t=!1){var i=new uW(o),n=t?og:0;function s(r,a){i.ensure(r,a)}a1(()=>{var r=!1;e((a,c=0)=>{r=!0,s(c,a)}),r||s(-1,null)},n)}function Vn(o,e){return e}function gW(o,e,t){for(var i=[],n=e.length,s,r=e.length,a=0;a<n;a++){let f=e[a];ld(f,()=>{if(s){if(s.pending.delete(f),s.done.add(f),s.pending.size===0){var p=o.outrogroups;xS(o,fy(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;ZH(g),g.append(h),o.items.clear()}xS(o,e,!c)}else s={pending:new Set(e),done:new Set},(o.outrogroups??(o.outrogroups=new Set)).add(s)}function xS(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|=wa;const r=document.createDocumentFragment();c1(s,r)}else To(e[n],t)}}var Lk;function _i(o,e,t,i,n,s=null){var r=o,a=new Map,c=(e&TP)!==0;if(c){var h=o;r=h.appendChild(nl())}var g=null,f=t1(()=>{var N=t();return Y0(N)?N:N==null?[]:fy(N)}),p,v=new Map,_=!0;function w(N){(P.effect.f&_r)===0&&(P.pending.delete(N),P.fallback=g,fW(P,p,r,e,i),g!==null&&(p.length===0?(g.f&wa)===0?G_(g):(g.f^=wa,df(g,null,r)):ld(g,()=>{g=null})))}function S(N){P.pending.delete(N)}var D=a1(()=>{p=u(f);for(var N=p.length,V=new Set,F=gi,Y=eT(),X=0;X<N;X+=1){var me=p[X],Le=i(me,X),je=_?null:a.get(Le);je?(je.v&&ag(je.v,me),je.i&&ag(je.i,X),Y&&F.unskip_effect(je.e)):(je=pW(a,_?r:Lk??(Lk=nl()),me,Le,X,n,e,t),_||(je.e.f|=wa),a.set(Le,je)),V.add(Le)}if(N===0&&s&&!g&&(_?g=dr(()=>s(r)):(g=dr(()=>s(Lk??(Lk=nl()))),g.f|=wa)),N>V.size&&QF(),!_)if(v.set(F,V),Y){for(const[ve,st]of a)V.has(ve)||F.skip_effect(st.e);F.oncommit(w),F.ondiscard(S)}else w(F);u(f)}),P={effect:D,items:a,pending:v,outrogroups:null,fallback:g};_=!1}function Xg(o){for(;o!==null&&(o.f&$r)===0;)o=o.next;return o}function fW(o,e,t,i,n){var je,ve,st,Ot,yt,ai,jt,Qt,Ne;var s=(i&hH)!==0,r=e.length,a=o.items,c=Xg(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&wa)===0&&((ve=(je=S.nodes)==null?void 0:je.a)==null||ve.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 Ge of o.outrogroups)Ge.pending.delete(S),Ge.done.delete(S);if((S.f&fo)!==0&&(G_(S),s&&((Ot=(st=S.nodes)==null?void 0:st.a)==null||Ot.unfix(),(f??(f=new Set)).delete(S))),(S.f&wa)!==0)if(S.f^=wa,S===c)df(S,null,t);else{var P=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),Il(o,g,S),Il(o,S,P),df(S,P,t),g=S,p=[],v=[],c=Xg(g.next);continue}if(S!==c){if(h!==void 0&&h.has(S)){if(p.length<v.length){var N=v[0],V;g=N.prev;var F=p[0],Y=p[p.length-1];for(V=0;V<p.length;V+=1)df(p[V],N,t);for(V=0;V<v.length;V+=1)h.delete(v[V]);Il(o,F.prev,Y.next),Il(o,g,F),Il(o,Y,N),c=N,g=Y,D-=1,p=[],v=[]}else h.delete(S),df(S,c,t),Il(o,S.prev,S.next),Il(o,S,g===null?o.effect.first:g.next),Il(o,g,S),g=S;continue}for(p=[],v=[];c!==null&&c!==S;)(h??(h=new Set)).add(c),v.push(c),c=Xg(c.next);if(c===null)continue}(S.f&wa)===0&&p.push(S),g=S,c=Xg(S.next)}if(o.outrogroups!==null){for(const Ge of o.outrogroups)Ge.pending.size===0&&(xS(o,fy(Ge.done)),(yt=o.outrogroups)==null||yt.delete(Ge));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&fo)===0&&X.push(S);for(;c!==null;)(c.f&fo)===0&&c!==o.fallback&&X.push(c),c=Xg(c.next);var me=X.length;if(me>0){var Le=(i&TP)!==0&&r===0?t:null;if(s){for(D=0;D<me;D+=1)(jt=(ai=X[D].nodes)==null?void 0:ai.a)==null||jt.measure();for(D=0;D<me;D+=1)(Ne=(Qt=X[D].nodes)==null?void 0:Qt.a)==null||Ne.fix()}gW(o,X,Le)}}s&&Yl(()=>{var Ge,Re;if(f!==void 0)for(S of f)(Re=(Ge=S.nodes)==null?void 0:Ge.a)==null||Re.apply()})}function pW(o,e,t,i,n,s,r,a){var c=(r&cH)!==0?(r&uH)===0?$H(t,!1,!1):nh(t):null,h=(r&dH)!==0?nh(n):null;return{v:c,i:h,e:dr(()=>(s(e,c??t,h??n,a),()=>{o.delete(i)}))}}function df(o,e,t){if(o.nodes)for(var i=o.nodes.start,n=o.nodes.end,s=e&&(e.f&wa)===0?e.nodes.start:t;i!==null;){var r=tm(i);if(s.before(i),i===n)return;i=r}}function Il(o,e,t){e===null?o.effect.first=t:e.next=t,t===null?o.effect.last=e:t.prev=e}function Ul(o,e,t=!1,i=!1,n=!1,s=!1){var r=o,a="";if(t)var c=o;G(()=>{var h=en;if(a!==(a=e()??"")){if(t){h.nodes=null,c.innerHTML=a,a!==""&&sh(Sa(c),c.lastChild);return}if(h.nodes!==null&&(sT(h.nodes.start,h.nodes.end),h.nodes=null),a!==""){var g=i?bH:n?yH:void 0,f=tT(i?"svg":n?"math":"template",g);f.innerHTML=a;var p=i||n?f:f.content;if(sh(Sa(p),p.lastChild),i||n)for(;Sa(p);)r.before(Sa(p));else r.before(p)}}})}const kk=[...`
|
|
3
3
|
\r\f \v\uFEFF`];function mW(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||kk.includes(i[r-1]))&&(a===i.length||kk.includes(i[a]))?i=(r===0?"":i.substring(0,r))+i.substring(a+1):r=a}}return i===""?null:i}function Ik(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 aw(o){return o[0]!=="-"||o[1]!=="-"?o.toLowerCase():o}function _W(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(aw)),n&&c.push(...Object.keys(n).map(aw));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=aw(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+=Ik(i)),n&&(t+=Ik(n,!0)),t=t.trim(),t===""?null:t}return o==null?null:String(o)}function $t(o,e,t,i,n,s){var r=o[fS];if(r!==t||r===void 0){var a=mW(t,i,s);a==null?o.removeAttribute("class"):e?o.className=a:o.setAttribute("class",a),o[fS]=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 lw(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 Ko(o,e,t,i){var n=o[pS];if(n!==e){var s=_W(e,i);s==null?o.removeAttribute("style"):o.style.cssText=s,o[pS]=e}else i&&(Array.isArray(i)?(lw(o,t==null?void 0:t[0],i[0]),lw(o,t==null?void 0:t[1],i[1],"important")):lw(o,t,i));return i}function vT(o,e,t=!1){if(o.multiple){if(e==null)return;if(!Y0(e))return SH();for(var i of o.options)i.selected=e.includes(Ef(i));return}for(i of o.options){var n=Ef(i);if(KH(n,e)){i.selected=!0;return}}(!t||e!==void 0)&&(o.selectedIndex=-1)}function vW(o){var e=new MutationObserver(()=>{vT(o,o.__value)});e.observe(o,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),o1(()=>{e.disconnect()})}function _a(o,e,t=e){var i=new WeakSet,n=!0;n1(o,"change",s=>{var r=s?"[selected]":":checked",a;if(o.multiple)a=[].map.call(o.querySelectorAll(r),Ef);else{var c=o.querySelector(r)??o.querySelector("option:not([disabled])");a=c&&Ef(c)}t(a),o.__value=a,gi!==null&&i.add(gi)}),r1(()=>{var s=e();if(o===document.activeElement){var r=gi;if(i.has(r))return}if(vT(o,s,n),n&&s===void 0){var a=o.querySelector(":checked");a!==null&&(s=Ef(a),t(s))}o.__value=s,n=!1}),vW(o)}function Ef(o){return"__value"in o?o.__value:o.value}const bW=Symbol("is custom element"),yW=Symbol("is html");function cw(o,e){var t=bT(o);t.checked!==(t.checked=e??void 0)&&(o.checked=e)}function Hn(o,e,t,i){var n=bT(o);n[e]!==(n[e]=t)&&(e==="loading"&&(o[YF]=t),t==null?o.removeAttribute(e):typeof t!="string"&&wW(o).includes(e)?o[e]=t:o.setAttribute(e,t))}function bT(o){return o[h_]??(o[h_]={[bW]:o.nodeName.includes("-"),[yW]:o.namespaceURI===MP})}var Dk=new Map;function wW(o){var e=o.getAttribute("is")||o.nodeName,t=Dk.get(e);if(t)return t;Dk.set(e,t=[]);for(var i,n=o,s=Element.prototype;s!==n;){i=jF(n);for(var r in i)i[r].set&&r!=="innerHTML"&&r!=="textContent"&&r!=="innerText"&&t.push(r);n=IP(n)}return t}function Ni(o,e,t=e){var i=new WeakSet;n1(o,"input",async n=>{var s=n?o.defaultValue:o.value;if(s=dw(o)?hw(s):s,t(s),gi!==null&&i.add(gi),await __(),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))}}}),wl(e)==null&&o.value&&(t(dw(o)?hw(o.value):o.value),gi!==null&&i.add(gi)),by(()=>{var n=e();if(o===document.activeElement){var s=gi;if(i.has(s))return}dw(o)&&n===hw(o.value)||o.type==="date"&&!n&&!o.value||n!==o.value&&(o.value=n??"")})}function As(o,e,t=e){n1(o,"change",i=>{var n=i?o.defaultChecked:o.checked;t(n)}),wl(e)==null&&t(o.checked),by(()=>{var i=e();o.checked=!!i})}function dw(o){var e=o.type;return e==="number"||e==="range"}function hw(o){return o===""?null:+o}var zl,Fu,Fp,sb,yT;const ob=class ob{constructor(e){Ti(this,sb);Ti(this,zl,new WeakMap);Ti(this,Fu);Ti(this,Fp);Mi(this,Fp,e)}observe(e,t){var i=ee(this,zl).get(e)||new Set;return i.add(t),ee(this,zl).set(e,i),In(this,sb,yT).call(this).observe(e,ee(this,Fp)),()=>{var n=ee(this,zl).get(e);n.delete(t),n.size===0&&(ee(this,zl).delete(e),ee(this,Fu).unobserve(e))}}};zl=new WeakMap,Fu=new WeakMap,Fp=new WeakMap,sb=new WeakSet,yT=function(){return ee(this,Fu)??Mi(this,Fu,new ResizeObserver(e=>{for(var t of e){ob.entries.set(t.target,t);for(var i of ee(this,zl).get(t.target)||[])i(t)}}))},Bi(ob,"entries",new WeakMap);let LS=ob;var SW=new LS({box:"border-box"});function CW(o,e,t){var i=SW.observe(o,()=>t(o[e]));r1(()=>(wl(()=>t(o[e])),i))}function uw(o,e){return o===e||(o==null?void 0:o[od])===e}function bs(o={},e,t,i){var n=Us.r,s=en;return r1(()=>{var r,a;return by(()=>{r=a,a=[],wl(()=>{uw(t(...a),o)||(e(o,...a),r&&uw(t(...r),o)&&e(null,...r))})}),()=>{let c=s;for(;c!==n&&c.parent!==null&&c.parent.f&gS;)c=c.parent;const h=()=>{a&&uw(t(...a),o)&&e(null,...a)},g=c.teardown;c.teardown=()=>{h(),g==null||g()}}}),o}function cg(o,e,t,i){var V;var n=!0,s=(t&pH)!==0,r=(t&mH)!==0,a=i,c=!0,h=void 0,g=()=>r&&n?(h??(h=tp(i)),u(h)):(c&&(c=!1,a=r?wl(i):i),a);let f;if(s){var p=od in o||XF in o;f=((V=Lu(o,e))==null?void 0:V.set)??(p&&e in o?F=>o[e]=F:void 0)}var v,_=!1;s?[v,_]=DH(()=>o[e]):v=o[e],v===void 0&&i!==void 0&&(v=g(),f&&(sH(),f(v)));var w;if(w=()=>{var F=o[e];return F===void 0?g():(c=!0,F)},(t&fH)===0)return w;if(f){var S=o.$$legacy;return(function(F,Y){return arguments.length>0?((!Y||S||_)&&f(Y?w():F),F):w()})}var D=!1,P=((t&gH)!==0?tp:t1)(()=>(D=!1,w()));s&&u(P);var N=en;return(function(F,Y){if(arguments.length>0){const X=Y?u(P):s?Si(F):F;return k(P,X),D=!0,a!==void 0&&(a=X),F}return hl&&D||(N.f&_r)!==0?P.v:u(P)})}function xr(o){Us===null&&PP(),zn(()=>{const e=wl(o);if(typeof e=="function")return e})}function yy(o){Us===null&&PP(),xr(()=>()=>wl(o))}const xW="5";var XD;typeof window<"u"&&((XD=window.__svelte??(window.__svelte={})).v??(XD.v=new Set)).add(xW);/*!-----------------------------------------------------------------------------
|
|
4
4
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -10,7 +10,7 @@ var rA=Object.defineProperty;var FL=o=>{throw TypeError(o)};var aA=(o,e,t)=>e in
|
|
|
10
10
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
11
11
|
* Released under the MIT license
|
|
12
12
|
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
|
13
|
-
*-----------------------------------------------------------------------------*/var AW=Object.defineProperty,OW=Object.getOwnPropertyDescriptor,FW=Object.getOwnPropertyNames,HW=Object.prototype.hasOwnProperty,WW=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of FW(e))!HW.call(o,n)&&n!==t&&AW(o,n,{get:()=>e[n],enumerable:!(i=OW(e,n))||i.enumerable});return o},BW=(o,e,t)=>(WW(o,e,"default"),t),zW="5.4.5",dg={};BW(dg,JD);var CT=(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))(CT||{}),xT=(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))(xT||{}),LT=(o=>(o[o.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",o[o.LineFeed=1]="LineFeed",o))(LT||{}),kT=(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))(kT||{}),IT=(o=>(o[o.Classic=1]="Classic",o[o.NodeJs=2]="NodeJs",o))(IT||{}),DT=class{constructor(o,e,t,i,n){this._onDidChange=new dg.Emitter,this._onDidExtraLibsChange=new dg.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)}},VW=zW,ET={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},PT=new DT({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},ET),TT=new DT({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},ET),jW=()=>wy().then(o=>o.getTypeScriptWorker()),UW=()=>wy().then(o=>o.getJavaScriptWorker());dg.languages.typescript={ModuleKind:CT,JsxEmit:xT,NewLineKind:LT,ScriptTarget:kT,ModuleResolutionKind:IT,typescriptVersion:VW,typescriptDefaults:PT,javascriptDefaults:TT,getTypeScriptWorker:jW,getJavaScriptWorker:UW};function wy(){return YD(()=>import("./tsMode-B7dtAHLr.js"),__vite__mapDeps([3,1,2]))}dg.languages.onLanguage("typescript",()=>wy().then(o=>o.setupTypeScript(PT)));dg.languages.onLanguage("javascript",()=>wy().then(o=>o.setupJavaScript(TT)));class $W extends io{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:Lt("toggleCollapseUnchangedRegions","Toggle Collapse Unchanged Regions"),icon:Yt.map,toggled:ae.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:ae.has("isInDiffEditor"),menu:{when:ae.has("isInDiffEditor"),id:lt.EditorTitle,order:22,group:"navigation"}})}run(e,...t){const i=e.get(Pn),n=!i.getValue("diffEditor.hideUnchangedRegions.enabled");i.updateValue("diffEditor.hideUnchangedRegions.enabled",n)}}class MT extends io{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:Lt("toggleShowMovedCodeBlocks","Toggle Show Moved Code Blocks"),precondition:ae.has("isInDiffEditor")})}run(e,...t){const i=e.get(Pn),n=!i.getValue("diffEditor.experimental.showMoves");i.updateValue("diffEditor.experimental.showMoves",n)}}class NT extends io{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:Lt("toggleUseInlineViewWhenSpaceIsLimited","Toggle Use Inline View When Space Is Limited"),precondition:ae.has("isInDiffEditor")})}run(e,...t){const i=e.get(Pn),n=!i.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");i.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",n)}}const sm=Lt("diffEditor","Diff Editor");class qW extends qr{constructor(){super({id:"diffEditor.switchSide",title:Lt("switchSide","Switch Side"),icon:Yt.arrowSwap,precondition:ae.has("isInDiffEditor"),f1:!0,category:sm})}runEditorCommand(e,t,i){const n=Mg(e);if(n instanceof Hp){if(i&&i.dryRun)return{destinationSelection:n.mapToOtherSide().destinationSelection};n.switchSide()}}}class KW extends qr{constructor(){super({id:"diffEditor.exitCompareMove",title:Lt("exitCompareMove","Exit Compare Move"),icon:Yt.close,precondition:M.comparingMovedCode,f1:!1,category:sm,keybinding:{weight:1e4,primary:9}})}runEditorCommand(e,t,...i){const n=Mg(e);n instanceof Hp&&n.exitCompareMove()}}class GW extends qr{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:Lt("collapseAllUnchangedRegions","Collapse All Unchanged Regions"),icon:Yt.fold,precondition:ae.has("isInDiffEditor"),f1:!0,category:sm})}runEditorCommand(e,t,...i){const n=Mg(e);n instanceof Hp&&n.collapseAllUnchangedRegions()}}class ZW extends qr{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:Lt("showAllUnchangedRegions","Show All Unchanged Regions"),icon:Yt.unfold,precondition:ae.has("isInDiffEditor"),f1:!0,category:sm})}runEditorCommand(e,t,...i){const n=Mg(e);n instanceof Hp&&n.showAllUnchangedRegions()}}class kS extends io{constructor(){super({id:"diffEditor.revert",title:Lt("revert","Revert"),f1:!1,category:sm})}run(e,t){const i=XW(e,t.originalUri,t.modifiedUri);i instanceof Hp&&i.revertRangeMappings(t.mapping.innerChanges??[])}}const RT=Lt("accessibleDiffViewer","Accessible Diff Viewer"),rb=class rb extends io{constructor(){super({id:rb.id,title:Lt("editor.action.accessibleDiffViewer.next","Go to Next Difference"),category:RT,precondition:ae.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(e){const t=Mg(e);t==null||t.accessibleDiffViewerNext()}};rb.id="editor.action.accessibleDiffViewer.next";let np=rb;const ab=class ab extends io{constructor(){super({id:ab.id,title:Lt("editor.action.accessibleDiffViewer.prev","Go to Previous Difference"),category:RT,precondition:ae.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(e){const t=Mg(e);t==null||t.accessibleDiffViewerPrev()}};ab.id="editor.action.accessibleDiffViewer.prev";let Z_=ab;function XW(o,e,t){return o.get(ns).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 Mg(o){const t=o.get(ns).listDiffEditors(),i=QD();if(i)for(const n of t){const s=n.getContainerDomNode();if(YW(s,i))return n}return null}function YW(o,e){let t=e;for(;t;){if(t===o)return!0;t=t.parentElement}return!1}tn($W);tn(MT);tn(NT);vr.appendMenuItem(lt.EditorTitle,{command:{id:new NT().desc.id,title:y("useInlineViewWhenSpaceIsLimited","Use Inline View When Space Is Limited"),toggled:ae.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:ae.has("isInDiffEditor")},order:11,group:"1_diff",when:ae.and(M.diffEditorRenderSideBySideInlineBreakpointReached,ae.has("isInDiffEditor"))});vr.appendMenuItem(lt.EditorTitle,{command:{id:new MT().desc.id,title:y("showMoves","Show Moved Code Blocks"),icon:Yt.move,toggled:lA.create("config.diffEditor.experimental.showMoves",!0),precondition:ae.has("isInDiffEditor")},order:10,group:"1_diff",when:ae.has("isInDiffEditor")});tn(kS);for(const o of[{icon:Yt.arrowRight,key:M.diffEditorInlineMode.toNegated()},{icon:Yt.discard,key:M.diffEditorInlineMode}])vr.appendMenuItem(lt.DiffEditorHunkToolbar,{command:{id:new kS().desc.id,title:y("revertHunk","Revert Block"),icon:o.icon},when:ae.and(M.diffEditorModifiedWritable,o.key),order:5,group:"primary"}),vr.appendMenuItem(lt.DiffEditorSelectionToolbar,{command:{id:new kS().desc.id,title:y("revertSelection","Revert Selection"),icon:o.icon},when:ae.and(M.diffEditorModifiedWritable,o.key),order:5,group:"primary"});tn(qW);tn(KW);tn(GW);tn(ZW);vr.appendMenuItem(lt.EditorTitle,{command:{id:np.id,title:y("Open Accessible Diff Viewer","Open Accessible Diff Viewer"),precondition:ae.has("isInDiffEditor")},order:10,group:"2_diff",when:ae.and(M.accessibleDiffViewerVisible.negate(),ae.has("isInDiffEditor"))});wn.registerCommandAlias("editor.action.diffReview.next",np.id);tn(np);wn.registerCommandAlias("editor.action.diffReview.prev",Z_.id);tn(Z_);var JW=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},QW=function(o,e){return function(t,i){e(t,i,o)}},IS;const Sy=new Ri("selectionAnchorSet",!1);var gd;let bc=(gd=class{static get(e){return e.getContribution(IS.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=Sy.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(qt.fromPositions(e,e),{description:"selection-anchor",stickiness:1,hoverMessage:new Ws().appendText(y("selectionAnchor","Selection Anchor")),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),br(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(qt.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()}},IS=gd,gd.ID="editor.contrib.selectionAnchorController",gd);bc=IS=JW([QW(1,Vi)],bc);class e3 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:rs(2089,2080),weight:100}})}async run(e,t){var i;(i=bc.get(t))==null||i.setSelectionAnchor()}}class t3 extends Se{constructor(){super({id:"editor.action.goToSelectionAnchor",label:y("goToSelectionAnchor","Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:Sy})}async run(e,t){var i;(i=bc.get(t))==null||i.goToSelectionAnchor()}}class i3 extends Se{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:y("selectFromAnchorToCursor","Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:Sy,kbOpts:{kbExpr:M.editorTextFocus,primary:rs(2089,2089),weight:100}})}async run(e,t){var i;(i=bc.get(t))==null||i.selectFromAnchorToCursor()}}class n3 extends Se{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:y("cancelSelectionAnchor","Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:Sy,kbOpts:{kbExpr:M.editorTextFocus,primary:9,weight:100}})}async run(e,t){var i;(i=bc.get(t))==null||i.cancelSelectionAnchor()}}bi(bc.ID,bc,4);ne(e3);ne(t3);ne(i3);ne(n3);const s3=_t("editorOverviewRuler.bracketMatchForeground","#A0A0A0",y("overviewRulerBracketMatchForeground","Overview ruler marker color for matching brackets."));class o3 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=oh.get(t))==null||i.jumpToBracket()}}class r3 extends Se{constructor(){super({id:"editor.action.selectToBracket",label:y("smartSelect.selectToBracket","Select to Bracket"),alias:"Select to Bracket",precondition:void 0,metadata:{description:Lt("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=oh.get(t))==null||s.selectToBracket(n)}}class a3 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=oh.get(t))==null||i.removeBrackets(this.id)}}class l3{constructor(e,t,i){this.position=e,this.brackets=t,this.options=i}}const Rl=class Rl extends Ve{static get(e){return e.getContribution(Rl.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new hs(()=>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 qt(r.lineNumber,r.column,r.lineNumber,r.column):new qt(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(z.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 qt(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(kt.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=Rl._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;!_&&this._matchBrackets==="always"&&(_=t.bracketPairs.findEnclosingBrackets(v,20),w=Rl._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),a[c++]=new l3(v,_,w)}}this._lastBracketsData=a,this._lastVersionId=i}};Rl.ID="editor.contrib.bracketMatchingController",Rl._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=Di.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:ls(s3),position:xa.Center}}),Rl._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=Di.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"});let oh=Rl;bi(oh.ID,oh,1);ne(r3);ne(o3);ne(a3);vr.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 c3{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 z(i,n-1,i,n),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new z(i,s,i,s),a)}else{const r=new z(i,s,i,s+1),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new z(i,n,i,n),a)}}computeCursorState(e,t){return this._isMovingLeft?new qt(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new qt(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class AT 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 c3(s,this.left));t.pushUndoStop(),t.executeCommands(this.id,i),t.pushUndoStop()}}class d3 extends AT{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:y("caret.moveLeft","Move Selected Text Left"),alias:"Move Selected Text Left",precondition:M.writable})}}class h3 extends AT{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:y("caret.moveRight","Move Selected Text Right"),alias:"Move Selected Text Right",precondition:M.writable})}}ne(d3);ne(h3);class u3 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():Yy.rightPosition(i,r.getPosition().lineNumber,r.getPosition().column),f=Yy.leftPosition(i,g),p=Yy.leftPosition(i,f),v=i.getValueInRange(z.fromPositions(p,f)),_=i.getValueInRange(z.fromPositions(f,g)),w=z.fromPositions(p,g);n.push(new Wp(w,_+v))}n.length>0&&(t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop())}}ne(u3);const Cy=(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 d1(o){return{asString:async()=>o,asFile:()=>{},value:typeof o=="string"?o:void 0}}function g3(o,e,t){const i={id:Cy(),name:o,uri:e,data:t};return{asString:async()=>"",asFile:()=>i,value:void 0}}class OT{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 el.some(this,([i,n])=>n.asFile())&&t.push("files"),HT(X_(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 X_(e)}}function X_(o){return o.toLowerCase()}function FT(o,e){return HT(X_(o),e.map(X_))}function HT(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 xy=Object.freeze({create:o=>eE(o.map(e=>e.toString())).join(`\r
|
|
13
|
+
*-----------------------------------------------------------------------------*/var AW=Object.defineProperty,OW=Object.getOwnPropertyDescriptor,FW=Object.getOwnPropertyNames,HW=Object.prototype.hasOwnProperty,WW=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of FW(e))!HW.call(o,n)&&n!==t&&AW(o,n,{get:()=>e[n],enumerable:!(i=OW(e,n))||i.enumerable});return o},BW=(o,e,t)=>(WW(o,e,"default"),t),zW="5.4.5",dg={};BW(dg,JD);var CT=(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))(CT||{}),xT=(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))(xT||{}),LT=(o=>(o[o.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",o[o.LineFeed=1]="LineFeed",o))(LT||{}),kT=(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))(kT||{}),IT=(o=>(o[o.Classic=1]="Classic",o[o.NodeJs=2]="NodeJs",o))(IT||{}),DT=class{constructor(o,e,t,i,n){this._onDidChange=new dg.Emitter,this._onDidExtraLibsChange=new dg.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)}},VW=zW,ET={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},PT=new DT({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},ET),TT=new DT({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},ET),jW=()=>wy().then(o=>o.getTypeScriptWorker()),UW=()=>wy().then(o=>o.getJavaScriptWorker());dg.languages.typescript={ModuleKind:CT,JsxEmit:xT,NewLineKind:LT,ScriptTarget:kT,ModuleResolutionKind:IT,typescriptVersion:VW,typescriptDefaults:PT,javascriptDefaults:TT,getTypeScriptWorker:jW,getJavaScriptWorker:UW};function wy(){return YD(()=>import("./tsMode-CIoeFEdg.js"),__vite__mapDeps([3,1,2]))}dg.languages.onLanguage("typescript",()=>wy().then(o=>o.setupTypeScript(PT)));dg.languages.onLanguage("javascript",()=>wy().then(o=>o.setupJavaScript(TT)));class $W extends io{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:Lt("toggleCollapseUnchangedRegions","Toggle Collapse Unchanged Regions"),icon:Yt.map,toggled:ae.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:ae.has("isInDiffEditor"),menu:{when:ae.has("isInDiffEditor"),id:lt.EditorTitle,order:22,group:"navigation"}})}run(e,...t){const i=e.get(Pn),n=!i.getValue("diffEditor.hideUnchangedRegions.enabled");i.updateValue("diffEditor.hideUnchangedRegions.enabled",n)}}class MT extends io{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:Lt("toggleShowMovedCodeBlocks","Toggle Show Moved Code Blocks"),precondition:ae.has("isInDiffEditor")})}run(e,...t){const i=e.get(Pn),n=!i.getValue("diffEditor.experimental.showMoves");i.updateValue("diffEditor.experimental.showMoves",n)}}class NT extends io{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:Lt("toggleUseInlineViewWhenSpaceIsLimited","Toggle Use Inline View When Space Is Limited"),precondition:ae.has("isInDiffEditor")})}run(e,...t){const i=e.get(Pn),n=!i.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");i.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",n)}}const sm=Lt("diffEditor","Diff Editor");class qW extends qr{constructor(){super({id:"diffEditor.switchSide",title:Lt("switchSide","Switch Side"),icon:Yt.arrowSwap,precondition:ae.has("isInDiffEditor"),f1:!0,category:sm})}runEditorCommand(e,t,i){const n=Mg(e);if(n instanceof Hp){if(i&&i.dryRun)return{destinationSelection:n.mapToOtherSide().destinationSelection};n.switchSide()}}}class KW extends qr{constructor(){super({id:"diffEditor.exitCompareMove",title:Lt("exitCompareMove","Exit Compare Move"),icon:Yt.close,precondition:M.comparingMovedCode,f1:!1,category:sm,keybinding:{weight:1e4,primary:9}})}runEditorCommand(e,t,...i){const n=Mg(e);n instanceof Hp&&n.exitCompareMove()}}class GW extends qr{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:Lt("collapseAllUnchangedRegions","Collapse All Unchanged Regions"),icon:Yt.fold,precondition:ae.has("isInDiffEditor"),f1:!0,category:sm})}runEditorCommand(e,t,...i){const n=Mg(e);n instanceof Hp&&n.collapseAllUnchangedRegions()}}class ZW extends qr{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:Lt("showAllUnchangedRegions","Show All Unchanged Regions"),icon:Yt.unfold,precondition:ae.has("isInDiffEditor"),f1:!0,category:sm})}runEditorCommand(e,t,...i){const n=Mg(e);n instanceof Hp&&n.showAllUnchangedRegions()}}class kS extends io{constructor(){super({id:"diffEditor.revert",title:Lt("revert","Revert"),f1:!1,category:sm})}run(e,t){const i=XW(e,t.originalUri,t.modifiedUri);i instanceof Hp&&i.revertRangeMappings(t.mapping.innerChanges??[])}}const RT=Lt("accessibleDiffViewer","Accessible Diff Viewer"),rb=class rb extends io{constructor(){super({id:rb.id,title:Lt("editor.action.accessibleDiffViewer.next","Go to Next Difference"),category:RT,precondition:ae.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(e){const t=Mg(e);t==null||t.accessibleDiffViewerNext()}};rb.id="editor.action.accessibleDiffViewer.next";let np=rb;const ab=class ab extends io{constructor(){super({id:ab.id,title:Lt("editor.action.accessibleDiffViewer.prev","Go to Previous Difference"),category:RT,precondition:ae.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(e){const t=Mg(e);t==null||t.accessibleDiffViewerPrev()}};ab.id="editor.action.accessibleDiffViewer.prev";let Z_=ab;function XW(o,e,t){return o.get(ns).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 Mg(o){const t=o.get(ns).listDiffEditors(),i=QD();if(i)for(const n of t){const s=n.getContainerDomNode();if(YW(s,i))return n}return null}function YW(o,e){let t=e;for(;t;){if(t===o)return!0;t=t.parentElement}return!1}tn($W);tn(MT);tn(NT);vr.appendMenuItem(lt.EditorTitle,{command:{id:new NT().desc.id,title:y("useInlineViewWhenSpaceIsLimited","Use Inline View When Space Is Limited"),toggled:ae.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:ae.has("isInDiffEditor")},order:11,group:"1_diff",when:ae.and(M.diffEditorRenderSideBySideInlineBreakpointReached,ae.has("isInDiffEditor"))});vr.appendMenuItem(lt.EditorTitle,{command:{id:new MT().desc.id,title:y("showMoves","Show Moved Code Blocks"),icon:Yt.move,toggled:lA.create("config.diffEditor.experimental.showMoves",!0),precondition:ae.has("isInDiffEditor")},order:10,group:"1_diff",when:ae.has("isInDiffEditor")});tn(kS);for(const o of[{icon:Yt.arrowRight,key:M.diffEditorInlineMode.toNegated()},{icon:Yt.discard,key:M.diffEditorInlineMode}])vr.appendMenuItem(lt.DiffEditorHunkToolbar,{command:{id:new kS().desc.id,title:y("revertHunk","Revert Block"),icon:o.icon},when:ae.and(M.diffEditorModifiedWritable,o.key),order:5,group:"primary"}),vr.appendMenuItem(lt.DiffEditorSelectionToolbar,{command:{id:new kS().desc.id,title:y("revertSelection","Revert Selection"),icon:o.icon},when:ae.and(M.diffEditorModifiedWritable,o.key),order:5,group:"primary"});tn(qW);tn(KW);tn(GW);tn(ZW);vr.appendMenuItem(lt.EditorTitle,{command:{id:np.id,title:y("Open Accessible Diff Viewer","Open Accessible Diff Viewer"),precondition:ae.has("isInDiffEditor")},order:10,group:"2_diff",when:ae.and(M.accessibleDiffViewerVisible.negate(),ae.has("isInDiffEditor"))});wn.registerCommandAlias("editor.action.diffReview.next",np.id);tn(np);wn.registerCommandAlias("editor.action.diffReview.prev",Z_.id);tn(Z_);var JW=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},QW=function(o,e){return function(t,i){e(t,i,o)}},IS;const Sy=new Ri("selectionAnchorSet",!1);var gd;let bc=(gd=class{static get(e){return e.getContribution(IS.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=Sy.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(qt.fromPositions(e,e),{description:"selection-anchor",stickiness:1,hoverMessage:new Ws().appendText(y("selectionAnchor","Selection Anchor")),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),br(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(qt.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()}},IS=gd,gd.ID="editor.contrib.selectionAnchorController",gd);bc=IS=JW([QW(1,Vi)],bc);class e3 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:rs(2089,2080),weight:100}})}async run(e,t){var i;(i=bc.get(t))==null||i.setSelectionAnchor()}}class t3 extends Se{constructor(){super({id:"editor.action.goToSelectionAnchor",label:y("goToSelectionAnchor","Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:Sy})}async run(e,t){var i;(i=bc.get(t))==null||i.goToSelectionAnchor()}}class i3 extends Se{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:y("selectFromAnchorToCursor","Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:Sy,kbOpts:{kbExpr:M.editorTextFocus,primary:rs(2089,2089),weight:100}})}async run(e,t){var i;(i=bc.get(t))==null||i.selectFromAnchorToCursor()}}class n3 extends Se{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:y("cancelSelectionAnchor","Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:Sy,kbOpts:{kbExpr:M.editorTextFocus,primary:9,weight:100}})}async run(e,t){var i;(i=bc.get(t))==null||i.cancelSelectionAnchor()}}bi(bc.ID,bc,4);ne(e3);ne(t3);ne(i3);ne(n3);const s3=_t("editorOverviewRuler.bracketMatchForeground","#A0A0A0",y("overviewRulerBracketMatchForeground","Overview ruler marker color for matching brackets."));class o3 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=oh.get(t))==null||i.jumpToBracket()}}class r3 extends Se{constructor(){super({id:"editor.action.selectToBracket",label:y("smartSelect.selectToBracket","Select to Bracket"),alias:"Select to Bracket",precondition:void 0,metadata:{description:Lt("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=oh.get(t))==null||s.selectToBracket(n)}}class a3 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=oh.get(t))==null||i.removeBrackets(this.id)}}class l3{constructor(e,t,i){this.position=e,this.brackets=t,this.options=i}}const Rl=class Rl extends Ve{static get(e){return e.getContribution(Rl.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new hs(()=>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 qt(r.lineNumber,r.column,r.lineNumber,r.column):new qt(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(z.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 qt(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(kt.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=Rl._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;!_&&this._matchBrackets==="always"&&(_=t.bracketPairs.findEnclosingBrackets(v,20),w=Rl._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),a[c++]=new l3(v,_,w)}}this._lastBracketsData=a,this._lastVersionId=i}};Rl.ID="editor.contrib.bracketMatchingController",Rl._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=Di.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:ls(s3),position:xa.Center}}),Rl._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=Di.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"});let oh=Rl;bi(oh.ID,oh,1);ne(r3);ne(o3);ne(a3);vr.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 c3{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 z(i,n-1,i,n),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new z(i,s,i,s),a)}else{const r=new z(i,s,i,s+1),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new z(i,n,i,n),a)}}computeCursorState(e,t){return this._isMovingLeft?new qt(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new qt(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class AT 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 c3(s,this.left));t.pushUndoStop(),t.executeCommands(this.id,i),t.pushUndoStop()}}class d3 extends AT{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:y("caret.moveLeft","Move Selected Text Left"),alias:"Move Selected Text Left",precondition:M.writable})}}class h3 extends AT{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:y("caret.moveRight","Move Selected Text Right"),alias:"Move Selected Text Right",precondition:M.writable})}}ne(d3);ne(h3);class u3 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():Yy.rightPosition(i,r.getPosition().lineNumber,r.getPosition().column),f=Yy.leftPosition(i,g),p=Yy.leftPosition(i,f),v=i.getValueInRange(z.fromPositions(p,f)),_=i.getValueInRange(z.fromPositions(f,g)),w=z.fromPositions(p,g);n.push(new Wp(w,_+v))}n.length>0&&(t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop())}}ne(u3);const Cy=(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 d1(o){return{asString:async()=>o,asFile:()=>{},value:typeof o=="string"?o:void 0}}function g3(o,e,t){const i={id:Cy(),name:o,uri:e,data:t};return{asString:async()=>"",asFile:()=>i,value:void 0}}class OT{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 el.some(this,([i,n])=>n.asFile())&&t.push("files"),HT(X_(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 X_(e)}}function X_(o){return o.toLowerCase()}function FT(o,e){return HT(X_(o),e.map(X_))}function HT(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 xy=Object.freeze({create:o=>eE(o.map(e=>e.toString())).join(`\r
|
|
14
14
|
`),split:o=>o.split(`\r
|
|
15
15
|
`),parse:o=>xy.split(o).filter(e=>!e.startsWith("#"))}),la=class la{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+la.sep)}intersects(e){return this.contains(e)||e.contains(this)}append(...e){return new la((this.value?[this.value,...e]:e).join(la.sep))}};la.sep=".",la.None=new la("@@none@@"),la.Empty=new la("");let En=la;const Ek={EDITORS:"CodeEditors",FILES:"CodeFiles"};class f3{}const p3={DragAndDropContribution:"workbench.contributions.dragAndDrop"};Kr.add(p3.DragAndDropContribution,new f3);const Bf=class Bf{constructor(){}static getInstance(){return Bf.INSTANCE}hasData(e){return e&&e===this.proto}getData(e){if(this.hasData(e))return this.data}};Bf.INSTANCE=new Bf;let DS=Bf;function WT(o){const e=new OT;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,d1(n))}else if(t.kind==="file"){const n=t.getAsFile();n&&e.append(i,m3(n))}}return e}function m3(o){const e=o.path?cn.parse(o.path):void 0;return g3(o.name,e,async()=>new Uint8Array(await o.arrayBuffer()))}const _3=Object.freeze([Ek.EDITORS,Ek.FILES,Yw.RESOURCES,Yw.INTERNAL_URI_LIST]);function BT(o,e=!1){const t=WT(o),i=t.get(Yw.INTERNAL_URI_LIST);if(i)t.replace(Cs.uriList,i);else if(e||!t.has(Cs.uriList)){const n=[];for(const s of o.items){const r=s.getAsFile();if(r){const a=r.path;try{a?n.push(cn.file(a).toString()):n.push(cn.parse(r.name,!0).toString())}catch{}}}n.length&&t.replace(Cs.uriList,d1(xy.create(n)))}for(const n of _3)t.delete(n);return t}var h1=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},sp=function(o,e){return function(t,i){e(t,i,o)}};class u1{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 zf=class zf extends u1{constructor(){super(...arguments),this.kind=zf.kind,this.dropMimeTypes=[Cs.text],this.pasteMimeTypes=[Cs.text]}async getEdit(e,t){const i=e.get(Cs.text);if(!i||e.has(Cs.uriList))return;const n=await i.asString();return{handledMimeType:Cs.text,title:y("text.label","Insert Plain Text"),insertText:n,kind:this.kind}}};zf.id="text",zf.kind=new En("text.plain");let rh=zf;class zT extends u1{constructor(){super(...arguments),this.kind=new En("uri.absolute"),this.dropMimeTypes=[Cs.uriList],this.pasteMimeTypes=[Cs.uriList]}async getEdit(e,t){const i=await VT(e);if(!i.length||t.isCancellationRequested)return;let n=0;const s=i.map(({uri:a,originalText:c})=>a.scheme===Ys.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:Cs.uriList,insertText:s,title:r,kind:this.kind}}}let Y_=class extends u1{constructor(e){super(),this._workspaceContextService=e,this.kind=new En("uri.relative"),this.dropMimeTypes=[Cs.uriList],this.pasteMimeTypes=[Cs.uriList]}async getEdit(e,t){const i=await VT(e);if(!i.length||t.isCancellationRequested)return;const n=rl(i.map(({uri:s})=>{const r=this._workspaceContextService.getWorkspaceFolder(s);return r?cA(r.uri,s):void 0}));if(n.length)return{handledMimeType:Cs.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}}};Y_=h1([sp(0,Gu)],Y_);class v3{constructor(){this.kind=new En("html"),this.pasteMimeTypes=["text/html"],this._yieldTo=[{mimeType:Cs.text}]}async provideDocumentPasteEdits(e,t,i,n,s){var c;if(n.triggerKind!==Jw.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 VT(o){const e=o.get(Cs.uriList);if(!e)return[];const t=await e.asString(),i=[];for(const n of xy.parse(t))try{i.push({uri:cn.parse(n),originalText:n})}catch{}return i}let ES=class extends Ve{constructor(e,t){super(),this._register(e.documentDropEditProvider.register("*",new rh)),this._register(e.documentDropEditProvider.register("*",new zT)),this._register(e.documentDropEditProvider.register("*",new Y_(t)))}};ES=h1([sp(0,It),sp(1,Gu)],ES);let PS=class extends Ve{constructor(e,t){super(),this._register(e.documentPasteEditProvider.register("*",new rh)),this._register(e.documentPasteEditProvider.register("*",new zT)),this._register(e.documentPasteEditProvider.register("*",new Y_(t))),this._register(e.documentPasteEditProvider.register("*",new v3))}};PS=h1([sp(0,It),sp(1,Gu)],PS);const ir=class ir{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=ir._table[i],typeof n=="number")return this.pos+=1,{type:n,pos:e,len:1};if(ir.isDigitCharacter(i)){n=8;do t+=1,i=this.value.charCodeAt(e+t);while(ir.isDigitCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}if(ir.isVariableCharacter(i)){n=9;do i=this.value.charCodeAt(e+ ++t);while(ir.isVariableCharacter(i)||ir.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 ir._table[i]>"u"&&!ir.isDigitCharacter(i)&&!ir.isVariableCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}};ir._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13};let TS=ir;class Ng{constructor(){this._children=[]}appendChild(e){return e instanceof go&&this._children[this._children.length-1]instanceof go?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 om)return e;e=e.parent}}toString(){return this.children.reduce((e,t)=>e+t.toString(),"")}len(){return 0}}let go=class jT extends Ng{constructor(e){super(),this.value=e}toString(){return this.value}len(){return this.value.length}clone(){return new jT(this.value)}};class UT extends Ng{}class qo extends UT{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 Rg?this._children[0]:void 0}clone(){const e=new qo(this.index);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}class Rg extends Ng{constructor(){super(...arguments),this.options=[]}appendChild(e){return e instanceof go&&(e.parent=this,this.options.push(e)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const e=new Rg;return this.options.forEach(e.appendChild,e),e}}class g1 extends Ng{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 Rr&&!!s.elseValue)&&(n=this._replace([])),n}_replace(e){let t="";for(const i of this._children)if(i instanceof Rr){let n=e[i.index]||"";n=i.resolve(n),t+=n}else t+=i.toString();return t}toString(){return""}clone(){const e=new g1;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 Rr extends Ng{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 Rr(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class op extends UT{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 go(t)],!0):!1}clone(){const e=new op(this.name);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}function Pk(o,e){const t=[...o];for(;t.length>0;){const i=t.shift();if(!e(i))break;t.unshift(...i.children)}}class om extends Ng{get placeholderInfo(){if(!this._placeholders){const e=[];let t;this.walk(function(i){return i instanceof qo&&(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 Pk([e],i=>(t+=i.len(),!0)),t}enclosingPlaceholders(e){const t=[];let{parent:i}=e;for(;i;)i instanceof qo&&t.push(i),i=i.parent;return t}resolveVariables(e){return this.walk(t=>(t instanceof op&&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 om;return this._children=this.children.map(t=>t.clone()),e}walk(e){Pk(this.children,e)}}class ah{constructor(){this._scanner=new TS,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 om;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 qo&&(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 qo(c.index);f.transform=c.transform;for(const p of g){const v=p.clone();f.appendChild(v),v instanceof qo&&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 qo(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 go(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 qo(Number(t)):new op(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 qo(Number(t));if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new go("${"+t+":")),s.children.forEach(e.appendChild,e),!0}else if(s.index>0&&this._accept(7)){const r=new Rg;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 go(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 op(t);if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new go("${"+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 g1;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 go(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 Rr(Number(n))),!0;if(!this._accept(1))return this._backTo(t),!1}else return e.appendChild(new Rr(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 Rr(Number(n),s)),!0)}else if(this._accept(11)){const s=this._until(4);if(s)return e.appendChild(new Rr(Number(n),void 0,s,void 0)),!0}else if(this._accept(12)){const s=this._until(4);if(s)return e.appendChild(new Rr(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 Rr(Number(n),void 0,s,r)),!0}}else{const s=this._until(4);if(s)return e.appendChild(new Rr(Number(n),void 0,void 0,s)),!0}return this._backTo(t),!1}_parseAnything(e){return this._token.type!==14?(e.appendChild(new go(this._scanner.tokenText(this._token))),this._accept(void 0),!0):!1}}function $T(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 dA(o,{range:s,text:typeof t.insertText=="string"?ah.escape(t.insertText)+"$0":t.insertText.snippet,insertAsSnippet:!0})),...((n=t.additionalEdit)==null?void 0:n.edits)??[]]}}function qT(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 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},y3=function(o,e){return function(t,i){e(t,i,o)}};const w3=Di.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:tE,inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}}),lb=class lb 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=mt(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=e;const t=mt("span.icon");this.domNode.append(t),t.classList.add(...Ki.asClassNameArray(Yt.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(zi(this.domNode,Un.CLICK,n=>{this.delegate.cancel()}))}getId(){return lb.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)}};lb.baseId="editor.widget.inlineProgressWidget";let MS=lb,J_=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 Mo),this._currentWidget=this._register(new Mo),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=Uf(()=>{const a=z.fromPositions(e);this._currentDecorations.set([{range:a,options:w3}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(MS,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()}};J_=b3([y3(2,hi)],J_);var S3=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Tk=function(o,e){return function(t,i){e(t,i,o)}},v_,Ql;let po=(Ql=class{static get(e){return e.getContribution(v_.ID)}constructor(e,t,i){this._openerService=i,this._messageWidget=new Mo,this._messageListeners=new He,this._mouseOverMessage=!1,this._editor=e,this._visible=v_.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){br(r_(e)?e.value:e),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._message=r_(e)?hA(e,{actionHandler:{callback:n=>{this.closeMessage(),uA(this._openerService,n,r_(e)?e.isTrusted:void 0)},disposables:this._messageListeners}}):void 0,this._messageWidget.value=new Mk(this._editor,t,typeof e=="string"?e:this._message.element),this._messageListeners.add(ds.debounce(this._editor.onDidBlurEditorText,(n,s)=>s,0)(()=>{this._mouseOverMessage||this._messageWidget.value&&gA(QD(),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(zi(this._messageWidget.value.getDomNode(),Un.MOUSE_ENTER,()=>this._mouseOverMessage=!0,!0)),this._messageListeners.add(zi(this._messageWidget.value.getDomNode(),Un.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 z(t.lineNumber-3,1,n.target.position.lineNumber+3,1))}))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(Mk.fadeOut(this._messageWidget.value))}},v_=Ql,Ql.ID="editor.contrib.messageController",Ql.MESSAGE_VISIBLE=new Ri("messageVisible",!1,y("messageVisible","Whether the editor is currently showing an inline message")),Ql);po=v_=S3([Tk(1,Vi),Tk(2,Gr)],po);const C3=no.bindToContribution(po.get);Mt(new C3({id:"leaveEditorMessage",precondition:po.MESSAGE_VISIBLE,handler:o=>o.closeMessage(),kbOpts:{weight:130,primary:9}}));let Mk=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)}};bi(po.ID,po,4);function gw(o,e){return e&&(o.stack||o.stacktrace)?y("stackTrace.format","{0}: {1}",Rk(o),Nk(o.stack)||Nk(o.stacktrace)):Rk(o)}function Nk(o){return Array.isArray(o)?o.join(`
|
|
16
16
|
`):o}function Rk(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 Q_(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=rl(o),i=Q_(t[0],e);return t.length>1?y("error.moreErrors","{0} ({1} errors in total)",i,t.length):i}if(iE(o))return o;if(o.detail){const t=o.detail;if(t.error)return gw(t.error,e);if(t.exception)return gw(t.exception,e)}return o.stack?gw(o,e):o.message?o.message:y("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}var KT=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Iu=function(o,e){return function(t,i){e(t,i,o)}},NS,fd;let RS=(fd=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(Dn(()=>this.visibleContext.reset())),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(Dn((()=>this.editor.removeContentWidget(this)))),this._register(this.editor.onDidChangeCursorPosition(f=>{s.containsPosition(f.position)||this.dispose()})),this._register(ds.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=mt(".post-edit-widget"),this.button=this._register(new fA(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(zi(this.domNode,Un.CLICK,()=>this.showSelector()))}getId(){return NS.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){this._contextMenuService.showContextMenu({getAnchor:()=>{const e=Qs(this.button.element);return{x:e.left+e.width,y:e.top+e.height}},getActions:()=>this.edits.allEdits.map((e,t)=>pA({id:"",label:e.title,checked:t===this.edits.activeEditIndex,run:()=>{if(t!==this.edits.activeEditIndex)return this.onSelectNewEdit(t)}}))})}},NS=fd,fd.baseId="editor.widget.postEditWidget",fd);RS=NS=KT([Iu(7,Lg),Iu(8,Vi),Iu(9,as)],RS);let ev=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 Mo),this._register(ds.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)=>{xc(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}':
|
|
@@ -149,7 +149,7 @@ $2
|
|
|
149
149
|
`),ke=[],Ke=/```(\w*)\n([\s\S]*?)```/g;let nt=0,at;for(;(at=Ke.exec(J))!==null;)at.index>nt&&ke.push({type:"text",text:J.slice(nt,at.index)}),ke.push({type:"code",lang:at[1]||"text",text:at[2].trimEnd()}),nt=at.index+at[0].length;const ut=J.slice(nt),ye=ut.match(/```(\w*)\n([\s\S]*)$/);return ye?(ye.index>0&&ke.push({type:"text",text:ut.slice(0,ye.index)}),ke.push({type:"code",lang:ye[1]||"text",text:ye[2]})):ut&&ke.push({type:"text",text:ut}),ke}function Ei(H){navigator.clipboard.writeText(H).catch(()=>{})}function Mn(H,J=!1){var ke;J&&t()&&k(D,t().path,!0),(ke=e.onApply)==null||ke.call(e,H)}function sn(H){return!H||H==="js"||H==="javascript"}function Sn(H){const J=H.match(/^\/\/ @new-file:\s*(\S+\.js)[ \t]*\n/);return J?{filename:J[1],code:H.slice(J[0].length)}:null}function Xi(H){return H>=1e9?`${(H/1e9).toFixed(1)} GB`:H>=1e6?`${(H/1e6).toFixed(0)} MB`:H>=1024?`${(H/1024).toFixed(1)} kB`:`${H} B`}async function Hi(){if(k(V,!0),!(u(F)||u(Y))){k(Y,!0),k(X,"");try{k(F,await pR(u(S)||u(h).model),!0)}catch(H){k(X,H.message,!0)}k(Y,!1)}}function dn(H){const J=H.match(/\.([^.]+)$/);return J?J[1].toUpperCase():"?"}function Nn(H){switch(H){case"SH":case"BASH":return"$";case"MD":case"MARKDOWN":return"⇓";case"JSON":case"JSONC":return"{}";default:return H}}function Rn(H){i(i().filter((J,ke)=>ke!==H))}function $n(){jt.click()}async function Cn(H){if(!(!H||H.length===0))for(const J of Array.from(H)){const ke=await J.text();i([...i(),{name:J.name,content:ke}])}}function pn(H){const J=H.target;Cn(J.files),J.value=""}function on(H){var J;H.preventDefault(),k(ai,!1),Cn(((J=H.dataTransfer)==null?void 0:J.files)??null)}function qe(H){var J;(J=H.dataTransfer)!=null&&J.types.includes("Files")&&(H.preventDefault(),k(ai,!0))}function Ft(){k(ai,!1)}async function li(){try{k(v,await m7(),!0)}catch{}}async function Ci(){var J;if(u(n).length===0)return;const H=((J=u(n).find(ke=>ke.role==="user"))==null?void 0:J.content.slice(0,80))??u(p);try{await _7(u(p),H,u(n)),await li()}catch{}}async function Ii(H){try{const J=await _D(H);k(n,J.messages,!0),k(p,H,!0),k(_,!1),k(c,"")}catch{}}async function mn(H){try{await v7(H),await li(),H===u(p)&&xn()}catch{}}function xn(){k(n,[],!0),k(c,""),k(p,f(),!0),k(_,!1)}xr(async()=>{zt();try{const H=await _D(u(p));k(n,H.messages,!0)}catch{}await li()});async function qn(){const H=u(r).trim();if(!H||u(a))return;k(r,""),k(c,""),k(a,!0);const J={role:"user",content:H};k(n,[...u(n),J],!0),Le=new AbortController,k(Qt,[],!0);try{await _R({messages:u(n),currentScript:u(Xt),context:u(Re),modelOverride:u(S)||void 0,extraFiles:i().length>0?i():void 0},ke=>{k(s,(u(s)??"")+ke)},Le.signal,ke=>{k(Qt,[...u(Qt),ke],!0)}),k(n,[...u(n),{role:"assistant",content:u(s)??"",toolEvents:u(Qt).length>0?[...u(Qt)]:void 0}],!0),k(Qt,[],!0)}catch(ke){if(ke.name==="AbortError"){const Ke=u(s);Ke&&Ke.trim()&&k(n,[...u(n),{role:"assistant",content:Ke+`
|
|
150
150
|
|
|
151
151
|
*[stopped]*`,toolEvents:u(Qt).length>0?[...u(Qt)]:void 0}],!0)}else k(c,ke.message,!0)}finally{Le=null,k(s,null),k(Qt,[],!0),k(a,!1),Ci()}}function hn(){Le==null||Le.abort()}function An(H){H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),qn())}function rn(){xn()}const Ln=["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 Ae(H){k(r,H,!0),Ne==null||Ne.focus()}var Z=uK(),Fe=bt(Z),wt=C(Fe),Dt=x(C(wt),2);{var Nt=H=>{var J=Sq(),ke=C(J);{var Ke=ut=>{var ye=Ur();G(()=>q(ye,`${u(h).provider??""} · ${(u(S)||u(h).model)??""}`)),T(ut,ye)},nt=ut=>{var ye=Ur();G(()=>q(ye,`${u(h).provider??""} · pick a model below`)),T(ut,ye)},at=ut=>{var ye=Ur("Not configured");T(ut,ye)};$(ke,ut=>{u(At)?ut(Ke):u(h).provider?ut(nt,1):ut(at,-1)})}G(()=>Hn(J,"title",`Provider: ${u(h).provider??""}`)),T(H,J)};$(Dt,H=>{u(h)&&H(Nt)})}var O=x(Dt,2);let se;var be=x(O,2);{var j=H=>{var J=Cq();te("click",J,rn),T(H,J)};$(be,H=>{u(n).length>0&&H(j)})}var pe=x(wt,2);{var Ue=H=>{var J=Iq(),ke=C(J),Ke=x(C(ke),2),nt=x(ke,2);{var at=ye=>{var Et=xq();T(ye,Et)},ut=ye=>{var Et=kq();_i(Et,21,()=>u(v),dt=>dt.id,(dt,he)=>{var Ct=Lq();let Ze;var Ie=C(Ct),le=C(Ie),_e=x(Ie,2);G(()=>{Ze=$t(Ct,1,"history-item svelte-10ayso4",null,Ze,{"history-active":u(he).id===u(p)}),Hn(Ie,"title",u(he).id),q(le,u(he).title||u(he).id)}),te("click",Ie,()=>Ii(u(he).id)),te("click",_e,()=>mn(u(he).id)),T(dt,Ct)}),T(ye,Et)};$(nt,ye=>{u(v).length===0?ye(at):ye(ut,-1)})}te("click",Ke,xn),T(H,J)};$(pe,H=>{u(_)&&H(Ue)})}var Ce=x(pe,2),De=C(Ce);{var Xe=H=>{var J=Dq();T(H,J)},Vt=H=>{var J=Tq(),ke=C(J),Ke=C(ke);{var nt=ye=>{var Et=Eq(),dt=x(bt(Et)),he=C(dt);G(Ct=>q(he,Ct),[()=>t().path.split("/").pop()]),T(ye,Et)},at=ye=>{var Et=Ur("No script open. Ask a general she scripting question.");T(ye,Et)};$(Ke,ye=>{t()?ye(nt):ye(at,-1)})}var ut=x(ke,2);_i(ut,17,()=>Ln,Vn,(ye,Et)=>{var dt=Pq(),he=C(dt);G(()=>q(he,u(Et))),te("click",dt,()=>Ae(u(Et))),T(ye,dt)}),T(H,J)};$(De,H=>{u(ot)?u(n).length===0&&u(s)===null&&H(Vt,1):H(Xe)})}var ft=x(De,2);_i(ft,17,()=>u(n),Vn,(H,J,ke)=>{var Ke=Bq(),nt=C(Ke);{var at=ye=>{var Et=Mq(),dt=C(Et);G(()=>q(dt,u(J).content)),T(ye,Et)},ut=ye=>{const Et=rt(()=>vt(u(J).content));var dt=Wq(),he=bt(dt);{var Ct=Ie=>{var le=TD();_i(le,21,()=>u(J).toolEvents,Vn,(_e,Qe)=>{var Bt=Fs(),fe=bt(Bt);{var $e=Pt=>{var et=ED(),ci=x(C(et),2),Jt=C(ci),Gn=x(ci,2);{var $i=Gt=>{var _n=DD(),ri=C(_n);G(On=>q(ri,On),[()=>Object.entries(u(Qe).args).map(([On,Yi])=>`${On}=${JSON.stringify(Yi)}`).join(", ")]),T(Gt,_n)},oi=rt(()=>u(Qe).args&&Object.keys(u(Qe).args).length>0);$(Gn,Gt=>{u(oi)&&Gt($i)})}G(Gt=>q(Jt,Gt),[()=>u(Qe).name.replace(/_/g," ")]),T(Pt,et)},gt=Pt=>{var et=PD(),ci=x(C(et),2),Jt=C(ci);G(Gn=>q(Jt,Gn),[()=>u(Qe).name.replace(/_/g," ")]),T(Pt,et)};$(fe,Pt=>{u(Qe).type==="tool_call"?Pt($e):Pt(gt,-1)})}T(_e,Bt)}),T(Ie,le)};$(he,Ie=>{var le;(le=u(J).toolEvents)!=null&&le.length&&Ie(Ct)})}var Ze=x(he,2);_i(Ze,21,()=>u(Et),Vn,(Ie,le,_e)=>{var Qe=Fs(),Bt=bt(Qe);{var fe=gt=>{var Pt=MD();Ul(Pt,()=>Bn(u(le).text),!0),T(gt,Pt)},$e=gt=>{const Pt=rt(()=>sn(u(le).lang)?Sn(u(le).text):null),et=rt(()=>u(Pt)?u(Pt).code:u(le).text),ci=rt(()=>`${ke}:${_e}`),Jt=rt(()=>vi(u(et))),Gn=rt(()=>u(N).has(u(ci)));var $i=Hq(),oi=C($i),Gt=C(oi),_n=C(Gt),ri=x(Gt,2),On=C(ri),Yi=x(On,2);{var Ps=Xs=>{var es=Nq();te("click",es,()=>e.onCreateFile(u(Pt).filename,u(Pt).code)),T(Xs,es)},Oo=Xs=>{var es=Oq(),Ts=bt(es),Ph=x(Ts,2);{var Th=Xo=>{var ea=Rq();T(Xo,ea)},Ec=Xo=>{var ea=Aq();te("click",ea,()=>Mn(u(le).text,!0)),T(Xo,ea)};$(Ph,Xo=>{u(P)?Xo(Th):Xo(Ec,-1)})}te("click",Ts,()=>Mn(u(le).text)),T(Xs,es)},Lr=rt(()=>sn(u(le).lang)&&t());$(Yi,Xs=>{u(Pt)&&e.onCreateFile?Xs(Ps):u(Lr)&&Xs(Oo,1)})}var Aa=x(oi,2);let kr;var Qr=C(Aa),Cl=C(Qr);Ul(Cl,()=>Gi(u(et),u(le).lang??""),!0);var Oa=x(Qr,2);{var Ai=Xs=>{var es=Fq(),Ts=C(es);G(()=>q(Ts,u(Gn)?"▲ collapse":"▼ expand")),te("click",es,()=>Tn(u(ci))),T(Xs,es)};$(Oa,Xs=>{u(Jt)&&Xs(Ai)})}G(()=>{q(_n,u(Pt)?`new: ${u(Pt).filename}`:u(le).lang),kr=$t(Aa,1,"code-body svelte-10ayso4",null,kr,{collapsed:u(Jt)&&!u(Gn)})}),te("click",On,()=>Ei(u(et))),T(gt,$i)};$(Bt,gt=>{u(le).type==="text"?gt(fe):gt($e,-1)})}T(Ie,Qe)}),T(ye,dt)};$(nt,ye=>{u(J).role==="user"?ye(at):ye(ut,-1)})}G(()=>$t(Ke,1,`message ${u(J).role??""}`,"svelte-10ayso4")),T(H,Ke)});var ue=x(ft,2);{var ht=H=>{var J=TD();_i(J,21,()=>u(Qt),Vn,(ke,Ke)=>{var nt=Fs(),at=bt(nt);{var ut=Et=>{var dt=ED(),he=x(C(dt),2),Ct=C(he),Ze=x(he,2);{var Ie=_e=>{var Qe=DD(),Bt=C(Qe);G(fe=>q(Bt,fe),[()=>Object.entries(u(Ke).args).map(([fe,$e])=>`${fe}=${JSON.stringify($e)}`).join(", ")]),T(_e,Qe)},le=rt(()=>u(Ke).args&&Object.keys(u(Ke).args).length>0);$(Ze,_e=>{u(le)&&_e(Ie)})}G(_e=>q(Ct,_e),[()=>u(Ke).name.replace(/_/g," ")]),T(Et,dt)},ye=Et=>{var dt=PD(),he=x(C(dt),2),Ct=C(he);G(Ze=>q(Ct,Ze),[()=>u(Ke).name.replace(/_/g," ")]),T(Et,dt)};$(at,Et=>{u(Ke).type==="tool_call"?Et(ut):Et(ye,-1)})}T(ke,nt)}),T(H,J)};$(ue,H=>{u(Qt).length>0&&H(ht)})}var ii=x(ue,2);{var Kt=H=>{var J=zq(),ke=C(J),Ke=C(ke),nt=C(Ke);G(()=>q(nt,ve[u(je)])),T(H,J)};$(ii,H=>{u(a)&&u(s)===null&&u(Qt).length===0&&H(Kt)})}var si=x(ii,2);{var ui=H=>{var J=jq(),ke=C(J);_i(ke,21,()=>nn(u(s)),Vn,(Ke,nt)=>{var at=Fs(),ut=bt(at);{var ye=dt=>{var he=MD();Ul(he,()=>Bn(u(nt).text),!0),T(dt,he)},Et=dt=>{var he=Vq(),Ct=C(he),Ze=C(Ct),Ie=C(Ze),le=x(Ct,2),_e=C(le);Ul(_e,()=>Gi(u(nt).text,u(nt).lang??""),!0),G(()=>q(Ie,u(nt).lang)),T(dt,he)};$(ut,dt=>{u(nt).type==="text"?dt(ye):dt(Et,-1)})}T(Ke,at)}),T(H,J)};$(si,H=>{u(s)!==null&&H(ui)})}bs(Ce,H=>Ge=H,()=>Ge);var Q=x(Ce,2);{var ge=H=>{var J=Uq(),ke=C(J);G(()=>q(ke,u(c))),T(H,J)};$(Q,H=>{u(c)&&H(ge)})}var We=x(Q,2),it=C(We),xt=C(it),Ye=x(it,2),pt=C(Ye),ei=x(Ye,2),Ut=C(ei),Rt=x(We,2),Oi=C(Rt);{var an=H=>{const J=rt(()=>dn(t().path.split("/").pop()??t().path));var ke=$q();let Ke;var nt=C(ke),at=C(nt),ut=x(nt,2),ye=C(ut),Et=x(ut,2),dt=C(Et);G((he,Ct)=>{Ke=$t(ke,1,"file-chip svelte-10ayso4",null,Ke,{inactive:!u(yt)}),$t(nt,1,`badge badge-${he??""}`,"svelte-10ayso4"),q(at,Ct),q(ye,t().path),Hn(Et,"title",u(yt)?"Remove from context":"Re-add to context"),q(dt,u(yt)?"×":"+")},[()=>u(J).toLowerCase(),()=>Nn(u(J))]),te("click",Et,()=>k(yt,!u(yt))),T(H,ke)};$(Oi,H=>{t()&&H(an)})}var Wi=x(Oi,2);_i(Wi,17,i,Vn,(H,J,ke)=>{const Ke=rt(()=>dn(u(J).name));var nt=qq(),at=C(nt),ut=C(at),ye=x(at,2),Et=C(ye),dt=x(ye,2);G((he,Ct)=>{$t(at,1,`badge badge-${he??""}`,"svelte-10ayso4"),q(ut,Ct),q(Et,u(J).name)},[()=>u(Ke).toLowerCase(),()=>Nn(u(Ke))]),te("click",dt,()=>Rn(ke)),T(H,nt)});var ti=x(Wi,2),ji=x(ti,2);bs(ji,H=>jt=H,()=>jt);var A=x(Rt,2);let K;var Ee=C(A);let Pe;var Be=C(Ee);bs(Be,H=>Ne=H,()=>Ne);var Me=x(Ee,2);{var re=H=>{var J=Kq();te("click",J,hn),T(H,J)},Je=H=>{var J=Gq();G(ke=>J.disabled=ke,[()=>!u(r).trim()||!u(At)]),te("click",J,qn),T(H,J)};$(Me,H=>{u(a)?H(re):H(Je,-1)})}var Oe=x(A,2);{var xe=H=>{var J=Qq(),ke=C(J),Ke=C(ke),nt=x(ke,2);{var at=dt=>{var he=Xq();_i(he,21,()=>u(w),Vn,(Ct,Ze)=>{var Ie=Zq(),le=C(Ie),_e={};G(()=>{q(le,u(Ze)),_e!==(_e=u(Ze))&&(Ie.value=(Ie.__value=u(Ze))??"")}),T(Ct,Ie)}),G(()=>he.disabled=u(a)),_a(he,()=>u(S),Ct=>k(S,Ct)),T(dt,he)},ut=dt=>{var he=Yq(),Ct=C(he);G(()=>q(Ct,u(S)||u(h).model)),T(dt,he)};$(nt,dt=>{u(w).length>0?dt(at):dt(ut,-1)})}var ye=x(nt,2);{var Et=dt=>{var he=Jq();te("click",he,Hi),T(dt,he)};$(ye,dt=>{u(h).provider==="ollama"&&dt(Et)})}G(()=>q(Ke,u(h).provider)),T(H,J)};$(Oe,H=>{var J;(J=u(h))!=null&&J.provider&&(u(ot)||u(w).length>0)&&H(xe)})}var St=x(Fe,2);{var Te=H=>{var J=hK(),ke=C(J),Ke=C(ke),nt=C(Ke),at=C(nt),ut=x(nt,2),ye=x(Ke,2),Et=C(ye);{var dt=Ze=>{var Ie=eK();T(Ze,Ie)},he=Ze=>{var Ie=tK(),le=C(Ie);G(()=>q(le,u(X))),T(Ze,Ie)},Ct=Ze=>{var Ie=dK(),le=C(Ie);{var _e=oi=>{var Gt=iK(),_n=x(bt(Gt)),ri=C(_n);G(()=>q(ri,u(F).version)),T(oi,Gt)};$(le,oi=>{u(F).version&&oi(_e)})}var Qe=x(le,2);{var Bt=oi=>{var Gt=nK(),_n=x(bt(Gt)),ri=C(_n);G(()=>q(ri,u(F).details.family)),T(oi,Gt)};$(Qe,oi=>{var Gt;(Gt=u(F).details)!=null&&Gt.family&&oi(Bt)})}var fe=x(Qe,2);{var $e=oi=>{var Gt=sK(),_n=x(bt(Gt)),ri=C(_n);G(()=>q(ri,u(F).details.parameter_size)),T(oi,Gt)};$(fe,oi=>{var Gt;(Gt=u(F).details)!=null&&Gt.parameter_size&&oi($e)})}var gt=x(fe,2);{var Pt=oi=>{var Gt=oK(),_n=x(bt(Gt)),ri=C(_n);G(()=>q(ri,u(F).details.quantization_level)),T(oi,Gt)};$(gt,oi=>{var Gt;(Gt=u(F).details)!=null&&Gt.quantization_level&&oi(Pt)})}var et=x(gt,2);{var ci=oi=>{var Gt=rK(),_n=x(bt(Gt)),ri=C(_n);G(()=>q(ri,u(F).details.format)),T(oi,Gt)};$(et,oi=>{var Gt;(Gt=u(F).details)!=null&&Gt.format&&oi(ci)})}var Jt=x(et,2);{var Gn=oi=>{var Gt=lK(),_n=x(bt(Gt),2);_i(_n,21,()=>u(F).running,Vn,(ri,On)=>{var Yi=aK(),Ps=C(Yi);G(Oo=>q(Ps,`${u(On).name??""} · ${Oo??""} VRAM`),[()=>Xi(u(On).size_vram)]),T(ri,Yi)}),T(oi,Gt)},$i=oi=>{var Gt=cK();T(oi,Gt)};$(Jt,oi=>{u(F).running&&u(F).running.length>0?oi(Gn):u(F).running!==null&&oi($i,1)})}T(Ze,Ie)};$(Et,Ze=>{u(Y)?Ze(dt):u(X)?Ze(he,1):u(F)&&Ze(Ct,2)})}G(()=>{var Ze;return q(at,`Ollama · ${(u(S)||((Ze=u(h))==null?void 0:Ze.model))??""}`)}),te("click",J,()=>k(V,!1)),te("click",ke,Ze=>Ze.stopPropagation()),te("click",ut,()=>k(V,!1)),T(H,J)};$(St,H=>{u(V)&&H(Te)})}G(H=>{se=$t(O,1,"icon-hdr-btn svelte-10ayso4",null,se,{active:u(_)}),q(Ut,H),K=$t(A,1,"input-row svelte-10ayso4",null,K,{"drag-over":u(ai)}),Pe=$t(Ee,1,"textarea-wrap svelte-10ayso4",null,Pe,{loading:u(a)}),Hn(Be,"placeholder",u(At)?"Ask anything… (Enter to send, Shift+Enter for newline, drag & drop files to add context)":u(ot)?"Select a model above to start chatting":"AI not configured"),Be.disabled=u(a)||!u(At)},[()=>Xi(u(ni))]),te("click",O,()=>k(_,!u(_))),As(xt,()=>u(st),H=>k(st,H)),As(pt,()=>u(Ot),H=>k(Ot,H)),te("click",ti,$n),te("change",ji,pn),os("dragover",A,qe),os("dragleave",A,Ft),os("drop",A,on),te("keydown",Be,An),Ni(Be,()=>u(r),H=>k(r,H)),T(o,Z),Ao()}Cr(["click","change","keydown"]);const fK={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"]},pK={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 m0=[],_0=[],v0=[];const eb=new Map;let AR=[];const b0=new Map,y0=new Map;async function ND(){try{m0=(await uR()).map(e=>e.topic)}catch{}}async function RD(){try{const[o,e]=await Promise.all([cR(),dR()]);_0=o,v0=e}catch{}}async function AD(){try{const o=await hR();AR=o.map(e=>e.nodeId),b0.clear(),y0.clear();for(const e of o)e.name&&(b0.set(e.nodeId,e.name),y0.set(e.name,e.nodeId));await Promise.all(o.map(async e=>{if(!eb.has(e.nodeId))try{eb.set(e.nodeId,await T_(e.nodeId))}catch{}}))}catch{}}function mK(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=_K(h),f=vK(h);if(g===0)return{type:"matter-nodeId",prefix:f};if(g===1){const p=eu(h,0);if(p)return{type:"matter-endpointId",nodeId:p}}if(g===2){const p=eu(h,0),v=OD(h,1)??eu(h,1);if(p&&v!==null)return{type:"matter-cluster",nodeId:p,endpointId:v}}if(g>=3){const p=eu(h,0),v=OD(h,1)??eu(h,1),_=eu(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 _K(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 vK(o){const e=o.match(/['"]([^'"]*)\s*$/);return e?e[1]:""}function eu(o,e){var s;const i=(s=OR(o)[e])==null?void 0:s.trim();if(!i)return null;const n=i.match(/^['"](.*)['"]$/);return n?n[1]:null}function OD(o,e){var s;const i=(s=OR(o)[e])==null?void 0:s.trim();if(!i)return null;const n=parseInt(i,10);return isNaN(n)?null:n}function OR(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 vh=Vc.CompletionItemKind;function bK(o,e){return(e?m0.filter(i=>i.startsWith(e)):m0).map(i=>({label:i,kind:vh.Value,insertText:i,range:o,detail:"MQTT topic",sortText:"0"+i}))}function yK(o,e,t){const i=t?[..._0,...v0]:_0;return(e?i.filter(s=>s.startsWith(e)):i).map(s=>({label:s,kind:vh.Value,insertText:s,range:o,detail:v0.includes(s)?"sheDB view":"sheDB document",sortText:"0"+s}))}function wK(o,e){return AR.map(t=>{const i=b0.get(t)??t;return e&&!i.startsWith(e)&&!t.startsWith(e)?null:{label:i,kind:vh.Value,insertText:i,range:o,detail:i!==t?`Node ID: ${t}`:"Matter node",sortText:"0"+i}}).filter(Boolean)}function FR(o){return y0.get(o)??o}function SK(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 CK(o,e){const t=eb.get(FR(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:vh.Value,insertText:n,range:o,detail:i.name?`Endpoint ${i.endpointId} — ${s}`:`Clusters: ${s}`,sortText:"0"+String(i.endpointId).padStart(4,"0")}}):[]}function xK(o,e,t){const i=eb.get(FR(e));if(!i)return[];const n=SK(i,t);return n?n.clusters.map(s=>({label:s.name,kind:vh.Value,insertText:s.name,range:o,detail:"Matter cluster",sortText:"0"+s.name})):[]}function LK(o,e,t){return(t?pK[e]??[]:fK[e]??[]).map(n=>({label:n,kind:t?vh.Function:vh.Property,insertText:n,range:o,detail:t?`${e} command`:`${e} attribute`,sortText:"0"+n}))}let FD=!1;function kK(){FD||(FD=!0,ND(),RD(),AD(),setInterval(ND,15e3),setInterval(RD,1e4),setInterval(AD,6e4),Vc.registerCompletionItemProvider("javascript",{triggerCharacters:["'",'"',"(",","," "],provideCompletionItems(o,e){const t=o.getValueInRange({startLineNumber:e.lineNumber,startColumn:1,endLineNumber:e.lineNumber,endColumn:e.column}),i=mK(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:bK(a,i.prefix)};case"db":return{suggestions:yK(a,i.prefix,i.includeViews)};case"matter-nodeId":return{suggestions:wK(a,i.prefix)};case"matter-endpointId":return{suggestions:CK(a,i.nodeId)};case"matter-cluster":return{suggestions:xK(a,i.nodeId,i.endpointId)};case"matter-attr":return{suggestions:LK(a,i.cluster,i.isSend)};default:return null}}}))}var IK=R('<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),DK=R('<button class="svelte-1pyfjii">Show git history</button>'),EK=R('<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),PK=R('<div class="ctx-backdrop svelte-1pyfjii" role="presentation"></div> <div class="ctx-menu svelte-1pyfjii"><!></div>',1),TK=R('<div class="lib-tip-float svelte-1pyfjii">Library directory — files here are not auto-loaded as scripts</div>'),HD=R('<span class="git-mod svelte-1pyfjii" title="Uncommitted changes">M</span>'),MK=R('<ul class="tree-children svelte-1pyfjii"></ul>'),NK=R('<li class="tree-dir svelte-1pyfjii"><div role="treeitem" tabindex="-1" draggable="true"><button>›</button> <span role="button" tabindex="0"> </span> <!> <label class="lib-label svelte-1pyfjii" title="Library directory — files here are not auto-loaded as scripts"><input type="checkbox" class="svelte-1pyfjii"/> <span class="lib-checkmark svelte-1pyfjii"></span> <svg width="11" height="11" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 3h8a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H3V3z"></path><line x1="3" y1="12" x2="13" y2="12"></line><line x1="6" y1="3" x2="6" y2="12"></line></svg></label> <label class="dis-label svelte-1pyfjii" title="Disable — scripts in this folder will not be executed"><input type="checkbox" class="svelte-1pyfjii"/> <span class="dis-checkmark svelte-1pyfjii"></span> <svg width="11" height="11" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"><circle cx="8" cy="8" r="6"></circle><line x1="3.8" y1="12.2" x2="12.2" y2="3.8"></line></svg></label></div> <!></li>'),RK=R('<span class="dirty-dot svelte-1pyfjii">●</span>'),AK=R('<span class="err-dot svelte-1pyfjii">●</span>'),OK=R('<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>'),FK=R('<span class="dis-spacer svelte-1pyfjii"></span>'),HK=R('<li draggable="true"><div class="file-row svelte-1pyfjii"><button><span> </span> <span class="fname svelte-1pyfjii"> </span> <!><!> <!></button> <!></div></li>'),WK=R('<div class="err svelte-1pyfjii"> </div>'),BK=R('<div class="history-empty svelte-1pyfjii">Loading…</div>'),zK=R('<div class="history-empty svelte-1pyfjii">No commits found.</div>'),VK=R('<button class="history-row svelte-1pyfjii"><span class="history-subject svelte-1pyfjii"> </span> <span class="history-meta svelte-1pyfjii"> </span></button>'),jK=R('<!> <button class="history-load-more svelte-1pyfjii"> </button>',1),UK=R('<div class="history-panel svelte-1pyfjii"><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>'),$K=R('<span class="tab-dirty svelte-1pyfjii">●</span>'),qK=R('<div role="button" tabindex="0"><span class="tab-label svelte-1pyfjii"> </span> <!> <button class="tab-close svelte-1pyfjii" title="Close">×</button></div>'),KK=R('<div class="tab-bar svelte-1pyfjii"></div>'),GK=R('<span class="git-changes svelte-1pyfjii"> </span>'),ZK=R('<span class="git-ahead svelte-1pyfjii"> </span>'),XK=R('<span class="git-behind svelte-1pyfjii"> </span>'),YK=R('<span class="git-status svelte-1pyfjii"><span class="git-branch svelte-1pyfjii"> </span> <!> <!> <!></span>'),JK=R('<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),QK=R('<button class="danger svelte-1pyfjii">Delete</button>'),eG=R(`<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 & 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>`),tG=R('<button class="svelte-1pyfjii">Always accept in this session</button>'),iG=R('<button class="svelte-1pyfjii">Disable auto-accept</button>'),nG=R('<div class="split-backdrop svelte-1pyfjii" role="presentation"></div> <div class="split-menu svelte-1pyfjii"><!></div>',1),sG=R('<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>'),oG=R('<div class="history-diff-notice svelte-1pyfjii">Binary file — diff not available.</div>'),rG=R('<div class="diff-container svelte-1pyfjii"></div>'),aG=R('<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>'),lG=R('<div class="log-resize-handle svelte-1pyfjii" role="separator"></div>'),cG=R('<span class="log-file svelte-1pyfjii"> </span>'),dG=R("<option> </option>"),hG=R('<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),uG=R('<div><span class="ts svelte-1pyfjii"> </span> <span class="lvl svelte-1pyfjii"> </span> <span class="msg svelte-1pyfjii"> </span></div>'),gG=R('<span class="log-empty svelte-1pyfjii">No log output for this script.</span>'),fG=R('<div class="log-body svelte-1pyfjii"><!> <!></div>'),pG=R('<div class="chat-resize-handle svelte-1pyfjii" role="separator"></div> <div class="chat-container svelte-1pyfjii"><!></div>',1),mG=R('<!> <!> <!> <!> <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>
|
|
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 & 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>`),tG=R('<button class="svelte-1pyfjii">Always accept in this session</button>'),iG=R('<button class="svelte-1pyfjii">Disable auto-accept</button>'),nG=R('<div class="split-backdrop svelte-1pyfjii" role="presentation"></div> <div class="split-menu svelte-1pyfjii"><!></div>',1),sG=R('<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>'),oG=R('<div class="history-diff-notice svelte-1pyfjii">Binary file — diff not available.</div>'),rG=R('<div class="diff-container svelte-1pyfjii"></div>'),aG=R('<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>'),lG=R('<div class="log-resize-handle svelte-1pyfjii" role="separator"></div>'),cG=R('<span class="log-file svelte-1pyfjii"> </span>'),dG=R("<option> </option>"),hG=R('<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),uG=R('<div><span class="ts svelte-1pyfjii"> </span> <span class="lvl svelte-1pyfjii"> </span> <span class="msg svelte-1pyfjii"> </span></div>'),gG=R('<span class="log-empty svelte-1pyfjii">No log output for this script.</span>'),fG=R('<div class="log-body svelte-1pyfjii"><!> <!></div>'),pG=R('<div class="chat-resize-handle svelte-1pyfjii" role="separator"></div> <div class="chat-container svelte-1pyfjii"><!></div>',1),mG=R('<!> <!> <!> <!> <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 _G(o,e){Ro(e,!0);let t=B(Si([])),i=B(Si({})),n=B(null),s=B(null),r=B(null),a=B(null),c=B(Si([])),h=B(null),g=B(!1),f=B(""),p=B(!1),v=B(!0),_=B(null),w=B(!1),S=B(!1),D=B(null),P=B(Si([])),N=B(!1),V=B(30),F=B(void 0),Y=null,X=null,me=null,Le=B(!1),je=B(""),ve=B(!1),st=B(void 0),Ot=B(Si(new Set));const yt=new Set;let ai=B(Si([])),jt=B("all"),Qt=B(""),Ne=B(!1);const Ge=["all","debug","info","warn","error"],Re={debug:0,info:1,warn:2,error:3};function ot(W){if(u(jt)!=="all"&&Re[W.level]<Re[u(jt)])return!1;if(!u(Qt))return!0;if(u(Ne))try{return new RegExp(u(Qt),"i").test(W.msg)}catch{}return W.msg.toLowerCase().includes(u(Qt).toLowerCase())}let At=B(null);function ni(W){const oe=W.currentTarget.getBoundingClientRect();k(At,{x:oe.left,y:oe.top},!0)}function Xt(){k(At,null)}let zt,vt,Li,vi=!1,Tn=null,Gi=!1,Bn=!1,nn=B(!1),Ei=B(null),Mn=B(!1),sn=B(!1),Sn=B(void 0),Xi=null,Hi=null,dn=null,Nn=B(Si(parseInt(localStorage.getItem("she-scripts-sidebar-width")??"220",10))),Rn=B(Si(parseInt(localStorage.getItem("she-scripts-log-height")??"130",10))),$n=B(Si(parseInt(localStorage.getItem("she-scripts-chat-width")??"340",10))),Cn=!1,pn=0,on=0,qe=!1,Ft=0,li=0,Ci=!1,Ii=0,mn=0;const xn=rt(()=>{var W;return u(h)&&u(rn)?{path:u(h),content:((W=u(rn).model)==null?void 0:W.getValue())??u(rn).savedContent}:null}),qn=rt(()=>{var W;return new Set(((W=u(_))==null?void 0:W.changes.map(oe=>oe.file))??[])});let hn,An,rn=rt(()=>u(c).find(W=>W.path===u(h))??null);const Ln="she-tabs",Ae="she-active-tab",Z="she-log-open",Fe="she-chat-open";let wt=cg(e,"active",3,!0);zn(()=>{Bn&&(localStorage.setItem(Ln,JSON.stringify(u(c).map(W=>W.path))),u(h)?localStorage.setItem(Ae,u(h)):localStorage.removeItem(Ae))}),zn(()=>{Bn&&localStorage.setItem(Fe,String(u(nn)))}),zn(()=>{wt()&&vt&&vt.layout()});const Dt=`
|
|
153
153
|
declare const she: {
|
|
154
154
|
log(...args: any[]): void;
|
|
155
155
|
info(...args: any[]): void;
|
|
@@ -211,10 +211,10 @@ declare const she: {
|
|
|
211
211
|
`;xr(async()=>{var ce;k(v,localStorage.getItem(Z)!=="false"),k(nn,localStorage.getItem(Fe)==="true"),Vc.typescript.javascriptDefaults.addExtraLib(Dt,"she-api.d.ts"),Vc.typescript.javascriptDefaults.setCompilerOptions({target:Vc.typescript.ScriptTarget.ES2022,allowNonTsExtensions:!0,checkJs:!0}),Vc.typescript.javascriptDefaults.setDiagnosticsOptions({noSyntaxValidation:!1,noSemanticValidation:!0}),kK(),Li=tr.createModel("","javascript"),vt=tr.create(zt,{model:Li,theme:"vs-dark",automaticLayout:!0,minimap:{enabled:!1},fontSize:14,lineNumbers:"on",scrollBeyondLastLine:!1}),vt.onDidChangeModelContent(()=>{if(vi)return;const tt=u(c).find(Tt=>Tt.path===u(h));tt&&(tt.dirty=vt.getValue()!==tt.savedContent),Oe&&clearTimeout(Oe),Oe=setTimeout(xe,600)}),Tn=bR(tt=>{const Tt=tt.msg.match(/^([^:\n]+\.js):\s/);if(!Tt)return;const Wt=Tt[1];if(tt.level==="error")yt.add(Wt),u(Ot).has(Wt)||k(Ot,new Set([...u(Ot),Wt]),!0);else if(yt.has(Wt)){yt.delete(Wt);const fi=new Set(u(Ot));fi.delete(Wt),k(Ot,fi,!0)}const Fi=u(c).find(fi=>fi.path===Wt);Fi&&(Fi.logEntries=[...Fi.logEntries.slice(-199),tt],Fi.path===u(h)&&u(v)&&u(st)&&__().then(()=>{u(st)&&(u(st).scrollTop=u(st).scrollHeight)}))}),await Nt(),Xe();try{const tt=await iL();typeof tt.gitAutoCommit=="boolean"&&k(w,tt.gitAutoCommit,!0),typeof tt.gitAutoPush=="boolean"&&k(S,tt.gitAutoPush,!0)}catch{}const W=JSON.parse(localStorage.getItem(Ln)??"[]"),oe=localStorage.getItem(Ae);for(const tt of W)await pe(tt,!1);const we=oe&&u(c).some(tt=>tt.path===oe)?oe:((ce=u(c)[0])==null?void 0:ce.path)??null;we&&await Ce(we),Bn=!0}),yy(()=>{var W;Oe&&clearTimeout(Oe),Tn==null||Tn();for(const oe of u(c))(W=oe.model)==null||W.dispose();Li==null||Li.dispose(),vt==null||vt.dispose()});async function Nt(){try{if(k(t,await G8(),!0),!Gi){let oe=function(we){for(const ce of we)ce.type==="dir"&&(W[ce.path]=!0,ce.children&&oe(ce.children))};Gi=!0;const W={};oe(u(t)),k(i,W,!0)}k(f,"")}catch(W){k(f,W.message,!0)}}function O(W){u(i)[W]=!u(i)[W]}function se(W){switch(W){case"SH":case"BASH":return"$";case"MD":case"MARKDOWN":return"⇓";case"JSON":case"JSONC":return"{}";default:return W}}async function be(W,oe){try{oe?await Hc(`${W}/.shelib`,""):await n_(`${W}/.shelib`),await Nt(),await Vt("all",oe?`lib ${W}`:`unlib ${W}`)}catch(we){k(f,we.message,!0)}}async function j(W,oe){const we=W.split("/").pop(),ce=W.includes("/")?W.slice(0,W.lastIndexOf("/")):"",tt=ce?`${ce}/.shedisable-${we}`:`.shedisable-${we}`;try{oe?await Hc(tt,""):await n_(tt),await Nt(),await Vt("all",oe?`disable ${W}`:`enable ${W}`)}catch(Tt){k(f,Tt.message,!0)}}async function pe(W,oe=!0){var we;if(u(c).some(ce=>ce.path===W)){oe&&await Ce(W);return}try{const{content:ce}=await $w(W),tt=WF.parse(`file:///she-scripts/${encodeURIComponent(W)}`);(we=tr.getModel(tt))==null||we.dispose();const Tt=tr.createModel(ce,Je(W),tt);k(c,[...u(c),{path:W,dirty:!1,savedContent:ce,model:Tt,logEntries:[]}],!0),oe&&await Ce(W)}catch(ce){k(f,ce.message,!0)}}async function Ue(W){await pe(W,!0)}async function Ce(W){const oe=u(c).find(we=>we.path===W);oe!=null&&oe.model&&(k(h,W,!0),vi=!0,vt.setModel(oe.model),vi=!1,xe())}async function De(W){var ce;const oe=u(c).find(tt=>tt.path===W);if(!oe||oe.dirty&&!await hn.show(`Discard unsaved changes to ${W}?`,{confirm:"Discard"}))return;const we=u(c).findIndex(tt=>tt.path===W);if((ce=oe.model)==null||ce.dispose(),k(c,u(c).filter(tt=>tt.path!==W),!0),u(h)===W){const tt=u(c)[we]??u(c)[we-1]??null;tt?await Ce(tt.path):(k(h,null),vt.setModel(Li))}}async function Xe(){try{k(_,await X8(),!0)}catch{k(_,null)}}async function Vt(W,oe){if(u(_))try{if(W==="all"?await t7(oe):await e7(W,oe),u(S))try{await qw()}catch{}await Xe()}catch{}}async function ft(){if(!u(h))return;const W=u(c).find(oe=>oe.path===u(h));if(W){k(g,!0);try{const oe=vt.getValue();await Hc(u(h),oe),W.savedContent=oe,W.dirty=!1,k(f,""),u(w)?await Vt([u(h)],`update ${u(h)}`):Xe()}catch(oe){k(f,oe.message,!0)}finally{k(g,!1)}}}async function ue(){if(!u(h)||(await ft(),u(f)))return;const W=await An.show("Commit message:",{initial:`update ${u(h)}`,placeholder:"Update script",confirm:"Commit"});if(W)try{if(await Q8(u(h),W),u(S))try{await qw()}catch{}Xe()}catch(oe){k(f,"Git: "+oe.message)}}async function ht(){k(p,!1);try{await qw(),await Xe(),k(f,"")}catch(W){k(f,"Git push: "+W.message)}}function ii(W){const oe=Date.now()-new Date(W).getTime(),we=Math.floor(oe/1e3);if(we<60)return"just now";const ce=Math.floor(we/60);if(ce<60)return`${ce}m ago`;const tt=Math.floor(ce/60);if(tt<24)return`${tt}h ago`;const Tt=Math.floor(tt/24);if(Tt<30)return`${Tt}d ago`;const Wt=Math.floor(Tt/30);return Wt<12?`${Wt}mo ago`:`${Math.floor(Wt/12)}y ago`}async function Kt(W){pt(),k(D,W,!0),k(P,[],!0),k(V,30),await si()}async function si(){if(u(D)){k(N,!0);try{k(P,await i7(u(D).path,u(V)),!0)}catch{}finally{k(N,!1)}}}async function ui(){k(V,u(V)+30),await si()}function Q(){k(D,null),k(P,[],!0),We()}async function ge(W){if(!u(D))return;We();let oe;try{oe=await n7(W.hash,u(D).path)}catch{return}if(k(je,W.hash,!0),k(ve,oe.binary,!0),k(Le,!0),oe.binary||oe.content===null)return;let we="";const ce=u(c).find(Tt=>Tt.path===u(D).path);if(ce!=null&&ce.model)we=ce.model.getValue();else try{we=(await $w(u(D).path)).content}catch{}if(await __(),!u(F))return;const tt=Je(u(D).path);X=tr.createModel(oe.content,tt),me=tr.createModel(we,tt),Y=tr.createDiffEditor(u(F),{theme:"vs-dark",readOnly:!0,renderSideBySide:!0,automaticLayout:!0,minimap:{enabled:!1},fontSize:13,scrollBeyondLastLine:!1}),Y.setModel({original:X,modified:me})}function We(){k(Le,!1),k(ve,!1),Y==null||Y.dispose(),Y=null,X==null||X.dispose(),X=null,me==null||me.dispose(),me=null}async function it(){const W=u(n)?`${u(n)}/`:"",oe=await An.show("New script name:",{placeholder:W?`${W}myscript.js`:"myscript.js",initial:W,confirm:"Create"});if(!oe)return;const we=oe.endsWith(".js")?`/* global she */
|
|
212
212
|
'use strict';
|
|
213
213
|
|
|
214
|
-
`:"";await Hc(oe,we),await Nt(),await pe(oe,!0)}async function xt(){const W=u(n)?`${u(n)}/`:"",oe=await An.show("New folder name:",{placeholder:W?`${W}subfolder`:"myfolder",initial:W,confirm:"Create"});oe&&(await Z8(oe),u(i)[oe]=!0,await Nt())}function Ye(W,oe){W.preventDefault(),k(s,{x:W.clientX,y:W.clientY,entry:oe},!0)}function pt(){k(s,null)}async function ei(W){pt(),k(n,W,!0),u(i)[W]=!0,await it()}async function Ut(W){pt(),k(n,W,!0),await xt()}async function Rt(W){pt();const oe=W.path.includes("/")?W.path.slice(0,W.path.lastIndexOf("/")+1):"",we=await An.show(W.type==="dir"?"Rename folder:":"Rename script:",{initial:W.name,placeholder:W.name,confirm:"Rename"});if(!we||we===W.name)return;const ce=oe+we;try{await fD(W.path,ce);const tt=u(c).find(Tt=>Tt.path===W.path);tt&&(tt.path=ce,u(h)===W.path&&k(h,ce)),await Nt(),await Vt("all",`rename ${W.path} → ${ce}`)}catch(tt){k(f,tt.message,!0)}}function Oi(W){if(!W.children)return 0;let oe=0;for(const we of W.children)oe++,we.type==="dir"&&(oe+=Oi(we));return oe}async function an(W){pt();let oe=`Delete ${W.type==="dir"?"folder":"file"} "${W.path}"?`;if(W.type==="dir"){const we=Oi(W);we>0&&(oe+=` This will also delete ${we} item${we===1?"":"s"} inside.`)}if(await hn.show(oe,{confirm:"Delete",danger:!0})){if(W.type==="dir")for(const we of[...u(c)])we.path.startsWith(W.path+"/")&&await De(we.path);else await De(W.path);await n_(W.path),await Nt(),await Vt("all",`delete ${W.path}`)}}async function Wi(W){pt();const{content:oe}=await $w(W.path);u(ai).some(we=>we.name===W.path)||k(ai,[...u(ai),{name:W.path,content:oe}],!0),k(nn,!0)}function ti(W,oe){var we;k(r,oe,!0),(we=W.dataTransfer)==null||we.setData("text/plain",oe)}function ji(W,oe){if(W.preventDefault(),u(r)&&(u(r)===oe||oe.startsWith(u(r)+"/"))){W.dataTransfer&&(W.dataTransfer.dropEffect="none"),k(a,null);return}W.dataTransfer&&(W.dataTransfer.dropEffect="move"),k(a,oe,!0)}function A(){k(a,null)}async function K(W,oe){var Wt,Fi,fi;W.preventDefault(),k(a,null);const we=Array.from(((Wt=W.dataTransfer)==null?void 0:Wt.items)??[]).filter(xi=>xi.kind==="file");if(we.length>0&&!u(r)){for(const xi of we){const Pi=(Fi=xi.webkitGetAsEntry)==null?void 0:Fi.call(xi);Pi&&await Ee(Pi,oe,!0)}await Nt();return}const ce=u(r)??((fi=W.dataTransfer)==null?void 0:fi.getData("text/plain"));if(k(r,null),!ce||ce===oe||oe.startsWith(ce+"/"))return;const tt=ce.split("/").pop(),Tt=oe?`${oe}/${tt}`:tt;if(Tt!==ce)try{await fD(ce,Tt);for(const xi of u(c))if(xi.path===ce)u(h)===ce&&k(h,Tt,!0),xi.path=Tt;else if(xi.path.startsWith(ce+"/")){const Pi=Tt+xi.path.slice(ce.length);u(h)===xi.path&&k(h,Pi),xi.path=Pi}await Nt(),await Vt("all",`rename ${ce} → ${Tt}`)}catch(xi){k(f,xi.message,!0)}}async function Ee(W,oe,we){if(W.isFile){const tt=await(await new Promise((Wt,Fi)=>W.file(Wt,Fi))).text(),Tt=oe?`${oe}/${W.name}`:W.name;await Hc(Tt,tt),we&&W.name.endsWith(".js")&&await j(Tt,!0)}else if(W.isDirectory){const ce=W.createReader();let tt=[],Tt;do Tt=await new Promise((Wt,Fi)=>ce.readEntries(Wt,Fi)),tt=[...tt,...Tt];while(Tt.length>0);for(const Wt of tt)await Ee(Wt,oe?`${oe}/${W.name}`:W.name,!1);if(we){const Wt=oe?`${oe}/${W.name}`:W.name;await j(Wt,!0)}}}async function Pe(){if(!u(h)||!await hn.show(`Delete ${u(h)}?`,{confirm:"Delete",danger:!0}))return;const W=u(h);await De(W),await n_(W),await Nt(),await Vt("all",`delete ${W}`)}function Be(){u(rn)&&(u(rn).logEntries=[])}function Me(){k(v,!u(v)),localStorage.setItem(Z,String(u(v)))}function re(W){return new Date(W).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Je(W){var ce;const oe=((ce=W.split(".").pop())==null?void 0:ce.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 Oe=null;async function xe(){const W=u(c).find(we=>we.path===u(h));if(!(W!=null&&W.model))return;const oe=W.model;try{const Tt=(await(await(await Vc.typescript.getJavaScriptWorker())(oe.uri)).getSyntacticDiagnostics(oe.uri.toString())).map(Wt=>{const Fi=oe.getPositionAt(Wt.start??0),fi=oe.getPositionAt((Wt.start??0)+(Wt.length??0));return{severity:BF.Error,startLineNumber:Fi.lineNumber,startColumn:Fi.column,endLineNumber:fi.lineNumber,endColumn:fi.column,message:typeof Wt.messageText=="string"?Wt.messageText:JSON.stringify(Wt.messageText),source:"she-syntax"}});if(tr.setModelMarkers(oe,"she-syntax",Tt),u(h)){if(Tt.length>0)yt.add(u(h)),u(Ot).has(u(h))||k(Ot,new Set([...u(Ot),u(h)]),!0);else if(yt.has(u(h))){yt.delete(u(h));const Wt=new Set(u(Ot));Wt.delete(u(h)),k(Ot,Wt,!0)}}}catch{}}function St(W){Cn=!0,pn=W.clientX,on=u(Nn),W.preventDefault()}function Te(W){qe=!0,Ft=W.clientY,li=u(Rn),W.preventDefault()}function H(W){Ci=!0,Ii=W.clientX,mn=u($n),W.preventDefault()}function J(W){Cn&&k(Nn,Math.max(140,Math.min(500,on+W.clientX-pn)),!0),qe&&k(Rn,Math.max(60,Math.min(500,li-(W.clientY-Ft))),!0),Ci&&k($n,Math.max(200,Math.min(700,mn-(W.clientX-Ii))),!0)}function ke(){Cn&&(Cn=!1,localStorage.setItem("she-scripts-sidebar-width",String(u(Nn)))),qe&&(qe=!1,localStorage.setItem("she-scripts-log-height",String(u(Rn)))),Ci&&(Ci=!1,localStorage.setItem("she-scripts-chat-width",String(u($n))))}function Ke(W){(W.ctrlKey||W.metaKey)&&W.key==="s"&&(W.preventDefault(),ft()),W.key==="Escape"&&(k(p,!1),k(s,null))}async function nt(W,oe){const we=await An.show("Save new script as:",{placeholder:"myscript.js",initial:W,confirm:"Create"});if(we)try{await Hc(we,oe),await Nt(),await pe(we,!0)}catch(ce){k(f,ce.message,!0)}}async function at(W){var we,ce;if(u(Mn)&&u(h)){k(Ei,W,!0),await ut();return}if(k(Ei,W,!0),await __(),!u(Sn))return;Hi==null||Hi.dispose(),dn==null||dn.dispose(),Xi==null||Xi.dispose();const oe=((ce=(we=u(rn))==null?void 0:we.model)==null?void 0:ce.getValue())??"";Hi=tr.createModel(oe,"javascript"),dn=tr.createModel(W,"javascript"),Xi=tr.createDiffEditor(u(Sn),{theme:"vs-dark",readOnly:!0,renderSideBySide:!0,automaticLayout:!0,minimap:{enabled:!1},fontSize:13,scrollBeyondLastLine:!1}),Xi.setModel({original:Hi,modified:dn})}zn(()=>{u(h),k(Mn,!1),k(sn,!1)});async function ut(){if(u(Ei)===null||!u(h))return;const W=u(Ei);k(Ei,null);const oe=u(c).find(we=>we.path===u(h));oe!=null&&oe.model&&(vi=!0,oe.model.setValue(W),vi=!1,oe.dirty=!1,oe.savedContent=W);try{await Hc(u(h),W),k(f,""),u(w)?await Vt([u(h)],`update ${u(h)}`):Xe()}catch(we){k(f,we.message,!0)}Et()}function ye(){k(Ei,null),Et()}function Et(){Xi==null||Xi.dispose(),Xi=null,Hi==null||Hi.dispose(),Hi=null,dn==null||dn.dispose(),dn=null}var dt=mG();os("keydown",ad,Ke),os("mousemove",ad,J),os("mouseup",ad,ke);var he=bt(dt);bs(Hg(he,{}),W=>hn=W,()=>hn);var Ct=x(he,2);bs(D7(Ct,{}),W=>An=W,()=>An);var Ze=x(Ct,2);{var Ie=W=>{var oe=PK(),we=bt(oe),ce=x(we,2);let tt;var Tt=C(ce);{var Wt=fi=>{var xi=IK(),Pi=bt(xi),di=x(Pi,2),un=x(di,4),qi=x(un,2);te("click",Pi,()=>ei(u(s).entry.path)),te("click",di,()=>Ut(u(s).entry.path)),te("click",un,()=>Rt(u(s).entry)),te("click",qi,()=>an(u(s).entry)),T(fi,xi)},Fi=fi=>{var xi=EK(),Pi=bt(xi),di=x(Pi,2),un=x(di,2),qi=x(un,2);{var Zn=kn=>{var Ms=DK();te("click",Ms,()=>Kt(u(s).entry)),T(kn,Ms)};$(qi,kn=>{u(_)&&kn(Zn)})}var vs=x(qi,4);te("click",Pi,()=>Ue(u(s).entry.path)),te("click",di,()=>Rt(u(s).entry)),te("click",un,()=>Wi(u(s).entry)),te("click",vs,()=>an(u(s).entry)),T(fi,xi)};$(Tt,fi=>{u(s).entry.type==="dir"?fi(Wt):fi(Fi,-1)})}G(()=>tt=Ko(ce,"",tt,{left:`${u(s).x??""}px`,top:`${u(s).y??""}px`})),te("click",we,pt),te("contextmenu",we,fi=>{fi.preventDefault(),pt()}),T(W,oe)};$(Ze,W=>{u(s)&&W(Ie)})}var le=x(Ze,2);{var _e=W=>{var oe=TK();let we;G(()=>we=Ko(oe,"",we,{left:`${u(At).x??""}px`,top:`${u(At).y-4}px`})),T(W,oe)};$(le,W=>{u(At)&&W(_e)})}var Qe=x(le,2),Bt=C(Qe);let fe;{const W=(we,ce=py,tt)=>{let Tt=t1(()=>KF(tt==null?void 0:tt(),!1));var Wt=Fs(),Fi=bt(Wt);{var fi=Pi=>{var di=NK(),un=C(di);let qi;var Zn=C(un);let vs;var kn=x(Zn,2);let Ms;var Yo=C(kn),cs=x(kn,2);{var oo=Kn=>{var Ir=HD();T(Kn,Ir)},Jo=rt(()=>u(qn).has(ce().path));$(cs,Kn=>{u(Jo)&&Kn(oo)})}var ro=x(cs,2),ao=C(ro),gs=x(ro,2),xl=C(gs),Ho=x(un,2);{var jg=Kn=>{var Ir=MK();_i(Ir,21,()=>ce().children,Ll=>Ll.path,(Ll,Nc)=>{W(Ll,()=>u(Nc),()=>ce().disabled||u(Tt))}),T(Kn,Ir)};$(Ho,Kn=>{u(i)[ce().path]&&ce().children&&Kn(jg)})}G(()=>{qi=$t(un,1,"dir-row svelte-1pyfjii",null,qi,{"dir-selected":u(n)===ce().path,"drag-target":u(a)===ce().path}),Hn(un,"aria-selected",u(n)===ce().path),vs=$t(Zn,1,"chevron svelte-1pyfjii",null,vs,{open:u(i)[ce().path]}),Ms=$t(kn,1,"dir-name svelte-1pyfjii",null,Ms,{lib:ce().lib}),q(Yo,ce().name),cw(ao,ce().lib),cw(xl,ce().disabled)}),os("dragstart",un,Kn=>ti(Kn,ce().path)),os("dragover",un,Kn=>ji(Kn,ce().path)),os("dragleave",un,A),os("drop",un,Kn=>K(Kn,ce().path)),te("contextmenu",un,Kn=>Ye(Kn,ce())),te("click",Zn,()=>O(ce().path)),te("click",kn,()=>{k(n,ce().path,!0),u(i)[ce().path]=!0}),te("keydown",kn,Kn=>Kn.key==="Enter"&&k(n,ce().path,!0)),os("mouseenter",ro,ni),os("mouseleave",ro,Xt),te("change",ao,()=>be(ce().path,!ce().lib)),te("change",xl,()=>j(ce().path,!ce().disabled)),T(Pi,di)},xi=Pi=>{const di=rt(()=>u(Ot).has(ce().path)),un=rt(()=>u(qn).has(ce().path)),qi=rt(()=>u(c).some(ln=>ln.path===ce().path&&ln.dirty)),Zn=rt(()=>(ce().name.split(".").pop()??"txt").toUpperCase()),vs=rt(()=>ce().name.endsWith(".js"));var kn=HK();let Ms;var Yo=C(kn),cs=C(Yo);let oo;var Jo=C(cs);let ro;var ao=C(Jo),gs=x(Jo,2),xl=C(gs),Ho=x(gs,2);{var jg=ln=>{var Ls=HD();T(ln,Ls)};$(Ho,ln=>{u(un)&&ln(jg)})}var Kn=x(Ho);{var Ir=ln=>{var Ls=RK();T(ln,Ls)};$(Kn,ln=>{u(qi)&&ln(Ir)})}var Ll=x(Kn,2);{var Nc=ln=>{var Ls=AK();T(ln,Ls)};$(Ll,ln=>{u(di)&&ln(Nc)})}var Rh=x(cs,2);{var Ug=ln=>{var Ls=OK();let kl;var Oh=C(Ls);G(()=>{kl=$t(Ls,1,"dis-label svelte-1pyfjii",null,kl,{"dis-locked":u(Tt)}),Hn(Ls,"title",u(Tt)?"Disabled by parent directory":"Disable — this script will not be executed"),cw(Oh,ce().disabled),Oh.disabled=u(Tt)}),te("change",Oh,()=>j(ce().path,!ce().disabled)),T(ln,Ls)},Ah=ln=>{var Ls=FK();T(ln,Ls)};$(Rh,ln=>{u(vs)?ln(Ug):ln(Ah,-1)})}G((ln,Ls,kl)=>{Ms=$t(kn,1,"tree-file svelte-1pyfjii",null,Ms,ln),oo=$t(cs,1,"svelte-1pyfjii",null,oo,{lib:ce().lib,dis:ce().disabled,err:u(di)}),ro=$t(Jo,1,`badge badge-${Ls??""}`,"svelte-1pyfjii",ro,{"badge-shelib":ce().lib}),q(ao,kl),q(xl,ce().name)},[()=>({active:u(c).some(ln=>ln.path===ce().path),"active-tab":ce().path===u(h)}),()=>u(Zn).toLowerCase(),()=>se(u(Zn))]),os("dragstart",kn,ln=>ti(ln,ce().path)),te("contextmenu",kn,ln=>Ye(ln,ce())),te("click",cs,()=>Ue(ce().path)),T(Pi,kn)};$(Fi,Pi=>{ce().type==="dir"?Pi(fi):Pi(xi,-1)})}T(we,Wt)};var $e=C(Bt),gt=C($e),Pt=x(gt,2),et=x(Pt,2),ci=x($e,2);{var Jt=we=>{var ce=WK(),tt=C(ce);G(()=>q(tt,u(f))),T(we,ce)};$(ci,we=>{u(f)&&we(Jt)})}var Gn=x(ci,2),$i=C(Gn);let oe;var oi=x($i,2);_i(oi,17,()=>u(t),we=>we.path,(we,ce)=>{W(we,()=>u(ce))});var Gt=x(Gn,2);{var _n=we=>{var ce=UK(),tt=C(ce),Tt=C(tt),Wt=C(Tt),Fi=x(Tt,2),fi=x(tt,2),xi=C(fi);{var Pi=qi=>{var Zn=BK();T(qi,Zn)},di=qi=>{var Zn=zK();T(qi,Zn)},un=qi=>{var Zn=jK(),vs=bt(Zn);_i(vs,17,()=>u(P),Yo=>Yo.hash,(Yo,cs)=>{var oo=VK(),Jo=C(oo),ro=C(Jo),ao=x(Jo,2),gs=C(ao);G((xl,Ho)=>{q(ro,u(cs).subject),q(gs,`${xl??""} · ${Ho??""}`)},[()=>u(cs).hash.slice(0,7),()=>ii(u(cs).date)]),te("click",oo,()=>ge(u(cs))),T(Yo,oo)});var kn=x(vs,2),Ms=C(kn);G(()=>{kn.disabled=u(N),q(Ms,u(N)?"Loading…":"Load more")}),te("click",kn,ui),T(qi,Zn)};$(xi,qi=>{u(N)&&u(P).length===0?qi(Pi):u(P).length===0?qi(di,1):qi(un,-1)})}G(()=>{Hn(Tt,"title",u(D).path),q(Wt,`History: ${u(D).name??""}`)}),te("click",Fi,Q),T(we,ce)};$(Gt,we=>{u(D)&&we(_n)})}G(()=>oe=$t($i,1,"tree-root-drop svelte-1pyfjii",null,oe,{"drag-target":u(a)===""})),te("click",gt,it),te("click",Pt,xt),te("click",et,Nt),os("dragover",$i,we=>ji(we,"")),os("dragleave",$i,A),os("drop",$i,we=>K(we,""))}var ri=x(Bt,2),On=x(ri,2),Yi=C(On);{var Ps=W=>{var oe=KK();_i(oe,21,()=>u(c),we=>we.path,(we,ce)=>{var tt=qK();let Tt;var Wt=C(tt),Fi=C(Wt),fi=x(Wt,2);{var xi=di=>{var un=$K();T(di,un)};$(fi,di=>{u(ce).dirty&&di(xi)})}var Pi=x(fi,2);G(di=>{Tt=$t(tt,1,"tab svelte-1pyfjii",null,Tt,{active:u(ce).path===u(h)}),q(Fi,di)},[()=>u(ce).path.split("/").pop()]),te("click",tt,()=>Ce(u(ce).path)),te("keydown",tt,di=>di.key==="Enter"&&Ce(u(ce).path)),te("click",Pi,di=>{di.stopPropagation(),De(u(ce).path)}),T(we,tt)}),T(W,oe)};$(Yi,W=>{u(c).length>0&&W(Ps)})}var Oo=x(Yi,2),Lr=C(Oo),Aa=C(Lr),kr=x(Lr,2);{var Qr=W=>{var oe=YK(),we=C(oe),ce=C(we),tt=x(we,2);{var Tt=Pi=>{var di=GK(),un=C(di);G(()=>{Hn(di,"title",`${u(_).changes.length??""} uncommitted change(s)`),q(un,`✎${u(_).changes.length??""}`)}),T(Pi,di)};$(tt,Pi=>{u(_).changes.length>0&&Pi(Tt)})}var Wt=x(tt,2);{var Fi=Pi=>{var di=ZK(),un=C(di);G(()=>{Hn(di,"title",`${u(_).ahead??""} commit(s) ahead of upstream`),q(un,`↑${u(_).ahead??""}`)}),T(Pi,di)};$(Wt,Pi=>{u(_).ahead>0&&Pi(Fi)})}var fi=x(Wt,2);{var xi=Pi=>{var di=XK(),un=C(di);G(()=>{Hn(di,"title",`${u(_).behind??""} commit(s) behind upstream`),q(un,`↓${u(_).behind??""}`)}),T(Pi,di)};$(fi,Pi=>{u(_).behind>0&&Pi(xi)})}G(()=>{Hn(we,"title",`Branch: ${u(_).branch??""}`),q(ce,`⎇ ${u(_).branch??""}`)}),T(W,oe)};$(kr,W=>{u(_)&&W(Qr)})}var Cl=x(kr,2),Oa=C(Cl),Ai=C(Oa),Xs=C(Ai),es=x(Ai,2),Ts=x(Oa,2);{var Ph=W=>{var oe=JK(),we=bt(oe),ce=x(we,2),tt=C(ce),Tt=x(tt,2),Wt=x(Tt,2);G(()=>Wt.disabled=!u(_)),te("click",we,()=>k(p,!1)),te("click",tt,()=>{k(p,!1),ft()}),te("click",Tt,()=>{k(p,!1),ue()}),te("click",Wt,ht),T(W,oe)};$(Ts,W=>{u(p)&&W(Ph)})}var Th=x(Cl,2);{var Ec=W=>{var oe=QK();te("click",oe,Pe),T(W,oe)};$(Th,W=>{u(h)&&W(Ec)})}var Xo=x(Th,2);let ea;var $y=x(Oo,2),pm=C($y),Mh=C(pm),mm=C(Mh);bs(mm,W=>zt=W,()=>zt);var Fo=x(mm,2);{var qy=W=>{var oe=eG();T(W,oe)};$(Fo,W=>{u(h)||W(qy)})}var _m=x(Fo,2);{var ta=W=>{var oe=sG(),we=C(oe),ce=C(we),tt=x(C(ce)),Tt=C(tt),Wt=x(ce,2),Fi=C(Wt),fi=C(Fi),xi=C(fi),Pi=C(xi),di=x(xi,2),un=x(fi,2);{var qi=kn=>{var Ms=nG(),Yo=bt(Ms),cs=x(Yo,2),oo=C(cs);{var Jo=ao=>{var gs=tG();te("click",gs,()=>{k(sn,!1),k(Mn,!0),ut()}),T(ao,gs)},ro=ao=>{var gs=iG();te("click",gs,()=>{k(sn,!1),k(Mn,!1)}),T(ao,gs)};$(oo,ao=>{u(Mn)?ao(ro,-1):ao(Jo)})}te("click",Yo,()=>k(sn,!1)),T(kn,Ms)};$(un,kn=>{u(sn)&&kn(qi)})}var Zn=x(Fi,2),vs=x(we,2);bs(vs,kn=>k(Sn,kn),()=>u(Sn)),G(kn=>{q(Tt,kn),q(Pi,u(Mn)?"Auto-accept ✓":"Accept")},[()=>{var kn;return(kn=u(h))==null?void 0:kn.split("/").pop()}]),te("click",xi,ut),te("click",di,()=>k(sn,!u(sn))),te("click",Zn,ye),T(W,oe)};$(_m,W=>{u(Ei)!==null&&W(ta)})}var Bg=x(Mh,2);{var vm=W=>{var oe=aG(),we=C(oe),ce=C(we),tt=x(C(ce)),Tt=C(tt),Wt=x(tt,2),Fi=C(Wt),fi=x(ce,2),xi=C(fi),Pi=x(we,2);{var di=qi=>{var Zn=oG();T(qi,Zn)},un=qi=>{var Zn=rG();bs(Zn,vs=>k(F,vs),()=>u(F)),T(qi,Zn)};$(Pi,qi=>{u(ve)?qi(di):qi(un,-1)})}G(qi=>{var Zn;q(Tt,qi),q(Fi,(Zn=u(D))==null?void 0:Zn.name)},[()=>u(je).slice(0,7)]),te("click",xi,We),T(W,oe)};$(Bg,W=>{u(Le)&&W(vm)})}var Pc=x(Bg,2);let bm,zg;var Vg=C(Pc);{var Ky=W=>{var oe=lG();te("mousedown",oe,Te),T(W,oe)};$(Vg,W=>{u(v)&&W(Ky)})}var ym=x(Vg,2),Tc=C(ym),wm=C(Tc),Sm=x(wm);{var Cm=W=>{var oe=cG(),we=C(oe);G(ce=>q(we,`— ${ce??""}`),[()=>u(h).split("/").pop()]),T(W,oe)};$(Sm,W=>{u(h)&&W(Cm)})}var Nh=x(Tc,2);{var Fa=W=>{var oe=hG(),we=bt(oe);_i(we,21,()=>Ge,Vn,(Fi,fi)=>{var xi=dG(),Pi=C(xi),di={};G(()=>{q(Pi,u(fi)),di!==(di=u(fi))&&(xi.value=(xi.__value=u(fi))??"")}),T(Fi,xi)});var ce=x(we,2),tt=x(ce,2),Tt=C(tt),Wt=x(tt,2);_a(we,()=>u(jt),Fi=>k(jt,Fi)),Ni(ce,()=>u(Qt),Fi=>k(Qt,Fi)),As(Tt,()=>u(Ne),Fi=>k(Ne,Fi)),te("click",Wt,Be),T(W,oe)};$(Nh,W=>{u(v)&&W(Fa)})}var Gy=x(ym,2);{var Mc=W=>{var oe=fG(),we=C(oe);_i(we,17,()=>{var Tt;return(((Tt=u(rn))==null?void 0:Tt.logEntries)??[]).filter(ot)},Tt=>Tt.ts+Tt.msg,(Tt,Wt)=>{var Fi=uG(),fi=C(Fi),xi=C(fi),Pi=x(fi,2),di=C(Pi),un=x(Pi,2),qi=C(un);G((Zn,vs)=>{$t(Fi,1,`log-line ${u(Wt).level??""}`,"svelte-1pyfjii"),q(xi,Zn),q(di,vs),q(qi,u(Wt).msg)},[()=>re(u(Wt).ts),()=>u(Wt).level.toUpperCase()]),T(Tt,Fi)});var ce=x(we,2);{var tt=Tt=>{var Wt=gG();T(Tt,Wt)};$(ce,Tt=>{var Wt;(((Wt=u(rn))==null?void 0:Wt.logEntries.length)??0)===0&&Tt(tt)})}bs(oe,Tt=>k(st,Tt),()=>u(st)),T(W,oe)};$(Gy,W=>{u(v)&&W(Mc)})}var yo=x(pm,2);{var xm=W=>{var oe=pG(),we=bt(oe),ce=x(we,2);let tt;var Tt=C(ce);gK(Tt,{get currentScript(){return u(xn)},onApply:at,onCreateFile:nt,get extraFiles(){return u(ai)},set extraFiles(Wt){k(ai,Wt,!0)}}),G(()=>tt=Ko(ce,"",tt,{width:`${u($n)??""}px`})),te("mousedown",we,H),T(W,oe)};$(yo,W=>{u(nn)&&W(xm)})}G(()=>{var W;fe=Ko(Bt,"",fe,{width:`${u(Nn)??""}px`}),q(Aa,u(h)??"No file selected"),Ai.disabled=!((W=u(rn))!=null&&W.dirty)||u(g),q(Xs,u(g)?"Saving…":"Save"),es.disabled=!u(h),ea=$t(Xo,1,"ai-toggle svelte-1pyfjii",null,ea,{"ai-open":u(nn)}),Hn(Xo,"title",u(nn)?"Close AI assistant":"Open AI assistant"),bm=$t(Pc,1,"log-panel svelte-1pyfjii",null,bm,{collapsed:!u(v)}),zg=Ko(Pc,"",zg,{height:u(v)?`${u(Rn)}px`:"26px"}),q(wm,`${u(v)?"▾":"▸"} Script Log `)}),te("mousedown",ri,St),te("click",Ai,ft),te("click",es,()=>k(p,!u(p))),te("click",Xo,()=>k(nn,!u(nn))),te("click",Tc,Me),T(o,dt),Ao()}Cr(["click","contextmenu","keydown","change","mousedown"]);const HR="she-theme";function vG(){return localStorage.getItem(HR)??"dark"}function bG(o){localStorage.setItem(HR,o);const e=document.documentElement;o==="system"?e.removeAttribute("data-theme"):e.setAttribute("data-theme",o)}var Cf={exports:{}};/* @preserve
|
|
214
|
+
`:"";await Hc(oe,we),await Nt(),await pe(oe,!0)}async function xt(){const W=u(n)?`${u(n)}/`:"",oe=await An.show("New folder name:",{placeholder:W?`${W}subfolder`:"myfolder",initial:W,confirm:"Create"});oe&&(await Z8(oe),u(i)[oe]=!0,await Nt())}function Ye(W,oe){W.preventDefault(),k(s,{x:W.clientX,y:W.clientY,entry:oe},!0)}function pt(){k(s,null)}async function ei(W){pt(),k(n,W,!0),u(i)[W]=!0,await it()}async function Ut(W){pt(),k(n,W,!0),await xt()}async function Rt(W){pt();const oe=W.path.includes("/")?W.path.slice(0,W.path.lastIndexOf("/")+1):"",we=await An.show(W.type==="dir"?"Rename folder:":"Rename script:",{initial:W.name,placeholder:W.name,confirm:"Rename"});if(!we||we===W.name)return;const ce=oe+we;try{await fD(W.path,ce);const tt=u(c).find(Tt=>Tt.path===W.path);tt&&(tt.path=ce,u(h)===W.path&&k(h,ce)),await Nt(),await Vt("all",`rename ${W.path} → ${ce}`)}catch(tt){k(f,tt.message,!0)}}function Oi(W){if(!W.children)return 0;let oe=0;for(const we of W.children)oe++,we.type==="dir"&&(oe+=Oi(we));return oe}async function an(W){pt();let oe=`Delete ${W.type==="dir"?"folder":"file"} "${W.path}"?`;if(W.type==="dir"){const we=Oi(W);we>0&&(oe+=` This will also delete ${we} item${we===1?"":"s"} inside.`)}if(await hn.show(oe,{confirm:"Delete",danger:!0})){if(W.type==="dir")for(const we of[...u(c)])we.path.startsWith(W.path+"/")&&await De(we.path);else await De(W.path);await n_(W.path),await Nt(),await Vt("all",`delete ${W.path}`)}}async function Wi(W){pt();const{content:oe}=await $w(W.path);u(ai).some(we=>we.name===W.path)||k(ai,[...u(ai),{name:W.path,content:oe}],!0),k(nn,!0)}function ti(W,oe){var we;k(r,oe,!0),(we=W.dataTransfer)==null||we.setData("text/plain",oe)}function ji(W,oe){if(W.preventDefault(),u(r)&&(u(r)===oe||oe.startsWith(u(r)+"/"))){W.dataTransfer&&(W.dataTransfer.dropEffect="none"),k(a,null);return}W.dataTransfer&&(W.dataTransfer.dropEffect="move"),k(a,oe,!0)}function A(){k(a,null)}async function K(W,oe){var Wt,Fi,fi;W.preventDefault(),k(a,null);const we=Array.from(((Wt=W.dataTransfer)==null?void 0:Wt.items)??[]).filter(xi=>xi.kind==="file");if(we.length>0&&!u(r)){for(const xi of we){const Pi=(Fi=xi.webkitGetAsEntry)==null?void 0:Fi.call(xi);Pi&&await Ee(Pi,oe,!0)}await Nt();return}const ce=u(r)??((fi=W.dataTransfer)==null?void 0:fi.getData("text/plain"));if(k(r,null),!ce||ce===oe||oe.startsWith(ce+"/"))return;const tt=ce.split("/").pop(),Tt=oe?`${oe}/${tt}`:tt;if(Tt!==ce)try{await fD(ce,Tt);for(const xi of u(c))if(xi.path===ce)u(h)===ce&&k(h,Tt,!0),xi.path=Tt;else if(xi.path.startsWith(ce+"/")){const Pi=Tt+xi.path.slice(ce.length);u(h)===xi.path&&k(h,Pi),xi.path=Pi}await Nt(),await Vt("all",`rename ${ce} → ${Tt}`)}catch(xi){k(f,xi.message,!0)}}async function Ee(W,oe,we){if(W.isFile){const tt=await(await new Promise((Wt,Fi)=>W.file(Wt,Fi))).text(),Tt=oe?`${oe}/${W.name}`:W.name;await Hc(Tt,tt),we&&W.name.endsWith(".js")&&await j(Tt,!0)}else if(W.isDirectory){const ce=W.createReader();let tt=[],Tt;do Tt=await new Promise((Wt,Fi)=>ce.readEntries(Wt,Fi)),tt=[...tt,...Tt];while(Tt.length>0);for(const Wt of tt)await Ee(Wt,oe?`${oe}/${W.name}`:W.name,!1);if(we){const Wt=oe?`${oe}/${W.name}`:W.name;await j(Wt,!0)}}}async function Pe(){if(!u(h)||!await hn.show(`Delete ${u(h)}?`,{confirm:"Delete",danger:!0}))return;const W=u(h);await De(W),await n_(W),await Nt(),await Vt("all",`delete ${W}`)}function Be(){u(rn)&&(u(rn).logEntries=[])}function Me(){k(v,!u(v)),localStorage.setItem(Z,String(u(v)))}function re(W){return new Date(W).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Je(W){var ce;const oe=((ce=W.split(".").pop())==null?void 0:ce.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 Oe=null;async function xe(){const W=u(c).find(we=>we.path===u(h));if(!(W!=null&&W.model))return;const oe=W.model;try{const Tt=(await(await(await Vc.typescript.getJavaScriptWorker())(oe.uri)).getSyntacticDiagnostics(oe.uri.toString())).map(Wt=>{const Fi=oe.getPositionAt(Wt.start??0),fi=oe.getPositionAt((Wt.start??0)+(Wt.length??0));return{severity:BF.Error,startLineNumber:Fi.lineNumber,startColumn:Fi.column,endLineNumber:fi.lineNumber,endColumn:fi.column,message:typeof Wt.messageText=="string"?Wt.messageText:JSON.stringify(Wt.messageText),source:"she-syntax"}});if(tr.setModelMarkers(oe,"she-syntax",Tt),u(h)){if(Tt.length>0)yt.add(u(h)),u(Ot).has(u(h))||k(Ot,new Set([...u(Ot),u(h)]),!0);else if(yt.has(u(h))){yt.delete(u(h));const Wt=new Set(u(Ot));Wt.delete(u(h)),k(Ot,Wt,!0)}}}catch{}}function St(W){Cn=!0,pn=W.clientX,on=u(Nn),W.preventDefault()}function Te(W){qe=!0,Ft=W.clientY,li=u(Rn),W.preventDefault()}function H(W){Ci=!0,Ii=W.clientX,mn=u($n),W.preventDefault()}function J(W){Cn&&k(Nn,Math.max(140,Math.min(500,on+W.clientX-pn)),!0),qe&&k(Rn,Math.max(60,Math.min(500,li-(W.clientY-Ft))),!0),Ci&&k($n,Math.max(200,Math.min(700,mn-(W.clientX-Ii))),!0)}function ke(){Cn&&(Cn=!1,localStorage.setItem("she-scripts-sidebar-width",String(u(Nn)))),qe&&(qe=!1,localStorage.setItem("she-scripts-log-height",String(u(Rn)))),Ci&&(Ci=!1,localStorage.setItem("she-scripts-chat-width",String(u($n))))}function Ke(W){(W.ctrlKey||W.metaKey)&&W.key==="s"&&(W.preventDefault(),ft()),W.key==="Escape"&&(k(p,!1),k(s,null))}async function nt(W,oe){const we=await An.show("Save new script as:",{placeholder:"myscript.js",initial:W,confirm:"Create"});if(we)try{await Hc(we,oe),await Nt(),await pe(we,!0)}catch(ce){k(f,ce.message,!0)}}async function at(W){var we,ce;if(u(Mn)&&u(h)){k(Ei,W,!0),await ut();return}if(k(Ei,W,!0),await __(),!u(Sn))return;Hi==null||Hi.dispose(),dn==null||dn.dispose(),Xi==null||Xi.dispose();const oe=((ce=(we=u(rn))==null?void 0:we.model)==null?void 0:ce.getValue())??"";Hi=tr.createModel(oe,"javascript"),dn=tr.createModel(W,"javascript"),Xi=tr.createDiffEditor(u(Sn),{theme:"vs-dark",readOnly:!0,renderSideBySide:!0,automaticLayout:!0,minimap:{enabled:!1},fontSize:13,scrollBeyondLastLine:!1}),Xi.setModel({original:Hi,modified:dn})}zn(()=>{u(h),k(Mn,!1),k(sn,!1)});async function ut(){if(u(Ei)===null||!u(h))return;const W=u(Ei);k(Ei,null);const oe=u(c).find(we=>we.path===u(h));oe!=null&&oe.model&&(vi=!0,oe.model.setValue(W),vi=!1,oe.dirty=!1,oe.savedContent=W);try{await Hc(u(h),W),k(f,""),u(w)?await Vt([u(h)],`update ${u(h)}`):Xe()}catch(we){k(f,we.message,!0)}Et()}function ye(){k(Ei,null),Et()}function Et(){Xi==null||Xi.dispose(),Xi=null,Hi==null||Hi.dispose(),Hi=null,dn==null||dn.dispose(),dn=null}var dt=mG();os("keydown",ad,Ke),os("mousemove",ad,J),os("mouseup",ad,ke);var he=bt(dt);bs(Hg(he,{}),W=>hn=W,()=>hn);var Ct=x(he,2);bs(D7(Ct,{}),W=>An=W,()=>An);var Ze=x(Ct,2);{var Ie=W=>{var oe=PK(),we=bt(oe),ce=x(we,2);let tt;var Tt=C(ce);{var Wt=fi=>{var xi=IK(),Pi=bt(xi),di=x(Pi,2),un=x(di,4),qi=x(un,2);te("click",Pi,()=>ei(u(s).entry.path)),te("click",di,()=>Ut(u(s).entry.path)),te("click",un,()=>Rt(u(s).entry)),te("click",qi,()=>an(u(s).entry)),T(fi,xi)},Fi=fi=>{var xi=EK(),Pi=bt(xi),di=x(Pi,2),un=x(di,2),qi=x(un,2);{var Zn=kn=>{var Ms=DK();te("click",Ms,()=>Kt(u(s).entry)),T(kn,Ms)};$(qi,kn=>{u(_)&&kn(Zn)})}var vs=x(qi,4);te("click",Pi,()=>Ue(u(s).entry.path)),te("click",di,()=>Rt(u(s).entry)),te("click",un,()=>Wi(u(s).entry)),te("click",vs,()=>an(u(s).entry)),T(fi,xi)};$(Tt,fi=>{u(s).entry.type==="dir"?fi(Wt):fi(Fi,-1)})}G(()=>tt=Ko(ce,"",tt,{left:`${u(s).x??""}px`,top:`${u(s).y??""}px`})),te("click",we,pt),te("contextmenu",we,fi=>{fi.preventDefault(),pt()}),T(W,oe)};$(Ze,W=>{u(s)&&W(Ie)})}var le=x(Ze,2);{var _e=W=>{var oe=TK();let we;G(()=>we=Ko(oe,"",we,{left:`${u(At).x??""}px`,top:`${u(At).y-4}px`})),T(W,oe)};$(le,W=>{u(At)&&W(_e)})}var Qe=x(le,2),Bt=C(Qe);let fe;{const W=(we,ce=py,tt)=>{let Tt=t1(()=>KF(tt==null?void 0:tt(),!1));var Wt=Fs(),Fi=bt(Wt);{var fi=Pi=>{var di=NK(),un=C(di);let qi;var Zn=C(un);let vs;var kn=x(Zn,2);let Ms;var Yo=C(kn),cs=x(kn,2);{var oo=Kn=>{var Ir=HD();T(Kn,Ir)},Jo=rt(()=>u(qn).has(ce().path));$(cs,Kn=>{u(Jo)&&Kn(oo)})}var ro=x(cs,2),ao=C(ro),gs=x(ro,2),xl=C(gs),Ho=x(un,2);{var jg=Kn=>{var Ir=MK();_i(Ir,21,()=>ce().children,Ll=>Ll.path,(Ll,Nc)=>{W(Ll,()=>u(Nc),()=>ce().disabled||u(Tt))}),T(Kn,Ir)};$(Ho,Kn=>{u(i)[ce().path]&&ce().children&&Kn(jg)})}G(()=>{qi=$t(un,1,"dir-row svelte-1pyfjii",null,qi,{"dir-selected":u(n)===ce().path,"drag-target":u(a)===ce().path}),Hn(un,"aria-selected",u(n)===ce().path),vs=$t(Zn,1,"chevron svelte-1pyfjii",null,vs,{open:u(i)[ce().path]}),Ms=$t(kn,1,"dir-name svelte-1pyfjii",null,Ms,{lib:ce().lib}),q(Yo,ce().name),cw(ao,ce().lib),cw(xl,ce().disabled)}),os("dragstart",un,Kn=>ti(Kn,ce().path)),os("dragover",un,Kn=>ji(Kn,ce().path)),os("dragleave",un,A),os("drop",un,Kn=>K(Kn,ce().path)),te("contextmenu",un,Kn=>Ye(Kn,ce())),te("click",Zn,()=>O(ce().path)),te("click",kn,()=>{k(n,ce().path,!0),u(i)[ce().path]=!0}),te("keydown",kn,Kn=>Kn.key==="Enter"&&k(n,ce().path,!0)),os("mouseenter",ro,ni),os("mouseleave",ro,Xt),te("change",ao,()=>be(ce().path,!ce().lib)),te("change",xl,()=>j(ce().path,!ce().disabled)),T(Pi,di)},xi=Pi=>{const di=rt(()=>u(Ot).has(ce().path)),un=rt(()=>u(qn).has(ce().path)),qi=rt(()=>u(c).some(ln=>ln.path===ce().path&&ln.dirty)),Zn=rt(()=>(ce().name.split(".").pop()??"txt").toUpperCase()),vs=rt(()=>ce().name.endsWith(".js"));var kn=HK();let Ms;var Yo=C(kn),cs=C(Yo);let oo;var Jo=C(cs);let ro;var ao=C(Jo),gs=x(Jo,2),xl=C(gs),Ho=x(gs,2);{var jg=ln=>{var Ls=HD();T(ln,Ls)};$(Ho,ln=>{u(un)&&ln(jg)})}var Kn=x(Ho);{var Ir=ln=>{var Ls=RK();T(ln,Ls)};$(Kn,ln=>{u(qi)&&ln(Ir)})}var Ll=x(Kn,2);{var Nc=ln=>{var Ls=AK();T(ln,Ls)};$(Ll,ln=>{u(di)&&ln(Nc)})}var Rh=x(cs,2);{var Ug=ln=>{var Ls=OK();let kl;var Oh=C(Ls);G(()=>{kl=$t(Ls,1,"dis-label svelte-1pyfjii",null,kl,{"dis-locked":u(Tt)}),Hn(Ls,"title",u(Tt)?"Disabled by parent directory":"Disable — this script will not be executed"),cw(Oh,ce().disabled),Oh.disabled=u(Tt)}),te("change",Oh,()=>j(ce().path,!ce().disabled)),T(ln,Ls)},Ah=ln=>{var Ls=FK();T(ln,Ls)};$(Rh,ln=>{u(vs)?ln(Ug):ln(Ah,-1)})}G((ln,Ls,kl)=>{Ms=$t(kn,1,"tree-file svelte-1pyfjii",null,Ms,ln),oo=$t(cs,1,"svelte-1pyfjii",null,oo,{lib:ce().lib,dis:ce().disabled,err:u(di)}),ro=$t(Jo,1,`badge badge-${Ls??""}`,"svelte-1pyfjii",ro,{"badge-shelib":ce().lib}),q(ao,kl),q(xl,ce().name)},[()=>({active:u(c).some(ln=>ln.path===ce().path),"active-tab":ce().path===u(h)}),()=>u(Zn).toLowerCase(),()=>se(u(Zn))]),os("dragstart",kn,ln=>ti(ln,ce().path)),te("contextmenu",kn,ln=>Ye(ln,ce())),te("click",cs,()=>Ue(ce().path)),T(Pi,kn)};$(Fi,Pi=>{ce().type==="dir"?Pi(fi):Pi(xi,-1)})}T(we,Wt)};var $e=C(Bt),gt=C($e),Pt=x(gt,2),et=x(Pt,2),ci=x($e,2);{var Jt=we=>{var ce=WK(),tt=C(ce);G(()=>q(tt,u(f))),T(we,ce)};$(ci,we=>{u(f)&&we(Jt)})}var Gn=x(ci,2),$i=C(Gn);let oe;var oi=x($i,2);_i(oi,17,()=>u(t),we=>we.path,(we,ce)=>{W(we,()=>u(ce))});var Gt=x(Gn,2);{var _n=we=>{var ce=UK(),tt=C(ce),Tt=C(tt),Wt=C(Tt),Fi=x(Tt,2),fi=x(tt,2),xi=C(fi);{var Pi=qi=>{var Zn=BK();T(qi,Zn)},di=qi=>{var Zn=zK();T(qi,Zn)},un=qi=>{var Zn=jK(),vs=bt(Zn);_i(vs,17,()=>u(P),Yo=>Yo.hash,(Yo,cs)=>{var oo=VK(),Jo=C(oo),ro=C(Jo),ao=x(Jo,2),gs=C(ao);G((xl,Ho)=>{q(ro,u(cs).subject),q(gs,`${xl??""} · ${Ho??""}`)},[()=>u(cs).hash.slice(0,7),()=>ii(u(cs).date)]),te("click",oo,()=>ge(u(cs))),T(Yo,oo)});var kn=x(vs,2),Ms=C(kn);G(()=>{kn.disabled=u(N),q(Ms,u(N)?"Loading…":"Load more")}),te("click",kn,ui),T(qi,Zn)};$(xi,qi=>{u(N)&&u(P).length===0?qi(Pi):u(P).length===0?qi(di,1):qi(un,-1)})}G(()=>{Hn(Tt,"title",u(D).path),q(Wt,`History: ${u(D).name??""}`)}),te("click",Fi,Q),T(we,ce)};$(Gt,we=>{u(D)&&we(_n)})}G(()=>oe=$t($i,1,"tree-root-drop svelte-1pyfjii",null,oe,{"drag-target":u(a)===""})),te("click",gt,it),te("click",Pt,xt),te("click",et,Nt),os("dragover",$i,we=>ji(we,"")),os("dragleave",$i,A),os("drop",$i,we=>K(we,""))}var ri=x(Bt,2),On=x(ri,2),Yi=C(On);{var Ps=W=>{var oe=KK();_i(oe,21,()=>u(c),we=>we.path,(we,ce)=>{var tt=qK();let Tt;var Wt=C(tt),Fi=C(Wt),fi=x(Wt,2);{var xi=di=>{var un=$K();T(di,un)};$(fi,di=>{u(ce).dirty&&di(xi)})}var Pi=x(fi,2);G(di=>{Tt=$t(tt,1,"tab svelte-1pyfjii",null,Tt,{active:u(ce).path===u(h)}),q(Fi,di)},[()=>u(ce).path.split("/").pop()]),te("click",tt,()=>Ce(u(ce).path)),te("keydown",tt,di=>di.key==="Enter"&&Ce(u(ce).path)),te("click",Pi,di=>{di.stopPropagation(),De(u(ce).path)}),T(we,tt)}),T(W,oe)};$(Yi,W=>{u(c).length>0&&W(Ps)})}var Oo=x(Yi,2),Lr=C(Oo),Aa=C(Lr),kr=x(Lr,2);{var Qr=W=>{var oe=YK(),we=C(oe),ce=C(we),tt=x(we,2);{var Tt=Pi=>{var di=GK(),un=C(di);G(()=>{Hn(di,"title",`${u(_).changes.length??""} uncommitted change(s)`),q(un,`✎${u(_).changes.length??""}`)}),T(Pi,di)};$(tt,Pi=>{u(_).changes.length>0&&Pi(Tt)})}var Wt=x(tt,2);{var Fi=Pi=>{var di=ZK(),un=C(di);G(()=>{Hn(di,"title",`${u(_).ahead??""} commit(s) ahead of upstream`),q(un,`↑${u(_).ahead??""}`)}),T(Pi,di)};$(Wt,Pi=>{u(_).ahead>0&&Pi(Fi)})}var fi=x(Wt,2);{var xi=Pi=>{var di=XK(),un=C(di);G(()=>{Hn(di,"title",`${u(_).behind??""} commit(s) behind upstream`),q(un,`↓${u(_).behind??""}`)}),T(Pi,di)};$(fi,Pi=>{u(_).behind>0&&Pi(xi)})}G(()=>{Hn(we,"title",`Branch: ${u(_).branch??""}`),q(ce,`⎇ ${u(_).branch??""}`)}),T(W,oe)};$(kr,W=>{u(_)&&W(Qr)})}var Cl=x(kr,2),Oa=C(Cl),Ai=C(Oa),Xs=C(Ai),es=x(Ai,2),Ts=x(Oa,2);{var Ph=W=>{var oe=JK(),we=bt(oe),ce=x(we,2),tt=C(ce),Tt=x(tt,2),Wt=x(Tt,2);G(()=>Wt.disabled=!u(_)),te("click",we,()=>k(p,!1)),te("click",tt,()=>{k(p,!1),ft()}),te("click",Tt,()=>{k(p,!1),ue()}),te("click",Wt,ht),T(W,oe)};$(Ts,W=>{u(p)&&W(Ph)})}var Th=x(Cl,2);{var Ec=W=>{var oe=QK();te("click",oe,Pe),T(W,oe)};$(Th,W=>{u(h)&&W(Ec)})}var Xo=x(Th,2);let ea;var $y=x(Oo,2),pm=C($y),Mh=C(pm),mm=C(Mh);bs(mm,W=>zt=W,()=>zt);var Fo=x(mm,2);{var qy=W=>{var oe=eG();T(W,oe)};$(Fo,W=>{u(h)||W(qy)})}var Bg=x(Fo,2);{var ta=W=>{var oe=sG(),we=C(oe),ce=C(we),tt=x(C(ce)),Tt=C(tt),Wt=x(ce,2),Fi=C(Wt),fi=C(Fi),xi=C(fi),Pi=C(xi),di=x(xi,2),un=x(fi,2);{var qi=kn=>{var Ms=nG(),Yo=bt(Ms),cs=x(Yo,2),oo=C(cs);{var Jo=ao=>{var gs=tG();te("click",gs,()=>{k(sn,!1),k(Mn,!0),ut()}),T(ao,gs)},ro=ao=>{var gs=iG();te("click",gs,()=>{k(sn,!1),k(Mn,!1)}),T(ao,gs)};$(oo,ao=>{u(Mn)?ao(ro,-1):ao(Jo)})}te("click",Yo,()=>k(sn,!1)),T(kn,Ms)};$(un,kn=>{u(sn)&&kn(qi)})}var Zn=x(Fi,2),vs=x(we,2);bs(vs,kn=>k(Sn,kn),()=>u(Sn)),G(kn=>{q(Tt,kn),q(Pi,u(Mn)?"Auto-accept ✓":"Accept")},[()=>{var kn;return(kn=u(h))==null?void 0:kn.split("/").pop()}]),te("click",xi,ut),te("click",di,()=>k(sn,!u(sn))),te("click",Zn,ye),T(W,oe)};$(Bg,W=>{u(Ei)!==null&&W(ta)})}var _m=x(Bg,2);{var vm=W=>{var oe=aG(),we=C(oe),ce=C(we),tt=x(C(ce)),Tt=C(tt),Wt=x(tt,2),Fi=C(Wt),fi=x(ce,2),xi=C(fi),Pi=x(we,2);{var di=qi=>{var Zn=oG();T(qi,Zn)},un=qi=>{var Zn=rG();bs(Zn,vs=>k(F,vs),()=>u(F)),T(qi,Zn)};$(Pi,qi=>{u(ve)?qi(di):qi(un,-1)})}G(qi=>{var Zn;q(Tt,qi),q(Fi,(Zn=u(D))==null?void 0:Zn.name)},[()=>u(je).slice(0,7)]),te("click",xi,We),T(W,oe)};$(_m,W=>{u(Le)&&W(vm)})}var Pc=x(Mh,2);let bm,zg;var Vg=C(Pc);{var Ky=W=>{var oe=lG();te("mousedown",oe,Te),T(W,oe)};$(Vg,W=>{u(v)&&W(Ky)})}var ym=x(Vg,2),Tc=C(ym),wm=C(Tc),Sm=x(wm);{var Cm=W=>{var oe=cG(),we=C(oe);G(ce=>q(we,`— ${ce??""}`),[()=>u(h).split("/").pop()]),T(W,oe)};$(Sm,W=>{u(h)&&W(Cm)})}var Nh=x(Tc,2);{var Fa=W=>{var oe=hG(),we=bt(oe);_i(we,21,()=>Ge,Vn,(Fi,fi)=>{var xi=dG(),Pi=C(xi),di={};G(()=>{q(Pi,u(fi)),di!==(di=u(fi))&&(xi.value=(xi.__value=u(fi))??"")}),T(Fi,xi)});var ce=x(we,2),tt=x(ce,2),Tt=C(tt),Wt=x(tt,2);_a(we,()=>u(jt),Fi=>k(jt,Fi)),Ni(ce,()=>u(Qt),Fi=>k(Qt,Fi)),As(Tt,()=>u(Ne),Fi=>k(Ne,Fi)),te("click",Wt,Be),T(W,oe)};$(Nh,W=>{u(v)&&W(Fa)})}var Gy=x(ym,2);{var Mc=W=>{var oe=fG(),we=C(oe);_i(we,17,()=>{var Tt;return(((Tt=u(rn))==null?void 0:Tt.logEntries)??[]).filter(ot)},Tt=>Tt.ts+Tt.msg,(Tt,Wt)=>{var Fi=uG(),fi=C(Fi),xi=C(fi),Pi=x(fi,2),di=C(Pi),un=x(Pi,2),qi=C(un);G((Zn,vs)=>{$t(Fi,1,`log-line ${u(Wt).level??""}`,"svelte-1pyfjii"),q(xi,Zn),q(di,vs),q(qi,u(Wt).msg)},[()=>re(u(Wt).ts),()=>u(Wt).level.toUpperCase()]),T(Tt,Fi)});var ce=x(we,2);{var tt=Tt=>{var Wt=gG();T(Tt,Wt)};$(ce,Tt=>{var Wt;(((Wt=u(rn))==null?void 0:Wt.logEntries.length)??0)===0&&Tt(tt)})}bs(oe,Tt=>k(st,Tt),()=>u(st)),T(W,oe)};$(Gy,W=>{u(v)&&W(Mc)})}var yo=x(pm,2);{var xm=W=>{var oe=pG(),we=bt(oe),ce=x(we,2);let tt;var Tt=C(ce);gK(Tt,{get currentScript(){return u(xn)},onApply:at,onCreateFile:nt,get extraFiles(){return u(ai)},set extraFiles(Wt){k(ai,Wt,!0)}}),G(()=>tt=Ko(ce,"",tt,{width:`${u($n)??""}px`})),te("mousedown",we,H),T(W,oe)};$(yo,W=>{u(nn)&&W(xm)})}G(()=>{var W;fe=Ko(Bt,"",fe,{width:`${u(Nn)??""}px`}),q(Aa,u(h)??"No file selected"),Ai.disabled=!((W=u(rn))!=null&&W.dirty)||u(g),q(Xs,u(g)?"Saving…":"Save"),es.disabled=!u(h),ea=$t(Xo,1,"ai-toggle svelte-1pyfjii",null,ea,{"ai-open":u(nn)}),Hn(Xo,"title",u(nn)?"Close AI assistant":"Open AI assistant"),bm=$t(Pc,1,"log-panel svelte-1pyfjii",null,bm,{collapsed:!u(v)}),zg=Ko(Pc,"",zg,{height:u(v)?`${u(Rn)}px`:"26px"}),q(wm,`${u(v)?"▾":"▸"} Script Log `)}),te("mousedown",ri,St),te("click",Ai,ft),te("click",es,()=>k(p,!u(p))),te("click",Xo,()=>k(nn,!u(nn))),te("click",Tc,Me),T(o,dt),Ao()}Cr(["click","contextmenu","keydown","change","mousedown"]);const HR="she-theme";function vG(){return localStorage.getItem(HR)??"dark"}function bG(o){localStorage.setItem(HR,o);const e=document.documentElement;o==="system"?e.removeAttribute("data-theme"):e.setAttribute("data-theme",o)}var Cf={exports:{}};/* @preserve
|
|
215
215
|
* Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com
|
|
216
216
|
* (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade
|
|
217
|
-
*/var yG=Cf.exports,WD;function wG(){return WD||(WD=1,(function(o,e){(function(t,i){i(e)})(yG,(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,E,U;return U=function(){b=!1,I&&(E.apply(m,I),I=!1)},E=function(){b?I=arguments:(l.apply(m,arguments),setTimeout(U,d),b=!0)},E}function g(l,d,m){var b=d[1],I=d[0],E=b-I;return l===b&&m?l:((l-I)%E+E)%E+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 P(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 N=Array.isArray||function(l){return Object.prototype.toString.call(l)==="[object Array]"};function V(l,d){for(var m=0;m<l.length;m++)if(l[m]===d)return m;return-1}var F="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function Y(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||Y("RequestAnimationFrame")||me,je=window.cancelAnimationFrame||Y("CancelAnimationFrame")||Y("CancelRequestAnimationFrame")||function(l){window.clearTimeout(l)};function ve(l,d,m){if(m&&Le===me)l.call(d);else return Le.call(window,r(l,d))}function st(l){l&&je.call(window,l)}var Ot={__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:P,isArray:N,indexOf:V,emptyImageUrl:F,requestFn:Le,cancelFn:je,requestAnimFrame:ve,cancelAnimFrame:st};function yt(){}yt.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&&(ai(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 E=0,U=b._initHooks.length;E<U;E++)b._initHooks[E].call(this)}},d},yt.include=function(l){var d=this.prototype.options;return n(this.prototype,l),l.options&&(this.prototype.options=d,this.mergeOptions(l.options)),this},yt.mergeOptions=function(l){return n(this.prototype.options,l),this},yt.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 ai(l){if(!(typeof L>"u"||!L||!L.Mixin)){l=N(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 jt={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,E=l.length;I<E;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,E=0,U=l.length;E<U;E++)I?this._off(l[E]):this._off(l[E],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,E;if(this._events&&(b=this._events[l],!!b)){if(arguments.length===1){if(this._firingCount)for(I=0,E=b.length;I<E;I++)b[I].fn=f;delete this._events[l];return}if(typeof d!="function"){console.warn("wrong listener type: "+typeof d);return}var U=this._listens(l,d,m);if(U!==!1){var ie=b[U];this._firingCount&&(ie.fn=f,this._events[l]=b=b.slice()),b.splice(U,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 E=0,U=I.length;E<U;E++){var ie=I[E],de=ie.fn;ie.once&&this.off(l,de,ie.ctx),de.call(ie.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 E=this._events&&this._events[l];if(E&&E.length&&this._listens(l,I,m)!==!1)return!0;if(b){for(var U in this._eventParents)if(this._eventParents[U].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,E=b.length;I<E;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,E=l.length;I<E;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)}};jt.addEventListener=jt.on,jt.removeEventListener=jt.clearAllEventListeners=jt.off,jt.addOneTimeEventListener=jt.once,jt.fireEvent=jt.fire,jt.hasEventListeners=jt.listens;var Qt=yt.extend(jt);function Ne(l,d,m){this.x=m?Math.round(l):l,this.y=m?Math.round(d):d}var Ge=Math.trunc||function(l){return l>0?Math.floor(l):Math.ceil(l)};Ne.prototype={clone:function(){return new Ne(this.x,this.y)},add:function(l){return this.clone()._add(Re(l))},_add:function(l){return this.x+=l.x,this.y+=l.y,this},subtract:function(l){return this.clone()._subtract(Re(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 Ne(this.x*l.x,this.y*l.y)},unscaleBy:function(l){return new Ne(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=Ge(this.x),this.y=Ge(this.y),this},distanceTo:function(l){l=Re(l);var d=l.x-this.x,m=l.y-this.y;return Math.sqrt(d*d+m*m)},equals:function(l){return l=Re(l),l.x===this.x&&l.y===this.y},contains:function(l){return l=Re(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 Re(l,d,m){return l instanceof Ne?l:N(l)?new Ne(l[0],l[1]):l==null?l:typeof l=="object"&&"x"in l&&"y"in l?new Ne(l.x,l.y):new Ne(l,d,m)}function ot(l,d){if(l)for(var m=d?[l,d]:l,b=0,I=m.length;b<I;b++)this.extend(m[b])}ot.prototype={extend:function(l){var d,m;if(!l)return this;if(l instanceof Ne||typeof l[0]=="number"||"x"in l)d=m=Re(l);else if(l=At(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 Re((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,l)},getBottomLeft:function(){return Re(this.min.x,this.max.y)},getTopRight:function(){return Re(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 Ne?l=Re(l):l=At(l),l instanceof ot?(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=At(l);var d=this.min,m=this.max,b=l.min,I=l.max,E=I.x>=d.x&&b.x<=m.x,U=I.y>=d.y&&b.y<=m.y;return E&&U},overlaps:function(l){l=At(l);var d=this.min,m=this.max,b=l.min,I=l.max,E=I.x>d.x&&b.x<m.x,U=I.y>d.y&&b.y<m.y;return E&&U},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 At(Re(d.x-b,d.y-I),Re(m.x+b,m.y+I))},equals:function(l){return l?(l=At(l),this.min.equals(l.getTopLeft())&&this.max.equals(l.getBottomRight())):!1}};function At(l,d){return!l||l instanceof ot?l:new ot(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 zt)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(vt(l)||Xt(l)):this;return!d&&!m?(this._southWest=new zt(b.lat,b.lng),this._northEast=new zt(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 zt(d.lat-b,d.lng-I),new zt(m.lat+b,m.lng+I))},getCenter:function(){return new zt((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 zt(this.getNorth(),this.getWest())},getSouthEast:function(){return new zt(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 zt||"lat"in l?l=vt(l):l=Xt(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=Xt(l);var d=this._southWest,m=this._northEast,b=l.getSouthWest(),I=l.getNorthEast(),E=I.lat>=d.lat&&b.lat<=m.lat,U=I.lng>=d.lng&&b.lng<=m.lng;return E&&U},overlaps:function(l){l=Xt(l);var d=this._southWest,m=this._northEast,b=l.getSouthWest(),I=l.getNorthEast(),E=I.lat>d.lat&&b.lat<m.lat,U=I.lng>d.lng&&b.lng<m.lng;return E&&U},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(l,d){return l?(l=Xt(l),this._southWest.equals(l.getSouthWest(),d)&&this._northEast.equals(l.getNorthEast(),d)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function Xt(l,d){return l instanceof ni?l:new ni(l,d)}function zt(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)}zt.prototype={equals:function(l,d){if(!l)return!1;l=vt(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 vi.distance(this,vt(l))},wrap:function(){return vi.wrapLatLng(this)},toBounds:function(l){var d=180*l/40075017,m=d/Math.cos(Math.PI/180*this.lat);return Xt([this.lat-d,this.lng-m],[this.lat+d,this.lng+m])},clone:function(){return new zt(this.lat,this.lng,this.alt)}};function vt(l,d,m){return l instanceof zt?l:N(l)&&typeof l[0]!="object"?l.length===3?new zt(l[0],l[1],l[2]):l.length===2?new zt(l[0],l[1]):null:l==null?l:typeof l=="object"&&"lat"in l?new zt(l.lat,"lng"in l?l.lng:l.lon,l.alt):d===void 0?null:new zt(l,d,m)}var Li={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 ot(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 zt(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 E=l.getSouthWest(),U=l.getNorthEast(),ie=new zt(E.lat-b,E.lng-I),de=new zt(U.lat-b,U.lng-I);return new ni(ie,de)}},vi=n({},Li,{wrapLng:[-180,180],R:6371e3,distance:function(l,d){var m=Math.PI/180,b=l.lat*m,I=d.lat*m,E=Math.sin((d.lat-l.lat)*m/2),U=Math.sin((d.lng-l.lng)*m/2),ie=E*E+Math.cos(b)*Math.cos(I)*U*U,de=2*Math.atan2(Math.sqrt(ie),Math.sqrt(1-ie));return this.R*de}}),Tn=6378137,Gi={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 Ne(this.R*l.lng*d,this.R*Math.log((1+I)/(1-I))/2)},unproject:function(l){var d=180/Math.PI;return new zt((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 ot([-l,-l],[l,l])})()};function Bn(l,d,m,b){if(N(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}Bn.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 Ne((l.x/d-this._b)/this._a,(l.y/d-this._d)/this._c)}};function nn(l,d,m,b){return new Bn(l,d,m,b)}var Ei=n({},vi,{code:"EPSG:3857",projection:Gi,transformation:(function(){var l=.5/(Math.PI*Gi.R);return nn(l,.5,-l,.5)})()}),Mn=n({},Ei,{code:"EPSG:900913"});function sn(l){return document.createElementNS("http://www.w3.org/2000/svg",l)}function Sn(l,d){var m="",b,I,E,U,ie,de;for(b=0,E=l.length;b<E;b++){for(ie=l[b],I=0,U=ie.length;I<U;I++)de=ie[I],m+=(I?"L":"M")+de.x+" "+de.y;m+=d?ue.svg?"z":"x":""}return m||"M0 0"}var Xi=document.documentElement.style,Hi="ActiveXObject"in window,dn=Hi&&!document.addEventListener,Nn="msLaunchUri"in navigator&&!("documentMode"in document),Rn=ft("webkit"),$n=ft("android"),Cn=ft("android 2")||ft("android 3"),pn=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),on=$n&&ft("Google")&&pn<537&&!("AudioNode"in window),qe=!!window.opera,Ft=!Nn&&ft("chrome"),li=ft("gecko")&&!Rn&&!qe&&!Hi,Ci=!Ft&&ft("safari"),Ii=ft("phantom"),mn="OTransition"in Xi,xn=navigator.platform.indexOf("Win")===0,qn=Hi&&"transition"in Xi,hn="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!Cn,An="MozPerspective"in Xi,rn=!window.L_DISABLE_3D&&(qn||hn||An)&&!mn&&!Ii,Ln=typeof orientation<"u"||ft("mobile"),Ae=Ln&&Rn,Z=Ln&&hn,Fe=!window.PointerEvent&&window.MSPointerEvent,wt=!!(window.PointerEvent||Fe),Dt="ontouchstart"in window||!!window.TouchEvent,Nt=!window.L_NO_TOUCH&&(Dt||wt),O=Ln&&qe,se=Ln&&li,be=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,j=(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})(),pe=(function(){return!!document.createElement("canvas").getContext})(),Ue=!!(document.createElementNS&&sn("svg").createSVGRect),Ce=!!Ue&&(function(){var l=document.createElement("div");return l.innerHTML="<svg/>",(l.firstChild&&l.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),De=!Ue&&(function(){try{var l=document.createElement("div");l.innerHTML='<v:shape adj="1"/>';var d=l.firstChild;return d.style.behavior="url(#default#VML)",d&&typeof d.adj=="object"}catch{return!1}})(),Xe=navigator.platform.indexOf("Mac")===0,Vt=navigator.platform.indexOf("Linux")===0;function ft(l){return navigator.userAgent.toLowerCase().indexOf(l)>=0}var ue={ie:Hi,ielt9:dn,edge:Nn,webkit:Rn,android:$n,android23:Cn,androidStock:on,opera:qe,chrome:Ft,gecko:li,safari:Ci,phantom:Ii,opera12:mn,win:xn,ie3d:qn,webkit3d:hn,gecko3d:An,any3d:rn,mobile:Ln,mobileWebkit:Ae,mobileWebkit3d:Z,msPointer:Fe,pointer:wt,touch:Nt,touchNative:Dt,mobileOpera:O,mobileGecko:se,retina:be,passiveEvents:j,canvas:pe,svg:Ue,vml:De,inlineSvg:Ce,mac:Xe,linux:Vt},ht=ue.msPointer?"MSPointerDown":"pointerdown",ii=ue.msPointer?"MSPointerMove":"pointermove",Kt=ue.msPointer?"MSPointerUp":"pointerup",si=ue.msPointer?"MSPointerCancel":"pointercancel",ui={touchstart:ht,touchmove:ii,touchend:Kt,touchcancel:si},Q={touchstart:Oi,touchmove:Rt,touchend:Rt,touchcancel:Rt},ge={},We=!1;function it(l,d,m){return d==="touchstart"&&Ut(),Q[d]?(m=Q[d].bind(this,m),l.addEventListener(ui[d],m,!1),m):(console.warn("wrong event specified:",d),f)}function xt(l,d,m){if(!ui[d]){console.warn("wrong event specified:",d);return}l.removeEventListener(ui[d],m,!1)}function Ye(l){ge[l.pointerId]=l}function pt(l){ge[l.pointerId]&&(ge[l.pointerId]=l)}function ei(l){delete ge[l.pointerId]}function Ut(){We||(document.addEventListener(ht,Ye,!0),document.addEventListener(ii,pt,!0),document.addEventListener(Kt,ei,!0),document.addEventListener(si,ei,!0),We=!0)}function Rt(l,d){if(d.pointerType!==(d.MSPOINTER_TYPE_MOUSE||"mouse")){d.touches=[];for(var m in ge)d.touches.push(ge[m]);d.changedTouches=[d],l(d)}}function Oi(l,d){d.MSPOINTER_TYPE_TOUCH&&d.pointerType===d.MSPOINTER_TYPE_TOUCH&&Yi(d),Rt(l,d)}function an(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 Wi=200;function ti(l,d){l.addEventListener("dblclick",d);var m=0,b;function I(E){if(E.detail!==1){b=E.detail;return}if(!(E.pointerType==="mouse"||E.sourceCapabilities&&!E.sourceCapabilities.firesTouchEvents)){var U=Oo(E);if(!(U.some(function(de){return de instanceof HTMLLabelElement&&de.attributes.for})&&!U.some(function(de){return de instanceof HTMLInputElement||de instanceof HTMLSelectElement}))){var ie=Date.now();ie-m<=Wi?(b++,b===2&&d(an(E))):b=1,m=ie}}}return l.addEventListener("click",I),{dblclick:d,simDblclick:I}}function ji(l,d){l.removeEventListener("dblclick",d.dblclick),l.removeEventListener("click",d.simDblclick)}var A=at(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),K=at(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Ee=K==="webkitTransition"||K==="OTransition"?K+"End":"transitionend";function Pe(l){return typeof l=="string"?document.getElementById(l):l}function Be(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 re(l){var d=l.parentNode;d&&d.removeChild(l)}function Je(l){for(;l.firstChild;)l.removeChild(l.firstChild)}function Oe(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 St(l,d){if(l.classList!==void 0)return l.classList.contains(d);var m=ke(l);return m.length>0&&new RegExp("(^|\\s)"+d+"(\\s|$)").test(m)}function Te(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(!St(l,d)){var E=ke(l);J(l,(E?E+" ":"")+d)}}function H(l,d){l.classList!==void 0?l.classList.remove(d):J(l,v((" "+ke(l)+" ").replace(" "+d+" "," ")))}function J(l,d){l.className.baseVal===void 0?l.className=d:l.className.baseVal=d}function ke(l){return l.correspondingElement&&(l=l.correspondingElement),l.className.baseVal===void 0?l.className:l.className.baseVal}function Ke(l,d){"opacity"in l.style?l.style.opacity=d:"filter"in l.style&&nt(l,d)}function nt(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 at(l){for(var d=document.documentElement.style,m=0;m<l.length;m++)if(l[m]in d)return l[m];return!1}function ut(l,d,m){var b=d||new Ne(0,0);l.style[A]=(ue.ie3d?"translate("+b.x+"px,"+b.y+"px)":"translate3d("+b.x+"px,"+b.y+"px,0)")+(m?" scale("+m+")":"")}function ye(l,d){l._leaflet_pos=d,ue.any3d?ut(l,d):(l.style.left=d.x+"px",l.style.top=d.y+"px")}function Et(l){return l._leaflet_pos||new Ne(0,0)}var dt,he,Ct;if("onselectstart"in document)dt=function(){et(window,"selectstart",Yi)},he=function(){Jt(window,"selectstart",Yi)};else{var Ze=at(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);dt=function(){if(Ze){var l=document.documentElement.style;Ct=l[Ze],l[Ze]="none"}},he=function(){Ze&&(document.documentElement.style[Ze]=Ct,Ct=void 0)}}function Ie(){et(window,"dragstart",Yi)}function le(){Jt(window,"dragstart",Yi)}var _e,Qe;function Bt(l){for(;l.tabIndex===-1;)l=l.parentNode;l.style&&(fe(),_e=l,Qe=l.style.outlineStyle,l.style.outlineStyle="none",et(window,"keydown",fe))}function fe(){_e&&(_e.style.outlineStyle=Qe,_e=void 0,Qe=void 0,Jt(window,"keydown",fe))}function $e(l){do l=l.parentNode;while((!l.offsetWidth||!l.offsetHeight)&&l!==document.body);return l}function gt(l){var d=l.getBoundingClientRect();return{x:d.width/l.offsetWidth||1,y:d.height/l.offsetHeight||1,boundingClientRect:d}}var Pt={__proto__:null,TRANSFORM:A,TRANSITION:K,TRANSITION_END:Ee,get:Pe,getStyle:Be,create:Me,remove:re,empty:Je,toFront:Oe,toBack:xe,hasClass:St,addClass:Te,removeClass:H,setClass:J,getClass:ke,setOpacity:Ke,testProp:at,setTransform:ut,setPosition:ye,getPosition:Et,get disableTextSelection(){return dt},get enableTextSelection(){return he},disableImageDrag:Ie,enableImageDrag:le,preventOutline:Bt,restoreOutline:fe,getSizedParentNode:$e,getScale:gt};function et(l,d,m,b){if(d&&typeof d=="object")for(var I in d)oi(l,I,d[I],m);else{d=_(d);for(var E=0,U=d.length;E<U;E++)oi(l,d[E],m,b)}return this}var ci="_leaflet_events";function Jt(l,d,m,b){if(arguments.length===1)Gn(l),delete l[ci];else if(d&&typeof d=="object")for(var I in d)Gt(l,I,d[I],m);else if(d=_(d),arguments.length===2)Gn(l,function(ie){return V(d,ie)!==-1});else for(var E=0,U=d.length;E<U;E++)Gt(l,d[E],m,b);return this}function Gn(l,d){for(var m in l[ci]){var b=m.split(/\d/)[0];(!d||d(b))&&Gt(l,b,null,null,m)}}var $i={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function oi(l,d,m,b){var I=d+c(m)+(b?"_"+c(b):"");if(l[ci]&&l[ci][I])return this;var E=function(ie){return m.call(b||l,ie||window.event)},U=E;!ue.touchNative&&ue.pointer&&d.indexOf("touch")===0?E=it(l,d,E):ue.touch&&d==="dblclick"?E=ti(l,E):"addEventListener"in l?d==="touchstart"||d==="touchmove"||d==="wheel"||d==="mousewheel"?l.addEventListener($i[d]||d,E,ue.passiveEvents?{passive:!1}:!1):d==="mouseenter"||d==="mouseleave"?(E=function(ie){ie=ie||window.event,Qr(l,ie)&&U(ie)},l.addEventListener($i[d],E,!1)):l.addEventListener(d,U,!1):l.attachEvent("on"+d,E),l[ci]=l[ci]||{},l[ci][I]=E}function Gt(l,d,m,b,I){I=I||d+c(m)+(b?"_"+c(b):"");var E=l[ci]&&l[ci][I];if(!E)return this;!ue.touchNative&&ue.pointer&&d.indexOf("touch")===0?xt(l,d,E):ue.touch&&d==="dblclick"?ji(l,E):"removeEventListener"in l?l.removeEventListener($i[d]||d,E,!1):l.detachEvent("on"+d,E),l[ci][I]=null}function _n(l){return l.stopPropagation?l.stopPropagation():l.originalEvent?l.originalEvent._stopped=!0:l.cancelBubble=!0,this}function ri(l){return oi(l,"wheel",_n),this}function On(l){return et(l,"mousedown touchstart dblclick contextmenu",_n),l._leaflet_disable_click=!0,this}function Yi(l){return l.preventDefault?l.preventDefault():l.returnValue=!1,this}function Ps(l){return Yi(l),_n(l),this}function Oo(l){if(l.composedPath)return l.composedPath();for(var d=[],m=l.target;m;)d.push(m),m=m.parentNode;return d}function Lr(l,d){if(!d)return new Ne(l.clientX,l.clientY);var m=gt(d),b=m.boundingClientRect;return new Ne((l.clientX-b.left)/m.x-d.clientLeft,(l.clientY-b.top)/m.y-d.clientTop)}var Aa=ue.linux&&ue.chrome?window.devicePixelRatio:ue.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function kr(l){return ue.edge?l.wheelDeltaY/2:l.deltaY&&l.deltaMode===0?-l.deltaY/Aa: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 Qr(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 Cl={__proto__:null,on:et,off:Jt,stopPropagation:_n,disableScrollPropagation:ri,disableClickPropagation:On,preventDefault:Yi,stop:Ps,getPropagationPath:Oo,getMousePosition:Lr,getWheelDelta:kr,isExternalTarget:Qr,addListener:et,removeListener:Jt},Oa=Qt.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=Et(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=ve(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(),ye(this._el,m),this.fire("step")},_complete:function(){st(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(l){return 1-Math.pow(1-l,this._easeOutPower)}}),Ai=Qt.extend({options:{crs:Ei,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(vt(d.center),d.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=K&&ue.any3d&&!ue.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),et(this._proxy,Ee,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(vt(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||(ue.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+l,d)},zoomOut:function(l,d){return l=l||(ue.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),E=l instanceof Ne?l:this.latLngToContainerPoint(l),U=E.subtract(I).multiplyBy(1-1/b),ie=this.containerPointToLatLng(I.add(U));return this.setView(ie,d,{zoom:m})},_getBoundsCenterZoom:function(l,d){d=d||{},l=l.getBounds?l.getBounds():Xt(l);var m=Re(d.paddingTopLeft||d.padding||[0,0]),b=Re(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 E=b.subtract(m).divideBy(2),U=this.project(l.getSouthWest(),I),ie=this.project(l.getNorthEast(),I),de=this.unproject(U.add(ie).divideBy(2).add(E),I);return{center:de,zoom:I}},fitBounds:function(l,d){if(l=Xt(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=Re(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 Oa,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),d.noMoveStart||this.fire("movestart"),d.animate!==!1){Te(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||!ue.any3d)return this.setView(l,d,m);this._stop();var b=this.project(this.getCenter()),I=this.project(l),E=this.getSize(),U=this._zoom;l=vt(l),d=d===void 0?U:d;var ie=Math.max(E.x,E.y),de=ie*this.getZoomScale(U,d),ze=I.distanceTo(b)||1,Ht=1.42,wi=Ht*Ht;function Zi(Ss){var Em=Ss?-1:1,iA=Ss?de:ie,nA=de*de-ie*ie+Em*wi*wi*ze*ze,sA=2*iA*wi*ze,Zy=nA/sA,OL=Math.sqrt(Zy*Zy+1)-Zy,oA=OL<1e-9?-18:Math.log(OL);return oA}function lo(Ss){return(Math.exp(Ss)-Math.exp(-Ss))/2}function Ns(Ss){return(Math.exp(Ss)+Math.exp(-Ss))/2}function Qo(Ss){return lo(Ss)/Ns(Ss)}var wo=Zi(0);function Hh(Ss){return ie*(Ns(wo)/Ns(wo+Ht*Ss))}function JR(Ss){return ie*(Ns(wo)*Qo(wo+Ht*Ss)-lo(wo))/wi}function QR(Ss){return 1-Math.pow(1-Ss,1.5)}var eA=Date.now(),RL=(Zi(1)-wo)/Ht,tA=m.duration?1e3*m.duration:1e3*RL*.8;function AL(){var Ss=(Date.now()-eA)/tA,Em=QR(Ss)*RL;Ss<=1?(this._flyToFrame=ve(AL,this),this._move(this.unproject(b.add(I.subtract(b).multiplyBy(JR(Em)/ze)),U),this.getScaleZoom(ie/Hh(Em),U),{flyTo:!0})):this._move(l,d)._moveEnd(!0)}return this._moveStart(!0,m.noMoveStart),AL.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=Xt(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,Xt(l));return m.equals(b)||this.panTo(b,d),this._enforcingBounds=!1,this},panInside:function(l,d){d=d||{};var m=Re(d.paddingTopLeft||d.padding||[0,0]),b=Re(d.paddingBottomRight||d.padding||[0,0]),I=this.project(this.getCenter()),E=this.project(l),U=this.getPixelBounds(),ie=At([U.min.add(m),U.max.subtract(b)]),de=ie.getSize();if(!ie.contains(E)){this._enforcingBounds=!0;var ze=E.subtract(ie.getCenter()),Ht=ie.extend(E).getSize().subtract(de);I.x+=ze.x<0?-Ht.x:Ht.x,I.y+=ze.y<0?-Ht.y:Ht.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(),E=b.subtract(I);return!E.x&&!E.y?this:(l.animate&&l.pan?this.panBy(E):(l.pan&&this._rawPanBy(E),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 zt(d,m),I=b.toBounds(l.coords.accuracy*2),E=this._locateOptions;if(E.setView){var U=this.getBoundsZoom(I);this.setView(b,E.maxZoom?Math.min(U,E.maxZoom):U)}var ie={latlng:b,bounds:I,timestamp:l.timestamp};for(var de in l.coords)typeof l.coords[de]=="number"&&(ie[de]=l.coords[de]);this.fire("locationfound",ie)}},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(),re(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(st(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var l;for(l in this._layers)this._layers[l].remove();for(l in this._panes)re(this._panes[l]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(l,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=Xt(l),m=Re(m||[0,0]);var b=this.getZoom()||0,I=this.getMinZoom(),E=this.getMaxZoom(),U=l.getNorthWest(),ie=l.getSouthEast(),de=this.getSize().subtract(m),ze=At(this.project(ie,b),this.project(U,b)).getSize(),Ht=ue.any3d?this.options.zoomSnap:1,wi=de.x/ze.x,Zi=de.y/ze.y,lo=d?Math.max(wi,Zi):Math.min(wi,Zi);return b=this.getScaleZoom(lo,b),Ht&&(b=Math.round(b/(Ht/100))*(Ht/100),b=d?Math.ceil(b/Ht)*Ht:Math.floor(b/Ht)*Ht),Math.max(I,Math.min(E,b))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new Ne(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 ot(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(vt(l),d)},unproject:function(l,d){return d=d===void 0?this._zoom:d,this.options.crs.pointToLatLng(Re(l),d)},layerPointToLatLng:function(l){var d=Re(l).add(this.getPixelOrigin());return this.unproject(d)},latLngToLayerPoint:function(l){var d=this.project(vt(l))._round();return d._subtract(this.getPixelOrigin())},wrapLatLng:function(l){return this.options.crs.wrapLatLng(vt(l))},wrapLatLngBounds:function(l){return this.options.crs.wrapLatLngBounds(Xt(l))},distance:function(l,d){return this.options.crs.distance(vt(l),vt(d))},containerPointToLayerPoint:function(l){return Re(l).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(l){return Re(l).add(this._getMapPanePos())},containerPointToLatLng:function(l){var d=this.containerPointToLayerPoint(Re(l));return this.layerPointToLatLng(d)},latLngToContainerPoint:function(l){return this.layerPointToContainerPoint(this.latLngToLayerPoint(vt(l)))},mouseEventToContainerPoint:function(l){return Lr(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=Pe(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&&ue.any3d,Te(l,"leaflet-container"+(ue.touch?" leaflet-touch":"")+(ue.retina?" leaflet-retina":"")+(ue.ielt9?" leaflet-oldie":"")+(ue.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var d=Be(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),ye(this._mapPane,new Ne(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(Te(l.markerPane,"leaflet-zoom-hide"),Te(l.shadowPane,"leaflet-zoom-hide"))},_resetView:function(l,d,m){ye(this._mapPane,new Ne(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 st(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(l){ye(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?Jt: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),ue.any3d&&this.options.transform3DLimit&&(l?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){st(this._resizeRequest),this._resizeRequest=ve(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",E=l.target||l.srcElement,U=!1;E;){if(b=this._targets[c(E)],b&&(d==="click"||d==="preclick")&&this._draggableMoved(b)){U=!0;break}if(b&&b.listens(d,!0)&&(I&&!Qr(E,l)||(m.push(b),I))||E===this._container)break;E=E.parentNode}return!m.length&&!U&&!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"&&Bt(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 E=[],U=0;U<m.length;U++)m[U].listens(d,!0)&&E.push(m[U]);I=E.concat(I)}if(I.length){d==="contextmenu"&&Yi(l);var ie=I[0],de={originalEvent:l};if(l.type!=="keypress"&&l.type!=="keydown"&&l.type!=="keyup"){var ze=ie.getLatLng&&(!ie._radius||ie._radius<=10);de.containerPoint=ze?this.latLngToContainerPoint(ie.getLatLng()):this.mouseEventToContainerPoint(l),de.layerPoint=this.containerPointToLayerPoint(de.containerPoint),de.latlng=ze?ie.getLatLng():this.layerPointToLatLng(de.layerPoint)}for(U=0;U<I.length;U++)if(I[U].fire(d,de,!0),de.originalEvent._stopped||I[U].options.bubblingMouseEvents===!1&&V(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 Et(this._mapPane)||new Ne(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 At([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),E=new ot(b.subtract(I),b.add(I)),U=this._getBoundsOffset(E,m,d);return Math.abs(U.x)<=1&&Math.abs(U.y)<=1?l:this.unproject(b.add(U),d)},_limitOffset:function(l,d){if(!d)return l;var m=this.getPixelBounds(),b=new ot(m.min.add(l),m.max.add(l));return l.add(this._getBoundsOffset(b,d))},_getBoundsOffset:function(l,d,m){var b=At(this.project(d.getNorthEast(),m),this.project(d.getSouthWest(),m)),I=b.min.subtract(l.min),E=b.max.subtract(l.max),U=this._rebound(I.x,-E.x),ie=this._rebound(I.y,-E.y);return new Ne(U,ie)},_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=ue.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(){H(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=A,b=this._proxy.style[m];ut(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(){re(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var l=this.getCenter(),d=this.getZoom();ut(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:(ve(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,Te(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&&H(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 Xs(l,d){return new Ai(l,d)}var es=yt.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 Te(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?(re(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(l){this._map&&l&&l.screenX>0&&l.screenY>0&&this._map.getContainer().focus()}}),Ts=function(l){return new es(l)};Ai.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,E){var U=d+I+" "+d+E;l[I+E]=Me("div",U,m)}b("top","left"),b("top","right"),b("bottom","left"),b("bottom","right")},_clearControlPos:function(){for(var l in this._controlCorners)re(this._controlCorners[l]);re(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var Ph=es.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 es.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(){Te(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?(Te(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=l+"px"):H(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return H(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),On(d),ri(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(E){E.keyCode===13&&this._expandSafely()},click:function(E){Yi(E),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;Je(this._baseLayersList),Je(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 E=document.createElement("span");d.appendChild(E),E.appendChild(b),E.appendChild(I);var U=l.overlay?this._overlaysList:this._baseLayersList;return U.appendChild(d),this._checkDisabledLayers(),d},_onInputClick:function(){if(!this._preventClick){var l=this._layerControlInputs,d,m,b=[],I=[];this._handlingClick=!0;for(var E=l.length-1;E>=0;E--)d=l[E],m=this._getLayer(d.layerId).layer,d.checked?b.push(m):d.checked||I.push(m);for(E=0;E<I.length;E++)this._map.hasLayer(I[E])&&this._map.removeLayer(I[E]);for(E=0;E<b.length;E++)this._map.hasLayer(b[E])||this._map.addLayer(b[E]);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",Yi),this.expand();var d=this;setTimeout(function(){Jt(l,"click",Yi),d._preventClick=!1})}}),Th=function(l,d,m){return new Ph(l,d,m)},Ec=es.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">−</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 E=Me("a",m,b);return E.innerHTML=l,E.href="#",E.title=d,E.setAttribute("role","button"),E.setAttribute("aria-label",d),On(E),et(E,"click",Ps),et(E,"click",I,this),et(E,"click",this._refocusOnMap,this),E},_updateDisabled:function(){var l=this._map,d="leaflet-disabled";H(this._zoomInButton,d),H(this._zoomOutButton,d),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||l._zoom===l.getMinZoom())&&(Te(this._zoomOutButton,d),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||l._zoom===l.getMaxZoom())&&(Te(this._zoomInButton,d),this._zoomInButton.setAttribute("aria-disabled","true"))}});Ai.mergeOptions({zoomControl:!0}),Ai.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Ec,this.addControl(this.zoomControl))});var Xo=function(l){return new Ec(l)},ea=es.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}}),$y=function(l){return new ea(l)},pm='<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>',Mh=es.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(ue.inlineSvg?pm+" ":"")+"Leaflet</a>"},initialize:function(l){w(this,l),this._attributions={}},onAdd:function(l){l.attributionControl=this,this._container=Me("div","leaflet-control-attribution"),On(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> ')}}});Ai.mergeOptions({attributionControl:!0}),Ai.addInitHook(function(){this.options.attributionControl&&new Mh().addTo(this)});var mm=function(l){return new Mh(l)};es.Layers=Ph,es.Zoom=Ec,es.Scale=ea,es.Attribution=Mh,Ts.layers=Th,Ts.zoom=Xo,Ts.scale=$y,Ts.attribution=mm;var Fo=yt.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}});Fo.addTo=function(l,d){return l.addHandler(d,this),this};var qy={Events:jt},_m=ue.touch?"touchstart mousedown":"mousedown",ta=Qt.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,_m,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(ta._dragging===this&&this.finishDrag(!0),Jt(this._dragStartTarget,_m,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(l){if(this._enabled&&(this._moved=!1,!St(this._element,"leaflet-zoom-anim"))){if(l.touches&&l.touches.length!==1){ta._dragging===this&&this.finishDrag();return}if(!(ta._dragging||l.shiftKey||l.which!==1&&l.button!==1&&!l.touches)&&(ta._dragging=this,this._preventOutline&&Bt(this._element),Ie(),dt(),!this._moving)){this.fire("down");var d=l.touches?l.touches[0]:l,m=$e(this._element);this._startPoint=new Ne(d.clientX,d.clientY),this._startPos=Et(this._element),this._parentScale=gt(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 Ne(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,Yi(l),this._moved||(this.fire("dragstart"),this._moved=!0,Te(document.body,"leaflet-dragging"),this._lastTarget=l.target||l.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),Te(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),ye(this._element,this._newPos),this.fire("drag",l)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(l){H(document.body,"leaflet-dragging"),this._lastTarget&&(H(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),Jt(document,"mousemove touchmove",this._onMove,this),Jt(document,"mouseup touchend touchcancel",this._onUp,this),le(),he();var d=this._moved&&this._moving;this._moving=!1,ta._dragging=!1,d&&this.fire("dragend",{noInertia:l,distance:this._newPos.distanceTo(this._startPos)})}});function Bg(l,d,m){var b,I=[1,4,2,8],E,U,ie,de,ze,Ht,wi,Zi;for(E=0,Ht=l.length;E<Ht;E++)l[E]._code=Fa(l[E],d);for(ie=0;ie<4;ie++){for(wi=I[ie],b=[],E=0,Ht=l.length,U=Ht-1;E<Ht;U=E++)de=l[E],ze=l[U],de._code&wi?ze._code&wi||(Zi=Nh(ze,de,wi,d,m),Zi._code=Fa(Zi,d),b.push(Zi)):(ze._code&wi&&(Zi=Nh(ze,de,wi,d,m),Zi._code=Fa(Zi,d),b.push(Zi)),b.push(de));l=b}return l}function vm(l,d){var m,b,I,E,U,ie,de,ze,Ht;if(!l||l.length===0)throw new Error("latlngs not passed");yo(l)||(console.warn("latlngs are not flat! Only the first ring will be used"),l=l[0]);var wi=vt([0,0]),Zi=Xt(l),lo=Zi.getNorthWest().distanceTo(Zi.getSouthWest())*Zi.getNorthEast().distanceTo(Zi.getNorthWest());lo<1700&&(wi=Pc(l));var Ns=l.length,Qo=[];for(m=0;m<Ns;m++){var wo=vt(l[m]);Qo.push(d.project(vt([wo.lat-wi.lat,wo.lng-wi.lng])))}for(ie=de=ze=0,m=0,b=Ns-1;m<Ns;b=m++)I=Qo[m],E=Qo[b],U=I.y*E.x-E.y*I.x,de+=(I.x+E.x)*U,ze+=(I.y+E.y)*U,ie+=U*3;ie===0?Ht=Qo[0]:Ht=[de/ie,ze/ie];var Hh=d.unproject(Re(Ht));return vt([Hh.lat+wi.lat,Hh.lng+wi.lng])}function Pc(l){for(var d=0,m=0,b=0,I=0;I<l.length;I++){var E=vt(l[I]);d+=E.lat,m+=E.lng,b++}return vt([d/b,m/b])}var bm={__proto__:null,clipPolygon:Bg,polygonCenter:vm,centroid:Pc};function zg(l,d){if(!d||!l.length)return l.slice();var m=d*d;return l=wm(l,m),l=ym(l,m),l}function Vg(l,d,m){return Math.sqrt(Mc(l,d,m,!0))}function Ky(l,d,m){return Mc(l,d,m)}function ym(l,d){var m=l.length,b=typeof Uint8Array<"u"?Uint8Array:Array,I=new b(m);I[0]=I[m-1]=1,Tc(l,I,d,0,m-1);var E,U=[];for(E=0;E<m;E++)I[E]&&U.push(l[E]);return U}function Tc(l,d,m,b,I){var E=0,U,ie,de;for(ie=b+1;ie<=I-1;ie++)de=Mc(l[ie],l[b],l[I],!0),de>E&&(U=ie,E=de);E>m&&(d[U]=1,Tc(l,d,m,b,U),Tc(l,d,m,U,I))}function wm(l,d){for(var m=[l[0]],b=1,I=0,E=l.length;b<E;b++)Gy(l[b],l[I])>d&&(m.push(l[b]),I=b);return I<E-1&&m.push(l[E-1]),m}var Sm;function Cm(l,d,m,b,I){var E=b?Sm:Fa(l,m),U=Fa(d,m),ie,de,ze;for(Sm=U;;){if(!(E|U))return[l,d];if(E&U)return!1;ie=E||U,de=Nh(l,d,ie,m,I),ze=Fa(de,m),ie===E?(l=de,E=ze):(d=de,U=ze)}}function Nh(l,d,m,b,I){var E=d.x-l.x,U=d.y-l.y,ie=b.min,de=b.max,ze,Ht;return m&8?(ze=l.x+E*(de.y-l.y)/U,Ht=de.y):m&4?(ze=l.x+E*(ie.y-l.y)/U,Ht=ie.y):m&2?(ze=de.x,Ht=l.y+U*(de.x-l.x)/E):m&1&&(ze=ie.x,Ht=l.y+U*(ie.x-l.x)/E),new Ne(ze,Ht,I)}function Fa(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 Gy(l,d){var m=d.x-l.x,b=d.y-l.y;return m*m+b*b}function Mc(l,d,m,b){var I=d.x,E=d.y,U=m.x-I,ie=m.y-E,de=U*U+ie*ie,ze;return de>0&&(ze=((l.x-I)*U+(l.y-E)*ie)/de,ze>1?(I=m.x,E=m.y):ze>0&&(I+=U*ze,E+=ie*ze)),U=l.x-I,ie=l.y-E,b?U*U+ie*ie:new Ne(I,E)}function yo(l){return!N(l[0])||typeof l[0][0]!="object"&&typeof l[0][0]<"u"}function xm(l){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),yo(l)}function W(l,d){var m,b,I,E,U,ie,de,ze;if(!l||l.length===0)throw new Error("latlngs not passed");yo(l)||(console.warn("latlngs are not flat! Only the first ring will be used"),l=l[0]);var Ht=vt([0,0]),wi=Xt(l),Zi=wi.getNorthWest().distanceTo(wi.getSouthWest())*wi.getNorthEast().distanceTo(wi.getNorthWest());Zi<1700&&(Ht=Pc(l));var lo=l.length,Ns=[];for(m=0;m<lo;m++){var Qo=vt(l[m]);Ns.push(d.project(vt([Qo.lat-Ht.lat,Qo.lng-Ht.lng])))}for(m=0,b=0;m<lo-1;m++)b+=Ns[m].distanceTo(Ns[m+1])/2;if(b===0)ze=Ns[0];else for(m=0,E=0;m<lo-1;m++)if(U=Ns[m],ie=Ns[m+1],I=U.distanceTo(ie),E+=I,E>b){de=(E-b)/I,ze=[ie.x-de*(ie.x-U.x),ie.y-de*(ie.y-U.y)];break}var wo=d.unproject(Re(ze));return vt([wo.lat+Ht.lat,wo.lng+Ht.lng])}var oe={__proto__:null,simplify:zg,pointToSegmentDistance:Vg,closestPointOnSegment:Ky,clipSegment:Cm,_getEdgeIntersection:Nh,_getBitCode:Fa,_sqClosestPointOnSegment:Mc,isFlat:yo,_flat:xm,polylineCenter:W},we={project:function(l){return new Ne(l.lng,l.lat)},unproject:function(l){return new zt(l.y,l.x)},bounds:new ot([-180,-90],[180,90])},ce={R:6378137,R_MINOR:6356752314245179e-9,bounds:new ot([-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,E=Math.sqrt(1-I*I),U=E*Math.sin(b),ie=Math.tan(Math.PI/4-b/2)/Math.pow((1-U)/(1+U),E/2);return b=-m*Math.log(Math.max(ie,1e-10)),new Ne(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),E=Math.exp(-l.y/m),U=Math.PI/2-2*Math.atan(E),ie=0,de=.1,ze;ie<15&&Math.abs(de)>1e-7;ie++)ze=I*Math.sin(U),ze=Math.pow((1-ze)/(1+ze),I/2),de=Math.PI/2-2*Math.atan(E*ze)-U,U+=de;return new zt(U*d,l.x*d/m)}},tt={__proto__:null,LonLat:we,Mercator:ce,SphericalMercator:Gi},Tt=n({},vi,{code:"EPSG:3395",projection:ce,transformation:(function(){var l=.5/(Math.PI*ce.R);return nn(l,.5,-l,.5)})()}),Wt=n({},vi,{code:"EPSG:4326",projection:we,transformation:nn(1/180,1,-1/180,.5)}),Fi=n({},Li,{projection:we,transformation:nn(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});Li.Earth=vi,Li.EPSG3395=Tt,Li.EPSG3857=Ei,Li.EPSG900913=Mn,Li.EPSG4326=Wt,Li.Simple=Fi;var fi=Qt.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})}}});Ai.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?N(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 xi=fi.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)}}),Pi=function(l,d){return new xi(l,d)},di=xi.extend({addLayer:function(l){return this.hasLayer(l)?this:(l.addEventParent(this),xi.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),xi.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}}),un=function(l,d){return new di(l,d)},qi=yt.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=Re(b),E=Re(d==="shadow"&&m.shadowAnchor||m.iconAnchor||I&&I.divideBy(2,!0));l.className="leaflet-marker-"+d+" "+(m.className||""),E&&(l.style.marginLeft=-E.x+"px",l.style.marginTop=-E.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 ue.retina&&this.options[l+"RetinaUrl"]||this.options[l+"Url"]}});function Zn(l){return new qi(l)}var vs=qi.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 vs.imagePath!="string"&&(vs.imagePath=this._detectIconPath()),(this.options.imagePath||vs.imagePath)+qi.prototype._getIconUrl.call(this,l)},_stripUrl:function(l){var d=function(m,b,I){var E=b.exec(m);return E&&E[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=Be(l,"background-image")||Be(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):""}}),kn=Fo.extend({initialize:function(l){this._marker=l},addHooks:function(){var l=this._marker._icon;this._draggable||(this._draggable=new ta(l,l,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),Te(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&&H(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,E=Et(d._icon),U=m.getPixelBounds(),ie=m.getPixelOrigin(),de=At(U.min._subtract(ie).add(I),U.max._subtract(ie).subtract(I));if(!de.contains(E)){var ze=Re((Math.max(de.max.x,E.x)-de.max.x)/(U.max.x-de.max.x)-(Math.min(de.min.x,E.x)-de.min.x)/(U.min.x-de.min.x),(Math.max(de.max.y,E.y)-de.max.y)/(U.max.y-de.max.y)-(Math.min(de.min.y,E.y)-de.min.y)/(U.min.y-de.min.y)).multiplyBy(b);m.panBy(ze,{animate:!1}),this._draggable._newPos._add(ze),this._draggable._startPos._add(ze),ye(d._icon,this._draggable._newPos),this._onDrag(l),this._panRequest=ve(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&&(st(this._panRequest),this._panRequest=ve(this._adjustPan.bind(this,l)))},_onDrag:function(l){var d=this._marker,m=d._shadow,b=Et(d._icon),I=d._map.layerPointToLatLng(b);m&&ye(m,b),d._latlng=I,l.latlng=I,l.oldLatLng=this._oldLatLng,d.fire("move",l).fire("drag",l)},_onDragEnd:function(l){st(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",l)}}),Ms=fi.extend({options:{icon:new vs,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=vt(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=vt(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||"")),Te(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),E=!1;I!==this._shadow&&(this._removeShadow(),E=!0),I&&(Te(I,d),I.alt=""),this._shadow=I,l.opacity<1&&this._updateOpacity(),b&&this.getPane().appendChild(this._icon),this._initInteraction(),I&&E&&this.getPane(l.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Jt(this._icon,"focus",this._panOnFocus,this),re(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&re(this._shadow),this._shadow=null},_setPos:function(l){this._icon&&ye(this._icon,l),this._shadow&&ye(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&&(Te(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),kn)){var l=this.options.draggable;this.dragging&&(l=this.dragging.enabled(),this.dragging.disable()),this.dragging=new kn(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&&Ke(this._icon,l),this._shadow&&Ke(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?Re(d.iconSize):Re(0,0),b=d.iconAnchor?Re(d.iconAnchor):Re(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 Yo(l,d){return new Ms(l,d)}var cs=fi.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)}}),oo=cs.extend({options:{fill:!0,radius:10},initialize:function(l,d){w(this,d),this._latlng=vt(l),this._radius=this.options.radius},setLatLng:function(l){var d=this._latlng;return this._latlng=vt(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 cs.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 ot(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 Jo(l,d){return new oo(l,d)}var ro=oo.extend({initialize:function(l,d,m){if(typeof d=="number"&&(d=n({},m,{radius:d})),w(this,d),this._latlng=vt(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:cs.prototype.setStyle,_project:function(){var l=this._latlng.lng,d=this._latlng.lat,m=this._map,b=m.options.crs;if(b.distance===vi.distance){var I=Math.PI/180,E=this._mRadius/vi.R/I,U=m.project([d+E,l]),ie=m.project([d-E,l]),de=U.add(ie).divideBy(2),ze=m.unproject(de).lat,Ht=Math.acos((Math.cos(E*I)-Math.sin(d*I)*Math.sin(ze*I))/(Math.cos(d*I)*Math.cos(ze*I)))/I;(isNaN(Ht)||Ht===0)&&(Ht=E/Math.cos(Math.PI/180*d)),this._point=de.subtract(m.getPixelOrigin()),this._radius=isNaN(Ht)?0:de.x-m.project([ze,l-Ht]).x,this._radiusY=de.y-U.y}else{var wi=b.unproject(b.project(this._latlng).subtract([this._mRadius,0]));this._point=m.latLngToLayerPoint(this._latlng),this._radius=this._point.x-m.latLngToLayerPoint(wi).x}this._updateBounds()}});function ao(l,d,m){return new ro(l,d,m)}var gs=cs.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=Mc,I,E,U=0,ie=this._parts.length;U<ie;U++)for(var de=this._parts[U],ze=1,Ht=de.length;ze<Ht;ze++){I=de[ze-1],E=de[ze];var wi=b(l,I,E,!0);wi<d&&(d=wi,m=b(l,I,E))}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 W(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(l,d){return d=d||this._defaultShape(),l=vt(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 yo(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(l){for(var d=[],m=yo(l),b=0,I=l.length;b<I;b++)m?(d[b]=vt(l[b]),this._bounds.extend(d[b])):d[b]=this._convertLatLngs(l[b]);return d},_project:function(){var l=new ot;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 Ne(l,l);this._rawPxBounds&&(this._pxBounds=new ot([this._rawPxBounds.min.subtract(d),this._rawPxBounds.max.add(d)]))},_projectLatlngs:function(l,d,m){var b=l[0]instanceof zt,I=l.length,E,U;if(b){for(U=[],E=0;E<I;E++)U[E]=this._map.latLngToLayerPoint(l[E]),m.extend(U[E]);d.push(U)}else for(E=0;E<I;E++)this._projectLatlngs(l[E],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,E,U,ie,de;for(m=0,I=0,E=this._rings.length;m<E;m++)for(de=this._rings[m],b=0,U=de.length;b<U-1;b++)ie=Cm(de[b],de[b+1],l,b,!0),ie&&(d[I]=d[I]||[],d[I].push(ie[0]),(ie[1]!==de[b+1]||b===U-2)&&(d[I].push(ie[1]),I++))}},_simplifyPoints:function(){for(var l=this._parts,d=this.options.smoothFactor,m=0,b=l.length;m<b;m++)l[m]=zg(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,E,U,ie,de=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(l))return!1;for(m=0,E=this._parts.length;m<E;m++)for(ie=this._parts[m],b=0,U=ie.length,I=U-1;b<U;I=b++)if(!(!d&&b===0)&&Vg(l,ie[I],ie[b])<=de)return!0;return!1}});function xl(l,d){return new gs(l,d)}gs._flat=xm;var Ho=gs.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 vm(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(l){var d=gs.prototype._convertLatLngs.call(this,l),m=d.length;return m>=2&&d[0]instanceof zt&&d[0].equals(d[m-1])&&d.pop(),d},_setLatLngs:function(l){gs.prototype._setLatLngs.call(this,l),yo(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return yo(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var l=this._renderer._bounds,d=this.options.weight,m=new Ne(d,d);if(l=new ot(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,E;b<I;b++)E=Bg(this._rings[b],l,!0),E.length&&this._parts.push(E)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(l){var d=!1,m,b,I,E,U,ie,de,ze;if(!this._pxBounds||!this._pxBounds.contains(l))return!1;for(E=0,de=this._parts.length;E<de;E++)for(m=this._parts[E],U=0,ze=m.length,ie=ze-1;U<ze;ie=U++)b=m[U],I=m[ie],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||gs.prototype._containsPoint.call(this,l,!0)}});function jg(l,d){return new Ho(l,d)}var Kn=di.extend({initialize:function(l,d){w(this,d),this._layers={},l&&this.addData(l)},addData:function(l){var d=N(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 E=this.options;if(E.filter&&!E.filter(l))return this;var U=Ir(l,E);return U?(U.feature=Ls(l),U.defaultOptions=U.options,this.resetStyle(U),E.onEachFeature&&E.onEachFeature(l,U),this.addLayer(U)):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 Ir(l,d){var m=l.type==="Feature"?l.geometry:l,b=m?m.coordinates:null,I=[],E=d&&d.pointToLayer,U=d&&d.coordsToLatLng||Nc,ie,de,ze,Ht;if(!b&&!m)return null;switch(m.type){case"Point":return ie=U(b),Ll(E,l,ie,d);case"MultiPoint":for(ze=0,Ht=b.length;ze<Ht;ze++)ie=U(b[ze]),I.push(Ll(E,l,ie,d));return new di(I);case"LineString":case"MultiLineString":return de=Rh(b,m.type==="LineString"?0:1,U),new gs(de,d);case"Polygon":case"MultiPolygon":return de=Rh(b,m.type==="Polygon"?1:2,U),new Ho(de,d);case"GeometryCollection":for(ze=0,Ht=m.geometries.length;ze<Ht;ze++){var wi=Ir({geometry:m.geometries[ze],type:"Feature",properties:l.properties},d);wi&&I.push(wi)}return new di(I);case"FeatureCollection":for(ze=0,Ht=m.features.length;ze<Ht;ze++){var Zi=Ir(m.features[ze],d);Zi&&I.push(Zi)}return new di(I);default:throw new Error("Invalid GeoJSON object.")}}function Ll(l,d,m,b){return l?l(d,m):new Ms(m,b&&b.markersInheritOptions&&b)}function Nc(l){return new zt(l[1],l[0],l[2])}function Rh(l,d,m){for(var b=[],I=0,E=l.length,U;I<E;I++)U=d?Rh(l[I],d-1,m):(m||Nc)(l[I]),b.push(U);return b}function Ug(l,d){return l=vt(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 Ah(l,d,m,b){for(var I=[],E=0,U=l.length;E<U;E++)I.push(d?Ah(l[E],yo(l[E])?0:d-1,m,b):Ug(l[E],b));return!d&&m&&I.length>0&&I.push(I[0].slice()),I}function ln(l,d){return l.feature?n({},l.feature,{geometry:d}):Ls(d)}function Ls(l){return l.type==="Feature"||l.type==="FeatureCollection"?l:{type:"Feature",properties:{},geometry:l}}var kl={toGeoJSON:function(l){return ln(this,{type:"Point",coordinates:Ug(this.getLatLng(),l)})}};Ms.include(kl),ro.include(kl),oo.include(kl),gs.include({toGeoJSON:function(l){var d=!yo(this._latlngs),m=Ah(this._latlngs,d?1:0,!1,l);return ln(this,{type:(d?"Multi":"")+"LineString",coordinates:m})}}),Ho.include({toGeoJSON:function(l){var d=!yo(this._latlngs),m=d&&!yo(this._latlngs[0]),b=Ah(this._latlngs,m?2:d?1:0,!0,l);return d||(b=[b]),ln(this,{type:(m?"Multi":"")+"Polygon",coordinates:b})}}),xi.include({toMultiPoint:function(l){var d=[];return this.eachLayer(function(m){d.push(m.toGeoJSON(l).geometry.coordinates)}),ln(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 E=I.toGeoJSON(l);if(m)b.push(E.geometry);else{var U=Ls(E);U.type==="FeatureCollection"?b.push.apply(b,U.features):b.push(U)}}}),m?ln(this,{geometries:b,type:"GeometryCollection"}):{type:"FeatureCollection",features:b}}});function Oh(l,d){return new Kn(l,d)}var WR=Oh,Lm=fi.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(l,d,m){this._url=l,this._bounds=Xt(d),w(this,m)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(Te(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){re(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(l){return this.options.opacity=l,this._image&&this._updateOpacity(),this},setStyle:function(l){return l.opacity&&this.setOpacity(l.opacity),this},bringToFront:function(){return this._map&&Oe(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=Xt(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(Te(d,"leaflet-image-layer"),this._zoomAnimated&&Te(d,"leaflet-zoom-animated"),this.options.className&&Te(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;ut(this._image,m,d)},_reset:function(){var l=this._image,d=new ot(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),m=d.getSize();ye(l,d.min),l.style.width=m.x+"px",l.style.height=m.y+"px"},_updateOpacity:function(){Ke(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()}}),BR=function(l,d,m){return new Lm(l,d,m)},vL=Lm.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(Te(d,"leaflet-image-layer"),this._zoomAnimated&&Te(d,"leaflet-zoom-animated"),this.options.className&&Te(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}N(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 E=0;E<this._url.length;E++){var U=Me("source");U.src=this._url[E],d.appendChild(U)}}});function zR(l,d,m){return new vL(l,d,m)}var bL=Lm.extend({_initImage:function(){var l=this._image=this._url;Te(l,"leaflet-image-layer"),this._zoomAnimated&&Te(l,"leaflet-zoom-animated"),this.options.className&&Te(l,this.options.className),l.onselectstart=f,l.onmousemove=f}});function VR(l,d,m){return new bL(l,d,m)}var ia=fi.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(l,d){l&&(l instanceof zt||N(l))?(this._latlng=vt(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&&Ke(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),l._fadeAnimated&&Ke(this._container,1),this.bringToFront(),this.options.interactive&&(Te(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(l){l._fadeAnimated?(Ke(this._container,0),this._removeTimeout=setTimeout(r(re,void 0,this._container),200)):re(this._container),this.options.interactive&&(H(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(l){return this._latlng=vt(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&&Oe(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 di){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=Re(this.options.offset),m=this._getAnchor();this._zoomAnimated?ye(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]}});Ai.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}}),fi.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 km=ia.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,ia.prototype.openOn.call(this,l)},onAdd:function(l){ia.prototype.onAdd.call(this,l),l.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof cs||this._source.on("preclick",_n))},onRemove:function(l){ia.prototype.onRemove.call(this,l),l.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof cs||this._source.off("preclick",_n))},getEvents:function(){var l=ia.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),On(d),ri(this._contentNode),et(d,"contextmenu",_n),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">×</span>',et(b,"click",function(I){Yi(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,E="leaflet-popup-scrolled";I&&b>I?(d.height=I+"px",Te(l,E)):H(l,E),this._containerWidth=this._container.offsetWidth},_animateZoom:function(l){var d=this._map._latLngToNewLayerPoint(this._latlng,l.zoom,l.center),m=this._getAnchor();ye(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(Be(this._container,"marginBottom"),10)||0,m=this._container.offsetHeight+d,b=this._containerWidth,I=new Ne(this._containerLeft,-m-this._containerBottom);I._add(Et(this._container));var E=l.layerPointToContainerPoint(I),U=Re(this.options.autoPanPadding),ie=Re(this.options.autoPanPaddingTopLeft||U),de=Re(this.options.autoPanPaddingBottomRight||U),ze=l.getSize(),Ht=0,wi=0;E.x+b+de.x>ze.x&&(Ht=E.x+b-ze.x+de.x),E.x-Ht-ie.x<0&&(Ht=E.x-ie.x),E.y+m+de.y>ze.y&&(wi=E.y+m-ze.y+de.y),E.y-wi-ie.y<0&&(wi=E.y-ie.y),(Ht||wi)&&(this.options.keepInView&&(this._autopanning=!0),l.fire("autopanstart").panBy([Ht,wi]))}},_getAnchor:function(){return Re(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),jR=function(l,d){return new km(l,d)};Ai.mergeOptions({closePopupOnClick:!0}),Ai.include({openPopup:function(l,d,m){return this._initOverlay(km,l,d,m).openOn(this),this},closePopup:function(l){return l=arguments.length?l:this._popup,l&&l.close(),this}}),fi.include({bindPopup:function(l,d){return this._popup=this._initOverlay(km,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 di||(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)){Ps(l);var d=l.layer||l.target;if(this._popup._source===d&&!(d instanceof cs)){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 Im=ia.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(l){ia.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){ia.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=ia.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,E=b.latLngToContainerPoint(b.getCenter()),U=b.layerPointToContainerPoint(l),ie=this.options.direction,de=I.offsetWidth,ze=I.offsetHeight,Ht=Re(this.options.offset),wi=this._getAnchor();ie==="top"?(d=de/2,m=ze):ie==="bottom"?(d=de/2,m=0):ie==="center"?(d=de/2,m=ze/2):ie==="right"?(d=0,m=ze/2):ie==="left"?(d=de,m=ze/2):U.x<E.x?(ie="right",d=0,m=ze/2):(ie="left",d=de+(Ht.x+wi.x)*2,m=ze/2),l=l.subtract(Re(d,m,!0)).add(Ht).add(wi),H(I,"leaflet-tooltip-right"),H(I,"leaflet-tooltip-left"),H(I,"leaflet-tooltip-top"),H(I,"leaflet-tooltip-bottom"),Te(I,"leaflet-tooltip-"+ie),ye(I,l)},_updatePosition:function(){var l=this._map.latLngToLayerPoint(this._latlng);this._setPosition(l)},setOpacity:function(l){this.options.opacity=l,this._container&&Ke(this._container,l)},_animateZoom:function(l){var d=this._map._latLngToNewLayerPoint(this._latlng,l.zoom,l.center);this._setPosition(d)},_getAnchor:function(){return Re(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),UR=function(l,d){return new Im(l,d)};Ai.include({openTooltip:function(l,d,m){return this._initOverlay(Im,l,d,m).openOn(this),this},closeTooltip:function(l){return l.close(),this}}),fi.include({bindTooltip:function(l,d){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(Im,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 di||(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 yL=qi.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?(Je(d),d.appendChild(m.html)):d.innerHTML=m.html!==!1?m.html:"",m.bgPos){var b=Re(m.bgPos);d.style.backgroundPosition=-b.x+"px "+-b.y+"px"}return this._setIconStyles(d,"icon"),d},createShadow:function(){return null}});function $R(l){return new yL(l)}qi.Default=vs;var $g=fi.extend({options:{tileSize:256,opacity:1,updateWhenIdle:ue.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(),re(this._container),l._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(Oe(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 Ne?l:new Ne(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,E;b<I;b++)E=d[b].style.zIndex,d[b]!==this._container&&E&&(m=l(m,+E));isFinite(m)&&(this.options.zIndex=m+l(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!ue.ielt9){Ke(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 E=Math.min(1,(l-I.loaded)/200);Ke(I.el,E),E<1?d=!0:(I.active?m=!0:this._onOpaqueTile(I),I.active=!0)}}m&&!this._noPrune&&this._pruneTiles(),d&&(st(this._fadeFrame),this._fadeFrame=ve(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)):(re(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)re(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),E=Math.floor(d/2),U=m-1,ie=new Ne(+I,+E);ie.z=+U;var de=this._tileCoordsToKey(ie),ze=this._tiles[de];return ze&&ze.active?(ze.retain=!0,!0):(ze&&ze.loaded&&(ze.retain=!0),U>b?this._retainParent(I,E,U,b):!1)},_retainChildren:function(l,d,m,b){for(var I=2*l;I<2*l+2;I++)for(var E=2*d;E<2*d+2;E++){var U=new Ne(I,E);U.z=m+1;var ie=this._tileCoordsToKey(U),de=this._tiles[ie];if(de&&de.active){de.retain=!0;continue}else de&&de.loaded&&(de.retain=!0);m+1<b&&this._retainChildren(I,E,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 E=this.options.updateWhenZooming&&I!==this._tileZoom;(!b||E)&&(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();ue.any3d?ut(l.el,I,b):ye(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(),E=d.getSize().divideBy(b*2);return new ot(I.subtract(E),I.add(E))},_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),E=I.getCenter(),U=[],ie=this.options.keepBuffer,de=new ot(I.getBottomLeft().subtract([ie,-ie]),I.getTopRight().add([ie,-ie]));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 Ht=this._tiles[ze].coords;(Ht.z!==this._tileZoom||!de.contains(new Ne(Ht.x,Ht.y)))&&(this._tiles[ze].current=!1)}if(Math.abs(m-this._tileZoom)>1){this._setView(l,m);return}for(var wi=I.min.y;wi<=I.max.y;wi++)for(var Zi=I.min.x;Zi<=I.max.x;Zi++){var lo=new Ne(Zi,wi);if(lo.z=this._tileZoom,!!this._isValidTile(lo)){var Ns=this._tiles[this._tileCoordsToKey(lo)];Ns?Ns.current=!0:U.push(lo)}}if(U.sort(function(wo,Hh){return wo.distanceTo(E)-Hh.distanceTo(E)}),U.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Qo=document.createDocumentFragment();for(Zi=0;Zi<U.length;Zi++)this._addTile(U[Zi],Qo);this._level.el.appendChild(Qo)}}}},_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 Xt(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),E=d.unproject(b,l.z),U=d.unproject(I,l.z);return[E,U]},_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 Ne(+d[0],+d[1]);return m.z=+d[2],m},_removeTile:function(l){var d=this._tiles[l];d&&(re(d.el),delete this._tiles[l],this.fire("tileunload",{tile:d.el,coords:this._keyToTileCoords(l)}))},_initTile:function(l){Te(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,ue.ielt9&&this.options.opacity<1&&Ke(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&&ve(r(this._tileReady,this,l,null,I)),ye(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?(Ke(m.el,0),st(this._fadeFrame),this._fadeFrame=ve(this._updateOpacity,this)):(m.active=!0,this._pruneTiles()),d||(Te(m.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:m.el,coords:l})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),ue.ielt9||!this._map._fadeAnimated?ve(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 Ne(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 ot(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 qR(l){return new $g(l)}var Fh=$g.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&&ue.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:ue.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 P(this._url,n(d,this.options))},_tileOnLoad:function(l,d){ue.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=F;var m=this._tiles[l].coords;re(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",F),$g.prototype._removeTile.call(this,l)},_tileReady:function(l,d,m){if(!(!this._map||m&&m.getAttribute("src")===F))return $g.prototype._tileReady.call(this,l,d,m)}});function wL(l,d){return new Fh(l,d)}var SL=Fh.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&&ue.retina?2:1,E=this.getTileSize();m.width=E.x*I,m.height=E.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,Fh.prototype.onAdd.call(this,l)},getTileUrl:function(l){var d=this._tileCoordsToNwSe(l),m=this._crs,b=At(m.project(d[0]),m.project(d[1])),I=b.min,E=b.max,U=(this._wmsVersion>=1.3&&this._crs===Wt?[I.y,I.x,E.y,E.x]:[I.x,I.y,E.x,E.y]).join(","),ie=Fh.prototype.getTileUrl.call(this,l);return ie+S(this.wmsParams,ie,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+U},setParams:function(l,d){return n(this.wmsParams,l),d||this.redraw(),this}});function KR(l,d){return new SL(l,d)}Fh.WMS=SL,wL.wms=KR;var Ha=fi.extend({options:{padding:.1},initialize:function(l){w(this,l),c(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),Te(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),E=b.multiplyBy(-m).add(I).subtract(this._map._getNewPixelOrigin(l,d));ue.any3d?ut(this._container,E,m):ye(this._container,E)},_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 ot(m,m.add(d.multiplyBy(1+l*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),CL=Ha.extend({options:{tolerance:0},getEvents:function(){var l=Ha.prototype.getEvents.call(this);return l.viewprereset=this._onViewPreReset,l},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Ha.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(){st(this._redrawRequest),delete this._ctx,re(this._container),Jt(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)){Ha.prototype._update.call(this);var l=this._bounds,d=this._container,m=l.getSize(),b=ue.retina?2:1;ye(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",ue.retina&&this._ctx.scale(2,2),this._ctx.translate(-l.min.x,-l.min.y),this.fire("update")}},_reset:function(){Ha.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||ve(this._redraw,this))},_extendRedrawBounds:function(l){if(l._pxBounds){var d=(l.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new ot,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,E,U=l._parts,ie=U.length,de=this._ctx;if(ie){for(de.beginPath(),m=0;m<ie;m++){for(b=0,I=U[m].length;b<I;b++)E=U[m][b],de[b?"lineTo":"moveTo"](E.x,E.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&&(H(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&&(Te(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 xL(l){return ue.canvas?new CL(l):null}var qg=(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">')}})(),GR={_initContainer:function(){this._container=Me("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Ha.prototype._update.call(this),this.fire("update"))},_initPath:function(l){var d=l._container=qg("shape");Te(d,"leaflet-vml-shape "+(this.options.className||"")),d.coordsize="1 1",l._path=qg("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;re(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=qg("stroke")),I.appendChild(d),d.weight=b.weight+"px",d.color=b.color,d.opacity=b.opacity,b.dashArray?d.dashStyle=N(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=qg("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){Oe(l._container)},_bringToBack:function(l){xe(l._container)}},Dm=ue.vml?qg:sn,Kg=Ha.extend({_initContainer:function(){this._container=Dm("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Dm("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){re(this._container),Jt(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Ha.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)),ye(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=Dm("path");l.options.className&&Te(d,l.options.className),l.options.interactive&&Te(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){re(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,Sn(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 ",E=l._empty()?"M0 0":"M"+(d.x-m)+","+d.y+I+m*2+",0 "+I+-m*2+",0 ";this._setPath(l,E)},_setPath:function(l,d){l._path.setAttribute("d",d)},_bringToFront:function(l){Oe(l._path)},_bringToBack:function(l){xe(l._path)}});ue.vml&&Kg.include(GR);function LL(l){return ue.svg||ue.vml?new Kg(l):null}Ai.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&&xL(l)||LL(l)}});var kL=Ho.extend({initialize:function(l,d){Ho.prototype.initialize.call(this,this._boundsToLatLngs(l),d)},setBounds:function(l){return this.setLatLngs(this._boundsToLatLngs(l))},_boundsToLatLngs:function(l){return l=Xt(l),[l.getSouthWest(),l.getNorthWest(),l.getNorthEast(),l.getSouthEast()]}});function ZR(l,d){return new kL(l,d)}Kg.create=Dm,Kg.pointsToPath=Sn,Kn.geometryToLayer=Ir,Kn.coordsToLatLng=Nc,Kn.coordsToLatLngs=Rh,Kn.latLngToCoords=Ug,Kn.latLngsToCoords=Ah,Kn.getFeature=ln,Kn.asFeature=Ls,Ai.mergeOptions({boxZoom:!0});var IL=Fo.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(){Jt(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){re(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(l){if(!l.shiftKey||l.which!==1&&l.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),dt(),Ie(),this._startPoint=this._map.mouseEventToContainerPoint(l),et(document,{contextmenu:Ps,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),Te(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(l);var d=new ot(this._point,this._startPoint),m=d.getSize();ye(this._box,d.min),this._box.style.width=m.x+"px",this._box.style.height=m.y+"px"},_finish:function(){this._moved&&(re(this._box),H(this._container,"leaflet-crosshair")),he(),le(),Jt(document,{contextmenu:Ps,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())}});Ai.addInitHook("addHandler","boxZoom",IL),Ai.mergeOptions({doubleClickZoom:!0});var DL=Fo.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)}});Ai.addInitHook("addHandler","doubleClickZoom",DL),Ai.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var EL=Fo.extend({addHooks:function(){if(!this._draggable){var l=this._map;this._draggable=new ta(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))}Te(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){H(this._map._container,"leaflet-grab"),H(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=Xt(this._map.options.maxBounds);this._offsetLimit=At(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,E=(b+d+m)%l-d-m,U=Math.abs(I+m)<Math.abs(E+m)?I:E;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=U},_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]),E=(this._lastTime-this._times[0])/1e3,U=m.easeLinearity,ie=I.multiplyBy(U/E),de=ie.distanceTo([0,0]),ze=Math.min(m.inertiaMaxSpeed,de),Ht=ie.multiplyBy(ze/de),wi=ze/(m.inertiaDeceleration*U),Zi=Ht.multiplyBy(-wi/2).round();!Zi.x&&!Zi.y?d.fire("moveend"):(Zi=d._limitOffset(Zi,d.options.maxBounds),ve(function(){d.panBy(Zi,{duration:wi,easeLinearity:U,noMoveStart:!0,animate:!0})}))}}});Ai.addInitHook("addHandler","dragging",EL),Ai.mergeOptions({keyboard:!0,keyboardPanDelta:80});var PL=Fo.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(),Jt(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(){Jt(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=Re(b).multiplyBy(3)),m.options.maxBounds&&(b=m._limitOffset(Re(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;Ps(l)}}});Ai.addInitHook("addHandler","keyboard",PL),Ai.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var TL=Fo.extend({addHooks:function(){et(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){Jt(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(l){var d=kr(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),Ps(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,E=m?Math.ceil(I/m)*m:I,U=l._limitZoom(d+(this._delta>0?E:-E))-d;this._delta=0,this._startTime=null,U&&(l.options.scrollWheelZoom==="center"?l.setZoom(d+U):l.setZoomAround(this._lastMousePos,d+U))}});Ai.addInitHook("addHandler","scrollWheelZoom",TL);var XR=600;Ai.mergeOptions({tapHold:ue.touchNative&&ue.safari&&ue.mobile,tapTolerance:15});var ML=Fo.extend({addHooks:function(){et(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Jt(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 Ne(d.clientX,d.clientY),this._holdTimeout=setTimeout(r(function(){this._cancel(),this._isTapValid()&&(et(document,"touchend",Yi),et(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",d))},this),XR),et(document,"touchend touchcancel contextmenu",this._cancel,this),et(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function l(){Jt(document,"touchend",Yi),Jt(document,"touchend touchcancel",l)},_cancel:function(){clearTimeout(this._holdTimeout),Jt(document,"touchend touchcancel contextmenu",this._cancel,this),Jt(document,"touchmove",this._onMove,this)},_onMove:function(l){var d=l.touches[0];this._newPos=new Ne(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)}});Ai.addInitHook("addHandler","tapHold",ML),Ai.mergeOptions({touchZoom:ue.touch,bounceAtZoomLimits:!0});var NL=Fo.extend({addHooks:function(){Te(this._map._container,"leaflet-touch-zoom"),et(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){H(this._map._container,"leaflet-touch-zoom"),Jt(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),Yi(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 E=m._add(b)._divideBy(2)._subtract(this._centerPoint);if(I===1&&E.x===0&&E.y===0)return;this._center=d.unproject(d.project(this._pinchStartLatLng,this._zoom).subtract(E),this._zoom)}this._moved||(d._moveStart(!0,!1),this._moved=!0),st(this._animRequest);var U=r(d._move,d,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=ve(U,this,!0),Yi(l)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,st(this._animRequest),Jt(document,"touchmove",this._onTouchMove,this),Jt(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))}});Ai.addInitHook("addHandler","touchZoom",NL),Ai.BoxZoom=IL,Ai.DoubleClickZoom=DL,Ai.Drag=EL,Ai.Keyboard=PL,Ai.ScrollWheelZoom=TL,Ai.TapHold=ML,Ai.TouchZoom=NL,t.Bounds=ot,t.Browser=ue,t.CRS=Li,t.Canvas=CL,t.Circle=ro,t.CircleMarker=oo,t.Class=yt,t.Control=es,t.DivIcon=yL,t.DivOverlay=ia,t.DomEvent=Cl,t.DomUtil=Pt,t.Draggable=ta,t.Evented=Qt,t.FeatureGroup=di,t.GeoJSON=Kn,t.GridLayer=$g,t.Handler=Fo,t.Icon=qi,t.ImageOverlay=Lm,t.LatLng=zt,t.LatLngBounds=ni,t.Layer=fi,t.LayerGroup=xi,t.LineUtil=oe,t.Map=Ai,t.Marker=Ms,t.Mixin=qy,t.Path=cs,t.Point=Ne,t.PolyUtil=bm,t.Polygon=Ho,t.Polyline=gs,t.Popup=km,t.PosAnimation=Oa,t.Projection=tt,t.Rectangle=kL,t.Renderer=Ha,t.SVG=Kg,t.SVGOverlay=bL,t.TileLayer=Fh,t.Tooltip=Im,t.Transformation=Bn,t.Util=Ot,t.VideoOverlay=vL,t.bind=r,t.bounds=At,t.canvas=xL,t.circle=ao,t.circleMarker=Jo,t.control=Ts,t.divIcon=$R,t.extend=n,t.featureGroup=un,t.geoJSON=Oh,t.geoJson=WR,t.gridLayer=qR,t.icon=Zn,t.imageOverlay=BR,t.latLng=vt,t.latLngBounds=Xt,t.layerGroup=Pi,t.map=Xs,t.marker=Yo,t.point=Re,t.polygon=jg,t.polyline=xl,t.popup=jR,t.rectangle=ZR,t.setOptions=w,t.stamp=c,t.svg=LL,t.svgOverlay=VR,t.tileLayer=wL,t.tooltip=UR,t.transformation=nn,t.version=i,t.videoOverlay=zR;var YR=window.L;t.noConflict=function(){return window.L=YR,this},window.L=t}))})(Cf,Cf.exports)),Cf.exports}var SG=wG();const of=yR(SG),CG="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=",xG="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==",LG="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC",Fn=(o,e=py)=>{var t=kG(),i=x(C(t),2),n=C(i);G(()=>q(n,e())),T(o,t)};var kG=R('<span class="tip svelte-767znw"><span class="tip-icon svelte-767znw">ℹ</span> <span class="tip-box svelte-767znw"> </span></span>'),IG=R("<button> </button>"),DG=R('<span class="err svelte-767znw"> </span>'),EG=R('<span class="ok svelte-767znw"> </span>'),PG=R('<div class="loading svelte-767znw">Loading…</div>'),TG=R('<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>'),MG=R('<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),NG=R('<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">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>'),RG=R('<div class="field svelte-767znw"><label class="svelte-767znw"> <!></label> <input type="password" placeholder="Enter new password" autocomplete="new-password" class="svelte-767znw"/></div>'),AG=R('<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),OG=R('<div class="field-error svelte-767znw"> </div>'),FG=R('<div class="field-ok svelte-767znw"> </div>'),HG=R('<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>'),WG=R('<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>'),BG=R('<section id="sec-scripts" class="svelte-767znw"><h3 class="svelte-767znw">Scripts</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Scripts directory <!></label> <input type="text" class="svelte-767znw"/></div> <div class="field field--check svelte-767znw"><span></span> <label class="check-label svelte-767znw"><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> Disable file watching <!></label></div></section>'),zG=R('<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>'),VG=R('<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>'),jG=R('<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>'),UG=R('<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>'),$G=R('<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>'),qG=R('<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>'),KG=R('<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>'),GG=R("<option> </option>"),ZG=R('<span class="free-badge svelte-767znw">FREE</span> ',1),XG=R(' — <a target="_blank" rel="noreferrer" class="svelte-767znw">Get API key ↗</a>',1),YG=R("<div><!> <!></div>"),JG=R('<div class="field svelte-767znw"><label class="svelte-767znw">Base URL <!></label> <input type="text" class="svelte-767znw"/></div>'),QG=R('<div class="field svelte-767znw"><label class="svelte-767znw">API key <!></label> <input type="password" placeholder="sk-…" autocomplete="off" class="svelte-767znw"/></div>'),e9=R('<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>'),t9=R('<div class="config-form svelte-767znw"><!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!></div>'),i9=R('<!> <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 n9(o,e){Ro(e,!0),delete of.Icon.Default.prototype._getIconUrl,of.Icon.Default.mergeOptions({iconUrl:CG,iconRetinaUrl:xG,shadowUrl:LG});let t=B(Si(vG())),i=B("~/.she"),n=B("mqtt"),s=B(""),r=B(""),a=B(""),c=B(""),h=B(""),g=B(""),f=B("logic"),p=B("var"),v=B(!1),_=B(8080),w=B(""),S=B("none"),D=B(""),P=B("X-Remote-User"),N=B(""),V=B(!1),F=B(""),Y=B(""),X=B(""),me=B(!1),Le=B(!1),je=B(!1),ve=B(48.7408),st=B(9.1778),Ot=B(!1),yt=B(void 0),ai=B(!1),jt=B(null),Qt=B("info"),Ne=B(""),Ge=B(""),Re=B(!1),ot=B(!1),At=B("");const ni=[{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 Xt=B("ollama"),zt=B("ollama"),vt=B(""),Li=B(""),vi=B("");const Tn={};let Gi="ollama";function Bn(j,pe){return j==="anthropic"?"anthropic":j==="ollama"?"ollama":pe?pe.includes("localhost:1234")?"lmstudio":pe.includes("groq.com")?"groq":pe.includes("googleapis.com")?"gemini":"openai":"openai"}function nn(){Tn[Gi]={baseUrl:u(vt),model:u(Li),apiKey:u(vi)};const j=ni.find(Ue=>Ue.id===u(Xt));if(!j)return;k(zt,j.provider,!0);const pe=Tn[u(Xt)];k(vt,(pe==null?void 0:pe.baseUrl)??j.baseUrl,!0),k(Li,(pe==null?void 0:pe.model)??j.defaultModel,!0),k(vi,(pe==null?void 0:pe.apiKey)??"",!0),Gi=u(Xt)}const Ei=rt(()=>ni.find(j=>j.id===u(Xt)));let Mn=B(Si({}));const sn=new Set(["url","name","variablePrefix","disableVariables","mqttUsername","mqttPassword","mqttCa","mqttCert","mqttKey","port","bindAddress","auth","password","proxyHeader","proxyLogoutUrl","dir","disableWatch","gitAutoCommit","gitAutoPush","latitude","longitude","verbosity","dbPath","dbPrefix","dbPublish","dbRetain","redis","ai"]);zn(()=>{if(!u(yt))return;const j=typeof u(ve)=="number"?u(ve):48.7408,pe=typeof u(st)=="number"?u(st):9.1778,Ue=of.map(u(yt)).setView([j,pe],10);of.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'}).addTo(Ue);const Ce=of.marker([j,pe],{draggable:!0}).addTo(Ue);k(jt,Ce,!0);const De=Xe=>{k(ve,+Xe.lat.toFixed(6)),k(st,+Xe.lng.toFixed(6))};return Ce.on("dragend",()=>De(Ce.getLatLng())),Ue.on("click",Xe=>{Ce.setLatLng(Xe.latlng),De(Xe.latlng)}),()=>{k(jt,null),Ue.remove()}}),zn(()=>{!u(jt)||u(ve)===""||u(st)===""||u(jt).setLatLng([Number(u(ve)),Number(u(st))])});let Sn;function Xi(){if(!navigator.geolocation){Sn.show("Geolocation is not supported by this browser.",{alert:!0});return}k(ai,!0),navigator.geolocation.getCurrentPosition(j=>{k(ve,+j.coords.latitude.toFixed(6)),k(st,+j.coords.longitude.toFixed(6)),k(ai,!1)},()=>{k(ai,!1)})}let Hi=B(!0),dn=B(!1),Nn=B(""),Rn=B(""),$n=B(""),Cn=B("appearance");const pn=[{id:"appearance",label:"Appearance",terms:["theme","color","dark","light"]},{id:"auth",label:"Authentication",terms:["auth","password","login","proxy","header","nginx","authentik","secure"]},{id:"mqtt",label:"MQTT",terms:["broker","url","client","name","variable","prefix"]},{id:"webserver",label:"Web server",terms:["port","http","server","bind","address"]},{id:"scripts",label:"Scripts",terms:["directory","watch","hot reload","dir"]},{id:"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 on=rt(()=>pn.filter(j=>{const pe=u($n).trim().toLowerCase();return!pe||j.label.toLowerCase().includes(pe)||j.terms.some(Ue=>Ue.includes(pe))}));function qe(j){var pe;k(Cn,j,!0),(pe=document.getElementById("sec-"+j))==null||pe.scrollIntoView({behavior:"smooth",block:"start"})}xr(async()=>{try{const j=await wf();j.dataDir&&k(i,j.dataDir,!0)}catch{}try{const j=await iL();if(typeof j.url=="string"&&j.url)try{const Ce=new URL(j.url);k(n,Ce.protocol.replace(":",""),!0),k(s,Ce.host,!0)}catch{k(s,j.url,!0)}typeof j.mqttUsername=="string"&&k(r,j.mqttUsername,!0),typeof j.mqttPassword=="string"&&k(a,j.mqttPassword,!0),typeof j.mqttCa=="string"&&k(c,j.mqttCa,!0),typeof j.mqttCert=="string"&&k(h,j.mqttCert,!0),typeof j.mqttKey=="string"&&k(g,j.mqttKey,!0),typeof j.name=="string"&&k(f,j.name,!0),typeof j.variablePrefix=="string"&&k(p,j.variablePrefix,!0),typeof j.disableVariables=="boolean"&&k(v,j.disableVariables,!0),typeof j.port=="number"&&k(_,j.port,!0),typeof j.bindAddress=="string"&&k(w,j.bindAddress,!0),typeof j.auth=="string"&&k(S,j.auth,!0),typeof j.proxyHeader=="string"&&k(P,j.proxyHeader,!0),typeof j.proxyLogoutUrl=="string"&&k(N,j.proxyLogoutUrl,!0),typeof j.dir=="string"&&k(X,j.dir,!0),typeof j.disableWatch=="boolean"&&k(me,j.disableWatch,!0),typeof j.gitAutoCommit=="boolean"&&k(Le,j.gitAutoCommit,!0),typeof j.gitAutoPush=="boolean"&&k(je,j.gitAutoPush,!0),typeof j.latitude=="number"&&k(ve,j.latitude,!0),typeof j.longitude=="number"&&k(st,j.longitude,!0),typeof j.verbosity=="string"&&k(Qt,j.verbosity,!0),typeof j.dbPath=="string"&&k(Ne,j.dbPath,!0),typeof j.dbPrefix=="string"&&k(Ge,j.dbPrefix,!0),typeof j.dbPublish=="boolean"&&k(Re,j.dbPublish,!0),typeof j.dbRetain=="boolean"&&k(ot,j.dbRetain,!0);const pe=j.redis;pe!=null&&pe.url&&k(At,pe.url,!0);const Ue=j.ai;Ue!=null&&Ue.provider&&k(zt,Ue.provider,!0),Ue!=null&&Ue.baseUrl&&k(vt,Ue.baseUrl,!0),Ue!=null&&Ue.model&&k(Li,Ue.model,!0),Ue!=null&&Ue.apiKey&&k(vi,Ue.apiKey,!0),k(Xt,Bn(u(zt),u(vt)),!0),Gi=u(Xt),k(Mn,Object.fromEntries(Object.entries(j).filter(([Ce])=>!sn.has(Ce))),!0)}catch(j){k(Rn,j.message,!0)}finally{k(Hi,!1)}});async function Ft(){if(k(Y,""),k(F,""),u(S)==="password"&&!u(D)){k(Y,"A password is required to enable password authentication.");return}k(V,!0);try{await K8(u(S),u(S)==="password"?u(D):void 0,u(S)==="proxy"?u(P):void 0,u(S)==="proxy"?u(N):void 0),k(D,""),k(F,"Authentication settings saved.")}catch(j){k(Y,j.message,!0)}finally{k(V,!1)}}async function li(){k(Rn,""),k(Nn,"");const j={...u(Mn)};u(s)&&(j.url=`${u(n)}://${u(s)}`),j.name=u(f),j.variablePrefix=u(p),u(v)&&(j.disableVariables=!0),u(r)&&(j.mqttUsername=u(r)),u(a)&&(j.mqttPassword=u(a)),u(c)&&(j.mqttCa=u(c)),u(h)&&(j.mqttCert=u(h)),u(g)&&(j.mqttKey=u(g)),u(_)!==""&&(j.port=Number(u(_))),u(w)&&(j.bindAddress=u(w)),u(X)&&(j.dir=u(X)),u(me)&&(j.disableWatch=!0),u(Le)&&(j.gitAutoCommit=!0),u(je)&&(j.gitAutoPush=!0),u(ve)!==""&&(j.latitude=Number(u(ve))),u(st)!==""&&(j.longitude=Number(u(st))),j.verbosity=u(Qt),u(Ne)&&(j.dbPath=u(Ne),u(Ge)&&(j.dbPrefix=u(Ge)),u(Re)&&(j.dbPublish=!0,u(ot)&&(j.dbRetain=!0))),u(At)&&(j.redis={url:u(At)}),u(zt)&&(j.ai={provider:u(zt),...u(vt)?{baseUrl:u(vt)}:{},...u(Li)?{model:u(Li)}:{},...u(vi)?{apiKey:u(vi)}:{}}),k(dn,!0);try{const pe=await s7(j);window.dispatchEvent(new CustomEvent("she:config-changed")),k(Nn,pe.restartRequired?"Saved — restart required to apply changes.":"Saved.",!0)}catch(pe){k(Rn,pe.message,!0)}finally{k(dn,!1)}}var Ci=i9(),Ii=bt(Ci);bs(Hg(Ii,{}),j=>Sn=j,()=>Sn);var mn=x(Ii,2),xn=C(mn),qn=C(xn),hn=x(C(qn),2),An=x(qn,2);_i(An,21,()=>pn,j=>j.id,(j,pe)=>{var Ue=Fs(),Ce=bt(Ue);{var De=Vt=>{var ft=IG();let ue;var ht=C(ft);G(()=>{ue=$t(ft,1,"section-link svelte-767znw",null,ue,{active:u(Cn)===u(pe).id}),q(ht,u(pe).label)}),te("click",ft,()=>qe(u(pe).id)),T(Vt,ft)},Xe=rt(()=>u(on).some(Vt=>Vt.id===u(pe).id));$(Ce,Vt=>{u(Xe)&&Vt(De)})}T(j,Ue)});var rn=x(xn,2),Ln=C(rn),Ae=x(C(Ln),2);{var Z=j=>{var pe=DG(),Ue=C(pe);G(()=>q(Ue,u(Rn))),T(j,pe)};$(Ae,j=>{u(Rn)&&j(Z)})}var Fe=x(Ae,2);{var wt=j=>{var pe=EG(),Ue=C(pe);G(()=>q(Ue,u(Nn))),T(j,pe)};$(Fe,j=>{u(Nn)&&j(wt)})}var Dt=x(Fe,2),Nt=C(Dt),O=x(Ln,2);{var se=j=>{var pe=PG();T(j,pe)},be=j=>{var pe=t9(),Ue=C(pe);{var Ce=re=>{var Je=TG(),Oe=x(C(Je),2),xe=x(C(Oe),2),St=C(xe);St.value=St.__value="dark";var Te=x(St);Te.value=Te.__value="light";var H=x(Te);H.value=H.__value="system",te("change",xe,()=>bG(u(t))),_a(xe,()=>u(t),J=>k(t,J)),T(re,Je)},De=rt(()=>u(on).some(re=>re.id==="appearance"));$(Ue,re=>{u(De)&&re(Ce)})}var Xe=x(Ue,2);{var Vt=re=>{var Je=NG(),Oe=x(C(Je),2),xe=C(Oe),St=x(C(xe));Fn(St,()=>"Transport protocol. Use mqtts or wss for TLS encryption.");var Te=x(xe,2),H=C(Te);H.value=H.__value="mqtt";var J=x(H);J.value=J.__value="mqtts";var ke=x(J);ke.value=ke.__value="ws";var Ke=x(ke);Ke.value=Ke.__value="wss";var nt=x(Oe,2),at=C(nt),ut=x(C(at));Fn(ut,()=>"Hostname and optional port of the MQTT broker. Example: 192.168.1.1:1883. Leave empty to run without MQTT.");var ye=x(at,2),Et=x(nt,2),dt=C(Et),he=x(C(dt));Fn(he,()=>"MQTT broker username. Leave empty if the broker does not require authentication.");var Ct=x(dt,2),Ze=x(Et,2),Ie=C(Ze),le=x(C(Ie));Fn(le,()=>"MQTT broker password. Stored in plain text in config.json.");var _e=x(Ie,2),Qe=x(Ze,2);{var Bt=ri=>{var On=MG(),Yi=bt(On),Ps=C(Yi),Oo=x(C(Ps));Fn(Oo,()=>"PEM-encoded CA certificate to verify the broker's TLS certificate. Leave empty to use the system's default CA store.");var Lr=x(Ps,2),Aa=x(Yi,2),kr=C(Aa),Qr=x(C(kr));Fn(Qr,()=>"PEM-encoded client certificate for mutual TLS authentication.");var Cl=x(kr,2),Oa=x(Aa,2),Ai=C(Oa),Xs=x(C(Ai));Fn(Xs,()=>"PEM-encoded private key matching the client certificate.");var es=x(Ai,2);Ni(Lr,()=>u(c),Ts=>k(c,Ts)),Ni(Cl,()=>u(h),Ts=>k(h,Ts)),Ni(es,()=>u(g),Ts=>k(g,Ts)),T(ri,On)};$(Qe,ri=>{(u(n)==="mqtts"||u(n)==="wss")&&ri(Bt)})}var fe=x(Qe,2),$e=C(fe),gt=x(C($e));Fn(gt,()=>'MQTT client ID and topic prefix used for the "connected" status message. Default: she');var Pt=x($e,2),et=x(fe,2),ci=C(et),Jt=x(C(ci));Fn(Jt,()=>"Topic prefix for the variable system (var/set/name → var/status/name). Default: var");var Gn=x(ci,2),$i=x(et,2),oi=x(C($i),2),Gt=C(oi),_n=x(Gt,4);Fn(_n,()=>"When enabled, var/set/… messages are not processed and no var/status/… retained messages are published."),_a(Te,()=>u(n),ri=>k(n,ri)),Ni(ye,()=>u(s),ri=>k(s,ri)),Ni(Ct,()=>u(r),ri=>k(r,ri)),Ni(_e,()=>u(a),ri=>k(a,ri)),Ni(Pt,()=>u(f),ri=>k(f,ri)),Ni(Gn,()=>u(p),ri=>k(p,ri)),As(Gt,()=>u(v),ri=>k(v,ri)),T(re,Je)},ft=rt(()=>u(on).some(re=>re.id==="mqtt"));$(Xe,re=>{u(ft)&&re(Vt)})}var ue=x(Xe,2);{var ht=re=>{var Je=HG(),Oe=x(C(Je),2),xe=C(Oe),St=x(C(xe));Fn(St,()=>"none: no authentication required. password: single-user password login. proxy: trust a header set by nginx/authentik.");var Te=x(xe,2),H=C(Te);H.value=H.__value="none";var J=x(H);J.value=J.__value="password";var ke=x(J);ke.value=ke.__value="proxy";var Ke=x(Oe,2);{var nt=le=>{var _e=RG(),Qe=C(_e),Bt=C(Qe),fe=x(Bt);Fn(fe,()=>"Set a new password. Leave empty to keep the current password (if already set).");var $e=x(Qe,2);G(()=>q(Bt,`${u(D)?"New password":"Password"} `)),Ni($e,()=>u(D),gt=>k(D,gt)),T(le,_e)};$(Ke,le=>{u(S)==="password"&&le(nt)})}var at=x(Ke,2);{var ut=le=>{var _e=AG(),Qe=bt(_e),Bt=C(Qe),fe=x(C(Bt));Fn(fe,()=>"The HTTP header that nginx/authentik sets after successful authentication. Default: X-Remote-User");var $e=x(Bt,2),gt=x(Qe,2),Pt=C(gt),et=x(C(Pt));Fn(et,()=>"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 ci=x(Pt,2);Ni($e,()=>u(P),Jt=>k(P,Jt)),Ni(ci,()=>u(N),Jt=>k(N,Jt)),T(le,_e)};$(at,le=>{u(S)==="proxy"&&le(ut)})}var ye=x(at,2);{var Et=le=>{var _e=OG(),Qe=C(_e);G(()=>q(Qe,u(Y))),T(le,_e)};$(ye,le=>{u(Y)&&le(Et)})}var dt=x(ye,2);{var he=le=>{var _e=FG(),Qe=C(_e);G(()=>q(Qe,u(F))),T(le,_e)};$(dt,le=>{u(F)&&le(he)})}var Ct=x(dt,2),Ze=x(C(Ct),2),Ie=C(Ze);G(()=>{Ze.disabled=u(V)||u(S)==="password"&&!u(D),q(Ie,u(V)?"Saving…":"Apply authentication settings")}),_a(Te,()=>u(S),le=>k(S,le)),te("click",Ze,Ft),T(re,Je)},ii=rt(()=>u(on).some(re=>re.id==="auth"));$(ue,re=>{u(ii)&&re(ht)})}var Kt=x(ue,2);{var si=re=>{var Je=WG(),Oe=x(C(Je),2),xe=C(Oe),St=x(C(xe));Fn(St,()=>"HTTP server port. Use 0 to let the OS pick a free port. Default: 8080");var Te=x(xe,2),H=x(Oe,2),J=C(H),ke=x(C(J));Fn(ke,()=>"Interface she listens on. Use 127.0.0.1 when running behind nginx (recommended with proxy auth). Default: 0.0.0.0");var Ke=x(J,2);Ni(Te,()=>u(_),nt=>k(_,nt)),Ni(Ke,()=>u(w),nt=>k(w,nt)),T(re,Je)},ui=rt(()=>u(on).some(re=>re.id==="webserver"));$(Kt,re=>{u(ui)&&re(si)})}var Q=x(Kt,2);{var ge=re=>{var Je=BG(),Oe=x(C(Je),2),xe=C(Oe),St=x(C(xe));Fn(St,()=>"Directory that is watched for .js script files. Defaults to {dataDir}/scripts");var Te=x(xe,2),H=x(Oe,2),J=x(C(H),2),ke=C(J),Ke=x(ke,4);Fn(Ke,()=>"When enabled the daemon will not watch for file changes and will not hot-reload scripts."),G(()=>Hn(Te,"placeholder",`${u(i)??""}/scripts (default)`)),Ni(Te,()=>u(X),nt=>k(X,nt)),As(ke,()=>u(me),nt=>k(me,nt)),T(re,Je)},We=rt(()=>u(on).some(re=>re.id==="scripts"));$(Q,re=>{u(We)&&re(ge)})}var it=x(Q,2);{var xt=re=>{var Je=zG(),Oe=x(C(Je),2),xe=x(C(Oe),2),St=C(xe),Te=x(St,4);Fn(Te,()=>"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 H=x(Oe,2),J=x(C(H),2),ke=C(J),Ke=x(ke,4);Fn(Ke,()=>"When enabled, every commit (manual or automatic) is immediately pushed to the remote."),As(St,()=>u(Le),nt=>k(Le,nt)),As(ke,()=>u(je),nt=>k(je,nt)),T(re,Je)},Ye=rt(()=>u(on).some(re=>re.id==="git"));$(it,re=>{u(Ye)&&re(xt)})}var pt=x(it,2);{var ei=re=>{var Je=jG(),Oe=x(C(Je),2),xe=C(Oe),St=x(C(xe));Fn(St,()=>"Geographic latitude used for sunrise/sunset calculations. Default: 48.7408 (Stuttgart)");var Te=x(xe,2),H=x(Oe,2),J=C(H),ke=x(C(J));Fn(ke,()=>"Geographic longitude used for sunrise/sunset calculations. Default: 9.1778 (Stuttgart)");var Ke=x(J,2),nt=x(H,2),at=x(C(nt),2),ut=C(at),ye=C(ut);{var Et=le=>{var _e=Ur("…");T(le,_e)},dt=le=>{var _e=Ur("📍 Use my location");T(le,_e)};$(ye,le=>{u(ai)?le(Et):le(dt,-1)})}var he=x(ut,2),Ct=C(he),Ze=x(nt,2);{var Ie=le=>{var _e=VG(),Qe=x(C(_e),2);bs(Qe,Bt=>k(yt,Bt),()=>u(yt)),T(le,_e)};$(Ze,le=>{u(Ot)&&le(Ie)})}G(()=>{ut.disabled=u(ai),q(Ct,u(Ot)?"Hide map":"Pick on map")}),Ni(Te,()=>u(ve),le=>k(ve,le)),Ni(Ke,()=>u(st),le=>k(st,le)),te("click",ut,Xi),te("click",he,()=>k(Ot,!u(Ot))),T(re,Je)},Ut=rt(()=>u(on).some(re=>re.id==="solar"));$(pt,re=>{u(Ut)&&re(ei)})}var Rt=x(pt,2);{var Oi=re=>{var Je=UG(),Oe=x(C(Je),2),xe=C(Oe),St=x(C(xe));Fn(St,()=>"Minimum log level. debug shows all messages including MQTT traffic details.");var Te=x(xe,2),H=C(Te);H.value=H.__value="debug";var J=x(H);J.value=J.__value="info";var ke=x(J);ke.value=ke.__value="warn";var Ke=x(ke);Ke.value=Ke.__value="error",_a(Te,()=>u(Qt),nt=>k(Qt,nt)),T(re,Je)},an=rt(()=>u(on).some(re=>re.id==="logging"));$(Rt,re=>{u(an)&&re(Oi)})}var Wi=x(Rt,2);{var ti=re=>{var Je=qG(),Oe=x(C(Je),2),xe=C(Oe),St=x(C(xe));Fn(St,()=>"Path to the sheDB data directory. Defaults to {dataDir}/db. Leave empty to disable sheDB.");var Te=x(xe,2),H=x(Oe,2),J=C(H),ke=x(C(J));Fn(ke,()=>"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 Ke=x(J,2),nt=x(H,2),at=x(C(nt),2);let ut;var ye=C(at),Et=x(ye,4);Fn(Et,()=>'When enabled, every document change is published to {dbPrefix}doc/{id}. Individual views can publish independently via their own "mqttpub" setting.');var dt=x(nt,2);{var he=Ct=>{var Ze=$G(),Ie=x(C(Ze),2);let le;var _e=C(Ie),Qe=x(_e,4);Fn(Qe,()=>"When enabled, MQTT messages for document changes are published as retained messages."),G(()=>{le=$t(Ie,1,"check-label svelte-767znw",null,le,{muted:!u(Ne)}),_e.disabled=!u(Ne)}),As(_e,()=>u(ot),Bt=>k(ot,Bt)),T(Ct,Ze)};$(dt,Ct=>{u(Re)&&Ct(he)})}G(()=>{Hn(Te,"placeholder",`defaults to ${u(i)??""}/db`),Ke.disabled=!u(Ne),ut=$t(at,1,"check-label svelte-767znw",null,ut,{muted:!u(Ne)}),ye.disabled=!u(Ne)}),Ni(Te,()=>u(Ne),Ct=>k(Ne,Ct)),Ni(Ke,()=>u(Ge),Ct=>k(Ge,Ct)),As(ye,()=>u(Re),Ct=>k(Re,Ct)),T(re,Je)},ji=rt(()=>u(on).some(re=>re.id==="shedb"));$(Wi,re=>{u(ji)&&re(ti)})}var A=x(Wi,2);{var K=re=>{var Je=KG(),Oe=x(C(Je),2),xe=C(Oe),St=x(C(xe));Fn(St,()=>"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 Te=x(xe,2);Ni(Te,()=>u(At),H=>k(At,H)),T(re,Je)},Ee=rt(()=>u(on).some(re=>re.id==="redis"));$(A,re=>{u(Ee)&&re(K)})}var Pe=x(A,2);{var Be=re=>{var Je=e9(),Oe=x(C(Je),2),xe=C(Oe),St=x(C(xe));Fn(St,()=>"Choose a provider. Free options need a free API key from the provider's website — no credit card required.");var Te=x(xe,2);_i(Te,21,()=>ni,Vn,(he,Ct)=>{var Ze=GG(),Ie=C(Ze),le={};G(()=>{q(Ie,u(Ct).label),le!==(le=u(Ct).id)&&(Ze.value=(Ze.__value=u(Ct).id)??"")}),T(he,Ze)});var H=x(Oe,2);{var J=he=>{var Ct=YG();let Ze;var Ie=C(Ct);{var le=Bt=>{var fe=ZG(),$e=x(bt(fe));G(()=>q($e,` ${u(Ei).freeNote??""}`)),T(Bt,fe)};$(Ie,Bt=>{u(Ei).freeNote&&Bt(le)})}var _e=x(Ie,2);{var Qe=Bt=>{var fe=XG(),$e=x(bt(fe));G(()=>Hn($e,"href",u(Ei).apiKeyUrl)),T(Bt,fe)};$(_e,Bt=>{u(Ei).apiKeyUrl&&Bt(Qe)})}G(()=>Ze=$t(Ct,1,"preset-note svelte-767znw",null,Ze,{free:!!u(Ei).freeNote})),T(he,Ct)};$(H,he=>{var Ct,Ze;((Ct=u(Ei))!=null&&Ct.freeNote||(Ze=u(Ei))!=null&&Ze.apiKeyUrl)&&he(J)})}var ke=x(H,2);{var Ke=he=>{var Ct=JG(),Ze=C(Ct),Ie=x(C(Ze));Fn(Ie,()=>"Base URL of the LLM API. Auto-filled for cloud presets. For Ollama: http://localhost:11434.");var le=x(Ze,2);G(()=>{var _e;return Hn(le,"placeholder",u(Xt)==="ollama"?"http://localhost:11434":u(Xt)==="lmstudio"?"http://localhost:1234":((_e=u(Ei))==null?void 0:_e.baseUrl)??"")}),Ni(le,()=>u(vt),_e=>k(vt,_e)),T(he,Ct)};$(ke,he=>{u(Xt)!=="anthropic"&&he(Ke)})}var nt=x(ke,2),at=C(nt),ut=x(C(at));Fn(ut,()=>"Model identifier. Suggested default is filled in when you choose a preset.");var ye=x(at,2),Et=x(nt,2);{var dt=he=>{var Ct=QG(),Ze=C(Ct),Ie=x(C(Ze));Fn(Ie,()=>"Stored in config.json. Not needed for local providers.");var le=x(Ze,2);Ni(le,()=>u(vi),_e=>k(vi,_e)),T(he,Ct)};$(Et,he=>{u(Xt)!=="ollama"&&u(Xt)!=="lmstudio"&&he(dt)})}G(()=>{var he;return Hn(ye,"placeholder",((he=u(Ei))==null?void 0:he.defaultModel)||"e.g. llama3.2")}),te("change",Te,nn),_a(Te,()=>u(Xt),he=>k(Xt,he)),Ni(ye,()=>u(Li),he=>k(Li,he)),T(re,Je)},Me=rt(()=>u(on).some(re=>re.id==="ai"));$(Pe,re=>{u(Me)&&re(Be)})}T(j,pe)};$(O,j=>{u(Hi)?j(se):j(be,-1)})}G(()=>{Dt.disabled=u(dn),q(Nt,u(dn)?"Saving…":"Save")}),Ni(hn,()=>u($n),j=>k($n,j)),te("click",Dt,li),T(o,Ci),Ao()}Cr(["click","change"]);var s9=R("<option> </option>"),o9=R('<div><span class="ts svelte-18loop9"> </span> <span class="lvl svelte-18loop9"> </span> <span class="msg svelte-18loop9"> </span></div>'),r9=R('<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 a9(o,e){Ro(e,!0);let t=B(Si(C7())),i,n=B(!0),s=B("all"),r=B(""),a=B(!1);const c=["all","debug","info","warn","error"],h={debug:0,info:1,warn:2,error:3};bR(X=>{k(t,[...u(t).slice(-1999),X],!0)}),xr(()=>{i&&(i.scrollTop=i.scrollHeight)}),zn(()=>{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=r9(),_=C(v),w=x(C(_),2);_i(w,21,()=>c,Vn,(X,me)=>{var Le=s9(),je=C(Le),ve={};G(()=>{q(je,u(me)),ve!==(ve=u(me))&&(Le.value=(Le.__value=u(me))??"")}),T(X,Le)});var S=x(w,2),D=x(S,2),P=C(D),N=x(D,2),V=C(N),F=x(N,2),Y=x(_,2);_i(Y,21,()=>u(t).filter(f),X=>X.ts+X.msg,(X,me)=>{var Le=o9(),je=C(Le),ve=C(je),st=x(je,2),Ot=C(st),yt=x(st,2),ai=C(yt);G((jt,Qt)=>{$t(Le,1,`line ${u(me).level??""}`,"svelte-18loop9"),q(ve,jt),q(Ot,Qt),q(ai,u(me).msg)},[()=>p(u(me).ts),()=>u(me).level.toUpperCase()]),T(X,Le)}),bs(Y,X=>i=X,()=>i),_a(w,()=>u(s),X=>k(s,X)),Ni(S,()=>u(r),X=>k(r,X)),As(P,()=>u(a),X=>k(a,X)),As(V,()=>u(n),X=>k(n,X)),te("click",F,g),T(o,v),Ao()}Cr(["click"]);var l9=R('<span class="chat-model svelte-1twuiul"><!></span>'),c9=R('<button class="clear-btn svelte-1twuiul" title="Clear conversation">✕</button>'),d9=R('<div class="unconfigured svelte-1twuiul">Configure an AI provider in the <strong class="svelte-1twuiul">Config</strong> tab to use the AI assistant.</div>'),h9=R('Working on view <code class="svelte-1twuiul"> </code>',1),u9=R('<button class="chip svelte-1twuiul"> </button>'),g9=R('<div class="suggestions svelte-1twuiul"><p class="suggestions-hint svelte-1twuiul"><!></p> <!></div>'),f9=R('<div class="msg-content user-text svelte-1twuiul"> </div>'),BD=R('<div class="tool-event tool-call svelte-1twuiul"><span class="tool-icon svelte-1twuiul">🔧</span><span class="tool-name svelte-1twuiul"> </span></div>'),zD=R('<div class="tool-event tool-result svelte-1twuiul"><span class="tool-icon svelte-1twuiul">✓</span><span class="tool-name svelte-1twuiul"> </span></div>'),VD=R('<div class="tool-events svelte-1twuiul"></div>'),jD=R('<div class="text-block svelte-1twuiul"></div>'),p9=R('<button class="expand-btn svelte-1twuiul"> </button>'),m9=R('<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>'),_9=R('<div class="apply-view-row svelte-1twuiul"><button class="apply-view-btn svelte-1twuiul"> </button></div>'),v9=R('<!> <div class="msg-content svelte-1twuiul"><!> <!></div>',1),b9=R("<div><!></div>"),y9=R('<div class="message assistant svelte-1twuiul"><div class="msg-content svelte-1twuiul"><span class="status-shimmer svelte-1twuiul"> </span></div></div>'),w9=R('<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>'),S9=R('<div class="message assistant streaming svelte-1twuiul"><div class="msg-content svelte-1twuiul"></div></div>'),C9=R('<div class="chat-error svelte-1twuiul"> </div>'),x9=R('<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>'),L9=R('<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>'),k9=R('<button class="stop-btn svelte-1twuiul" title="Stop generation">■</button>'),I9=R('<button class="send-btn svelte-1twuiul">↑</button>'),D9=R('<option class="svelte-1twuiul"> </option>'),E9=R('<select class="model-select svelte-1twuiul"></select>'),P9=R('<span class="model-name svelte-1twuiul"> </span>'),T9=R('<button class="info-btn svelte-1twuiul" title="Model info">ℹ</button>'),M9=R('<div class="model-bar svelte-1twuiul"><span class="model-provider svelte-1twuiul"> </span> <!> <!></div>'),N9=R('<p class="info-status svelte-1twuiul">Loading…</p>'),R9=R('<p class="info-status info-err svelte-1twuiul"> </p>'),A9=R('<dt class="svelte-1twuiul">Ollama version</dt><dd class="svelte-1twuiul"> </dd>',1),O9=R('<dt class="svelte-1twuiul">Family</dt><dd class="svelte-1twuiul"> </dd>',1),F9=R('<dt class="svelte-1twuiul">Parameters</dt><dd class="svelte-1twuiul"> </dd>',1),H9=R('<dt class="svelte-1twuiul">Quantization</dt><dd class="svelte-1twuiul"> </dd>',1),W9=R('<div class="running-model svelte-1twuiul"> </div>'),B9=R('<dt class="svelte-1twuiul">Loaded</dt> <dd class="svelte-1twuiul"></dd>',1),z9=R('<dt class="svelte-1twuiul">Loaded</dt><dd class="dim svelte-1twuiul">Not in memory</dd>',1),V9=R('<dl class="svelte-1twuiul"><!> <!> <!> <!> <!></dl>'),j9=R('<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>'),U9=R('<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 $9(o,e){Ro(e,!0),Xv.registerLanguage("javascript",xR),Wn.use({breaks:!0,gfm:!0});let t=cg(e,"currentView",3,null);const i="she:viewchat:messages";let n=B(Si(JSON.parse(localStorage.getItem(i)??"[]"))),s=B(null),r=B(""),a=B(!1),c=B(""),h=B(null),g=B(Si([])),f=B(Si(localStorage.getItem("she:selectedModel")??""));zn(()=>{localStorage.setItem(i,JSON.stringify(u(n)))});let p=B(Si(new Set)),v=B(!1),_=B(null),w=B(!1),S=B(""),D=null,P=B(0);const N=["[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 V=B(!0),F=B(!0),Y=B(!0),X=B(Si([])),me=B(!0),Le=B(!1),je,ve=B(Si([])),st=B(0),Ot,yt;const ai=rt(()=>({apiref:!1,shedb:u(V),sampleDocs:u(F),tools:u(Y)})),jt=rt(()=>{var A;return((A=u(h))==null?void 0:A.configured)??!1}),Qt=rt(()=>u(st)+new TextEncoder().encode(u(r)).length),Ne=rt(()=>u(me)?t():null);async function Ge(){try{const A=await gR();k(h,A,!0),A.configured&&!u(f)&&k(f,A.model,!0)}catch{}}zn(()=>(window.addEventListener("she:config-changed",Ge),()=>window.removeEventListener("she:config-changed",Ge))),xr(()=>{Ge()}),zn(()=>{u(f)&&localStorage.setItem("she:selectedModel",u(f))}),zn(()=>{var A;(A=u(h))!=null&&A.provider&&fR().then(K=>{k(g,K.models,!0),!u(f)&&K.models.length>0&&k(f,K.models[0],!0)}).catch(()=>{})}),zn(()=>{u(f),k(_,null),k(S,"")}),zn(()=>{const A=u(ai),K=u(Ne),Ee=u(X);u(jt)&&mR({context:A,currentView:K??null,extraFiles:Ee.length>0?Ee:void 0}).then(Pe=>{k(st,new TextEncoder().encode(Pe.prompt).length,!0)}).catch(()=>{})}),zn(()=>{if(!u(a))return;k(P,Math.floor(Math.random()*N.length),!0);const A=setInterval(()=>{k(P,(u(P)+1)%N.length)},1e4);return()=>clearInterval(A)}),zn(()=>{var A;yt&&(u(n).length+(((A=u(s))==null?void 0:A.length)??0),requestAnimationFrame(()=>{yt&&(yt.scrollTop=yt.scrollHeight)}))});function Re(A){const K=[],Ee=/```(\w*)\n([\s\S]*?)```/g;let Pe=0,Be;for(;(Be=Ee.exec(A))!==null;)Be.index>Pe&&K.push({type:"text",text:A.slice(Pe,Be.index)}),K.push({type:"code",lang:Be[1]||"text",text:Be[2].trimEnd()}),Pe=Be.index+Be[0].length;return Pe<A.length&&K.push({type:"text",text:A.slice(Pe)}),K}function ot(A){const K=[],Ee=/```(\w*)\n([\s\S]*?)```/g;let Pe=0,Be;for(;(Be=Ee.exec(A))!==null;)Be.index>Pe&&K.push({type:"text",text:A.slice(Pe,Be.index)}),K.push({type:"code",lang:Be[1]||"text",text:Be[2].trimEnd()}),Pe=Be.index+Be[0].length;const Me=A.slice(Pe),re=Me.match(/```(\w*)\n([\s\S]*)$/);return re?(re.index>0&&K.push({type:"text",text:Me.slice(0,re.index)}),K.push({type:"code",lang:re[1]||"text",text:re[2]})):Me&&K.push({type:"text",text:Me}),K}function At(A){const K={};for(const Ee of A)if(Ee.type==="code"){if(Ee.lang==="filter")K.filter=Ee.text.trim();else if(Gi(Ee.lang)){const Pe=Ee.text.split(`
|
|
217
|
+
*/var yG=Cf.exports,WD;function wG(){return WD||(WD=1,(function(o,e){(function(t,i){i(e)})(yG,(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,E,U;return U=function(){b=!1,I&&(E.apply(m,I),I=!1)},E=function(){b?I=arguments:(l.apply(m,arguments),setTimeout(U,d),b=!0)},E}function g(l,d,m){var b=d[1],I=d[0],E=b-I;return l===b&&m?l:((l-I)%E+E)%E+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 P(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 N=Array.isArray||function(l){return Object.prototype.toString.call(l)==="[object Array]"};function V(l,d){for(var m=0;m<l.length;m++)if(l[m]===d)return m;return-1}var F="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function Y(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||Y("RequestAnimationFrame")||me,je=window.cancelAnimationFrame||Y("CancelAnimationFrame")||Y("CancelRequestAnimationFrame")||function(l){window.clearTimeout(l)};function ve(l,d,m){if(m&&Le===me)l.call(d);else return Le.call(window,r(l,d))}function st(l){l&&je.call(window,l)}var Ot={__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:P,isArray:N,indexOf:V,emptyImageUrl:F,requestFn:Le,cancelFn:je,requestAnimFrame:ve,cancelAnimFrame:st};function yt(){}yt.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&&(ai(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 E=0,U=b._initHooks.length;E<U;E++)b._initHooks[E].call(this)}},d},yt.include=function(l){var d=this.prototype.options;return n(this.prototype,l),l.options&&(this.prototype.options=d,this.mergeOptions(l.options)),this},yt.mergeOptions=function(l){return n(this.prototype.options,l),this},yt.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 ai(l){if(!(typeof L>"u"||!L||!L.Mixin)){l=N(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 jt={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,E=l.length;I<E;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,E=0,U=l.length;E<U;E++)I?this._off(l[E]):this._off(l[E],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,E;if(this._events&&(b=this._events[l],!!b)){if(arguments.length===1){if(this._firingCount)for(I=0,E=b.length;I<E;I++)b[I].fn=f;delete this._events[l];return}if(typeof d!="function"){console.warn("wrong listener type: "+typeof d);return}var U=this._listens(l,d,m);if(U!==!1){var ie=b[U];this._firingCount&&(ie.fn=f,this._events[l]=b=b.slice()),b.splice(U,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 E=0,U=I.length;E<U;E++){var ie=I[E],de=ie.fn;ie.once&&this.off(l,de,ie.ctx),de.call(ie.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 E=this._events&&this._events[l];if(E&&E.length&&this._listens(l,I,m)!==!1)return!0;if(b){for(var U in this._eventParents)if(this._eventParents[U].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,E=b.length;I<E;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,E=l.length;I<E;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)}};jt.addEventListener=jt.on,jt.removeEventListener=jt.clearAllEventListeners=jt.off,jt.addOneTimeEventListener=jt.once,jt.fireEvent=jt.fire,jt.hasEventListeners=jt.listens;var Qt=yt.extend(jt);function Ne(l,d,m){this.x=m?Math.round(l):l,this.y=m?Math.round(d):d}var Ge=Math.trunc||function(l){return l>0?Math.floor(l):Math.ceil(l)};Ne.prototype={clone:function(){return new Ne(this.x,this.y)},add:function(l){return this.clone()._add(Re(l))},_add:function(l){return this.x+=l.x,this.y+=l.y,this},subtract:function(l){return this.clone()._subtract(Re(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 Ne(this.x*l.x,this.y*l.y)},unscaleBy:function(l){return new Ne(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=Ge(this.x),this.y=Ge(this.y),this},distanceTo:function(l){l=Re(l);var d=l.x-this.x,m=l.y-this.y;return Math.sqrt(d*d+m*m)},equals:function(l){return l=Re(l),l.x===this.x&&l.y===this.y},contains:function(l){return l=Re(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 Re(l,d,m){return l instanceof Ne?l:N(l)?new Ne(l[0],l[1]):l==null?l:typeof l=="object"&&"x"in l&&"y"in l?new Ne(l.x,l.y):new Ne(l,d,m)}function ot(l,d){if(l)for(var m=d?[l,d]:l,b=0,I=m.length;b<I;b++)this.extend(m[b])}ot.prototype={extend:function(l){var d,m;if(!l)return this;if(l instanceof Ne||typeof l[0]=="number"||"x"in l)d=m=Re(l);else if(l=At(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 Re((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,l)},getBottomLeft:function(){return Re(this.min.x,this.max.y)},getTopRight:function(){return Re(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 Ne?l=Re(l):l=At(l),l instanceof ot?(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=At(l);var d=this.min,m=this.max,b=l.min,I=l.max,E=I.x>=d.x&&b.x<=m.x,U=I.y>=d.y&&b.y<=m.y;return E&&U},overlaps:function(l){l=At(l);var d=this.min,m=this.max,b=l.min,I=l.max,E=I.x>d.x&&b.x<m.x,U=I.y>d.y&&b.y<m.y;return E&&U},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 At(Re(d.x-b,d.y-I),Re(m.x+b,m.y+I))},equals:function(l){return l?(l=At(l),this.min.equals(l.getTopLeft())&&this.max.equals(l.getBottomRight())):!1}};function At(l,d){return!l||l instanceof ot?l:new ot(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 zt)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(vt(l)||Xt(l)):this;return!d&&!m?(this._southWest=new zt(b.lat,b.lng),this._northEast=new zt(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 zt(d.lat-b,d.lng-I),new zt(m.lat+b,m.lng+I))},getCenter:function(){return new zt((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 zt(this.getNorth(),this.getWest())},getSouthEast:function(){return new zt(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 zt||"lat"in l?l=vt(l):l=Xt(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=Xt(l);var d=this._southWest,m=this._northEast,b=l.getSouthWest(),I=l.getNorthEast(),E=I.lat>=d.lat&&b.lat<=m.lat,U=I.lng>=d.lng&&b.lng<=m.lng;return E&&U},overlaps:function(l){l=Xt(l);var d=this._southWest,m=this._northEast,b=l.getSouthWest(),I=l.getNorthEast(),E=I.lat>d.lat&&b.lat<m.lat,U=I.lng>d.lng&&b.lng<m.lng;return E&&U},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(l,d){return l?(l=Xt(l),this._southWest.equals(l.getSouthWest(),d)&&this._northEast.equals(l.getNorthEast(),d)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function Xt(l,d){return l instanceof ni?l:new ni(l,d)}function zt(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)}zt.prototype={equals:function(l,d){if(!l)return!1;l=vt(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 vi.distance(this,vt(l))},wrap:function(){return vi.wrapLatLng(this)},toBounds:function(l){var d=180*l/40075017,m=d/Math.cos(Math.PI/180*this.lat);return Xt([this.lat-d,this.lng-m],[this.lat+d,this.lng+m])},clone:function(){return new zt(this.lat,this.lng,this.alt)}};function vt(l,d,m){return l instanceof zt?l:N(l)&&typeof l[0]!="object"?l.length===3?new zt(l[0],l[1],l[2]):l.length===2?new zt(l[0],l[1]):null:l==null?l:typeof l=="object"&&"lat"in l?new zt(l.lat,"lng"in l?l.lng:l.lon,l.alt):d===void 0?null:new zt(l,d,m)}var Li={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 ot(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 zt(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 E=l.getSouthWest(),U=l.getNorthEast(),ie=new zt(E.lat-b,E.lng-I),de=new zt(U.lat-b,U.lng-I);return new ni(ie,de)}},vi=n({},Li,{wrapLng:[-180,180],R:6371e3,distance:function(l,d){var m=Math.PI/180,b=l.lat*m,I=d.lat*m,E=Math.sin((d.lat-l.lat)*m/2),U=Math.sin((d.lng-l.lng)*m/2),ie=E*E+Math.cos(b)*Math.cos(I)*U*U,de=2*Math.atan2(Math.sqrt(ie),Math.sqrt(1-ie));return this.R*de}}),Tn=6378137,Gi={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 Ne(this.R*l.lng*d,this.R*Math.log((1+I)/(1-I))/2)},unproject:function(l){var d=180/Math.PI;return new zt((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 ot([-l,-l],[l,l])})()};function Bn(l,d,m,b){if(N(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}Bn.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 Ne((l.x/d-this._b)/this._a,(l.y/d-this._d)/this._c)}};function nn(l,d,m,b){return new Bn(l,d,m,b)}var Ei=n({},vi,{code:"EPSG:3857",projection:Gi,transformation:(function(){var l=.5/(Math.PI*Gi.R);return nn(l,.5,-l,.5)})()}),Mn=n({},Ei,{code:"EPSG:900913"});function sn(l){return document.createElementNS("http://www.w3.org/2000/svg",l)}function Sn(l,d){var m="",b,I,E,U,ie,de;for(b=0,E=l.length;b<E;b++){for(ie=l[b],I=0,U=ie.length;I<U;I++)de=ie[I],m+=(I?"L":"M")+de.x+" "+de.y;m+=d?ue.svg?"z":"x":""}return m||"M0 0"}var Xi=document.documentElement.style,Hi="ActiveXObject"in window,dn=Hi&&!document.addEventListener,Nn="msLaunchUri"in navigator&&!("documentMode"in document),Rn=ft("webkit"),$n=ft("android"),Cn=ft("android 2")||ft("android 3"),pn=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),on=$n&&ft("Google")&&pn<537&&!("AudioNode"in window),qe=!!window.opera,Ft=!Nn&&ft("chrome"),li=ft("gecko")&&!Rn&&!qe&&!Hi,Ci=!Ft&&ft("safari"),Ii=ft("phantom"),mn="OTransition"in Xi,xn=navigator.platform.indexOf("Win")===0,qn=Hi&&"transition"in Xi,hn="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!Cn,An="MozPerspective"in Xi,rn=!window.L_DISABLE_3D&&(qn||hn||An)&&!mn&&!Ii,Ln=typeof orientation<"u"||ft("mobile"),Ae=Ln&&Rn,Z=Ln&&hn,Fe=!window.PointerEvent&&window.MSPointerEvent,wt=!!(window.PointerEvent||Fe),Dt="ontouchstart"in window||!!window.TouchEvent,Nt=!window.L_NO_TOUCH&&(Dt||wt),O=Ln&&qe,se=Ln&&li,be=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,j=(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})(),pe=(function(){return!!document.createElement("canvas").getContext})(),Ue=!!(document.createElementNS&&sn("svg").createSVGRect),Ce=!!Ue&&(function(){var l=document.createElement("div");return l.innerHTML="<svg/>",(l.firstChild&&l.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),De=!Ue&&(function(){try{var l=document.createElement("div");l.innerHTML='<v:shape adj="1"/>';var d=l.firstChild;return d.style.behavior="url(#default#VML)",d&&typeof d.adj=="object"}catch{return!1}})(),Xe=navigator.platform.indexOf("Mac")===0,Vt=navigator.platform.indexOf("Linux")===0;function ft(l){return navigator.userAgent.toLowerCase().indexOf(l)>=0}var ue={ie:Hi,ielt9:dn,edge:Nn,webkit:Rn,android:$n,android23:Cn,androidStock:on,opera:qe,chrome:Ft,gecko:li,safari:Ci,phantom:Ii,opera12:mn,win:xn,ie3d:qn,webkit3d:hn,gecko3d:An,any3d:rn,mobile:Ln,mobileWebkit:Ae,mobileWebkit3d:Z,msPointer:Fe,pointer:wt,touch:Nt,touchNative:Dt,mobileOpera:O,mobileGecko:se,retina:be,passiveEvents:j,canvas:pe,svg:Ue,vml:De,inlineSvg:Ce,mac:Xe,linux:Vt},ht=ue.msPointer?"MSPointerDown":"pointerdown",ii=ue.msPointer?"MSPointerMove":"pointermove",Kt=ue.msPointer?"MSPointerUp":"pointerup",si=ue.msPointer?"MSPointerCancel":"pointercancel",ui={touchstart:ht,touchmove:ii,touchend:Kt,touchcancel:si},Q={touchstart:Oi,touchmove:Rt,touchend:Rt,touchcancel:Rt},ge={},We=!1;function it(l,d,m){return d==="touchstart"&&Ut(),Q[d]?(m=Q[d].bind(this,m),l.addEventListener(ui[d],m,!1),m):(console.warn("wrong event specified:",d),f)}function xt(l,d,m){if(!ui[d]){console.warn("wrong event specified:",d);return}l.removeEventListener(ui[d],m,!1)}function Ye(l){ge[l.pointerId]=l}function pt(l){ge[l.pointerId]&&(ge[l.pointerId]=l)}function ei(l){delete ge[l.pointerId]}function Ut(){We||(document.addEventListener(ht,Ye,!0),document.addEventListener(ii,pt,!0),document.addEventListener(Kt,ei,!0),document.addEventListener(si,ei,!0),We=!0)}function Rt(l,d){if(d.pointerType!==(d.MSPOINTER_TYPE_MOUSE||"mouse")){d.touches=[];for(var m in ge)d.touches.push(ge[m]);d.changedTouches=[d],l(d)}}function Oi(l,d){d.MSPOINTER_TYPE_TOUCH&&d.pointerType===d.MSPOINTER_TYPE_TOUCH&&Yi(d),Rt(l,d)}function an(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 Wi=200;function ti(l,d){l.addEventListener("dblclick",d);var m=0,b;function I(E){if(E.detail!==1){b=E.detail;return}if(!(E.pointerType==="mouse"||E.sourceCapabilities&&!E.sourceCapabilities.firesTouchEvents)){var U=Oo(E);if(!(U.some(function(de){return de instanceof HTMLLabelElement&&de.attributes.for})&&!U.some(function(de){return de instanceof HTMLInputElement||de instanceof HTMLSelectElement}))){var ie=Date.now();ie-m<=Wi?(b++,b===2&&d(an(E))):b=1,m=ie}}}return l.addEventListener("click",I),{dblclick:d,simDblclick:I}}function ji(l,d){l.removeEventListener("dblclick",d.dblclick),l.removeEventListener("click",d.simDblclick)}var A=at(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),K=at(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Ee=K==="webkitTransition"||K==="OTransition"?K+"End":"transitionend";function Pe(l){return typeof l=="string"?document.getElementById(l):l}function Be(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 re(l){var d=l.parentNode;d&&d.removeChild(l)}function Je(l){for(;l.firstChild;)l.removeChild(l.firstChild)}function Oe(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 St(l,d){if(l.classList!==void 0)return l.classList.contains(d);var m=ke(l);return m.length>0&&new RegExp("(^|\\s)"+d+"(\\s|$)").test(m)}function Te(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(!St(l,d)){var E=ke(l);J(l,(E?E+" ":"")+d)}}function H(l,d){l.classList!==void 0?l.classList.remove(d):J(l,v((" "+ke(l)+" ").replace(" "+d+" "," ")))}function J(l,d){l.className.baseVal===void 0?l.className=d:l.className.baseVal=d}function ke(l){return l.correspondingElement&&(l=l.correspondingElement),l.className.baseVal===void 0?l.className:l.className.baseVal}function Ke(l,d){"opacity"in l.style?l.style.opacity=d:"filter"in l.style&&nt(l,d)}function nt(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 at(l){for(var d=document.documentElement.style,m=0;m<l.length;m++)if(l[m]in d)return l[m];return!1}function ut(l,d,m){var b=d||new Ne(0,0);l.style[A]=(ue.ie3d?"translate("+b.x+"px,"+b.y+"px)":"translate3d("+b.x+"px,"+b.y+"px,0)")+(m?" scale("+m+")":"")}function ye(l,d){l._leaflet_pos=d,ue.any3d?ut(l,d):(l.style.left=d.x+"px",l.style.top=d.y+"px")}function Et(l){return l._leaflet_pos||new Ne(0,0)}var dt,he,Ct;if("onselectstart"in document)dt=function(){et(window,"selectstart",Yi)},he=function(){Jt(window,"selectstart",Yi)};else{var Ze=at(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);dt=function(){if(Ze){var l=document.documentElement.style;Ct=l[Ze],l[Ze]="none"}},he=function(){Ze&&(document.documentElement.style[Ze]=Ct,Ct=void 0)}}function Ie(){et(window,"dragstart",Yi)}function le(){Jt(window,"dragstart",Yi)}var _e,Qe;function Bt(l){for(;l.tabIndex===-1;)l=l.parentNode;l.style&&(fe(),_e=l,Qe=l.style.outlineStyle,l.style.outlineStyle="none",et(window,"keydown",fe))}function fe(){_e&&(_e.style.outlineStyle=Qe,_e=void 0,Qe=void 0,Jt(window,"keydown",fe))}function $e(l){do l=l.parentNode;while((!l.offsetWidth||!l.offsetHeight)&&l!==document.body);return l}function gt(l){var d=l.getBoundingClientRect();return{x:d.width/l.offsetWidth||1,y:d.height/l.offsetHeight||1,boundingClientRect:d}}var Pt={__proto__:null,TRANSFORM:A,TRANSITION:K,TRANSITION_END:Ee,get:Pe,getStyle:Be,create:Me,remove:re,empty:Je,toFront:Oe,toBack:xe,hasClass:St,addClass:Te,removeClass:H,setClass:J,getClass:ke,setOpacity:Ke,testProp:at,setTransform:ut,setPosition:ye,getPosition:Et,get disableTextSelection(){return dt},get enableTextSelection(){return he},disableImageDrag:Ie,enableImageDrag:le,preventOutline:Bt,restoreOutline:fe,getSizedParentNode:$e,getScale:gt};function et(l,d,m,b){if(d&&typeof d=="object")for(var I in d)oi(l,I,d[I],m);else{d=_(d);for(var E=0,U=d.length;E<U;E++)oi(l,d[E],m,b)}return this}var ci="_leaflet_events";function Jt(l,d,m,b){if(arguments.length===1)Gn(l),delete l[ci];else if(d&&typeof d=="object")for(var I in d)Gt(l,I,d[I],m);else if(d=_(d),arguments.length===2)Gn(l,function(ie){return V(d,ie)!==-1});else for(var E=0,U=d.length;E<U;E++)Gt(l,d[E],m,b);return this}function Gn(l,d){for(var m in l[ci]){var b=m.split(/\d/)[0];(!d||d(b))&&Gt(l,b,null,null,m)}}var $i={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function oi(l,d,m,b){var I=d+c(m)+(b?"_"+c(b):"");if(l[ci]&&l[ci][I])return this;var E=function(ie){return m.call(b||l,ie||window.event)},U=E;!ue.touchNative&&ue.pointer&&d.indexOf("touch")===0?E=it(l,d,E):ue.touch&&d==="dblclick"?E=ti(l,E):"addEventListener"in l?d==="touchstart"||d==="touchmove"||d==="wheel"||d==="mousewheel"?l.addEventListener($i[d]||d,E,ue.passiveEvents?{passive:!1}:!1):d==="mouseenter"||d==="mouseleave"?(E=function(ie){ie=ie||window.event,Qr(l,ie)&&U(ie)},l.addEventListener($i[d],E,!1)):l.addEventListener(d,U,!1):l.attachEvent("on"+d,E),l[ci]=l[ci]||{},l[ci][I]=E}function Gt(l,d,m,b,I){I=I||d+c(m)+(b?"_"+c(b):"");var E=l[ci]&&l[ci][I];if(!E)return this;!ue.touchNative&&ue.pointer&&d.indexOf("touch")===0?xt(l,d,E):ue.touch&&d==="dblclick"?ji(l,E):"removeEventListener"in l?l.removeEventListener($i[d]||d,E,!1):l.detachEvent("on"+d,E),l[ci][I]=null}function _n(l){return l.stopPropagation?l.stopPropagation():l.originalEvent?l.originalEvent._stopped=!0:l.cancelBubble=!0,this}function ri(l){return oi(l,"wheel",_n),this}function On(l){return et(l,"mousedown touchstart dblclick contextmenu",_n),l._leaflet_disable_click=!0,this}function Yi(l){return l.preventDefault?l.preventDefault():l.returnValue=!1,this}function Ps(l){return Yi(l),_n(l),this}function Oo(l){if(l.composedPath)return l.composedPath();for(var d=[],m=l.target;m;)d.push(m),m=m.parentNode;return d}function Lr(l,d){if(!d)return new Ne(l.clientX,l.clientY);var m=gt(d),b=m.boundingClientRect;return new Ne((l.clientX-b.left)/m.x-d.clientLeft,(l.clientY-b.top)/m.y-d.clientTop)}var Aa=ue.linux&&ue.chrome?window.devicePixelRatio:ue.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function kr(l){return ue.edge?l.wheelDeltaY/2:l.deltaY&&l.deltaMode===0?-l.deltaY/Aa: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 Qr(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 Cl={__proto__:null,on:et,off:Jt,stopPropagation:_n,disableScrollPropagation:ri,disableClickPropagation:On,preventDefault:Yi,stop:Ps,getPropagationPath:Oo,getMousePosition:Lr,getWheelDelta:kr,isExternalTarget:Qr,addListener:et,removeListener:Jt},Oa=Qt.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=Et(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=ve(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(),ye(this._el,m),this.fire("step")},_complete:function(){st(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(l){return 1-Math.pow(1-l,this._easeOutPower)}}),Ai=Qt.extend({options:{crs:Ei,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(vt(d.center),d.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=K&&ue.any3d&&!ue.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),et(this._proxy,Ee,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(vt(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||(ue.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+l,d)},zoomOut:function(l,d){return l=l||(ue.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),E=l instanceof Ne?l:this.latLngToContainerPoint(l),U=E.subtract(I).multiplyBy(1-1/b),ie=this.containerPointToLatLng(I.add(U));return this.setView(ie,d,{zoom:m})},_getBoundsCenterZoom:function(l,d){d=d||{},l=l.getBounds?l.getBounds():Xt(l);var m=Re(d.paddingTopLeft||d.padding||[0,0]),b=Re(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 E=b.subtract(m).divideBy(2),U=this.project(l.getSouthWest(),I),ie=this.project(l.getNorthEast(),I),de=this.unproject(U.add(ie).divideBy(2).add(E),I);return{center:de,zoom:I}},fitBounds:function(l,d){if(l=Xt(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=Re(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 Oa,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),d.noMoveStart||this.fire("movestart"),d.animate!==!1){Te(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||!ue.any3d)return this.setView(l,d,m);this._stop();var b=this.project(this.getCenter()),I=this.project(l),E=this.getSize(),U=this._zoom;l=vt(l),d=d===void 0?U:d;var ie=Math.max(E.x,E.y),de=ie*this.getZoomScale(U,d),ze=I.distanceTo(b)||1,Ht=1.42,wi=Ht*Ht;function Zi(Ss){var Em=Ss?-1:1,iA=Ss?de:ie,nA=de*de-ie*ie+Em*wi*wi*ze*ze,sA=2*iA*wi*ze,Zy=nA/sA,OL=Math.sqrt(Zy*Zy+1)-Zy,oA=OL<1e-9?-18:Math.log(OL);return oA}function lo(Ss){return(Math.exp(Ss)-Math.exp(-Ss))/2}function Ns(Ss){return(Math.exp(Ss)+Math.exp(-Ss))/2}function Qo(Ss){return lo(Ss)/Ns(Ss)}var wo=Zi(0);function Hh(Ss){return ie*(Ns(wo)/Ns(wo+Ht*Ss))}function JR(Ss){return ie*(Ns(wo)*Qo(wo+Ht*Ss)-lo(wo))/wi}function QR(Ss){return 1-Math.pow(1-Ss,1.5)}var eA=Date.now(),RL=(Zi(1)-wo)/Ht,tA=m.duration?1e3*m.duration:1e3*RL*.8;function AL(){var Ss=(Date.now()-eA)/tA,Em=QR(Ss)*RL;Ss<=1?(this._flyToFrame=ve(AL,this),this._move(this.unproject(b.add(I.subtract(b).multiplyBy(JR(Em)/ze)),U),this.getScaleZoom(ie/Hh(Em),U),{flyTo:!0})):this._move(l,d)._moveEnd(!0)}return this._moveStart(!0,m.noMoveStart),AL.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=Xt(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,Xt(l));return m.equals(b)||this.panTo(b,d),this._enforcingBounds=!1,this},panInside:function(l,d){d=d||{};var m=Re(d.paddingTopLeft||d.padding||[0,0]),b=Re(d.paddingBottomRight||d.padding||[0,0]),I=this.project(this.getCenter()),E=this.project(l),U=this.getPixelBounds(),ie=At([U.min.add(m),U.max.subtract(b)]),de=ie.getSize();if(!ie.contains(E)){this._enforcingBounds=!0;var ze=E.subtract(ie.getCenter()),Ht=ie.extend(E).getSize().subtract(de);I.x+=ze.x<0?-Ht.x:Ht.x,I.y+=ze.y<0?-Ht.y:Ht.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(),E=b.subtract(I);return!E.x&&!E.y?this:(l.animate&&l.pan?this.panBy(E):(l.pan&&this._rawPanBy(E),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 zt(d,m),I=b.toBounds(l.coords.accuracy*2),E=this._locateOptions;if(E.setView){var U=this.getBoundsZoom(I);this.setView(b,E.maxZoom?Math.min(U,E.maxZoom):U)}var ie={latlng:b,bounds:I,timestamp:l.timestamp};for(var de in l.coords)typeof l.coords[de]=="number"&&(ie[de]=l.coords[de]);this.fire("locationfound",ie)}},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(),re(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(st(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var l;for(l in this._layers)this._layers[l].remove();for(l in this._panes)re(this._panes[l]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(l,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=Xt(l),m=Re(m||[0,0]);var b=this.getZoom()||0,I=this.getMinZoom(),E=this.getMaxZoom(),U=l.getNorthWest(),ie=l.getSouthEast(),de=this.getSize().subtract(m),ze=At(this.project(ie,b),this.project(U,b)).getSize(),Ht=ue.any3d?this.options.zoomSnap:1,wi=de.x/ze.x,Zi=de.y/ze.y,lo=d?Math.max(wi,Zi):Math.min(wi,Zi);return b=this.getScaleZoom(lo,b),Ht&&(b=Math.round(b/(Ht/100))*(Ht/100),b=d?Math.ceil(b/Ht)*Ht:Math.floor(b/Ht)*Ht),Math.max(I,Math.min(E,b))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new Ne(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 ot(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(vt(l),d)},unproject:function(l,d){return d=d===void 0?this._zoom:d,this.options.crs.pointToLatLng(Re(l),d)},layerPointToLatLng:function(l){var d=Re(l).add(this.getPixelOrigin());return this.unproject(d)},latLngToLayerPoint:function(l){var d=this.project(vt(l))._round();return d._subtract(this.getPixelOrigin())},wrapLatLng:function(l){return this.options.crs.wrapLatLng(vt(l))},wrapLatLngBounds:function(l){return this.options.crs.wrapLatLngBounds(Xt(l))},distance:function(l,d){return this.options.crs.distance(vt(l),vt(d))},containerPointToLayerPoint:function(l){return Re(l).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(l){return Re(l).add(this._getMapPanePos())},containerPointToLatLng:function(l){var d=this.containerPointToLayerPoint(Re(l));return this.layerPointToLatLng(d)},latLngToContainerPoint:function(l){return this.layerPointToContainerPoint(this.latLngToLayerPoint(vt(l)))},mouseEventToContainerPoint:function(l){return Lr(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=Pe(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&&ue.any3d,Te(l,"leaflet-container"+(ue.touch?" leaflet-touch":"")+(ue.retina?" leaflet-retina":"")+(ue.ielt9?" leaflet-oldie":"")+(ue.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var d=Be(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),ye(this._mapPane,new Ne(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(Te(l.markerPane,"leaflet-zoom-hide"),Te(l.shadowPane,"leaflet-zoom-hide"))},_resetView:function(l,d,m){ye(this._mapPane,new Ne(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 st(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(l){ye(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?Jt: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),ue.any3d&&this.options.transform3DLimit&&(l?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){st(this._resizeRequest),this._resizeRequest=ve(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",E=l.target||l.srcElement,U=!1;E;){if(b=this._targets[c(E)],b&&(d==="click"||d==="preclick")&&this._draggableMoved(b)){U=!0;break}if(b&&b.listens(d,!0)&&(I&&!Qr(E,l)||(m.push(b),I))||E===this._container)break;E=E.parentNode}return!m.length&&!U&&!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"&&Bt(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 E=[],U=0;U<m.length;U++)m[U].listens(d,!0)&&E.push(m[U]);I=E.concat(I)}if(I.length){d==="contextmenu"&&Yi(l);var ie=I[0],de={originalEvent:l};if(l.type!=="keypress"&&l.type!=="keydown"&&l.type!=="keyup"){var ze=ie.getLatLng&&(!ie._radius||ie._radius<=10);de.containerPoint=ze?this.latLngToContainerPoint(ie.getLatLng()):this.mouseEventToContainerPoint(l),de.layerPoint=this.containerPointToLayerPoint(de.containerPoint),de.latlng=ze?ie.getLatLng():this.layerPointToLatLng(de.layerPoint)}for(U=0;U<I.length;U++)if(I[U].fire(d,de,!0),de.originalEvent._stopped||I[U].options.bubblingMouseEvents===!1&&V(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 Et(this._mapPane)||new Ne(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 At([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),E=new ot(b.subtract(I),b.add(I)),U=this._getBoundsOffset(E,m,d);return Math.abs(U.x)<=1&&Math.abs(U.y)<=1?l:this.unproject(b.add(U),d)},_limitOffset:function(l,d){if(!d)return l;var m=this.getPixelBounds(),b=new ot(m.min.add(l),m.max.add(l));return l.add(this._getBoundsOffset(b,d))},_getBoundsOffset:function(l,d,m){var b=At(this.project(d.getNorthEast(),m),this.project(d.getSouthWest(),m)),I=b.min.subtract(l.min),E=b.max.subtract(l.max),U=this._rebound(I.x,-E.x),ie=this._rebound(I.y,-E.y);return new Ne(U,ie)},_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=ue.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(){H(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=A,b=this._proxy.style[m];ut(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(){re(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var l=this.getCenter(),d=this.getZoom();ut(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:(ve(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,Te(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&&H(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 Xs(l,d){return new Ai(l,d)}var es=yt.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 Te(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?(re(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(l){this._map&&l&&l.screenX>0&&l.screenY>0&&this._map.getContainer().focus()}}),Ts=function(l){return new es(l)};Ai.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,E){var U=d+I+" "+d+E;l[I+E]=Me("div",U,m)}b("top","left"),b("top","right"),b("bottom","left"),b("bottom","right")},_clearControlPos:function(){for(var l in this._controlCorners)re(this._controlCorners[l]);re(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var Ph=es.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 es.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(){Te(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?(Te(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=l+"px"):H(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return H(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),On(d),ri(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(E){E.keyCode===13&&this._expandSafely()},click:function(E){Yi(E),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;Je(this._baseLayersList),Je(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 E=document.createElement("span");d.appendChild(E),E.appendChild(b),E.appendChild(I);var U=l.overlay?this._overlaysList:this._baseLayersList;return U.appendChild(d),this._checkDisabledLayers(),d},_onInputClick:function(){if(!this._preventClick){var l=this._layerControlInputs,d,m,b=[],I=[];this._handlingClick=!0;for(var E=l.length-1;E>=0;E--)d=l[E],m=this._getLayer(d.layerId).layer,d.checked?b.push(m):d.checked||I.push(m);for(E=0;E<I.length;E++)this._map.hasLayer(I[E])&&this._map.removeLayer(I[E]);for(E=0;E<b.length;E++)this._map.hasLayer(b[E])||this._map.addLayer(b[E]);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",Yi),this.expand();var d=this;setTimeout(function(){Jt(l,"click",Yi),d._preventClick=!1})}}),Th=function(l,d,m){return new Ph(l,d,m)},Ec=es.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">−</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 E=Me("a",m,b);return E.innerHTML=l,E.href="#",E.title=d,E.setAttribute("role","button"),E.setAttribute("aria-label",d),On(E),et(E,"click",Ps),et(E,"click",I,this),et(E,"click",this._refocusOnMap,this),E},_updateDisabled:function(){var l=this._map,d="leaflet-disabled";H(this._zoomInButton,d),H(this._zoomOutButton,d),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||l._zoom===l.getMinZoom())&&(Te(this._zoomOutButton,d),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||l._zoom===l.getMaxZoom())&&(Te(this._zoomInButton,d),this._zoomInButton.setAttribute("aria-disabled","true"))}});Ai.mergeOptions({zoomControl:!0}),Ai.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Ec,this.addControl(this.zoomControl))});var Xo=function(l){return new Ec(l)},ea=es.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}}),$y=function(l){return new ea(l)},pm='<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>',Mh=es.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(ue.inlineSvg?pm+" ":"")+"Leaflet</a>"},initialize:function(l){w(this,l),this._attributions={}},onAdd:function(l){l.attributionControl=this,this._container=Me("div","leaflet-control-attribution"),On(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> ')}}});Ai.mergeOptions({attributionControl:!0}),Ai.addInitHook(function(){this.options.attributionControl&&new Mh().addTo(this)});var mm=function(l){return new Mh(l)};es.Layers=Ph,es.Zoom=Ec,es.Scale=ea,es.Attribution=Mh,Ts.layers=Th,Ts.zoom=Xo,Ts.scale=$y,Ts.attribution=mm;var Fo=yt.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}});Fo.addTo=function(l,d){return l.addHandler(d,this),this};var qy={Events:jt},Bg=ue.touch?"touchstart mousedown":"mousedown",ta=Qt.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,Bg,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(ta._dragging===this&&this.finishDrag(!0),Jt(this._dragStartTarget,Bg,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(l){if(this._enabled&&(this._moved=!1,!St(this._element,"leaflet-zoom-anim"))){if(l.touches&&l.touches.length!==1){ta._dragging===this&&this.finishDrag();return}if(!(ta._dragging||l.shiftKey||l.which!==1&&l.button!==1&&!l.touches)&&(ta._dragging=this,this._preventOutline&&Bt(this._element),Ie(),dt(),!this._moving)){this.fire("down");var d=l.touches?l.touches[0]:l,m=$e(this._element);this._startPoint=new Ne(d.clientX,d.clientY),this._startPos=Et(this._element),this._parentScale=gt(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 Ne(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,Yi(l),this._moved||(this.fire("dragstart"),this._moved=!0,Te(document.body,"leaflet-dragging"),this._lastTarget=l.target||l.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),Te(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),ye(this._element,this._newPos),this.fire("drag",l)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(l){H(document.body,"leaflet-dragging"),this._lastTarget&&(H(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),Jt(document,"mousemove touchmove",this._onMove,this),Jt(document,"mouseup touchend touchcancel",this._onUp,this),le(),he();var d=this._moved&&this._moving;this._moving=!1,ta._dragging=!1,d&&this.fire("dragend",{noInertia:l,distance:this._newPos.distanceTo(this._startPos)})}});function _m(l,d,m){var b,I=[1,4,2,8],E,U,ie,de,ze,Ht,wi,Zi;for(E=0,Ht=l.length;E<Ht;E++)l[E]._code=Fa(l[E],d);for(ie=0;ie<4;ie++){for(wi=I[ie],b=[],E=0,Ht=l.length,U=Ht-1;E<Ht;U=E++)de=l[E],ze=l[U],de._code&wi?ze._code&wi||(Zi=Nh(ze,de,wi,d,m),Zi._code=Fa(Zi,d),b.push(Zi)):(ze._code&wi&&(Zi=Nh(ze,de,wi,d,m),Zi._code=Fa(Zi,d),b.push(Zi)),b.push(de));l=b}return l}function vm(l,d){var m,b,I,E,U,ie,de,ze,Ht;if(!l||l.length===0)throw new Error("latlngs not passed");yo(l)||(console.warn("latlngs are not flat! Only the first ring will be used"),l=l[0]);var wi=vt([0,0]),Zi=Xt(l),lo=Zi.getNorthWest().distanceTo(Zi.getSouthWest())*Zi.getNorthEast().distanceTo(Zi.getNorthWest());lo<1700&&(wi=Pc(l));var Ns=l.length,Qo=[];for(m=0;m<Ns;m++){var wo=vt(l[m]);Qo.push(d.project(vt([wo.lat-wi.lat,wo.lng-wi.lng])))}for(ie=de=ze=0,m=0,b=Ns-1;m<Ns;b=m++)I=Qo[m],E=Qo[b],U=I.y*E.x-E.y*I.x,de+=(I.x+E.x)*U,ze+=(I.y+E.y)*U,ie+=U*3;ie===0?Ht=Qo[0]:Ht=[de/ie,ze/ie];var Hh=d.unproject(Re(Ht));return vt([Hh.lat+wi.lat,Hh.lng+wi.lng])}function Pc(l){for(var d=0,m=0,b=0,I=0;I<l.length;I++){var E=vt(l[I]);d+=E.lat,m+=E.lng,b++}return vt([d/b,m/b])}var bm={__proto__:null,clipPolygon:_m,polygonCenter:vm,centroid:Pc};function zg(l,d){if(!d||!l.length)return l.slice();var m=d*d;return l=wm(l,m),l=ym(l,m),l}function Vg(l,d,m){return Math.sqrt(Mc(l,d,m,!0))}function Ky(l,d,m){return Mc(l,d,m)}function ym(l,d){var m=l.length,b=typeof Uint8Array<"u"?Uint8Array:Array,I=new b(m);I[0]=I[m-1]=1,Tc(l,I,d,0,m-1);var E,U=[];for(E=0;E<m;E++)I[E]&&U.push(l[E]);return U}function Tc(l,d,m,b,I){var E=0,U,ie,de;for(ie=b+1;ie<=I-1;ie++)de=Mc(l[ie],l[b],l[I],!0),de>E&&(U=ie,E=de);E>m&&(d[U]=1,Tc(l,d,m,b,U),Tc(l,d,m,U,I))}function wm(l,d){for(var m=[l[0]],b=1,I=0,E=l.length;b<E;b++)Gy(l[b],l[I])>d&&(m.push(l[b]),I=b);return I<E-1&&m.push(l[E-1]),m}var Sm;function Cm(l,d,m,b,I){var E=b?Sm:Fa(l,m),U=Fa(d,m),ie,de,ze;for(Sm=U;;){if(!(E|U))return[l,d];if(E&U)return!1;ie=E||U,de=Nh(l,d,ie,m,I),ze=Fa(de,m),ie===E?(l=de,E=ze):(d=de,U=ze)}}function Nh(l,d,m,b,I){var E=d.x-l.x,U=d.y-l.y,ie=b.min,de=b.max,ze,Ht;return m&8?(ze=l.x+E*(de.y-l.y)/U,Ht=de.y):m&4?(ze=l.x+E*(ie.y-l.y)/U,Ht=ie.y):m&2?(ze=de.x,Ht=l.y+U*(de.x-l.x)/E):m&1&&(ze=ie.x,Ht=l.y+U*(ie.x-l.x)/E),new Ne(ze,Ht,I)}function Fa(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 Gy(l,d){var m=d.x-l.x,b=d.y-l.y;return m*m+b*b}function Mc(l,d,m,b){var I=d.x,E=d.y,U=m.x-I,ie=m.y-E,de=U*U+ie*ie,ze;return de>0&&(ze=((l.x-I)*U+(l.y-E)*ie)/de,ze>1?(I=m.x,E=m.y):ze>0&&(I+=U*ze,E+=ie*ze)),U=l.x-I,ie=l.y-E,b?U*U+ie*ie:new Ne(I,E)}function yo(l){return!N(l[0])||typeof l[0][0]!="object"&&typeof l[0][0]<"u"}function xm(l){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),yo(l)}function W(l,d){var m,b,I,E,U,ie,de,ze;if(!l||l.length===0)throw new Error("latlngs not passed");yo(l)||(console.warn("latlngs are not flat! Only the first ring will be used"),l=l[0]);var Ht=vt([0,0]),wi=Xt(l),Zi=wi.getNorthWest().distanceTo(wi.getSouthWest())*wi.getNorthEast().distanceTo(wi.getNorthWest());Zi<1700&&(Ht=Pc(l));var lo=l.length,Ns=[];for(m=0;m<lo;m++){var Qo=vt(l[m]);Ns.push(d.project(vt([Qo.lat-Ht.lat,Qo.lng-Ht.lng])))}for(m=0,b=0;m<lo-1;m++)b+=Ns[m].distanceTo(Ns[m+1])/2;if(b===0)ze=Ns[0];else for(m=0,E=0;m<lo-1;m++)if(U=Ns[m],ie=Ns[m+1],I=U.distanceTo(ie),E+=I,E>b){de=(E-b)/I,ze=[ie.x-de*(ie.x-U.x),ie.y-de*(ie.y-U.y)];break}var wo=d.unproject(Re(ze));return vt([wo.lat+Ht.lat,wo.lng+Ht.lng])}var oe={__proto__:null,simplify:zg,pointToSegmentDistance:Vg,closestPointOnSegment:Ky,clipSegment:Cm,_getEdgeIntersection:Nh,_getBitCode:Fa,_sqClosestPointOnSegment:Mc,isFlat:yo,_flat:xm,polylineCenter:W},we={project:function(l){return new Ne(l.lng,l.lat)},unproject:function(l){return new zt(l.y,l.x)},bounds:new ot([-180,-90],[180,90])},ce={R:6378137,R_MINOR:6356752314245179e-9,bounds:new ot([-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,E=Math.sqrt(1-I*I),U=E*Math.sin(b),ie=Math.tan(Math.PI/4-b/2)/Math.pow((1-U)/(1+U),E/2);return b=-m*Math.log(Math.max(ie,1e-10)),new Ne(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),E=Math.exp(-l.y/m),U=Math.PI/2-2*Math.atan(E),ie=0,de=.1,ze;ie<15&&Math.abs(de)>1e-7;ie++)ze=I*Math.sin(U),ze=Math.pow((1-ze)/(1+ze),I/2),de=Math.PI/2-2*Math.atan(E*ze)-U,U+=de;return new zt(U*d,l.x*d/m)}},tt={__proto__:null,LonLat:we,Mercator:ce,SphericalMercator:Gi},Tt=n({},vi,{code:"EPSG:3395",projection:ce,transformation:(function(){var l=.5/(Math.PI*ce.R);return nn(l,.5,-l,.5)})()}),Wt=n({},vi,{code:"EPSG:4326",projection:we,transformation:nn(1/180,1,-1/180,.5)}),Fi=n({},Li,{projection:we,transformation:nn(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});Li.Earth=vi,Li.EPSG3395=Tt,Li.EPSG3857=Ei,Li.EPSG900913=Mn,Li.EPSG4326=Wt,Li.Simple=Fi;var fi=Qt.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})}}});Ai.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?N(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 xi=fi.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)}}),Pi=function(l,d){return new xi(l,d)},di=xi.extend({addLayer:function(l){return this.hasLayer(l)?this:(l.addEventParent(this),xi.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),xi.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}}),un=function(l,d){return new di(l,d)},qi=yt.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=Re(b),E=Re(d==="shadow"&&m.shadowAnchor||m.iconAnchor||I&&I.divideBy(2,!0));l.className="leaflet-marker-"+d+" "+(m.className||""),E&&(l.style.marginLeft=-E.x+"px",l.style.marginTop=-E.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 ue.retina&&this.options[l+"RetinaUrl"]||this.options[l+"Url"]}});function Zn(l){return new qi(l)}var vs=qi.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 vs.imagePath!="string"&&(vs.imagePath=this._detectIconPath()),(this.options.imagePath||vs.imagePath)+qi.prototype._getIconUrl.call(this,l)},_stripUrl:function(l){var d=function(m,b,I){var E=b.exec(m);return E&&E[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=Be(l,"background-image")||Be(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):""}}),kn=Fo.extend({initialize:function(l){this._marker=l},addHooks:function(){var l=this._marker._icon;this._draggable||(this._draggable=new ta(l,l,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),Te(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&&H(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,E=Et(d._icon),U=m.getPixelBounds(),ie=m.getPixelOrigin(),de=At(U.min._subtract(ie).add(I),U.max._subtract(ie).subtract(I));if(!de.contains(E)){var ze=Re((Math.max(de.max.x,E.x)-de.max.x)/(U.max.x-de.max.x)-(Math.min(de.min.x,E.x)-de.min.x)/(U.min.x-de.min.x),(Math.max(de.max.y,E.y)-de.max.y)/(U.max.y-de.max.y)-(Math.min(de.min.y,E.y)-de.min.y)/(U.min.y-de.min.y)).multiplyBy(b);m.panBy(ze,{animate:!1}),this._draggable._newPos._add(ze),this._draggable._startPos._add(ze),ye(d._icon,this._draggable._newPos),this._onDrag(l),this._panRequest=ve(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&&(st(this._panRequest),this._panRequest=ve(this._adjustPan.bind(this,l)))},_onDrag:function(l){var d=this._marker,m=d._shadow,b=Et(d._icon),I=d._map.layerPointToLatLng(b);m&&ye(m,b),d._latlng=I,l.latlng=I,l.oldLatLng=this._oldLatLng,d.fire("move",l).fire("drag",l)},_onDragEnd:function(l){st(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",l)}}),Ms=fi.extend({options:{icon:new vs,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=vt(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=vt(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||"")),Te(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),E=!1;I!==this._shadow&&(this._removeShadow(),E=!0),I&&(Te(I,d),I.alt=""),this._shadow=I,l.opacity<1&&this._updateOpacity(),b&&this.getPane().appendChild(this._icon),this._initInteraction(),I&&E&&this.getPane(l.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Jt(this._icon,"focus",this._panOnFocus,this),re(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&re(this._shadow),this._shadow=null},_setPos:function(l){this._icon&&ye(this._icon,l),this._shadow&&ye(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&&(Te(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),kn)){var l=this.options.draggable;this.dragging&&(l=this.dragging.enabled(),this.dragging.disable()),this.dragging=new kn(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&&Ke(this._icon,l),this._shadow&&Ke(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?Re(d.iconSize):Re(0,0),b=d.iconAnchor?Re(d.iconAnchor):Re(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 Yo(l,d){return new Ms(l,d)}var cs=fi.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)}}),oo=cs.extend({options:{fill:!0,radius:10},initialize:function(l,d){w(this,d),this._latlng=vt(l),this._radius=this.options.radius},setLatLng:function(l){var d=this._latlng;return this._latlng=vt(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 cs.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 ot(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 Jo(l,d){return new oo(l,d)}var ro=oo.extend({initialize:function(l,d,m){if(typeof d=="number"&&(d=n({},m,{radius:d})),w(this,d),this._latlng=vt(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:cs.prototype.setStyle,_project:function(){var l=this._latlng.lng,d=this._latlng.lat,m=this._map,b=m.options.crs;if(b.distance===vi.distance){var I=Math.PI/180,E=this._mRadius/vi.R/I,U=m.project([d+E,l]),ie=m.project([d-E,l]),de=U.add(ie).divideBy(2),ze=m.unproject(de).lat,Ht=Math.acos((Math.cos(E*I)-Math.sin(d*I)*Math.sin(ze*I))/(Math.cos(d*I)*Math.cos(ze*I)))/I;(isNaN(Ht)||Ht===0)&&(Ht=E/Math.cos(Math.PI/180*d)),this._point=de.subtract(m.getPixelOrigin()),this._radius=isNaN(Ht)?0:de.x-m.project([ze,l-Ht]).x,this._radiusY=de.y-U.y}else{var wi=b.unproject(b.project(this._latlng).subtract([this._mRadius,0]));this._point=m.latLngToLayerPoint(this._latlng),this._radius=this._point.x-m.latLngToLayerPoint(wi).x}this._updateBounds()}});function ao(l,d,m){return new ro(l,d,m)}var gs=cs.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=Mc,I,E,U=0,ie=this._parts.length;U<ie;U++)for(var de=this._parts[U],ze=1,Ht=de.length;ze<Ht;ze++){I=de[ze-1],E=de[ze];var wi=b(l,I,E,!0);wi<d&&(d=wi,m=b(l,I,E))}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 W(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(l,d){return d=d||this._defaultShape(),l=vt(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 yo(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(l){for(var d=[],m=yo(l),b=0,I=l.length;b<I;b++)m?(d[b]=vt(l[b]),this._bounds.extend(d[b])):d[b]=this._convertLatLngs(l[b]);return d},_project:function(){var l=new ot;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 Ne(l,l);this._rawPxBounds&&(this._pxBounds=new ot([this._rawPxBounds.min.subtract(d),this._rawPxBounds.max.add(d)]))},_projectLatlngs:function(l,d,m){var b=l[0]instanceof zt,I=l.length,E,U;if(b){for(U=[],E=0;E<I;E++)U[E]=this._map.latLngToLayerPoint(l[E]),m.extend(U[E]);d.push(U)}else for(E=0;E<I;E++)this._projectLatlngs(l[E],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,E,U,ie,de;for(m=0,I=0,E=this._rings.length;m<E;m++)for(de=this._rings[m],b=0,U=de.length;b<U-1;b++)ie=Cm(de[b],de[b+1],l,b,!0),ie&&(d[I]=d[I]||[],d[I].push(ie[0]),(ie[1]!==de[b+1]||b===U-2)&&(d[I].push(ie[1]),I++))}},_simplifyPoints:function(){for(var l=this._parts,d=this.options.smoothFactor,m=0,b=l.length;m<b;m++)l[m]=zg(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,E,U,ie,de=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(l))return!1;for(m=0,E=this._parts.length;m<E;m++)for(ie=this._parts[m],b=0,U=ie.length,I=U-1;b<U;I=b++)if(!(!d&&b===0)&&Vg(l,ie[I],ie[b])<=de)return!0;return!1}});function xl(l,d){return new gs(l,d)}gs._flat=xm;var Ho=gs.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 vm(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(l){var d=gs.prototype._convertLatLngs.call(this,l),m=d.length;return m>=2&&d[0]instanceof zt&&d[0].equals(d[m-1])&&d.pop(),d},_setLatLngs:function(l){gs.prototype._setLatLngs.call(this,l),yo(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return yo(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var l=this._renderer._bounds,d=this.options.weight,m=new Ne(d,d);if(l=new ot(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,E;b<I;b++)E=_m(this._rings[b],l,!0),E.length&&this._parts.push(E)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(l){var d=!1,m,b,I,E,U,ie,de,ze;if(!this._pxBounds||!this._pxBounds.contains(l))return!1;for(E=0,de=this._parts.length;E<de;E++)for(m=this._parts[E],U=0,ze=m.length,ie=ze-1;U<ze;ie=U++)b=m[U],I=m[ie],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||gs.prototype._containsPoint.call(this,l,!0)}});function jg(l,d){return new Ho(l,d)}var Kn=di.extend({initialize:function(l,d){w(this,d),this._layers={},l&&this.addData(l)},addData:function(l){var d=N(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 E=this.options;if(E.filter&&!E.filter(l))return this;var U=Ir(l,E);return U?(U.feature=Ls(l),U.defaultOptions=U.options,this.resetStyle(U),E.onEachFeature&&E.onEachFeature(l,U),this.addLayer(U)):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 Ir(l,d){var m=l.type==="Feature"?l.geometry:l,b=m?m.coordinates:null,I=[],E=d&&d.pointToLayer,U=d&&d.coordsToLatLng||Nc,ie,de,ze,Ht;if(!b&&!m)return null;switch(m.type){case"Point":return ie=U(b),Ll(E,l,ie,d);case"MultiPoint":for(ze=0,Ht=b.length;ze<Ht;ze++)ie=U(b[ze]),I.push(Ll(E,l,ie,d));return new di(I);case"LineString":case"MultiLineString":return de=Rh(b,m.type==="LineString"?0:1,U),new gs(de,d);case"Polygon":case"MultiPolygon":return de=Rh(b,m.type==="Polygon"?1:2,U),new Ho(de,d);case"GeometryCollection":for(ze=0,Ht=m.geometries.length;ze<Ht;ze++){var wi=Ir({geometry:m.geometries[ze],type:"Feature",properties:l.properties},d);wi&&I.push(wi)}return new di(I);case"FeatureCollection":for(ze=0,Ht=m.features.length;ze<Ht;ze++){var Zi=Ir(m.features[ze],d);Zi&&I.push(Zi)}return new di(I);default:throw new Error("Invalid GeoJSON object.")}}function Ll(l,d,m,b){return l?l(d,m):new Ms(m,b&&b.markersInheritOptions&&b)}function Nc(l){return new zt(l[1],l[0],l[2])}function Rh(l,d,m){for(var b=[],I=0,E=l.length,U;I<E;I++)U=d?Rh(l[I],d-1,m):(m||Nc)(l[I]),b.push(U);return b}function Ug(l,d){return l=vt(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 Ah(l,d,m,b){for(var I=[],E=0,U=l.length;E<U;E++)I.push(d?Ah(l[E],yo(l[E])?0:d-1,m,b):Ug(l[E],b));return!d&&m&&I.length>0&&I.push(I[0].slice()),I}function ln(l,d){return l.feature?n({},l.feature,{geometry:d}):Ls(d)}function Ls(l){return l.type==="Feature"||l.type==="FeatureCollection"?l:{type:"Feature",properties:{},geometry:l}}var kl={toGeoJSON:function(l){return ln(this,{type:"Point",coordinates:Ug(this.getLatLng(),l)})}};Ms.include(kl),ro.include(kl),oo.include(kl),gs.include({toGeoJSON:function(l){var d=!yo(this._latlngs),m=Ah(this._latlngs,d?1:0,!1,l);return ln(this,{type:(d?"Multi":"")+"LineString",coordinates:m})}}),Ho.include({toGeoJSON:function(l){var d=!yo(this._latlngs),m=d&&!yo(this._latlngs[0]),b=Ah(this._latlngs,m?2:d?1:0,!0,l);return d||(b=[b]),ln(this,{type:(m?"Multi":"")+"Polygon",coordinates:b})}}),xi.include({toMultiPoint:function(l){var d=[];return this.eachLayer(function(m){d.push(m.toGeoJSON(l).geometry.coordinates)}),ln(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 E=I.toGeoJSON(l);if(m)b.push(E.geometry);else{var U=Ls(E);U.type==="FeatureCollection"?b.push.apply(b,U.features):b.push(U)}}}),m?ln(this,{geometries:b,type:"GeometryCollection"}):{type:"FeatureCollection",features:b}}});function Oh(l,d){return new Kn(l,d)}var WR=Oh,Lm=fi.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(l,d,m){this._url=l,this._bounds=Xt(d),w(this,m)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(Te(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){re(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(l){return this.options.opacity=l,this._image&&this._updateOpacity(),this},setStyle:function(l){return l.opacity&&this.setOpacity(l.opacity),this},bringToFront:function(){return this._map&&Oe(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=Xt(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(Te(d,"leaflet-image-layer"),this._zoomAnimated&&Te(d,"leaflet-zoom-animated"),this.options.className&&Te(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;ut(this._image,m,d)},_reset:function(){var l=this._image,d=new ot(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),m=d.getSize();ye(l,d.min),l.style.width=m.x+"px",l.style.height=m.y+"px"},_updateOpacity:function(){Ke(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()}}),BR=function(l,d,m){return new Lm(l,d,m)},vL=Lm.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(Te(d,"leaflet-image-layer"),this._zoomAnimated&&Te(d,"leaflet-zoom-animated"),this.options.className&&Te(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}N(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 E=0;E<this._url.length;E++){var U=Me("source");U.src=this._url[E],d.appendChild(U)}}});function zR(l,d,m){return new vL(l,d,m)}var bL=Lm.extend({_initImage:function(){var l=this._image=this._url;Te(l,"leaflet-image-layer"),this._zoomAnimated&&Te(l,"leaflet-zoom-animated"),this.options.className&&Te(l,this.options.className),l.onselectstart=f,l.onmousemove=f}});function VR(l,d,m){return new bL(l,d,m)}var ia=fi.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(l,d){l&&(l instanceof zt||N(l))?(this._latlng=vt(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&&Ke(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),l._fadeAnimated&&Ke(this._container,1),this.bringToFront(),this.options.interactive&&(Te(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(l){l._fadeAnimated?(Ke(this._container,0),this._removeTimeout=setTimeout(r(re,void 0,this._container),200)):re(this._container),this.options.interactive&&(H(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(l){return this._latlng=vt(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&&Oe(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 di){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=Re(this.options.offset),m=this._getAnchor();this._zoomAnimated?ye(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]}});Ai.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}}),fi.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 km=ia.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,ia.prototype.openOn.call(this,l)},onAdd:function(l){ia.prototype.onAdd.call(this,l),l.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof cs||this._source.on("preclick",_n))},onRemove:function(l){ia.prototype.onRemove.call(this,l),l.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof cs||this._source.off("preclick",_n))},getEvents:function(){var l=ia.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),On(d),ri(this._contentNode),et(d,"contextmenu",_n),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">×</span>',et(b,"click",function(I){Yi(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,E="leaflet-popup-scrolled";I&&b>I?(d.height=I+"px",Te(l,E)):H(l,E),this._containerWidth=this._container.offsetWidth},_animateZoom:function(l){var d=this._map._latLngToNewLayerPoint(this._latlng,l.zoom,l.center),m=this._getAnchor();ye(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(Be(this._container,"marginBottom"),10)||0,m=this._container.offsetHeight+d,b=this._containerWidth,I=new Ne(this._containerLeft,-m-this._containerBottom);I._add(Et(this._container));var E=l.layerPointToContainerPoint(I),U=Re(this.options.autoPanPadding),ie=Re(this.options.autoPanPaddingTopLeft||U),de=Re(this.options.autoPanPaddingBottomRight||U),ze=l.getSize(),Ht=0,wi=0;E.x+b+de.x>ze.x&&(Ht=E.x+b-ze.x+de.x),E.x-Ht-ie.x<0&&(Ht=E.x-ie.x),E.y+m+de.y>ze.y&&(wi=E.y+m-ze.y+de.y),E.y-wi-ie.y<0&&(wi=E.y-ie.y),(Ht||wi)&&(this.options.keepInView&&(this._autopanning=!0),l.fire("autopanstart").panBy([Ht,wi]))}},_getAnchor:function(){return Re(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),jR=function(l,d){return new km(l,d)};Ai.mergeOptions({closePopupOnClick:!0}),Ai.include({openPopup:function(l,d,m){return this._initOverlay(km,l,d,m).openOn(this),this},closePopup:function(l){return l=arguments.length?l:this._popup,l&&l.close(),this}}),fi.include({bindPopup:function(l,d){return this._popup=this._initOverlay(km,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 di||(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)){Ps(l);var d=l.layer||l.target;if(this._popup._source===d&&!(d instanceof cs)){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 Im=ia.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(l){ia.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){ia.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=ia.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,E=b.latLngToContainerPoint(b.getCenter()),U=b.layerPointToContainerPoint(l),ie=this.options.direction,de=I.offsetWidth,ze=I.offsetHeight,Ht=Re(this.options.offset),wi=this._getAnchor();ie==="top"?(d=de/2,m=ze):ie==="bottom"?(d=de/2,m=0):ie==="center"?(d=de/2,m=ze/2):ie==="right"?(d=0,m=ze/2):ie==="left"?(d=de,m=ze/2):U.x<E.x?(ie="right",d=0,m=ze/2):(ie="left",d=de+(Ht.x+wi.x)*2,m=ze/2),l=l.subtract(Re(d,m,!0)).add(Ht).add(wi),H(I,"leaflet-tooltip-right"),H(I,"leaflet-tooltip-left"),H(I,"leaflet-tooltip-top"),H(I,"leaflet-tooltip-bottom"),Te(I,"leaflet-tooltip-"+ie),ye(I,l)},_updatePosition:function(){var l=this._map.latLngToLayerPoint(this._latlng);this._setPosition(l)},setOpacity:function(l){this.options.opacity=l,this._container&&Ke(this._container,l)},_animateZoom:function(l){var d=this._map._latLngToNewLayerPoint(this._latlng,l.zoom,l.center);this._setPosition(d)},_getAnchor:function(){return Re(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),UR=function(l,d){return new Im(l,d)};Ai.include({openTooltip:function(l,d,m){return this._initOverlay(Im,l,d,m).openOn(this),this},closeTooltip:function(l){return l.close(),this}}),fi.include({bindTooltip:function(l,d){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(Im,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 di||(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 yL=qi.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?(Je(d),d.appendChild(m.html)):d.innerHTML=m.html!==!1?m.html:"",m.bgPos){var b=Re(m.bgPos);d.style.backgroundPosition=-b.x+"px "+-b.y+"px"}return this._setIconStyles(d,"icon"),d},createShadow:function(){return null}});function $R(l){return new yL(l)}qi.Default=vs;var $g=fi.extend({options:{tileSize:256,opacity:1,updateWhenIdle:ue.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(),re(this._container),l._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(Oe(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 Ne?l:new Ne(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,E;b<I;b++)E=d[b].style.zIndex,d[b]!==this._container&&E&&(m=l(m,+E));isFinite(m)&&(this.options.zIndex=m+l(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!ue.ielt9){Ke(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 E=Math.min(1,(l-I.loaded)/200);Ke(I.el,E),E<1?d=!0:(I.active?m=!0:this._onOpaqueTile(I),I.active=!0)}}m&&!this._noPrune&&this._pruneTiles(),d&&(st(this._fadeFrame),this._fadeFrame=ve(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)):(re(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)re(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),E=Math.floor(d/2),U=m-1,ie=new Ne(+I,+E);ie.z=+U;var de=this._tileCoordsToKey(ie),ze=this._tiles[de];return ze&&ze.active?(ze.retain=!0,!0):(ze&&ze.loaded&&(ze.retain=!0),U>b?this._retainParent(I,E,U,b):!1)},_retainChildren:function(l,d,m,b){for(var I=2*l;I<2*l+2;I++)for(var E=2*d;E<2*d+2;E++){var U=new Ne(I,E);U.z=m+1;var ie=this._tileCoordsToKey(U),de=this._tiles[ie];if(de&&de.active){de.retain=!0;continue}else de&&de.loaded&&(de.retain=!0);m+1<b&&this._retainChildren(I,E,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 E=this.options.updateWhenZooming&&I!==this._tileZoom;(!b||E)&&(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();ue.any3d?ut(l.el,I,b):ye(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(),E=d.getSize().divideBy(b*2);return new ot(I.subtract(E),I.add(E))},_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),E=I.getCenter(),U=[],ie=this.options.keepBuffer,de=new ot(I.getBottomLeft().subtract([ie,-ie]),I.getTopRight().add([ie,-ie]));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 Ht=this._tiles[ze].coords;(Ht.z!==this._tileZoom||!de.contains(new Ne(Ht.x,Ht.y)))&&(this._tiles[ze].current=!1)}if(Math.abs(m-this._tileZoom)>1){this._setView(l,m);return}for(var wi=I.min.y;wi<=I.max.y;wi++)for(var Zi=I.min.x;Zi<=I.max.x;Zi++){var lo=new Ne(Zi,wi);if(lo.z=this._tileZoom,!!this._isValidTile(lo)){var Ns=this._tiles[this._tileCoordsToKey(lo)];Ns?Ns.current=!0:U.push(lo)}}if(U.sort(function(wo,Hh){return wo.distanceTo(E)-Hh.distanceTo(E)}),U.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Qo=document.createDocumentFragment();for(Zi=0;Zi<U.length;Zi++)this._addTile(U[Zi],Qo);this._level.el.appendChild(Qo)}}}},_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 Xt(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),E=d.unproject(b,l.z),U=d.unproject(I,l.z);return[E,U]},_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 Ne(+d[0],+d[1]);return m.z=+d[2],m},_removeTile:function(l){var d=this._tiles[l];d&&(re(d.el),delete this._tiles[l],this.fire("tileunload",{tile:d.el,coords:this._keyToTileCoords(l)}))},_initTile:function(l){Te(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,ue.ielt9&&this.options.opacity<1&&Ke(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&&ve(r(this._tileReady,this,l,null,I)),ye(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?(Ke(m.el,0),st(this._fadeFrame),this._fadeFrame=ve(this._updateOpacity,this)):(m.active=!0,this._pruneTiles()),d||(Te(m.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:m.el,coords:l})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),ue.ielt9||!this._map._fadeAnimated?ve(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 Ne(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 ot(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 qR(l){return new $g(l)}var Fh=$g.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&&ue.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:ue.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 P(this._url,n(d,this.options))},_tileOnLoad:function(l,d){ue.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=F;var m=this._tiles[l].coords;re(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",F),$g.prototype._removeTile.call(this,l)},_tileReady:function(l,d,m){if(!(!this._map||m&&m.getAttribute("src")===F))return $g.prototype._tileReady.call(this,l,d,m)}});function wL(l,d){return new Fh(l,d)}var SL=Fh.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&&ue.retina?2:1,E=this.getTileSize();m.width=E.x*I,m.height=E.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,Fh.prototype.onAdd.call(this,l)},getTileUrl:function(l){var d=this._tileCoordsToNwSe(l),m=this._crs,b=At(m.project(d[0]),m.project(d[1])),I=b.min,E=b.max,U=(this._wmsVersion>=1.3&&this._crs===Wt?[I.y,I.x,E.y,E.x]:[I.x,I.y,E.x,E.y]).join(","),ie=Fh.prototype.getTileUrl.call(this,l);return ie+S(this.wmsParams,ie,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+U},setParams:function(l,d){return n(this.wmsParams,l),d||this.redraw(),this}});function KR(l,d){return new SL(l,d)}Fh.WMS=SL,wL.wms=KR;var Ha=fi.extend({options:{padding:.1},initialize:function(l){w(this,l),c(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),Te(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),E=b.multiplyBy(-m).add(I).subtract(this._map._getNewPixelOrigin(l,d));ue.any3d?ut(this._container,E,m):ye(this._container,E)},_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 ot(m,m.add(d.multiplyBy(1+l*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),CL=Ha.extend({options:{tolerance:0},getEvents:function(){var l=Ha.prototype.getEvents.call(this);return l.viewprereset=this._onViewPreReset,l},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Ha.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(){st(this._redrawRequest),delete this._ctx,re(this._container),Jt(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)){Ha.prototype._update.call(this);var l=this._bounds,d=this._container,m=l.getSize(),b=ue.retina?2:1;ye(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",ue.retina&&this._ctx.scale(2,2),this._ctx.translate(-l.min.x,-l.min.y),this.fire("update")}},_reset:function(){Ha.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||ve(this._redraw,this))},_extendRedrawBounds:function(l){if(l._pxBounds){var d=(l.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new ot,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,E,U=l._parts,ie=U.length,de=this._ctx;if(ie){for(de.beginPath(),m=0;m<ie;m++){for(b=0,I=U[m].length;b<I;b++)E=U[m][b],de[b?"lineTo":"moveTo"](E.x,E.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&&(H(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&&(Te(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 xL(l){return ue.canvas?new CL(l):null}var qg=(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">')}})(),GR={_initContainer:function(){this._container=Me("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Ha.prototype._update.call(this),this.fire("update"))},_initPath:function(l){var d=l._container=qg("shape");Te(d,"leaflet-vml-shape "+(this.options.className||"")),d.coordsize="1 1",l._path=qg("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;re(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=qg("stroke")),I.appendChild(d),d.weight=b.weight+"px",d.color=b.color,d.opacity=b.opacity,b.dashArray?d.dashStyle=N(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=qg("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){Oe(l._container)},_bringToBack:function(l){xe(l._container)}},Dm=ue.vml?qg:sn,Kg=Ha.extend({_initContainer:function(){this._container=Dm("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Dm("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){re(this._container),Jt(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Ha.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)),ye(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=Dm("path");l.options.className&&Te(d,l.options.className),l.options.interactive&&Te(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){re(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,Sn(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 ",E=l._empty()?"M0 0":"M"+(d.x-m)+","+d.y+I+m*2+",0 "+I+-m*2+",0 ";this._setPath(l,E)},_setPath:function(l,d){l._path.setAttribute("d",d)},_bringToFront:function(l){Oe(l._path)},_bringToBack:function(l){xe(l._path)}});ue.vml&&Kg.include(GR);function LL(l){return ue.svg||ue.vml?new Kg(l):null}Ai.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&&xL(l)||LL(l)}});var kL=Ho.extend({initialize:function(l,d){Ho.prototype.initialize.call(this,this._boundsToLatLngs(l),d)},setBounds:function(l){return this.setLatLngs(this._boundsToLatLngs(l))},_boundsToLatLngs:function(l){return l=Xt(l),[l.getSouthWest(),l.getNorthWest(),l.getNorthEast(),l.getSouthEast()]}});function ZR(l,d){return new kL(l,d)}Kg.create=Dm,Kg.pointsToPath=Sn,Kn.geometryToLayer=Ir,Kn.coordsToLatLng=Nc,Kn.coordsToLatLngs=Rh,Kn.latLngToCoords=Ug,Kn.latLngsToCoords=Ah,Kn.getFeature=ln,Kn.asFeature=Ls,Ai.mergeOptions({boxZoom:!0});var IL=Fo.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(){Jt(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){re(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(l){if(!l.shiftKey||l.which!==1&&l.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),dt(),Ie(),this._startPoint=this._map.mouseEventToContainerPoint(l),et(document,{contextmenu:Ps,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),Te(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(l);var d=new ot(this._point,this._startPoint),m=d.getSize();ye(this._box,d.min),this._box.style.width=m.x+"px",this._box.style.height=m.y+"px"},_finish:function(){this._moved&&(re(this._box),H(this._container,"leaflet-crosshair")),he(),le(),Jt(document,{contextmenu:Ps,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())}});Ai.addInitHook("addHandler","boxZoom",IL),Ai.mergeOptions({doubleClickZoom:!0});var DL=Fo.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)}});Ai.addInitHook("addHandler","doubleClickZoom",DL),Ai.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var EL=Fo.extend({addHooks:function(){if(!this._draggable){var l=this._map;this._draggable=new ta(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))}Te(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){H(this._map._container,"leaflet-grab"),H(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=Xt(this._map.options.maxBounds);this._offsetLimit=At(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,E=(b+d+m)%l-d-m,U=Math.abs(I+m)<Math.abs(E+m)?I:E;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=U},_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]),E=(this._lastTime-this._times[0])/1e3,U=m.easeLinearity,ie=I.multiplyBy(U/E),de=ie.distanceTo([0,0]),ze=Math.min(m.inertiaMaxSpeed,de),Ht=ie.multiplyBy(ze/de),wi=ze/(m.inertiaDeceleration*U),Zi=Ht.multiplyBy(-wi/2).round();!Zi.x&&!Zi.y?d.fire("moveend"):(Zi=d._limitOffset(Zi,d.options.maxBounds),ve(function(){d.panBy(Zi,{duration:wi,easeLinearity:U,noMoveStart:!0,animate:!0})}))}}});Ai.addInitHook("addHandler","dragging",EL),Ai.mergeOptions({keyboard:!0,keyboardPanDelta:80});var PL=Fo.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(),Jt(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(){Jt(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=Re(b).multiplyBy(3)),m.options.maxBounds&&(b=m._limitOffset(Re(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;Ps(l)}}});Ai.addInitHook("addHandler","keyboard",PL),Ai.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var TL=Fo.extend({addHooks:function(){et(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){Jt(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(l){var d=kr(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),Ps(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,E=m?Math.ceil(I/m)*m:I,U=l._limitZoom(d+(this._delta>0?E:-E))-d;this._delta=0,this._startTime=null,U&&(l.options.scrollWheelZoom==="center"?l.setZoom(d+U):l.setZoomAround(this._lastMousePos,d+U))}});Ai.addInitHook("addHandler","scrollWheelZoom",TL);var XR=600;Ai.mergeOptions({tapHold:ue.touchNative&&ue.safari&&ue.mobile,tapTolerance:15});var ML=Fo.extend({addHooks:function(){et(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Jt(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 Ne(d.clientX,d.clientY),this._holdTimeout=setTimeout(r(function(){this._cancel(),this._isTapValid()&&(et(document,"touchend",Yi),et(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",d))},this),XR),et(document,"touchend touchcancel contextmenu",this._cancel,this),et(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function l(){Jt(document,"touchend",Yi),Jt(document,"touchend touchcancel",l)},_cancel:function(){clearTimeout(this._holdTimeout),Jt(document,"touchend touchcancel contextmenu",this._cancel,this),Jt(document,"touchmove",this._onMove,this)},_onMove:function(l){var d=l.touches[0];this._newPos=new Ne(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)}});Ai.addInitHook("addHandler","tapHold",ML),Ai.mergeOptions({touchZoom:ue.touch,bounceAtZoomLimits:!0});var NL=Fo.extend({addHooks:function(){Te(this._map._container,"leaflet-touch-zoom"),et(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){H(this._map._container,"leaflet-touch-zoom"),Jt(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),Yi(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 E=m._add(b)._divideBy(2)._subtract(this._centerPoint);if(I===1&&E.x===0&&E.y===0)return;this._center=d.unproject(d.project(this._pinchStartLatLng,this._zoom).subtract(E),this._zoom)}this._moved||(d._moveStart(!0,!1),this._moved=!0),st(this._animRequest);var U=r(d._move,d,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=ve(U,this,!0),Yi(l)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,st(this._animRequest),Jt(document,"touchmove",this._onTouchMove,this),Jt(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))}});Ai.addInitHook("addHandler","touchZoom",NL),Ai.BoxZoom=IL,Ai.DoubleClickZoom=DL,Ai.Drag=EL,Ai.Keyboard=PL,Ai.ScrollWheelZoom=TL,Ai.TapHold=ML,Ai.TouchZoom=NL,t.Bounds=ot,t.Browser=ue,t.CRS=Li,t.Canvas=CL,t.Circle=ro,t.CircleMarker=oo,t.Class=yt,t.Control=es,t.DivIcon=yL,t.DivOverlay=ia,t.DomEvent=Cl,t.DomUtil=Pt,t.Draggable=ta,t.Evented=Qt,t.FeatureGroup=di,t.GeoJSON=Kn,t.GridLayer=$g,t.Handler=Fo,t.Icon=qi,t.ImageOverlay=Lm,t.LatLng=zt,t.LatLngBounds=ni,t.Layer=fi,t.LayerGroup=xi,t.LineUtil=oe,t.Map=Ai,t.Marker=Ms,t.Mixin=qy,t.Path=cs,t.Point=Ne,t.PolyUtil=bm,t.Polygon=Ho,t.Polyline=gs,t.Popup=km,t.PosAnimation=Oa,t.Projection=tt,t.Rectangle=kL,t.Renderer=Ha,t.SVG=Kg,t.SVGOverlay=bL,t.TileLayer=Fh,t.Tooltip=Im,t.Transformation=Bn,t.Util=Ot,t.VideoOverlay=vL,t.bind=r,t.bounds=At,t.canvas=xL,t.circle=ao,t.circleMarker=Jo,t.control=Ts,t.divIcon=$R,t.extend=n,t.featureGroup=un,t.geoJSON=Oh,t.geoJson=WR,t.gridLayer=qR,t.icon=Zn,t.imageOverlay=BR,t.latLng=vt,t.latLngBounds=Xt,t.layerGroup=Pi,t.map=Xs,t.marker=Yo,t.point=Re,t.polygon=jg,t.polyline=xl,t.popup=jR,t.rectangle=ZR,t.setOptions=w,t.stamp=c,t.svg=LL,t.svgOverlay=VR,t.tileLayer=wL,t.tooltip=UR,t.transformation=nn,t.version=i,t.videoOverlay=zR;var YR=window.L;t.noConflict=function(){return window.L=YR,this},window.L=t}))})(Cf,Cf.exports)),Cf.exports}var SG=wG();const of=yR(SG),CG="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=",xG="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==",LG="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC",Fn=(o,e=py)=>{var t=kG(),i=x(C(t),2),n=C(i);G(()=>q(n,e())),T(o,t)};var kG=R('<span class="tip svelte-767znw"><span class="tip-icon svelte-767znw">ℹ</span> <span class="tip-box svelte-767znw"> </span></span>'),IG=R("<button> </button>"),DG=R('<span class="err svelte-767znw"> </span>'),EG=R('<span class="ok svelte-767znw"> </span>'),PG=R('<div class="loading svelte-767znw">Loading…</div>'),TG=R('<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>'),MG=R('<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),NG=R('<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">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>'),RG=R('<div class="field svelte-767znw"><label class="svelte-767znw"> <!></label> <input type="password" placeholder="Enter new password" autocomplete="new-password" class="svelte-767znw"/></div>'),AG=R('<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),OG=R('<div class="field-error svelte-767znw"> </div>'),FG=R('<div class="field-ok svelte-767znw"> </div>'),HG=R('<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>'),WG=R('<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>'),BG=R('<section id="sec-scripts" class="svelte-767znw"><h3 class="svelte-767znw">Scripts</h3> <div class="field svelte-767znw"><label class="svelte-767znw">Scripts directory <!></label> <input type="text" class="svelte-767znw"/></div> <div class="field field--check svelte-767znw"><span></span> <label class="check-label svelte-767znw"><input type="checkbox" class="svelte-767znw"/> <span class="checkmark svelte-767znw"></span> Disable file watching <!></label></div></section>'),zG=R('<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>'),VG=R('<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>'),jG=R('<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>'),UG=R('<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>'),$G=R('<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>'),qG=R('<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>'),KG=R('<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>'),GG=R("<option> </option>"),ZG=R('<span class="free-badge svelte-767znw">FREE</span> ',1),XG=R(' — <a target="_blank" rel="noreferrer" class="svelte-767znw">Get API key ↗</a>',1),YG=R("<div><!> <!></div>"),JG=R('<div class="field svelte-767znw"><label class="svelte-767znw">Base URL <!></label> <input type="text" class="svelte-767znw"/></div>'),QG=R('<div class="field svelte-767znw"><label class="svelte-767znw">API key <!></label> <input type="password" placeholder="sk-…" autocomplete="off" class="svelte-767znw"/></div>'),e9=R('<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>'),t9=R('<div class="config-form svelte-767znw"><!> <!> <!> <!> <!> <!> <!> <!> <!> <!> <!></div>'),i9=R('<!> <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 n9(o,e){Ro(e,!0),delete of.Icon.Default.prototype._getIconUrl,of.Icon.Default.mergeOptions({iconUrl:CG,iconRetinaUrl:xG,shadowUrl:LG});let t=B(Si(vG())),i=B("~/.she"),n=B("mqtt"),s=B(""),r=B(""),a=B(""),c=B(""),h=B(""),g=B(""),f=B("logic"),p=B("var"),v=B(!1),_=B(8080),w=B(""),S=B("none"),D=B(""),P=B("X-Remote-User"),N=B(""),V=B(!1),F=B(""),Y=B(""),X=B(""),me=B(!1),Le=B(!1),je=B(!1),ve=B(48.7408),st=B(9.1778),Ot=B(!1),yt=B(void 0),ai=B(!1),jt=B(null),Qt=B("info"),Ne=B(""),Ge=B(""),Re=B(!1),ot=B(!1),At=B("");const ni=[{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 Xt=B("ollama"),zt=B("ollama"),vt=B(""),Li=B(""),vi=B("");const Tn={};let Gi="ollama";function Bn(j,pe){return j==="anthropic"?"anthropic":j==="ollama"?"ollama":pe?pe.includes("localhost:1234")?"lmstudio":pe.includes("groq.com")?"groq":pe.includes("googleapis.com")?"gemini":"openai":"openai"}function nn(){Tn[Gi]={baseUrl:u(vt),model:u(Li),apiKey:u(vi)};const j=ni.find(Ue=>Ue.id===u(Xt));if(!j)return;k(zt,j.provider,!0);const pe=Tn[u(Xt)];k(vt,(pe==null?void 0:pe.baseUrl)??j.baseUrl,!0),k(Li,(pe==null?void 0:pe.model)??j.defaultModel,!0),k(vi,(pe==null?void 0:pe.apiKey)??"",!0),Gi=u(Xt)}const Ei=rt(()=>ni.find(j=>j.id===u(Xt)));let Mn=B(Si({}));const sn=new Set(["url","name","variablePrefix","disableVariables","mqttUsername","mqttPassword","mqttCa","mqttCert","mqttKey","port","bindAddress","auth","password","proxyHeader","proxyLogoutUrl","dir","disableWatch","gitAutoCommit","gitAutoPush","latitude","longitude","verbosity","dbPath","dbPrefix","dbPublish","dbRetain","redis","ai"]);zn(()=>{if(!u(yt))return;const j=typeof u(ve)=="number"?u(ve):48.7408,pe=typeof u(st)=="number"?u(st):9.1778,Ue=of.map(u(yt)).setView([j,pe],10);of.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'}).addTo(Ue);const Ce=of.marker([j,pe],{draggable:!0}).addTo(Ue);k(jt,Ce,!0);const De=Xe=>{k(ve,+Xe.lat.toFixed(6)),k(st,+Xe.lng.toFixed(6))};return Ce.on("dragend",()=>De(Ce.getLatLng())),Ue.on("click",Xe=>{Ce.setLatLng(Xe.latlng),De(Xe.latlng)}),()=>{k(jt,null),Ue.remove()}}),zn(()=>{!u(jt)||u(ve)===""||u(st)===""||u(jt).setLatLng([Number(u(ve)),Number(u(st))])});let Sn;function Xi(){if(!navigator.geolocation){Sn.show("Geolocation is not supported by this browser.",{alert:!0});return}k(ai,!0),navigator.geolocation.getCurrentPosition(j=>{k(ve,+j.coords.latitude.toFixed(6)),k(st,+j.coords.longitude.toFixed(6)),k(ai,!1)},()=>{k(ai,!1)})}let Hi=B(!0),dn=B(!1),Nn=B(""),Rn=B(""),$n=B(""),Cn=B("appearance");const pn=[{id:"appearance",label:"Appearance",terms:["theme","color","dark","light"]},{id:"auth",label:"Authentication",terms:["auth","password","login","proxy","header","nginx","authentik","secure"]},{id:"mqtt",label:"MQTT",terms:["broker","url","client","name","variable","prefix"]},{id:"webserver",label:"Web server",terms:["port","http","server","bind","address"]},{id:"scripts",label:"Scripts",terms:["directory","watch","hot reload","dir"]},{id:"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 on=rt(()=>pn.filter(j=>{const pe=u($n).trim().toLowerCase();return!pe||j.label.toLowerCase().includes(pe)||j.terms.some(Ue=>Ue.includes(pe))}));function qe(j){var pe;k(Cn,j,!0),(pe=document.getElementById("sec-"+j))==null||pe.scrollIntoView({behavior:"smooth",block:"start"})}xr(async()=>{try{const j=await wf();j.dataDir&&k(i,j.dataDir,!0)}catch{}try{const j=await iL();if(typeof j.url=="string"&&j.url)try{const Ce=new URL(j.url);k(n,Ce.protocol.replace(":",""),!0),k(s,Ce.host,!0)}catch{k(s,j.url,!0)}typeof j.mqttUsername=="string"&&k(r,j.mqttUsername,!0),typeof j.mqttPassword=="string"&&k(a,j.mqttPassword,!0),typeof j.mqttCa=="string"&&k(c,j.mqttCa,!0),typeof j.mqttCert=="string"&&k(h,j.mqttCert,!0),typeof j.mqttKey=="string"&&k(g,j.mqttKey,!0),typeof j.name=="string"&&k(f,j.name,!0),typeof j.variablePrefix=="string"&&k(p,j.variablePrefix,!0),typeof j.disableVariables=="boolean"&&k(v,j.disableVariables,!0),typeof j.port=="number"&&k(_,j.port,!0),typeof j.bindAddress=="string"&&k(w,j.bindAddress,!0),typeof j.auth=="string"&&k(S,j.auth,!0),typeof j.proxyHeader=="string"&&k(P,j.proxyHeader,!0),typeof j.proxyLogoutUrl=="string"&&k(N,j.proxyLogoutUrl,!0),typeof j.dir=="string"&&k(X,j.dir,!0),typeof j.disableWatch=="boolean"&&k(me,j.disableWatch,!0),typeof j.gitAutoCommit=="boolean"&&k(Le,j.gitAutoCommit,!0),typeof j.gitAutoPush=="boolean"&&k(je,j.gitAutoPush,!0),typeof j.latitude=="number"&&k(ve,j.latitude,!0),typeof j.longitude=="number"&&k(st,j.longitude,!0),typeof j.verbosity=="string"&&k(Qt,j.verbosity,!0),typeof j.dbPath=="string"&&k(Ne,j.dbPath,!0),typeof j.dbPrefix=="string"&&k(Ge,j.dbPrefix,!0),typeof j.dbPublish=="boolean"&&k(Re,j.dbPublish,!0),typeof j.dbRetain=="boolean"&&k(ot,j.dbRetain,!0);const pe=j.redis;pe!=null&&pe.url&&k(At,pe.url,!0);const Ue=j.ai;Ue!=null&&Ue.provider&&k(zt,Ue.provider,!0),Ue!=null&&Ue.baseUrl&&k(vt,Ue.baseUrl,!0),Ue!=null&&Ue.model&&k(Li,Ue.model,!0),Ue!=null&&Ue.apiKey&&k(vi,Ue.apiKey,!0),k(Xt,Bn(u(zt),u(vt)),!0),Gi=u(Xt),k(Mn,Object.fromEntries(Object.entries(j).filter(([Ce])=>!sn.has(Ce))),!0)}catch(j){k(Rn,j.message,!0)}finally{k(Hi,!1)}});async function Ft(){if(k(Y,""),k(F,""),u(S)==="password"&&!u(D)){k(Y,"A password is required to enable password authentication.");return}k(V,!0);try{await K8(u(S),u(S)==="password"?u(D):void 0,u(S)==="proxy"?u(P):void 0,u(S)==="proxy"?u(N):void 0),k(D,""),k(F,"Authentication settings saved.")}catch(j){k(Y,j.message,!0)}finally{k(V,!1)}}async function li(){k(Rn,""),k(Nn,"");const j={...u(Mn)};u(s)&&(j.url=`${u(n)}://${u(s)}`),j.name=u(f),j.variablePrefix=u(p),u(v)&&(j.disableVariables=!0),u(r)&&(j.mqttUsername=u(r)),u(a)&&(j.mqttPassword=u(a)),u(c)&&(j.mqttCa=u(c)),u(h)&&(j.mqttCert=u(h)),u(g)&&(j.mqttKey=u(g)),u(_)!==""&&(j.port=Number(u(_))),u(w)&&(j.bindAddress=u(w)),u(X)&&(j.dir=u(X)),u(me)&&(j.disableWatch=!0),u(Le)&&(j.gitAutoCommit=!0),u(je)&&(j.gitAutoPush=!0),u(ve)!==""&&(j.latitude=Number(u(ve))),u(st)!==""&&(j.longitude=Number(u(st))),j.verbosity=u(Qt),u(Ne)&&(j.dbPath=u(Ne),u(Ge)&&(j.dbPrefix=u(Ge)),u(Re)&&(j.dbPublish=!0,u(ot)&&(j.dbRetain=!0))),u(At)&&(j.redis={url:u(At)}),u(zt)&&(j.ai={provider:u(zt),...u(vt)?{baseUrl:u(vt)}:{},...u(Li)?{model:u(Li)}:{},...u(vi)?{apiKey:u(vi)}:{}}),k(dn,!0);try{const pe=await s7(j);window.dispatchEvent(new CustomEvent("she:config-changed")),k(Nn,pe.restartRequired?"Saved — restart required to apply changes.":"Saved.",!0)}catch(pe){k(Rn,pe.message,!0)}finally{k(dn,!1)}}var Ci=i9(),Ii=bt(Ci);bs(Hg(Ii,{}),j=>Sn=j,()=>Sn);var mn=x(Ii,2),xn=C(mn),qn=C(xn),hn=x(C(qn),2),An=x(qn,2);_i(An,21,()=>pn,j=>j.id,(j,pe)=>{var Ue=Fs(),Ce=bt(Ue);{var De=Vt=>{var ft=IG();let ue;var ht=C(ft);G(()=>{ue=$t(ft,1,"section-link svelte-767znw",null,ue,{active:u(Cn)===u(pe).id}),q(ht,u(pe).label)}),te("click",ft,()=>qe(u(pe).id)),T(Vt,ft)},Xe=rt(()=>u(on).some(Vt=>Vt.id===u(pe).id));$(Ce,Vt=>{u(Xe)&&Vt(De)})}T(j,Ue)});var rn=x(xn,2),Ln=C(rn),Ae=x(C(Ln),2);{var Z=j=>{var pe=DG(),Ue=C(pe);G(()=>q(Ue,u(Rn))),T(j,pe)};$(Ae,j=>{u(Rn)&&j(Z)})}var Fe=x(Ae,2);{var wt=j=>{var pe=EG(),Ue=C(pe);G(()=>q(Ue,u(Nn))),T(j,pe)};$(Fe,j=>{u(Nn)&&j(wt)})}var Dt=x(Fe,2),Nt=C(Dt),O=x(Ln,2);{var se=j=>{var pe=PG();T(j,pe)},be=j=>{var pe=t9(),Ue=C(pe);{var Ce=re=>{var Je=TG(),Oe=x(C(Je),2),xe=x(C(Oe),2),St=C(xe);St.value=St.__value="dark";var Te=x(St);Te.value=Te.__value="light";var H=x(Te);H.value=H.__value="system",te("change",xe,()=>bG(u(t))),_a(xe,()=>u(t),J=>k(t,J)),T(re,Je)},De=rt(()=>u(on).some(re=>re.id==="appearance"));$(Ue,re=>{u(De)&&re(Ce)})}var Xe=x(Ue,2);{var Vt=re=>{var Je=NG(),Oe=x(C(Je),2),xe=C(Oe),St=x(C(xe));Fn(St,()=>"Transport protocol. Use mqtts or wss for TLS encryption.");var Te=x(xe,2),H=C(Te);H.value=H.__value="mqtt";var J=x(H);J.value=J.__value="mqtts";var ke=x(J);ke.value=ke.__value="ws";var Ke=x(ke);Ke.value=Ke.__value="wss";var nt=x(Oe,2),at=C(nt),ut=x(C(at));Fn(ut,()=>"Hostname and optional port of the MQTT broker. Example: 192.168.1.1:1883. Leave empty to run without MQTT.");var ye=x(at,2),Et=x(nt,2),dt=C(Et),he=x(C(dt));Fn(he,()=>"MQTT broker username. Leave empty if the broker does not require authentication.");var Ct=x(dt,2),Ze=x(Et,2),Ie=C(Ze),le=x(C(Ie));Fn(le,()=>"MQTT broker password. Stored in plain text in config.json.");var _e=x(Ie,2),Qe=x(Ze,2);{var Bt=ri=>{var On=MG(),Yi=bt(On),Ps=C(Yi),Oo=x(C(Ps));Fn(Oo,()=>"PEM-encoded CA certificate to verify the broker's TLS certificate. Leave empty to use the system's default CA store.");var Lr=x(Ps,2),Aa=x(Yi,2),kr=C(Aa),Qr=x(C(kr));Fn(Qr,()=>"PEM-encoded client certificate for mutual TLS authentication.");var Cl=x(kr,2),Oa=x(Aa,2),Ai=C(Oa),Xs=x(C(Ai));Fn(Xs,()=>"PEM-encoded private key matching the client certificate.");var es=x(Ai,2);Ni(Lr,()=>u(c),Ts=>k(c,Ts)),Ni(Cl,()=>u(h),Ts=>k(h,Ts)),Ni(es,()=>u(g),Ts=>k(g,Ts)),T(ri,On)};$(Qe,ri=>{(u(n)==="mqtts"||u(n)==="wss")&&ri(Bt)})}var fe=x(Qe,2),$e=C(fe),gt=x(C($e));Fn(gt,()=>'MQTT client ID and topic prefix used for the "connected" status message. Default: she');var Pt=x($e,2),et=x(fe,2),ci=C(et),Jt=x(C(ci));Fn(Jt,()=>"Topic prefix for the variable system (var/set/name → var/status/name). Default: var");var Gn=x(ci,2),$i=x(et,2),oi=x(C($i),2),Gt=C(oi),_n=x(Gt,4);Fn(_n,()=>"When enabled, var/set/… messages are not processed and no var/status/… retained messages are published."),_a(Te,()=>u(n),ri=>k(n,ri)),Ni(ye,()=>u(s),ri=>k(s,ri)),Ni(Ct,()=>u(r),ri=>k(r,ri)),Ni(_e,()=>u(a),ri=>k(a,ri)),Ni(Pt,()=>u(f),ri=>k(f,ri)),Ni(Gn,()=>u(p),ri=>k(p,ri)),As(Gt,()=>u(v),ri=>k(v,ri)),T(re,Je)},ft=rt(()=>u(on).some(re=>re.id==="mqtt"));$(Xe,re=>{u(ft)&&re(Vt)})}var ue=x(Xe,2);{var ht=re=>{var Je=HG(),Oe=x(C(Je),2),xe=C(Oe),St=x(C(xe));Fn(St,()=>"none: no authentication required. password: single-user password login. proxy: trust a header set by nginx/authentik.");var Te=x(xe,2),H=C(Te);H.value=H.__value="none";var J=x(H);J.value=J.__value="password";var ke=x(J);ke.value=ke.__value="proxy";var Ke=x(Oe,2);{var nt=le=>{var _e=RG(),Qe=C(_e),Bt=C(Qe),fe=x(Bt);Fn(fe,()=>"Set a new password. Leave empty to keep the current password (if already set).");var $e=x(Qe,2);G(()=>q(Bt,`${u(D)?"New password":"Password"} `)),Ni($e,()=>u(D),gt=>k(D,gt)),T(le,_e)};$(Ke,le=>{u(S)==="password"&&le(nt)})}var at=x(Ke,2);{var ut=le=>{var _e=AG(),Qe=bt(_e),Bt=C(Qe),fe=x(C(Bt));Fn(fe,()=>"The HTTP header that nginx/authentik sets after successful authentication. Default: X-Remote-User");var $e=x(Bt,2),gt=x(Qe,2),Pt=C(gt),et=x(C(Pt));Fn(et,()=>"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 ci=x(Pt,2);Ni($e,()=>u(P),Jt=>k(P,Jt)),Ni(ci,()=>u(N),Jt=>k(N,Jt)),T(le,_e)};$(at,le=>{u(S)==="proxy"&&le(ut)})}var ye=x(at,2);{var Et=le=>{var _e=OG(),Qe=C(_e);G(()=>q(Qe,u(Y))),T(le,_e)};$(ye,le=>{u(Y)&&le(Et)})}var dt=x(ye,2);{var he=le=>{var _e=FG(),Qe=C(_e);G(()=>q(Qe,u(F))),T(le,_e)};$(dt,le=>{u(F)&&le(he)})}var Ct=x(dt,2),Ze=x(C(Ct),2),Ie=C(Ze);G(()=>{Ze.disabled=u(V)||u(S)==="password"&&!u(D),q(Ie,u(V)?"Saving…":"Apply authentication settings")}),_a(Te,()=>u(S),le=>k(S,le)),te("click",Ze,Ft),T(re,Je)},ii=rt(()=>u(on).some(re=>re.id==="auth"));$(ue,re=>{u(ii)&&re(ht)})}var Kt=x(ue,2);{var si=re=>{var Je=WG(),Oe=x(C(Je),2),xe=C(Oe),St=x(C(xe));Fn(St,()=>"HTTP server port. Use 0 to let the OS pick a free port. Default: 8080");var Te=x(xe,2),H=x(Oe,2),J=C(H),ke=x(C(J));Fn(ke,()=>"Interface she listens on. Use 127.0.0.1 when running behind nginx (recommended with proxy auth). Default: 0.0.0.0");var Ke=x(J,2);Ni(Te,()=>u(_),nt=>k(_,nt)),Ni(Ke,()=>u(w),nt=>k(w,nt)),T(re,Je)},ui=rt(()=>u(on).some(re=>re.id==="webserver"));$(Kt,re=>{u(ui)&&re(si)})}var Q=x(Kt,2);{var ge=re=>{var Je=BG(),Oe=x(C(Je),2),xe=C(Oe),St=x(C(xe));Fn(St,()=>"Directory that is watched for .js script files. Defaults to {dataDir}/scripts");var Te=x(xe,2),H=x(Oe,2),J=x(C(H),2),ke=C(J),Ke=x(ke,4);Fn(Ke,()=>"When enabled the daemon will not watch for file changes and will not hot-reload scripts."),G(()=>Hn(Te,"placeholder",`${u(i)??""}/scripts (default)`)),Ni(Te,()=>u(X),nt=>k(X,nt)),As(ke,()=>u(me),nt=>k(me,nt)),T(re,Je)},We=rt(()=>u(on).some(re=>re.id==="scripts"));$(Q,re=>{u(We)&&re(ge)})}var it=x(Q,2);{var xt=re=>{var Je=zG(),Oe=x(C(Je),2),xe=x(C(Oe),2),St=C(xe),Te=x(St,4);Fn(Te,()=>"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 H=x(Oe,2),J=x(C(H),2),ke=C(J),Ke=x(ke,4);Fn(Ke,()=>"When enabled, every commit (manual or automatic) is immediately pushed to the remote."),As(St,()=>u(Le),nt=>k(Le,nt)),As(ke,()=>u(je),nt=>k(je,nt)),T(re,Je)},Ye=rt(()=>u(on).some(re=>re.id==="git"));$(it,re=>{u(Ye)&&re(xt)})}var pt=x(it,2);{var ei=re=>{var Je=jG(),Oe=x(C(Je),2),xe=C(Oe),St=x(C(xe));Fn(St,()=>"Geographic latitude used for sunrise/sunset calculations. Default: 48.7408 (Stuttgart)");var Te=x(xe,2),H=x(Oe,2),J=C(H),ke=x(C(J));Fn(ke,()=>"Geographic longitude used for sunrise/sunset calculations. Default: 9.1778 (Stuttgart)");var Ke=x(J,2),nt=x(H,2),at=x(C(nt),2),ut=C(at),ye=C(ut);{var Et=le=>{var _e=Ur("…");T(le,_e)},dt=le=>{var _e=Ur("📍 Use my location");T(le,_e)};$(ye,le=>{u(ai)?le(Et):le(dt,-1)})}var he=x(ut,2),Ct=C(he),Ze=x(nt,2);{var Ie=le=>{var _e=VG(),Qe=x(C(_e),2);bs(Qe,Bt=>k(yt,Bt),()=>u(yt)),T(le,_e)};$(Ze,le=>{u(Ot)&&le(Ie)})}G(()=>{ut.disabled=u(ai),q(Ct,u(Ot)?"Hide map":"Pick on map")}),Ni(Te,()=>u(ve),le=>k(ve,le)),Ni(Ke,()=>u(st),le=>k(st,le)),te("click",ut,Xi),te("click",he,()=>k(Ot,!u(Ot))),T(re,Je)},Ut=rt(()=>u(on).some(re=>re.id==="solar"));$(pt,re=>{u(Ut)&&re(ei)})}var Rt=x(pt,2);{var Oi=re=>{var Je=UG(),Oe=x(C(Je),2),xe=C(Oe),St=x(C(xe));Fn(St,()=>"Minimum log level. debug shows all messages including MQTT traffic details.");var Te=x(xe,2),H=C(Te);H.value=H.__value="debug";var J=x(H);J.value=J.__value="info";var ke=x(J);ke.value=ke.__value="warn";var Ke=x(ke);Ke.value=Ke.__value="error",_a(Te,()=>u(Qt),nt=>k(Qt,nt)),T(re,Je)},an=rt(()=>u(on).some(re=>re.id==="logging"));$(Rt,re=>{u(an)&&re(Oi)})}var Wi=x(Rt,2);{var ti=re=>{var Je=qG(),Oe=x(C(Je),2),xe=C(Oe),St=x(C(xe));Fn(St,()=>"Path to the sheDB data directory. Defaults to {dataDir}/db. Leave empty to disable sheDB.");var Te=x(xe,2),H=x(Oe,2),J=C(H),ke=x(C(J));Fn(ke,()=>"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 Ke=x(J,2),nt=x(H,2),at=x(C(nt),2);let ut;var ye=C(at),Et=x(ye,4);Fn(Et,()=>'When enabled, every document change is published to {dbPrefix}doc/{id}. Individual views can publish independently via their own "mqttpub" setting.');var dt=x(nt,2);{var he=Ct=>{var Ze=$G(),Ie=x(C(Ze),2);let le;var _e=C(Ie),Qe=x(_e,4);Fn(Qe,()=>"When enabled, MQTT messages for document changes are published as retained messages."),G(()=>{le=$t(Ie,1,"check-label svelte-767znw",null,le,{muted:!u(Ne)}),_e.disabled=!u(Ne)}),As(_e,()=>u(ot),Bt=>k(ot,Bt)),T(Ct,Ze)};$(dt,Ct=>{u(Re)&&Ct(he)})}G(()=>{Hn(Te,"placeholder",`defaults to ${u(i)??""}/db`),Ke.disabled=!u(Ne),ut=$t(at,1,"check-label svelte-767znw",null,ut,{muted:!u(Ne)}),ye.disabled=!u(Ne)}),Ni(Te,()=>u(Ne),Ct=>k(Ne,Ct)),Ni(Ke,()=>u(Ge),Ct=>k(Ge,Ct)),As(ye,()=>u(Re),Ct=>k(Re,Ct)),T(re,Je)},ji=rt(()=>u(on).some(re=>re.id==="shedb"));$(Wi,re=>{u(ji)&&re(ti)})}var A=x(Wi,2);{var K=re=>{var Je=KG(),Oe=x(C(Je),2),xe=C(Oe),St=x(C(xe));Fn(St,()=>"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 Te=x(xe,2);Ni(Te,()=>u(At),H=>k(At,H)),T(re,Je)},Ee=rt(()=>u(on).some(re=>re.id==="redis"));$(A,re=>{u(Ee)&&re(K)})}var Pe=x(A,2);{var Be=re=>{var Je=e9(),Oe=x(C(Je),2),xe=C(Oe),St=x(C(xe));Fn(St,()=>"Choose a provider. Free options need a free API key from the provider's website — no credit card required.");var Te=x(xe,2);_i(Te,21,()=>ni,Vn,(he,Ct)=>{var Ze=GG(),Ie=C(Ze),le={};G(()=>{q(Ie,u(Ct).label),le!==(le=u(Ct).id)&&(Ze.value=(Ze.__value=u(Ct).id)??"")}),T(he,Ze)});var H=x(Oe,2);{var J=he=>{var Ct=YG();let Ze;var Ie=C(Ct);{var le=Bt=>{var fe=ZG(),$e=x(bt(fe));G(()=>q($e,` ${u(Ei).freeNote??""}`)),T(Bt,fe)};$(Ie,Bt=>{u(Ei).freeNote&&Bt(le)})}var _e=x(Ie,2);{var Qe=Bt=>{var fe=XG(),$e=x(bt(fe));G(()=>Hn($e,"href",u(Ei).apiKeyUrl)),T(Bt,fe)};$(_e,Bt=>{u(Ei).apiKeyUrl&&Bt(Qe)})}G(()=>Ze=$t(Ct,1,"preset-note svelte-767znw",null,Ze,{free:!!u(Ei).freeNote})),T(he,Ct)};$(H,he=>{var Ct,Ze;((Ct=u(Ei))!=null&&Ct.freeNote||(Ze=u(Ei))!=null&&Ze.apiKeyUrl)&&he(J)})}var ke=x(H,2);{var Ke=he=>{var Ct=JG(),Ze=C(Ct),Ie=x(C(Ze));Fn(Ie,()=>"Base URL of the LLM API. Auto-filled for cloud presets. For Ollama: http://localhost:11434.");var le=x(Ze,2);G(()=>{var _e;return Hn(le,"placeholder",u(Xt)==="ollama"?"http://localhost:11434":u(Xt)==="lmstudio"?"http://localhost:1234":((_e=u(Ei))==null?void 0:_e.baseUrl)??"")}),Ni(le,()=>u(vt),_e=>k(vt,_e)),T(he,Ct)};$(ke,he=>{u(Xt)!=="anthropic"&&he(Ke)})}var nt=x(ke,2),at=C(nt),ut=x(C(at));Fn(ut,()=>"Model identifier. Suggested default is filled in when you choose a preset.");var ye=x(at,2),Et=x(nt,2);{var dt=he=>{var Ct=QG(),Ze=C(Ct),Ie=x(C(Ze));Fn(Ie,()=>"Stored in config.json. Not needed for local providers.");var le=x(Ze,2);Ni(le,()=>u(vi),_e=>k(vi,_e)),T(he,Ct)};$(Et,he=>{u(Xt)!=="ollama"&&u(Xt)!=="lmstudio"&&he(dt)})}G(()=>{var he;return Hn(ye,"placeholder",((he=u(Ei))==null?void 0:he.defaultModel)||"e.g. llama3.2")}),te("change",Te,nn),_a(Te,()=>u(Xt),he=>k(Xt,he)),Ni(ye,()=>u(Li),he=>k(Li,he)),T(re,Je)},Me=rt(()=>u(on).some(re=>re.id==="ai"));$(Pe,re=>{u(Me)&&re(Be)})}T(j,pe)};$(O,j=>{u(Hi)?j(se):j(be,-1)})}G(()=>{Dt.disabled=u(dn),q(Nt,u(dn)?"Saving…":"Save")}),Ni(hn,()=>u($n),j=>k($n,j)),te("click",Dt,li),T(o,Ci),Ao()}Cr(["click","change"]);var s9=R("<option> </option>"),o9=R('<div><span class="ts svelte-18loop9"> </span> <span class="lvl svelte-18loop9"> </span> <span class="msg svelte-18loop9"> </span></div>'),r9=R('<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 a9(o,e){Ro(e,!0);let t=B(Si(C7())),i,n=B(!0),s=B("all"),r=B(""),a=B(!1);const c=["all","debug","info","warn","error"],h={debug:0,info:1,warn:2,error:3};bR(X=>{k(t,[...u(t).slice(-1999),X],!0)}),xr(()=>{i&&(i.scrollTop=i.scrollHeight)}),zn(()=>{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=r9(),_=C(v),w=x(C(_),2);_i(w,21,()=>c,Vn,(X,me)=>{var Le=s9(),je=C(Le),ve={};G(()=>{q(je,u(me)),ve!==(ve=u(me))&&(Le.value=(Le.__value=u(me))??"")}),T(X,Le)});var S=x(w,2),D=x(S,2),P=C(D),N=x(D,2),V=C(N),F=x(N,2),Y=x(_,2);_i(Y,21,()=>u(t).filter(f),X=>X.ts+X.msg,(X,me)=>{var Le=o9(),je=C(Le),ve=C(je),st=x(je,2),Ot=C(st),yt=x(st,2),ai=C(yt);G((jt,Qt)=>{$t(Le,1,`line ${u(me).level??""}`,"svelte-18loop9"),q(ve,jt),q(Ot,Qt),q(ai,u(me).msg)},[()=>p(u(me).ts),()=>u(me).level.toUpperCase()]),T(X,Le)}),bs(Y,X=>i=X,()=>i),_a(w,()=>u(s),X=>k(s,X)),Ni(S,()=>u(r),X=>k(r,X)),As(P,()=>u(a),X=>k(a,X)),As(V,()=>u(n),X=>k(n,X)),te("click",F,g),T(o,v),Ao()}Cr(["click"]);var l9=R('<span class="chat-model svelte-1twuiul"><!></span>'),c9=R('<button class="clear-btn svelte-1twuiul" title="Clear conversation">✕</button>'),d9=R('<div class="unconfigured svelte-1twuiul">Configure an AI provider in the <strong class="svelte-1twuiul">Config</strong> tab to use the AI assistant.</div>'),h9=R('Working on view <code class="svelte-1twuiul"> </code>',1),u9=R('<button class="chip svelte-1twuiul"> </button>'),g9=R('<div class="suggestions svelte-1twuiul"><p class="suggestions-hint svelte-1twuiul"><!></p> <!></div>'),f9=R('<div class="msg-content user-text svelte-1twuiul"> </div>'),BD=R('<div class="tool-event tool-call svelte-1twuiul"><span class="tool-icon svelte-1twuiul">🔧</span><span class="tool-name svelte-1twuiul"> </span></div>'),zD=R('<div class="tool-event tool-result svelte-1twuiul"><span class="tool-icon svelte-1twuiul">✓</span><span class="tool-name svelte-1twuiul"> </span></div>'),VD=R('<div class="tool-events svelte-1twuiul"></div>'),jD=R('<div class="text-block svelte-1twuiul"></div>'),p9=R('<button class="expand-btn svelte-1twuiul"> </button>'),m9=R('<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>'),_9=R('<div class="apply-view-row svelte-1twuiul"><button class="apply-view-btn svelte-1twuiul"> </button></div>'),v9=R('<!> <div class="msg-content svelte-1twuiul"><!> <!></div>',1),b9=R("<div><!></div>"),y9=R('<div class="message assistant svelte-1twuiul"><div class="msg-content svelte-1twuiul"><span class="status-shimmer svelte-1twuiul"> </span></div></div>'),w9=R('<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>'),S9=R('<div class="message assistant streaming svelte-1twuiul"><div class="msg-content svelte-1twuiul"></div></div>'),C9=R('<div class="chat-error svelte-1twuiul"> </div>'),x9=R('<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>'),L9=R('<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>'),k9=R('<button class="stop-btn svelte-1twuiul" title="Stop generation">■</button>'),I9=R('<button class="send-btn svelte-1twuiul">↑</button>'),D9=R('<option class="svelte-1twuiul"> </option>'),E9=R('<select class="model-select svelte-1twuiul"></select>'),P9=R('<span class="model-name svelte-1twuiul"> </span>'),T9=R('<button class="info-btn svelte-1twuiul" title="Model info">ℹ</button>'),M9=R('<div class="model-bar svelte-1twuiul"><span class="model-provider svelte-1twuiul"> </span> <!> <!></div>'),N9=R('<p class="info-status svelte-1twuiul">Loading…</p>'),R9=R('<p class="info-status info-err svelte-1twuiul"> </p>'),A9=R('<dt class="svelte-1twuiul">Ollama version</dt><dd class="svelte-1twuiul"> </dd>',1),O9=R('<dt class="svelte-1twuiul">Family</dt><dd class="svelte-1twuiul"> </dd>',1),F9=R('<dt class="svelte-1twuiul">Parameters</dt><dd class="svelte-1twuiul"> </dd>',1),H9=R('<dt class="svelte-1twuiul">Quantization</dt><dd class="svelte-1twuiul"> </dd>',1),W9=R('<div class="running-model svelte-1twuiul"> </div>'),B9=R('<dt class="svelte-1twuiul">Loaded</dt> <dd class="svelte-1twuiul"></dd>',1),z9=R('<dt class="svelte-1twuiul">Loaded</dt><dd class="dim svelte-1twuiul">Not in memory</dd>',1),V9=R('<dl class="svelte-1twuiul"><!> <!> <!> <!> <!></dl>'),j9=R('<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>'),U9=R('<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 $9(o,e){Ro(e,!0),Xv.registerLanguage("javascript",xR),Wn.use({breaks:!0,gfm:!0});let t=cg(e,"currentView",3,null);const i="she:viewchat:messages";let n=B(Si(JSON.parse(localStorage.getItem(i)??"[]"))),s=B(null),r=B(""),a=B(!1),c=B(""),h=B(null),g=B(Si([])),f=B(Si(localStorage.getItem("she:selectedModel")??""));zn(()=>{localStorage.setItem(i,JSON.stringify(u(n)))});let p=B(Si(new Set)),v=B(!1),_=B(null),w=B(!1),S=B(""),D=null,P=B(0);const N=["[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 V=B(!0),F=B(!0),Y=B(!0),X=B(Si([])),me=B(!0),Le=B(!1),je,ve=B(Si([])),st=B(0),Ot,yt;const ai=rt(()=>({apiref:!1,shedb:u(V),sampleDocs:u(F),tools:u(Y)})),jt=rt(()=>{var A;return((A=u(h))==null?void 0:A.configured)??!1}),Qt=rt(()=>u(st)+new TextEncoder().encode(u(r)).length),Ne=rt(()=>u(me)?t():null);async function Ge(){try{const A=await gR();k(h,A,!0),A.configured&&!u(f)&&k(f,A.model,!0)}catch{}}zn(()=>(window.addEventListener("she:config-changed",Ge),()=>window.removeEventListener("she:config-changed",Ge))),xr(()=>{Ge()}),zn(()=>{u(f)&&localStorage.setItem("she:selectedModel",u(f))}),zn(()=>{var A;(A=u(h))!=null&&A.provider&&fR().then(K=>{k(g,K.models,!0),!u(f)&&K.models.length>0&&k(f,K.models[0],!0)}).catch(()=>{})}),zn(()=>{u(f),k(_,null),k(S,"")}),zn(()=>{const A=u(ai),K=u(Ne),Ee=u(X);u(jt)&&mR({context:A,currentView:K??null,extraFiles:Ee.length>0?Ee:void 0}).then(Pe=>{k(st,new TextEncoder().encode(Pe.prompt).length,!0)}).catch(()=>{})}),zn(()=>{if(!u(a))return;k(P,Math.floor(Math.random()*N.length),!0);const A=setInterval(()=>{k(P,(u(P)+1)%N.length)},1e4);return()=>clearInterval(A)}),zn(()=>{var A;yt&&(u(n).length+(((A=u(s))==null?void 0:A.length)??0),requestAnimationFrame(()=>{yt&&(yt.scrollTop=yt.scrollHeight)}))});function Re(A){const K=[],Ee=/```(\w*)\n([\s\S]*?)```/g;let Pe=0,Be;for(;(Be=Ee.exec(A))!==null;)Be.index>Pe&&K.push({type:"text",text:A.slice(Pe,Be.index)}),K.push({type:"code",lang:Be[1]||"text",text:Be[2].trimEnd()}),Pe=Be.index+Be[0].length;return Pe<A.length&&K.push({type:"text",text:A.slice(Pe)}),K}function ot(A){const K=[],Ee=/```(\w*)\n([\s\S]*?)```/g;let Pe=0,Be;for(;(Be=Ee.exec(A))!==null;)Be.index>Pe&&K.push({type:"text",text:A.slice(Pe,Be.index)}),K.push({type:"code",lang:Be[1]||"text",text:Be[2].trimEnd()}),Pe=Be.index+Be[0].length;const Me=A.slice(Pe),re=Me.match(/```(\w*)\n([\s\S]*)$/);return re?(re.index>0&&K.push({type:"text",text:Me.slice(0,re.index)}),K.push({type:"code",lang:re[1]||"text",text:re[2]})):Me&&K.push({type:"text",text:Me}),K}function At(A){const K={};for(const Ee of A)if(Ee.type==="code"){if(Ee.lang==="filter")K.filter=Ee.text.trim();else if(Gi(Ee.lang)){const Pe=Ee.text.split(`
|
|
218
218
|
`)[0].trim();Pe==="// @view-map"?K.map=Ee.text.split(`
|
|
219
219
|
`).slice(1).join(`
|
|
220
220
|
`).trim():Pe==="// @view-reduce"&&(K.reduce=Ee.text.split(`
|
|
@@ -222,4 +222,4 @@ declare const she: {
|
|
|
222
222
|
`).trim())}}return K}function ni(A){return A.filter!==void 0||A.map!==void 0||A.reduce!==void 0}function Xt(A){const K=[];return A.filter!==void 0&&K.push("filter"),A.map!==void 0&&K.push("map"),A.reduce!==void 0&&K.push("reduce"),`Apply ${K.join(" + ")}`}const zt=15;function vt(A){return A.split(`
|
|
223
223
|
`).length>zt}function Li(A){const K=new Set(u(p));K.has(A)?K.delete(A):K.add(A),k(p,K,!0)}function vi(A,K){if(Gi(K))try{return Xv.highlight(A,{language:"javascript"}).value}catch{}return A.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Tn(A){return Wn.parse(A)}function Gi(A){return!A||A==="js"||A==="javascript"}function Bn(A){navigator.clipboard.writeText(A).catch(()=>{})}async function nn(){if(k(v,!0),!(u(_)||u(w))){k(w,!0),k(S,"");try{k(_,await pR(u(f)||u(h).model),!0)}catch(A){k(S,A.message,!0)}k(w,!1)}}function Ei(A){return A>=1e9?`${(A/1e9).toFixed(1)} GB`:A>=1e6?`${(A/1e6).toFixed(0)} MB`:`${A} B`}function Mn(A){const K=A.match(/\.([^.]+)$/);return K?K[1].toUpperCase():"?"}function sn(A){switch(A){case"SH":case"BASH":return"$";case"MD":case"MARKDOWN":return"↓";case"JSON":case"JSONC":return"{}";default:return A}}function Sn(A){k(X,u(X).filter((K,Ee)=>Ee!==A),!0)}function Xi(){je.click()}async function Hi(A){if(!(!A||A.length===0))for(const K of Array.from(A)){const Ee=await K.text();k(X,[...u(X),{name:K.name,content:Ee}],!0)}}function dn(A){const K=A.target;Hi(K.files),K.value=""}function Nn(A){var K;A.preventDefault(),k(Le,!1),Hi(((K=A.dataTransfer)==null?void 0:K.files)??null)}function Rn(A){var K;(K=A.dataTransfer)!=null&&K.types.includes("Files")&&(A.preventDefault(),k(Le,!0))}function $n(){k(Le,!1)}async function Cn(){const A=u(r).trim();if(!(!A||u(a))){k(r,""),k(c,""),k(a,!0),k(n,[...u(n),{role:"user",content:A}],!0),D=new AbortController,k(ve,[],!0);try{await _R({messages:u(n),currentView:u(Ne),context:u(ai),modelOverride:u(f)||void 0,extraFiles:u(X).length>0?u(X):void 0},K=>{k(s,(u(s)??"")+K)},D.signal,K=>{k(ve,[...u(ve),K],!0)}),k(n,[...u(n),{role:"assistant",content:u(s)??"",toolEvents:u(ve).length>0?[...u(ve)]:void 0}],!0),k(ve,[],!0)}catch(K){if(K.name==="AbortError"){const Ee=u(s);Ee!=null&&Ee.trim()&&k(n,[...u(n),{role:"assistant",content:Ee+`
|
|
224
224
|
|
|
225
|
-
*[stopped]*`,toolEvents:u(ve).length>0?[...u(ve)]:void 0}],!0)}else k(c,K.message,!0)}finally{D=null,k(s,null),k(ve,[],!0),k(a,!1)}}}function pn(){D==null||D.abort()}function on(A){A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),Cn())}function qe(){k(n,[],!0),k(c,"")}const Ft=["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 li(A){k(r,A,!0),Ot==null||Ot.focus()}var Ci=U9(),Ii=bt(Ci),mn=C(Ii),xn=x(C(mn),2);{var qn=A=>{var K=l9(),Ee=C(K);{var Pe=Me=>{var re=Ur();G(()=>q(re,`${u(h).provider??""} · ${(u(f)||u(h).model)??""}`)),T(Me,re)},Be=Me=>{var re=Ur("Not configured");T(Me,re)};$(Ee,Me=>{u(jt)?Me(Pe):Me(Be,-1)})}G(()=>Hn(K,"title",`Provider: ${u(h).provider??""}`)),T(A,K)};$(xn,A=>{u(h)&&A(qn)})}var hn=x(xn,2);{var An=A=>{var K=c9();te("click",K,qe),T(A,K)};$(hn,A=>{u(n).length>0&&A(An)})}var rn=x(mn,2),Ln=C(rn);{var Ae=A=>{var K=d9();T(A,K)},Z=A=>{var K=g9(),Ee=C(K),Pe=C(Ee);{var Be=Je=>{var Oe=h9(),xe=x(bt(Oe)),St=C(xe);G(()=>q(St,t().id)),T(Je,Oe)},Me=Je=>{var Oe=Ur("No view selected. Ask a general sheDB view question.");T(Je,Oe)};$(Pe,Je=>{t()?Je(Be):Je(Me,-1)})}var re=x(Ee,2);_i(re,17,()=>Ft,Vn,(Je,Oe)=>{var xe=u9(),St=C(xe);G(()=>q(St,u(Oe))),te("click",xe,()=>li(u(Oe))),T(Je,xe)}),T(A,K)};$(Ln,A=>{u(jt)?u(n).length===0&&u(s)===null&&A(Z,1):A(Ae)})}var Fe=x(Ln,2);_i(Fe,17,()=>u(n),Vn,(A,K,Ee)=>{var Pe=b9(),Be=C(Pe);{var Me=Je=>{var Oe=f9(),xe=C(Oe);G(()=>q(xe,u(K).content)),T(Je,Oe)},re=Je=>{const Oe=rt(()=>Re(u(K).content)),xe=rt(()=>At(u(Oe)));var St=v9(),Te=bt(St);{var H=ut=>{var ye=VD();_i(ye,21,()=>u(K).toolEvents,Vn,(Et,dt)=>{var he=Fs(),Ct=bt(he);{var Ze=le=>{var _e=BD(),Qe=x(C(_e)),Bt=C(Qe);G(fe=>q(Bt,fe),[()=>u(dt).name.replace(/_/g," ")]),T(le,_e)},Ie=le=>{var _e=zD(),Qe=x(C(_e)),Bt=C(Qe);G(fe=>q(Bt,fe),[()=>u(dt).name.replace(/_/g," ")]),T(le,_e)};$(Ct,le=>{u(dt).type==="tool_call"?le(Ze):le(Ie,-1)})}T(Et,he)}),T(ut,ye)};$(Te,ut=>{var ye;(ye=u(K).toolEvents)!=null&&ye.length&&ut(H)})}var J=x(Te,2),ke=C(J);_i(ke,17,()=>u(Oe),Vn,(ut,ye,Et)=>{var dt=Fs(),he=bt(dt);{var Ct=Ie=>{var le=jD();Ul(le,()=>Tn(u(ye).text),!0),T(Ie,le)},Ze=Ie=>{const le=rt(()=>`${Ee}:${Et}`),_e=rt(()=>vt(u(ye).text)),Qe=rt(()=>u(p).has(u(le))),Bt=rt(()=>u(ye).lang==="filter");var fe=m9(),$e=C(fe),gt=C($e),Pt=C(gt),et=x(gt,2),ci=C(et),Jt=x($e,2);let Gn;var $i=C(Jt),oi=C($i);Ul(oi,()=>vi(u(ye).text,u(ye).lang??""),!0);var Gt=x($i,2);{var _n=ri=>{var On=p9(),Yi=C(On);G(()=>q(Yi,u(Qe)?"▲ collapse":"▼ expand")),te("click",On,()=>Li(u(le))),T(ri,On)};$(Gt,ri=>{u(_e)&&ri(_n)})}G(()=>{q(Pt,u(Bt)?"filter":u(ye).lang),Gn=$t(Jt,1,"code-body svelte-1twuiul",null,Gn,{collapsed:u(_e)&&!u(Qe)})}),te("click",ci,()=>Bn(u(ye).text)),T(Ie,fe)};$(he,Ie=>{u(ye).type==="text"?Ie(Ct):Ie(Ze,-1)})}T(ut,dt)});var Ke=x(ke,2);{var nt=ut=>{var ye=_9(),Et=C(ye),dt=C(Et);G(he=>q(dt,he),[()=>Xt(u(xe))]),te("click",Et,()=>e.onApplyView(u(xe))),T(ut,ye)},at=rt(()=>ni(u(xe))&&e.onApplyView);$(Ke,ut=>{u(at)&&ut(nt)})}T(Je,St)};$(Be,Je=>{u(K).role==="user"?Je(Me):Je(re,-1)})}G(()=>$t(Pe,1,`message ${u(K).role??""}`,"svelte-1twuiul")),T(A,Pe)});var wt=x(Fe,2);{var Dt=A=>{var K=VD();_i(K,21,()=>u(ve),Vn,(Ee,Pe)=>{var Be=Fs(),Me=bt(Be);{var re=Oe=>{var xe=BD(),St=x(C(xe)),Te=C(St);G(H=>q(Te,H),[()=>u(Pe).name.replace(/_/g," ")]),T(Oe,xe)},Je=Oe=>{var xe=zD(),St=x(C(xe)),Te=C(St);G(H=>q(Te,H),[()=>u(Pe).name.replace(/_/g," ")]),T(Oe,xe)};$(Me,Oe=>{u(Pe).type==="tool_call"?Oe(re):Oe(Je,-1)})}T(Ee,Be)}),T(A,K)};$(wt,A=>{u(ve).length>0&&A(Dt)})}var Nt=x(wt,2);{var O=A=>{var K=y9(),Ee=C(K),Pe=C(Ee),Be=C(Pe);G(()=>q(Be,N[u(P)])),T(A,K)};$(Nt,A=>{u(a)&&u(s)===null&&u(ve).length===0&&A(O)})}var se=x(Nt,2);{var be=A=>{var K=S9(),Ee=C(K);_i(Ee,21,()=>ot(u(s)),Vn,(Pe,Be)=>{var Me=Fs(),re=bt(Me);{var Je=xe=>{var St=jD();Ul(St,()=>Tn(u(Be).text),!0),T(xe,St)},Oe=xe=>{var St=w9(),Te=C(St),H=C(Te),J=C(H),ke=x(Te,2),Ke=C(ke);Ul(Ke,()=>vi(u(Be).text,u(Be).lang??""),!0),G(()=>q(J,u(Be).lang)),T(xe,St)};$(re,xe=>{u(Be).type==="text"?xe(Je):xe(Oe,-1)})}T(Pe,Me)}),T(A,K)};$(se,A=>{u(s)!==null&&A(be)})}bs(rn,A=>yt=A,()=>yt);var j=x(rn,2);{var pe=A=>{var K=C9(),Ee=C(K);G(()=>q(Ee,u(c))),T(A,K)};$(j,A=>{u(c)&&A(pe)})}var Ue=x(j,2),Ce=C(Ue),De=C(Ce),Xe=x(Ce,2),Vt=C(Xe),ft=x(Xe,2),ue=C(ft),ht=x(ft,2),ii=C(ht),Kt=x(Ue,2),si=C(Kt);{var ui=A=>{var K=x9();let Ee;var Pe=x(C(K),2),Be=C(Pe),Me=x(Pe,2),re=C(Me);G(()=>{Ee=$t(K,1,"file-chip svelte-1twuiul",null,Ee,{inactive:!u(me)}),q(Be,t().id),Hn(Me,"title",u(me)?"Remove from context":"Re-add to context"),q(re,u(me)?"×":"+")}),te("click",Me,()=>k(me,!u(me))),T(A,K)};$(si,A=>{t()&&A(ui)})}var Q=x(si,2);_i(Q,17,()=>u(X),Vn,(A,K,Ee)=>{const Pe=rt(()=>Mn(u(K).name));var Be=L9(),Me=C(Be),re=C(Me),Je=x(Me,2),Oe=C(Je),xe=x(Je,2);G((St,Te)=>{$t(Me,1,`badge badge-${St??""}`,"svelte-1twuiul"),q(re,Te),q(Oe,u(K).name)},[()=>u(Pe).toLowerCase(),()=>sn(u(Pe))]),te("click",xe,()=>Sn(Ee)),T(A,Be)});var ge=x(Q,2),We=x(ge,2);bs(We,A=>je=A,()=>je);var it=x(Kt,2);let xt;var Ye=C(it);let pt;var ei=C(Ye);bs(ei,A=>Ot=A,()=>Ot);var Ut=x(Ye,2);{var Rt=A=>{var K=k9();te("click",K,pn),T(A,K)},Oi=A=>{var K=I9();G(Ee=>K.disabled=Ee,[()=>!u(r).trim()||!u(jt)]),te("click",K,Cn),T(A,K)};$(Ut,A=>{u(a)?A(Rt):A(Oi,-1)})}var an=x(it,2);{var Wi=A=>{var K=M9(),Ee=C(K),Pe=C(Ee),Be=x(Ee,2);{var Me=xe=>{var St=E9();_i(St,21,()=>u(g),Vn,(Te,H)=>{var J=D9(),ke=C(J),Ke={};G(()=>{q(ke,u(H)),Ke!==(Ke=u(H))&&(J.value=(J.__value=u(H))??"")}),T(Te,J)}),G(()=>St.disabled=u(a)),_a(St,()=>u(f),Te=>k(f,Te)),T(xe,St)},re=xe=>{var St=P9(),Te=C(St);G(()=>q(Te,u(f)||u(h).model)),T(xe,St)};$(Be,xe=>{u(g).length>0?xe(Me):xe(re,-1)})}var Je=x(Be,2);{var Oe=xe=>{var St=T9();te("click",St,nn),T(xe,St)};$(Je,xe=>{u(h).provider==="ollama"&&xe(Oe)})}G(()=>q(Pe,u(h).provider)),T(A,K)};$(an,A=>{u(jt)&&u(h)&&A(Wi)})}var ti=x(Ii,2);{var ji=A=>{var K=j9(),Ee=C(K),Pe=C(Ee),Be=C(Pe),Me=C(Be),re=x(Be,2),Je=x(Pe,2),Oe=C(Je);{var xe=H=>{var J=N9();T(H,J)},St=H=>{var J=R9(),ke=C(J);G(()=>q(ke,u(S))),T(H,J)},Te=H=>{var J=V9(),ke=C(J);{var Ke=Ie=>{var le=A9(),_e=x(bt(le)),Qe=C(_e);G(()=>q(Qe,u(_).version)),T(Ie,le)};$(ke,Ie=>{u(_).version&&Ie(Ke)})}var nt=x(ke,2);{var at=Ie=>{var le=O9(),_e=x(bt(le)),Qe=C(_e);G(()=>q(Qe,u(_).details.family)),T(Ie,le)};$(nt,Ie=>{var le;(le=u(_).details)!=null&&le.family&&Ie(at)})}var ut=x(nt,2);{var ye=Ie=>{var le=F9(),_e=x(bt(le)),Qe=C(_e);G(()=>q(Qe,u(_).details.parameter_size)),T(Ie,le)};$(ut,Ie=>{var le;(le=u(_).details)!=null&&le.parameter_size&&Ie(ye)})}var Et=x(ut,2);{var dt=Ie=>{var le=H9(),_e=x(bt(le)),Qe=C(_e);G(()=>q(Qe,u(_).details.quantization_level)),T(Ie,le)};$(Et,Ie=>{var le;(le=u(_).details)!=null&&le.quantization_level&&Ie(dt)})}var he=x(Et,2);{var Ct=Ie=>{var le=B9(),_e=x(bt(le),2);_i(_e,21,()=>u(_).running,Vn,(Qe,Bt)=>{var fe=W9(),$e=C(fe);G(gt=>q($e,`${u(Bt).name??""} · ${gt??""} VRAM`),[()=>Ei(u(Bt).size_vram)]),T(Qe,fe)}),T(Ie,le)},Ze=Ie=>{var le=z9();T(Ie,le)};$(he,Ie=>{u(_).running&&u(_).running.length>0?Ie(Ct):u(_).running!==null&&Ie(Ze,1)})}T(H,J)};$(Oe,H=>{u(w)?H(xe):u(S)?H(St,1):u(_)&&H(Te,2)})}G(()=>{var H;return q(Me,`Ollama · ${(u(f)||((H=u(h))==null?void 0:H.model))??""}`)}),te("click",K,()=>k(v,!1)),te("click",Ee,H=>H.stopPropagation()),te("click",re,()=>k(v,!1)),T(A,K)};$(ti,A=>{u(v)&&A(ji)})}G(A=>{q(ii,A),xt=$t(it,1,"input-row svelte-1twuiul",null,xt,{"drag-over":u(Le)}),pt=$t(Ye,1,"textarea-wrap svelte-1twuiul",null,pt,{loading:u(a)}),Hn(ei,"placeholder",u(jt)?"Ask anything… (Enter to send, Shift+Enter for newline, drag & drop files to add context)":"AI not configured"),ei.disabled=u(a)||!u(jt)},[()=>Ei(u(Qt))]),As(De,()=>u(V),A=>k(V,A)),As(Vt,()=>u(F),A=>k(F,A)),As(ue,()=>u(Y),A=>k(Y,A)),te("click",ge,Xi),te("change",We,dn),os("dragover",it,Rn),os("dragleave",it,$n),os("drop",it,Nn),te("keydown",ei,on),Ni(ei,()=>u(r),A=>k(r,A)),T(o,Ci),Ao()}Cr(["click","change","keydown"]);var q9=R('<div class="me svelte-1pxdb1"></div>');function Zw(o,e){Ro(e,!0);let t=cg(e,"value",15,""),i=cg(e,"language",3,"javascript"),n,s,r=!1;xr(()=>{const c=i()==="json"?{formatOnPaste:!0,autoIndent:"full"}:{};s=tr.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())})}),yy(()=>s==null?void 0:s.dispose()),zn(()=>{!s||s.getValue()===t()||(r=!0,s.setValue(t()),r=!1)});var a=q9();bs(a,c=>n=c,()=>n),T(o,a),Ao()}var K9=R('<!> <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 — 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),G9=R('<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>'),UD=R('<div class="form-error svelte-rrt0o"> </div>'),Z9=R('<div class="new-item-form svelte-rrt0o"><input placeholder="device/lamp1" class="svelte-rrt0o"/> <button class="svelte-rrt0o">Create</button></div> <!>',1),$D=R("<li> </li>"),qD=R('<div class="error-bar svelte-rrt0o"> </div>'),KD=R('<div class="loading svelte-rrt0o">Loading…</div>'),X9=R('<div class="monaco-doc-wrap svelte-rrt0o"><!></div>'),Y9=R('<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),J9=R('<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>'),Q9=R('<div class="new-item-form svelte-rrt0o"><input placeholder="myView" class="svelte-rrt0o"/> <button class="svelte-rrt0o">Create</button></div> <!>',1),eZ=R('<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>'),tZ=R('<span class="badge-error svelte-rrt0o">error</span>'),iZ=R('<span class="badge-ok svelte-rrt0o"> </span>'),nZ=R('<pre class="result-error svelte-rrt0o"> </pre>'),sZ=R('<pre class="result-json svelte-rrt0o"> </pre>'),oZ=R('<div class="view-result svelte-rrt0o"><div class="result-header svelte-rrt0o">Result <!></div> <!></div>'),rZ=R('<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 · 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>'),aZ=R('<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),lZ=R('<div class="chat-resize-handle svelte-rrt0o" role="separator"></div> <div class="chat-pane svelte-rrt0o"><!></div>',1),cZ=R('<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>'),dZ=R('<div class="db-root svelte-rrt0o" role="presentation"><div class="panel-tabs svelte-rrt0o"><button>Documents</button> <button>Views</button> <!></div> <!></div>');function hZ(o,e){Ro(e,!0);const t=Ae=>{var Z=K9(),Fe=bt(Z);bs(Hg(Fe,{}),wt=>sn=wt,()=>sn),T(Ae,Z)};let i=B(Si([])),n=B(null),s=B("{}"),r=B(!1),a=B(null);const c="she-db-selected-view";let h=B(Si([])),g=B(Si(localStorage.getItem(c))),f=B("#"),p=B("// emit(this.someProperty)"),v=B(""),_=B(""),w=B(!1),S=B(!1),D=B(null),P=B(!1),N=B(null),V=B("she/db/view/");const F="she-db-panel";let Y=B(Si(localStorage.getItem(F)??"docs")),X=B(""),me=B(!1),Le=B(null),je=B(""),ve=B(!1),st=B(null);const Ot="she-db-sidebar-width";let yt=B(Si(parseInt(localStorage.getItem(Ot)??"220",10))),ai=!1,jt=0,Qt=0;const Ne="she-db-chat-width",Ge="she-db-chat-open";let Re=B(localStorage.getItem(Ge)==="true"),ot=B(Si(parseInt(localStorage.getItem(Ne)??"320",10))),At=!1,ni=0,Xt=0;const zt=rt(()=>u(g)?{id:u(g),filter:u(f),map:u(p),reduce:u(v)}:null);function vt(Ae){Ae.filter!==void 0&&k(f,Ae.filter,!0),Ae.map!==void 0&&k(p,Ae.map,!0),Ae.reduce!==void 0&&k(v,Ae.reduce,!0)}zn(()=>{localStorage.setItem(Ge,String(u(Re)))}),zn(()=>{localStorage.setItem(F,u(Y))}),zn(()=>{u(g)?localStorage.setItem(c,u(g)):localStorage.removeItem(c)});function Li(Ae){ai=!0,jt=Ae.clientX,Qt=u(yt),Ae.preventDefault()}function vi(Ae){ai&&k(yt,Math.max(140,Math.min(500,Qt+Ae.clientX-jt)),!0),At&&k(ot,Math.max(240,Math.min(600,Xt-(Ae.clientX-ni))),!0)}function Tn(){ai&&(ai=!1,localStorage.setItem(Ot,String(u(yt)))),At&&(At=!1,localStorage.setItem(Ne,String(u(ot))))}function Gi(Ae){At=!0,ni=Ae.clientX,Xt=u(ot),Ae.preventDefault()}async function Bn(){try{k(i,await cR(),!0)}catch{}}async function nn(){try{k(h,await dR(),!0)}catch{}}async function Ei(Ae){k(n,Ae,!0),k(a,null),k(r,!0);try{const Z=await o7(Ae);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 Mn(){if(u(n)){k(a,null);try{const Ae=JSON.parse(u(s));await pD(u(n),Ae)}catch(Ae){k(a,Ae instanceof Error?Ae.message:String(Ae),!0)}}}let sn;async function Sn(){if(u(n)&&await sn.show(`Delete document "${u(n)}"?`,{confirm:"Delete",danger:!0}))try{await r7(u(n)),k(n,null),k(s,"{}")}catch(Ae){k(a,Ae instanceof Error?Ae.message:String(Ae),!0)}}async function Xi(){const Ae=u(X).trim();if(Ae){k(Le,null);try{await pD(Ae,{}),k(me,!1),k(X,""),await Ei(Ae)}catch(Z){k(Le,Z instanceof Error?Z.message:String(Z),!0)}}}async function Hi(Ae){k(g,Ae,!0),k(N,null),k(P,!0),k(D,null);try{const Z=await a7(Ae);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 Kw(Ae).catch(()=>null),!0)}catch(Z){k(N,Z instanceof Error?Z.message:String(Z),!0)}finally{k(P,!1)}}async function dn(){if(u(g)){k(N,null);try{const Ae={map:u(p)};u(f).trim()&&(Ae.filter=u(f).trim()),u(v).trim()&&(Ae.reduce=u(v).trim()),u(_).trim()&&(Ae.description=u(_).trim()),u(w)&&(Ae.mqttpub=!0),u(S)&&(Ae.retain=!0),await mD(u(g),Ae)}catch(Ae){k(N,Ae instanceof Error?Ae.message:String(Ae),!0)}}}async function Nn(){if(u(g))try{k(D,await Kw(u(g)),!0)}catch(Ae){k(N,Ae instanceof Error?Ae.message:String(Ae),!0)}}async function Rn(){if(u(g)&&await sn.show(`Delete view "${u(g)}"?`,{confirm:"Delete",danger:!0}))try{await l7(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(Ae){k(N,Ae instanceof Error?Ae.message:String(Ae),!0)}}async function $n(){if(!u(je).trim())return;const Ae=u(je).trim();k(st,null);try{await mD(Ae,{map:"// emit(this.someProperty)"}),k(ve,!1),k(je,""),await nn(),await Hi(Ae)}catch(Z){k(st,Z instanceof Error?Z.message:String(Z),!0)}}let Cn=B(""),pn=B(""),on=rt(()=>[...u(i)].filter(Ae=>!u(Cn)||Ae.toLowerCase().includes(u(Cn).toLowerCase())).sort()),qe=rt(()=>[...u(h)].filter(Ae=>!u(pn)||Ae.toLowerCase().includes(u(pn).toLowerCase())).sort());xr(()=>{Bn(),nn().then(()=>{u(g)&&u(h).includes(u(g))?Hi(u(g)):k(g,null)}),iL().then(Dt=>{const Nt=Dt.dbPrefix||"she/db/",O=Nt.endsWith("/")?Nt:Nt+"/";k(V,O+"view/")}).catch(()=>{});const Ae=Ya("db:ids",Dt=>{k(i,Dt.ids??[],!0)}),Z=Ya("db:viewIds",Dt=>{k(h,Dt.ids??[],!0)}),Fe=Ya("db:change",async Dt=>{const Nt=Dt.id;u(n)===Nt&&(Dt.doc===null?(k(n,null),k(s,"{}")):k(s,JSON.stringify(Dt.doc,null,2),!0))}),wt=Ya("db:viewUpdate",async Dt=>{const Nt=Dt.id;u(g)===Nt&&k(D,await Kw(Nt).catch(()=>null),!0)});return()=>{Ae(),Z(),Fe(),wt()}});var Ft=dZ(),li=C(Ft),Ci=C(li);let Ii;var mn=x(Ci,2);let xn;var qn=x(mn,2);{var hn=Ae=>{var Z=G9();let Fe;G(()=>{Fe=$t(Z,1,"ai-toggle svelte-rrt0o",null,Fe,{"ai-open":u(Re)}),Hn(Z,"title",u(Re)?"Close AI assistant":"Open AI assistant")}),te("click",Z,()=>k(Re,!u(Re))),T(Ae,Z)};$(qn,Ae=>{u(Y)==="views"&&Ae(hn)})}var An=x(li,2);{var rn=Ae=>{var Z=J9(),Fe=C(Z);let wt;var Dt=C(Fe),Nt=C(Dt),O=x(Dt,2);{var se=ft=>{var ue=Z9(),ht=bt(ue),ii=C(ht),Kt=x(ii,2),si=x(ht,2);{var ui=Q=>{var ge=UD(),We=C(ge);G(()=>q(We,u(Le))),T(Q,ge)};$(si,Q=>{u(Le)&&Q(ui)})}te("keydown",ii,Q=>Q.key==="Enter"&&Xi()),Ni(ii,()=>u(X),Q=>k(X,Q)),te("click",Kt,Xi),T(ft,ue)};$(O,ft=>{u(me)&&ft(se)})}var be=x(O,2),j=C(be),pe=x(be,2);_i(pe,20,()=>u(on),ft=>ft,(ft,ue)=>{var ht=$D();let ii;var Kt=C(ht);G(()=>{ii=$t(ht,1,"flat-item svelte-rrt0o",null,ii,{"active-item":u(n)===ue}),q(Kt,ue)}),te("click",ht,()=>Ei(ue)),T(ft,ht)});var Ue=x(Fe,2),Ce=x(Ue,2),De=C(Ce);{var Xe=ft=>{var ue=Y9(),ht=bt(ue),ii=C(ht),Kt=C(ii),si=x(ii,2),ui=x(si,2),Q=x(ht,2);{var ge=Ye=>{var pt=qD(),ei=C(pt);G(()=>q(ei,u(a))),T(Ye,pt)};$(Q,Ye=>{u(a)&&Ye(ge)})}var We=x(Q,2);{var it=Ye=>{var pt=KD();T(Ye,pt)},xt=Ye=>{var pt=X9(),ei=C(pt);Zw(ei,{language:"json",get value(){return u(s)},set value(Ut){k(s,Ut,!0)}}),T(Ye,pt)};$(We,Ye=>{u(r)?Ye(it):Ye(xt,-1)})}G(()=>q(Kt,u(n))),te("click",si,Mn),te("click",ui,Sn),T(ft,ue)},Vt=ft=>{t(ft)};$(De,ft=>{u(n)?ft(Xe):ft(Vt,-1)})}G(()=>wt=Ko(Fe,"",wt,{width:`${u(yt)??""}px`})),te("click",Nt,()=>{k(me,!u(me)),k(Le,null)}),Ni(j,()=>u(Cn),ft=>k(Cn,ft)),te("mousedown",Ue,Li),T(Ae,Z)},Ln=Ae=>{var Z=cZ(),Fe=C(Z);let wt;var Dt=C(Fe),Nt=C(Dt),O=x(Dt,2);{var se=ht=>{var ii=Q9(),Kt=bt(ii),si=C(Kt),ui=x(si,2),Q=x(Kt,2);{var ge=We=>{var it=UD(),xt=C(it);G(()=>q(xt,u(st))),T(We,it)};$(Q,We=>{u(st)&&We(ge)})}te("keydown",si,We=>We.key==="Enter"&&$n()),Ni(si,()=>u(je),We=>k(je,We)),te("click",ui,$n),T(ht,ii)};$(O,ht=>{u(ve)&&ht(se)})}var be=x(O,2),j=C(be),pe=x(be,2);_i(pe,20,()=>u(qe),ht=>ht,(ht,ii)=>{var Kt=$D();let si;var ui=C(Kt);G(()=>{si=$t(Kt,1,"flat-item svelte-rrt0o",null,si,{"active-item":u(g)===ii}),q(ui,ii)}),te("click",Kt,()=>Hi(ii)),T(ht,Kt)});var Ue=x(Fe,2),Ce=x(Ue,2),De=C(Ce);{var Xe=ht=>{var ii=aZ(),Kt=bt(ii),si=C(Kt),ui=C(si),Q=x(si,2),ge=x(Q,2),We=x(ge,2),it=x(Kt,2);{var xt=Ut=>{var Rt=qD(),Oi=C(Rt);G(()=>q(Oi,u(N))),T(Ut,Rt)};$(it,Ut=>{u(N)&&Ut(xt)})}var Ye=x(it,2);{var pt=Ut=>{var Rt=KD();T(Ut,Rt)},ei=Ut=>{var Rt=rZ(),Oi=C(Rt),an=x(C(Oi),2),Wi=C(an),ti=x(Oi,2),ji=x(C(ti),2),A=C(ji),K=x(ti,2),Ee=x(C(K),2),Pe=C(Ee);Zw(Pe,{language:"javascript",get value(){return u(p)},set value(at){k(p,at,!0)}});var Be=x(K,2),Me=x(C(Be),2),re=C(Me);Zw(re,{language:"javascript",get value(){return u(v)},set value(at){k(v,at,!0)}});var Je=x(Be,2),Oe=C(Je),xe=C(Oe),St=x(xe,4),Te=x(C(St)),H=C(Te),J=x(Oe,2);{var ke=at=>{var ut=eZ(),ye=C(ut);As(ye,()=>u(S),Et=>k(S,Et)),T(at,ut)};$(J,at=>{u(w)&&at(ke)})}var Ke=x(Je,2);{var nt=at=>{var ut=oZ(),ye=C(ut),Et=x(C(ye));{var dt=le=>{var _e=tZ();T(le,_e)},he=le=>{var _e=iZ(),Qe=C(_e);G(()=>q(Qe,`${u(D).length??0??""} items · rev ${u(D)._rev??""}`)),T(le,_e)};$(Et,le=>{u(D).error?le(dt):le(he,-1)})}var Ct=x(ye,2);{var Ze=le=>{var _e=nZ(),Qe=C(_e);G(()=>q(Qe,u(D).error)),T(le,_e)},Ie=le=>{var _e=sZ(),Qe=C(_e);G(Bt=>q(Qe,Bt),[()=>JSON.stringify(u(D).result,null,2)]),T(le,_e)};$(Ct,le=>{u(D).error?le(Ze):le(Ie,-1)})}T(at,ut)};$(Ke,at=>{u(D)&&at(nt)})}G(()=>q(H,`${u(V)??""}${u(g)??""} on every update`)),Ni(Wi,()=>u(_),at=>k(_,at)),Ni(A,()=>u(f),at=>k(f,at)),As(xe,()=>u(w),at=>k(w,at)),T(Ut,Rt)};$(Ye,Ut=>{u(P)?Ut(pt):Ut(ei,-1)})}G(()=>q(ui,u(g))),te("click",Q,dn),te("click",ge,Nn),te("click",We,Rn),T(ht,ii)},Vt=ht=>{t(ht)};$(De,ht=>{u(g)?ht(Xe):ht(Vt,-1)})}var ft=x(Ce,2);{var ue=ht=>{var ii=lZ(),Kt=bt(ii),si=x(Kt,2);let ui;var Q=C(si);$9(Q,{get currentView(){return u(zt)},onApplyView:vt}),G(()=>ui=Ko(si,"",ui,{width:`${u(ot)??""}px`})),te("mousedown",Kt,Gi),T(ht,ii)};$(ft,ht=>{u(Re)&&ht(ue)})}G(()=>wt=Ko(Fe,"",wt,{width:`${u(yt)??""}px`})),te("click",Nt,()=>{k(ve,!u(ve)),k(st,null)}),Ni(j,()=>u(pn),ht=>k(pn,ht)),te("mousedown",Ue,Li),T(Ae,Z)};$(An,Ae=>{u(Y)==="docs"?Ae(rn):Ae(Ln,-1)})}G(()=>{Ii=$t(Ci,1,"svelte-rrt0o",null,Ii,{active:u(Y)==="docs"}),xn=$t(mn,1,"svelte-rrt0o",null,xn,{active:u(Y)==="views"})}),te("mousemove",Ft,vi),te("mouseup",Ft,Tn),os("mouseleave",Ft,Tn),te("click",Ci,()=>k(Y,"docs")),te("click",mn,()=>k(Y,"views")),T(o,Ft),Ao()}Cr(["mousemove","mouseup","click","keydown","mousedown"]);var uZ=R('<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),gZ=R('<label class="svelte-1ua3isv">Pairing Code / QR <input type="text" placeholder="MT:..." class="svelte-1ua3isv"/></label>'),GD=R('<p class="err svelte-1ua3isv"> </p>'),fZ=R('<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>'),pZ=R('<span class="device-name svelte-1ua3isv"> </span> <span class="device-nodeid svelte-1ua3isv"> </span>',1),mZ=R('<span class="device-name svelte-1ua3isv"> </span>'),_Z=R('<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>'),vZ=R('<li class="empty svelte-1ua3isv">No paired devices</li>'),bZ=R('<p class="info svelte-1ua3isv">Loading…</p>'),yZ=R('<p class="device-subtitle svelte-1ua3isv"> </p>'),wZ=R('<span class="ep-chip svelte-1ua3isv"> </span>'),SZ=R('<span class="attr-id svelte-1ua3isv"> </span>'),CZ=R('<button class="attr-action-btn svelte-1ua3isv"> </button>'),xZ=R('<div class="attr-actions svelte-1ua3isv"></div>'),LZ=R('<span class="cmd-sep svelte-1ua3isv">,</span>'),kZ=R('<span class="cmd-name svelte-1ua3isv"> </span><span class="cmd-id svelte-1ua3isv"> </span>',1),IZ=R('<span class="cmd-id svelte-1ua3isv"> </span>'),DZ=R("<!> <!>",1),EZ=R('<span class="cmd-list svelte-1ua3isv"></span>'),PZ=R(' <span class="cmd-id svelte-1ua3isv"> </span>',1),TZ=R('<tr class="svelte-1ua3isv"><td class="svelte-1ua3isv"><!></td><td class="svelte-1ua3isv"> </td></tr>'),MZ=R('<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>'),NZ=R('<th class="svelte-1ua3isv"> </th>'),RZ=R('<td class="svelte-1ua3isv"> </td>'),AZ=R('<tr class="svelte-1ua3isv"></tr>'),OZ=R('<table class="attr-arr-table svelte-1ua3isv"><thead class="svelte-1ua3isv"><tr class="svelte-1ua3isv"></tr></thead><tbody class="svelte-1ua3isv"></tbody></table>'),FZ=R('<tr class="svelte-1ua3isv"><td class="attr-obj-key svelte-1ua3isv"> </td><td class="attr-obj-val svelte-1ua3isv"> </td></tr>'),HZ=R('<table class="attr-obj-table svelte-1ua3isv"><tbody class="svelte-1ua3isv"></tbody></table>'),WZ=R('<a class="attr-link svelte-1ua3isv" target="_blank" rel="noopener noreferrer"> </a>'),BZ=R('<span class="attr-val svelte-1ua3isv"> </span>'),zZ=R('<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>'),VZ=R('<tr class="cluster-hdr-row svelte-1ua3isv"><td colspan="3" class="cluster-hdr-cell svelte-1ua3isv"> </td></tr> <!>',1),jZ=R('<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>'),UZ=R('<p class="no-clusters svelte-1ua3isv">No clusters</p>'),$Z=R('<details class="svelte-1ua3isv"><summary class="svelte-1ua3isv"> <span class="ep-id svelte-1ua3isv"> </span> <span class="ep-chips svelte-1ua3isv"></span></summary> <!></details>'),qZ=R('<div class="detail-hdr svelte-1ua3isv"><h2 class="svelte-1ua3isv"> </h2> <!> <p class="detail-nodeid svelte-1ua3isv"> </p></div> <!>',1),KZ=R('<p class="info svelte-1ua3isv">Select a device to view its endpoints.</p>'),GZ=R('<span class="stream-badge svelte-1ua3isv"> </span>'),ZZ=R('<span class="stream-empty svelte-1ua3isv">Waiting for events…</span>'),Xw=R(' <span class="e-sub svelte-1ua3isv"> </span>',1),XZ=R('<span class="e-badge e-badge-status svelte-1ua3isv">status</span> <span class="e-node svelte-1ua3isv"> <!></span> <span> </span>',1),YZ=R('<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),JZ=R('<div class="er svelte-1ua3isv"><span class="e-ts svelte-1ua3isv"> </span> <!></div>'),QZ=R('<div class="stream-body svelte-1ua3isv"><!></div>'),eX=R('<!> <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 tX(o,e){Ro(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,wt,Dt,Nt){try{await w7(Z,Fe,wt,Dt,Nt)}catch(O){console.error("matter command failed",O)}}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 wt=n[Z];return Fe.map(Dt=>{const Nt=typeof Dt=="number"?Dt:Number(Dt);return{id:Nt,name:(wt==null?void 0:wt[Nt])??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=B(Si([])),f=Si(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 P=500,N=20,V=32;let F=0,Y=B(Si([])),X=B(!0),me=B(180),Le=rt(()=>{const Z=Math.max(1,Math.floor((u(me)-V)/N)+1);return u(Y).slice(0,Z)});function je(Z){Z.preventDefault();const Fe=Z.clientY,wt=u(me);function Dt(O){k(me,Math.max(60,Math.min(600,wt+Fe-O.clientY)),!0)}function Nt(){document.removeEventListener("mousemove",Dt),document.removeEventListener("mouseup",Nt)}document.addEventListener("mousemove",Dt),document.addEventListener("mouseup",Nt)}let ve=B(null),st=B(!1),Ot=B(null),yt=B(!1),ai=B("passcode"),jt=B(""),Qt=B(""),Ne=B(""),Ge=B(!1),Re=B(null),ot=B("");const At="she:matter:selectedNodeId";async function ni(){try{k(g,await hR(),!0);for(const Z of u(g))T_(Z.nodeId).then(Fe=>{f.set(Z.nodeId,Fe)}).catch(()=>{});if(u(g).length>0&&!u(ve)){const Z=localStorage.getItem(At),Fe=Z&&u(g).find(wt=>wt.nodeId===Z)?Z:u(g)[0].nodeId;Xt(Fe)}}catch{k(g,[],!0)}}async function Xt(Z){k(st,!0),k(Ot,null);try{k(ve,await T_(Z),!0),f.set(Z,u(ve)),localStorage.setItem(At,Z)}catch(Fe){k(Ot,Fe instanceof Error?Fe.message:String(Fe),!0)}finally{k(st,!1)}}let zt;async function vt(Z){var Fe;if(await zt.show(`Unpair device ${Z}?`,{confirm:"Unpair",danger:!0}))try{await y7(Z),((Fe=u(ve))==null?void 0:Fe.nodeId)===Z&&k(ve,null),await ni()}catch(wt){k(Ot,wt instanceof Error?wt.message:String(wt),!0)}}async function Li(){k(Ge,!0),k(Re,null);try{let Z;u(ai)==="passcode"?(Z={passcode:Number(u(jt))},u(Qt)&&(Z={...Z,discriminator:Number(u(Qt))})):Z={pairingCode:u(Ne).trim()},u(ot).trim()&&(Z={...Z,discoveryAddress:u(ot).trim()}),await b7(Z),k(yt,!1),k(jt,""),k(Qt,""),k(Ne,""),k(ot,""),await ni()}catch(Z){k(Re,Z instanceof Error?Z.message:String(Z),!0)}finally{k(Ge,!1)}}xr(()=>{ni()});const vi=Ya("matter:deviceList",Z=>{if(!Array.isArray(Z.devices))return;const Fe=Z.devices;for(const wt of Fe)f.has(wt.nodeId)||T_(wt.nodeId).then(Dt=>{f.set(wt.nodeId,Dt)}).catch(()=>{});k(g,Fe,!0)}),Tn=Ya("matter:deviceStatus",Z=>{if(Z.nodeId===void 0)return;const Fe=String(Z.nodeId),wt=!!Z.online;k(g,u(g).map(Dt=>Dt.nodeId===Fe?{...Dt,online:wt}:Dt),!0),k(Y,[{id:F++,kind:"status",nodeId:Fe,online:wt,ts:Date.now()},...u(Y).slice(0,P-1)],!0)}),Gi=Ya("matter:attr",Z=>{const Fe=String(Z.nodeId),wt=Z.endpointId,Dt=String(Z.clusterName),Nt=String(Z.attrName),O=Z.value;if(u(ve)&&u(ve).nodeId===Fe){const be=u(ve).endpoints.find(pe=>pe.endpointId===wt),j=be==null?void 0:be.clusters.find(pe=>pe.name===Dt);j&&(j.attrs[Nt]=O)}const se=f.get(Fe);if(se){const be=se.endpoints.find(pe=>pe.endpointId===wt),j=be==null?void 0:be.clusters.find(pe=>pe.name===Dt);j&&(j.attrs[Nt]=O)}k(Y,[{id:F++,kind:"attr",nodeId:Fe,endpointId:wt,clusterName:Dt,attrName:Nt,value:O,ts:Z.ts??Date.now()},...u(Y).slice(0,P-1)],!0)});yy(()=>{vi(),Tn(),Gi()});var Bn=eX(),nn=bt(Bn);bs(Hg(nn,{}),Z=>zt=Z,()=>zt);var Ei=x(nn,2),Mn=C(Ei),sn=C(Mn),Sn=C(sn),Xi=x(C(Sn),2),Hi=x(Sn,2);{var dn=Z=>{var Fe=fZ(),wt=C(Fe),Dt=C(wt);let Nt;var O=x(Dt,2);let se;var be=x(wt,2);{var j=ue=>{var ht=uZ(),ii=bt(ht),Kt=x(C(ii)),si=x(ii,2),ui=x(C(si));Ni(Kt,()=>u(jt),Q=>k(jt,Q)),Ni(ui,()=>u(Qt),Q=>k(Qt,Q)),T(ue,ht)},pe=ue=>{var ht=gZ(),ii=x(C(ht));Ni(ii,()=>u(Ne),Kt=>k(Ne,Kt)),T(ue,ht)};$(be,ue=>{u(ai)==="passcode"?ue(j):ue(pe,-1)})}var Ue=x(be,2),Ce=x(C(Ue)),De=x(Ue,2);{var Xe=ue=>{var ht=GD(),ii=C(ht);G(()=>q(ii,u(Re))),T(ue,ht)};$(De,ue=>{u(Re)&&ue(Xe)})}var Vt=x(De,2),ft=C(Vt);G(()=>{Nt=$t(Dt,1,"svelte-1ua3isv",null,Nt,{active:u(ai)==="passcode"}),se=$t(O,1,"svelte-1ua3isv",null,se,{active:u(ai)==="pairingCode"}),Vt.disabled=u(Ge),q(ft,u(Ge)?"Commissioning…":"Commission")}),te("click",Dt,()=>k(ai,"passcode")),te("click",O,()=>k(ai,"pairingCode")),Ni(Ce,()=>u(ot),ue=>k(ot,ue)),te("click",Vt,Li),T(Z,Fe)};$(Hi,Z=>{u(yt)&&Z(dn)})}var Nn=x(Hi,2),Rn=C(Nn);_i(Rn,17,()=>u(g),Z=>Z.nodeId,(Z,Fe)=>{var wt=_Z();let Dt;var Nt=C(wt),O=C(Nt);let se;var be=x(O,2),j=C(be);{var pe=De=>{var Xe=pZ(),Vt=bt(Xe),ft=C(Vt),ue=x(Vt,2),ht=C(ue);G(()=>{q(ft,u(Fe).name),q(ht,`#${u(Fe).nodeId??""}`)}),T(De,Xe)},Ue=De=>{var Xe=mZ(),Vt=C(Xe);G(()=>q(Vt,`Node ${u(Fe).nodeId??""}`)),T(De,Xe)};$(j,De=>{u(Fe).name?De(pe):De(Ue,-1)})}var Ce=x(Nt,2);G(()=>{var De;Dt=$t(wt,1,"svelte-1ua3isv",null,Dt,{selected:((De=u(ve))==null?void 0:De.nodeId)===u(Fe).nodeId}),se=$t(O,1,"status-dot svelte-1ua3isv",null,se,{online:u(Fe).online})}),te("click",Nt,()=>Xt(u(Fe).nodeId)),te("click",Ce,()=>vt(u(Fe).nodeId)),T(Z,wt)});var $n=x(Rn,2);{var Cn=Z=>{var Fe=vZ();T(Z,Fe)};$($n,Z=>{u(g).length===0&&Z(Cn)})}var pn=x(sn,2),on=C(pn);{var qe=Z=>{var Fe=bZ();T(Z,Fe)},Ft=Z=>{var Fe=GD(),wt=C(Fe);G(()=>q(wt,u(Ot))),T(Z,Fe)},li=Z=>{var Fe=qZ(),wt=bt(Fe),Dt=C(wt),Nt=C(Dt),O=x(Dt,2);{var se=Ue=>{var Ce=yZ(),De=C(Ce);G(()=>q(De,u(ve).subtitle)),T(Ue,Ce)};$(O,Ue=>{u(ve).subtitle&&Ue(se)})}var be=x(O,2),j=C(be),pe=x(wt,2);_i(pe,17,()=>u(ve).endpoints,Ue=>Ue.endpointId,(Ue,Ce)=>{var De=$Z(),Xe=C(De),Vt=C(Xe),ft=x(Vt),ue=C(ft),ht=x(ft,2);_i(ht,21,()=>u(Ce).clusters,Vn,(ui,Q)=>{var ge=wZ(),We=C(ge);G(()=>q(We,u(Q).name)),T(ui,ge)});var ii=x(Xe,2);{var Kt=ui=>{var Q=jZ(),ge=x(C(Q));_i(ge,21,()=>u(Ce).clusters,Vn,(We,it)=>{var xt=VZ(),Ye=bt(xt),pt=C(Ye),ei=C(pt),Ut=x(Ye,2);_i(Ut,17,()=>Object.entries(u(it).attrs),Vn,(Rt,Oi)=>{var an=rt(()=>mk(u(Oi),2));let Wi=()=>u(an)[0],ti=()=>u(an)[1];var ji=Fs(),A=bt(ji);{var K=Pe=>{const Be=rt(()=>{var _e;return(_e=t[u(it).name])==null?void 0:_e[Wi()]}),Me=rt(()=>(Wi()==="acceptedCommandList"||Wi()==="generatedCommandList")&&Array.isArray(ti())),re=rt(()=>{var _e;return((_e=c[u(it).name])==null?void 0:_e[Wi()])??a[Wi()]});var Je=zZ(),Oe=C(Je),xe=C(Oe),St=C(xe),Te=x(xe);{var H=_e=>{var Qe=SZ(),Bt=C(Qe);G(fe=>q(Bt,`(${fe??""})`),[()=>h(u(re))]),T(_e,Qe)};$(Te,_e=>{u(re)!==void 0&&_e(H)})}var J=x(Oe),ke=C(J);{var Ke=_e=>{var Qe=xZ();_i(Qe,21,()=>u(Be),Vn,(Bt,fe)=>{var $e=CZ(),gt=C($e);G(()=>q(gt,u(fe).label)),te("click",$e,()=>i(u(ve).nodeId,u(Ce).endpointId,u(it).name,u(fe).command,u(fe).args)),T(Bt,$e)}),T(_e,Qe)};$(ke,_e=>{u(Be)&&_e(Ke)})}var nt=x(J),at=C(nt);{var ut=_e=>{var Qe=EZ();_i(Qe,21,()=>s(u(it).name,ti()),Vn,(Bt,fe,$e)=>{var gt=DZ(),Pt=bt(gt);{var et=$i=>{var oi=LZ();T($i,oi)};$(Pt,$i=>{$e>0&&$i(et)})}var ci=x(Pt,2);{var Jt=$i=>{var oi=kZ(),Gt=bt(oi),_n=C(Gt),ri=x(Gt),On=C(ri);G(()=>{q(_n,u(fe).name),q(On,`(${u(fe).id??""})`)}),T($i,oi)},Gn=$i=>{var oi=IZ(),Gt=C(oi);G(()=>q(Gt,u(fe).id)),T($i,oi)};$(ci,$i=>{u(fe).name?$i(Jt):$i(Gn,-1)})}T(Bt,gt)}),T(_e,Qe)},ye=_e=>{var Qe=MZ(),Bt=x(C(Qe));_i(Bt,21,ti,Vn,(fe,$e)=>{const gt=rt(()=>u($e)),Pt=rt(()=>u(gt).deviceType),et=rt(()=>r[u(Pt)]);var ci=TZ(),Jt=C(ci),Gn=C(Jt);{var $i=ri=>{var On=PZ(),Yi=bt(On),Ps=x(Yi),Oo=C(Ps);G(Lr=>{q(Yi,`${u(et)??""} `),q(Oo,`(${Lr??""})`)},[()=>h(u(Pt))]),T(ri,On)},oi=ri=>{var On=Ur();G(Yi=>q(On,Yi),[()=>h(u(Pt))]),T(ri,On)};$(Gn,ri=>{u(et)?ri($i):ri(oi,-1)})}var Gt=x(Jt),_n=C(Gt);G(ri=>q(_n,ri),[()=>v(u(gt).revision)]),T(fe,ci)}),T(_e,Qe)},Et=rt(()=>Wi()==="deviceTypeList"&&Array.isArray(ti())),dt=_e=>{const Qe=rt(()=>[...new Set(ti().flatMap(Pt=>Object.keys(Pt)))]);var Bt=OZ(),fe=C(Bt),$e=C(fe);_i($e,21,()=>u(Qe),Vn,(Pt,et)=>{var ci=NZ(),Jt=C(ci);G(()=>q(Jt,u(et))),T(Pt,ci)});var gt=x(fe);_i(gt,21,ti,Vn,(Pt,et)=>{var ci=AZ();_i(ci,21,()=>u(Qe),Vn,(Jt,Gn)=>{var $i=RZ(),oi=C($i);G(Gt=>q(oi,Gt),[()=>v(u(et)[u(Gn)])]),T(Jt,$i)}),T(Pt,ci)}),T(_e,Bt)},he=rt(()=>w(ti())),Ct=_e=>{var Qe=HZ(),Bt=C(Qe);_i(Bt,21,()=>Object.entries(ti()),Vn,(fe,$e)=>{var gt=rt(()=>mk(u($e),2));let Pt=()=>u(gt)[0],et=()=>u(gt)[1];var ci=FZ(),Jt=C(ci),Gn=C(Jt),$i=x(Jt),oi=C($i);G(Gt=>{q(Gn,Pt()),q(oi,Gt)},[()=>v(et())]),T(fe,ci)}),T(_e,Qe)},Ze=rt(()=>_(ti())),Ie=_e=>{var Qe=WZ(),Bt=C(Qe);G(()=>{Hn(Qe,"href",ti()),q(Bt,ti())}),T(_e,Qe)},le=_e=>{var Qe=BZ(),Bt=C(Qe);G(fe=>q(Bt,fe),[()=>v(ti())]),T(_e,Qe)};$(at,_e=>{u(Me)?_e(ut):u(Et)?_e(ye,1):u(he)?_e(dt,2):u(Ze)?_e(Ct,3):(Wi()==="productUrl"||Wi()==="productURL")&&typeof ti()=="string"?_e(Ie,4):_e(le,-1)})}G(()=>{Hn(Oe,"title",Wi()),q(St,Wi())}),T(Pe,Je)},Ee=rt(()=>!S(ti(),Wi()));$(A,Pe=>{u(Ee)&&Pe(K)})}T(Rt,ji)}),G(()=>q(ei,u(it).name)),T(We,xt)}),T(ui,Q)},si=ui=>{var Q=UZ();T(ui,Q)};$(ii,ui=>{u(Ce).clusters.length>0?ui(Kt):ui(si,-1)})}G(()=>{q(Vt,`${u(Ce).name??`Endpoint ${u(Ce).endpointId}`??""} `),q(ue,`ep${u(Ce).endpointId??""}`)}),T(Ue,De)}),G(()=>{q(Nt,u(ve).name??`Node ${u(ve).nodeId}`),q(j,`Node ID: ${u(ve).nodeId??""}`)}),T(Z,Fe)},Ci=Z=>{var Fe=KZ();T(Z,Fe)};$(on,Z=>{u(st)?Z(qe):u(Ot)?Z(Ft,1):u(ve)?Z(li,2):Z(Ci,-1)})}var Ii=x(Mn,2),mn=C(Ii),xn=x(mn,2),qn=x(C(xn),2);{var hn=Z=>{var Fe=GZ(),wt=C(Fe);G(()=>q(wt,u(Y).length)),T(Z,Fe)};$(qn,Z=>{!u(X)&&u(Y).length>0&&Z(hn)})}var An=x(qn,2),rn=C(An),Ln=x(xn,2);{var Ae=Z=>{var Fe=QZ(),wt=C(Fe);{var Dt=O=>{var se=ZZ();T(O,se)},Nt=O=>{var se=Fs(),be=bt(se);_i(be,17,()=>u(Le),j=>j.id,(j,pe)=>{const Ue=rt(()=>{var Kt,si;return((Kt=f.get(u(pe).nodeId))==null?void 0:Kt.name)??((si=u(g).find(ui=>ui.nodeId===u(pe).nodeId))==null?void 0:si.name)??null}),Ce=rt(()=>{var Kt,si;return u(pe).endpointId!==void 0?((si=(Kt=f.get(u(pe).nodeId))==null?void 0:Kt.endpoints.find(ui=>ui.endpointId===u(pe).endpointId))==null?void 0:si.name)??null:null}),De=rt(()=>u(pe).attrName??u(pe).clusterName);var Xe=JZ(),Vt=C(Xe),ft=C(Vt),ue=x(Vt,2);{var ht=Kt=>{var si=XZ(),ui=x(bt(si),2),Q=C(ui),ge=x(Q);{var We=pt=>{var ei=Xw(),Ut=x(bt(ei)),Rt=C(Ut);G(()=>q(Rt,`(#${u(pe).nodeId??""})`)),T(pt,ei)};$(ge,pt=>{u(Ue)&&pt(We)})}var it=x(ui,2);let xt;var Ye=C(it);G(()=>{q(Q,u(Ue)??`#${u(pe).nodeId}`),xt=$t(it,1,"e-val svelte-1ua3isv",null,xt,{"e-online":u(pe).online,"e-offline":!u(pe).online}),q(Ye,u(pe).online?"online":"offline")}),T(Kt,si)},ii=Kt=>{var si=YZ(),ui=x(bt(si),2),Q=C(ui),ge=x(Q);{var We=ti=>{var ji=Xw(),A=x(bt(ji)),K=C(A);G(()=>q(K,`(#${u(pe).nodeId??""})`)),T(ti,ji)};$(ge,ti=>{u(Ue)&&ti(We)})}var it=x(ui,2),xt=C(it),Ye=x(xt);{var pt=ti=>{var ji=Xw(),A=x(bt(ji)),K=C(A);G(()=>q(K,`(ep ${u(pe).endpointId??""})`)),T(ti,ji)};$(Ye,ti=>{u(Ce)&&ti(pt)})}var ei=x(it,2),Ut=C(ei),Rt=x(ei,2),Oi=C(Rt),an=x(Rt,2),Wi=C(an);G(ti=>{q(Q,u(Ue)??`#${u(pe).nodeId}`),q(xt,u(Ce)??`ep${u(pe).endpointId}`),q(Ut,u(pe).clusterName),q(Oi,u(De)),q(Wi,ti)},[()=>p(u(pe).value)]),T(Kt,si)};$(ue,Kt=>{u(pe).kind==="status"?Kt(ht):Kt(ii,-1)})}G(Kt=>q(ft,Kt),[()=>D(u(pe).ts)]),T(j,Xe)}),T(O,se)};$(wt,O=>{u(Le).length===0?O(Dt):O(Nt,-1)})}T(Z,Fe)};$(Ln,Z=>{u(X)&&Z(Ae)})}G(()=>{Ko(Ii,u(X)?`height: ${u(me)}px;`:""),q(rn,u(X)?"▾":"▸")}),te("click",Xi,()=>k(yt,!u(yt))),te("mousedown",mn,je),te("click",An,()=>{k(X,!u(X))}),T(o,Bn),Ao()}Cr(["click","mousedown"]);var iX=R("<button>›</button>"),nX=R('<span class="chev-ph svelte-1vejtrc"></span>'),sX=R('<span class="tv svelte-1vejtrc"> </span> <span class="tt svelte-1vejtrc"> </span>',1),oX=R('<div class="tc svelte-1vejtrc"></div>'),rX=R('<div class="tn svelte-1vejtrc"><div><!> <span class="seg svelte-1vejtrc"> </span> <!></div> <!></div>'),aX=R("<option></option>"),lX=R('<span class="pub-ok svelte-1vejtrc">✓</span>'),cX=R('<span class="pub-err svelte-1vejtrc"> </span>'),dX=R('<div class="info svelte-1vejtrc">Loading…</div>'),hX=R('<div class="info err svelte-1vejtrc"> </div>'),uX=R('<div class="info svelte-1vejtrc">No topics match.</div>'),gX=R('<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>'),fX=R('<div class="vs svelte-1vejtrc"><div><div class="vrows-abs svelte-1vejtrc"></div></div></div>'),pX=R('<div class="info svelte-1vejtrc">No topics yet.</div>'),mX=R('<div class="tree-wrap svelte-1vejtrc"><!></div>'),_X=R('<span class="stream-badge"> </span>'),vX=R('<span class="stream-empty svelte-1vejtrc">Waiting for messages…</span>'),bX=R('<span class="s-ret svelte-1vejtrc" title="retained snapshot">⊛</span>'),yX=R('<div><span class="s-ts svelte-1vejtrc"> </span> <!> <span class="s-topic svelte-1vejtrc"> </span> <span class="s-val svelte-1vejtrc"> </span></div>'),wX=R('<div class="stream-body svelte-1vejtrc"><!></div>'),SX=R('<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),CX=R('<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>'),xX=R('<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),LX=R('<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 kX(o,e){Ro(e,!0);const t=(Q,ge=py)=>{const We=rt(()=>u(f).has(ge().path)),it=rt(()=>u(a)>=0&&ge().children.size>0),xt=rt(()=>u(a)>=0&&ge().isLeaf&&!n.has(ge().path));var Ye=rX(),pt=C(Ye);let ei;var Ut=C(pt);{var Rt=Pe=>{var Be=iX();let Me;G(()=>{Me=$t(Be,1,"chev svelte-1vejtrc",null,Me,{open:u(We)}),Hn(Be,"aria-label",u(We)?"Collapse":"Expand")}),te("click",Be,()=>p(ge().path)),T(Pe,Be)},Oi=Pe=>{var Be=nX();T(Pe,Be)};$(Ut,Pe=>{u(it)?Pe(Rt):Pe(Oi,-1)})}var an=x(Ut,2),Wi=C(an),ti=x(an,2);{var ji=Pe=>{var Be=sX(),Me=bt(Be),re=C(Me),Je=x(Me,2),Oe=C(Je);G((xe,St,Te)=>{Hn(Me,"title",xe),q(re,St),q(Oe,Te)},[()=>{var xe;return Ei((xe=Sn(ge().path))==null?void 0:xe.val)},()=>{var xe;return Ei((xe=Sn(ge().path))==null?void 0:xe.val)},()=>{var xe;return((xe=Sn(ge().path))==null?void 0:xe.ts)!=null?Mn(Sn(ge().path).ts):""}]),T(Pe,Be)},A=rt(()=>ge().isLeaf&&i.has(ge().path));$(ti,Pe=>{u(A)&&Pe(ji)})}var K=x(pt,2);{var Ee=Pe=>{var Be=oX();_i(Be,21,()=>[...ge().children.values()].sort((Me,re)=>Me.seg.localeCompare(re.seg)),Me=>Me.path,(Me,re)=>{t(Me,()=>u(re))}),T(Pe,Be)};$(K,Pe=>{u(it)&&u(We)&&Pe(Ee)})}G(()=>{ei=$t(pt,1,"tr svelte-1vejtrc",null,ei,{stale:u(xt)}),q(Wi,ge().seg)}),te("click",pt,()=>{k(st,ge().path+"/#")}),te("contextmenu",pt,Pe=>{Pe.preventDefault(),k(ot,{x:Pe.clientX,y:Pe.clientY,topic:ge().path},!0)}),T(Q,Ye)},i=new Map,n=new Set,s=new Set;let r=null,a=B(0);function c(){r===null&&(r=requestAnimationFrame(()=>{r=null;for(const Q of s)g(Q);s.clear(),bk(a)}))}const h=new Map;function g(Q){const ge=Q.split("/");let We=h,it="";for(let xt=0;xt<ge.length;xt++){const Ye=ge[xt];it=xt===0?Ye:`${it}/${Ye}`,We.has(Ye)||We.set(Ye,{seg:Ye,path:it,children:new Map,isLeaf:!1});const pt=We.get(Ye);xt===ge.length-1&&(pt.isLeaf=!0),We=pt.children}}let f=B(Si(new Set));function p(Q){const ge=new Set(u(f));ge.has(Q)?ge.delete(Q):ge.add(Q),k(f,ge,!0)}let v=B("");const _=24,w=5;let S=B(0),D=B(300),P=rt(()=>{if(u(a),!u(v))return[];const Q=u(v).toLowerCase().split(/\s+/).filter(Boolean),ge=[];for(const[We,it]of i){const xt=We.toLowerCase();Q.every(Ye=>xt.includes(Ye))&&ge.push({topic:We,...it})}return ge.sort((We,it)=>We.topic.localeCompare(it.topic))}),N=rt(()=>{const Q=u(P).length,ge=Math.max(0,Math.floor(u(S)/_)-w),We=Math.min(Q,Math.ceil((u(S)+u(D))/_)+w);return{start:ge,end:We,totalH:Q*_,top:ge*_}});const V=1e3,F=200,Y=20,X=36;let me=0,Le=B(Si([])),je=B(Si([])),ve=B(!0),st=B("#"),Ot=B(200);zn(()=>{const Q=u(st).trim(),ge=wl(()=>u(Le)),We=!Q||Q==="#"?ge.slice(0,F):ge.filter(it=>yt(Q,it.topic)).slice(0,F);if(Q&&Q!=="#"){const it=new Set(We.map(Ye=>Ye.topic)),xt=[];for(const[Ye,pt]of i)it.has(Ye)||yt(Q,Ye)&&xt.push({id:-(xt.length+1),topic:Ye,val:pt.val,ts:pt.ts,retained:!0});xt.sort((Ye,pt)=>Ye.topic.localeCompare(pt.topic)),k(je,[...We,...xt],!0)}else k(je,We,!0)});function yt(Q,ge){if(Q==="#")return!0;const We=Q.split("/"),it=ge.split("/");for(let xt=0;xt<We.length;xt++){if(We[xt]==="#")return!0;if(xt>=it.length||We[xt]!=="+"&&We[xt]!==it[xt])return!1}return We.length===it.length}function ai(Q){Q.preventDefault();const ge=Q.clientY,We=u(Ot);function it(Ye){k(Ot,Math.max(60,Math.min(800,We+ge-Ye.clientY)),!0)}function xt(){document.removeEventListener("mousemove",it),document.removeEventListener("mouseup",xt)}document.addEventListener("mousemove",it),document.addEventListener("mouseup",xt)}let jt=rt(()=>{const Q=Math.max(1,Math.floor((u(Ot)-X)/Y)+1);return u(je).slice(0,Q)}),Qt=B(!0),Ne=B(null);async function Ge(){k(Qt,!0),k(Ne,null);try{const Q=await uR();for(const ge of Q)i.set(ge.topic,{val:ge.val,ts:ge.ts}),g(ge.topic)}catch(Q){k(Ne,Q instanceof Error?Q.message:String(Q),!0)}finally{k(Qt,!1),bk(a)}}const Re=Ya("mqtt",Q=>{const{topic:ge,val:We,ts:it}=Q;i.set(ge,{val:We,ts:it}),n.add(ge),s.add(ge),c();const xt={id:me++,topic:ge,val:We,ts:it};k(Le,[xt,...u(Le).slice(0,V-1)],!0);const Ye=u(st).trim();(!Ye||Ye==="#"||yt(Ye,ge))&&k(je,[xt,...u(je).filter(pt=>!(pt.retained&&pt.topic===ge)).slice(0,F-1)],!0)});let ot=B(null),At=B(null);async function ni(Q,ge){const We=[Q];if(ge){const it=Q+"/";for(const xt of i.keys())xt.startsWith(it)&&We.push(xt)}for(const it of We)await vD(it,"",!0,0)}let Xt=rt(()=>(u(a),[...i.keys()].sort())),zt=B(""),vt=B(""),Li=B(!1),vi=B(0),Tn=B(!1),Gi=B(null),Bn=B(!1);async function nn(){if(u(zt)){k(Tn,!0),k(Gi,null),k(Bn,!1);try{await vD(u(zt),u(vt),u(Li),u(vi)),k(Bn,!0),setTimeout(()=>{k(Bn,!1)},2e3)}catch(Q){k(Gi,Q instanceof Error?Q.message:String(Q),!0)}finally{k(Tn,!1)}}}function Ei(Q){return Q==null?"":typeof Q=="object"?JSON.stringify(Q):String(Q)}function Mn(Q){return new Date(Q).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function sn(Q){return new Date(Q).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Sn(Q){return u(a),i.get(Q)}let Xi=rt(()=>(u(a),[...h.values()].sort((Q,ge)=>Q.seg.localeCompare(ge.seg)))),Hi=rt(()=>(u(a),i.size));xr(Ge),yy(()=>{Re(),r!==null&&cancelAnimationFrame(r)});var dn=LX(),Nn=x(C(dn),2),Rn=C(Nn),$n=C(Rn),Cn=x($n,2);_i(Cn,20,()=>u(Xt),Q=>Q,(Q,ge)=>{var We=aX(),it={};G(()=>{it!==(it=ge)&&(We.value=(We.__value=ge)??"")}),T(Q,We)});var pn=x(Cn,2),on=x(pn,2),qe=C(on),Ft=x(on,2),li=C(Ft);li.value=li.__value=0;var Ci=x(li);Ci.value=Ci.__value=1;var Ii=x(Ci);Ii.value=Ii.__value=2;var mn=x(Ft,2),xn=x(mn,2);{var qn=Q=>{var ge=lX();T(Q,ge)};$(xn,Q=>{u(Bn)&&Q(qn)})}var hn=x(xn,2);{var An=Q=>{var ge=cX(),We=C(ge);G(()=>q(We,u(Gi))),T(Q,ge)};$(hn,Q=>{u(Gi)&&Q(An)})}var rn=x(Rn,2),Ln=C(rn),Ae=x(Ln,2),Z=C(Ae);{var Fe=Q=>{var ge=Ur();G(()=>q(ge,`${u(P).length??""} /`)),T(Q,ge)};$(Z,Q=>{u(v)&&Q(Fe)})}var wt=x(Z),Dt=x(rn,2);{var Nt=Q=>{var ge=dX();T(Q,ge)},O=Q=>{var ge=hX(),We=C(ge);G(()=>q(We,u(Ne))),T(Q,ge)},se=Q=>{var ge=Fs(),We=bt(ge);{var it=Ye=>{var pt=uX();T(Ye,pt)},xt=Ye=>{var pt=fX(),ei=C(pt),Ut=C(ei);_i(Ut,21,()=>u(P).slice(u(N).start,u(N).end),Rt=>Rt.topic,(Rt,Oi)=>{var an=gX(),Wi=C(an),ti=C(Wi),ji=x(Wi,2),A=C(ji),K=x(ji,2),Ee=C(K);G((Pe,Be,Me)=>{q(ti,u(Oi).topic),Hn(ji,"title",Pe),q(A,Be),q(Ee,Me)},[()=>Ei(u(Oi).val),()=>Ei(u(Oi).val),()=>Mn(u(Oi).ts)]),T(Rt,an)}),G(()=>{Ko(ei,`height: ${u(N).totalH??""}px; position: relative;`),Ko(Ut,`top: ${u(N).top??""}px;`)}),os("scroll",pt,Rt=>{k(S,Rt.currentTarget.scrollTop,!0)}),CW(pt,"clientHeight",Rt=>k(D,Rt)),T(Ye,pt)};$(We,Ye=>{u(P).length===0?Ye(it):Ye(xt,-1)})}T(Q,ge)},be=Q=>{var ge=mX(),We=C(ge);{var it=Ye=>{var pt=pX();T(Ye,pt)},xt=Ye=>{var pt=Fs(),ei=bt(pt);_i(ei,17,()=>u(Xi),Ut=>Ut.path,(Ut,Rt)=>{t(Ut,()=>u(Rt))}),T(Ye,pt)};$(We,Ye=>{u(Xi).length===0?Ye(it):Ye(xt,-1)})}T(Q,ge)};$(Dt,Q=>{u(Qt)?Q(Nt):u(Ne)?Q(O,1):u(v)?Q(se,2):Q(be,-1)})}var j=x(Nn,2),pe=C(j),Ue=x(pe,2),Ce=C(Ue),De=x(Ce,2);{var Xe=Q=>{var ge=_X(),We=C(ge);G(()=>q(We,u(je).length)),T(Q,ge)};$(De,Q=>{!u(ve)&&u(je).length>0&&Q(Xe)})}var Vt=x(De,2),ft=C(Vt),ue=x(Ue,2);{var ht=Q=>{var ge=wX(),We=C(ge);{var it=Ye=>{var pt=vX();T(Ye,pt)},xt=Ye=>{var pt=Fs(),ei=bt(pt);_i(ei,17,()=>u(jt),Ut=>Ut.id,(Ut,Rt)=>{var Oi=yX();let an;var Wi=C(Oi),ti=C(Wi),ji=x(Wi,2);{var A=Me=>{var re=bX();T(Me,re)};$(ji,Me=>{u(Rt).retained&&Me(A)})}var K=x(ji,2),Ee=C(K),Pe=x(K,2),Be=C(Pe);G((Me,re,Je)=>{an=$t(Oi,1,"sr svelte-1vejtrc",null,an,{retained:u(Rt).retained}),q(ti,Me),q(Ee,u(Rt).topic),Hn(Pe,"title",re),q(Be,Je)},[()=>sn(u(Rt).ts),()=>Ei(u(Rt).val),()=>Ei(u(Rt).val)]),T(Ut,Oi)}),T(Ye,pt)};$(We,Ye=>{u(jt).length===0?Ye(it):Ye(xt,-1)})}T(Q,ge)};$(ue,Q=>{u(ve)&&Q(ht)})}var ii=x(j,2);{var Kt=Q=>{var ge=SX(),We=bt(ge),it=x(We,2);let xt;var Ye=C(it),pt=x(Ye,2);G(()=>xt=Ko(it,"",xt,{left:`${u(ot).x??""}px`,top:`${u(ot).y??""}px`})),te("click",We,()=>k(ot,null)),te("contextmenu",We,ei=>{ei.preventDefault(),k(ot,null)}),te("click",Ye,()=>{navigator.clipboard.writeText(u(ot).topic),k(ot,null)}),te("click",pt,()=>{const ei=u(ot).topic,Ut=ei+"/",Rt=[...i.keys()].some(Oi=>Oi.startsWith(Ut));k(At,{topic:ei,hasChildren:Rt,recursive:!1},!0),k(ot,null)}),T(Q,ge)};$(ii,Q=>{u(ot)&&Q(Kt)})}var si=x(ii,2);{var ui=Q=>{var ge=xX(),We=bt(ge),it=x(We,2),xt=x(C(it),2),Ye=C(xt),pt=x(C(Ye)),ei=C(pt),Ut=x(Ye,2);{var Rt=ti=>{var ji=CX(),A=C(ji);As(A,()=>u(At).recursive,K=>u(At).recursive=K),T(ti,ji)};$(Ut,ti=>{u(At).hasChildren&&ti(Rt)})}var Oi=x(xt,2),an=C(Oi),Wi=x(an,2);G(()=>q(ei,u(At).topic)),te("click",We,()=>k(At,null)),te("click",an,()=>k(At,null)),te("click",Wi,()=>{const{topic:ti,recursive:ji}=u(At);k(At,null),ni(ti,ji)}),T(Q,ge)};$(si,Q=>{u(At)&&Q(ui)})}G(()=>{mn.disabled=u(Tn)||!u(zt),q(wt,` ${u(Hi)??""}`),Ko(j,u(ve)?`height: ${u(Ot)}px;`:""),q(ft,u(ve)?"▾":"▸")}),Ni($n,()=>u(zt),Q=>k(zt,Q)),Ni(pn,()=>u(vt),Q=>k(vt,Q)),As(qe,()=>u(Li),Q=>k(Li,Q)),_a(Ft,()=>u(vi),Q=>k(vi,Q)),te("click",mn,nn),Ni(Ln,()=>u(v),Q=>k(v,Q)),te("mousedown",pe,ai),Ni(Ce,()=>u(st),Q=>k(st,Q)),te("click",Vt,()=>{k(ve,!u(ve))}),T(o,dn),Ao()}Cr(["click","contextmenu","mousedown"]);var IX=R('<div class="restart-banner restart-banner--restarting svelte-twakcj">Restarting daemon…</div>'),DX=R('<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>'),EX=R('<div class="err svelte-twakcj"> </div>'),PX=R('<span class="pane-count pane-count--warn svelte-twakcj"> </span>'),TX=R('<p class="empty svelte-twakcj">No packages installed.</p>'),MX=R('<p class="empty svelte-twakcj">No match.</p>'),NX=R('<span class="dep-latest svelte-twakcj"> </span>'),RX=_T('<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>'),AX=_T('<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>'),OX=R('<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>'),FX=R('<span class="result-author svelte-twakcj"> </span>'),HX=R('<span class="result-date svelte-twakcj"> </span>'),WX=R('<span class="result-desc svelte-twakcj"> </span>'),BX=R('<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>'),zX=R('<div class="results-list svelte-twakcj"></div>'),VX=R('<pre class="npm-output svelte-twakcj"> </pre>'),jX=R(`<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>`),UX=R('<!> <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 $X(o,e){Ro(e,!0);let t=B(Si([])),i=B(""),n=B(Si({})),s=B(!1),r=B(""),a=B(Si([])),c=B(!1),h=B(!1),g=B(!1),f=B(""),p=B(""),v=Si({});const _=rt(()=>u(i).trim()?u(t).filter(qe=>qe.name.toLowerCase().includes(u(i).toLowerCase())):u(t)),w=rt(()=>Object.keys(u(n)).length);xr(async()=>{await Promise.all([S(),D()])});async function S(){try{k(t,await c7(),!0),k(f,"")}catch(qe){k(f,qe.message,!0)}}async function D(){try{k(n,await f7(),!0)}catch{}}async function P(){k(s,!0);try{k(n,await p7(),!0)}catch{}finally{k(s,!1)}}async function N(){const qe=u(r).trim();if(!qe){k(a,[],!0);return}k(g,!0),k(f,"");try{k(a,await d7(qe),!0)}catch(Ft){k(f,Ft.message,!0)}finally{k(g,!1)}}function V(qe){if(!qe)return"";try{return new Date(qe).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}async function F(qe,Ft){v[qe]=!0,k(f,""),k(p,"");try{const li=await h7(qe,Ft);k(p,li.stdout||li.stderr||"Done.",!0),k(c,!0),await S()}catch(li){k(f,li.message,!0)}finally{v[qe]=!1}}async function Y(qe){v[qe]=!0,k(f,""),k(p,"");try{const Ft=await u7(qe);k(p,Ft.stdout||Ft.stderr||"Done.",!0),k(c,!0);const li={...u(n)};delete li[qe],k(n,li,!0),await S()}catch(Ft){k(f,Ft.message,!0)}finally{v[qe]=!1}}async function X(qe){v[qe]=!0,k(f,""),k(p,"");try{const Ft=await g7(qe);k(p,Ft.stdout||Ft.stderr||"Done.",!0),k(c,!0);const li={...u(n)};delete li[qe],k(n,li,!0),await S()}catch(Ft){k(f,Ft.message,!0)}finally{v[qe]=!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 lR()}catch{}setTimeout(()=>{window.location.reload()},3e3)}}var je=UX(),ve=bt(je);bs(Hg(ve,{}),qe=>me=qe,()=>me);var st=x(ve,2),Ot=C(st);{var yt=qe=>{var Ft=IX();T(qe,Ft)},ai=qe=>{var Ft=DX(),li=x(C(Ft));te("click",li,Le),T(qe,Ft)};$(Ot,qe=>{u(h)?qe(yt):u(c)&&qe(ai,1)})}var jt=x(Ot,2);{var Qt=qe=>{var Ft=EX(),li=C(Ft);G(()=>q(li,u(f))),T(qe,Ft)};$(jt,qe=>{u(f)&&qe(Qt)})}var Ne=x(jt,2),Ge=C(Ne),Re=C(Ge),ot=x(C(Re),2),At=C(ot),ni=x(ot,2);{var Xt=qe=>{var Ft=PX(),li=C(Ft);G(()=>q(li,`${u(w)??""} outdated`)),T(qe,Ft)};$(ni,qe=>{u(w)>0&&qe(Xt)})}var zt=x(ni,2),vt=C(zt);let Li;var vi=x(Re,2),Tn=C(vi),Gi=x(vi,2),Bn=C(Gi);{var nn=qe=>{var Ft=TX();T(qe,Ft)},Ei=qe=>{var Ft=MX();T(qe,Ft)},Mn=qe=>{var Ft=Fs(),li=bt(Ft);_i(li,17,()=>u(_),Ci=>Ci.name,(Ci,Ii)=>{var mn=OX();let xn;var qn=C(mn),hn=C(qn),An=C(hn),rn=x(hn,2),Ln=C(rn),Ae=x(rn,2);{var Z=j=>{var pe=NX(),Ue=C(pe);G(()=>q(Ue,`→ v${u(n)[u(Ii).name].latest??""}`)),T(j,pe)};$(Ae,j=>{u(n)[u(Ii).name]&&j(Z)})}var Fe=x(qn,2),wt=C(Fe);let Dt;var Nt=C(wt);{var O=j=>{var pe=RX();T(j,pe)},se=j=>{var pe=AX();T(j,pe)};$(Nt,j=>{v[u(Ii).name]?j(O):j(se,-1)})}var be=x(wt,2);G(()=>{xn=$t(mn,1,"dep-row svelte-twakcj",null,xn,{"dep-busy":!!v[u(Ii).name]}),Hn(hn,"href",u(Ii).url??`https://www.npmjs.com/package/${u(Ii).name}`),q(An,u(Ii).name),q(Ln,u(Ii).installedVersion??u(Ii).version),Dt=$t(wt,1,"icon-btn svelte-twakcj",null,Dt,{"icon-btn--update":!!u(n)[u(Ii).name]}),wt.disabled=!!v[u(Ii).name],Hn(wt,"title",u(n)[u(Ii).name]?`Update to v${u(n)[u(Ii).name].latest}`:"Update to latest"),be.disabled=!!v[u(Ii).name]}),te("click",wt,()=>X(u(Ii).name)),te("click",be,()=>Y(u(Ii).name)),T(Ci,mn)}),T(qe,Ft)};$(Bn,qe=>{u(t).length===0?qe(nn):u(_).length===0?qe(Ei,1):qe(Mn,-1)})}var sn=x(Ge,2),Sn=x(C(sn),2),Xi=C(Sn),Hi=x(Xi,2),dn=C(Hi),Nn=x(Sn,2);{var Rn=qe=>{var Ft=zX();_i(Ft,21,()=>u(a),li=>li.name,(li,Ci)=>{var Ii=BX(),mn=C(Ii),xn=C(mn),qn=C(xn),hn=x(xn,2),An=C(hn),rn=x(hn,2);{var Ln=O=>{var se=FX(),be=C(se);G(()=>q(be,u(Ci).author)),T(O,se)};$(rn,O=>{u(Ci).author&&O(Ln)})}var Ae=x(rn,2);{var Z=O=>{var se=HX(),be=C(se);G(j=>{Hn(se,"title",u(Ci).date),q(be,j)},[()=>V(u(Ci).date)]),T(O,se)};$(Ae,O=>{u(Ci).date&&O(Z)})}var Fe=x(Ae,2);{var wt=O=>{var se=WX(),be=C(se);G(()=>q(be,u(Ci).description)),T(O,se)};$(Fe,O=>{u(Ci).description&&O(wt)})}var Dt=x(mn,2),Nt=C(Dt);G(()=>{Hn(xn,"href",u(Ci).url??`https://www.npmjs.com/package/${u(Ci).name}`),q(qn,u(Ci).name),q(An,u(Ci).version),Dt.disabled=!!v[u(Ci).name],q(Nt,v[u(Ci).name]?"Installing…":"Install")}),te("click",Dt,()=>F(u(Ci).name)),T(li,Ii)}),T(qe,Ft)};$(Nn,qe=>{u(a).length>0&&qe(Rn)})}var $n=x(Nn,2);{var Cn=qe=>{var Ft=VX(),li=C(Ft);G(()=>q(li,u(p))),T(qe,Ft)};$($n,qe=>{u(p)&&qe(Cn)})}var pn=x($n,2);{var on=qe=>{var Ft=jX();T(qe,Ft)};$(pn,qe=>{!u(a).length&&!u(p)&&qe(on)})}G(()=>{q(At,u(t).length),zt.disabled=u(s),Li=$t(vt,0,"svelte-twakcj",null,Li,{spinning:u(s)}),Hi.disabled=u(g),q(dn,u(g)?"Searching…":"Search")}),te("click",zt,P),Ni(Tn,()=>u(i),qe=>k(i,qe)),te("keydown",Xi,qe=>qe.key==="Enter"&&N()),Ni(Xi,()=>u(r),qe=>k(r,qe)),te("click",Hi,N),T(o,je),Ao()}Cr(["click","keydown"]);var qX=R('<span class="mqtt-dot svelte-1n46o8q" title="Waiting for retained MQTT state"></span>'),KX=R('<span class="update-dot svelte-1n46o8q" title="Update available"></span>'),GX=R('<dt class="svelte-1n46o8q">Latest</dt><dd style="color: #f90" class="svelte-1n46o8q"> </dd>',1),ZX=R('<dt class="svelte-1n46o8q">Latest</dt><dd class="svelte-1n46o8q">up to date</dd>',1),XX=R('<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>'),YX=R('<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>'),JX=R('<dt class="svelte-1n46o8q">Uptime</dt><dd class="svelte-1n46o8q"> </dd>',1),QX=R('<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),eY=R('<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),tY=R('<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>'),iY=R('<span class="stats-empty svelte-1n46o8q">Loading…</span>'),nY=R('<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>'),sY=R('<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>'),oY=R('<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>'),rY=R('<div class="login-error svelte-1n46o8q"> </div>'),aY=R('<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>'),lY=R('<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>'),cY=R('<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>'),dY=R("<!> <!> <!> <!>",1);function hY(o,e){Ro(e,!0);const t=["scripts","mqtt","matter","db","logs","config","packages"];function i(){const Ge=location.hash.slice(1);return t.includes(Ge)?Ge:"scripts"}let n=B(Si(i())),s=B(null),r=B(!1),a=B(!1),c=B(!1),h=B(!1),g=B("none"),f=B(""),p=B(!1),v=B(""),_=B(""),w=B(!1),S=B(!1);V8(()=>{k(p,!0)});async function D(){k(_,""),k(w,!0);try{await $8(u(v)),k(v,""),k(p,!1)}catch(Ge){k(_,Ge.message??"Login failed",!0)}finally{k(w,!1)}}async function P(){if(u(g)==="proxy"&&u(f)){window.location.href=u(f);return}await q8(),k(p,!0)}let N=B(null),V=B(!1),F=B(!1);async function Y(){if(!await u(N).show("Restart the she daemon? The page will reload after a moment.",{confirm:"Restart"}))return;k(V,!0);let Ge;try{Ge=(await wf()).startedAt}catch{}try{await lR()}catch{}const Re=Date.now()+6e4;for(;Date.now()<Re;){await new Promise(ot=>setTimeout(ot,250));try{const ot=await wf();if(Ge===void 0||ot.startedAt!==Ge){location.reload();return}}catch{}}location.reload()}async function X(){k(c,!0);try{const Ge=await J8();u(s)&&k(s,{...u(s),latestVersion:Ge.latestVersion??void 0},!0)}catch{}finally{k(c,!1)}}async function me(){var ot,At;if(!await u(N).show(`Update to v${(ot=u(s))==null?void 0:ot.latestVersion}? The daemon will restart after the update completes.`,{confirm:"Update"}))return;k(a,!1),k(h,!0);const Ge=(At=u(s))==null?void 0:At.startedAt;try{await Y8()}catch{}const Re=Date.now()+18e4;for(;Date.now()<Re;){await new Promise(ni=>setTimeout(ni,1e3));try{const ni=await wf();if(Ge===void 0||ni.startedAt!==Ge){location.reload();return}}catch{k(h,!1),k(V,!0)}}location.reload()}function Le(Ge){k(n,Ge,!0),location.hash=Ge}xr(async()=>{location.hash||(location.hash=u(n));const Ge=()=>{k(n,i(),!0)};window.addEventListener("hashchange",Ge);try{const ni=await U8();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 Re(){try{k(s,await wf(),!0)}catch{}}Re();const ot=setInterval(Re,5e3),At=Ya("mqtt:status",ni=>{k(F,ni.ready===!1)});return()=>{window.removeEventListener("hashchange",Ge),clearInterval(ot),At()}});var je=dY();os("click",XP,()=>{u(r)&&k(r,!1),u(a)&&k(a,!1)});var ve=bt(je);{var st=Ge=>{var Re=oY(),ot=C(Re),At=x(C(ot),2);let ni;var Xt=x(At,2);let zt;var vt=x(Xt,2);let Li;var vi=x(C(vt),2);{var Tn=ue=>{var ht=qX();T(ue,ht)};$(vi,ue=>{u(F)&&ue(Tn)})}var Gi=x(vt,2);let Bn;var nn=x(Gi,2);let Ei;var Mn=x(nn,2);let sn;var Sn=x(Mn,4),Xi=x(C(Sn),2),Hi=C(Xi),dn=C(Hi);dn.nodeValue="v0.27.5 ";var Nn=x(dn);{var Rn=ue=>{var ht=KX();T(ue,ht)};$(Nn,ue=>{var ht;(ht=u(s))!=null&&ht.latestVersion&&ue(Rn)})}var $n=x(Hi,2);{var Cn=ue=>{var ht=YX(),ii=C(ht),Kt=x(C(ii));Kt.textContent="v0.27.5";var si=x(Kt,2);{var ui=Ut=>{var Rt=GX(),Oi=x(bt(Rt)),an=C(Oi);G(()=>q(an,`v${u(s).latestVersion??""}`)),T(Ut,Rt)},Q=Ut=>{var Rt=ZX();T(Ut,Rt)};$(si,Ut=>{var Rt;(Rt=u(s))!=null&&Rt.latestVersion?Ut(ui):Ut(Q,-1)})}var ge=x(ii,2),We=C(ge);{var it=Ut=>{var Rt=XX(),Oi=x(C(Rt));G(()=>q(Oi,` Update to v${u(s).latestVersion??""}`)),te("click",Rt,me),T(Ut,Rt)};$(We,Ut=>{var Rt;(Rt=u(s))!=null&&Rt.latestVersion&&Ut(it)})}var xt=x(We,2),Ye=C(xt);let pt;var ei=x(Ye);G(()=>{xt.disabled=u(c),pt=$t(Ye,0,"svelte-1n46o8q",null,pt,{spinning:u(c)}),q(ei,` ${u(c)?"Checking…":"Check for updates"}`)}),te("click",ht,Ut=>Ut.stopPropagation()),te("click",xt,X),T(ue,ht)};$($n,ue=>{u(a)&&ue(Cn)})}var pn=x(Xi,2),on=C(pn),qe=x(on,2);{var Ft=ue=>{var ht=nY(),ii=C(ht);{var Kt=ge=>{var We=tY(),it=C(We);{var xt=re=>{const Je=rt(()=>Math.floor((Date.now()-u(s).startedAt)/1e3)),Oe=rt(()=>Math.floor(u(Je)/86400)),xe=rt(()=>Math.floor(u(Je)%86400/3600)),St=rt(()=>Math.floor(u(Je)%3600/60));var Te=JX(),H=x(bt(Te)),J=C(H);G(()=>q(J,`${u(Oe)>0?u(Oe)+"d ":""}${u(xe)>0||u(Oe)>0?u(xe)+"h ":""}${u(St)??""}m`)),T(re,Te)};$(it,re=>{u(s).startedAt&&re(xt)})}var Ye=x(it,3),pt=C(Ye),ei=x(Ye,3),Ut=C(ei),Rt=x(ei,3),Oi=C(Rt),an=x(Rt,2);{var Wi=re=>{var Je=QX(),Oe=x(bt(Je)),xe=C(Oe),St=x(Oe,3),Te=C(St);G(()=>{q(xe,u(s).matterNodes??0),q(Te,u(s).matterEndpoints??0)}),T(re,Je)};$(an,re=>{u(s).matterEnabled&&re(Wi)})}var ti=x(an,2);{var ji=re=>{var Je=eY(),Oe=x(bt(Je)),xe=C(Oe),St=x(Oe,3),Te=C(St);G(()=>{q(xe,u(s).dbDocs??"—"),q(Te,u(s).dbViews??"—")}),T(re,Je)};$(ti,re=>{u(s).dbEnabled&&re(ji)})}var A=x(ti,3),K=C(A),Ee=x(A,3),Pe=C(Ee),Be=x(Ee,3),Me=C(Be);G(()=>{q(pt,u(s).scripts),q(Ut,u(s).topics),q(Oi,u(s).mqttMsgPerSec??"—"),q(K,u(s).handlers??"—"),q(Pe,u(s).memMb!=null?u(s).memMb+" MB":"—"),q(Me,u(s).cpuPercent!=null?u(s).cpuPercent+" %":"—")}),T(ge,We)},si=ge=>{var We=iY();T(ge,We)};$(ii,ge=>{u(s)?ge(Kt):ge(si,-1)})}var ui=x(ii,2),Q=C(ui);te("click",ht,ge=>ge.stopPropagation()),te("click",Q,()=>{k(r,!1),Y()}),T(ue,ht)};$(qe,ue=>{u(r)&&ue(Ft)})}var li=x(pn,2);let Ci;var Ii=x(li,2);{var mn=ue=>{var ht=sY();te("click",ht,P),T(ue,ht)};$(Ii,ue=>{u(g)==="password"&&ue(mn)})}var xn=x(ot,2),qn=C(xn);bs(Hg(qn,{}),ue=>k(N,ue,!0),()=>u(N));var hn=x(qn,2);let An;var rn=C(hn);{let ue=rt(()=>u(n)==="scripts");_G(rn,{get active(){return u(ue)}})}var Ln=x(hn,2);let Ae;var Z=C(Ln);$X(Z,{});var Fe=x(Ln,2);let wt;var Dt=C(Fe);kX(Dt,{});var Nt=x(Fe,2);let O;var se=C(Nt);tX(se,{});var be=x(Nt,2);let j;var pe=C(be);hZ(pe,{});var Ue=x(be,2);let Ce;var De=C(Ue);n9(De,{});var Xe=x(Ue,2);let Vt;var ft=C(Xe);a9(ft,{}),G(()=>{ni=$t(At,1,"svelte-1n46o8q",null,ni,{active:u(n)==="scripts"}),zt=$t(Xt,1,"svelte-1n46o8q",null,zt,{active:u(n)==="packages"}),Li=$t(vt,1,"svelte-1n46o8q",null,Li,{active:u(n)==="mqtt"}),Bn=$t(Gi,1,"svelte-1n46o8q",null,Bn,{active:u(n)==="matter"}),Ei=$t(nn,1,"svelte-1n46o8q",null,Ei,{active:u(n)==="db"}),sn=$t(Mn,1,"svelte-1n46o8q",null,sn,{active:u(n)==="logs"}),Ci=$t(li,1,"nav-settings svelte-1n46o8q",null,Ci,{active:u(n)==="config"}),An=$t(hn,1,"page-wrap svelte-1n46o8q",null,An,{hidden:u(n)!=="scripts"}),Ae=$t(Ln,1,"page-wrap svelte-1n46o8q",null,Ae,{hidden:u(n)!=="packages"}),wt=$t(Fe,1,"page-wrap svelte-1n46o8q",null,wt,{hidden:u(n)!=="mqtt"}),O=$t(Nt,1,"page-wrap svelte-1n46o8q",null,O,{hidden:u(n)!=="matter"}),j=$t(be,1,"page-wrap svelte-1n46o8q",null,j,{hidden:u(n)!=="db"}),Ce=$t(Ue,1,"page-wrap svelte-1n46o8q",null,Ce,{hidden:u(n)!=="config"}),Vt=$t(Xe,1,"page-wrap svelte-1n46o8q",null,Vt,{hidden:u(n)!=="logs"})}),te("click",At,()=>Le("scripts")),te("click",Xt,()=>Le("packages")),te("click",vt,()=>Le("mqtt")),te("click",Gi,()=>Le("matter")),te("click",nn,()=>Le("db")),te("click",Mn,()=>Le("logs")),te("click",Hi,ue=>{ue.stopPropagation(),k(a,!u(a)),k(r,!1)}),te("click",on,ue=>{ue.stopPropagation(),k(r,!u(r)),k(a,!1)}),te("click",li,()=>Le("config")),T(Ge,Re)};$(ve,Ge=>{u(S)&&!u(p)&&Ge(st)})}var Ot=x(ve,2);{var yt=Ge=>{var Re=aY(),ot=C(Re),At=x(C(ot),4),ni=x(C(At),2),Xt=x(At,2);{var zt=vi=>{var Tn=rY(),Gi=C(Tn);G(()=>q(Gi,u(_))),T(vi,Tn)};$(Xt,vi=>{u(_)&&vi(zt)})}var vt=x(Xt,2),Li=C(vt);G(()=>{ni.disabled=u(w),vt.disabled=u(w)||!u(v),q(Li,u(w)?"Signing in…":"Sign in")}),os("submit",ot,vi=>{vi.preventDefault(),D()}),Ni(ni,()=>u(v),vi=>k(v,vi)),T(Ge,Re)};$(Ot,Ge=>{u(p)&&Ge(yt)})}var ai=x(Ot,2);{var jt=Ge=>{var Re=lY();T(Ge,Re)};$(ai,Ge=>{u(V)&&Ge(jt)})}var Qt=x(ai,2);{var Ne=Ge=>{var Re=cY();T(Ge,Re)};$(Qt,Ge=>{u(h)&&Ge(Ne)})}T(o,je),Ao()}Cr(["click"]);cW(hY,{target:document.getElementById("app")});export{PT as t};
|
|
225
|
+
*[stopped]*`,toolEvents:u(ve).length>0?[...u(ve)]:void 0}],!0)}else k(c,K.message,!0)}finally{D=null,k(s,null),k(ve,[],!0),k(a,!1)}}}function pn(){D==null||D.abort()}function on(A){A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),Cn())}function qe(){k(n,[],!0),k(c,"")}const Ft=["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 li(A){k(r,A,!0),Ot==null||Ot.focus()}var Ci=U9(),Ii=bt(Ci),mn=C(Ii),xn=x(C(mn),2);{var qn=A=>{var K=l9(),Ee=C(K);{var Pe=Me=>{var re=Ur();G(()=>q(re,`${u(h).provider??""} · ${(u(f)||u(h).model)??""}`)),T(Me,re)},Be=Me=>{var re=Ur("Not configured");T(Me,re)};$(Ee,Me=>{u(jt)?Me(Pe):Me(Be,-1)})}G(()=>Hn(K,"title",`Provider: ${u(h).provider??""}`)),T(A,K)};$(xn,A=>{u(h)&&A(qn)})}var hn=x(xn,2);{var An=A=>{var K=c9();te("click",K,qe),T(A,K)};$(hn,A=>{u(n).length>0&&A(An)})}var rn=x(mn,2),Ln=C(rn);{var Ae=A=>{var K=d9();T(A,K)},Z=A=>{var K=g9(),Ee=C(K),Pe=C(Ee);{var Be=Je=>{var Oe=h9(),xe=x(bt(Oe)),St=C(xe);G(()=>q(St,t().id)),T(Je,Oe)},Me=Je=>{var Oe=Ur("No view selected. Ask a general sheDB view question.");T(Je,Oe)};$(Pe,Je=>{t()?Je(Be):Je(Me,-1)})}var re=x(Ee,2);_i(re,17,()=>Ft,Vn,(Je,Oe)=>{var xe=u9(),St=C(xe);G(()=>q(St,u(Oe))),te("click",xe,()=>li(u(Oe))),T(Je,xe)}),T(A,K)};$(Ln,A=>{u(jt)?u(n).length===0&&u(s)===null&&A(Z,1):A(Ae)})}var Fe=x(Ln,2);_i(Fe,17,()=>u(n),Vn,(A,K,Ee)=>{var Pe=b9(),Be=C(Pe);{var Me=Je=>{var Oe=f9(),xe=C(Oe);G(()=>q(xe,u(K).content)),T(Je,Oe)},re=Je=>{const Oe=rt(()=>Re(u(K).content)),xe=rt(()=>At(u(Oe)));var St=v9(),Te=bt(St);{var H=ut=>{var ye=VD();_i(ye,21,()=>u(K).toolEvents,Vn,(Et,dt)=>{var he=Fs(),Ct=bt(he);{var Ze=le=>{var _e=BD(),Qe=x(C(_e)),Bt=C(Qe);G(fe=>q(Bt,fe),[()=>u(dt).name.replace(/_/g," ")]),T(le,_e)},Ie=le=>{var _e=zD(),Qe=x(C(_e)),Bt=C(Qe);G(fe=>q(Bt,fe),[()=>u(dt).name.replace(/_/g," ")]),T(le,_e)};$(Ct,le=>{u(dt).type==="tool_call"?le(Ze):le(Ie,-1)})}T(Et,he)}),T(ut,ye)};$(Te,ut=>{var ye;(ye=u(K).toolEvents)!=null&&ye.length&&ut(H)})}var J=x(Te,2),ke=C(J);_i(ke,17,()=>u(Oe),Vn,(ut,ye,Et)=>{var dt=Fs(),he=bt(dt);{var Ct=Ie=>{var le=jD();Ul(le,()=>Tn(u(ye).text),!0),T(Ie,le)},Ze=Ie=>{const le=rt(()=>`${Ee}:${Et}`),_e=rt(()=>vt(u(ye).text)),Qe=rt(()=>u(p).has(u(le))),Bt=rt(()=>u(ye).lang==="filter");var fe=m9(),$e=C(fe),gt=C($e),Pt=C(gt),et=x(gt,2),ci=C(et),Jt=x($e,2);let Gn;var $i=C(Jt),oi=C($i);Ul(oi,()=>vi(u(ye).text,u(ye).lang??""),!0);var Gt=x($i,2);{var _n=ri=>{var On=p9(),Yi=C(On);G(()=>q(Yi,u(Qe)?"▲ collapse":"▼ expand")),te("click",On,()=>Li(u(le))),T(ri,On)};$(Gt,ri=>{u(_e)&&ri(_n)})}G(()=>{q(Pt,u(Bt)?"filter":u(ye).lang),Gn=$t(Jt,1,"code-body svelte-1twuiul",null,Gn,{collapsed:u(_e)&&!u(Qe)})}),te("click",ci,()=>Bn(u(ye).text)),T(Ie,fe)};$(he,Ie=>{u(ye).type==="text"?Ie(Ct):Ie(Ze,-1)})}T(ut,dt)});var Ke=x(ke,2);{var nt=ut=>{var ye=_9(),Et=C(ye),dt=C(Et);G(he=>q(dt,he),[()=>Xt(u(xe))]),te("click",Et,()=>e.onApplyView(u(xe))),T(ut,ye)},at=rt(()=>ni(u(xe))&&e.onApplyView);$(Ke,ut=>{u(at)&&ut(nt)})}T(Je,St)};$(Be,Je=>{u(K).role==="user"?Je(Me):Je(re,-1)})}G(()=>$t(Pe,1,`message ${u(K).role??""}`,"svelte-1twuiul")),T(A,Pe)});var wt=x(Fe,2);{var Dt=A=>{var K=VD();_i(K,21,()=>u(ve),Vn,(Ee,Pe)=>{var Be=Fs(),Me=bt(Be);{var re=Oe=>{var xe=BD(),St=x(C(xe)),Te=C(St);G(H=>q(Te,H),[()=>u(Pe).name.replace(/_/g," ")]),T(Oe,xe)},Je=Oe=>{var xe=zD(),St=x(C(xe)),Te=C(St);G(H=>q(Te,H),[()=>u(Pe).name.replace(/_/g," ")]),T(Oe,xe)};$(Me,Oe=>{u(Pe).type==="tool_call"?Oe(re):Oe(Je,-1)})}T(Ee,Be)}),T(A,K)};$(wt,A=>{u(ve).length>0&&A(Dt)})}var Nt=x(wt,2);{var O=A=>{var K=y9(),Ee=C(K),Pe=C(Ee),Be=C(Pe);G(()=>q(Be,N[u(P)])),T(A,K)};$(Nt,A=>{u(a)&&u(s)===null&&u(ve).length===0&&A(O)})}var se=x(Nt,2);{var be=A=>{var K=S9(),Ee=C(K);_i(Ee,21,()=>ot(u(s)),Vn,(Pe,Be)=>{var Me=Fs(),re=bt(Me);{var Je=xe=>{var St=jD();Ul(St,()=>Tn(u(Be).text),!0),T(xe,St)},Oe=xe=>{var St=w9(),Te=C(St),H=C(Te),J=C(H),ke=x(Te,2),Ke=C(ke);Ul(Ke,()=>vi(u(Be).text,u(Be).lang??""),!0),G(()=>q(J,u(Be).lang)),T(xe,St)};$(re,xe=>{u(Be).type==="text"?xe(Je):xe(Oe,-1)})}T(Pe,Me)}),T(A,K)};$(se,A=>{u(s)!==null&&A(be)})}bs(rn,A=>yt=A,()=>yt);var j=x(rn,2);{var pe=A=>{var K=C9(),Ee=C(K);G(()=>q(Ee,u(c))),T(A,K)};$(j,A=>{u(c)&&A(pe)})}var Ue=x(j,2),Ce=C(Ue),De=C(Ce),Xe=x(Ce,2),Vt=C(Xe),ft=x(Xe,2),ue=C(ft),ht=x(ft,2),ii=C(ht),Kt=x(Ue,2),si=C(Kt);{var ui=A=>{var K=x9();let Ee;var Pe=x(C(K),2),Be=C(Pe),Me=x(Pe,2),re=C(Me);G(()=>{Ee=$t(K,1,"file-chip svelte-1twuiul",null,Ee,{inactive:!u(me)}),q(Be,t().id),Hn(Me,"title",u(me)?"Remove from context":"Re-add to context"),q(re,u(me)?"×":"+")}),te("click",Me,()=>k(me,!u(me))),T(A,K)};$(si,A=>{t()&&A(ui)})}var Q=x(si,2);_i(Q,17,()=>u(X),Vn,(A,K,Ee)=>{const Pe=rt(()=>Mn(u(K).name));var Be=L9(),Me=C(Be),re=C(Me),Je=x(Me,2),Oe=C(Je),xe=x(Je,2);G((St,Te)=>{$t(Me,1,`badge badge-${St??""}`,"svelte-1twuiul"),q(re,Te),q(Oe,u(K).name)},[()=>u(Pe).toLowerCase(),()=>sn(u(Pe))]),te("click",xe,()=>Sn(Ee)),T(A,Be)});var ge=x(Q,2),We=x(ge,2);bs(We,A=>je=A,()=>je);var it=x(Kt,2);let xt;var Ye=C(it);let pt;var ei=C(Ye);bs(ei,A=>Ot=A,()=>Ot);var Ut=x(Ye,2);{var Rt=A=>{var K=k9();te("click",K,pn),T(A,K)},Oi=A=>{var K=I9();G(Ee=>K.disabled=Ee,[()=>!u(r).trim()||!u(jt)]),te("click",K,Cn),T(A,K)};$(Ut,A=>{u(a)?A(Rt):A(Oi,-1)})}var an=x(it,2);{var Wi=A=>{var K=M9(),Ee=C(K),Pe=C(Ee),Be=x(Ee,2);{var Me=xe=>{var St=E9();_i(St,21,()=>u(g),Vn,(Te,H)=>{var J=D9(),ke=C(J),Ke={};G(()=>{q(ke,u(H)),Ke!==(Ke=u(H))&&(J.value=(J.__value=u(H))??"")}),T(Te,J)}),G(()=>St.disabled=u(a)),_a(St,()=>u(f),Te=>k(f,Te)),T(xe,St)},re=xe=>{var St=P9(),Te=C(St);G(()=>q(Te,u(f)||u(h).model)),T(xe,St)};$(Be,xe=>{u(g).length>0?xe(Me):xe(re,-1)})}var Je=x(Be,2);{var Oe=xe=>{var St=T9();te("click",St,nn),T(xe,St)};$(Je,xe=>{u(h).provider==="ollama"&&xe(Oe)})}G(()=>q(Pe,u(h).provider)),T(A,K)};$(an,A=>{u(jt)&&u(h)&&A(Wi)})}var ti=x(Ii,2);{var ji=A=>{var K=j9(),Ee=C(K),Pe=C(Ee),Be=C(Pe),Me=C(Be),re=x(Be,2),Je=x(Pe,2),Oe=C(Je);{var xe=H=>{var J=N9();T(H,J)},St=H=>{var J=R9(),ke=C(J);G(()=>q(ke,u(S))),T(H,J)},Te=H=>{var J=V9(),ke=C(J);{var Ke=Ie=>{var le=A9(),_e=x(bt(le)),Qe=C(_e);G(()=>q(Qe,u(_).version)),T(Ie,le)};$(ke,Ie=>{u(_).version&&Ie(Ke)})}var nt=x(ke,2);{var at=Ie=>{var le=O9(),_e=x(bt(le)),Qe=C(_e);G(()=>q(Qe,u(_).details.family)),T(Ie,le)};$(nt,Ie=>{var le;(le=u(_).details)!=null&&le.family&&Ie(at)})}var ut=x(nt,2);{var ye=Ie=>{var le=F9(),_e=x(bt(le)),Qe=C(_e);G(()=>q(Qe,u(_).details.parameter_size)),T(Ie,le)};$(ut,Ie=>{var le;(le=u(_).details)!=null&&le.parameter_size&&Ie(ye)})}var Et=x(ut,2);{var dt=Ie=>{var le=H9(),_e=x(bt(le)),Qe=C(_e);G(()=>q(Qe,u(_).details.quantization_level)),T(Ie,le)};$(Et,Ie=>{var le;(le=u(_).details)!=null&&le.quantization_level&&Ie(dt)})}var he=x(Et,2);{var Ct=Ie=>{var le=B9(),_e=x(bt(le),2);_i(_e,21,()=>u(_).running,Vn,(Qe,Bt)=>{var fe=W9(),$e=C(fe);G(gt=>q($e,`${u(Bt).name??""} · ${gt??""} VRAM`),[()=>Ei(u(Bt).size_vram)]),T(Qe,fe)}),T(Ie,le)},Ze=Ie=>{var le=z9();T(Ie,le)};$(he,Ie=>{u(_).running&&u(_).running.length>0?Ie(Ct):u(_).running!==null&&Ie(Ze,1)})}T(H,J)};$(Oe,H=>{u(w)?H(xe):u(S)?H(St,1):u(_)&&H(Te,2)})}G(()=>{var H;return q(Me,`Ollama · ${(u(f)||((H=u(h))==null?void 0:H.model))??""}`)}),te("click",K,()=>k(v,!1)),te("click",Ee,H=>H.stopPropagation()),te("click",re,()=>k(v,!1)),T(A,K)};$(ti,A=>{u(v)&&A(ji)})}G(A=>{q(ii,A),xt=$t(it,1,"input-row svelte-1twuiul",null,xt,{"drag-over":u(Le)}),pt=$t(Ye,1,"textarea-wrap svelte-1twuiul",null,pt,{loading:u(a)}),Hn(ei,"placeholder",u(jt)?"Ask anything… (Enter to send, Shift+Enter for newline, drag & drop files to add context)":"AI not configured"),ei.disabled=u(a)||!u(jt)},[()=>Ei(u(Qt))]),As(De,()=>u(V),A=>k(V,A)),As(Vt,()=>u(F),A=>k(F,A)),As(ue,()=>u(Y),A=>k(Y,A)),te("click",ge,Xi),te("change",We,dn),os("dragover",it,Rn),os("dragleave",it,$n),os("drop",it,Nn),te("keydown",ei,on),Ni(ei,()=>u(r),A=>k(r,A)),T(o,Ci),Ao()}Cr(["click","change","keydown"]);var q9=R('<div class="me svelte-1pxdb1"></div>');function Zw(o,e){Ro(e,!0);let t=cg(e,"value",15,""),i=cg(e,"language",3,"javascript"),n,s,r=!1;xr(()=>{const c=i()==="json"?{formatOnPaste:!0,autoIndent:"full"}:{};s=tr.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())})}),yy(()=>s==null?void 0:s.dispose()),zn(()=>{!s||s.getValue()===t()||(r=!0,s.setValue(t()),r=!1)});var a=q9();bs(a,c=>n=c,()=>n),T(o,a),Ao()}var K9=R('<!> <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 — 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),G9=R('<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>'),UD=R('<div class="form-error svelte-rrt0o"> </div>'),Z9=R('<div class="new-item-form svelte-rrt0o"><input placeholder="device/lamp1" class="svelte-rrt0o"/> <button class="svelte-rrt0o">Create</button></div> <!>',1),$D=R("<li> </li>"),qD=R('<div class="error-bar svelte-rrt0o"> </div>'),KD=R('<div class="loading svelte-rrt0o">Loading…</div>'),X9=R('<div class="monaco-doc-wrap svelte-rrt0o"><!></div>'),Y9=R('<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),J9=R('<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>'),Q9=R('<div class="new-item-form svelte-rrt0o"><input placeholder="myView" class="svelte-rrt0o"/> <button class="svelte-rrt0o">Create</button></div> <!>',1),eZ=R('<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>'),tZ=R('<span class="badge-error svelte-rrt0o">error</span>'),iZ=R('<span class="badge-ok svelte-rrt0o"> </span>'),nZ=R('<pre class="result-error svelte-rrt0o"> </pre>'),sZ=R('<pre class="result-json svelte-rrt0o"> </pre>'),oZ=R('<div class="view-result svelte-rrt0o"><div class="result-header svelte-rrt0o">Result <!></div> <!></div>'),rZ=R('<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 · 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>'),aZ=R('<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),lZ=R('<div class="chat-resize-handle svelte-rrt0o" role="separator"></div> <div class="chat-pane svelte-rrt0o"><!></div>',1),cZ=R('<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>'),dZ=R('<div class="db-root svelte-rrt0o" role="presentation"><div class="panel-tabs svelte-rrt0o"><button>Documents</button> <button>Views</button> <!></div> <!></div>');function hZ(o,e){Ro(e,!0);const t=Ae=>{var Z=K9(),Fe=bt(Z);bs(Hg(Fe,{}),wt=>sn=wt,()=>sn),T(Ae,Z)};let i=B(Si([])),n=B(null),s=B("{}"),r=B(!1),a=B(null);const c="she-db-selected-view";let h=B(Si([])),g=B(Si(localStorage.getItem(c))),f=B("#"),p=B("// emit(this.someProperty)"),v=B(""),_=B(""),w=B(!1),S=B(!1),D=B(null),P=B(!1),N=B(null),V=B("she/db/view/");const F="she-db-panel";let Y=B(Si(localStorage.getItem(F)??"docs")),X=B(""),me=B(!1),Le=B(null),je=B(""),ve=B(!1),st=B(null);const Ot="she-db-sidebar-width";let yt=B(Si(parseInt(localStorage.getItem(Ot)??"220",10))),ai=!1,jt=0,Qt=0;const Ne="she-db-chat-width",Ge="she-db-chat-open";let Re=B(localStorage.getItem(Ge)==="true"),ot=B(Si(parseInt(localStorage.getItem(Ne)??"320",10))),At=!1,ni=0,Xt=0;const zt=rt(()=>u(g)?{id:u(g),filter:u(f),map:u(p),reduce:u(v)}:null);function vt(Ae){Ae.filter!==void 0&&k(f,Ae.filter,!0),Ae.map!==void 0&&k(p,Ae.map,!0),Ae.reduce!==void 0&&k(v,Ae.reduce,!0)}zn(()=>{localStorage.setItem(Ge,String(u(Re)))}),zn(()=>{localStorage.setItem(F,u(Y))}),zn(()=>{u(g)?localStorage.setItem(c,u(g)):localStorage.removeItem(c)});function Li(Ae){ai=!0,jt=Ae.clientX,Qt=u(yt),Ae.preventDefault()}function vi(Ae){ai&&k(yt,Math.max(140,Math.min(500,Qt+Ae.clientX-jt)),!0),At&&k(ot,Math.max(240,Math.min(600,Xt-(Ae.clientX-ni))),!0)}function Tn(){ai&&(ai=!1,localStorage.setItem(Ot,String(u(yt)))),At&&(At=!1,localStorage.setItem(Ne,String(u(ot))))}function Gi(Ae){At=!0,ni=Ae.clientX,Xt=u(ot),Ae.preventDefault()}async function Bn(){try{k(i,await cR(),!0)}catch{}}async function nn(){try{k(h,await dR(),!0)}catch{}}async function Ei(Ae){k(n,Ae,!0),k(a,null),k(r,!0);try{const Z=await o7(Ae);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 Mn(){if(u(n)){k(a,null);try{const Ae=JSON.parse(u(s));await pD(u(n),Ae)}catch(Ae){k(a,Ae instanceof Error?Ae.message:String(Ae),!0)}}}let sn;async function Sn(){if(u(n)&&await sn.show(`Delete document "${u(n)}"?`,{confirm:"Delete",danger:!0}))try{await r7(u(n)),k(n,null),k(s,"{}")}catch(Ae){k(a,Ae instanceof Error?Ae.message:String(Ae),!0)}}async function Xi(){const Ae=u(X).trim();if(Ae){k(Le,null);try{await pD(Ae,{}),k(me,!1),k(X,""),await Ei(Ae)}catch(Z){k(Le,Z instanceof Error?Z.message:String(Z),!0)}}}async function Hi(Ae){k(g,Ae,!0),k(N,null),k(P,!0),k(D,null);try{const Z=await a7(Ae);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 Kw(Ae).catch(()=>null),!0)}catch(Z){k(N,Z instanceof Error?Z.message:String(Z),!0)}finally{k(P,!1)}}async function dn(){if(u(g)){k(N,null);try{const Ae={map:u(p)};u(f).trim()&&(Ae.filter=u(f).trim()),u(v).trim()&&(Ae.reduce=u(v).trim()),u(_).trim()&&(Ae.description=u(_).trim()),u(w)&&(Ae.mqttpub=!0),u(S)&&(Ae.retain=!0),await mD(u(g),Ae)}catch(Ae){k(N,Ae instanceof Error?Ae.message:String(Ae),!0)}}}async function Nn(){if(u(g))try{k(D,await Kw(u(g)),!0)}catch(Ae){k(N,Ae instanceof Error?Ae.message:String(Ae),!0)}}async function Rn(){if(u(g)&&await sn.show(`Delete view "${u(g)}"?`,{confirm:"Delete",danger:!0}))try{await l7(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(Ae){k(N,Ae instanceof Error?Ae.message:String(Ae),!0)}}async function $n(){if(!u(je).trim())return;const Ae=u(je).trim();k(st,null);try{await mD(Ae,{map:"// emit(this.someProperty)"}),k(ve,!1),k(je,""),await nn(),await Hi(Ae)}catch(Z){k(st,Z instanceof Error?Z.message:String(Z),!0)}}let Cn=B(""),pn=B(""),on=rt(()=>[...u(i)].filter(Ae=>!u(Cn)||Ae.toLowerCase().includes(u(Cn).toLowerCase())).sort()),qe=rt(()=>[...u(h)].filter(Ae=>!u(pn)||Ae.toLowerCase().includes(u(pn).toLowerCase())).sort());xr(()=>{Bn(),nn().then(()=>{u(g)&&u(h).includes(u(g))?Hi(u(g)):k(g,null)}),iL().then(Dt=>{const Nt=Dt.dbPrefix||"she/db/",O=Nt.endsWith("/")?Nt:Nt+"/";k(V,O+"view/")}).catch(()=>{});const Ae=Ya("db:ids",Dt=>{k(i,Dt.ids??[],!0)}),Z=Ya("db:viewIds",Dt=>{k(h,Dt.ids??[],!0)}),Fe=Ya("db:change",async Dt=>{const Nt=Dt.id;u(n)===Nt&&(Dt.doc===null?(k(n,null),k(s,"{}")):k(s,JSON.stringify(Dt.doc,null,2),!0))}),wt=Ya("db:viewUpdate",async Dt=>{const Nt=Dt.id;u(g)===Nt&&k(D,await Kw(Nt).catch(()=>null),!0)});return()=>{Ae(),Z(),Fe(),wt()}});var Ft=dZ(),li=C(Ft),Ci=C(li);let Ii;var mn=x(Ci,2);let xn;var qn=x(mn,2);{var hn=Ae=>{var Z=G9();let Fe;G(()=>{Fe=$t(Z,1,"ai-toggle svelte-rrt0o",null,Fe,{"ai-open":u(Re)}),Hn(Z,"title",u(Re)?"Close AI assistant":"Open AI assistant")}),te("click",Z,()=>k(Re,!u(Re))),T(Ae,Z)};$(qn,Ae=>{u(Y)==="views"&&Ae(hn)})}var An=x(li,2);{var rn=Ae=>{var Z=J9(),Fe=C(Z);let wt;var Dt=C(Fe),Nt=C(Dt),O=x(Dt,2);{var se=ft=>{var ue=Z9(),ht=bt(ue),ii=C(ht),Kt=x(ii,2),si=x(ht,2);{var ui=Q=>{var ge=UD(),We=C(ge);G(()=>q(We,u(Le))),T(Q,ge)};$(si,Q=>{u(Le)&&Q(ui)})}te("keydown",ii,Q=>Q.key==="Enter"&&Xi()),Ni(ii,()=>u(X),Q=>k(X,Q)),te("click",Kt,Xi),T(ft,ue)};$(O,ft=>{u(me)&&ft(se)})}var be=x(O,2),j=C(be),pe=x(be,2);_i(pe,20,()=>u(on),ft=>ft,(ft,ue)=>{var ht=$D();let ii;var Kt=C(ht);G(()=>{ii=$t(ht,1,"flat-item svelte-rrt0o",null,ii,{"active-item":u(n)===ue}),q(Kt,ue)}),te("click",ht,()=>Ei(ue)),T(ft,ht)});var Ue=x(Fe,2),Ce=x(Ue,2),De=C(Ce);{var Xe=ft=>{var ue=Y9(),ht=bt(ue),ii=C(ht),Kt=C(ii),si=x(ii,2),ui=x(si,2),Q=x(ht,2);{var ge=Ye=>{var pt=qD(),ei=C(pt);G(()=>q(ei,u(a))),T(Ye,pt)};$(Q,Ye=>{u(a)&&Ye(ge)})}var We=x(Q,2);{var it=Ye=>{var pt=KD();T(Ye,pt)},xt=Ye=>{var pt=X9(),ei=C(pt);Zw(ei,{language:"json",get value(){return u(s)},set value(Ut){k(s,Ut,!0)}}),T(Ye,pt)};$(We,Ye=>{u(r)?Ye(it):Ye(xt,-1)})}G(()=>q(Kt,u(n))),te("click",si,Mn),te("click",ui,Sn),T(ft,ue)},Vt=ft=>{t(ft)};$(De,ft=>{u(n)?ft(Xe):ft(Vt,-1)})}G(()=>wt=Ko(Fe,"",wt,{width:`${u(yt)??""}px`})),te("click",Nt,()=>{k(me,!u(me)),k(Le,null)}),Ni(j,()=>u(Cn),ft=>k(Cn,ft)),te("mousedown",Ue,Li),T(Ae,Z)},Ln=Ae=>{var Z=cZ(),Fe=C(Z);let wt;var Dt=C(Fe),Nt=C(Dt),O=x(Dt,2);{var se=ht=>{var ii=Q9(),Kt=bt(ii),si=C(Kt),ui=x(si,2),Q=x(Kt,2);{var ge=We=>{var it=UD(),xt=C(it);G(()=>q(xt,u(st))),T(We,it)};$(Q,We=>{u(st)&&We(ge)})}te("keydown",si,We=>We.key==="Enter"&&$n()),Ni(si,()=>u(je),We=>k(je,We)),te("click",ui,$n),T(ht,ii)};$(O,ht=>{u(ve)&&ht(se)})}var be=x(O,2),j=C(be),pe=x(be,2);_i(pe,20,()=>u(qe),ht=>ht,(ht,ii)=>{var Kt=$D();let si;var ui=C(Kt);G(()=>{si=$t(Kt,1,"flat-item svelte-rrt0o",null,si,{"active-item":u(g)===ii}),q(ui,ii)}),te("click",Kt,()=>Hi(ii)),T(ht,Kt)});var Ue=x(Fe,2),Ce=x(Ue,2),De=C(Ce);{var Xe=ht=>{var ii=aZ(),Kt=bt(ii),si=C(Kt),ui=C(si),Q=x(si,2),ge=x(Q,2),We=x(ge,2),it=x(Kt,2);{var xt=Ut=>{var Rt=qD(),Oi=C(Rt);G(()=>q(Oi,u(N))),T(Ut,Rt)};$(it,Ut=>{u(N)&&Ut(xt)})}var Ye=x(it,2);{var pt=Ut=>{var Rt=KD();T(Ut,Rt)},ei=Ut=>{var Rt=rZ(),Oi=C(Rt),an=x(C(Oi),2),Wi=C(an),ti=x(Oi,2),ji=x(C(ti),2),A=C(ji),K=x(ti,2),Ee=x(C(K),2),Pe=C(Ee);Zw(Pe,{language:"javascript",get value(){return u(p)},set value(at){k(p,at,!0)}});var Be=x(K,2),Me=x(C(Be),2),re=C(Me);Zw(re,{language:"javascript",get value(){return u(v)},set value(at){k(v,at,!0)}});var Je=x(Be,2),Oe=C(Je),xe=C(Oe),St=x(xe,4),Te=x(C(St)),H=C(Te),J=x(Oe,2);{var ke=at=>{var ut=eZ(),ye=C(ut);As(ye,()=>u(S),Et=>k(S,Et)),T(at,ut)};$(J,at=>{u(w)&&at(ke)})}var Ke=x(Je,2);{var nt=at=>{var ut=oZ(),ye=C(ut),Et=x(C(ye));{var dt=le=>{var _e=tZ();T(le,_e)},he=le=>{var _e=iZ(),Qe=C(_e);G(()=>q(Qe,`${u(D).length??0??""} items · rev ${u(D)._rev??""}`)),T(le,_e)};$(Et,le=>{u(D).error?le(dt):le(he,-1)})}var Ct=x(ye,2);{var Ze=le=>{var _e=nZ(),Qe=C(_e);G(()=>q(Qe,u(D).error)),T(le,_e)},Ie=le=>{var _e=sZ(),Qe=C(_e);G(Bt=>q(Qe,Bt),[()=>JSON.stringify(u(D).result,null,2)]),T(le,_e)};$(Ct,le=>{u(D).error?le(Ze):le(Ie,-1)})}T(at,ut)};$(Ke,at=>{u(D)&&at(nt)})}G(()=>q(H,`${u(V)??""}${u(g)??""} on every update`)),Ni(Wi,()=>u(_),at=>k(_,at)),Ni(A,()=>u(f),at=>k(f,at)),As(xe,()=>u(w),at=>k(w,at)),T(Ut,Rt)};$(Ye,Ut=>{u(P)?Ut(pt):Ut(ei,-1)})}G(()=>q(ui,u(g))),te("click",Q,dn),te("click",ge,Nn),te("click",We,Rn),T(ht,ii)},Vt=ht=>{t(ht)};$(De,ht=>{u(g)?ht(Xe):ht(Vt,-1)})}var ft=x(Ce,2);{var ue=ht=>{var ii=lZ(),Kt=bt(ii),si=x(Kt,2);let ui;var Q=C(si);$9(Q,{get currentView(){return u(zt)},onApplyView:vt}),G(()=>ui=Ko(si,"",ui,{width:`${u(ot)??""}px`})),te("mousedown",Kt,Gi),T(ht,ii)};$(ft,ht=>{u(Re)&&ht(ue)})}G(()=>wt=Ko(Fe,"",wt,{width:`${u(yt)??""}px`})),te("click",Nt,()=>{k(ve,!u(ve)),k(st,null)}),Ni(j,()=>u(pn),ht=>k(pn,ht)),te("mousedown",Ue,Li),T(Ae,Z)};$(An,Ae=>{u(Y)==="docs"?Ae(rn):Ae(Ln,-1)})}G(()=>{Ii=$t(Ci,1,"svelte-rrt0o",null,Ii,{active:u(Y)==="docs"}),xn=$t(mn,1,"svelte-rrt0o",null,xn,{active:u(Y)==="views"})}),te("mousemove",Ft,vi),te("mouseup",Ft,Tn),os("mouseleave",Ft,Tn),te("click",Ci,()=>k(Y,"docs")),te("click",mn,()=>k(Y,"views")),T(o,Ft),Ao()}Cr(["mousemove","mouseup","click","keydown","mousedown"]);var uZ=R('<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),gZ=R('<label class="svelte-1ua3isv">Pairing Code / QR <input type="text" placeholder="MT:..." class="svelte-1ua3isv"/></label>'),GD=R('<p class="err svelte-1ua3isv"> </p>'),fZ=R('<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>'),pZ=R('<span class="device-name svelte-1ua3isv"> </span> <span class="device-nodeid svelte-1ua3isv"> </span>',1),mZ=R('<span class="device-name svelte-1ua3isv"> </span>'),_Z=R('<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>'),vZ=R('<li class="empty svelte-1ua3isv">No paired devices</li>'),bZ=R('<p class="info svelte-1ua3isv">Loading…</p>'),yZ=R('<p class="device-subtitle svelte-1ua3isv"> </p>'),wZ=R('<span class="ep-chip svelte-1ua3isv"> </span>'),SZ=R('<span class="attr-id svelte-1ua3isv"> </span>'),CZ=R('<button class="attr-action-btn svelte-1ua3isv"> </button>'),xZ=R('<div class="attr-actions svelte-1ua3isv"></div>'),LZ=R('<span class="cmd-sep svelte-1ua3isv">,</span>'),kZ=R('<span class="cmd-name svelte-1ua3isv"> </span><span class="cmd-id svelte-1ua3isv"> </span>',1),IZ=R('<span class="cmd-id svelte-1ua3isv"> </span>'),DZ=R("<!> <!>",1),EZ=R('<span class="cmd-list svelte-1ua3isv"></span>'),PZ=R(' <span class="cmd-id svelte-1ua3isv"> </span>',1),TZ=R('<tr class="svelte-1ua3isv"><td class="svelte-1ua3isv"><!></td><td class="svelte-1ua3isv"> </td></tr>'),MZ=R('<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>'),NZ=R('<th class="svelte-1ua3isv"> </th>'),RZ=R('<td class="svelte-1ua3isv"> </td>'),AZ=R('<tr class="svelte-1ua3isv"></tr>'),OZ=R('<table class="attr-arr-table svelte-1ua3isv"><thead class="svelte-1ua3isv"><tr class="svelte-1ua3isv"></tr></thead><tbody class="svelte-1ua3isv"></tbody></table>'),FZ=R('<tr class="svelte-1ua3isv"><td class="attr-obj-key svelte-1ua3isv"> </td><td class="attr-obj-val svelte-1ua3isv"> </td></tr>'),HZ=R('<table class="attr-obj-table svelte-1ua3isv"><tbody class="svelte-1ua3isv"></tbody></table>'),WZ=R('<a class="attr-link svelte-1ua3isv" target="_blank" rel="noopener noreferrer"> </a>'),BZ=R('<span class="attr-val svelte-1ua3isv"> </span>'),zZ=R('<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>'),VZ=R('<tr class="cluster-hdr-row svelte-1ua3isv"><td colspan="3" class="cluster-hdr-cell svelte-1ua3isv"> </td></tr> <!>',1),jZ=R('<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>'),UZ=R('<p class="no-clusters svelte-1ua3isv">No clusters</p>'),$Z=R('<details class="svelte-1ua3isv"><summary class="svelte-1ua3isv"> <span class="ep-id svelte-1ua3isv"> </span> <span class="ep-chips svelte-1ua3isv"></span></summary> <!></details>'),qZ=R('<div class="detail-hdr svelte-1ua3isv"><h2 class="svelte-1ua3isv"> </h2> <!> <p class="detail-nodeid svelte-1ua3isv"> </p></div> <!>',1),KZ=R('<p class="info svelte-1ua3isv">Select a device to view its endpoints.</p>'),GZ=R('<span class="stream-badge svelte-1ua3isv"> </span>'),ZZ=R('<span class="stream-empty svelte-1ua3isv">Waiting for events…</span>'),Xw=R(' <span class="e-sub svelte-1ua3isv"> </span>',1),XZ=R('<span class="e-badge e-badge-status svelte-1ua3isv">status</span> <span class="e-node svelte-1ua3isv"> <!></span> <span> </span>',1),YZ=R('<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),JZ=R('<div class="er svelte-1ua3isv"><span class="e-ts svelte-1ua3isv"> </span> <!></div>'),QZ=R('<div class="stream-body svelte-1ua3isv"><!></div>'),eX=R('<!> <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 tX(o,e){Ro(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,wt,Dt,Nt){try{await w7(Z,Fe,wt,Dt,Nt)}catch(O){console.error("matter command failed",O)}}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 wt=n[Z];return Fe.map(Dt=>{const Nt=typeof Dt=="number"?Dt:Number(Dt);return{id:Nt,name:(wt==null?void 0:wt[Nt])??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=B(Si([])),f=Si(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 P=500,N=20,V=32;let F=0,Y=B(Si([])),X=B(!0),me=B(180),Le=rt(()=>{const Z=Math.max(1,Math.floor((u(me)-V)/N)+1);return u(Y).slice(0,Z)});function je(Z){Z.preventDefault();const Fe=Z.clientY,wt=u(me);function Dt(O){k(me,Math.max(60,Math.min(600,wt+Fe-O.clientY)),!0)}function Nt(){document.removeEventListener("mousemove",Dt),document.removeEventListener("mouseup",Nt)}document.addEventListener("mousemove",Dt),document.addEventListener("mouseup",Nt)}let ve=B(null),st=B(!1),Ot=B(null),yt=B(!1),ai=B("passcode"),jt=B(""),Qt=B(""),Ne=B(""),Ge=B(!1),Re=B(null),ot=B("");const At="she:matter:selectedNodeId";async function ni(){try{k(g,await hR(),!0);for(const Z of u(g))T_(Z.nodeId).then(Fe=>{f.set(Z.nodeId,Fe)}).catch(()=>{});if(u(g).length>0&&!u(ve)){const Z=localStorage.getItem(At),Fe=Z&&u(g).find(wt=>wt.nodeId===Z)?Z:u(g)[0].nodeId;Xt(Fe)}}catch{k(g,[],!0)}}async function Xt(Z){k(st,!0),k(Ot,null);try{k(ve,await T_(Z),!0),f.set(Z,u(ve)),localStorage.setItem(At,Z)}catch(Fe){k(Ot,Fe instanceof Error?Fe.message:String(Fe),!0)}finally{k(st,!1)}}let zt;async function vt(Z){var Fe;if(await zt.show(`Unpair device ${Z}?`,{confirm:"Unpair",danger:!0}))try{await y7(Z),((Fe=u(ve))==null?void 0:Fe.nodeId)===Z&&k(ve,null),await ni()}catch(wt){k(Ot,wt instanceof Error?wt.message:String(wt),!0)}}async function Li(){k(Ge,!0),k(Re,null);try{let Z;u(ai)==="passcode"?(Z={passcode:Number(u(jt))},u(Qt)&&(Z={...Z,discriminator:Number(u(Qt))})):Z={pairingCode:u(Ne).trim()},u(ot).trim()&&(Z={...Z,discoveryAddress:u(ot).trim()}),await b7(Z),k(yt,!1),k(jt,""),k(Qt,""),k(Ne,""),k(ot,""),await ni()}catch(Z){k(Re,Z instanceof Error?Z.message:String(Z),!0)}finally{k(Ge,!1)}}xr(()=>{ni()});const vi=Ya("matter:deviceList",Z=>{if(!Array.isArray(Z.devices))return;const Fe=Z.devices;for(const wt of Fe)f.has(wt.nodeId)||T_(wt.nodeId).then(Dt=>{f.set(wt.nodeId,Dt)}).catch(()=>{});k(g,Fe,!0)}),Tn=Ya("matter:deviceStatus",Z=>{if(Z.nodeId===void 0)return;const Fe=String(Z.nodeId),wt=!!Z.online;k(g,u(g).map(Dt=>Dt.nodeId===Fe?{...Dt,online:wt}:Dt),!0),k(Y,[{id:F++,kind:"status",nodeId:Fe,online:wt,ts:Date.now()},...u(Y).slice(0,P-1)],!0)}),Gi=Ya("matter:attr",Z=>{const Fe=String(Z.nodeId),wt=Z.endpointId,Dt=String(Z.clusterName),Nt=String(Z.attrName),O=Z.value;if(u(ve)&&u(ve).nodeId===Fe){const be=u(ve).endpoints.find(pe=>pe.endpointId===wt),j=be==null?void 0:be.clusters.find(pe=>pe.name===Dt);j&&(j.attrs[Nt]=O)}const se=f.get(Fe);if(se){const be=se.endpoints.find(pe=>pe.endpointId===wt),j=be==null?void 0:be.clusters.find(pe=>pe.name===Dt);j&&(j.attrs[Nt]=O)}k(Y,[{id:F++,kind:"attr",nodeId:Fe,endpointId:wt,clusterName:Dt,attrName:Nt,value:O,ts:Z.ts??Date.now()},...u(Y).slice(0,P-1)],!0)});yy(()=>{vi(),Tn(),Gi()});var Bn=eX(),nn=bt(Bn);bs(Hg(nn,{}),Z=>zt=Z,()=>zt);var Ei=x(nn,2),Mn=C(Ei),sn=C(Mn),Sn=C(sn),Xi=x(C(Sn),2),Hi=x(Sn,2);{var dn=Z=>{var Fe=fZ(),wt=C(Fe),Dt=C(wt);let Nt;var O=x(Dt,2);let se;var be=x(wt,2);{var j=ue=>{var ht=uZ(),ii=bt(ht),Kt=x(C(ii)),si=x(ii,2),ui=x(C(si));Ni(Kt,()=>u(jt),Q=>k(jt,Q)),Ni(ui,()=>u(Qt),Q=>k(Qt,Q)),T(ue,ht)},pe=ue=>{var ht=gZ(),ii=x(C(ht));Ni(ii,()=>u(Ne),Kt=>k(Ne,Kt)),T(ue,ht)};$(be,ue=>{u(ai)==="passcode"?ue(j):ue(pe,-1)})}var Ue=x(be,2),Ce=x(C(Ue)),De=x(Ue,2);{var Xe=ue=>{var ht=GD(),ii=C(ht);G(()=>q(ii,u(Re))),T(ue,ht)};$(De,ue=>{u(Re)&&ue(Xe)})}var Vt=x(De,2),ft=C(Vt);G(()=>{Nt=$t(Dt,1,"svelte-1ua3isv",null,Nt,{active:u(ai)==="passcode"}),se=$t(O,1,"svelte-1ua3isv",null,se,{active:u(ai)==="pairingCode"}),Vt.disabled=u(Ge),q(ft,u(Ge)?"Commissioning…":"Commission")}),te("click",Dt,()=>k(ai,"passcode")),te("click",O,()=>k(ai,"pairingCode")),Ni(Ce,()=>u(ot),ue=>k(ot,ue)),te("click",Vt,Li),T(Z,Fe)};$(Hi,Z=>{u(yt)&&Z(dn)})}var Nn=x(Hi,2),Rn=C(Nn);_i(Rn,17,()=>u(g),Z=>Z.nodeId,(Z,Fe)=>{var wt=_Z();let Dt;var Nt=C(wt),O=C(Nt);let se;var be=x(O,2),j=C(be);{var pe=De=>{var Xe=pZ(),Vt=bt(Xe),ft=C(Vt),ue=x(Vt,2),ht=C(ue);G(()=>{q(ft,u(Fe).name),q(ht,`#${u(Fe).nodeId??""}`)}),T(De,Xe)},Ue=De=>{var Xe=mZ(),Vt=C(Xe);G(()=>q(Vt,`Node ${u(Fe).nodeId??""}`)),T(De,Xe)};$(j,De=>{u(Fe).name?De(pe):De(Ue,-1)})}var Ce=x(Nt,2);G(()=>{var De;Dt=$t(wt,1,"svelte-1ua3isv",null,Dt,{selected:((De=u(ve))==null?void 0:De.nodeId)===u(Fe).nodeId}),se=$t(O,1,"status-dot svelte-1ua3isv",null,se,{online:u(Fe).online})}),te("click",Nt,()=>Xt(u(Fe).nodeId)),te("click",Ce,()=>vt(u(Fe).nodeId)),T(Z,wt)});var $n=x(Rn,2);{var Cn=Z=>{var Fe=vZ();T(Z,Fe)};$($n,Z=>{u(g).length===0&&Z(Cn)})}var pn=x(sn,2),on=C(pn);{var qe=Z=>{var Fe=bZ();T(Z,Fe)},Ft=Z=>{var Fe=GD(),wt=C(Fe);G(()=>q(wt,u(Ot))),T(Z,Fe)},li=Z=>{var Fe=qZ(),wt=bt(Fe),Dt=C(wt),Nt=C(Dt),O=x(Dt,2);{var se=Ue=>{var Ce=yZ(),De=C(Ce);G(()=>q(De,u(ve).subtitle)),T(Ue,Ce)};$(O,Ue=>{u(ve).subtitle&&Ue(se)})}var be=x(O,2),j=C(be),pe=x(wt,2);_i(pe,17,()=>u(ve).endpoints,Ue=>Ue.endpointId,(Ue,Ce)=>{var De=$Z(),Xe=C(De),Vt=C(Xe),ft=x(Vt),ue=C(ft),ht=x(ft,2);_i(ht,21,()=>u(Ce).clusters,Vn,(ui,Q)=>{var ge=wZ(),We=C(ge);G(()=>q(We,u(Q).name)),T(ui,ge)});var ii=x(Xe,2);{var Kt=ui=>{var Q=jZ(),ge=x(C(Q));_i(ge,21,()=>u(Ce).clusters,Vn,(We,it)=>{var xt=VZ(),Ye=bt(xt),pt=C(Ye),ei=C(pt),Ut=x(Ye,2);_i(Ut,17,()=>Object.entries(u(it).attrs),Vn,(Rt,Oi)=>{var an=rt(()=>mk(u(Oi),2));let Wi=()=>u(an)[0],ti=()=>u(an)[1];var ji=Fs(),A=bt(ji);{var K=Pe=>{const Be=rt(()=>{var _e;return(_e=t[u(it).name])==null?void 0:_e[Wi()]}),Me=rt(()=>(Wi()==="acceptedCommandList"||Wi()==="generatedCommandList")&&Array.isArray(ti())),re=rt(()=>{var _e;return((_e=c[u(it).name])==null?void 0:_e[Wi()])??a[Wi()]});var Je=zZ(),Oe=C(Je),xe=C(Oe),St=C(xe),Te=x(xe);{var H=_e=>{var Qe=SZ(),Bt=C(Qe);G(fe=>q(Bt,`(${fe??""})`),[()=>h(u(re))]),T(_e,Qe)};$(Te,_e=>{u(re)!==void 0&&_e(H)})}var J=x(Oe),ke=C(J);{var Ke=_e=>{var Qe=xZ();_i(Qe,21,()=>u(Be),Vn,(Bt,fe)=>{var $e=CZ(),gt=C($e);G(()=>q(gt,u(fe).label)),te("click",$e,()=>i(u(ve).nodeId,u(Ce).endpointId,u(it).name,u(fe).command,u(fe).args)),T(Bt,$e)}),T(_e,Qe)};$(ke,_e=>{u(Be)&&_e(Ke)})}var nt=x(J),at=C(nt);{var ut=_e=>{var Qe=EZ();_i(Qe,21,()=>s(u(it).name,ti()),Vn,(Bt,fe,$e)=>{var gt=DZ(),Pt=bt(gt);{var et=$i=>{var oi=LZ();T($i,oi)};$(Pt,$i=>{$e>0&&$i(et)})}var ci=x(Pt,2);{var Jt=$i=>{var oi=kZ(),Gt=bt(oi),_n=C(Gt),ri=x(Gt),On=C(ri);G(()=>{q(_n,u(fe).name),q(On,`(${u(fe).id??""})`)}),T($i,oi)},Gn=$i=>{var oi=IZ(),Gt=C(oi);G(()=>q(Gt,u(fe).id)),T($i,oi)};$(ci,$i=>{u(fe).name?$i(Jt):$i(Gn,-1)})}T(Bt,gt)}),T(_e,Qe)},ye=_e=>{var Qe=MZ(),Bt=x(C(Qe));_i(Bt,21,ti,Vn,(fe,$e)=>{const gt=rt(()=>u($e)),Pt=rt(()=>u(gt).deviceType),et=rt(()=>r[u(Pt)]);var ci=TZ(),Jt=C(ci),Gn=C(Jt);{var $i=ri=>{var On=PZ(),Yi=bt(On),Ps=x(Yi),Oo=C(Ps);G(Lr=>{q(Yi,`${u(et)??""} `),q(Oo,`(${Lr??""})`)},[()=>h(u(Pt))]),T(ri,On)},oi=ri=>{var On=Ur();G(Yi=>q(On,Yi),[()=>h(u(Pt))]),T(ri,On)};$(Gn,ri=>{u(et)?ri($i):ri(oi,-1)})}var Gt=x(Jt),_n=C(Gt);G(ri=>q(_n,ri),[()=>v(u(gt).revision)]),T(fe,ci)}),T(_e,Qe)},Et=rt(()=>Wi()==="deviceTypeList"&&Array.isArray(ti())),dt=_e=>{const Qe=rt(()=>[...new Set(ti().flatMap(Pt=>Object.keys(Pt)))]);var Bt=OZ(),fe=C(Bt),$e=C(fe);_i($e,21,()=>u(Qe),Vn,(Pt,et)=>{var ci=NZ(),Jt=C(ci);G(()=>q(Jt,u(et))),T(Pt,ci)});var gt=x(fe);_i(gt,21,ti,Vn,(Pt,et)=>{var ci=AZ();_i(ci,21,()=>u(Qe),Vn,(Jt,Gn)=>{var $i=RZ(),oi=C($i);G(Gt=>q(oi,Gt),[()=>v(u(et)[u(Gn)])]),T(Jt,$i)}),T(Pt,ci)}),T(_e,Bt)},he=rt(()=>w(ti())),Ct=_e=>{var Qe=HZ(),Bt=C(Qe);_i(Bt,21,()=>Object.entries(ti()),Vn,(fe,$e)=>{var gt=rt(()=>mk(u($e),2));let Pt=()=>u(gt)[0],et=()=>u(gt)[1];var ci=FZ(),Jt=C(ci),Gn=C(Jt),$i=x(Jt),oi=C($i);G(Gt=>{q(Gn,Pt()),q(oi,Gt)},[()=>v(et())]),T(fe,ci)}),T(_e,Qe)},Ze=rt(()=>_(ti())),Ie=_e=>{var Qe=WZ(),Bt=C(Qe);G(()=>{Hn(Qe,"href",ti()),q(Bt,ti())}),T(_e,Qe)},le=_e=>{var Qe=BZ(),Bt=C(Qe);G(fe=>q(Bt,fe),[()=>v(ti())]),T(_e,Qe)};$(at,_e=>{u(Me)?_e(ut):u(Et)?_e(ye,1):u(he)?_e(dt,2):u(Ze)?_e(Ct,3):(Wi()==="productUrl"||Wi()==="productURL")&&typeof ti()=="string"?_e(Ie,4):_e(le,-1)})}G(()=>{Hn(Oe,"title",Wi()),q(St,Wi())}),T(Pe,Je)},Ee=rt(()=>!S(ti(),Wi()));$(A,Pe=>{u(Ee)&&Pe(K)})}T(Rt,ji)}),G(()=>q(ei,u(it).name)),T(We,xt)}),T(ui,Q)},si=ui=>{var Q=UZ();T(ui,Q)};$(ii,ui=>{u(Ce).clusters.length>0?ui(Kt):ui(si,-1)})}G(()=>{q(Vt,`${u(Ce).name??`Endpoint ${u(Ce).endpointId}`??""} `),q(ue,`ep${u(Ce).endpointId??""}`)}),T(Ue,De)}),G(()=>{q(Nt,u(ve).name??`Node ${u(ve).nodeId}`),q(j,`Node ID: ${u(ve).nodeId??""}`)}),T(Z,Fe)},Ci=Z=>{var Fe=KZ();T(Z,Fe)};$(on,Z=>{u(st)?Z(qe):u(Ot)?Z(Ft,1):u(ve)?Z(li,2):Z(Ci,-1)})}var Ii=x(Mn,2),mn=C(Ii),xn=x(mn,2),qn=x(C(xn),2);{var hn=Z=>{var Fe=GZ(),wt=C(Fe);G(()=>q(wt,u(Y).length)),T(Z,Fe)};$(qn,Z=>{!u(X)&&u(Y).length>0&&Z(hn)})}var An=x(qn,2),rn=C(An),Ln=x(xn,2);{var Ae=Z=>{var Fe=QZ(),wt=C(Fe);{var Dt=O=>{var se=ZZ();T(O,se)},Nt=O=>{var se=Fs(),be=bt(se);_i(be,17,()=>u(Le),j=>j.id,(j,pe)=>{const Ue=rt(()=>{var Kt,si;return((Kt=f.get(u(pe).nodeId))==null?void 0:Kt.name)??((si=u(g).find(ui=>ui.nodeId===u(pe).nodeId))==null?void 0:si.name)??null}),Ce=rt(()=>{var Kt,si;return u(pe).endpointId!==void 0?((si=(Kt=f.get(u(pe).nodeId))==null?void 0:Kt.endpoints.find(ui=>ui.endpointId===u(pe).endpointId))==null?void 0:si.name)??null:null}),De=rt(()=>u(pe).attrName??u(pe).clusterName);var Xe=JZ(),Vt=C(Xe),ft=C(Vt),ue=x(Vt,2);{var ht=Kt=>{var si=XZ(),ui=x(bt(si),2),Q=C(ui),ge=x(Q);{var We=pt=>{var ei=Xw(),Ut=x(bt(ei)),Rt=C(Ut);G(()=>q(Rt,`(#${u(pe).nodeId??""})`)),T(pt,ei)};$(ge,pt=>{u(Ue)&&pt(We)})}var it=x(ui,2);let xt;var Ye=C(it);G(()=>{q(Q,u(Ue)??`#${u(pe).nodeId}`),xt=$t(it,1,"e-val svelte-1ua3isv",null,xt,{"e-online":u(pe).online,"e-offline":!u(pe).online}),q(Ye,u(pe).online?"online":"offline")}),T(Kt,si)},ii=Kt=>{var si=YZ(),ui=x(bt(si),2),Q=C(ui),ge=x(Q);{var We=ti=>{var ji=Xw(),A=x(bt(ji)),K=C(A);G(()=>q(K,`(#${u(pe).nodeId??""})`)),T(ti,ji)};$(ge,ti=>{u(Ue)&&ti(We)})}var it=x(ui,2),xt=C(it),Ye=x(xt);{var pt=ti=>{var ji=Xw(),A=x(bt(ji)),K=C(A);G(()=>q(K,`(ep ${u(pe).endpointId??""})`)),T(ti,ji)};$(Ye,ti=>{u(Ce)&&ti(pt)})}var ei=x(it,2),Ut=C(ei),Rt=x(ei,2),Oi=C(Rt),an=x(Rt,2),Wi=C(an);G(ti=>{q(Q,u(Ue)??`#${u(pe).nodeId}`),q(xt,u(Ce)??`ep${u(pe).endpointId}`),q(Ut,u(pe).clusterName),q(Oi,u(De)),q(Wi,ti)},[()=>p(u(pe).value)]),T(Kt,si)};$(ue,Kt=>{u(pe).kind==="status"?Kt(ht):Kt(ii,-1)})}G(Kt=>q(ft,Kt),[()=>D(u(pe).ts)]),T(j,Xe)}),T(O,se)};$(wt,O=>{u(Le).length===0?O(Dt):O(Nt,-1)})}T(Z,Fe)};$(Ln,Z=>{u(X)&&Z(Ae)})}G(()=>{Ko(Ii,u(X)?`height: ${u(me)}px;`:""),q(rn,u(X)?"▾":"▸")}),te("click",Xi,()=>k(yt,!u(yt))),te("mousedown",mn,je),te("click",An,()=>{k(X,!u(X))}),T(o,Bn),Ao()}Cr(["click","mousedown"]);var iX=R("<button>›</button>"),nX=R('<span class="chev-ph svelte-1vejtrc"></span>'),sX=R('<span class="tv svelte-1vejtrc"> </span> <span class="tt svelte-1vejtrc"> </span>',1),oX=R('<div class="tc svelte-1vejtrc"></div>'),rX=R('<div class="tn svelte-1vejtrc"><div><!> <span class="seg svelte-1vejtrc"> </span> <!></div> <!></div>'),aX=R("<option></option>"),lX=R('<span class="pub-ok svelte-1vejtrc">✓</span>'),cX=R('<span class="pub-err svelte-1vejtrc"> </span>'),dX=R('<div class="info svelte-1vejtrc">Loading…</div>'),hX=R('<div class="info err svelte-1vejtrc"> </div>'),uX=R('<div class="info svelte-1vejtrc">No topics match.</div>'),gX=R('<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>'),fX=R('<div class="vs svelte-1vejtrc"><div><div class="vrows-abs svelte-1vejtrc"></div></div></div>'),pX=R('<div class="info svelte-1vejtrc">No topics yet.</div>'),mX=R('<div class="tree-wrap svelte-1vejtrc"><!></div>'),_X=R('<span class="stream-badge"> </span>'),vX=R('<span class="stream-empty svelte-1vejtrc">Waiting for messages…</span>'),bX=R('<span class="s-ret svelte-1vejtrc" title="retained snapshot">⊛</span>'),yX=R('<div><span class="s-ts svelte-1vejtrc"> </span> <!> <span class="s-topic svelte-1vejtrc"> </span> <span class="s-val svelte-1vejtrc"> </span></div>'),wX=R('<div class="stream-body svelte-1vejtrc"><!></div>'),SX=R('<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),CX=R('<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>'),xX=R('<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),LX=R('<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 kX(o,e){Ro(e,!0);const t=(Q,ge=py)=>{const We=rt(()=>u(f).has(ge().path)),it=rt(()=>u(a)>=0&&ge().children.size>0),xt=rt(()=>u(a)>=0&&ge().isLeaf&&!n.has(ge().path));var Ye=rX(),pt=C(Ye);let ei;var Ut=C(pt);{var Rt=Pe=>{var Be=iX();let Me;G(()=>{Me=$t(Be,1,"chev svelte-1vejtrc",null,Me,{open:u(We)}),Hn(Be,"aria-label",u(We)?"Collapse":"Expand")}),te("click",Be,()=>p(ge().path)),T(Pe,Be)},Oi=Pe=>{var Be=nX();T(Pe,Be)};$(Ut,Pe=>{u(it)?Pe(Rt):Pe(Oi,-1)})}var an=x(Ut,2),Wi=C(an),ti=x(an,2);{var ji=Pe=>{var Be=sX(),Me=bt(Be),re=C(Me),Je=x(Me,2),Oe=C(Je);G((xe,St,Te)=>{Hn(Me,"title",xe),q(re,St),q(Oe,Te)},[()=>{var xe;return Ei((xe=Sn(ge().path))==null?void 0:xe.val)},()=>{var xe;return Ei((xe=Sn(ge().path))==null?void 0:xe.val)},()=>{var xe;return((xe=Sn(ge().path))==null?void 0:xe.ts)!=null?Mn(Sn(ge().path).ts):""}]),T(Pe,Be)},A=rt(()=>ge().isLeaf&&i.has(ge().path));$(ti,Pe=>{u(A)&&Pe(ji)})}var K=x(pt,2);{var Ee=Pe=>{var Be=oX();_i(Be,21,()=>[...ge().children.values()].sort((Me,re)=>Me.seg.localeCompare(re.seg)),Me=>Me.path,(Me,re)=>{t(Me,()=>u(re))}),T(Pe,Be)};$(K,Pe=>{u(it)&&u(We)&&Pe(Ee)})}G(()=>{ei=$t(pt,1,"tr svelte-1vejtrc",null,ei,{stale:u(xt)}),q(Wi,ge().seg)}),te("click",pt,()=>{k(st,ge().path+"/#")}),te("contextmenu",pt,Pe=>{Pe.preventDefault(),k(ot,{x:Pe.clientX,y:Pe.clientY,topic:ge().path},!0)}),T(Q,Ye)},i=new Map,n=new Set,s=new Set;let r=null,a=B(0);function c(){r===null&&(r=requestAnimationFrame(()=>{r=null;for(const Q of s)g(Q);s.clear(),bk(a)}))}const h=new Map;function g(Q){const ge=Q.split("/");let We=h,it="";for(let xt=0;xt<ge.length;xt++){const Ye=ge[xt];it=xt===0?Ye:`${it}/${Ye}`,We.has(Ye)||We.set(Ye,{seg:Ye,path:it,children:new Map,isLeaf:!1});const pt=We.get(Ye);xt===ge.length-1&&(pt.isLeaf=!0),We=pt.children}}let f=B(Si(new Set));function p(Q){const ge=new Set(u(f));ge.has(Q)?ge.delete(Q):ge.add(Q),k(f,ge,!0)}let v=B("");const _=24,w=5;let S=B(0),D=B(300),P=rt(()=>{if(u(a),!u(v))return[];const Q=u(v).toLowerCase().split(/\s+/).filter(Boolean),ge=[];for(const[We,it]of i){const xt=We.toLowerCase();Q.every(Ye=>xt.includes(Ye))&&ge.push({topic:We,...it})}return ge.sort((We,it)=>We.topic.localeCompare(it.topic))}),N=rt(()=>{const Q=u(P).length,ge=Math.max(0,Math.floor(u(S)/_)-w),We=Math.min(Q,Math.ceil((u(S)+u(D))/_)+w);return{start:ge,end:We,totalH:Q*_,top:ge*_}});const V=1e3,F=200,Y=20,X=36;let me=0,Le=B(Si([])),je=B(Si([])),ve=B(!0),st=B("#"),Ot=B(200);zn(()=>{const Q=u(st).trim(),ge=wl(()=>u(Le)),We=!Q||Q==="#"?ge.slice(0,F):ge.filter(it=>yt(Q,it.topic)).slice(0,F);if(Q&&Q!=="#"){const it=new Set(We.map(Ye=>Ye.topic)),xt=[];for(const[Ye,pt]of i)it.has(Ye)||yt(Q,Ye)&&xt.push({id:-(xt.length+1),topic:Ye,val:pt.val,ts:pt.ts,retained:!0});xt.sort((Ye,pt)=>Ye.topic.localeCompare(pt.topic)),k(je,[...We,...xt],!0)}else k(je,We,!0)});function yt(Q,ge){if(Q==="#")return!0;const We=Q.split("/"),it=ge.split("/");for(let xt=0;xt<We.length;xt++){if(We[xt]==="#")return!0;if(xt>=it.length||We[xt]!=="+"&&We[xt]!==it[xt])return!1}return We.length===it.length}function ai(Q){Q.preventDefault();const ge=Q.clientY,We=u(Ot);function it(Ye){k(Ot,Math.max(60,Math.min(800,We+ge-Ye.clientY)),!0)}function xt(){document.removeEventListener("mousemove",it),document.removeEventListener("mouseup",xt)}document.addEventListener("mousemove",it),document.addEventListener("mouseup",xt)}let jt=rt(()=>{const Q=Math.max(1,Math.floor((u(Ot)-X)/Y)+1);return u(je).slice(0,Q)}),Qt=B(!0),Ne=B(null);async function Ge(){k(Qt,!0),k(Ne,null);try{const Q=await uR();for(const ge of Q)i.set(ge.topic,{val:ge.val,ts:ge.ts}),g(ge.topic)}catch(Q){k(Ne,Q instanceof Error?Q.message:String(Q),!0)}finally{k(Qt,!1),bk(a)}}const Re=Ya("mqtt",Q=>{const{topic:ge,val:We,ts:it}=Q;i.set(ge,{val:We,ts:it}),n.add(ge),s.add(ge),c();const xt={id:me++,topic:ge,val:We,ts:it};k(Le,[xt,...u(Le).slice(0,V-1)],!0);const Ye=u(st).trim();(!Ye||Ye==="#"||yt(Ye,ge))&&k(je,[xt,...u(je).filter(pt=>!(pt.retained&&pt.topic===ge)).slice(0,F-1)],!0)});let ot=B(null),At=B(null);async function ni(Q,ge){const We=[Q];if(ge){const it=Q+"/";for(const xt of i.keys())xt.startsWith(it)&&We.push(xt)}for(const it of We)await vD(it,"",!0,0)}let Xt=rt(()=>(u(a),[...i.keys()].sort())),zt=B(""),vt=B(""),Li=B(!1),vi=B(0),Tn=B(!1),Gi=B(null),Bn=B(!1);async function nn(){if(u(zt)){k(Tn,!0),k(Gi,null),k(Bn,!1);try{await vD(u(zt),u(vt),u(Li),u(vi)),k(Bn,!0),setTimeout(()=>{k(Bn,!1)},2e3)}catch(Q){k(Gi,Q instanceof Error?Q.message:String(Q),!0)}finally{k(Tn,!1)}}}function Ei(Q){return Q==null?"":typeof Q=="object"?JSON.stringify(Q):String(Q)}function Mn(Q){return new Date(Q).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function sn(Q){return new Date(Q).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Sn(Q){return u(a),i.get(Q)}let Xi=rt(()=>(u(a),[...h.values()].sort((Q,ge)=>Q.seg.localeCompare(ge.seg)))),Hi=rt(()=>(u(a),i.size));xr(Ge),yy(()=>{Re(),r!==null&&cancelAnimationFrame(r)});var dn=LX(),Nn=x(C(dn),2),Rn=C(Nn),$n=C(Rn),Cn=x($n,2);_i(Cn,20,()=>u(Xt),Q=>Q,(Q,ge)=>{var We=aX(),it={};G(()=>{it!==(it=ge)&&(We.value=(We.__value=ge)??"")}),T(Q,We)});var pn=x(Cn,2),on=x(pn,2),qe=C(on),Ft=x(on,2),li=C(Ft);li.value=li.__value=0;var Ci=x(li);Ci.value=Ci.__value=1;var Ii=x(Ci);Ii.value=Ii.__value=2;var mn=x(Ft,2),xn=x(mn,2);{var qn=Q=>{var ge=lX();T(Q,ge)};$(xn,Q=>{u(Bn)&&Q(qn)})}var hn=x(xn,2);{var An=Q=>{var ge=cX(),We=C(ge);G(()=>q(We,u(Gi))),T(Q,ge)};$(hn,Q=>{u(Gi)&&Q(An)})}var rn=x(Rn,2),Ln=C(rn),Ae=x(Ln,2),Z=C(Ae);{var Fe=Q=>{var ge=Ur();G(()=>q(ge,`${u(P).length??""} /`)),T(Q,ge)};$(Z,Q=>{u(v)&&Q(Fe)})}var wt=x(Z),Dt=x(rn,2);{var Nt=Q=>{var ge=dX();T(Q,ge)},O=Q=>{var ge=hX(),We=C(ge);G(()=>q(We,u(Ne))),T(Q,ge)},se=Q=>{var ge=Fs(),We=bt(ge);{var it=Ye=>{var pt=uX();T(Ye,pt)},xt=Ye=>{var pt=fX(),ei=C(pt),Ut=C(ei);_i(Ut,21,()=>u(P).slice(u(N).start,u(N).end),Rt=>Rt.topic,(Rt,Oi)=>{var an=gX(),Wi=C(an),ti=C(Wi),ji=x(Wi,2),A=C(ji),K=x(ji,2),Ee=C(K);G((Pe,Be,Me)=>{q(ti,u(Oi).topic),Hn(ji,"title",Pe),q(A,Be),q(Ee,Me)},[()=>Ei(u(Oi).val),()=>Ei(u(Oi).val),()=>Mn(u(Oi).ts)]),T(Rt,an)}),G(()=>{Ko(ei,`height: ${u(N).totalH??""}px; position: relative;`),Ko(Ut,`top: ${u(N).top??""}px;`)}),os("scroll",pt,Rt=>{k(S,Rt.currentTarget.scrollTop,!0)}),CW(pt,"clientHeight",Rt=>k(D,Rt)),T(Ye,pt)};$(We,Ye=>{u(P).length===0?Ye(it):Ye(xt,-1)})}T(Q,ge)},be=Q=>{var ge=mX(),We=C(ge);{var it=Ye=>{var pt=pX();T(Ye,pt)},xt=Ye=>{var pt=Fs(),ei=bt(pt);_i(ei,17,()=>u(Xi),Ut=>Ut.path,(Ut,Rt)=>{t(Ut,()=>u(Rt))}),T(Ye,pt)};$(We,Ye=>{u(Xi).length===0?Ye(it):Ye(xt,-1)})}T(Q,ge)};$(Dt,Q=>{u(Qt)?Q(Nt):u(Ne)?Q(O,1):u(v)?Q(se,2):Q(be,-1)})}var j=x(Nn,2),pe=C(j),Ue=x(pe,2),Ce=C(Ue),De=x(Ce,2);{var Xe=Q=>{var ge=_X(),We=C(ge);G(()=>q(We,u(je).length)),T(Q,ge)};$(De,Q=>{!u(ve)&&u(je).length>0&&Q(Xe)})}var Vt=x(De,2),ft=C(Vt),ue=x(Ue,2);{var ht=Q=>{var ge=wX(),We=C(ge);{var it=Ye=>{var pt=vX();T(Ye,pt)},xt=Ye=>{var pt=Fs(),ei=bt(pt);_i(ei,17,()=>u(jt),Ut=>Ut.id,(Ut,Rt)=>{var Oi=yX();let an;var Wi=C(Oi),ti=C(Wi),ji=x(Wi,2);{var A=Me=>{var re=bX();T(Me,re)};$(ji,Me=>{u(Rt).retained&&Me(A)})}var K=x(ji,2),Ee=C(K),Pe=x(K,2),Be=C(Pe);G((Me,re,Je)=>{an=$t(Oi,1,"sr svelte-1vejtrc",null,an,{retained:u(Rt).retained}),q(ti,Me),q(Ee,u(Rt).topic),Hn(Pe,"title",re),q(Be,Je)},[()=>sn(u(Rt).ts),()=>Ei(u(Rt).val),()=>Ei(u(Rt).val)]),T(Ut,Oi)}),T(Ye,pt)};$(We,Ye=>{u(jt).length===0?Ye(it):Ye(xt,-1)})}T(Q,ge)};$(ue,Q=>{u(ve)&&Q(ht)})}var ii=x(j,2);{var Kt=Q=>{var ge=SX(),We=bt(ge),it=x(We,2);let xt;var Ye=C(it),pt=x(Ye,2);G(()=>xt=Ko(it,"",xt,{left:`${u(ot).x??""}px`,top:`${u(ot).y??""}px`})),te("click",We,()=>k(ot,null)),te("contextmenu",We,ei=>{ei.preventDefault(),k(ot,null)}),te("click",Ye,()=>{navigator.clipboard.writeText(u(ot).topic),k(ot,null)}),te("click",pt,()=>{const ei=u(ot).topic,Ut=ei+"/",Rt=[...i.keys()].some(Oi=>Oi.startsWith(Ut));k(At,{topic:ei,hasChildren:Rt,recursive:!1},!0),k(ot,null)}),T(Q,ge)};$(ii,Q=>{u(ot)&&Q(Kt)})}var si=x(ii,2);{var ui=Q=>{var ge=xX(),We=bt(ge),it=x(We,2),xt=x(C(it),2),Ye=C(xt),pt=x(C(Ye)),ei=C(pt),Ut=x(Ye,2);{var Rt=ti=>{var ji=CX(),A=C(ji);As(A,()=>u(At).recursive,K=>u(At).recursive=K),T(ti,ji)};$(Ut,ti=>{u(At).hasChildren&&ti(Rt)})}var Oi=x(xt,2),an=C(Oi),Wi=x(an,2);G(()=>q(ei,u(At).topic)),te("click",We,()=>k(At,null)),te("click",an,()=>k(At,null)),te("click",Wi,()=>{const{topic:ti,recursive:ji}=u(At);k(At,null),ni(ti,ji)}),T(Q,ge)};$(si,Q=>{u(At)&&Q(ui)})}G(()=>{mn.disabled=u(Tn)||!u(zt),q(wt,` ${u(Hi)??""}`),Ko(j,u(ve)?`height: ${u(Ot)}px;`:""),q(ft,u(ve)?"▾":"▸")}),Ni($n,()=>u(zt),Q=>k(zt,Q)),Ni(pn,()=>u(vt),Q=>k(vt,Q)),As(qe,()=>u(Li),Q=>k(Li,Q)),_a(Ft,()=>u(vi),Q=>k(vi,Q)),te("click",mn,nn),Ni(Ln,()=>u(v),Q=>k(v,Q)),te("mousedown",pe,ai),Ni(Ce,()=>u(st),Q=>k(st,Q)),te("click",Vt,()=>{k(ve,!u(ve))}),T(o,dn),Ao()}Cr(["click","contextmenu","mousedown"]);var IX=R('<div class="restart-banner restart-banner--restarting svelte-twakcj">Restarting daemon…</div>'),DX=R('<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>'),EX=R('<div class="err svelte-twakcj"> </div>'),PX=R('<span class="pane-count pane-count--warn svelte-twakcj"> </span>'),TX=R('<p class="empty svelte-twakcj">No packages installed.</p>'),MX=R('<p class="empty svelte-twakcj">No match.</p>'),NX=R('<span class="dep-latest svelte-twakcj"> </span>'),RX=_T('<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>'),AX=_T('<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>'),OX=R('<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>'),FX=R('<span class="result-author svelte-twakcj"> </span>'),HX=R('<span class="result-date svelte-twakcj"> </span>'),WX=R('<span class="result-desc svelte-twakcj"> </span>'),BX=R('<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>'),zX=R('<div class="results-list svelte-twakcj"></div>'),VX=R('<pre class="npm-output svelte-twakcj"> </pre>'),jX=R(`<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>`),UX=R('<!> <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 $X(o,e){Ro(e,!0);let t=B(Si([])),i=B(""),n=B(Si({})),s=B(!1),r=B(""),a=B(Si([])),c=B(!1),h=B(!1),g=B(!1),f=B(""),p=B(""),v=Si({});const _=rt(()=>u(i).trim()?u(t).filter(qe=>qe.name.toLowerCase().includes(u(i).toLowerCase())):u(t)),w=rt(()=>Object.keys(u(n)).length);xr(async()=>{await Promise.all([S(),D()])});async function S(){try{k(t,await c7(),!0),k(f,"")}catch(qe){k(f,qe.message,!0)}}async function D(){try{k(n,await f7(),!0)}catch{}}async function P(){k(s,!0);try{k(n,await p7(),!0)}catch{}finally{k(s,!1)}}async function N(){const qe=u(r).trim();if(!qe){k(a,[],!0);return}k(g,!0),k(f,"");try{k(a,await d7(qe),!0)}catch(Ft){k(f,Ft.message,!0)}finally{k(g,!1)}}function V(qe){if(!qe)return"";try{return new Date(qe).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}async function F(qe,Ft){v[qe]=!0,k(f,""),k(p,"");try{const li=await h7(qe,Ft);k(p,li.stdout||li.stderr||"Done.",!0),k(c,!0),await S()}catch(li){k(f,li.message,!0)}finally{v[qe]=!1}}async function Y(qe){v[qe]=!0,k(f,""),k(p,"");try{const Ft=await u7(qe);k(p,Ft.stdout||Ft.stderr||"Done.",!0),k(c,!0);const li={...u(n)};delete li[qe],k(n,li,!0),await S()}catch(Ft){k(f,Ft.message,!0)}finally{v[qe]=!1}}async function X(qe){v[qe]=!0,k(f,""),k(p,"");try{const Ft=await g7(qe);k(p,Ft.stdout||Ft.stderr||"Done.",!0),k(c,!0);const li={...u(n)};delete li[qe],k(n,li,!0),await S()}catch(Ft){k(f,Ft.message,!0)}finally{v[qe]=!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 lR()}catch{}setTimeout(()=>{window.location.reload()},3e3)}}var je=UX(),ve=bt(je);bs(Hg(ve,{}),qe=>me=qe,()=>me);var st=x(ve,2),Ot=C(st);{var yt=qe=>{var Ft=IX();T(qe,Ft)},ai=qe=>{var Ft=DX(),li=x(C(Ft));te("click",li,Le),T(qe,Ft)};$(Ot,qe=>{u(h)?qe(yt):u(c)&&qe(ai,1)})}var jt=x(Ot,2);{var Qt=qe=>{var Ft=EX(),li=C(Ft);G(()=>q(li,u(f))),T(qe,Ft)};$(jt,qe=>{u(f)&&qe(Qt)})}var Ne=x(jt,2),Ge=C(Ne),Re=C(Ge),ot=x(C(Re),2),At=C(ot),ni=x(ot,2);{var Xt=qe=>{var Ft=PX(),li=C(Ft);G(()=>q(li,`${u(w)??""} outdated`)),T(qe,Ft)};$(ni,qe=>{u(w)>0&&qe(Xt)})}var zt=x(ni,2),vt=C(zt);let Li;var vi=x(Re,2),Tn=C(vi),Gi=x(vi,2),Bn=C(Gi);{var nn=qe=>{var Ft=TX();T(qe,Ft)},Ei=qe=>{var Ft=MX();T(qe,Ft)},Mn=qe=>{var Ft=Fs(),li=bt(Ft);_i(li,17,()=>u(_),Ci=>Ci.name,(Ci,Ii)=>{var mn=OX();let xn;var qn=C(mn),hn=C(qn),An=C(hn),rn=x(hn,2),Ln=C(rn),Ae=x(rn,2);{var Z=j=>{var pe=NX(),Ue=C(pe);G(()=>q(Ue,`→ v${u(n)[u(Ii).name].latest??""}`)),T(j,pe)};$(Ae,j=>{u(n)[u(Ii).name]&&j(Z)})}var Fe=x(qn,2),wt=C(Fe);let Dt;var Nt=C(wt);{var O=j=>{var pe=RX();T(j,pe)},se=j=>{var pe=AX();T(j,pe)};$(Nt,j=>{v[u(Ii).name]?j(O):j(se,-1)})}var be=x(wt,2);G(()=>{xn=$t(mn,1,"dep-row svelte-twakcj",null,xn,{"dep-busy":!!v[u(Ii).name]}),Hn(hn,"href",u(Ii).url??`https://www.npmjs.com/package/${u(Ii).name}`),q(An,u(Ii).name),q(Ln,u(Ii).installedVersion??u(Ii).version),Dt=$t(wt,1,"icon-btn svelte-twakcj",null,Dt,{"icon-btn--update":!!u(n)[u(Ii).name]}),wt.disabled=!!v[u(Ii).name],Hn(wt,"title",u(n)[u(Ii).name]?`Update to v${u(n)[u(Ii).name].latest}`:"Update to latest"),be.disabled=!!v[u(Ii).name]}),te("click",wt,()=>X(u(Ii).name)),te("click",be,()=>Y(u(Ii).name)),T(Ci,mn)}),T(qe,Ft)};$(Bn,qe=>{u(t).length===0?qe(nn):u(_).length===0?qe(Ei,1):qe(Mn,-1)})}var sn=x(Ge,2),Sn=x(C(sn),2),Xi=C(Sn),Hi=x(Xi,2),dn=C(Hi),Nn=x(Sn,2);{var Rn=qe=>{var Ft=zX();_i(Ft,21,()=>u(a),li=>li.name,(li,Ci)=>{var Ii=BX(),mn=C(Ii),xn=C(mn),qn=C(xn),hn=x(xn,2),An=C(hn),rn=x(hn,2);{var Ln=O=>{var se=FX(),be=C(se);G(()=>q(be,u(Ci).author)),T(O,se)};$(rn,O=>{u(Ci).author&&O(Ln)})}var Ae=x(rn,2);{var Z=O=>{var se=HX(),be=C(se);G(j=>{Hn(se,"title",u(Ci).date),q(be,j)},[()=>V(u(Ci).date)]),T(O,se)};$(Ae,O=>{u(Ci).date&&O(Z)})}var Fe=x(Ae,2);{var wt=O=>{var se=WX(),be=C(se);G(()=>q(be,u(Ci).description)),T(O,se)};$(Fe,O=>{u(Ci).description&&O(wt)})}var Dt=x(mn,2),Nt=C(Dt);G(()=>{Hn(xn,"href",u(Ci).url??`https://www.npmjs.com/package/${u(Ci).name}`),q(qn,u(Ci).name),q(An,u(Ci).version),Dt.disabled=!!v[u(Ci).name],q(Nt,v[u(Ci).name]?"Installing…":"Install")}),te("click",Dt,()=>F(u(Ci).name)),T(li,Ii)}),T(qe,Ft)};$(Nn,qe=>{u(a).length>0&&qe(Rn)})}var $n=x(Nn,2);{var Cn=qe=>{var Ft=VX(),li=C(Ft);G(()=>q(li,u(p))),T(qe,Ft)};$($n,qe=>{u(p)&&qe(Cn)})}var pn=x($n,2);{var on=qe=>{var Ft=jX();T(qe,Ft)};$(pn,qe=>{!u(a).length&&!u(p)&&qe(on)})}G(()=>{q(At,u(t).length),zt.disabled=u(s),Li=$t(vt,0,"svelte-twakcj",null,Li,{spinning:u(s)}),Hi.disabled=u(g),q(dn,u(g)?"Searching…":"Search")}),te("click",zt,P),Ni(Tn,()=>u(i),qe=>k(i,qe)),te("keydown",Xi,qe=>qe.key==="Enter"&&N()),Ni(Xi,()=>u(r),qe=>k(r,qe)),te("click",Hi,N),T(o,je),Ao()}Cr(["click","keydown"]);var qX=R('<span class="mqtt-dot svelte-1n46o8q" title="Waiting for retained MQTT state"></span>'),KX=R('<span class="update-dot svelte-1n46o8q" title="Update available"></span>'),GX=R('<dt class="svelte-1n46o8q">Latest</dt><dd style="color: #f90" class="svelte-1n46o8q"> </dd>',1),ZX=R('<dt class="svelte-1n46o8q">Latest</dt><dd class="svelte-1n46o8q">up to date</dd>',1),XX=R('<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>'),YX=R('<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>'),JX=R('<dt class="svelte-1n46o8q">Uptime</dt><dd class="svelte-1n46o8q"> </dd>',1),QX=R('<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),eY=R('<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),tY=R('<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>'),iY=R('<span class="stats-empty svelte-1n46o8q">Loading…</span>'),nY=R('<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>'),sY=R('<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>'),oY=R('<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>'),rY=R('<div class="login-error svelte-1n46o8q"> </div>'),aY=R('<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>'),lY=R('<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>'),cY=R('<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>'),dY=R("<!> <!> <!> <!>",1);function hY(o,e){Ro(e,!0);const t=["scripts","mqtt","matter","db","logs","config","packages"];function i(){const Ge=location.hash.slice(1);return t.includes(Ge)?Ge:"scripts"}let n=B(Si(i())),s=B(null),r=B(!1),a=B(!1),c=B(!1),h=B(!1),g=B("none"),f=B(""),p=B(!1),v=B(""),_=B(""),w=B(!1),S=B(!1);V8(()=>{k(p,!0)});async function D(){k(_,""),k(w,!0);try{await $8(u(v)),k(v,""),k(p,!1)}catch(Ge){k(_,Ge.message??"Login failed",!0)}finally{k(w,!1)}}async function P(){if(u(g)==="proxy"&&u(f)){window.location.href=u(f);return}await q8(),k(p,!0)}let N=B(null),V=B(!1),F=B(!1);async function Y(){if(!await u(N).show("Restart the she daemon? The page will reload after a moment.",{confirm:"Restart"}))return;k(V,!0);let Ge;try{Ge=(await wf()).startedAt}catch{}try{await lR()}catch{}const Re=Date.now()+6e4;for(;Date.now()<Re;){await new Promise(ot=>setTimeout(ot,250));try{const ot=await wf();if(Ge===void 0||ot.startedAt!==Ge){location.reload();return}}catch{}}location.reload()}async function X(){k(c,!0);try{const Ge=await J8();u(s)&&k(s,{...u(s),latestVersion:Ge.latestVersion??void 0},!0)}catch{}finally{k(c,!1)}}async function me(){var ot,At;if(!await u(N).show(`Update to v${(ot=u(s))==null?void 0:ot.latestVersion}? The daemon will restart after the update completes.`,{confirm:"Update"}))return;k(a,!1),k(h,!0);const Ge=(At=u(s))==null?void 0:At.startedAt;try{await Y8()}catch{}const Re=Date.now()+18e4;for(;Date.now()<Re;){await new Promise(ni=>setTimeout(ni,1e3));try{const ni=await wf();if(Ge===void 0||ni.startedAt!==Ge){location.reload();return}}catch{k(h,!1),k(V,!0)}}location.reload()}function Le(Ge){k(n,Ge,!0),location.hash=Ge}xr(async()=>{location.hash||(location.hash=u(n));const Ge=()=>{k(n,i(),!0)};window.addEventListener("hashchange",Ge);try{const ni=await U8();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 Re(){try{k(s,await wf(),!0)}catch{}}Re();const ot=setInterval(Re,5e3),At=Ya("mqtt:status",ni=>{k(F,ni.ready===!1)});return()=>{window.removeEventListener("hashchange",Ge),clearInterval(ot),At()}});var je=dY();os("click",XP,()=>{u(r)&&k(r,!1),u(a)&&k(a,!1)});var ve=bt(je);{var st=Ge=>{var Re=oY(),ot=C(Re),At=x(C(ot),2);let ni;var Xt=x(At,2);let zt;var vt=x(Xt,2);let Li;var vi=x(C(vt),2);{var Tn=ue=>{var ht=qX();T(ue,ht)};$(vi,ue=>{u(F)&&ue(Tn)})}var Gi=x(vt,2);let Bn;var nn=x(Gi,2);let Ei;var Mn=x(nn,2);let sn;var Sn=x(Mn,4),Xi=x(C(Sn),2),Hi=C(Xi),dn=C(Hi);dn.nodeValue="v0.27.7 ";var Nn=x(dn);{var Rn=ue=>{var ht=KX();T(ue,ht)};$(Nn,ue=>{var ht;(ht=u(s))!=null&&ht.latestVersion&&ue(Rn)})}var $n=x(Hi,2);{var Cn=ue=>{var ht=YX(),ii=C(ht),Kt=x(C(ii));Kt.textContent="v0.27.7";var si=x(Kt,2);{var ui=Ut=>{var Rt=GX(),Oi=x(bt(Rt)),an=C(Oi);G(()=>q(an,`v${u(s).latestVersion??""}`)),T(Ut,Rt)},Q=Ut=>{var Rt=ZX();T(Ut,Rt)};$(si,Ut=>{var Rt;(Rt=u(s))!=null&&Rt.latestVersion?Ut(ui):Ut(Q,-1)})}var ge=x(ii,2),We=C(ge);{var it=Ut=>{var Rt=XX(),Oi=x(C(Rt));G(()=>q(Oi,` Update to v${u(s).latestVersion??""}`)),te("click",Rt,me),T(Ut,Rt)};$(We,Ut=>{var Rt;(Rt=u(s))!=null&&Rt.latestVersion&&Ut(it)})}var xt=x(We,2),Ye=C(xt);let pt;var ei=x(Ye);G(()=>{xt.disabled=u(c),pt=$t(Ye,0,"svelte-1n46o8q",null,pt,{spinning:u(c)}),q(ei,` ${u(c)?"Checking…":"Check for updates"}`)}),te("click",ht,Ut=>Ut.stopPropagation()),te("click",xt,X),T(ue,ht)};$($n,ue=>{u(a)&&ue(Cn)})}var pn=x(Xi,2),on=C(pn),qe=x(on,2);{var Ft=ue=>{var ht=nY(),ii=C(ht);{var Kt=ge=>{var We=tY(),it=C(We);{var xt=re=>{const Je=rt(()=>Math.floor((Date.now()-u(s).startedAt)/1e3)),Oe=rt(()=>Math.floor(u(Je)/86400)),xe=rt(()=>Math.floor(u(Je)%86400/3600)),St=rt(()=>Math.floor(u(Je)%3600/60));var Te=JX(),H=x(bt(Te)),J=C(H);G(()=>q(J,`${u(Oe)>0?u(Oe)+"d ":""}${u(xe)>0||u(Oe)>0?u(xe)+"h ":""}${u(St)??""}m`)),T(re,Te)};$(it,re=>{u(s).startedAt&&re(xt)})}var Ye=x(it,3),pt=C(Ye),ei=x(Ye,3),Ut=C(ei),Rt=x(ei,3),Oi=C(Rt),an=x(Rt,2);{var Wi=re=>{var Je=QX(),Oe=x(bt(Je)),xe=C(Oe),St=x(Oe,3),Te=C(St);G(()=>{q(xe,u(s).matterNodes??0),q(Te,u(s).matterEndpoints??0)}),T(re,Je)};$(an,re=>{u(s).matterEnabled&&re(Wi)})}var ti=x(an,2);{var ji=re=>{var Je=eY(),Oe=x(bt(Je)),xe=C(Oe),St=x(Oe,3),Te=C(St);G(()=>{q(xe,u(s).dbDocs??"—"),q(Te,u(s).dbViews??"—")}),T(re,Je)};$(ti,re=>{u(s).dbEnabled&&re(ji)})}var A=x(ti,3),K=C(A),Ee=x(A,3),Pe=C(Ee),Be=x(Ee,3),Me=C(Be);G(()=>{q(pt,u(s).scripts),q(Ut,u(s).topics),q(Oi,u(s).mqttMsgPerSec??"—"),q(K,u(s).handlers??"—"),q(Pe,u(s).memMb!=null?u(s).memMb+" MB":"—"),q(Me,u(s).cpuPercent!=null?u(s).cpuPercent+" %":"—")}),T(ge,We)},si=ge=>{var We=iY();T(ge,We)};$(ii,ge=>{u(s)?ge(Kt):ge(si,-1)})}var ui=x(ii,2),Q=C(ui);te("click",ht,ge=>ge.stopPropagation()),te("click",Q,()=>{k(r,!1),Y()}),T(ue,ht)};$(qe,ue=>{u(r)&&ue(Ft)})}var li=x(pn,2);let Ci;var Ii=x(li,2);{var mn=ue=>{var ht=sY();te("click",ht,P),T(ue,ht)};$(Ii,ue=>{u(g)==="password"&&ue(mn)})}var xn=x(ot,2),qn=C(xn);bs(Hg(qn,{}),ue=>k(N,ue,!0),()=>u(N));var hn=x(qn,2);let An;var rn=C(hn);{let ue=rt(()=>u(n)==="scripts");_G(rn,{get active(){return u(ue)}})}var Ln=x(hn,2);let Ae;var Z=C(Ln);$X(Z,{});var Fe=x(Ln,2);let wt;var Dt=C(Fe);kX(Dt,{});var Nt=x(Fe,2);let O;var se=C(Nt);tX(se,{});var be=x(Nt,2);let j;var pe=C(be);hZ(pe,{});var Ue=x(be,2);let Ce;var De=C(Ue);n9(De,{});var Xe=x(Ue,2);let Vt;var ft=C(Xe);a9(ft,{}),G(()=>{ni=$t(At,1,"svelte-1n46o8q",null,ni,{active:u(n)==="scripts"}),zt=$t(Xt,1,"svelte-1n46o8q",null,zt,{active:u(n)==="packages"}),Li=$t(vt,1,"svelte-1n46o8q",null,Li,{active:u(n)==="mqtt"}),Bn=$t(Gi,1,"svelte-1n46o8q",null,Bn,{active:u(n)==="matter"}),Ei=$t(nn,1,"svelte-1n46o8q",null,Ei,{active:u(n)==="db"}),sn=$t(Mn,1,"svelte-1n46o8q",null,sn,{active:u(n)==="logs"}),Ci=$t(li,1,"nav-settings svelte-1n46o8q",null,Ci,{active:u(n)==="config"}),An=$t(hn,1,"page-wrap svelte-1n46o8q",null,An,{hidden:u(n)!=="scripts"}),Ae=$t(Ln,1,"page-wrap svelte-1n46o8q",null,Ae,{hidden:u(n)!=="packages"}),wt=$t(Fe,1,"page-wrap svelte-1n46o8q",null,wt,{hidden:u(n)!=="mqtt"}),O=$t(Nt,1,"page-wrap svelte-1n46o8q",null,O,{hidden:u(n)!=="matter"}),j=$t(be,1,"page-wrap svelte-1n46o8q",null,j,{hidden:u(n)!=="db"}),Ce=$t(Ue,1,"page-wrap svelte-1n46o8q",null,Ce,{hidden:u(n)!=="config"}),Vt=$t(Xe,1,"page-wrap svelte-1n46o8q",null,Vt,{hidden:u(n)!=="logs"})}),te("click",At,()=>Le("scripts")),te("click",Xt,()=>Le("packages")),te("click",vt,()=>Le("mqtt")),te("click",Gi,()=>Le("matter")),te("click",nn,()=>Le("db")),te("click",Mn,()=>Le("logs")),te("click",Hi,ue=>{ue.stopPropagation(),k(a,!u(a)),k(r,!1)}),te("click",on,ue=>{ue.stopPropagation(),k(r,!u(r)),k(a,!1)}),te("click",li,()=>Le("config")),T(Ge,Re)};$(ve,Ge=>{u(S)&&!u(p)&&Ge(st)})}var Ot=x(ve,2);{var yt=Ge=>{var Re=aY(),ot=C(Re),At=x(C(ot),4),ni=x(C(At),2),Xt=x(At,2);{var zt=vi=>{var Tn=rY(),Gi=C(Tn);G(()=>q(Gi,u(_))),T(vi,Tn)};$(Xt,vi=>{u(_)&&vi(zt)})}var vt=x(Xt,2),Li=C(vt);G(()=>{ni.disabled=u(w),vt.disabled=u(w)||!u(v),q(Li,u(w)?"Signing in…":"Sign in")}),os("submit",ot,vi=>{vi.preventDefault(),D()}),Ni(ni,()=>u(v),vi=>k(v,vi)),T(Ge,Re)};$(Ot,Ge=>{u(p)&&Ge(yt)})}var ai=x(Ot,2);{var jt=Ge=>{var Re=lY();T(Ge,Re)};$(ai,Ge=>{u(V)&&Ge(jt)})}var Qt=x(ai,2);{var Ne=Ge=>{var Re=cY();T(Ge,Re)};$(Qt,Ge=>{u(h)&&Ge(Ne)})}T(o,je),Ao()}Cr(["click"]);cW(hY,{target:document.getElementById("app")});export{PT as t};
|