smart-home-engine 0.26.2 → 0.26.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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-CXjN2zbx.js"])))=>i.map(i=>d[i]);
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-COmSRXCz.js"])))=>i.map(i=>d[i]);
2
2
  var rA=Object.defineProperty;var TL=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 Oi=(o,e,t)=>aA(o,typeof e!="symbol"?e+"":e,t),Vw=(o,e,t)=>e.has(o)||TL("Cannot "+t);var ee=(o,e,t)=>(Vw(o,e,"read from private field"),t?t.call(o):e.get(o)),Ii=(o,e,t)=>e.has(o)?TL("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,t),Di=(o,e,t,i)=>(Vw(o,e,"write to private field"),i?i.call(o,t):e.set(o,t),t),yn=(o,e,t)=>(Vw(o,e,"access private method"),t);import{_ as qD,m as KD,l as St,A as Qs,C as ae,I as xn,D as Pp,a as es,g as GD,M as rt,b as Zt,E as Wr,c as M,r as en,d as ur,e as w,f as lA,h as mn,R as Pi,S as Ut,i as Rs,j as gr,k as Hi,n as vi,o as ie,p as Se,K as ns,q as mt,s as je,t as ls,u as B,v as xi,O as wa,w as os,P as Lt,x as jw,y as Tp,z as ZD,B as Ja,F as Br,G as Vy,H as vs,U as sn,J as Vu,L as kt,N as sl,Q as cA,T as Gs,V as jy,W as dA,X as XD,$ as pt,Y as qi,Z as Fi,a0 as On,a1 as di,a2 as Do,a3 as Of,a4 as ze,a5 as Gm,a6 as hA,a7 as uA,a8 as as,a9 as gA,aa as zr,ab as eo,ac as Pt,ad as YD,ae as Sn,af as fA,ag as pA,ah as Xs,ai as bg,aj as ss,ak as Ab,al as Vs,am as xc,an as f0,ao as Ob,ap as fs,aq as ju,ar as ps,as as Fb,at as Hb,au as mA,av as Mp,aw as wg,ax as fl,ay as _A,az as yg,aA as vA,aB as p0,aC as bA,aD as wA,aE as ML,aF as Qn,aG as Qa,aH as js,aI as pi,aJ as Ga,aK as yA,aL as xa,aM as Lo,aN as us,aO as Vr,aP as m0,aQ as cs,aR as Zn,aS as w_,aT as fi,aU as JD,aV as SA,aW as _0,aX as Wb,aY as v0,aZ as b0,a_ as Qc,a$ as CA,b0 as w0,b1 as xA,b2 as y0,b3 as pl,b4 as ml,b5 as Uu,b6 as Ff,b7 as go,b8 as Np,b9 as y_,ba as Uw,bb as cn,bc as S0,bd as Rp,be as Bb,bf as LA,bg as QD,bh as Hf,bi as $u,bj as Wf,bk as Ap,bl as zb,bm as zi,bn as Lc,bo as Op,bp as kA,bq as IA,br as C0,bs as DA,bt as S_,bu as $o,bv as x0,bw as qu,bx as _l,by as Sg,bz as Si,bA as Ku,bB as eE,bC as Fp,bD as EA,bE as ed,bF as lt,bG as NL,bH as Zm,bI as tE,bJ as mr,bK as Rr,bL as gn,bM as Gu,bN as rr,bO as Zu,bP as An,bQ as Bf,bR as mh,bS as Uy,bT as iE,bU as nE,bV as sE,bW as L0,bX as ro,bY as Ji,bZ as Hp,b_ as oE,b$ as el,c0 as Vb,c1 as PA,c2 as tu,c3 as RL,c4 as Wp,c5 as rE,c6 as iu,c7 as TA,c8 as Qo,c9 as jb,ca as MA,cb as to,cc as jr,cd as Bp,ce as zf,cf as aE,cg as zo,ch as zp,ci as Ub,cj as NA,ck as RA,cl as AA,cm as Cg,cn as La,co as gs,cp as OA,cq as k0,cr as FA,cs as HA,ct as AL,cu as WA,cv as Vp,cw as ol,cx as $y,cy as Yd,cz as rl,cA as BA,cB as ya,cC as ar,cD as So,cE as OL,cF as Os,cG as jp,cH as pc,cI as ka,cJ as zA,cK as Ur,cL as Vf,cM as $b,cN as lE,cO as VA,cP as jA,cQ as I0,cR as UA,cS as jf,cT as $A,cU as zl,cV as Uf,cW as FL,cX as qA,cY as KA,cZ as Ea,c_ as GA,c$ as D0,d0 as cE,d1 as dE,d2 as hE,d3 as uE,d4 as ZA,d5 as XA,d6 as gE,d7 as fE,d8 as YA,d9 as E0,da as JA,db as QA,dc as zn,dd as eO,de as P0,df as tO,dg as nu,dh as HL,di as iO,dj as nO,dk as sO,dl as oO,dm as rO,dn as aO,dp as Xu,dq as qb,dr as qy,ds as lO,dt as cO,du as WL,dv as Ky,dw as dO,dx as BL,dy as $w,dz as hO,dA as pE,dB as uO,dC as mE,dD as Gy,dE as gO,dF as fO,dG as pO,dH as _E,dI as vE,dJ as mO,dK as C_,dL as bE,dM as Kb,dN as _O,dO as vO,dP as mc,dQ as T0,dR as bO,dS as zL,dT as VL,dU as wO,dV as su,dW as wE,dX as yO,dY as SO,dZ as CO,d_ as xO,d$ as yE,e0 as SE,e1 as CE,e2 as xE,e3 as LO,e4 as Sa,e5 as jL,e6 as kO,e7 as Up,e8 as IO,e9 as Yg,ea as LE,eb as UL,ec as $f,ed as kE,ee as x_,ef as DO,eg as IE,eh as EO,ei as DE,ej as PO,ek as TO,el as EE,em as PE,en as al,eo as Gb,ep as MO,eq as TE,er as ko,es as td,et as ME,eu as NO,ev as RO,ew as NE,ex as RE,ey as AO,ez as AE,eA as OE,eB as qf,eC as OO,eD as FO,eE as HO,eF as WO,eG as Bg,eH as $L,eI as BO,eJ as zO,eK as VO,eL as L_,eM as xs,eN as jO,eO as Zy,eP as _h,eQ as UO,eR as Ka,eS as $O,eT as qO,eU as FE,eV as KO,eW as mf,eX as GO,eY as ZO,eZ as XO,e_ as YO,e$ as qL,f0 as KL,f1 as GL,f2 as vh,f3 as M0,f4 as HE,f5 as Xy,f6 as Xm,f7 as WE,f8 as k_,f9 as JO,fa as QO,fb as e2,fc as t2,fd as N0,fe as BE,ff as i2,fg as I_,fh as zE,fi as VE,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 jE,fs as h2,ft as D_,fu as UE,fv as u2,fw as $E,fx as g2,fy as qE,fz as KE,fA as f2,fB as ZL,fC as GE,fD as XL,fE as p2,fF as qw,fG as YL,fH as m2,fI as _2,fJ as v2,fK as ua,fL as _c,fM as b2,fN as JL,fO as Ym,fP as w2,fQ as Za,fR as Zb,fS as Yy,fT as y2,fU as ZE,fV as XE,fW as Fs,fX as QL,fY as vm,fZ as R0,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 ek,g7 as P2,g8 as T2,g9 as M2,ga as Yu,gb as _f,gc as YE,gd as N2,ge as A0,gf as Jm,gg as bm,gh as Kw,gi as R2,gj as A2,gk as JE,gl as O2,gm as O0,gn as F2,go as H2,gp as QE,gq as Xb,gr as W2,gs as E_,gt as F0,gu as H0,gv as W0,gw as eP,gx as tP,gy as iP,gz as nP,gA as sP,gB as oP,gC as rP,gD as tk,gE as aP,gF as Nh,gG as B2,gH as z2,gI as V2,gJ as j2,gK as lP,gL as U2,gM as $2,gN as ik,gO as Jy,gP as Zl,gQ as q2,gR as K2,gS as G2,gT as Z2,gU as X2,gV as Y2,gW as nk,gX as B0,gY as Qy,gZ as J2,g_ as eS,g$ as Q2,h0 as eF,h1 as tF,h2 as iF,h3 as z0,h4 as cP,h5 as sk,h6 as ok,h7 as nF,h8 as sF,h9 as oF,ha as rk,hb as Gw,hc as rF,hd as aF,he as lF,hf as Zw,hg as dP,hh as hP,hi as uP,hj as gP,hk as ll,hl as fP,hm as V0,hn as ak,ho as cF,hp as pP,hq as dF,hr as hF,hs as Yb,ht as Jb,hu as bh,hv as Qb,hw as $p,hx as uF,hy as ew,hz as gF,hA as fF,hB as pF,hC as mP,hD as zg,hE as mF,hF as _F,hG as vF,hH as bF,hI as qp,hJ as wF,hK as _P,hL as vP,hM as bP,hN as tS,hO as yF,hP as SF,hQ as CF,hR as xF,hS as LF,hT as iS,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 wP,i1 as RF,i2 as AF,i3 as OF,i4 as lk,i5 as FF,i6 as HF,i7 as Wc,i8 as Wa,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 yP=!1;var j0=Array.isArray,zF=Array.prototype.indexOf,P_=Array.prototype.includes,tw=Array.from,VF=Object.defineProperty,bu=Object.getOwnPropertyDescriptor,jF=Object.getOwnPropertyDescriptors,UF=Object.prototype,$F=Array.prototype,SP=Object.getPrototypeOf,ck=Object.isExtensible;const iw=()=>{};function qF(o){for(var e=0;e<o.length;e++)o[e]()}function CP(){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 dk(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 Bs=2,Ju=4,nw=8,xP=1<<24,Ar=16,Hr=32,vc=64,nS=128,dr=512,Ls=1024,Ps=2048,Ia=4096,lo=8192,hr=16384,xg=32768,sS=1<<25,Qu=65536,T_=1<<17,GF=1<<18,Lg=1<<19,ZF=1<<20,_a=1<<25,Jd=65536,M_=1<<21,wu=1<<22,Xl=1<<23,id=Symbol("$state"),XF=Symbol("legacy props"),YF=Symbol(""),Qm=Symbol("attributes"),oS=Symbol("class"),rS=Symbol("style"),Jg=Symbol("text"),e_=Symbol("form reset"),sw=new class extends Error{constructor(){super(...arguments);Oi(this,"name","StaleReactionError");Oi(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function LP(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,kP=4,hH=8,uH=16,gH=1,fH=4,pH=8,mH=16,_H=1,vH=2,Cs=Symbol("uninitialized"),IP="http://www.w3.org/1999/xhtml",bH="http://www.w3.org/2000/svg",wH="http://www.w3.org/1998/Math/MathML";function yH(){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 DP(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 EP(o){return!xH(o,this.v)}let LH=!1,Ws=null;function eg(o){Ws=o}function Po(o,e=!1,t){Ws={p:Ws,i:!1,c:null,e:null,s:o,x:null,r:Qi,l:null}}function To(o){var e=Ws,t=e.e;if(t!==null){e.e=null;for(var i of t)YP(i)}return o!==void 0&&(e.x=o),e.i=!0,Ws=e.p,o??{}}function PP(){return!0}let Uc=[];function TP(){var o=Uc;Uc=[],qF(o)}function Yl(o){if(Uc.length===0&&!bf){var e=Uc;queueMicrotask(()=>{e===Uc&&TP()})}Uc.push(o)}function kH(){for(;Uc.length>0;)TP()}function MP(o){var e=Qi;if(e===null)return Yi.f|=Xl,o;if((e.f&xg)===0&&(e.f&Ju)===0)throw o;Vl(o,e)}function Vl(o,e){for(;e!==null;){if((e.f&nS)!==0){if((e.f&xg)===0)throw o;try{e.b.error(o);return}catch(t){o=t}}e=e.parent}throw o}const IH=-7169;function ds(o,e){o.f=o.f&IH|e}function U0(o){(o.f&dr)!==0||o.deps===null?ds(o,Ls):ds(o,Ia)}function NP(o){if(o!==null)for(const e of o)(e.f&Bs)===0||(e.f&Jd)===0||(e.f^=Jd,NP(e.deps))}function RP(o,e,t){(o.f&Ps)!==0?e.add(o):(o.f&Ia)!==0&&t.add(o),NP(o.deps),ds(o,Ls)}let wm=!1;function DH(o){var e=wm;try{return wm=!1,[o(),wm]}finally{wm=e}}let Xw=null,Rh=null,ui=null,vf=null,As=null,aS=null,bf=!1,Yw=!1,ou=null,t_=null;var hk=0;let EH=1;var xu,Hl,Gc,Lu,ku,Iu,ja,Du,bo,xp,Ua,Lr,la,Eu,Zc,Vn,lS,Qg,cS,AP,OP,Zh,PH,ef;const Vv=class Vv{constructor(){Ii(this,Vn);Oi(this,"id",EH++);Ii(this,xu,!1);Oi(this,"linked",!0);Ii(this,Hl,null);Ii(this,Gc,null);Oi(this,"async_deriveds",new Map);Oi(this,"current",new Map);Oi(this,"previous",new Map);Ii(this,Lu,new Set);Ii(this,ku,new Set);Ii(this,Iu,0);Ii(this,ja,new Map);Ii(this,Du,null);Ii(this,bo,[]);Ii(this,xp,[]);Ii(this,Ua,new Set);Ii(this,Lr,new Set);Ii(this,la,new Map);Ii(this,Eu,new Set);Oi(this,"is_fork",!1);Ii(this,Zc,!1);Rh===null?Xw=Rh=this:(Di(Rh,Gc,this),Di(this,Hl,Rh)),Rh=this}skip_effect(e){ee(this,la).has(e)||ee(this,la).set(e,{d:[],m:[]}),ee(this,Eu).delete(e)}unskip_effect(e,t=i=>this.schedule(i)){var i=ee(this,la).get(e);if(i){ee(this,la).delete(e);for(var n of i.d)ds(n,Ps),t(n);for(n of i.m)ds(n,Ia),t(n)}ee(this,Eu).add(e)}capture(e,t,i=!1){e.v!==Cs&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&Xl)===0&&(this.current.set(e,[t,i]),As==null||As.set(e,t)),this.is_fork||(e.v=t)}activate(){ui=this}deactivate(){ui=null,As=null}flush(){try{Yw=!0,ui=this,yn(this,Vn,Qg).call(this)}finally{hk=0,aS=null,ou=null,t_=null,Yw=!1,ui=null,As=null,nd.clear()}}discard(){var e;for(const t of ee(this,ku))t(this);ee(this,ku).clear(),yn(this,Vn,ef).call(this),(e=ee(this,Du))==null||e.resolve()}register_created_effect(e){ee(this,xp).push(e)}increment(e,t){if(Di(this,Iu,ee(this,Iu)+1),e){let i=ee(this,ja).get(t)??0;ee(this,ja).set(t,i+1)}}decrement(e,t){if(Di(this,Iu,ee(this,Iu)-1),e){let i=ee(this,ja).get(t)??0;i===1?ee(this,ja).delete(t):ee(this,ja).set(t,i-1)}ee(this,Zc)||(Di(this,Zc,!0),Yl(()=>{Di(this,Zc,!1),this.linked&&this.flush()}))}transfer_effects(e,t){for(const i of e)ee(this,Ua).add(i);for(const i of t)ee(this,Lr).add(i);e.clear(),t.clear()}oncommit(e){ee(this,Lu).add(e)}ondiscard(e){ee(this,ku).add(e)}settled(){return(ee(this,Du)??Di(this,Du,CP())).promise}static ensure(){if(ui===null){const e=ui=new Vv;!Yw&&!bf&&Yl(()=>{ee(e,xu)||e.flush()})}return ui}apply(){{As=null;return}}schedule(e){var n;if(aS=e,(n=e.b)!=null&&n.is_pending&&(e.f&(Ju|nw|xP))!==0&&(e.f&xg)===0){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var i=t.f;if(ou!==null&&t===Qi&&(Yi===null||(Yi.f&Bs)===0))return;if((i&(vc|Hr))!==0){if((i&Ls)===0)return;t.f^=Ls}}ee(this,bo).push(t)}};xu=new WeakMap,Hl=new WeakMap,Gc=new WeakMap,Lu=new WeakMap,ku=new WeakMap,Iu=new WeakMap,ja=new WeakMap,Du=new WeakMap,bo=new WeakMap,xp=new WeakMap,Ua=new WeakMap,Lr=new WeakMap,la=new WeakMap,Eu=new WeakMap,Zc=new WeakMap,Vn=new WeakSet,lS=function(){if(this.is_fork)return!0;for(const i of ee(this,ja).keys()){for(var e=i,t=!1;e.parent!==null;){if(ee(this,la).has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1},Qg=function(){var c,h,g,f;Di(this,xu,!0),hk++>1e3&&(yn(this,Vn,ef).call(this),MH());for(const p of ee(this,Ua))ee(this,Lr).delete(p),ds(p,Ps),this.schedule(p);for(const p of ee(this,Lr))ds(p,Ia),this.schedule(p);const e=ee(this,bo);Di(this,bo,[]),this.apply();var t=ou=[],i=[],n=t_=[];for(const p of e)try{yn(this,Vn,cS).call(this,p,t,i)}catch(v){throw WP(p),yn(this,Vn,lS).call(this)||this.discard(),v}if(ui=null,n.length>0){var s=Vv.ensure();for(const p of n)s.schedule(p)}if(ou=null,t_=null,yn(this,Vn,lS).call(this)){yn(this,Vn,Zh).call(this,i),yn(this,Vn,Zh).call(this,t);for(const[p,v]of ee(this,la))HP(p,v);n.length>0&&yn(c=ui,Vn,Qg).call(c);return}const r=yn(this,Vn,AP).call(this);if(r){yn(this,Vn,Zh).call(this,i),yn(this,Vn,Zh).call(this,t),yn(h=r,Vn,OP).call(h,this);return}ee(this,Ua).clear(),ee(this,Lr).clear();for(const p of ee(this,Lu))p(this);ee(this,Lu).clear(),vf=this,uk(i),uk(t),vf=null,(g=ee(this,Du))==null||g.resolve();var a=ui;if(ee(this,Iu)===0&&(ee(this,bo).length===0||a!==null)&&yn(this,Vn,ef).call(this),ee(this,bo).length>0)if(a!==null){const p=a;ee(p,bo).push(...ee(this,bo).filter(v=>!ee(p,bo).includes(v)))}else a=this;a!==null&&yn(f=a,Vn,Qg).call(f)},cS=function(e,t,i){e.f^=Ls;for(var n=e.first;n!==null;){var s=n.f,r=(s&(Hr|vc))!==0,a=r&&(s&Ls)!==0,c=a||(s&lo)!==0||ee(this,la).has(n);if(!c&&n.fn!==null){r?n.f^=Ls:(s&Ju)!==0?t.push(n):Gp(n)&&((s&Ar)!==0&&ee(this,Lr).add(n),ig(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}}},AP=function(){for(var e=ee(this,Hl);e!==null;){if(!e.is_fork){for(const[t,[,i]]of this.current)if(e.current.has(t)&&!i)return e}e=ee(e,Hl)}return null},OP=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,Ua),ee(e,Lr));const t=n=>{var s=n.reactions;if(s!==null)for(const c of s){var r=c.f;if((r&Bs)!==0)t(c);else{var a=c;r&(wu|Ar)&&!this.async_deriveds.has(a)&&(ee(this,Lr).delete(a),ds(a,Ps),this.schedule(a))}}};for(const n of this.current.keys())t(n);this.oncommit(()=>e.discard()),yn(i=e,Vn,ef).call(i),ui=this,yn(this,Vn,Qg).call(this)},Zh=function(e){for(var t=0;t<e.length;t+=1)RP(e[t],ee(this,Ua),ee(this,Lr))},PH=function(){var g;for(let f=Xw;f!==null;f=ee(f,Gc)){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,xu)){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,Eu))f.unskip_effect(p,v=>{var _;(v.f&(Ar|wu))!==0?f.schedule(v):yn(_=f,Vn,Zh).call(_,[v])});f.activate();var s=new Set,r=new Map;for(var a of t)FP(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,xp))(p.f&(hr|lo|T_))===0&&$0(p,c,r)&&((p.f&(wu|Ar))!==0?(ds(p,Ps),f.schedule(p)):ee(f,Ua).add(p));if(ee(f,bo).length>0&&!ee(f,Zc)){f.apply();for(var h of ee(f,bo))yn(g=f,Vn,cS).call(g,h,[],[]);Di(f,bo,[])}f.deactivate()}}}},ef=function(){if(this.linked){var e=ee(this,Hl),t=ee(this,Gc);e===null?Xw=t:Di(e,Gc,t),t===null?Rh=e:Di(t,Hl,e),this.linked=!1}};let Qd=Vv;function TH(o){var e=bf;bf=!0;try{for(var t;;){if(kH(),ui===null)return t;ui.flush()}}finally{bf=e}}function MH(){try{nH()}catch(o){Vl(o,aS)}}let Sr=null;function uk(o){var e=o.length;if(e!==0){for(var t=0;t<e;){var i=o[t++];if((i.f&(hr|lo))===0&&Gp(i)&&(Sr=new Set,ig(i),i.deps===null&&i.first===null&&i.nodes===null&&i.teardown===null&&i.ac===null&&eT(i),(Sr==null?void 0:Sr.size)>0)){nd.clear();for(const n of Sr){if((n.f&(hr|lo))!==0)continue;const s=[n];let r=n.parent;for(;r!==null;)Sr.has(r)&&(Sr.delete(r),s.push(r)),r=r.parent;for(let a=s.length-1;a>=0;a--){const c=s[a];(c.f&(hr|lo))===0&&ig(c)}}Sr.clear()}}Sr=null}}function FP(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&Bs)!==0?FP(n,e,t,i):(s&(wu|Ar))!==0&&(s&Ps)===0&&$0(n,e,i)&&(ds(n,Ps),q0(n))}}function $0(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(P_.call(e,n))return!0;if((n.f&Bs)!==0&&$0(n,e,t))return t.set(n,!0),!0}return t.set(o,!1),!1}function q0(o){ui.schedule(o)}function HP(o,e){if(!((o.f&Hr)!==0&&(o.f&Ls)!==0)){(o.f&Ps)!==0?e.d.push(o):(o.f&Ia)!==0&&e.m.push(o),ds(o,Ls);for(var t=o.first;t!==null;)HP(t,e),t=t.next}}function WP(o){ds(o,Ls);for(var e=o.first;e!==null;)WP(e),e=e.next}function NH(o){let e=0,t=eh(0),i;return()=>{X0()&&(u(t),rw(()=>(e===0&&(i=bl(()=>o(()=>wf(t)))),e+=1,()=>{Yl(()=>{e-=1,e===0&&(i==null||i(),i=void 0,wf(t))})})))}}var RH=Qu|Lg;function AH(o,e,t,i){new OH(o,e,t,i)}var tr,g0,ir,Xc,wo,nr,so,Fo,$a,Yc,Wl,Pu,Lp,kp,qa,jv,hs,FH,HH,WH,dS,i_,n_,hS,uS;class OH{constructor(e,t,i,n){Ii(this,hs);Oi(this,"parent");Oi(this,"is_pending",!1);Oi(this,"transform_error");Ii(this,tr);Ii(this,g0,null);Ii(this,ir);Ii(this,Xc);Ii(this,wo);Ii(this,nr,null);Ii(this,so,null);Ii(this,Fo,null);Ii(this,$a,null);Ii(this,Yc,0);Ii(this,Wl,0);Ii(this,Pu,!1);Ii(this,Lp,new Set);Ii(this,kp,new Set);Ii(this,qa,null);Ii(this,jv,NH(()=>(Di(this,qa,eh(ee(this,Yc))),()=>{Di(this,qa,null)})));var s;Di(this,tr,e),Di(this,ir,t),Di(this,Xc,r=>{var a=Qi;a.b=this,a.f|=nS,i(r)}),this.parent=Qi.b,this.transform_error=n??((s=this.parent)==null?void 0:s.transform_error)??(r=>r),Di(this,wo,Q0(()=>{yn(this,hs,dS).call(this)},RH))}defer_effect(e){RP(e,ee(this,Lp),ee(this,kp))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!ee(this,ir).pending}update_pending_count(e,t){yn(this,hs,hS).call(this,e,t),Di(this,Yc,ee(this,Yc)+e),!(!ee(this,qa)||ee(this,Pu))&&(Di(this,Pu,!0),Yl(()=>{Di(this,Pu,!1),ee(this,qa)&&tg(ee(this,qa),ee(this,Yc))}))}get_effect_pending(){return ee(this,jv).call(this),u(ee(this,qa))}error(e){if(!ee(this,ir).onerror&&!ee(this,ir).failed)throw e;ui!=null&&ui.is_fork?(ee(this,nr)&&ui.skip_effect(ee(this,nr)),ee(this,so)&&ui.skip_effect(ee(this,so)),ee(this,Fo)&&ui.skip_effect(ee(this,Fo)),ui.oncommit(()=>{yn(this,hs,uS).call(this,e)})):yn(this,hs,uS).call(this,e)}}tr=new WeakMap,g0=new WeakMap,ir=new WeakMap,Xc=new WeakMap,wo=new WeakMap,nr=new WeakMap,so=new WeakMap,Fo=new WeakMap,$a=new WeakMap,Yc=new WeakMap,Wl=new WeakMap,Pu=new WeakMap,Lp=new WeakMap,kp=new WeakMap,qa=new WeakMap,jv=new WeakMap,hs=new WeakSet,FH=function(){try{Di(this,nr,sr(()=>ee(this,Xc).call(this,ee(this,tr))))}catch(e){this.error(e)}},HH=function(e){const t=ee(this,ir).failed;t&&Di(this,Fo,sr(()=>{t(ee(this,tr),()=>e,()=>()=>{})}))},WH=function(){const e=ee(this,ir).pending;e&&(this.is_pending=!0,Di(this,so,sr(()=>e(ee(this,tr)))),Yl(()=>{var t=Di(this,$a,document.createDocumentFragment()),i=tl();t.append(i),Di(this,nr,yn(this,hs,n_).call(this,()=>sr(()=>ee(this,Xc).call(this,i)))),ee(this,Wl)===0&&(ee(this,tr).before(t),Di(this,$a,null),od(ee(this,so),()=>{Di(this,so,null)}),yn(this,hs,i_).call(this,ui))}))},dS=function(){try{if(this.is_pending=this.has_pending_snippet(),Di(this,Wl,0),Di(this,Yc,0),Di(this,nr,sr(()=>{ee(this,Xc).call(this,ee(this,tr))})),ee(this,Wl)>0){var e=Di(this,$a,document.createDocumentFragment());t1(ee(this,nr),e);const t=ee(this,ir).pending;Di(this,so,sr(()=>t(ee(this,tr))))}else yn(this,hs,i_).call(this,ui)}catch(t){this.error(t)}},i_=function(e){this.is_pending=!1,e.transfer_effects(ee(this,Lp),ee(this,kp))},n_=function(e){var t=Qi,i=Yi,n=Ws;Da(ee(this,wo)),fr(ee(this,wo)),eg(ee(this,wo).ctx);try{return Qd.ensure(),e()}catch(s){return MP(s),null}finally{Da(t),fr(i),eg(n)}},hS=function(e,t){var i;if(!this.has_pending_snippet()){this.parent&&yn(i=this.parent,hs,hS).call(i,e,t);return}Di(this,Wl,ee(this,Wl)+e),ee(this,Wl)===0&&(yn(this,hs,i_).call(this,t),ee(this,so)&&od(ee(this,so),()=>{Di(this,so,null)}),ee(this,$a)&&(ee(this,tr).before(ee(this,$a)),Di(this,$a,null)))},uS=function(e){ee(this,nr)&&(Io(ee(this,nr)),Di(this,nr,null)),ee(this,so)&&(Io(ee(this,so)),Di(this,so,null)),ee(this,Fo)&&(Io(ee(this,Fo)),Di(this,Fo,null));var t=ee(this,ir).onerror;let i=ee(this,ir).failed;var n=!1,s=!1;const r=()=>{if(n){CH();return}n=!0,s&&lH(),ee(this,Fo)!==null&&od(ee(this,Fo),()=>{Di(this,Fo,null)}),yn(this,hs,n_).call(this,()=>{yn(this,hs,dS).call(this)})},a=c=>{try{s=!0,t==null||t(c,r),s=!1}catch(h){Vl(h,ee(this,wo)&&ee(this,wo).parent)}i&&Di(this,Fo,yn(this,hs,n_).call(this,()=>{try{return sr(()=>{var h=Qi;h.b=this,h.f|=nS,i(ee(this,tr),()=>c,()=>r)})}catch(h){return Vl(h,ee(this,wo).parent),null}}))};Yl(()=>{var c;try{c=this.transform_error(e)}catch(h){Vl(h,ee(this,wo)&&ee(this,wo).parent);return}c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(a,h=>Vl(h,ee(this,wo)&&ee(this,wo).parent)):a(c)})};function BH(o,e,t,i){const n=Kf;var s=o.filter(p=>!p.settled);if(t.length===0&&s.length===0){i(e.map(n));return}var r=Qi,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&hr)===0){a();try{i(p)}catch(v){Vl(v,r)}N_()}}var g=BP();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=>Vl(p,r)).finally(g)}c?c.then(()=>{a(),f(),N_()}):f()}function zH(){var o=Qi,e=Yi,t=Ws,i=ui;return function(s=!0){Da(o),fr(e),eg(t),s&&(o.f&hr)===0&&(i==null||i.activate(),i==null||i.apply())}}function N_(o=!0){Da(null),fr(null),eg(null),o&&(ui==null||ui.deactivate())}function BP(){var o=Qi,e=o.b,t=ui,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 Kf(o){var e=Bs|Ps;return Qi!==null&&(Qi.f|=Lg),{ctx:Ws,deps:null,effects:null,equals:DP,f:e,fn:o,reactions:null,rv:0,v:Cs,wv:0,parent:Qi,ac:null}}const ym=Symbol("obsolete");function VH(o,e,t){let i=Qi;i===null&&JF();var n=void 0,s=eh(Cs),r=!Yi,a=new Set;return eW(()=>{var v,_;var c=Qi,h=CP();n=h.promise;try{Promise.resolve(o()).then(h.resolve,y=>{y!==sw&&h.reject(y)}).finally(N_)}catch(y){h.reject(y),N_()}var g=ui;if(r){if((c.f&xg)!==0)var f=BP();if((v=i.b)!=null&&v.is_rendered())(_=g.async_deriveds.get(c))==null||_.reject(ym);else for(const y of a.values())y.reject(ym);a.add(h),g.async_deriveds.set(c,h)}const p=(y,S=void 0)=>{f==null||f(),a.delete(h),S!==ym&&(g.activate(),S?(s.f|=Xl,tg(s,S)):((s.f&Xl)!==0&&(s.f^=Xl),tg(s,y)),g.deactivate())};h.promise.then(p,y=>p(null,y||"unknown"))}),Y0(()=>{for(const c of a)c.reject(ym)}),new Promise(c=>{function h(g){function f(){g===n?c(s):h(n)}g.then(f,f)}h(n)})}function st(o){const e=Kf(o);return nT(e),e}function K0(o){const e=Kf(o);return e.equals=EP,e}function jH(o){var e=o.effects;if(e!==null){o.effects=null;for(var t=0;t<e.length;t+=1)Io(e[t])}}function G0(o){var e,t=Qi,i=o.parent;if(!cl&&i!==null&&o.v!==Cs&&(i.f&(hr|lo))!==0)return yH(),o.v;Da(i);try{o.f&=~Jd,jH(o),e=aT(o)}finally{Da(t)}return e}function zP(o){var e=G0(o);if(!o.equals(e)&&(o.wv=oT(),(!(ui!=null&&ui.is_fork)||o.deps===null)&&(ui!==null?(ui.capture(o,e,!0),vf==null||vf.capture(o,e,!0)):o.v=e,o.deps===null))){ds(o,Ls);return}cl||(As!==null?(X0()||ui!=null&&ui.is_fork)&&As.set(o,e):U0(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(sw),i.fn!==null&&(i.teardown=iw),i.ac=null,Gf(i,0),e1(i))}function VP(o){if(o.effects!==null)for(const e of o.effects)e.teardown&&e.fn!==null&&ig(e)}let R_=new Set;const nd=new Map;let jP=!1;function eh(o,e){var t={f:0,v:o,reactions:null,equals:DP,rv:0,wv:0};return t}function z(o,e){const t=eh(o);return nT(t),t}function $H(o,e=!1,t=!0){const i=eh(o);return e||(i.equals=EP),i}function I(o,e,t=!1){Yi!==null&&(!Or||(Yi.f&T_)!==0)&&PP()&&(Yi.f&(Bs|Ar|wu|T_))!==0&&(Ca===null||!Ca.has(o))&&aH();let i=t?wi(e):e;return tg(o,i,t_)}function tg(o,e,t=null){if(!o.equals(e)){nd.set(o,cl?e:o.v);var i=Qd.ensure();if(i.capture(o,e),(o.f&Bs)!==0){const n=o;(o.f&Ps)!==0&&G0(n),As===null&&U0(n)}o.wv=oT(),UP(o,Ps,t),Qi!==null&&(Qi.f&Ls)!==0&&(Qi.f&(Hr|vc))===0&&(er===null?iW([o]):er.push(o)),!i.is_fork&&R_.size>0&&!jP&&qH()}return e}function qH(){jP=!1;for(const o of R_){(o.f&Ls)!==0&&ds(o,Ia);let e;try{e=Gp(o)}catch{e=!0}e&&ig(o)}R_.clear()}function gk(o,e=1){var t=u(o),i=e===1?t++:t--;return I(o,t),i}function wf(o){I(o,o.v+1)}function UP(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&Ps)===0;if(c&&ds(r,e),(a&T_)!==0)R_.add(r);else if((a&Bs)!==0){var h=r;As==null||As.delete(h),(a&Jd)===0&&(a&dr&&(Qi===null||(Qi.f&M_)===0)&&(r.f|=Jd),UP(h,Ia,t))}else if(c){var g=r;(a&Ar)!==0&&Sr!==null&&Sr.add(g),t!==null?t.push(g):q0(g)}}}function wi(o){if(typeof o!="object"||o===null||id in o)return o;const e=SP(o);if(e!==UF&&e!==$F)return o;var t=new Map,i=j0(o),n=z(0),s=rd,r=a=>{if(rd===s)return a();var c=Yi,h=rd;fr(null),_k(s);var g=a();return fr(c),_k(h),g};return i&&t.set("length",z(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=z(h.value);return t.set(c,f),f}):I(g,h.value,!0),!0},deleteProperty(a,c){var h=t.get(c);if(h===void 0){if(c in a){const g=r(()=>z(Cs));t.set(c,g),wf(n)}}else I(h,Cs),wf(n);return!0},get(a,c,h){var v;if(c===id)return o;var g=t.get(c),f=c in a;if(g===void 0&&(!f||(v=bu(a,c))!=null&&v.writable)&&(g=r(()=>{var _=wi(f?a[c]:Cs),y=z(_);return y}),t.set(c,g)),g!==void 0){var p=u(g);return p===Cs?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!==Cs)return{enumerable:!0,configurable:!0,value:p,writable:!0}}return h},has(a,c){var p;if(c===id)return!0;var h=t.get(c),g=h!==void 0&&h.v!==Cs||Reflect.has(a,c);if(h!==void 0||Qi!==null&&(!g||(p=bu(a,c))!=null&&p.writable)){h===void 0&&(h=r(()=>{var v=g?wi(a[c]):Cs,_=z(v);return _}),t.set(c,h));var f=u(h);if(f===Cs)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?I(_,Cs):v in a&&(_=r(()=>z(Cs)),t.set(v+"",_))}if(f===void 0)(!p||(N=bu(a,c))!=null&&N.writable)&&(f=r(()=>z(void 0)),I(f,wi(h)),t.set(c,f));else{p=f.v!==Cs;var y=r(()=>wi(h));I(f,y)}var S=Reflect.getOwnPropertyDescriptor(a,c);if(S!=null&&S.set&&S.set.call(g,h),!p){if(i&&typeof c=="string"){var D=t.get("length"),E=Number(c);Number.isInteger(E)&&E>=D.v&&I(D,E+1)}wf(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!==Cs});for(var[h,g]of t)g.v!==Cs&&!(h in a)&&c.push(h);return c},setPrototypeOf(){rH()}})}function fk(o){try{if(o!==null&&typeof o=="object"&&id in o)return o[id]}catch{}return o}function KH(o,e){return Object.is(fk(o),fk(e))}var sd,$P,qP,KP,GP;function GH(){if(sd===void 0){sd=window,$P=document,qP=/Firefox/.test(navigator.userAgent);var o=Element.prototype,e=Node.prototype,t=Text.prototype;KP=bu(e,"firstChild").get,GP=bu(e,"nextSibling").get,ck(o)&&(o[oS]=void 0,o[Qm]=null,o[rS]=void 0,o.__e=void 0),ck(t)&&(t[Jg]=void 0)}}function tl(o=""){return document.createTextNode(o)}function va(o){return KP.call(o)}function Kp(o){return GP.call(o)}function x(o,e){return va(o)}function bt(o,e=!1){{var t=va(o);return t instanceof Comment&&t.data===""?Kp(t):t}}function C(o,e=1,t=!1){let i=o;for(;e--;)i=Kp(i);return i}function ZH(o){o.textContent=""}function ZP(){return!1}function XP(o,e,t){return e==null||e===IP?t?document.createElement(o,{is:t}):document.createElement(o):t?document.createElementNS(e,o,{is:t}):document.createElementNS(e,o)}let pk=!1;function XH(){pk||(pk=!0,document.addEventListener("reset",o=>{Promise.resolve().then(()=>{var e;if(!o.defaultPrevented)for(const t of o.target.elements)(e=t[e_])==null||e.call(t)})},{capture:!0}))}function ow(o){var e=Yi,t=Qi;fr(null),Da(null);try{return o()}finally{fr(e),Da(t)}}function Z0(o,e,t,i=t){o.addEventListener(e,()=>ow(t));const n=o[e_];n?o[e_]=()=>{n(),i(!0)}:o[e_]=()=>i(!0),XH()}function YH(o){Qi===null&&(Yi===null&&iH(),tH()),cl&&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 vl(o,e){var t=Qi;t!==null&&(t.f&lo)!==0&&(o|=lo);var i={ctx:Ws,deps:null,nodes:null,f:o|Ps|dr,first:null,fn:e,last:null,next:null,parent:t,b:t&&t.b,prev:null,teardown:null,wv:0,ac:null};ui==null||ui.register_created_effect(i);var n=i;if((o&Ju)!==0)ou!==null?ou.push(i):Qd.ensure().schedule(i);else if(e!==null){try{ig(i)}catch(r){throw Io(i),r}n.deps===null&&n.teardown===null&&n.nodes===null&&n.first===n.last&&(n.f&Lg)===0&&(n=n.first,(o&Ar)!==0&&(o&Qu)!==0&&n!==null&&(n.f|=Qu))}if(n!==null&&(n.parent=t,t!==null&&JH(n,t),Yi!==null&&(Yi.f&Bs)!==0&&(o&vc)===0)){var s=Yi;(s.effects??(s.effects=[])).push(n)}return i}function X0(){return Yi!==null&&!Or}function Y0(o){const e=vl(nw,null);return ds(e,Ls),e.teardown=o,e}function Mn(o){YH();var e=Qi.f,t=!Yi&&(e&Hr)!==0&&Ws!==null&&!Ws.i;if(t){var i=Ws;(i.e??(i.e=[])).push(o)}else return YP(o)}function YP(o){return vl(Ju|ZF,o)}function QH(o){Qd.ensure();const e=vl(vc|Lg,o);return(t={})=>new Promise(i=>{t.outro?od(e,()=>{Io(e),i(void 0)}):(Io(e),i(void 0))})}function J0(o){return vl(Ju,o)}function eW(o){return vl(wu|Lg,o)}function rw(o,e=0){return vl(nw|e,o)}function Z(o,e=[],t=[],i=[]){BH(i,e,t,n=>{vl(nw,()=>o(...n.map(u)))})}function Q0(o,e=0){var t=vl(Ar|e,o);return t}function sr(o){return vl(Hr|Lg,o)}function JP(o){var e=o.teardown;if(e!==null){const t=cl,i=Yi;mk(!0),fr(null);try{e.call(null)}finally{mk(t),fr(i)}}}function e1(o,e=!1){var t=o.first;for(o.first=o.last=null;t!==null;){const n=t.ac;n!==null&&ow(()=>{n.abort(sw)});var i=t.next;(t.f&vc)!==0?t.parent=null:Io(t,e),t=i}}function tW(o){for(var e=o.first;e!==null;){var t=e.next;(e.f&Hr)===0&&Io(e),e=t}}function Io(o,e=!0){var t=!1;(e||(o.f&GF)!==0)&&o.nodes!==null&&o.nodes.end!==null&&(QP(o.nodes.start,o.nodes.end),t=!0),ds(o,sS),e1(o,e&&!t),Gf(o,0);var i=o.nodes&&o.nodes.t;if(i!==null)for(const s of i)s.stop();JP(o),o.f^=sS,o.f|=hr;var n=o.parent;n!==null&&n.first!==null&&eT(o),o.next=o.prev=o.teardown=o.ctx=o.deps=o.fn=o.nodes=o.ac=o.b=null}function QP(o,e){for(;o!==null;){var t=o===e?null:Kp(o);o.remove(),o=t}}function eT(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 od(o,e,t=!0){var i=[];tT(o,i,!0);var n=()=>{t&&Io(o),e&&e()},s=i.length;if(s>0){var r=()=>--s||n();for(var a of i)a.out(r)}else n()}function tT(o,e,t){if((o.f&lo)===0){o.f^=lo;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&Qu)!==0||(n.f&Hr)!==0&&(o.f&Ar)!==0;tT(n,e,r?t:!1)}n=s}}}function A_(o){iT(o,!0)}function iT(o,e){if((o.f&lo)!==0){o.f^=lo,(o.f&Ls)===0&&(ds(o,Ps),Qd.ensure().schedule(o));for(var t=o.first;t!==null;){var i=t.next,n=(t.f&Qu)!==0||(t.f&Hr)!==0;iT(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 t1(o,e){if(o.nodes)for(var t=o.nodes.start,i=o.nodes.end;t!==null;){var n=t===i?null:Kp(t);e.append(t),t=n}}let s_=!1,cl=!1;function mk(o){cl=o}let Yi=null,Or=!1;function fr(o){Yi=o}let Qi=null;function Da(o){Qi=o}let Ca=null;function nT(o){Yi!==null&&(Ca??(Ca=new Set)).add(o)}let yo=null,Ao=0,er=null;function iW(o){er=o}let sT=1,$c=0,rd=$c;function _k(o){rd=o}function oT(){return++sT}function Gp(o){var e=o.f;if((e&Ps)!==0)return!0;if(e&Bs&&(o.f&=~Jd),(e&Ia)!==0){for(var t=o.deps,i=t.length,n=0;n<i;n++){var s=t[n];if(Gp(s)&&zP(s),s.wv>o.wv)return!0}(e&dr)!==0&&As===null&&ds(o,Ls)}return!1}function rT(o,e,t=!0){var i=o.reactions;if(i!==null&&!(Ca!==null&&Ca.has(o)))for(var n=0;n<i.length;n++){var s=i[n];(s.f&Bs)!==0?rT(s,e,!1):e===s&&(t?ds(s,Ps):(s.f&Ls)!==0&&ds(s,Ia),q0(s))}}function aT(o){var y;var e=yo,t=Ao,i=er,n=Yi,s=Ca,r=Ws,a=Or,c=rd,h=o.f;yo=null,Ao=0,er=null,Yi=(h&(Hr|vc))===0?o:null,Ca=null,eg(o.ctx),Or=!1,rd=++$c,o.ac!==null&&(ow(()=>{o.ac.abort(sw)}),o.ac=null);try{o.f|=M_;var g=o.fn,f=g();o.f|=xg;var p=o.deps,v=ui==null?void 0:ui.is_fork;if(yo!==null){var _;if(v||Gf(o,Ao),p!==null&&Ao>0)for(p.length=Ao+yo.length,_=0;_<yo.length;_++)p[Ao+_]=yo[_];else o.deps=p=yo;if(X0()&&(o.f&dr)!==0)for(_=Ao;_<p.length;_++)((y=p[_]).reactions??(y.reactions=[])).push(o)}else!v&&p!==null&&Ao<p.length&&(Gf(o,Ao),p.length=Ao);if(PP()&&er!==null&&!Or&&p!==null&&(o.f&(Bs|Ia|Ps))===0)for(_=0;_<er.length;_++)rT(er[_],o);if(n!==null&&n!==o){if($c++,n.deps!==null)for(let S=0;S<t;S+=1)n.deps[S].rv=$c;if(e!==null)for(const S of e)S.rv=$c;er!==null&&(i===null?i=er:i.push(...er))}return(o.f&Xl)!==0&&(o.f^=Xl),f}catch(S){return MP(S)}finally{o.f^=M_,yo=e,Ao=t,er=i,Yi=n,Ca=s,eg(r),Or=a,rd=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&Bs)!==0&&(yo===null||!P_.call(yo,e))){var s=e;(s.f&dr)!==0&&(s.f^=dr,s.f&=~Jd),s.v!==Cs&&U0(s),UH(s),Gf(s,0)}}function Gf(o,e){var t=o.deps;if(t!==null)for(var i=e;i<t.length;i++)nW(o,t[i])}function ig(o){var e=o.f;if((e&hr)===0){ds(o,Ls);var t=Qi,i=s_;Qi=o,s_=!0;try{(e&(Ar|xP))!==0?tW(o):e1(o),JP(o);var n=aT(o);o.teardown=typeof n=="function"?n:null,o.wv=sT;var s;yP&&LH&&(o.f&Ps)!==0&&o.deps}finally{s_=i,Qi=t}}}async function gS(){await Promise.resolve(),TH()}function u(o){var e=o.f,t=(e&Bs)!==0;if(Yi!==null&&!Or){var i=Qi!==null&&(Qi.f&hr)!==0;if(!i&&(Ca===null||!Ca.has(o))){var n=Yi.deps;if((Yi.f&M_)!==0)o.rv<$c&&(o.rv=$c,yo===null&&n!==null&&n[Ao]===o?Ao++:yo===null?yo=[o]:yo.push(o));else{Yi.deps??(Yi.deps=[]),P_.call(Yi.deps,o)||Yi.deps.push(o);var s=o.reactions;s===null?o.reactions=[Yi]:P_.call(s,Yi)||s.push(Yi)}}}if(cl&&nd.has(o))return nd.get(o);if(t){var r=o;if(cl){var a=r.v;return((r.f&Ls)===0&&r.reactions!==null||cT(r))&&(a=G0(r)),nd.set(r,a),a}var c=(r.f&dr)===0&&!Or&&Yi!==null&&(s_||(Yi.f&dr)!==0),h=(r.f&xg)===0;Gp(r)&&(c&&(r.f|=dr),zP(r)),c&&!h&&(VP(r),lT(r))}if(As!=null&&As.has(o))return As.get(o);if((o.f&Xl)!==0)throw o.v;return o.v}function lT(o){if(o.f|=dr,o.deps!==null)for(const e of o.deps)(e.reactions??(e.reactions=[])).push(o),(e.f&Bs)!==0&&(e.f&dr)===0&&(VP(e),lT(e))}function cT(o){if(o.v===Cs)return!0;if(o.deps===null)return!1;for(const e of o.deps)if(nd.has(e)||(e.f&Bs)!==0&&cT(e))return!0;return!1}function bl(o){var e=Or;try{return Or=!0,o()}finally{Or=e}}const sW=["touchstart","touchmove"];function oW(o){return sW.includes(o)}const qc=Symbol("events"),dT=new Set,fS=new Set;function rW(o,e,t,i={}){function n(s){if(i.capture||pS.call(e,s),!s.cancelBubble)return ow(()=>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 is(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)&&Y0(()=>{e.removeEventListener(o,r,s)})}function ne(o,e,t){(e[qc]??(e[qc]={}))[o]=t}function _r(o){for(var e=0;e<o.length;e++)dT.add(o[e]);for(var t of fS)t(o)}let vk=null;function pS(o){var y,S;var e=this,t=e.ownerDocument,i=o.type,n=((y=o.composedPath)==null?void 0:y.call(o))||[],s=n[0]||o.target;vk=o;var r=0,a=vk===o&&o[qc];if(a){var c=n.indexOf(a);if(c!==-1&&(e===document||e===window)){o[qc]=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=Yi,f=Qi;fr(null),Da(null);try{for(var p,v=[];s!==null&&s!==e;){try{var _=(S=s[qc])==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[qc]=e,delete o.currentTarget,fr(g),Da(f)}}}var UD;const Jw=((UD=globalThis==null?void 0:globalThis.window)==null?void 0:UD.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:o=>o});function aW(o){return(Jw==null?void 0:Jw.createHTML(o))??o}function hT(o){var e=XP("template");return e.innerHTML=aW(o.replaceAll("<!>","<!---->")),e.content}function th(o,e){var t=Qi;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=hT(s?o:"<!>"+o),t||(n=va(n)));var r=i||qP?document.importNode(n,!0):n.cloneNode(!0);if(t){var a=va(r),c=r.lastChild;th(a,c)}else th(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=hT(n),a=va(r);s=va(a)}var c=s.cloneNode(!0);return th(c,c),c}}function uT(o,e){return lW(o,e,"svg")}function Fr(o=""){{var e=tl(o+"");return th(e,e),e}}function Ts(){var o=document.createDocumentFragment(),e=document.createComment(""),t=tl();return o.append(e,t),th(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[Jg]??(o[Jg]=o.nodeValue))&&(o[Jg]=t,o.nodeValue=`${t}`)}function cW(o,e){return dW(o,e)}const Sm=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(tl());AH(g,{pending:()=>{}},v=>{Po({});var _=Ws;s&&(_.c=s),n&&(i.$$events=n),c=o(v,i)||{},To()},a);var f=new Set,p=v=>{for(var _=0;_<v.length;_++){var y=v[_];if(!f.has(y)){f.add(y);var S=oW(y);for(const N of[e,document]){var D=Sm.get(N);D===void 0&&(D=new Map,Sm.set(N,D));var E=D.get(y);E===void 0?(N.addEventListener(y,pS,{passive:S}),D.set(y,1)):D.set(y,E+1)}}}};return p(tw(dT)),fS.add(p),()=>{var S;for(var v of f)for(const D of[e,document]){var _=Sm.get(D),y=_.get(v);--y==0?(D.removeEventListener(v,pS),_.delete(v),_.size===0&&Sm.delete(D)):_.set(v,y)}fS.delete(p),g!==t&&((S=g.parentNode)==null||S.removeChild(g))}});return hW.set(c,h),c}let hW=new WeakMap;var kr,ca,Ho,Jc,Ip,Dp,Uv;class uW{constructor(e,t=!0){Oi(this,"anchor");Ii(this,kr,new Map);Ii(this,ca,new Map);Ii(this,Ho,new Map);Ii(this,Jc,new Set);Ii(this,Ip,!0);Ii(this,Dp,e=>{if(ee(this,kr).has(e)){var t=ee(this,kr).get(e),i=ee(this,ca).get(t);if(i)A_(i),ee(this,Jc).delete(t);else{var n=ee(this,Ho).get(t);n&&(A_(n.effect),ee(this,ca).set(t,n.effect),ee(this,Ho).delete(t),n.fragment.lastChild.remove(),this.anchor.before(n.fragment),i=n.effect)}for(const[s,r]of ee(this,kr)){if(ee(this,kr).delete(s),s===e)break;const a=ee(this,Ho).get(r);a&&(Io(a.effect),ee(this,Ho).delete(r))}for(const[s,r]of ee(this,ca)){if(s===t||ee(this,Jc).has(s))continue;const a=()=>{if(Array.from(ee(this,kr).values()).includes(s)){var h=document.createDocumentFragment();t1(r,h),h.append(tl()),ee(this,Ho).set(s,{effect:r,fragment:h})}else Io(r);ee(this,Jc).delete(s),ee(this,ca).delete(s)};ee(this,Ip)||!i?(ee(this,Jc).add(s),od(r,a,!1)):a()}}});Ii(this,Uv,e=>{ee(this,kr).delete(e);const t=Array.from(ee(this,kr).values());for(const[i,n]of ee(this,Ho))t.includes(i)||(Io(n.effect),ee(this,Ho).delete(i))});this.anchor=e,Di(this,Ip,t)}ensure(e,t){var i=ui,n=ZP();if(t&&!ee(this,ca).has(e)&&!ee(this,Ho).has(e))if(n){var s=document.createDocumentFragment(),r=tl();s.append(r),ee(this,Ho).set(e,{effect:sr(()=>t(r)),fragment:s})}else ee(this,ca).set(e,sr(()=>t(this.anchor)));if(ee(this,kr).set(i,e),n){for(const[a,c]of ee(this,ca))a===e?i.unskip_effect(c):i.skip_effect(c);for(const[a,c]of ee(this,Ho))a===e?i.unskip_effect(c.effect):i.skip_effect(c.effect);i.oncommit(ee(this,Dp)),i.ondiscard(ee(this,Uv))}else ee(this,Dp).call(this,i)}}kr=new WeakMap,ca=new WeakMap,Ho=new WeakMap,Jc=new WeakMap,Ip=new WeakMap,Dp=new WeakMap,Uv=new WeakMap;function $(o,e,t=!1){var i=new uW(o),n=t?Qu:0;function s(r,a){i.ensure(r,a)}Q0(()=>{var r=!1;e((a,c=0)=>{r=!0,s(c,a)}),r||s(-1,null)},n)}function Nn(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];od(f,()=>{if(s){if(s.pending.delete(f),s.done.add(f),s.pending.size===0){var p=o.outrogroups;mS(o,tw(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()}mS(o,e,!c)}else s={pending:new Set(e),done:new Set},(o.outrogroups??(o.outrogroups=new Set)).add(s)}function mS(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|=_a;const r=document.createDocumentFragment();t1(s,r)}else Io(e[n],t)}}var bk;function _i(o,e,t,i,n,s=null){var r=o,a=new Map,c=(e&kP)!==0;if(c){var h=o;r=h.appendChild(tl())}var g=null,f=K0(()=>{var N=t();return j0(N)?N:N==null?[]:tw(N)}),p,v=new Map,_=!0;function y(N){(E.effect.f&hr)===0&&(E.pending.delete(N),E.fallback=g,fW(E,p,r,e,i),g!==null&&(p.length===0?(g.f&_a)===0?A_(g):(g.f^=_a,tf(g,null,r)):od(g,()=>{g=null})))}function S(N){E.pending.delete(N)}var D=Q0(()=>{p=u(f);for(var N=p.length,V=new Set,F=ui,Y=ZP(),X=0;X<N;X+=1){var ue=p[X],Pe=i(ue,X),Ue=_?null:a.get(Pe);Ue?(Ue.v&&tg(Ue.v,ue),Ue.i&&tg(Ue.i,X),Y&&F.unskip_effect(Ue.e)):(Ue=pW(a,_?r:bk??(bk=tl()),ue,Pe,X,n,e,t),_||(Ue.e.f|=_a),a.set(Pe,Ue)),V.add(Pe)}if(N===0&&s&&!g&&(_?g=sr(()=>s(r)):(g=sr(()=>s(bk??(bk=tl()))),g.f|=_a)),N>V.size&&QF(),!_)if(v.set(F,V),Y){for(const[ve,at]of a)V.has(ve)||F.skip_effect(at.e);F.oncommit(y),F.ondiscard(S)}else y(F);u(f)}),E={effect:D,items:a,pending:v,outrogroups:null,fallback:g};_=!1}function Vg(o){for(;o!==null&&(o.f&Hr)===0;)o=o.next;return o}function fW(o,e,t,i,n){var Ue,ve,at,Xt,Ct,Qt,Ft,ei,de;var s=(i&hH)!==0,r=e.length,a=o.items,c=Vg(o.effect.first),h,g=null,f,p=[],v=[],_,y,S,D;if(s)for(D=0;D<r;D+=1)_=e[D],y=n(_,D),S=a.get(y).e,(S.f&_a)===0&&((ve=(Ue=S.nodes)==null?void 0:Ue.a)==null||ve.measure(),(f??(f=new Set)).add(S));for(D=0;D<r;D+=1){if(_=e[D],y=n(_,D),S=a.get(y).e,o.outrogroups!==null)for(const xt of o.outrogroups)xt.pending.delete(S),xt.done.delete(S);if((S.f&lo)!==0&&(A_(S),s&&((Xt=(at=S.nodes)==null?void 0:at.a)==null||Xt.unfix(),(f??(f=new Set)).delete(S))),(S.f&_a)!==0)if(S.f^=_a,S===c)tf(S,null,t);else{var E=g?g.next:c;S===o.effect.last&&(o.effect.last=S.prev),S.prev&&(S.prev.next=S.next),S.next&&(S.next.prev=S.prev),kl(o,g,S),kl(o,S,E),tf(S,E,t),g=S,p=[],v=[],c=Vg(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)tf(p[V],N,t);for(V=0;V<v.length;V+=1)h.delete(v[V]);kl(o,F.prev,Y.next),kl(o,g,F),kl(o,Y,N),c=N,g=Y,D-=1,p=[],v=[]}else h.delete(S),tf(S,c,t),kl(o,S.prev,S.next),kl(o,S,g===null?o.effect.first:g.next),kl(o,g,S),g=S;continue}for(p=[],v=[];c!==null&&c!==S;)(h??(h=new Set)).add(c),v.push(c),c=Vg(c.next);if(c===null)continue}(S.f&_a)===0&&p.push(S),g=S,c=Vg(S.next)}if(o.outrogroups!==null){for(const xt of o.outrogroups)xt.pending.size===0&&(mS(o,tw(xt.done)),(Ct=o.outrogroups)==null||Ct.delete(xt));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&lo)===0&&X.push(S);for(;c!==null;)(c.f&lo)===0&&c!==o.fallback&&X.push(c),c=Vg(c.next);var ue=X.length;if(ue>0){var Pe=(i&kP)!==0&&r===0?t:null;if(s){for(D=0;D<ue;D+=1)(Ft=(Qt=X[D].nodes)==null?void 0:Qt.a)==null||Ft.measure();for(D=0;D<ue;D+=1)(de=(ei=X[D].nodes)==null?void 0:ei.a)==null||de.fix()}gW(o,X,Pe)}}s&&Yl(()=>{var xt,Oe;if(f!==void 0)for(S of f)(Oe=(xt=S.nodes)==null?void 0:xt.a)==null||Oe.apply()})}function pW(o,e,t,i,n,s,r,a){var c=(r&cH)!==0?(r&uH)===0?$H(t,!1,!1):eh(t):null,h=(r&dH)!==0?eh(n):null;return{v:c,i:h,e:sr(()=>(s(e,c??t,h??n,a),()=>{o.delete(i)}))}}function tf(o,e,t){if(o.nodes)for(var i=o.nodes.start,n=o.nodes.end,s=e&&(e.f&_a)===0?e.nodes.start:t;i!==null;){var r=Kp(i);if(s.before(i),i===n)return;i=r}}function kl(o,e,t){e===null?o.effect.first=t:e.next=t,t===null?o.effect.last=e:t.prev=e}function jl(o,e,t=!1,i=!1,n=!1,s=!1){var r=o,a="";if(t)var c=o;Z(()=>{var h=Qi;if(a!==(a=e()??"")){if(t){h.nodes=null,c.innerHTML=a,a!==""&&th(va(c),c.lastChild);return}if(h.nodes!==null&&(QP(h.nodes.start,h.nodes.end),h.nodes=null),a!==""){var g=i?bH:n?wH:void 0,f=XP(i?"svg":n?"math":"template",g);f.innerHTML=a;var p=i||n?f:f.content;if(th(va(p),p.lastChild),i||n)for(;va(p);)r.before(va(p));else r.before(p)}}})}const wk=[...`
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||wk.includes(i[r-1]))&&(a===i.length||wk.includes(i[a]))?i=(r===0?"":i.substring(0,r))+i.substring(a+1):r=a}}return i===""?null:i}function yk(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 Qw(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(Qw)),n&&c.push(...Object.keys(n).map(Qw));var h=0,g=-1;const y=o.length;for(var f=0;f<y;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===y-1){if(g!==-1){var v=Qw(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+=yk(i)),n&&(t+=yk(n,!0)),t=t.trim(),t===""?null:t}return o==null?null:String(o)}function jt(o,e,t,i,n,s){var r=o[oS];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[oS]=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 ey(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 jo(o,e,t,i){var n=o[rS];if(n!==e){var s=_W(e,i);s==null?o.removeAttribute("style"):o.style.cssText=s,o[rS]=e}else i&&(Array.isArray(i)?(ey(o,t==null?void 0:t[0],i[0]),ey(o,t==null?void 0:t[1],i[1],"important")):ey(o,t,i));return i}function gT(o,e,t=!1){if(o.multiple){if(e==null)return;if(!j0(e))return SH();for(var i of o.options)i.selected=e.includes(yf(i));return}for(i of o.options){var n=yf(i);if(KH(n,e)){i.selected=!0;return}}(!t||e!==void 0)&&(o.selectedIndex=-1)}function vW(o){var e=new MutationObserver(()=>{gT(o,o.__value)});e.observe(o,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Y0(()=>{e.disconnect()})}function ga(o,e,t=e){var i=new WeakSet,n=!0;Z0(o,"change",s=>{var r=s?"[selected]":":checked",a;if(o.multiple)a=[].map.call(o.querySelectorAll(r),yf);else{var c=o.querySelector(r)??o.querySelector("option:not([disabled])");a=c&&yf(c)}t(a),o.__value=a,ui!==null&&i.add(ui)}),J0(()=>{var s=e();if(o===document.activeElement){var r=ui;if(i.has(r))return}if(gT(o,s,n),n&&s===void 0){var a=o.querySelector(":checked");a!==null&&(s=yf(a),t(s))}o.__value=s,n=!1}),vW(o)}function yf(o){return"__value"in o?o.__value:o.value}const bW=Symbol("is custom element"),wW=Symbol("is html");function ty(o,e){var t=fT(o);t.checked!==(t.checked=e??void 0)&&(o.checked=e)}function Rn(o,e,t,i){var n=fT(o);n[e]!==(n[e]=t)&&(e==="loading"&&(o[YF]=t),t==null?o.removeAttribute(e):typeof t!="string"&&yW(o).includes(e)?o[e]=t:o.setAttribute(e,t))}function fT(o){return o[Qm]??(o[Qm]={[bW]:o.nodeName.includes("-"),[wW]:o.namespaceURI===IP})}var Sk=new Map;function yW(o){var e=o.getAttribute("is")||o.nodeName,t=Sk.get(e);if(t)return t;Sk.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=SP(n)}return t}function Ei(o,e,t=e){var i=new WeakSet;Z0(o,"input",async n=>{var s=n?o.defaultValue:o.value;if(s=iy(o)?ny(s):s,t(s),ui!==null&&i.add(ui),await gS(),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))}}}),bl(e)==null&&o.value&&(t(iy(o)?ny(o.value):o.value),ui!==null&&i.add(ui)),rw(()=>{var n=e();if(o===document.activeElement){var s=ui;if(i.has(s))return}iy(o)&&n===ny(o.value)||o.type==="date"&&!n&&!o.value||n!==o.value&&(o.value=n??"")})}function Es(o,e,t=e){Z0(o,"change",i=>{var n=i?o.defaultChecked:o.checked;t(n)}),bl(e)==null&&t(o.checked),rw(()=>{var i=e();o.checked=!!i})}function iy(o){var e=o.type;return e==="number"||e==="range"}function ny(o){return o===""?null:+o}var Bl,Tu,Ep,$v,pT;const qv=class qv{constructor(e){Ii(this,$v);Ii(this,Bl,new WeakMap);Ii(this,Tu);Ii(this,Ep);Di(this,Ep,e)}observe(e,t){var i=ee(this,Bl).get(e)||new Set;return i.add(t),ee(this,Bl).set(e,i),yn(this,$v,pT).call(this).observe(e,ee(this,Ep)),()=>{var n=ee(this,Bl).get(e);n.delete(t),n.size===0&&(ee(this,Bl).delete(e),ee(this,Tu).unobserve(e))}}};Bl=new WeakMap,Tu=new WeakMap,Ep=new WeakMap,$v=new WeakSet,pT=function(){return ee(this,Tu)??Di(this,Tu,new ResizeObserver(e=>{for(var t of e){qv.entries.set(t.target,t);for(var i of ee(this,Bl).get(t.target)||[])i(t)}}))},Oi(qv,"entries",new WeakMap);let _S=qv;var SW=new _S({box:"border-box"});function CW(o,e,t){var i=SW.observe(o,()=>t(o[e]));J0(()=>(bl(()=>t(o[e])),i))}function sy(o,e){return o===e||(o==null?void 0:o[id])===e}function bs(o={},e,t,i){var n=Ws.r,s=Qi;return J0(()=>{var r,a;return rw(()=>{r=a,a=[],bl(()=>{sy(t(...a),o)||(e(o,...a),r&&sy(t(...r),o)&&e(null,...r))})}),()=>{let c=s;for(;c!==n&&c.parent!==null&&c.parent.f&sS;)c=c.parent;const h=()=>{a&&sy(t(...a),o)&&e(null,...a)},g=c.teardown;c.teardown=()=>{h(),g==null||g()}}}),o}function ng(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=Kf(i)),u(h)):(c&&(c=!1,a=r?bl(i):i),a);let f;if(s){var p=id in o||XF in o;f=((V=bu(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 y;if(y=()=>{var F=o[e];return F===void 0?g():(c=!0,F)},(t&fH)===0)return y;if(f){var S=o.$$legacy;return(function(F,Y){return arguments.length>0?((!Y||S||_)&&f(Y?y():F),F):y()})}var D=!1,E=((t&gH)!==0?Kf:K0)(()=>(D=!1,y()));s&&u(E);var N=Qi;return(function(F,Y){if(arguments.length>0){const X=Y?u(E):s?wi(F):F;return I(E,X),D=!0,a!==void 0&&(a=X),F}return cl&&D||(N.f&hr)!==0?E.v:u(E)})}function vr(o){Ws===null&&LP(),Mn(()=>{const e=bl(o);if(typeof e=="function")return e})}function aw(o){Ws===null&&LP(),vr(()=>()=>bl(o))}const xW="5";var $D;typeof window<"u"&&(($D=window.__svelte??(window.__svelte={})).v??($D.v=new Set)).add(xW);/*!-----------------------------------------------------------------------------
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10,7 +10,7 @@ var rA=Object.defineProperty;var TL=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",sg={};BW(sg,KD);var vT=(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))(vT||{}),bT=(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))(bT||{}),wT=(o=>(o[o.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",o[o.LineFeed=1]="LineFeed",o))(wT||{}),yT=(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))(yT||{}),ST=(o=>(o[o.Classic=1]="Classic",o[o.NodeJs=2]="NodeJs",o))(ST||{}),CT=class{constructor(o,e,t,i,n){this._onDidChange=new sg.Emitter,this._onDidExtraLibsChange=new sg.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,xT={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},LT=new CT({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},xT),kT=new CT({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},xT),jW=()=>lw().then(o=>o.getTypeScriptWorker()),UW=()=>lw().then(o=>o.getJavaScriptWorker());sg.languages.typescript={ModuleKind:vT,JsxEmit:bT,NewLineKind:wT,ScriptTarget:yT,ModuleResolutionKind:ST,typescriptVersion:VW,typescriptDefaults:LT,javascriptDefaults:kT,getTypeScriptWorker:jW,getJavaScriptWorker:UW};function lw(){return qD(()=>import("./tsMode-CXjN2zbx.js"),__vite__mapDeps([3,1,2]))}sg.languages.onLanguage("typescript",()=>lw().then(o=>o.setupTypeScript(LT)));sg.languages.onLanguage("javascript",()=>lw().then(o=>o.setupJavaScript(kT)));class $W extends Qs{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:St("toggleCollapseUnchangedRegions","Toggle Collapse Unchanged Regions"),icon:Zt.map,toggled:ae.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:ae.has("isInDiffEditor"),menu:{when:ae.has("isInDiffEditor"),id:rt.EditorTitle,order:22,group:"navigation"}})}run(e,...t){const i=e.get(xn),n=!i.getValue("diffEditor.hideUnchangedRegions.enabled");i.updateValue("diffEditor.hideUnchangedRegions.enabled",n)}}class IT extends Qs{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:St("toggleShowMovedCodeBlocks","Toggle Show Moved Code Blocks"),precondition:ae.has("isInDiffEditor")})}run(e,...t){const i=e.get(xn),n=!i.getValue("diffEditor.experimental.showMoves");i.updateValue("diffEditor.experimental.showMoves",n)}}class DT extends Qs{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:St("toggleUseInlineViewWhenSpaceIsLimited","Toggle Use Inline View When Space Is Limited"),precondition:ae.has("isInDiffEditor")})}run(e,...t){const i=e.get(xn),n=!i.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");i.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",n)}}const Xp=St("diffEditor","Diff Editor");class qW extends Wr{constructor(){super({id:"diffEditor.switchSide",title:St("switchSide","Switch Side"),icon:Zt.arrowSwap,precondition:ae.has("isInDiffEditor"),f1:!0,category:Xp})}runEditorCommand(e,t,i){const n=kg(e);if(n instanceof Pp){if(i&&i.dryRun)return{destinationSelection:n.mapToOtherSide().destinationSelection};n.switchSide()}}}class KW extends Wr{constructor(){super({id:"diffEditor.exitCompareMove",title:St("exitCompareMove","Exit Compare Move"),icon:Zt.close,precondition:M.comparingMovedCode,f1:!1,category:Xp,keybinding:{weight:1e4,primary:9}})}runEditorCommand(e,t,...i){const n=kg(e);n instanceof Pp&&n.exitCompareMove()}}class GW extends Wr{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:St("collapseAllUnchangedRegions","Collapse All Unchanged Regions"),icon:Zt.fold,precondition:ae.has("isInDiffEditor"),f1:!0,category:Xp})}runEditorCommand(e,t,...i){const n=kg(e);n instanceof Pp&&n.collapseAllUnchangedRegions()}}class ZW extends Wr{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:St("showAllUnchangedRegions","Show All Unchanged Regions"),icon:Zt.unfold,precondition:ae.has("isInDiffEditor"),f1:!0,category:Xp})}runEditorCommand(e,t,...i){const n=kg(e);n instanceof Pp&&n.showAllUnchangedRegions()}}class vS extends Qs{constructor(){super({id:"diffEditor.revert",title:St("revert","Revert"),f1:!1,category:Xp})}run(e,t){const i=XW(e,t.originalUri,t.modifiedUri);i instanceof Pp&&i.revertRangeMappings(t.mapping.innerChanges??[])}}const ET=St("accessibleDiffViewer","Accessible Diff Viewer"),Kv=class Kv extends Qs{constructor(){super({id:Kv.id,title:St("editor.action.accessibleDiffViewer.next","Go to Next Difference"),category:ET,precondition:ae.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(e){const t=kg(e);t==null||t.accessibleDiffViewerNext()}};Kv.id="editor.action.accessibleDiffViewer.next";let Zf=Kv;const Gv=class Gv extends Qs{constructor(){super({id:Gv.id,title:St("editor.action.accessibleDiffViewer.prev","Go to Previous Difference"),category:ET,precondition:ae.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(e){const t=kg(e);t==null||t.accessibleDiffViewerPrev()}};Gv.id="editor.action.accessibleDiffViewer.prev";let O_=Gv;function XW(o,e,t){return o.get(es).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 kg(o){const t=o.get(es).listDiffEditors(),i=GD();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}en($W);en(IT);en(DT);ur.appendMenuItem(rt.EditorTitle,{command:{id:new DT().desc.id,title:w("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"))});ur.appendMenuItem(rt.EditorTitle,{command:{id:new IT().desc.id,title:w("showMoves","Show Moved Code Blocks"),icon:Zt.move,toggled:lA.create("config.diffEditor.experimental.showMoves",!0),precondition:ae.has("isInDiffEditor")},order:10,group:"1_diff",when:ae.has("isInDiffEditor")});en(vS);for(const o of[{icon:Zt.arrowRight,key:M.diffEditorInlineMode.toNegated()},{icon:Zt.discard,key:M.diffEditorInlineMode}])ur.appendMenuItem(rt.DiffEditorHunkToolbar,{command:{id:new vS().desc.id,title:w("revertHunk","Revert Block"),icon:o.icon},when:ae.and(M.diffEditorModifiedWritable,o.key),order:5,group:"primary"}),ur.appendMenuItem(rt.DiffEditorSelectionToolbar,{command:{id:new vS().desc.id,title:w("revertSelection","Revert Selection"),icon:o.icon},when:ae.and(M.diffEditorModifiedWritable,o.key),order:5,group:"primary"});en(qW);en(KW);en(GW);en(ZW);ur.appendMenuItem(rt.EditorTitle,{command:{id:Zf.id,title:w("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"))});mn.registerCommandAlias("editor.action.diffReview.next",Zf.id);en(Zf);mn.registerCommandAlias("editor.action.diffReview.prev",O_.id);en(O_);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)}},bS;const cw=new Pi("selectionAnchorSet",!1);var dd;let bc=(dd=class{static get(e){return e.getContribution(bS.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=cw.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(Ut.fromPositions(e,e),{description:"selection-anchor",stickiness:1,hoverMessage:new Rs().appendText(w("selectionAnchor","Selection Anchor")),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),gr(w("anchorSet","Anchor set at {0}:{1}",e.lineNumber,e.column))}}goToSelectionAnchor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);e&&this.editor.setPosition(e.getStartPosition())}}selectFromAnchorToCursor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);if(e){const t=this.editor.getPosition();this.editor.setSelection(Ut.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()}},bS=dd,dd.ID="editor.contrib.selectionAnchorController",dd);bc=bS=JW([QW(1,Hi)],bc);class e3 extends Se{constructor(){super({id:"editor.action.setSelectionAnchor",label:w("setSelectionAnchor","Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:ns(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:w("goToSelectionAnchor","Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:cw})}async run(e,t){var i;(i=bc.get(t))==null||i.goToSelectionAnchor()}}class i3 extends Se{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:w("selectFromAnchorToCursor","Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:cw,kbOpts:{kbExpr:M.editorTextFocus,primary:ns(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:w("cancelSelectionAnchor","Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:cw,kbOpts:{kbExpr:M.editorTextFocus,primary:9,weight:100}})}async run(e,t){var i;(i=bc.get(t))==null||i.cancelSelectionAnchor()}}vi(bc.ID,bc,4);ie(e3);ie(t3);ie(i3);ie(n3);const s3=mt("editorOverviewRuler.bracketMatchForeground","#A0A0A0",w("overviewRulerBracketMatchForeground","Overview ruler marker color for matching brackets."));class o3 extends Se{constructor(){super({id:"editor.action.jumpToBracket",label:w("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=ih.get(t))==null||i.jumpToBracket()}}class r3 extends Se{constructor(){super({id:"editor.action.selectToBracket",label:w("smartSelect.selectToBracket","Select to Bracket"),alias:"Select to Bracket",precondition:void 0,metadata:{description:St("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=ih.get(t))==null||s.selectToBracket(n)}}class a3 extends Se{constructor(){super({id:"editor.action.removeBrackets",label:w("smartSelect.removeBrackets","Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:2561,weight:100}})}run(e,t){var i;(i=ih.get(t))==null||i.removeBrackets(this.id)}}class l3{constructor(e,t,i){this.position=e,this.brackets=t,this.options=i}}const Nl=class Nl extends je{static get(e){return e.getContribution(Nl.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new ls(()=>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 Ut(r.lineNumber,r.column,r.lineNumber,r.column):new Ut(n.lineNumber,n.column,n.lineNumber,n.column)});this._editor.setSelections(t),this._editor.revealRange(t[0])}selectToBracket(e){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=[];this._editor.getSelections().forEach(n=>{const s=n.getStartPosition();let r=t.bracketPairs.matchBracket(s);if(!r&&(r=t.bracketPairs.findEnclosingBrackets(s),!r)){const h=t.bracketPairs.findNextBracket(s);h&&h.range&&(r=t.bracketPairs.matchBracket(h.range.getStartPosition()))}let a=null,c=null;if(r){r.sort(B.compareRangesUsingStarts);const[h,g]=r;if(a=e?h.getStartPosition():h.getEndPosition(),c=e?g.getEndPosition():g.getStartPosition(),g.containsPosition(s)){const f=a;a=c,c=f}}a&&c&&i.push(new Ut(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(Lt.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),y=Nl._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;!_&&this._matchBrackets==="always"&&(_=t.bracketPairs.findEnclosingBrackets(v,20),y=Nl._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),a[c++]=new l3(v,_,y)}}this._lastBracketsData=a,this._lastVersionId=i}};Nl.ID="editor.contrib.bracketMatchingController",Nl._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=xi.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:os(s3),position:wa.Center}}),Nl._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=xi.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"});let ih=Nl;vi(ih.ID,ih,1);ie(r3);ie(o3);ie(a3);ur.appendMenuItem(rt.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:w({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 B(i,n-1,i,n),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new B(i,s,i,s),a)}else{const r=new B(i,s,i,s+1),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new B(i,n,i,n),a)}}computeCursorState(e,t){return this._isMovingLeft?new Ut(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new Ut(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class PT 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 PT{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:w("caret.moveLeft","Move Selected Text Left"),alias:"Move Selected Text Left",precondition:M.writable})}}class h3 extends PT{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:w("caret.moveRight","Move Selected Text Right"),alias:"Move Selected Text Right",precondition:M.writable})}}ie(d3);ie(h3);class u3 extends Se{constructor(){super({id:"editor.action.transposeLetters",label:w("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():jw.rightPosition(i,r.getPosition().lineNumber,r.getPosition().column),f=jw.leftPosition(i,g),p=jw.leftPosition(i,f),v=i.getValueInRange(B.fromPositions(p,f)),_=i.getValueInRange(B.fromPositions(f,g)),y=B.fromPositions(p,g);n.push(new Tp(y,_+v))}n.length>0&&(t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop())}}ie(u3);const dw=(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 i1(o){return{asString:async()=>o,asFile:()=>{},value:typeof o=="string"?o:void 0}}function g3(o,e,t){const i={id:dw(),name:o,uri:e,data:t};return{asString:async()=>"",asFile:()=>i,value:void 0}}class TT{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 Ja.some(this,([i,n])=>n.asFile())&&t.push("files"),NT(F_(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 F_(e)}}function F_(o){return o.toLowerCase()}function MT(o,e){return NT(F_(o),e.map(F_))}function NT(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 hw=Object.freeze({create:o=>ZD(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",sg={};BW(sg,KD);var vT=(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))(vT||{}),bT=(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))(bT||{}),wT=(o=>(o[o.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",o[o.LineFeed=1]="LineFeed",o))(wT||{}),yT=(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))(yT||{}),ST=(o=>(o[o.Classic=1]="Classic",o[o.NodeJs=2]="NodeJs",o))(ST||{}),CT=class{constructor(o,e,t,i,n){this._onDidChange=new sg.Emitter,this._onDidExtraLibsChange=new sg.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,xT={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},LT=new CT({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},xT),kT=new CT({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},xT),jW=()=>lw().then(o=>o.getTypeScriptWorker()),UW=()=>lw().then(o=>o.getJavaScriptWorker());sg.languages.typescript={ModuleKind:vT,JsxEmit:bT,NewLineKind:wT,ScriptTarget:yT,ModuleResolutionKind:ST,typescriptVersion:VW,typescriptDefaults:LT,javascriptDefaults:kT,getTypeScriptWorker:jW,getJavaScriptWorker:UW};function lw(){return qD(()=>import("./tsMode-COmSRXCz.js"),__vite__mapDeps([3,1,2]))}sg.languages.onLanguage("typescript",()=>lw().then(o=>o.setupTypeScript(LT)));sg.languages.onLanguage("javascript",()=>lw().then(o=>o.setupJavaScript(kT)));class $W extends Qs{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:St("toggleCollapseUnchangedRegions","Toggle Collapse Unchanged Regions"),icon:Zt.map,toggled:ae.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:ae.has("isInDiffEditor"),menu:{when:ae.has("isInDiffEditor"),id:rt.EditorTitle,order:22,group:"navigation"}})}run(e,...t){const i=e.get(xn),n=!i.getValue("diffEditor.hideUnchangedRegions.enabled");i.updateValue("diffEditor.hideUnchangedRegions.enabled",n)}}class IT extends Qs{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:St("toggleShowMovedCodeBlocks","Toggle Show Moved Code Blocks"),precondition:ae.has("isInDiffEditor")})}run(e,...t){const i=e.get(xn),n=!i.getValue("diffEditor.experimental.showMoves");i.updateValue("diffEditor.experimental.showMoves",n)}}class DT extends Qs{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:St("toggleUseInlineViewWhenSpaceIsLimited","Toggle Use Inline View When Space Is Limited"),precondition:ae.has("isInDiffEditor")})}run(e,...t){const i=e.get(xn),n=!i.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");i.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",n)}}const Xp=St("diffEditor","Diff Editor");class qW extends Wr{constructor(){super({id:"diffEditor.switchSide",title:St("switchSide","Switch Side"),icon:Zt.arrowSwap,precondition:ae.has("isInDiffEditor"),f1:!0,category:Xp})}runEditorCommand(e,t,i){const n=kg(e);if(n instanceof Pp){if(i&&i.dryRun)return{destinationSelection:n.mapToOtherSide().destinationSelection};n.switchSide()}}}class KW extends Wr{constructor(){super({id:"diffEditor.exitCompareMove",title:St("exitCompareMove","Exit Compare Move"),icon:Zt.close,precondition:M.comparingMovedCode,f1:!1,category:Xp,keybinding:{weight:1e4,primary:9}})}runEditorCommand(e,t,...i){const n=kg(e);n instanceof Pp&&n.exitCompareMove()}}class GW extends Wr{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:St("collapseAllUnchangedRegions","Collapse All Unchanged Regions"),icon:Zt.fold,precondition:ae.has("isInDiffEditor"),f1:!0,category:Xp})}runEditorCommand(e,t,...i){const n=kg(e);n instanceof Pp&&n.collapseAllUnchangedRegions()}}class ZW extends Wr{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:St("showAllUnchangedRegions","Show All Unchanged Regions"),icon:Zt.unfold,precondition:ae.has("isInDiffEditor"),f1:!0,category:Xp})}runEditorCommand(e,t,...i){const n=kg(e);n instanceof Pp&&n.showAllUnchangedRegions()}}class vS extends Qs{constructor(){super({id:"diffEditor.revert",title:St("revert","Revert"),f1:!1,category:Xp})}run(e,t){const i=XW(e,t.originalUri,t.modifiedUri);i instanceof Pp&&i.revertRangeMappings(t.mapping.innerChanges??[])}}const ET=St("accessibleDiffViewer","Accessible Diff Viewer"),Kv=class Kv extends Qs{constructor(){super({id:Kv.id,title:St("editor.action.accessibleDiffViewer.next","Go to Next Difference"),category:ET,precondition:ae.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(e){const t=kg(e);t==null||t.accessibleDiffViewerNext()}};Kv.id="editor.action.accessibleDiffViewer.next";let Zf=Kv;const Gv=class Gv extends Qs{constructor(){super({id:Gv.id,title:St("editor.action.accessibleDiffViewer.prev","Go to Previous Difference"),category:ET,precondition:ae.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(e){const t=kg(e);t==null||t.accessibleDiffViewerPrev()}};Gv.id="editor.action.accessibleDiffViewer.prev";let O_=Gv;function XW(o,e,t){return o.get(es).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 kg(o){const t=o.get(es).listDiffEditors(),i=GD();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}en($W);en(IT);en(DT);ur.appendMenuItem(rt.EditorTitle,{command:{id:new DT().desc.id,title:w("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"))});ur.appendMenuItem(rt.EditorTitle,{command:{id:new IT().desc.id,title:w("showMoves","Show Moved Code Blocks"),icon:Zt.move,toggled:lA.create("config.diffEditor.experimental.showMoves",!0),precondition:ae.has("isInDiffEditor")},order:10,group:"1_diff",when:ae.has("isInDiffEditor")});en(vS);for(const o of[{icon:Zt.arrowRight,key:M.diffEditorInlineMode.toNegated()},{icon:Zt.discard,key:M.diffEditorInlineMode}])ur.appendMenuItem(rt.DiffEditorHunkToolbar,{command:{id:new vS().desc.id,title:w("revertHunk","Revert Block"),icon:o.icon},when:ae.and(M.diffEditorModifiedWritable,o.key),order:5,group:"primary"}),ur.appendMenuItem(rt.DiffEditorSelectionToolbar,{command:{id:new vS().desc.id,title:w("revertSelection","Revert Selection"),icon:o.icon},when:ae.and(M.diffEditorModifiedWritable,o.key),order:5,group:"primary"});en(qW);en(KW);en(GW);en(ZW);ur.appendMenuItem(rt.EditorTitle,{command:{id:Zf.id,title:w("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"))});mn.registerCommandAlias("editor.action.diffReview.next",Zf.id);en(Zf);mn.registerCommandAlias("editor.action.diffReview.prev",O_.id);en(O_);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)}},bS;const cw=new Pi("selectionAnchorSet",!1);var dd;let bc=(dd=class{static get(e){return e.getContribution(bS.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=cw.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(Ut.fromPositions(e,e),{description:"selection-anchor",stickiness:1,hoverMessage:new Rs().appendText(w("selectionAnchor","Selection Anchor")),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),gr(w("anchorSet","Anchor set at {0}:{1}",e.lineNumber,e.column))}}goToSelectionAnchor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);e&&this.editor.setPosition(e.getStartPosition())}}selectFromAnchorToCursor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);if(e){const t=this.editor.getPosition();this.editor.setSelection(Ut.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()}},bS=dd,dd.ID="editor.contrib.selectionAnchorController",dd);bc=bS=JW([QW(1,Hi)],bc);class e3 extends Se{constructor(){super({id:"editor.action.setSelectionAnchor",label:w("setSelectionAnchor","Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:ns(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:w("goToSelectionAnchor","Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:cw})}async run(e,t){var i;(i=bc.get(t))==null||i.goToSelectionAnchor()}}class i3 extends Se{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:w("selectFromAnchorToCursor","Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:cw,kbOpts:{kbExpr:M.editorTextFocus,primary:ns(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:w("cancelSelectionAnchor","Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:cw,kbOpts:{kbExpr:M.editorTextFocus,primary:9,weight:100}})}async run(e,t){var i;(i=bc.get(t))==null||i.cancelSelectionAnchor()}}vi(bc.ID,bc,4);ie(e3);ie(t3);ie(i3);ie(n3);const s3=mt("editorOverviewRuler.bracketMatchForeground","#A0A0A0",w("overviewRulerBracketMatchForeground","Overview ruler marker color for matching brackets."));class o3 extends Se{constructor(){super({id:"editor.action.jumpToBracket",label:w("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=ih.get(t))==null||i.jumpToBracket()}}class r3 extends Se{constructor(){super({id:"editor.action.selectToBracket",label:w("smartSelect.selectToBracket","Select to Bracket"),alias:"Select to Bracket",precondition:void 0,metadata:{description:St("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=ih.get(t))==null||s.selectToBracket(n)}}class a3 extends Se{constructor(){super({id:"editor.action.removeBrackets",label:w("smartSelect.removeBrackets","Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:M.editorTextFocus,primary:2561,weight:100}})}run(e,t){var i;(i=ih.get(t))==null||i.removeBrackets(this.id)}}class l3{constructor(e,t,i){this.position=e,this.brackets=t,this.options=i}}const Nl=class Nl extends je{static get(e){return e.getContribution(Nl.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new ls(()=>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 Ut(r.lineNumber,r.column,r.lineNumber,r.column):new Ut(n.lineNumber,n.column,n.lineNumber,n.column)});this._editor.setSelections(t),this._editor.revealRange(t[0])}selectToBracket(e){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=[];this._editor.getSelections().forEach(n=>{const s=n.getStartPosition();let r=t.bracketPairs.matchBracket(s);if(!r&&(r=t.bracketPairs.findEnclosingBrackets(s),!r)){const h=t.bracketPairs.findNextBracket(s);h&&h.range&&(r=t.bracketPairs.matchBracket(h.range.getStartPosition()))}let a=null,c=null;if(r){r.sort(B.compareRangesUsingStarts);const[h,g]=r;if(a=e?h.getStartPosition():h.getEndPosition(),c=e?g.getEndPosition():g.getStartPosition(),g.containsPosition(s)){const f=a;a=c,c=f}}a&&c&&i.push(new Ut(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(Lt.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),y=Nl._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;!_&&this._matchBrackets==="always"&&(_=t.bracketPairs.findEnclosingBrackets(v,20),y=Nl._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),a[c++]=new l3(v,_,y)}}this._lastBracketsData=a,this._lastVersionId=i}};Nl.ID="editor.contrib.bracketMatchingController",Nl._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=xi.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:os(s3),position:wa.Center}}),Nl._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=xi.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"});let ih=Nl;vi(ih.ID,ih,1);ie(r3);ie(o3);ie(a3);ur.appendMenuItem(rt.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:w({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 B(i,n-1,i,n),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new B(i,s,i,s),a)}else{const r=new B(i,s,i,s+1),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new B(i,n,i,n),a)}}computeCursorState(e,t){return this._isMovingLeft?new Ut(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new Ut(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class PT 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 PT{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:w("caret.moveLeft","Move Selected Text Left"),alias:"Move Selected Text Left",precondition:M.writable})}}class h3 extends PT{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:w("caret.moveRight","Move Selected Text Right"),alias:"Move Selected Text Right",precondition:M.writable})}}ie(d3);ie(h3);class u3 extends Se{constructor(){super({id:"editor.action.transposeLetters",label:w("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():jw.rightPosition(i,r.getPosition().lineNumber,r.getPosition().column),f=jw.leftPosition(i,g),p=jw.leftPosition(i,f),v=i.getValueInRange(B.fromPositions(p,f)),_=i.getValueInRange(B.fromPositions(f,g)),y=B.fromPositions(p,g);n.push(new Tp(y,_+v))}n.length>0&&(t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop())}}ie(u3);const dw=(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 i1(o){return{asString:async()=>o,asFile:()=>{},value:typeof o=="string"?o:void 0}}function g3(o,e,t){const i={id:dw(),name:o,uri:e,data:t};return{asString:async()=>"",asFile:()=>i,value:void 0}}class TT{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 Ja.some(this,([i,n])=>n.asFile())&&t.push("files"),NT(F_(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 F_(e)}}function F_(o){return o.toLowerCase()}function MT(o,e){return NT(F_(o),e.map(F_))}function NT(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 hw=Object.freeze({create:o=>ZD(o.map(e=>e.toString())).join(`\r
14
14
  `),split:o=>o.split(`\r
15
15
  `),parse:o=>hw.split(o).filter(e=>!e.startsWith("#"))}),sa=class sa{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+sa.sep)}intersects(e){return this.contains(e)||e.contains(this)}append(...e){return new sa((this.value?[this.value,...e]:e).join(sa.sep))}};sa.sep=".",sa.None=new sa("@@none@@"),sa.Empty=new sa("");let Cn=sa;const Ck={EDITORS:"CodeEditors",FILES:"CodeFiles"};class f3{}const p3={DragAndDropContribution:"workbench.contributions.dragAndDrop"};Br.add(p3.DragAndDropContribution,new f3);const Mf=class Mf{constructor(){}static getInstance(){return Mf.INSTANCE}hasData(e){return e&&e===this.proto}getData(e){if(this.hasData(e))return this.data}};Mf.INSTANCE=new Mf;let wS=Mf;function RT(o){const e=new TT;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,i1(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?sn.parse(o.path):void 0;return g3(o.name,e,async()=>new Uint8Array(await o.arrayBuffer()))}const _3=Object.freeze([Ck.EDITORS,Ck.FILES,Vy.RESOURCES,Vy.INTERNAL_URI_LIST]);function AT(o,e=!1){const t=RT(o),i=t.get(Vy.INTERNAL_URI_LIST);if(i)t.replace(vs.uriList,i);else if(e||!t.has(vs.uriList)){const n=[];for(const s of o.items){const r=s.getAsFile();if(r){const a=r.path;try{a?n.push(sn.file(a).toString()):n.push(sn.parse(r.name,!0).toString())}catch{}}}n.length&&t.replace(vs.uriList,i1(hw.create(n)))}for(const n of _3)t.delete(n);return t}var n1=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Xf=function(o,e){return function(t,i){e(t,i,o)}};class s1{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 Nf=class Nf extends s1{constructor(){super(...arguments),this.kind=Nf.kind,this.dropMimeTypes=[vs.text],this.pasteMimeTypes=[vs.text]}async getEdit(e,t){const i=e.get(vs.text);if(!i||e.has(vs.uriList))return;const n=await i.asString();return{handledMimeType:vs.text,title:w("text.label","Insert Plain Text"),insertText:n,kind:this.kind}}};Nf.id="text",Nf.kind=new Cn("text.plain");let nh=Nf;class OT extends s1{constructor(){super(...arguments),this.kind=new Cn("uri.absolute"),this.dropMimeTypes=[vs.uriList],this.pasteMimeTypes=[vs.uriList]}async getEdit(e,t){const i=await FT(e);if(!i.length||t.isCancellationRequested)return;let n=0;const s=i.map(({uri:a,originalText:c})=>a.scheme===Gs.file?a.fsPath:(n++,c)).join(" ");let r;return n>0?r=i.length>1?w("defaultDropProvider.uriList.uris","Insert Uris"):w("defaultDropProvider.uriList.uri","Insert Uri"):r=i.length>1?w("defaultDropProvider.uriList.paths","Insert Paths"):w("defaultDropProvider.uriList.path","Insert Path"),{handledMimeType:vs.uriList,insertText:s,title:r,kind:this.kind}}}let H_=class extends s1{constructor(e){super(),this._workspaceContextService=e,this.kind=new Cn("uri.relative"),this.dropMimeTypes=[vs.uriList],this.pasteMimeTypes=[vs.uriList]}async getEdit(e,t){const i=await FT(e);if(!i.length||t.isCancellationRequested)return;const n=sl(i.map(({uri:s})=>{const r=this._workspaceContextService.getWorkspaceFolder(s);return r?cA(r.uri,s):void 0}));if(n.length)return{handledMimeType:vs.uriList,insertText:n.join(" "),title:i.length>1?w("defaultDropProvider.uriList.relativePaths","Insert Relative Paths"):w("defaultDropProvider.uriList.relativePath","Insert Relative Path"),kind:this.kind}}};H_=n1([Xf(0,Vu)],H_);class v3{constructor(){this.kind=new Cn("html"),this.pasteMimeTypes=["text/html"],this._yieldTo=[{mimeType:vs.text}]}async provideDocumentPasteEdits(e,t,i,n,s){var c;if(n.triggerKind!==jy.PasteAs&&!((c=n.only)!=null&&c.contains(this.kind)))return;const r=i.get("text/html"),a=await(r==null?void 0:r.asString());if(!(!a||s.isCancellationRequested))return{dispose(){},edits:[{insertText:a,yieldTo:this._yieldTo,title:w("pasteHtmlLabel","Insert HTML"),kind:this.kind}]}}}async function FT(o){const e=o.get(vs.uriList);if(!e)return[];const t=await e.asString(),i=[];for(const n of hw.parse(t))try{i.push({uri:sn.parse(n),originalText:n})}catch{}return i}let yS=class extends je{constructor(e,t){super(),this._register(e.documentDropEditProvider.register("*",new nh)),this._register(e.documentDropEditProvider.register("*",new OT)),this._register(e.documentDropEditProvider.register("*",new H_(t)))}};yS=n1([Xf(0,kt),Xf(1,Vu)],yS);let SS=class extends je{constructor(e,t){super(),this._register(e.documentPasteEditProvider.register("*",new nh)),this._register(e.documentPasteEditProvider.register("*",new OT)),this._register(e.documentPasteEditProvider.register("*",new H_(t))),this._register(e.documentPasteEditProvider.register("*",new v3))}};SS=n1([Xf(0,kt),Xf(1,Vu)],SS);const Xo=class Xo{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=Xo._table[i],typeof n=="number")return this.pos+=1,{type:n,pos:e,len:1};if(Xo.isDigitCharacter(i)){n=8;do t+=1,i=this.value.charCodeAt(e+t);while(Xo.isDigitCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}if(Xo.isVariableCharacter(i)){n=9;do i=this.value.charCodeAt(e+ ++t);while(Xo.isVariableCharacter(i)||Xo.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 Xo._table[i]>"u"&&!Xo.isDigitCharacter(i)&&!Xo.isVariableCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}};Xo._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13};let CS=Xo;class Ig{constructor(){this._children=[]}appendChild(e){return e instanceof ao&&this._children[this._children.length-1]instanceof ao?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 Yp)return e;e=e.parent}}toString(){return this.children.reduce((e,t)=>e+t.toString(),"")}len(){return 0}}let ao=class HT extends Ig{constructor(e){super(),this.value=e}toString(){return this.value}len(){return this.value.length}clone(){return new HT(this.value)}};class WT extends Ig{}class Vo extends WT{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 Dg?this._children[0]:void 0}clone(){const e=new Vo(this.index);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}class Dg extends Ig{constructor(){super(...arguments),this.options=[]}appendChild(e){return e instanceof ao&&(e.parent=this,this.options.push(e)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const e=new Dg;return this.options.forEach(e.appendChild,e),e}}class o1 extends Ig{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 Ir&&!!s.elseValue)&&(n=this._replace([])),n}_replace(e){let t="";for(const i of this._children)if(i instanceof Ir){let n=e[i.index]||"";n=i.resolve(n),t+=n}else t+=i.toString();return t}toString(){return""}clone(){const e=new o1;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 Ir extends Ig{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 Ir(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class Yf extends WT{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 ao(t)],!0):!1}clone(){const e=new Yf(this.name);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}function xk(o,e){const t=[...o];for(;t.length>0;){const i=t.shift();if(!e(i))break;t.unshift(...i.children)}}class Yp extends Ig{get placeholderInfo(){if(!this._placeholders){const e=[];let t;this.walk(function(i){return i instanceof Vo&&(e.push(i),t=!t||t.index<i.index?i:t),!0}),this._placeholders={all:e,last:t}}return this._placeholders}get placeholders(){const{all:e}=this.placeholderInfo;return e}offset(e){let t=0,i=!1;return this.walk(n=>n===e?(i=!0,!1):(t+=n.len(),!0)),i?t:-1}fullLen(e){let t=0;return xk([e],i=>(t+=i.len(),!0)),t}enclosingPlaceholders(e){const t=[];let{parent:i}=e;for(;i;)i instanceof Vo&&t.push(i),i=i.parent;return t}resolveVariables(e){return this.walk(t=>(t instanceof Yf&&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 Yp;return this._children=this.children.map(t=>t.clone()),e}walk(e){xk(this.children,e)}}class sh{constructor(){this._scanner=new CS,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 Yp;return this.parseFragment(e,n),this.ensureFinalTabstop(n,i??!1,t??!1),n}parseFragment(e,t){const i=t.children.length;for(this._scanner.text(e),this._token=this._scanner.next();this._parse(t););const n=new Map,s=[];t.walk(c=>(c instanceof Vo&&(c.isFinalTabstop?n.set(0,void 0):!n.has(c.index)&&c.children.length>0?n.set(c.index,c.children):s.push(c)),!0));const r=(c,h)=>{const g=n.get(c.index);if(!g)return;const f=new Vo(c.index);f.transform=c.transform;for(const p of g){const v=p.clone();f.appendChild(v),v instanceof Vo&&n.has(v.index)&&!h.has(v.index)&&(h.add(v.index),r(v,h),h.delete(v.index))}t.replace(c,[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 Vo(0)))}_accept(e,t){if(e===void 0||this._token.type===e){const i=t?this._scanner.tokenText(this._token):!0;return this._token=this._scanner.next(),i}return!1}_backTo(e){return this._scanner.pos=e.pos+e.len,this._token=e,!1}_until(e){const t=this._token;for(;this._token.type!==e;){if(this._token.type===14)return!1;if(this._token.type===5){const n=this._scanner.next();if(n.type!==0&&n.type!==4&&n.type!==5)return!1}this._token=this._scanner.next()}const i=this._scanner.value.substring(t.pos,this._token.pos).replace(/\\(\$|}|\\)/g,"$1");return this._token=this._scanner.next(),i}_parse(e){return this._parseEscaped(e)||this._parseTabstopOrVariableName(e)||this._parseComplexPlaceholder(e)||this._parseComplexVariable(e)||this._parseAnything(e)}_parseEscaped(e){let t;return(t=this._accept(5,!0))?(t=this._accept(0,!0)||this._accept(4,!0)||this._accept(5,!0)||t,e.appendChild(new ao(t)),!0):!1}_parseTabstopOrVariableName(e){let t;const i=this._token;return this._accept(0)&&(t=this._accept(9,!0)||this._accept(8,!0))?(e.appendChild(/^\d+$/.test(t)?new Vo(Number(t)):new Yf(t)),!0):this._backTo(i)}_parseComplexPlaceholder(e){let t;const i=this._token;if(!(this._accept(0)&&this._accept(3)&&(t=this._accept(8,!0))))return this._backTo(i);const s=new Vo(Number(t));if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new ao("${"+t+":")),s.children.forEach(e.appendChild,e),!0}else if(s.index>0&&this._accept(7)){const r=new Dg;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 ao(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 Yf(t);if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new ao("${"+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 o1;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 ao(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 Ir(Number(n))),!0;if(!this._accept(1))return this._backTo(t),!1}else return e.appendChild(new Ir(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 Ir(Number(n),s)),!0)}else if(this._accept(11)){const s=this._until(4);if(s)return e.appendChild(new Ir(Number(n),void 0,s,void 0)),!0}else if(this._accept(12)){const s=this._until(4);if(s)return e.appendChild(new Ir(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 Ir(Number(n),void 0,s,r)),!0}}else{const s=this._until(4);if(s)return e.appendChild(new Ir(Number(n),void 0,void 0,s)),!0}return this._backTo(t),!1}_parseAnything(e){return this._token.type!==14?(e.appendChild(new ao(this._scanner.tokenText(this._token))),this._accept(void 0),!0):!1}}function BT(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"?sh.escape(t.insertText)+"$0":t.insertText.snippet,insertAsSnippet:!0})),...((n=t.additionalEdit)==null?void 0:n.edits)??[]]}}function zT(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},w3=function(o,e){return function(t,i){e(t,i,o)}};const y3=xi.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:XD,inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}}),Zv=class Zv extends je{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=pt(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=e;const t=pt("span.icon");this.domNode.append(t),t.classList.add(...qi.asClassNameArray(Zt.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(Fi(this.domNode,On.CLICK,n=>{this.delegate.cancel()}))}getId(){return Zv.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)}};Zv.baseId="editor.widget.inlineProgressWidget";let xS=Zv,W_=class extends je{constructor(e,t,i){super(),this.id=e,this._editor=t,this._instantiationService=i,this._showDelay=500,this._showPromise=this._register(new Do),this._currentWidget=this._register(new Do),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=Of(()=>{const a=B.fromPositions(e);this._currentDecorations.set([{range:a,options:y3}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(xS,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()}};W_=b3([w3(2,di)],W_);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},Lk=function(o,e){return function(t,i){e(t,i,o)}},o_,Ql;let co=(Ql=class{static get(e){return e.getContribution(o_.ID)}constructor(e,t,i){this._openerService=i,this._messageWidget=new Do,this._messageListeners=new ze,this._mouseOverMessage=!1,this._editor=e,this._visible=o_.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){gr(Gm(e)?e.value:e),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._message=Gm(e)?hA(e,{actionHandler:{callback:n=>{this.closeMessage(),uA(this._openerService,n,Gm(e)?e.isTrusted:void 0)},disposables:this._messageListeners}}):void 0,this._messageWidget.value=new kk(this._editor,t,typeof e=="string"?e:this._message.element),this._messageListeners.add(as.debounce(this._editor.onDidBlurEditorText,(n,s)=>s,0)(()=>{this._mouseOverMessage||this._messageWidget.value&&gA(GD(),this._messageWidget.value.getDomNode())||this.closeMessage()})),this._messageListeners.add(this._editor.onDidChangeCursorPosition(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidDispose(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidChangeModel(()=>this.closeMessage())),this._messageListeners.add(Fi(this._messageWidget.value.getDomNode(),On.MOUSE_ENTER,()=>this._mouseOverMessage=!0,!0)),this._messageListeners.add(Fi(this._messageWidget.value.getDomNode(),On.MOUSE_LEAVE,()=>this._mouseOverMessage=!1,!0));let i;this._messageListeners.add(this._editor.onMouseMove(n=>{n.target.position&&(i?i.containsPosition(n.target.position)||this.closeMessage():i=new B(t.lineNumber-3,1,n.target.position.lineNumber+3,1))}))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(kk.fadeOut(this._messageWidget.value))}},o_=Ql,Ql.ID="editor.contrib.messageController",Ql.MESSAGE_VISIBLE=new Pi("messageVisible",!1,w("messageVisible","Whether the editor is currently showing an inline message")),Ql);co=o_=S3([Lk(1,Hi),Lk(2,zr)],co);const C3=eo.bindToContribution(co.get);Pt(new C3({id:"leaveEditorMessage",precondition:co.MESSAGE_VISIBLE,handler:o=>o.closeMessage(),kbOpts:{weight:130,primary:9}}));let kk=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)}};vi(co.ID,co,4);function oy(o,e){return e&&(o.stack||o.stacktrace)?w("stackTrace.format","{0}: {1}",Dk(o),Ik(o.stack)||Ik(o.stacktrace)):Dk(o)}function Ik(o){return Array.isArray(o)?o.join(`
16
16
  `):o}function Dk(o){return o.code==="ERR_UNC_HOST_NOT_ALLOWED"?`${o.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`:typeof o.code=="string"&&typeof o.errno=="number"&&typeof o.syscall=="string"?w("nodeExceptionMessage","A system error occurred ({0})",o.message):o.message||w("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}function B_(o=null,e=!1){if(!o)return w("error.defaultMessage","An unknown error occurred. Please consult the log for more details.");if(Array.isArray(o)){const t=sl(o),i=B_(t[0],e);return t.length>1?w("error.moreErrors","{0} ({1} errors in total)",i,t.length):i}if(YD(o))return o;if(o.detail){const t=o.detail;if(t.error)return oy(t.error,e);if(t.exception)return oy(t.exception,e)}return o.stack?oy(o,e):o.message?o.message:w("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}var VT=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},yu=function(o,e){return function(t,i){e(t,i,o)}},LS,hd;let kS=(hd=class extends je{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(Sn(()=>this.visibleContext.reset())),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(Sn((()=>this.editor.removeContentWidget(this)))),this._register(this.editor.onDidChangeCursorPosition(f=>{s.containsPosition(f.position)||this.dispose()})),this._register(as.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=pt(".post-edit-widget"),this.button=this._register(new fA(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(Fi(this.domNode,On.CLICK,()=>this.showSelector()))}getId(){return LS.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){this._contextMenuService.showContextMenu({getAnchor:()=>{const e=Xs(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)}}))})}},LS=hd,hd.baseId="editor.widget.postEditWidget",hd);kS=LS=VT([yu(7,bg),yu(8,Hi),yu(9,ss)],kS);let z_=class extends je{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 Do),this._register(as.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,w("resolveError",`Error resolving edit '{0}':
@@ -222,4 +222,4 @@ declare const she: {
222
222
  `).trim())}}return K}function hi(A){return A.filter!==void 0||A.map!==void 0||A.reduce!==void 0}function zt(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 Rt=15;function Dt(A){return A.split(`
223
223
  `).length>Rt}function ii(A){const K=new Set(u(p));K.has(A)?K.delete(A):K.add(A),I(p,K,!0)}function mi(A,K){if(Zi(K))try{return Fv.highlight(A,{language:"javascript"}).value}catch{}return A.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function _n(A){return Dn.parse(A)}function Zi(A){return!A||A==="js"||A==="javascript"}function vn(A){navigator.clipboard.writeText(A).catch(()=>{})}async function En(){if(I(v,!0),!(u(_)||u(y))){I(y,!0),I(S,"");try{I(_,await dR(u(f)||u(h).model),!0)}catch(A){I(S,A.message,!0)}I(y,!1)}}function Vi(A){return A>=1e9?`${(A/1e9).toFixed(1)} GB`:A>=1e6?`${(A/1e6).toFixed(0)} MB`:`${A} B`}function qn(A){const K=A.match(/\.([^.]+)$/);return K?K[1].toUpperCase():"?"}function dn(A){switch(A){case"SH":case"BASH":return"$";case"MD":case"MARKDOWN":return"↓";case"JSON":case"JSONC":return"{}";default:return A}}function Ln(A){I(X,u(X).filter((K,Me)=>Me!==A),!0)}function Wn(){Ue.click()}async function hn(A){if(!(!A||A.length===0))for(const K of Array.from(A)){const Me=await K.text();I(X,[...u(X),{name:K.name,content:Me}],!0)}}function Kn(A){const K=A.target;hn(K.files),K.value=""}function Fn(A){var K;A.preventDefault(),I(Pe,!1),hn(((K=A.dataTransfer)==null?void 0:K.files)??null)}function Hn(A){var K;(K=A.dataTransfer)!=null&&K.types.includes("Files")&&(A.preventDefault(),I(Pe,!0))}function Bn(){I(Pe,!1)}async function un(){const A=u(r).trim();if(!(!A||u(a))){I(r,""),I(c,""),I(a,!0),I(n,[...u(n),{role:"user",content:A}],!0),D=new AbortController,I(ve,[],!0);try{await uR({messages:u(n),currentView:u(de),context:u(Qt),modelOverride:u(f)||void 0,extraFiles:u(X).length>0?u(X):void 0},K=>{I(s,(u(s)??"")+K)},D.signal,K=>{I(ve,[...u(ve),K],!0)}),I(n,[...u(n),{role:"assistant",content:u(s)??"",toolEvents:u(ve).length>0?[...u(ve)]:void 0}],!0),I(ve,[],!0)}catch(K){if(K.name==="AbortError"){const Me=u(s);Me!=null&&Me.trim()&&I(n,[...u(n),{role:"assistant",content:Me+`
224
224
 
225
- *[stopped]*`,toolEvents:u(ve).length>0?[...u(ve)]:void 0}],!0)}else I(c,K.message,!0)}finally{D=null,I(s,null),I(ve,[],!0),I(a,!1)}}}function Ki(){D==null||D.abort()}function Ti(A){A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),un())}function Ge(){I(n,[],!0),I(c,"")}const Mt=["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 gi(A){I(r,A,!0),Xt==null||Xt.focus()}var Li=N9(),Ci=bt(Li),on=x(Ci),ki=C(x(on),2);{var jn=A=>{var K=YG(),Me=x(K);{var ye=Ce=>{var oe=Fr();Z(()=>q(oe,`${u(h).provider??""} · ${(u(f)||u(h).model)??""}`)),T(Ce,oe)},De=Ce=>{var oe=Fr("Not configured");T(Ce,oe)};$(Me,Ce=>{u(Ft)?Ce(ye):Ce(De,-1)})}Z(()=>Rn(K,"title",`Provider: ${u(h).provider??""}`)),T(A,K)};$(ki,A=>{u(h)&&A(jn)})}var Pn=C(ki,2);{var Xn=A=>{var K=JG();ne("click",K,Ge),T(A,K)};$(Pn,A=>{u(n).length>0&&A(Xn)})}var Tn=C(on,2),rn=x(Tn);{var Be=A=>{var K=QG();T(A,K)},G=A=>{var K=i9(),Me=x(K),ye=x(Me);{var De=it=>{var qe=e9(),Ee=C(bt(qe)),Et=x(Ee);Z(()=>q(Et,t().id)),T(it,qe)},Ce=it=>{var qe=Fr("No view selected. Ask a general sheDB view question.");T(it,qe)};$(ye,it=>{t()?it(De):it(Ce,-1)})}var oe=C(Me,2);_i(oe,17,()=>Mt,Nn,(it,qe)=>{var Ee=t9(),Et=x(Ee);Z(()=>q(Et,u(qe))),ne("click",Ee,()=>gi(u(qe))),T(it,Ee)}),T(A,K)};$(rn,A=>{u(Ft)?u(n).length===0&&u(s)===null&&A(G,1):A(Be)})}var Ae=C(rn,2);_i(Ae,17,()=>u(n),Nn,(A,K,Me)=>{var ye=l9(),De=x(ye);{var Ce=it=>{var qe=n9(),Ee=x(qe);Z(()=>q(Ee,u(K).content)),T(it,qe)},oe=it=>{const qe=st(()=>Oe(u(K).content)),Ee=st(()=>Nt(u(qe)));var Et=a9(),We=bt(Et);{var H=ft=>{var we=FD();_i(we,21,()=>u(K).toolEvents,Nn,(vt,ut)=>{var he=Ts(),wt=bt(he);{var Xe=le=>{var me=AD(),Je=C(x(me)),Ht=x(Je);Z(ge=>q(Ht,ge),[()=>u(ut).name.replace(/_/g," ")]),T(le,me)},Le=le=>{var me=OD(),Je=C(x(me)),Ht=x(Je);Z(ge=>q(Ht,ge),[()=>u(ut).name.replace(/_/g," ")]),T(le,me)};$(wt,le=>{u(ut).type==="tool_call"?le(Xe):le(Le,-1)})}T(vt,he)}),T(ft,we)};$(We,ft=>{var we;(we=u(K).toolEvents)!=null&&we.length&&ft(H)})}var Q=C(We,2),xe=x(Q);_i(xe,17,()=>u(qe),Nn,(ft,we,vt)=>{var ut=Ts(),he=bt(ut);{var wt=Le=>{var le=HD();jl(le,()=>_n(u(we).text),!0),T(Le,le)},Xe=Le=>{const le=st(()=>`${Me}:${vt}`),me=st(()=>Dt(u(we).text)),Je=st(()=>u(p).has(u(le))),Ht=st(()=>u(we).lang==="filter");var ge=o9(),Ke=x(ge),gt=x(Ke),yt=x(gt),Qe=C(gt,2),li=x(Qe),Jt=C(Ke,2);let Un;var tn=x(Jt),ri=x(tn);jl(ri,()=>mi(u(we).text,u(we).lang??""),!0);var Vt=C(tn,2);{var an=ci=>{var bn=s9(),Xi=x(bn);Z(()=>q(Xi,u(Je)?"▲ collapse":"▼ expand")),ne("click",bn,()=>ii(u(le))),T(ci,bn)};$(Vt,ci=>{u(me)&&ci(an)})}Z(()=>{q(yt,u(Ht)?"filter":u(we).lang),Un=jt(Jt,1,"code-body svelte-1twuiul",null,Un,{collapsed:u(me)&&!u(Je)})}),ne("click",li,()=>vn(u(we).text)),T(Le,ge)};$(he,Le=>{u(we).type==="text"?Le(wt):Le(Xe,-1)})}T(ft,ut)});var Ze=C(xe,2);{var et=ft=>{var we=r9(),vt=x(we),ut=x(vt);Z(he=>q(ut,he),[()=>zt(u(Ee))]),ne("click",vt,()=>e.onApplyView(u(Ee))),T(ft,we)},nt=st(()=>hi(u(Ee))&&e.onApplyView);$(Ze,ft=>{u(nt)&&ft(et)})}T(it,Et)};$(De,it=>{u(K).role==="user"?it(Ce):it(oe,-1)})}Z(()=>jt(ye,1,`message ${u(K).role??""}`,"svelte-1twuiul")),T(A,ye)});var ct=C(Ae,2);{var dt=A=>{var K=FD();_i(K,21,()=>u(ve),Nn,(Me,ye)=>{var De=Ts(),Ce=bt(De);{var oe=qe=>{var Ee=AD(),Et=C(x(Ee)),We=x(Et);Z(H=>q(We,H),[()=>u(ye).name.replace(/_/g," ")]),T(qe,Ee)},it=qe=>{var Ee=OD(),Et=C(x(Ee)),We=x(Et);Z(H=>q(We,H),[()=>u(ye).name.replace(/_/g," ")]),T(qe,Ee)};$(Ce,qe=>{u(ye).type==="tool_call"?qe(oe):qe(it,-1)})}T(Me,De)}),T(A,K)};$(ct,A=>{u(ve).length>0&&A(dt)})}var Wt=C(ct,2);{var O=A=>{var K=c9(),Me=x(K),ye=x(Me),De=x(ye);Z(()=>q(De,N[u(E)])),T(A,K)};$(Wt,A=>{u(a)&&u(s)===null&&u(ve).length===0&&A(O)})}var se=C(Wt,2);{var be=A=>{var K=h9(),Me=x(K);_i(Me,21,()=>Ye(u(s)),Nn,(ye,De)=>{var Ce=Ts(),oe=bt(Ce);{var it=Ee=>{var Et=HD();jl(Et,()=>_n(u(De).text),!0),T(Ee,Et)},qe=Ee=>{var Et=d9(),We=x(Et),H=x(We),Q=x(H),xe=C(We,2),Ze=x(xe);jl(Ze,()=>mi(u(De).text,u(De).lang??""),!0),Z(()=>q(Q,u(De).lang)),T(Ee,Et)};$(oe,Ee=>{u(De).type==="text"?Ee(it):Ee(qe,-1)})}T(ye,Ce)}),T(A,K)};$(se,A=>{u(s)!==null&&A(be)})}bs(Tn,A=>Ct=A,()=>Ct);var j=C(Tn,2);{var pe=A=>{var K=u9(),Me=x(K);Z(()=>q(Me,u(c))),T(A,K)};$(j,A=>{u(c)&&A(pe)})}var Fe=C(j,2),ke=x(Fe),Ne=x(ke),Te=C(ke,2),Tt=x(Te),ht=C(Te,2),Ie=x(ht),At=C(ht,2),ni=x(At),qt=C(Fe,2),$t=x(qt);{var ti=A=>{var K=g9();let Me;var ye=C(x(K),2),De=x(ye),Ce=C(ye,2),oe=x(Ce);Z(()=>{Me=jt(K,1,"file-chip svelte-1twuiul",null,Me,{inactive:!u(ue)}),q(De,t().id),Rn(Ce,"title",u(ue)?"Remove from context":"Re-add to context"),q(oe,u(ue)?"×":"+")}),ne("click",Ce,()=>I(ue,!u(ue))),T(A,K)};$($t,A=>{t()&&A(ti)})}var J=C($t,2);_i(J,17,()=>u(X),Nn,(A,K,Me)=>{const ye=st(()=>qn(u(K).name));var De=f9(),Ce=x(De),oe=x(Ce),it=C(Ce,2),qe=x(it),Ee=C(it,2);Z((Et,We)=>{jt(Ce,1,`badge badge-${Et??""}`,"svelte-1twuiul"),q(oe,We),q(qe,u(K).name)},[()=>u(ye).toLowerCase(),()=>dn(u(ye))]),ne("click",Ee,()=>Ln(Me)),T(A,De)});var _e=C(J,2),$e=C(_e,2);bs($e,A=>Ue=A,()=>Ue);var tt=C(qt,2);let It;var He=x(tt);let ot;var Yt=x(He);bs(Yt,A=>Xt=A,()=>Xt);var ai=C(He,2);{var si=A=>{var K=p9();ne("click",K,Ki),T(A,K)},ji=A=>{var K=m9();Z(Me=>K.disabled=Me,[()=>!u(r).trim()||!u(Ft)]),ne("click",K,un),T(A,K)};$(ai,A=>{u(a)?A(si):A(ji,-1)})}var kn=C(tt,2);{var Mi=A=>{var K=y9(),Me=x(K),ye=x(Me),De=C(Me,2);{var Ce=Ee=>{var Et=v9();_i(Et,21,()=>u(g),Nn,(We,H)=>{var Q=_9(),xe=x(Q),Ze={};Z(()=>{q(xe,u(H)),Ze!==(Ze=u(H))&&(Q.value=(Q.__value=u(H))??"")}),T(We,Q)}),Z(()=>Et.disabled=u(a)),ga(Et,()=>u(f),We=>I(f,We)),T(Ee,Et)},oe=Ee=>{var Et=b9(),We=x(Et);Z(()=>q(We,u(f)||u(h).model)),T(Ee,Et)};$(De,Ee=>{u(g).length>0?Ee(Ce):Ee(oe,-1)})}var it=C(De,2);{var qe=Ee=>{var Et=w9();ne("click",Et,En),T(Ee,Et)};$(it,Ee=>{u(h).provider==="ollama"&&Ee(qe)})}Z(()=>q(ye,u(h).provider)),T(A,K)};$(kn,A=>{u(Ft)&&u(h)&&A(Mi)})}var oi=C(Ci,2);{var Wi=A=>{var K=M9(),Me=x(K),ye=x(Me),De=x(ye),Ce=x(De),oe=C(De,2),it=C(ye,2),qe=x(it);{var Ee=H=>{var Q=S9();T(H,Q)},Et=H=>{var Q=C9(),xe=x(Q);Z(()=>q(xe,u(S))),T(H,Q)},We=H=>{var Q=T9(),xe=x(Q);{var Ze=Le=>{var le=x9(),me=C(bt(le)),Je=x(me);Z(()=>q(Je,u(_).version)),T(Le,le)};$(xe,Le=>{u(_).version&&Le(Ze)})}var et=C(xe,2);{var nt=Le=>{var le=L9(),me=C(bt(le)),Je=x(me);Z(()=>q(Je,u(_).details.family)),T(Le,le)};$(et,Le=>{var le;(le=u(_).details)!=null&&le.family&&Le(nt)})}var ft=C(et,2);{var we=Le=>{var le=k9(),me=C(bt(le)),Je=x(me);Z(()=>q(Je,u(_).details.parameter_size)),T(Le,le)};$(ft,Le=>{var le;(le=u(_).details)!=null&&le.parameter_size&&Le(we)})}var vt=C(ft,2);{var ut=Le=>{var le=I9(),me=C(bt(le)),Je=x(me);Z(()=>q(Je,u(_).details.quantization_level)),T(Le,le)};$(vt,Le=>{var le;(le=u(_).details)!=null&&le.quantization_level&&Le(ut)})}var he=C(vt,2);{var wt=Le=>{var le=E9(),me=C(bt(le),2);_i(me,21,()=>u(_).running,Nn,(Je,Ht)=>{var ge=D9(),Ke=x(ge);Z(gt=>q(Ke,`${u(Ht).name??""} · ${gt??""} VRAM`),[()=>Vi(u(Ht).size_vram)]),T(Je,ge)}),T(Le,le)},Xe=Le=>{var le=P9();T(Le,le)};$(he,Le=>{u(_).running&&u(_).running.length>0?Le(wt):u(_).running!==null&&Le(Xe,1)})}T(H,Q)};$(qe,H=>{u(y)?H(Ee):u(S)?H(Et,1):u(_)&&H(We,2)})}Z(()=>{var H;return q(Ce,`Ollama · ${(u(f)||((H=u(h))==null?void 0:H.model))??""}`)}),ne("click",K,()=>I(v,!1)),ne("click",Me,H=>H.stopPropagation()),ne("click",oe,()=>I(v,!1)),T(A,K)};$(oi,A=>{u(v)&&A(Wi)})}Z(A=>{q(ni,A),It=jt(tt,1,"input-row svelte-1twuiul",null,It,{"drag-over":u(Pe)}),ot=jt(He,1,"textarea-wrap svelte-1twuiul",null,ot,{loading:u(a)}),Rn(Yt,"placeholder",u(Ft)?"Ask anything… (Enter to send, Shift+Enter for newline, drag & drop files to add context)":"AI not configured"),Yt.disabled=u(a)||!u(Ft)},[()=>Vi(u(ei))]),Es(Ne,()=>u(V),A=>I(V,A)),Es(Tt,()=>u(F),A=>I(F,A)),Es(Ie,()=>u(Y),A=>I(Y,A)),ne("click",_e,Wn),ne("change",$e,Kn),is("dragover",tt,Hn),is("dragleave",tt,Bn),is("drop",tt,Fn),ne("keydown",Yt,Ti),Ei(Yt,()=>u(r),A=>I(r,A)),T(o,Li),To()}_r(["click","change","keydown"]);var A9=R('<div class="me svelte-1pxdb1"></div>');function By(o,e){Po(e,!0);let t=ng(e,"value",15,""),i=ng(e,"language",3,"javascript"),n,s,r=!1;vr(()=>{const c=i()==="json"?{formatOnPaste:!0,autoIndent:"full"}:{};s=Wa.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())})}),aw(()=>s==null?void 0:s.dispose()),Mn(()=>{!s||s.getValue()===t()||(r=!0,s.setValue(t()),r=!1)});var a=A9();bs(a,c=>n=c,()=>n),T(o,a),To()}var O9=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 &mdash; call <code class="svelte-rrt0o">emit(value)</code> to add to result.</div> <div class="welcome-links svelte-rrt0o"><a href="https://github.com/hobbyquaker/she/blob/main/doc/db/README.md" target="_blank" rel="noopener" class="svelte-rrt0o">sheDB docs</a> <span class="svelte-rrt0o">·</span> <a href="https://github.com/hobbyquaker/she/blob/main/doc/db/view-examples.md" target="_blank" rel="noopener" class="svelte-rrt0o">View examples</a> <span class="svelte-rrt0o">·</span> <a href="https://github.com/hobbyquaker/she" target="_blank" rel="noopener" class="svelte-rrt0o">GitHub</a></div></div></div>',1),F9=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>'),WD=R('<div class="form-error svelte-rrt0o"> </div>'),H9=R('<div class="new-item-form svelte-rrt0o"><input placeholder="device/lamp1" class="svelte-rrt0o"/> <button class="svelte-rrt0o">Create</button></div> <!>',1),BD=R("<li> </li>"),zD=R('<div class="error-bar svelte-rrt0o"> </div>'),VD=R('<div class="loading svelte-rrt0o">Loading…</div>'),W9=R('<div class="monaco-doc-wrap svelte-rrt0o"><!></div>'),B9=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),z9=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>'),V9=R('<div class="new-item-form svelte-rrt0o"><input placeholder="myView" class="svelte-rrt0o"/> <button class="svelte-rrt0o">Create</button></div> <!>',1),j9=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>'),U9=R('<span class="badge-error svelte-rrt0o">error</span>'),$9=R('<span class="badge-ok svelte-rrt0o"> </span>'),q9=R('<pre class="result-error svelte-rrt0o"> </pre>'),K9=R('<pre class="result-json svelte-rrt0o"> </pre>'),G9=R('<div class="view-result svelte-rrt0o"><div class="result-header svelte-rrt0o">Result <!></div> <!></div>'),Z9=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 &nbsp;·&nbsp; call <code>emit(this)</code> to include in result</span></div> <div class="monaco-view-wrap monaco-view-wrap--map svelte-rrt0o"><!></div></div> <div class="view-section svelte-rrt0o"><div class="section-title svelte-rrt0o">Reduce <span class="section-hint svelte-rrt0o">— receives <code>result</code> array, must <code>return</code> new value (optional)</span></div> <div class="monaco-view-wrap monaco-view-wrap--reduce svelte-rrt0o"><!></div></div> <div class="view-section view-section--options svelte-rrt0o"><label class="opt-check svelte-rrt0o"><input type="checkbox" class="svelte-rrt0o"/> <span class="checkmark svelte-rrt0o"></span> Publish to MQTT <span class="section-hint svelte-rrt0o">— publish view to MQTT topic <code> </code></span></label> <!></div> <!></div>'),X9=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),Y9=R('<div class="chat-resize-handle svelte-rrt0o" role="separator"></div> <div class="chat-pane svelte-rrt0o"><!></div>',1),J9=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>'),Q9=R('<div class="db-root svelte-rrt0o" role="presentation"><div class="panel-tabs svelte-rrt0o"><button>Documents</button> <button>Views</button> <!></div> <!></div>');function eZ(o,e){Po(e,!0);const t=Be=>{var G=O9(),Ae=bt(G);bs(Mg(Ae,{}),ct=>dn=ct,()=>dn),T(Be,G)};let i=z(wi([])),n=z(null),s=z("{}"),r=z(!1),a=z(null);const c="she-db-selected-view";let h=z(wi([])),g=z(wi(localStorage.getItem(c))),f=z("#"),p=z("// emit(this.someProperty)"),v=z(""),_=z(""),y=z(!1),S=z(!1),D=z(null),E=z(!1),N=z(null),V=z("she/db/view/");const F="she-db-panel";let Y=z(wi(localStorage.getItem(F)??"docs")),X=z(""),ue=z(!1),Pe=z(null),Ue=z(""),ve=z(!1),at=z(null);const Xt="she-db-sidebar-width";let Ct=z(wi(parseInt(localStorage.getItem(Xt)??"220",10))),Qt=!1,Ft=0,ei=0;const de="she-db-chat-width",xt="she-db-chat-open";let Oe=z(localStorage.getItem(xt)==="true"),Ye=z(wi(parseInt(localStorage.getItem(de)??"320",10))),Nt=!1,hi=0,zt=0;const Rt=st(()=>u(g)?{id:u(g),filter:u(f),map:u(p),reduce:u(v)}:null);function Dt(Be){Be.filter!==void 0&&I(f,Be.filter,!0),Be.map!==void 0&&I(p,Be.map,!0),Be.reduce!==void 0&&I(v,Be.reduce,!0)}Mn(()=>{localStorage.setItem(xt,String(u(Oe)))}),Mn(()=>{localStorage.setItem(F,u(Y))}),Mn(()=>{u(g)?localStorage.setItem(c,u(g)):localStorage.removeItem(c)});function ii(Be){Qt=!0,Ft=Be.clientX,ei=u(Ct),Be.preventDefault()}function mi(Be){Qt&&I(Ct,Math.max(140,Math.min(500,ei+Be.clientX-Ft)),!0),Nt&&I(Ye,Math.max(240,Math.min(600,zt-(Be.clientX-hi))),!0)}function _n(){Qt&&(Qt=!1,localStorage.setItem(Xt,String(u(Ct)))),Nt&&(Nt=!1,localStorage.setItem(de,String(u(Ye))))}function Zi(Be){Nt=!0,hi=Be.clientX,zt=u(Ye),Be.preventDefault()}async function vn(){try{I(i,await sR(),!0)}catch{}}async function En(){try{I(h,await oR(),!0)}catch{}}async function Vi(Be){I(n,Be,!0),I(a,null),I(r,!0);try{const G=await n8(Be);I(s,JSON.stringify(G,null,2),!0)}catch(G){I(a,G instanceof Error?G.message:String(G),!0)}finally{I(r,!1)}}async function qn(){if(u(n)){I(a,null);try{const Be=JSON.parse(u(s));await dD(u(n),Be)}catch(Be){I(a,Be instanceof Error?Be.message:String(Be),!0)}}}let dn;async function Ln(){if(u(n)&&await dn.show(`Delete document "${u(n)}"?`,{confirm:"Delete",danger:!0}))try{await s8(u(n)),I(n,null),I(s,"{}")}catch(Be){I(a,Be instanceof Error?Be.message:String(Be),!0)}}async function Wn(){const Be=u(X).trim();if(Be){I(Pe,null);try{await dD(Be,{}),I(ue,!1),I(X,""),await Vi(Be)}catch(G){I(Pe,G instanceof Error?G.message:String(G),!0)}}}async function hn(Be){I(g,Be,!0),I(N,null),I(E,!0),I(D,null);try{const G=await o8(Be);I(f,G.filter??"",!0),I(p,G.map,!0),I(v,G.reduce??"",!0),I(_,G.description??"",!0),I(y,G.mqttpub??!1,!0),I(S,G.retain??!1,!0),I(D,await Hy(Be).catch(()=>null),!0)}catch(G){I(N,G instanceof Error?G.message:String(G),!0)}finally{I(E,!1)}}async function Kn(){if(u(g)){I(N,null);try{const Be={map:u(p)};u(f).trim()&&(Be.filter=u(f).trim()),u(v).trim()&&(Be.reduce=u(v).trim()),u(_).trim()&&(Be.description=u(_).trim()),u(y)&&(Be.mqttpub=!0),u(S)&&(Be.retain=!0),await hD(u(g),Be)}catch(Be){I(N,Be instanceof Error?Be.message:String(Be),!0)}}}async function Fn(){if(u(g))try{I(D,await Hy(u(g)),!0)}catch(Be){I(N,Be instanceof Error?Be.message:String(Be),!0)}}async function Hn(){if(u(g)&&await dn.show(`Delete view "${u(g)}"?`,{confirm:"Delete",danger:!0}))try{await r8(u(g)),I(g,null),I(f,""),I(p,"// emit(this.someProperty)"),I(v,""),I(_,""),I(y,!1),I(S,!1),I(D,null)}catch(Be){I(N,Be instanceof Error?Be.message:String(Be),!0)}}async function Bn(){if(!u(Ue).trim())return;const Be=u(Ue).trim();I(at,null);try{await hD(Be,{map:"// emit(this.someProperty)"}),I(ve,!1),I(Ue,""),await En(),await hn(Be)}catch(G){I(at,G instanceof Error?G.message:String(G),!0)}}let un=z(""),Ki=z(""),Ti=st(()=>[...u(i)].filter(Be=>!u(un)||Be.toLowerCase().includes(u(un).toLowerCase())).sort()),Ge=st(()=>[...u(h)].filter(Be=>!u(Ki)||Be.toLowerCase().includes(u(Ki).toLowerCase())).sort());vr(()=>{vn(),En().then(()=>{u(g)&&u(h).includes(u(g))?hn(u(g)):I(g,null)}),G1().then(dt=>{const Wt=dt.dbPrefix||"she/db/",O=Wt.endsWith("/")?Wt:Wt+"/";I(V,O+"view/")}).catch(()=>{});const Be=Gl("db:ids",dt=>{I(i,dt.ids??[],!0)}),G=Gl("db:viewIds",dt=>{I(h,dt.ids??[],!0)}),Ae=Gl("db:change",async dt=>{const Wt=dt.id;u(n)===Wt&&(dt.doc===null?(I(n,null),I(s,"{}")):I(s,JSON.stringify(dt.doc,null,2),!0))}),ct=Gl("db:viewUpdate",async dt=>{const Wt=dt.id;u(g)===Wt&&I(D,await Hy(Wt).catch(()=>null),!0)});return()=>{Be(),G(),Ae(),ct()}});var Mt=Q9(),gi=x(Mt),Li=x(gi);let Ci;var on=C(Li,2);let ki;var jn=C(on,2);{var Pn=Be=>{var G=F9();let Ae;Z(()=>{Ae=jt(G,1,"ai-toggle svelte-rrt0o",null,Ae,{"ai-open":u(Oe)}),Rn(G,"title",u(Oe)?"Close AI assistant":"Open AI assistant")}),ne("click",G,()=>I(Oe,!u(Oe))),T(Be,G)};$(jn,Be=>{u(Y)==="views"&&Be(Pn)})}var Xn=C(gi,2);{var Tn=Be=>{var G=z9(),Ae=x(G);let ct;var dt=x(Ae),Wt=x(dt),O=C(dt,2);{var se=ht=>{var Ie=H9(),At=bt(Ie),ni=x(At),qt=C(ni,2),$t=C(At,2);{var ti=J=>{var _e=WD(),$e=x(_e);Z(()=>q($e,u(Pe))),T(J,_e)};$($t,J=>{u(Pe)&&J(ti)})}ne("keydown",ni,J=>J.key==="Enter"&&Wn()),Ei(ni,()=>u(X),J=>I(X,J)),ne("click",qt,Wn),T(ht,Ie)};$(O,ht=>{u(ue)&&ht(se)})}var be=C(O,2),j=x(be),pe=C(be,2);_i(pe,20,()=>u(Ti),ht=>ht,(ht,Ie)=>{var At=BD();let ni;var qt=x(At);Z(()=>{ni=jt(At,1,"flat-item svelte-rrt0o",null,ni,{"active-item":u(n)===Ie}),q(qt,Ie)}),ne("click",At,()=>Vi(Ie)),T(ht,At)});var Fe=C(Ae,2),ke=C(Fe,2),Ne=x(ke);{var Te=ht=>{var Ie=B9(),At=bt(Ie),ni=x(At),qt=x(ni),$t=C(ni,2),ti=C($t,2),J=C(At,2);{var _e=He=>{var ot=zD(),Yt=x(ot);Z(()=>q(Yt,u(a))),T(He,ot)};$(J,He=>{u(a)&&He(_e)})}var $e=C(J,2);{var tt=He=>{var ot=VD();T(He,ot)},It=He=>{var ot=W9(),Yt=x(ot);By(Yt,{language:"json",get value(){return u(s)},set value(ai){I(s,ai,!0)}}),T(He,ot)};$($e,He=>{u(r)?He(tt):He(It,-1)})}Z(()=>q(qt,u(n))),ne("click",$t,qn),ne("click",ti,Ln),T(ht,Ie)},Tt=ht=>{t(ht)};$(Ne,ht=>{u(n)?ht(Te):ht(Tt,-1)})}Z(()=>ct=jo(Ae,"",ct,{width:`${u(Ct)??""}px`})),ne("click",Wt,()=>{I(ue,!u(ue)),I(Pe,null)}),Ei(j,()=>u(un),ht=>I(un,ht)),ne("mousedown",Fe,ii),T(Be,G)},rn=Be=>{var G=J9(),Ae=x(G);let ct;var dt=x(Ae),Wt=x(dt),O=C(dt,2);{var se=At=>{var ni=V9(),qt=bt(ni),$t=x(qt),ti=C($t,2),J=C(qt,2);{var _e=$e=>{var tt=WD(),It=x(tt);Z(()=>q(It,u(at))),T($e,tt)};$(J,$e=>{u(at)&&$e(_e)})}ne("keydown",$t,$e=>$e.key==="Enter"&&Bn()),Ei($t,()=>u(Ue),$e=>I(Ue,$e)),ne("click",ti,Bn),T(At,ni)};$(O,At=>{u(ve)&&At(se)})}var be=C(O,2),j=x(be),pe=C(be,2);_i(pe,20,()=>u(Ge),At=>At,(At,ni)=>{var qt=BD();let $t;var ti=x(qt);Z(()=>{$t=jt(qt,1,"flat-item svelte-rrt0o",null,$t,{"active-item":u(g)===ni}),q(ti,ni)}),ne("click",qt,()=>hn(ni)),T(At,qt)});var Fe=C(Ae,2),ke=C(Fe,2),Ne=x(ke);{var Te=At=>{var ni=X9(),qt=bt(ni),$t=x(qt),ti=x($t),J=C($t,2),_e=C(J,2),$e=C(_e,2),tt=C(qt,2);{var It=ai=>{var si=zD(),ji=x(si);Z(()=>q(ji,u(N))),T(ai,si)};$(tt,ai=>{u(N)&&ai(It)})}var He=C(tt,2);{var ot=ai=>{var si=VD();T(ai,si)},Yt=ai=>{var si=Z9(),ji=x(si),kn=C(x(ji),2),Mi=x(kn),oi=C(ji,2),Wi=C(x(oi),2),A=x(Wi),K=C(oi,2),Me=C(x(K),2),ye=x(Me);By(ye,{language:"javascript",get value(){return u(p)},set value(nt){I(p,nt,!0)}});var De=C(K,2),Ce=C(x(De),2),oe=x(Ce);By(oe,{language:"javascript",get value(){return u(v)},set value(nt){I(v,nt,!0)}});var it=C(De,2),qe=x(it),Ee=x(qe),Et=C(Ee,4),We=C(x(Et)),H=x(We),Q=C(qe,2);{var xe=nt=>{var ft=j9(),we=x(ft);Es(we,()=>u(S),vt=>I(S,vt)),T(nt,ft)};$(Q,nt=>{u(y)&&nt(xe)})}var Ze=C(it,2);{var et=nt=>{var ft=G9(),we=x(ft),vt=C(x(we));{var ut=le=>{var me=U9();T(le,me)},he=le=>{var me=$9(),Je=x(me);Z(()=>q(Je,`${u(D).length??0??""} items · rev ${u(D)._rev??""}`)),T(le,me)};$(vt,le=>{u(D).error?le(ut):le(he,-1)})}var wt=C(we,2);{var Xe=le=>{var me=q9(),Je=x(me);Z(()=>q(Je,u(D).error)),T(le,me)},Le=le=>{var me=K9(),Je=x(me);Z(Ht=>q(Je,Ht),[()=>JSON.stringify(u(D).result,null,2)]),T(le,me)};$(wt,le=>{u(D).error?le(Xe):le(Le,-1)})}T(nt,ft)};$(Ze,nt=>{u(D)&&nt(et)})}Z(()=>q(H,`${u(V)??""}${u(g)??""} on every update`)),Ei(Mi,()=>u(_),nt=>I(_,nt)),Ei(A,()=>u(f),nt=>I(f,nt)),Es(Ee,()=>u(y),nt=>I(y,nt)),T(ai,si)};$(He,ai=>{u(E)?ai(ot):ai(Yt,-1)})}Z(()=>q(ti,u(g))),ne("click",J,Kn),ne("click",_e,Fn),ne("click",$e,Hn),T(At,ni)},Tt=At=>{t(At)};$(Ne,At=>{u(g)?At(Te):At(Tt,-1)})}var ht=C(ke,2);{var Ie=At=>{var ni=Y9(),qt=bt(ni),$t=C(qt,2);let ti;var J=x($t);R9(J,{get currentView(){return u(Rt)},onApplyView:Dt}),Z(()=>ti=jo($t,"",ti,{width:`${u(Ye)??""}px`})),ne("mousedown",qt,Zi),T(At,ni)};$(ht,At=>{u(Oe)&&At(Ie)})}Z(()=>ct=jo(Ae,"",ct,{width:`${u(Ct)??""}px`})),ne("click",Wt,()=>{I(ve,!u(ve)),I(at,null)}),Ei(j,()=>u(Ki),At=>I(Ki,At)),ne("mousedown",Fe,ii),T(Be,G)};$(Xn,Be=>{u(Y)==="docs"?Be(Tn):Be(rn,-1)})}Z(()=>{Ci=jt(Li,1,"svelte-rrt0o",null,Ci,{active:u(Y)==="docs"}),ki=jt(on,1,"svelte-rrt0o",null,ki,{active:u(Y)==="views"})}),ne("mousemove",Mt,mi),ne("mouseup",Mt,_n),is("mouseleave",Mt,_n),ne("click",Li,()=>I(Y,"docs")),ne("click",on,()=>I(Y,"views")),T(o,Mt),To()}_r(["mousemove","mouseup","click","keydown","mousedown"]);var tZ=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),iZ=R('<label class="svelte-1ua3isv">Pairing Code / QR <input type="text" placeholder="MT:..." class="svelte-1ua3isv"/></label>'),jD=R('<p class="err svelte-1ua3isv"> </p>'),nZ=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>'),sZ=R('<span class="device-name svelte-1ua3isv"> </span> <span class="device-nodeid svelte-1ua3isv"> </span>',1),oZ=R('<span class="device-name svelte-1ua3isv"> </span>'),rZ=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>'),aZ=R('<li class="empty svelte-1ua3isv">No paired devices</li>'),lZ=R('<p class="info svelte-1ua3isv">Loading…</p>'),cZ=R('<p class="device-subtitle svelte-1ua3isv"> </p>'),dZ=R('<span class="ep-chip svelte-1ua3isv"> </span>'),hZ=R('<span class="attr-id svelte-1ua3isv"> </span>'),uZ=R('<button class="attr-action-btn svelte-1ua3isv"> </button>'),gZ=R('<div class="attr-actions svelte-1ua3isv"></div>'),fZ=R('<span class="cmd-sep svelte-1ua3isv">,</span>'),pZ=R('<span class="cmd-name svelte-1ua3isv"> </span><span class="cmd-id svelte-1ua3isv"> </span>',1),mZ=R('<span class="cmd-id svelte-1ua3isv"> </span>'),_Z=R("<!> <!>",1),vZ=R('<span class="cmd-list svelte-1ua3isv"></span>'),bZ=R(' <span class="cmd-id svelte-1ua3isv"> </span>',1),wZ=R('<tr class="svelte-1ua3isv"><td class="svelte-1ua3isv"><!></td><td class="svelte-1ua3isv"> </td></tr>'),yZ=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>'),SZ=R('<th class="svelte-1ua3isv"> </th>'),CZ=R('<td class="svelte-1ua3isv"> </td>'),xZ=R('<tr class="svelte-1ua3isv"></tr>'),LZ=R('<table class="attr-arr-table svelte-1ua3isv"><thead class="svelte-1ua3isv"><tr class="svelte-1ua3isv"></tr></thead><tbody class="svelte-1ua3isv"></tbody></table>'),kZ=R('<tr class="svelte-1ua3isv"><td class="attr-obj-key svelte-1ua3isv"> </td><td class="attr-obj-val svelte-1ua3isv"> </td></tr>'),IZ=R('<table class="attr-obj-table svelte-1ua3isv"><tbody class="svelte-1ua3isv"></tbody></table>'),DZ=R('<a class="attr-link svelte-1ua3isv" target="_blank" rel="noopener noreferrer"> </a>'),EZ=R('<span class="attr-val svelte-1ua3isv"> </span>'),PZ=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>'),TZ=R('<tr class="cluster-hdr-row svelte-1ua3isv"><td colspan="3" class="cluster-hdr-cell svelte-1ua3isv"> </td></tr> <!>',1),MZ=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>'),NZ=R('<p class="no-clusters svelte-1ua3isv">No clusters</p>'),RZ=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>'),AZ=R('<div class="detail-hdr svelte-1ua3isv"><h2 class="svelte-1ua3isv"> </h2> <!> <p class="detail-nodeid svelte-1ua3isv"> </p></div> <!>',1),OZ=R('<p class="info svelte-1ua3isv">Select a device to view its endpoints.</p>'),FZ=R('<span class="stream-badge svelte-1ua3isv"> </span>'),HZ=R('<span class="stream-empty svelte-1ua3isv">Waiting for events…</span>'),zy=R('&nbsp;<span class="e-sub svelte-1ua3isv"> </span>',1),WZ=R('<span class="e-badge e-badge-status svelte-1ua3isv">status</span> <span class="e-node svelte-1ua3isv"> <!></span> <span> </span>',1),BZ=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),zZ=R('<div class="er svelte-1ua3isv"><span class="e-ts svelte-1ua3isv"> </span> <!></div>'),VZ=R('<div class="stream-body svelte-1ua3isv"><!></div>'),jZ=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 UZ(o,e){Po(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(G,Ae,ct,dt,Wt){try{await b8(G,Ae,ct,dt,Wt)}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(G,Ae){const ct=n[G];return Ae.map(dt=>{const Wt=typeof dt=="number"?dt:Number(dt);return{id:Wt,name:(ct==null?void 0:ct[Wt])??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(G){return"0x"+G.toString(16).toUpperCase().padStart(4,"0")}let g=z(wi([])),f=wi(new Map);function p(G){if(G==null)return"—";if(typeof G=="boolean"||typeof G=="number")return String(G);if(typeof G=="string")return G.length>50?G.slice(0,47)+"…":G;const Ae=JSON.stringify(G);return Ae.length>60?Ae.slice(0,57)+"…":Ae}function v(G){return G==null?"—":typeof G=="boolean"||typeof G=="number"?String(G):typeof G=="string"?G:JSON.stringify(G)}function _(G){return G!==null&&typeof G=="object"&&!Array.isArray(G)}function y(G){return Array.isArray(G)&&G.length>0&&G.every(_)}function S(G,Ae){return!!(Ae==="attributeList"||Array.isArray(G)&&G.length===0||_(G)&&Object.keys(G).length===0)}function D(G){return new Date(G).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}const E=500,N=20,V=32;let F=0,Y=z(wi([])),X=z(!0),ue=z(180),Pe=st(()=>{const G=Math.max(1,Math.floor((u(ue)-V)/N)+1);return u(Y).slice(0,G)});function Ue(G){G.preventDefault();const Ae=G.clientY,ct=u(ue);function dt(O){I(ue,Math.max(60,Math.min(600,ct+Ae-O.clientY)),!0)}function Wt(){document.removeEventListener("mousemove",dt),document.removeEventListener("mouseup",Wt)}document.addEventListener("mousemove",dt),document.addEventListener("mouseup",Wt)}let ve=z(null),at=z(!1),Xt=z(null),Ct=z(!1),Qt=z("passcode"),Ft=z(""),ei=z(""),de=z(""),xt=z(!1),Oe=z(null),Ye=z("");const Nt="she:matter:selectedNodeId";async function hi(){try{I(g,await rR(),!0);for(const G of u(g))v_(G.nodeId).then(Ae=>{f.set(G.nodeId,Ae)}).catch(()=>{});if(u(g).length>0&&!u(ve)){const G=localStorage.getItem(Nt),Ae=G&&u(g).find(ct=>ct.nodeId===G)?G:u(g)[0].nodeId;zt(Ae)}}catch{I(g,[],!0)}}async function zt(G){I(at,!0),I(Xt,null);try{I(ve,await v_(G),!0),f.set(G,u(ve)),localStorage.setItem(Nt,G)}catch(Ae){I(Xt,Ae instanceof Error?Ae.message:String(Ae),!0)}finally{I(at,!1)}}let Rt;async function Dt(G){var Ae;if(await Rt.show(`Unpair device ${G}?`,{confirm:"Unpair",danger:!0}))try{await v8(G),((Ae=u(ve))==null?void 0:Ae.nodeId)===G&&I(ve,null),await hi()}catch(ct){I(Xt,ct instanceof Error?ct.message:String(ct),!0)}}async function ii(){I(xt,!0),I(Oe,null);try{let G;u(Qt)==="passcode"?(G={passcode:Number(u(Ft))},u(ei)&&(G={...G,discriminator:Number(u(ei))})):G={pairingCode:u(de).trim()},u(Ye).trim()&&(G={...G,discoveryAddress:u(Ye).trim()}),await _8(G),I(Ct,!1),I(Ft,""),I(ei,""),I(de,""),I(Ye,""),await hi()}catch(G){I(Oe,G instanceof Error?G.message:String(G),!0)}finally{I(xt,!1)}}vr(()=>{hi()});const mi=Gl("matter:deviceList",G=>{if(!Array.isArray(G.devices))return;const Ae=G.devices;for(const ct of Ae)f.has(ct.nodeId)||v_(ct.nodeId).then(dt=>{f.set(ct.nodeId,dt)}).catch(()=>{});I(g,Ae,!0)}),_n=Gl("matter:deviceStatus",G=>{if(G.nodeId===void 0)return;const Ae=String(G.nodeId),ct=!!G.online;I(g,u(g).map(dt=>dt.nodeId===Ae?{...dt,online:ct}:dt),!0),I(Y,[{id:F++,kind:"status",nodeId:Ae,online:ct,ts:Date.now()},...u(Y).slice(0,E-1)],!0)}),Zi=Gl("matter:attr",G=>{const Ae=String(G.nodeId),ct=G.endpointId,dt=String(G.clusterName),Wt=String(G.attrName),O=G.value;if(u(ve)&&u(ve).nodeId===Ae){const be=u(ve).endpoints.find(pe=>pe.endpointId===ct),j=be==null?void 0:be.clusters.find(pe=>pe.name===dt);j&&(j.attrs[Wt]=O)}const se=f.get(Ae);if(se){const be=se.endpoints.find(pe=>pe.endpointId===ct),j=be==null?void 0:be.clusters.find(pe=>pe.name===dt);j&&(j.attrs[Wt]=O)}I(Y,[{id:F++,kind:"attr",nodeId:Ae,endpointId:ct,clusterName:dt,attrName:Wt,value:O,ts:G.ts??Date.now()},...u(Y).slice(0,E-1)],!0)});aw(()=>{mi(),_n(),Zi()});var vn=jZ(),En=bt(vn);bs(Mg(En,{}),G=>Rt=G,()=>Rt);var Vi=C(En,2),qn=x(Vi),dn=x(qn),Ln=x(dn),Wn=C(x(Ln),2),hn=C(Ln,2);{var Kn=G=>{var Ae=nZ(),ct=x(Ae),dt=x(ct);let Wt;var O=C(dt,2);let se;var be=C(ct,2);{var j=Ie=>{var At=tZ(),ni=bt(At),qt=C(x(ni)),$t=C(ni,2),ti=C(x($t));Ei(qt,()=>u(Ft),J=>I(Ft,J)),Ei(ti,()=>u(ei),J=>I(ei,J)),T(Ie,At)},pe=Ie=>{var At=iZ(),ni=C(x(At));Ei(ni,()=>u(de),qt=>I(de,qt)),T(Ie,At)};$(be,Ie=>{u(Qt)==="passcode"?Ie(j):Ie(pe,-1)})}var Fe=C(be,2),ke=C(x(Fe)),Ne=C(Fe,2);{var Te=Ie=>{var At=jD(),ni=x(At);Z(()=>q(ni,u(Oe))),T(Ie,At)};$(Ne,Ie=>{u(Oe)&&Ie(Te)})}var Tt=C(Ne,2),ht=x(Tt);Z(()=>{Wt=jt(dt,1,"svelte-1ua3isv",null,Wt,{active:u(Qt)==="passcode"}),se=jt(O,1,"svelte-1ua3isv",null,se,{active:u(Qt)==="pairingCode"}),Tt.disabled=u(xt),q(ht,u(xt)?"Commissioning…":"Commission")}),ne("click",dt,()=>I(Qt,"passcode")),ne("click",O,()=>I(Qt,"pairingCode")),Ei(ke,()=>u(Ye),Ie=>I(Ye,Ie)),ne("click",Tt,ii),T(G,Ae)};$(hn,G=>{u(Ct)&&G(Kn)})}var Fn=C(hn,2),Hn=x(Fn);_i(Hn,17,()=>u(g),G=>G.nodeId,(G,Ae)=>{var ct=rZ();let dt;var Wt=x(ct),O=x(Wt);let se;var be=C(O,2),j=x(be);{var pe=Ne=>{var Te=sZ(),Tt=bt(Te),ht=x(Tt),Ie=C(Tt,2),At=x(Ie);Z(()=>{q(ht,u(Ae).name),q(At,`#${u(Ae).nodeId??""}`)}),T(Ne,Te)},Fe=Ne=>{var Te=oZ(),Tt=x(Te);Z(()=>q(Tt,`Node ${u(Ae).nodeId??""}`)),T(Ne,Te)};$(j,Ne=>{u(Ae).name?Ne(pe):Ne(Fe,-1)})}var ke=C(Wt,2);Z(()=>{var Ne;dt=jt(ct,1,"svelte-1ua3isv",null,dt,{selected:((Ne=u(ve))==null?void 0:Ne.nodeId)===u(Ae).nodeId}),se=jt(O,1,"status-dot svelte-1ua3isv",null,se,{online:u(Ae).online})}),ne("click",Wt,()=>zt(u(Ae).nodeId)),ne("click",ke,()=>Dt(u(Ae).nodeId)),T(G,ct)});var Bn=C(Hn,2);{var un=G=>{var Ae=aZ();T(G,Ae)};$(Bn,G=>{u(g).length===0&&G(un)})}var Ki=C(dn,2),Ti=x(Ki);{var Ge=G=>{var Ae=lZ();T(G,Ae)},Mt=G=>{var Ae=jD(),ct=x(Ae);Z(()=>q(ct,u(Xt))),T(G,Ae)},gi=G=>{var Ae=AZ(),ct=bt(Ae),dt=x(ct),Wt=x(dt),O=C(dt,2);{var se=Fe=>{var ke=cZ(),Ne=x(ke);Z(()=>q(Ne,u(ve).subtitle)),T(Fe,ke)};$(O,Fe=>{u(ve).subtitle&&Fe(se)})}var be=C(O,2),j=x(be),pe=C(ct,2);_i(pe,17,()=>u(ve).endpoints,Fe=>Fe.endpointId,(Fe,ke)=>{var Ne=RZ(),Te=x(Ne),Tt=x(Te),ht=C(Tt),Ie=x(ht),At=C(ht,2);_i(At,21,()=>u(ke).clusters,Nn,(ti,J)=>{var _e=dZ(),$e=x(_e);Z(()=>q($e,u(J).name)),T(ti,_e)});var ni=C(Te,2);{var qt=ti=>{var J=MZ(),_e=C(x(J));_i(_e,21,()=>u(ke).clusters,Nn,($e,tt)=>{var It=TZ(),He=bt(It),ot=x(He),Yt=x(ot),ai=C(He,2);_i(ai,17,()=>Object.entries(u(tt).attrs),Nn,(si,ji)=>{var kn=st(()=>dk(u(ji),2));let Mi=()=>u(kn)[0],oi=()=>u(kn)[1];var Wi=Ts(),A=bt(Wi);{var K=ye=>{const De=st(()=>{var me;return(me=t[u(tt).name])==null?void 0:me[Mi()]}),Ce=st(()=>(Mi()==="acceptedCommandList"||Mi()==="generatedCommandList")&&Array.isArray(oi())),oe=st(()=>{var me;return((me=c[u(tt).name])==null?void 0:me[Mi()])??a[Mi()]});var it=PZ(),qe=x(it),Ee=x(qe),Et=x(Ee),We=C(Ee);{var H=me=>{var Je=hZ(),Ht=x(Je);Z(ge=>q(Ht,`(${ge??""})`),[()=>h(u(oe))]),T(me,Je)};$(We,me=>{u(oe)!==void 0&&me(H)})}var Q=C(qe),xe=x(Q);{var Ze=me=>{var Je=gZ();_i(Je,21,()=>u(De),Nn,(Ht,ge)=>{var Ke=uZ(),gt=x(Ke);Z(()=>q(gt,u(ge).label)),ne("click",Ke,()=>i(u(ve).nodeId,u(ke).endpointId,u(tt).name,u(ge).command,u(ge).args)),T(Ht,Ke)}),T(me,Je)};$(xe,me=>{u(De)&&me(Ze)})}var et=C(Q),nt=x(et);{var ft=me=>{var Je=vZ();_i(Je,21,()=>s(u(tt).name,oi()),Nn,(Ht,ge,Ke)=>{var gt=_Z(),yt=bt(gt);{var Qe=tn=>{var ri=fZ();T(tn,ri)};$(yt,tn=>{Ke>0&&tn(Qe)})}var li=C(yt,2);{var Jt=tn=>{var ri=pZ(),Vt=bt(ri),an=x(Vt),ci=C(Vt),bn=x(ci);Z(()=>{q(an,u(ge).name),q(bn,`(${u(ge).id??""})`)}),T(tn,ri)},Un=tn=>{var ri=mZ(),Vt=x(ri);Z(()=>q(Vt,u(ge).id)),T(tn,ri)};$(li,tn=>{u(ge).name?tn(Jt):tn(Un,-1)})}T(Ht,gt)}),T(me,Je)},we=me=>{var Je=yZ(),Ht=C(x(Je));_i(Ht,21,oi,Nn,(ge,Ke)=>{const gt=st(()=>u(Ke)),yt=st(()=>u(gt).deviceType),Qe=st(()=>r[u(yt)]);var li=wZ(),Jt=x(li),Un=x(Jt);{var tn=ci=>{var bn=bZ(),Xi=bt(bn),ys=C(Xi),Mo=x(ys);Z(qr=>{q(Xi,`${u(Qe)??""} `),q(Mo,`(${qr??""})`)},[()=>h(u(yt))]),T(ci,bn)},ri=ci=>{var bn=Fr();Z(Xi=>q(bn,Xi),[()=>h(u(yt))]),T(ci,bn)};$(Un,ci=>{u(Qe)?ci(tn):ci(ri,-1)})}var Vt=C(Jt),an=x(Vt);Z(ci=>q(an,ci),[()=>v(u(gt).revision)]),T(ge,li)}),T(me,Je)},vt=st(()=>Mi()==="deviceTypeList"&&Array.isArray(oi())),ut=me=>{const Je=st(()=>[...new Set(oi().flatMap(yt=>Object.keys(yt)))]);var Ht=LZ(),ge=x(Ht),Ke=x(ge);_i(Ke,21,()=>u(Je),Nn,(yt,Qe)=>{var li=SZ(),Jt=x(li);Z(()=>q(Jt,u(Qe))),T(yt,li)});var gt=C(ge);_i(gt,21,oi,Nn,(yt,Qe)=>{var li=xZ();_i(li,21,()=>u(Je),Nn,(Jt,Un)=>{var tn=CZ(),ri=x(tn);Z(Vt=>q(ri,Vt),[()=>v(u(Qe)[u(Un)])]),T(Jt,tn)}),T(yt,li)}),T(me,Ht)},he=st(()=>y(oi())),wt=me=>{var Je=IZ(),Ht=x(Je);_i(Ht,21,()=>Object.entries(oi()),Nn,(ge,Ke)=>{var gt=st(()=>dk(u(Ke),2));let yt=()=>u(gt)[0],Qe=()=>u(gt)[1];var li=kZ(),Jt=x(li),Un=x(Jt),tn=C(Jt),ri=x(tn);Z(Vt=>{q(Un,yt()),q(ri,Vt)},[()=>v(Qe())]),T(ge,li)}),T(me,Je)},Xe=st(()=>_(oi())),Le=me=>{var Je=DZ(),Ht=x(Je);Z(()=>{Rn(Je,"href",oi()),q(Ht,oi())}),T(me,Je)},le=me=>{var Je=EZ(),Ht=x(Je);Z(ge=>q(Ht,ge),[()=>v(oi())]),T(me,Je)};$(nt,me=>{u(Ce)?me(ft):u(vt)?me(we,1):u(he)?me(ut,2):u(Xe)?me(wt,3):(Mi()==="productUrl"||Mi()==="productURL")&&typeof oi()=="string"?me(Le,4):me(le,-1)})}Z(()=>{Rn(qe,"title",Mi()),q(Et,Mi())}),T(ye,it)},Me=st(()=>!S(oi(),Mi()));$(A,ye=>{u(Me)&&ye(K)})}T(si,Wi)}),Z(()=>q(Yt,u(tt).name)),T($e,It)}),T(ti,J)},$t=ti=>{var J=NZ();T(ti,J)};$(ni,ti=>{u(ke).clusters.length>0?ti(qt):ti($t,-1)})}Z(()=>{q(Tt,`${u(ke).name??`Endpoint ${u(ke).endpointId}`??""} `),q(Ie,`ep${u(ke).endpointId??""}`)}),T(Fe,Ne)}),Z(()=>{q(Wt,u(ve).name??`Node ${u(ve).nodeId}`),q(j,`Node ID: ${u(ve).nodeId??""}`)}),T(G,Ae)},Li=G=>{var Ae=OZ();T(G,Ae)};$(Ti,G=>{u(at)?G(Ge):u(Xt)?G(Mt,1):u(ve)?G(gi,2):G(Li,-1)})}var Ci=C(qn,2),on=x(Ci),ki=C(on,2),jn=C(x(ki),2);{var Pn=G=>{var Ae=FZ(),ct=x(Ae);Z(()=>q(ct,u(Y).length)),T(G,Ae)};$(jn,G=>{!u(X)&&u(Y).length>0&&G(Pn)})}var Xn=C(jn,2),Tn=x(Xn),rn=C(ki,2);{var Be=G=>{var Ae=VZ(),ct=x(Ae);{var dt=O=>{var se=HZ();T(O,se)},Wt=O=>{var se=Ts(),be=bt(se);_i(be,17,()=>u(Pe),j=>j.id,(j,pe)=>{const Fe=st(()=>{var qt,$t;return((qt=f.get(u(pe).nodeId))==null?void 0:qt.name)??(($t=u(g).find(ti=>ti.nodeId===u(pe).nodeId))==null?void 0:$t.name)??null}),ke=st(()=>{var qt,$t;return u(pe).endpointId!==void 0?(($t=(qt=f.get(u(pe).nodeId))==null?void 0:qt.endpoints.find(ti=>ti.endpointId===u(pe).endpointId))==null?void 0:$t.name)??null:null}),Ne=st(()=>u(pe).attrName??u(pe).clusterName);var Te=zZ(),Tt=x(Te),ht=x(Tt),Ie=C(Tt,2);{var At=qt=>{var $t=WZ(),ti=C(bt($t),2),J=x(ti),_e=C(J);{var $e=ot=>{var Yt=zy(),ai=C(bt(Yt)),si=x(ai);Z(()=>q(si,`(#${u(pe).nodeId??""})`)),T(ot,Yt)};$(_e,ot=>{u(Fe)&&ot($e)})}var tt=C(ti,2);let It;var He=x(tt);Z(()=>{q(J,u(Fe)??`#${u(pe).nodeId}`),It=jt(tt,1,"e-val svelte-1ua3isv",null,It,{"e-online":u(pe).online,"e-offline":!u(pe).online}),q(He,u(pe).online?"online":"offline")}),T(qt,$t)},ni=qt=>{var $t=BZ(),ti=C(bt($t),2),J=x(ti),_e=C(J);{var $e=oi=>{var Wi=zy(),A=C(bt(Wi)),K=x(A);Z(()=>q(K,`(#${u(pe).nodeId??""})`)),T(oi,Wi)};$(_e,oi=>{u(Fe)&&oi($e)})}var tt=C(ti,2),It=x(tt),He=C(It);{var ot=oi=>{var Wi=zy(),A=C(bt(Wi)),K=x(A);Z(()=>q(K,`(ep ${u(pe).endpointId??""})`)),T(oi,Wi)};$(He,oi=>{u(ke)&&oi(ot)})}var Yt=C(tt,2),ai=x(Yt),si=C(Yt,2),ji=x(si),kn=C(si,2),Mi=x(kn);Z(oi=>{q(J,u(Fe)??`#${u(pe).nodeId}`),q(It,u(ke)??`ep${u(pe).endpointId}`),q(ai,u(pe).clusterName),q(ji,u(Ne)),q(Mi,oi)},[()=>p(u(pe).value)]),T(qt,$t)};$(Ie,qt=>{u(pe).kind==="status"?qt(At):qt(ni,-1)})}Z(qt=>q(ht,qt),[()=>D(u(pe).ts)]),T(j,Te)}),T(O,se)};$(ct,O=>{u(Pe).length===0?O(dt):O(Wt,-1)})}T(G,Ae)};$(rn,G=>{u(X)&&G(Be)})}Z(()=>{jo(Ci,u(X)?`height: ${u(ue)}px;`:""),q(Tn,u(X)?"▾":"▸")}),ne("click",Wn,()=>I(Ct,!u(Ct))),ne("mousedown",on,Ue),ne("click",Xn,()=>{I(X,!u(X))}),T(o,vn),To()}_r(["click","mousedown"]);var $Z=R("<button>›</button>"),qZ=R('<span class="chev-ph svelte-1vejtrc"></span>'),KZ=R('<span class="tv svelte-1vejtrc"> </span> <span class="tt svelte-1vejtrc"> </span>',1),GZ=R('<div class="tc svelte-1vejtrc"></div>'),ZZ=R('<div class="tn svelte-1vejtrc"><div><!> <span class="seg svelte-1vejtrc"> </span> <!></div> <!></div>'),XZ=R("<option></option>"),YZ=R('<span class="pub-ok svelte-1vejtrc">✓</span>'),JZ=R('<span class="pub-err svelte-1vejtrc"> </span>'),QZ=R('<div class="info svelte-1vejtrc">Loading…</div>'),eX=R('<div class="info err svelte-1vejtrc"> </div>'),tX=R('<div class="info svelte-1vejtrc">No topics match.</div>'),iX=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>'),nX=R('<div class="vs svelte-1vejtrc"><div><div class="vrows-abs svelte-1vejtrc"></div></div></div>'),sX=R('<div class="info svelte-1vejtrc">No topics yet.</div>'),oX=R('<div class="tree-wrap svelte-1vejtrc"><!></div>'),rX=R('<span class="stream-badge"> </span>'),aX=R('<span class="stream-empty svelte-1vejtrc">Waiting for messages…</span>'),lX=R('<span class="s-ret svelte-1vejtrc" title="retained snapshot">&#x229B;</span>'),cX=R('<div><span class="s-ts svelte-1vejtrc"> </span> <!> <span class="s-topic svelte-1vejtrc"> </span> <span class="s-val svelte-1vejtrc"> </span></div>'),dX=R('<div class="stream-body svelte-1vejtrc"><!></div>'),hX=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),uX=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>'),gX=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),fX=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 pX(o,e){Po(e,!0);const t=(J,_e=iw)=>{const $e=st(()=>u(f).has(_e().path)),tt=st(()=>u(a)>=0&&_e().children.size>0),It=st(()=>u(a)>=0&&_e().isLeaf&&!n.has(_e().path));var He=ZZ(),ot=x(He);let Yt;var ai=x(ot);{var si=ye=>{var De=$Z();let Ce;Z(()=>{Ce=jt(De,1,"chev svelte-1vejtrc",null,Ce,{open:u($e)}),Rn(De,"aria-label",u($e)?"Collapse":"Expand")}),ne("click",De,()=>p(_e().path)),T(ye,De)},ji=ye=>{var De=qZ();T(ye,De)};$(ai,ye=>{u(tt)?ye(si):ye(ji,-1)})}var kn=C(ai,2),Mi=x(kn),oi=C(kn,2);{var Wi=ye=>{var De=KZ(),Ce=bt(De),oe=x(Ce),it=C(Ce,2),qe=x(it);Z((Ee,Et,We)=>{Rn(Ce,"title",Ee),q(oe,Et),q(qe,We)},[()=>{var Ee;return Vi((Ee=Ln(_e().path))==null?void 0:Ee.val)},()=>{var Ee;return Vi((Ee=Ln(_e().path))==null?void 0:Ee.val)},()=>{var Ee;return((Ee=Ln(_e().path))==null?void 0:Ee.ts)!=null?qn(Ln(_e().path).ts):""}]),T(ye,De)},A=st(()=>_e().isLeaf&&i.has(_e().path));$(oi,ye=>{u(A)&&ye(Wi)})}var K=C(ot,2);{var Me=ye=>{var De=GZ();_i(De,21,()=>[..._e().children.values()].sort((Ce,oe)=>Ce.seg.localeCompare(oe.seg)),Ce=>Ce.path,(Ce,oe)=>{t(Ce,()=>u(oe))}),T(ye,De)};$(K,ye=>{u(tt)&&u($e)&&ye(Me)})}Z(()=>{Yt=jt(ot,1,"tr svelte-1vejtrc",null,Yt,{stale:u(It)}),q(Mi,_e().seg)}),ne("click",ot,()=>{I(at,_e().path+"/#")}),ne("contextmenu",ot,ye=>{ye.preventDefault(),I(Ye,{x:ye.clientX,y:ye.clientY,topic:_e().path},!0)}),T(J,He)},i=new Map,n=new Set,s=new Set;let r=null,a=z(0);function c(){r===null&&(r=requestAnimationFrame(()=>{r=null;for(const J of s)g(J);s.clear(),gk(a)}))}const h=new Map;function g(J){const _e=J.split("/");let $e=h,tt="";for(let It=0;It<_e.length;It++){const He=_e[It];tt=It===0?He:`${tt}/${He}`,$e.has(He)||$e.set(He,{seg:He,path:tt,children:new Map,isLeaf:!1});const ot=$e.get(He);It===_e.length-1&&(ot.isLeaf=!0),$e=ot.children}}let f=z(wi(new Set));function p(J){const _e=new Set(u(f));_e.has(J)?_e.delete(J):_e.add(J),I(f,_e,!0)}let v=z("");const _=24,y=5;let S=z(0),D=z(300),E=st(()=>{if(u(a),!u(v))return[];const J=u(v).toLowerCase().split(/\s+/).filter(Boolean),_e=[];for(const[$e,tt]of i){const It=$e.toLowerCase();J.every(He=>It.includes(He))&&_e.push({topic:$e,...tt})}return _e.sort(($e,tt)=>$e.topic.localeCompare(tt.topic))}),N=st(()=>{const J=u(E).length,_e=Math.max(0,Math.floor(u(S)/_)-y),$e=Math.min(J,Math.ceil((u(S)+u(D))/_)+y);return{start:_e,end:$e,totalH:J*_,top:_e*_}});const V=1e3,F=200,Y=20,X=36;let ue=0,Pe=z(wi([])),Ue=z(wi([])),ve=z(!0),at=z("#"),Xt=z(200);Mn(()=>{const J=u(at).trim(),_e=bl(()=>u(Pe)),$e=!J||J==="#"?_e.slice(0,F):_e.filter(tt=>Ct(J,tt.topic)).slice(0,F);if(J&&J!=="#"){const tt=new Set($e.map(He=>He.topic)),It=[];for(const[He,ot]of i)tt.has(He)||Ct(J,He)&&It.push({id:-(It.length+1),topic:He,val:ot.val,ts:ot.ts,retained:!0});It.sort((He,ot)=>He.topic.localeCompare(ot.topic)),I(Ue,[...$e,...It],!0)}else I(Ue,$e,!0)});function Ct(J,_e){if(J==="#")return!0;const $e=J.split("/"),tt=_e.split("/");for(let It=0;It<$e.length;It++){if($e[It]==="#")return!0;if(It>=tt.length||$e[It]!=="+"&&$e[It]!==tt[It])return!1}return $e.length===tt.length}function Qt(J){J.preventDefault();const _e=J.clientY,$e=u(Xt);function tt(He){I(Xt,Math.max(60,Math.min(800,$e+_e-He.clientY)),!0)}function It(){document.removeEventListener("mousemove",tt),document.removeEventListener("mouseup",It)}document.addEventListener("mousemove",tt),document.addEventListener("mouseup",It)}let Ft=st(()=>{const J=Math.max(1,Math.floor((u(Xt)-X)/Y)+1);return u(Ue).slice(0,J)}),ei=z(!0),de=z(null);async function xt(){I(ei,!0),I(de,null);try{const J=await aR();for(const _e of J)i.set(_e.topic,{val:_e.val,ts:_e.ts}),g(_e.topic)}catch(J){I(de,J instanceof Error?J.message:String(J),!0)}finally{I(ei,!1),gk(a)}}const Oe=Gl("mqtt",J=>{const{topic:_e,val:$e,ts:tt}=J;i.set(_e,{val:$e,ts:tt}),n.add(_e),s.add(_e),c();const It={id:ue++,topic:_e,val:$e,ts:tt};I(Pe,[It,...u(Pe).slice(0,V-1)],!0);const He=u(at).trim();(!He||He==="#"||Ct(He,_e))&&I(Ue,[It,...u(Ue).filter(ot=>!(ot.retained&&ot.topic===_e)).slice(0,F-1)],!0)});let Ye=z(null),Nt=z(null);async function hi(J,_e){const $e=[J];if(_e){const tt=J+"/";for(const It of i.keys())It.startsWith(tt)&&$e.push(It)}for(const tt of $e)await gD(tt,"",!0,0)}let zt=st(()=>(u(a),[...i.keys()].sort())),Rt=z(""),Dt=z(""),ii=z(!1),mi=z(0),_n=z(!1),Zi=z(null),vn=z(!1);async function En(){if(u(Rt)){I(_n,!0),I(Zi,null),I(vn,!1);try{await gD(u(Rt),u(Dt),u(ii),u(mi)),I(vn,!0),setTimeout(()=>{I(vn,!1)},2e3)}catch(J){I(Zi,J instanceof Error?J.message:String(J),!0)}finally{I(_n,!1)}}}function Vi(J){return J==null?"":typeof J=="object"?JSON.stringify(J):String(J)}function qn(J){return new Date(J).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function dn(J){return new Date(J).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Ln(J){return u(a),i.get(J)}let Wn=st(()=>(u(a),[...h.values()].sort((J,_e)=>J.seg.localeCompare(_e.seg)))),hn=st(()=>(u(a),i.size));vr(xt),aw(()=>{Oe(),r!==null&&cancelAnimationFrame(r)});var Kn=fX(),Fn=C(x(Kn),2),Hn=x(Fn),Bn=x(Hn),un=C(Bn,2);_i(un,20,()=>u(zt),J=>J,(J,_e)=>{var $e=XZ(),tt={};Z(()=>{tt!==(tt=_e)&&($e.value=($e.__value=_e)??"")}),T(J,$e)});var Ki=C(un,2),Ti=C(Ki,2),Ge=x(Ti),Mt=C(Ti,2),gi=x(Mt);gi.value=gi.__value=0;var Li=C(gi);Li.value=Li.__value=1;var Ci=C(Li);Ci.value=Ci.__value=2;var on=C(Mt,2),ki=C(on,2);{var jn=J=>{var _e=YZ();T(J,_e)};$(ki,J=>{u(vn)&&J(jn)})}var Pn=C(ki,2);{var Xn=J=>{var _e=JZ(),$e=x(_e);Z(()=>q($e,u(Zi))),T(J,_e)};$(Pn,J=>{u(Zi)&&J(Xn)})}var Tn=C(Hn,2),rn=x(Tn),Be=C(rn,2),G=x(Be);{var Ae=J=>{var _e=Fr();Z(()=>q(_e,`${u(E).length??""} /`)),T(J,_e)};$(G,J=>{u(v)&&J(Ae)})}var ct=C(G),dt=C(Tn,2);{var Wt=J=>{var _e=QZ();T(J,_e)},O=J=>{var _e=eX(),$e=x(_e);Z(()=>q($e,u(de))),T(J,_e)},se=J=>{var _e=Ts(),$e=bt(_e);{var tt=He=>{var ot=tX();T(He,ot)},It=He=>{var ot=nX(),Yt=x(ot),ai=x(Yt);_i(ai,21,()=>u(E).slice(u(N).start,u(N).end),si=>si.topic,(si,ji)=>{var kn=iX(),Mi=x(kn),oi=x(Mi),Wi=C(Mi,2),A=x(Wi),K=C(Wi,2),Me=x(K);Z((ye,De,Ce)=>{q(oi,u(ji).topic),Rn(Wi,"title",ye),q(A,De),q(Me,Ce)},[()=>Vi(u(ji).val),()=>Vi(u(ji).val),()=>qn(u(ji).ts)]),T(si,kn)}),Z(()=>{jo(Yt,`height: ${u(N).totalH??""}px; position: relative;`),jo(ai,`top: ${u(N).top??""}px;`)}),is("scroll",ot,si=>{I(S,si.currentTarget.scrollTop,!0)}),CW(ot,"clientHeight",si=>I(D,si)),T(He,ot)};$($e,He=>{u(E).length===0?He(tt):He(It,-1)})}T(J,_e)},be=J=>{var _e=oX(),$e=x(_e);{var tt=He=>{var ot=sX();T(He,ot)},It=He=>{var ot=Ts(),Yt=bt(ot);_i(Yt,17,()=>u(Wn),ai=>ai.path,(ai,si)=>{t(ai,()=>u(si))}),T(He,ot)};$($e,He=>{u(Wn).length===0?He(tt):He(It,-1)})}T(J,_e)};$(dt,J=>{u(ei)?J(Wt):u(de)?J(O,1):u(v)?J(se,2):J(be,-1)})}var j=C(Fn,2),pe=x(j),Fe=C(pe,2),ke=x(Fe),Ne=C(ke,2);{var Te=J=>{var _e=rX(),$e=x(_e);Z(()=>q($e,u(Ue).length)),T(J,_e)};$(Ne,J=>{!u(ve)&&u(Ue).length>0&&J(Te)})}var Tt=C(Ne,2),ht=x(Tt),Ie=C(Fe,2);{var At=J=>{var _e=dX(),$e=x(_e);{var tt=He=>{var ot=aX();T(He,ot)},It=He=>{var ot=Ts(),Yt=bt(ot);_i(Yt,17,()=>u(Ft),ai=>ai.id,(ai,si)=>{var ji=cX();let kn;var Mi=x(ji),oi=x(Mi),Wi=C(Mi,2);{var A=Ce=>{var oe=lX();T(Ce,oe)};$(Wi,Ce=>{u(si).retained&&Ce(A)})}var K=C(Wi,2),Me=x(K),ye=C(K,2),De=x(ye);Z((Ce,oe,it)=>{kn=jt(ji,1,"sr svelte-1vejtrc",null,kn,{retained:u(si).retained}),q(oi,Ce),q(Me,u(si).topic),Rn(ye,"title",oe),q(De,it)},[()=>dn(u(si).ts),()=>Vi(u(si).val),()=>Vi(u(si).val)]),T(ai,ji)}),T(He,ot)};$($e,He=>{u(Ft).length===0?He(tt):He(It,-1)})}T(J,_e)};$(Ie,J=>{u(ve)&&J(At)})}var ni=C(j,2);{var qt=J=>{var _e=hX(),$e=bt(_e),tt=C($e,2);let It;var He=x(tt),ot=C(He,2);Z(()=>It=jo(tt,"",It,{left:`${u(Ye).x??""}px`,top:`${u(Ye).y??""}px`})),ne("click",$e,()=>I(Ye,null)),ne("contextmenu",$e,Yt=>{Yt.preventDefault(),I(Ye,null)}),ne("click",He,()=>{navigator.clipboard.writeText(u(Ye).topic),I(Ye,null)}),ne("click",ot,()=>{const Yt=u(Ye).topic,ai=Yt+"/",si=[...i.keys()].some(ji=>ji.startsWith(ai));I(Nt,{topic:Yt,hasChildren:si,recursive:!1},!0),I(Ye,null)}),T(J,_e)};$(ni,J=>{u(Ye)&&J(qt)})}var $t=C(ni,2);{var ti=J=>{var _e=gX(),$e=bt(_e),tt=C($e,2),It=C(x(tt),2),He=x(It),ot=C(x(He)),Yt=x(ot),ai=C(He,2);{var si=oi=>{var Wi=uX(),A=x(Wi);Es(A,()=>u(Nt).recursive,K=>u(Nt).recursive=K),T(oi,Wi)};$(ai,oi=>{u(Nt).hasChildren&&oi(si)})}var ji=C(It,2),kn=x(ji),Mi=C(kn,2);Z(()=>q(Yt,u(Nt).topic)),ne("click",$e,()=>I(Nt,null)),ne("click",kn,()=>I(Nt,null)),ne("click",Mi,()=>{const{topic:oi,recursive:Wi}=u(Nt);I(Nt,null),hi(oi,Wi)}),T(J,_e)};$($t,J=>{u(Nt)&&J(ti)})}Z(()=>{on.disabled=u(_n)||!u(Rt),q(ct,` ${u(hn)??""}`),jo(j,u(ve)?`height: ${u(Xt)}px;`:""),q(ht,u(ve)?"▾":"▸")}),Ei(Bn,()=>u(Rt),J=>I(Rt,J)),Ei(Ki,()=>u(Dt),J=>I(Dt,J)),Es(Ge,()=>u(ii),J=>I(ii,J)),ga(Mt,()=>u(mi),J=>I(mi,J)),ne("click",on,En),Ei(rn,()=>u(v),J=>I(v,J)),ne("mousedown",pe,Qt),Ei(ke,()=>u(at),J=>I(at,J)),ne("click",Tt,()=>{I(ve,!u(ve))}),T(o,Kn),To()}_r(["click","contextmenu","mousedown"]);var mX=R('<div class="restart-banner restart-banner--restarting svelte-twakcj">Restarting daemon…</div>'),_X=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>'),vX=R('<div class="err svelte-twakcj"> </div>'),bX=R('<span class="pane-count pane-count--warn svelte-twakcj"> </span>'),wX=R('<p class="empty svelte-twakcj">No packages installed.</p>'),yX=R('<p class="empty svelte-twakcj">No match.</p>'),SX=R('<span class="dep-latest svelte-twakcj"> </span>'),CX=uT('<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>'),xX=uT('<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>'),LX=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>'),kX=R('<span class="result-author svelte-twakcj"> </span>'),IX=R('<span class="result-date svelte-twakcj"> </span>'),DX=R('<span class="result-desc svelte-twakcj"> </span>'),EX=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>'),PX=R('<div class="results-list svelte-twakcj"></div>'),TX=R('<pre class="npm-output svelte-twakcj"> </pre>'),MX=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>`),NX=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 RX(o,e){Po(e,!0);let t=z(wi([])),i=z(""),n=z(wi({})),s=z(!1),r=z(""),a=z(wi([])),c=z(!1),h=z(!1),g=z(!1),f=z(""),p=z(""),v=wi({});const _=st(()=>u(i).trim()?u(t).filter(Ge=>Ge.name.toLowerCase().includes(u(i).toLowerCase())):u(t)),y=st(()=>Object.keys(u(n)).length);vr(async()=>{await Promise.all([S(),D()])});async function S(){try{I(t,await a8(),!0),I(f,"")}catch(Ge){I(f,Ge.message,!0)}}async function D(){try{I(n,await u8(),!0)}catch{}}async function E(){I(s,!0);try{I(n,await g8(),!0)}catch{}finally{I(s,!1)}}async function N(){const Ge=u(r).trim();if(!Ge){I(a,[],!0);return}I(g,!0),I(f,"");try{I(a,await l8(Ge),!0)}catch(Mt){I(f,Mt.message,!0)}finally{I(g,!1)}}function V(Ge){if(!Ge)return"";try{return new Date(Ge).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}async function F(Ge,Mt){v[Ge]=!0,I(f,""),I(p,"");try{const gi=await c8(Ge,Mt);I(p,gi.stdout||gi.stderr||"Done.",!0),I(c,!0),await S()}catch(gi){I(f,gi.message,!0)}finally{v[Ge]=!1}}async function Y(Ge){v[Ge]=!0,I(f,""),I(p,"");try{const Mt=await d8(Ge);I(p,Mt.stdout||Mt.stderr||"Done.",!0),I(c,!0);const gi={...u(n)};delete gi[Ge],I(n,gi,!0),await S()}catch(Mt){I(f,Mt.message,!0)}finally{v[Ge]=!1}}async function X(Ge){v[Ge]=!0,I(f,""),I(p,"");try{const Mt=await h8(Ge);I(p,Mt.stdout||Mt.stderr||"Done.",!0),I(c,!0);const gi={...u(n)};delete gi[Ge],I(n,gi,!0),await S()}catch(Mt){I(f,Mt.message,!0)}finally{v[Ge]=!1}}let ue;async function Pe(){if(await ue.show("Restart the she daemon? The page will reload after a moment.",{confirm:"Restart"})){I(h,!0);try{await nR()}catch{}setTimeout(()=>{window.location.reload()},3e3)}}var Ue=NX(),ve=bt(Ue);bs(Mg(ve,{}),Ge=>ue=Ge,()=>ue);var at=C(ve,2),Xt=x(at);{var Ct=Ge=>{var Mt=mX();T(Ge,Mt)},Qt=Ge=>{var Mt=_X(),gi=C(x(Mt));ne("click",gi,Pe),T(Ge,Mt)};$(Xt,Ge=>{u(h)?Ge(Ct):u(c)&&Ge(Qt,1)})}var Ft=C(Xt,2);{var ei=Ge=>{var Mt=vX(),gi=x(Mt);Z(()=>q(gi,u(f))),T(Ge,Mt)};$(Ft,Ge=>{u(f)&&Ge(ei)})}var de=C(Ft,2),xt=x(de),Oe=x(xt),Ye=C(x(Oe),2),Nt=x(Ye),hi=C(Ye,2);{var zt=Ge=>{var Mt=bX(),gi=x(Mt);Z(()=>q(gi,`${u(y)??""} outdated`)),T(Ge,Mt)};$(hi,Ge=>{u(y)>0&&Ge(zt)})}var Rt=C(hi,2),Dt=x(Rt);let ii;var mi=C(Oe,2),_n=x(mi),Zi=C(mi,2),vn=x(Zi);{var En=Ge=>{var Mt=wX();T(Ge,Mt)},Vi=Ge=>{var Mt=yX();T(Ge,Mt)},qn=Ge=>{var Mt=Ts(),gi=bt(Mt);_i(gi,17,()=>u(_),Li=>Li.name,(Li,Ci)=>{var on=LX();let ki;var jn=x(on),Pn=x(jn),Xn=x(Pn),Tn=C(Pn,2),rn=x(Tn),Be=C(Tn,2);{var G=j=>{var pe=SX(),Fe=x(pe);Z(()=>q(Fe,`→ v${u(n)[u(Ci).name].latest??""}`)),T(j,pe)};$(Be,j=>{u(n)[u(Ci).name]&&j(G)})}var Ae=C(jn,2),ct=x(Ae);let dt;var Wt=x(ct);{var O=j=>{var pe=CX();T(j,pe)},se=j=>{var pe=xX();T(j,pe)};$(Wt,j=>{v[u(Ci).name]?j(O):j(se,-1)})}var be=C(ct,2);Z(()=>{ki=jt(on,1,"dep-row svelte-twakcj",null,ki,{"dep-busy":!!v[u(Ci).name]}),Rn(Pn,"href",u(Ci).url??`https://www.npmjs.com/package/${u(Ci).name}`),q(Xn,u(Ci).name),q(rn,u(Ci).installedVersion??u(Ci).version),dt=jt(ct,1,"icon-btn svelte-twakcj",null,dt,{"icon-btn--update":!!u(n)[u(Ci).name]}),ct.disabled=!!v[u(Ci).name],Rn(ct,"title",u(n)[u(Ci).name]?`Update to v${u(n)[u(Ci).name].latest}`:"Update to latest"),be.disabled=!!v[u(Ci).name]}),ne("click",ct,()=>X(u(Ci).name)),ne("click",be,()=>Y(u(Ci).name)),T(Li,on)}),T(Ge,Mt)};$(vn,Ge=>{u(t).length===0?Ge(En):u(_).length===0?Ge(Vi,1):Ge(qn,-1)})}var dn=C(xt,2),Ln=C(x(dn),2),Wn=x(Ln),hn=C(Wn,2),Kn=x(hn),Fn=C(Ln,2);{var Hn=Ge=>{var Mt=PX();_i(Mt,21,()=>u(a),gi=>gi.name,(gi,Li)=>{var Ci=EX(),on=x(Ci),ki=x(on),jn=x(ki),Pn=C(ki,2),Xn=x(Pn),Tn=C(Pn,2);{var rn=O=>{var se=kX(),be=x(se);Z(()=>q(be,u(Li).author)),T(O,se)};$(Tn,O=>{u(Li).author&&O(rn)})}var Be=C(Tn,2);{var G=O=>{var se=IX(),be=x(se);Z(j=>{Rn(se,"title",u(Li).date),q(be,j)},[()=>V(u(Li).date)]),T(O,se)};$(Be,O=>{u(Li).date&&O(G)})}var Ae=C(Be,2);{var ct=O=>{var se=DX(),be=x(se);Z(()=>q(be,u(Li).description)),T(O,se)};$(Ae,O=>{u(Li).description&&O(ct)})}var dt=C(on,2),Wt=x(dt);Z(()=>{Rn(ki,"href",u(Li).url??`https://www.npmjs.com/package/${u(Li).name}`),q(jn,u(Li).name),q(Xn,u(Li).version),dt.disabled=!!v[u(Li).name],q(Wt,v[u(Li).name]?"Installing…":"Install")}),ne("click",dt,()=>F(u(Li).name)),T(gi,Ci)}),T(Ge,Mt)};$(Fn,Ge=>{u(a).length>0&&Ge(Hn)})}var Bn=C(Fn,2);{var un=Ge=>{var Mt=TX(),gi=x(Mt);Z(()=>q(gi,u(p))),T(Ge,Mt)};$(Bn,Ge=>{u(p)&&Ge(un)})}var Ki=C(Bn,2);{var Ti=Ge=>{var Mt=MX();T(Ge,Mt)};$(Ki,Ge=>{!u(a).length&&!u(p)&&Ge(Ti)})}Z(()=>{q(Nt,u(t).length),Rt.disabled=u(s),ii=jt(Dt,0,"svelte-twakcj",null,ii,{spinning:u(s)}),hn.disabled=u(g),q(Kn,u(g)?"Searching…":"Search")}),ne("click",Rt,E),Ei(_n,()=>u(i),Ge=>I(i,Ge)),ne("keydown",Wn,Ge=>Ge.key==="Enter"&&N()),Ei(Wn,()=>u(r),Ge=>I(r,Ge)),ne("click",hn,N),T(o,Ue),To()}_r(["click","keydown"]);var AX=R('<span class="update-dot svelte-1n46o8q" title="Update available"></span>'),OX=R('<dt class="svelte-1n46o8q">Latest</dt><dd style="color: #f90" class="svelte-1n46o8q"> </dd>',1),FX=R('<dt class="svelte-1n46o8q">Latest</dt><dd class="svelte-1n46o8q">up to date</dd>',1),HX=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"><polyline points="4 4 4 10 10 10"></polyline><path d="M4 10A9 9 0 1 0 6.5 5"></path></svg> </button>'),WX=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"></polyline><path d="M4 10A9 9 0 1 0 6.5 5"></path></svg> </button></div></div>'),BX=R('<dt class="svelte-1n46o8q">Uptime</dt><dd class="svelte-1n46o8q"> </dd>',1),zX=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),VX=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),jX=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>'),UX=R('<span class="stats-empty svelte-1n46o8q">Loading…</span>'),$X=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"><path d="M18.36 6.64a9 9 0 1 1-12.73 0"></path><line x1="12" y1="2" x2="12" y2="12"></line></svg> Restart daemon</button></div></div>'),qX=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"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path><polyline points="16 17 21 12 16 7"></polyline><line x1="21" y1="12" x2="9" y2="12"></line></svg></button>'),KX=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"><polyline points="5,3 1,8 5,13"></polyline><polyline points="11,3 15,8 11,13"></polyline></svg> Scripts</button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="square" stroke-linejoin="miter"><rect x="0.75" y="0.75" width="14.5" height="14.5" rx="1"></rect><path d="M2,11 V5 H5 V11"></path><path d="M6,12 V5 H9 V8 H6"></path><path d="M10,11 V5 H15 V11"></path><line x1="12.5" y1="5" x2="12.5" y2="11"></line></svg> Packages</button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" stroke="none" style="vertical-align: middle"><path fill-rule="evenodd" d="M2,0 H14 A2,2 0 0,1 16,2 V14 A2,2 0 0,1 14,16 H0 V2 A2,2 0 0,1 2,0 Z M0,16 L0,12 A4,4 0 0,1 4,16 Z M0,10.5 A5.5,5.5 0 0,1 5.5,16 L9,16 A9,9 0 0,0 0,7 Z M0,5.5 A10.5,10.5 0 0,1 10.5,16 L13.5,16 A13.5,13.5 0 0,0 0,2.5 Z"></path></svg> MQTT</button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M8,2 L8,7"></path><path d="M6,5 L8,7.5 L10,5"></path><path d="M2.5,14 L6,10"></path><path d="M6.2,12.8 L6,10 L3.2,10.2"></path><path d="M13.5,14 L10,10"></path><path d="M9.8,12.8 L10,10 L12.8,10.2"></path></svg> Matter</button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><ellipse cx="8" cy="4.5" rx="5" ry="1.8"></ellipse><path d="M3,4.5 v7 a5,1.8 0,0,0 10,0 v-7"></path><path d="M3,8 a5,1.8 0,0,0 10,0"></path></svg> DB</button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><line x1="2" y1="5" x2="14" y2="5"></line><line x1="2" y1="8" x2="14" y2="8"></line><line x1="2" y1="11" x2="9" y2="11"></line></svg> Logs</button> <div class="nav-spacer svelte-1n46o8q"></div> <div class="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"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg></a> <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"><line x1="18" y1="20" x2="18" y2="10"></line><line x1="12" y1="20" x2="12" y2="4"></line><line x1="6" y1="20" x2="6" y2="14"></line></svg></button> <!></div> <button title="Settings"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"></path><circle cx="12" cy="12" r="3"></circle></svg></button> <!></div></nav> <main class="svelte-1n46o8q"><!> <div><!></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div></main></div>'),GX=R('<div class="login-error svelte-1n46o8q"> </div>'),ZX=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>'),XX=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"></polyline><path d="M4 10A9 9 0 1 0 6.5 5"></path></svg> Restarting smart-home-engine…</div></div>'),YX=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"></polyline><path d="M4 10A9 9 0 1 0 6.5 5"></path></svg> Updating smart-home-engine…</div></div>'),JX=R("<!> <!> <!> <!>",1);function QX(o,e){Po(e,!0);const t=["scripts","mqtt","matter","db","logs","config","packages"];function i(){const de=location.hash.slice(1);return t.includes(de)?de:"scripts"}let n=z(wi(i())),s=z(null),r=z(!1),a=z(!1),c=z(!1),h=z(!1),g=z("none"),f=z(""),p=z(!1),v=z(""),_=z(""),y=z(!1),S=z(!1);V7(()=>{I(p,!0)});async function D(){I(_,""),I(y,!0);try{await $7(u(v)),I(v,""),I(p,!1)}catch(de){I(_,de.message??"Login failed",!0)}finally{I(y,!1)}}async function E(){if(u(g)==="proxy"&&u(f)){window.location.href=u(f);return}await q7(),I(p,!0)}let N=z(null),V=z(!1);async function F(){if(!await u(N).show("Restart the she daemon? The page will reload after a moment.",{confirm:"Restart"}))return;I(V,!0);let de;try{de=(await gf()).startedAt}catch{}try{await nR()}catch{}const xt=Date.now()+6e4;for(;Date.now()<xt;){await new Promise(Oe=>setTimeout(Oe,250));try{const Oe=await gf();if(de===void 0||Oe.startedAt!==de){location.reload();return}}catch{}}location.reload()}async function Y(){I(c,!0);try{const de=await J7();u(s)&&I(s,{...u(s),latestVersion:de.latestVersion??void 0},!0)}catch{}finally{I(c,!1)}}async function X(){var Oe;if(!await u(N).show(`Update to v${(Oe=u(s))==null?void 0:Oe.latestVersion}? The daemon will restart after the update completes.`,{confirm:"Update"}))return;I(a,!1),I(h,!0);try{await Y7()}catch{}let de=!1;const xt=Date.now()+18e4;for(;Date.now()<xt;){await new Promise(Ye=>setTimeout(Ye,2e3));try{if(await gf(),de){location.reload();return}}catch{de=!0}}location.reload()}function ue(de){I(n,de,!0),location.hash=de}vr(async()=>{location.hash||(location.hash=u(n));const de=()=>{I(n,i(),!0)};window.addEventListener("hashchange",de);try{const Ye=await U7();I(g,Ye.mode,!0),I(f,Ye.proxyLogoutUrl??"",!0),u(g)==="password"&&(await fetch("/she/scripts")).status===401&&I(p,!0)}catch{}I(S,!0);async function xt(){try{I(s,await gf(),!0)}catch{}}xt();const Oe=setInterval(xt,5e3);return()=>{window.removeEventListener("hashchange",de),clearInterval(Oe)}});var Pe=JX();is("click",$P,()=>{u(r)&&I(r,!1),u(a)&&I(a,!1)});var Ue=bt(Pe);{var ve=de=>{var xt=KX(),Oe=x(xt),Ye=C(x(Oe),2);let Nt;var hi=C(Ye,2);let zt;var Rt=C(hi,2);let Dt;var ii=C(Rt,2);let mi;var _n=C(ii,2);let Zi;var vn=C(_n,2);let En;var Vi=C(vn,4),qn=C(x(Vi),2),dn=x(qn),Ln=x(dn);Ln.nodeValue="v0.26.2 ";var Wn=C(Ln);{var hn=Te=>{var Tt=AX();T(Te,Tt)};$(Wn,Te=>{var Tt;(Tt=u(s))!=null&&Tt.latestVersion&&Te(hn)})}var Kn=C(dn,2);{var Fn=Te=>{var Tt=WX(),ht=x(Tt),Ie=C(x(ht));Ie.textContent="v0.26.2";var At=C(Ie,2);{var ni=He=>{var ot=OX(),Yt=C(bt(ot)),ai=x(Yt);Z(()=>q(ai,`v${u(s).latestVersion??""}`)),T(He,ot)},qt=He=>{var ot=FX();T(He,ot)};$(At,He=>{var ot;(ot=u(s))!=null&&ot.latestVersion?He(ni):He(qt,-1)})}var $t=C(ht,2),ti=x($t);{var J=He=>{var ot=HX(),Yt=C(x(ot));Z(()=>q(Yt,` Update to v${u(s).latestVersion??""}`)),ne("click",ot,X),T(He,ot)};$(ti,He=>{var ot;(ot=u(s))!=null&&ot.latestVersion&&He(J)})}var _e=C(ti,2),$e=x(_e);let tt;var It=C($e);Z(()=>{_e.disabled=u(c),tt=jt($e,0,"svelte-1n46o8q",null,tt,{spinning:u(c)}),q(It,` ${u(c)?"Checking…":"Check for updates"}`)}),ne("click",Tt,He=>He.stopPropagation()),ne("click",_e,Y),T(Te,Tt)};$(Kn,Te=>{u(a)&&Te(Fn)})}var Hn=C(qn,2),Bn=x(Hn),un=C(Bn,2);{var Ki=Te=>{var Tt=$X(),ht=x(Tt);{var Ie=$t=>{var ti=jX(),J=x(ti);{var _e=ye=>{const De=st(()=>Math.floor((Date.now()-u(s).startedAt)/1e3)),Ce=st(()=>Math.floor(u(De)/86400)),oe=st(()=>Math.floor(u(De)%86400/3600)),it=st(()=>Math.floor(u(De)%3600/60));var qe=BX(),Ee=C(bt(qe)),Et=x(Ee);Z(()=>q(Et,`${u(Ce)>0?u(Ce)+"d ":""}${u(oe)>0||u(Ce)>0?u(oe)+"h ":""}${u(it)??""}m`)),T(ye,qe)};$(J,ye=>{u(s).startedAt&&ye(_e)})}var $e=C(J,3),tt=x($e),It=C($e,3),He=x(It),ot=C(It,3),Yt=x(ot),ai=C(ot,2);{var si=ye=>{var De=zX(),Ce=C(bt(De)),oe=x(Ce),it=C(Ce,3),qe=x(it);Z(()=>{q(oe,u(s).matterNodes??0),q(qe,u(s).matterEndpoints??0)}),T(ye,De)};$(ai,ye=>{u(s).matterEnabled&&ye(si)})}var ji=C(ai,2);{var kn=ye=>{var De=VX(),Ce=C(bt(De)),oe=x(Ce),it=C(Ce,3),qe=x(it);Z(()=>{q(oe,u(s).dbDocs??"—"),q(qe,u(s).dbViews??"—")}),T(ye,De)};$(ji,ye=>{u(s).dbEnabled&&ye(kn)})}var Mi=C(ji,3),oi=x(Mi),Wi=C(Mi,3),A=x(Wi),K=C(Wi,3),Me=x(K);Z(()=>{q(tt,u(s).scripts),q(He,u(s).topics),q(Yt,u(s).mqttMsgPerSec??"—"),q(oi,u(s).handlers??"—"),q(A,u(s).memMb!=null?u(s).memMb+" MB":"—"),q(Me,u(s).cpuPercent!=null?u(s).cpuPercent+" %":"—")}),T($t,ti)},At=$t=>{var ti=UX();T($t,ti)};$(ht,$t=>{u(s)?$t(Ie):$t(At,-1)})}var ni=C(ht,2),qt=x(ni);ne("click",Tt,$t=>$t.stopPropagation()),ne("click",qt,()=>{I(r,!1),F()}),T(Te,Tt)};$(un,Te=>{u(r)&&Te(Ki)})}var Ti=C(Hn,2);let Ge;var Mt=C(Ti,2);{var gi=Te=>{var Tt=qX();ne("click",Tt,E),T(Te,Tt)};$(Mt,Te=>{u(g)==="password"&&Te(gi)})}var Li=C(Oe,2),Ci=x(Li);bs(Mg(Ci,{}),Te=>I(N,Te,!0),()=>u(N));var on=C(Ci,2);let ki;var jn=x(on);{let Te=st(()=>u(n)==="scripts");rG(jn,{get active(){return u(Te)}})}var Pn=C(on,2);let Xn;var Tn=x(Pn);RX(Tn,{});var rn=C(Pn,2);let Be;var G=x(rn);pX(G,{});var Ae=C(rn,2);let ct;var dt=x(Ae);UZ(dt,{});var Wt=C(Ae,2);let O;var se=x(Wt);eZ(se,{});var be=C(Wt,2);let j;var pe=x(be);qG(pe,{});var Fe=C(be,2);let ke;var Ne=x(Fe);XG(Ne,{}),Z(()=>{Nt=jt(Ye,1,"svelte-1n46o8q",null,Nt,{active:u(n)==="scripts"}),zt=jt(hi,1,"svelte-1n46o8q",null,zt,{active:u(n)==="packages"}),Dt=jt(Rt,1,"svelte-1n46o8q",null,Dt,{active:u(n)==="mqtt"}),mi=jt(ii,1,"svelte-1n46o8q",null,mi,{active:u(n)==="matter"}),Zi=jt(_n,1,"svelte-1n46o8q",null,Zi,{active:u(n)==="db"}),En=jt(vn,1,"svelte-1n46o8q",null,En,{active:u(n)==="logs"}),Ge=jt(Ti,1,"nav-settings svelte-1n46o8q",null,Ge,{active:u(n)==="config"}),ki=jt(on,1,"page-wrap svelte-1n46o8q",null,ki,{hidden:u(n)!=="scripts"}),Xn=jt(Pn,1,"page-wrap svelte-1n46o8q",null,Xn,{hidden:u(n)!=="packages"}),Be=jt(rn,1,"page-wrap svelte-1n46o8q",null,Be,{hidden:u(n)!=="mqtt"}),ct=jt(Ae,1,"page-wrap svelte-1n46o8q",null,ct,{hidden:u(n)!=="matter"}),O=jt(Wt,1,"page-wrap svelte-1n46o8q",null,O,{hidden:u(n)!=="db"}),j=jt(be,1,"page-wrap svelte-1n46o8q",null,j,{hidden:u(n)!=="config"}),ke=jt(Fe,1,"page-wrap svelte-1n46o8q",null,ke,{hidden:u(n)!=="logs"})}),ne("click",Ye,()=>ue("scripts")),ne("click",hi,()=>ue("packages")),ne("click",Rt,()=>ue("mqtt")),ne("click",ii,()=>ue("matter")),ne("click",_n,()=>ue("db")),ne("click",vn,()=>ue("logs")),ne("click",dn,Te=>{Te.stopPropagation(),I(a,!u(a)),I(r,!1)}),ne("click",Bn,Te=>{Te.stopPropagation(),I(r,!u(r)),I(a,!1)}),ne("click",Ti,()=>ue("config")),T(de,xt)};$(Ue,de=>{u(S)&&!u(p)&&de(ve)})}var at=C(Ue,2);{var Xt=de=>{var xt=ZX(),Oe=x(xt),Ye=C(x(Oe),4),Nt=C(x(Ye),2),hi=C(Ye,2);{var zt=ii=>{var mi=GX(),_n=x(mi);Z(()=>q(_n,u(_))),T(ii,mi)};$(hi,ii=>{u(_)&&ii(zt)})}var Rt=C(hi,2),Dt=x(Rt);Z(()=>{Nt.disabled=u(y),Rt.disabled=u(y)||!u(v),q(Dt,u(y)?"Signing in…":"Sign in")}),is("submit",Oe,ii=>{ii.preventDefault(),D()}),Ei(Nt,()=>u(v),ii=>I(v,ii)),T(de,xt)};$(at,de=>{u(p)&&de(Xt)})}var Ct=C(at,2);{var Qt=de=>{var xt=XX();T(de,xt)};$(Ct,de=>{u(V)&&de(Qt)})}var Ft=C(Ct,2);{var ei=de=>{var xt=YX();T(de,xt)};$(Ft,de=>{u(h)&&de(ei)})}T(o,Pe),To()}_r(["click"]);cW(QX,{target:document.getElementById("app")});export{LT as t};
225
+ *[stopped]*`,toolEvents:u(ve).length>0?[...u(ve)]:void 0}],!0)}else I(c,K.message,!0)}finally{D=null,I(s,null),I(ve,[],!0),I(a,!1)}}}function Ki(){D==null||D.abort()}function Ti(A){A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),un())}function Ge(){I(n,[],!0),I(c,"")}const Mt=["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 gi(A){I(r,A,!0),Xt==null||Xt.focus()}var Li=N9(),Ci=bt(Li),on=x(Ci),ki=C(x(on),2);{var jn=A=>{var K=YG(),Me=x(K);{var ye=Ce=>{var oe=Fr();Z(()=>q(oe,`${u(h).provider??""} · ${(u(f)||u(h).model)??""}`)),T(Ce,oe)},De=Ce=>{var oe=Fr("Not configured");T(Ce,oe)};$(Me,Ce=>{u(Ft)?Ce(ye):Ce(De,-1)})}Z(()=>Rn(K,"title",`Provider: ${u(h).provider??""}`)),T(A,K)};$(ki,A=>{u(h)&&A(jn)})}var Pn=C(ki,2);{var Xn=A=>{var K=JG();ne("click",K,Ge),T(A,K)};$(Pn,A=>{u(n).length>0&&A(Xn)})}var Tn=C(on,2),rn=x(Tn);{var Be=A=>{var K=QG();T(A,K)},G=A=>{var K=i9(),Me=x(K),ye=x(Me);{var De=it=>{var qe=e9(),Ee=C(bt(qe)),Et=x(Ee);Z(()=>q(Et,t().id)),T(it,qe)},Ce=it=>{var qe=Fr("No view selected. Ask a general sheDB view question.");T(it,qe)};$(ye,it=>{t()?it(De):it(Ce,-1)})}var oe=C(Me,2);_i(oe,17,()=>Mt,Nn,(it,qe)=>{var Ee=t9(),Et=x(Ee);Z(()=>q(Et,u(qe))),ne("click",Ee,()=>gi(u(qe))),T(it,Ee)}),T(A,K)};$(rn,A=>{u(Ft)?u(n).length===0&&u(s)===null&&A(G,1):A(Be)})}var Ae=C(rn,2);_i(Ae,17,()=>u(n),Nn,(A,K,Me)=>{var ye=l9(),De=x(ye);{var Ce=it=>{var qe=n9(),Ee=x(qe);Z(()=>q(Ee,u(K).content)),T(it,qe)},oe=it=>{const qe=st(()=>Oe(u(K).content)),Ee=st(()=>Nt(u(qe)));var Et=a9(),We=bt(Et);{var H=ft=>{var we=FD();_i(we,21,()=>u(K).toolEvents,Nn,(vt,ut)=>{var he=Ts(),wt=bt(he);{var Xe=le=>{var me=AD(),Je=C(x(me)),Ht=x(Je);Z(ge=>q(Ht,ge),[()=>u(ut).name.replace(/_/g," ")]),T(le,me)},Le=le=>{var me=OD(),Je=C(x(me)),Ht=x(Je);Z(ge=>q(Ht,ge),[()=>u(ut).name.replace(/_/g," ")]),T(le,me)};$(wt,le=>{u(ut).type==="tool_call"?le(Xe):le(Le,-1)})}T(vt,he)}),T(ft,we)};$(We,ft=>{var we;(we=u(K).toolEvents)!=null&&we.length&&ft(H)})}var Q=C(We,2),xe=x(Q);_i(xe,17,()=>u(qe),Nn,(ft,we,vt)=>{var ut=Ts(),he=bt(ut);{var wt=Le=>{var le=HD();jl(le,()=>_n(u(we).text),!0),T(Le,le)},Xe=Le=>{const le=st(()=>`${Me}:${vt}`),me=st(()=>Dt(u(we).text)),Je=st(()=>u(p).has(u(le))),Ht=st(()=>u(we).lang==="filter");var ge=o9(),Ke=x(ge),gt=x(Ke),yt=x(gt),Qe=C(gt,2),li=x(Qe),Jt=C(Ke,2);let Un;var tn=x(Jt),ri=x(tn);jl(ri,()=>mi(u(we).text,u(we).lang??""),!0);var Vt=C(tn,2);{var an=ci=>{var bn=s9(),Xi=x(bn);Z(()=>q(Xi,u(Je)?"▲ collapse":"▼ expand")),ne("click",bn,()=>ii(u(le))),T(ci,bn)};$(Vt,ci=>{u(me)&&ci(an)})}Z(()=>{q(yt,u(Ht)?"filter":u(we).lang),Un=jt(Jt,1,"code-body svelte-1twuiul",null,Un,{collapsed:u(me)&&!u(Je)})}),ne("click",li,()=>vn(u(we).text)),T(Le,ge)};$(he,Le=>{u(we).type==="text"?Le(wt):Le(Xe,-1)})}T(ft,ut)});var Ze=C(xe,2);{var et=ft=>{var we=r9(),vt=x(we),ut=x(vt);Z(he=>q(ut,he),[()=>zt(u(Ee))]),ne("click",vt,()=>e.onApplyView(u(Ee))),T(ft,we)},nt=st(()=>hi(u(Ee))&&e.onApplyView);$(Ze,ft=>{u(nt)&&ft(et)})}T(it,Et)};$(De,it=>{u(K).role==="user"?it(Ce):it(oe,-1)})}Z(()=>jt(ye,1,`message ${u(K).role??""}`,"svelte-1twuiul")),T(A,ye)});var ct=C(Ae,2);{var dt=A=>{var K=FD();_i(K,21,()=>u(ve),Nn,(Me,ye)=>{var De=Ts(),Ce=bt(De);{var oe=qe=>{var Ee=AD(),Et=C(x(Ee)),We=x(Et);Z(H=>q(We,H),[()=>u(ye).name.replace(/_/g," ")]),T(qe,Ee)},it=qe=>{var Ee=OD(),Et=C(x(Ee)),We=x(Et);Z(H=>q(We,H),[()=>u(ye).name.replace(/_/g," ")]),T(qe,Ee)};$(Ce,qe=>{u(ye).type==="tool_call"?qe(oe):qe(it,-1)})}T(Me,De)}),T(A,K)};$(ct,A=>{u(ve).length>0&&A(dt)})}var Wt=C(ct,2);{var O=A=>{var K=c9(),Me=x(K),ye=x(Me),De=x(ye);Z(()=>q(De,N[u(E)])),T(A,K)};$(Wt,A=>{u(a)&&u(s)===null&&u(ve).length===0&&A(O)})}var se=C(Wt,2);{var be=A=>{var K=h9(),Me=x(K);_i(Me,21,()=>Ye(u(s)),Nn,(ye,De)=>{var Ce=Ts(),oe=bt(Ce);{var it=Ee=>{var Et=HD();jl(Et,()=>_n(u(De).text),!0),T(Ee,Et)},qe=Ee=>{var Et=d9(),We=x(Et),H=x(We),Q=x(H),xe=C(We,2),Ze=x(xe);jl(Ze,()=>mi(u(De).text,u(De).lang??""),!0),Z(()=>q(Q,u(De).lang)),T(Ee,Et)};$(oe,Ee=>{u(De).type==="text"?Ee(it):Ee(qe,-1)})}T(ye,Ce)}),T(A,K)};$(se,A=>{u(s)!==null&&A(be)})}bs(Tn,A=>Ct=A,()=>Ct);var j=C(Tn,2);{var pe=A=>{var K=u9(),Me=x(K);Z(()=>q(Me,u(c))),T(A,K)};$(j,A=>{u(c)&&A(pe)})}var Fe=C(j,2),ke=x(Fe),Ne=x(ke),Te=C(ke,2),Tt=x(Te),ht=C(Te,2),Ie=x(ht),At=C(ht,2),ni=x(At),qt=C(Fe,2),$t=x(qt);{var ti=A=>{var K=g9();let Me;var ye=C(x(K),2),De=x(ye),Ce=C(ye,2),oe=x(Ce);Z(()=>{Me=jt(K,1,"file-chip svelte-1twuiul",null,Me,{inactive:!u(ue)}),q(De,t().id),Rn(Ce,"title",u(ue)?"Remove from context":"Re-add to context"),q(oe,u(ue)?"×":"+")}),ne("click",Ce,()=>I(ue,!u(ue))),T(A,K)};$($t,A=>{t()&&A(ti)})}var J=C($t,2);_i(J,17,()=>u(X),Nn,(A,K,Me)=>{const ye=st(()=>qn(u(K).name));var De=f9(),Ce=x(De),oe=x(Ce),it=C(Ce,2),qe=x(it),Ee=C(it,2);Z((Et,We)=>{jt(Ce,1,`badge badge-${Et??""}`,"svelte-1twuiul"),q(oe,We),q(qe,u(K).name)},[()=>u(ye).toLowerCase(),()=>dn(u(ye))]),ne("click",Ee,()=>Ln(Me)),T(A,De)});var _e=C(J,2),$e=C(_e,2);bs($e,A=>Ue=A,()=>Ue);var tt=C(qt,2);let It;var He=x(tt);let ot;var Yt=x(He);bs(Yt,A=>Xt=A,()=>Xt);var ai=C(He,2);{var si=A=>{var K=p9();ne("click",K,Ki),T(A,K)},ji=A=>{var K=m9();Z(Me=>K.disabled=Me,[()=>!u(r).trim()||!u(Ft)]),ne("click",K,un),T(A,K)};$(ai,A=>{u(a)?A(si):A(ji,-1)})}var kn=C(tt,2);{var Mi=A=>{var K=y9(),Me=x(K),ye=x(Me),De=C(Me,2);{var Ce=Ee=>{var Et=v9();_i(Et,21,()=>u(g),Nn,(We,H)=>{var Q=_9(),xe=x(Q),Ze={};Z(()=>{q(xe,u(H)),Ze!==(Ze=u(H))&&(Q.value=(Q.__value=u(H))??"")}),T(We,Q)}),Z(()=>Et.disabled=u(a)),ga(Et,()=>u(f),We=>I(f,We)),T(Ee,Et)},oe=Ee=>{var Et=b9(),We=x(Et);Z(()=>q(We,u(f)||u(h).model)),T(Ee,Et)};$(De,Ee=>{u(g).length>0?Ee(Ce):Ee(oe,-1)})}var it=C(De,2);{var qe=Ee=>{var Et=w9();ne("click",Et,En),T(Ee,Et)};$(it,Ee=>{u(h).provider==="ollama"&&Ee(qe)})}Z(()=>q(ye,u(h).provider)),T(A,K)};$(kn,A=>{u(Ft)&&u(h)&&A(Mi)})}var oi=C(Ci,2);{var Wi=A=>{var K=M9(),Me=x(K),ye=x(Me),De=x(ye),Ce=x(De),oe=C(De,2),it=C(ye,2),qe=x(it);{var Ee=H=>{var Q=S9();T(H,Q)},Et=H=>{var Q=C9(),xe=x(Q);Z(()=>q(xe,u(S))),T(H,Q)},We=H=>{var Q=T9(),xe=x(Q);{var Ze=Le=>{var le=x9(),me=C(bt(le)),Je=x(me);Z(()=>q(Je,u(_).version)),T(Le,le)};$(xe,Le=>{u(_).version&&Le(Ze)})}var et=C(xe,2);{var nt=Le=>{var le=L9(),me=C(bt(le)),Je=x(me);Z(()=>q(Je,u(_).details.family)),T(Le,le)};$(et,Le=>{var le;(le=u(_).details)!=null&&le.family&&Le(nt)})}var ft=C(et,2);{var we=Le=>{var le=k9(),me=C(bt(le)),Je=x(me);Z(()=>q(Je,u(_).details.parameter_size)),T(Le,le)};$(ft,Le=>{var le;(le=u(_).details)!=null&&le.parameter_size&&Le(we)})}var vt=C(ft,2);{var ut=Le=>{var le=I9(),me=C(bt(le)),Je=x(me);Z(()=>q(Je,u(_).details.quantization_level)),T(Le,le)};$(vt,Le=>{var le;(le=u(_).details)!=null&&le.quantization_level&&Le(ut)})}var he=C(vt,2);{var wt=Le=>{var le=E9(),me=C(bt(le),2);_i(me,21,()=>u(_).running,Nn,(Je,Ht)=>{var ge=D9(),Ke=x(ge);Z(gt=>q(Ke,`${u(Ht).name??""} · ${gt??""} VRAM`),[()=>Vi(u(Ht).size_vram)]),T(Je,ge)}),T(Le,le)},Xe=Le=>{var le=P9();T(Le,le)};$(he,Le=>{u(_).running&&u(_).running.length>0?Le(wt):u(_).running!==null&&Le(Xe,1)})}T(H,Q)};$(qe,H=>{u(y)?H(Ee):u(S)?H(Et,1):u(_)&&H(We,2)})}Z(()=>{var H;return q(Ce,`Ollama · ${(u(f)||((H=u(h))==null?void 0:H.model))??""}`)}),ne("click",K,()=>I(v,!1)),ne("click",Me,H=>H.stopPropagation()),ne("click",oe,()=>I(v,!1)),T(A,K)};$(oi,A=>{u(v)&&A(Wi)})}Z(A=>{q(ni,A),It=jt(tt,1,"input-row svelte-1twuiul",null,It,{"drag-over":u(Pe)}),ot=jt(He,1,"textarea-wrap svelte-1twuiul",null,ot,{loading:u(a)}),Rn(Yt,"placeholder",u(Ft)?"Ask anything… (Enter to send, Shift+Enter for newline, drag & drop files to add context)":"AI not configured"),Yt.disabled=u(a)||!u(Ft)},[()=>Vi(u(ei))]),Es(Ne,()=>u(V),A=>I(V,A)),Es(Tt,()=>u(F),A=>I(F,A)),Es(Ie,()=>u(Y),A=>I(Y,A)),ne("click",_e,Wn),ne("change",$e,Kn),is("dragover",tt,Hn),is("dragleave",tt,Bn),is("drop",tt,Fn),ne("keydown",Yt,Ti),Ei(Yt,()=>u(r),A=>I(r,A)),T(o,Li),To()}_r(["click","change","keydown"]);var A9=R('<div class="me svelte-1pxdb1"></div>');function By(o,e){Po(e,!0);let t=ng(e,"value",15,""),i=ng(e,"language",3,"javascript"),n,s,r=!1;vr(()=>{const c=i()==="json"?{formatOnPaste:!0,autoIndent:"full"}:{};s=Wa.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())})}),aw(()=>s==null?void 0:s.dispose()),Mn(()=>{!s||s.getValue()===t()||(r=!0,s.setValue(t()),r=!1)});var a=A9();bs(a,c=>n=c,()=>n),T(o,a),To()}var O9=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 &mdash; call <code class="svelte-rrt0o">emit(value)</code> to add to result.</div> <div class="welcome-links svelte-rrt0o"><a href="https://github.com/hobbyquaker/she/blob/main/doc/db/README.md" target="_blank" rel="noopener" class="svelte-rrt0o">sheDB docs</a> <span class="svelte-rrt0o">·</span> <a href="https://github.com/hobbyquaker/she/blob/main/doc/db/view-examples.md" target="_blank" rel="noopener" class="svelte-rrt0o">View examples</a> <span class="svelte-rrt0o">·</span> <a href="https://github.com/hobbyquaker/she" target="_blank" rel="noopener" class="svelte-rrt0o">GitHub</a></div></div></div>',1),F9=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>'),WD=R('<div class="form-error svelte-rrt0o"> </div>'),H9=R('<div class="new-item-form svelte-rrt0o"><input placeholder="device/lamp1" class="svelte-rrt0o"/> <button class="svelte-rrt0o">Create</button></div> <!>',1),BD=R("<li> </li>"),zD=R('<div class="error-bar svelte-rrt0o"> </div>'),VD=R('<div class="loading svelte-rrt0o">Loading…</div>'),W9=R('<div class="monaco-doc-wrap svelte-rrt0o"><!></div>'),B9=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),z9=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>'),V9=R('<div class="new-item-form svelte-rrt0o"><input placeholder="myView" class="svelte-rrt0o"/> <button class="svelte-rrt0o">Create</button></div> <!>',1),j9=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>'),U9=R('<span class="badge-error svelte-rrt0o">error</span>'),$9=R('<span class="badge-ok svelte-rrt0o"> </span>'),q9=R('<pre class="result-error svelte-rrt0o"> </pre>'),K9=R('<pre class="result-json svelte-rrt0o"> </pre>'),G9=R('<div class="view-result svelte-rrt0o"><div class="result-header svelte-rrt0o">Result <!></div> <!></div>'),Z9=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 &nbsp;·&nbsp; call <code>emit(this)</code> to include in result</span></div> <div class="monaco-view-wrap monaco-view-wrap--map svelte-rrt0o"><!></div></div> <div class="view-section svelte-rrt0o"><div class="section-title svelte-rrt0o">Reduce <span class="section-hint svelte-rrt0o">— receives <code>result</code> array, must <code>return</code> new value (optional)</span></div> <div class="monaco-view-wrap monaco-view-wrap--reduce svelte-rrt0o"><!></div></div> <div class="view-section view-section--options svelte-rrt0o"><label class="opt-check svelte-rrt0o"><input type="checkbox" class="svelte-rrt0o"/> <span class="checkmark svelte-rrt0o"></span> Publish to MQTT <span class="section-hint svelte-rrt0o">— publish view to MQTT topic <code> </code></span></label> <!></div> <!></div>'),X9=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),Y9=R('<div class="chat-resize-handle svelte-rrt0o" role="separator"></div> <div class="chat-pane svelte-rrt0o"><!></div>',1),J9=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>'),Q9=R('<div class="db-root svelte-rrt0o" role="presentation"><div class="panel-tabs svelte-rrt0o"><button>Documents</button> <button>Views</button> <!></div> <!></div>');function eZ(o,e){Po(e,!0);const t=Be=>{var G=O9(),Ae=bt(G);bs(Mg(Ae,{}),ct=>dn=ct,()=>dn),T(Be,G)};let i=z(wi([])),n=z(null),s=z("{}"),r=z(!1),a=z(null);const c="she-db-selected-view";let h=z(wi([])),g=z(wi(localStorage.getItem(c))),f=z("#"),p=z("// emit(this.someProperty)"),v=z(""),_=z(""),y=z(!1),S=z(!1),D=z(null),E=z(!1),N=z(null),V=z("she/db/view/");const F="she-db-panel";let Y=z(wi(localStorage.getItem(F)??"docs")),X=z(""),ue=z(!1),Pe=z(null),Ue=z(""),ve=z(!1),at=z(null);const Xt="she-db-sidebar-width";let Ct=z(wi(parseInt(localStorage.getItem(Xt)??"220",10))),Qt=!1,Ft=0,ei=0;const de="she-db-chat-width",xt="she-db-chat-open";let Oe=z(localStorage.getItem(xt)==="true"),Ye=z(wi(parseInt(localStorage.getItem(de)??"320",10))),Nt=!1,hi=0,zt=0;const Rt=st(()=>u(g)?{id:u(g),filter:u(f),map:u(p),reduce:u(v)}:null);function Dt(Be){Be.filter!==void 0&&I(f,Be.filter,!0),Be.map!==void 0&&I(p,Be.map,!0),Be.reduce!==void 0&&I(v,Be.reduce,!0)}Mn(()=>{localStorage.setItem(xt,String(u(Oe)))}),Mn(()=>{localStorage.setItem(F,u(Y))}),Mn(()=>{u(g)?localStorage.setItem(c,u(g)):localStorage.removeItem(c)});function ii(Be){Qt=!0,Ft=Be.clientX,ei=u(Ct),Be.preventDefault()}function mi(Be){Qt&&I(Ct,Math.max(140,Math.min(500,ei+Be.clientX-Ft)),!0),Nt&&I(Ye,Math.max(240,Math.min(600,zt-(Be.clientX-hi))),!0)}function _n(){Qt&&(Qt=!1,localStorage.setItem(Xt,String(u(Ct)))),Nt&&(Nt=!1,localStorage.setItem(de,String(u(Ye))))}function Zi(Be){Nt=!0,hi=Be.clientX,zt=u(Ye),Be.preventDefault()}async function vn(){try{I(i,await sR(),!0)}catch{}}async function En(){try{I(h,await oR(),!0)}catch{}}async function Vi(Be){I(n,Be,!0),I(a,null),I(r,!0);try{const G=await n8(Be);I(s,JSON.stringify(G,null,2),!0)}catch(G){I(a,G instanceof Error?G.message:String(G),!0)}finally{I(r,!1)}}async function qn(){if(u(n)){I(a,null);try{const Be=JSON.parse(u(s));await dD(u(n),Be)}catch(Be){I(a,Be instanceof Error?Be.message:String(Be),!0)}}}let dn;async function Ln(){if(u(n)&&await dn.show(`Delete document "${u(n)}"?`,{confirm:"Delete",danger:!0}))try{await s8(u(n)),I(n,null),I(s,"{}")}catch(Be){I(a,Be instanceof Error?Be.message:String(Be),!0)}}async function Wn(){const Be=u(X).trim();if(Be){I(Pe,null);try{await dD(Be,{}),I(ue,!1),I(X,""),await Vi(Be)}catch(G){I(Pe,G instanceof Error?G.message:String(G),!0)}}}async function hn(Be){I(g,Be,!0),I(N,null),I(E,!0),I(D,null);try{const G=await o8(Be);I(f,G.filter??"",!0),I(p,G.map,!0),I(v,G.reduce??"",!0),I(_,G.description??"",!0),I(y,G.mqttpub??!1,!0),I(S,G.retain??!1,!0),I(D,await Hy(Be).catch(()=>null),!0)}catch(G){I(N,G instanceof Error?G.message:String(G),!0)}finally{I(E,!1)}}async function Kn(){if(u(g)){I(N,null);try{const Be={map:u(p)};u(f).trim()&&(Be.filter=u(f).trim()),u(v).trim()&&(Be.reduce=u(v).trim()),u(_).trim()&&(Be.description=u(_).trim()),u(y)&&(Be.mqttpub=!0),u(S)&&(Be.retain=!0),await hD(u(g),Be)}catch(Be){I(N,Be instanceof Error?Be.message:String(Be),!0)}}}async function Fn(){if(u(g))try{I(D,await Hy(u(g)),!0)}catch(Be){I(N,Be instanceof Error?Be.message:String(Be),!0)}}async function Hn(){if(u(g)&&await dn.show(`Delete view "${u(g)}"?`,{confirm:"Delete",danger:!0}))try{await r8(u(g)),I(g,null),I(f,""),I(p,"// emit(this.someProperty)"),I(v,""),I(_,""),I(y,!1),I(S,!1),I(D,null)}catch(Be){I(N,Be instanceof Error?Be.message:String(Be),!0)}}async function Bn(){if(!u(Ue).trim())return;const Be=u(Ue).trim();I(at,null);try{await hD(Be,{map:"// emit(this.someProperty)"}),I(ve,!1),I(Ue,""),await En(),await hn(Be)}catch(G){I(at,G instanceof Error?G.message:String(G),!0)}}let un=z(""),Ki=z(""),Ti=st(()=>[...u(i)].filter(Be=>!u(un)||Be.toLowerCase().includes(u(un).toLowerCase())).sort()),Ge=st(()=>[...u(h)].filter(Be=>!u(Ki)||Be.toLowerCase().includes(u(Ki).toLowerCase())).sort());vr(()=>{vn(),En().then(()=>{u(g)&&u(h).includes(u(g))?hn(u(g)):I(g,null)}),G1().then(dt=>{const Wt=dt.dbPrefix||"she/db/",O=Wt.endsWith("/")?Wt:Wt+"/";I(V,O+"view/")}).catch(()=>{});const Be=Gl("db:ids",dt=>{I(i,dt.ids??[],!0)}),G=Gl("db:viewIds",dt=>{I(h,dt.ids??[],!0)}),Ae=Gl("db:change",async dt=>{const Wt=dt.id;u(n)===Wt&&(dt.doc===null?(I(n,null),I(s,"{}")):I(s,JSON.stringify(dt.doc,null,2),!0))}),ct=Gl("db:viewUpdate",async dt=>{const Wt=dt.id;u(g)===Wt&&I(D,await Hy(Wt).catch(()=>null),!0)});return()=>{Be(),G(),Ae(),ct()}});var Mt=Q9(),gi=x(Mt),Li=x(gi);let Ci;var on=C(Li,2);let ki;var jn=C(on,2);{var Pn=Be=>{var G=F9();let Ae;Z(()=>{Ae=jt(G,1,"ai-toggle svelte-rrt0o",null,Ae,{"ai-open":u(Oe)}),Rn(G,"title",u(Oe)?"Close AI assistant":"Open AI assistant")}),ne("click",G,()=>I(Oe,!u(Oe))),T(Be,G)};$(jn,Be=>{u(Y)==="views"&&Be(Pn)})}var Xn=C(gi,2);{var Tn=Be=>{var G=z9(),Ae=x(G);let ct;var dt=x(Ae),Wt=x(dt),O=C(dt,2);{var se=ht=>{var Ie=H9(),At=bt(Ie),ni=x(At),qt=C(ni,2),$t=C(At,2);{var ti=J=>{var _e=WD(),$e=x(_e);Z(()=>q($e,u(Pe))),T(J,_e)};$($t,J=>{u(Pe)&&J(ti)})}ne("keydown",ni,J=>J.key==="Enter"&&Wn()),Ei(ni,()=>u(X),J=>I(X,J)),ne("click",qt,Wn),T(ht,Ie)};$(O,ht=>{u(ue)&&ht(se)})}var be=C(O,2),j=x(be),pe=C(be,2);_i(pe,20,()=>u(Ti),ht=>ht,(ht,Ie)=>{var At=BD();let ni;var qt=x(At);Z(()=>{ni=jt(At,1,"flat-item svelte-rrt0o",null,ni,{"active-item":u(n)===Ie}),q(qt,Ie)}),ne("click",At,()=>Vi(Ie)),T(ht,At)});var Fe=C(Ae,2),ke=C(Fe,2),Ne=x(ke);{var Te=ht=>{var Ie=B9(),At=bt(Ie),ni=x(At),qt=x(ni),$t=C(ni,2),ti=C($t,2),J=C(At,2);{var _e=He=>{var ot=zD(),Yt=x(ot);Z(()=>q(Yt,u(a))),T(He,ot)};$(J,He=>{u(a)&&He(_e)})}var $e=C(J,2);{var tt=He=>{var ot=VD();T(He,ot)},It=He=>{var ot=W9(),Yt=x(ot);By(Yt,{language:"json",get value(){return u(s)},set value(ai){I(s,ai,!0)}}),T(He,ot)};$($e,He=>{u(r)?He(tt):He(It,-1)})}Z(()=>q(qt,u(n))),ne("click",$t,qn),ne("click",ti,Ln),T(ht,Ie)},Tt=ht=>{t(ht)};$(Ne,ht=>{u(n)?ht(Te):ht(Tt,-1)})}Z(()=>ct=jo(Ae,"",ct,{width:`${u(Ct)??""}px`})),ne("click",Wt,()=>{I(ue,!u(ue)),I(Pe,null)}),Ei(j,()=>u(un),ht=>I(un,ht)),ne("mousedown",Fe,ii),T(Be,G)},rn=Be=>{var G=J9(),Ae=x(G);let ct;var dt=x(Ae),Wt=x(dt),O=C(dt,2);{var se=At=>{var ni=V9(),qt=bt(ni),$t=x(qt),ti=C($t,2),J=C(qt,2);{var _e=$e=>{var tt=WD(),It=x(tt);Z(()=>q(It,u(at))),T($e,tt)};$(J,$e=>{u(at)&&$e(_e)})}ne("keydown",$t,$e=>$e.key==="Enter"&&Bn()),Ei($t,()=>u(Ue),$e=>I(Ue,$e)),ne("click",ti,Bn),T(At,ni)};$(O,At=>{u(ve)&&At(se)})}var be=C(O,2),j=x(be),pe=C(be,2);_i(pe,20,()=>u(Ge),At=>At,(At,ni)=>{var qt=BD();let $t;var ti=x(qt);Z(()=>{$t=jt(qt,1,"flat-item svelte-rrt0o",null,$t,{"active-item":u(g)===ni}),q(ti,ni)}),ne("click",qt,()=>hn(ni)),T(At,qt)});var Fe=C(Ae,2),ke=C(Fe,2),Ne=x(ke);{var Te=At=>{var ni=X9(),qt=bt(ni),$t=x(qt),ti=x($t),J=C($t,2),_e=C(J,2),$e=C(_e,2),tt=C(qt,2);{var It=ai=>{var si=zD(),ji=x(si);Z(()=>q(ji,u(N))),T(ai,si)};$(tt,ai=>{u(N)&&ai(It)})}var He=C(tt,2);{var ot=ai=>{var si=VD();T(ai,si)},Yt=ai=>{var si=Z9(),ji=x(si),kn=C(x(ji),2),Mi=x(kn),oi=C(ji,2),Wi=C(x(oi),2),A=x(Wi),K=C(oi,2),Me=C(x(K),2),ye=x(Me);By(ye,{language:"javascript",get value(){return u(p)},set value(nt){I(p,nt,!0)}});var De=C(K,2),Ce=C(x(De),2),oe=x(Ce);By(oe,{language:"javascript",get value(){return u(v)},set value(nt){I(v,nt,!0)}});var it=C(De,2),qe=x(it),Ee=x(qe),Et=C(Ee,4),We=C(x(Et)),H=x(We),Q=C(qe,2);{var xe=nt=>{var ft=j9(),we=x(ft);Es(we,()=>u(S),vt=>I(S,vt)),T(nt,ft)};$(Q,nt=>{u(y)&&nt(xe)})}var Ze=C(it,2);{var et=nt=>{var ft=G9(),we=x(ft),vt=C(x(we));{var ut=le=>{var me=U9();T(le,me)},he=le=>{var me=$9(),Je=x(me);Z(()=>q(Je,`${u(D).length??0??""} items · rev ${u(D)._rev??""}`)),T(le,me)};$(vt,le=>{u(D).error?le(ut):le(he,-1)})}var wt=C(we,2);{var Xe=le=>{var me=q9(),Je=x(me);Z(()=>q(Je,u(D).error)),T(le,me)},Le=le=>{var me=K9(),Je=x(me);Z(Ht=>q(Je,Ht),[()=>JSON.stringify(u(D).result,null,2)]),T(le,me)};$(wt,le=>{u(D).error?le(Xe):le(Le,-1)})}T(nt,ft)};$(Ze,nt=>{u(D)&&nt(et)})}Z(()=>q(H,`${u(V)??""}${u(g)??""} on every update`)),Ei(Mi,()=>u(_),nt=>I(_,nt)),Ei(A,()=>u(f),nt=>I(f,nt)),Es(Ee,()=>u(y),nt=>I(y,nt)),T(ai,si)};$(He,ai=>{u(E)?ai(ot):ai(Yt,-1)})}Z(()=>q(ti,u(g))),ne("click",J,Kn),ne("click",_e,Fn),ne("click",$e,Hn),T(At,ni)},Tt=At=>{t(At)};$(Ne,At=>{u(g)?At(Te):At(Tt,-1)})}var ht=C(ke,2);{var Ie=At=>{var ni=Y9(),qt=bt(ni),$t=C(qt,2);let ti;var J=x($t);R9(J,{get currentView(){return u(Rt)},onApplyView:Dt}),Z(()=>ti=jo($t,"",ti,{width:`${u(Ye)??""}px`})),ne("mousedown",qt,Zi),T(At,ni)};$(ht,At=>{u(Oe)&&At(Ie)})}Z(()=>ct=jo(Ae,"",ct,{width:`${u(Ct)??""}px`})),ne("click",Wt,()=>{I(ve,!u(ve)),I(at,null)}),Ei(j,()=>u(Ki),At=>I(Ki,At)),ne("mousedown",Fe,ii),T(Be,G)};$(Xn,Be=>{u(Y)==="docs"?Be(Tn):Be(rn,-1)})}Z(()=>{Ci=jt(Li,1,"svelte-rrt0o",null,Ci,{active:u(Y)==="docs"}),ki=jt(on,1,"svelte-rrt0o",null,ki,{active:u(Y)==="views"})}),ne("mousemove",Mt,mi),ne("mouseup",Mt,_n),is("mouseleave",Mt,_n),ne("click",Li,()=>I(Y,"docs")),ne("click",on,()=>I(Y,"views")),T(o,Mt),To()}_r(["mousemove","mouseup","click","keydown","mousedown"]);var tZ=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),iZ=R('<label class="svelte-1ua3isv">Pairing Code / QR <input type="text" placeholder="MT:..." class="svelte-1ua3isv"/></label>'),jD=R('<p class="err svelte-1ua3isv"> </p>'),nZ=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>'),sZ=R('<span class="device-name svelte-1ua3isv"> </span> <span class="device-nodeid svelte-1ua3isv"> </span>',1),oZ=R('<span class="device-name svelte-1ua3isv"> </span>'),rZ=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>'),aZ=R('<li class="empty svelte-1ua3isv">No paired devices</li>'),lZ=R('<p class="info svelte-1ua3isv">Loading…</p>'),cZ=R('<p class="device-subtitle svelte-1ua3isv"> </p>'),dZ=R('<span class="ep-chip svelte-1ua3isv"> </span>'),hZ=R('<span class="attr-id svelte-1ua3isv"> </span>'),uZ=R('<button class="attr-action-btn svelte-1ua3isv"> </button>'),gZ=R('<div class="attr-actions svelte-1ua3isv"></div>'),fZ=R('<span class="cmd-sep svelte-1ua3isv">,</span>'),pZ=R('<span class="cmd-name svelte-1ua3isv"> </span><span class="cmd-id svelte-1ua3isv"> </span>',1),mZ=R('<span class="cmd-id svelte-1ua3isv"> </span>'),_Z=R("<!> <!>",1),vZ=R('<span class="cmd-list svelte-1ua3isv"></span>'),bZ=R(' <span class="cmd-id svelte-1ua3isv"> </span>',1),wZ=R('<tr class="svelte-1ua3isv"><td class="svelte-1ua3isv"><!></td><td class="svelte-1ua3isv"> </td></tr>'),yZ=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>'),SZ=R('<th class="svelte-1ua3isv"> </th>'),CZ=R('<td class="svelte-1ua3isv"> </td>'),xZ=R('<tr class="svelte-1ua3isv"></tr>'),LZ=R('<table class="attr-arr-table svelte-1ua3isv"><thead class="svelte-1ua3isv"><tr class="svelte-1ua3isv"></tr></thead><tbody class="svelte-1ua3isv"></tbody></table>'),kZ=R('<tr class="svelte-1ua3isv"><td class="attr-obj-key svelte-1ua3isv"> </td><td class="attr-obj-val svelte-1ua3isv"> </td></tr>'),IZ=R('<table class="attr-obj-table svelte-1ua3isv"><tbody class="svelte-1ua3isv"></tbody></table>'),DZ=R('<a class="attr-link svelte-1ua3isv" target="_blank" rel="noopener noreferrer"> </a>'),EZ=R('<span class="attr-val svelte-1ua3isv"> </span>'),PZ=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>'),TZ=R('<tr class="cluster-hdr-row svelte-1ua3isv"><td colspan="3" class="cluster-hdr-cell svelte-1ua3isv"> </td></tr> <!>',1),MZ=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>'),NZ=R('<p class="no-clusters svelte-1ua3isv">No clusters</p>'),RZ=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>'),AZ=R('<div class="detail-hdr svelte-1ua3isv"><h2 class="svelte-1ua3isv"> </h2> <!> <p class="detail-nodeid svelte-1ua3isv"> </p></div> <!>',1),OZ=R('<p class="info svelte-1ua3isv">Select a device to view its endpoints.</p>'),FZ=R('<span class="stream-badge svelte-1ua3isv"> </span>'),HZ=R('<span class="stream-empty svelte-1ua3isv">Waiting for events…</span>'),zy=R('&nbsp;<span class="e-sub svelte-1ua3isv"> </span>',1),WZ=R('<span class="e-badge e-badge-status svelte-1ua3isv">status</span> <span class="e-node svelte-1ua3isv"> <!></span> <span> </span>',1),BZ=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),zZ=R('<div class="er svelte-1ua3isv"><span class="e-ts svelte-1ua3isv"> </span> <!></div>'),VZ=R('<div class="stream-body svelte-1ua3isv"><!></div>'),jZ=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 UZ(o,e){Po(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(G,Ae,ct,dt,Wt){try{await b8(G,Ae,ct,dt,Wt)}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(G,Ae){const ct=n[G];return Ae.map(dt=>{const Wt=typeof dt=="number"?dt:Number(dt);return{id:Wt,name:(ct==null?void 0:ct[Wt])??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(G){return"0x"+G.toString(16).toUpperCase().padStart(4,"0")}let g=z(wi([])),f=wi(new Map);function p(G){if(G==null)return"—";if(typeof G=="boolean"||typeof G=="number")return String(G);if(typeof G=="string")return G.length>50?G.slice(0,47)+"…":G;const Ae=JSON.stringify(G);return Ae.length>60?Ae.slice(0,57)+"…":Ae}function v(G){return G==null?"—":typeof G=="boolean"||typeof G=="number"?String(G):typeof G=="string"?G:JSON.stringify(G)}function _(G){return G!==null&&typeof G=="object"&&!Array.isArray(G)}function y(G){return Array.isArray(G)&&G.length>0&&G.every(_)}function S(G,Ae){return!!(Ae==="attributeList"||Array.isArray(G)&&G.length===0||_(G)&&Object.keys(G).length===0)}function D(G){return new Date(G).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}const E=500,N=20,V=32;let F=0,Y=z(wi([])),X=z(!0),ue=z(180),Pe=st(()=>{const G=Math.max(1,Math.floor((u(ue)-V)/N)+1);return u(Y).slice(0,G)});function Ue(G){G.preventDefault();const Ae=G.clientY,ct=u(ue);function dt(O){I(ue,Math.max(60,Math.min(600,ct+Ae-O.clientY)),!0)}function Wt(){document.removeEventListener("mousemove",dt),document.removeEventListener("mouseup",Wt)}document.addEventListener("mousemove",dt),document.addEventListener("mouseup",Wt)}let ve=z(null),at=z(!1),Xt=z(null),Ct=z(!1),Qt=z("passcode"),Ft=z(""),ei=z(""),de=z(""),xt=z(!1),Oe=z(null),Ye=z("");const Nt="she:matter:selectedNodeId";async function hi(){try{I(g,await rR(),!0);for(const G of u(g))v_(G.nodeId).then(Ae=>{f.set(G.nodeId,Ae)}).catch(()=>{});if(u(g).length>0&&!u(ve)){const G=localStorage.getItem(Nt),Ae=G&&u(g).find(ct=>ct.nodeId===G)?G:u(g)[0].nodeId;zt(Ae)}}catch{I(g,[],!0)}}async function zt(G){I(at,!0),I(Xt,null);try{I(ve,await v_(G),!0),f.set(G,u(ve)),localStorage.setItem(Nt,G)}catch(Ae){I(Xt,Ae instanceof Error?Ae.message:String(Ae),!0)}finally{I(at,!1)}}let Rt;async function Dt(G){var Ae;if(await Rt.show(`Unpair device ${G}?`,{confirm:"Unpair",danger:!0}))try{await v8(G),((Ae=u(ve))==null?void 0:Ae.nodeId)===G&&I(ve,null),await hi()}catch(ct){I(Xt,ct instanceof Error?ct.message:String(ct),!0)}}async function ii(){I(xt,!0),I(Oe,null);try{let G;u(Qt)==="passcode"?(G={passcode:Number(u(Ft))},u(ei)&&(G={...G,discriminator:Number(u(ei))})):G={pairingCode:u(de).trim()},u(Ye).trim()&&(G={...G,discoveryAddress:u(Ye).trim()}),await _8(G),I(Ct,!1),I(Ft,""),I(ei,""),I(de,""),I(Ye,""),await hi()}catch(G){I(Oe,G instanceof Error?G.message:String(G),!0)}finally{I(xt,!1)}}vr(()=>{hi()});const mi=Gl("matter:deviceList",G=>{if(!Array.isArray(G.devices))return;const Ae=G.devices;for(const ct of Ae)f.has(ct.nodeId)||v_(ct.nodeId).then(dt=>{f.set(ct.nodeId,dt)}).catch(()=>{});I(g,Ae,!0)}),_n=Gl("matter:deviceStatus",G=>{if(G.nodeId===void 0)return;const Ae=String(G.nodeId),ct=!!G.online;I(g,u(g).map(dt=>dt.nodeId===Ae?{...dt,online:ct}:dt),!0),I(Y,[{id:F++,kind:"status",nodeId:Ae,online:ct,ts:Date.now()},...u(Y).slice(0,E-1)],!0)}),Zi=Gl("matter:attr",G=>{const Ae=String(G.nodeId),ct=G.endpointId,dt=String(G.clusterName),Wt=String(G.attrName),O=G.value;if(u(ve)&&u(ve).nodeId===Ae){const be=u(ve).endpoints.find(pe=>pe.endpointId===ct),j=be==null?void 0:be.clusters.find(pe=>pe.name===dt);j&&(j.attrs[Wt]=O)}const se=f.get(Ae);if(se){const be=se.endpoints.find(pe=>pe.endpointId===ct),j=be==null?void 0:be.clusters.find(pe=>pe.name===dt);j&&(j.attrs[Wt]=O)}I(Y,[{id:F++,kind:"attr",nodeId:Ae,endpointId:ct,clusterName:dt,attrName:Wt,value:O,ts:G.ts??Date.now()},...u(Y).slice(0,E-1)],!0)});aw(()=>{mi(),_n(),Zi()});var vn=jZ(),En=bt(vn);bs(Mg(En,{}),G=>Rt=G,()=>Rt);var Vi=C(En,2),qn=x(Vi),dn=x(qn),Ln=x(dn),Wn=C(x(Ln),2),hn=C(Ln,2);{var Kn=G=>{var Ae=nZ(),ct=x(Ae),dt=x(ct);let Wt;var O=C(dt,2);let se;var be=C(ct,2);{var j=Ie=>{var At=tZ(),ni=bt(At),qt=C(x(ni)),$t=C(ni,2),ti=C(x($t));Ei(qt,()=>u(Ft),J=>I(Ft,J)),Ei(ti,()=>u(ei),J=>I(ei,J)),T(Ie,At)},pe=Ie=>{var At=iZ(),ni=C(x(At));Ei(ni,()=>u(de),qt=>I(de,qt)),T(Ie,At)};$(be,Ie=>{u(Qt)==="passcode"?Ie(j):Ie(pe,-1)})}var Fe=C(be,2),ke=C(x(Fe)),Ne=C(Fe,2);{var Te=Ie=>{var At=jD(),ni=x(At);Z(()=>q(ni,u(Oe))),T(Ie,At)};$(Ne,Ie=>{u(Oe)&&Ie(Te)})}var Tt=C(Ne,2),ht=x(Tt);Z(()=>{Wt=jt(dt,1,"svelte-1ua3isv",null,Wt,{active:u(Qt)==="passcode"}),se=jt(O,1,"svelte-1ua3isv",null,se,{active:u(Qt)==="pairingCode"}),Tt.disabled=u(xt),q(ht,u(xt)?"Commissioning…":"Commission")}),ne("click",dt,()=>I(Qt,"passcode")),ne("click",O,()=>I(Qt,"pairingCode")),Ei(ke,()=>u(Ye),Ie=>I(Ye,Ie)),ne("click",Tt,ii),T(G,Ae)};$(hn,G=>{u(Ct)&&G(Kn)})}var Fn=C(hn,2),Hn=x(Fn);_i(Hn,17,()=>u(g),G=>G.nodeId,(G,Ae)=>{var ct=rZ();let dt;var Wt=x(ct),O=x(Wt);let se;var be=C(O,2),j=x(be);{var pe=Ne=>{var Te=sZ(),Tt=bt(Te),ht=x(Tt),Ie=C(Tt,2),At=x(Ie);Z(()=>{q(ht,u(Ae).name),q(At,`#${u(Ae).nodeId??""}`)}),T(Ne,Te)},Fe=Ne=>{var Te=oZ(),Tt=x(Te);Z(()=>q(Tt,`Node ${u(Ae).nodeId??""}`)),T(Ne,Te)};$(j,Ne=>{u(Ae).name?Ne(pe):Ne(Fe,-1)})}var ke=C(Wt,2);Z(()=>{var Ne;dt=jt(ct,1,"svelte-1ua3isv",null,dt,{selected:((Ne=u(ve))==null?void 0:Ne.nodeId)===u(Ae).nodeId}),se=jt(O,1,"status-dot svelte-1ua3isv",null,se,{online:u(Ae).online})}),ne("click",Wt,()=>zt(u(Ae).nodeId)),ne("click",ke,()=>Dt(u(Ae).nodeId)),T(G,ct)});var Bn=C(Hn,2);{var un=G=>{var Ae=aZ();T(G,Ae)};$(Bn,G=>{u(g).length===0&&G(un)})}var Ki=C(dn,2),Ti=x(Ki);{var Ge=G=>{var Ae=lZ();T(G,Ae)},Mt=G=>{var Ae=jD(),ct=x(Ae);Z(()=>q(ct,u(Xt))),T(G,Ae)},gi=G=>{var Ae=AZ(),ct=bt(Ae),dt=x(ct),Wt=x(dt),O=C(dt,2);{var se=Fe=>{var ke=cZ(),Ne=x(ke);Z(()=>q(Ne,u(ve).subtitle)),T(Fe,ke)};$(O,Fe=>{u(ve).subtitle&&Fe(se)})}var be=C(O,2),j=x(be),pe=C(ct,2);_i(pe,17,()=>u(ve).endpoints,Fe=>Fe.endpointId,(Fe,ke)=>{var Ne=RZ(),Te=x(Ne),Tt=x(Te),ht=C(Tt),Ie=x(ht),At=C(ht,2);_i(At,21,()=>u(ke).clusters,Nn,(ti,J)=>{var _e=dZ(),$e=x(_e);Z(()=>q($e,u(J).name)),T(ti,_e)});var ni=C(Te,2);{var qt=ti=>{var J=MZ(),_e=C(x(J));_i(_e,21,()=>u(ke).clusters,Nn,($e,tt)=>{var It=TZ(),He=bt(It),ot=x(He),Yt=x(ot),ai=C(He,2);_i(ai,17,()=>Object.entries(u(tt).attrs),Nn,(si,ji)=>{var kn=st(()=>dk(u(ji),2));let Mi=()=>u(kn)[0],oi=()=>u(kn)[1];var Wi=Ts(),A=bt(Wi);{var K=ye=>{const De=st(()=>{var me;return(me=t[u(tt).name])==null?void 0:me[Mi()]}),Ce=st(()=>(Mi()==="acceptedCommandList"||Mi()==="generatedCommandList")&&Array.isArray(oi())),oe=st(()=>{var me;return((me=c[u(tt).name])==null?void 0:me[Mi()])??a[Mi()]});var it=PZ(),qe=x(it),Ee=x(qe),Et=x(Ee),We=C(Ee);{var H=me=>{var Je=hZ(),Ht=x(Je);Z(ge=>q(Ht,`(${ge??""})`),[()=>h(u(oe))]),T(me,Je)};$(We,me=>{u(oe)!==void 0&&me(H)})}var Q=C(qe),xe=x(Q);{var Ze=me=>{var Je=gZ();_i(Je,21,()=>u(De),Nn,(Ht,ge)=>{var Ke=uZ(),gt=x(Ke);Z(()=>q(gt,u(ge).label)),ne("click",Ke,()=>i(u(ve).nodeId,u(ke).endpointId,u(tt).name,u(ge).command,u(ge).args)),T(Ht,Ke)}),T(me,Je)};$(xe,me=>{u(De)&&me(Ze)})}var et=C(Q),nt=x(et);{var ft=me=>{var Je=vZ();_i(Je,21,()=>s(u(tt).name,oi()),Nn,(Ht,ge,Ke)=>{var gt=_Z(),yt=bt(gt);{var Qe=tn=>{var ri=fZ();T(tn,ri)};$(yt,tn=>{Ke>0&&tn(Qe)})}var li=C(yt,2);{var Jt=tn=>{var ri=pZ(),Vt=bt(ri),an=x(Vt),ci=C(Vt),bn=x(ci);Z(()=>{q(an,u(ge).name),q(bn,`(${u(ge).id??""})`)}),T(tn,ri)},Un=tn=>{var ri=mZ(),Vt=x(ri);Z(()=>q(Vt,u(ge).id)),T(tn,ri)};$(li,tn=>{u(ge).name?tn(Jt):tn(Un,-1)})}T(Ht,gt)}),T(me,Je)},we=me=>{var Je=yZ(),Ht=C(x(Je));_i(Ht,21,oi,Nn,(ge,Ke)=>{const gt=st(()=>u(Ke)),yt=st(()=>u(gt).deviceType),Qe=st(()=>r[u(yt)]);var li=wZ(),Jt=x(li),Un=x(Jt);{var tn=ci=>{var bn=bZ(),Xi=bt(bn),ys=C(Xi),Mo=x(ys);Z(qr=>{q(Xi,`${u(Qe)??""} `),q(Mo,`(${qr??""})`)},[()=>h(u(yt))]),T(ci,bn)},ri=ci=>{var bn=Fr();Z(Xi=>q(bn,Xi),[()=>h(u(yt))]),T(ci,bn)};$(Un,ci=>{u(Qe)?ci(tn):ci(ri,-1)})}var Vt=C(Jt),an=x(Vt);Z(ci=>q(an,ci),[()=>v(u(gt).revision)]),T(ge,li)}),T(me,Je)},vt=st(()=>Mi()==="deviceTypeList"&&Array.isArray(oi())),ut=me=>{const Je=st(()=>[...new Set(oi().flatMap(yt=>Object.keys(yt)))]);var Ht=LZ(),ge=x(Ht),Ke=x(ge);_i(Ke,21,()=>u(Je),Nn,(yt,Qe)=>{var li=SZ(),Jt=x(li);Z(()=>q(Jt,u(Qe))),T(yt,li)});var gt=C(ge);_i(gt,21,oi,Nn,(yt,Qe)=>{var li=xZ();_i(li,21,()=>u(Je),Nn,(Jt,Un)=>{var tn=CZ(),ri=x(tn);Z(Vt=>q(ri,Vt),[()=>v(u(Qe)[u(Un)])]),T(Jt,tn)}),T(yt,li)}),T(me,Ht)},he=st(()=>y(oi())),wt=me=>{var Je=IZ(),Ht=x(Je);_i(Ht,21,()=>Object.entries(oi()),Nn,(ge,Ke)=>{var gt=st(()=>dk(u(Ke),2));let yt=()=>u(gt)[0],Qe=()=>u(gt)[1];var li=kZ(),Jt=x(li),Un=x(Jt),tn=C(Jt),ri=x(tn);Z(Vt=>{q(Un,yt()),q(ri,Vt)},[()=>v(Qe())]),T(ge,li)}),T(me,Je)},Xe=st(()=>_(oi())),Le=me=>{var Je=DZ(),Ht=x(Je);Z(()=>{Rn(Je,"href",oi()),q(Ht,oi())}),T(me,Je)},le=me=>{var Je=EZ(),Ht=x(Je);Z(ge=>q(Ht,ge),[()=>v(oi())]),T(me,Je)};$(nt,me=>{u(Ce)?me(ft):u(vt)?me(we,1):u(he)?me(ut,2):u(Xe)?me(wt,3):(Mi()==="productUrl"||Mi()==="productURL")&&typeof oi()=="string"?me(Le,4):me(le,-1)})}Z(()=>{Rn(qe,"title",Mi()),q(Et,Mi())}),T(ye,it)},Me=st(()=>!S(oi(),Mi()));$(A,ye=>{u(Me)&&ye(K)})}T(si,Wi)}),Z(()=>q(Yt,u(tt).name)),T($e,It)}),T(ti,J)},$t=ti=>{var J=NZ();T(ti,J)};$(ni,ti=>{u(ke).clusters.length>0?ti(qt):ti($t,-1)})}Z(()=>{q(Tt,`${u(ke).name??`Endpoint ${u(ke).endpointId}`??""} `),q(Ie,`ep${u(ke).endpointId??""}`)}),T(Fe,Ne)}),Z(()=>{q(Wt,u(ve).name??`Node ${u(ve).nodeId}`),q(j,`Node ID: ${u(ve).nodeId??""}`)}),T(G,Ae)},Li=G=>{var Ae=OZ();T(G,Ae)};$(Ti,G=>{u(at)?G(Ge):u(Xt)?G(Mt,1):u(ve)?G(gi,2):G(Li,-1)})}var Ci=C(qn,2),on=x(Ci),ki=C(on,2),jn=C(x(ki),2);{var Pn=G=>{var Ae=FZ(),ct=x(Ae);Z(()=>q(ct,u(Y).length)),T(G,Ae)};$(jn,G=>{!u(X)&&u(Y).length>0&&G(Pn)})}var Xn=C(jn,2),Tn=x(Xn),rn=C(ki,2);{var Be=G=>{var Ae=VZ(),ct=x(Ae);{var dt=O=>{var se=HZ();T(O,se)},Wt=O=>{var se=Ts(),be=bt(se);_i(be,17,()=>u(Pe),j=>j.id,(j,pe)=>{const Fe=st(()=>{var qt,$t;return((qt=f.get(u(pe).nodeId))==null?void 0:qt.name)??(($t=u(g).find(ti=>ti.nodeId===u(pe).nodeId))==null?void 0:$t.name)??null}),ke=st(()=>{var qt,$t;return u(pe).endpointId!==void 0?(($t=(qt=f.get(u(pe).nodeId))==null?void 0:qt.endpoints.find(ti=>ti.endpointId===u(pe).endpointId))==null?void 0:$t.name)??null:null}),Ne=st(()=>u(pe).attrName??u(pe).clusterName);var Te=zZ(),Tt=x(Te),ht=x(Tt),Ie=C(Tt,2);{var At=qt=>{var $t=WZ(),ti=C(bt($t),2),J=x(ti),_e=C(J);{var $e=ot=>{var Yt=zy(),ai=C(bt(Yt)),si=x(ai);Z(()=>q(si,`(#${u(pe).nodeId??""})`)),T(ot,Yt)};$(_e,ot=>{u(Fe)&&ot($e)})}var tt=C(ti,2);let It;var He=x(tt);Z(()=>{q(J,u(Fe)??`#${u(pe).nodeId}`),It=jt(tt,1,"e-val svelte-1ua3isv",null,It,{"e-online":u(pe).online,"e-offline":!u(pe).online}),q(He,u(pe).online?"online":"offline")}),T(qt,$t)},ni=qt=>{var $t=BZ(),ti=C(bt($t),2),J=x(ti),_e=C(J);{var $e=oi=>{var Wi=zy(),A=C(bt(Wi)),K=x(A);Z(()=>q(K,`(#${u(pe).nodeId??""})`)),T(oi,Wi)};$(_e,oi=>{u(Fe)&&oi($e)})}var tt=C(ti,2),It=x(tt),He=C(It);{var ot=oi=>{var Wi=zy(),A=C(bt(Wi)),K=x(A);Z(()=>q(K,`(ep ${u(pe).endpointId??""})`)),T(oi,Wi)};$(He,oi=>{u(ke)&&oi(ot)})}var Yt=C(tt,2),ai=x(Yt),si=C(Yt,2),ji=x(si),kn=C(si,2),Mi=x(kn);Z(oi=>{q(J,u(Fe)??`#${u(pe).nodeId}`),q(It,u(ke)??`ep${u(pe).endpointId}`),q(ai,u(pe).clusterName),q(ji,u(Ne)),q(Mi,oi)},[()=>p(u(pe).value)]),T(qt,$t)};$(Ie,qt=>{u(pe).kind==="status"?qt(At):qt(ni,-1)})}Z(qt=>q(ht,qt),[()=>D(u(pe).ts)]),T(j,Te)}),T(O,se)};$(ct,O=>{u(Pe).length===0?O(dt):O(Wt,-1)})}T(G,Ae)};$(rn,G=>{u(X)&&G(Be)})}Z(()=>{jo(Ci,u(X)?`height: ${u(ue)}px;`:""),q(Tn,u(X)?"▾":"▸")}),ne("click",Wn,()=>I(Ct,!u(Ct))),ne("mousedown",on,Ue),ne("click",Xn,()=>{I(X,!u(X))}),T(o,vn),To()}_r(["click","mousedown"]);var $Z=R("<button>›</button>"),qZ=R('<span class="chev-ph svelte-1vejtrc"></span>'),KZ=R('<span class="tv svelte-1vejtrc"> </span> <span class="tt svelte-1vejtrc"> </span>',1),GZ=R('<div class="tc svelte-1vejtrc"></div>'),ZZ=R('<div class="tn svelte-1vejtrc"><div><!> <span class="seg svelte-1vejtrc"> </span> <!></div> <!></div>'),XZ=R("<option></option>"),YZ=R('<span class="pub-ok svelte-1vejtrc">✓</span>'),JZ=R('<span class="pub-err svelte-1vejtrc"> </span>'),QZ=R('<div class="info svelte-1vejtrc">Loading…</div>'),eX=R('<div class="info err svelte-1vejtrc"> </div>'),tX=R('<div class="info svelte-1vejtrc">No topics match.</div>'),iX=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>'),nX=R('<div class="vs svelte-1vejtrc"><div><div class="vrows-abs svelte-1vejtrc"></div></div></div>'),sX=R('<div class="info svelte-1vejtrc">No topics yet.</div>'),oX=R('<div class="tree-wrap svelte-1vejtrc"><!></div>'),rX=R('<span class="stream-badge"> </span>'),aX=R('<span class="stream-empty svelte-1vejtrc">Waiting for messages…</span>'),lX=R('<span class="s-ret svelte-1vejtrc" title="retained snapshot">&#x229B;</span>'),cX=R('<div><span class="s-ts svelte-1vejtrc"> </span> <!> <span class="s-topic svelte-1vejtrc"> </span> <span class="s-val svelte-1vejtrc"> </span></div>'),dX=R('<div class="stream-body svelte-1vejtrc"><!></div>'),hX=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),uX=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>'),gX=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),fX=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 pX(o,e){Po(e,!0);const t=(J,_e=iw)=>{const $e=st(()=>u(f).has(_e().path)),tt=st(()=>u(a)>=0&&_e().children.size>0),It=st(()=>u(a)>=0&&_e().isLeaf&&!n.has(_e().path));var He=ZZ(),ot=x(He);let Yt;var ai=x(ot);{var si=ye=>{var De=$Z();let Ce;Z(()=>{Ce=jt(De,1,"chev svelte-1vejtrc",null,Ce,{open:u($e)}),Rn(De,"aria-label",u($e)?"Collapse":"Expand")}),ne("click",De,()=>p(_e().path)),T(ye,De)},ji=ye=>{var De=qZ();T(ye,De)};$(ai,ye=>{u(tt)?ye(si):ye(ji,-1)})}var kn=C(ai,2),Mi=x(kn),oi=C(kn,2);{var Wi=ye=>{var De=KZ(),Ce=bt(De),oe=x(Ce),it=C(Ce,2),qe=x(it);Z((Ee,Et,We)=>{Rn(Ce,"title",Ee),q(oe,Et),q(qe,We)},[()=>{var Ee;return Vi((Ee=Ln(_e().path))==null?void 0:Ee.val)},()=>{var Ee;return Vi((Ee=Ln(_e().path))==null?void 0:Ee.val)},()=>{var Ee;return((Ee=Ln(_e().path))==null?void 0:Ee.ts)!=null?qn(Ln(_e().path).ts):""}]),T(ye,De)},A=st(()=>_e().isLeaf&&i.has(_e().path));$(oi,ye=>{u(A)&&ye(Wi)})}var K=C(ot,2);{var Me=ye=>{var De=GZ();_i(De,21,()=>[..._e().children.values()].sort((Ce,oe)=>Ce.seg.localeCompare(oe.seg)),Ce=>Ce.path,(Ce,oe)=>{t(Ce,()=>u(oe))}),T(ye,De)};$(K,ye=>{u(tt)&&u($e)&&ye(Me)})}Z(()=>{Yt=jt(ot,1,"tr svelte-1vejtrc",null,Yt,{stale:u(It)}),q(Mi,_e().seg)}),ne("click",ot,()=>{I(at,_e().path+"/#")}),ne("contextmenu",ot,ye=>{ye.preventDefault(),I(Ye,{x:ye.clientX,y:ye.clientY,topic:_e().path},!0)}),T(J,He)},i=new Map,n=new Set,s=new Set;let r=null,a=z(0);function c(){r===null&&(r=requestAnimationFrame(()=>{r=null;for(const J of s)g(J);s.clear(),gk(a)}))}const h=new Map;function g(J){const _e=J.split("/");let $e=h,tt="";for(let It=0;It<_e.length;It++){const He=_e[It];tt=It===0?He:`${tt}/${He}`,$e.has(He)||$e.set(He,{seg:He,path:tt,children:new Map,isLeaf:!1});const ot=$e.get(He);It===_e.length-1&&(ot.isLeaf=!0),$e=ot.children}}let f=z(wi(new Set));function p(J){const _e=new Set(u(f));_e.has(J)?_e.delete(J):_e.add(J),I(f,_e,!0)}let v=z("");const _=24,y=5;let S=z(0),D=z(300),E=st(()=>{if(u(a),!u(v))return[];const J=u(v).toLowerCase().split(/\s+/).filter(Boolean),_e=[];for(const[$e,tt]of i){const It=$e.toLowerCase();J.every(He=>It.includes(He))&&_e.push({topic:$e,...tt})}return _e.sort(($e,tt)=>$e.topic.localeCompare(tt.topic))}),N=st(()=>{const J=u(E).length,_e=Math.max(0,Math.floor(u(S)/_)-y),$e=Math.min(J,Math.ceil((u(S)+u(D))/_)+y);return{start:_e,end:$e,totalH:J*_,top:_e*_}});const V=1e3,F=200,Y=20,X=36;let ue=0,Pe=z(wi([])),Ue=z(wi([])),ve=z(!0),at=z("#"),Xt=z(200);Mn(()=>{const J=u(at).trim(),_e=bl(()=>u(Pe)),$e=!J||J==="#"?_e.slice(0,F):_e.filter(tt=>Ct(J,tt.topic)).slice(0,F);if(J&&J!=="#"){const tt=new Set($e.map(He=>He.topic)),It=[];for(const[He,ot]of i)tt.has(He)||Ct(J,He)&&It.push({id:-(It.length+1),topic:He,val:ot.val,ts:ot.ts,retained:!0});It.sort((He,ot)=>He.topic.localeCompare(ot.topic)),I(Ue,[...$e,...It],!0)}else I(Ue,$e,!0)});function Ct(J,_e){if(J==="#")return!0;const $e=J.split("/"),tt=_e.split("/");for(let It=0;It<$e.length;It++){if($e[It]==="#")return!0;if(It>=tt.length||$e[It]!=="+"&&$e[It]!==tt[It])return!1}return $e.length===tt.length}function Qt(J){J.preventDefault();const _e=J.clientY,$e=u(Xt);function tt(He){I(Xt,Math.max(60,Math.min(800,$e+_e-He.clientY)),!0)}function It(){document.removeEventListener("mousemove",tt),document.removeEventListener("mouseup",It)}document.addEventListener("mousemove",tt),document.addEventListener("mouseup",It)}let Ft=st(()=>{const J=Math.max(1,Math.floor((u(Xt)-X)/Y)+1);return u(Ue).slice(0,J)}),ei=z(!0),de=z(null);async function xt(){I(ei,!0),I(de,null);try{const J=await aR();for(const _e of J)i.set(_e.topic,{val:_e.val,ts:_e.ts}),g(_e.topic)}catch(J){I(de,J instanceof Error?J.message:String(J),!0)}finally{I(ei,!1),gk(a)}}const Oe=Gl("mqtt",J=>{const{topic:_e,val:$e,ts:tt}=J;i.set(_e,{val:$e,ts:tt}),n.add(_e),s.add(_e),c();const It={id:ue++,topic:_e,val:$e,ts:tt};I(Pe,[It,...u(Pe).slice(0,V-1)],!0);const He=u(at).trim();(!He||He==="#"||Ct(He,_e))&&I(Ue,[It,...u(Ue).filter(ot=>!(ot.retained&&ot.topic===_e)).slice(0,F-1)],!0)});let Ye=z(null),Nt=z(null);async function hi(J,_e){const $e=[J];if(_e){const tt=J+"/";for(const It of i.keys())It.startsWith(tt)&&$e.push(It)}for(const tt of $e)await gD(tt,"",!0,0)}let zt=st(()=>(u(a),[...i.keys()].sort())),Rt=z(""),Dt=z(""),ii=z(!1),mi=z(0),_n=z(!1),Zi=z(null),vn=z(!1);async function En(){if(u(Rt)){I(_n,!0),I(Zi,null),I(vn,!1);try{await gD(u(Rt),u(Dt),u(ii),u(mi)),I(vn,!0),setTimeout(()=>{I(vn,!1)},2e3)}catch(J){I(Zi,J instanceof Error?J.message:String(J),!0)}finally{I(_n,!1)}}}function Vi(J){return J==null?"":typeof J=="object"?JSON.stringify(J):String(J)}function qn(J){return new Date(J).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function dn(J){return new Date(J).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function Ln(J){return u(a),i.get(J)}let Wn=st(()=>(u(a),[...h.values()].sort((J,_e)=>J.seg.localeCompare(_e.seg)))),hn=st(()=>(u(a),i.size));vr(xt),aw(()=>{Oe(),r!==null&&cancelAnimationFrame(r)});var Kn=fX(),Fn=C(x(Kn),2),Hn=x(Fn),Bn=x(Hn),un=C(Bn,2);_i(un,20,()=>u(zt),J=>J,(J,_e)=>{var $e=XZ(),tt={};Z(()=>{tt!==(tt=_e)&&($e.value=($e.__value=_e)??"")}),T(J,$e)});var Ki=C(un,2),Ti=C(Ki,2),Ge=x(Ti),Mt=C(Ti,2),gi=x(Mt);gi.value=gi.__value=0;var Li=C(gi);Li.value=Li.__value=1;var Ci=C(Li);Ci.value=Ci.__value=2;var on=C(Mt,2),ki=C(on,2);{var jn=J=>{var _e=YZ();T(J,_e)};$(ki,J=>{u(vn)&&J(jn)})}var Pn=C(ki,2);{var Xn=J=>{var _e=JZ(),$e=x(_e);Z(()=>q($e,u(Zi))),T(J,_e)};$(Pn,J=>{u(Zi)&&J(Xn)})}var Tn=C(Hn,2),rn=x(Tn),Be=C(rn,2),G=x(Be);{var Ae=J=>{var _e=Fr();Z(()=>q(_e,`${u(E).length??""} /`)),T(J,_e)};$(G,J=>{u(v)&&J(Ae)})}var ct=C(G),dt=C(Tn,2);{var Wt=J=>{var _e=QZ();T(J,_e)},O=J=>{var _e=eX(),$e=x(_e);Z(()=>q($e,u(de))),T(J,_e)},se=J=>{var _e=Ts(),$e=bt(_e);{var tt=He=>{var ot=tX();T(He,ot)},It=He=>{var ot=nX(),Yt=x(ot),ai=x(Yt);_i(ai,21,()=>u(E).slice(u(N).start,u(N).end),si=>si.topic,(si,ji)=>{var kn=iX(),Mi=x(kn),oi=x(Mi),Wi=C(Mi,2),A=x(Wi),K=C(Wi,2),Me=x(K);Z((ye,De,Ce)=>{q(oi,u(ji).topic),Rn(Wi,"title",ye),q(A,De),q(Me,Ce)},[()=>Vi(u(ji).val),()=>Vi(u(ji).val),()=>qn(u(ji).ts)]),T(si,kn)}),Z(()=>{jo(Yt,`height: ${u(N).totalH??""}px; position: relative;`),jo(ai,`top: ${u(N).top??""}px;`)}),is("scroll",ot,si=>{I(S,si.currentTarget.scrollTop,!0)}),CW(ot,"clientHeight",si=>I(D,si)),T(He,ot)};$($e,He=>{u(E).length===0?He(tt):He(It,-1)})}T(J,_e)},be=J=>{var _e=oX(),$e=x(_e);{var tt=He=>{var ot=sX();T(He,ot)},It=He=>{var ot=Ts(),Yt=bt(ot);_i(Yt,17,()=>u(Wn),ai=>ai.path,(ai,si)=>{t(ai,()=>u(si))}),T(He,ot)};$($e,He=>{u(Wn).length===0?He(tt):He(It,-1)})}T(J,_e)};$(dt,J=>{u(ei)?J(Wt):u(de)?J(O,1):u(v)?J(se,2):J(be,-1)})}var j=C(Fn,2),pe=x(j),Fe=C(pe,2),ke=x(Fe),Ne=C(ke,2);{var Te=J=>{var _e=rX(),$e=x(_e);Z(()=>q($e,u(Ue).length)),T(J,_e)};$(Ne,J=>{!u(ve)&&u(Ue).length>0&&J(Te)})}var Tt=C(Ne,2),ht=x(Tt),Ie=C(Fe,2);{var At=J=>{var _e=dX(),$e=x(_e);{var tt=He=>{var ot=aX();T(He,ot)},It=He=>{var ot=Ts(),Yt=bt(ot);_i(Yt,17,()=>u(Ft),ai=>ai.id,(ai,si)=>{var ji=cX();let kn;var Mi=x(ji),oi=x(Mi),Wi=C(Mi,2);{var A=Ce=>{var oe=lX();T(Ce,oe)};$(Wi,Ce=>{u(si).retained&&Ce(A)})}var K=C(Wi,2),Me=x(K),ye=C(K,2),De=x(ye);Z((Ce,oe,it)=>{kn=jt(ji,1,"sr svelte-1vejtrc",null,kn,{retained:u(si).retained}),q(oi,Ce),q(Me,u(si).topic),Rn(ye,"title",oe),q(De,it)},[()=>dn(u(si).ts),()=>Vi(u(si).val),()=>Vi(u(si).val)]),T(ai,ji)}),T(He,ot)};$($e,He=>{u(Ft).length===0?He(tt):He(It,-1)})}T(J,_e)};$(Ie,J=>{u(ve)&&J(At)})}var ni=C(j,2);{var qt=J=>{var _e=hX(),$e=bt(_e),tt=C($e,2);let It;var He=x(tt),ot=C(He,2);Z(()=>It=jo(tt,"",It,{left:`${u(Ye).x??""}px`,top:`${u(Ye).y??""}px`})),ne("click",$e,()=>I(Ye,null)),ne("contextmenu",$e,Yt=>{Yt.preventDefault(),I(Ye,null)}),ne("click",He,()=>{navigator.clipboard.writeText(u(Ye).topic),I(Ye,null)}),ne("click",ot,()=>{const Yt=u(Ye).topic,ai=Yt+"/",si=[...i.keys()].some(ji=>ji.startsWith(ai));I(Nt,{topic:Yt,hasChildren:si,recursive:!1},!0),I(Ye,null)}),T(J,_e)};$(ni,J=>{u(Ye)&&J(qt)})}var $t=C(ni,2);{var ti=J=>{var _e=gX(),$e=bt(_e),tt=C($e,2),It=C(x(tt),2),He=x(It),ot=C(x(He)),Yt=x(ot),ai=C(He,2);{var si=oi=>{var Wi=uX(),A=x(Wi);Es(A,()=>u(Nt).recursive,K=>u(Nt).recursive=K),T(oi,Wi)};$(ai,oi=>{u(Nt).hasChildren&&oi(si)})}var ji=C(It,2),kn=x(ji),Mi=C(kn,2);Z(()=>q(Yt,u(Nt).topic)),ne("click",$e,()=>I(Nt,null)),ne("click",kn,()=>I(Nt,null)),ne("click",Mi,()=>{const{topic:oi,recursive:Wi}=u(Nt);I(Nt,null),hi(oi,Wi)}),T(J,_e)};$($t,J=>{u(Nt)&&J(ti)})}Z(()=>{on.disabled=u(_n)||!u(Rt),q(ct,` ${u(hn)??""}`),jo(j,u(ve)?`height: ${u(Xt)}px;`:""),q(ht,u(ve)?"▾":"▸")}),Ei(Bn,()=>u(Rt),J=>I(Rt,J)),Ei(Ki,()=>u(Dt),J=>I(Dt,J)),Es(Ge,()=>u(ii),J=>I(ii,J)),ga(Mt,()=>u(mi),J=>I(mi,J)),ne("click",on,En),Ei(rn,()=>u(v),J=>I(v,J)),ne("mousedown",pe,Qt),Ei(ke,()=>u(at),J=>I(at,J)),ne("click",Tt,()=>{I(ve,!u(ve))}),T(o,Kn),To()}_r(["click","contextmenu","mousedown"]);var mX=R('<div class="restart-banner restart-banner--restarting svelte-twakcj">Restarting daemon…</div>'),_X=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>'),vX=R('<div class="err svelte-twakcj"> </div>'),bX=R('<span class="pane-count pane-count--warn svelte-twakcj"> </span>'),wX=R('<p class="empty svelte-twakcj">No packages installed.</p>'),yX=R('<p class="empty svelte-twakcj">No match.</p>'),SX=R('<span class="dep-latest svelte-twakcj"> </span>'),CX=uT('<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>'),xX=uT('<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>'),LX=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>'),kX=R('<span class="result-author svelte-twakcj"> </span>'),IX=R('<span class="result-date svelte-twakcj"> </span>'),DX=R('<span class="result-desc svelte-twakcj"> </span>'),EX=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>'),PX=R('<div class="results-list svelte-twakcj"></div>'),TX=R('<pre class="npm-output svelte-twakcj"> </pre>'),MX=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>`),NX=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 RX(o,e){Po(e,!0);let t=z(wi([])),i=z(""),n=z(wi({})),s=z(!1),r=z(""),a=z(wi([])),c=z(!1),h=z(!1),g=z(!1),f=z(""),p=z(""),v=wi({});const _=st(()=>u(i).trim()?u(t).filter(Ge=>Ge.name.toLowerCase().includes(u(i).toLowerCase())):u(t)),y=st(()=>Object.keys(u(n)).length);vr(async()=>{await Promise.all([S(),D()])});async function S(){try{I(t,await a8(),!0),I(f,"")}catch(Ge){I(f,Ge.message,!0)}}async function D(){try{I(n,await u8(),!0)}catch{}}async function E(){I(s,!0);try{I(n,await g8(),!0)}catch{}finally{I(s,!1)}}async function N(){const Ge=u(r).trim();if(!Ge){I(a,[],!0);return}I(g,!0),I(f,"");try{I(a,await l8(Ge),!0)}catch(Mt){I(f,Mt.message,!0)}finally{I(g,!1)}}function V(Ge){if(!Ge)return"";try{return new Date(Ge).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}async function F(Ge,Mt){v[Ge]=!0,I(f,""),I(p,"");try{const gi=await c8(Ge,Mt);I(p,gi.stdout||gi.stderr||"Done.",!0),I(c,!0),await S()}catch(gi){I(f,gi.message,!0)}finally{v[Ge]=!1}}async function Y(Ge){v[Ge]=!0,I(f,""),I(p,"");try{const Mt=await d8(Ge);I(p,Mt.stdout||Mt.stderr||"Done.",!0),I(c,!0);const gi={...u(n)};delete gi[Ge],I(n,gi,!0),await S()}catch(Mt){I(f,Mt.message,!0)}finally{v[Ge]=!1}}async function X(Ge){v[Ge]=!0,I(f,""),I(p,"");try{const Mt=await h8(Ge);I(p,Mt.stdout||Mt.stderr||"Done.",!0),I(c,!0);const gi={...u(n)};delete gi[Ge],I(n,gi,!0),await S()}catch(Mt){I(f,Mt.message,!0)}finally{v[Ge]=!1}}let ue;async function Pe(){if(await ue.show("Restart the she daemon? The page will reload after a moment.",{confirm:"Restart"})){I(h,!0);try{await nR()}catch{}setTimeout(()=>{window.location.reload()},3e3)}}var Ue=NX(),ve=bt(Ue);bs(Mg(ve,{}),Ge=>ue=Ge,()=>ue);var at=C(ve,2),Xt=x(at);{var Ct=Ge=>{var Mt=mX();T(Ge,Mt)},Qt=Ge=>{var Mt=_X(),gi=C(x(Mt));ne("click",gi,Pe),T(Ge,Mt)};$(Xt,Ge=>{u(h)?Ge(Ct):u(c)&&Ge(Qt,1)})}var Ft=C(Xt,2);{var ei=Ge=>{var Mt=vX(),gi=x(Mt);Z(()=>q(gi,u(f))),T(Ge,Mt)};$(Ft,Ge=>{u(f)&&Ge(ei)})}var de=C(Ft,2),xt=x(de),Oe=x(xt),Ye=C(x(Oe),2),Nt=x(Ye),hi=C(Ye,2);{var zt=Ge=>{var Mt=bX(),gi=x(Mt);Z(()=>q(gi,`${u(y)??""} outdated`)),T(Ge,Mt)};$(hi,Ge=>{u(y)>0&&Ge(zt)})}var Rt=C(hi,2),Dt=x(Rt);let ii;var mi=C(Oe,2),_n=x(mi),Zi=C(mi,2),vn=x(Zi);{var En=Ge=>{var Mt=wX();T(Ge,Mt)},Vi=Ge=>{var Mt=yX();T(Ge,Mt)},qn=Ge=>{var Mt=Ts(),gi=bt(Mt);_i(gi,17,()=>u(_),Li=>Li.name,(Li,Ci)=>{var on=LX();let ki;var jn=x(on),Pn=x(jn),Xn=x(Pn),Tn=C(Pn,2),rn=x(Tn),Be=C(Tn,2);{var G=j=>{var pe=SX(),Fe=x(pe);Z(()=>q(Fe,`→ v${u(n)[u(Ci).name].latest??""}`)),T(j,pe)};$(Be,j=>{u(n)[u(Ci).name]&&j(G)})}var Ae=C(jn,2),ct=x(Ae);let dt;var Wt=x(ct);{var O=j=>{var pe=CX();T(j,pe)},se=j=>{var pe=xX();T(j,pe)};$(Wt,j=>{v[u(Ci).name]?j(O):j(se,-1)})}var be=C(ct,2);Z(()=>{ki=jt(on,1,"dep-row svelte-twakcj",null,ki,{"dep-busy":!!v[u(Ci).name]}),Rn(Pn,"href",u(Ci).url??`https://www.npmjs.com/package/${u(Ci).name}`),q(Xn,u(Ci).name),q(rn,u(Ci).installedVersion??u(Ci).version),dt=jt(ct,1,"icon-btn svelte-twakcj",null,dt,{"icon-btn--update":!!u(n)[u(Ci).name]}),ct.disabled=!!v[u(Ci).name],Rn(ct,"title",u(n)[u(Ci).name]?`Update to v${u(n)[u(Ci).name].latest}`:"Update to latest"),be.disabled=!!v[u(Ci).name]}),ne("click",ct,()=>X(u(Ci).name)),ne("click",be,()=>Y(u(Ci).name)),T(Li,on)}),T(Ge,Mt)};$(vn,Ge=>{u(t).length===0?Ge(En):u(_).length===0?Ge(Vi,1):Ge(qn,-1)})}var dn=C(xt,2),Ln=C(x(dn),2),Wn=x(Ln),hn=C(Wn,2),Kn=x(hn),Fn=C(Ln,2);{var Hn=Ge=>{var Mt=PX();_i(Mt,21,()=>u(a),gi=>gi.name,(gi,Li)=>{var Ci=EX(),on=x(Ci),ki=x(on),jn=x(ki),Pn=C(ki,2),Xn=x(Pn),Tn=C(Pn,2);{var rn=O=>{var se=kX(),be=x(se);Z(()=>q(be,u(Li).author)),T(O,se)};$(Tn,O=>{u(Li).author&&O(rn)})}var Be=C(Tn,2);{var G=O=>{var se=IX(),be=x(se);Z(j=>{Rn(se,"title",u(Li).date),q(be,j)},[()=>V(u(Li).date)]),T(O,se)};$(Be,O=>{u(Li).date&&O(G)})}var Ae=C(Be,2);{var ct=O=>{var se=DX(),be=x(se);Z(()=>q(be,u(Li).description)),T(O,se)};$(Ae,O=>{u(Li).description&&O(ct)})}var dt=C(on,2),Wt=x(dt);Z(()=>{Rn(ki,"href",u(Li).url??`https://www.npmjs.com/package/${u(Li).name}`),q(jn,u(Li).name),q(Xn,u(Li).version),dt.disabled=!!v[u(Li).name],q(Wt,v[u(Li).name]?"Installing…":"Install")}),ne("click",dt,()=>F(u(Li).name)),T(gi,Ci)}),T(Ge,Mt)};$(Fn,Ge=>{u(a).length>0&&Ge(Hn)})}var Bn=C(Fn,2);{var un=Ge=>{var Mt=TX(),gi=x(Mt);Z(()=>q(gi,u(p))),T(Ge,Mt)};$(Bn,Ge=>{u(p)&&Ge(un)})}var Ki=C(Bn,2);{var Ti=Ge=>{var Mt=MX();T(Ge,Mt)};$(Ki,Ge=>{!u(a).length&&!u(p)&&Ge(Ti)})}Z(()=>{q(Nt,u(t).length),Rt.disabled=u(s),ii=jt(Dt,0,"svelte-twakcj",null,ii,{spinning:u(s)}),hn.disabled=u(g),q(Kn,u(g)?"Searching…":"Search")}),ne("click",Rt,E),Ei(_n,()=>u(i),Ge=>I(i,Ge)),ne("keydown",Wn,Ge=>Ge.key==="Enter"&&N()),Ei(Wn,()=>u(r),Ge=>I(r,Ge)),ne("click",hn,N),T(o,Ue),To()}_r(["click","keydown"]);var AX=R('<span class="update-dot svelte-1n46o8q" title="Update available"></span>'),OX=R('<dt class="svelte-1n46o8q">Latest</dt><dd style="color: #f90" class="svelte-1n46o8q"> </dd>',1),FX=R('<dt class="svelte-1n46o8q">Latest</dt><dd class="svelte-1n46o8q">up to date</dd>',1),HX=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"><polyline points="4 4 4 10 10 10"></polyline><path d="M4 10A9 9 0 1 0 6.5 5"></path></svg> </button>'),WX=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"></polyline><path d="M4 10A9 9 0 1 0 6.5 5"></path></svg> </button></div></div>'),BX=R('<dt class="svelte-1n46o8q">Uptime</dt><dd class="svelte-1n46o8q"> </dd>',1),zX=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),VX=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),jX=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>'),UX=R('<span class="stats-empty svelte-1n46o8q">Loading…</span>'),$X=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"><path d="M18.36 6.64a9 9 0 1 1-12.73 0"></path><line x1="12" y1="2" x2="12" y2="12"></line></svg> Restart daemon</button></div></div>'),qX=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"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path><polyline points="16 17 21 12 16 7"></polyline><line x1="21" y1="12" x2="9" y2="12"></line></svg></button>'),KX=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"><polyline points="5,3 1,8 5,13"></polyline><polyline points="11,3 15,8 11,13"></polyline></svg> Scripts</button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="square" stroke-linejoin="miter"><rect x="0.75" y="0.75" width="14.5" height="14.5" rx="1"></rect><path d="M2,11 V5 H5 V11"></path><path d="M6,12 V5 H9 V8 H6"></path><path d="M10,11 V5 H15 V11"></path><line x1="12.5" y1="5" x2="12.5" y2="11"></line></svg> Packages</button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" stroke="none" style="vertical-align: middle"><path fill-rule="evenodd" d="M2,0 H14 A2,2 0 0,1 16,2 V14 A2,2 0 0,1 14,16 H0 V2 A2,2 0 0,1 2,0 Z M0,16 L0,12 A4,4 0 0,1 4,16 Z M0,10.5 A5.5,5.5 0 0,1 5.5,16 L9,16 A9,9 0 0,0 0,7 Z M0,5.5 A10.5,10.5 0 0,1 10.5,16 L13.5,16 A13.5,13.5 0 0,0 0,2.5 Z"></path></svg> MQTT</button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M8,2 L8,7"></path><path d="M6,5 L8,7.5 L10,5"></path><path d="M2.5,14 L6,10"></path><path d="M6.2,12.8 L6,10 L3.2,10.2"></path><path d="M13.5,14 L10,10"></path><path d="M9.8,12.8 L10,10 L12.8,10.2"></path></svg> Matter</button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><ellipse cx="8" cy="4.5" rx="5" ry="1.8"></ellipse><path d="M3,4.5 v7 a5,1.8 0,0,0 10,0 v-7"></path><path d="M3,8 a5,1.8 0,0,0 10,0"></path></svg> DB</button> <button><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><line x1="2" y1="5" x2="14" y2="5"></line><line x1="2" y1="8" x2="14" y2="8"></line><line x1="2" y1="11" x2="9" y2="11"></line></svg> Logs</button> <div class="nav-spacer svelte-1n46o8q"></div> <div class="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"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg></a> <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"><line x1="18" y1="20" x2="18" y2="10"></line><line x1="12" y1="20" x2="12" y2="4"></line><line x1="6" y1="20" x2="6" y2="14"></line></svg></button> <!></div> <button title="Settings"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"></path><circle cx="12" cy="12" r="3"></circle></svg></button> <!></div></nav> <main class="svelte-1n46o8q"><!> <div><!></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div> <div><!></div></main></div>'),GX=R('<div class="login-error svelte-1n46o8q"> </div>'),ZX=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>'),XX=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"></polyline><path d="M4 10A9 9 0 1 0 6.5 5"></path></svg> Restarting smart-home-engine…</div></div>'),YX=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"></polyline><path d="M4 10A9 9 0 1 0 6.5 5"></path></svg> Updating smart-home-engine…</div></div>'),JX=R("<!> <!> <!> <!>",1);function QX(o,e){Po(e,!0);const t=["scripts","mqtt","matter","db","logs","config","packages"];function i(){const de=location.hash.slice(1);return t.includes(de)?de:"scripts"}let n=z(wi(i())),s=z(null),r=z(!1),a=z(!1),c=z(!1),h=z(!1),g=z("none"),f=z(""),p=z(!1),v=z(""),_=z(""),y=z(!1),S=z(!1);V7(()=>{I(p,!0)});async function D(){I(_,""),I(y,!0);try{await $7(u(v)),I(v,""),I(p,!1)}catch(de){I(_,de.message??"Login failed",!0)}finally{I(y,!1)}}async function E(){if(u(g)==="proxy"&&u(f)){window.location.href=u(f);return}await q7(),I(p,!0)}let N=z(null),V=z(!1);async function F(){if(!await u(N).show("Restart the she daemon? The page will reload after a moment.",{confirm:"Restart"}))return;I(V,!0);let de;try{de=(await gf()).startedAt}catch{}try{await nR()}catch{}const xt=Date.now()+6e4;for(;Date.now()<xt;){await new Promise(Oe=>setTimeout(Oe,250));try{const Oe=await gf();if(de===void 0||Oe.startedAt!==de){location.reload();return}}catch{}}location.reload()}async function Y(){I(c,!0);try{const de=await J7();u(s)&&I(s,{...u(s),latestVersion:de.latestVersion??void 0},!0)}catch{}finally{I(c,!1)}}async function X(){var Oe;if(!await u(N).show(`Update to v${(Oe=u(s))==null?void 0:Oe.latestVersion}? The daemon will restart after the update completes.`,{confirm:"Update"}))return;I(a,!1),I(h,!0);try{await Y7()}catch{}let de=!1;const xt=Date.now()+18e4;for(;Date.now()<xt;){await new Promise(Ye=>setTimeout(Ye,2e3));try{if(await gf(),de){location.reload();return}}catch{de=!0}}location.reload()}function ue(de){I(n,de,!0),location.hash=de}vr(async()=>{location.hash||(location.hash=u(n));const de=()=>{I(n,i(),!0)};window.addEventListener("hashchange",de);try{const Ye=await U7();I(g,Ye.mode,!0),I(f,Ye.proxyLogoutUrl??"",!0),u(g)==="password"&&(await fetch("/she/scripts")).status===401&&I(p,!0)}catch{}I(S,!0);async function xt(){try{I(s,await gf(),!0)}catch{}}xt();const Oe=setInterval(xt,5e3);return()=>{window.removeEventListener("hashchange",de),clearInterval(Oe)}});var Pe=JX();is("click",$P,()=>{u(r)&&I(r,!1),u(a)&&I(a,!1)});var Ue=bt(Pe);{var ve=de=>{var xt=KX(),Oe=x(xt),Ye=C(x(Oe),2);let Nt;var hi=C(Ye,2);let zt;var Rt=C(hi,2);let Dt;var ii=C(Rt,2);let mi;var _n=C(ii,2);let Zi;var vn=C(_n,2);let En;var Vi=C(vn,4),qn=C(x(Vi),2),dn=x(qn),Ln=x(dn);Ln.nodeValue="v0.26.3 ";var Wn=C(Ln);{var hn=Te=>{var Tt=AX();T(Te,Tt)};$(Wn,Te=>{var Tt;(Tt=u(s))!=null&&Tt.latestVersion&&Te(hn)})}var Kn=C(dn,2);{var Fn=Te=>{var Tt=WX(),ht=x(Tt),Ie=C(x(ht));Ie.textContent="v0.26.3";var At=C(Ie,2);{var ni=He=>{var ot=OX(),Yt=C(bt(ot)),ai=x(Yt);Z(()=>q(ai,`v${u(s).latestVersion??""}`)),T(He,ot)},qt=He=>{var ot=FX();T(He,ot)};$(At,He=>{var ot;(ot=u(s))!=null&&ot.latestVersion?He(ni):He(qt,-1)})}var $t=C(ht,2),ti=x($t);{var J=He=>{var ot=HX(),Yt=C(x(ot));Z(()=>q(Yt,` Update to v${u(s).latestVersion??""}`)),ne("click",ot,X),T(He,ot)};$(ti,He=>{var ot;(ot=u(s))!=null&&ot.latestVersion&&He(J)})}var _e=C(ti,2),$e=x(_e);let tt;var It=C($e);Z(()=>{_e.disabled=u(c),tt=jt($e,0,"svelte-1n46o8q",null,tt,{spinning:u(c)}),q(It,` ${u(c)?"Checking…":"Check for updates"}`)}),ne("click",Tt,He=>He.stopPropagation()),ne("click",_e,Y),T(Te,Tt)};$(Kn,Te=>{u(a)&&Te(Fn)})}var Hn=C(qn,2),Bn=x(Hn),un=C(Bn,2);{var Ki=Te=>{var Tt=$X(),ht=x(Tt);{var Ie=$t=>{var ti=jX(),J=x(ti);{var _e=ye=>{const De=st(()=>Math.floor((Date.now()-u(s).startedAt)/1e3)),Ce=st(()=>Math.floor(u(De)/86400)),oe=st(()=>Math.floor(u(De)%86400/3600)),it=st(()=>Math.floor(u(De)%3600/60));var qe=BX(),Ee=C(bt(qe)),Et=x(Ee);Z(()=>q(Et,`${u(Ce)>0?u(Ce)+"d ":""}${u(oe)>0||u(Ce)>0?u(oe)+"h ":""}${u(it)??""}m`)),T(ye,qe)};$(J,ye=>{u(s).startedAt&&ye(_e)})}var $e=C(J,3),tt=x($e),It=C($e,3),He=x(It),ot=C(It,3),Yt=x(ot),ai=C(ot,2);{var si=ye=>{var De=zX(),Ce=C(bt(De)),oe=x(Ce),it=C(Ce,3),qe=x(it);Z(()=>{q(oe,u(s).matterNodes??0),q(qe,u(s).matterEndpoints??0)}),T(ye,De)};$(ai,ye=>{u(s).matterEnabled&&ye(si)})}var ji=C(ai,2);{var kn=ye=>{var De=VX(),Ce=C(bt(De)),oe=x(Ce),it=C(Ce,3),qe=x(it);Z(()=>{q(oe,u(s).dbDocs??"—"),q(qe,u(s).dbViews??"—")}),T(ye,De)};$(ji,ye=>{u(s).dbEnabled&&ye(kn)})}var Mi=C(ji,3),oi=x(Mi),Wi=C(Mi,3),A=x(Wi),K=C(Wi,3),Me=x(K);Z(()=>{q(tt,u(s).scripts),q(He,u(s).topics),q(Yt,u(s).mqttMsgPerSec??"—"),q(oi,u(s).handlers??"—"),q(A,u(s).memMb!=null?u(s).memMb+" MB":"—"),q(Me,u(s).cpuPercent!=null?u(s).cpuPercent+" %":"—")}),T($t,ti)},At=$t=>{var ti=UX();T($t,ti)};$(ht,$t=>{u(s)?$t(Ie):$t(At,-1)})}var ni=C(ht,2),qt=x(ni);ne("click",Tt,$t=>$t.stopPropagation()),ne("click",qt,()=>{I(r,!1),F()}),T(Te,Tt)};$(un,Te=>{u(r)&&Te(Ki)})}var Ti=C(Hn,2);let Ge;var Mt=C(Ti,2);{var gi=Te=>{var Tt=qX();ne("click",Tt,E),T(Te,Tt)};$(Mt,Te=>{u(g)==="password"&&Te(gi)})}var Li=C(Oe,2),Ci=x(Li);bs(Mg(Ci,{}),Te=>I(N,Te,!0),()=>u(N));var on=C(Ci,2);let ki;var jn=x(on);{let Te=st(()=>u(n)==="scripts");rG(jn,{get active(){return u(Te)}})}var Pn=C(on,2);let Xn;var Tn=x(Pn);RX(Tn,{});var rn=C(Pn,2);let Be;var G=x(rn);pX(G,{});var Ae=C(rn,2);let ct;var dt=x(Ae);UZ(dt,{});var Wt=C(Ae,2);let O;var se=x(Wt);eZ(se,{});var be=C(Wt,2);let j;var pe=x(be);qG(pe,{});var Fe=C(be,2);let ke;var Ne=x(Fe);XG(Ne,{}),Z(()=>{Nt=jt(Ye,1,"svelte-1n46o8q",null,Nt,{active:u(n)==="scripts"}),zt=jt(hi,1,"svelte-1n46o8q",null,zt,{active:u(n)==="packages"}),Dt=jt(Rt,1,"svelte-1n46o8q",null,Dt,{active:u(n)==="mqtt"}),mi=jt(ii,1,"svelte-1n46o8q",null,mi,{active:u(n)==="matter"}),Zi=jt(_n,1,"svelte-1n46o8q",null,Zi,{active:u(n)==="db"}),En=jt(vn,1,"svelte-1n46o8q",null,En,{active:u(n)==="logs"}),Ge=jt(Ti,1,"nav-settings svelte-1n46o8q",null,Ge,{active:u(n)==="config"}),ki=jt(on,1,"page-wrap svelte-1n46o8q",null,ki,{hidden:u(n)!=="scripts"}),Xn=jt(Pn,1,"page-wrap svelte-1n46o8q",null,Xn,{hidden:u(n)!=="packages"}),Be=jt(rn,1,"page-wrap svelte-1n46o8q",null,Be,{hidden:u(n)!=="mqtt"}),ct=jt(Ae,1,"page-wrap svelte-1n46o8q",null,ct,{hidden:u(n)!=="matter"}),O=jt(Wt,1,"page-wrap svelte-1n46o8q",null,O,{hidden:u(n)!=="db"}),j=jt(be,1,"page-wrap svelte-1n46o8q",null,j,{hidden:u(n)!=="config"}),ke=jt(Fe,1,"page-wrap svelte-1n46o8q",null,ke,{hidden:u(n)!=="logs"})}),ne("click",Ye,()=>ue("scripts")),ne("click",hi,()=>ue("packages")),ne("click",Rt,()=>ue("mqtt")),ne("click",ii,()=>ue("matter")),ne("click",_n,()=>ue("db")),ne("click",vn,()=>ue("logs")),ne("click",dn,Te=>{Te.stopPropagation(),I(a,!u(a)),I(r,!1)}),ne("click",Bn,Te=>{Te.stopPropagation(),I(r,!u(r)),I(a,!1)}),ne("click",Ti,()=>ue("config")),T(de,xt)};$(Ue,de=>{u(S)&&!u(p)&&de(ve)})}var at=C(Ue,2);{var Xt=de=>{var xt=ZX(),Oe=x(xt),Ye=C(x(Oe),4),Nt=C(x(Ye),2),hi=C(Ye,2);{var zt=ii=>{var mi=GX(),_n=x(mi);Z(()=>q(_n,u(_))),T(ii,mi)};$(hi,ii=>{u(_)&&ii(zt)})}var Rt=C(hi,2),Dt=x(Rt);Z(()=>{Nt.disabled=u(y),Rt.disabled=u(y)||!u(v),q(Dt,u(y)?"Signing in…":"Sign in")}),is("submit",Oe,ii=>{ii.preventDefault(),D()}),Ei(Nt,()=>u(v),ii=>I(v,ii)),T(de,xt)};$(at,de=>{u(p)&&de(Xt)})}var Ct=C(at,2);{var Qt=de=>{var xt=XX();T(de,xt)};$(Ct,de=>{u(V)&&de(Qt)})}var Ft=C(Ct,2);{var ei=de=>{var xt=YX();T(de,xt)};$(Ft,de=>{u(h)&&de(ei)})}T(o,Pe),To()}_r(["click"]);cW(QX,{target:document.getElementById("app")});export{LT as t};
@@ -1,4 +1,4 @@
1
- import{m as O}from"./monaco-langs-BW2J83t5.js";import{t as I}from"./index-D8-_nETT.js";/*!-----------------------------------------------------------------------------
1
+ import{m as O}from"./monaco-langs-BW2J83t5.js";import{t as I}from"./index-DtmmxR--.js";/*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
4
4
  * Released under the MIT license
@@ -155,7 +155,7 @@
155
155
  }
156
156
  })();
157
157
  </script>
158
- <script type="module" crossorigin src="/assets/index-D8-_nETT.js"></script>
158
+ <script type="module" crossorigin src="/assets/index-DtmmxR--.js"></script>
159
159
  <link rel="modulepreload" crossorigin href="/assets/monaco-langs-BW2J83t5.js">
160
160
  <link rel="stylesheet" crossorigin href="/assets/monaco-langs-DyX1CsEw.css">
161
161
  <link rel="stylesheet" crossorigin href="/assets/index-CND95LL-.css">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smart-home-engine",
3
- "version": "0.26.2",
3
+ "version": "0.26.3",
4
4
  "description": "Node.js based script runner for use in MQTT based Smart Home environments",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -522,7 +522,7 @@ function createScript(source, name) {
522
522
  }
523
523
  }
524
524
 
525
- function runScript(script, name, origin) {
525
+ function runScript(script, name, _origin) {
526
526
  const scriptDir = path.dirname(path.resolve(name));
527
527
  const logLabel = makeLabel(name);
528
528
 
@@ -1035,10 +1035,7 @@ function runScript(script, name, origin) {
1035
1035
  subscriptions.filter((s) => s._script === name).length +
1036
1036
  varSubscriptions.filter((s) => s._script === name).length +
1037
1037
  mqttEventCallbacks.filter((c) => c._script === name).length;
1038
- const registeredTimers =
1039
- _myJobs.length +
1040
- sunEvents.filter((e) => e._script === name).length +
1041
- _myTimers.size;
1038
+ const registeredTimers = _myJobs.length + sunEvents.filter((e) => e._script === name).length + _myTimers.size;
1042
1039
  if (registeredCallbacks > 0 || registeredTimers > 0) {
1043
1040
  const parts = [];
1044
1041
  if (registeredCallbacks > 0) parts.push(`${registeredCallbacks} callback${registeredCallbacks !== 1 ? 's' : ''}`);
@@ -1077,7 +1074,7 @@ function loadScript(file, origin) {
1077
1074
 
1078
1075
  function unloadScript(file) {
1079
1076
  file = file.replace(/\\/g, '/');
1080
- const origin = scriptOrigins.get(file) || 'user';
1077
+ const _origin = scriptOrigins.get(file) || 'user';
1081
1078
  const unloadLabel = makeLabel(file);
1082
1079
  log.info(unloadLabel, 'unloading');
1083
1080
  scriptOrigins.delete(file);
@@ -1195,7 +1192,6 @@ function loadSandbox(callback) {
1195
1192
  }
1196
1193
  });
1197
1194
 
1198
-
1199
1195
  callback();
1200
1196
  }
1201
1197
  });