@mndw/cli 0.1.3 → 0.1.4
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.
- package/dist/meta.json +3 -3
- package/dist/mndw.js +5 -2
- package/host-dev/assets/{index-DhiLr-OP.js → index-CwQLpAUa.js} +3 -3
- package/host-dev/assets/{sandbox-url-ClgdqetH.js → sandbox-url-BRfzhk02.js} +1 -1
- package/host-dev/index.html +2 -2
- package/host-dev/shared/{mndw-ui@0.1.3.js → mndw-ui@0.1.4.js} +36 -6
- package/package.json +12 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Yv=Object.defineProperty;var Jv=Object.getPrototypeOf;var Kv=Reflect.get;var Bd=t=>{throw TypeError(t)};var Qv=(t,e,n)=>e in t?Yv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var G=(t,e,n)=>Qv(t,typeof e!="symbol"?e+"":e,n),Ll=(t,e,n)=>e.has(t)||Bd("Cannot "+n);var E=(t,e,n)=>(Ll(t,e,"read from private field"),n?n.call(t):e.get(t)),be=(t,e,n)=>e.has(t)?Bd("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Me=(t,e,n,r)=>(Ll(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Oe=(t,e,n)=>(Ll(t,e,"access private method"),n);var $d=(t,e,n)=>Kv(Jv(t),n,e);import{setMndwUiLocale as eb,coercePlacement as Ud,isMobileSheet as tb,resolveSizing as jd,computePopoverCoords as nb,createFocusTrap as Mc,composedContains as rb,tabbableElements as ib,column as Hr,defineMndwUi as sb}from"/shared/mndw-ui@0.1.3.js";import{ReplaySubject as ob,Observable as _a,tap as Dl,timer as ab,exhaustMap as lb,catchError as cb,EMPTY as ub,takeUntil as Fd,Subject as db,Subscription as fb,BehaviorSubject as hb,map as pb,firstValueFrom as hp,timeout as pp}from"/shared/rxjs@7.8.2.js";import{FetchTransport as gb,SessionManager as mb,RciManager as vb}from"/shared/rci-tools-core@0.6.0.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();const bb="/assets/sprite-qQ7EZWXN.svg",gp=!1;var al=Array.isArray,_b=Array.prototype.indexOf,wa=Array.prototype.includes,ll=Array.from,wb=Object.defineProperty,Fs=Object.getOwnPropertyDescriptor,mp=Object.getOwnPropertyDescriptors,vp=Object.prototype,yb=Array.prototype,cl=Object.getPrototypeOf,Gd=Object.isExtensible;const kb=()=>{};function Eb(t){return t()}function Oc(t){for(var e=0;e<t.length;e++)t[e]()}function bp(){var t,e,n=new Promise((r,i)=>{t=r,e=i});return{promise:n,resolve:t,reject:e}}function Sb(t,e){if(Array.isArray(t))return t;if(!(Symbol.iterator in t))return Array.from(t);const n=[];for(const r of t)if(n.push(r),n.length===e)break;return n}const $t=2,Ki=4,xo=8,Ru=1<<24,Un=16,On=32,yr=64,Nc=128,An=512,zt=1024,Rt=2048,Vn=4096,rn=8192,Mn=16384,us=32768,zc=1<<25,Wr=65536,ya=1<<17,xb=1<<18,ds=1<<19,_p=1<<20,or=1<<25,wi=65536,ka=1<<21,Bi=1<<22,Fr=1<<23,Gr=Symbol("$state"),Tb=Symbol(""),la=Symbol("attributes"),Ic=Symbol("class"),Lc=Symbol("style"),Os=Symbol("text"),ca=Symbol("form reset"),To=new class extends Error{constructor(){super(...arguments);G(this,"name","StaleReactionError");G(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var up;const Au=!!((up=globalThis.document)!=null&&up.contentType)&&globalThis.document.contentType.includes("xml");function Mu(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Cb(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Pb(t,e,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function Rb(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Ab(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Mb(t){throw new Error("https://svelte.dev/e/effect_orphan")}function Ob(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Nb(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function zb(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Ib(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Lb(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const Db=1,Hb=2,wp=4,Bb=8,$b=16,Ub=1,jb=2,Ct=Symbol("uninitialized"),Fb="http://www.w3.org/1999/xhtml",Gb="@attach";function Vb(){console.warn("https://svelte.dev/e/derived_inert")}function Zb(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function Wb(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function yp(t){return t===this.v}function kp(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function Ep(t){return!kp(t,this.v)}let Co=!1,qb=!1;function Xb(){Co=!0}const Yb=[];function jo(t,e=!1,n=!1){return ua(t,new Map,"",Yb,null,n)}function ua(t,e,n,r,i=null,s=!1){if(typeof t=="object"&&t!==null){var o=e.get(t);if(o!==void 0)return o;if(t instanceof Map)return new Map(t);if(t instanceof Set)return new Set(t);if(al(t)){var a=Array(t.length);e.set(t,a),i!==null&&e.set(i,a);for(var l=0;l<t.length;l+=1){var c=t[l];l in t&&(a[l]=ua(c,e,n,r,null,s))}return a}if(cl(t)===vp){a={},e.set(t,a),i!==null&&e.set(i,a);for(var u of Object.keys(t))a[u]=ua(t[u],e,n,r,null,s);return a}if(t instanceof Date)return structuredClone(t);if(typeof t.toJSON=="function"&&!s)return ua(t.toJSON(),e,n,r,t)}if(t instanceof EventTarget)return t;try{return structuredClone(t)}catch{return t}}let et=null;function Qi(t){et=t}function Jb(t){return Ou().get(t)}function Kb(t,e){return Ou().set(t,e),e}function Qb(t){return Ou().has(t)}function Ie(t,e=!1,n){et={p:et,i:!1,c:null,e:null,s:t,x:null,r:Ve,l:Co&&!e?{s:null,u:null,$:[]}:null}}function Le(t){var e=et,n=e.e;if(n!==null){e.e=null;for(var r of n)Vp(r)}return e.i=!0,et=e.p,{}}function Po(){return!Co||et!==null&&et.l===null}function Ou(t){return et===null&&Mu(),et.c??(et.c=new Map(e_(et)||void 0))}function e_(t){let e=t.p;for(;e!==null;){const n=e.c;if(n!==null)return n;e=e.p}return null}let oi=[];function Sp(){var t=oi;oi=[],Oc(t)}function ar(t){if(oi.length===0&&!Vs){var e=oi;queueMicrotask(()=>{e===oi&&Sp()})}oi.push(t)}function t_(){for(;oi.length>0;)Sp()}function xp(t){var e=Ve;if(e===null)return Fe.f|=Fr,t;if((e.f&us)===0&&(e.f&Ki)===0)throw t;Br(t,e)}function Br(t,e){if(!(e!==null&&(e.f&Mn)!==0)){for(;e!==null;){if((e.f&Nc)!==0){if((e.f&us)===0)throw t;try{e.b.error(t);return}catch(n){t=n}}e=e.parent}throw t}}const n_=-7169;function St(t,e){t.f=t.f&n_|e}function Nu(t){(t.f&An)!==0||t.deps===null?St(t,zt):St(t,Vn)}function Tp(t){if(t!==null)for(const e of t)(e.f&$t)===0||(e.f&wi)===0||(e.f^=wi,Tp(e.deps))}function Cp(t,e,n){(t.f&Rt)!==0?e.add(t):(t.f&Vn)!==0&&n.add(t),Tp(t.deps),St(t,zt)}function r_(t,e){if(e){const n=document.body;t.autofocus=!0,ar(()=>{document.activeElement===n&&t.focus()})}}let Vd=!1;function i_(){Vd||(Vd=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{var e;if(!t.defaultPrevented)for(const n of t.target.elements)(e=n[ca])==null||e.call(n)})},{capture:!0}))}function fs(t){var e=Fe,n=Ve;pn(null),Nn(null);try{return t()}finally{pn(e),Nn(n)}}function s_(t,e,n,r=n){t.addEventListener(e,()=>fs(n));const i=t[ca];i?t[ca]=()=>{i(),r(!0)}:t[ca]=()=>r(!0),i_()}function o_(t){let e=0,n=kr(0),r;return()=>{Du()&&(f(n),fl(()=>(e===0&&(r=Jr(()=>t(()=>Bt(n)))),e+=1,()=>{ar(()=>{e-=1,e===0&&(r==null||r(),r=void 0,Bt(n))})})))}}var a_=Wr|ds;function l_(t,e,n,r){new c_(t,e,n,r)}var Tn,Pu,Cn,ui,ln,Pn,tn,_n,dr,di,Ir,Gi,uo,fo,fr,tl,ht,u_,d_,Dc,f_,Hc,da,fa,Bc,$c;class c_{constructor(e,n,r,i){be(this,ht);G(this,"parent");G(this,"is_pending",!1);G(this,"transform_error");be(this,Tn);be(this,Pu,null);be(this,Cn);be(this,ui);be(this,ln);be(this,Pn,null);be(this,tn,null);be(this,_n,null);be(this,dr,null);be(this,di,0);be(this,Ir,0);be(this,Gi,!1);be(this,uo,new Set);be(this,fo,new Set);be(this,fr,null);be(this,tl,o_(()=>(Me(this,fr,kr(E(this,di))),()=>{Me(this,fr,null)})));var s;Me(this,Tn,e),Me(this,Cn,n),Me(this,ui,o=>{var a=Ve;a.b=this,a.f|=Nc,r(o)}),this.parent=Ve.b,this.transform_error=i??((s=this.parent)==null?void 0:s.transform_error)??(o=>o),Me(this,ln,Ao(()=>{Oe(this,ht,Hc).call(this)},a_))}defer_effect(e){Cp(e,E(this,uo),E(this,fo))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!E(this,Cn).pending}update_pending_count(e,n){Oe(this,ht,Bc).call(this,e,n),Me(this,di,E(this,di)+e),!(!E(this,fr)||E(this,Gi))&&(Me(this,Gi,!0),ar(()=>{Me(this,Gi,!1),E(this,fr)&&es(E(this,fr),E(this,di))}))}get_effect_pending(){return E(this,tl).call(this),f(E(this,fr))}error(e){if(!E(this,Cn).onerror&&!E(this,Cn).failed)throw e;Te!=null&&Te.is_fork?(E(this,Pn)&&Te.skip_effect(E(this,Pn)),E(this,tn)&&Te.skip_effect(E(this,tn)),E(this,_n)&&Te.skip_effect(E(this,_n)),Te.oncommit(()=>{Oe(this,ht,$c).call(this,e)})):Oe(this,ht,$c).call(this,e)}}Tn=new WeakMap,Pu=new WeakMap,Cn=new WeakMap,ui=new WeakMap,ln=new WeakMap,Pn=new WeakMap,tn=new WeakMap,_n=new WeakMap,dr=new WeakMap,di=new WeakMap,Ir=new WeakMap,Gi=new WeakMap,uo=new WeakMap,fo=new WeakMap,fr=new WeakMap,tl=new WeakMap,ht=new WeakSet,u_=function(){try{Me(this,Pn,dn(()=>E(this,ui).call(this,E(this,Tn))))}catch(e){this.error(e)}},d_=function(e){const n=E(this,Cn).failed,{reset:r,invoke_onerror:i}=Oe(this,ht,Dc).call(this,e);ar(i),n&&Me(this,_n,dn(()=>{n(E(this,Tn),()=>e,()=>r)}))},Dc=function(e){var n=!1,r=!1;const i=()=>{if(n){Wb();return}n=!0,r&&Lb(),E(this,_n)!==null&&vi(E(this,_n),()=>{Me(this,_n,null)}),Oe(this,ht,fa).call(this,()=>{Oe(this,ht,Hc).call(this)})};return{reset:i,invoke_onerror:()=>{var o,a;try{r=!0,(a=(o=E(this,Cn)).onerror)==null||a.call(o,e,i),r=!1}catch(l){Br(l,E(this,ln)&&E(this,ln).parent)}}}},f_=function(){const e=E(this,Cn).pending;e&&(this.is_pending=!0,Me(this,tn,dn(()=>e(E(this,Tn)))),ar(()=>{var n=Me(this,dr,document.createDocumentFragment()),r=br();n.append(r),Me(this,Pn,Oe(this,ht,fa).call(this,()=>dn(()=>E(this,ui).call(this,r)))),E(this,Ir)===0&&(E(this,Tn).before(n),Me(this,dr,null),vi(E(this,tn),()=>{Me(this,tn,null)}),Oe(this,ht,da).call(this,Te))}))},Hc=function(){try{if(this.is_pending=this.has_pending_snippet(),Me(this,Ir,0),Me(this,di,0),Me(this,Pn,dn(()=>{E(this,ui).call(this,E(this,Tn))})),E(this,Ir)>0){var e=Me(this,dr,document.createDocumentFragment());$u(E(this,Pn),e);const n=E(this,Cn).pending;Me(this,tn,dn(()=>n(E(this,Tn))))}else Oe(this,ht,da).call(this,Te)}catch(n){this.error(n)}},da=function(e){this.is_pending=!1,e.transfer_effects(E(this,uo),E(this,fo))},fa=function(e){var n=Ve,r=Fe,i=et;Nn(E(this,ln)),pn(E(this,ln)),Qi(E(this,ln).ctx);try{return yi.ensure(),e()}catch(s){return xp(s),null}finally{Nn(n),pn(r),Qi(i)}},Bc=function(e,n){var r;if(!this.has_pending_snippet()){this.parent&&Oe(r=this.parent,ht,Bc).call(r,e,n);return}Me(this,Ir,E(this,Ir)+e),E(this,Ir)===0&&(Oe(this,ht,da).call(this,n),E(this,tn)&&vi(E(this,tn),()=>{Me(this,tn,null)}),E(this,dr)&&(E(this,Tn).before(E(this,dr)),Me(this,dr,null)))},$c=function(e){E(this,Pn)&&(Zt(E(this,Pn)),Me(this,Pn,null)),E(this,tn)&&(Zt(E(this,tn)),Me(this,tn,null)),E(this,_n)&&(Zt(E(this,_n)),Me(this,_n,null));let n=E(this,Cn).failed;const r=i=>{const{reset:s,invoke_onerror:o}=Oe(this,ht,Dc).call(this,i);o(),n&&Me(this,_n,Oe(this,ht,fa).call(this,()=>{try{return dn(()=>{var a=Ve;a.b=this,a.f|=Nc,n(E(this,Tn),()=>i,()=>s)})}catch(a){return Br(a,E(this,ln).parent),null}}))};ar(()=>{var i;try{i=this.transform_error(e)}catch(s){Br(s,E(this,ln)&&E(this,ln).parent);return}i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(r,s=>Br(s,E(this,ln)&&E(this,ln).parent)):r(i)})};function Pp(t,e,n,r){const i=Po()?ul:Ap;var s=t.filter(p=>!p.settled),o=e.map(i);if(n.length===0&&s.length===0){r(o);return}var a=Ve,l=h_(),c=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(p=>p.promise)):null;function u(p){if((a.f&Mn)===0){l();try{r([...o,...p])}catch(g){Br(g,a)}Ea()}}var d=Rp();if(n.length===0){c.then(()=>u([])).finally(d);return}function h(){Promise.all(n.map(p=>p_(p))).then(u).catch(p=>Br(p,a)).finally(d)}c?c.then(()=>{l(),h(),Ea()}):h()}function h_(){var t=Ve,e=Fe,n=et,r=Te;return function(s=!0){Nn(t),pn(e),Qi(n),s&&(t.f&Mn)===0&&(r==null||r.activate(),r==null||r.apply())}}function Ea(t=!0){Nn(null),pn(null),Qi(null),t&&(Te==null||Te.deactivate())}function Rp(){var t=Ve,e=t.b,n=Te,r=!!(e!=null&&e.is_rendered());return e==null||e.update_pending_count(1,n),n.increment(r,t),()=>{e==null||e.update_pending_count(-1,n),n.decrement(r,t)}}function ul(t){var e=$t|Rt;return Ve!==null&&(Ve.f|=ds),{ctx:et,deps:null,effects:null,equals:yp,f:e,fn:t,reactions:null,rv:0,v:Ct,wv:0,parent:Ve,ac:null}}const Ns=Symbol("obsolete");function p_(t,e,n){let r=Ve;r===null&&Cb();var i=void 0,s=kr(Ct),o=!Fe,a=new Set;return A_(()=>{var p,g;var l=Ve,c=bp();i=c.promise;try{Promise.resolve(t()).then(c.resolve,m=>{m!==To&&c.reject(m)}).finally(Ea)}catch(m){c.reject(m),Ea()}var u=Te;if(o){if((l.f&us)!==0)var d=Rp();if((p=r.b)!=null&&p.is_rendered())(g=u.async_deriveds.get(l))==null||g.reject(Ns);else for(const m of a.values())m.reject(Ns);a.add(c),u.async_deriveds.set(l,c)}const h=(m,_=void 0)=>{d==null||d(),a.delete(c),_!==Ns&&(u.activate(),_?(s.f|=Fr,es(s,_)):((s.f&Fr)!==0&&(s.f^=Fr),es(s,m)),u.deactivate())};c.promise.then(h,m=>h(null,m||"unknown"))}),Hu(()=>{for(const l of a)l.reject(Ns)}),new Promise(l=>{function c(u){function d(){u===i?l(s):c(i)}u.then(d,d)}c(i)})}function fe(t){const e=ul(t);return Jp(e),e}function Ap(t){const e=ul(t);return e.equals=Ep,e}function g_(t){var e=t.effects;if(e!==null){t.effects=null;for(var n=0;n<e.length;n+=1)Zt(e[n])}}function zu(t){var e,n=Ve,r=t.parent;if(!qr&&r!==null&&t.v!==Ct&&(r.f&(Mn|rn))!==0)return Vb(),t.v;Nn(r);try{t.f&=~wi,g_(t),e=tg(t)}finally{Nn(n)}return e}function Mp(t){var e=zu(t);if(!t.equals(e)&&(t.wv=Qp(),(!(Te!=null&&Te.is_fork)||t.deps===null)&&(Te!==null?(Te.capture(t,e,!0),Gs==null||Gs.capture(t,e,!0)):t.v=e,t.deps===null))){St(t,zt);return}qr||(Gt!==null?(Du()||Te!=null&&Te.is_fork)&&Gt.set(t,e):Nu(t))}function m_(t){var e;if(t.effects!==null)for(const n of t.effects)(n.teardown||n.ac)&&((e=n.teardown)==null||e.call(n),n.ac!==null&&fs(()=>{n.ac.abort(To),n.ac=null}),n.fn!==null&&(n.teardown=kb),Js(n,0),Bu(n))}function Op(t){if(t.effects!==null)for(const e of t.effects)e.teardown&&e.fn!==null&&ts(e)}let Hl=null,Ri=null,Te=null,Gs=null,Gt=null,Uc=null,Vs=!1,Bl=!1,Ii=null,ha=null;var Zd=0;let v_=1;var Vi,Lr,fi,Zi,Wi,qi,hr,Xi,cn,ho,pr,Dn,er,Yi,hi,rt,jc,zs,Fc,Np,zp,zi,b_,Is;const nl=class nl{constructor(){be(this,rt);G(this,"id",v_++);be(this,Vi,!1);G(this,"linked",!0);be(this,Lr,null);be(this,fi,null);G(this,"async_deriveds",new Map);G(this,"current",new Map);G(this,"previous",new Map);be(this,Zi,new Set);be(this,Wi,new Set);be(this,qi,0);be(this,hr,new Map);be(this,Xi,null);be(this,cn,[]);be(this,ho,[]);be(this,pr,new Set);be(this,Dn,new Set);be(this,er,new Map);be(this,Yi,new Set);G(this,"is_fork",!1);be(this,hi,!1);Ri===null?Hl=Ri=this:(Me(Ri,fi,this),Me(this,Lr,Ri)),Ri=this}skip_effect(e){E(this,er).has(e)||E(this,er).set(e,{d:[],m:[]}),E(this,Yi).delete(e)}unskip_effect(e,n=r=>this.schedule(r)){var r=E(this,er).get(e);if(r){E(this,er).delete(e);for(var i of r.d)St(i,Rt),n(i);for(i of r.m)St(i,Vn),n(i)}E(this,Yi).add(e)}capture(e,n,r=!1){e.v!==Ct&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&Fr)===0&&(this.current.set(e,[n,r]),Gt==null||Gt.set(e,n)),this.is_fork||(e.v=n)}activate(){Te=this}deactivate(){Te=null,Gt=null}flush(){try{Bl=!0,Te=this,Oe(this,rt,zs).call(this)}finally{Zd=0,Uc=null,Ii=null,ha=null,Bl=!1,Te=null,Gt=null,mi.clear()}}discard(){var e;for(const n of E(this,Wi))n(this);E(this,Wi).clear();for(const n of this.async_deriveds.values())n.reject(Ns);Oe(this,rt,Is).call(this),(e=E(this,Xi))==null||e.resolve()}register_created_effect(e){E(this,ho).push(e)}increment(e,n){if(Me(this,qi,E(this,qi)+1),e){let r=E(this,hr).get(n)??0;E(this,hr).set(n,r+1)}}decrement(e,n){if(Me(this,qi,E(this,qi)-1),e){let r=E(this,hr).get(n)??0;r===1?E(this,hr).delete(n):E(this,hr).set(n,r-1)}E(this,hi)||(Me(this,hi,!0),ar(()=>{Me(this,hi,!1),this.linked&&this.flush()}))}transfer_effects(e,n){for(const r of e)E(this,pr).add(r);for(const r of n)E(this,Dn).add(r);e.clear(),n.clear()}oncommit(e){E(this,Zi).add(e)}ondiscard(e){E(this,Wi).add(e)}settled(){return(E(this,Xi)??Me(this,Xi,bp())).promise}static ensure(){if(Te===null){const e=Te=new nl;!Bl&&!Vs&&ar(()=>{E(e,Vi)||e.flush()})}return Te}apply(){{Gt=null;return}}schedule(e){var i;if(Uc=e,(i=e.b)!=null&&i.is_pending&&(e.f&(Ki|xo|Ru))!==0&&(e.f&us)===0){e.b.defer_effect(e);return}for(var n=e;n.parent!==null;){n=n.parent;var r=n.f;if(Ii!==null&&n===Ve&&(Fe===null||(Fe.f&$t)===0))return;if((r&(yr|On))!==0){if((r&zt)===0)return;n.f^=zt}}E(this,cn).push(n)}};Vi=new WeakMap,Lr=new WeakMap,fi=new WeakMap,Zi=new WeakMap,Wi=new WeakMap,qi=new WeakMap,hr=new WeakMap,Xi=new WeakMap,cn=new WeakMap,ho=new WeakMap,pr=new WeakMap,Dn=new WeakMap,er=new WeakMap,Yi=new WeakMap,hi=new WeakMap,rt=new WeakSet,jc=function(){if(this.is_fork)return!0;for(const r of E(this,hr).keys()){for(var e=r,n=!1;e.parent!==null;){if(E(this,er).has(e)){n=!0;break}e=e.parent}if(!n)return!0}return!1},zs=function(){var l,c,u,d;Me(this,Vi,!0),Zd++>1e3&&(Oe(this,rt,Is).call(this),w_());for(const h of E(this,pr))E(this,Dn).delete(h),St(h,Rt),this.schedule(h);for(const h of E(this,Dn))St(h,Vn),this.schedule(h);const e=E(this,cn);Me(this,cn,[]),this.apply();var n=Ii=[],r=[],i=ha=[];for(const h of e)try{Oe(this,rt,Fc).call(this,h,n,r)}catch(p){throw Dp(h),Oe(this,rt,jc).call(this)||this.discard(),p}if(Te=null,i.length>0){var s=nl.ensure();for(const h of i)s.schedule(h)}if(Ii=null,ha=null,Oe(this,rt,jc).call(this)){Oe(this,rt,zi).call(this,r),Oe(this,rt,zi).call(this,n);for(const[h,p]of E(this,er))Lp(h,p);i.length>0&&Oe(l=Te,rt,zs).call(l);return}const o=Oe(this,rt,Np).call(this);if(o){Oe(this,rt,zi).call(this,r),Oe(this,rt,zi).call(this,n),Oe(c=o,rt,zp).call(c,this);return}E(this,pr).clear(),E(this,Dn).clear();for(const h of E(this,Zi))h(this);E(this,Zi).clear(),Gs=this,Wd(r),Wd(n),Gs=null,(u=E(this,Xi))==null||u.resolve();var a=Te;if(E(this,qi)===0&&(E(this,cn).length===0||a!==null)&&Oe(this,rt,Is).call(this),E(this,cn).length>0)if(a!==null){const h=a;E(h,cn).push(...E(this,cn).filter(p=>!E(h,cn).includes(p)))}else a=this;a!==null&&Oe(d=a,rt,zs).call(d)},Fc=function(e,n,r){e.f^=zt;for(var i=e.first;i!==null;){var s=i.f,o=(s&(On|yr))!==0,a=o&&(s&zt)!==0,l=a||(s&rn)!==0||E(this,er).has(i);if(!l&&i.fn!==null){o?i.f^=zt:(s&Ki)!==0?n.push(i):Mo(i)&&((s&Un)!==0&&E(this,Dn).add(i),ts(i));var c=i.first;if(c!==null){i=c;continue}}for(;i!==null;){var u=i.next;if(u!==null){i=u;break}i=i.parent}}},Np=function(){for(var e=E(this,Lr);e!==null;){if(!e.is_fork){for(const[n,[,r]]of this.current)if(e.current.has(n)&&!r)return e}e=E(e,Lr)}return null},zp=function(e){var r;for(const[i,s]of e.current)!this.previous.has(i)&&e.previous.has(i)&&this.previous.set(i,e.previous.get(i)),this.current.set(i,s);for(const[i,s]of e.async_deriveds){const o=this.async_deriveds.get(i);o&&s.promise.then(o.resolve).catch(o.reject)}e.async_deriveds.clear(),this.transfer_effects(E(e,pr),E(e,Dn));const n=i=>{var s=i.reactions;if(s!==null&&!((i.f&$t)!==0&&(i.f&(Rt|Vn))===0))for(const l of s){var o=l.f;if((o&$t)!==0)n(l);else{var a=l;o&(Bi|Un)&&!this.async_deriveds.has(a)&&(E(this,Dn).delete(a),St(a,Rt),this.schedule(a))}}};for(const i of this.current.keys())n(i);this.oncommit(()=>e.discard()),Oe(r=e,rt,Is).call(r),Te=this,Oe(this,rt,zs).call(this)},zi=function(e){for(var n=0;n<e.length;n+=1)Cp(e[n],E(this,pr),E(this,Dn))},b_=function(){var d;for(let h=Hl;h!==null;h=E(h,fi)){var e=h.id<this.id,n=[];for(const[p,[g,m]]of this.current){if(h.current.has(p)){var r=h.current.get(p)[0];if(e&&g!==r)h.current.set(p,[g,m]);else continue}n.push(p)}if(e)for(const[p,g]of this.async_deriveds){const m=h.async_deriveds.get(p);m&&g.promise.then(m.resolve).catch(m.reject)}var i=[...h.current.keys()].filter(p=>!h.current.get(p)[1]);if(!(!E(h,Vi)||i.length===0)){var s=i.filter(p=>!this.current.has(p));if(s.length===0)e&&h.discard();else if(n.length>0){if(e)for(const p of E(this,Yi))h.unskip_effect(p,g=>{var m;(g.f&(Un|Bi))!==0?h.schedule(g):Oe(m=h,rt,zi).call(m,[g])});h.activate();var o=new Set,a=new Map;for(var l of n)Ip(l,s,o,a);a=new Map;var c=[...h.current].filter(([p,g])=>{const m=this.current.get(p);return m?m[0]!==g[0]||m[1]!==g[1]:!0}).map(([p])=>p);if(c.length>0)for(const p of E(this,ho))(p.f&(Mn|rn|ya))===0&&Iu(p,c,a)&&((p.f&(Bi|Un))!==0?(St(p,Rt),h.schedule(p)):E(h,pr).add(p));if(E(h,cn).length>0&&!E(h,hi)){h.apply();for(var u of E(h,cn))Oe(d=h,rt,Fc).call(d,u,[],[]);Me(h,cn,[])}h.deactivate()}}}},Is=function(){if(this.linked){var e=E(this,Lr),n=E(this,fi);e===null?Hl=n:Me(e,fi,n),n===null?Ri=e:Me(n,Lr,e),this.linked=!1}};let yi=nl;function __(t){var e=Vs;Vs=!0;try{for(var n;;){if(t_(),Te===null)return n;Te.flush()}}finally{Vs=e}}function w_(){try{Ob()}catch(t){Br(t,Uc)}}let Ln=null;function Wd(t){var e=t.length;if(e!==0){for(var n=0;n<e;){var r=t[n++];if((r.f&(Mn|rn))===0&&Mo(r)&&(Ln=new Set,ts(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&qp(r),(Ln==null?void 0:Ln.size)>0)){mi.clear();for(const i of Ln){if((i.f&(Mn|rn))!==0)continue;const s=[i];let o=i.parent;for(;o!==null;)Ln.has(o)&&(Ln.delete(o),s.push(o)),o=o.parent;for(let a=s.length-1;a>=0;a--){const l=s[a];(l.f&(Mn|rn))===0&&ts(l)}}Ln.clear()}}Ln=null}}function Ip(t,e,n,r){if(!n.has(t)&&(n.add(t),t.reactions!==null))for(const i of t.reactions){const s=i.f;(s&$t)!==0?Ip(i,e,n,r):(s&(Bi|Un))!==0&&(s&Rt)===0&&Iu(i,e,r)&&(St(i,Rt),Lu(i))}}function Iu(t,e,n){const r=n.get(t);if(r!==void 0)return r;if(t.deps!==null)for(const i of t.deps){if(wa.call(e,i))return!0;if((i.f&$t)!==0&&Iu(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function Lu(t){Te.schedule(t)}function Lp(t,e){if(!((t.f&On)!==0&&(t.f&zt)!==0)){(t.f&Rt)!==0?e.d.push(t):(t.f&Vn)!==0&&e.m.push(t),St(t,zt);for(var n=t.first;n!==null;)Lp(n,e),n=n.next}}function Dp(t){St(t,zt);for(var e=t.first;e!==null;)Dp(e),e=e.next}let Sa=new Set;const mi=new Map;let Hp=!1;function kr(t,e){var n={f:0,v:t,reactions:null,equals:yp,rv:0,wv:0};return n}function Y(t,e){const n=kr(t);return Jp(n),n}function y_(t,e=!1,n=!0){var i;const r=kr(t);return e||(r.equals=Ep),Co&&n&&et!==null&&et.l!==null&&((i=et.l).s??(i.s=[])).push(r),r}function b(t,e,n=!1){Fe!==null&&(!jn||(Fe.f&ya)!==0)&&Po()&&(Fe.f&($t|Un|Bi|ya))!==0&&(lr===null||!lr.has(t))&&Ib();let r=n?it(e):e;return es(t,r,ha)}function es(t,e,n=null){if(!t.equals(e)){mi.set(t,qr?e:t.v);var r=yi.ensure();if(r.capture(t,e),(t.f&$t)!==0){const i=t;(t.f&Rt)!==0&&zu(i),Gt===null&&Nu(i)}t.wv=Qp(),Bp(t,Rt,n),Po()&&Ve!==null&&(Ve.f&zt)!==0&&(Ve.f&(On|yr))===0&&(xn===null?N_([t]):xn.push(t)),!r.is_fork&&Sa.size>0&&!Hp&&k_()}return e}function k_(){Hp=!1;for(const t of Sa){(t.f&zt)!==0&&St(t,Vn);let e;try{e=Mo(t)}catch{e=!0}e&&ts(t)}Sa.clear()}function Bt(t){b(t,t.v+1)}function Bp(t,e,n){var r=t.reactions;if(r!==null)for(var i=Po(),s=r.length,o=0;o<s;o++){var a=r[o],l=a.f;if(!(!i&&a===Ve)){var c=(l&Rt)===0;if(c&&St(a,e),(l&ya)!==0)Sa.add(a);else if((l&$t)!==0){var u=a;Gt==null||Gt.delete(u),(l&wi)===0&&(l&An&&(Ve===null||(Ve.f&ka)===0)&&(a.f|=wi),Bp(u,Vn,n))}else if(c){var d=a;(l&Un)!==0&&Ln!==null&&Ln.add(d),n!==null?n.push(d):Lu(d)}}}}function it(t){if(typeof t!="object"||t===null||Gr in t)return t;const e=cl(t);if(e!==vp&&e!==yb)return t;var n=new Map,r=al(t),i=Y(0),s=Zn,o=a=>{if(Zn===s)return a();var l=Fe,c=Zn;pn(null),Yd(s);var u=a();return pn(l),Yd(c),u};return r&&n.set("length",Y(t.length)),new Proxy(t,{defineProperty(a,l,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&Nb();var u=n.get(l);return u===void 0?o(()=>{var d=Y(c.value);return n.set(l,d),d}):b(u,c.value,!0),!0},deleteProperty(a,l){var c=n.get(l);if(c===void 0){if(l in a){const u=o(()=>Y(Ct));n.set(l,u),Bt(i)}}else b(c,Ct),Bt(i);return!0},get(a,l,c){var p;if(l===Gr)return t;var u=n.get(l),d=l in a;if(u===void 0&&(!d||(p=Fs(a,l))!=null&&p.writable)&&(u=o(()=>{var g=it(d?a[l]:Ct),m=Y(g);return m}),n.set(l,u)),u!==void 0){var h=f(u);return h===Ct?void 0:h}return Reflect.get(a,l,c)},getOwnPropertyDescriptor(a,l){var c=Reflect.getOwnPropertyDescriptor(a,l);if(c&&"value"in c){var u=n.get(l);u&&(c.value=f(u))}else if(c===void 0){var d=n.get(l),h=d==null?void 0:d.v;if(d!==void 0&&h!==Ct)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return c},has(a,l){var h;if(l===Gr)return!0;var c=n.get(l),u=c!==void 0&&c.v!==Ct||Reflect.has(a,l);if(c!==void 0||Ve!==null&&(!u||(h=Fs(a,l))!=null&&h.writable)){c===void 0&&(c=o(()=>{var p=u?it(a[l]):Ct,g=Y(p);return g}),n.set(l,c));var d=f(c);if(d===Ct)return!1}return u},set(a,l,c,u){var I;var d=n.get(l),h=l in a;if(r&&l==="length")for(var p=c;p<d.v;p+=1){var g=n.get(p+"");g!==void 0?b(g,Ct):p in a&&(g=o(()=>Y(Ct)),n.set(p+"",g))}if(d===void 0)(!h||(I=Fs(a,l))!=null&&I.writable)&&(d=o(()=>Y(void 0)),b(d,it(c)),n.set(l,d));else{h=d.v!==Ct;var m=o(()=>it(c));b(d,m)}var _=Reflect.getOwnPropertyDescriptor(a,l);if(_!=null&&_.set&&_.set.call(u,c),!h){if(r&&typeof l=="string"){var k=n.get("length"),O=Number(l);Number.isInteger(O)&&O>=k.v&&b(k,O+1)}Bt(i)}return!0},ownKeys(a){f(i);var l=Reflect.ownKeys(a).filter(d=>{var h=n.get(d);return h===void 0||h.v!==Ct});for(var[c,u]of n)u.v!==Ct&&!(c in a)&&l.push(c);return l},setPrototypeOf(){zb()}})}function qd(t){try{if(t!==null&&typeof t=="object"&&Gr in t)return t[Gr]}catch{}return t}function E_(t,e){return Object.is(qd(t),qd(e))}var Ys,$p,Up,jp;function S_(){if(Ys===void 0){Ys=window,$p=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;Up=Fs(e,"firstChild").get,jp=Fs(e,"nextSibling").get,Gd(t)&&(t[Ic]=void 0,t[la]=null,t[Lc]=void 0,t.__e=void 0),Gd(n)&&(n[Os]=void 0)}}function br(t=""){return document.createTextNode(t)}function xa(t){return Up.call(t)}function Ro(t){return jp.call(t)}function v(t,e){return xa(t)}function Xe(t,e=!1){{var n=xa(t);return n instanceof Comment&&n.data===""?Ro(n):n}}function x(t,e=1,n=!1){let r=t;for(;e--;)r=Ro(r);return r}function x_(t){t.textContent=""}function Fp(){return!1}function T_(t,e,n){return n?document.createElement(t,{is:n}):document.createElement(t)}function Gp(t){Ve===null&&(Fe===null&&Mb(),Ab()),qr&&Rb()}function C_(t,e){var n=e.last;n===null?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}function Wn(t,e){var n=Ve;n!==null&&(n.f&rn)!==0&&(t|=rn);var r={ctx:et,deps:null,nodes:null,f:t|Rt|An,first:null,fn:e,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};Te==null||Te.register_created_effect(r);var i=r;if((t&Ki)!==0)Ii!==null?Ii.push(r):yi.ensure().schedule(r);else if(e!==null){try{ts(r)}catch(o){throw Zt(r),o}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&(i.f&ds)===0&&(i=i.first,(t&Un)!==0&&(t&Wr)!==0&&i!==null&&(i.f|=Wr))}if(i!==null&&(i.parent=n,n!==null&&C_(i,n),Fe!==null&&(Fe.f&$t)!==0&&(t&yr)===0)){var s=Fe;(s.effects??(s.effects=[])).push(i)}return r}function Du(){return Fe!==null&&!jn}function Hu(t){const e=Wn(xo,null);return St(e,zt),e.teardown=t,e}function hn(t){Gp();var e=Ve.f,n=!Fe&&(e&On)!==0&&et!==null&&!et.i;if(n){var r=et;(r.e??(r.e=[])).push(t)}else return Vp(t)}function Vp(t){return Wn(Ki|_p,t)}function P_(t){return Gp(),Wn(xo|_p,t)}function R_(t){yi.ensure();const e=Wn(yr|ds,t);return(n={})=>new Promise(r=>{n.outro?vi(e,()=>{Zt(e),r(void 0)}):(Zt(e),r(void 0))})}function dl(t){return Wn(Ki,t)}function A_(t){return Wn(Bi|ds,t)}function fl(t,e=0){return Wn(xo|e,t)}function y(t,e=[],n=[],r=[]){Pp(r,e,n,i=>{Wn(xo,()=>{t(...i.map(f))})})}function Ao(t,e=0){var n=Wn(Un|e,t);return n}function Zp(t,e=0){var n=Wn(Ru|e,t);return n}function dn(t){return Wn(On|ds,t)}function Wp(t){var e=t.teardown;if(e!==null){const n=qr,r=Fe;Xd(!0),pn(null);try{e.call(null)}finally{Xd(n),pn(r)}}}function Bu(t,e=!1){var n=t.first;for(t.first=t.last=null;n!==null;){const i=n.ac;i!==null&&fs(()=>{i.abort(To)});var r=n.next;(n.f&yr)!==0?n.parent=null:Zt(n,e),n=r}}function M_(t){for(var e=t.first;e!==null;){var n=e.next;(e.f&On)===0&&Zt(e),e=n}}function Zt(t,e=!0){var n=!1;(e||(t.f&xb)!==0)&&t.nodes!==null&&t.nodes.end!==null&&(O_(t.nodes.start,t.nodes.end),n=!0),t.f|=zc,Bu(t,e&&!n),Js(t,0);var r=t.nodes&&t.nodes.t;if(r!==null)for(const s of r)s.stop();Wp(t),t.f^=zc,t.f|=Mn;var i=t.parent;i!==null&&i.first!==null&&qp(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=t.b=null}function O_(t,e){for(;t!==null;){var n=t===e?null:Ro(t);t.remove(),t=n}}function qp(t){var e=t.parent,n=t.prev,r=t.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),e!==null&&(e.first===t&&(e.first=r),e.last===t&&(e.last=n))}function vi(t,e,n=!0){var r=[];Xp(t,r,!0);var i=()=>{n&&Zt(t),e&&e()},s=r.length;if(s>0){var o=()=>--s||i();for(var a of r)a.out(o)}else i()}function Xp(t,e,n){if((t.f&rn)===0){t.f^=rn;var r=t.nodes&&t.nodes.t;if(r!==null)for(const a of r)(a.is_global||n)&&e.push(a);for(var i=t.first;i!==null;){var s=i.next;if((i.f&yr)===0){var o=(i.f&Wr)!==0||(i.f&On)!==0&&(t.f&Un)!==0;Xp(i,e,o?n:!1)}i=s}}}function Ta(t){Yp(t,!0)}function Yp(t,e){if((t.f&rn)!==0){t.f^=rn,(t.f&zt)===0&&(St(t,Rt),yi.ensure().schedule(t));for(var n=t.first;n!==null;){var r=n.next,i=(n.f&Wr)!==0||(n.f&On)!==0;Yp(n,i?e:!1),n=r}var s=t.nodes&&t.nodes.t;if(s!==null)for(const o of s)(o.is_global||e)&&o.in()}}function $u(t,e){if(t.nodes)for(var n=t.nodes.start,r=t.nodes.end;n!==null;){var i=n===r?null:Ro(n);e.append(n),n=i}}let pa=!1,qr=!1;function Xd(t){qr=t}let Fe=null,jn=!1;function pn(t){Fe=t}let Ve=null;function Nn(t){Ve=t}let lr=null;function Jp(t){Fe!==null&&(lr??(lr=new Set)).add(t)}let un=null,bn=0,xn=null;function N_(t){xn=t}let Kp=1,ai=0,Zn=ai;function Yd(t){Zn=t}function Qp(){return++Kp}function Mo(t){var e=t.f;if((e&Rt)!==0)return!0;if(e&$t&&(t.f&=~wi),(e&Vn)!==0){for(var n=t.deps,r=n.length,i=0;i<r;i++){var s=n[i];if(Mo(s)&&Mp(s),s.wv>t.wv)return!0}(e&An)!==0&&Gt===null&&St(t,zt)}return!1}function eg(t,e,n=!0){var r=t.reactions;if(r!==null&&!(lr!==null&&lr.has(t)))for(var i=0;i<r.length;i++){var s=r[i];(s.f&$t)!==0?eg(s,e,!1):e===s&&(n?St(s,Rt):(s.f&zt)!==0&&St(s,Vn),Lu(s))}}function tg(t){var m;var e=un,n=bn,r=xn,i=Fe,s=lr,o=et,a=jn,l=Zn,c=t.f;un=null,bn=0,xn=null,Fe=(c&(On|yr))===0?t:null,lr=null,Qi(t.ctx),jn=!1,Zn=++ai,t.ac!==null&&(fs(()=>{t.ac.abort(To)}),t.ac=null);try{t.f|=ka;var u=t.fn,d=u();t.f|=us;var h=t.deps,p=Te==null?void 0:Te.is_fork;if(un!==null){var g;if(p||Js(t,bn),h!==null&&bn>0)for(h.length=bn+un.length,g=0;g<un.length;g++)h[bn+g]=un[g];else t.deps=h=un;if(Du()&&(t.f&An)!==0)for(g=bn;g<h.length;g++)((m=h[g]).reactions??(m.reactions=[])).push(t)}else!p&&h!==null&&bn<h.length&&(Js(t,bn),h.length=bn);if(Po()&&xn!==null&&!jn&&h!==null&&(t.f&($t|Vn|Rt))===0)for(g=0;g<xn.length;g++)eg(xn[g],t);if(i!==null&&i!==t){if(ai++,i.deps!==null)for(let _=0;_<n;_+=1)i.deps[_].rv=ai;if(e!==null)for(const _ of e)_.rv=ai;xn!==null&&(r===null?r=xn:r.push(...xn))}return(t.f&Fr)!==0&&(t.f^=Fr),d}catch(_){return xp(_)}finally{t.f^=ka,un=e,bn=n,xn=r,Fe=i,lr=s,Qi(o),jn=a,Zn=l}}function z_(t,e){let n=e.reactions;if(n!==null){var r=_b.call(n,t);if(r!==-1){var i=n.length-1;i===0?n=e.reactions=null:(n[r]=n[i],n.pop())}}if(n===null&&(e.f&$t)!==0&&(un===null||!wa.call(un,e))){var s=e;(s.f&An)!==0&&(s.f^=An,s.f&=~wi),s.v!==Ct&&Nu(s),s.ac!==null&&fs(()=>{s.ac.abort(To),s.ac=null,St(s,Rt)}),m_(s),Js(s,0)}}function Js(t,e){var n=t.deps;if(n!==null)for(var r=e;r<n.length;r++)z_(t,n[r])}function ts(t){var e=t.f;if((e&Mn)===0){St(t,zt);var n=Ve,r=pa;Ve=t,pa=(e&(On|yr))===0;try{(e&(Un|Ru))!==0?M_(t):Bu(t),Wp(t);var i=tg(t);t.teardown=typeof i=="function"?i:null,t.wv=Kp;var s;gp&&qb&&(t.f&Rt)!==0&&t.deps}finally{pa=r,Ve=n}}}async function I_(){await Promise.resolve(),__()}function f(t){var e=t.f,n=(e&$t)!==0;if(Fe!==null&&!jn){var r=Ve!==null&&(Ve.f&Mn)!==0;if(!r&&(lr===null||!lr.has(t))){var i=Fe.deps;if((Fe.f&ka)!==0)t.rv<ai&&(t.rv=ai,un===null&&i!==null&&i[bn]===t?bn++:un===null?un=[t]:un.push(t));else{Fe.deps??(Fe.deps=[]),wa.call(Fe.deps,t)||Fe.deps.push(t);var s=t.reactions;s===null?t.reactions=[Fe]:wa.call(s,Fe)||s.push(Fe)}}}if(qr&&mi.has(t))return mi.get(t);if(n){var o=t;if(qr){var a=o.v;return((o.f&zt)===0&&o.reactions!==null||rg(o))&&(a=zu(o)),mi.set(o,a),a}var l=(o.f&An)===0&&!jn&&Fe!==null&&(pa||(Fe.f&An)!==0),c=(o.f&us)===0;Mo(o)&&(l&&(o.f|=An),Mp(o)),l&&!c&&(Op(o),ng(o))}if(Gt!=null&&Gt.has(t))return Gt.get(t);if((t.f&Fr)!==0)throw t.v;return t.v}function ng(t){if(t.f|=An,t.deps!==null)for(const e of t.deps)(e.reactions??(e.reactions=[])).push(t),(e.f&$t)!==0&&(e.f&An)===0&&(Op(e),ng(e))}function rg(t){if(t.v===Ct)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(mi.has(e)||(e.f&$t)!==0&&rg(e))return!0;return!1}function Jr(t){var e=jn;try{return jn=!0,t()}finally{jn=e}}function ig(t){if(!(typeof t!="object"||!t||t instanceof EventTarget)){if(Gr in t)Gc(t);else if(!Array.isArray(t))for(let e in t){const n=t[e];typeof n=="object"&&n&&Gr in n&&Gc(n)}}}function Gc(t,e=new Set){if(typeof t=="object"&&t!==null&&!(t instanceof EventTarget)&&!e.has(t)){e.add(t),t instanceof Date&&t.getTime();for(let r in t)try{Gc(t[r],e)}catch{}const n=cl(t);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){const r=mp(n);for(let i in r){const s=r[i].get;if(s)try{s.call(t)}catch{}}}}}function L_(t){return t.endsWith("capture")&&t!=="gotpointercapture"&&t!=="lostpointercapture"}const D_=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function H_(t){return D_.includes(t)}const B_={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function $_(t){return t=t.toLowerCase(),B_[t]??t}const U_=["touchstart","touchmove"];function j_(t){return U_.includes(t)}const li=Symbol("events"),sg=new Set,Vc=new Set;function Uu(t,e,n,r={}){function i(s){if(r.capture||Zc.call(e,s),!s.cancelBubble)return fs(()=>n==null?void 0:n.call(this,s))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?ar(()=>{e.addEventListener(t,i,r)}):e.addEventListener(t,i,r),i}function Jd(t,e,n,r={}){var i=Uu(e,t,n,r);return()=>{t.removeEventListener(e,i,r)}}function ut(t,e,n,r,i){var s={capture:r,passive:i},o=Uu(t,e,n,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Hu(()=>{e.removeEventListener(t,o,s)})}function pe(t,e,n){(e[li]??(e[li]={}))[t]=n}function at(t){for(var e=0;e<t.length;e++)sg.add(t[e]);for(var n of Vc)n(t)}let Kd=null;function Zc(t){var m,_;var e=this,n=e.ownerDocument,r=t.type,i=((m=t.composedPath)==null?void 0:m.call(t))||[],s=i[0]||t.target;Kd=t;var o=0,a=Kd===t&&t[li];if(a){var l=i.indexOf(a);if(l!==-1&&(e===document||e===window)){t[li]=e;return}var c=i.indexOf(e);if(c===-1)return;l<=c&&(o=l)}if(s=i[o]||t.target,s!==e){wb(t,"currentTarget",{configurable:!0,get(){return s||n}});var u=Fe,d=Ve;pn(null),Nn(null);try{for(var h,p=[];s!==null&&s!==e;){try{var g=(_=s[li])==null?void 0:_[r];g!=null&&(!s.disabled||t.target===s)&&g.call(s,t)}catch(k){h?p.push(k):h=k}if(t.cancelBubble)break;o++,s=o<i.length?i[o]:null}if(h){for(let k of p)queueMicrotask(()=>{throw k});throw h}}finally{t[li]=e,delete t.currentTarget,pn(u),Nn(d)}}}var dp;const $l=((dp=globalThis==null?void 0:globalThis.window)==null?void 0:dp.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function F_(t){return($l==null?void 0:$l.createHTML(t))??t}function G_(t){var e=T_("template");return e.innerHTML=F_(t.replaceAll("<!>","<!---->")),e.content}function Ca(t,e){var n=Ve;n.nodes===null&&(n.nodes={start:t,end:e,a:null,t:null})}function z(t,e){var n=(e&Ub)!==0,r=(e&jb)!==0,i,s=!t.startsWith("<!>");return()=>{i===void 0&&(i=G_(s?t:"<!>"+t),n||(i=xa(i)));var o=r||$p?document.importNode(i,!0):i.cloneNode(!0);if(n){var a=xa(o),l=o.lastChild;Ca(a,l)}else Ca(o,o);return o}}function Ls(t=""){{var e=br(t+"");return Ca(e,e),e}}function kn(){var t=document.createDocumentFragment(),e=document.createComment(""),n=br();return t.append(e,n),Ca(e,n),t}function C(t,e){t!==null&&t.before(e)}function S(t,e){var n=e==null?"":typeof e=="object"?`${e}`:e;n!==(t[Os]??(t[Os]=t.nodeValue))&&(t[Os]=n,t.nodeValue=`${n}`)}function hl(t,e){return V_(t,e)}const Fo=new Map;function V_(t,{target:e,anchor:n,props:r={},events:i,context:s,intro:o=!0,transformError:a}){S_();var l=void 0,c=R_(()=>{var u=n??e.appendChild(br());l_(u,{pending:()=>{}},p=>{Ie({});var g=et;s&&(g.c=s),i&&(r.$$events=i),l=t(p,r)||{},Le()},a);var d=new Set,h=p=>{for(var g=0;g<p.length;g++){var m=p[g];if(!d.has(m)){d.add(m);var _=j_(m);for(const I of[e,document]){var k=Fo.get(I);k===void 0&&(k=new Map,Fo.set(I,k));var O=k.get(m);O===void 0?(I.addEventListener(m,Zc,{passive:_}),k.set(m,1)):k.set(m,O+1)}}}};return h(ll(sg)),Vc.add(h),()=>{var _;for(var p of d)for(const k of[e,document]){var g=Fo.get(k),m=g.get(p);--m==0?(k.removeEventListener(p,Zc),g.delete(p),g.size===0&&Fo.delete(k)):g.set(p,m)}Vc.delete(h),u!==n&&((_=u.parentNode)==null||_.removeChild(u))}});return Wc.set(l,c),l}let Wc=new WeakMap;function ju(t,e){const n=Wc.get(t);return n?(Wc.delete(t),n(e)):Promise.resolve()}var Hn,tr,wn,pi,po,go,rl;class Fu{constructor(e,n=!0){G(this,"anchor");be(this,Hn,new Map);be(this,tr,new Map);be(this,wn,new Map);be(this,pi,new Set);be(this,po,!0);be(this,go,e=>{if(E(this,Hn).has(e)){var n=E(this,Hn).get(e),r=E(this,tr).get(n);if(r)Ta(r),E(this,pi).delete(n);else{var i=E(this,wn).get(n);i&&(Ta(i.effect),E(this,tr).set(n,i.effect),E(this,wn).delete(n),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),r=i.effect)}for(const[s,o]of E(this,Hn)){if(E(this,Hn).delete(s),s===e)break;const a=E(this,wn).get(o);a&&(Zt(a.effect),E(this,wn).delete(o))}for(const[s,o]of E(this,tr)){if(s===n||E(this,pi).has(s))continue;const a=()=>{if(Array.from(E(this,Hn).values()).includes(s)){var c=document.createDocumentFragment();$u(o,c),c.append(br()),E(this,wn).set(s,{effect:o,fragment:c})}else Zt(o);E(this,pi).delete(s),E(this,tr).delete(s)};E(this,po)||!r?(E(this,pi).add(s),vi(o,a,!1)):a()}}});be(this,rl,e=>{E(this,Hn).delete(e);const n=Array.from(E(this,Hn).values());for(const[r,i]of E(this,wn))n.includes(r)||(Zt(i.effect),E(this,wn).delete(r))});this.anchor=e,Me(this,po,n)}ensure(e,n){var r=Te,i=Fp();if(n&&!E(this,tr).has(e)&&!E(this,wn).has(e))if(i){var s=document.createDocumentFragment(),o=br();s.append(o),E(this,wn).set(e,{effect:dn(()=>n(o)),fragment:s})}else E(this,tr).set(e,dn(()=>n(this.anchor)));if(E(this,Hn).set(r,e),i){for(const[a,l]of E(this,tr))a===e?r.unskip_effect(l):r.skip_effect(l);for(const[a,l]of E(this,wn))a===e?r.unskip_effect(l.effect):r.skip_effect(l.effect);r.oncommit(E(this,go)),r.ondiscard(E(this,rl))}else E(this,go).call(this,r)}}Hn=new WeakMap,tr=new WeakMap,wn=new WeakMap,pi=new WeakMap,po=new WeakMap,go=new WeakMap,rl=new WeakMap;function Z(t,e,n=!1){var r=new Fu(t),i=n?Wr:0;function s(o,a){r.ensure(o,a)}Ao(()=>{var o=!1;e((a,l=0)=>{o=!0,s(l,a)}),o||s(-1,null)},i)}function Z_(t,e,n){for(var r=[],i=e.length,s,o=e.length,a=0;a<i;a++){let d=e[a];vi(d,()=>{if(s){if(s.pending.delete(d),s.done.add(d),s.pending.size===0){var h=t.outrogroups;qc(t,ll(s.done)),h.delete(s),h.size===0&&(t.outrogroups=null)}}else o-=1},!1)}if(o===0){var l=r.length===0&&n!==null;if(l){var c=n,u=c.parentNode;x_(u),u.append(c),t.items.clear()}qc(t,e,!l)}else s={pending:new Set(e),done:new Set},(t.outrogroups??(t.outrogroups=new Set)).add(s)}function qc(t,e,n=!0){var r;if(t.pending.size>0){r=new Set;for(const o of t.pending.values())for(const a of o)r.add(t.items.get(a).e)}for(var i=0;i<e.length;i++){var s=e[i];if(r!=null&&r.has(s)){s.f|=or;const o=document.createDocumentFragment();$u(s,o)}else Zt(e[i],n)}}var Qd;function ft(t,e,n,r,i,s=null){var o=t,a=new Map,l=(e&wp)!==0;if(l){var c=t;o=c.appendChild(br())}var u=null,d=Ap(()=>{var I=n();return al(I)?I:I==null?[]:ll(I)}),h,p=new Map,g=!0;function m(I){(O.effect.f&Mn)===0&&(O.pending.delete(I),O.fallback=u,W_(O,h,o,e,r),u!==null&&(h.length===0?(u.f&or)===0?Ta(u):(u.f^=or,Ds(u,null,o)):vi(u,()=>{u=null})))}function _(I){O.pending.delete(I)}var k=Ao(()=>{h=f(d);for(var I=h.length,R=new Set,A=Te,T=Fp(),M=0;M<I;M+=1){var N=h[M],j=r(N,M),H=g?null:a.get(j);H?(H.v&&es(H.v,N),H.i&&es(H.i,M),T&&A.unskip_effect(H.e)):(H=q_(a,g?o:Qd??(Qd=br()),N,j,M,i,e,n),g||(H.e.f|=or),a.set(j,H)),R.add(j)}if(I===0&&s&&!u&&(g?u=dn(()=>s(o)):(u=dn(()=>s(Qd??(Qd=br()))),u.f|=or)),I>R.size&&Pb(),!g)if(p.set(A,R),T){for(const[se,B]of a)R.has(se)||A.skip_effect(B.e);A.oncommit(m),A.ondiscard(_)}else m(A);f(d)}),O={effect:k,items:a,pending:p,outrogroups:null,fallback:u};g=!1}function Ts(t){for(;t!==null&&(t.f&On)===0;)t=t.next;return t}function W_(t,e,n,r,i){var H,se,B,q,ee,te,W,J,ne;var s=(r&Bb)!==0,o=e.length,a=t.items,l=Ts(t.effect.first),c,u=null,d,h=[],p=[],g,m,_,k;if(s)for(k=0;k<o;k+=1)g=e[k],m=i(g,k),_=a.get(m).e,(_.f&or)===0&&((se=(H=_.nodes)==null?void 0:H.a)==null||se.measure(),(d??(d=new Set)).add(_));for(k=0;k<o;k+=1){if(g=e[k],m=i(g,k),_=a.get(m).e,t.outrogroups!==null)for(const le of t.outrogroups)le.pending.delete(_),le.done.delete(_);if((_.f&rn)!==0&&(Ta(_),s&&((q=(B=_.nodes)==null?void 0:B.a)==null||q.unfix(),(d??(d=new Set)).delete(_))),(_.f&or)!==0)if(_.f^=or,_===l)Ds(_,null,n);else{var O=u?u.next:l;_===t.effect.last&&(t.effect.last=_.prev),_.prev&&(_.prev.next=_.next),_.next&&(_.next.prev=_.prev),Nr(t,u,_),Nr(t,_,O),Ds(_,O,n),u=_,h=[],p=[],l=Ts(u.next);continue}if(_!==l){if(c!==void 0&&c.has(_)){if(h.length<p.length){var I=p[0],R;u=I.prev;var A=h[0],T=h[h.length-1];for(R=0;R<h.length;R+=1)Ds(h[R],I,n);for(R=0;R<p.length;R+=1)c.delete(p[R]);Nr(t,A.prev,T.next),Nr(t,u,A),Nr(t,T,I),l=I,u=T,k-=1,h=[],p=[]}else c.delete(_),Ds(_,l,n),Nr(t,_.prev,_.next),Nr(t,_,u===null?t.effect.first:u.next),Nr(t,u,_),u=_;continue}for(h=[],p=[];l!==null&&l!==_;)(c??(c=new Set)).add(l),p.push(l),l=Ts(l.next);if(l===null)continue}(_.f&or)===0&&h.push(_),u=_,l=Ts(_.next)}if(t.outrogroups!==null){for(const le of t.outrogroups)le.pending.size===0&&(qc(t,ll(le.done)),(ee=t.outrogroups)==null||ee.delete(le));t.outrogroups.size===0&&(t.outrogroups=null)}if(l!==null||c!==void 0){var M=[];if(c!==void 0)for(_ of c)(_.f&rn)===0&&M.push(_);for(;l!==null;)(l.f&rn)===0&&l!==t.fallback&&M.push(l),l=Ts(l.next);var N=M.length;if(N>0){var j=(r&wp)!==0&&o===0?n:null;if(s){for(k=0;k<N;k+=1)(W=(te=M[k].nodes)==null?void 0:te.a)==null||W.measure();for(k=0;k<N;k+=1)(ne=(J=M[k].nodes)==null?void 0:J.a)==null||ne.fix()}Z_(t,M,j)}}s&&ar(()=>{var le,oe;if(d!==void 0)for(_ of d)(oe=(le=_.nodes)==null?void 0:le.a)==null||oe.apply()})}function q_(t,e,n,r,i,s,o,a){var l=(o&Db)!==0?(o&$b)===0?y_(n,!1,!1):kr(n):null,c=(o&Hb)!==0?kr(i):null;return{v:l,i:c,e:dn(()=>(s(e,l??n,c??i,a),()=>{t.delete(r)}))}}function Ds(t,e,n){if(t.nodes)for(var r=t.nodes.start,i=t.nodes.end,s=e&&(e.f&or)===0?e.nodes.start:n;r!==null;){var o=Ro(r);if(s.before(r),r===i)return;r=o}}function Nr(t,e,n){e===null?t.effect.first=n:e.next=n,n===null?t.effect.last=e:n.prev=e}function X_(t,e,...n){var r=new Fu(t);Ao(()=>{const i=e()??null;r.ensure(i,i&&(s=>i(s,...n)))},Wr)}function Y_(t,e,n){var r=new Fu(t);Ao(()=>{var i=e()??null;r.ensure(i,i&&(s=>n(s,i)))},Wr)}function Kr(t,e,n){dl(()=>{var r=Jr(()=>e(t,n==null?void 0:n())||{});if(n&&(r!=null&&r.update)){var i=!1,s={};fl(()=>{var o=n();ig(o),i&&kp(s,o)&&(s=o,r.update(o))}),i=!0}if(r!=null&&r.destroy)return()=>r.destroy()})}function J_(t,e){var n=void 0,r;Zp(()=>{n!==(n=e())&&(r&&(Zt(r),r=null),n&&(r=dn(()=>{dl(()=>n(t))})))})}function og(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=og(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function K_(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=og(t))&&(r&&(r+=" "),r+=e);return r}function Q_(t){return typeof t=="object"?K_(t):t??""}const ef=[...`
|
|
1
|
+
var Yv=Object.defineProperty;var Jv=Object.getPrototypeOf;var Kv=Reflect.get;var Bd=t=>{throw TypeError(t)};var Qv=(t,e,n)=>e in t?Yv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var G=(t,e,n)=>Qv(t,typeof e!="symbol"?e+"":e,n),Ll=(t,e,n)=>e.has(t)||Bd("Cannot "+n);var E=(t,e,n)=>(Ll(t,e,"read from private field"),n?n.call(t):e.get(t)),be=(t,e,n)=>e.has(t)?Bd("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Me=(t,e,n,r)=>(Ll(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Oe=(t,e,n)=>(Ll(t,e,"access private method"),n);var $d=(t,e,n)=>Kv(Jv(t),n,e);import{setMndwUiLocale as eb,coercePlacement as Ud,isMobileSheet as tb,resolveSizing as jd,computePopoverCoords as nb,createFocusTrap as Mc,composedContains as rb,tabbableElements as ib,column as Hr,defineMndwUi as sb}from"/shared/mndw-ui@0.1.4.js";import{ReplaySubject as ob,Observable as _a,tap as Dl,timer as ab,exhaustMap as lb,catchError as cb,EMPTY as ub,takeUntil as Fd,Subject as db,Subscription as fb,BehaviorSubject as hb,map as pb,firstValueFrom as hp,timeout as pp}from"/shared/rxjs@7.8.2.js";import{FetchTransport as gb,SessionManager as mb,RciManager as vb}from"/shared/rci-tools-core@0.6.0.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();const bb="/assets/sprite-qQ7EZWXN.svg",gp=!1;var al=Array.isArray,_b=Array.prototype.indexOf,wa=Array.prototype.includes,ll=Array.from,wb=Object.defineProperty,Fs=Object.getOwnPropertyDescriptor,mp=Object.getOwnPropertyDescriptors,vp=Object.prototype,yb=Array.prototype,cl=Object.getPrototypeOf,Gd=Object.isExtensible;const kb=()=>{};function Eb(t){return t()}function Oc(t){for(var e=0;e<t.length;e++)t[e]()}function bp(){var t,e,n=new Promise((r,i)=>{t=r,e=i});return{promise:n,resolve:t,reject:e}}function Sb(t,e){if(Array.isArray(t))return t;if(!(Symbol.iterator in t))return Array.from(t);const n=[];for(const r of t)if(n.push(r),n.length===e)break;return n}const $t=2,Ki=4,xo=8,Ru=1<<24,Un=16,On=32,yr=64,Nc=128,An=512,zt=1024,Rt=2048,Vn=4096,rn=8192,Mn=16384,us=32768,zc=1<<25,Wr=65536,ya=1<<17,xb=1<<18,ds=1<<19,_p=1<<20,or=1<<25,wi=65536,ka=1<<21,Bi=1<<22,Fr=1<<23,Gr=Symbol("$state"),Tb=Symbol(""),la=Symbol("attributes"),Ic=Symbol("class"),Lc=Symbol("style"),Os=Symbol("text"),ca=Symbol("form reset"),To=new class extends Error{constructor(){super(...arguments);G(this,"name","StaleReactionError");G(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var up;const Au=!!((up=globalThis.document)!=null&&up.contentType)&&globalThis.document.contentType.includes("xml");function Mu(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Cb(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Pb(t,e,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function Rb(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Ab(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Mb(t){throw new Error("https://svelte.dev/e/effect_orphan")}function Ob(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Nb(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function zb(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Ib(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Lb(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const Db=1,Hb=2,wp=4,Bb=8,$b=16,Ub=1,jb=2,Ct=Symbol("uninitialized"),Fb="http://www.w3.org/1999/xhtml",Gb="@attach";function Vb(){console.warn("https://svelte.dev/e/derived_inert")}function Zb(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function Wb(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function yp(t){return t===this.v}function kp(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function Ep(t){return!kp(t,this.v)}let Co=!1,qb=!1;function Xb(){Co=!0}const Yb=[];function jo(t,e=!1,n=!1){return ua(t,new Map,"",Yb,null,n)}function ua(t,e,n,r,i=null,s=!1){if(typeof t=="object"&&t!==null){var o=e.get(t);if(o!==void 0)return o;if(t instanceof Map)return new Map(t);if(t instanceof Set)return new Set(t);if(al(t)){var a=Array(t.length);e.set(t,a),i!==null&&e.set(i,a);for(var l=0;l<t.length;l+=1){var c=t[l];l in t&&(a[l]=ua(c,e,n,r,null,s))}return a}if(cl(t)===vp){a={},e.set(t,a),i!==null&&e.set(i,a);for(var u of Object.keys(t))a[u]=ua(t[u],e,n,r,null,s);return a}if(t instanceof Date)return structuredClone(t);if(typeof t.toJSON=="function"&&!s)return ua(t.toJSON(),e,n,r,t)}if(t instanceof EventTarget)return t;try{return structuredClone(t)}catch{return t}}let et=null;function Qi(t){et=t}function Jb(t){return Ou().get(t)}function Kb(t,e){return Ou().set(t,e),e}function Qb(t){return Ou().has(t)}function Ie(t,e=!1,n){et={p:et,i:!1,c:null,e:null,s:t,x:null,r:Ve,l:Co&&!e?{s:null,u:null,$:[]}:null}}function Le(t){var e=et,n=e.e;if(n!==null){e.e=null;for(var r of n)Vp(r)}return e.i=!0,et=e.p,{}}function Po(){return!Co||et!==null&&et.l===null}function Ou(t){return et===null&&Mu(),et.c??(et.c=new Map(e_(et)||void 0))}function e_(t){let e=t.p;for(;e!==null;){const n=e.c;if(n!==null)return n;e=e.p}return null}let oi=[];function Sp(){var t=oi;oi=[],Oc(t)}function ar(t){if(oi.length===0&&!Vs){var e=oi;queueMicrotask(()=>{e===oi&&Sp()})}oi.push(t)}function t_(){for(;oi.length>0;)Sp()}function xp(t){var e=Ve;if(e===null)return Fe.f|=Fr,t;if((e.f&us)===0&&(e.f&Ki)===0)throw t;Br(t,e)}function Br(t,e){if(!(e!==null&&(e.f&Mn)!==0)){for(;e!==null;){if((e.f&Nc)!==0){if((e.f&us)===0)throw t;try{e.b.error(t);return}catch(n){t=n}}e=e.parent}throw t}}const n_=-7169;function St(t,e){t.f=t.f&n_|e}function Nu(t){(t.f&An)!==0||t.deps===null?St(t,zt):St(t,Vn)}function Tp(t){if(t!==null)for(const e of t)(e.f&$t)===0||(e.f&wi)===0||(e.f^=wi,Tp(e.deps))}function Cp(t,e,n){(t.f&Rt)!==0?e.add(t):(t.f&Vn)!==0&&n.add(t),Tp(t.deps),St(t,zt)}function r_(t,e){if(e){const n=document.body;t.autofocus=!0,ar(()=>{document.activeElement===n&&t.focus()})}}let Vd=!1;function i_(){Vd||(Vd=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{var e;if(!t.defaultPrevented)for(const n of t.target.elements)(e=n[ca])==null||e.call(n)})},{capture:!0}))}function fs(t){var e=Fe,n=Ve;pn(null),Nn(null);try{return t()}finally{pn(e),Nn(n)}}function s_(t,e,n,r=n){t.addEventListener(e,()=>fs(n));const i=t[ca];i?t[ca]=()=>{i(),r(!0)}:t[ca]=()=>r(!0),i_()}function o_(t){let e=0,n=kr(0),r;return()=>{Du()&&(f(n),fl(()=>(e===0&&(r=Jr(()=>t(()=>Bt(n)))),e+=1,()=>{ar(()=>{e-=1,e===0&&(r==null||r(),r=void 0,Bt(n))})})))}}var a_=Wr|ds;function l_(t,e,n,r){new c_(t,e,n,r)}var Tn,Pu,Cn,ui,ln,Pn,tn,_n,dr,di,Ir,Gi,uo,fo,fr,tl,ht,u_,d_,Dc,f_,Hc,da,fa,Bc,$c;class c_{constructor(e,n,r,i){be(this,ht);G(this,"parent");G(this,"is_pending",!1);G(this,"transform_error");be(this,Tn);be(this,Pu,null);be(this,Cn);be(this,ui);be(this,ln);be(this,Pn,null);be(this,tn,null);be(this,_n,null);be(this,dr,null);be(this,di,0);be(this,Ir,0);be(this,Gi,!1);be(this,uo,new Set);be(this,fo,new Set);be(this,fr,null);be(this,tl,o_(()=>(Me(this,fr,kr(E(this,di))),()=>{Me(this,fr,null)})));var s;Me(this,Tn,e),Me(this,Cn,n),Me(this,ui,o=>{var a=Ve;a.b=this,a.f|=Nc,r(o)}),this.parent=Ve.b,this.transform_error=i??((s=this.parent)==null?void 0:s.transform_error)??(o=>o),Me(this,ln,Ao(()=>{Oe(this,ht,Hc).call(this)},a_))}defer_effect(e){Cp(e,E(this,uo),E(this,fo))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!E(this,Cn).pending}update_pending_count(e,n){Oe(this,ht,Bc).call(this,e,n),Me(this,di,E(this,di)+e),!(!E(this,fr)||E(this,Gi))&&(Me(this,Gi,!0),ar(()=>{Me(this,Gi,!1),E(this,fr)&&es(E(this,fr),E(this,di))}))}get_effect_pending(){return E(this,tl).call(this),f(E(this,fr))}error(e){if(!E(this,Cn).onerror&&!E(this,Cn).failed)throw e;Te!=null&&Te.is_fork?(E(this,Pn)&&Te.skip_effect(E(this,Pn)),E(this,tn)&&Te.skip_effect(E(this,tn)),E(this,_n)&&Te.skip_effect(E(this,_n)),Te.oncommit(()=>{Oe(this,ht,$c).call(this,e)})):Oe(this,ht,$c).call(this,e)}}Tn=new WeakMap,Pu=new WeakMap,Cn=new WeakMap,ui=new WeakMap,ln=new WeakMap,Pn=new WeakMap,tn=new WeakMap,_n=new WeakMap,dr=new WeakMap,di=new WeakMap,Ir=new WeakMap,Gi=new WeakMap,uo=new WeakMap,fo=new WeakMap,fr=new WeakMap,tl=new WeakMap,ht=new WeakSet,u_=function(){try{Me(this,Pn,dn(()=>E(this,ui).call(this,E(this,Tn))))}catch(e){this.error(e)}},d_=function(e){const n=E(this,Cn).failed,{reset:r,invoke_onerror:i}=Oe(this,ht,Dc).call(this,e);ar(i),n&&Me(this,_n,dn(()=>{n(E(this,Tn),()=>e,()=>r)}))},Dc=function(e){var n=!1,r=!1;const i=()=>{if(n){Wb();return}n=!0,r&&Lb(),E(this,_n)!==null&&vi(E(this,_n),()=>{Me(this,_n,null)}),Oe(this,ht,fa).call(this,()=>{Oe(this,ht,Hc).call(this)})};return{reset:i,invoke_onerror:()=>{var o,a;try{r=!0,(a=(o=E(this,Cn)).onerror)==null||a.call(o,e,i),r=!1}catch(l){Br(l,E(this,ln)&&E(this,ln).parent)}}}},f_=function(){const e=E(this,Cn).pending;e&&(this.is_pending=!0,Me(this,tn,dn(()=>e(E(this,Tn)))),ar(()=>{var n=Me(this,dr,document.createDocumentFragment()),r=br();n.append(r),Me(this,Pn,Oe(this,ht,fa).call(this,()=>dn(()=>E(this,ui).call(this,r)))),E(this,Ir)===0&&(E(this,Tn).before(n),Me(this,dr,null),vi(E(this,tn),()=>{Me(this,tn,null)}),Oe(this,ht,da).call(this,Te))}))},Hc=function(){try{if(this.is_pending=this.has_pending_snippet(),Me(this,Ir,0),Me(this,di,0),Me(this,Pn,dn(()=>{E(this,ui).call(this,E(this,Tn))})),E(this,Ir)>0){var e=Me(this,dr,document.createDocumentFragment());$u(E(this,Pn),e);const n=E(this,Cn).pending;Me(this,tn,dn(()=>n(E(this,Tn))))}else Oe(this,ht,da).call(this,Te)}catch(n){this.error(n)}},da=function(e){this.is_pending=!1,e.transfer_effects(E(this,uo),E(this,fo))},fa=function(e){var n=Ve,r=Fe,i=et;Nn(E(this,ln)),pn(E(this,ln)),Qi(E(this,ln).ctx);try{return yi.ensure(),e()}catch(s){return xp(s),null}finally{Nn(n),pn(r),Qi(i)}},Bc=function(e,n){var r;if(!this.has_pending_snippet()){this.parent&&Oe(r=this.parent,ht,Bc).call(r,e,n);return}Me(this,Ir,E(this,Ir)+e),E(this,Ir)===0&&(Oe(this,ht,da).call(this,n),E(this,tn)&&vi(E(this,tn),()=>{Me(this,tn,null)}),E(this,dr)&&(E(this,Tn).before(E(this,dr)),Me(this,dr,null)))},$c=function(e){E(this,Pn)&&(Zt(E(this,Pn)),Me(this,Pn,null)),E(this,tn)&&(Zt(E(this,tn)),Me(this,tn,null)),E(this,_n)&&(Zt(E(this,_n)),Me(this,_n,null));let n=E(this,Cn).failed;const r=i=>{const{reset:s,invoke_onerror:o}=Oe(this,ht,Dc).call(this,i);o(),n&&Me(this,_n,Oe(this,ht,fa).call(this,()=>{try{return dn(()=>{var a=Ve;a.b=this,a.f|=Nc,n(E(this,Tn),()=>i,()=>s)})}catch(a){return Br(a,E(this,ln).parent),null}}))};ar(()=>{var i;try{i=this.transform_error(e)}catch(s){Br(s,E(this,ln)&&E(this,ln).parent);return}i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(r,s=>Br(s,E(this,ln)&&E(this,ln).parent)):r(i)})};function Pp(t,e,n,r){const i=Po()?ul:Ap;var s=t.filter(p=>!p.settled),o=e.map(i);if(n.length===0&&s.length===0){r(o);return}var a=Ve,l=h_(),c=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(p=>p.promise)):null;function u(p){if((a.f&Mn)===0){l();try{r([...o,...p])}catch(g){Br(g,a)}Ea()}}var d=Rp();if(n.length===0){c.then(()=>u([])).finally(d);return}function h(){Promise.all(n.map(p=>p_(p))).then(u).catch(p=>Br(p,a)).finally(d)}c?c.then(()=>{l(),h(),Ea()}):h()}function h_(){var t=Ve,e=Fe,n=et,r=Te;return function(s=!0){Nn(t),pn(e),Qi(n),s&&(t.f&Mn)===0&&(r==null||r.activate(),r==null||r.apply())}}function Ea(t=!0){Nn(null),pn(null),Qi(null),t&&(Te==null||Te.deactivate())}function Rp(){var t=Ve,e=t.b,n=Te,r=!!(e!=null&&e.is_rendered());return e==null||e.update_pending_count(1,n),n.increment(r,t),()=>{e==null||e.update_pending_count(-1,n),n.decrement(r,t)}}function ul(t){var e=$t|Rt;return Ve!==null&&(Ve.f|=ds),{ctx:et,deps:null,effects:null,equals:yp,f:e,fn:t,reactions:null,rv:0,v:Ct,wv:0,parent:Ve,ac:null}}const Ns=Symbol("obsolete");function p_(t,e,n){let r=Ve;r===null&&Cb();var i=void 0,s=kr(Ct),o=!Fe,a=new Set;return A_(()=>{var p,g;var l=Ve,c=bp();i=c.promise;try{Promise.resolve(t()).then(c.resolve,m=>{m!==To&&c.reject(m)}).finally(Ea)}catch(m){c.reject(m),Ea()}var u=Te;if(o){if((l.f&us)!==0)var d=Rp();if((p=r.b)!=null&&p.is_rendered())(g=u.async_deriveds.get(l))==null||g.reject(Ns);else for(const m of a.values())m.reject(Ns);a.add(c),u.async_deriveds.set(l,c)}const h=(m,_=void 0)=>{d==null||d(),a.delete(c),_!==Ns&&(u.activate(),_?(s.f|=Fr,es(s,_)):((s.f&Fr)!==0&&(s.f^=Fr),es(s,m)),u.deactivate())};c.promise.then(h,m=>h(null,m||"unknown"))}),Hu(()=>{for(const l of a)l.reject(Ns)}),new Promise(l=>{function c(u){function d(){u===i?l(s):c(i)}u.then(d,d)}c(i)})}function fe(t){const e=ul(t);return Jp(e),e}function Ap(t){const e=ul(t);return e.equals=Ep,e}function g_(t){var e=t.effects;if(e!==null){t.effects=null;for(var n=0;n<e.length;n+=1)Zt(e[n])}}function zu(t){var e,n=Ve,r=t.parent;if(!qr&&r!==null&&t.v!==Ct&&(r.f&(Mn|rn))!==0)return Vb(),t.v;Nn(r);try{t.f&=~wi,g_(t),e=tg(t)}finally{Nn(n)}return e}function Mp(t){var e=zu(t);if(!t.equals(e)&&(t.wv=Qp(),(!(Te!=null&&Te.is_fork)||t.deps===null)&&(Te!==null?(Te.capture(t,e,!0),Gs==null||Gs.capture(t,e,!0)):t.v=e,t.deps===null))){St(t,zt);return}qr||(Gt!==null?(Du()||Te!=null&&Te.is_fork)&&Gt.set(t,e):Nu(t))}function m_(t){var e;if(t.effects!==null)for(const n of t.effects)(n.teardown||n.ac)&&((e=n.teardown)==null||e.call(n),n.ac!==null&&fs(()=>{n.ac.abort(To),n.ac=null}),n.fn!==null&&(n.teardown=kb),Js(n,0),Bu(n))}function Op(t){if(t.effects!==null)for(const e of t.effects)e.teardown&&e.fn!==null&&ts(e)}let Hl=null,Ri=null,Te=null,Gs=null,Gt=null,Uc=null,Vs=!1,Bl=!1,Ii=null,ha=null;var Zd=0;let v_=1;var Vi,Lr,fi,Zi,Wi,qi,hr,Xi,cn,ho,pr,Dn,er,Yi,hi,rt,jc,zs,Fc,Np,zp,zi,b_,Is;const nl=class nl{constructor(){be(this,rt);G(this,"id",v_++);be(this,Vi,!1);G(this,"linked",!0);be(this,Lr,null);be(this,fi,null);G(this,"async_deriveds",new Map);G(this,"current",new Map);G(this,"previous",new Map);be(this,Zi,new Set);be(this,Wi,new Set);be(this,qi,0);be(this,hr,new Map);be(this,Xi,null);be(this,cn,[]);be(this,ho,[]);be(this,pr,new Set);be(this,Dn,new Set);be(this,er,new Map);be(this,Yi,new Set);G(this,"is_fork",!1);be(this,hi,!1);Ri===null?Hl=Ri=this:(Me(Ri,fi,this),Me(this,Lr,Ri)),Ri=this}skip_effect(e){E(this,er).has(e)||E(this,er).set(e,{d:[],m:[]}),E(this,Yi).delete(e)}unskip_effect(e,n=r=>this.schedule(r)){var r=E(this,er).get(e);if(r){E(this,er).delete(e);for(var i of r.d)St(i,Rt),n(i);for(i of r.m)St(i,Vn),n(i)}E(this,Yi).add(e)}capture(e,n,r=!1){e.v!==Ct&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&Fr)===0&&(this.current.set(e,[n,r]),Gt==null||Gt.set(e,n)),this.is_fork||(e.v=n)}activate(){Te=this}deactivate(){Te=null,Gt=null}flush(){try{Bl=!0,Te=this,Oe(this,rt,zs).call(this)}finally{Zd=0,Uc=null,Ii=null,ha=null,Bl=!1,Te=null,Gt=null,mi.clear()}}discard(){var e;for(const n of E(this,Wi))n(this);E(this,Wi).clear();for(const n of this.async_deriveds.values())n.reject(Ns);Oe(this,rt,Is).call(this),(e=E(this,Xi))==null||e.resolve()}register_created_effect(e){E(this,ho).push(e)}increment(e,n){if(Me(this,qi,E(this,qi)+1),e){let r=E(this,hr).get(n)??0;E(this,hr).set(n,r+1)}}decrement(e,n){if(Me(this,qi,E(this,qi)-1),e){let r=E(this,hr).get(n)??0;r===1?E(this,hr).delete(n):E(this,hr).set(n,r-1)}E(this,hi)||(Me(this,hi,!0),ar(()=>{Me(this,hi,!1),this.linked&&this.flush()}))}transfer_effects(e,n){for(const r of e)E(this,pr).add(r);for(const r of n)E(this,Dn).add(r);e.clear(),n.clear()}oncommit(e){E(this,Zi).add(e)}ondiscard(e){E(this,Wi).add(e)}settled(){return(E(this,Xi)??Me(this,Xi,bp())).promise}static ensure(){if(Te===null){const e=Te=new nl;!Bl&&!Vs&&ar(()=>{E(e,Vi)||e.flush()})}return Te}apply(){{Gt=null;return}}schedule(e){var i;if(Uc=e,(i=e.b)!=null&&i.is_pending&&(e.f&(Ki|xo|Ru))!==0&&(e.f&us)===0){e.b.defer_effect(e);return}for(var n=e;n.parent!==null;){n=n.parent;var r=n.f;if(Ii!==null&&n===Ve&&(Fe===null||(Fe.f&$t)===0))return;if((r&(yr|On))!==0){if((r&zt)===0)return;n.f^=zt}}E(this,cn).push(n)}};Vi=new WeakMap,Lr=new WeakMap,fi=new WeakMap,Zi=new WeakMap,Wi=new WeakMap,qi=new WeakMap,hr=new WeakMap,Xi=new WeakMap,cn=new WeakMap,ho=new WeakMap,pr=new WeakMap,Dn=new WeakMap,er=new WeakMap,Yi=new WeakMap,hi=new WeakMap,rt=new WeakSet,jc=function(){if(this.is_fork)return!0;for(const r of E(this,hr).keys()){for(var e=r,n=!1;e.parent!==null;){if(E(this,er).has(e)){n=!0;break}e=e.parent}if(!n)return!0}return!1},zs=function(){var l,c,u,d;Me(this,Vi,!0),Zd++>1e3&&(Oe(this,rt,Is).call(this),w_());for(const h of E(this,pr))E(this,Dn).delete(h),St(h,Rt),this.schedule(h);for(const h of E(this,Dn))St(h,Vn),this.schedule(h);const e=E(this,cn);Me(this,cn,[]),this.apply();var n=Ii=[],r=[],i=ha=[];for(const h of e)try{Oe(this,rt,Fc).call(this,h,n,r)}catch(p){throw Dp(h),Oe(this,rt,jc).call(this)||this.discard(),p}if(Te=null,i.length>0){var s=nl.ensure();for(const h of i)s.schedule(h)}if(Ii=null,ha=null,Oe(this,rt,jc).call(this)){Oe(this,rt,zi).call(this,r),Oe(this,rt,zi).call(this,n);for(const[h,p]of E(this,er))Lp(h,p);i.length>0&&Oe(l=Te,rt,zs).call(l);return}const o=Oe(this,rt,Np).call(this);if(o){Oe(this,rt,zi).call(this,r),Oe(this,rt,zi).call(this,n),Oe(c=o,rt,zp).call(c,this);return}E(this,pr).clear(),E(this,Dn).clear();for(const h of E(this,Zi))h(this);E(this,Zi).clear(),Gs=this,Wd(r),Wd(n),Gs=null,(u=E(this,Xi))==null||u.resolve();var a=Te;if(E(this,qi)===0&&(E(this,cn).length===0||a!==null)&&Oe(this,rt,Is).call(this),E(this,cn).length>0)if(a!==null){const h=a;E(h,cn).push(...E(this,cn).filter(p=>!E(h,cn).includes(p)))}else a=this;a!==null&&Oe(d=a,rt,zs).call(d)},Fc=function(e,n,r){e.f^=zt;for(var i=e.first;i!==null;){var s=i.f,o=(s&(On|yr))!==0,a=o&&(s&zt)!==0,l=a||(s&rn)!==0||E(this,er).has(i);if(!l&&i.fn!==null){o?i.f^=zt:(s&Ki)!==0?n.push(i):Mo(i)&&((s&Un)!==0&&E(this,Dn).add(i),ts(i));var c=i.first;if(c!==null){i=c;continue}}for(;i!==null;){var u=i.next;if(u!==null){i=u;break}i=i.parent}}},Np=function(){for(var e=E(this,Lr);e!==null;){if(!e.is_fork){for(const[n,[,r]]of this.current)if(e.current.has(n)&&!r)return e}e=E(e,Lr)}return null},zp=function(e){var r;for(const[i,s]of e.current)!this.previous.has(i)&&e.previous.has(i)&&this.previous.set(i,e.previous.get(i)),this.current.set(i,s);for(const[i,s]of e.async_deriveds){const o=this.async_deriveds.get(i);o&&s.promise.then(o.resolve).catch(o.reject)}e.async_deriveds.clear(),this.transfer_effects(E(e,pr),E(e,Dn));const n=i=>{var s=i.reactions;if(s!==null&&!((i.f&$t)!==0&&(i.f&(Rt|Vn))===0))for(const l of s){var o=l.f;if((o&$t)!==0)n(l);else{var a=l;o&(Bi|Un)&&!this.async_deriveds.has(a)&&(E(this,Dn).delete(a),St(a,Rt),this.schedule(a))}}};for(const i of this.current.keys())n(i);this.oncommit(()=>e.discard()),Oe(r=e,rt,Is).call(r),Te=this,Oe(this,rt,zs).call(this)},zi=function(e){for(var n=0;n<e.length;n+=1)Cp(e[n],E(this,pr),E(this,Dn))},b_=function(){var d;for(let h=Hl;h!==null;h=E(h,fi)){var e=h.id<this.id,n=[];for(const[p,[g,m]]of this.current){if(h.current.has(p)){var r=h.current.get(p)[0];if(e&&g!==r)h.current.set(p,[g,m]);else continue}n.push(p)}if(e)for(const[p,g]of this.async_deriveds){const m=h.async_deriveds.get(p);m&&g.promise.then(m.resolve).catch(m.reject)}var i=[...h.current.keys()].filter(p=>!h.current.get(p)[1]);if(!(!E(h,Vi)||i.length===0)){var s=i.filter(p=>!this.current.has(p));if(s.length===0)e&&h.discard();else if(n.length>0){if(e)for(const p of E(this,Yi))h.unskip_effect(p,g=>{var m;(g.f&(Un|Bi))!==0?h.schedule(g):Oe(m=h,rt,zi).call(m,[g])});h.activate();var o=new Set,a=new Map;for(var l of n)Ip(l,s,o,a);a=new Map;var c=[...h.current].filter(([p,g])=>{const m=this.current.get(p);return m?m[0]!==g[0]||m[1]!==g[1]:!0}).map(([p])=>p);if(c.length>0)for(const p of E(this,ho))(p.f&(Mn|rn|ya))===0&&Iu(p,c,a)&&((p.f&(Bi|Un))!==0?(St(p,Rt),h.schedule(p)):E(h,pr).add(p));if(E(h,cn).length>0&&!E(h,hi)){h.apply();for(var u of E(h,cn))Oe(d=h,rt,Fc).call(d,u,[],[]);Me(h,cn,[])}h.deactivate()}}}},Is=function(){if(this.linked){var e=E(this,Lr),n=E(this,fi);e===null?Hl=n:Me(e,fi,n),n===null?Ri=e:Me(n,Lr,e),this.linked=!1}};let yi=nl;function __(t){var e=Vs;Vs=!0;try{for(var n;;){if(t_(),Te===null)return n;Te.flush()}}finally{Vs=e}}function w_(){try{Ob()}catch(t){Br(t,Uc)}}let Ln=null;function Wd(t){var e=t.length;if(e!==0){for(var n=0;n<e;){var r=t[n++];if((r.f&(Mn|rn))===0&&Mo(r)&&(Ln=new Set,ts(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&qp(r),(Ln==null?void 0:Ln.size)>0)){mi.clear();for(const i of Ln){if((i.f&(Mn|rn))!==0)continue;const s=[i];let o=i.parent;for(;o!==null;)Ln.has(o)&&(Ln.delete(o),s.push(o)),o=o.parent;for(let a=s.length-1;a>=0;a--){const l=s[a];(l.f&(Mn|rn))===0&&ts(l)}}Ln.clear()}}Ln=null}}function Ip(t,e,n,r){if(!n.has(t)&&(n.add(t),t.reactions!==null))for(const i of t.reactions){const s=i.f;(s&$t)!==0?Ip(i,e,n,r):(s&(Bi|Un))!==0&&(s&Rt)===0&&Iu(i,e,r)&&(St(i,Rt),Lu(i))}}function Iu(t,e,n){const r=n.get(t);if(r!==void 0)return r;if(t.deps!==null)for(const i of t.deps){if(wa.call(e,i))return!0;if((i.f&$t)!==0&&Iu(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function Lu(t){Te.schedule(t)}function Lp(t,e){if(!((t.f&On)!==0&&(t.f&zt)!==0)){(t.f&Rt)!==0?e.d.push(t):(t.f&Vn)!==0&&e.m.push(t),St(t,zt);for(var n=t.first;n!==null;)Lp(n,e),n=n.next}}function Dp(t){St(t,zt);for(var e=t.first;e!==null;)Dp(e),e=e.next}let Sa=new Set;const mi=new Map;let Hp=!1;function kr(t,e){var n={f:0,v:t,reactions:null,equals:yp,rv:0,wv:0};return n}function Y(t,e){const n=kr(t);return Jp(n),n}function y_(t,e=!1,n=!0){var i;const r=kr(t);return e||(r.equals=Ep),Co&&n&&et!==null&&et.l!==null&&((i=et.l).s??(i.s=[])).push(r),r}function b(t,e,n=!1){Fe!==null&&(!jn||(Fe.f&ya)!==0)&&Po()&&(Fe.f&($t|Un|Bi|ya))!==0&&(lr===null||!lr.has(t))&&Ib();let r=n?it(e):e;return es(t,r,ha)}function es(t,e,n=null){if(!t.equals(e)){mi.set(t,qr?e:t.v);var r=yi.ensure();if(r.capture(t,e),(t.f&$t)!==0){const i=t;(t.f&Rt)!==0&&zu(i),Gt===null&&Nu(i)}t.wv=Qp(),Bp(t,Rt,n),Po()&&Ve!==null&&(Ve.f&zt)!==0&&(Ve.f&(On|yr))===0&&(xn===null?N_([t]):xn.push(t)),!r.is_fork&&Sa.size>0&&!Hp&&k_()}return e}function k_(){Hp=!1;for(const t of Sa){(t.f&zt)!==0&&St(t,Vn);let e;try{e=Mo(t)}catch{e=!0}e&&ts(t)}Sa.clear()}function Bt(t){b(t,t.v+1)}function Bp(t,e,n){var r=t.reactions;if(r!==null)for(var i=Po(),s=r.length,o=0;o<s;o++){var a=r[o],l=a.f;if(!(!i&&a===Ve)){var c=(l&Rt)===0;if(c&&St(a,e),(l&ya)!==0)Sa.add(a);else if((l&$t)!==0){var u=a;Gt==null||Gt.delete(u),(l&wi)===0&&(l&An&&(Ve===null||(Ve.f&ka)===0)&&(a.f|=wi),Bp(u,Vn,n))}else if(c){var d=a;(l&Un)!==0&&Ln!==null&&Ln.add(d),n!==null?n.push(d):Lu(d)}}}}function it(t){if(typeof t!="object"||t===null||Gr in t)return t;const e=cl(t);if(e!==vp&&e!==yb)return t;var n=new Map,r=al(t),i=Y(0),s=Zn,o=a=>{if(Zn===s)return a();var l=Fe,c=Zn;pn(null),Yd(s);var u=a();return pn(l),Yd(c),u};return r&&n.set("length",Y(t.length)),new Proxy(t,{defineProperty(a,l,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&Nb();var u=n.get(l);return u===void 0?o(()=>{var d=Y(c.value);return n.set(l,d),d}):b(u,c.value,!0),!0},deleteProperty(a,l){var c=n.get(l);if(c===void 0){if(l in a){const u=o(()=>Y(Ct));n.set(l,u),Bt(i)}}else b(c,Ct),Bt(i);return!0},get(a,l,c){var p;if(l===Gr)return t;var u=n.get(l),d=l in a;if(u===void 0&&(!d||(p=Fs(a,l))!=null&&p.writable)&&(u=o(()=>{var g=it(d?a[l]:Ct),m=Y(g);return m}),n.set(l,u)),u!==void 0){var h=f(u);return h===Ct?void 0:h}return Reflect.get(a,l,c)},getOwnPropertyDescriptor(a,l){var c=Reflect.getOwnPropertyDescriptor(a,l);if(c&&"value"in c){var u=n.get(l);u&&(c.value=f(u))}else if(c===void 0){var d=n.get(l),h=d==null?void 0:d.v;if(d!==void 0&&h!==Ct)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return c},has(a,l){var h;if(l===Gr)return!0;var c=n.get(l),u=c!==void 0&&c.v!==Ct||Reflect.has(a,l);if(c!==void 0||Ve!==null&&(!u||(h=Fs(a,l))!=null&&h.writable)){c===void 0&&(c=o(()=>{var p=u?it(a[l]):Ct,g=Y(p);return g}),n.set(l,c));var d=f(c);if(d===Ct)return!1}return u},set(a,l,c,u){var I;var d=n.get(l),h=l in a;if(r&&l==="length")for(var p=c;p<d.v;p+=1){var g=n.get(p+"");g!==void 0?b(g,Ct):p in a&&(g=o(()=>Y(Ct)),n.set(p+"",g))}if(d===void 0)(!h||(I=Fs(a,l))!=null&&I.writable)&&(d=o(()=>Y(void 0)),b(d,it(c)),n.set(l,d));else{h=d.v!==Ct;var m=o(()=>it(c));b(d,m)}var _=Reflect.getOwnPropertyDescriptor(a,l);if(_!=null&&_.set&&_.set.call(u,c),!h){if(r&&typeof l=="string"){var k=n.get("length"),O=Number(l);Number.isInteger(O)&&O>=k.v&&b(k,O+1)}Bt(i)}return!0},ownKeys(a){f(i);var l=Reflect.ownKeys(a).filter(d=>{var h=n.get(d);return h===void 0||h.v!==Ct});for(var[c,u]of n)u.v!==Ct&&!(c in a)&&l.push(c);return l},setPrototypeOf(){zb()}})}function qd(t){try{if(t!==null&&typeof t=="object"&&Gr in t)return t[Gr]}catch{}return t}function E_(t,e){return Object.is(qd(t),qd(e))}var Ys,$p,Up,jp;function S_(){if(Ys===void 0){Ys=window,$p=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;Up=Fs(e,"firstChild").get,jp=Fs(e,"nextSibling").get,Gd(t)&&(t[Ic]=void 0,t[la]=null,t[Lc]=void 0,t.__e=void 0),Gd(n)&&(n[Os]=void 0)}}function br(t=""){return document.createTextNode(t)}function xa(t){return Up.call(t)}function Ro(t){return jp.call(t)}function v(t,e){return xa(t)}function Xe(t,e=!1){{var n=xa(t);return n instanceof Comment&&n.data===""?Ro(n):n}}function x(t,e=1,n=!1){let r=t;for(;e--;)r=Ro(r);return r}function x_(t){t.textContent=""}function Fp(){return!1}function T_(t,e,n){return n?document.createElement(t,{is:n}):document.createElement(t)}function Gp(t){Ve===null&&(Fe===null&&Mb(),Ab()),qr&&Rb()}function C_(t,e){var n=e.last;n===null?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}function Wn(t,e){var n=Ve;n!==null&&(n.f&rn)!==0&&(t|=rn);var r={ctx:et,deps:null,nodes:null,f:t|Rt|An,first:null,fn:e,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};Te==null||Te.register_created_effect(r);var i=r;if((t&Ki)!==0)Ii!==null?Ii.push(r):yi.ensure().schedule(r);else if(e!==null){try{ts(r)}catch(o){throw Zt(r),o}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&(i.f&ds)===0&&(i=i.first,(t&Un)!==0&&(t&Wr)!==0&&i!==null&&(i.f|=Wr))}if(i!==null&&(i.parent=n,n!==null&&C_(i,n),Fe!==null&&(Fe.f&$t)!==0&&(t&yr)===0)){var s=Fe;(s.effects??(s.effects=[])).push(i)}return r}function Du(){return Fe!==null&&!jn}function Hu(t){const e=Wn(xo,null);return St(e,zt),e.teardown=t,e}function hn(t){Gp();var e=Ve.f,n=!Fe&&(e&On)!==0&&et!==null&&!et.i;if(n){var r=et;(r.e??(r.e=[])).push(t)}else return Vp(t)}function Vp(t){return Wn(Ki|_p,t)}function P_(t){return Gp(),Wn(xo|_p,t)}function R_(t){yi.ensure();const e=Wn(yr|ds,t);return(n={})=>new Promise(r=>{n.outro?vi(e,()=>{Zt(e),r(void 0)}):(Zt(e),r(void 0))})}function dl(t){return Wn(Ki,t)}function A_(t){return Wn(Bi|ds,t)}function fl(t,e=0){return Wn(xo|e,t)}function y(t,e=[],n=[],r=[]){Pp(r,e,n,i=>{Wn(xo,()=>{t(...i.map(f))})})}function Ao(t,e=0){var n=Wn(Un|e,t);return n}function Zp(t,e=0){var n=Wn(Ru|e,t);return n}function dn(t){return Wn(On|ds,t)}function Wp(t){var e=t.teardown;if(e!==null){const n=qr,r=Fe;Xd(!0),pn(null);try{e.call(null)}finally{Xd(n),pn(r)}}}function Bu(t,e=!1){var n=t.first;for(t.first=t.last=null;n!==null;){const i=n.ac;i!==null&&fs(()=>{i.abort(To)});var r=n.next;(n.f&yr)!==0?n.parent=null:Zt(n,e),n=r}}function M_(t){for(var e=t.first;e!==null;){var n=e.next;(e.f&On)===0&&Zt(e),e=n}}function Zt(t,e=!0){var n=!1;(e||(t.f&xb)!==0)&&t.nodes!==null&&t.nodes.end!==null&&(O_(t.nodes.start,t.nodes.end),n=!0),t.f|=zc,Bu(t,e&&!n),Js(t,0);var r=t.nodes&&t.nodes.t;if(r!==null)for(const s of r)s.stop();Wp(t),t.f^=zc,t.f|=Mn;var i=t.parent;i!==null&&i.first!==null&&qp(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=t.b=null}function O_(t,e){for(;t!==null;){var n=t===e?null:Ro(t);t.remove(),t=n}}function qp(t){var e=t.parent,n=t.prev,r=t.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),e!==null&&(e.first===t&&(e.first=r),e.last===t&&(e.last=n))}function vi(t,e,n=!0){var r=[];Xp(t,r,!0);var i=()=>{n&&Zt(t),e&&e()},s=r.length;if(s>0){var o=()=>--s||i();for(var a of r)a.out(o)}else i()}function Xp(t,e,n){if((t.f&rn)===0){t.f^=rn;var r=t.nodes&&t.nodes.t;if(r!==null)for(const a of r)(a.is_global||n)&&e.push(a);for(var i=t.first;i!==null;){var s=i.next;if((i.f&yr)===0){var o=(i.f&Wr)!==0||(i.f&On)!==0&&(t.f&Un)!==0;Xp(i,e,o?n:!1)}i=s}}}function Ta(t){Yp(t,!0)}function Yp(t,e){if((t.f&rn)!==0){t.f^=rn,(t.f&zt)===0&&(St(t,Rt),yi.ensure().schedule(t));for(var n=t.first;n!==null;){var r=n.next,i=(n.f&Wr)!==0||(n.f&On)!==0;Yp(n,i?e:!1),n=r}var s=t.nodes&&t.nodes.t;if(s!==null)for(const o of s)(o.is_global||e)&&o.in()}}function $u(t,e){if(t.nodes)for(var n=t.nodes.start,r=t.nodes.end;n!==null;){var i=n===r?null:Ro(n);e.append(n),n=i}}let pa=!1,qr=!1;function Xd(t){qr=t}let Fe=null,jn=!1;function pn(t){Fe=t}let Ve=null;function Nn(t){Ve=t}let lr=null;function Jp(t){Fe!==null&&(lr??(lr=new Set)).add(t)}let un=null,bn=0,xn=null;function N_(t){xn=t}let Kp=1,ai=0,Zn=ai;function Yd(t){Zn=t}function Qp(){return++Kp}function Mo(t){var e=t.f;if((e&Rt)!==0)return!0;if(e&$t&&(t.f&=~wi),(e&Vn)!==0){for(var n=t.deps,r=n.length,i=0;i<r;i++){var s=n[i];if(Mo(s)&&Mp(s),s.wv>t.wv)return!0}(e&An)!==0&&Gt===null&&St(t,zt)}return!1}function eg(t,e,n=!0){var r=t.reactions;if(r!==null&&!(lr!==null&&lr.has(t)))for(var i=0;i<r.length;i++){var s=r[i];(s.f&$t)!==0?eg(s,e,!1):e===s&&(n?St(s,Rt):(s.f&zt)!==0&&St(s,Vn),Lu(s))}}function tg(t){var m;var e=un,n=bn,r=xn,i=Fe,s=lr,o=et,a=jn,l=Zn,c=t.f;un=null,bn=0,xn=null,Fe=(c&(On|yr))===0?t:null,lr=null,Qi(t.ctx),jn=!1,Zn=++ai,t.ac!==null&&(fs(()=>{t.ac.abort(To)}),t.ac=null);try{t.f|=ka;var u=t.fn,d=u();t.f|=us;var h=t.deps,p=Te==null?void 0:Te.is_fork;if(un!==null){var g;if(p||Js(t,bn),h!==null&&bn>0)for(h.length=bn+un.length,g=0;g<un.length;g++)h[bn+g]=un[g];else t.deps=h=un;if(Du()&&(t.f&An)!==0)for(g=bn;g<h.length;g++)((m=h[g]).reactions??(m.reactions=[])).push(t)}else!p&&h!==null&&bn<h.length&&(Js(t,bn),h.length=bn);if(Po()&&xn!==null&&!jn&&h!==null&&(t.f&($t|Vn|Rt))===0)for(g=0;g<xn.length;g++)eg(xn[g],t);if(i!==null&&i!==t){if(ai++,i.deps!==null)for(let _=0;_<n;_+=1)i.deps[_].rv=ai;if(e!==null)for(const _ of e)_.rv=ai;xn!==null&&(r===null?r=xn:r.push(...xn))}return(t.f&Fr)!==0&&(t.f^=Fr),d}catch(_){return xp(_)}finally{t.f^=ka,un=e,bn=n,xn=r,Fe=i,lr=s,Qi(o),jn=a,Zn=l}}function z_(t,e){let n=e.reactions;if(n!==null){var r=_b.call(n,t);if(r!==-1){var i=n.length-1;i===0?n=e.reactions=null:(n[r]=n[i],n.pop())}}if(n===null&&(e.f&$t)!==0&&(un===null||!wa.call(un,e))){var s=e;(s.f&An)!==0&&(s.f^=An,s.f&=~wi),s.v!==Ct&&Nu(s),s.ac!==null&&fs(()=>{s.ac.abort(To),s.ac=null,St(s,Rt)}),m_(s),Js(s,0)}}function Js(t,e){var n=t.deps;if(n!==null)for(var r=e;r<n.length;r++)z_(t,n[r])}function ts(t){var e=t.f;if((e&Mn)===0){St(t,zt);var n=Ve,r=pa;Ve=t,pa=(e&(On|yr))===0;try{(e&(Un|Ru))!==0?M_(t):Bu(t),Wp(t);var i=tg(t);t.teardown=typeof i=="function"?i:null,t.wv=Kp;var s;gp&&qb&&(t.f&Rt)!==0&&t.deps}finally{pa=r,Ve=n}}}async function I_(){await Promise.resolve(),__()}function f(t){var e=t.f,n=(e&$t)!==0;if(Fe!==null&&!jn){var r=Ve!==null&&(Ve.f&Mn)!==0;if(!r&&(lr===null||!lr.has(t))){var i=Fe.deps;if((Fe.f&ka)!==0)t.rv<ai&&(t.rv=ai,un===null&&i!==null&&i[bn]===t?bn++:un===null?un=[t]:un.push(t));else{Fe.deps??(Fe.deps=[]),wa.call(Fe.deps,t)||Fe.deps.push(t);var s=t.reactions;s===null?t.reactions=[Fe]:wa.call(s,Fe)||s.push(Fe)}}}if(qr&&mi.has(t))return mi.get(t);if(n){var o=t;if(qr){var a=o.v;return((o.f&zt)===0&&o.reactions!==null||rg(o))&&(a=zu(o)),mi.set(o,a),a}var l=(o.f&An)===0&&!jn&&Fe!==null&&(pa||(Fe.f&An)!==0),c=(o.f&us)===0;Mo(o)&&(l&&(o.f|=An),Mp(o)),l&&!c&&(Op(o),ng(o))}if(Gt!=null&&Gt.has(t))return Gt.get(t);if((t.f&Fr)!==0)throw t.v;return t.v}function ng(t){if(t.f|=An,t.deps!==null)for(const e of t.deps)(e.reactions??(e.reactions=[])).push(t),(e.f&$t)!==0&&(e.f&An)===0&&(Op(e),ng(e))}function rg(t){if(t.v===Ct)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(mi.has(e)||(e.f&$t)!==0&&rg(e))return!0;return!1}function Jr(t){var e=jn;try{return jn=!0,t()}finally{jn=e}}function ig(t){if(!(typeof t!="object"||!t||t instanceof EventTarget)){if(Gr in t)Gc(t);else if(!Array.isArray(t))for(let e in t){const n=t[e];typeof n=="object"&&n&&Gr in n&&Gc(n)}}}function Gc(t,e=new Set){if(typeof t=="object"&&t!==null&&!(t instanceof EventTarget)&&!e.has(t)){e.add(t),t instanceof Date&&t.getTime();for(let r in t)try{Gc(t[r],e)}catch{}const n=cl(t);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){const r=mp(n);for(let i in r){const s=r[i].get;if(s)try{s.call(t)}catch{}}}}}function L_(t){return t.endsWith("capture")&&t!=="gotpointercapture"&&t!=="lostpointercapture"}const D_=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function H_(t){return D_.includes(t)}const B_={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function $_(t){return t=t.toLowerCase(),B_[t]??t}const U_=["touchstart","touchmove"];function j_(t){return U_.includes(t)}const li=Symbol("events"),sg=new Set,Vc=new Set;function Uu(t,e,n,r={}){function i(s){if(r.capture||Zc.call(e,s),!s.cancelBubble)return fs(()=>n==null?void 0:n.call(this,s))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?ar(()=>{e.addEventListener(t,i,r)}):e.addEventListener(t,i,r),i}function Jd(t,e,n,r={}){var i=Uu(e,t,n,r);return()=>{t.removeEventListener(e,i,r)}}function ut(t,e,n,r,i){var s={capture:r,passive:i},o=Uu(t,e,n,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Hu(()=>{e.removeEventListener(t,o,s)})}function pe(t,e,n){(e[li]??(e[li]={}))[t]=n}function at(t){for(var e=0;e<t.length;e++)sg.add(t[e]);for(var n of Vc)n(t)}let Kd=null;function Zc(t){var m,_;var e=this,n=e.ownerDocument,r=t.type,i=((m=t.composedPath)==null?void 0:m.call(t))||[],s=i[0]||t.target;Kd=t;var o=0,a=Kd===t&&t[li];if(a){var l=i.indexOf(a);if(l!==-1&&(e===document||e===window)){t[li]=e;return}var c=i.indexOf(e);if(c===-1)return;l<=c&&(o=l)}if(s=i[o]||t.target,s!==e){wb(t,"currentTarget",{configurable:!0,get(){return s||n}});var u=Fe,d=Ve;pn(null),Nn(null);try{for(var h,p=[];s!==null&&s!==e;){try{var g=(_=s[li])==null?void 0:_[r];g!=null&&(!s.disabled||t.target===s)&&g.call(s,t)}catch(k){h?p.push(k):h=k}if(t.cancelBubble)break;o++,s=o<i.length?i[o]:null}if(h){for(let k of p)queueMicrotask(()=>{throw k});throw h}}finally{t[li]=e,delete t.currentTarget,pn(u),Nn(d)}}}var dp;const $l=((dp=globalThis==null?void 0:globalThis.window)==null?void 0:dp.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function F_(t){return($l==null?void 0:$l.createHTML(t))??t}function G_(t){var e=T_("template");return e.innerHTML=F_(t.replaceAll("<!>","<!---->")),e.content}function Ca(t,e){var n=Ve;n.nodes===null&&(n.nodes={start:t,end:e,a:null,t:null})}function z(t,e){var n=(e&Ub)!==0,r=(e&jb)!==0,i,s=!t.startsWith("<!>");return()=>{i===void 0&&(i=G_(s?t:"<!>"+t),n||(i=xa(i)));var o=r||$p?document.importNode(i,!0):i.cloneNode(!0);if(n){var a=xa(o),l=o.lastChild;Ca(a,l)}else Ca(o,o);return o}}function Ls(t=""){{var e=br(t+"");return Ca(e,e),e}}function kn(){var t=document.createDocumentFragment(),e=document.createComment(""),n=br();return t.append(e,n),Ca(e,n),t}function C(t,e){t!==null&&t.before(e)}function S(t,e){var n=e==null?"":typeof e=="object"?`${e}`:e;n!==(t[Os]??(t[Os]=t.nodeValue))&&(t[Os]=n,t.nodeValue=`${n}`)}function hl(t,e){return V_(t,e)}const Fo=new Map;function V_(t,{target:e,anchor:n,props:r={},events:i,context:s,intro:o=!0,transformError:a}){S_();var l=void 0,c=R_(()=>{var u=n??e.appendChild(br());l_(u,{pending:()=>{}},p=>{Ie({});var g=et;s&&(g.c=s),i&&(r.$$events=i),l=t(p,r)||{},Le()},a);var d=new Set,h=p=>{for(var g=0;g<p.length;g++){var m=p[g];if(!d.has(m)){d.add(m);var _=j_(m);for(const I of[e,document]){var k=Fo.get(I);k===void 0&&(k=new Map,Fo.set(I,k));var O=k.get(m);O===void 0?(I.addEventListener(m,Zc,{passive:_}),k.set(m,1)):k.set(m,O+1)}}}};return h(ll(sg)),Vc.add(h),()=>{var _;for(var p of d)for(const k of[e,document]){var g=Fo.get(k),m=g.get(p);--m==0?(k.removeEventListener(p,Zc),g.delete(p),g.size===0&&Fo.delete(k)):g.set(p,m)}Vc.delete(h),u!==n&&((_=u.parentNode)==null||_.removeChild(u))}});return Wc.set(l,c),l}let Wc=new WeakMap;function ju(t,e){const n=Wc.get(t);return n?(Wc.delete(t),n(e)):Promise.resolve()}var Hn,tr,wn,pi,po,go,rl;class Fu{constructor(e,n=!0){G(this,"anchor");be(this,Hn,new Map);be(this,tr,new Map);be(this,wn,new Map);be(this,pi,new Set);be(this,po,!0);be(this,go,e=>{if(E(this,Hn).has(e)){var n=E(this,Hn).get(e),r=E(this,tr).get(n);if(r)Ta(r),E(this,pi).delete(n);else{var i=E(this,wn).get(n);i&&(Ta(i.effect),E(this,tr).set(n,i.effect),E(this,wn).delete(n),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),r=i.effect)}for(const[s,o]of E(this,Hn)){if(E(this,Hn).delete(s),s===e)break;const a=E(this,wn).get(o);a&&(Zt(a.effect),E(this,wn).delete(o))}for(const[s,o]of E(this,tr)){if(s===n||E(this,pi).has(s))continue;const a=()=>{if(Array.from(E(this,Hn).values()).includes(s)){var c=document.createDocumentFragment();$u(o,c),c.append(br()),E(this,wn).set(s,{effect:o,fragment:c})}else Zt(o);E(this,pi).delete(s),E(this,tr).delete(s)};E(this,po)||!r?(E(this,pi).add(s),vi(o,a,!1)):a()}}});be(this,rl,e=>{E(this,Hn).delete(e);const n=Array.from(E(this,Hn).values());for(const[r,i]of E(this,wn))n.includes(r)||(Zt(i.effect),E(this,wn).delete(r))});this.anchor=e,Me(this,po,n)}ensure(e,n){var r=Te,i=Fp();if(n&&!E(this,tr).has(e)&&!E(this,wn).has(e))if(i){var s=document.createDocumentFragment(),o=br();s.append(o),E(this,wn).set(e,{effect:dn(()=>n(o)),fragment:s})}else E(this,tr).set(e,dn(()=>n(this.anchor)));if(E(this,Hn).set(r,e),i){for(const[a,l]of E(this,tr))a===e?r.unskip_effect(l):r.skip_effect(l);for(const[a,l]of E(this,wn))a===e?r.unskip_effect(l.effect):r.skip_effect(l.effect);r.oncommit(E(this,go)),r.ondiscard(E(this,rl))}else E(this,go).call(this,r)}}Hn=new WeakMap,tr=new WeakMap,wn=new WeakMap,pi=new WeakMap,po=new WeakMap,go=new WeakMap,rl=new WeakMap;function Z(t,e,n=!1){var r=new Fu(t),i=n?Wr:0;function s(o,a){r.ensure(o,a)}Ao(()=>{var o=!1;e((a,l=0)=>{o=!0,s(l,a)}),o||s(-1,null)},i)}function Z_(t,e,n){for(var r=[],i=e.length,s,o=e.length,a=0;a<i;a++){let d=e[a];vi(d,()=>{if(s){if(s.pending.delete(d),s.done.add(d),s.pending.size===0){var h=t.outrogroups;qc(t,ll(s.done)),h.delete(s),h.size===0&&(t.outrogroups=null)}}else o-=1},!1)}if(o===0){var l=r.length===0&&n!==null;if(l){var c=n,u=c.parentNode;x_(u),u.append(c),t.items.clear()}qc(t,e,!l)}else s={pending:new Set(e),done:new Set},(t.outrogroups??(t.outrogroups=new Set)).add(s)}function qc(t,e,n=!0){var r;if(t.pending.size>0){r=new Set;for(const o of t.pending.values())for(const a of o)r.add(t.items.get(a).e)}for(var i=0;i<e.length;i++){var s=e[i];if(r!=null&&r.has(s)){s.f|=or;const o=document.createDocumentFragment();$u(s,o)}else Zt(e[i],n)}}var Qd;function ft(t,e,n,r,i,s=null){var o=t,a=new Map,l=(e&wp)!==0;if(l){var c=t;o=c.appendChild(br())}var u=null,d=Ap(()=>{var I=n();return al(I)?I:I==null?[]:ll(I)}),h,p=new Map,g=!0;function m(I){(O.effect.f&Mn)===0&&(O.pending.delete(I),O.fallback=u,W_(O,h,o,e,r),u!==null&&(h.length===0?(u.f&or)===0?Ta(u):(u.f^=or,Ds(u,null,o)):vi(u,()=>{u=null})))}function _(I){O.pending.delete(I)}var k=Ao(()=>{h=f(d);for(var I=h.length,R=new Set,A=Te,T=Fp(),M=0;M<I;M+=1){var N=h[M],j=r(N,M),H=g?null:a.get(j);H?(H.v&&es(H.v,N),H.i&&es(H.i,M),T&&A.unskip_effect(H.e)):(H=q_(a,g?o:Qd??(Qd=br()),N,j,M,i,e,n),g||(H.e.f|=or),a.set(j,H)),R.add(j)}if(I===0&&s&&!u&&(g?u=dn(()=>s(o)):(u=dn(()=>s(Qd??(Qd=br()))),u.f|=or)),I>R.size&&Pb(),!g)if(p.set(A,R),T){for(const[se,B]of a)R.has(se)||A.skip_effect(B.e);A.oncommit(m),A.ondiscard(_)}else m(A);f(d)}),O={effect:k,items:a,pending:p,outrogroups:null,fallback:u};g=!1}function Ts(t){for(;t!==null&&(t.f&On)===0;)t=t.next;return t}function W_(t,e,n,r,i){var H,se,B,q,ee,te,W,J,ne;var s=(r&Bb)!==0,o=e.length,a=t.items,l=Ts(t.effect.first),c,u=null,d,h=[],p=[],g,m,_,k;if(s)for(k=0;k<o;k+=1)g=e[k],m=i(g,k),_=a.get(m).e,(_.f&or)===0&&((se=(H=_.nodes)==null?void 0:H.a)==null||se.measure(),(d??(d=new Set)).add(_));for(k=0;k<o;k+=1){if(g=e[k],m=i(g,k),_=a.get(m).e,t.outrogroups!==null)for(const le of t.outrogroups)le.pending.delete(_),le.done.delete(_);if((_.f&rn)!==0&&(Ta(_),s&&((q=(B=_.nodes)==null?void 0:B.a)==null||q.unfix(),(d??(d=new Set)).delete(_))),(_.f&or)!==0)if(_.f^=or,_===l)Ds(_,null,n);else{var O=u?u.next:l;_===t.effect.last&&(t.effect.last=_.prev),_.prev&&(_.prev.next=_.next),_.next&&(_.next.prev=_.prev),Nr(t,u,_),Nr(t,_,O),Ds(_,O,n),u=_,h=[],p=[],l=Ts(u.next);continue}if(_!==l){if(c!==void 0&&c.has(_)){if(h.length<p.length){var I=p[0],R;u=I.prev;var A=h[0],T=h[h.length-1];for(R=0;R<h.length;R+=1)Ds(h[R],I,n);for(R=0;R<p.length;R+=1)c.delete(p[R]);Nr(t,A.prev,T.next),Nr(t,u,A),Nr(t,T,I),l=I,u=T,k-=1,h=[],p=[]}else c.delete(_),Ds(_,l,n),Nr(t,_.prev,_.next),Nr(t,_,u===null?t.effect.first:u.next),Nr(t,u,_),u=_;continue}for(h=[],p=[];l!==null&&l!==_;)(c??(c=new Set)).add(l),p.push(l),l=Ts(l.next);if(l===null)continue}(_.f&or)===0&&h.push(_),u=_,l=Ts(_.next)}if(t.outrogroups!==null){for(const le of t.outrogroups)le.pending.size===0&&(qc(t,ll(le.done)),(ee=t.outrogroups)==null||ee.delete(le));t.outrogroups.size===0&&(t.outrogroups=null)}if(l!==null||c!==void 0){var M=[];if(c!==void 0)for(_ of c)(_.f&rn)===0&&M.push(_);for(;l!==null;)(l.f&rn)===0&&l!==t.fallback&&M.push(l),l=Ts(l.next);var N=M.length;if(N>0){var j=(r&wp)!==0&&o===0?n:null;if(s){for(k=0;k<N;k+=1)(W=(te=M[k].nodes)==null?void 0:te.a)==null||W.measure();for(k=0;k<N;k+=1)(ne=(J=M[k].nodes)==null?void 0:J.a)==null||ne.fix()}Z_(t,M,j)}}s&&ar(()=>{var le,oe;if(d!==void 0)for(_ of d)(oe=(le=_.nodes)==null?void 0:le.a)==null||oe.apply()})}function q_(t,e,n,r,i,s,o,a){var l=(o&Db)!==0?(o&$b)===0?y_(n,!1,!1):kr(n):null,c=(o&Hb)!==0?kr(i):null;return{v:l,i:c,e:dn(()=>(s(e,l??n,c??i,a),()=>{t.delete(r)}))}}function Ds(t,e,n){if(t.nodes)for(var r=t.nodes.start,i=t.nodes.end,s=e&&(e.f&or)===0?e.nodes.start:n;r!==null;){var o=Ro(r);if(s.before(r),r===i)return;r=o}}function Nr(t,e,n){e===null?t.effect.first=n:e.next=n,n===null?t.effect.last=e:n.prev=e}function X_(t,e,...n){var r=new Fu(t);Ao(()=>{const i=e()??null;r.ensure(i,i&&(s=>i(s,...n)))},Wr)}function Y_(t,e,n){var r=new Fu(t);Ao(()=>{var i=e()??null;r.ensure(i,i&&(s=>n(s,i)))},Wr)}function Kr(t,e,n){dl(()=>{var r=Jr(()=>e(t,n==null?void 0:n())||{});if(n&&(r!=null&&r.update)){var i=!1,s={};fl(()=>{var o=n();ig(o),i&&kp(s,o)&&(s=o,r.update(o))}),i=!0}if(r!=null&&r.destroy)return()=>r.destroy()})}function J_(t,e){var n=void 0,r;Zp(()=>{n!==(n=e())&&(r&&(Zt(r),r=null),n&&(r=dn(()=>{dl(()=>n(t))})))})}function og(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=og(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function K_(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=og(t))&&(r&&(r+=" "),r+=e);return r}function Q_(t){return typeof t=="object"?K_(t):t??""}const ef=[...`
|
|
2
2
|
\r\f \v\uFEFF`];function ew(t,e,n){var r=t==null?"":""+t;if(e&&(r=r?r+" "+e:e),n){for(var i of Object.keys(n))if(n[i])r=r?r+" "+i:i;else if(r.length)for(var s=i.length,o=0;(o=r.indexOf(i,o))>=0;){var a=o+s;(o===0||ef.includes(r[o-1]))&&(a===r.length||ef.includes(r[a]))?r=(o===0?"":r.substring(0,o))+r.substring(a+1):o=a}}return r===""?null:r}function tf(t,e=!1){var n=e?" !important;":";",r="";for(var i of Object.keys(t)){var s=t[i];s!=null&&s!==""&&(r+=" "+i+": "+s+n)}return r}function Ul(t){return t[0]!=="-"||t[1]!=="-"?t.toLowerCase():t}function tw(t,e){if(e){var n="",r,i;if(Array.isArray(e)?(r=e[0],i=e[1]):r=e,t){t=String(t).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var s=!1,o=0,a=!1,l=[];r&&l.push(...Object.keys(r).map(Ul)),i&&l.push(...Object.keys(i).map(Ul));var c=0,u=-1;const m=t.length;for(var d=0;d<m;d++){var h=t[d];if(a?h==="/"&&t[d-1]==="*"&&(a=!1):s?s===h&&(s=!1):h==="/"&&t[d+1]==="*"?a=!0:h==='"'||h==="'"?s=h:h==="("?o++:h===")"&&o--,!a&&s===!1&&o===0){if(h===":"&&u===-1)u=d;else if(h===";"||d===m-1){if(u!==-1){var p=Ul(t.substring(c,u).trim());if(!l.includes(p)){h!==";"&&d++;var g=t.substring(c,d).trim();n+=" "+g+";"}}c=d+1,u=-1}}}}return r&&(n+=tf(r)),i&&(n+=tf(i,!0)),n=n.trim(),n===""?null:n}return t==null?null:String(t)}function Ne(t,e,n,r,i,s){var o=t[Ic];if(o!==n||o===void 0){var a=ew(n,r,s);a==null?t.removeAttribute("class"):e?t.className=a:t.setAttribute("class",a),t[Ic]=n}else if(s&&i!==s)for(var l in s){var c=!!s[l];(i==null||c!==!!i[l])&&t.classList.toggle(l,c)}return s}function jl(t,e={},n,r){for(var i in n){var s=n[i];e[i]!==s&&(n[i]==null?t.style.removeProperty(i):t.style.setProperty(i,s,r))}}function Ks(t,e,n,r){var i=t[Lc];if(i!==e){var s=tw(e,r);s==null?t.removeAttribute("style"):t.style.cssText=s,t[Lc]=e}else r&&(Array.isArray(r)?(jl(t,n==null?void 0:n[0],r[0]),jl(t,n==null?void 0:n[1],r[1],"important")):jl(t,n,r));return r}function Xc(t,e,n=!1){if(t.multiple){if(e==null)return;if(!al(e))return Zb();for(var r of t.options)r.selected=e.includes(nf(r));return}for(r of t.options){var i=nf(r);if(E_(i,e)){r.selected=!0;return}}(!n||e!==void 0)&&(t.selectedIndex=-1)}function nw(t){var e=new MutationObserver(()=>{"__value"in t&&Xc(t,t.__value)});e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Hu(()=>{e.disconnect()})}function nf(t){return"__value"in t?t.__value:t.value}const Go=Symbol("class"),Cs=Symbol("style"),ag=Symbol("is custom element"),lg=Symbol("is html"),rw=Au?"input":"INPUT",iw=Au?"option":"OPTION",sw=Au?"select":"SELECT";function ow(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function Ae(t,e,n,r){var i=cg(t);i[e]!==(i[e]=n)&&(e==="loading"&&(t[Tb]=n),n==null?t.removeAttribute(e):typeof n!="string"&&Gu(t).includes(e)?t[e]=n:t.setAttribute(e,n))}function P(t,e,n){var r=Fe,i=Ve;pn(null),Nn(null);try{e!=="style"&&(Yc.has(t.getAttribute("is")||t.nodeName)||!customElements||customElements.get(t.getAttribute("is")||t.nodeName.toLowerCase())?Gu(t).includes(e):n&&typeof n=="object")?t[e]=n:Ae(t,e,n==null?n:String(n))}finally{pn(r),Nn(i)}}function aw(t,e,n,r,i=!1,s=!1){var o=cg(t),a=o[ag],l=!o[lg],c=e||{},u=t.nodeName===iw;for(var d in e)d in n||(n[d]=null);n.class?n.class=Q_(n.class):n.class=null,n[Cs]&&(n.style??(n.style=null));var h=Gu(t);if(t.nodeName===rw&&"type"in n&&("value"in n||"__value"in n)){var p=n.type;(p!==c.type||p===void 0&&t.hasAttribute("type"))&&(c.type=p,Ae(t,"type",p))}for(const R in n){let A=n[R];if(u&&R==="value"&&A==null){t.value=t.__value="",c[R]=A;continue}if(R==="class"){var g=t.namespaceURI==="http://www.w3.org/1999/xhtml";Ne(t,g,A,r,e==null?void 0:e[Go],n[Go]),c[R]=A,c[Go]=n[Go];continue}if(R==="style"){Ks(t,A,e==null?void 0:e[Cs],n[Cs]),c[R]=A,c[Cs]=n[Cs];continue}var m=c[R];if(!(A===m&&!(A===void 0&&t.hasAttribute(R)))){c[R]=A;var _=R[0]+R[1];if(_!=="$$")if(_==="on"){const T={},M="$$"+R;let N=R.slice(2);var k=H_(N);if(L_(N)&&(N=N.slice(0,-7),T.capture=!0),!k&&m){if(A!=null)continue;t.removeEventListener(N,c[M],T),c[M]=null}if(k)pe(N,t,A),at([N]);else if(A!=null){let j=function(H){c[R].call(this,H)};c[M]=Uu(N,t,j,T)}}else if(R==="style")Ae(t,R,A);else if(R==="autofocus")r_(t,!!A);else if(!a&&(R==="__value"||R==="value"&&A!=null))t.value=t.__value=A;else if(R==="selected"&&u)ow(t,A);else{var O=R;l||(O=$_(O));var I=O==="defaultValue"||O==="defaultChecked";if(A==null&&!a&&!I)if(o[R]=null,O==="value"||O==="checked"){let T=t;const M=e===void 0;if(O==="value"){let N=T.defaultValue;T.removeAttribute(O),T.defaultValue=N,T.value=T.__value=M?N:null}else{let N=T.defaultChecked;T.removeAttribute(O),T.defaultChecked=N,T.checked=M?N:!1}}else t.removeAttribute(R);else I||h.includes(O)&&(a||typeof A!="string")?(t[O]=A,O in o&&(o[O]=Ct)):typeof A!="function"&&Ae(t,O,A)}}}return c}function lw(t,e,n=[],r=[],i=[],s,o=!1,a=!1){Pp(i,n,r,l=>{var c=void 0,u={},d=t.nodeName===sw,h=!1;if(Zp(()=>{var g=e(...l.map(f)),m=aw(t,c,g,s,o,a);h&&d&&"value"in g&&Xc(t,g.value);for(let k of Object.getOwnPropertySymbols(u))g[k]||Zt(u[k]);for(let k of Object.getOwnPropertySymbols(g)){var _=g[k];k.description===Gb&&(!c||_!==c[k])&&(u[k]&&Zt(u[k]),u[k]=dn(()=>J_(t,()=>_))),m[k]=_}c=m}),d){var p=t;dl(()=>{Xc(p,c.value,!0),nw(p)})}h=!0})}function cg(t){return t[la]??(t[la]={[ag]:t.nodeName.includes("-"),[lg]:t.namespaceURI===Fb})}var Yc=new Map;function Gu(t){var e=t.getAttribute("is")||t.nodeName,n=Yc.get(e);if(n)return n;Yc.set(e,n=[]);for(var r,i=t,s=Element.prototype;s!==i;){r=mp(i);for(var o in r)r[o].set&&o!=="innerHTML"&&o!=="textContent"&&o!=="innerText"&&n.push(o);i=cl(i)}return n}function cw(t,e,n=e){var r=new WeakSet;s_(t,"input",async i=>{var s=i?t.defaultValue:t.value;if(s=Fl(t)?Gl(s):s,n(s),Te!==null&&r.add(Te),await I_(),s!==(s=e())){var o=t.selectionStart,a=t.selectionEnd,l=t.value.length;if(t.value=s??"",a!==null){var c=t.value.length;o===a&&a===l&&c>l?(t.selectionStart=c,t.selectionEnd=c):(t.selectionStart=o,t.selectionEnd=Math.min(a,c))}}}),Jr(e)==null&&t.value&&(n(Fl(t)?Gl(t.value):t.value),Te!==null&&r.add(Te)),fl(()=>{var i=e();if(t===document.activeElement){var s=Te;if(r.has(s))return}Fl(t)&&i===Gl(t.value)||t.type==="date"&&!i&&!t.value||i!==t.value&&(t.value=i??"")})}function Fl(t){var e=t.type;return e==="number"||e==="range"}function Gl(t){return t===""?null:+t}function Vl(t,e){return t===e||(t==null?void 0:t[Gr])===e}function Qs(t={},e,n,r){var i=et.r,s=Ve;return dl(()=>{var o,a;return fl(()=>{o=a,a=(r==null?void 0:r())||[],Jr(()=>{Vl(n(...a),t)||(e(t,...a),o&&Vl(n(...o),t)&&e(null,...o))})}),()=>{let l=s;for(;l!==i&&l.parent!==null&&l.parent.f&zc;)l=l.parent;const c=()=>{a&&Vl(n(...a),t)&&e(null,...a)},u=l.teardown;l.teardown=()=>{c(),u==null||u()}}}),t}function uw(t=!1){const e=et,n=e.l.u;if(!n)return;let r=()=>ig(e.s);if(t){let i=0,s={};const o=ul(()=>{let a=!1;const l=e.s;for(const c in l)l[c]!==s[c]&&(s[c]=l[c],a=!0);return a&&i++,i});r=()=>f(o)}n.b.length&&P_(()=>{rf(e,r),Oc(n.b)}),hn(()=>{const i=Jr(()=>n.m.map(Eb));return()=>{for(const s of i)typeof s=="function"&&s()}}),n.a.length&&hn(()=>{rf(e,r),Oc(n.a)})}function rf(t,e){if(t.l.s)for(const n of t.l.s)f(n);e()}function Yt(t,e,n,r){var i=r,s=!0,o=()=>(s&&(s=!1,i=r),i),a;a=t[e],a===void 0&&r!==void 0&&(a=o());var l;return l=()=>{var c=t[e];return c===void 0?o():(s=!0,c)},l}function zn(t){et===null&&Mu(),Co&&et.l!==null?dw(et).m.push(t):hn(()=>{const e=Jr(t);if(typeof e=="function")return e})}function Oo(t){et===null&&Mu(),zn(()=>()=>Jr(t))}function dw(t){var e=t.l;return e.u??(e.u={a:[],b:[],m:[]})}const fw="5";var fp;typeof window<"u"&&((fp=window.__svelte??(window.__svelte={})).v??(fp.v=new Set)).add(fw);const hw="modulepreload",pw=function(t){return"/"+t},sf={},Pa=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=o(n.map(c=>{if(c=pw(c),c in sf)return;sf[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":hw,u||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),u)return new Promise((p,g)=>{h.addEventListener("load",p),h.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};function Zs(t,e){if(e)for(const n in e)t=t.replace(`:${n}`,String(e[n]));return dt.name==="#"?t==="/"?"/#/":Ra("#",t):dt.name?Ra(dt.name,t):t}function gw(t,e){let n=Zs(t,e==null?void 0:e.params);return e!=null&&e.search&&(n+=Wu(e.search)),e!=null&&e.hash&&!e.hash.startsWith("#")&&(n+="#"+e.hash),n}function ug(t){return Promise.all(t.map(e=>mw(e)))}function mw(t){return new Promise(e=>{vw(t)?Promise.resolve(t()).then(n=>{e(n.default)}):e(t)})}function vw(t){return typeof t=="function"&&!!/\(\)\s?=>\s?(import|__vite_ssr_dynamic_import__)\(.*\)/.test(String(t))}function Ra(...t){let e="";for(let n of t)n.startsWith("/")||(e+="/"),n.endsWith("/")&&(n=n.slice(0,-1)),e+=n;return e}function Vu(t){return dt.name&&t.startsWith(dt.name)&&(t=t.slice(dt.name.length)||"/"),t}function Zu(){const t=dt.name==="#"?globalThis.location.hash.slice(1):globalThis.location.pathname,e=dt.name==="#"?"":globalThis.location.hash;return{pathname:t,search:globalThis.location.search,state:history.state,hash:e}}function Wu(t){if(!t)return;if(typeof t=="string")return t.startsWith("?")||(t="?"+t),t;const e=Object.fromEntries(Object.entries(t).map(([r,i])=>[r,String(i)]));return Object.keys(e).length===0?void 0:"?"+new URLSearchParams(e).toString()}function qu(t){if(!t)return{};if(typeof t=="string"){const e=new URLSearchParams(t);return Object.fromEntries([...e.entries()].map(([n,r])=>[n,bw(r)]))}return t}function bw(t){if(t==="")return"";if(t==="true")return!0;if(t==="false")return!1;const e=Number(t);return Number.isNaN(e)?t:e}function Jc(t,e){return dg((n,r)=>n===r,t,e)}Jc.startsWith=(t,e)=>dg((n,r)=>n.startsWith(r),t,e);function dg(t,e,n){if(!e.includes(":")){const s=dt.name&&dt.name!=="#"?Zs(e):e;return t(fn.pathname,s)}if(n)return dt.name==="#"?t(fn.pathname,Zs(e,n).replace("/#","")):t(fn.pathname,Zs(e,n));const r=e.split("/").slice(1);let i=fn.pathname.split("/").slice(1);if(r.length>i.length)return!1;for(const[s,o]of r.entries()){const a=i[s];if(!o.startsWith(":")&&o!==a)return!1}return!0}function Xu(t,e){t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1));const n=t.split("/").slice(1),r=_w(Object.keys(e));let i,s=[],o=[],a={},l={};const c=e["/"];c&&typeof c=="object"&&"meta"in c&&c.meta&&(l={...l,...c.meta});let u=!1;e:for(const d of r){const h=d.split("/");h[0]===""&&h.shift();for(let[p,g]of h.entries()){u=g.startsWith("(")&&g.endsWith(")"),u&&(g=g.slice(1,-1));const m=n[p],_=g===""&&typeof e["/"]!="function";if(g.startsWith(":"))a[g.slice(1)]=decodeURIComponent(m);else if(g.startsWith("*")){const R=g.slice(1);R&&(a[R]=n.slice(p).map(decodeURIComponent).join("/")),u?s=[]:"layout"in e&&e.layout&&s.push(e.layout);const A=(p?"/":"")+h.join("/");i=e[A];break e}else if(g.toLowerCase()!==(m==null?void 0:m.toLowerCase())&&!_)break;if(p!==h.length-1)continue;const k=e["/"+h.join("/")];if(typeof k=="function"&&h.length!==n.length)continue;if(!u&&"layout"in e&&e.layout&&s.push(e.layout),"hooks"in e&&e.hooks&&o.push(e.hooks),"meta"in e&&e.meta&&(l={...l,...e.meta}),typeof k=="function"){if(h.length===n.length){i=k;break e}continue}const O=_?t:"/"+n.slice(p+1).join("/"),I=Xu(O,k);if(I.match)i=I.match,a={...a,...I.params},o.push(...I.hooks),l={...l,...I.meta},I.breakFromLayouts?(s=[],u=!0):s.push(...I.layouts);else continue;break e}}return{match:i,layouts:s,hooks:o,params:a,meta:l,breakFromLayouts:u}}function _w(t){return t.toSorted((e,n)=>of(e)-of(n))}function of(t){return t===""||t==="/"?1:t.includes("*")?4:t.includes(":")?3:2}const ww=200,yw=Math.PI/6,kw=50;async function fg(t,e,n){const{match:r,layouts:i,hooks:s,meta:o}=Xu(e,t);for(const{onPreload:a}of s)a==null||a({pathname:e,meta:o,...n,search:qu(n==null?void 0:n.search)});await ug(r?[...i,r]:i)}const af=new Set,Ai=new Set;function Ew(t){function e(o){if(!o.getAttribute("href"))return;const l=new URL(o.href),c=Vu(l.pathname),{replace:u,state:d}=o.dataset;fg(t,c,{replace:u===""||u==="true",search:l.search,state:d,hash:l.hash})}let n=null;function r(o){if(!o.getPredictedEvents||n)return;if(n=setTimeout(()=>{n=null},kw),Ai.size===0){document.removeEventListener("pointermove",r);return}const l=o.getPredictedEvents().at(-1);if(!l)return;const c=o.clientX,u=o.clientY,d=l.clientX-c,h=l.clientY-u,p=Math.hypot(d,h);if(p<2)return;const g=d/p,m=h/p;e:for(const _ of Ai){_.isConnected||Ai.delete(_);const k=_.getBoundingClientRect(),O=[{x:k.left,y:k.top},{x:k.right,y:k.top},{x:k.left,y:k.bottom},{x:k.right,y:k.bottom},{x:k.left+k.width/2,y:k.top+k.height/2}];for(const I of O){const R=I.x-c,A=I.y-u,T=Math.hypot(R,A);if(T>ww||T<.001)continue;const M=R/T,N=A/T,j=g*M+m*N;if(Math.acos(Math.max(-1,Math.min(1,j)))<=yw){e(_),Ai.delete(_);continue e}}}}const i=new IntersectionObserver(o=>{for(const a of o)a.isIntersecting&&(i.unobserve(a.target),e(a.target))});new MutationObserver(()=>{const o=document.querySelectorAll("a[data-preload]");for(const a of o)if(!af.has(a)){switch(af.add(a),a.dataset.preload){case"":case"true":case"hover":{a.addEventListener("mouseenter",function l(){a.removeEventListener("mouseenter",l),e(a)});break}case"predict":{Ai.size===0&&document.addEventListener("pointermove",r),Ai.add(a);break}case"viewport":{i.observe(a);break}default:{console.warn(`Unknown preload strategy \`${a.dataset.preload}\` on`,a,`
|
|
3
3
|
Available strategies are: hover, viewport, predict`);break}}a.addEventListener("focus",function l(){a.removeEventListener("focus",l),e(a)})}}).observe(document.body,{subtree:!0,childList:!0})}class lf extends Error{constructor(e){super(`Navigating to: ${e}`),this.name="Redirect"}}var Sw=["forEach","isDisjointFrom","isSubsetOf","isSupersetOf"],xw=["difference","intersection","symmetricDifference","union"],cf=!1,Ji,Bn,Dr,il,cs,hg,pg;const sl=class sl extends Set{constructor(n){super();be(this,cs);be(this,Ji,new Map);be(this,Bn,Y(0));be(this,Dr,Y(0));be(this,il,Zn||-1);if(n){for(var r of n)super.add(r);E(this,Dr).v=super.size}cf||Oe(this,cs,pg).call(this)}has(n){var r=super.has(n),i=E(this,Ji),s=i.get(n);if(s===void 0){if(!r)return f(E(this,Bn)),!1;s=Oe(this,cs,hg).call(this,!0),i.set(n,s)}return f(s),r}add(n){return super.has(n)||(super.add(n),b(E(this,Dr),super.size),Bt(E(this,Bn))),this}delete(n){var r=super.delete(n),i=E(this,Ji),s=i.get(n);return s!==void 0&&(i.delete(n),b(s,!1)),r&&(b(E(this,Dr),super.size),Bt(E(this,Bn))),r}clear(){if(super.size!==0){super.clear();var n=E(this,Ji);for(var r of n.values())b(r,!1);n.clear(),b(E(this,Dr),0),Bt(E(this,Bn))}}keys(){return this.values()}values(){return f(E(this,Bn)),super.values()}entries(){return f(E(this,Bn)),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return f(E(this,Dr))}};Ji=new WeakMap,Bn=new WeakMap,Dr=new WeakMap,il=new WeakMap,cs=new WeakSet,hg=function(n){return Zn===E(this,il)?Y(n):kr(n)},pg=function(){cf=!0;var n=sl.prototype,r=Set.prototype;for(const i of Sw)n[i]=function(...s){return f(E(this,Bn)),r[i].apply(this,s)};for(const i of xw)n[i]=function(...s){f(E(this,Bn));var o=r[i].apply(this,s);return new sl(o)}};let Aa=sl;var nr,rr,gr,ol,Gn,Hs,ga;const Ld=class Ld extends Map{constructor(n){super();be(this,Gn);be(this,nr,new Map);be(this,rr,Y(0));be(this,gr,Y(0));be(this,ol,Zn||-1);if(n){for(var[r,i]of n)super.set(r,i);E(this,gr).v=super.size}}has(n){var r=E(this,nr),i=r.get(n);if(i===void 0)if(super.has(n))i=Oe(this,Gn,Hs).call(this,0),r.set(n,i);else return f(E(this,rr)),!1;return f(i),!0}forEach(n,r){Oe(this,Gn,ga).call(this),super.forEach(n,r)}get(n){var r=E(this,nr),i=r.get(n);if(i===void 0)if(super.has(n))i=Oe(this,Gn,Hs).call(this,0),r.set(n,i);else{f(E(this,rr));return}return f(i),super.get(n)}set(n,r){var d;var i=E(this,nr),s=i.get(n),o=super.get(n),a=super.set(n,r),l=E(this,rr);if(s===void 0)s=Oe(this,Gn,Hs).call(this,0),i.set(n,s),b(E(this,gr),super.size),Bt(l);else if(o!==r){Bt(s);var c=l.reactions===null?null:new Set(l.reactions),u=c===null||!((d=s.reactions)!=null&&d.every(h=>c.has(h)));u&&Bt(l)}return a}delete(n){var r=E(this,nr),i=r.get(n),s=super.delete(n);return i!==void 0&&(r.delete(n),b(i,-1)),s&&(b(E(this,gr),super.size),Bt(E(this,rr))),s}clear(){if(super.size!==0){super.clear();var n=E(this,nr);b(E(this,gr),0);for(var r of n.values())b(r,-1);Bt(E(this,rr)),n.clear()}}keys(){return f(E(this,rr)),super.keys()}values(){return Oe(this,Gn,ga).call(this),super.values()}entries(){return Oe(this,Gn,ga).call(this),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return f(E(this,gr)),super.size}};nr=new WeakMap,rr=new WeakMap,gr=new WeakMap,ol=new WeakMap,Gn=new WeakSet,Hs=function(n){return Zn===E(this,ol)?Y(n):kr(n)},ga=function(){f(E(this,rr));var n=E(this,nr);if(E(this,gr).v!==n.size){for(var r of $d(Ld.prototype,this,"keys").call(this))if(!n.has(r)){var i=Oe(this,Gn,Hs).call(this,0);n.set(r,i)}}for([,i]of E(this,nr))f(i)};let ns=Ld;const Tw=Symbol("replace");var jt,mo,mr,gi,Bs;class Cw extends URLSearchParams{constructor(){super(...arguments);be(this,gi);be(this,jt,Y(0));be(this,mo,Rw());be(this,mr,!1)}[Tw](n){if(!E(this,mr)&&n.toString()!==super.toString()){Me(this,mr,!0);for(const r of[...super.keys()])super.delete(r);for(const[r,i]of n)super.append(r,i);Bt(E(this,jt)),Me(this,mr,!1)}}append(n,r){super.append(n,r),Oe(this,gi,Bs).call(this),Bt(E(this,jt))}delete(n,r){var i=super.has(n,r);super.delete(n,r),i&&(Oe(this,gi,Bs).call(this),Bt(E(this,jt)))}get(n){return f(E(this,jt)),super.get(n)}getAll(n){return f(E(this,jt)),super.getAll(n)}has(n,r){return f(E(this,jt)),super.has(n,r)}keys(){return f(E(this,jt)),super.keys()}forEach(n,r){f(E(this,jt)),super.forEach(n,r)}set(n,r){var i=super.getAll(n);super.set(n,r);var s=super.getAll(n);(i.length!==s.length||i.some((o,a)=>o!==s[a]))&&(Oe(this,gi,Bs).call(this),Bt(E(this,jt)))}sort(){super.sort(),Oe(this,gi,Bs).call(this),Bt(E(this,jt))}toString(){return f(E(this,jt)),super.toString()}values(){return f(E(this,jt)),super.values()}entries(){return f(E(this,jt)),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return f(E(this,jt)),super.size}}jt=new WeakMap,mo=new WeakMap,mr=new WeakMap,gi=new WeakSet,Bs=function(){if(!E(this,mo)||E(this,mr))return;Me(this,mr,!0);const n=this.toString();E(this,mo).search=n&&`?${n}`,Me(this,mr,!1)};let Pw=null;function Rw(){return Pw}let Vo=new Cw(globalThis.location.search);function uf(t){if(Vo.toString()===t)return;const e=new URLSearchParams(t);for(const[n,r]of e)Vo.set(n,r);for(const n of Vo.keys())e.has(n)||Vo.delete(n)}let Ws;const dt={name:void 0};let Kc=it({value:[]}),fn=it({pathname:"/",search:"",state:null,hash:""});queueMicrotask(()=>{const t=Zu();fn.pathname=t.pathname,fn.search=t.search,fn.state=t.state,fn.hash=t.hash});let Qc=it({value:{}}),gg=it({value:{}}),ri=null,Zo=null,ma=null;function Aw(t){if(t){const e=new URL(globalThis.location.toString());t==="#"?(dt.name="#",globalThis.location.href.includes("#")||(e.hash="/",history.replaceState(history.state||{},"",e.toString()))):(dt.name=(t.startsWith("/")?"":"/")+t,e.pathname.startsWith(dt.name)||(e.pathname=Ra(dt.name,e.pathname),history.replaceState(history.state||{},"",e.toString())))}Object.assign(fn,Zu())}function Mw(t){return Ws=t,Ew(Ws),{p:gw,navigate:Ow,isActive:Jc,async preload(e){await fg(Ws,e)},route:{get params(){return Qc.value},getParams(e){if(!Jc(e))throw new Error(`\`${e}\` does not match the current route`);return Qc.value},get pathname(){return Vu(fn.pathname)},get search(){return qu(fn.search)},get state(){return fn.state},get hash(){return fn.hash},get meta(){return gg.value}}}}async function Ow(t,e={}){if(typeof t=="number")return globalThis.history.go(t),new lf(`History entry: ${t}`);t=Zs(t,e.params),dt.name==="#"?t=t.replace("/#",""):e.hash&&!e.hash.startsWith("#")&&(e.hash="#"+e.hash);const n=Ma(t,e);return ma=n,await n,new lf(`${t}${Wu((e==null?void 0:e.search)??"")}${(e==null?void 0:e.hash)??""}`)}async function Ma(t,e={}){if(!Ws)throw new Error("Router not initialized: `createRouter` was not called.");if(Zo&&Zo!==ri)return;ri==null||ri.abort(),ri=new AbortController;const{signal:n}=ri,r=Nw(t),{match:i,layouts:s,hooks:o,meta:a,params:l}=Xu(r,Ws),c=qu(e.search),u={pathname:r,meta:a,...e,search:c};let d=[];for(const p of o){if(n.aborted)return ma;try{const{beforeLoad:g}=p;d.push(p),Zo=ri,await(g==null?void 0:g(u))}catch(g){if(n.aborted)return ma;for(const{onError:m}of d)m==null||m(g,u);return}finally{Zo=null}}let h;try{h=await ug(i?[...s,i]:s)}catch(p){for(const{onError:g}of o)g==null||g(p,u);throw p}if(n.aborted)return ma;if(t){const p=Wu(e.search),g=new URL(globalThis.location.toString());g.search=p||"",g.hash=e.hash||"",dt.name==="#"?g.hash=t:dt.name&&!t.startsWith(dt.name)?g.pathname=Ra(dt.name,t):g.pathname=t;const m=e.replace?"replaceState":"pushState";globalThis.history[m](e.state||{},"",g.toString()),uf(p)}else uf(globalThis.location.search);e.viewTransition&&document.startViewTransition!==void 0?document.startViewTransition(()=>{Kc.value=h}):Kc.value=h,Qc.value=l,gg.value=a,Object.assign(fn,Zu()),e.scrollToTop!==!1&&window.scrollTo({top:0,left:0,behavior:e.scrollToTop});for(const{afterLoad:p}of o)p==null||p(u)}function Nw(t){let e;return t?e=t:dt.name==="#"?e=globalThis.location.hash.slice(1):e=globalThis.location.pathname,dt.name&&e.startsWith(dt.name)&&(e=e.slice(dt.name.length)||"/"),Vu(e)}function zw(t){var d;const e=t.target.closest("a");if(!e||e.hasAttribute("target")||e.hasAttribute("download")||!e.hasAttribute("href")||(d=e.getAttribute("href"))!=null&&d.startsWith("#"))return;const n=new URL(e.href),r=globalThis.location.origin;if(n.origin!==r)return;const i=dt.name==="#"?n.hash:n.pathname,s=dt.name==="#"?void 0:n.hash;t.preventDefault();const{replace:o,state:a,scrollToTop:l,viewTransition:c}=e.dataset;let u;if(a)try{u=JSON.parse(a)}catch{u=a}Ma(i,{replace:o===""||o==="true",search:n.search,state:u,hash:s,scrollToTop:l==="false"?!1:l,viewTransition:c===""||c==="true"})}function mg(t,e){Ie(e,!0);const n=fe(()=>e.tree[0]),r=fe(()=>e.tree.slice(1));var i=kn(),s=Xe(i);Y_(s,()=>f(n),(o,a)=>{a(o,{children:(l,c)=>{var u=kn(),d=Xe(u);{var h=p=>{mg(p,{get tree(){return f(r)}})};Z(d,p=>{f(r).length>0&&p(h)})}C(l,u)},$$slots:{default:!0}})}),C(t,i),Le()}function Iw(t,e){Ie(e,!0),Aw(e.base),Ma(),hn(()=>{const n=Jd(globalThis,"popstate",()=>Ma()),r=Jd(globalThis,"click",zw);return()=>{n(),r()}}),mg(t,{get tree(){return Kc.value}}),Le()}const Lw=720;function pl(){return window.matchMedia("(max-width: "+Lw+"px)")}function vg(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function bg(t,e,n,r){for(const[i,s]of Object.entries(t)){const o=n===""?i:`${n}.${i}`;if(typeof s=="string"){if(Object.hasOwn(r,o))throw new Error(`Plugin catalog ${e} contains duplicate key "${o}"`);r[o]=s}else if(vg(s))bg(s,e,o,r);else throw new Error(`Plugin catalog ${e} key "${o}" must be a string or object`)}}function Dw(t,e){if(!vg(t))throw new Error(`Plugin catalog ${e} must be a JSON object`);const n={};return bg(t,e,"",n),Object.freeze(n)}var df;function $(t,e,n){function r(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:o,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,l);const c=o.prototype,u=Object.keys(c);for(let d=0;d<u.length;d++){const h=u[d];h in a||(a[h]=c[h].bind(a))}}const i=(n==null?void 0:n.Parent)??Object;class s extends i{}Object.defineProperty(s,"name",{value:t});function o(a){var l;const c=n!=null&&n.Parent?new s:this;r(c,a),(l=c._zod).deferred??(l.deferred=[]);for(const u of c._zod.deferred)u();return c}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>{var l,c;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(c=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:c.has(t)}}),Object.defineProperty(o,"name",{value:t}),o}class $i extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class _g extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(df=globalThis).__zod_globalConfig??(df.__zod_globalConfig={});const Yu=globalThis.__zod_globalConfig;function Er(t){return Yu}function wg(t){const e=Object.values(t).filter(r=>typeof r=="number");return Object.entries(t).filter(([r,i])=>e.indexOf(+r)===-1).map(([r,i])=>i)}function eu(t,e){return typeof e=="bigint"?e.toString():e}function gl(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function Ju(t){return t==null}function Ku(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function Hw(t,e){const n=t/e,r=Math.round(n),i=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}const ff=Symbol("evaluating");function st(t,e,n){let r;Object.defineProperty(t,e,{get(){if(r!==ff)return r===void 0&&(r=ff,r=n()),r},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function ki(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Qr(...t){const e={};for(const n of t){const r=Object.getOwnPropertyDescriptors(n);Object.assign(e,r)}return Object.defineProperties({},e)}function hf(t){return JSON.stringify(t)}function Bw(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const yg="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function eo(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const $w=gl(()=>{var t;if(Yu.jitless||typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)!=null&&t.includes("Cloudflare")))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function rs(t){if(eo(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const n=e.prototype;return!(eo(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function kg(t){return rs(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}const Uw=new Set(["string","number","symbol"]);function is(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ei(t,e,n){const r=new t._zod.constr(e??t._zod.def);return(!e||n!=null&&n.parent)&&(r._zod.parent=t),r}function ye(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function jw(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const Fw={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Gw(t,e){const n=t._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=Qr(t._zod.def,{get shape(){const o={};for(const a in e){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(o[a]=n.shape[a])}return ki(this,"shape",o),o},checks:[]});return ei(t,s)}function Vw(t,e){const n=t._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=Qr(t._zod.def,{get shape(){const o={...t._zod.def.shape};for(const a in e){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete o[a]}return ki(this,"shape",o),o},checks:[]});return ei(t,s)}function Zw(t,e){if(!rs(e))throw new Error("Invalid input to extend: expected a plain object");const n=t._zod.def.checks;if(n&&n.length>0){const s=t._zod.def.shape;for(const o in e)if(Object.getOwnPropertyDescriptor(s,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=Qr(t._zod.def,{get shape(){const s={...t._zod.def.shape,...e};return ki(this,"shape",s),s}});return ei(t,i)}function Ww(t,e){if(!rs(e))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Qr(t._zod.def,{get shape(){const r={...t._zod.def.shape,...e};return ki(this,"shape",r),r}});return ei(t,n)}function qw(t,e){var r;if((r=t._zod.def.checks)!=null&&r.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=Qr(t._zod.def,{get shape(){const i={...t._zod.def.shape,...e._zod.def.shape};return ki(this,"shape",i),i},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return ei(t,n)}function Xw(t,e,n){const i=e._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const o=Qr(e._zod.def,{get shape(){const a=e._zod.def.shape,l={...a};if(n)for(const c in n){if(!(c in a))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(l[c]=t?new t({type:"optional",innerType:a[c]}):a[c])}else for(const c in a)l[c]=t?new t({type:"optional",innerType:a[c]}):a[c];return ki(this,"shape",l),l},checks:[]});return ei(e,o)}function Yw(t,e,n){const r=Qr(e._zod.def,{get shape(){const i=e._zod.def.shape,s={...i};if(n)for(const o in n){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);n[o]&&(s[o]=new t({type:"nonoptional",innerType:i[o]}))}else for(const o in i)s[o]=new t({type:"nonoptional",innerType:i[o]});return ki(this,"shape",s),s}});return ei(e,r)}function Li(t,e=0){var n;if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(((n=t.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function Jw(t,e=0){var n;if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(((n=t.issues[r])==null?void 0:n.continue)===!1)return!0;return!1}function Di(t,e){return e.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function Wo(t){return typeof t=="string"?t:t==null?void 0:t.message}function Sr(t,e,n){var l,c,u,d,h,p;const r=t.message?t.message:Wo((u=(c=(l=t.inst)==null?void 0:l._zod.def)==null?void 0:c.error)==null?void 0:u.call(c,t))??Wo((d=e==null?void 0:e.error)==null?void 0:d.call(e,t))??Wo((h=n.customError)==null?void 0:h.call(n,t))??Wo((p=n.localeError)==null?void 0:p.call(n,t))??"Invalid input",{inst:i,continue:s,input:o,...a}=t;return a.path??(a.path=[]),a.message=r,e!=null&&e.reportInput&&(a.input=o),a}function Qu(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function to(...t){const[e,n,r]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:r}:{...e}}const Eg=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,eu,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Sg=$("$ZodError",Eg),xg=$("$ZodError",Eg,{Parent:Error});function Kw(t,e=n=>n.message){const n={},r=[];for(const i of t.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:n}}function Qw(t,e=n=>n.message){const n={_errors:[]},r=(i,s=[])=>{for(const o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>r({issues:a},[...s,...o.path]));else if(o.code==="invalid_key")r({issues:o.issues},[...s,...o.path]);else if(o.code==="invalid_element")r({issues:o.issues},[...s,...o.path]);else{const a=[...s,...o.path];if(a.length===0)n._errors.push(e(o));else{let l=n,c=0;for(;c<a.length;){const u=a[c];c===a.length-1?(l[u]=l[u]||{_errors:[]},l[u]._errors.push(e(o))):l[u]=l[u]||{_errors:[]},l=l[u],c++}}}};return r(t),n}const ed=t=>(e,n,r,i)=>{const s=r?{...r,async:!1}:{async:!1},o=e._zod.run({value:n,issues:[]},s);if(o instanceof Promise)throw new $i;if(o.issues.length){const a=new((i==null?void 0:i.Err)??t)(o.issues.map(l=>Sr(l,s,Er())));throw yg(a,i==null?void 0:i.callee),a}return o.value},td=t=>async(e,n,r,i)=>{const s=r?{...r,async:!0}:{async:!0};let o=e._zod.run({value:n,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){const a=new((i==null?void 0:i.Err)??t)(o.issues.map(l=>Sr(l,s,Er())));throw yg(a,i==null?void 0:i.callee),a}return o.value},ml=t=>(e,n,r)=>{const i=r?{...r,async:!1}:{async:!1},s=e._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new $i;return s.issues.length?{success:!1,error:new(t??Sg)(s.issues.map(o=>Sr(o,i,Er())))}:{success:!0,data:s.value}},e0=ml(xg),vl=t=>async(e,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let s=e._zod.run({value:n,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(o=>Sr(o,i,Er())))}:{success:!0,data:s.value}},t0=vl(xg),n0=t=>(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return ed(t)(e,n,i)},r0=t=>(e,n,r)=>ed(t)(e,n,r),i0=t=>async(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return td(t)(e,n,i)},s0=t=>async(e,n,r)=>td(t)(e,n,r),o0=t=>(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return ml(t)(e,n,i)},a0=t=>(e,n,r)=>ml(t)(e,n,r),l0=t=>async(e,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return vl(t)(e,n,i)},c0=t=>async(e,n,r)=>vl(t)(e,n,r),u0=/^[cC][0-9a-z]{6,}$/,d0=/^[0-9a-z]+$/,f0=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,h0=/^[0-9a-vA-V]{20}$/,p0=/^[A-Za-z0-9]{27}$/,g0=/^[a-zA-Z0-9_-]{21}$/,m0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,v0=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,pf=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,b0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,_0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function w0(){return new RegExp(_0,"u")}const y0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,k0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,E0=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,S0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,x0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Tg=/^[A-Za-z0-9_-]*$/,T0=/^https?$/,C0=/^\+[1-9]\d{6,14}$/,Cg="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",P0=new RegExp(`^${Cg}$`);function Pg(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function R0(t){return new RegExp(`^${Pg(t)}$`)}function A0(t){const e=Pg({precision:t.precision}),n=["Z"];t.local&&n.push(""),t.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${e}(?:${n.join("|")})`;return new RegExp(`^${Cg}T(?:${r})$`)}const M0=t=>{const e=t?`[\\s\\S]{${(t==null?void 0:t.minimum)??0},${(t==null?void 0:t.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},O0=/^-?\d+$/,Rg=/^-?\d+(?:\.\d+)?$/,N0=/^(?:true|false)$/i,z0=/^[^A-Z]*$/,I0=/^[^a-z]*$/,gn=$("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),Ag={number:"number",bigint:"bigint",object:"date"},Mg=$("$ZodCheckLessThan",(t,e)=>{gn.init(t,e);const n=Ag[typeof e.value];t._zod.onattach.push(r=>{const i=r._zod.bag,s=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Og=$("$ZodCheckGreaterThan",(t,e)=>{gn.init(t,e);const n=Ag[typeof e.value];t._zod.onattach.push(r=>{const i=r._zod.bag,s=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),L0=$("$ZodCheckMultipleOf",(t,e)=>{gn.init(t,e),t._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=e.value)}),t._zod.check=n=>{if(typeof n.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%e.value===BigInt(0):Hw(n.value,e.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:e.value,input:n.value,inst:t,continue:!e.abort})}}),D0=$("$ZodCheckNumberFormat",(t,e)=>{var o;gn.init(t,e),e.format=e.format||"float64";const n=(o=e.format)==null?void 0:o.includes("int"),r=n?"int":"number",[i,s]=Fw[e.format];t._zod.onattach.push(a=>{const l=a._zod.bag;l.format=e.format,l.minimum=i,l.maximum=s,n&&(l.pattern=O0)}),t._zod.check=a=>{const l=a.value;if(n){if(!Number.isInteger(l)){a.issues.push({expected:r,format:e.format,code:"invalid_type",continue:!1,input:l,inst:t});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,inclusive:!0,continue:!e.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,inclusive:!0,continue:!e.abort});return}}l<i&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),l>s&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:s,inclusive:!0,inst:t,continue:!e.abort})}}),H0=$("$ZodCheckMaxLength",(t,e)=>{var n;gn.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!Ju(i)&&i.length!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{const i=r.value;if(i.length<=e.maximum)return;const o=Qu(i);r.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),B0=$("$ZodCheckMinLength",(t,e)=>{var n;gn.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!Ju(i)&&i.length!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{const i=r.value;if(i.length>=e.minimum)return;const o=Qu(i);r.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),$0=$("$ZodCheckLengthEquals",(t,e)=>{var n;gn.init(t,e),(n=t._zod.def).when??(n.when=r=>{const i=r.value;return!Ju(i)&&i.length!==void 0}),t._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=r=>{const i=r.value,s=i.length;if(s===e.length)return;const o=Qu(i),a=s>e.length;r.issues.push({origin:o,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:t,continue:!e.abort})}}),bl=$("$ZodCheckStringFormat",(t,e)=>{var n,r;gn.init(t,e),t._zod.onattach.push(i=>{const s=i._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(n=t._zod).check??(n.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(r=t._zod).check??(r.check=()=>{})}),U0=$("$ZodCheckRegex",(t,e)=>{bl.init(t,e),t._zod.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),j0=$("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=z0),bl.init(t,e)}),F0=$("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=I0),bl.init(t,e)}),G0=$("$ZodCheckIncludes",(t,e)=>{gn.init(t,e);const n=is(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${n}`:n);e.pattern=r,t._zod.onattach.push(i=>{const s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),t._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:t,continue:!e.abort})}}),V0=$("$ZodCheckStartsWith",(t,e)=>{gn.init(t,e);const n=new RegExp(`^${is(e.prefix)}.*`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:t,continue:!e.abort})}}),Z0=$("$ZodCheckEndsWith",(t,e)=>{gn.init(t,e);const n=new RegExp(`.*${is(e.suffix)}$`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:t,continue:!e.abort})}}),W0=$("$ZodCheckOverwrite",(t,e)=>{gn.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class q0{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
|
|
4
4
|
`).filter(o=>o),i=Math.min(...r.map(o=>o.length-o.trimStart().length)),s=r.map(o=>o.slice(i)).map(o=>" ".repeat(this.indent*2)+o);for(const o of s)this.content.push(o)}compile(){const e=Function,n=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new e(...n,i.join(`
|
|
@@ -77,7 +77,7 @@ ${r("light")}
|
|
|
77
77
|
`}const gm=(t,e)=>{if(typeof t=="number"){if(e===3)return{mode:"rgb",r:(t>>8&15|t>>4&240)/255,g:(t>>4&15|t&240)/255,b:(t&15|t<<4&240)/255};if(e===4)return{mode:"rgb",r:(t>>12&15|t>>8&240)/255,g:(t>>8&15|t>>4&240)/255,b:(t>>4&15|t&240)/255,alpha:(t&15|t<<4&240)/255};if(e===6)return{mode:"rgb",r:(t>>16&255)/255,g:(t>>8&255)/255,b:(t&255)/255};if(e===8)return{mode:"rgb",r:(t>>24&255)/255,g:(t>>16&255)/255,b:(t>>8&255)/255,alpha:(t&255)/255}}},vS={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},bS=t=>gm(vS[t.toLowerCase()],6),_S=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,wS=t=>{let e;return(e=t.match(_S))?gm(parseInt(e[1],16),e[1].length):void 0},Vr="([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)",qs=`${Vr}%`,ad=`(?:${Vr}%|${Vr})`,yS=`(?:${Vr}(deg|grad|rad|turn)|${Vr})`,ss="\\s*,\\s*",kS=new RegExp(`^rgba?\\(\\s*${Vr}${ss}${Vr}${ss}${Vr}\\s*(?:,\\s*${ad}\\s*)?\\)$`),ES=new RegExp(`^rgba?\\(\\s*${qs}${ss}${qs}${ss}${qs}\\s*(?:,\\s*${ad}\\s*)?\\)$`),SS=t=>{let e={mode:"rgb"},n;if(n=t.match(kS))n[1]!==void 0&&(e.r=n[1]/255),n[2]!==void 0&&(e.g=n[2]/255),n[3]!==void 0&&(e.b=n[3]/255);else if(n=t.match(ES))n[1]!==void 0&&(e.r=n[1]/100),n[2]!==void 0&&(e.g=n[2]/100),n[3]!==void 0&&(e.b=n[3]/100);else return;return n[4]!==void 0?e.alpha=Math.max(0,Math.min(1,n[4]/100)):n[5]!==void 0&&(e.alpha=Math.max(0,Math.min(1,+n[5]))),e},xS=(t,e)=>t===void 0?void 0:typeof t!="object"?LS(t):t.mode!==void 0?t:e?{...t,mode:e}:void 0,TS=(t="rgb")=>e=>(e=xS(e,t))!==void 0?e.mode===t?e:ir[e.mode][t]?ir[e.mode][t](e):t==="rgb"?ir[e.mode].rgb(e):ir.rgb[t](ir[e.mode].rgb(e)):void 0,ir={},mm={},Ia=[],vm={},CS=t=>t,tt=t=>(ir[t.mode]={...ir[t.mode],...t.toMode},Object.keys(t.fromMode||{}).forEach(e=>{ir[e]||(ir[e]={}),ir[e][t.mode]=t.fromMode[e]}),t.ranges||(t.ranges={}),t.difference||(t.difference={}),t.channels.forEach(e=>{if(t.ranges[e]===void 0&&(t.ranges[e]=[0,1]),!t.interpolate[e])throw new Error(`Missing interpolator for: ${e}`);typeof t.interpolate[e]=="function"&&(t.interpolate[e]={use:t.interpolate[e]}),t.interpolate[e].fixup||(t.interpolate[e].fixup=CS)}),mm[t.mode]=t,(t.parse||[]).forEach(e=>{RS(e,t.mode)}),TS(t.mode)),PS=t=>mm[t],RS=(t,e)=>{if(typeof t=="string"){if(!e)throw new Error("'mode' required when 'parser' is a string");vm[t]=e}else typeof t=="function"&&Ia.indexOf(t)<0&&Ia.push(t)},au=/[^\x00-\x7F]|[a-zA-Z_]/,AS=/[^\x00-\x7F]|[-\w]/,Q={Function:"function",Ident:"ident",Number:"number",Percentage:"percentage",ParenClose:")",None:"none",Hue:"hue",Alpha:"alpha"};let Pe=0;function Ko(t){let e=t[Pe],n=t[Pe+1];return e==="-"||e==="+"?/\d/.test(n)||n==="."&&/\d/.test(t[Pe+2]):e==="."?/\d/.test(n):/\d/.test(e)}function lu(t){if(Pe>=t.length)return!1;let e=t[Pe];if(au.test(e))return!0;if(e==="-"){if(t.length-Pe<2)return!1;let n=t[Pe+1];return!!(n==="-"||au.test(n))}return!1}const MS={deg:1,rad:180/Math.PI,grad:9/10,turn:360};function Ps(t){let e="";if((t[Pe]==="-"||t[Pe]==="+")&&(e+=t[Pe++]),e+=Qo(t),t[Pe]==="."&&/\d/.test(t[Pe+1])&&(e+=t[Pe++]+Qo(t)),(t[Pe]==="e"||t[Pe]==="E")&&((t[Pe+1]==="-"||t[Pe+1]==="+")&&/\d/.test(t[Pe+2])?e+=t[Pe++]+t[Pe++]+Qo(t):/\d/.test(t[Pe+1])&&(e+=t[Pe++]+Qo(t))),lu(t)){let n=La(t);return n==="deg"||n==="rad"||n==="turn"||n==="grad"?{type:Q.Hue,value:e*MS[n]}:void 0}return t[Pe]==="%"?(Pe++,{type:Q.Percentage,value:+e}):{type:Q.Number,value:+e}}function Qo(t){let e="";for(;/\d/.test(t[Pe]);)e+=t[Pe++];return e}function La(t){let e="";for(;Pe<t.length&&AS.test(t[Pe]);)e+=t[Pe++];return e}function OS(t){let e=La(t);return t[Pe]==="("?(Pe++,{type:Q.Function,value:e}):e==="none"?{type:Q.None,value:void 0}:{type:Q.Ident,value:e}}function NS(t=""){let e=t.trim(),n=[],r;for(Pe=0;Pe<e.length;){if(r=e[Pe++],r===`
|
|
78
78
|
`||r===" "||r===" "){for(;Pe<e.length&&(e[Pe]===`
|
|
79
79
|
`||e[Pe]===" "||e[Pe]===" ");)Pe++;continue}if(r===",")return;if(r===")"){n.push({type:Q.ParenClose});continue}if(r==="+"){if(Pe--,Ko(e)){n.push(Ps(e));continue}return}if(r==="-"){if(Pe--,Ko(e)){n.push(Ps(e));continue}if(lu(e)){n.push({type:Q.Ident,value:La(e)});continue}return}if(r==="."){if(Pe--,Ko(e)){n.push(Ps(e));continue}return}if(r==="/"){for(;Pe<e.length&&(e[Pe]===`
|
|
80
|
-
`||e[Pe]===" "||e[Pe]===" ");)Pe++;let i;if(Ko(e)&&(i=Ps(e),i.type!==Q.Hue)){n.push({type:Q.Alpha,value:i});continue}if(lu(e)&&La(e)==="none"){n.push({type:Q.Alpha,value:{type:Q.None,value:void 0}});continue}return}if(/\d/.test(r)){Pe--,n.push(Ps(e));continue}if(au.test(r)){Pe--,n.push(OS(e));continue}return}return n}function zS(t){t._i=0;let e=t[t._i++];if(!e||e.type!==Q.Function||e.value!=="color"||(e=t[t._i++],e.type!==Q.Ident))return;const n=vm[e.value];if(!n)return;const r={mode:n},i=bm(t,!1);if(!i)return;const s=PS(n).channels;for(let o=0,a,l;o<s.length;o++)a=i[o],l=s[o],a.type!==Q.None&&(r[l]=a.type===Q.Number?a.value:a.value/100,l==="alpha"&&(r[l]=Math.max(0,Math.min(1,r[l]))));return r}function bm(t,e){const n=[];let r;for(;t._i<t.length;){if(r=t[t._i++],r.type===Q.None||r.type===Q.Number||r.type===Q.Alpha||r.type===Q.Percentage||e&&r.type===Q.Hue){n.push(r);continue}if(r.type===Q.ParenClose){if(t._i<t.length)return;continue}return}if(!(n.length<3||n.length>4)){if(n.length===4){if(n[3].type!==Q.Alpha)return;n[3]=n[3].value}return n.length===3&&n.push({type:Q.None,value:void 0}),n.every(i=>i.type!==Q.Alpha)?n:void 0}}function IS(t,e){t._i=0;let n=t[t._i++];if(!n||n.type!==Q.Function)return;let r=bm(t,e);if(r)return r.unshift(n.value),r}const LS=t=>{if(typeof t!="string")return;const e=NS(t),n=e?IS(e,!0):void 0;let r,i=0,s=Ia.length;for(;i<s;)if((r=Ia[i++](t,n))!==void 0)return r;return e?zS(e):void 0};function DS(t,e){if(!e||e[0]!=="rgb"&&e[0]!=="rgba")return;const n={mode:"rgb"},[,r,i,s,o]=e;if(!(r.type===Q.Hue||i.type===Q.Hue||s.type===Q.Hue))return r.type!==Q.None&&(n.r=r.type===Q.Number?r.value/255:r.value/100),i.type!==Q.None&&(n.g=i.type===Q.Number?i.value/255:i.value/100),s.type!==Q.None&&(n.b=s.type===Q.Number?s.value/255:s.value/100),o.type!==Q.None&&(n.alpha=Math.min(1,Math.max(0,o.type===Q.Number?o.value:o.value/100))),n}const HS=t=>t==="transparent"?{mode:"rgb",r:0,g:0,b:0,alpha:0}:void 0,BS=(t,e,n)=>t+n*(e-t),$S=t=>{let e=[];for(let n=0;n<t.length-1;n++){let r=t[n],i=t[n+1];r===void 0&&i===void 0?e.push(void 0):r!==void 0&&i!==void 0?e.push([r,i]):e.push(r!==void 0?[r,r]:[i,i])}return e},US=t=>e=>{let n=$S(e);return r=>{let i=r*n.length,s=r>=1?n.length-1:Math.max(Math.floor(i),0),o=n[s];return o===void 0?void 0:t(o[0],o[1],i-s)}},he=US(BS),It=t=>{let e=!1,n=t.map(r=>r!==void 0?(e=!0,r):1);return e?n:t},gs={mode:"rgb",channels:["r","g","b","alpha"],parse:[DS,wS,SS,bS,HS,"srgb"],serialize:"srgb",interpolate:{r:he,g:he,b:he,alpha:{use:he,fixup:It}},gamut:!0,white:{r:1,g:1,b:1},black:{r:0,g:0,b:0}},Kl=(t=0)=>Math.pow(Math.abs(t),563/256)*Math.sign(t),Vf=t=>{let e=Kl(t.r),n=Kl(t.g),r=Kl(t.b),i={mode:"xyz65",x:.5766690429101305*e+.1855582379065463*n+.1882286462349947*r,y:.297344975250536*e+.6273635662554661*n+.0752914584939979*r,z:.0270313613864123*e+.0706888525358272*n+.9913375368376386*r};return t.alpha!==void 0&&(i.alpha=t.alpha),i},Ql=t=>Math.pow(Math.abs(t),256/563)*Math.sign(t),Zf=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i={mode:"a98",r:Ql(t*2.0415879038107465-e*.5650069742788597-.3447313507783297*n),g:Ql(t*-.9692436362808798+e*1.8759675015077206+.0415550574071756*n),b:Ql(t*.0134442806320312-e*.1183623922310184+1.0151749943912058*n)};return r!==void 0&&(i.alpha=r),i},ec=(t=0)=>{const e=Math.abs(t);return e<=.04045?t/12.92:(Math.sign(t)||1)*Math.pow((e+.055)/1.055,2.4)},ms=({r:t,g:e,b:n,alpha:r})=>{let i={mode:"lrgb",r:ec(t),g:ec(e),b:ec(n)};return r!==void 0&&(i.alpha=r),i},Ei=t=>{let{r:e,g:n,b:r,alpha:i}=ms(t),s={mode:"xyz65",x:.4123907992659593*e+.357584339383878*n+.1804807884018343*r,y:.2126390058715102*e+.715168678767756*n+.0721923153607337*r,z:.0193308187155918*e+.119194779794626*n+.9505321522496607*r};return i!==void 0&&(s.alpha=i),s},tc=(t=0)=>{const e=Math.abs(t);return e>.0031308?(Math.sign(t)||1)*(1.055*Math.pow(e,1/2.4)-.055):t*12.92},vs=({r:t,g:e,b:n,alpha:r},i="rgb")=>{let s={mode:i,r:tc(t),g:tc(e),b:tc(n)};return r!==void 0&&(s.alpha=r),s},Si=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=vs({r:t*3.2409699419045226-e*1.537383177570094-.4986107602930034*n,g:t*-.9692436362808796+e*1.8759675015077204+.0415550574071756*n,b:t*.0556300796969936-e*.2039769588889765+1.0569715142428784*n});return r!==void 0&&(i.alpha=r),i},jS={...gs,mode:"a98",parse:["a98-rgb"],serialize:"a98-rgb",fromMode:{rgb:t=>Zf(Ei(t)),xyz65:Zf},toMode:{rgb:t=>Si(Vf(t)),xyz65:Vf}},Wt=t=>(t=t%360)<0?t+360:t,FS=(t,e)=>t.map((n,r,i)=>{if(n===void 0)return n;let s=Wt(n);return r===0||t[r-1]===void 0?s:e(s-Wt(i[r-1]))}).reduce((n,r)=>!n.length||r===void 0||n[n.length-1]===void 0?(n.push(r),n):(n.push(r+n[n.length-1]),n),[]),Cr=t=>FS(t,e=>Math.abs(e)<=180?e:e-360*Math.sign(e)),Ht=[-.14861,1.78277,-.29227,-.90649,1.97294,0],GS=Math.PI/180,VS=180/Math.PI;let Wf=Ht[3]*Ht[4],qf=Ht[1]*Ht[4],Xf=Ht[1]*Ht[2]-Ht[0]*Ht[3];const ZS=({r:t,g:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=(Xf*n+t*Wf-e*qf)/(Xf+Wf-qf),s=n-i,o=(Ht[4]*(e-i)-Ht[2]*s)/Ht[3],a={mode:"cubehelix",l:i,s:i===0||i===1?void 0:Math.sqrt(s*s+o*o)/(Ht[4]*i*(1-i))};return a.s&&(a.h=Math.atan2(o,s)*VS-120),r!==void 0&&(a.alpha=r),a},WS=({h:t,s:e,l:n,alpha:r})=>{let i={mode:"rgb"};t=(t===void 0?0:t+120)*GS,n===void 0&&(n=0);let s=e===void 0?0:e*n*(1-n),o=Math.cos(t),a=Math.sin(t);return i.r=n+s*(Ht[0]*o+Ht[1]*a),i.g=n+s*(Ht[2]*o+Ht[3]*a),i.b=n+s*(Ht[4]*o+Ht[5]*a),r!==void 0&&(i.alpha=r),i},wl=(t,e)=>{if(t.h===void 0||e.h===void 0||!t.s||!e.s)return 0;let n=Wt(t.h),r=Wt(e.h),i=Math.sin((r-n+360)/2*Math.PI/180);return 2*Math.sqrt(t.s*e.s)*i},qS=(t,e)=>{if(t.h===void 0||e.h===void 0)return 0;let n=Wt(t.h),r=Wt(e.h);return Math.abs(r-n)>180?n-(r-360*Math.sign(r-n)):r-n},yl=(t,e)=>{if(t.h===void 0||e.h===void 0||!t.c||!e.c)return 0;let n=Wt(t.h),r=Wt(e.h),i=Math.sin((r-n+360)/2*Math.PI/180);return 2*Math.sqrt(t.c*e.c)*i},Pr=t=>{let e=t.reduce((r,i)=>{if(i!==void 0){let s=i*Math.PI/180;r.sin+=Math.sin(s),r.cos+=Math.cos(s)}return r},{sin:0,cos:0}),n=Math.atan2(e.sin,e.cos)*180/Math.PI;return n<0?360+n:n},XS={mode:"cubehelix",channels:["h","s","l","alpha"],parse:["--cubehelix"],serialize:"--cubehelix",ranges:{h:[0,360],s:[0,4.614],l:[0,1]},fromMode:{rgb:ZS},toMode:{rgb:WS},interpolate:{h:{use:he,fixup:Cr},s:he,l:he,alpha:{use:he,fixup:It}},difference:{h:wl},average:{h:Pr}},Xr=({l:t,a:e,b:n,alpha:r},i="lch")=>{e===void 0&&(e=0),n===void 0&&(n=0);let s=Math.sqrt(e*e+n*n),o={mode:i,l:t,c:s};return s&&(o.h=Wt(Math.atan2(n,e)*180/Math.PI)),r!==void 0&&(o.alpha=r),o},Yr=({l:t,c:e,h:n,alpha:r},i="lab")=>{n===void 0&&(n=0);let s={mode:i,l:t,a:e?e*Math.cos(n/180*Math.PI):0,b:e?e*Math.sin(n/180*Math.PI):0};return r!==void 0&&(s.alpha=r),s},_m=Math.pow(29,3)/Math.pow(3,3),wm=Math.pow(6,3)/Math.pow(29,3),Mt={X:.3457/.3585,Y:1,Z:(1-.3457-.3585)/.3585},Ui={X:.3127/.329,Y:1,Z:(1-.3127-.329)/.329};let nc=t=>Math.pow(t,3)>wm?Math.pow(t,3):(116*t-16)/_m;const ym=({l:t,a:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=(t+16)/116,s=e/500+i,o=i-n/200,a={mode:"xyz65",x:nc(s)*Ui.X,y:nc(i)*Ui.Y,z:nc(o)*Ui.Z};return r!==void 0&&(a.alpha=r),a},kl=t=>Si(ym(t)),rc=t=>t>wm?Math.cbrt(t):(_m*t+16)/116,km=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=rc(t/Ui.X),s=rc(e/Ui.Y),o=rc(n/Ui.Z),a={mode:"lab65",l:116*s-16,a:500*(i-s),b:200*(s-o)};return r!==void 0&&(a.alpha=r),a},El=t=>{let e=km(Ei(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e},Da=1,Em=1,ro=26/180*Math.PI,Ha=Math.cos(ro),Ba=Math.sin(ro),Sm=100/Math.log(139/100),cu=({l:t,c:e,h:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i={mode:"lab65",l:(Math.exp(t*Da/Sm)-1)/.0039},s=(Math.exp(.0435*e*Em*Da)-1)/.075,o=s*Math.cos(n/180*Math.PI-ro),a=s*Math.sin(n/180*Math.PI-ro);return i.a=o*Ha-a/.83*Ba,i.b=o*Ba+a/.83*Ha,r!==void 0&&(i.alpha=r),i},uu=({l:t,a:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=e*Ha+n*Ba,s=.83*(n*Ha-e*Ba),o=Math.sqrt(i*i+s*s),a={mode:"dlch",l:Sm/Da*Math.log(1+.0039*t),c:Math.log(1+.075*o)/(.0435*Em*Da)};return a.c&&(a.h=Wt((Math.atan2(s,i)+ro)/Math.PI*180)),r!==void 0&&(a.alpha=r),a},Yf=t=>cu(Xr(t,"dlch")),Jf=t=>Yr(uu(t),"dlab"),YS={mode:"dlab",parse:["--din99o-lab"],serialize:"--din99o-lab",toMode:{lab65:Yf,rgb:t=>kl(Yf(t))},fromMode:{lab65:Jf,rgb:t=>Jf(El(t))},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-40.09,45.501],b:[-40.469,44.344]},interpolate:{l:he,a:he,b:he,alpha:{use:he,fixup:It}}},JS={mode:"dlch",parse:["--din99o-lch"],serialize:"--din99o-lch",toMode:{lab65:cu,dlab:t=>Yr(t,"dlab"),rgb:t=>kl(cu(t))},fromMode:{lab65:uu,dlab:t=>Xr(t,"dlch"),rgb:t=>uu(El(t))},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,51.484],h:[0,360]},interpolate:{l:he,c:he,h:{use:he,fixup:Cr},alpha:{use:he,fixup:It}},difference:{h:yl},average:{h:Pr}};function KS({h:t,s:e,i:n,alpha:r}){t=Wt(t!==void 0?t:0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.abs(t/60%2-1),s;switch(Math.floor(t/60)){case 0:s={r:n*(1+e*(3/(2-i)-1)),g:n*(1+e*(3*(1-i)/(2-i)-1)),b:n*(1-e)};break;case 1:s={r:n*(1+e*(3*(1-i)/(2-i)-1)),g:n*(1+e*(3/(2-i)-1)),b:n*(1-e)};break;case 2:s={r:n*(1-e),g:n*(1+e*(3/(2-i)-1)),b:n*(1+e*(3*(1-i)/(2-i)-1))};break;case 3:s={r:n*(1-e),g:n*(1+e*(3*(1-i)/(2-i)-1)),b:n*(1+e*(3/(2-i)-1))};break;case 4:s={r:n*(1+e*(3*(1-i)/(2-i)-1)),g:n*(1-e),b:n*(1+e*(3/(2-i)-1))};break;case 5:s={r:n*(1+e*(3/(2-i)-1)),g:n*(1-e),b:n*(1+e*(3*(1-i)/(2-i)-1))};break;default:s={r:n*(1-e),g:n*(1-e),b:n*(1-e)}}return s.mode="rgb",r!==void 0&&(s.alpha=r),s}function QS({r:t,g:e,b:n,alpha:r}){t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.max(t,e,n),s=Math.min(t,e,n),o={mode:"hsi",s:t+e+n===0?0:1-3*s/(t+e+n),i:(t+e+n)/3};return i-s!==0&&(o.h=(i===t?(e-n)/(i-s)+(e<n)*6:i===e?(n-t)/(i-s)+2:(t-e)/(i-s)+4)*60),r!==void 0&&(o.alpha=r),o}const ex={mode:"hsi",toMode:{rgb:KS},parse:["--hsi"],serialize:"--hsi",fromMode:{rgb:QS},channels:["h","s","i","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:he,fixup:Cr},s:he,i:he,alpha:{use:he,fixup:It}},difference:{h:wl},average:{h:Pr}};function tx({h:t,s:e,l:n,alpha:r}){t=Wt(t!==void 0?t:0),e===void 0&&(e=0),n===void 0&&(n=0);let i=n+e*(n<.5?n:1-n),s=i-(i-n)*2*Math.abs(t/60%2-1),o;switch(Math.floor(t/60)){case 0:o={r:i,g:s,b:2*n-i};break;case 1:o={r:s,g:i,b:2*n-i};break;case 2:o={r:2*n-i,g:i,b:s};break;case 3:o={r:2*n-i,g:s,b:i};break;case 4:o={r:s,g:2*n-i,b:i};break;case 5:o={r:i,g:2*n-i,b:s};break;default:o={r:2*n-i,g:2*n-i,b:2*n-i}}return o.mode="rgb",r!==void 0&&(o.alpha=r),o}function nx({r:t,g:e,b:n,alpha:r}){t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.max(t,e,n),s=Math.min(t,e,n),o={mode:"hsl",s:i===s?0:(i-s)/(1-Math.abs(i+s-1)),l:.5*(i+s)};return i-s!==0&&(o.h=(i===t?(e-n)/(i-s)+(e<n)*6:i===e?(n-t)/(i-s)+2:(t-e)/(i-s)+4)*60),r!==void 0&&(o.alpha=r),o}const rx=(t,e)=>{switch(e){case"deg":return+t;case"rad":return t/Math.PI*180;case"grad":return t/10*9;case"turn":return t*360}},ix=new RegExp(`^hsla?\\(\\s*${yS}${ss}${qs}${ss}${qs}\\s*(?:,\\s*${ad}\\s*)?\\)$`),sx=t=>{let e=t.match(ix);if(!e)return;let n={mode:"hsl"};return e[3]!==void 0?n.h=+e[3]:e[1]!==void 0&&e[2]!==void 0&&(n.h=rx(e[1],e[2])),e[4]!==void 0&&(n.s=Math.min(Math.max(0,e[4]/100),1)),e[5]!==void 0&&(n.l=Math.min(Math.max(0,e[5]/100),1)),e[6]!==void 0?n.alpha=Math.max(0,Math.min(1,e[6]/100)):e[7]!==void 0&&(n.alpha=Math.max(0,Math.min(1,+e[7]))),n};function ox(t,e){if(!e||e[0]!=="hsl"&&e[0]!=="hsla")return;const n={mode:"hsl"},[,r,i,s,o]=e;if(r.type!==Q.None){if(r.type===Q.Percentage)return;n.h=r.value}if(i.type!==Q.None){if(i.type===Q.Hue)return;n.s=i.value/100}if(s.type!==Q.None){if(s.type===Q.Hue)return;n.l=s.value/100}return o.type!==Q.None&&(n.alpha=Math.min(1,Math.max(0,o.type===Q.Number?o.value:o.value/100))),n}const xm={mode:"hsl",toMode:{rgb:tx},fromMode:{rgb:nx},channels:["h","s","l","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[ox,sx],serialize:t=>`hsl(${t.h!==void 0?t.h:"none"} ${t.s!==void 0?t.s*100+"%":"none"} ${t.l!==void 0?t.l*100+"%":"none"}${t.alpha<1?` / ${t.alpha}`:""})`,interpolate:{h:{use:he,fixup:Cr},s:he,l:he,alpha:{use:he,fixup:It}},difference:{h:wl},average:{h:Pr}};function Tm({h:t,s:e,v:n,alpha:r}){t=Wt(t!==void 0?t:0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.abs(t/60%2-1),s;switch(Math.floor(t/60)){case 0:s={r:n,g:n*(1-e*i),b:n*(1-e)};break;case 1:s={r:n*(1-e*i),g:n,b:n*(1-e)};break;case 2:s={r:n*(1-e),g:n,b:n*(1-e*i)};break;case 3:s={r:n*(1-e),g:n*(1-e*i),b:n};break;case 4:s={r:n*(1-e*i),g:n*(1-e),b:n};break;case 5:s={r:n,g:n*(1-e),b:n*(1-e*i)};break;default:s={r:n*(1-e),g:n*(1-e),b:n*(1-e)}}return s.mode="rgb",r!==void 0&&(s.alpha=r),s}function Cm({r:t,g:e,b:n,alpha:r}){t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.max(t,e,n),s=Math.min(t,e,n),o={mode:"hsv",s:i===0?0:1-s/i,v:i};return i-s!==0&&(o.h=(i===t?(e-n)/(i-s)+(e<n)*6:i===e?(n-t)/(i-s)+2:(t-e)/(i-s)+4)*60),r!==void 0&&(o.alpha=r),o}const Pm={mode:"hsv",toMode:{rgb:Tm},parse:["--hsv"],serialize:"--hsv",fromMode:{rgb:Cm},channels:["h","s","v","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:he,fixup:Cr},s:he,v:he,alpha:{use:he,fixup:It}},difference:{h:wl},average:{h:Pr}};function ax({h:t,w:e,b:n,alpha:r}){if(e===void 0&&(e=0),n===void 0&&(n=0),e+n>1){let i=e+n;e/=i,n/=i}return Tm({h:t,s:n===1?1:1-e/(1-n),v:1-n,alpha:r})}function lx(t){let e=Cm(t);if(e===void 0)return;let n=e.s!==void 0?e.s:0,r=e.v!==void 0?e.v:0,i={mode:"hwb",w:(1-n)*r,b:1-r};return e.h!==void 0&&(i.h=e.h),e.alpha!==void 0&&(i.alpha=e.alpha),i}function cx(t,e){if(!e||e[0]!=="hwb")return;const n={mode:"hwb"},[,r,i,s,o]=e;if(r.type!==Q.None){if(r.type===Q.Percentage)return;n.h=r.value}if(i.type!==Q.None){if(i.type===Q.Hue)return;n.w=i.value/100}if(s.type!==Q.None){if(s.type===Q.Hue)return;n.b=s.value/100}return o.type!==Q.None&&(n.alpha=Math.min(1,Math.max(0,o.type===Q.Number?o.value:o.value/100))),n}const ux={mode:"hwb",toMode:{rgb:ax},fromMode:{rgb:lx},channels:["h","w","b","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[cx],serialize:t=>`hwb(${t.h!==void 0?t.h:"none"} ${t.w!==void 0?t.w*100+"%":"none"} ${t.b!==void 0?t.b*100+"%":"none"}${t.alpha<1?` / ${t.alpha}`:""})`,interpolate:{h:{use:he,fixup:Cr},w:he,b:he,alpha:{use:he,fixup:It}},difference:{h:qS},average:{h:Pr}},Rm=203,Sl=.1593017578125,Am=78.84375,xl=.8359375,Tl=18.8515625,Cl=18.6875;function ic(t){if(t<0)return 0;const e=Math.pow(t,1/Am);return 1e4*Math.pow(Math.max(0,e-xl)/(Tl-Cl*e),1/Sl)}function sc(t){if(t<0)return 0;const e=Math.pow(t/1e4,Sl);return Math.pow((xl+Tl*e)/(1+Cl*e),Am)}const oc=t=>Math.max(t/Rm,0),Kf=({i:t,t:e,p:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);const i=ic(t+.008609037037932761*e+.11102962500302593*n),s=ic(t-.00860903703793275*e-.11102962500302599*n),o=ic(t+.5600313357106791*e-.32062717498731885*n),a={mode:"xyz65",x:oc(2.070152218389422*i-1.3263473389671556*s+.2066510476294051*o),y:oc(.3647385209748074*i+.680566024947227*s-.0453045459220346*o),z:oc(-.049747207535812*i-.0492609666966138*s+1.1880659249923042*o)};return r!==void 0&&(a.alpha=r),a},ac=(t=0)=>Math.max(t*Rm,0),Qf=({x:t,y:e,z:n,alpha:r})=>{const i=ac(t),s=ac(e),o=ac(n),a=sc(.3592832590121217*i+.6976051147779502*s-.0358915932320289*o),l=sc(-.1920808463704995*i+1.1004767970374323*s+.0753748658519118*o),c=sc(.0070797844607477*i+.0748396662186366*s+.8433265453898765*o),u=.5*a+.5*l,d=1.61376953125*a-3.323486328125*l+1.709716796875*c,h=4.378173828125*a-4.24560546875*l-.132568359375*c,p={mode:"itp",i:u,t:d,p:h};return r!==void 0&&(p.alpha=r),p},dx={mode:"itp",channels:["i","t","p","alpha"],parse:["--ictcp"],serialize:"--ictcp",toMode:{xyz65:Kf,rgb:t=>Si(Kf(t))},fromMode:{xyz65:Qf,rgb:t=>Qf(Ei(t))},ranges:{i:[0,.581],t:[-.369,.272],p:[-.164,.331]},interpolate:{i:he,t:he,p:he,alpha:{use:he,fixup:It}}},fx=134.03437499999998,hx=16295499532821565e-27,lc=t=>{if(t<0)return 0;let e=Math.pow(t/1e4,Sl);return Math.pow((xl+Tl*e)/(1+Cl*e),fx)},cc=(t=0)=>Math.max(t*203,0),Mm=({x:t,y:e,z:n,alpha:r})=>{t=cc(t),e=cc(e),n=cc(n);let i=1.15*t-.15*n,s=.66*e+.34*t,o=lc(.41478972*i+.579999*s+.014648*n),a=lc(-.20151*i+1.120649*s+.0531008*n),l=lc(-.0166008*i+.2648*s+.6684799*n),c=(o+a)/2,u={mode:"jab",j:.44*c/(1-.56*c)-hx,a:3.524*o-4.066708*a+.542708*l,b:.199076*o+1.096799*a-1.295875*l};return r!==void 0&&(u.alpha=r),u},px=134.03437499999998,eh=16295499532821565e-27,uc=t=>{if(t<0)return 0;let e=Math.pow(t,1/px);return 1e4*Math.pow((xl-e)/(Cl*e-Tl),1/Sl)},dc=t=>t/203,Om=({j:t,a:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=(t+eh)/(.44+.56*(t+eh)),s=uc(i+.13860504*e+.058047316*n),o=uc(i-.13860504*e-.058047316*n),a=uc(i-.096019242*e-.8118919*n),l={mode:"xyz65",x:dc(1.661373024652174*s-.914523081304348*o+.23136208173913045*a),y:dc(-.3250758611844533*s+1.571847026732543*o-.21825383453227928*a),z:dc(-.090982811*s-.31272829*o+1.5227666*a)};return r!==void 0&&(l.alpha=r),l},Nm=t=>{let e=Mm(Ei(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e},zm=t=>Si(Om(t)),gx={mode:"jab",channels:["j","a","b","alpha"],parse:["--jzazbz"],serialize:"--jzazbz",fromMode:{rgb:Nm,xyz65:Mm},toMode:{rgb:zm,xyz65:Om},ranges:{j:[0,.222],a:[-.109,.129],b:[-.185,.134]},interpolate:{j:he,a:he,b:he,alpha:{use:he,fixup:It}}},th=({j:t,a:e,b:n,alpha:r})=>{e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.sqrt(e*e+n*n),s={mode:"jch",j:t,c:i};return i&&(s.h=Wt(Math.atan2(n,e)*180/Math.PI)),r!==void 0&&(s.alpha=r),s},nh=({j:t,c:e,h:n,alpha:r})=>{n===void 0&&(n=0);let i={mode:"jab",j:t,a:e?e*Math.cos(n/180*Math.PI):0,b:e?e*Math.sin(n/180*Math.PI):0};return r!==void 0&&(i.alpha=r),i},mx={mode:"jch",parse:["--jzczhz"],serialize:"--jzczhz",toMode:{jab:nh,rgb:t=>zm(nh(t))},fromMode:{rgb:t=>th(Nm(t)),jab:th},channels:["j","c","h","alpha"],ranges:{j:[0,.221],c:[0,.19],h:[0,360]},interpolate:{h:{use:he,fixup:Cr},c:he,j:he,alpha:{use:he,fixup:It}},difference:{h:yl},average:{h:Pr}},Pl=Math.pow(29,3)/Math.pow(3,3),ld=Math.pow(6,3)/Math.pow(29,3);let fc=t=>Math.pow(t,3)>ld?Math.pow(t,3):(116*t-16)/Pl;const cd=({l:t,a:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=(t+16)/116,s=e/500+i,o=i-n/200,a={mode:"xyz50",x:fc(s)*Mt.X,y:fc(i)*Mt.Y,z:fc(o)*Mt.Z};return r!==void 0&&(a.alpha=r),a},zo=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=vs({r:t*3.1341359569958707-e*1.6173863321612538-.4906619460083532*n,g:t*-.978795502912089+e*1.916254567259524+.03344273116131949*n,b:t*.07195537988411677-e*.2289768264158322+1.405386058324125*n});return r!==void 0&&(i.alpha=r),i},Im=t=>zo(cd(t)),Io=t=>{let{r:e,g:n,b:r,alpha:i}=ms(t),s={mode:"xyz50",x:.436065742824811*e+.3851514688337912*n+.14307845442264197*r,y:.22249319175623702*e+.7168870538238823*n+.06061979053616537*r,z:.013923904500943465*e+.09708128566574634*n+.7140993584005155*r};return i!==void 0&&(s.alpha=i),s},hc=t=>t>ld?Math.cbrt(t):(Pl*t+16)/116,ud=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=hc(t/Mt.X),s=hc(e/Mt.Y),o=hc(n/Mt.Z),a={mode:"lab",l:116*s-16,a:500*(i-s),b:200*(s-o)};return r!==void 0&&(a.alpha=r),a},Lm=t=>{let e=ud(Io(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e};function vx(t,e){if(!e||e[0]!=="lab")return;const n={mode:"lab"},[,r,i,s,o]=e;if(!(r.type===Q.Hue||i.type===Q.Hue||s.type===Q.Hue))return r.type!==Q.None&&(n.l=Math.min(Math.max(0,r.value),100)),i.type!==Q.None&&(n.a=i.type===Q.Number?i.value:i.value*125/100),s.type!==Q.None&&(n.b=s.type===Q.Number?s.value:s.value*125/100),o.type!==Q.None&&(n.alpha=Math.min(1,Math.max(0,o.type===Q.Number?o.value:o.value/100))),n}const dd={mode:"lab",toMode:{xyz50:cd,rgb:Im},fromMode:{xyz50:ud,rgb:Lm},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-125,125],b:[-125,125]},parse:[vx],serialize:t=>`lab(${t.l!==void 0?t.l:"none"} ${t.a!==void 0?t.a:"none"} ${t.b!==void 0?t.b:"none"}${t.alpha<1?` / ${t.alpha}`:""})`,interpolate:{l:he,a:he,b:he,alpha:{use:he,fixup:It}}},bx={...dd,mode:"lab65",parse:["--lab-d65"],serialize:"--lab-d65",toMode:{xyz65:ym,rgb:kl},fromMode:{xyz65:km,rgb:El},ranges:{l:[0,100],a:[-125,125],b:[-125,125]}};function _x(t,e){if(!e||e[0]!=="lch")return;const n={mode:"lch"},[,r,i,s,o]=e;if(r.type!==Q.None){if(r.type===Q.Hue)return;n.l=Math.min(Math.max(0,r.value),100)}if(i.type!==Q.None&&(n.c=Math.max(0,i.type===Q.Number?i.value:i.value*150/100)),s.type!==Q.None){if(s.type===Q.Percentage)return;n.h=s.value}return o.type!==Q.None&&(n.alpha=Math.min(1,Math.max(0,o.type===Q.Number?o.value:o.value/100))),n}const fd={mode:"lch",toMode:{lab:Yr,rgb:t=>Im(Yr(t))},fromMode:{rgb:t=>Xr(Lm(t)),lab:Xr},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,150],h:[0,360]},parse:[_x],serialize:t=>`lch(${t.l!==void 0?t.l:"none"} ${t.c!==void 0?t.c:"none"} ${t.h!==void 0?t.h:"none"}${t.alpha<1?` / ${t.alpha}`:""})`,interpolate:{h:{use:he,fixup:Cr},c:he,l:he,alpha:{use:he,fixup:It}},difference:{h:yl},average:{h:Pr}},wx={...fd,mode:"lch65",parse:["--lch-d65"],serialize:"--lch-d65",toMode:{lab65:t=>Yr(t,"lab65"),rgb:t=>kl(Yr(t,"lab65"))},fromMode:{rgb:t=>Xr(El(t),"lch65"),lab65:t=>Xr(t,"lch65")},ranges:{l:[0,100],c:[0,150],h:[0,360]}},Dm=({l:t,u:e,v:n,alpha:r})=>{e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.sqrt(e*e+n*n),s={mode:"lchuv",l:t,c:i};return i&&(s.h=Wt(Math.atan2(n,e)*180/Math.PI)),r!==void 0&&(s.alpha=r),s},Hm=({l:t,c:e,h:n,alpha:r})=>{n===void 0&&(n=0);let i={mode:"luv",l:t,u:e?e*Math.cos(n/180*Math.PI):0,v:e?e*Math.sin(n/180*Math.PI):0};return r!==void 0&&(i.alpha=r),i},Bm=(t,e,n)=>4*t/(t+15*e+3*n),$m=(t,e,n)=>9*e/(t+15*e+3*n),yx=Bm(Mt.X,Mt.Y,Mt.Z),kx=$m(Mt.X,Mt.Y,Mt.Z),Ex=t=>t<=ld?Pl*t:116*Math.cbrt(t)-16,du=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Ex(e/Mt.Y),s=Bm(t,e,n),o=$m(t,e,n);!isFinite(s)||!isFinite(o)?i=s=o=0:(s=13*i*(s-yx),o=13*i*(o-kx));let a={mode:"luv",l:i,u:s,v:o};return r!==void 0&&(a.alpha=r),a},Sx=(t,e,n)=>4*t/(t+15*e+3*n),xx=(t,e,n)=>9*e/(t+15*e+3*n),Tx=Sx(Mt.X,Mt.Y,Mt.Z),Cx=xx(Mt.X,Mt.Y,Mt.Z),fu=({l:t,u:e,v:n,alpha:r})=>{if(t===void 0&&(t=0),t===0)return{mode:"xyz50",x:0,y:0,z:0};e===void 0&&(e=0),n===void 0&&(n=0);let i=e/(13*t)+Tx,s=n/(13*t)+Cx,o=Mt.Y*(t<=8?t/Pl:Math.pow((t+16)/116,3)),a=o*(9*i)/(4*s),l=o*(12-3*i-20*s)/(4*s),c={mode:"xyz50",x:a,y:o,z:l};return r!==void 0&&(c.alpha=r),c},Px=t=>Dm(du(Io(t))),Rx=t=>zo(fu(Hm(t))),Ax={mode:"lchuv",toMode:{luv:Hm,rgb:Rx},fromMode:{rgb:Px,luv:Dm},channels:["l","c","h","alpha"],parse:["--lchuv"],serialize:"--lchuv",ranges:{l:[0,100],c:[0,176.956],h:[0,360]},interpolate:{h:{use:he,fixup:Cr},c:he,l:he,alpha:{use:he,fixup:It}},difference:{h:yl},average:{h:Pr}},Mx={...gs,mode:"lrgb",toMode:{rgb:vs},fromMode:{rgb:ms},parse:["srgb-linear"],serialize:"srgb-linear"},Ox={mode:"luv",toMode:{xyz50:fu,rgb:t=>zo(fu(t))},fromMode:{xyz50:du,rgb:t=>du(Io(t))},channels:["l","u","v","alpha"],parse:["--luv"],serialize:"--luv",ranges:{l:[0,100],u:[-84.936,175.042],v:[-125.882,87.243]},interpolate:{l:he,u:he,v:he,alpha:{use:he,fixup:It}}},Um=({r:t,g:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.cbrt(.412221469470763*t+.5363325372617348*e+.0514459932675022*n),s=Math.cbrt(.2119034958178252*t+.6806995506452344*e+.1073969535369406*n),o=Math.cbrt(.0883024591900564*t+.2817188391361215*e+.6299787016738222*n),a={mode:"oklab",l:.210454268309314*i+.7936177747023054*s-.0040720430116193*o,a:1.9779985324311684*i-2.42859224204858*s+.450593709617411*o,b:.0259040424655478*i+.7827717124575296*s-.8086757549230774*o};return r!==void 0&&(a.alpha=r),a},Rl=t=>{let e=Um(ms(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e},Lo=({l:t,a:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.pow(t+.3963377773761749*e+.2158037573099136*n,3),s=Math.pow(t-.1055613458156586*e-.0638541728258133*n,3),o=Math.pow(t-.0894841775298119*e-1.2914855480194092*n,3),a={mode:"lrgb",r:4.076741636075957*i-3.3077115392580616*s+.2309699031821044*o,g:-1.2684379732850317*i+2.6097573492876887*s-.3413193760026573*o,b:-.0041960761386756*i-.7034186179359362*s+1.7076146940746117*o};return r!==void 0&&(a.alpha=r),a},Al=t=>vs(Lo(t));function hu(t){const r=1.170873786407767;return .5*(r*t-.206+Math.sqrt((r*t-.206)*(r*t-.206)+4*.03*r*t))}function $a(t){return(t*t+.206*t)/(1.170873786407767*(t+.03))}function Nx(t,e){let n,r,i,s,o,a,l,c;-1.88170328*t-.80936493*e>1?(n=1.19086277,r=1.76576728,i=.59662641,s=.75515197,o=.56771245,a=4.0767416621,l=-3.3077115913,c=.2309699292):1.81444104*t-1.19445276*e>1?(n=.73956515,r=-.45954404,i=.08285427,s=.1254107,o=.14503204,a=-1.2684380046,l=2.6097574011,c=-.3413193965):(n=1.35733652,r=-.00915799,i=-1.1513021,s=-.50559606,o=.00692167,a=-.0041960863,l=-.7034186147,c=1.707614701);let u=n+r*t+i*e+s*t*t+o*t*e,d=.3963377774*t+.2158037573*e,h=-.1055613458*t-.0638541728*e,p=-.0894841775*t-1.291485548*e;{let g=1+u*d,m=1+u*h,_=1+u*p,k=g*g*g,O=m*m*m,I=_*_*_,R=3*d*g*g,A=3*h*m*m,T=3*p*_*_,M=6*d*d*g,N=6*h*h*m,j=6*p*p*_,H=a*k+l*O+c*I,se=a*R+l*A+c*T,B=a*M+l*N+c*j;u=u-H*se/(se*se-.5*H*B)}return u}function hd(t,e){let n=Nx(t,e),r=Lo({l:1,a:n*t,b:n*e}),i=Math.cbrt(1/Math.max(r.r,r.g,r.b)),s=i*n;return[i,s]}function zx(t,e,n,r,i,s=null){s||(s=hd(t,e));let o;if((n-i)*s[1]-(s[0]-i)*r<=0)o=s[1]*i/(r*s[0]+s[1]*(i-n));else{o=s[1]*(i-1)/(r*(s[0]-1)+s[1]*(i-n));{let a=n-i,l=r,c=.3963377774*t+.2158037573*e,u=-.1055613458*t-.0638541728*e,d=-.0894841775*t-1.291485548*e,h=a+l*c,p=a+l*u,g=a+l*d;{let m=i*(1-o)+o*n,_=o*r,k=m+_*c,O=m+_*u,I=m+_*d,R=k*k*k,A=O*O*O,T=I*I*I,M=3*h*k*k,N=3*p*O*O,j=3*g*I*I,H=6*h*h*k,se=6*p*p*O,B=6*g*g*I,q=4.0767416621*R-3.3077115913*A+.2309699292*T-1,ee=4.0767416621*M-3.3077115913*N+.2309699292*j,te=4.0767416621*H-3.3077115913*se+.2309699292*B,W=ee/(ee*ee-.5*q*te),J=-q*W,ne=-1.2684380046*R+2.6097574011*A-.3413193965*T-1,le=-1.2684380046*M+2.6097574011*N-.3413193965*j,oe=-1.2684380046*H+2.6097574011*se-.3413193965*B,ue=le/(le*le-.5*ne*oe),De=-ne*ue,Ye=-.0041960863*R-.7034186147*A+1.707614701*T-1,je=-.0041960863*M-.7034186147*N+1.707614701*j,Ke=-.0041960863*H-.7034186147*se+1.707614701*B,ce=je/(je*je-.5*Ye*Ke),ae=-Ye*ce;J=W>=0?J:1e6,De=ue>=0?De:1e6,ae=ce>=0?ae:1e6,o+=Math.min(J,Math.min(De,ae))}}}return o}function pd(t,e,n=null){n||(n=hd(t,e));let r=n[0],i=n[1];return[i/r,i/(1-r)]}function jm(t,e,n){let r=hd(e,n),i=zx(e,n,t,1,t,r),s=pd(e,n,r),o=.11516993+1/(7.4477897+4.1590124*n+e*(-2.19557347+1.75198401*n+e*(-2.13704948-10.02301043*n+e*(-4.24894561+5.38770819*n+4.69891013*e)))),a=.11239642+1/(1.6132032-.68124379*n+e*(.40370612+.90148123*n+e*(-.27087943+.6122399*n+e*(.00299215-.45399568*n-.14661872*e)))),l=i/Math.min(t*s[0],(1-t)*s[1]),c=t*o,u=(1-t)*a,d=.9*l*Math.sqrt(Math.sqrt(1/(1/(c*c*c*c)+1/(u*u*u*u))));return c=t*.4,u=(1-t)*.8,[Math.sqrt(1/(1/(c*c)+1/(u*u))),d,i]}function rh(t){const e=t.l!==void 0?t.l:0,n=t.a!==void 0?t.a:0,r=t.b!==void 0?t.b:0,i={mode:"okhsl",l:hu(e)};t.alpha!==void 0&&(i.alpha=t.alpha);let s=Math.sqrt(n*n+r*r);if(!s)return i.s=0,i;let[o,a,l]=jm(e,n/s,r/s),c;if(s<a){let u=0,d=.8*o,h=1-d/a;c=(s-u)/(d+h*(s-u))*.8}else{let u=a,d=.2*a*a*1.25*1.25/o,h=1-d/(l-a);c=.8+.2*((s-u)/(d+h*(s-u)))}return c&&(i.s=c,i.h=Wt(Math.atan2(r,n)*180/Math.PI)),i}function ih(t){let e=t.h!==void 0?t.h:0,n=t.s!==void 0?t.s:0,r=t.l!==void 0?t.l:0;const i={mode:"oklab",l:$a(r)};if(t.alpha!==void 0&&(i.alpha=t.alpha),!n||r===1)return i.a=i.b=0,i;let s=Math.cos(e/180*Math.PI),o=Math.sin(e/180*Math.PI),[a,l,c]=jm(i.l,s,o),u,d,h,p;n<.8?(u=1.25*n,d=0,h=.8*a,p=1-h/l):(u=5*(n-.8),d=l,h=.2*l*l*1.25*1.25/a,p=1-h/(c-l));let g=d+u*h/(1-p*u);return i.a=g*s,i.b=g*o,i}const Ix={...xm,mode:"okhsl",channels:["h","s","l","alpha"],parse:["--okhsl"],serialize:"--okhsl",fromMode:{oklab:rh,rgb:t=>rh(Rl(t))},toMode:{oklab:ih,rgb:t=>Al(ih(t))}};function sh(t){let e=t.l!==void 0?t.l:0,n=t.a!==void 0?t.a:0,r=t.b!==void 0?t.b:0,i=Math.sqrt(n*n+r*r),s=i?n/i:1,o=i?r/i:1,[a,l]=pd(s,o),c=.5,u=1-c/a,d=l/(i+e*l),h=d*e,p=d*i,g=$a(h),m=p*g/h,_=Lo({l:g,a:s*m,b:o*m}),k=Math.cbrt(1/Math.max(_.r,_.g,_.b,0));e=e/k,i=i/k*hu(e)/e,e=hu(e);const O={mode:"okhsv",s:i?(c+l)*p/(l*c+l*u*p):0,v:e?e/h:0};return O.s&&(O.h=Wt(Math.atan2(r,n)*180/Math.PI)),t.alpha!==void 0&&(O.alpha=t.alpha),O}function oh(t){const e={mode:"oklab"};t.alpha!==void 0&&(e.alpha=t.alpha);const n=t.h!==void 0?t.h:0,r=t.s!==void 0?t.s:0,i=t.v!==void 0?t.v:0,s=Math.cos(n/180*Math.PI),o=Math.sin(n/180*Math.PI),[a,l]=pd(s,o),c=.5,u=1-c/a,d=1-r*c/(c+l-l*u*r),h=r*l*c/(c+l-l*u*r),p=$a(d),g=h*p/d,m=Lo({l:p,a:s*g,b:o*g}),_=Math.cbrt(1/Math.max(m.r,m.g,m.b,0)),k=$a(i*d),O=h*k/d;return e.l=k*_,e.a=O*s*_,e.b=O*o*_,e}const Lx={...Pm,mode:"okhsv",channels:["h","s","v","alpha"],parse:["--okhsv"],serialize:"--okhsv",fromMode:{oklab:sh,rgb:t=>sh(Rl(t))},toMode:{oklab:oh,rgb:t=>Al(oh(t))}};function Dx(t,e){if(!e||e[0]!=="oklab")return;const n={mode:"oklab"},[,r,i,s,o]=e;if(!(r.type===Q.Hue||i.type===Q.Hue||s.type===Q.Hue))return r.type!==Q.None&&(n.l=Math.min(Math.max(0,r.type===Q.Number?r.value:r.value/100),1)),i.type!==Q.None&&(n.a=i.type===Q.Number?i.value:i.value*.4/100),s.type!==Q.None&&(n.b=s.type===Q.Number?s.value:s.value*.4/100),o.type!==Q.None&&(n.alpha=Math.min(1,Math.max(0,o.type===Q.Number?o.value:o.value/100))),n}const Hx={...dd,mode:"oklab",toMode:{lrgb:Lo,rgb:Al},fromMode:{lrgb:Um,rgb:Rl},ranges:{l:[0,1],a:[-.4,.4],b:[-.4,.4]},parse:[Dx],serialize:t=>`oklab(${t.l!==void 0?t.l:"none"} ${t.a!==void 0?t.a:"none"} ${t.b!==void 0?t.b:"none"}${t.alpha<1?` / ${t.alpha}`:""})`};function Bx(t,e){if(!e||e[0]!=="oklch")return;const n={mode:"oklch"},[,r,i,s,o]=e;if(r.type!==Q.None){if(r.type===Q.Hue)return;n.l=Math.min(Math.max(0,r.type===Q.Number?r.value:r.value/100),1)}if(i.type!==Q.None&&(n.c=Math.max(0,i.type===Q.Number?i.value:i.value*.4/100)),s.type!==Q.None){if(s.type===Q.Percentage)return;n.h=s.value}return o.type!==Q.None&&(n.alpha=Math.min(1,Math.max(0,o.type===Q.Number?o.value:o.value/100))),n}const $x={...fd,mode:"oklch",toMode:{oklab:t=>Yr(t,"oklab"),rgb:t=>Al(Yr(t,"oklab"))},fromMode:{rgb:t=>Xr(Rl(t),"oklch"),oklab:t=>Xr(t,"oklch")},parse:[Bx],serialize:t=>`oklch(${t.l!==void 0?t.l:"none"} ${t.c!==void 0?t.c:"none"} ${t.h!==void 0?t.h:"none"}${t.alpha<1?` / ${t.alpha}`:""})`,ranges:{l:[0,1],c:[0,.4],h:[0,360]}},ah=t=>{let{r:e,g:n,b:r,alpha:i}=ms(t),s={mode:"xyz65",x:.486570948648216*e+.265667693169093*n+.1982172852343625*r,y:.2289745640697487*e+.6917385218365062*n+.079286914093745*r,z:0*e+.0451133818589026*n+1.043944368900976*r};return i!==void 0&&(s.alpha=i),s},lh=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=vs({r:t*2.4934969119414263-e*.9313836179191242-.402710784450717*n,g:t*-.8294889695615749+e*1.7626640603183465+.0236246858419436*n,b:t*.0358458302437845-e*.0761723892680418+.9568845240076871*n},"p3");return r!==void 0&&(i.alpha=r),i},Ux={...gs,mode:"p3",parse:["display-p3"],serialize:"display-p3",fromMode:{rgb:t=>lh(Ei(t)),xyz65:lh},toMode:{rgb:t=>Si(ah(t)),xyz65:ah}},pc=t=>{let e=Math.abs(t);return e>=1/512?Math.sign(t)*Math.pow(e,1/1.8):16*t},ch=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i={mode:"prophoto",r:pc(t*1.3457868816471585-e*.2555720873797946-.0511018649755453*n),g:pc(t*-.5446307051249019+e*1.5082477428451466+.0205274474364214*n),b:pc(t*0+e*0+1.2119675456389452*n)};return r!==void 0&&(i.alpha=r),i},gc=(t=0)=>{let e=Math.abs(t);return e>=16/512?Math.sign(t)*Math.pow(e,1.8):t/16},uh=t=>{let e=gc(t.r),n=gc(t.g),r=gc(t.b),i={mode:"xyz50",x:.7977666449006423*e+.1351812974005331*n+.0313477341283922*r,y:.2880748288194013*e+.7118352342418731*n+899369387256e-16*r,z:0*e+0*n+.8251046025104602*r};return t.alpha!==void 0&&(i.alpha=t.alpha),i},jx={...gs,mode:"prophoto",parse:["prophoto-rgb"],serialize:"prophoto-rgb",fromMode:{xyz50:ch,rgb:t=>ch(Io(t))},toMode:{xyz50:uh,rgb:t=>zo(uh(t))}},dh=1.09929682680944,Fx=.018053968510807,mc=t=>{const e=Math.abs(t);return e>Fx?(Math.sign(t)||1)*(dh*Math.pow(e,.45)-(dh-1)):4.5*t},fh=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i={mode:"rec2020",r:mc(t*1.7166511879712683-e*.3556707837763925-.2533662813736599*n),g:mc(t*-.6666843518324893+e*1.6164812366349395+.0157685458139111*n),b:mc(t*.0176398574453108-e*.0427706132578085+.9421031212354739*n)};return r!==void 0&&(i.alpha=r),i},hh=1.09929682680944,Gx=.018053968510807,vc=(t=0)=>{let e=Math.abs(t);return e<Gx*4.5?t/4.5:(Math.sign(t)||1)*Math.pow((e+hh-1)/hh,1/.45)},ph=t=>{let e=vc(t.r),n=vc(t.g),r=vc(t.b),i={mode:"xyz65",x:.6369580483012911*e+.1446169035862083*n+.1688809751641721*r,y:.262700212011267*e+.6779980715188708*n+.059301716469862*r,z:0*e+.0280726930490874*n+1.0609850577107909*r};return t.alpha!==void 0&&(i.alpha=t.alpha),i},Vx={...gs,mode:"rec2020",fromMode:{xyz65:fh,rgb:t=>fh(Ei(t))},toMode:{xyz65:ph,rgb:t=>Si(ph(t))},parse:["rec2020"],serialize:"rec2020"},bi=.0037930732552754493,Fm=Math.cbrt(bi),bc=t=>Math.cbrt(t)-Fm,Zx=t=>{const{r:e,g:n,b:r,alpha:i}=ms(t),s=bc(.3*e+.622*n+.078*r+bi),o=bc(.23*e+.692*n+.078*r+bi),a=bc(.2434226892454782*e+.2047674442449682*n+.5518098665095535*r+bi),l={mode:"xyb",x:(s-o)/2,y:(s+o)/2,b:a-(s+o)/2};return i!==void 0&&(l.alpha=i),l},_c=t=>Math.pow(t+Fm,3),Wx=({x:t,y:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);const i=_c(t+e)-bi,s=_c(e-t)-bi,o=_c(n+e)-bi,a=vs({r:11.031566904639861*i-9.866943908131562*s-.16462299650829934*o,g:-3.2541473810744237*i+4.418770377582723*s-.16462299650829934*o,b:-3.6588512867136815*i+2.7129230459360922*s+1.9459282407775895*o});return r!==void 0&&(a.alpha=r),a},qx={mode:"xyb",channels:["x","y","b","alpha"],parse:["--xyb"],serialize:"--xyb",toMode:{rgb:Wx},fromMode:{rgb:Zx},ranges:{x:[-.0154,.0281],y:[0,.8453],b:[-.2778,.388]},interpolate:{x:he,y:he,b:he,alpha:{use:he,fixup:It}}},Xx={mode:"xyz50",parse:["xyz-d50"],serialize:"xyz-d50",toMode:{rgb:zo,lab:ud},fromMode:{rgb:Io,lab:cd},channels:["x","y","z","alpha"],ranges:{x:[0,.964],y:[0,.999],z:[0,.825]},interpolate:{x:he,y:he,z:he,alpha:{use:he,fixup:It}}},Yx=t=>{let{x:e,y:n,z:r,alpha:i}=t;e===void 0&&(e=0),n===void 0&&(n=0),r===void 0&&(r=0);let s={mode:"xyz50",x:1.0479298208405488*e+.0229467933410191*n-.0501922295431356*r,y:.0296278156881593*e+.990434484573249*n-.0170738250293851*r,z:-.0092430581525912*e+.0150551448965779*n+.7518742899580008*r};return i!==void 0&&(s.alpha=i),s},Jx=t=>{let{x:e,y:n,z:r,alpha:i}=t;e===void 0&&(e=0),n===void 0&&(n=0),r===void 0&&(r=0);let s={mode:"xyz65",x:.9554734527042182*e-.0230985368742614*n+.0632593086610217*r,y:-.0283697069632081*e+1.0099954580058226*n+.021041398966943*r,z:.0123140016883199*e-.0205076964334779*n+1.3303659366080753*r};return i!==void 0&&(s.alpha=i),s},Kx={mode:"xyz65",toMode:{rgb:Si,xyz50:Yx},fromMode:{rgb:Ei,xyz50:Jx},ranges:{x:[0,.95],y:[0,1],z:[0,1.088]},channels:["x","y","z","alpha"],parse:["xyz","xyz-d65"],serialize:"xyz-d65",interpolate:{x:he,y:he,z:he,alpha:{use:he,fixup:It}}},Qx=({r:t,g:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);const i={mode:"yiq",y:.29889531*t+.58662247*e+.11448223*n,i:.59597799*t-.2741761*e-.32180189*n,q:.21147017*t-.52261711*e+.31114694*n};return r!==void 0&&(i.alpha=r),i},e2=({y:t,i:e,q:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);const i={mode:"rgb",r:t+.95608445*e+.6208885*n,g:t-.27137664*e-.6486059*n,b:t-1.10561724*e+1.70250126*n};return r!==void 0&&(i.alpha=r),i},t2={mode:"yiq",toMode:{rgb:e2},fromMode:{rgb:Qx},channels:["y","i","q","alpha"],parse:["--yiq"],serialize:"--yiq",ranges:{i:[-.595,.595],q:[-.522,.522]},interpolate:{y:he,i:he,q:he,alpha:{use:he,fixup:It}}};tt(jS);tt(XS);tt(YS);tt(JS);tt(ex);tt(xm);tt(Pm);tt(ux);tt(dx);tt(gx);tt(mx);tt(dd);tt(bx);tt(fd);tt(wx);tt(Ax);tt(Mx);tt(Ox);tt(Ix);tt(Lx);tt(Hx);tt($x);tt(Ux);tt(jx);tt(Vx);tt(gs);tt(qx);tt(Xx);tt(Kx);tt(t2);const ba=["dark","light"],pu=od.map(t=>t.token),n2=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;function Gm(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function r2(t,e,n){if(!Gm(t))return n.push(`"${e}" must be an object of 21 colour tokens.`),!1;let r=!0;for(const i of pu){const s=t[i];if(s===void 0){n.push(`"${e}" is missing the token "${i}".`),r=!1;continue}if(typeof s!="string"){n.push(`"${e}.${i}" must be a string, got ${typeof s}.`),r=!1;continue}n2.test(s)||(n.push(`"${e}.${i}" must be a hex colour like #1a2b3c, got "${s}".`),r=!1)}for(const i of Object.keys(t))pu.includes(i)||(n.push(`"${e}" has an unknown token "${i}".`),r=!1);return r}function i2(t){const e=[];for(const n of ba)for(const r of gS){const i=pS(t[n][r.fg],t[n][r.bg]);i<r.min&&e.push({theme:n,pair:`${r.fg} on ${r.bg}`,ratio:Number(i.toFixed(2)),min:r.min})}return e}function Vm(t){const e=[];if(!Gm(t))return{palette:null,structuralErrors:['The file must contain a JSON object with "dark" and "light" keys.'],contrastWarnings:[]};let n=!0;for(const i of ba){if(!(i in t)){e.push(`Missing the "${i}" theme.`),n=!1;continue}r2(t[i],i,e)||(n=!1)}for(const i of Object.keys(t))ba.includes(i)||(e.push(`Unknown top-level key "${i}"; expected only "dark" and "light".`),n=!1);if(!n)return{palette:null,structuralErrors:e,contrastWarnings:[]};const r={dark:{},light:{}};for(const i of ba){const s=t[i];for(const o of pu)r[i][o]=s[o]}return{palette:r,structuralErrors:[],contrastWarnings:i2(r)}}const s2=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),Zm=Ue({permission:hm,reason:de().min(1),prerequisite:de().min(1).optional()}),gd=Vt().int().nonnegative().nullable(),o2=Ue({kind:Kt(["exec","service"]),state:Pt("blocked"),retryAfterSeconds:gd,blockers:vt(Zm).min(1)}),a2=Ue({kind:Kt(["exec","service"]),state:Pt("incompatible"),retryAfterSeconds:gd,requiredProtocol:Vt().int(),supportedProtocols:vt(Vt().int())}),l2=Ue({kind:Kt(["exec","service"]),state:Kt(["ready","starting","unavailable","maintenance","disabled","not-approved"]),retryAfterSeconds:gd}),c2=t=>{if(!s2(t))return t;if(({blocked:["requiredProtocol","supportedProtocols"],incompatible:["blockers"]}[String(t.state)]??["blockers","requiredProtocol","supportedProtocols"]).some(r=>Object.prototype.hasOwnProperty.call(t,r)))throw new Error("backend status contains fields for a different variant");return t},u2=_E(c2,rd("state",[o2,a2,l2]));class gu extends Error{constructor(n){super(`Unknown backend binding id: "${n}"`);G(this,"code","UNKNOWN_ID");this.id=n,this.name="BackendUnknownId"}}class Wm extends Error{constructor(n){super(`Backend "${n}" is not approved`);G(this,"code","NOT_APPROVED");this.id=n,this.name="BackendNotApproved"}}class qm extends Error{constructor(n){super(`Backend "${n}" is disabled`);G(this,"code","DISABLED");this.id=n,this.name="BackendDisabled"}}class gh extends Error{constructor(n,r){super(`Backend route "${n}" is not an ${r} route`);G(this,"code","TRANSPORT_MISMATCH");this.id=n,this.expected=r,this.name="BackendTransportMismatch"}}class d2 extends Error{constructor(n,r){super(`Backend "${n}" is starting`);G(this,"daemonCode","BACKEND_STARTING");this.id=n,this.retryAfterSeconds=r,this.name="BackendStarting"}}class f2 extends Error{constructor(n){super(`Backend "${n}" is unavailable`);G(this,"daemonCode","BACKEND_UNAVAILABLE");this.id=n,this.name="BackendUnavailable"}}class h2 extends Error{constructor(n){super(`Backend "${n}" is incompatible`);G(this,"daemonCode","BACKEND_INCOMPATIBLE");this.id=n,this.name="BackendIncompatible"}}class p2 extends Error{constructor(n,r){super(`Backend "${n}" is under maintenance`);G(this,"daemonCode","BACKEND_MAINTENANCE");this.id=n,this.retryAfterSeconds=r,this.name="BackendMaintenance"}}class g2 extends Error{constructor(n,r,i){super(`Backend "${n}" is blocked on an unmet activation prerequisite`);G(this,"daemonCode","BACKEND_BLOCKED");this.id=n,this.blockers=r,this.retryAfterSeconds=i,this.name="BackendBlocked"}}class m2 extends Error{constructor(n){super(`Backend "${n}" returned a bad gateway response`);G(this,"daemonCode","BAD_GATEWAY");this.id=n,this.name="BackendBadGateway"}}class wc extends Error{constructor(n,r){super(r);G(this,"code","STATUS_QUERY_FAILED");this.httpStatus=n,this.name="BackendStatusQueryError"}}const yc=t=>{const e=t.headers.get("Retry-After");if(e===null||!/^\d+$/.test(e))return null;const n=Number(e);return Number.isSafeInteger(n)?n:null},v2=t=>{const e=vt(Zm).safeParse(t);return e.success?e.data:[]},b2={DISABLED:t=>new qm(t),NOT_APPROVED:t=>new Wm(t),ROUTE_NOT_FOUND:t=>new gu(t),BACKEND_STARTING:(t,e)=>new d2(t,yc(e)),BACKEND_UNAVAILABLE:t=>new f2(t),BACKEND_INCOMPATIBLE:t=>new h2(t),BACKEND_MAINTENANCE:(t,e)=>new p2(t,yc(e)),BACKEND_BLOCKED:(t,e,n)=>new g2(t,v2(n.detail),yc(e)),BAD_GATEWAY:t=>new m2(t)},_2=t=>{if(!t)return"";const e=new URLSearchParams;for(const[r,i]of Object.entries(t))e.set(r,String(i));const n=e.toString();return n?`?${n}`:""},w2=t=>t===null||typeof t!="object"?!1:!(t instanceof FormData||t instanceof Blob||t instanceof ArrayBuffer||t instanceof URLSearchParams||t instanceof ReadableStream),y2=t=>t.startsWith("https:")?"wss:":"ws:",mh=(t,e)=>t.enabled?t.approval!=="approved"?new Wm(e):null:new qm(e),k2=async(t,e)=>{if(e.ok)return e;let n;try{n=(await e.clone().json()).error}catch{return e}const r=n!=null&&n.code?b2[n.code]:void 0;if(!r||!n)return e;throw r(t,e,n)},E2=async(t,e,n,r)=>{const i=`${t.origin}/api/plugins/${t.pluginName}/${e.path}${_2(r.query)}`,s=new Headers(r.headers);e.method!=="GET"&&e.method!=="HEAD"&&s.set("X-Mndw-Csrf","1");let o;r.body!==void 0&&r.body!==null&&(w2(r.body)?(o=JSON.stringify(r.body),s.has("content-type")||s.set("content-type","application/json")):o=r.body);const a=await t.fetchImpl(i,{method:e.method,headers:s,body:o,signal:r.signal});return k2(n,a)};function S2(t,e,n={}){const r={pluginName:t,descriptor:e,fetchImpl:n.fetch??globalThis.fetch.bind(globalThis),WebSocketCtor:n.WebSocketCtor??globalThis.WebSocket,origin:n.origin??(typeof location<"u"?location.origin:"http://localhost")};return{fetch(i,s={}){const o=e.routes[i];if(!o)throw new gu(i);if(o.transport!=="http"||!o.method)throw new gh(i,"http");const a=mh(e,i);return a?Promise.reject(a):E2(r,o,i,s)},socket(i,s={}){const o=e.routes[i];if(!o)throw new gu(i);if(o.transport!=="websocket")throw new gh(i,"websocket");const a=mh(e,i);if(a)throw a;const l=`${y2(r.origin)}//${r.origin.replace(/^[a-z]+:\/\//,"")}/ws/plugins/${r.pluginName}/${o.path}`,c=s.protocols??o.protocols;return new r.WebSocketCtor(l,c)},status(i={}){const s=`${r.origin}/api/plugins/${r.pluginName}/_mndw/status`;return r.fetchImpl(s,{method:"GET",signal:i.signal}).then(async o=>{if(!o.ok)throw new wc(o.status,`Backend status query failed with HTTP ${o.status}`);try{return u2.parse(await o.json())}catch(a){throw a instanceof wc?a:new wc(o.status,"Backend status response is invalid")}})}}}class vh extends Error{constructor(n,r){super(r);G(this,"status");this.name="TelemetryError",this.status=n}}const Zr=t=>typeof t=="number"&&Number.isFinite(t),x2=["unanchored","anchored","suspect"],T2=t=>{if(t===void 0)return;if(t===null||typeof t!="object"||Array.isArray(t))throw new Error("telemetry clock is invalid");const e=t,{state:n,historyEndMs:r,historyCurrent:i,replayPending:s}=e;if(typeof n!="string"||!x2.includes(n))throw new Error("telemetry clock state is invalid");if(r!==null&&(!Zr(r)||!Number.isInteger(r)||r<0))throw new Error("telemetry clock historyEndMs must be a non-negative integer or null");if(typeof i!="boolean"||typeof s!="boolean")throw new Error("telemetry clock flags must be booleans");if(r===null&&i)throw new Error("telemetry clock cannot be current without history");return{state:n,historyEndMs:r,historyCurrent:i,replayPending:s}},C2=new Set(["accent","success","warning","muted"]),P2=t=>{if(typeof t!="string"||!C2.has(t))throw new Error(`invalid projected chart color: ${String(t)}`);return t},bh=(t,e)=>{if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`projected point in ${e} is invalid`);const n=t;if(!Zr(n.time))throw new Error(`projected point time in ${e} is invalid`);if(n.value!==null&&!Zr(n.value))throw new Error(`projected point value in ${e} must be finite or null`);return{time:n.time,value:n.value===null?Number.NaN:n.value}},R2=(t,e)=>{if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`projected band point in ${e} is invalid`);const n=t;if(!Zr(n.time)||!Zr(n.min)||!Zr(n.max))throw new Error(`projected band point in ${e} is invalid`);return{time:n.time,min:n.min,max:n.max}},A2=(t,e)=>{if(e===null||typeof e!="object"||Array.isArray(e))throw new Error(`projected series ${t} is invalid`);const n=e;if(typeof n.supported!="boolean")throw new Error(`projected series ${t} supported is invalid`);if(n.unit!=="percent"&&n.unit!=="celsius")throw new Error(`projected series ${t} has invalid unit`);if(n.label!==void 0&&n.label!==null&&typeof n.label!="string")throw new Error(`projected series ${t} label is invalid`);if(!Array.isArray(n.points)||!Array.isArray(n.segments)||!Array.isArray(n.bands))throw new Error(`projected series ${t} arrays are invalid`);const r=n.points.map(a=>bh(a,t)),i=n.segments.map(a=>{if(a===null||typeof a!="object"||Array.isArray(a))throw new Error(`projected segment in ${t} is invalid`);const l=a;if(!Array.isArray(l.data))throw new Error(`projected segment data in ${t} is invalid`);return{data:l.data.map(c=>bh(c,t))}}),s=n.bands.map(a=>{if(a===null||typeof a!="object"||Array.isArray(a))throw new Error(`projected band in ${t} is invalid`);const l=a;if(typeof l.id!="string"||!Array.isArray(l.data))throw new Error(`projected band in ${t} is invalid`);return{id:l.id,data:l.data.map(c=>R2(c,t)),color:P2(l.color)}});let o;if(n.valueDomain!==void 0&&n.valueDomain!==null){if(typeof n.valueDomain!="object"||Array.isArray(n.valueDomain))throw new Error(`projected series ${t} valueDomain is invalid`);const a=n.valueDomain;if(!Zr(a.min)||!Zr(a.max))throw new Error(`projected series ${t} valueDomain is invalid`);o={min:a.min,max:a.max}}return{label:typeof n.label=="string"?n.label:void 0,supported:n.supported,unit:n.unit,points:r,segments:i,bands:s,valueDomain:o}},M2=t=>{if(t===null||typeof t!="object"||Array.isArray(t))throw new Error("projected telemetry response must be an object");const e=t,n=e.gathering;if(n===null||typeof n!="object"||Array.isArray(n)||typeof n.enabled!="boolean")throw new Error("projected telemetry gathering is invalid");const r=e.keys;if(r===null||typeof r!="object"||Array.isArray(r))throw new Error("projected telemetry keys are invalid");const i={};for(const[s,o]of Object.entries(r))i[s]=A2(s,o);return{keys:i,gathering:{enabled:n.enabled},clock:T2(e.clock),sessionConfigured:typeof e.sessionConfigured=="boolean"?e.sessionConfigured:!1}},O2=t=>t!==null&&typeof t=="object"&&"name"in t&&t.name==="AbortError";function N2(t=globalThis.fetch){const e=async(n,r,i)=>{const s=await t(n,{method:"GET",cache:"no-store",signal:i.signal});if(!s.ok)throw new vh(s.status,i.unavailableMessage);try{return r(await s.json())}catch(o){throw O2(o)?o:new vh(s.status,o instanceof Error?o.message:i.invalidResponseMessage)}};return{async fetchProjected(n,r={}){return e(`/api/mndw/telemetry?project=${n}`,M2,{signal:r.signal,unavailableMessage:"Projected telemetry is unavailable.",invalidResponseMessage:"Invalid projected telemetry response."})}}}const z2={loading:"Loading…",error:"Something went wrong."},I2={"toggle-menu":"Toggle menu",close:"Close navigation",dashboard:"Dashboard","package-manager":"Entware",plugins:"Plugins",settings:"Settings","light-theme":"Switch to light theme","dark-theme":"Switch to dark theme","color-theme":"Toggle color theme",language:"Language","language-english":"Switch to English","language-russian":"Switch to Russian",logout:"Logout"},L2={"add-widget":"+ Add Widget","arrange-widgets":"Arrange widgets","no-widgets":"No widgets available",preparing:"preparing…",unavailable:"unavailable","move-up":"Move {label} up","move-down":"Move {label} down","remove-widget":"Remove {label}","preparing-dependencies":"Preparing… installing dependencies","dependency-install-failed":"Dependency install failed"},D2={title:"Settings","general-tab":"General","diagnostics-tab":"Diagnostics","plugins-tab":"Plugins","self-update-tab":"System update","self-update-description":"Check for and safely install a new mndw package, or restore the previous package.","self-update-current":"Running version: {version}","self-update-rollback":"Rollback version: {version}","self-update-available":"Update available: {version}","self-update-check":"Check for updates","self-update-apply":"Apply update","self-update-revert":"Revert","self-update-confirm-update-title":"Confirm update","self-update-confirm-revert-title":"Confirm revert","self-update-confirm-update":"Install update to {version}? mndw will restart.","self-update-confirm-revert":"Revert to {version}? mndw will restart.","self-update-progress-title":"System update","self-update-checking":"Checking…","self-update-preparing":"Preparing update…","self-update-updating":"Updating to {version}…","self-update-reverting":"Reverting to {version}…","self-update-success":"Update complete. Running version: {version}","self-update-busy":"Package manager is busy. Try again shortly.","self-update-no-update":"No update is available. Check again later.","self-update-rollback-unavailable":"No rollback is available.","self-update-unconfirmed":"Update started, but its final state could not be confirmed. Check again.","self-update-unconfirmed-modal":"Unable to confirm self-update completion. Check status again after closing this dialog.","self-update-failure-generic":"Self-update failed. Check again or retry later.","self-update-failure-update-missing":"Update package was not found.","self-update-failure-opkg-install-failed":"Update package installation failed.","self-update-failure-opkg-revert-failed":"Rollback package installation failed.","self-update-failure-rollback-missing":"Rollback package was not found.","self-update-failure-helper-exited":"Update helper stopped before completion.","self-update-failure-unexpected-version":"Device version changed unexpectedly during update.","self-update-failure-state-corrupt":"Self-update state is corrupted. Check again.",general:"General",language:{label:"Language",english:"English",russian:"Русский",pending:"Applying language…"},appearance:"Appearance","dark-theme":"Dark theme",device:"Device","telemetry-label":"Background telemetry","telemetry-toggle":"Enable telemetry","telemetry-description":"Store CPU, memory, and temperature history for 30 days.","telemetry-session-note":"A configured persistent RCI session is required for CPU and memory telemetry.","telemetry-wear-note":"Telemetry collection will increase the load on the storage device where Entware is installed and may accelerate its wear.","telemetry-error":"Could not update background telemetry.",name:"Name:",vendor:"Vendor:",firmware:"Firmware:","device-unavailable":"Device info unavailable.","persistent-rci-title":"Persistent RCI session","persistent-rci-description":"Keep RCI access in mndwd for permitted plugins. Tokens never leave mndwd.","configure-persistent":"Configure persistent controller session","persistent-tokenless-toggle":"Persistent session with controller and extenders","persistent-tokenless-description":"mndwd keeps RCI sessions to this controller and eligible extenders for permitted plugins. No token is required on this firmware.","persistent-needs-token":"Firmware was updated and now requires a controller token. Enter a token to resume the persistent session.","persistent-storage-disabled":"Persistent session storage is disabled.","persistent-storage-decrypt-failed":"Persistent session storage could not be decrypted.","controller-token":"Controller token",test:"Test",save:"Save","clear-controller-session":"Clear controller session","update-firmware-persistent":"Update device firmware to enable persistent RCI sessions.","controller-result":"Controller: {result}","persistent-extenders-title":"Persistent extenders session","persistent-enumeration-stale":"Mesh membership is temporarily stale; live sessions are still monitored.","extender-reason-certificate-invalid":"certificate is invalid","extender-reason-no-auth-token":"auth-token capability unavailable","extender-reason-missing-fqdn":"secure relay name unavailable","extender-state-offline":"offline","extender-state-establishing":"coming online","extender-state-live":"connected","extender-state-dead":"reconnecting","persistent-state-unavailable":"Persistent RCI session state unavailable","persistent-request-failed":"Persistent RCI session request failed","controller-token-rejected":"Controller token rejected","firmware-unsupported":"Device firmware does not support persistent RCI sessions","device-unreachable":"Device unreachable","palette-import-aria-label":"Import palette JSON","backend-capacity":"Backend capacity","backend-approval-title":"Approve backend for {label}","backend-approval-declaration":"declares a backend. Review its capabilities before approving.","backend-approval-deny":"Deny","backend-approval-approve":"Approve","upload-plugin-zip":"Upload plugin ZIP","diagnostics-description":"Download recent daemon and plugin runtime state for troubleshooting.","download-diagnostics":"Download diagnostics",downloading:"Downloading…","diagnostics-failed":"Diagnostics download failed","plugin-manager":{title:"Plugin manager","reload-notice":"Reload to apply plugin changes.","reload-now":"Reload now",later:"Later",loading:"Loading plugins...",retry:"Retry",dismiss:"Dismiss",exec:"Exec",services:"Services","per-plugin-exec-limit":"Per-plugin exec limit","service-protocols":"Service protocols","runtime-status-unavailable":"Runtime status unavailable: {error}","maintenance-busy":"Plugin is busy with another maintenance operation. Try again shortly.","confirming-state":"Confirming plugin state…","operation-finishing":"Plugin operation is still finishing. Refresh to check again.","outcome-unknown":"Could not confirm restart outcome. Refresh to check plugin status.","installed-title":"Installed plugins","no-installed":"No plugins installed.",version:"Version",type:"Type",source:"Source",builtin:"Built-in","installing-dependencies":"Installing dependencies…","dependency-install-failed":"Dependency install failed","version-mismatch":"Version mismatch","load-version-warning":"Built against {versions}. Plugin still loads, but may misbehave with this host.","version-warning":{title:"Version compatibility","sdk-major":"Built for @mndw/sdk {pluginVersion}; this dashboard provides {hostVersion}. The plugin may not work.","sdk-newer-minor":"Built for a newer @mndw/sdk ({pluginVersion}) than this dashboard provides ({hostVersion}). Some features may not work.","shared-major":"Built for {name} {pluginVersion}; this dashboard provides {hostVersion}. The plugin may not work.","install-anyway":"You can still install it."},"endpoint-one":"{count} endpoint","endpoint-many":"{count} endpoints","websocket-one":"{count} websocket","websocket-many":"{count} websockets","persistent-rci-read":"Persistent RCI read","persistent-rci-write":"Persistent RCI write",refresh:"Refresh",enable:"Enable",disable:"Disable","restart-backend":"Restart backend","delete-confirmation":"Delete {label}? This cannot be undone.",cancel:"Cancel","delete-plugin":"Delete plugin",delete:"Delete",backend:"Backend",protocol:"Protocol",incompatible:"incompatible","supported-service-protocols":"Supported service protocols","runtime-state-stopped":"stopped","runtime-state-capacity-blocked":"capacity blocked","runtime-state-starting":"starting","runtime-state-ready":"ready","runtime-state-backoff":"backing off","runtime-state-failed":"failed","pending-title":"Pending approvals","deny-confirmation":"Deny {label}? This cannot be undone.","deny-plugin":"Deny plugin",deny:"Deny",approve:"Approve",routes:"Routes","backend-kind-service":"Runs a resident background process as root","backend-kind-exec":"Runs commands as root on each request",packages:"Installs packages","service-args":"Service arguments","public-routes":"Public routes (reachable from the LAN without sign-in)",permissions:"Permissions","upload-trust-warning":"A plugin gets full administrator access to this router. Install plugins only from authors you trust.","upload-drop":"Drop a plugin ZIP here or choose a file.",uploading:"Uploading plugin...","waiting-approval":"Waiting for approval...","installed-success":'Installed "{label}".',"approved-success":'Approved "{label}".',"choose-zip":"Choose a ZIP file.","empty-zip":"The ZIP file is empty.","zip-too-large":"The ZIP file exceeds the 10 MB upload limit.","upload-target-mismatch":"{filename} targets {archiveTarget}, but this device reports {deviceTarget}. Choose the matching archive."}},H2={cancel:"Cancel",close:"Close",save:"Save",retry:"Retry"},B2={username:"Username",password:"Password",submit:"Login","logging-in":"Logging in…","invalid-credentials":"Invalid credentials","connection-failed":"Connection failed"},$2={region:"Notifications",dismiss:"Dismiss"},U2={tab:"Packages",title:"Package Manager",refresh:"Refresh Metadata",reload:"Reload",search:"Search packages…",all:"All",installed:"Installed",updates:"Updates ({count})",selected:"({count} selected)","with-selected":"With selected:",install:"Install",remove:"Remove",update:"Update",installing:"Installing…",removing:"Removing…",updating:"Updating…","action-failed":"{action} failed","update-available":"Update available",available:"Available","select-package":"Select {name}","select-all":"Select all filtered packages",loading:"Loading…","load-failed":"Failed to load packages",empty:"No packages found","no-match":"No packages match your filter",package:"Package",version:"Version",status:"Status",description:"Description",expand:"Expand {name}",collapse:"Collapse {name}",loaded:"{count} packages loaded","never-refreshed":"Metadata never refreshed","refreshed-ago":"Metadata refreshed {minutes} min ago","detail-failed":"Failed to load package details",size:"Feed size","installed-size":"Installed size","installed-time":"Installed time",dependencies:"Dependencies","confirm-remove-title":"Confirm package removal","confirm-remove":"Remove {names}?",protected:"Protected package","dependency-conflict":"Can't remove {package}: it is required by {dependents}.","dependency-conflict-generic":"Can't remove {package}: it is required by other installed packages."},j2={tab:"Services",title:"Services",description:"Inspect and control device init services.",refresh:"Refresh states",service:"Service",state:"State",autostart:"Autostart",actions:"Actions",start:"Start",stop:"Stop",restart:"Restart",enabled:"Enabled",disabled:"Disabled","enable-at-boot":"Enable at boot","disable-at-boot":"Disable at boot",pid:"PID {pid}","autostart-pinned":"Autostart is fixed by ENABLED= in the script","probe-failed":"Unknown",empty:"No services found","load-failed":"Failed to load services",unavailable:"No service manager available","unavailable-description":"This device does not expose an init service directory.",protected:"Protected service","confirm-title":"Confirm service action",confirm:"{action} service {name}?","confirm-enable-boot":"Enable {name} at boot? The running service is unchanged until reboot.","confirm-disable-boot":"Disable {name} at boot? The running service is unchanged until reboot."},F2={"device-timeout":"The device did not respond.","invalid-manifest":"The plugin manifest is invalid.","invalid-zip":"The file is not a valid ZIP archive.","manifest-missing":"The archive has no manifest.json at its root.","unsupported-manifest-version":"This plugin manifest version is no longer supported.",conflict:"A plugin with that name already exists.","upload-too-large":"The plugin exceeds the 10 MB upload limit.","opkg-failed":"Installing the plugin's system packages failed.","daemon-failed":"Starting the plugin's backend failed.",unauthorized:"Your session has expired. Please log in again.","service-capacity":"No service capacity is available. Stop another backend and try again.","backend-busy":"The backend is busy. Try again shortly.","backend-unavailable":"The backend is unavailable.","backend-incompatible":"This backend requires an unsupported protocol version.","backend-maintenance":"The backend is being updated. Try again shortly.","controller-session-unavailable":"Controller token session is unavailable.","rci-socket-start-failed":"Persistent RCI session socket could not start. Try again."},Xm={app:z2,nav:I2,dashboard:L2,settings:D2,common:H2,login:B2,toast:$2,packages:U2,services:j2,errors:F2},G2={loading:"Загрузка…",error:"Произошла ошибка."},V2={"toggle-menu":"Переключить меню",close:"Закрыть навигацию",dashboard:"Панель управления","package-manager":"Entware",plugins:"Плагины",settings:"Настройки","light-theme":"Включить светлую тему","dark-theme":"Включить тёмную тему","color-theme":"Переключить цветовую тему",language:"Язык","language-english":"Переключить на английский","language-russian":"Переключить на русский",logout:"Выйти"},Z2={"add-widget":"+ Добавить виджет","arrange-widgets":"Упорядочить виджеты","no-widgets":"Нет доступных виджетов",preparing:"подготовка…",unavailable:"недоступен","move-up":"Переместить {label} выше","move-down":"Переместить {label} ниже","remove-widget":"Удалить {label}","preparing-dependencies":"Подготовка… установка зависимостей","dependency-install-failed":"Не удалось установить зависимости"},W2={title:"Настройки","general-tab":"Общие","diagnostics-tab":"Диагностика","plugins-tab":"Плагины","self-update-tab":"Обновление системы","self-update-description":"Проверяйте и безопасно устанавливайте новую версию mndw или восстанавливайте предыдущую.","self-update-current":"Текущая версия: {version}","self-update-rollback":"Версия для отката: {version}","self-update-available":"Доступно обновление: {version}","self-update-check":"Проверить обновления","self-update-apply":"Установить обновление","self-update-revert":"Откатить","self-update-confirm-update-title":"Подтвердите обновление","self-update-confirm-revert-title":"Подтвердите откат","self-update-confirm-update":"Установить обновление до версии {version}? mndw будет перезапущен.","self-update-confirm-revert":"Откатить до версии {version}? mndw будет перезапущен.","self-update-progress-title":"Обновление системы","self-update-checking":"Проверка…","self-update-preparing":"Подготовка обновления…","self-update-updating":"Обновление до {version}…","self-update-reverting":"Откат до {version}…","self-update-success":"Обновление завершено. Текущая версия: {version}","self-update-busy":"Менеджер пакетов занят. Повторите попытку позже.","self-update-no-update":"Обновление недоступно. Повторите проверку позже.","self-update-rollback-unavailable":"Откат недоступен.","self-update-unconfirmed":"Обновление запущено, но результат не подтверждён. Проверьте состояние ещё раз.","self-update-unconfirmed-modal":"Не удалось подтвердить завершение обновления. Закройте диалог и проверьте состояние ещё раз.","self-update-failure-generic":"Не удалось обновить систему. Повторите попытку позже.","self-update-failure-update-missing":"Пакет обновления не найден.","self-update-failure-opkg-install-failed":"Не удалось установить пакет обновления.","self-update-failure-opkg-revert-failed":"Не удалось установить пакет отката.","self-update-failure-rollback-missing":"Пакет отката не найден.","self-update-failure-helper-exited":"Помощник обновления завершился раньше времени.","self-update-failure-unexpected-version":"Версия устройства неожиданно изменилась во время обновления.","self-update-failure-state-corrupt":"Состояние обновления повреждено. Выполните проверку снова.",general:"Общие",language:{label:"Язык",english:"English",russian:"Русский",pending:"Применение языка…"},appearance:"Внешний вид","dark-theme":"Тёмная тема",device:"Устройство","telemetry-label":"Фоновая телеметрия","telemetry-toggle":"Включить телеметрию","telemetry-description":"Хранить историю CPU, памяти и температуры в течение 30 дней.","telemetry-session-note":"Для телеметрии CPU и памяти требуется настроенная постоянная сессия RCI.","telemetry-wear-note":"Сбор телеметрии увеличит нагрузку на накопитель, на котором установлен Entware, и может ускорить его износ.","telemetry-error":"Не удалось обновить фоновую телеметрию.",name:"Имя:",vendor:"Производитель:",firmware:"Прошивка:","device-unavailable":"Информация об устройстве недоступна.","persistent-rci-title":"Постоянная сессия rci/","persistent-rci-description":"Сохранить доступ rci/ в mndwd для разрешённых плагинов. Токены не покидают mndwd.","configure-persistent":"Настроить постоянный сеанс контроллера","persistent-tokenless-toggle":"Постоянная сессия с контроллером и экстендерами","persistent-tokenless-description":"mndwd поддерживает RCI-сессии с контроллером и подходящими экстендерами для разрешённых плагинов. На этой прошивке токен не требуется.","persistent-needs-token":"Прошивка обновлена и теперь требует токен контроллера. Введите токен, чтобы возобновить постоянную сессию.","persistent-storage-disabled":"Хранилище постоянных сеансов отключено.","persistent-storage-decrypt-failed":"Не удалось расшифровать хранилище постоянных сеансов.","controller-token":"Токен контроллера",test:"Проверить",save:"Сохранить","clear-controller-session":"Очистить сеанс контроллера","update-firmware-persistent":"Обновите прошивку устройства для включения постоянных сеансов rci/.","controller-result":"Контроллер: {result}","persistent-extenders-title":"Постоянный сеанс расширителей","persistent-enumeration-stale":"Список mesh временно устарел; активные сеансы всё ещё проверяются.","extender-reason-certificate-invalid":"сертификат недействителен","extender-reason-no-auth-token":"возможность auth-token недоступна","extender-reason-missing-fqdn":"имя защищённого реле недоступно","extender-state-offline":"не в сети","extender-state-establishing":"подключается","extender-state-live":"подключён","extender-state-dead":"переподключается","persistent-state-unavailable":"Состояние постоянного сеанса rci/ недоступно","persistent-request-failed":"Не удалось выполнить запрос постоянного сеанса rci/","controller-token-rejected":"Токен контроллера отклонён","firmware-unsupported":"Прошивка устройства не поддерживает постоянные сеансы rci/","device-unreachable":"Устройство недоступно","palette-import-aria-label":"Импорт JSON-палитры","backend-capacity":"Ёмкость серверной части","backend-approval-title":"Подтвердить серверную часть для {label}","backend-approval-declaration":"объявляет серверную часть. Проверьте её возможности перед подтверждением.","backend-approval-deny":"Отклонить","backend-approval-approve":"Подтвердить","upload-plugin-zip":"Загрузить ZIP плагина","diagnostics-description":"Скачать состояние демона и плагинов для диагностики.","download-diagnostics":"Скачать диагностику",downloading:"Скачивание…","diagnostics-failed":"Не удалось скачать диагностику","plugin-manager":{title:"Менеджер плагинов","reload-notice":"Перезагрузите страницу, чтобы применить изменения плагинов.","reload-now":"Перезагрузить сейчас",later:"Позже",loading:"Загрузка плагинов…",retry:"Повторить",dismiss:"Скрыть",exec:"Exec",services:"Сервисы","per-plugin-exec-limit":"Лимит Exec для плагина","service-protocols":"Протоколы сервисов","runtime-status-unavailable":"Состояние серверной части недоступно: {error}","maintenance-busy":"Плагин занят другой операцией обслуживания. Повторите попытку позже.","confirming-state":"Проверка состояния плагина…","operation-finishing":"Операция с плагином ещё выполняется. Обновите страницу, чтобы проверить результат.","outcome-unknown":"Не удалось подтвердить результат перезапуска. Обновите страницу, чтобы проверить состояние плагина.","installed-title":"Установленные плагины","no-installed":"Плагины не установлены.",version:"Версия",type:"Тип",source:"Источник",builtin:"Встроенный","installing-dependencies":"Установка зависимостей…","dependency-install-failed":"Не удалось установить зависимости","version-mismatch":"Несоответствие версии","load-version-warning":"Собрано для версий {versions}. Плагин всё ещё загружается, но может работать неправильно с этим хостом.","version-warning":{title:"Совместимость версий","sdk-major":"Собрано для @mndw/sdk {pluginVersion}; эта панель предоставляет {hostVersion}. Плагин может не работать.","sdk-newer-minor":"Собрано для более новой версии @mndw/sdk ({pluginVersion}), чем предоставляет эта панель ({hostVersion}). Некоторые функции могут не работать.","shared-major":"Собрано для {name} {pluginVersion}; эта панель предоставляет {hostVersion}. Плагин может не работать.","install-anyway":"Плагин всё равно можно установить."},"endpoint-one":"{count} конечная точка","endpoint-many":"{count} конечных точек","websocket-one":"{count} веб-сокет","websocket-many":"{count} веб-сокетов","persistent-rci-read":"Чтение через постоянный RCI","persistent-rci-write":"Запись через постоянный RCI",refresh:"Обновить",enable:"Включить",disable:"Отключить","restart-backend":"Перезапустить серверную часть","delete-confirmation":"Удалить {label}? Это действие нельзя отменить.",cancel:"Отмена","delete-plugin":"Удалить плагин",delete:"Удалить",backend:"Серверная часть",protocol:"Протокол",incompatible:"несовместима","supported-service-protocols":"Поддерживаемые протоколы сервисов","runtime-state-stopped":"остановлена","runtime-state-capacity-blocked":"заблокирована из-за нехватки ресурсов","runtime-state-starting":"запускается","runtime-state-ready":"готова","runtime-state-backoff":"ожидает перезапуска","runtime-state-failed":"ошибка","pending-title":"Ожидающие подтверждения","deny-confirmation":"Отклонить {label}? Это действие нельзя отменить.","deny-plugin":"Отклонить плагин",deny:"Отклонить",approve:"Подтвердить",routes:"Маршруты","backend-kind-service":"Запускает постоянный фоновый процесс от root","backend-kind-exec":"Запускает команды от root на каждый запрос",packages:"Устанавливает пакеты","service-args":"Аргументы сервиса","public-routes":"Публичные маршруты (доступны из локальной сети без входа)",permissions:"Разрешения","upload-trust-warning":"Плагин получает полный административный доступ к роутеру. Устанавливайте плагины только от авторов, которым доверяете.","upload-drop":"Перетащите ZIP плагина сюда или выберите файл.",uploading:"Загрузка плагина…","waiting-approval":"Ожидание подтверждения…","installed-success":"Плагин «{label}» установлен.","approved-success":"Плагин «{label}» подтверждён.","choose-zip":"Выберите ZIP-файл.","empty-zip":"ZIP-файл пуст.","zip-too-large":"Размер ZIP-файла превышает лимит загрузки 10 МБ.","upload-target-mismatch":"Файл {filename} предназначен для {archiveTarget}, но устройство сообщает {deviceTarget}. Выберите подходящий архив."}},q2={cancel:"Отмена",close:"Закрыть",save:"Сохранить",retry:"Повторить"},X2={username:"Имя пользователя",password:"Пароль",submit:"Войти","logging-in":"Выполняется вход…","invalid-credentials":"Неверные учётные данные","connection-failed":"Ошибка соединения"},Y2={region:"Уведомления",dismiss:"Закрыть"},J2={tab:"Пакеты",title:"Менеджер пакетов",refresh:"Обновить метаданные",reload:"Перезагрузить",search:"Поиск пакетов…",all:"Все",installed:"Установленные",updates:"Обновления ({count})",selected:"(выбрано: {count})","with-selected":"С выбранными:",install:"Установить",remove:"Удалить",update:"Обновить",installing:"Установка…",removing:"Удаление…",updating:"Обновление…","action-failed":"Не удалось выполнить: {action}","update-available":"Доступно обновление",available:"Доступен","select-package":"Выбрать {name}","select-all":"Выбрать все отфильтрованные пакеты",loading:"Загрузка…","load-failed":"Не удалось загрузить пакеты",empty:"Пакеты не найдены","no-match":"Нет пакетов, соответствующих фильтру",package:"Пакет",version:"Версия",status:"Состояние",description:"Описание",expand:"Развернуть {name}",collapse:"Свернуть {name}",loaded:"Загружено пакетов: {count}","never-refreshed":"Метаданные ещё не обновлялись","refreshed-ago":"Метаданные обновлены {minutes} мин назад","detail-failed":"Не удалось загрузить сведения о пакете",size:"Размер в репозитории","installed-size":"Установленный размер","installed-time":"Время установки",dependencies:"Зависимости","confirm-remove-title":"Подтвердите удаление пакета","confirm-remove":"Удалить {names}?",protected:"Защищённый пакет","dependency-conflict":"Невозможно удалить {package}: от него зависит {dependents}.","dependency-conflict-generic":"Невозможно удалить {package}: от него зависят другие установленные пакеты."},K2={tab:"Сервисы",title:"Сервисы",description:"Просмотр и управление сервисами устройства.",refresh:"Обновить состояния",service:"Сервис",state:"Состояние",autostart:"Автозапуск",actions:"Действия",start:"Запустить",stop:"Остановить",restart:"Перезапустить",enabled:"Включён",disabled:"Выключен","enable-at-boot":"Включать при загрузке","disable-at-boot":"Не включать при загрузке",pid:"PID {pid}","autostart-pinned":"Автозапуск задан строкой ENABLED= в скрипте","probe-failed":"Неизвестно",empty:"Сервисы не найдены","load-failed":"Не удалось загрузить сервисы",unavailable:"Менеджер сервисов недоступен","unavailable-description":"На устройстве нет доступного каталога init-сервисов.",protected:"Защищённый сервис","confirm-title":"Подтвердите действие с сервисом",confirm:"{action} сервис {name}?","confirm-enable-boot":"Включать {name} при загрузке? Работающий сервис не изменится до перезагрузки.","confirm-disable-boot":"Не включать {name} при загрузке? Работающий сервис не изменится до перезагрузки."},Q2={"device-timeout":"Устройство не отвечает.","invalid-manifest":"Манифест плагина недействителен.","invalid-zip":"Файл не является ZIP-архивом.","manifest-missing":"В архиве нет manifest.json в корне.","unsupported-manifest-version":"Версия манифеста плагина больше не поддерживается.",conflict:"Плагин с таким именем уже существует.","upload-too-large":"Плагин превышает лимит загрузки 10 МБ.","opkg-failed":"Не удалось установить системные пакеты плагина.","daemon-failed":"Не удалось запустить серверную часть плагина.",unauthorized:"Сеанс истёк. Войдите снова.","service-capacity":"Нет свободных сервисных ресурсов.","backend-busy":"Серверная часть занята. Повторите позже.","backend-unavailable":"Серверная часть недоступна.","backend-incompatible":"Протокол серверной части не поддерживается.","backend-maintenance":"Серверная часть обновляется. Повторите позже.","controller-session-unavailable":"Сеанс токена контроллера недоступен.","rci-socket-start-failed":"Не удалось запустить сокет сеанса RCI. Повторите попытку."},eT={app:G2,nav:V2,dashboard:Z2,settings:W2,common:q2,login:X2,toast:Y2,packages:J2,services:K2,errors:Q2},md="mndw",Ua=`${md}:plugin`,Ym=["en","ru"],Jm=5e3,tT=6e4,nT=24e4,vd=Object.freeze({theme:"dark",locale:"en"}),bd=Object.freeze({deviceName:"Unknown",vendor:"Unknown",manufacturer:"Unknown",model:"Unknown",series:"Unknown",region:"Unknown",hwId:"Unknown",hwVersion:"Unknown",firmwareVersion:"Unknown",firmwareRelease:"Unknown",features:Object.freeze([]),components:Object.freeze([]),switchports:Object.freeze({list:Object.freeze([]),layout:Object.freeze([]),hasPortStats:!1}),usb:Object.freeze({ports:Object.freeze([])})}),Km="/api/mgmt/list",rT="/api/mgmt/permission",iT="/api/mgmt/upload",_h="/api/mgmt/approve",sT="/api/mgmt/deny",oT="/api/mgmt/enable",aT="/api/mgmt/disable",lT="/api/mgmt/delete",cT="/api/mgmt/restart",uT="/api/mgmt/runtime",kc="/api/mgmt/palette",dT="/api/mgmt/device-hardware",wh="/api/mgmt/telemetry",fT="/api/mgmt/opkg/list",hT="/api/mgmt/opkg/install",pT="/api/mgmt/opkg/remove",gT="/api/mgmt/opkg/update",mT="/api/mgmt/opkg/upgrade",vT="/api/mgmt/opkg/info",bT="/api/mgmt/self-update/status",_T="/api/mgmt/self-update/check",wT="/api/mgmt/self-update/apply",yT="/api/mgmt/self-update/revert",kT="/api/mgmt/service/list",ET="/api/mgmt/service/status",ST="/api/mgmt/service/start",xT="/api/mgmt/service/stop",TT="/api/mgmt/service/restart",CT="/api/mgmt/service/set-enabled",yh={builtin:"/plugins/",user:"/user-plugins/"},PT={A:"Ȧ",B:"Ḃ",C:"Ç",D:"Ḋ",E:"Ḗ",F:"Ḟ",G:"Ġ",H:"Ḧ",I:"Ī",J:"Ĵ",K:"Ḱ",L:"Ŀ",M:"Ṁ",N:"Ṅ",O:"Ö",P:"Ṕ",Q:"Q",R:"Ŕ",S:"Ṡ",T:"Ṫ",U:"Ū",V:"Ṽ",W:"Ẇ",X:"Ẋ",Y:"Ẏ",Z:"Ż",a:"ȧ",b:"ḃ",c:"ç",d:"ḋ",e:"ḗ",f:"ḟ",g:"ġ",h:"ḧ",i:"ī",j:"ĵ",k:"ḱ",l:"ŀ",m:"ṁ",n:"ṅ",o:"ö",p:"ṕ",q:"q",r:"ŕ",s:"ṡ",t:"ṫ",u:"ū",v:"ṽ",w:"ẇ",x:"ẋ",y:"ẏ",z:"ż"};function RT(t){return[...t].map(e=>PT[e]??e).join("")}function AT(t){const e=t.replace(/\b\w+\b/g,n=>{const r="~".repeat(Math.max(1,Math.ceil(n.length*.35)));return`${n}${r}`});return`[${RT(e)}]`}function Qm(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>[e,typeof n=="string"?AT(n):Qm(n)]))}function MT(){const t=new ob(1);let e=!1;const n={ended$:t.asObservable(),get ended(){return e},end:()=>{e||(e=!0,t.next(),t.complete())}};return Object.freeze(n)}function Ec(t,e,n){return new _a(r=>{if(n.ended){r.complete();return}let i;const s=()=>{const a=i;i=void 0,a==null||a()},o=n.ended$.subscribe(()=>{s(),r.complete()});return r.next(t()),!r.closed&&!n.ended&&(i=e(a=>r.next(a)),n.ended&&s()),()=>{o.unsubscribe(),s()}})}function OT(t,e){return new _a(n=>{if(e.ended){n.complete();return}let r;const i=()=>{const o=r;r=void 0,o==null||o()},s=e.ended$.subscribe(()=>{i(),n.complete()});return r=t(()=>n.next()),e.ended&&i(),()=>{s.unsubscribe(),i()}})}const mu=3e3;function NT(t={}){return{catalogSuccessCache:new Map,catalogCells:new Set,activeGeneration:void 0,nextGenerationToken:0,fetchCatalog:t.fetchCatalog??LT,now:t.now??Date.now,setTimeout:t.setTimeout??globalThis.setTimeout.bind(globalThis),queueMicrotask:t.queueMicrotask??globalThis.queueMicrotask.bind(globalThis)}}function Sc(t,e){return`${t.name}/${t.version}/${e}`}function zT(t,e){const n=t.locales[e];if(n!==void 0)return`${t.baseUrl.replace(/\/$/,"")}/${n}?v=${encodeURIComponent(t.version)}`}function IT(t){return t.split("-")[0]}function ev(t,e){if(t.locales[e]!==void 0)return e;const n=IT(e);return n!==void 0&&t.locales[n]!==void 0?n:t.defaultLocale}async function LT(t){const e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);return Dw(await e.json(),t)}async function kh(t,e,n,r){const i=t.catalogSuccessCache.get(Sc(e,n));if(i!==void 0)return i;const s=zT(e,n);if(s===void 0)throw new Error(`Plugin "${e.name}" does not declare a catalog for ${n}`);try{const o=await t.fetchCatalog(s);if(r!==void 0&&t.now()>r)throw new Error("catalog request completed after deadline");return t.catalogSuccessCache.set(Sc(e,n),o),o}catch(o){throw t.catalogSuccessCache.delete(Sc(e,n)),o}}function DT(t,e){const n=Math.max(0,e-t.now());return new Promise((r,i)=>{t.setTimeout(()=>i(new Error("catalog deadline exceeded")),n)})}async function tv(t,e,n,r){var d,h;const i=ev(e,n),s=e.defaultLocale,o=kh(t,e,i,r),a=i===s?o:kh(t,e,s,r),l=await Promise.race([Promise.allSettled([o,a]),DT(t,r)]).catch(()=>{}),c=Array.isArray(l)&&((d=l[0])==null?void 0:d.status)==="fulfilled"?l[0].value:void 0,u=Array.isArray(l)&&((h=l[1])==null?void 0:h.status)==="fulfilled"?l[1].value:void 0;return{hostLocale:n,resolvedCatalogLocale:i,...c===void 0?{}:{primaryCatalog:c},...u===void 0?{}:{defaultCatalog:u},fallbackStatus:c!==void 0?"primary":u!==void 0?"default":"key"}}function nv(t,e){return{hostLocale:e,resolvedCatalogLocale:ev(t,e),fallbackStatus:"key"}}class HT{constructor(e,n){G(this,"source");G(this,"state");G(this,"listeners",new Set);this.source=Object.freeze({...e,locales:Object.freeze({...e.locales})}),this.state=nv(this.source,n)}readCurrentState(){return this.state}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}commit(e,n=!0){if(this.state=Object.freeze(e),n)for(const r of this.listeners)r()}}function BT(t,e,n){const r=new HT(e,n);return t.catalogCells.add(r),t.activeGeneration!==void 0&&t.activeGeneration.add(r),r}function $T(t,e){t.catalogCells.add(e)}function UT(t,e){t.catalogCells.delete(e)}function jT(t){var e;(e=t.activeGeneration)==null||e.discard(),t.catalogCells.clear(),t.activeGeneration=void 0}function rv(t,e,n,r){if(r!==void 0)return{name:t,version:e,baseUrl:n,defaultLocale:r.defaultLocale,locales:r.locales}}async function FT(t,e,n,r=mu){e.commit(await tv(t,e.source,n,t.now()+r))}class GT{constructor(e,n){G(this,"runtime");G(this,"token");G(this,"targetLocale");G(this,"deadline");G(this,"promise");G(this,"pending",0);G(this,"initialEnrollmentDone",!1);G(this,"settled",!1);G(this,"cells",new Map);G(this,"resolvedStates",new Map);G(this,"resolvePromise");this.runtime=e,this.token=++e.nextGenerationToken,this.targetLocale=n,this.deadline=e.now()+mu,this.promise=new Promise(r=>{this.resolvePromise=r}),e.setTimeout(()=>this.settle(),mu)}add(e){if(this.settled||this.runtime.now()>=this.deadline||this.cells.has(e))return;this.pending+=1;const n=tv(this.runtime,e.source,this.targetLocale,this.deadline).catch(()=>nv(e.source,this.targetLocale));this.cells.set(e,n),n.then(r=>{this.resolvedStates.set(e,r)}).finally(()=>{this.pending-=1,this.settle()})}closeEnrollment(){this.initialEnrollmentDone=!0,this.settle()}discard(){this.settled||(this.settled=!0,this.resolvePromise())}settle(){this.settled||!this.initialEnrollmentDone||this.pending>0||this.runtime.queueMicrotask(()=>{this.settled||!this.initialEnrollmentDone||this.pending>0||(this.settled=!0,this.resolvePromise())})}commit(e){if(this.runtime.activeGeneration===this){for(const[n,r]of this.resolvedStates)n.commit(r,!1);e();for(const n of this.resolvedStates.keys()){const r=this.resolvedStates.get(n);this.runtime.activeGeneration===this&&r!==void 0&&n.commit(r)}this.runtime.activeGeneration=void 0}}}function VT(t,e){if(t.activeGeneration!==void 0)throw new Error("A plugin catalog generation is already pending");const n=new GT(t,e);t.activeGeneration=n;for(const r of t.catalogCells)n.add(r);return n.closeEnrollment(),n}function ZT(t,e){t.commit(e)}function WT(t,e){e.discard(),t.activeGeneration===e&&(t.activeGeneration=void 0)}function qT(t){return t.activeGeneration}function XT(t,e,n,r){var o,a;const i=t==null?void 0:t.readCurrentState(),s=((o=i==null?void 0:i.primaryCatalog)==null?void 0:o[e])??((a=i==null?void 0:i.defaultCatalog)==null?void 0:a[e])??e;return fm(s,n,r)}function YT(t,e,n,r){const i={get locale(){return e()},direction:"ltr",t:(s,o)=>XT(t,s,o,e()),formatNumber:(s,o)=>new Intl.NumberFormat(no(e()),o).format(s),formatDate:(s,o)=>new Intl.DateTimeFormat(no(e()),o).format(s),change$:OT((t==null?void 0:t.subscribe.bind(t))??n,r)};return Object.freeze(i)}function JT(t={}){const e=NT(t);return{createPluginCatalogCell:(n,r)=>BT(e,n,r),registerPluginCatalogCell:n=>$T(e,n),unregisterPluginCatalogCell:n=>UT(e,n),clearPluginCatalogCells:()=>jT(e),loadInitialPluginCatalog:(n,r,i)=>FT(e,n,r,i),preparePluginCatalogGeneration:n=>VT(e,n),commitPluginCatalogGeneration:(n,r)=>ZT(n,r),discardPluginCatalogGeneration:n=>WT(e,n),getActivePluginCatalogGeneration:()=>qT(e)}}const Do=JT(),iv=`${md}:locale`,xc={en:Xm,ru:eT};Qm(Xm);function sv(t){try{if(typeof Intl.getCanonicalLocales=="function")return Intl.getCanonicalLocales(t)[0];if(typeof Intl.Locale=="function")return new Intl.Locale(t).toString()}catch{}}function KT(){return!1}function _d(){return Ym}function ov(t){const e=sv(t);return _d().find(n=>n===e)}function Eh(t){const e=sv(t);if(e!==void 0)return ov(e)??_d().find(n=>n===e.split("-")[0])}function QT(t){try{return(t==null?void 0:t.getItem(iv))??void 0}catch{return}}function eC(){const t=[...navigator.languages];return navigator.language!==""&&t.push(navigator.language),t}function tC(t){const e=t.catalog,n=t.storage??globalThis.localStorage,r=t.document??globalThis.document,i=t.setUiLocale??eb;let s=Ym[0],o=!1;const a=new Set,l=new Set,c=m=>{r.documentElement.lang=m,r.documentElement.dir="ltr"},u=m=>{s=m,i(m),c(m);for(const _ of a)_(m)};return Object.freeze({initLocale:()=>{const m=QT(n),k=(m===void 0?void 0:ov(m))??eC().map(Eh).find(O=>O!==void 0)??"en";return u(k),k},getLocale:()=>s,setLocale:async m=>{const _=Eh(m)??"en";if(_===s)return;o=!0;for(const O of l)O(!0);const k=e.preparePluginCatalogGeneration(_);await k.promise,e.commitPluginCatalogGeneration(k,()=>{u(_);try{n==null||n.setItem(iv,_)}catch{}}),o=!1;for(const O of l)O(!1)},subscribeLocale:m=>(a.add(m),()=>{a.delete(m)}),isLocaleSwitchPending:()=>o,subscribeLocalePending:m=>(l.add(m),()=>{l.delete(m)}),hostT:(m,_,k=s)=>{const O=xc[k]??xc.en,I=Sh(O,m)??Sh(xc.en,m)??m;return _===void 0?I:fm(I,_,k)},hostFormatNumber:(m,_)=>new Intl.NumberFormat(no(s),_).format(m),hostFormatDate:(m,_)=>new Intl.DateTimeFormat(no(s),_).format(m),getAvailableLocales:_d,isPseudoLocaleEnabled:KT})}const Ho=tC({catalog:Do}),nC=Ho,os=()=>Ho.getLocale(),vu=t=>Ho.subscribeLocale(t),rC=t=>Ho.subscribeLocalePending(t),Rn=(t,e,n)=>Ho.hostT(t,e,n);function Sh(t,e){let n=t;for(const r of e.split(".")){if(typeof n=="string")return;n=n[r]}return typeof n=="string"?n:void 0}const av=`${md}:theme`,bu="dark";let Ur=bu;const _u=new Set;function iC(){try{const t=localStorage.getItem(av);return t==="light"||t==="dark"?t:bu}catch{return bu}}function lv(t){document.documentElement.dataset.theme=t}function cv(t){for(const e of _u)e(t)}function sC(){return Ur=iC(),lv(Ur),cv(Ur),Ur}function ja(){return Ur}function oC(t){if(t!==Ur){Ur=t,lv(t);try{localStorage.setItem(av,t)}catch{}cv(t)}}function ji(){oC(Ur==="dark"?"light":"dark")}function uv(t){return _u.add(t),()=>{_u.delete(t)}}function xh(t){return t.split(",").map(e=>e.trim()).filter(e=>e!=="")}const aC=["/","/login","/packages","/packages/services","/settings"],lC=new Set(aC);function dv(t){return lC.has(t)}const cC=de().regex(/^[a-z0-9][a-z0-9-]*$/,{message:"name must be lowercase alphanumeric with hyphens (e.g. my-widget)"}),uC=t=>!t.startsWith("/")&&!t.includes("..")&&!t.includes("\\")&&!t.split("/").some(e=>e==="."||e===".."),fv=t=>{const e=t.split("/").filter(Boolean);return!!e[e.length-1]},wd=de().min(1).refine(uC,{message:"must be a safe relative path"}),dC=wd.refine(fv,{message:"entry must include a file name"}),wu=t=>{try{if(typeof Intl.getCanonicalLocales=="function")return Intl.getCanonicalLocales(t)[0];if(typeof Intl.Locale=="function")return new Intl.Locale(t).toString()}catch{}},fC=de().min(1).superRefine((t,e)=>{const n=wu(t);n===void 0?e.addIssue({code:"custom",message:"must be a valid BCP-47 locale tag"}):n!==t&&e.addIssue({code:"custom",message:`must use canonical BCP-47 spelling (${n})`})}),hC=wd.refine(t=>t.endsWith(".json"),{message:"catalog path must end with .json"}),pC=Ue({defaultLocale:fC,locales:ps(de(),hC)}).strict().superRefine((t,e)=>{const n=Object.keys(t.locales);n.length===0&&e.addIssue({code:"custom",path:["locales"],message:"locales must contain at least one locale"});const r=new Map;for(const s of n){const o=wu(s);if(o===void 0){e.addIssue({code:"custom",path:["locales",s],message:"must be a valid BCP-47 locale tag"});continue}o!==s&&e.addIssue({code:"custom",path:["locales",s],message:`must use canonical BCP-47 spelling (${o})`});const a=r.get(o);a!==void 0&&a!==s?e.addIssue({code:"custom",path:["locales",s],message:`canonical locale collides with ${a}`}):r.set(o,s)}const i=wu(t.defaultLocale);i!==void 0&&!r.has(i)&&e.addIssue({code:"custom",path:["defaultLocale"],message:"defaultLocale must be present in locales"})}),hv=de().regex(/^[a-z0-9][a-z0-9+_.-]*$/),pv=Kt(["session","public"]).default("session"),gC=de().transform(t=>t.toUpperCase()).pipe(Kt(["GET","HEAD","POST","PUT","PATCH","DELETE"])),gv=t=>{if(t.length===0||t.startsWith("/")||t.includes("\\")||t.includes("?")||t.includes("#"))return!1;let e;try{e=decodeURIComponent(t)}catch{return!1}if(e!==t||e.includes("%")||e.startsWith("/")||e.includes("\\"))return!1;const n=e.split("/");return n.every(r=>r.length>0&&r!=="."&&r!=="..")&&n[0]!=="_mndw"},mv=wd.refine(fv,{message:"command must include a file name"}).refine(t=>!t.split("/").some(e=>e==="."||e===".."),{message:"command must not contain dot segments"}),mC=de().min(1).refine(t=>[...t].every(e=>{const n=e.codePointAt(0)??0;return n>31&&n!==127}),{message:"args must not contain control characters"}),vv=Ue({id:de().min(1),transport:Pt("http"),method:gC,path:de().refine(gv,{message:"path must be canonical and safe"}),access:pv}),vC=Ue({id:de().min(1),transport:Pt("websocket"),path:de().refine(gv,{message:"path must be canonical and safe"}),access:pv,protocols:vt(de().min(1)).optional()}),bC=vv.extend({command:mv}),bv=(t,e)=>{const n=t.map(i=>i.id);new Set(n).size!==n.length&&e.addIssue({code:"custom",message:"backend.routes contains duplicate id"});const r=t.map(i=>i.transport==="http"?`${i.transport}:${i.method}:${i.path}`:`${i.transport}:${i.path}`);new Set(r).size!==r.length&&e.addIssue({code:"custom",message:"backend.routes contains duplicate route tuple"});for(const i of t)i.transport==="http"&&i.access==="public"&&!["GET","HEAD"].includes(i.method??"")&&e.addIssue({code:"custom",message:"public HTTP routes may only use GET or HEAD"})},_C=Ue({kind:Pt("exec"),packages:vt(hv).optional(),routes:vt(bC).min(1)}).strict().superRefine((t,e)=>{bv(t.routes,e)}),wC=Ue({kind:Pt("service"),protocolVersion:Vt().int().positive(),command:mv,args:vt(mC).optional(),packages:vt(hv).optional(),routes:vt($r([vv,vC])).min(1)}).strict().superRefine((t,e)=>{bv(t.routes,e)}),yC=$r([_C,wC]),Th=Vt().int().positive().max(12),Ch=Vt().int().positive(),kC=Pt(1).describe("Manifest format version. Must be 1."),EC=cC.describe("Unique plugin id used as the on-disk folder and URL segment."),SC=de().min(1).describe("Semver-ish version string."),xC=de().min(1).describe("Human-readable name shown in the dashboard or navigation."),TC=dC.describe("Relative path to the bundled entry module."),CC=de().optional().describe("Optional icon name."),PC=pm,RC=vt(PC).superRefine((t,e)=>{new Set(t).size!==t.length&&e.addIssue({code:"custom",message:"permissions contains duplicate permission"})}),AC=Ue({w:Th,h:Ch,minW:Th.optional(),minH:Ch.optional()}).refine(t=>t.minW===void 0||t.minW<=t.w,{message:"size.minW must be less than or equal to size.w",path:["minW"]}).refine(t=>t.minH===void 0||t.minH<=t.h,{message:"size.minH must be less than or equal to size.h",path:["minH"]}),MC=de().regex(/^\/[^/?#*]+$/).refine(t=>!dv(t),{message:"route is reserved by the host"}),_v={manifestVersion:kC,name:EC,version:SC,label:xC,entry:TC,icon:CC,permissions:RC.optional(),i18n:pC.optional(),backend:yC.optional()},OC=Ue({..._v,type:Pt("widget"),size:AC,fixedHeight:xr().optional()}),NC=Ue({..._v,type:Pt("page"),route:MC}),zC=rd("type",[OC,NC]);class IC extends Error{constructor(n,r){const i=r.map(o=>({path:o.path.length===0?"<root>":o.path.join("."),message:o.message})),s=i.map(o=>`${o.path}: ${o.message}`).join("; ");super(`Invalid manifest for "${n}": ${s}`);G(this,"issues");this.issues=i}}function LC(t){const e=zC.safeParse(t);if(!e.success){const n=typeof t=="object"&&t!==null&&typeof t.name=="string"?t.name:"unknown";throw new IC(n,e.error.issues)}return e.data}Ue({cid:de().optional(),mac:de().optional(),ip:de().optional(),fqdn:de().optional(),"fqdn-certificate-valid":xr().optional(),capabilities:ps(de(),nu()).optional()}).passthrough();const DC=[{specifiers:["@rci-tools/core"],bundle:"rci-tools-core",version:"0.6.0",entryPoint:"@rci-tools/core",external:["rxjs","hash-wasm"],framework:"base"},{specifiers:["rxjs"],bundle:"rxjs",version:"7.8.2",entryPoint:"rxjs",framework:"base"},{specifiers:["rxjs/operators"],bundle:"rxjs-operators",version:"7.8.2",entryPoint:"rxjs/operators",framework:"base"},{specifiers:["hash-wasm"],bundle:"hash-wasm",version:"4.12.0",entryPoint:"hash-wasm",framework:"base"},{specifiers:["d3"],bundle:"d3",version:"7.9.0",entryPoint:"d3",framework:"base"},{specifiers:["@mndw/ui"],bundle:"mndw-ui",version:"0.1.3",entryPoint:"@mndw/ui",external:["d3"],framework:"base"},{specifiers:["vue"],bundle:"vue",version:"3.5.39",entryPoint:"vue",banner:"var __VUE_OPTIONS_API__=true,__VUE_PROD_DEVTOOLS__=false,__VUE_PROD_HYDRATION_MISMATCH_DETAILS__=false;",framework:"vue"},{specifiers:["zone.js"],bundle:"zone",version:"0.15.1",entryPoint:"zone.js",framework:"angular"},{specifiers:["@angular/core","@angular/core/rxjs-interop"],bundle:"angular-core",version:"21.2.18",stdin:"export * from '@angular/core'; export * from '@angular/core/rxjs-interop';",external:["rxjs","rxjs/operators","@angular/compiler"],framework:"angular"},{specifiers:["@angular/common"],bundle:"angular-common",version:"21.2.18",entryPoint:"@angular/common",external:["rxjs","@angular/compiler","@angular/core"],framework:"angular"},{specifiers:["@angular/platform-browser"],bundle:"angular-platform-browser",version:"21.2.18",entryPoint:"@angular/platform-browser",external:["rxjs","@angular/compiler","@angular/core"],framework:"angular"},{specifiers:["@angular/compiler"],bundle:"angular-compiler",version:"21.2.18",entryPoint:"@angular/compiler",external:["rxjs"],framework:"angular"}],yd=()=>Object.fromEntries(DC.flatMap(t=>t.specifiers.map(e=>[e,t.version]))),HC=Kt(["builtin","registry","upload"]),BC=Kt(["pending","approved"]),$C=Kt(["ready","installing","failed"]),UC=Kt(["stopped","capacity_blocked","starting","ready","backoff","failed"]),jC=Ue({kind:Kt(["exec","service"]),packages:vt(de()).optional(),args:vt(de()).optional(),publicRoutes:vt(de()).optional()}),FC=ps(de(),xr()).superRefine((t,e)=>{for(const n of Object.keys(t))fS(n)||e.addIssue({code:"custom",path:[n],message:"only persistent RCI permissions may be granted"})}),GC=Ue({transport:Kt(["http","websocket"]),path:de(),method:Kt(["GET","HEAD","POST","PUT","PATCH","DELETE"]).optional(),protocols:vt(de()).optional()}),VC=Ue({routes:ps(de(),GC)}),ZC=Ue({w:Vt(),h:Vt(),minW:Vt().optional(),minH:Vt().optional()}),WC=Ue({defaultLocale:de(),locales:ps(de(),de())}),qC=Ue({state:UC,restartCount:Vt(),consecutiveFailures:Vt(),startedAt:de().optional(),nextAttemptAt:de().optional(),lastExit:de().optional(),lastError:de().optional(),recentStderr:vt(de()).optional(),requiredProtocol:Vt().optional(),compatible:xr().optional(),supportedProtocols:vt(Vt()).optional()}),XC=Ue({sdkVersion:de(),sharedDependencies:ps(de(),de())}),wv={name:de(),version:de(),label:de(),entry:de(),icon:de().optional(),source:HC,approval:BC,enabled:xr(),permissions:vt(pm).optional(),permissionGrants:FC.optional(),depsStatus:$C,backend:VC,review:jC.optional(),i18n:WC.optional(),catalogBaseUrl:de().optional(),runtime:qC.optional(),lock:XC.optional()},YC=Ue({...wv,type:Pt("widget"),size:ZC,fixedHeight:xr().optional()}),JC=Ue({...wv,type:Pt("page"),route:de()}),yv=rd("type",[YC,JC]),KC=Ue({plugins:vt(yv)}),kv=t=>KC.parse(t).plugins,Tc=t=>yv.parse(t),Fa=new ns;function Bo(t){return Fa.get(t)??"ready"}function Ph(t){Fa.clear();for(const e of t)Fa.set(e.name,e.depsStatus)}let ea=null,Rh;function QC(){clearTimeout(Rh),Rh=void 0,ea==null||ea.abort(),ea=null}const me=it({authenticated:!1,ready:!1,hostInfo:null,deviceInfo:null,pluginLoadError:null,mobileSidebarOpen:!1,desktopSidebarCollapsed:!1,theme:ja(),locale:os(),localeSwitchPending:!1});function Cc(){pl().matches?me.mobileSidebarOpen=!me.mobileSidebarOpen:me.desktopSidebarCollapsed=!me.desktopSidebarCollapsed}function kd(){QC(),me.authenticated=!1,me.ready=!1,me.hostInfo=null,me.deviceInfo=null}uv(t=>{me.theme=t});vu(t=>{me.locale=t});rC(t=>{me.localeSwitchPending=t});function w(t,e){return Rn(t,e,me.locale)}var eP=z('<h2 class="mndw-overlay-dialog__title svelte-1ervcvh"> </h2>'),tP=z('<button type="button" class="mndw-overlay-dialog__close svelte-1ervcvh">×</button>'),nP=z('<header class="mndw-overlay-dialog__header svelte-1ervcvh"><!> <!></header>'),rP=z('<p class="mndw-overlay-dialog__description svelte-1ervcvh"> </p>'),iP=z('<div role="dialog"><!> <!> <div class="mndw-overlay-dialog__body svelte-1ervcvh"></div></div>');function sP(t,e){Ie(e,!0);const n=Math.random().toString(36).slice(2),r=`mndw-overlay-title-${n}`,i=`mndw-overlay-desc-${n}`;function s(p,g){return p.appendChild(g),{destroy(){g.parentNode===p&&p.removeChild(g)}}}const o=fe(()=>e.layer.mobileSheet?"width:100%;height:auto;max-height:100dvh":[e.layer.sizing.width?`width:${e.layer.sizing.width}`:"",e.layer.sizing.height?`height:${e.layer.sizing.height}`:"",e.layer.sizing.maxWidth?`max-width:${e.layer.sizing.maxWidth}`:"",e.layer.sizing.maxHeight?`max-height:${e.layer.sizing.maxHeight}`:""].filter(Boolean).join(";"));var a=iP(),l=v(a);{var c=p=>{var g=nP(),m=v(g);{var _=I=>{var R=eP(),A=v(R);y(()=>{Ae(R,"id",r),S(A,e.layer.shell.title)}),C(I,R)};Z(m,I=>{var R;(R=e.layer.shell)!=null&&R.title&&I(_)})}var k=x(m,2);{var O=I=>{var R=tP();y(A=>Ae(R,"aria-label",A),[()=>w("common.close")]),pe("click",R,()=>e.layer.close(void 0,"action")),C(I,R)};Z(k,I=>{var R;(R=e.layer.shell)!=null&&R.showCloseButton&&I(O)})}C(p,g)};Z(l,p=>{var g,m;((g=e.layer.shell)!=null&&g.title||(m=e.layer.shell)!=null&&m.showCloseButton)&&p(c)})}var u=x(l,2);{var d=p=>{var g=rP(),m=v(g);y(()=>{Ae(g,"id",i),S(m,e.layer.shell.description)}),C(p,g)};Z(u,p=>{var g;(g=e.layer.shell)!=null&&g.description&&p(d)})}var h=x(u,2);Kr(h,(p,g)=>s==null?void 0:s(p,g),()=>e.layer.contentElement),y(()=>{var p,g;Ne(a,1,`mndw-overlay-dialog mndw-overlay-dialog--${e.layer.kind??""} mndw-overlay-dialog--${e.layer.placement??""} ${e.layer.mobileSheet?"mndw-overlay-dialog--sheet":""} ${e.layer.className??""??""}`,"svelte-1ervcvh"),Ae(a,"data-locale",me.locale),Ae(a,"aria-modal",e.layer.kind==="modal"?"true":void 0),Ae(a,"aria-labelledby",(p=e.layer.shell)!=null&&p.title?r:void 0),Ae(a,"aria-describedby",(g=e.layer.shell)!=null&&g.description?i:void 0),Ks(a,f(o))}),C(t,a),Le()}at(["click"]);const oP=1e4;function aP(t){switch(t){case"modal":return{placement:"center",closeOnEscape:!0,closeOnOutsideClick:!1,trapFocus:!0,restoreFocus:!0,lockScroll:!0,backdrop:!0};case"drawer":return{placement:"right",closeOnEscape:!0,closeOnOutsideClick:!0,trapFocus:!0,restoreFocus:!0,lockScroll:!0,backdrop:!0};case"popover":return{placement:"bottom-start",closeOnEscape:!0,closeOnOutsideClick:!0,trapFocus:!1,restoreFocus:!1,lockScroll:!1,backdrop:!1};case"custom":return{placement:"center",closeOnEscape:!1,closeOnOutsideClick:!1,trapFocus:!1,restoreFocus:!1,lockScroll:!1,backdrop:!1}}}var vo,bo,_o,wo,yo,ko;class Ah{constructor(e,n,r,i,s){G(this,"id");G(this,"pluginName");G(this,"instanceId");G(this,"kind");G(this,"hostElement");G(this,"contentElement");be(this,vo,Y("opening"));be(this,bo,Y(null));be(this,_o,Y("center"));G(this,"mobileSheet");be(this,wo,Y(void 0));be(this,yo,Y(it({})));be(this,ko,Y(null));G(this,"behavior");G(this,"closeOnEscape");G(this,"closeOnOutsideClick");G(this,"trapFocus");G(this,"restoreFocus");G(this,"lockScroll");G(this,"backdrop");G(this,"closed");G(this,"abortController",new AbortController);G(this,"anchorElement");G(this,"cleanup",null);G(this,"onCloseListeners",new Set);G(this,"previousFocus");G(this,"closedResolve");G(this,"openTimeout");G(this,"focusTrap",null);G(this,"repositionHandler",null);G(this,"anchorObserver",null);G(this,"runtime");var a;this.runtime=e,this.id=e.allocateLayerId(),this.pluginName=n,this.instanceId=r,this.kind=i.kind;const o=aP(i.kind);this.behavior=o,this.closeOnEscape=i.closeOnEscape??o.closeOnEscape,this.closeOnOutsideClick=i.closeOnOutsideClick??o.closeOnOutsideClick,this.trapFocus=i.trapFocus??o.trapFocus,this.restoreFocus=i.restoreFocus??o.restoreFocus,this.lockScroll=i.lockScroll??o.lockScroll,this.backdrop=o.backdrop,this.shell=s,this.placement=Ud(i.kind,i.placement),this.mobileSheet=tb(i.kind),this.className=i.className,this.sizing=jd(i.kind,i,this.mobileSheet),this.anchorElement=((a=i.anchor)==null?void 0:a.element)??null,this.hostElement=document.createElement("div"),this.hostElement.className="mndw-overlay-layer",this.contentElement=document.createElement("div"),this.contentElement.className="mndw-overlay-content",s||this.hostElement.appendChild(this.contentElement),this.previousFocus=this.restoreFocus&&document.activeElement instanceof HTMLElement?document.activeElement:null,this.closed=new Promise(l=>{this.closedResolve=l}),this.openTimeout=setTimeout(()=>{this.state==="opening"&&this.closeInternal("mount-failed")},oP),this.attachAnchorObservers()}get state(){return f(E(this,vo))}set state(e){b(E(this,vo),e,!0)}get shell(){return f(E(this,bo))}set shell(e){b(E(this,bo),e,!0)}get placement(){return f(E(this,_o))}set placement(e){b(E(this,_o),e,!0)}get className(){return f(E(this,wo))}set className(e){b(E(this,wo),e,!0)}get sizing(){return f(E(this,yo))}set sizing(e){b(E(this,yo),e,!0)}get position(){return f(E(this,ko))}set position(e){b(E(this,ko),e,!0)}get isOpen(){return this.state==="opening"||this.state==="open"}get signal(){return this.abortController.signal}close(e,n="api"){this.closeInternal(n,e)}closeWithReason(e,n){this.closeInternal(e,n)}setCleanup(e){this.state!=="closed"&&(this.cleanup=e)}markReady(){this.state==="opening"&&(this.clearOpenTimeout(),this.state="open",this.trapFocus&&requestAnimationFrame(()=>this.activateFocusTrap()))}update(e){if(this.isOpen){if(e.className!==void 0&&(this.className=e.className),e.placement!==void 0&&(this.placement=Ud(this.kind,e.placement)),e.anchor!==void 0&&!this.shell&&(this.anchorElement=e.anchor.element,this.attachAnchorObservers()),this.shell){const n={...this.shell??{showCloseButton:!0}};e.title!==void 0&&(n.title=e.title),e.description!==void 0&&(n.description=e.description),e.showCloseButton!==void 0&&(n.showCloseButton=e.showCloseButton),this.shell=n}(e.width!==void 0||e.height!==void 0||e.maxWidth!==void 0||e.maxHeight!==void 0)&&(this.sizing=jd(this.kind,{kind:this.kind,width:e.width,height:e.height,maxWidth:e.maxWidth,maxHeight:e.maxHeight},this.mobileSheet)),this.reposition()}}onClose(e){return this.onCloseListeners.add(e),()=>{this.onCloseListeners.delete(e)}}reposition(){if(this.kind!=="popover"||!this.anchorElement)return;const e=this.contentElement.getBoundingClientRect();if(e.width<=0||e.height<=0)return;const n=nb({element:this.anchorElement},{width:e.width,height:e.height},this.placement);this.placement=n.placement,this.position={top:n.top,left:n.left}}attachAnchorObservers(){if(this.detachAnchorObservers(),this.kind!=="popover"||!this.anchorElement)return;const e=this.anchorElement;this.repositionHandler=()=>{requestAnimationFrame(()=>this.reposition())},window.addEventListener("scroll",this.repositionHandler,!0),window.addEventListener("resize",this.repositionHandler),this.anchorObserver=new MutationObserver(()=>{e.isConnected||this.closeInternal("anchor-lost")}),this.anchorObserver.observe(document.body,{childList:!0,subtree:!0})}detachAnchorObservers(){var e;this.repositionHandler&&(window.removeEventListener("scroll",this.repositionHandler,!0),window.removeEventListener("resize",this.repositionHandler),this.repositionHandler=null),(e=this.anchorObserver)==null||e.disconnect(),this.anchorObserver=null}clearOpenTimeout(){this.openTimeout!==void 0&&(clearTimeout(this.openTimeout),this.openTimeout=void 0)}async closeInternal(e,n){var s;if(this.state==="closing"||this.state==="closed")return;this.state="closing",(s=this.focusTrap)==null||s.deactivate(),this.focusTrap=null,this.clearOpenTimeout(),this.abortController.abort(),this.detachAnchorObservers();const r=this.cleanup;if(r)try{await(r instanceof Promise?await r:r)()}catch(o){console.error(`[mndw] Overlay cleanup for "${this.pluginName}" failed:`,o)}this.restoreFocusOnClose(),this.runtime.removeLayer(this),this.state="closed";const i={reason:e,result:n};this.closedResolve(i);for(const o of this.onCloseListeners)try{o(i)}catch(a){console.error(`[mndw] Overlay onClose listener for "${this.pluginName}" failed:`,a)}}restoreFocusOnClose(){var n,r;const e=document.activeElement;if(this.kind==="popover"&&((n=this.anchorElement)!=null&&n.isConnected)){const i=this.contentElement.contains(e),s=!e||e===document.body;(i||s)&&this.anchorElement.focus();return}this.restoreFocus&&((r=this.previousFocus)!=null&&r.isConnected)&&this.previousFocus.focus()}activateFocusTrap(){this.state!=="open"||this.focusTrap||!this.hostElement.isConnected||(this.focusTrap=Mc(this.hostElement,{initialFocus:()=>ib(this.contentElement)[0]??null,restoreFocus:!1,allowFocus:e=>this.runtime.store.layers.some(n=>n.id>this.id&&rb(n.hostElement,e))}))}}vo=new WeakMap,bo=new WeakMap,_o=new WeakMap,wo=new WeakMap,yo=new WeakMap,ko=new WeakMap;var Eo;class lP{constructor(){be(this,Eo,Y(it([])))}get layers(){return f(E(this,Eo))}set layers(e){b(E(this,Eo),e,!0)}}Eo=new WeakMap;function cP(){const t=new lP;let e=1;return{store:t,allocateLayerId:()=>e++,removeLayer:n=>{const r=t.layers.indexOf(n);r!==-1&&t.layers.splice(r,1)},addLayer:n=>{if(n.kind==="modal")for(const r of[...t.layers])r.instanceId===n.instanceId&&r.kind==="popover"&&r.closeWithReason("replaced");t.layers.push(n)}}}const Ev=cP(),uP=Ev;function Ed(t,e,n=Ev){let r=!1;function i(){if(r)throw new Error(`[mndw] Overlay service for "${t}" (${e}) is disposed; the plugin instance was unmounted.`)}function s(){return n.store.layers.filter(l=>l.instanceId===e)}const o={createLayer(l){i();const c=new Ah(n,t,e,l,null);return n.addLayer(c),c},open(l){i();const{title:c,description:u,showCloseButton:d,mount:h,kind:p,...g}=l,m=new Ah(n,t,e,{kind:p,...g},{title:c,description:u,showCloseButton:d??!0});n.addLayer(m);try{const _=h(m.contentElement,m,m.signal);_ instanceof Promise?_.then(()=>m.markReady()).catch(k=>{console.error(`[mndw] Overlay mount for "${t}" failed:`,k),m.closeWithReason("mount-failed")}):m.markReady()}catch(_){console.error(`[mndw] Overlay mount for "${t}" failed:`,_),m.closeWithReason("mount-failed")}return m},closeAll(){for(const l of s())l.close(void 0,"api")}};function a(l="plugin-unmount"){if(!r){r=!0;for(const c of s())c.closeWithReason(l)}}return{service:o,dispose:a}}var dP=z('<div class="mndw-overlay-backdrop svelte-11o3k6p" aria-hidden="true"></div>'),fP=z("<div><!> <div></div></div>");function hP(t,e){Ie(e,!0);let n=Yt(e,"runtime",3,uP);const r=1e3,i=fe(()=>n().store.layers);function s(p){return r+p}function o(p){return p.kind==="modal"||p.kind==="drawer"}function a(p){return p.kind==="popover"?p.position?`position:absolute;top:${p.position.top}px;left:${p.position.left}px`:"position:absolute;visibility:hidden":""}function l(p,g){p.appendChild(g.hostElement),g.kind==="drawer"&&g.placement==="bottom"&&(g.hostElement.style.display="flex",g.hostElement.style.flexDirection="column",g.hostElement.style.justifyContent="flex-end",g.hostElement.style.width="100%",g.hostElement.style.height="100%",g.hostElement.style.minHeight="0");let m;return g.shell&&(m=hl(sP,{target:g.hostElement,props:{layer:g}})),requestAnimationFrame(()=>{g.state!=="closed"&&g.reposition()}),{destroy(){m&&ju(m),g.hostElement.remove()}}}function c(p){if(p.key==="Escape"){for(let g=f(i).length-1;g>=0;g--)if(f(i)[g].closeOnEscape){f(i)[g].closeWithReason("escape"),p.stopPropagation();return}}}function u(p){const g=p.composedPath();for(let m=f(i).length-1;m>=0;m--){const _=f(i)[m];if(g.includes(_.hostElement)||_.anchorElement&&g.includes(_.anchorElement))return;if(_.closeOnOutsideClick){_.closeWithReason("outside-click");return}if(o(_))return}}hn(()=>{const p=f(i).some(m=>m.lockScroll),g=document.body.style.overflow;return p&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=g}});var d=kn();ut("keydown",Ys,c),ut("pointerdown",Ys,u);var h=Xe(d);ft(h,19,()=>f(i),p=>p.id,(p,g,m)=>{var _=fP();let k;var O=v(_);{var I=T=>{var M=dP();C(T,M)},R=fe(()=>o(f(g))&&f(g).backdrop);Z(O,T=>{f(R)&&T(I)})}var A=x(O,2);Kr(A,(T,M)=>l==null?void 0:l(T,M),()=>f(g)),y((T,M)=>{Ne(_,1,`mndw-overlay-layer mndw-overlay-layer--${f(g).kind??""}`,"svelte-11o3k6p"),k=Ks(_,"",k,T),Ne(A,1,`mndw-overlay-positioner mndw-overlay-positioner--${f(g).kind??""} mndw-overlay-positioner--${f(g).placement??""} ${f(g).mobileSheet?"mndw-overlay-positioner--sheet":""}`,"svelte-11o3k6p"),Ks(A,M)},[()=>({"z-index":s(f(m))}),()=>a(f(g))]),C(p,_)}),C(t,d),Le()}const pP={success:4e3,info:4e3,error:0},gP=4,mP=.35,vP=.5;function bP(t,e,n){return e<=0?!1:Math.abs(t)>=e*mP||Math.abs(n)>=vP}var So;class _P{constructor(){be(this,So,Y(it([])));G(this,"nextId",1);G(this,"maxToasts",gP);G(this,"timers",new ns)}get toasts(){return f(E(this,So))}set toasts(e){b(E(this,So),e,!0)}show(e){const n=e.variant??"info",r=e.duration??pP[n],i=this.nextId++;return this.toasts.push({id:i,message:e.message,variant:n,duration:r}),this.enforceCap(),r>0&&this.timers.set(i,setTimeout(()=>this.dismiss(i),r)),i}success(e,n){return this.show({...n,message:e,variant:"success"})}info(e,n){return this.show({...n,message:e,variant:"info"})}error(e,n){return this.show({...n,message:e,variant:"error"})}dismiss(e){this.clearTimer(e);const n=this.toasts.findIndex(r=>r.id===e);n!==-1&&this.toasts.splice(n,1)}setMaxToasts(e){this.maxToasts=Math.max(1,Math.trunc(e)),this.enforceCap()}clear(){for(const e of this.timers.keys())this.clearTimer(e);this.toasts=[]}enforceCap(){for(;this.toasts.length>this.maxToasts;){const e=this.toasts.shift();e!==void 0&&this.clearTimer(e.id)}}clearTimer(e){const n=this.timers.get(e);n!==void 0&&(clearTimeout(n),this.timers.delete(e))}}So=new WeakMap;const si=new _P;var wP=z('<div><span class="mndw-toast__body svelte-1g105wt"> </span> <button type="button" class="mndw-toast__dismiss svelte-1g105wt"><mndw-icon></mndw-icon></button></div>',2),yP=z('<div role="region"></div>');function kP(t,e){Ie(e,!0);let n=Yt(e,"store",3,si);const r=pl();let i=Y(it(r.matches));const s=d=>{b(i,d.matches,!0),n().setMaxToasts(d.matches?3:4)};function o(d){return d==="error"?"danger":d}function a(d,h){let p=h,g=null,m=0,_=0,k=!1;const O=T=>{d.style.transition="transform 0.15s ease, opacity 0.15s ease",d.style.transform="",d.style.opacity=""},I=T=>{!p.enabled||T.pointerType==="mouse"||g!==null||(g=T.pointerId,m=T.clientX,_=T.timeStamp,k=!0,d.style.transition="",d.setPointerCapture(T.pointerId))},R=T=>{if(!k||T.pointerId!==g)return;const M=T.clientX-m;d.style.transform=`translateX(${M}px)`,d.style.opacity=String(Math.max(.3,1-Math.abs(M)/d.offsetWidth))},A=T=>{if(!k||T.pointerId!==g)return;const M=T.clientX-m,N=Math.max(1,T.timeStamp-_),j=M/N;k=!1,g=null,bP(M,d.offsetWidth,j)?p.onDismiss():O()};return d.style.touchAction="pan-y",d.addEventListener("pointerdown",I),d.addEventListener("pointermove",R),d.addEventListener("pointerup",A),d.addEventListener("pointercancel",A),{update(T){p=T},destroy(){d.removeEventListener("pointerdown",I),d.removeEventListener("pointermove",R),d.removeEventListener("pointerup",A),d.removeEventListener("pointercancel",A)}}}zn(()=>(n().setMaxToasts(f(i)?3:4),r.addEventListener("change",s),()=>{r.removeEventListener("change",s)}));var l=kn(),c=Xe(l);{var u=d=>{var h=yP();let p;ft(h,21,()=>n().toasts,g=>g.id,(g,m)=>{var _=wP(),k=v(_),O=v(k),I=x(k,2),R=v(I);P(R,"name","x"),Kr(_,(A,T)=>a==null?void 0:a(A,T),()=>({enabled:f(i),onDismiss:()=>n().dismiss(f(m).id)})),y((A,T)=>{Ne(_,1,`mndw-toast mndw-alert mndw-alert--${A??""}`,"svelte-1g105wt"),Ae(_,"role",f(m).variant==="error"?"alert":"status"),Ae(_,"aria-live",f(m).variant==="error"?"assertive":"polite"),S(O,f(m).message),Ae(I,"aria-label",T)},[()=>o(f(m).variant),()=>w("toast.dismiss")]),pe("click",I,()=>n().dismiss(f(m).id)),C(g,_)}),y(g=>{p=Ne(h,1,"mndw-toast-host svelte-1g105wt",null,p,{"mndw-toast-host--mobile":f(i)}),Ae(h,"aria-label",g)},[()=>w("toast.region")]),C(d,h)};Z(c,d=>{n().toasts.length>0&&d(u)})}C(t,l),Le()}at(["click"]);class yu extends Error{constructor(n,r,i){super(r,i);G(this,"code");this.name="PageRouteError",this.code=n}}const EP=["execute","queue","initBackgroundProcess","queueBackgroundProcess"],SP={light:{bg:"#f7fcfd",surface:"#edf2f3",surfaceRaised:"#f2f7f8",border:"#80878a",textSubtle:"#2f353a",textMuted:"#1d2328",text:"#0c1217",accent:"#016ca5",accentHover:"#005583",accentContrast:"#ffffff",danger:"#c5001b",dangerBg:"#ffe9e6",success:"#137738",successBg:"#d7f9dc",warning:"#916100",warningBg:"#ffebd1",info:"#016ca5",infoBg:"#e0f1ff",focusRing:"#004f7a",surfaceHover:"#e8edee",shadowColor:"#4145462e"},dark:{bg:"#030405",surface:"#0d0f10",surfaceRaised:"#151719",border:"#606569",textSubtle:"#b9c0c7",textMuted:"#d1d9e1",text:"#eaf3fb",accent:"#016ca5",accentHover:"#2b84bf",accentContrast:"#ffffff",danger:"#ed3f3f",dangerBg:"#390204",success:"#5cb572",successBg:"#05210d",warning:"#efa831",warningBg:"#271700",info:"#338ac5",infoBg:"#021d2f",focusRing:"#338ac5",surfaceHover:"#1e2022",shadowColor:"#0102038c"}},Sd="0.1.3",xP=1;function TP(t){return typeof t!="object"||t===null||Array.isArray(t)?!1:Object.values(t).every(e=>typeof e=="string")}async function CP(t,e=fetch){try{const n=await e(`${t}/mndw.lock.json`);if(!n.ok)return null;const r=await n.json();if(typeof r!="object"||r===null)return null;const i=r;if(i.lockVersion!==xP)return null;const s=i.sdkVersion,o=i.sharedDependencies;return typeof s!="string"||!TP(o)?null:{sdkVersion:s,sharedDependencies:o}}catch{return null}}function Us(t){if(typeof t!="string")return null;const e=/^(\d+)(?:\.(\d+))?(?:[.+-]|$)/.exec(t.trim());return e===null?null:{major:Number(e[1]),minor:e[2]===void 0?null:Number(e[2])}}function jr(t){const e=Us(t);return e===null?null:e.major>0?String(e.major):e.minor===null?"0":`0.${e.minor}`}function PP(t,e=yd(),n=Sd){const r=[],i=Us(t.sdkVersion),s=Us(n),o=jr(t.sdkVersion),a=jr(n);i!==null&&s!==null&&o!==null&&a!==null&&(o!==a?r.push({kind:"sdk-major",name:"@mndw/sdk",pluginVersion:t.sdkVersion,hostVersion:n}):i.major>0&&i.minor!==null&&s.minor!==null&&i.minor>s.minor&&r.push({kind:"sdk-newer-minor",name:"@mndw/sdk",pluginVersion:t.sdkVersion,hostVersion:n}));for(const[l,c]of Object.entries(t.sharedDependencies)){const u=e[l];if(u===void 0)continue;const d=Us(c),h=Us(u),p=jr(c),g=jr(u);d!==null&&h!==null&&p!==null&&g!==null&&p!==g&&r.push({kind:"shared-major",name:l,pluginVersion:c,hostVersion:u})}return r}function RP(t,e=yd(),n=Sd){const r=[];for(const[o,a]of Object.entries(t.sharedDependencies)){const l=e[o];if(l===void 0)continue;const c=jr(a),u=jr(l);c===null||u===null||c!==u&&r.push(`${o} @${c} (host provides @${u})`)}const i=jr(t.sdkVersion),s=jr(n);return i!==null&&s!==null&&i!==s&&r.push(`@mndw/sdk @${i} (host provides @${s})`),r}function AP(t,e,n=yd(),r=Sd){const i=RP(e,n,r);return i.length>0&&console.warn(`[mndw] plugin "${t}" was built against ${i.join(", ")}; it may misbehave with the versions this host provides`),i}class MP{constructor(e={catalog:Do}){G(this,"plugins",new Map);G(this,"catalog");this.catalog=e.catalog}register(e){if(this.plugins.has(e.entry.name))throw new Error(`Duplicate plugin name "${e.entry.name}"`);this.plugins.set(e.entry.name,e),e.catalog!==void 0&&this.catalog.registerPluginCatalogCell(e.catalog)}replace(e){const n=this.plugins.get(e.entry.name);if(n===void 0)throw new Error(`Cannot replace unknown plugin "${e.entry.name}"`);if(n.entry.type!==e.entry.type)throw new Error(`Cannot change plugin "${e.entry.name}" type from ${n.entry.type} to ${e.entry.type}`);if(n.entry.type==="page"&&e.entry.type==="page"&&n.entry.route!==e.entry.route)throw new Error(`Cannot change page "${e.entry.name}" route from ${n.entry.route} to ${e.entry.route}`);return this.plugins.set(e.entry.name,e),n.catalog!==void 0&&this.catalog.unregisterPluginCatalogCell(n.catalog),e.catalog!==void 0&&this.catalog.registerPluginCatalogCell(e.catalog),n}get(e){return this.plugins.get(e)}getWidgets(){return[...this.plugins.values()].filter(e=>e.entry.type==="widget")}getPages(){return[...this.plugins.values()].filter(e=>e.entry.type==="page")}getAll(){return[...this.plugins.values()]}clear(){for(const e of this.plugins.values())e.catalog!==void 0&&this.catalog.unregisterPluginCatalogCell(e.catalog);this.plugins.clear(),this.catalog.clearPluginCatalogCells()}}const bs=new MP,io=it({});function OP(){for(const t of Object.keys(io))delete io[t]}function NP(t,e){if(e.length===0){delete io[t];return}io[t]=[...e]}function zP(t){return io[t]??[]}const IP=15e3,Pc=new Set;function LP(t,e,n){return`${t}/${e}?v=${encodeURIComponent(n)}`}async function DP(t,e){Pc.has(t)||await new Promise(n=>{if(document.querySelector(`link[data-plugin-style="${e}"][href="${t}"]`)){Pc.add(t),n();return}const i=document.createElement("link");i.rel="stylesheet",i.href=t,i.dataset.pluginStyle=e,i.onload=()=>{Pc.add(t),n()},i.onerror=()=>{console.warn(`[mndw] No stylesheet for plugin "${e}" at ${t}`),n()},document.head.appendChild(i)})}function HP(t,e){const n=t;if(typeof n.createInstance!="function")throw new Error(`Plugin "${e}" does not export { createInstance }`);return n}async function BP(){const t=await fetch(Km);if(!t.ok)throw new Error(`HTTP ${t.status}`);return kv(await t.json())}async function $P(t,e){const n=await CP(e);return n?AP(t.name,n):[]}function UP(t){const e=new Set,n=new Set;return t.filter(r=>{if(e.has(r.name))return console.error(`[mndw] Skipping duplicate plugin "${r.name}"`),!1;if(e.add(r.name),r.type==="page"){if(n.has(r.route))return console.error(`[mndw] Skipping duplicate page route "${r.route}"`),!1;n.add(r.route)}return!0})}async function jP(t,e,n){const i=`${t.source==="builtin"?yh.builtin:yh.user}${t.name}`,s=o=>LP(i,o,t.version);await e.loadStylesheet(s("index.css"),t.name);try{const o=await e.importModule(s(t.entry)),a=HP(o,t.name),l=rv(t.name,t.version,t.catalogBaseUrl??i,t.i18n),c=l===void 0?void 0:e.catalogService.createPluginCatalogCell(l,e.getLocale());if(c!==void 0&&await e.catalogService.loadInitialPluginCatalog(c,e.getLocale()),n.aborted)return;e.registry.register({entry:t,module:a,...c===void 0?{}:{catalog:c}}),console.log(`[mndw] Loaded plugin: ${t.name} (${t.source})`),Promise.resolve().then(()=>e.checkVersions(t,i)).then(u=>{NP(t.name,u)}).catch(u=>{console.error(`[mndw] Version check failed for "${t.name}":`,u)})}catch(o){console.error(`[mndw] Failed to load plugin "${t.name}":`,o)}}async function FP(t,e){const n=new AbortController,r=new Promise(s=>{n.signal.addEventListener("abort",()=>{console.error(`[mndw] Plugin "${t.name}" did not load within ${e.loadTimeoutMs} ms; skipping it`),s()},{once:!0})}),i=setTimeout(()=>n.abort(),e.loadTimeoutMs);try{await Promise.race([jP(t,e,n.signal),r])}finally{clearTimeout(i)}}async function GP(t={}){const e=t.fetchList??BP,n={importModule:t.importModule??(s=>import(s)),loadStylesheet:t.loadStylesheet??DP,checkVersions:t.checkVersions??$P,catalogService:t.catalogService??Do,registry:t.registry??bs,getLocale:t.getLocale??os,loadTimeoutMs:t.loadTimeoutMs??IP};n.registry.clear(),Ph([]),me.pluginLoadError=null,OP();let r;try{r=await e()}catch(s){console.error("[mndw] Failed to load plugin list:",s),me.pluginLoadError="Failed to load plugins. Check the console for details.";return}Ph(r);const i=UP(r.filter(s=>s.enabled&&s.approval==="approved"));await Promise.all(i.map(s=>FP(s,n)))}const VP=Ue({id:de(),label:de(),index:Vt().finite().int().nonnegative(),type:de(),group:de(),color:de(),interfaceId:de()}),ZP=Ue({list:vt(VP),layout:vt(vt(de())),hasPortStats:xr()}),WP=Ue({switchports:ZP,usbPortCount:Vt().finite().int().nonnegative()});function ku(){return{list:[],layout:[],hasPortStats:!1}}function qP(t){return WP.parse(t)}const Xt=Object.freeze({"X-Mndw-Csrf":"1"}),sn=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),_r=t=>typeof t=="string"&&t.length>0,Ml=async t=>{try{return await t.json()}catch{return}};function Ol(t,e){const n=sn(t)?t:void 0,r=n==null?void 0:n.error,i=sn(r)?r:void 0,s=i==null?void 0:i.code,o=i==null?void 0:i.message;return{code:_r(s)?s:"UNKNOWN",message:_r(o)?o:e,detail:i==null?void 0:i.detail}}class Fi extends Error{constructor(n,r,i){super(n);G(this,"code");G(this,"detail");this.name="MgmtError",this.code=r,this.detail=i}}function XP(t){switch(t){case"read":return Jm;case"mutation":return tT;case"install":return nT}}async function zr(t){const e=Ol(await Ml(t),t.statusText);return new Fi(e.message,e.code,e.detail)}function YP(t){return t instanceof DOMException&&t.name==="TimeoutError"||t instanceof TypeError?"ambiguous":t instanceof Fi&&t.code==="BACKEND_MAINTENANCE"?"rejected-maintenance":"error"}function JP(t=globalThis.fetch,e=n=>AbortSignal.timeout(XP(n))){function n(o){return e(o)}async function r(o){if(o.status!==204)throw o.ok?new Fi("The device returned an unexpected response.","UNKNOWN"):await zr(o)}async function i(o,a,l){const c=await t(o,{method:"POST",headers:{"Content-Type":"application/json",...Xt},body:JSON.stringify({name:a}),signal:n(l)});if(!c.ok)throw await zr(c);return c}async function s(o,a){const l=await i(o,a,o===_h?"install":"mutation");return Tc(await l.json())}return{async listPlugins(){const o=await t(Km,{method:"GET",signal:n("read")});if(!o.ok)throw await zr(o);return kv(await o.json())},async uploadPlugin(o){const a=await t(iT,{method:"POST",headers:{"Content-Type":"application/zip",...Xt},body:o});if(a.status===201||a.status===202){const l=Tc(await a.json());return{status:a.status===201?"installed":"pending",entry:l}}throw await zr(a)},approvePlugin:o=>s(_h,o),enablePlugin:o=>s(oT,o),disablePlugin:o=>s(aT,o),async setPluginPermission(o,a,l){const c=await t(rT,{method:"POST",headers:{"Content-Type":"application/json",...Xt},body:JSON.stringify({name:o,permission:a,enabled:l}),signal:n("mutation")});if(!c.ok)throw await zr(c);return Tc(await c.json())},async denyPlugin(o){await i(sT,o,"mutation")},async deletePlugin(o){await i(lT,o,"mutation")},async restartPlugin(o){await i(cT,o,"mutation")},async getRuntime(){const o=await t(uT,{method:"GET",signal:n("read")});if(!o.ok)throw await zr(o);return await o.json()},async getDeviceHardware(){try{const o=await t(dT,{method:"GET",signal:n("read")});return o.ok?qP(await o.json()):{switchports:ku(),usbPortCount:0}}catch{return{switchports:ku(),usbPortCount:0}}},async getPalette(){const o=await t(kc,{method:"GET",cache:"no-store",signal:n("read")});if(!o.ok)throw await zr(o);const a=await o.json().catch(()=>null);if(a===null||typeof a!="object"||Array.isArray(a)||!Object.prototype.hasOwnProperty.call(a,"palette"))throw new Fi("The device returned an unexpected palette response.","UNKNOWN");return a.palette??null},async putPalette(o){const a=await t(kc,{method:"PUT",headers:{"Content-Type":"application/json",...Xt},body:JSON.stringify(o),signal:n("mutation")});await r(a)},async deletePalette(){const o=await t(kc,{method:"DELETE",headers:{...Xt},signal:n("mutation")});await r(o)},async getTelemetry(){const o=await t(wh,{method:"GET",signal:n("read")});if(!o.ok)throw await zr(o);const a=await o.json();if(a===null||typeof a!="object"||typeof a.enabled!="boolean")throw new Fi("The device returned an unexpected telemetry response.","UNKNOWN");return{enabled:a.enabled}},async setTelemetry(o){const a=await t(wh,{method:"PUT",headers:{"Content-Type":"application/json",...Xt},body:JSON.stringify({enabled:o}),signal:n("mutation")});await r(a)}}}const xd=JP(),Mh={INVALID_ZIP:"errors.invalid-zip",MANIFEST_MISSING:"errors.manifest-missing",UNSUPPORTED_MANIFEST_VERSION:"errors.unsupported-manifest-version",CONFLICT:"errors.conflict",UPLOAD_TOO_LARGE:"errors.upload-too-large",OPKG_FAILED:"errors.opkg-failed",DAEMON_FAILED:"errors.daemon-failed",UNAUTHORIZED:"errors.unauthorized",SERVICE_CAPACITY_EXCEEDED:"errors.service-capacity",BACKEND_BUSY:"errors.backend-busy",BACKEND_UNAVAILABLE:"errors.backend-unavailable",BACKEND_INCOMPATIBLE:"errors.backend-incompatible",BACKEND_MAINTENANCE:"errors.backend-maintenance",CONTROLLER_SESSION_UNAVAILABLE:"errors.controller-session-unavailable",RCI_SOCKET_START_FAILED:"errors.rci-socket-start-failed"};function sr(t){return t instanceof DOMException&&t.name==="TimeoutError"?Rn("errors.device-timeout"):t instanceof Fi?t.code==="MANIFEST_INVALID"?_r(t.detail)?`${Rn("errors.invalid-manifest")}: ${t.detail}`:Rn("errors.invalid-manifest"):(Mh[t.code]===void 0?t.message:Rn(Mh[t.code]))||Rn("app.error"):t instanceof Error?t.message:Rn("app.error")}const Eu="mndw-palette-override",KP=":root:root";function QP(t){const e=t.getElementById(Eu);if(e instanceof HTMLStyleElement)return e;const n=t.createElement("style");return n.id=Eu,t.head.appendChild(n),n}function Rs(t,e){var n;if(e===null){(n=t.getElementById(Eu))==null||n.remove();return}QP(t).textContent=mS(e,{selector:KP})}function Mi(t){return Object.freeze({dark:{...t.dark},light:{...t.light}})}function eR(t,e){return JSON.stringify(t)!==JSON.stringify(e)}function tR(t){const e=t.document??globalThis.document;let n=null;const r=new Set,i=()=>Mi(n??SP),s=()=>{const a=i();for(const l of r)l(Mi(a))},o=async a=>{const l=await t.mgmtClient.getPalette();let c=null;if(l!==null){const d=Vm(l);if(d.palette===null)throw new Error("The device returned an invalid palette.");c=d.palette}const u=eR(n,c);n=c,Rs(e,c),a&&u&&s()};return{getApplied:()=>n===null?null:Mi(n),getExportable:i,getTokens:i,refreshPalette:async()=>{await o(!0)},initPalette:async()=>{try{await o(!1)}catch(a){console.warn("[mndw] Could not load the device palette; using defaults.",a)}},previewOverride:a=>{const l=Mi(a);Rs(e,l);for(const c of r)c(Mi(l))},discardPreview:()=>{Rs(e,n),s()},commitOverride:async a=>{await t.mgmtClient.putPalette(a),n=Mi(a),Rs(e,n),s()},resetToDefault:async()=>{await t.mgmtClient.deletePalette(),n=null,Rs(e,null),s()},subscribePalette:a=>(r.add(a),()=>{r.delete(a)})}}const Td=tR({mgmtClient:xd}),Oh=()=>Td.getTokens(),nR=t=>Td.subscribePalette(t),rR=["transient","unauthorized","validation","redemption-failed","controller-unavailable","malformed-response"],iR=globalThis.fetch.bind(globalThis);async function js(t,e={},n=2e4){const r=new AbortController,i=globalThis.setTimeout(()=>r.abort(),n);try{return await iR(t,{...e,signal:r.signal})}finally{globalThis.clearTimeout(i)}}class Qn extends Error{constructor(n,r){super(n);G(this,"code");G(this,"status");this.name="PersistentRciSessionError",this.code=n,this.status=r}}const ta="/api/mndw/rci-session",sR=["offline","establishing","live","dead"],oR=["certificate-invalid","no-auth-token","missing-fqdn"],aR=["token","none","unknown"],lR=["supported","invalid","unsupported","unknown","needs-token"],cR=["ok","empty","disabled","decrypt-failed"];class uR{async getCapability(){const e=await this.read(await js(`${ta}/capability`,{headers:{...Xt}}));return this.parseCapability(e)}async testController(e){return await this.read(await this.post("/controller/test",{token:e}))}async saveController(e){return await this.read(await this.post("/controller",{token:e}))}async clearController(){await this.read(await js(`${ta}/controller`,{method:"DELETE",headers:{...Xt}}))}async setEnabled(e){await this.read(await js(`${ta}/enabled`,{method:"PUT",headers:{"Content-Type":"application/json",...Xt},body:JSON.stringify({enabled:e})}))}async post(e,n){return await js(`${ta}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Xt},body:JSON.stringify(n)})}async read(e){const n=await e.text();let r;try{r=n===""?void 0:JSON.parse(n)}catch{throw new Qn("MALFORMED_RESPONSE",e.status)}if(!e.ok){const i=this.errorCode(r)??`HTTP_${e.status}`;throw new Qn(i,e.status)}return r}parseCapability(e){if(!this.isRecord(e)||!this.isRecord(e.store)||!this.isRecord(e.controller)||!Array.isArray(e.extenders)||typeof e.stale!="boolean"||!this.isStoreState(e.store.state)||!this.isSupport(e.controller.support)||!this.isAuthMode(e.controller.auth)||typeof e.controller.enabled!="boolean")throw new Qn("MALFORMED_RESPONSE",200);const n={support:e.controller.support,auth:e.controller.auth,enabled:e.controller.enabled};if(e.controller.lastCheckedAt!==void 0){if(typeof e.controller.lastCheckedAt!="string")throw new Qn("MALFORMED_RESPONSE",200);n.lastCheckedAt=e.controller.lastCheckedAt}const r=e.extenders.map(s=>this.parseExtender(s)),i={store:{state:e.store.state},controller:n,extenders:r,stale:e.stale};if(e.lastEnumerationError!==void 0){if(!this.isFailureCategory(e.lastEnumerationError))throw new Qn("MALFORMED_RESPONSE",200);i.lastEnumerationError=e.lastEnumerationError}if(e.lastEnumerationErrorAt!==void 0){if(typeof e.lastEnumerationErrorAt!="string")throw new Qn("MALFORMED_RESPONSE",200);i.lastEnumerationErrorAt=e.lastEnumerationErrorAt}return i}parseExtender(e){if(!this.isRecord(e)||typeof e.identity!="string"||typeof e.name!="string"||typeof e.eligible!="boolean")throw new Qn("MALFORMED_RESPONSE",200);if(!e.eligible){if(!this.isEligibilityReason(e.reason)||e.state!==void 0||e.lastError!==void 0||e.lastHeartbeatAt!==void 0)throw new Qn("MALFORMED_RESPONSE",200);return{identity:e.identity,name:e.name,eligible:!1,reason:e.reason}}if(e.reason!==void 0||e.state!==void 0&&!this.isSessionState(e.state)||e.lastError!==void 0&&!this.isFailureCategory(e.lastError)||e.lastHeartbeatAt!==void 0&&typeof e.lastHeartbeatAt!="string")throw new Qn("MALFORMED_RESPONSE",200);const n={identity:e.identity,name:e.name,eligible:!0};return e.state!==void 0&&(n.state=e.state),e.lastError!==void 0&&(n.lastError=e.lastError),e.lastHeartbeatAt!==void 0&&(n.lastHeartbeatAt=e.lastHeartbeatAt),n}errorCode(e){if(this.isRecord(e)&&this.isRecord(e.error)&&typeof e.error.code=="string")return e.error.code}isRecord(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}isStoreState(e){return typeof e=="string"&&cR.includes(e)}isSupport(e){return typeof e=="string"&&lR.includes(e)}isAuthMode(e){return typeof e=="string"&&aR.includes(e)}isSessionState(e){return typeof e=="string"&&sR.includes(e)}isEligibilityReason(e){return typeof e=="string"&&oR.includes(e)}isFailureCategory(e){return typeof e=="string"&&rR.includes(e)}}function dR(){return new uR}const fR=dR(),hR=3e4,pR={path:"show.system"};class gR{constructor(){G(this,"transport");G(this,"heartbeatSubscription",null);G(this,"driver");G(this,"auth");const e=window.location.origin;this.transport=new gb,this.auth=new mb(e,this.transport),this.driver=new vb(e,this.transport)}login(e,n){return this.auth.login(e,n).pipe(Dl(r=>{r?this.startHeartbeat():this.stopHeartbeat()}))}logout(){return this.stopHeartbeat(),this.auth.logout()}isAuthenticated(){return this.auth.isAuthenticated().pipe(Dl(e=>{e?this.startHeartbeat():this.stopHeartbeat()}))}get authError$(){return this.transport.authError$.pipe(Dl(()=>this.stopHeartbeat()))}startHeartbeat(){this.heartbeatSubscription===null&&(this.heartbeatSubscription=ab(0,hR).pipe(lb(()=>this.heartbeatRequest())).subscribe())}stopHeartbeat(){var e;(e=this.heartbeatSubscription)==null||e.unsubscribe(),this.heartbeatSubscription=null}heartbeatRequest(){return this.driver.queue(pR).pipe(cb(()=>ub))}}const Cd=new gR,{service:mR}=Ed("@mndw/ui","@mndw/ui"),vR=mR;function bR(t=globalThis.fetch){return N2(t)}const _R=bR(),wR=500,yR=5e3,Nh=.2,kR=100,ER=1024,SR=2048,xR=t=>(typeof t=="string"?[t]:[...t]).flatMap(n=>n.split(",")).filter(n=>n.length>0),TR=(t,e)=>t==="*"||e===t||e.startsWith(`${t}.`),CR=(t,e)=>{if(t==="*"||t===e||t.startsWith(`${e}.`))return t;if(e==="*"||e.startsWith(`${t}.`))return e},PR=(t,e)=>{const n=new Set;for(const r of t)for(const i of e){const s=CR(r,i);s!==void 0&&n.add(s)}return[...n]},RR=t=>{const e=new Set;for(const n of t){if(!n.startsWith("events:"))continue;const r=n.slice(7);for(const i of r.split(","))(i==="*"||/^[a-z][a-z0-9]*(?:\.[a-z][a-z0-9]*)*$/.test(i))&&e.add(i)}return[...e]},AR=t=>t!==null&&typeof t=="object"&&!Array.isArray(t)?t:void 0;class MR{constructor(e={}){G(this,"socketFactory");G(this,"schedule");G(this,"cancelSchedule");G(this,"random");G(this,"diagnostic");G(this,"registrations",new Map);G(this,"deliveredIds",new Set);G(this,"deliveredOrder",[]);G(this,"liveBuffer",[]);G(this,"socket");G(this,"reconnectTimer");G(this,"reconnectAttempt",0);G(this,"nextHandlerId",1);G(this,"lastSeenId","");G(this,"replayCursor","");G(this,"catchingUp",!1);G(this,"replaying",!1);G(this,"closing",!1);this.socketFactory=e.WebSocket??(typeof WebSocket>"u"?void 0:WebSocket),this.schedule=e.setTimeout??globalThis.setTimeout,this.cancelSchedule=e.clearTimeout??globalThis.clearTimeout,this.random=e.random??Math.random,this.diagnostic=e.diagnostic??((n,r)=>console.warn(`[mndw] ${n}`,r))}createFacade(e,n,r,i){const s=RR(r);if(s.length!==0)return this.disposeFacade(e),this.registrations.set(e,{id:e,pluginName:n,grants:s,subscriptions:new Map,resyncHandlers:new Map}),{select$:o=>new _a(a=>{const l=this.registrations.get(e);if(l===void 0){a.complete();return}const c=PR(xR(o),l.grants);if(c.length===0){a.complete();return}const u=this.nextHandlerId++;return l.subscriptions.set(u,{filters:c,handler:d=>a.next(d)}),this.updateWireSubscription(),()=>{l.subscriptions.delete(u)&&this.updateWireSubscription()}}).pipe(Fd(i.ended$)),resync$:new _a(o=>{const a=this.registrations.get(e);if(a===void 0){o.complete();return}const l=this.nextHandlerId++;return a.resyncHandlers.set(l,()=>o.next()),()=>{a.resyncHandlers.delete(l)}}).pipe(Fd(i.ended$))}}disposeFacade(e){this.registrations.delete(e)&&(this.updateWireSubscription(),this.registrations.size===0&&this.closeSocket())}effectiveWireFilters(){const e=new Set;for(const n of this.registrations.values())for(const r of n.subscriptions.values())for(const i of r.filters)e.add(i);return[...e].sort()}ensureSocket(){if(this.socket!==void 0||this.reconnectTimer!==void 0||this.closing||this.effectiveWireFilters().length===0)return;if(this.socketFactory===void 0){this.diagnostic("event stream WebSocket is unavailable");return}const e=new this.socketFactory("/ws/events");this.socket=e,e.addEventListener("open",()=>this.handleOpen(e)),e.addEventListener("message",n=>this.handleMessage(e,n.data)),e.addEventListener("close",()=>this.handleClose(e)),e.addEventListener("error",n=>this.diagnostic("event stream socket error",n))}handleOpen(e){this.socket===e&&(this.reconnectAttempt=0,this.sendSubscribe(),this.catchingUp=!0,this.replaying=!1,this.replayCursor=this.lastSeenId,this.requestReplay(this.lastSeenId))}handleClose(e){this.socket===e&&(this.socket=void 0,this.registrations.size>0&&!this.closing&&this.scheduleReconnect())}handleMessage(e,n){if(this.socket!==e||typeof n!="string")return;let r;try{r=JSON.parse(n)}catch(s){this.diagnostic("event stream returned invalid JSON",s);return}const i=AR(r);(i==null?void 0:i.type)==="event"?this.handleIncomingEvent(i.event):(i==null?void 0:i.type)==="replay"?this.handleReplay(i):(i==null?void 0:i.type)==="error"&&this.handleServerError(i)}handleIncomingEvent(e){const n=Lf.safeParse(e);if(!n.success){this.diagnostic("event stream returned invalid event",n.error);return}if(this.catchingUp){if(this.liveBuffer.length>=ER){this.liveBuffer.length=0,this.closeActiveSocket();return}this.liveBuffer.push(n.data);return}this.deliver(n.data)}handleReplay(e){if(!this.catchingUp||!Array.isArray(e.events)||typeof e.hasMore!="boolean")return;const n=e.events.map(i=>Lf.safeParse(i)).filter(i=>i.success);for(const i of n)i.success&&(this.replayCursor=i.data.id,this.deliver(i.data));if(this.replaying=!1,e.hasMore&&this.replayCursor!==""){this.requestReplay(this.replayCursor);return}this.catchingUp=!1,this.replaying=!1;const r=this.liveBuffer.splice(0);for(const i of r)this.deliver(i);for(const i of this.registrations.values())for(const s of i.resyncHandlers.values())try{s()}catch(o){this.diagnostic(`event resync handler failed for ${i.pluginName}`,o)}}handleServerError(e){if(e.code==="CURSOR_EXPIRED"){this.catchingUp=!1,this.replaying=!1;const r=this.liveBuffer.splice(0);for(const i of r)this.deliver(i);this.diagnostic("event stream replay cursor expired");for(const i of this.registrations.values())for(const s of i.resyncHandlers.values())try{s()}catch(o){this.diagnostic(`event resync handler failed for ${i.pluginName}`,o)}return}const n=typeof e.message=="string"?e.message:typeof e.code=="string"?e.code:"unknown";this.diagnostic(`event stream server error: ${n}`)}deliver(e){if(this.lastSeenId=e.id,!this.deliveredIds.has(e.id)){for(this.deliveredIds.add(e.id),this.deliveredOrder.push(e.id);this.deliveredOrder.length>SR;){const n=this.deliveredOrder.shift();n!==void 0&&this.deliveredIds.delete(n)}for(const n of this.registrations.values())for(const r of n.subscriptions.values())if(r.filters.some(i=>TR(i,e.topic)))try{r.handler(e)}catch(i){this.diagnostic(`event handler failed for ${n.pluginName}`,i)}}}sendSubscribe(){this.send({type:"subscribe",topics:this.effectiveWireFilters()})}updateWireSubscription(){const e=this.effectiveWireFilters();if(e.length===0){this.closeSocket();return}const n=this.socket;(n==null?void 0:n.readyState)===1&&!this.catchingUp&&this.send({type:"subscribe",topics:e}),this.ensureSocket()}requestReplay(e){this.replaying||(this.replaying=!0,this.send({type:"replay",after:e,limit:kR}))}send(e){const n=this.socket;(n==null?void 0:n.readyState)===1&&n.send(JSON.stringify(e))}scheduleReconnect(){if(this.reconnectTimer!==void 0||this.effectiveWireFilters().length===0)return;const e=Math.min(yR,wR*2**this.reconnectAttempt++),n=1-Nh+this.random()*2*Nh;this.reconnectTimer=this.schedule(()=>{this.reconnectTimer=void 0,this.ensureSocket()},Math.round(e*n))}closeActiveSocket(){const e=this.socket;e!==void 0&&(this.catchingUp=!1,this.replaying=!1,e.close(1008,"event stream catch-up overflow"))}closeSocket(){this.reconnectTimer!==void 0&&(this.cancelSchedule(this.reconnectTimer),this.reconnectTimer=void 0),this.catchingUp=!1,this.replaying=!1,this.liveBuffer.length=0;const e=this.socket;this.socket=void 0,e!==void 0&&e.close(1e3,"no event subscribers")}}function OR(t={}){return new MR(t)}const NR=Object.freeze({mgmtClient:xd,palette:Td,catalog:Do,locale:nC,registry:bs,persistentRci:fR,rci:Cd,telemetry:_R,eventStream:OR(),overlay:vR});function so(){return NR}const Su="mndw:sandbox-reloaded";function zR(t){const e=t;if(typeof e.createInstance!="function")throw new Error("Sandbox plugin does not export { createInstance }");return e}function IR(t){const e={};if(t===void 0)return{routes:e};for(const n of t.routes)e[n.id]=n.transport==="http"?{transport:"http",method:n.method,path:n.path}:{transport:"websocket",path:n.path,...n.protocols===void 0?{}:{protocols:n.protocols}};return{routes:e}}function LR(t,e){const n={name:t.name,version:t.version,label:t.label,entry:t.entry,...t.icon!==void 0?{icon:t.icon}:{},...t.i18n===void 0?{}:{i18n:t.i18n},...e===void 0?{}:{catalogBaseUrl:e},source:"builtin",approval:"approved",enabled:!0,depsStatus:"ready",backend:IR(t.backend)};return t.type==="widget"?{...n,type:"widget",size:t.size,...t.fixedHeight===!0?{fixedHeight:!0}:{}}:{...n,type:"page",route:t.route}}async function Sv(t){if(t.importPluginModule===void 0||t.importManifestModule===void 0)throw new Error("Sandbox imports were not provided");const e=zR(await t.importPluginModule()),n=await t.importManifestModule();if(n.default===void 0||n.default===null)throw new Error("Sandbox manifest module has no default export");const r=LC(n.default),i=t.catalogBaseUrl??n.__catalogBaseUrl,s=LR(r,i),o=t.catalogService??Do,a=t.getLocale??os,l=rv(s.name,s.version,i??`/plugins/${s.name}`,s.i18n),c=l===void 0?void 0:o.createPluginCatalogCell(l,a());return c!==void 0&&await o.loadInitialPluginCatalog(c,a()),{entry:s,module:e,...c===void 0?{}:{catalog:c}}}async function DR(t={}){const e=t.registry??bs;try{const n=await Sv(t);e.register(n),console.log(`[mndw] Sandbox plugin loaded: ${n.entry.name}`)}catch(n){console.error("[mndw] Failed to load sandbox plugin:",n)}}async function HR(t={}){const e=t.registry??bs,n=t.remountWidgets??BR,r=t.reloadPage??$R,i=t.pluginContextServices??(()=>{const c=so();return{locale:c.locale,palette:c.palette,telemetry:c.telemetry,eventStream:c.eventStream}})();let s;try{s=await Sv(t)}catch(c){return console.error("[mndw] Sandbox reload rejected (invalid update kept previous plugin):",c),"failed"}const o=s.entry.name,a=e.get(o);if(a===void 0)return e.register(s),"reloaded";let l;try{l=e.replace(s)}catch(c){return console.error(`[mndw] Sandbox reload needs a restart of \`mndw dev\`: ${c.message}`),"restart-required"}try{const c=await n(o,s,a,e,i),u=await r(o,s,a);if(!c||!u)throw new Error("a widget or page remount reported failure");return console.log(`[mndw] Sandbox plugin reloaded: ${o}`),"reloaded"}catch(c){return e.replace(l),console.error(`[mndw] Sandbox reload failed, kept previous plugin "${o}":`,c),"failed"}}async function BR(t,e,n,r,i){const{remountWidgetTiles:s}=await Pa(async()=>{const{remountWidgetTiles:o}=await Promise.resolve().then(()=>xA);return{remountWidgetTiles:o}},[]);return s(i,r,t,e,n)}async function $R(t,e,n){const r=[],i={pluginName:t,next:e,prior:n,register:o=>r.push(o)};return window.dispatchEvent(new CustomEvent(Su,{detail:i})),(await Promise.all(r)).every(Boolean)}const xv={importPluginModule:()=>Pa(()=>import("./_virtual_sandbox-plugin-Cg-1CvkF.js"),[]),importManifestModule:()=>Pa(()=>import("./_virtual_sandbox-manifest-DbTeSIus.js"),[])};function na(){return{received:!1,value:void 0}}function UR(t,e){let n=na(),r=na(),i=!1,s=Promise.resolve();const o=()=>{i||(i=!0,queueMicrotask(()=>{i=!1;const a=n,l=r;n=na(),r=na();const c={importPluginModule:a.received?()=>Promise.resolve(a.value):e.importPluginModule,importManifestModule:l.received?()=>Promise.resolve(l.value):e.importManifestModule};s=s.then(()=>HR({...c,registry:t.registry,catalogService:t.catalog,getLocale:()=>t.locale.getLocale(),pluginContextServices:{locale:t.locale,palette:t.palette,telemetry:t.telemetry,eventStream:t.eventStream}})).then(()=>{}).catch(u=>{console.error("[mndw] Sandbox HMR transaction failed:",u)})}))};return{plugin:a=>{n={received:!0,value:a},o()},manifest:a=>{r={received:!0,value:a},o()}}}function jR(t,e=void 0,n=xv){if(e===void 0)return;const r=UR(t,n);e.accept("virtual:sandbox-plugin",i=>{r.plugin(i)}),e.accept("virtual:sandbox-manifest",i=>{r.manifest(i)})}class D{static getElements(e,n=document){if(typeof e=="string"){const r="getElementById"in n?n:void 0;if(r&&!isNaN(+e[0])){const s=r.getElementById(e);return s?[s]:[]}let i=n.querySelectorAll(e);if(!i.length&&e[0]!=="."&&e[0]!=="#"&&(i=n.querySelectorAll("."+e),i.length||(i=n.querySelectorAll("#"+e)),!i.length)){const s=n.querySelector(`[gs-id="${e}"]`);return s?[s]:[]}return Array.from(i)}return[e]}static getElement(e,n=document){if(typeof e=="string"){const r="getElementById"in n?n:void 0;if(!e.length)return null;if(r&&e[0]==="#")return r.getElementById(e.substring(1));if(e[0]==="#"||e[0]==="."||e[0]==="[")return n.querySelector(e);if(r&&!isNaN(+e[0]))return r.getElementById(e);let i=n.querySelector(e);return r&&!i&&(i=r.getElementById(e)),i||(i=n.querySelector("."+e)),i}return e}static lazyLoad(e){var n,r;return e.lazyLoad||((r=(n=e.grid)==null?void 0:n.opts)==null?void 0:r.lazyLoad)&&e.lazyLoad!==!1}static createDiv(e,n){const r=document.createElement("div");return e.forEach(i=>{i&&r.classList.add(i)}),n==null||n.appendChild(r),r}static shouldSizeToContent(e,n=!1){return(e==null?void 0:e.grid)&&(n?e.sizeToContent===!0||e.grid.opts.sizeToContent===!0&&e.sizeToContent===void 0:!!e.sizeToContent||e.grid.opts.sizeToContent&&e.sizeToContent!==!1)}static isIntercepted(e,n){return!(e.y>=n.y+n.h||e.y+e.h<=n.y||e.x+e.w<=n.x||e.x>=n.x+n.w)}static isTouching(e,n){return D.isIntercepted(e,{x:n.x-.5,y:n.y-.5,w:n.w+1,h:n.h+1})}static areaIntercept(e,n){const r=e.x>n.x?e.x:n.x,i=e.x+e.w<n.x+n.w?e.x+e.w:n.x+n.w;if(i<=r)return 0;const s=e.y>n.y?e.y:n.y,o=e.y+e.h<n.y+n.h?e.y+e.h:n.y+n.h;return o<=s?0:(i-r)*(o-s)}static area(e){return e.w*e.h}static sort(e,n=1){return e.sort((i,s)=>{const o=n*((i.y??1e4)-(s.y??1e4));return o===0?n*((i.x??1e4)-(s.x??1e4)):o})}static find(e,n){return n?e.find(r=>r.id===n):void 0}static toBool(e){return typeof e=="boolean"?e:typeof e=="string"?(e=e.toLowerCase(),!(e===""||e==="no"||e==="false"||e==="0")):!!e}static toNumber(e){return e===null||e.length===0?void 0:Number(e)}static parseHeight(e){let n,r="px";if(typeof e=="string")if(e==="auto"||e==="")n=0;else{const i=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!i)throw new Error(`Invalid height val = ${e}`);r=i[2]||"px",n=parseFloat(i[1])}else n=e;return{h:n,unit:r}}static defaults(e,...n){return n.forEach(r=>{for(const i in r){if(!r.hasOwnProperty(i))return;e[i]===null||e[i]===void 0?e[i]=r[i]:typeof r[i]=="object"&&typeof e[i]=="object"&&D.defaults(e[i],r[i])}}),e}static same(e,n){if(typeof e!="object")return e==n;if(typeof e!=typeof n||Object.keys(e).length!==Object.keys(n).length)return!1;for(const r in e)if(e[r]!==n[r])return!1;return!0}static copyPos(e,n,r=!1){return n.x!==void 0&&(e.x=n.x),n.y!==void 0&&(e.y=n.y),n.w!==void 0&&(e.w=n.w),n.h!==void 0&&(e.h=n.h),r&&(n.minW&&(e.minW=n.minW),n.minH&&(e.minH=n.minH),n.maxW&&(e.maxW=n.maxW),n.maxH&&(e.maxH=n.maxH)),e}static samePos(e,n){return e&&n&&e.x===n.x&&e.y===n.y&&(e.w||1)===(n.w||1)&&(e.h||1)===(n.h||1)}static sanitizeMinMax(e){e.minW||delete e.minW,e.minH||delete e.minH,e.maxW||delete e.maxW,e.maxH||delete e.maxH}static removeInternalAndSame(e,n){if(!(typeof e!="object"||typeof n!="object")&&!(Array.isArray(e)||Array.isArray(n)))for(let r in e){const i=e[r],s=n[r];r[0]==="_"||i===s?delete e[r]:i&&typeof i=="object"&&s!==void 0&&(D.removeInternalAndSame(i,s),Object.keys(i).length||delete e[r])}}static removeInternalForSave(e,n=!0){for(let r in e)(r[0]==="_"||e[r]===null||e[r]===void 0)&&delete e[r];delete e.grid,n&&delete e.el,e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,e.locked||delete e.locked,(e.w===1||e.w===e.minW)&&delete e.w,(e.h===1||e.h===e.minH)&&delete e.h}static throttle(e,n){let r=!1;return(...i)=>{r||(r=!0,setTimeout(()=>{e(...i),r=!1},n))}}static removePositioningStyles(e){const n=e.style;n.position&&n.removeProperty("position"),n.left&&n.removeProperty("left"),n.top&&n.removeProperty("top"),n.width&&n.removeProperty("width"),n.height&&n.removeProperty("height")}static getScrollElement(e){if(!e)return document.scrollingElement||document.documentElement;const n=getComputedStyle(e).overflowY;return(n==="auto"||n==="scroll")&&e.scrollHeight>e.clientHeight?e:D.getScrollElement(e.parentElement)}static updateScrollResize(e,n,r){const i=D.getScrollElement(n),s=i.clientHeight,o=i===D.getScrollElement()?0:i.getBoundingClientRect().top,a=e.clientY-o,l=a<r,c=a>s-r;l?i.scrollBy({behavior:"smooth",top:a-r}):c&&i.scrollBy({behavior:"smooth",top:r-(s-a)})}static clone(e){return e==null||typeof e!="object"?e:e instanceof Array?[...e]:{...e}}static cloneDeep(e){const n=["parentGrid","el","grid","subGrid","engine"],r=D.clone(e);for(const i in r)r.hasOwnProperty(i)&&typeof r[i]=="object"&&i.substring(0,2)!=="__"&&!n.find(s=>s===i)&&(r[i]=D.cloneDeep(e[i]));return r}static cloneNode(e){const n=e.cloneNode(!0);return n.removeAttribute("id"),n}static appendTo(e,n){let r;typeof n=="string"?r=D.getElement(n):r=n,r&&r.appendChild(e)}static addElStyles(e,n){if(n instanceof Object)for(const r in n)n.hasOwnProperty(r)&&(Array.isArray(n[r])?n[r].forEach(i=>{e.style[r]=i}):e.style[r]=n[r])}static initEvent(e,n){const r={type:n.type},i={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:n.target?n.target:e.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(s=>r[s]=e[s]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(s=>r[s]=e[s]),{...r,...i}}static simulateMouseEvent(e,n,r){const i=e,s=new MouseEvent(n,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,ctrlKey:i.ctrlKey??!1,altKey:i.altKey??!1,shiftKey:i.shiftKey??!1,metaKey:i.metaKey??!1,button:0,relatedTarget:e.target});(r||e.target).dispatchEvent(s)}static getValuesFromTransformedElement(e){const n=document.createElement("div");D.addElStyles(n,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),e.appendChild(n);const r=n.getBoundingClientRect();return e.removeChild(n),n.remove(),{xScale:1/r.width,yScale:1/r.height,xOffset:r.left,yOffset:r.top}}static swap(e,n,r){if(!e)return;const i=e[n];e[n]=e[r],e[r]=i}static canBeRotated(e){var n;return!(!e||e.w===e.h||e.locked||e.noResize||(n=e.grid)!=null&&n.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class vr{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange}batchUpdate(e=!0,n=!0){return!!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,n&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,n){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||n.y<=e.y)}_fixCollisions(e,n=e,r,i={}){if(this.sortNodes(-1),r=r||this.collide(e,n),!r)return!1;if(e._moving&&!i.nested&&!this.float&&this.swap(e,r))return!0;let s=n;!this._loading&&this._useEntireRowArea(e,n)&&(s={x:0,w:this.column,y:n.y,h:n.h},r=this.collide(e,s,i.skip));let o=!1;const a={nested:!0,pack:!1};let l=0;for(;r=r||this.collide(e,s,i.skip);){if(l++>this.nodes.length*2)throw new Error("Infinite collide check");let c;if(r.locked||this._loading||e._moving&&!e._skipDown&&n.y>e.y&&!this.float&&(!this.collide(r,{...r,y:e.y},e)||!this.collide(r,{...r,y:n.y-r.h},e))){e._skipDown=e._skipDown||n.y>e.y;const u={...n,y:r.y+r.h,...a};c=this._loading&&D.samePos(e,u)?!0:this.moveNode(e,u),(r.locked||this._loading)&&c?D.copyPos(n,e):!r.locked&&c&&i.pack&&(this._packNodes(),n.y=r.y+r.h,D.copyPos(e,n)),o=o||c}else c=this.moveNode(r,{...r,y:n.y+n.h,skip:e,...a});if(!c)return o;r=void 0}return o}collide(e,n=e,r){const i=e._id,s=r==null?void 0:r._id;return this.nodes.find(o=>o._id!==i&&o._id!==s&&D.isIntercepted(o,n))}collideAll(e,n=e,r){const i=e._id,s=r==null?void 0:r._id;return this.nodes.filter(o=>o._id!==i&&o._id!==s&&D.isIntercepted(o,n))}directionCollideCoverage(e,n,r){if(!n.rect||!e._rect)return;const i=e._rect,s={...n.rect};s.y>i.y?(s.h+=s.y-i.y,s.y=i.y):s.h+=i.y-s.y,s.x>i.x?(s.w+=s.x-i.x,s.x=i.x):s.w+=i.x-s.x;let o,a=.5;for(let l of r){if(l.locked||!l._rect)break;const c=l._rect;let u=Number.MAX_VALUE,d=Number.MAX_VALUE;i.y<c.y?u=(s.y+s.h-c.y)/c.h:i.y+i.h>c.y+c.h&&(u=(c.y+c.h-s.y)/c.h),i.x<c.x?d=(s.x+s.w-c.x)/c.w:i.x+i.w>c.x+c.w&&(d=(c.x+c.w-s.x)/c.w);const h=Math.min(d,u);h>a&&(a=h,o=l)}return n.collide=o,o}cacheRects(e,n,r,i,s,o){return this.nodes.forEach(a=>a._rect={y:a.y*n+r,x:a.x*e+o,w:a.w*e-o-i,h:a.h*n-r-s}),this}swap(e,n){if(!n||n.locked||!e||e.locked)return!1;function r(){const s=n.x,o=n.y;return n.x=e.x,n.y=e.y,e.h!=n.h?(e.x=s,e.y=n.y+n.h):e.w!=n.w?(e.x=n.x+n.w,e.y=o):(e.x=s,e.y=o),e._dirty=n._dirty=!0,!0}let i;if(e.w===n.w&&e.h===n.h&&(e.x===n.x||e.y===n.y)&&(i=D.isTouching(e,n)))return r();if(i!==!1){if(e.w===n.w&&e.x===n.x&&(i||(i=D.isTouching(e,n)))){if(n.y<e.y){const s=e;e=n,n=s}return r()}if(i!==!1){if(e.h===n.h&&e.y===n.y&&(i||(i=D.isTouching(e,n)))){if(n.x<e.x){const s=e;e=n,n=s}return r()}return!1}}}isAreaEmpty(e,n,r,i){const s={x:e||0,y:n||0,w:r||1,h:i||1};return!this.collide(s)}compact(e="compact",n=!0){if(this.nodes.length===0)return this;n&&this.sortNodes();const r=this.batchMode;r||this.batchUpdate();const i=this._inColumnResize;i||(this._inColumnResize=!0);const s=this.nodes;return this.nodes=[],s.forEach((o,a,l)=>{let c;o.locked||(o.autoPosition=!0,e==="list"&&a&&(c=l[a-1])),this.addNode(o,!1,c)}),i||delete this._inColumnResize,r||this.batchUpdate(!1),this}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(e=1){return this.nodes=D.sort(this.nodes,e),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(e=>{if(e._updating||e._orig===void 0||e.y===e._orig.y)return;let n=e.y;for(;n>e._orig.y;)--n,this.collide(e,{x:e.x,y:n,w:e.w,h:e.h})||(e._dirty=!0,e.y=n)}):this.nodes.forEach((e,n)=>{if(!e.locked)for(;e.y>0;){const r=n===0?0:e.y-1;if(!(n===0||!this.collide(e,{x:e.x,y:r,w:e.w,h:e.h})))break;e._dirty=e.y!==r,e.y=r}}),this)}prepareNode(e,n){e._id=e._id??vr._idSeq++;const r=e.id;if(r){let s=1;for(;this.nodes.find(o=>o.id===e.id&&o!==e);)e.id=r+"_"+s++}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=!0);const i={x:0,y:0,w:1,h:1};return D.defaults(e,i),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,D.sanitizeMinMax(e),typeof e.x=="string"&&(e.x=Number(e.x)),typeof e.y=="string"&&(e.y=Number(e.y)),typeof e.w=="string"&&(e.w=Number(e.w)),typeof e.h=="string"&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=i.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=i.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=i.w),isNaN(e.h)&&(e.h=i.h),this.nodeBoundFix(e,n),e}nodeBoundFix(e,n){const r=e._orig||D.copyPos({},e);if(e.maxW&&(e.w=Math.min(e.w||1,e.maxW)),e.maxH&&(e.h=Math.min(e.h||1,e.maxH)),e.minW&&(e.w=Math.max(e.w||1,e.minW)),e.minH&&(e.h=Math.max(e.h||1,e.minH)),(e.x||0)+(e.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&e._id!=null&&this.findCacheLayout(e,this.defaultColumn)===-1){const s={...e};s.autoPosition||s.x===void 0?(delete s.x,delete s.y):s.x=Math.min(this.defaultColumn-1,s.x),s.w=Math.min(this.defaultColumn,s.w||1),this.cacheOneLayout(s,this.defaultColumn)}return e.w>this.column?e.w=this.column:e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(n?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(n?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),D.samePos(e,r)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(n=>n._dirty&&!D.samePos(n,n._orig)):this.nodes.filter(n=>n._dirty)}_notify(e){if(this.batchMode||!this.onChange)return this;const n=(e||[]).concat(this.getDirtyNodes());return this.onChange(n),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(e=>{delete e._dirty,delete e._lastTried}),this)}saveInitial(){return this.nodes.forEach(e=>{e._orig=D.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||D.samePos(e,e._orig)||(D.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,n=this.nodes,r=this.column,i){const s=i?i.y*r+(i.x+i.w):0;let o=!1;for(let a=s;!o;++a){const l=a%r,c=Math.floor(a/r);if(l+e.w>r)continue;const u={x:l,y:c,w:e.w,h:e.h};n.find(d=>D.isIntercepted(u,d))||((e.x!==l||e.y!==c)&&(e._dirty=!0),e.x=l,e.y=c,delete e.autoPosition,o=!0)}return o}addNode(e,n=!1,r){const i=this.nodes.find(o=>o._id===e._id);if(i)return i;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let s;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,r)&&(delete e.autoPosition,s=!0),this.nodes.push(e),n&&this.addedNodes.push(e),s||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,n=!0,r=!1){return this.nodes.find(i=>i._id===e._id)?(r&&this.removedNodes.push(e),n&&(e._removeDOM=!0),this.nodes=this.nodes.filter(i=>i._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=!0,n=!0){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(i=>i._removeDOM=!0);const r=this.nodes;return this.removedNodes=n?r:[],this.nodes=[],this._notify(r)}moveNodeCheck(e,n){if(!this.changedPosConstrain(e,n))return!1;if(n.pack=!0,!this.maxRow)return this.moveNode(e,n);let r;const i=new vr({column:this.column,float:this.float,nodes:this.nodes.map(o=>o._id===e._id?(r={...o},r):{...o})});if(!r)return!1;const s=i.moveNode(r,n)&&i.getRow()<=Math.max(this.getRow(),this.maxRow);if(!s&&!n.resizing&&n.collide){const o=n.collide.el.gridstackNode;if(this.swap(e,o))return this._notify(),!0}return s?(i.nodes.filter(o=>o._dirty).forEach(o=>{const a=this.nodes.find(l=>l._id===o._id);a&&(D.copyPos(a,o),a._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const n=new vr({column:this.column,float:this.float,nodes:this.nodes.map(i=>({...i}))}),r={...e};return this.cleanupNode(r),delete r.el,delete r._id,delete r.content,delete r.grid,n.addNode(r),n.getRow()<=this.maxRow?(e._willFitPos=D.copyPos({},r),!0):!1}changedPosConstrain(e,n){return n.w=n.w||e.w,n.h=n.h||e.h,e.x!==n.x||e.y!==n.y?!0:(e.maxW&&(n.w=Math.min(n.w,e.maxW)),e.maxH&&(n.h=Math.min(n.h,e.maxH)),e.minW&&(n.w=Math.max(n.w,e.minW)),e.minH&&(n.h=Math.max(n.h,e.minH)),e.w!==n.w||e.h!==n.h)}moveNode(e,n){var c,u;if(!e||!n)return!1;let r;n.pack===void 0&&!this.batchMode&&(r=n.pack=!0),typeof n.x!="number"&&(n.x=e.x),typeof n.y!="number"&&(n.y=e.y),typeof n.w!="number"&&(n.w=e.w),typeof n.h!="number"&&(n.h=e.h);const i=e.w!==n.w||e.h!==n.h,s=D.copyPos({},e,!0);if(D.copyPos(s,n),this.nodeBoundFix(s,i),D.copyPos(n,s),!n.forceCollide&&D.samePos(e,n))return!1;const o=D.copyPos({},e),a=this.collideAll(e,s,n.skip);let l=!0;if(a.length){const d=e._moving&&!n.nested;let h=d?this.directionCollideCoverage(e,n,a):a[0];if(d&&h&&((u=(c=e.grid)==null?void 0:c.opts)!=null&&u.subGridDynamic)&&!e.grid._isTemp){const p=D.areaIntercept(n.rect,h._rect),g=D.area(n.rect),m=D.area(h._rect);p/(g<m?g:m)>.8&&(h.grid.makeSubGrid(h.el,void 0,e),h=void 0)}h?l=!this._fixCollisions(e,s,h,n):(l=!1,r&&delete n.pack)}return l&&!D.samePos(e,s)&&(e._dirty=!0,D.copyPos(e,s)),n.pack&&this._packNodes()._notify(),!D.samePos(e,o)}getRow(){return this.nodes.reduce((e,n)=>Math.max(e,n.y+n.h),0)}beginUpdate(e){return e._updating||(e._updating=!0,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const e=this.nodes.find(n=>n._updating);return e&&(delete e._updating,delete e._skipDown),this}save(e=!0,n,r){var a;const i=((a=this._layouts)==null?void 0:a.length)||0;let s;i&&(r?r!==this.column&&(s=this._layouts[r]):this.column!==i-1&&(s=this._layouts[i-1]));const o=[];return this.sortNodes(),this.nodes.forEach(l=>{const c=s==null?void 0:s.find(d=>d._id===l._id),u={...l,...c||{}};D.removeInternalForSave(u,!e),n&&n(l,u),o.push(u)}),o}layoutsNodesChange(e){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((n,r)=>{if(!n||r===this.column)return this;if(r<this.column)this._layouts[r]=void 0;else{const i=r/this.column;e.forEach(s=>{if(!s._orig)return;const o=n.find(a=>a._id===s._id);o&&(o.y>=0&&s.y!==s._orig.y&&(o.y+=s.y-s._orig.y,o.y<0&&(o.y=0)),s.x!==s._orig.x&&(o.x=Math.round(s.x*i),o.x<0&&(o.x=0)),s.w!==s._orig.w&&(o.w=Math.round(s.w*i),o.w<1&&(o.w=1)))})}}),this)}columnChanged(e,n,r="moveScale"){var a;if(!this.nodes.length||!n||e===n)return this;const i=r==="compact"||r==="list";i&&this.sortNodes(1),n<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let s=[],o=i?this.nodes:D.sort(this.nodes,-1);if(n>e&&this._layouts){const l=this._layouts[n]||[],c=this._layouts.length-1;!l.length&&e!==c&&((a=this._layouts[c])!=null&&a.length)&&(e=c,this._layouts[c].forEach(u=>{const d=o.find(h=>h._id===u._id);d&&(!i&&!u.autoPosition&&(d.x=u.x??d.x,d.y=u.y??d.y),d.w=u.w??d.w,(u.x==null||u.y===void 0)&&(d.autoPosition=!0))})),l.forEach(u=>{const d=o.findIndex(h=>h._id===u._id);if(d!==-1){const h=o[d];if(i){h.w=u.w;return}(u.autoPosition||isNaN(u.x)||isNaN(u.y))&&this.findEmptyPosition(u,s),u.autoPosition||(h.x=u.x??h.x,h.y=u.y??h.y,h.w=u.w??h.w,s.push(h)),o.splice(d,1)}})}if(i)this.compact(r,!1);else{if(o.length)if(typeof r=="function")r(n,e,s,o);else{const l=i||r==="none"?1:n/e,c=r==="move"||r==="moveScale",u=r==="scale"||r==="moveScale";o.forEach(d=>{d.x=n===1?0:c?Math.round(d.x*l):Math.min(d.x,n-1),d.w=n===1||e===1?1:u?Math.round(d.w*l)||1:Math.min(d.w,n),s.push(d)}),o=[]}s=D.sort(s,-1),this._inColumnResize=!0,this.nodes=[],s.forEach(l=>{this.addNode(l,!1),delete l._orig})}return this.nodes.forEach(l=>delete l._orig),this.batchUpdate(!1,!i),delete this._inColumnResize,this}cacheLayout(e,n,r=!1){const i=[];return e.forEach((s,o)=>{if(s._id===void 0){const a=s.id?this.nodes.find(l=>l.id===s.id):void 0;s._id=(a==null?void 0:a._id)??vr._idSeq++}i[o]={x:s.x,y:s.y,w:s.w,_id:s._id}}),this._layouts=r?[]:this._layouts||[],this._layouts[n]=i,this}cacheOneLayout(e,n){e._id=e._id??vr._idSeq++;const r={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete r.x,delete r.y,e.autoPosition&&(r.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[n]=this._layouts[n]||[];const i=this.findCacheLayout(e,n);return i===-1?this._layouts[n].push(r):this._layouts[n][i]=r,this}findCacheLayout(e,n){var r,i;return((i=(r=this._layouts)==null?void 0:r[n])==null?void 0:i.findIndex(s=>s._id===e._id))??-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let n=0;n<this._layouts.length;n++){const r=this.findCacheLayout(e,n);r!==-1&&this._layouts[n].splice(r,1)}}cleanupNode(e){for(const n in e)n[0]==="_"&&n!=="_id"&&delete e[n];return this}}vr._idSeq=0;const vn={alwaysShowResizeHandle:"mobile",animate:!0,auto:!0,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:!0},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"};class xe{}const Fn=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0);class yn{}function Ga(t,e){t.touches.length>1||(t.cancelable&&t.preventDefault(),D.simulateMouseEvent(t.changedTouches[0],e))}function Tv(t,e){t.cancelable&&t.preventDefault(),D.simulateMouseEvent(t,e)}function Va(t){yn.touchHandled||(yn.touchHandled=!0,Ga(t,"mousedown"))}function Za(t){yn.touchHandled&&Ga(t,"mousemove")}function Wa(t){if(!yn.touchHandled)return;yn.pointerLeaveTimeout&&(window.clearTimeout(yn.pointerLeaveTimeout),delete yn.pointerLeaveTimeout);const e=!!xe.dragElement;Ga(t,"mouseup"),e||Ga(t,"click"),yn.touchHandled=!1}function qa(t){t.pointerType!=="mouse"&&t.target.releasePointerCapture(t.pointerId)}function zh(t){xe.dragElement&&t.pointerType!=="mouse"&&Tv(t,"mouseenter")}function Ih(t){xe.dragElement&&t.pointerType!=="mouse"&&(yn.pointerLeaveTimeout=window.setTimeout(()=>{delete yn.pointerLeaveTimeout,Tv(t,"mouseleave")},10))}class Nl{constructor(e,n,r){this.host=e,this.dir=n,this.option=r,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){if(this.option.element)try{this.el=this.option.element instanceof HTMLElement?this.option.element:this.host.querySelector(this.option.element)}catch(e){this.option.element=void 0,console.error("Query for resizeable handle failed, falling back",e)}return this.el||(this.el=document.createElement("div"),this.host.appendChild(this.el)),this.el.classList.add("ui-resizable-handle"),this.el.classList.add(`${Nl.prefix}${this.dir}`),this.el.style.zIndex="100",this.el.style.userSelect="none",this.el.addEventListener("mousedown",this._mouseDown),Fn&&(this.el.addEventListener("touchstart",Va),this.el.addEventListener("pointerdown",qa)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),Fn&&(this.el.removeEventListener("touchstart",Va),this.el.removeEventListener("pointerdown",qa)),this.option.element||this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(e){this.mouseDownEvent=e,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Fn&&(this.el.addEventListener("touchmove",Za),this.el.addEventListener("touchend",Wa)),e.stopPropagation(),e.preventDefault()}_mouseMove(e){const n=this.mouseDownEvent;this.moving?this._triggerEvent("move",e):Math.abs(e.x-n.x)+Math.abs(e.y-n.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",e),document.addEventListener("keydown",this._keyEvent)),e.stopPropagation()}_mouseUp(e){this.moving&&(this._triggerEvent("stop",e),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Fn&&(this.el.removeEventListener("touchmove",Za),this.el.removeEventListener("touchend",Wa)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault()}_keyEvent(e){var n,r;e.key==="Escape"&&((r=(n=this.host.gridstackNode)==null?void 0:n.grid)==null||r.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(e,n){return this.option[e]&&this.option[e](n),this}}Nl.prefix="ui-resizable-";class Pd{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(e,n){this._eventRegister[e]=n}off(e){delete this._eventRegister[e]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(e,n){if(!this.disabled&&this._eventRegister&&this._eventRegister[e])return this._eventRegister[e](n)}}class oo extends Pd{constructor(e,n={}){super(),this.el=e,this.option=n,this.rectScale={x:1,y:1},this._ui=()=>{const i=this.el.parentElement.getBoundingClientRect(),s={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,right:this.originalRect.right,top:this.originalRect.top-this.scrolled},o=this.temporalRect||s;return{position:{left:this.option.rtl?(i.right-o.right)*this.rectScale.x:(o.left-i.left)*this.rectScale.x,top:(o.top-i.top)*this.rectScale.y},size:{width:o.width*this.rectScale.x,height:o.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(e,n){super.on(e,n)}off(e){super.off(e)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(e){const n=e.handles&&e.handles!==this.option.handles,r=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(i=>this.option[i]=e[i]),n&&(this._removeHandlers(),this._setupHandlers()),r&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),xe.overResizeElement===this&&delete xe.overResizeElement),this}_mouseOver(e){xe.overResizeElement||xe.dragElement||(xe.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){xe.overResizeElement===this&&(delete xe.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Nl(this.el,e,{element:this.option.element,start:n=>this._resizeStart(n),stop:n=>this._resizeStop(n),move:n=>this._resizing(n,e)})),this}_resizeStart(e){this.sizeToContent=D.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=D.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const n=D.initEvent(e,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(n,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",n),this}_resizing(e,n){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(e,n),this._applyChange();const r=D.initEvent(e,{type:"resize",target:this.el});return r.resizeDir=n,r.hasMovedX=this.option.rtl?n.includes("e"):n.includes("w"),r.hasMovedY=n.includes("n"),this.option.resize&&this.option.resize(r,this._ui()),this.triggerEvent("resize",r),this}_resizeStop(e){const n=D.initEvent(e,{type:"resizestop",target:this.el});return this._cleanHelper(),this.option.stop&&this.option.stop(n),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",n),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=oo._originStyleProp.map(r=>this.el.style[r]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,n=D.getValuesFromTransformedElement(e);return this.rectScale={x:n.xScale,y:n.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return oo._originStyleProp.forEach((e,n)=>{this.el.style[e]=this.elOriginStyleVal[n]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,n){const r=this.startEvent,i={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,right:this.originalRect.right,top:this.originalRect.top-this.scrolled},s=e.clientX-r.clientX,o=this.sizeToContent?0:e.clientY-r.clientY;let a,l;const c=this.option.rtl;!c&&n.indexOf("e")>-1?i.width+=s:c&&n.indexOf("w")>-1?i.width-=s:!c&&n.indexOf("w")>-1?(i.width-=s,i.left+=s,a=!0):c&&n.indexOf("e")>-1&&(i.width+=s,i.right+=s,a=!0),n.indexOf("s")>-1?i.height+=o:n.indexOf("n")>-1&&(i.height-=o,i.top+=o,l=!0);const u=this._constrainSize(i.width,i.height,a,l);return Math.round(i.width)!==Math.round(u.width)&&(!c&&n.indexOf("w")>-1?i.left+=i.width-u.width:c&&n.indexOf("e")>-1&&(i.right-=i.width-u.width),i.width=u.width),Math.round(i.height)!==Math.round(u.height)&&(n.indexOf("n")>-1&&(i.top+=i.height-u.height),i.height=u.height),i}_constrainSize(e,n,r,i){const s=this.option,o=(r?s.maxWidthMoveLeft:s.maxWidth)||Number.MAX_SAFE_INTEGER,a=s.minWidth/this.rectScale.x||e,l=(i?s.maxHeightMoveUp:s.maxHeight)||Number.MAX_SAFE_INTEGER,c=s.minHeight/this.rectScale.y||n,u=Math.min(o,Math.max(a,e)),d=Math.min(l,Math.max(c,n));return{width:u,height:d}}_applyChange(){let e={left:0,right:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const n=this.el.parentElement,{left:r,right:i,top:s}=n.getBoundingClientRect();e={left:r,right:i,top:s,width:0,height:0}}return this.temporalRect?(Object.entries(this.temporalRect).forEach(([n,r])=>{if(this.option.rtl?n==="left":n==="right")return;const i=n==="width"||n==="left"||n==="right"?this.rectScale.x:n==="height"||n==="top"?this.rectScale.y:1;let s;n==="right"?s=(e.right-r)*this.rectScale.x+"px":s=(r-e[n])*i+"px",this.el.style[n]=s}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}}oo._originStyleProp=["width","height","position","left","right","top","opacity","zIndex"];const FR='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class ao extends Pd{constructor(e,n={}){var s;super(),this.el=e,this.option=n,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},this._autoScrollTick=()=>{const o=this.helper,a=this._autoScrollContainer;if(!o||!a){this._stopScrolling();return}const l=this._getClipping(o,a);if(l===0){this._stopScrolling();return}if(!this._autoScrollMaxSpeed){const p=window.innerHeight||document.documentElement.clientHeight;this._autoScrollMaxSpeed=Math.max(p/150,4)}const c=Math.abs(l),u=Math.min(c*.5,this._autoScrollMaxSpeed),d=l>0?u:-u,h=a.scrollTop;if(a.scrollTop+=d,a.scrollTop===h){this._stopScrolling();return}this.dragging&&this.lastDrag&&(this._dragFollow(this.lastDrag),this._callDrag(this.lastDrag)),this._autoScrollAnimId=requestAnimationFrame(this._autoScrollTick)};const r=(s=n==null?void 0:n.handle)==null?void 0:s.substring(1),i=e.gridstackNode;this.dragEls=!r||e.classList.contains(r)?[e]:i!=null&&i.subGrid?[e.querySelector(n.handle)||e]:this.getAllHandles(),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}getAllHandles(){return Array.from(this.el.querySelectorAll(this.option.handle)).filter(e=>{if(!(e instanceof HTMLElement))return!1;const n=e.closest(".grid-stack-item");return n===this.el||!n})}on(e,n){super.on(e,n)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),Fn&&(e.addEventListener("touchstart",Va),e.addEventListener("pointerdown",qa))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(n=>{n.removeEventListener("mousedown",this._mouseDown),Fn&&(n.removeEventListener("touchstart",Va),n.removeEventListener("pointerdown",qa))}),e||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(e){return Object.keys(e).forEach(n=>this.option[n]=e[n]),this}_mouseDown(e){if(yn.touchHandled&&e.isTrusted&&(yn.touchHandled=!1),!xe.mouseHandled)return e.button!==0||!this.dragEls.find(n=>n===e.target)&&e.target.closest(FR)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete xe.dragElement,delete xe.dropElement,delete this._autoScrollMaxSpeed,delete this._autoScrollContainer,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Fn&&(e.currentTarget.addEventListener("touchmove",Za),e.currentTarget.addEventListener("touchend",Wa)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),xe.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const n=D.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(n,this.ui()),this.triggerEvent("drag",n)}_mouseMove(e){var r;const n=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),xe.pauseDrag){const i=Number.isInteger(xe.pauseDrag)?xe.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),i)}else this._callDrag(e);else if(Math.abs(e.x-n.x)+Math.abs(e.y-n.y)>3){this.dragging=!0,xe.dragElement=this;const i=(r=this.el.gridstackNode)==null?void 0:r.grid;i?xe.dropElement=i.el.ddElement.ddDroppable:delete xe.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=D.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const s=D.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(s,this.ui()),this.triggerEvent("dragstart",s),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){var n,r;if(this._stopScrolling(),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Fn&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",Za,!0),e.currentTarget.removeEventListener("touchend",Wa,!0)),this.dragging){delete this.dragging,(n=this.el.gridstackNode)==null||delete n._origRotate,document.removeEventListener("keydown",this._keyEvent),((r=xe.dropElement)==null?void 0:r.el)===this.el.parentElement&&delete xe.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const i=D.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(i),this.triggerEvent("dragstop",i),xe.dropElement&&xe.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete xe.dragElement,delete xe.dropElement,delete xe.mouseHandled,e.preventDefault()}_keyEvent(e){var i,s;const n=this.el.gridstackNode,r=(n==null?void 0:n.grid)||((s=(i=xe.dropElement)==null?void 0:i.el)==null?void 0:s.gridstack);if(e.key==="Escape")n&&n._origRotate&&(n._orig=n._origRotate,delete n._origRotate),r==null||r.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(n&&r&&(e.key==="r"||e.key==="R")){if(!D.canBeRotated(n))return;n._origRotate=n._origRotate||{...n._orig},delete n._moving,r.setAnimation(!1).rotate(n.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetX}).setAnimation(),n._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,n.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",D.swap(n._orig,"w","h"),delete n._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let e=this.el;return typeof this.option.helper=="function"?e=this.option.helper(this.el):this.option.helper==="clone"&&(e=D.cloneNode(this.el)),e.parentElement||D.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=ao.originStyleProp.map(n=>this.el.style[n]),e}_setupHelperStyle(e){var r,i;this.helper.classList.add("ui-draggable-dragging"),(i=(r=this.el.gridstackNode)==null?void 0:r.grid)==null||i.el.classList.add("grid-stack-dragging");const n=this.helper.style;return n.pointerEvents="none",n.width=this.dragOffset.width+"px",n.height=this.dragOffset.height+"px",n.willChange="left, right, top",n.position="fixed",this._dragFollow(e),n.transition="none",setTimeout(()=>{this.helper&&(n.transition=null)},0),this}_removeHelperStyle(){var n,r,i;this.helper.classList.remove("ui-draggable-dragging"),(r=(n=this.el.gridstackNode)==null?void 0:n.grid)==null||r.el.classList.remove("grid-stack-dragging");const e=(i=this.helper)==null?void 0:i.gridstackNode;if(!(e!=null&&e._isAboutToRemove)&&this.dragElementOriginStyle){const s=this.helper,o=this.dragElementOriginStyle.transition||null;s.style.transition=this.dragElementOriginStyle.transition="none",ao.originStyleProp.forEach(a=>s.style[a]=this.dragElementOriginStyle[a]||null),setTimeout(()=>s.style.transition=o,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const n=this.helper.style,r=this.dragOffset;this.option.rtl?(n.right=(window.innerWidth-e.clientX+r.offsetX)*this.dragTransform.xScale+"px",n.left&&(n.left="")):(n.left=(e.clientX+r.offsetX)*this.dragTransform.xScale+"px",n.right&&(n.right="")),n.top=(e.clientY+r.offsetTop)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,n,r){let i=0,s=0;r&&(i=this.dragTransform.xOffset,s=this.dragTransform.yOffset);const o=n.getBoundingClientRect();let a=this.option.rtl?o.right:o.left,l=this.option.rtl?e.clientX-o.right+i:-e.clientX+o.left-i;return{x:a,top:o.top,offsetX:l,offsetTop:-e.clientY+o.top-s,width:o.width*this.dragTransform.xScale,height:o.height*this.dragTransform.yScale}}updateScrollPosition(e){this._autoScrollContainer=D.getScrollElement(e),this._getClipping(this.helper,this._autoScrollContainer)===0?this._stopScrolling():this._autoScrollAnimId||(this._autoScrollAnimId=requestAnimationFrame(this._autoScrollTick))}_getClipping(e,n){const r=e.getBoundingClientRect(),i=n.getBoundingClientRect(),s=window.innerHeight||document.documentElement.clientHeight;if(r.bottom<i.top||r.top>i.bottom)return 0;const o=r.bottom-Math.min(i.bottom,s),a=r.top-Math.max(i.top,0);return a<0?a:o>0?o:0}_stopScrolling(){this._autoScrollAnimId&&(cancelAnimationFrame(this._autoScrollAnimId),delete this._autoScrollAnimId)}ui(){const n=this.el.parentElement.getBoundingClientRect(),r=this.helper.getBoundingClientRect(),i=this.option.rtl?(n.right-r.right)*this.dragTransform.xScale:(r.left-n.left)*this.dragTransform.xScale;return{position:{top:(r.top-n.top)*this.dragTransform.yScale,left:i}}}}ao.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","right","top","minWidth","willChange"];class GR extends Pd{constructor(e,n={}){super(),this.el=e,this.option=n,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(e,n){super.on(e,n)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),Fn&&(this.el.addEventListener("pointerenter",zh),this.el.addEventListener("pointerleave",Ih)))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),e||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),Fn&&(this.el.removeEventListener("pointerenter",zh),this.el.removeEventListener("pointerleave",Ih)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(e){return Object.keys(e).forEach(n=>this.option[n]=e[n]),this._setupAccept(),this}_mouseEnter(e){if(!xe.dragElement||yn.touchHandled&&e.isTrusted||!this._canDrop(xe.dragElement.el))return;e.preventDefault(),e.stopPropagation(),xe.dragElement._stopScrolling(),xe.dropElement&&xe.dropElement!==this&&xe.dropElement._mouseLeave(e,!0),xe.dropElement=this;const n=D.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(n,this._ui(xe.dragElement)),this.triggerEvent("dropover",n),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,n=!1){var i;if(!xe.dragElement||xe.dropElement!==this)return;e.preventDefault(),e.stopPropagation(),n&&xe.dragElement._stopScrolling();const r=D.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(r,this._ui(xe.dragElement)),this.triggerEvent("dropout",r),xe.dropElement===this&&(delete xe.dropElement,!n)){let s,o=this.el.parentElement;for(;!s&&o;)s=(i=o.ddElement)==null?void 0:i.ddDroppable,o=o.parentElement;s&&s._mouseEnter(e)}}drop(e){e.preventDefault();const n=D.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(n,this._ui(xe.dragElement)),this.triggerEvent("drop",n)}_canDrop(e){return e&&(!this.accept||this.accept(e))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=e=>e.classList.contains(this.option.accept)||e.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(e){return{draggable:e.el,...e.ui()}}}class Rd{static init(e){return e.ddElement||(e.ddElement=new Rd(e)),e.ddElement}constructor(e){this.el=e}on(e,n){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.on(e,n):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.on(e,n):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.on(e,n),this}off(e){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.off(e):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.off(e):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.off(e),this}setupDraggable(e){return this.ddDraggable?this.ddDraggable.updateOption(e):this.ddDraggable=new ao(this.el,e),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(e){return this.ddResizable?this.ddResizable.updateOption(e):this.ddResizable=new oo(this.el,e),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(e){return this.ddDroppable?this.ddDroppable.updateOption(e):this.ddDroppable=new GR(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class VR{resizable(e,n,r,i){return this._getDDElements(e,n).forEach(s=>{if(n==="disable"||n==="enable")s.ddResizable&&s.ddResizable[n]();else if(n==="destroy")s.ddResizable&&s.cleanResizable();else if(n==="option")s.setupResizable({[r]:i});else{const a=s.el.gridstackNode.grid;let l=s.el.getAttribute("gs-resize-handles")||a.opts.resizable.handles||"e,s,se";l==="all"&&(l="n,e,s,w,se,sw,ne,nw");const c=!a.opts.alwaysShowResizeHandle;s.setupResizable({...a.opts.resizable,handles:l,autoHide:c,start:n.start,stop:n.stop,resize:n.resize,rtl:n.rtl})}}),this}draggable(e,n,r,i){return this._getDDElements(e,n).forEach(s=>{if(n==="disable"||n==="enable")s.ddDraggable&&s.ddDraggable[n]();else if(n==="destroy")s.ddDraggable&&s.cleanDraggable();else if(n==="option")s.setupDraggable({[r]:i});else{const o=s.el.gridstackNode.grid;s.setupDraggable({...o.opts.draggable,start:n.start,stop:n.stop,drag:n.drag,rtl:n.rtl})}}),this}dragIn(e,n){return this._getDDElements(e).forEach(r=>r.setupDraggable(n)),this}droppable(e,n,r,i){return typeof n.accept=="function"&&!n._accept&&(n._accept=n.accept,n.accept=s=>n._accept(s)),this._getDDElements(e,n).forEach(s=>{n==="disable"||n==="enable"?s.ddDroppable&&s.ddDroppable[n]():n==="destroy"?s.ddDroppable&&s.cleanDroppable():n==="option"?s.setupDroppable({[r]:i}):s.setupDroppable(n)}),this}isDroppable(e){var n;return!!((n=e==null?void 0:e.ddElement)!=null&&n.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){var n;return!!((n=e==null?void 0:e.ddElement)!=null&&n.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){var n;return!!((n=e==null?void 0:e.ddElement)!=null&&n.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,n,r){return this._getDDElements(e).forEach(i=>i.on(n,s=>{r(s,xe.dragElement?xe.dragElement.el:s.target,xe.dragElement?xe.dragElement.helper:null)})),this}off(e,n){return this._getDDElements(e).forEach(r=>r.off(n)),this}_getDDElements(e,n){const r=e.gridstack||n!=="destroy"&&n!=="disable",i=D.getElements(e);return i.length?i.map(o=>o.ddElement||(r?Rd.init(o):null)).filter(o=>o):[]}}/*!
|
|
80
|
+
`||e[Pe]===" "||e[Pe]===" ");)Pe++;let i;if(Ko(e)&&(i=Ps(e),i.type!==Q.Hue)){n.push({type:Q.Alpha,value:i});continue}if(lu(e)&&La(e)==="none"){n.push({type:Q.Alpha,value:{type:Q.None,value:void 0}});continue}return}if(/\d/.test(r)){Pe--,n.push(Ps(e));continue}if(au.test(r)){Pe--,n.push(OS(e));continue}return}return n}function zS(t){t._i=0;let e=t[t._i++];if(!e||e.type!==Q.Function||e.value!=="color"||(e=t[t._i++],e.type!==Q.Ident))return;const n=vm[e.value];if(!n)return;const r={mode:n},i=bm(t,!1);if(!i)return;const s=PS(n).channels;for(let o=0,a,l;o<s.length;o++)a=i[o],l=s[o],a.type!==Q.None&&(r[l]=a.type===Q.Number?a.value:a.value/100,l==="alpha"&&(r[l]=Math.max(0,Math.min(1,r[l]))));return r}function bm(t,e){const n=[];let r;for(;t._i<t.length;){if(r=t[t._i++],r.type===Q.None||r.type===Q.Number||r.type===Q.Alpha||r.type===Q.Percentage||e&&r.type===Q.Hue){n.push(r);continue}if(r.type===Q.ParenClose){if(t._i<t.length)return;continue}return}if(!(n.length<3||n.length>4)){if(n.length===4){if(n[3].type!==Q.Alpha)return;n[3]=n[3].value}return n.length===3&&n.push({type:Q.None,value:void 0}),n.every(i=>i.type!==Q.Alpha)?n:void 0}}function IS(t,e){t._i=0;let n=t[t._i++];if(!n||n.type!==Q.Function)return;let r=bm(t,e);if(r)return r.unshift(n.value),r}const LS=t=>{if(typeof t!="string")return;const e=NS(t),n=e?IS(e,!0):void 0;let r,i=0,s=Ia.length;for(;i<s;)if((r=Ia[i++](t,n))!==void 0)return r;return e?zS(e):void 0};function DS(t,e){if(!e||e[0]!=="rgb"&&e[0]!=="rgba")return;const n={mode:"rgb"},[,r,i,s,o]=e;if(!(r.type===Q.Hue||i.type===Q.Hue||s.type===Q.Hue))return r.type!==Q.None&&(n.r=r.type===Q.Number?r.value/255:r.value/100),i.type!==Q.None&&(n.g=i.type===Q.Number?i.value/255:i.value/100),s.type!==Q.None&&(n.b=s.type===Q.Number?s.value/255:s.value/100),o.type!==Q.None&&(n.alpha=Math.min(1,Math.max(0,o.type===Q.Number?o.value:o.value/100))),n}const HS=t=>t==="transparent"?{mode:"rgb",r:0,g:0,b:0,alpha:0}:void 0,BS=(t,e,n)=>t+n*(e-t),$S=t=>{let e=[];for(let n=0;n<t.length-1;n++){let r=t[n],i=t[n+1];r===void 0&&i===void 0?e.push(void 0):r!==void 0&&i!==void 0?e.push([r,i]):e.push(r!==void 0?[r,r]:[i,i])}return e},US=t=>e=>{let n=$S(e);return r=>{let i=r*n.length,s=r>=1?n.length-1:Math.max(Math.floor(i),0),o=n[s];return o===void 0?void 0:t(o[0],o[1],i-s)}},he=US(BS),It=t=>{let e=!1,n=t.map(r=>r!==void 0?(e=!0,r):1);return e?n:t},gs={mode:"rgb",channels:["r","g","b","alpha"],parse:[DS,wS,SS,bS,HS,"srgb"],serialize:"srgb",interpolate:{r:he,g:he,b:he,alpha:{use:he,fixup:It}},gamut:!0,white:{r:1,g:1,b:1},black:{r:0,g:0,b:0}},Kl=(t=0)=>Math.pow(Math.abs(t),563/256)*Math.sign(t),Vf=t=>{let e=Kl(t.r),n=Kl(t.g),r=Kl(t.b),i={mode:"xyz65",x:.5766690429101305*e+.1855582379065463*n+.1882286462349947*r,y:.297344975250536*e+.6273635662554661*n+.0752914584939979*r,z:.0270313613864123*e+.0706888525358272*n+.9913375368376386*r};return t.alpha!==void 0&&(i.alpha=t.alpha),i},Ql=t=>Math.pow(Math.abs(t),256/563)*Math.sign(t),Zf=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i={mode:"a98",r:Ql(t*2.0415879038107465-e*.5650069742788597-.3447313507783297*n),g:Ql(t*-.9692436362808798+e*1.8759675015077206+.0415550574071756*n),b:Ql(t*.0134442806320312-e*.1183623922310184+1.0151749943912058*n)};return r!==void 0&&(i.alpha=r),i},ec=(t=0)=>{const e=Math.abs(t);return e<=.04045?t/12.92:(Math.sign(t)||1)*Math.pow((e+.055)/1.055,2.4)},ms=({r:t,g:e,b:n,alpha:r})=>{let i={mode:"lrgb",r:ec(t),g:ec(e),b:ec(n)};return r!==void 0&&(i.alpha=r),i},Ei=t=>{let{r:e,g:n,b:r,alpha:i}=ms(t),s={mode:"xyz65",x:.4123907992659593*e+.357584339383878*n+.1804807884018343*r,y:.2126390058715102*e+.715168678767756*n+.0721923153607337*r,z:.0193308187155918*e+.119194779794626*n+.9505321522496607*r};return i!==void 0&&(s.alpha=i),s},tc=(t=0)=>{const e=Math.abs(t);return e>.0031308?(Math.sign(t)||1)*(1.055*Math.pow(e,1/2.4)-.055):t*12.92},vs=({r:t,g:e,b:n,alpha:r},i="rgb")=>{let s={mode:i,r:tc(t),g:tc(e),b:tc(n)};return r!==void 0&&(s.alpha=r),s},Si=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=vs({r:t*3.2409699419045226-e*1.537383177570094-.4986107602930034*n,g:t*-.9692436362808796+e*1.8759675015077204+.0415550574071756*n,b:t*.0556300796969936-e*.2039769588889765+1.0569715142428784*n});return r!==void 0&&(i.alpha=r),i},jS={...gs,mode:"a98",parse:["a98-rgb"],serialize:"a98-rgb",fromMode:{rgb:t=>Zf(Ei(t)),xyz65:Zf},toMode:{rgb:t=>Si(Vf(t)),xyz65:Vf}},Wt=t=>(t=t%360)<0?t+360:t,FS=(t,e)=>t.map((n,r,i)=>{if(n===void 0)return n;let s=Wt(n);return r===0||t[r-1]===void 0?s:e(s-Wt(i[r-1]))}).reduce((n,r)=>!n.length||r===void 0||n[n.length-1]===void 0?(n.push(r),n):(n.push(r+n[n.length-1]),n),[]),Cr=t=>FS(t,e=>Math.abs(e)<=180?e:e-360*Math.sign(e)),Ht=[-.14861,1.78277,-.29227,-.90649,1.97294,0],GS=Math.PI/180,VS=180/Math.PI;let Wf=Ht[3]*Ht[4],qf=Ht[1]*Ht[4],Xf=Ht[1]*Ht[2]-Ht[0]*Ht[3];const ZS=({r:t,g:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=(Xf*n+t*Wf-e*qf)/(Xf+Wf-qf),s=n-i,o=(Ht[4]*(e-i)-Ht[2]*s)/Ht[3],a={mode:"cubehelix",l:i,s:i===0||i===1?void 0:Math.sqrt(s*s+o*o)/(Ht[4]*i*(1-i))};return a.s&&(a.h=Math.atan2(o,s)*VS-120),r!==void 0&&(a.alpha=r),a},WS=({h:t,s:e,l:n,alpha:r})=>{let i={mode:"rgb"};t=(t===void 0?0:t+120)*GS,n===void 0&&(n=0);let s=e===void 0?0:e*n*(1-n),o=Math.cos(t),a=Math.sin(t);return i.r=n+s*(Ht[0]*o+Ht[1]*a),i.g=n+s*(Ht[2]*o+Ht[3]*a),i.b=n+s*(Ht[4]*o+Ht[5]*a),r!==void 0&&(i.alpha=r),i},wl=(t,e)=>{if(t.h===void 0||e.h===void 0||!t.s||!e.s)return 0;let n=Wt(t.h),r=Wt(e.h),i=Math.sin((r-n+360)/2*Math.PI/180);return 2*Math.sqrt(t.s*e.s)*i},qS=(t,e)=>{if(t.h===void 0||e.h===void 0)return 0;let n=Wt(t.h),r=Wt(e.h);return Math.abs(r-n)>180?n-(r-360*Math.sign(r-n)):r-n},yl=(t,e)=>{if(t.h===void 0||e.h===void 0||!t.c||!e.c)return 0;let n=Wt(t.h),r=Wt(e.h),i=Math.sin((r-n+360)/2*Math.PI/180);return 2*Math.sqrt(t.c*e.c)*i},Pr=t=>{let e=t.reduce((r,i)=>{if(i!==void 0){let s=i*Math.PI/180;r.sin+=Math.sin(s),r.cos+=Math.cos(s)}return r},{sin:0,cos:0}),n=Math.atan2(e.sin,e.cos)*180/Math.PI;return n<0?360+n:n},XS={mode:"cubehelix",channels:["h","s","l","alpha"],parse:["--cubehelix"],serialize:"--cubehelix",ranges:{h:[0,360],s:[0,4.614],l:[0,1]},fromMode:{rgb:ZS},toMode:{rgb:WS},interpolate:{h:{use:he,fixup:Cr},s:he,l:he,alpha:{use:he,fixup:It}},difference:{h:wl},average:{h:Pr}},Xr=({l:t,a:e,b:n,alpha:r},i="lch")=>{e===void 0&&(e=0),n===void 0&&(n=0);let s=Math.sqrt(e*e+n*n),o={mode:i,l:t,c:s};return s&&(o.h=Wt(Math.atan2(n,e)*180/Math.PI)),r!==void 0&&(o.alpha=r),o},Yr=({l:t,c:e,h:n,alpha:r},i="lab")=>{n===void 0&&(n=0);let s={mode:i,l:t,a:e?e*Math.cos(n/180*Math.PI):0,b:e?e*Math.sin(n/180*Math.PI):0};return r!==void 0&&(s.alpha=r),s},_m=Math.pow(29,3)/Math.pow(3,3),wm=Math.pow(6,3)/Math.pow(29,3),Mt={X:.3457/.3585,Y:1,Z:(1-.3457-.3585)/.3585},Ui={X:.3127/.329,Y:1,Z:(1-.3127-.329)/.329};let nc=t=>Math.pow(t,3)>wm?Math.pow(t,3):(116*t-16)/_m;const ym=({l:t,a:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=(t+16)/116,s=e/500+i,o=i-n/200,a={mode:"xyz65",x:nc(s)*Ui.X,y:nc(i)*Ui.Y,z:nc(o)*Ui.Z};return r!==void 0&&(a.alpha=r),a},kl=t=>Si(ym(t)),rc=t=>t>wm?Math.cbrt(t):(_m*t+16)/116,km=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=rc(t/Ui.X),s=rc(e/Ui.Y),o=rc(n/Ui.Z),a={mode:"lab65",l:116*s-16,a:500*(i-s),b:200*(s-o)};return r!==void 0&&(a.alpha=r),a},El=t=>{let e=km(Ei(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e},Da=1,Em=1,ro=26/180*Math.PI,Ha=Math.cos(ro),Ba=Math.sin(ro),Sm=100/Math.log(139/100),cu=({l:t,c:e,h:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i={mode:"lab65",l:(Math.exp(t*Da/Sm)-1)/.0039},s=(Math.exp(.0435*e*Em*Da)-1)/.075,o=s*Math.cos(n/180*Math.PI-ro),a=s*Math.sin(n/180*Math.PI-ro);return i.a=o*Ha-a/.83*Ba,i.b=o*Ba+a/.83*Ha,r!==void 0&&(i.alpha=r),i},uu=({l:t,a:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=e*Ha+n*Ba,s=.83*(n*Ha-e*Ba),o=Math.sqrt(i*i+s*s),a={mode:"dlch",l:Sm/Da*Math.log(1+.0039*t),c:Math.log(1+.075*o)/(.0435*Em*Da)};return a.c&&(a.h=Wt((Math.atan2(s,i)+ro)/Math.PI*180)),r!==void 0&&(a.alpha=r),a},Yf=t=>cu(Xr(t,"dlch")),Jf=t=>Yr(uu(t),"dlab"),YS={mode:"dlab",parse:["--din99o-lab"],serialize:"--din99o-lab",toMode:{lab65:Yf,rgb:t=>kl(Yf(t))},fromMode:{lab65:Jf,rgb:t=>Jf(El(t))},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-40.09,45.501],b:[-40.469,44.344]},interpolate:{l:he,a:he,b:he,alpha:{use:he,fixup:It}}},JS={mode:"dlch",parse:["--din99o-lch"],serialize:"--din99o-lch",toMode:{lab65:cu,dlab:t=>Yr(t,"dlab"),rgb:t=>kl(cu(t))},fromMode:{lab65:uu,dlab:t=>Xr(t,"dlch"),rgb:t=>uu(El(t))},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,51.484],h:[0,360]},interpolate:{l:he,c:he,h:{use:he,fixup:Cr},alpha:{use:he,fixup:It}},difference:{h:yl},average:{h:Pr}};function KS({h:t,s:e,i:n,alpha:r}){t=Wt(t!==void 0?t:0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.abs(t/60%2-1),s;switch(Math.floor(t/60)){case 0:s={r:n*(1+e*(3/(2-i)-1)),g:n*(1+e*(3*(1-i)/(2-i)-1)),b:n*(1-e)};break;case 1:s={r:n*(1+e*(3*(1-i)/(2-i)-1)),g:n*(1+e*(3/(2-i)-1)),b:n*(1-e)};break;case 2:s={r:n*(1-e),g:n*(1+e*(3/(2-i)-1)),b:n*(1+e*(3*(1-i)/(2-i)-1))};break;case 3:s={r:n*(1-e),g:n*(1+e*(3*(1-i)/(2-i)-1)),b:n*(1+e*(3/(2-i)-1))};break;case 4:s={r:n*(1+e*(3*(1-i)/(2-i)-1)),g:n*(1-e),b:n*(1+e*(3/(2-i)-1))};break;case 5:s={r:n*(1+e*(3/(2-i)-1)),g:n*(1-e),b:n*(1+e*(3*(1-i)/(2-i)-1))};break;default:s={r:n*(1-e),g:n*(1-e),b:n*(1-e)}}return s.mode="rgb",r!==void 0&&(s.alpha=r),s}function QS({r:t,g:e,b:n,alpha:r}){t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.max(t,e,n),s=Math.min(t,e,n),o={mode:"hsi",s:t+e+n===0?0:1-3*s/(t+e+n),i:(t+e+n)/3};return i-s!==0&&(o.h=(i===t?(e-n)/(i-s)+(e<n)*6:i===e?(n-t)/(i-s)+2:(t-e)/(i-s)+4)*60),r!==void 0&&(o.alpha=r),o}const ex={mode:"hsi",toMode:{rgb:KS},parse:["--hsi"],serialize:"--hsi",fromMode:{rgb:QS},channels:["h","s","i","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:he,fixup:Cr},s:he,i:he,alpha:{use:he,fixup:It}},difference:{h:wl},average:{h:Pr}};function tx({h:t,s:e,l:n,alpha:r}){t=Wt(t!==void 0?t:0),e===void 0&&(e=0),n===void 0&&(n=0);let i=n+e*(n<.5?n:1-n),s=i-(i-n)*2*Math.abs(t/60%2-1),o;switch(Math.floor(t/60)){case 0:o={r:i,g:s,b:2*n-i};break;case 1:o={r:s,g:i,b:2*n-i};break;case 2:o={r:2*n-i,g:i,b:s};break;case 3:o={r:2*n-i,g:s,b:i};break;case 4:o={r:s,g:2*n-i,b:i};break;case 5:o={r:i,g:2*n-i,b:s};break;default:o={r:2*n-i,g:2*n-i,b:2*n-i}}return o.mode="rgb",r!==void 0&&(o.alpha=r),o}function nx({r:t,g:e,b:n,alpha:r}){t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.max(t,e,n),s=Math.min(t,e,n),o={mode:"hsl",s:i===s?0:(i-s)/(1-Math.abs(i+s-1)),l:.5*(i+s)};return i-s!==0&&(o.h=(i===t?(e-n)/(i-s)+(e<n)*6:i===e?(n-t)/(i-s)+2:(t-e)/(i-s)+4)*60),r!==void 0&&(o.alpha=r),o}const rx=(t,e)=>{switch(e){case"deg":return+t;case"rad":return t/Math.PI*180;case"grad":return t/10*9;case"turn":return t*360}},ix=new RegExp(`^hsla?\\(\\s*${yS}${ss}${qs}${ss}${qs}\\s*(?:,\\s*${ad}\\s*)?\\)$`),sx=t=>{let e=t.match(ix);if(!e)return;let n={mode:"hsl"};return e[3]!==void 0?n.h=+e[3]:e[1]!==void 0&&e[2]!==void 0&&(n.h=rx(e[1],e[2])),e[4]!==void 0&&(n.s=Math.min(Math.max(0,e[4]/100),1)),e[5]!==void 0&&(n.l=Math.min(Math.max(0,e[5]/100),1)),e[6]!==void 0?n.alpha=Math.max(0,Math.min(1,e[6]/100)):e[7]!==void 0&&(n.alpha=Math.max(0,Math.min(1,+e[7]))),n};function ox(t,e){if(!e||e[0]!=="hsl"&&e[0]!=="hsla")return;const n={mode:"hsl"},[,r,i,s,o]=e;if(r.type!==Q.None){if(r.type===Q.Percentage)return;n.h=r.value}if(i.type!==Q.None){if(i.type===Q.Hue)return;n.s=i.value/100}if(s.type!==Q.None){if(s.type===Q.Hue)return;n.l=s.value/100}return o.type!==Q.None&&(n.alpha=Math.min(1,Math.max(0,o.type===Q.Number?o.value:o.value/100))),n}const xm={mode:"hsl",toMode:{rgb:tx},fromMode:{rgb:nx},channels:["h","s","l","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[ox,sx],serialize:t=>`hsl(${t.h!==void 0?t.h:"none"} ${t.s!==void 0?t.s*100+"%":"none"} ${t.l!==void 0?t.l*100+"%":"none"}${t.alpha<1?` / ${t.alpha}`:""})`,interpolate:{h:{use:he,fixup:Cr},s:he,l:he,alpha:{use:he,fixup:It}},difference:{h:wl},average:{h:Pr}};function Tm({h:t,s:e,v:n,alpha:r}){t=Wt(t!==void 0?t:0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.abs(t/60%2-1),s;switch(Math.floor(t/60)){case 0:s={r:n,g:n*(1-e*i),b:n*(1-e)};break;case 1:s={r:n*(1-e*i),g:n,b:n*(1-e)};break;case 2:s={r:n*(1-e),g:n,b:n*(1-e*i)};break;case 3:s={r:n*(1-e),g:n*(1-e*i),b:n};break;case 4:s={r:n*(1-e*i),g:n*(1-e),b:n};break;case 5:s={r:n,g:n*(1-e),b:n*(1-e*i)};break;default:s={r:n*(1-e),g:n*(1-e),b:n*(1-e)}}return s.mode="rgb",r!==void 0&&(s.alpha=r),s}function Cm({r:t,g:e,b:n,alpha:r}){t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.max(t,e,n),s=Math.min(t,e,n),o={mode:"hsv",s:i===0?0:1-s/i,v:i};return i-s!==0&&(o.h=(i===t?(e-n)/(i-s)+(e<n)*6:i===e?(n-t)/(i-s)+2:(t-e)/(i-s)+4)*60),r!==void 0&&(o.alpha=r),o}const Pm={mode:"hsv",toMode:{rgb:Tm},parse:["--hsv"],serialize:"--hsv",fromMode:{rgb:Cm},channels:["h","s","v","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:he,fixup:Cr},s:he,v:he,alpha:{use:he,fixup:It}},difference:{h:wl},average:{h:Pr}};function ax({h:t,w:e,b:n,alpha:r}){if(e===void 0&&(e=0),n===void 0&&(n=0),e+n>1){let i=e+n;e/=i,n/=i}return Tm({h:t,s:n===1?1:1-e/(1-n),v:1-n,alpha:r})}function lx(t){let e=Cm(t);if(e===void 0)return;let n=e.s!==void 0?e.s:0,r=e.v!==void 0?e.v:0,i={mode:"hwb",w:(1-n)*r,b:1-r};return e.h!==void 0&&(i.h=e.h),e.alpha!==void 0&&(i.alpha=e.alpha),i}function cx(t,e){if(!e||e[0]!=="hwb")return;const n={mode:"hwb"},[,r,i,s,o]=e;if(r.type!==Q.None){if(r.type===Q.Percentage)return;n.h=r.value}if(i.type!==Q.None){if(i.type===Q.Hue)return;n.w=i.value/100}if(s.type!==Q.None){if(s.type===Q.Hue)return;n.b=s.value/100}return o.type!==Q.None&&(n.alpha=Math.min(1,Math.max(0,o.type===Q.Number?o.value:o.value/100))),n}const ux={mode:"hwb",toMode:{rgb:ax},fromMode:{rgb:lx},channels:["h","w","b","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[cx],serialize:t=>`hwb(${t.h!==void 0?t.h:"none"} ${t.w!==void 0?t.w*100+"%":"none"} ${t.b!==void 0?t.b*100+"%":"none"}${t.alpha<1?` / ${t.alpha}`:""})`,interpolate:{h:{use:he,fixup:Cr},w:he,b:he,alpha:{use:he,fixup:It}},difference:{h:qS},average:{h:Pr}},Rm=203,Sl=.1593017578125,Am=78.84375,xl=.8359375,Tl=18.8515625,Cl=18.6875;function ic(t){if(t<0)return 0;const e=Math.pow(t,1/Am);return 1e4*Math.pow(Math.max(0,e-xl)/(Tl-Cl*e),1/Sl)}function sc(t){if(t<0)return 0;const e=Math.pow(t/1e4,Sl);return Math.pow((xl+Tl*e)/(1+Cl*e),Am)}const oc=t=>Math.max(t/Rm,0),Kf=({i:t,t:e,p:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);const i=ic(t+.008609037037932761*e+.11102962500302593*n),s=ic(t-.00860903703793275*e-.11102962500302599*n),o=ic(t+.5600313357106791*e-.32062717498731885*n),a={mode:"xyz65",x:oc(2.070152218389422*i-1.3263473389671556*s+.2066510476294051*o),y:oc(.3647385209748074*i+.680566024947227*s-.0453045459220346*o),z:oc(-.049747207535812*i-.0492609666966138*s+1.1880659249923042*o)};return r!==void 0&&(a.alpha=r),a},ac=(t=0)=>Math.max(t*Rm,0),Qf=({x:t,y:e,z:n,alpha:r})=>{const i=ac(t),s=ac(e),o=ac(n),a=sc(.3592832590121217*i+.6976051147779502*s-.0358915932320289*o),l=sc(-.1920808463704995*i+1.1004767970374323*s+.0753748658519118*o),c=sc(.0070797844607477*i+.0748396662186366*s+.8433265453898765*o),u=.5*a+.5*l,d=1.61376953125*a-3.323486328125*l+1.709716796875*c,h=4.378173828125*a-4.24560546875*l-.132568359375*c,p={mode:"itp",i:u,t:d,p:h};return r!==void 0&&(p.alpha=r),p},dx={mode:"itp",channels:["i","t","p","alpha"],parse:["--ictcp"],serialize:"--ictcp",toMode:{xyz65:Kf,rgb:t=>Si(Kf(t))},fromMode:{xyz65:Qf,rgb:t=>Qf(Ei(t))},ranges:{i:[0,.581],t:[-.369,.272],p:[-.164,.331]},interpolate:{i:he,t:he,p:he,alpha:{use:he,fixup:It}}},fx=134.03437499999998,hx=16295499532821565e-27,lc=t=>{if(t<0)return 0;let e=Math.pow(t/1e4,Sl);return Math.pow((xl+Tl*e)/(1+Cl*e),fx)},cc=(t=0)=>Math.max(t*203,0),Mm=({x:t,y:e,z:n,alpha:r})=>{t=cc(t),e=cc(e),n=cc(n);let i=1.15*t-.15*n,s=.66*e+.34*t,o=lc(.41478972*i+.579999*s+.014648*n),a=lc(-.20151*i+1.120649*s+.0531008*n),l=lc(-.0166008*i+.2648*s+.6684799*n),c=(o+a)/2,u={mode:"jab",j:.44*c/(1-.56*c)-hx,a:3.524*o-4.066708*a+.542708*l,b:.199076*o+1.096799*a-1.295875*l};return r!==void 0&&(u.alpha=r),u},px=134.03437499999998,eh=16295499532821565e-27,uc=t=>{if(t<0)return 0;let e=Math.pow(t,1/px);return 1e4*Math.pow((xl-e)/(Cl*e-Tl),1/Sl)},dc=t=>t/203,Om=({j:t,a:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=(t+eh)/(.44+.56*(t+eh)),s=uc(i+.13860504*e+.058047316*n),o=uc(i-.13860504*e-.058047316*n),a=uc(i-.096019242*e-.8118919*n),l={mode:"xyz65",x:dc(1.661373024652174*s-.914523081304348*o+.23136208173913045*a),y:dc(-.3250758611844533*s+1.571847026732543*o-.21825383453227928*a),z:dc(-.090982811*s-.31272829*o+1.5227666*a)};return r!==void 0&&(l.alpha=r),l},Nm=t=>{let e=Mm(Ei(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e},zm=t=>Si(Om(t)),gx={mode:"jab",channels:["j","a","b","alpha"],parse:["--jzazbz"],serialize:"--jzazbz",fromMode:{rgb:Nm,xyz65:Mm},toMode:{rgb:zm,xyz65:Om},ranges:{j:[0,.222],a:[-.109,.129],b:[-.185,.134]},interpolate:{j:he,a:he,b:he,alpha:{use:he,fixup:It}}},th=({j:t,a:e,b:n,alpha:r})=>{e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.sqrt(e*e+n*n),s={mode:"jch",j:t,c:i};return i&&(s.h=Wt(Math.atan2(n,e)*180/Math.PI)),r!==void 0&&(s.alpha=r),s},nh=({j:t,c:e,h:n,alpha:r})=>{n===void 0&&(n=0);let i={mode:"jab",j:t,a:e?e*Math.cos(n/180*Math.PI):0,b:e?e*Math.sin(n/180*Math.PI):0};return r!==void 0&&(i.alpha=r),i},mx={mode:"jch",parse:["--jzczhz"],serialize:"--jzczhz",toMode:{jab:nh,rgb:t=>zm(nh(t))},fromMode:{rgb:t=>th(Nm(t)),jab:th},channels:["j","c","h","alpha"],ranges:{j:[0,.221],c:[0,.19],h:[0,360]},interpolate:{h:{use:he,fixup:Cr},c:he,j:he,alpha:{use:he,fixup:It}},difference:{h:yl},average:{h:Pr}},Pl=Math.pow(29,3)/Math.pow(3,3),ld=Math.pow(6,3)/Math.pow(29,3);let fc=t=>Math.pow(t,3)>ld?Math.pow(t,3):(116*t-16)/Pl;const cd=({l:t,a:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=(t+16)/116,s=e/500+i,o=i-n/200,a={mode:"xyz50",x:fc(s)*Mt.X,y:fc(i)*Mt.Y,z:fc(o)*Mt.Z};return r!==void 0&&(a.alpha=r),a},zo=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=vs({r:t*3.1341359569958707-e*1.6173863321612538-.4906619460083532*n,g:t*-.978795502912089+e*1.916254567259524+.03344273116131949*n,b:t*.07195537988411677-e*.2289768264158322+1.405386058324125*n});return r!==void 0&&(i.alpha=r),i},Im=t=>zo(cd(t)),Io=t=>{let{r:e,g:n,b:r,alpha:i}=ms(t),s={mode:"xyz50",x:.436065742824811*e+.3851514688337912*n+.14307845442264197*r,y:.22249319175623702*e+.7168870538238823*n+.06061979053616537*r,z:.013923904500943465*e+.09708128566574634*n+.7140993584005155*r};return i!==void 0&&(s.alpha=i),s},hc=t=>t>ld?Math.cbrt(t):(Pl*t+16)/116,ud=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=hc(t/Mt.X),s=hc(e/Mt.Y),o=hc(n/Mt.Z),a={mode:"lab",l:116*s-16,a:500*(i-s),b:200*(s-o)};return r!==void 0&&(a.alpha=r),a},Lm=t=>{let e=ud(Io(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e};function vx(t,e){if(!e||e[0]!=="lab")return;const n={mode:"lab"},[,r,i,s,o]=e;if(!(r.type===Q.Hue||i.type===Q.Hue||s.type===Q.Hue))return r.type!==Q.None&&(n.l=Math.min(Math.max(0,r.value),100)),i.type!==Q.None&&(n.a=i.type===Q.Number?i.value:i.value*125/100),s.type!==Q.None&&(n.b=s.type===Q.Number?s.value:s.value*125/100),o.type!==Q.None&&(n.alpha=Math.min(1,Math.max(0,o.type===Q.Number?o.value:o.value/100))),n}const dd={mode:"lab",toMode:{xyz50:cd,rgb:Im},fromMode:{xyz50:ud,rgb:Lm},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-125,125],b:[-125,125]},parse:[vx],serialize:t=>`lab(${t.l!==void 0?t.l:"none"} ${t.a!==void 0?t.a:"none"} ${t.b!==void 0?t.b:"none"}${t.alpha<1?` / ${t.alpha}`:""})`,interpolate:{l:he,a:he,b:he,alpha:{use:he,fixup:It}}},bx={...dd,mode:"lab65",parse:["--lab-d65"],serialize:"--lab-d65",toMode:{xyz65:ym,rgb:kl},fromMode:{xyz65:km,rgb:El},ranges:{l:[0,100],a:[-125,125],b:[-125,125]}};function _x(t,e){if(!e||e[0]!=="lch")return;const n={mode:"lch"},[,r,i,s,o]=e;if(r.type!==Q.None){if(r.type===Q.Hue)return;n.l=Math.min(Math.max(0,r.value),100)}if(i.type!==Q.None&&(n.c=Math.max(0,i.type===Q.Number?i.value:i.value*150/100)),s.type!==Q.None){if(s.type===Q.Percentage)return;n.h=s.value}return o.type!==Q.None&&(n.alpha=Math.min(1,Math.max(0,o.type===Q.Number?o.value:o.value/100))),n}const fd={mode:"lch",toMode:{lab:Yr,rgb:t=>Im(Yr(t))},fromMode:{rgb:t=>Xr(Lm(t)),lab:Xr},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,150],h:[0,360]},parse:[_x],serialize:t=>`lch(${t.l!==void 0?t.l:"none"} ${t.c!==void 0?t.c:"none"} ${t.h!==void 0?t.h:"none"}${t.alpha<1?` / ${t.alpha}`:""})`,interpolate:{h:{use:he,fixup:Cr},c:he,l:he,alpha:{use:he,fixup:It}},difference:{h:yl},average:{h:Pr}},wx={...fd,mode:"lch65",parse:["--lch-d65"],serialize:"--lch-d65",toMode:{lab65:t=>Yr(t,"lab65"),rgb:t=>kl(Yr(t,"lab65"))},fromMode:{rgb:t=>Xr(El(t),"lch65"),lab65:t=>Xr(t,"lch65")},ranges:{l:[0,100],c:[0,150],h:[0,360]}},Dm=({l:t,u:e,v:n,alpha:r})=>{e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.sqrt(e*e+n*n),s={mode:"lchuv",l:t,c:i};return i&&(s.h=Wt(Math.atan2(n,e)*180/Math.PI)),r!==void 0&&(s.alpha=r),s},Hm=({l:t,c:e,h:n,alpha:r})=>{n===void 0&&(n=0);let i={mode:"luv",l:t,u:e?e*Math.cos(n/180*Math.PI):0,v:e?e*Math.sin(n/180*Math.PI):0};return r!==void 0&&(i.alpha=r),i},Bm=(t,e,n)=>4*t/(t+15*e+3*n),$m=(t,e,n)=>9*e/(t+15*e+3*n),yx=Bm(Mt.X,Mt.Y,Mt.Z),kx=$m(Mt.X,Mt.Y,Mt.Z),Ex=t=>t<=ld?Pl*t:116*Math.cbrt(t)-16,du=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Ex(e/Mt.Y),s=Bm(t,e,n),o=$m(t,e,n);!isFinite(s)||!isFinite(o)?i=s=o=0:(s=13*i*(s-yx),o=13*i*(o-kx));let a={mode:"luv",l:i,u:s,v:o};return r!==void 0&&(a.alpha=r),a},Sx=(t,e,n)=>4*t/(t+15*e+3*n),xx=(t,e,n)=>9*e/(t+15*e+3*n),Tx=Sx(Mt.X,Mt.Y,Mt.Z),Cx=xx(Mt.X,Mt.Y,Mt.Z),fu=({l:t,u:e,v:n,alpha:r})=>{if(t===void 0&&(t=0),t===0)return{mode:"xyz50",x:0,y:0,z:0};e===void 0&&(e=0),n===void 0&&(n=0);let i=e/(13*t)+Tx,s=n/(13*t)+Cx,o=Mt.Y*(t<=8?t/Pl:Math.pow((t+16)/116,3)),a=o*(9*i)/(4*s),l=o*(12-3*i-20*s)/(4*s),c={mode:"xyz50",x:a,y:o,z:l};return r!==void 0&&(c.alpha=r),c},Px=t=>Dm(du(Io(t))),Rx=t=>zo(fu(Hm(t))),Ax={mode:"lchuv",toMode:{luv:Hm,rgb:Rx},fromMode:{rgb:Px,luv:Dm},channels:["l","c","h","alpha"],parse:["--lchuv"],serialize:"--lchuv",ranges:{l:[0,100],c:[0,176.956],h:[0,360]},interpolate:{h:{use:he,fixup:Cr},c:he,l:he,alpha:{use:he,fixup:It}},difference:{h:yl},average:{h:Pr}},Mx={...gs,mode:"lrgb",toMode:{rgb:vs},fromMode:{rgb:ms},parse:["srgb-linear"],serialize:"srgb-linear"},Ox={mode:"luv",toMode:{xyz50:fu,rgb:t=>zo(fu(t))},fromMode:{xyz50:du,rgb:t=>du(Io(t))},channels:["l","u","v","alpha"],parse:["--luv"],serialize:"--luv",ranges:{l:[0,100],u:[-84.936,175.042],v:[-125.882,87.243]},interpolate:{l:he,u:he,v:he,alpha:{use:he,fixup:It}}},Um=({r:t,g:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.cbrt(.412221469470763*t+.5363325372617348*e+.0514459932675022*n),s=Math.cbrt(.2119034958178252*t+.6806995506452344*e+.1073969535369406*n),o=Math.cbrt(.0883024591900564*t+.2817188391361215*e+.6299787016738222*n),a={mode:"oklab",l:.210454268309314*i+.7936177747023054*s-.0040720430116193*o,a:1.9779985324311684*i-2.42859224204858*s+.450593709617411*o,b:.0259040424655478*i+.7827717124575296*s-.8086757549230774*o};return r!==void 0&&(a.alpha=r),a},Rl=t=>{let e=Um(ms(t));return t.r===t.b&&t.b===t.g&&(e.a=e.b=0),e},Lo=({l:t,a:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=Math.pow(t+.3963377773761749*e+.2158037573099136*n,3),s=Math.pow(t-.1055613458156586*e-.0638541728258133*n,3),o=Math.pow(t-.0894841775298119*e-1.2914855480194092*n,3),a={mode:"lrgb",r:4.076741636075957*i-3.3077115392580616*s+.2309699031821044*o,g:-1.2684379732850317*i+2.6097573492876887*s-.3413193760026573*o,b:-.0041960761386756*i-.7034186179359362*s+1.7076146940746117*o};return r!==void 0&&(a.alpha=r),a},Al=t=>vs(Lo(t));function hu(t){const r=1.170873786407767;return .5*(r*t-.206+Math.sqrt((r*t-.206)*(r*t-.206)+4*.03*r*t))}function $a(t){return(t*t+.206*t)/(1.170873786407767*(t+.03))}function Nx(t,e){let n,r,i,s,o,a,l,c;-1.88170328*t-.80936493*e>1?(n=1.19086277,r=1.76576728,i=.59662641,s=.75515197,o=.56771245,a=4.0767416621,l=-3.3077115913,c=.2309699292):1.81444104*t-1.19445276*e>1?(n=.73956515,r=-.45954404,i=.08285427,s=.1254107,o=.14503204,a=-1.2684380046,l=2.6097574011,c=-.3413193965):(n=1.35733652,r=-.00915799,i=-1.1513021,s=-.50559606,o=.00692167,a=-.0041960863,l=-.7034186147,c=1.707614701);let u=n+r*t+i*e+s*t*t+o*t*e,d=.3963377774*t+.2158037573*e,h=-.1055613458*t-.0638541728*e,p=-.0894841775*t-1.291485548*e;{let g=1+u*d,m=1+u*h,_=1+u*p,k=g*g*g,O=m*m*m,I=_*_*_,R=3*d*g*g,A=3*h*m*m,T=3*p*_*_,M=6*d*d*g,N=6*h*h*m,j=6*p*p*_,H=a*k+l*O+c*I,se=a*R+l*A+c*T,B=a*M+l*N+c*j;u=u-H*se/(se*se-.5*H*B)}return u}function hd(t,e){let n=Nx(t,e),r=Lo({l:1,a:n*t,b:n*e}),i=Math.cbrt(1/Math.max(r.r,r.g,r.b)),s=i*n;return[i,s]}function zx(t,e,n,r,i,s=null){s||(s=hd(t,e));let o;if((n-i)*s[1]-(s[0]-i)*r<=0)o=s[1]*i/(r*s[0]+s[1]*(i-n));else{o=s[1]*(i-1)/(r*(s[0]-1)+s[1]*(i-n));{let a=n-i,l=r,c=.3963377774*t+.2158037573*e,u=-.1055613458*t-.0638541728*e,d=-.0894841775*t-1.291485548*e,h=a+l*c,p=a+l*u,g=a+l*d;{let m=i*(1-o)+o*n,_=o*r,k=m+_*c,O=m+_*u,I=m+_*d,R=k*k*k,A=O*O*O,T=I*I*I,M=3*h*k*k,N=3*p*O*O,j=3*g*I*I,H=6*h*h*k,se=6*p*p*O,B=6*g*g*I,q=4.0767416621*R-3.3077115913*A+.2309699292*T-1,ee=4.0767416621*M-3.3077115913*N+.2309699292*j,te=4.0767416621*H-3.3077115913*se+.2309699292*B,W=ee/(ee*ee-.5*q*te),J=-q*W,ne=-1.2684380046*R+2.6097574011*A-.3413193965*T-1,le=-1.2684380046*M+2.6097574011*N-.3413193965*j,oe=-1.2684380046*H+2.6097574011*se-.3413193965*B,ue=le/(le*le-.5*ne*oe),De=-ne*ue,Ye=-.0041960863*R-.7034186147*A+1.707614701*T-1,je=-.0041960863*M-.7034186147*N+1.707614701*j,Ke=-.0041960863*H-.7034186147*se+1.707614701*B,ce=je/(je*je-.5*Ye*Ke),ae=-Ye*ce;J=W>=0?J:1e6,De=ue>=0?De:1e6,ae=ce>=0?ae:1e6,o+=Math.min(J,Math.min(De,ae))}}}return o}function pd(t,e,n=null){n||(n=hd(t,e));let r=n[0],i=n[1];return[i/r,i/(1-r)]}function jm(t,e,n){let r=hd(e,n),i=zx(e,n,t,1,t,r),s=pd(e,n,r),o=.11516993+1/(7.4477897+4.1590124*n+e*(-2.19557347+1.75198401*n+e*(-2.13704948-10.02301043*n+e*(-4.24894561+5.38770819*n+4.69891013*e)))),a=.11239642+1/(1.6132032-.68124379*n+e*(.40370612+.90148123*n+e*(-.27087943+.6122399*n+e*(.00299215-.45399568*n-.14661872*e)))),l=i/Math.min(t*s[0],(1-t)*s[1]),c=t*o,u=(1-t)*a,d=.9*l*Math.sqrt(Math.sqrt(1/(1/(c*c*c*c)+1/(u*u*u*u))));return c=t*.4,u=(1-t)*.8,[Math.sqrt(1/(1/(c*c)+1/(u*u))),d,i]}function rh(t){const e=t.l!==void 0?t.l:0,n=t.a!==void 0?t.a:0,r=t.b!==void 0?t.b:0,i={mode:"okhsl",l:hu(e)};t.alpha!==void 0&&(i.alpha=t.alpha);let s=Math.sqrt(n*n+r*r);if(!s)return i.s=0,i;let[o,a,l]=jm(e,n/s,r/s),c;if(s<a){let u=0,d=.8*o,h=1-d/a;c=(s-u)/(d+h*(s-u))*.8}else{let u=a,d=.2*a*a*1.25*1.25/o,h=1-d/(l-a);c=.8+.2*((s-u)/(d+h*(s-u)))}return c&&(i.s=c,i.h=Wt(Math.atan2(r,n)*180/Math.PI)),i}function ih(t){let e=t.h!==void 0?t.h:0,n=t.s!==void 0?t.s:0,r=t.l!==void 0?t.l:0;const i={mode:"oklab",l:$a(r)};if(t.alpha!==void 0&&(i.alpha=t.alpha),!n||r===1)return i.a=i.b=0,i;let s=Math.cos(e/180*Math.PI),o=Math.sin(e/180*Math.PI),[a,l,c]=jm(i.l,s,o),u,d,h,p;n<.8?(u=1.25*n,d=0,h=.8*a,p=1-h/l):(u=5*(n-.8),d=l,h=.2*l*l*1.25*1.25/a,p=1-h/(c-l));let g=d+u*h/(1-p*u);return i.a=g*s,i.b=g*o,i}const Ix={...xm,mode:"okhsl",channels:["h","s","l","alpha"],parse:["--okhsl"],serialize:"--okhsl",fromMode:{oklab:rh,rgb:t=>rh(Rl(t))},toMode:{oklab:ih,rgb:t=>Al(ih(t))}};function sh(t){let e=t.l!==void 0?t.l:0,n=t.a!==void 0?t.a:0,r=t.b!==void 0?t.b:0,i=Math.sqrt(n*n+r*r),s=i?n/i:1,o=i?r/i:1,[a,l]=pd(s,o),c=.5,u=1-c/a,d=l/(i+e*l),h=d*e,p=d*i,g=$a(h),m=p*g/h,_=Lo({l:g,a:s*m,b:o*m}),k=Math.cbrt(1/Math.max(_.r,_.g,_.b,0));e=e/k,i=i/k*hu(e)/e,e=hu(e);const O={mode:"okhsv",s:i?(c+l)*p/(l*c+l*u*p):0,v:e?e/h:0};return O.s&&(O.h=Wt(Math.atan2(r,n)*180/Math.PI)),t.alpha!==void 0&&(O.alpha=t.alpha),O}function oh(t){const e={mode:"oklab"};t.alpha!==void 0&&(e.alpha=t.alpha);const n=t.h!==void 0?t.h:0,r=t.s!==void 0?t.s:0,i=t.v!==void 0?t.v:0,s=Math.cos(n/180*Math.PI),o=Math.sin(n/180*Math.PI),[a,l]=pd(s,o),c=.5,u=1-c/a,d=1-r*c/(c+l-l*u*r),h=r*l*c/(c+l-l*u*r),p=$a(d),g=h*p/d,m=Lo({l:p,a:s*g,b:o*g}),_=Math.cbrt(1/Math.max(m.r,m.g,m.b,0)),k=$a(i*d),O=h*k/d;return e.l=k*_,e.a=O*s*_,e.b=O*o*_,e}const Lx={...Pm,mode:"okhsv",channels:["h","s","v","alpha"],parse:["--okhsv"],serialize:"--okhsv",fromMode:{oklab:sh,rgb:t=>sh(Rl(t))},toMode:{oklab:oh,rgb:t=>Al(oh(t))}};function Dx(t,e){if(!e||e[0]!=="oklab")return;const n={mode:"oklab"},[,r,i,s,o]=e;if(!(r.type===Q.Hue||i.type===Q.Hue||s.type===Q.Hue))return r.type!==Q.None&&(n.l=Math.min(Math.max(0,r.type===Q.Number?r.value:r.value/100),1)),i.type!==Q.None&&(n.a=i.type===Q.Number?i.value:i.value*.4/100),s.type!==Q.None&&(n.b=s.type===Q.Number?s.value:s.value*.4/100),o.type!==Q.None&&(n.alpha=Math.min(1,Math.max(0,o.type===Q.Number?o.value:o.value/100))),n}const Hx={...dd,mode:"oklab",toMode:{lrgb:Lo,rgb:Al},fromMode:{lrgb:Um,rgb:Rl},ranges:{l:[0,1],a:[-.4,.4],b:[-.4,.4]},parse:[Dx],serialize:t=>`oklab(${t.l!==void 0?t.l:"none"} ${t.a!==void 0?t.a:"none"} ${t.b!==void 0?t.b:"none"}${t.alpha<1?` / ${t.alpha}`:""})`};function Bx(t,e){if(!e||e[0]!=="oklch")return;const n={mode:"oklch"},[,r,i,s,o]=e;if(r.type!==Q.None){if(r.type===Q.Hue)return;n.l=Math.min(Math.max(0,r.type===Q.Number?r.value:r.value/100),1)}if(i.type!==Q.None&&(n.c=Math.max(0,i.type===Q.Number?i.value:i.value*.4/100)),s.type!==Q.None){if(s.type===Q.Percentage)return;n.h=s.value}return o.type!==Q.None&&(n.alpha=Math.min(1,Math.max(0,o.type===Q.Number?o.value:o.value/100))),n}const $x={...fd,mode:"oklch",toMode:{oklab:t=>Yr(t,"oklab"),rgb:t=>Al(Yr(t,"oklab"))},fromMode:{rgb:t=>Xr(Rl(t),"oklch"),oklab:t=>Xr(t,"oklch")},parse:[Bx],serialize:t=>`oklch(${t.l!==void 0?t.l:"none"} ${t.c!==void 0?t.c:"none"} ${t.h!==void 0?t.h:"none"}${t.alpha<1?` / ${t.alpha}`:""})`,ranges:{l:[0,1],c:[0,.4],h:[0,360]}},ah=t=>{let{r:e,g:n,b:r,alpha:i}=ms(t),s={mode:"xyz65",x:.486570948648216*e+.265667693169093*n+.1982172852343625*r,y:.2289745640697487*e+.6917385218365062*n+.079286914093745*r,z:0*e+.0451133818589026*n+1.043944368900976*r};return i!==void 0&&(s.alpha=i),s},lh=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i=vs({r:t*2.4934969119414263-e*.9313836179191242-.402710784450717*n,g:t*-.8294889695615749+e*1.7626640603183465+.0236246858419436*n,b:t*.0358458302437845-e*.0761723892680418+.9568845240076871*n},"p3");return r!==void 0&&(i.alpha=r),i},Ux={...gs,mode:"p3",parse:["display-p3"],serialize:"display-p3",fromMode:{rgb:t=>lh(Ei(t)),xyz65:lh},toMode:{rgb:t=>Si(ah(t)),xyz65:ah}},pc=t=>{let e=Math.abs(t);return e>=1/512?Math.sign(t)*Math.pow(e,1/1.8):16*t},ch=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i={mode:"prophoto",r:pc(t*1.3457868816471585-e*.2555720873797946-.0511018649755453*n),g:pc(t*-.5446307051249019+e*1.5082477428451466+.0205274474364214*n),b:pc(t*0+e*0+1.2119675456389452*n)};return r!==void 0&&(i.alpha=r),i},gc=(t=0)=>{let e=Math.abs(t);return e>=16/512?Math.sign(t)*Math.pow(e,1.8):t/16},uh=t=>{let e=gc(t.r),n=gc(t.g),r=gc(t.b),i={mode:"xyz50",x:.7977666449006423*e+.1351812974005331*n+.0313477341283922*r,y:.2880748288194013*e+.7118352342418731*n+899369387256e-16*r,z:0*e+0*n+.8251046025104602*r};return t.alpha!==void 0&&(i.alpha=t.alpha),i},jx={...gs,mode:"prophoto",parse:["prophoto-rgb"],serialize:"prophoto-rgb",fromMode:{xyz50:ch,rgb:t=>ch(Io(t))},toMode:{xyz50:uh,rgb:t=>zo(uh(t))}},dh=1.09929682680944,Fx=.018053968510807,mc=t=>{const e=Math.abs(t);return e>Fx?(Math.sign(t)||1)*(dh*Math.pow(e,.45)-(dh-1)):4.5*t},fh=({x:t,y:e,z:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);let i={mode:"rec2020",r:mc(t*1.7166511879712683-e*.3556707837763925-.2533662813736599*n),g:mc(t*-.6666843518324893+e*1.6164812366349395+.0157685458139111*n),b:mc(t*.0176398574453108-e*.0427706132578085+.9421031212354739*n)};return r!==void 0&&(i.alpha=r),i},hh=1.09929682680944,Gx=.018053968510807,vc=(t=0)=>{let e=Math.abs(t);return e<Gx*4.5?t/4.5:(Math.sign(t)||1)*Math.pow((e+hh-1)/hh,1/.45)},ph=t=>{let e=vc(t.r),n=vc(t.g),r=vc(t.b),i={mode:"xyz65",x:.6369580483012911*e+.1446169035862083*n+.1688809751641721*r,y:.262700212011267*e+.6779980715188708*n+.059301716469862*r,z:0*e+.0280726930490874*n+1.0609850577107909*r};return t.alpha!==void 0&&(i.alpha=t.alpha),i},Vx={...gs,mode:"rec2020",fromMode:{xyz65:fh,rgb:t=>fh(Ei(t))},toMode:{xyz65:ph,rgb:t=>Si(ph(t))},parse:["rec2020"],serialize:"rec2020"},bi=.0037930732552754493,Fm=Math.cbrt(bi),bc=t=>Math.cbrt(t)-Fm,Zx=t=>{const{r:e,g:n,b:r,alpha:i}=ms(t),s=bc(.3*e+.622*n+.078*r+bi),o=bc(.23*e+.692*n+.078*r+bi),a=bc(.2434226892454782*e+.2047674442449682*n+.5518098665095535*r+bi),l={mode:"xyb",x:(s-o)/2,y:(s+o)/2,b:a-(s+o)/2};return i!==void 0&&(l.alpha=i),l},_c=t=>Math.pow(t+Fm,3),Wx=({x:t,y:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);const i=_c(t+e)-bi,s=_c(e-t)-bi,o=_c(n+e)-bi,a=vs({r:11.031566904639861*i-9.866943908131562*s-.16462299650829934*o,g:-3.2541473810744237*i+4.418770377582723*s-.16462299650829934*o,b:-3.6588512867136815*i+2.7129230459360922*s+1.9459282407775895*o});return r!==void 0&&(a.alpha=r),a},qx={mode:"xyb",channels:["x","y","b","alpha"],parse:["--xyb"],serialize:"--xyb",toMode:{rgb:Wx},fromMode:{rgb:Zx},ranges:{x:[-.0154,.0281],y:[0,.8453],b:[-.2778,.388]},interpolate:{x:he,y:he,b:he,alpha:{use:he,fixup:It}}},Xx={mode:"xyz50",parse:["xyz-d50"],serialize:"xyz-d50",toMode:{rgb:zo,lab:ud},fromMode:{rgb:Io,lab:cd},channels:["x","y","z","alpha"],ranges:{x:[0,.964],y:[0,.999],z:[0,.825]},interpolate:{x:he,y:he,z:he,alpha:{use:he,fixup:It}}},Yx=t=>{let{x:e,y:n,z:r,alpha:i}=t;e===void 0&&(e=0),n===void 0&&(n=0),r===void 0&&(r=0);let s={mode:"xyz50",x:1.0479298208405488*e+.0229467933410191*n-.0501922295431356*r,y:.0296278156881593*e+.990434484573249*n-.0170738250293851*r,z:-.0092430581525912*e+.0150551448965779*n+.7518742899580008*r};return i!==void 0&&(s.alpha=i),s},Jx=t=>{let{x:e,y:n,z:r,alpha:i}=t;e===void 0&&(e=0),n===void 0&&(n=0),r===void 0&&(r=0);let s={mode:"xyz65",x:.9554734527042182*e-.0230985368742614*n+.0632593086610217*r,y:-.0283697069632081*e+1.0099954580058226*n+.021041398966943*r,z:.0123140016883199*e-.0205076964334779*n+1.3303659366080753*r};return i!==void 0&&(s.alpha=i),s},Kx={mode:"xyz65",toMode:{rgb:Si,xyz50:Yx},fromMode:{rgb:Ei,xyz50:Jx},ranges:{x:[0,.95],y:[0,1],z:[0,1.088]},channels:["x","y","z","alpha"],parse:["xyz","xyz-d65"],serialize:"xyz-d65",interpolate:{x:he,y:he,z:he,alpha:{use:he,fixup:It}}},Qx=({r:t,g:e,b:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);const i={mode:"yiq",y:.29889531*t+.58662247*e+.11448223*n,i:.59597799*t-.2741761*e-.32180189*n,q:.21147017*t-.52261711*e+.31114694*n};return r!==void 0&&(i.alpha=r),i},e2=({y:t,i:e,q:n,alpha:r})=>{t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0);const i={mode:"rgb",r:t+.95608445*e+.6208885*n,g:t-.27137664*e-.6486059*n,b:t-1.10561724*e+1.70250126*n};return r!==void 0&&(i.alpha=r),i},t2={mode:"yiq",toMode:{rgb:e2},fromMode:{rgb:Qx},channels:["y","i","q","alpha"],parse:["--yiq"],serialize:"--yiq",ranges:{i:[-.595,.595],q:[-.522,.522]},interpolate:{y:he,i:he,q:he,alpha:{use:he,fixup:It}}};tt(jS);tt(XS);tt(YS);tt(JS);tt(ex);tt(xm);tt(Pm);tt(ux);tt(dx);tt(gx);tt(mx);tt(dd);tt(bx);tt(fd);tt(wx);tt(Ax);tt(Mx);tt(Ox);tt(Ix);tt(Lx);tt(Hx);tt($x);tt(Ux);tt(jx);tt(Vx);tt(gs);tt(qx);tt(Xx);tt(Kx);tt(t2);const ba=["dark","light"],pu=od.map(t=>t.token),n2=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;function Gm(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function r2(t,e,n){if(!Gm(t))return n.push(`"${e}" must be an object of 21 colour tokens.`),!1;let r=!0;for(const i of pu){const s=t[i];if(s===void 0){n.push(`"${e}" is missing the token "${i}".`),r=!1;continue}if(typeof s!="string"){n.push(`"${e}.${i}" must be a string, got ${typeof s}.`),r=!1;continue}n2.test(s)||(n.push(`"${e}.${i}" must be a hex colour like #1a2b3c, got "${s}".`),r=!1)}for(const i of Object.keys(t))pu.includes(i)||(n.push(`"${e}" has an unknown token "${i}".`),r=!1);return r}function i2(t){const e=[];for(const n of ba)for(const r of gS){const i=pS(t[n][r.fg],t[n][r.bg]);i<r.min&&e.push({theme:n,pair:`${r.fg} on ${r.bg}`,ratio:Number(i.toFixed(2)),min:r.min})}return e}function Vm(t){const e=[];if(!Gm(t))return{palette:null,structuralErrors:['The file must contain a JSON object with "dark" and "light" keys.'],contrastWarnings:[]};let n=!0;for(const i of ba){if(!(i in t)){e.push(`Missing the "${i}" theme.`),n=!1;continue}r2(t[i],i,e)||(n=!1)}for(const i of Object.keys(t))ba.includes(i)||(e.push(`Unknown top-level key "${i}"; expected only "dark" and "light".`),n=!1);if(!n)return{palette:null,structuralErrors:e,contrastWarnings:[]};const r={dark:{},light:{}};for(const i of ba){const s=t[i];for(const o of pu)r[i][o]=s[o]}return{palette:r,structuralErrors:[],contrastWarnings:i2(r)}}const s2=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),Zm=Ue({permission:hm,reason:de().min(1),prerequisite:de().min(1).optional()}),gd=Vt().int().nonnegative().nullable(),o2=Ue({kind:Kt(["exec","service"]),state:Pt("blocked"),retryAfterSeconds:gd,blockers:vt(Zm).min(1)}),a2=Ue({kind:Kt(["exec","service"]),state:Pt("incompatible"),retryAfterSeconds:gd,requiredProtocol:Vt().int(),supportedProtocols:vt(Vt().int())}),l2=Ue({kind:Kt(["exec","service"]),state:Kt(["ready","starting","unavailable","maintenance","disabled","not-approved"]),retryAfterSeconds:gd}),c2=t=>{if(!s2(t))return t;if(({blocked:["requiredProtocol","supportedProtocols"],incompatible:["blockers"]}[String(t.state)]??["blockers","requiredProtocol","supportedProtocols"]).some(r=>Object.prototype.hasOwnProperty.call(t,r)))throw new Error("backend status contains fields for a different variant");return t},u2=_E(c2,rd("state",[o2,a2,l2]));class gu extends Error{constructor(n){super(`Unknown backend binding id: "${n}"`);G(this,"code","UNKNOWN_ID");this.id=n,this.name="BackendUnknownId"}}class Wm extends Error{constructor(n){super(`Backend "${n}" is not approved`);G(this,"code","NOT_APPROVED");this.id=n,this.name="BackendNotApproved"}}class qm extends Error{constructor(n){super(`Backend "${n}" is disabled`);G(this,"code","DISABLED");this.id=n,this.name="BackendDisabled"}}class gh extends Error{constructor(n,r){super(`Backend route "${n}" is not an ${r} route`);G(this,"code","TRANSPORT_MISMATCH");this.id=n,this.expected=r,this.name="BackendTransportMismatch"}}class d2 extends Error{constructor(n,r){super(`Backend "${n}" is starting`);G(this,"daemonCode","BACKEND_STARTING");this.id=n,this.retryAfterSeconds=r,this.name="BackendStarting"}}class f2 extends Error{constructor(n){super(`Backend "${n}" is unavailable`);G(this,"daemonCode","BACKEND_UNAVAILABLE");this.id=n,this.name="BackendUnavailable"}}class h2 extends Error{constructor(n){super(`Backend "${n}" is incompatible`);G(this,"daemonCode","BACKEND_INCOMPATIBLE");this.id=n,this.name="BackendIncompatible"}}class p2 extends Error{constructor(n,r){super(`Backend "${n}" is under maintenance`);G(this,"daemonCode","BACKEND_MAINTENANCE");this.id=n,this.retryAfterSeconds=r,this.name="BackendMaintenance"}}class g2 extends Error{constructor(n,r,i){super(`Backend "${n}" is blocked on an unmet activation prerequisite`);G(this,"daemonCode","BACKEND_BLOCKED");this.id=n,this.blockers=r,this.retryAfterSeconds=i,this.name="BackendBlocked"}}class m2 extends Error{constructor(n){super(`Backend "${n}" returned a bad gateway response`);G(this,"daemonCode","BAD_GATEWAY");this.id=n,this.name="BackendBadGateway"}}class wc extends Error{constructor(n,r){super(r);G(this,"code","STATUS_QUERY_FAILED");this.httpStatus=n,this.name="BackendStatusQueryError"}}const yc=t=>{const e=t.headers.get("Retry-After");if(e===null||!/^\d+$/.test(e))return null;const n=Number(e);return Number.isSafeInteger(n)?n:null},v2=t=>{const e=vt(Zm).safeParse(t);return e.success?e.data:[]},b2={DISABLED:t=>new qm(t),NOT_APPROVED:t=>new Wm(t),ROUTE_NOT_FOUND:t=>new gu(t),BACKEND_STARTING:(t,e)=>new d2(t,yc(e)),BACKEND_UNAVAILABLE:t=>new f2(t),BACKEND_INCOMPATIBLE:t=>new h2(t),BACKEND_MAINTENANCE:(t,e)=>new p2(t,yc(e)),BACKEND_BLOCKED:(t,e,n)=>new g2(t,v2(n.detail),yc(e)),BAD_GATEWAY:t=>new m2(t)},_2=t=>{if(!t)return"";const e=new URLSearchParams;for(const[r,i]of Object.entries(t))e.set(r,String(i));const n=e.toString();return n?`?${n}`:""},w2=t=>t===null||typeof t!="object"?!1:!(t instanceof FormData||t instanceof Blob||t instanceof ArrayBuffer||t instanceof URLSearchParams||t instanceof ReadableStream),y2=t=>t.startsWith("https:")?"wss:":"ws:",mh=(t,e)=>t.enabled?t.approval!=="approved"?new Wm(e):null:new qm(e),k2=async(t,e)=>{if(e.ok)return e;let n;try{n=(await e.clone().json()).error}catch{return e}const r=n!=null&&n.code?b2[n.code]:void 0;if(!r||!n)return e;throw r(t,e,n)},E2=async(t,e,n,r)=>{const i=`${t.origin}/api/plugins/${t.pluginName}/${e.path}${_2(r.query)}`,s=new Headers(r.headers);e.method!=="GET"&&e.method!=="HEAD"&&s.set("X-Mndw-Csrf","1");let o;r.body!==void 0&&r.body!==null&&(w2(r.body)?(o=JSON.stringify(r.body),s.has("content-type")||s.set("content-type","application/json")):o=r.body);const a=await t.fetchImpl(i,{method:e.method,headers:s,body:o,signal:r.signal});return k2(n,a)};function S2(t,e,n={}){const r={pluginName:t,descriptor:e,fetchImpl:n.fetch??globalThis.fetch.bind(globalThis),WebSocketCtor:n.WebSocketCtor??globalThis.WebSocket,origin:n.origin??(typeof location<"u"?location.origin:"http://localhost")};return{fetch(i,s={}){const o=e.routes[i];if(!o)throw new gu(i);if(o.transport!=="http"||!o.method)throw new gh(i,"http");const a=mh(e,i);return a?Promise.reject(a):E2(r,o,i,s)},socket(i,s={}){const o=e.routes[i];if(!o)throw new gu(i);if(o.transport!=="websocket")throw new gh(i,"websocket");const a=mh(e,i);if(a)throw a;const l=`${y2(r.origin)}//${r.origin.replace(/^[a-z]+:\/\//,"")}/ws/plugins/${r.pluginName}/${o.path}`,c=s.protocols??o.protocols;return new r.WebSocketCtor(l,c)},status(i={}){const s=`${r.origin}/api/plugins/${r.pluginName}/_mndw/status`;return r.fetchImpl(s,{method:"GET",signal:i.signal}).then(async o=>{if(!o.ok)throw new wc(o.status,`Backend status query failed with HTTP ${o.status}`);try{return u2.parse(await o.json())}catch(a){throw a instanceof wc?a:new wc(o.status,"Backend status response is invalid")}})}}}class vh extends Error{constructor(n,r){super(r);G(this,"status");this.name="TelemetryError",this.status=n}}const Zr=t=>typeof t=="number"&&Number.isFinite(t),x2=["unanchored","anchored","suspect"],T2=t=>{if(t===void 0)return;if(t===null||typeof t!="object"||Array.isArray(t))throw new Error("telemetry clock is invalid");const e=t,{state:n,historyEndMs:r,historyCurrent:i,replayPending:s}=e;if(typeof n!="string"||!x2.includes(n))throw new Error("telemetry clock state is invalid");if(r!==null&&(!Zr(r)||!Number.isInteger(r)||r<0))throw new Error("telemetry clock historyEndMs must be a non-negative integer or null");if(typeof i!="boolean"||typeof s!="boolean")throw new Error("telemetry clock flags must be booleans");if(r===null&&i)throw new Error("telemetry clock cannot be current without history");return{state:n,historyEndMs:r,historyCurrent:i,replayPending:s}},C2=new Set(["accent","success","warning","muted"]),P2=t=>{if(typeof t!="string"||!C2.has(t))throw new Error(`invalid projected chart color: ${String(t)}`);return t},bh=(t,e)=>{if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`projected point in ${e} is invalid`);const n=t;if(!Zr(n.time))throw new Error(`projected point time in ${e} is invalid`);if(n.value!==null&&!Zr(n.value))throw new Error(`projected point value in ${e} must be finite or null`);return{time:n.time,value:n.value===null?Number.NaN:n.value}},R2=(t,e)=>{if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`projected band point in ${e} is invalid`);const n=t;if(!Zr(n.time)||!Zr(n.min)||!Zr(n.max))throw new Error(`projected band point in ${e} is invalid`);return{time:n.time,min:n.min,max:n.max}},A2=(t,e)=>{if(e===null||typeof e!="object"||Array.isArray(e))throw new Error(`projected series ${t} is invalid`);const n=e;if(typeof n.supported!="boolean")throw new Error(`projected series ${t} supported is invalid`);if(n.unit!=="percent"&&n.unit!=="celsius")throw new Error(`projected series ${t} has invalid unit`);if(n.label!==void 0&&n.label!==null&&typeof n.label!="string")throw new Error(`projected series ${t} label is invalid`);if(!Array.isArray(n.points)||!Array.isArray(n.segments)||!Array.isArray(n.bands))throw new Error(`projected series ${t} arrays are invalid`);const r=n.points.map(a=>bh(a,t)),i=n.segments.map(a=>{if(a===null||typeof a!="object"||Array.isArray(a))throw new Error(`projected segment in ${t} is invalid`);const l=a;if(!Array.isArray(l.data))throw new Error(`projected segment data in ${t} is invalid`);return{data:l.data.map(c=>bh(c,t))}}),s=n.bands.map(a=>{if(a===null||typeof a!="object"||Array.isArray(a))throw new Error(`projected band in ${t} is invalid`);const l=a;if(typeof l.id!="string"||!Array.isArray(l.data))throw new Error(`projected band in ${t} is invalid`);return{id:l.id,data:l.data.map(c=>R2(c,t)),color:P2(l.color)}});let o;if(n.valueDomain!==void 0&&n.valueDomain!==null){if(typeof n.valueDomain!="object"||Array.isArray(n.valueDomain))throw new Error(`projected series ${t} valueDomain is invalid`);const a=n.valueDomain;if(!Zr(a.min)||!Zr(a.max))throw new Error(`projected series ${t} valueDomain is invalid`);o={min:a.min,max:a.max}}return{label:typeof n.label=="string"?n.label:void 0,supported:n.supported,unit:n.unit,points:r,segments:i,bands:s,valueDomain:o}},M2=t=>{if(t===null||typeof t!="object"||Array.isArray(t))throw new Error("projected telemetry response must be an object");const e=t,n=e.gathering;if(n===null||typeof n!="object"||Array.isArray(n)||typeof n.enabled!="boolean")throw new Error("projected telemetry gathering is invalid");const r=e.keys;if(r===null||typeof r!="object"||Array.isArray(r))throw new Error("projected telemetry keys are invalid");const i={};for(const[s,o]of Object.entries(r))i[s]=A2(s,o);return{keys:i,gathering:{enabled:n.enabled},clock:T2(e.clock),sessionConfigured:typeof e.sessionConfigured=="boolean"?e.sessionConfigured:!1}},O2=t=>t!==null&&typeof t=="object"&&"name"in t&&t.name==="AbortError";function N2(t=globalThis.fetch){const e=async(n,r,i)=>{const s=await t(n,{method:"GET",cache:"no-store",signal:i.signal});if(!s.ok)throw new vh(s.status,i.unavailableMessage);try{return r(await s.json())}catch(o){throw O2(o)?o:new vh(s.status,o instanceof Error?o.message:i.invalidResponseMessage)}};return{async fetchProjected(n,r={}){return e(`/api/mndw/telemetry?project=${n}`,M2,{signal:r.signal,unavailableMessage:"Projected telemetry is unavailable.",invalidResponseMessage:"Invalid projected telemetry response."})}}}const z2={loading:"Loading…",error:"Something went wrong."},I2={"toggle-menu":"Toggle menu",close:"Close navigation",dashboard:"Dashboard","package-manager":"Entware",plugins:"Plugins",settings:"Settings","light-theme":"Switch to light theme","dark-theme":"Switch to dark theme","color-theme":"Toggle color theme",language:"Language","language-english":"Switch to English","language-russian":"Switch to Russian",logout:"Logout"},L2={"add-widget":"+ Add Widget","arrange-widgets":"Arrange widgets","no-widgets":"No widgets available",preparing:"preparing…",unavailable:"unavailable","move-up":"Move {label} up","move-down":"Move {label} down","remove-widget":"Remove {label}","preparing-dependencies":"Preparing… installing dependencies","dependency-install-failed":"Dependency install failed"},D2={title:"Settings","general-tab":"General","diagnostics-tab":"Diagnostics","plugins-tab":"Plugins","self-update-tab":"System update","self-update-description":"Check for and safely install a new mndw package, or restore the previous package.","self-update-current":"Running version: {version}","self-update-rollback":"Rollback version: {version}","self-update-available":"Update available: {version}","self-update-check":"Check for updates","self-update-apply":"Apply update","self-update-revert":"Revert","self-update-confirm-update-title":"Confirm update","self-update-confirm-revert-title":"Confirm revert","self-update-confirm-update":"Install update to {version}? mndw will restart.","self-update-confirm-revert":"Revert to {version}? mndw will restart.","self-update-progress-title":"System update","self-update-checking":"Checking…","self-update-preparing":"Preparing update…","self-update-updating":"Updating to {version}…","self-update-reverting":"Reverting to {version}…","self-update-success":"Update complete. Running version: {version}","self-update-busy":"Package manager is busy. Try again shortly.","self-update-no-update":"No update is available. Check again later.","self-update-rollback-unavailable":"No rollback is available.","self-update-unconfirmed":"Update started, but its final state could not be confirmed. Check again.","self-update-unconfirmed-modal":"Unable to confirm self-update completion. Check status again after closing this dialog.","self-update-failure-generic":"Self-update failed. Check again or retry later.","self-update-failure-update-missing":"Update package was not found.","self-update-failure-opkg-install-failed":"Update package installation failed.","self-update-failure-opkg-revert-failed":"Rollback package installation failed.","self-update-failure-rollback-missing":"Rollback package was not found.","self-update-failure-helper-exited":"Update helper stopped before completion.","self-update-failure-unexpected-version":"Device version changed unexpectedly during update.","self-update-failure-state-corrupt":"Self-update state is corrupted. Check again.",general:"General",language:{label:"Language",english:"English",russian:"Русский",pending:"Applying language…"},appearance:"Appearance","dark-theme":"Dark theme",device:"Device","telemetry-label":"Background telemetry","telemetry-toggle":"Enable telemetry","telemetry-description":"Store CPU, memory, and temperature history for 30 days.","telemetry-session-note":"A configured persistent RCI session is required for CPU and memory telemetry.","telemetry-wear-note":"Telemetry collection will increase the load on the storage device where Entware is installed and may accelerate its wear.","telemetry-error":"Could not update background telemetry.",name:"Name:",vendor:"Vendor:",firmware:"Firmware:","device-unavailable":"Device info unavailable.","persistent-rci-title":"Persistent RCI session","persistent-rci-description":"Keep RCI access in mndwd for permitted plugins. Tokens never leave mndwd.","configure-persistent":"Configure persistent controller session","persistent-tokenless-toggle":"Persistent session with controller and extenders","persistent-tokenless-description":"mndwd keeps RCI sessions to this controller and eligible extenders for permitted plugins. No token is required on this firmware.","persistent-needs-token":"Firmware was updated and now requires a controller token. Enter a token to resume the persistent session.","persistent-storage-disabled":"Persistent session storage is disabled.","persistent-storage-decrypt-failed":"Persistent session storage could not be decrypted.","controller-token":"Controller token",test:"Test",save:"Save","clear-controller-session":"Clear controller session","update-firmware-persistent":"Update device firmware to enable persistent RCI sessions.","controller-result":"Controller: {result}","persistent-extenders-title":"Persistent extenders session","persistent-enumeration-stale":"Mesh membership is temporarily stale; live sessions are still monitored.","extender-reason-certificate-invalid":"certificate is invalid","extender-reason-no-auth-token":"auth-token capability unavailable","extender-reason-missing-fqdn":"secure relay name unavailable","extender-state-offline":"offline","extender-state-establishing":"coming online","extender-state-live":"connected","extender-state-dead":"reconnecting","persistent-state-unavailable":"Persistent RCI session state unavailable","persistent-request-failed":"Persistent RCI session request failed","controller-token-rejected":"Controller token rejected","firmware-unsupported":"Device firmware does not support persistent RCI sessions","device-unreachable":"Device unreachable","palette-import-aria-label":"Import palette JSON","backend-capacity":"Backend capacity","backend-approval-title":"Approve backend for {label}","backend-approval-declaration":"declares a backend. Review its capabilities before approving.","backend-approval-deny":"Deny","backend-approval-approve":"Approve","upload-plugin-zip":"Upload plugin ZIP","diagnostics-description":"Download recent daemon and plugin runtime state for troubleshooting.","download-diagnostics":"Download diagnostics",downloading:"Downloading…","diagnostics-failed":"Diagnostics download failed","plugin-manager":{title:"Plugin manager","reload-notice":"Reload to apply plugin changes.","reload-now":"Reload now",later:"Later",loading:"Loading plugins...",retry:"Retry",dismiss:"Dismiss",exec:"Exec",services:"Services","per-plugin-exec-limit":"Per-plugin exec limit","service-protocols":"Service protocols","runtime-status-unavailable":"Runtime status unavailable: {error}","maintenance-busy":"Plugin is busy with another maintenance operation. Try again shortly.","confirming-state":"Confirming plugin state…","operation-finishing":"Plugin operation is still finishing. Refresh to check again.","outcome-unknown":"Could not confirm restart outcome. Refresh to check plugin status.","installed-title":"Installed plugins","no-installed":"No plugins installed.",version:"Version",type:"Type",source:"Source",builtin:"Built-in","installing-dependencies":"Installing dependencies…","dependency-install-failed":"Dependency install failed","version-mismatch":"Version mismatch","load-version-warning":"Built against {versions}. Plugin still loads, but may misbehave with this host.","version-warning":{title:"Version compatibility","sdk-major":"Built for @mndw/sdk {pluginVersion}; this dashboard provides {hostVersion}. The plugin may not work.","sdk-newer-minor":"Built for a newer @mndw/sdk ({pluginVersion}) than this dashboard provides ({hostVersion}). Some features may not work.","shared-major":"Built for {name} {pluginVersion}; this dashboard provides {hostVersion}. The plugin may not work.","install-anyway":"You can still install it."},"endpoint-one":"{count} endpoint","endpoint-many":"{count} endpoints","websocket-one":"{count} websocket","websocket-many":"{count} websockets","persistent-rci-read":"Persistent RCI read","persistent-rci-write":"Persistent RCI write",refresh:"Refresh",enable:"Enable",disable:"Disable","restart-backend":"Restart backend","delete-confirmation":"Delete {label}? This cannot be undone.",cancel:"Cancel","delete-plugin":"Delete plugin",delete:"Delete",backend:"Backend",protocol:"Protocol",incompatible:"incompatible","supported-service-protocols":"Supported service protocols","runtime-state-stopped":"stopped","runtime-state-capacity-blocked":"capacity blocked","runtime-state-starting":"starting","runtime-state-ready":"ready","runtime-state-backoff":"backing off","runtime-state-failed":"failed","pending-title":"Pending approvals","deny-confirmation":"Deny {label}? This cannot be undone.","deny-plugin":"Deny plugin",deny:"Deny",approve:"Approve",routes:"Routes","backend-kind-service":"Runs a resident background process as root","backend-kind-exec":"Runs commands as root on each request",packages:"Installs packages","service-args":"Service arguments","public-routes":"Public routes (reachable from the LAN without sign-in)",permissions:"Permissions","upload-trust-warning":"A plugin gets full administrator access to this router. Install plugins only from authors you trust.","upload-drop":"Drop a plugin ZIP here or choose a file.",uploading:"Uploading plugin...","waiting-approval":"Waiting for approval...","installed-success":'Installed "{label}".',"approved-success":'Approved "{label}".',"choose-zip":"Choose a ZIP file.","empty-zip":"The ZIP file is empty.","zip-too-large":"The ZIP file exceeds the 10 MB upload limit.","upload-target-mismatch":"{filename} targets {archiveTarget}, but this device reports {deviceTarget}. Choose the matching archive."}},H2={cancel:"Cancel",close:"Close",save:"Save",retry:"Retry"},B2={username:"Username",password:"Password",submit:"Login","logging-in":"Logging in…","invalid-credentials":"Invalid credentials","connection-failed":"Connection failed"},$2={region:"Notifications",dismiss:"Dismiss"},U2={tab:"Packages",title:"Package Manager",refresh:"Refresh Metadata",reload:"Reload",search:"Search packages…",all:"All",installed:"Installed",updates:"Updates ({count})",selected:"({count} selected)","with-selected":"With selected:",install:"Install",remove:"Remove",update:"Update",installing:"Installing…",removing:"Removing…",updating:"Updating…","action-failed":"{action} failed","update-available":"Update available",available:"Available","select-package":"Select {name}","select-all":"Select all filtered packages",loading:"Loading…","load-failed":"Failed to load packages",empty:"No packages found","no-match":"No packages match your filter",package:"Package",version:"Version",status:"Status",description:"Description",expand:"Expand {name}",collapse:"Collapse {name}",loaded:"{count} packages loaded","never-refreshed":"Metadata never refreshed","refreshed-ago":"Metadata refreshed {minutes} min ago","detail-failed":"Failed to load package details",size:"Feed size","installed-size":"Installed size","installed-time":"Installed time",dependencies:"Dependencies","confirm-remove-title":"Confirm package removal","confirm-remove":"Remove {names}?",protected:"Protected package","dependency-conflict":"Can't remove {package}: it is required by {dependents}.","dependency-conflict-generic":"Can't remove {package}: it is required by other installed packages."},j2={tab:"Services",title:"Services",description:"Inspect and control device init services.",refresh:"Refresh states",service:"Service",state:"State",autostart:"Autostart",actions:"Actions",start:"Start",stop:"Stop",restart:"Restart",enabled:"Enabled",disabled:"Disabled","enable-at-boot":"Enable at boot","disable-at-boot":"Disable at boot",pid:"PID {pid}","autostart-pinned":"Autostart is fixed by ENABLED= in the script","probe-failed":"Unknown",empty:"No services found","load-failed":"Failed to load services",unavailable:"No service manager available","unavailable-description":"This device does not expose an init service directory.",protected:"Protected service","confirm-title":"Confirm service action",confirm:"{action} service {name}?","confirm-enable-boot":"Enable {name} at boot? The running service is unchanged until reboot.","confirm-disable-boot":"Disable {name} at boot? The running service is unchanged until reboot."},F2={"device-timeout":"The device did not respond.","invalid-manifest":"The plugin manifest is invalid.","invalid-zip":"The file is not a valid ZIP archive.","manifest-missing":"The archive has no manifest.json at its root.","unsupported-manifest-version":"This plugin manifest version is no longer supported.",conflict:"A plugin with that name already exists.","upload-too-large":"The plugin exceeds the 10 MB upload limit.","opkg-failed":"Installing the plugin's system packages failed.","daemon-failed":"Starting the plugin's backend failed.",unauthorized:"Your session has expired. Please log in again.","service-capacity":"No service capacity is available. Stop another backend and try again.","backend-busy":"The backend is busy. Try again shortly.","backend-unavailable":"The backend is unavailable.","backend-incompatible":"This backend requires an unsupported protocol version.","backend-maintenance":"The backend is being updated. Try again shortly.","controller-session-unavailable":"Controller token session is unavailable.","rci-socket-start-failed":"Persistent RCI session socket could not start. Try again."},Xm={app:z2,nav:I2,dashboard:L2,settings:D2,common:H2,login:B2,toast:$2,packages:U2,services:j2,errors:F2},G2={loading:"Загрузка…",error:"Произошла ошибка."},V2={"toggle-menu":"Переключить меню",close:"Закрыть навигацию",dashboard:"Панель управления","package-manager":"Entware",plugins:"Плагины",settings:"Настройки","light-theme":"Включить светлую тему","dark-theme":"Включить тёмную тему","color-theme":"Переключить цветовую тему",language:"Язык","language-english":"Переключить на английский","language-russian":"Переключить на русский",logout:"Выйти"},Z2={"add-widget":"+ Добавить виджет","arrange-widgets":"Упорядочить виджеты","no-widgets":"Нет доступных виджетов",preparing:"подготовка…",unavailable:"недоступен","move-up":"Переместить {label} выше","move-down":"Переместить {label} ниже","remove-widget":"Удалить {label}","preparing-dependencies":"Подготовка… установка зависимостей","dependency-install-failed":"Не удалось установить зависимости"},W2={title:"Настройки","general-tab":"Общие","diagnostics-tab":"Диагностика","plugins-tab":"Плагины","self-update-tab":"Обновление системы","self-update-description":"Проверяйте и безопасно устанавливайте новую версию mndw или восстанавливайте предыдущую.","self-update-current":"Текущая версия: {version}","self-update-rollback":"Версия для отката: {version}","self-update-available":"Доступно обновление: {version}","self-update-check":"Проверить обновления","self-update-apply":"Установить обновление","self-update-revert":"Откатить","self-update-confirm-update-title":"Подтвердите обновление","self-update-confirm-revert-title":"Подтвердите откат","self-update-confirm-update":"Установить обновление до версии {version}? mndw будет перезапущен.","self-update-confirm-revert":"Откатить до версии {version}? mndw будет перезапущен.","self-update-progress-title":"Обновление системы","self-update-checking":"Проверка…","self-update-preparing":"Подготовка обновления…","self-update-updating":"Обновление до {version}…","self-update-reverting":"Откат до {version}…","self-update-success":"Обновление завершено. Текущая версия: {version}","self-update-busy":"Менеджер пакетов занят. Повторите попытку позже.","self-update-no-update":"Обновление недоступно. Повторите проверку позже.","self-update-rollback-unavailable":"Откат недоступен.","self-update-unconfirmed":"Обновление запущено, но результат не подтверждён. Проверьте состояние ещё раз.","self-update-unconfirmed-modal":"Не удалось подтвердить завершение обновления. Закройте диалог и проверьте состояние ещё раз.","self-update-failure-generic":"Не удалось обновить систему. Повторите попытку позже.","self-update-failure-update-missing":"Пакет обновления не найден.","self-update-failure-opkg-install-failed":"Не удалось установить пакет обновления.","self-update-failure-opkg-revert-failed":"Не удалось установить пакет отката.","self-update-failure-rollback-missing":"Пакет отката не найден.","self-update-failure-helper-exited":"Помощник обновления завершился раньше времени.","self-update-failure-unexpected-version":"Версия устройства неожиданно изменилась во время обновления.","self-update-failure-state-corrupt":"Состояние обновления повреждено. Выполните проверку снова.",general:"Общие",language:{label:"Язык",english:"English",russian:"Русский",pending:"Применение языка…"},appearance:"Внешний вид","dark-theme":"Тёмная тема",device:"Устройство","telemetry-label":"Фоновая телеметрия","telemetry-toggle":"Включить телеметрию","telemetry-description":"Хранить историю CPU, памяти и температуры в течение 30 дней.","telemetry-session-note":"Для телеметрии CPU и памяти требуется настроенная постоянная сессия RCI.","telemetry-wear-note":"Сбор телеметрии увеличит нагрузку на накопитель, на котором установлен Entware, и может ускорить его износ.","telemetry-error":"Не удалось обновить фоновую телеметрию.",name:"Имя:",vendor:"Производитель:",firmware:"Прошивка:","device-unavailable":"Информация об устройстве недоступна.","persistent-rci-title":"Постоянная сессия rci/","persistent-rci-description":"Сохранить доступ rci/ в mndwd для разрешённых плагинов. Токены не покидают mndwd.","configure-persistent":"Настроить постоянный сеанс контроллера","persistent-tokenless-toggle":"Постоянная сессия с контроллером и экстендерами","persistent-tokenless-description":"mndwd поддерживает RCI-сессии с контроллером и подходящими экстендерами для разрешённых плагинов. На этой прошивке токен не требуется.","persistent-needs-token":"Прошивка обновлена и теперь требует токен контроллера. Введите токен, чтобы возобновить постоянную сессию.","persistent-storage-disabled":"Хранилище постоянных сеансов отключено.","persistent-storage-decrypt-failed":"Не удалось расшифровать хранилище постоянных сеансов.","controller-token":"Токен контроллера",test:"Проверить",save:"Сохранить","clear-controller-session":"Очистить сеанс контроллера","update-firmware-persistent":"Обновите прошивку устройства для включения постоянных сеансов rci/.","controller-result":"Контроллер: {result}","persistent-extenders-title":"Постоянный сеанс расширителей","persistent-enumeration-stale":"Список mesh временно устарел; активные сеансы всё ещё проверяются.","extender-reason-certificate-invalid":"сертификат недействителен","extender-reason-no-auth-token":"возможность auth-token недоступна","extender-reason-missing-fqdn":"имя защищённого реле недоступно","extender-state-offline":"не в сети","extender-state-establishing":"подключается","extender-state-live":"подключён","extender-state-dead":"переподключается","persistent-state-unavailable":"Состояние постоянного сеанса rci/ недоступно","persistent-request-failed":"Не удалось выполнить запрос постоянного сеанса rci/","controller-token-rejected":"Токен контроллера отклонён","firmware-unsupported":"Прошивка устройства не поддерживает постоянные сеансы rci/","device-unreachable":"Устройство недоступно","palette-import-aria-label":"Импорт JSON-палитры","backend-capacity":"Ёмкость серверной части","backend-approval-title":"Подтвердить серверную часть для {label}","backend-approval-declaration":"объявляет серверную часть. Проверьте её возможности перед подтверждением.","backend-approval-deny":"Отклонить","backend-approval-approve":"Подтвердить","upload-plugin-zip":"Загрузить ZIP плагина","diagnostics-description":"Скачать состояние демона и плагинов для диагностики.","download-diagnostics":"Скачать диагностику",downloading:"Скачивание…","diagnostics-failed":"Не удалось скачать диагностику","plugin-manager":{title:"Менеджер плагинов","reload-notice":"Перезагрузите страницу, чтобы применить изменения плагинов.","reload-now":"Перезагрузить сейчас",later:"Позже",loading:"Загрузка плагинов…",retry:"Повторить",dismiss:"Скрыть",exec:"Exec",services:"Сервисы","per-plugin-exec-limit":"Лимит Exec для плагина","service-protocols":"Протоколы сервисов","runtime-status-unavailable":"Состояние серверной части недоступно: {error}","maintenance-busy":"Плагин занят другой операцией обслуживания. Повторите попытку позже.","confirming-state":"Проверка состояния плагина…","operation-finishing":"Операция с плагином ещё выполняется. Обновите страницу, чтобы проверить результат.","outcome-unknown":"Не удалось подтвердить результат перезапуска. Обновите страницу, чтобы проверить состояние плагина.","installed-title":"Установленные плагины","no-installed":"Плагины не установлены.",version:"Версия",type:"Тип",source:"Источник",builtin:"Встроенный","installing-dependencies":"Установка зависимостей…","dependency-install-failed":"Не удалось установить зависимости","version-mismatch":"Несоответствие версии","load-version-warning":"Собрано для версий {versions}. Плагин всё ещё загружается, но может работать неправильно с этим хостом.","version-warning":{title:"Совместимость версий","sdk-major":"Собрано для @mndw/sdk {pluginVersion}; эта панель предоставляет {hostVersion}. Плагин может не работать.","sdk-newer-minor":"Собрано для более новой версии @mndw/sdk ({pluginVersion}), чем предоставляет эта панель ({hostVersion}). Некоторые функции могут не работать.","shared-major":"Собрано для {name} {pluginVersion}; эта панель предоставляет {hostVersion}. Плагин может не работать.","install-anyway":"Плагин всё равно можно установить."},"endpoint-one":"{count} конечная точка","endpoint-many":"{count} конечных точек","websocket-one":"{count} веб-сокет","websocket-many":"{count} веб-сокетов","persistent-rci-read":"Чтение через постоянный RCI","persistent-rci-write":"Запись через постоянный RCI",refresh:"Обновить",enable:"Включить",disable:"Отключить","restart-backend":"Перезапустить серверную часть","delete-confirmation":"Удалить {label}? Это действие нельзя отменить.",cancel:"Отмена","delete-plugin":"Удалить плагин",delete:"Удалить",backend:"Серверная часть",protocol:"Протокол",incompatible:"несовместима","supported-service-protocols":"Поддерживаемые протоколы сервисов","runtime-state-stopped":"остановлена","runtime-state-capacity-blocked":"заблокирована из-за нехватки ресурсов","runtime-state-starting":"запускается","runtime-state-ready":"готова","runtime-state-backoff":"ожидает перезапуска","runtime-state-failed":"ошибка","pending-title":"Ожидающие подтверждения","deny-confirmation":"Отклонить {label}? Это действие нельзя отменить.","deny-plugin":"Отклонить плагин",deny:"Отклонить",approve:"Подтвердить",routes:"Маршруты","backend-kind-service":"Запускает постоянный фоновый процесс от root","backend-kind-exec":"Запускает команды от root на каждый запрос",packages:"Устанавливает пакеты","service-args":"Аргументы сервиса","public-routes":"Публичные маршруты (доступны из локальной сети без входа)",permissions:"Разрешения","upload-trust-warning":"Плагин получает полный административный доступ к роутеру. Устанавливайте плагины только от авторов, которым доверяете.","upload-drop":"Перетащите ZIP плагина сюда или выберите файл.",uploading:"Загрузка плагина…","waiting-approval":"Ожидание подтверждения…","installed-success":"Плагин «{label}» установлен.","approved-success":"Плагин «{label}» подтверждён.","choose-zip":"Выберите ZIP-файл.","empty-zip":"ZIP-файл пуст.","zip-too-large":"Размер ZIP-файла превышает лимит загрузки 10 МБ.","upload-target-mismatch":"Файл {filename} предназначен для {archiveTarget}, но устройство сообщает {deviceTarget}. Выберите подходящий архив."}},q2={cancel:"Отмена",close:"Закрыть",save:"Сохранить",retry:"Повторить"},X2={username:"Имя пользователя",password:"Пароль",submit:"Войти","logging-in":"Выполняется вход…","invalid-credentials":"Неверные учётные данные","connection-failed":"Ошибка соединения"},Y2={region:"Уведомления",dismiss:"Закрыть"},J2={tab:"Пакеты",title:"Менеджер пакетов",refresh:"Обновить метаданные",reload:"Перезагрузить",search:"Поиск пакетов…",all:"Все",installed:"Установленные",updates:"Обновления ({count})",selected:"(выбрано: {count})","with-selected":"С выбранными:",install:"Установить",remove:"Удалить",update:"Обновить",installing:"Установка…",removing:"Удаление…",updating:"Обновление…","action-failed":"Не удалось выполнить: {action}","update-available":"Доступно обновление",available:"Доступен","select-package":"Выбрать {name}","select-all":"Выбрать все отфильтрованные пакеты",loading:"Загрузка…","load-failed":"Не удалось загрузить пакеты",empty:"Пакеты не найдены","no-match":"Нет пакетов, соответствующих фильтру",package:"Пакет",version:"Версия",status:"Состояние",description:"Описание",expand:"Развернуть {name}",collapse:"Свернуть {name}",loaded:"Загружено пакетов: {count}","never-refreshed":"Метаданные ещё не обновлялись","refreshed-ago":"Метаданные обновлены {minutes} мин назад","detail-failed":"Не удалось загрузить сведения о пакете",size:"Размер в репозитории","installed-size":"Установленный размер","installed-time":"Время установки",dependencies:"Зависимости","confirm-remove-title":"Подтвердите удаление пакета","confirm-remove":"Удалить {names}?",protected:"Защищённый пакет","dependency-conflict":"Невозможно удалить {package}: от него зависит {dependents}.","dependency-conflict-generic":"Невозможно удалить {package}: от него зависят другие установленные пакеты."},K2={tab:"Сервисы",title:"Сервисы",description:"Просмотр и управление сервисами устройства.",refresh:"Обновить состояния",service:"Сервис",state:"Состояние",autostart:"Автозапуск",actions:"Действия",start:"Запустить",stop:"Остановить",restart:"Перезапустить",enabled:"Включён",disabled:"Выключен","enable-at-boot":"Включать при загрузке","disable-at-boot":"Не включать при загрузке",pid:"PID {pid}","autostart-pinned":"Автозапуск задан строкой ENABLED= в скрипте","probe-failed":"Неизвестно",empty:"Сервисы не найдены","load-failed":"Не удалось загрузить сервисы",unavailable:"Менеджер сервисов недоступен","unavailable-description":"На устройстве нет доступного каталога init-сервисов.",protected:"Защищённый сервис","confirm-title":"Подтвердите действие с сервисом",confirm:"{action} сервис {name}?","confirm-enable-boot":"Включать {name} при загрузке? Работающий сервис не изменится до перезагрузки.","confirm-disable-boot":"Не включать {name} при загрузке? Работающий сервис не изменится до перезагрузки."},Q2={"device-timeout":"Устройство не отвечает.","invalid-manifest":"Манифест плагина недействителен.","invalid-zip":"Файл не является ZIP-архивом.","manifest-missing":"В архиве нет manifest.json в корне.","unsupported-manifest-version":"Версия манифеста плагина больше не поддерживается.",conflict:"Плагин с таким именем уже существует.","upload-too-large":"Плагин превышает лимит загрузки 10 МБ.","opkg-failed":"Не удалось установить системные пакеты плагина.","daemon-failed":"Не удалось запустить серверную часть плагина.",unauthorized:"Сеанс истёк. Войдите снова.","service-capacity":"Нет свободных сервисных ресурсов.","backend-busy":"Серверная часть занята. Повторите позже.","backend-unavailable":"Серверная часть недоступна.","backend-incompatible":"Протокол серверной части не поддерживается.","backend-maintenance":"Серверная часть обновляется. Повторите позже.","controller-session-unavailable":"Сеанс токена контроллера недоступен.","rci-socket-start-failed":"Не удалось запустить сокет сеанса RCI. Повторите попытку."},eT={app:G2,nav:V2,dashboard:Z2,settings:W2,common:q2,login:X2,toast:Y2,packages:J2,services:K2,errors:Q2},md="mndw",Ua=`${md}:plugin`,Ym=["en","ru"],Jm=5e3,tT=6e4,nT=24e4,vd=Object.freeze({theme:"dark",locale:"en"}),bd=Object.freeze({deviceName:"Unknown",vendor:"Unknown",manufacturer:"Unknown",model:"Unknown",series:"Unknown",region:"Unknown",hwId:"Unknown",hwVersion:"Unknown",firmwareVersion:"Unknown",firmwareRelease:"Unknown",features:Object.freeze([]),components:Object.freeze([]),switchports:Object.freeze({list:Object.freeze([]),layout:Object.freeze([]),hasPortStats:!1}),usb:Object.freeze({ports:Object.freeze([])})}),Km="/api/mgmt/list",rT="/api/mgmt/permission",iT="/api/mgmt/upload",_h="/api/mgmt/approve",sT="/api/mgmt/deny",oT="/api/mgmt/enable",aT="/api/mgmt/disable",lT="/api/mgmt/delete",cT="/api/mgmt/restart",uT="/api/mgmt/runtime",kc="/api/mgmt/palette",dT="/api/mgmt/device-hardware",wh="/api/mgmt/telemetry",fT="/api/mgmt/opkg/list",hT="/api/mgmt/opkg/install",pT="/api/mgmt/opkg/remove",gT="/api/mgmt/opkg/update",mT="/api/mgmt/opkg/upgrade",vT="/api/mgmt/opkg/info",bT="/api/mgmt/self-update/status",_T="/api/mgmt/self-update/check",wT="/api/mgmt/self-update/apply",yT="/api/mgmt/self-update/revert",kT="/api/mgmt/service/list",ET="/api/mgmt/service/status",ST="/api/mgmt/service/start",xT="/api/mgmt/service/stop",TT="/api/mgmt/service/restart",CT="/api/mgmt/service/set-enabled",yh={builtin:"/plugins/",user:"/user-plugins/"},PT={A:"Ȧ",B:"Ḃ",C:"Ç",D:"Ḋ",E:"Ḗ",F:"Ḟ",G:"Ġ",H:"Ḧ",I:"Ī",J:"Ĵ",K:"Ḱ",L:"Ŀ",M:"Ṁ",N:"Ṅ",O:"Ö",P:"Ṕ",Q:"Q",R:"Ŕ",S:"Ṡ",T:"Ṫ",U:"Ū",V:"Ṽ",W:"Ẇ",X:"Ẋ",Y:"Ẏ",Z:"Ż",a:"ȧ",b:"ḃ",c:"ç",d:"ḋ",e:"ḗ",f:"ḟ",g:"ġ",h:"ḧ",i:"ī",j:"ĵ",k:"ḱ",l:"ŀ",m:"ṁ",n:"ṅ",o:"ö",p:"ṕ",q:"q",r:"ŕ",s:"ṡ",t:"ṫ",u:"ū",v:"ṽ",w:"ẇ",x:"ẋ",y:"ẏ",z:"ż"};function RT(t){return[...t].map(e=>PT[e]??e).join("")}function AT(t){const e=t.replace(/\b\w+\b/g,n=>{const r="~".repeat(Math.max(1,Math.ceil(n.length*.35)));return`${n}${r}`});return`[${RT(e)}]`}function Qm(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>[e,typeof n=="string"?AT(n):Qm(n)]))}function MT(){const t=new ob(1);let e=!1;const n={ended$:t.asObservable(),get ended(){return e},end:()=>{e||(e=!0,t.next(),t.complete())}};return Object.freeze(n)}function Ec(t,e,n){return new _a(r=>{if(n.ended){r.complete();return}let i;const s=()=>{const a=i;i=void 0,a==null||a()},o=n.ended$.subscribe(()=>{s(),r.complete()});return r.next(t()),!r.closed&&!n.ended&&(i=e(a=>r.next(a)),n.ended&&s()),()=>{o.unsubscribe(),s()}})}function OT(t,e){return new _a(n=>{if(e.ended){n.complete();return}let r;const i=()=>{const o=r;r=void 0,o==null||o()},s=e.ended$.subscribe(()=>{i(),n.complete()});return r=t(()=>n.next()),e.ended&&i(),()=>{s.unsubscribe(),i()}})}const mu=3e3;function NT(t={}){return{catalogSuccessCache:new Map,catalogCells:new Set,activeGeneration:void 0,nextGenerationToken:0,fetchCatalog:t.fetchCatalog??LT,now:t.now??Date.now,setTimeout:t.setTimeout??globalThis.setTimeout.bind(globalThis),queueMicrotask:t.queueMicrotask??globalThis.queueMicrotask.bind(globalThis)}}function Sc(t,e){return`${t.name}/${t.version}/${e}`}function zT(t,e){const n=t.locales[e];if(n!==void 0)return`${t.baseUrl.replace(/\/$/,"")}/${n}?v=${encodeURIComponent(t.version)}`}function IT(t){return t.split("-")[0]}function ev(t,e){if(t.locales[e]!==void 0)return e;const n=IT(e);return n!==void 0&&t.locales[n]!==void 0?n:t.defaultLocale}async function LT(t){const e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);return Dw(await e.json(),t)}async function kh(t,e,n,r){const i=t.catalogSuccessCache.get(Sc(e,n));if(i!==void 0)return i;const s=zT(e,n);if(s===void 0)throw new Error(`Plugin "${e.name}" does not declare a catalog for ${n}`);try{const o=await t.fetchCatalog(s);if(r!==void 0&&t.now()>r)throw new Error("catalog request completed after deadline");return t.catalogSuccessCache.set(Sc(e,n),o),o}catch(o){throw t.catalogSuccessCache.delete(Sc(e,n)),o}}function DT(t,e){const n=Math.max(0,e-t.now());return new Promise((r,i)=>{t.setTimeout(()=>i(new Error("catalog deadline exceeded")),n)})}async function tv(t,e,n,r){var d,h;const i=ev(e,n),s=e.defaultLocale,o=kh(t,e,i,r),a=i===s?o:kh(t,e,s,r),l=await Promise.race([Promise.allSettled([o,a]),DT(t,r)]).catch(()=>{}),c=Array.isArray(l)&&((d=l[0])==null?void 0:d.status)==="fulfilled"?l[0].value:void 0,u=Array.isArray(l)&&((h=l[1])==null?void 0:h.status)==="fulfilled"?l[1].value:void 0;return{hostLocale:n,resolvedCatalogLocale:i,...c===void 0?{}:{primaryCatalog:c},...u===void 0?{}:{defaultCatalog:u},fallbackStatus:c!==void 0?"primary":u!==void 0?"default":"key"}}function nv(t,e){return{hostLocale:e,resolvedCatalogLocale:ev(t,e),fallbackStatus:"key"}}class HT{constructor(e,n){G(this,"source");G(this,"state");G(this,"listeners",new Set);this.source=Object.freeze({...e,locales:Object.freeze({...e.locales})}),this.state=nv(this.source,n)}readCurrentState(){return this.state}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}commit(e,n=!0){if(this.state=Object.freeze(e),n)for(const r of this.listeners)r()}}function BT(t,e,n){const r=new HT(e,n);return t.catalogCells.add(r),t.activeGeneration!==void 0&&t.activeGeneration.add(r),r}function $T(t,e){t.catalogCells.add(e)}function UT(t,e){t.catalogCells.delete(e)}function jT(t){var e;(e=t.activeGeneration)==null||e.discard(),t.catalogCells.clear(),t.activeGeneration=void 0}function rv(t,e,n,r){if(r!==void 0)return{name:t,version:e,baseUrl:n,defaultLocale:r.defaultLocale,locales:r.locales}}async function FT(t,e,n,r=mu){e.commit(await tv(t,e.source,n,t.now()+r))}class GT{constructor(e,n){G(this,"runtime");G(this,"token");G(this,"targetLocale");G(this,"deadline");G(this,"promise");G(this,"pending",0);G(this,"initialEnrollmentDone",!1);G(this,"settled",!1);G(this,"cells",new Map);G(this,"resolvedStates",new Map);G(this,"resolvePromise");this.runtime=e,this.token=++e.nextGenerationToken,this.targetLocale=n,this.deadline=e.now()+mu,this.promise=new Promise(r=>{this.resolvePromise=r}),e.setTimeout(()=>this.settle(),mu)}add(e){if(this.settled||this.runtime.now()>=this.deadline||this.cells.has(e))return;this.pending+=1;const n=tv(this.runtime,e.source,this.targetLocale,this.deadline).catch(()=>nv(e.source,this.targetLocale));this.cells.set(e,n),n.then(r=>{this.resolvedStates.set(e,r)}).finally(()=>{this.pending-=1,this.settle()})}closeEnrollment(){this.initialEnrollmentDone=!0,this.settle()}discard(){this.settled||(this.settled=!0,this.resolvePromise())}settle(){this.settled||!this.initialEnrollmentDone||this.pending>0||this.runtime.queueMicrotask(()=>{this.settled||!this.initialEnrollmentDone||this.pending>0||(this.settled=!0,this.resolvePromise())})}commit(e){if(this.runtime.activeGeneration===this){for(const[n,r]of this.resolvedStates)n.commit(r,!1);e();for(const n of this.resolvedStates.keys()){const r=this.resolvedStates.get(n);this.runtime.activeGeneration===this&&r!==void 0&&n.commit(r)}this.runtime.activeGeneration=void 0}}}function VT(t,e){if(t.activeGeneration!==void 0)throw new Error("A plugin catalog generation is already pending");const n=new GT(t,e);t.activeGeneration=n;for(const r of t.catalogCells)n.add(r);return n.closeEnrollment(),n}function ZT(t,e){t.commit(e)}function WT(t,e){e.discard(),t.activeGeneration===e&&(t.activeGeneration=void 0)}function qT(t){return t.activeGeneration}function XT(t,e,n,r){var o,a;const i=t==null?void 0:t.readCurrentState(),s=((o=i==null?void 0:i.primaryCatalog)==null?void 0:o[e])??((a=i==null?void 0:i.defaultCatalog)==null?void 0:a[e])??e;return fm(s,n,r)}function YT(t,e,n,r){const i={get locale(){return e()},direction:"ltr",t:(s,o)=>XT(t,s,o,e()),formatNumber:(s,o)=>new Intl.NumberFormat(no(e()),o).format(s),formatDate:(s,o)=>new Intl.DateTimeFormat(no(e()),o).format(s),change$:OT((t==null?void 0:t.subscribe.bind(t))??n,r)};return Object.freeze(i)}function JT(t={}){const e=NT(t);return{createPluginCatalogCell:(n,r)=>BT(e,n,r),registerPluginCatalogCell:n=>$T(e,n),unregisterPluginCatalogCell:n=>UT(e,n),clearPluginCatalogCells:()=>jT(e),loadInitialPluginCatalog:(n,r,i)=>FT(e,n,r,i),preparePluginCatalogGeneration:n=>VT(e,n),commitPluginCatalogGeneration:(n,r)=>ZT(n,r),discardPluginCatalogGeneration:n=>WT(e,n),getActivePluginCatalogGeneration:()=>qT(e)}}const Do=JT(),iv=`${md}:locale`,xc={en:Xm,ru:eT};Qm(Xm);function sv(t){try{if(typeof Intl.getCanonicalLocales=="function")return Intl.getCanonicalLocales(t)[0];if(typeof Intl.Locale=="function")return new Intl.Locale(t).toString()}catch{}}function KT(){return!1}function _d(){return Ym}function ov(t){const e=sv(t);return _d().find(n=>n===e)}function Eh(t){const e=sv(t);if(e!==void 0)return ov(e)??_d().find(n=>n===e.split("-")[0])}function QT(t){try{return(t==null?void 0:t.getItem(iv))??void 0}catch{return}}function eC(){const t=[...navigator.languages];return navigator.language!==""&&t.push(navigator.language),t}function tC(t){const e=t.catalog,n=t.storage??globalThis.localStorage,r=t.document??globalThis.document,i=t.setUiLocale??eb;let s=Ym[0],o=!1;const a=new Set,l=new Set,c=m=>{r.documentElement.lang=m,r.documentElement.dir="ltr"},u=m=>{s=m,i(m),c(m);for(const _ of a)_(m)};return Object.freeze({initLocale:()=>{const m=QT(n),k=(m===void 0?void 0:ov(m))??eC().map(Eh).find(O=>O!==void 0)??"en";return u(k),k},getLocale:()=>s,setLocale:async m=>{const _=Eh(m)??"en";if(_===s)return;o=!0;for(const O of l)O(!0);const k=e.preparePluginCatalogGeneration(_);await k.promise,e.commitPluginCatalogGeneration(k,()=>{u(_);try{n==null||n.setItem(iv,_)}catch{}}),o=!1;for(const O of l)O(!1)},subscribeLocale:m=>(a.add(m),()=>{a.delete(m)}),isLocaleSwitchPending:()=>o,subscribeLocalePending:m=>(l.add(m),()=>{l.delete(m)}),hostT:(m,_,k=s)=>{const O=xc[k]??xc.en,I=Sh(O,m)??Sh(xc.en,m)??m;return _===void 0?I:fm(I,_,k)},hostFormatNumber:(m,_)=>new Intl.NumberFormat(no(s),_).format(m),hostFormatDate:(m,_)=>new Intl.DateTimeFormat(no(s),_).format(m),getAvailableLocales:_d,isPseudoLocaleEnabled:KT})}const Ho=tC({catalog:Do}),nC=Ho,os=()=>Ho.getLocale(),vu=t=>Ho.subscribeLocale(t),rC=t=>Ho.subscribeLocalePending(t),Rn=(t,e,n)=>Ho.hostT(t,e,n);function Sh(t,e){let n=t;for(const r of e.split(".")){if(typeof n=="string")return;n=n[r]}return typeof n=="string"?n:void 0}const av=`${md}:theme`,bu="dark";let Ur=bu;const _u=new Set;function iC(){try{const t=localStorage.getItem(av);return t==="light"||t==="dark"?t:bu}catch{return bu}}function lv(t){document.documentElement.dataset.theme=t}function cv(t){for(const e of _u)e(t)}function sC(){return Ur=iC(),lv(Ur),cv(Ur),Ur}function ja(){return Ur}function oC(t){if(t!==Ur){Ur=t,lv(t);try{localStorage.setItem(av,t)}catch{}cv(t)}}function ji(){oC(Ur==="dark"?"light":"dark")}function uv(t){return _u.add(t),()=>{_u.delete(t)}}function xh(t){return t.split(",").map(e=>e.trim()).filter(e=>e!=="")}const aC=["/","/login","/packages","/packages/services","/settings"],lC=new Set(aC);function dv(t){return lC.has(t)}const cC=de().regex(/^[a-z0-9][a-z0-9-]*$/,{message:"name must be lowercase alphanumeric with hyphens (e.g. my-widget)"}),uC=t=>!t.startsWith("/")&&!t.includes("..")&&!t.includes("\\")&&!t.split("/").some(e=>e==="."||e===".."),fv=t=>{const e=t.split("/").filter(Boolean);return!!e[e.length-1]},wd=de().min(1).refine(uC,{message:"must be a safe relative path"}),dC=wd.refine(fv,{message:"entry must include a file name"}),wu=t=>{try{if(typeof Intl.getCanonicalLocales=="function")return Intl.getCanonicalLocales(t)[0];if(typeof Intl.Locale=="function")return new Intl.Locale(t).toString()}catch{}},fC=de().min(1).superRefine((t,e)=>{const n=wu(t);n===void 0?e.addIssue({code:"custom",message:"must be a valid BCP-47 locale tag"}):n!==t&&e.addIssue({code:"custom",message:`must use canonical BCP-47 spelling (${n})`})}),hC=wd.refine(t=>t.endsWith(".json"),{message:"catalog path must end with .json"}),pC=Ue({defaultLocale:fC,locales:ps(de(),hC)}).strict().superRefine((t,e)=>{const n=Object.keys(t.locales);n.length===0&&e.addIssue({code:"custom",path:["locales"],message:"locales must contain at least one locale"});const r=new Map;for(const s of n){const o=wu(s);if(o===void 0){e.addIssue({code:"custom",path:["locales",s],message:"must be a valid BCP-47 locale tag"});continue}o!==s&&e.addIssue({code:"custom",path:["locales",s],message:`must use canonical BCP-47 spelling (${o})`});const a=r.get(o);a!==void 0&&a!==s?e.addIssue({code:"custom",path:["locales",s],message:`canonical locale collides with ${a}`}):r.set(o,s)}const i=wu(t.defaultLocale);i!==void 0&&!r.has(i)&&e.addIssue({code:"custom",path:["defaultLocale"],message:"defaultLocale must be present in locales"})}),hv=de().regex(/^[a-z0-9][a-z0-9+_.-]*$/),pv=Kt(["session","public"]).default("session"),gC=de().transform(t=>t.toUpperCase()).pipe(Kt(["GET","HEAD","POST","PUT","PATCH","DELETE"])),gv=t=>{if(t.length===0||t.startsWith("/")||t.includes("\\")||t.includes("?")||t.includes("#"))return!1;let e;try{e=decodeURIComponent(t)}catch{return!1}if(e!==t||e.includes("%")||e.startsWith("/")||e.includes("\\"))return!1;const n=e.split("/");return n.every(r=>r.length>0&&r!=="."&&r!=="..")&&n[0]!=="_mndw"},mv=wd.refine(fv,{message:"command must include a file name"}).refine(t=>!t.split("/").some(e=>e==="."||e===".."),{message:"command must not contain dot segments"}),mC=de().min(1).refine(t=>[...t].every(e=>{const n=e.codePointAt(0)??0;return n>31&&n!==127}),{message:"args must not contain control characters"}),vv=Ue({id:de().min(1),transport:Pt("http"),method:gC,path:de().refine(gv,{message:"path must be canonical and safe"}),access:pv}),vC=Ue({id:de().min(1),transport:Pt("websocket"),path:de().refine(gv,{message:"path must be canonical and safe"}),access:pv,protocols:vt(de().min(1)).optional()}),bC=vv.extend({command:mv}),bv=(t,e)=>{const n=t.map(i=>i.id);new Set(n).size!==n.length&&e.addIssue({code:"custom",message:"backend.routes contains duplicate id"});const r=t.map(i=>i.transport==="http"?`${i.transport}:${i.method}:${i.path}`:`${i.transport}:${i.path}`);new Set(r).size!==r.length&&e.addIssue({code:"custom",message:"backend.routes contains duplicate route tuple"});for(const i of t)i.transport==="http"&&i.access==="public"&&!["GET","HEAD"].includes(i.method??"")&&e.addIssue({code:"custom",message:"public HTTP routes may only use GET or HEAD"})},_C=Ue({kind:Pt("exec"),packages:vt(hv).optional(),routes:vt(bC).min(1)}).strict().superRefine((t,e)=>{bv(t.routes,e)}),wC=Ue({kind:Pt("service"),protocolVersion:Vt().int().positive(),command:mv,args:vt(mC).optional(),packages:vt(hv).optional(),routes:vt($r([vv,vC])).min(1)}).strict().superRefine((t,e)=>{bv(t.routes,e)}),yC=$r([_C,wC]),Th=Vt().int().positive().max(12),Ch=Vt().int().positive(),kC=Pt(1).describe("Manifest format version. Must be 1."),EC=cC.describe("Unique plugin id used as the on-disk folder and URL segment."),SC=de().min(1).describe("Semver-ish version string."),xC=de().min(1).describe("Human-readable name shown in the dashboard or navigation."),TC=dC.describe("Relative path to the bundled entry module."),CC=de().optional().describe("Optional icon name."),PC=pm,RC=vt(PC).superRefine((t,e)=>{new Set(t).size!==t.length&&e.addIssue({code:"custom",message:"permissions contains duplicate permission"})}),AC=Ue({w:Th,h:Ch,minW:Th.optional(),minH:Ch.optional()}).refine(t=>t.minW===void 0||t.minW<=t.w,{message:"size.minW must be less than or equal to size.w",path:["minW"]}).refine(t=>t.minH===void 0||t.minH<=t.h,{message:"size.minH must be less than or equal to size.h",path:["minH"]}),MC=de().regex(/^\/[^/?#*]+$/).refine(t=>!dv(t),{message:"route is reserved by the host"}),_v={manifestVersion:kC,name:EC,version:SC,label:xC,entry:TC,icon:CC,permissions:RC.optional(),i18n:pC.optional(),backend:yC.optional()},OC=Ue({..._v,type:Pt("widget"),size:AC,fixedHeight:xr().optional()}),NC=Ue({..._v,type:Pt("page"),route:MC}),zC=rd("type",[OC,NC]);class IC extends Error{constructor(n,r){const i=r.map(o=>({path:o.path.length===0?"<root>":o.path.join("."),message:o.message})),s=i.map(o=>`${o.path}: ${o.message}`).join("; ");super(`Invalid manifest for "${n}": ${s}`);G(this,"issues");this.issues=i}}function LC(t){const e=zC.safeParse(t);if(!e.success){const n=typeof t=="object"&&t!==null&&typeof t.name=="string"?t.name:"unknown";throw new IC(n,e.error.issues)}return e.data}Ue({cid:de().optional(),mac:de().optional(),ip:de().optional(),fqdn:de().optional(),"fqdn-certificate-valid":xr().optional(),capabilities:ps(de(),nu()).optional()}).passthrough();const DC=[{specifiers:["@rci-tools/core"],bundle:"rci-tools-core",version:"0.6.0",entryPoint:"@rci-tools/core",external:["rxjs","hash-wasm"],framework:"base"},{specifiers:["rxjs"],bundle:"rxjs",version:"7.8.2",entryPoint:"rxjs",framework:"base"},{specifiers:["rxjs/operators"],bundle:"rxjs-operators",version:"7.8.2",entryPoint:"rxjs/operators",framework:"base"},{specifiers:["hash-wasm"],bundle:"hash-wasm",version:"4.12.0",entryPoint:"hash-wasm",framework:"base"},{specifiers:["d3"],bundle:"d3",version:"7.9.0",entryPoint:"d3",framework:"base"},{specifiers:["@mndw/ui"],bundle:"mndw-ui",version:"0.1.4",entryPoint:"@mndw/ui",external:["d3"],framework:"base"},{specifiers:["vue"],bundle:"vue",version:"3.5.39",entryPoint:"vue",banner:"var __VUE_OPTIONS_API__=true,__VUE_PROD_DEVTOOLS__=false,__VUE_PROD_HYDRATION_MISMATCH_DETAILS__=false;",framework:"vue"},{specifiers:["zone.js"],bundle:"zone",version:"0.15.1",entryPoint:"zone.js",framework:"angular"},{specifiers:["@angular/core","@angular/core/rxjs-interop"],bundle:"angular-core",version:"21.2.18",stdin:"export * from '@angular/core'; export * from '@angular/core/rxjs-interop';",external:["rxjs","rxjs/operators","@angular/compiler"],framework:"angular"},{specifiers:["@angular/common"],bundle:"angular-common",version:"21.2.18",entryPoint:"@angular/common",external:["rxjs","@angular/compiler","@angular/core"],framework:"angular"},{specifiers:["@angular/platform-browser"],bundle:"angular-platform-browser",version:"21.2.18",entryPoint:"@angular/platform-browser",external:["rxjs","@angular/compiler","@angular/core"],framework:"angular"},{specifiers:["@angular/compiler"],bundle:"angular-compiler",version:"21.2.18",entryPoint:"@angular/compiler",external:["rxjs"],framework:"angular"}],yd=()=>Object.fromEntries(DC.flatMap(t=>t.specifiers.map(e=>[e,t.version]))),HC=Kt(["builtin","registry","upload"]),BC=Kt(["pending","approved"]),$C=Kt(["ready","installing","failed"]),UC=Kt(["stopped","capacity_blocked","starting","ready","backoff","failed"]),jC=Ue({kind:Kt(["exec","service"]),packages:vt(de()).optional(),args:vt(de()).optional(),publicRoutes:vt(de()).optional()}),FC=ps(de(),xr()).superRefine((t,e)=>{for(const n of Object.keys(t))fS(n)||e.addIssue({code:"custom",path:[n],message:"only persistent RCI permissions may be granted"})}),GC=Ue({transport:Kt(["http","websocket"]),path:de(),method:Kt(["GET","HEAD","POST","PUT","PATCH","DELETE"]).optional(),protocols:vt(de()).optional()}),VC=Ue({routes:ps(de(),GC)}),ZC=Ue({w:Vt(),h:Vt(),minW:Vt().optional(),minH:Vt().optional()}),WC=Ue({defaultLocale:de(),locales:ps(de(),de())}),qC=Ue({state:UC,restartCount:Vt(),consecutiveFailures:Vt(),startedAt:de().optional(),nextAttemptAt:de().optional(),lastExit:de().optional(),lastError:de().optional(),recentStderr:vt(de()).optional(),requiredProtocol:Vt().optional(),compatible:xr().optional(),supportedProtocols:vt(Vt()).optional()}),XC=Ue({sdkVersion:de(),sharedDependencies:ps(de(),de())}),wv={name:de(),version:de(),label:de(),entry:de(),icon:de().optional(),source:HC,approval:BC,enabled:xr(),permissions:vt(pm).optional(),permissionGrants:FC.optional(),depsStatus:$C,backend:VC,review:jC.optional(),i18n:WC.optional(),catalogBaseUrl:de().optional(),runtime:qC.optional(),lock:XC.optional()},YC=Ue({...wv,type:Pt("widget"),size:ZC,fixedHeight:xr().optional()}),JC=Ue({...wv,type:Pt("page"),route:de()}),yv=rd("type",[YC,JC]),KC=Ue({plugins:vt(yv)}),kv=t=>KC.parse(t).plugins,Tc=t=>yv.parse(t),Fa=new ns;function Bo(t){return Fa.get(t)??"ready"}function Ph(t){Fa.clear();for(const e of t)Fa.set(e.name,e.depsStatus)}let ea=null,Rh;function QC(){clearTimeout(Rh),Rh=void 0,ea==null||ea.abort(),ea=null}const me=it({authenticated:!1,ready:!1,hostInfo:null,deviceInfo:null,pluginLoadError:null,mobileSidebarOpen:!1,desktopSidebarCollapsed:!1,theme:ja(),locale:os(),localeSwitchPending:!1});function Cc(){pl().matches?me.mobileSidebarOpen=!me.mobileSidebarOpen:me.desktopSidebarCollapsed=!me.desktopSidebarCollapsed}function kd(){QC(),me.authenticated=!1,me.ready=!1,me.hostInfo=null,me.deviceInfo=null}uv(t=>{me.theme=t});vu(t=>{me.locale=t});rC(t=>{me.localeSwitchPending=t});function w(t,e){return Rn(t,e,me.locale)}var eP=z('<h2 class="mndw-overlay-dialog__title svelte-1ervcvh"> </h2>'),tP=z('<button type="button" class="mndw-overlay-dialog__close svelte-1ervcvh">×</button>'),nP=z('<header class="mndw-overlay-dialog__header svelte-1ervcvh"><!> <!></header>'),rP=z('<p class="mndw-overlay-dialog__description svelte-1ervcvh"> </p>'),iP=z('<div role="dialog"><!> <!> <div class="mndw-overlay-dialog__body svelte-1ervcvh"></div></div>');function sP(t,e){Ie(e,!0);const n=Math.random().toString(36).slice(2),r=`mndw-overlay-title-${n}`,i=`mndw-overlay-desc-${n}`;function s(p,g){return p.appendChild(g),{destroy(){g.parentNode===p&&p.removeChild(g)}}}const o=fe(()=>e.layer.mobileSheet?"width:100%;height:auto;max-height:100dvh":[e.layer.sizing.width?`width:${e.layer.sizing.width}`:"",e.layer.sizing.height?`height:${e.layer.sizing.height}`:"",e.layer.sizing.maxWidth?`max-width:${e.layer.sizing.maxWidth}`:"",e.layer.sizing.maxHeight?`max-height:${e.layer.sizing.maxHeight}`:""].filter(Boolean).join(";"));var a=iP(),l=v(a);{var c=p=>{var g=nP(),m=v(g);{var _=I=>{var R=eP(),A=v(R);y(()=>{Ae(R,"id",r),S(A,e.layer.shell.title)}),C(I,R)};Z(m,I=>{var R;(R=e.layer.shell)!=null&&R.title&&I(_)})}var k=x(m,2);{var O=I=>{var R=tP();y(A=>Ae(R,"aria-label",A),[()=>w("common.close")]),pe("click",R,()=>e.layer.close(void 0,"action")),C(I,R)};Z(k,I=>{var R;(R=e.layer.shell)!=null&&R.showCloseButton&&I(O)})}C(p,g)};Z(l,p=>{var g,m;((g=e.layer.shell)!=null&&g.title||(m=e.layer.shell)!=null&&m.showCloseButton)&&p(c)})}var u=x(l,2);{var d=p=>{var g=rP(),m=v(g);y(()=>{Ae(g,"id",i),S(m,e.layer.shell.description)}),C(p,g)};Z(u,p=>{var g;(g=e.layer.shell)!=null&&g.description&&p(d)})}var h=x(u,2);Kr(h,(p,g)=>s==null?void 0:s(p,g),()=>e.layer.contentElement),y(()=>{var p,g;Ne(a,1,`mndw-overlay-dialog mndw-overlay-dialog--${e.layer.kind??""} mndw-overlay-dialog--${e.layer.placement??""} ${e.layer.mobileSheet?"mndw-overlay-dialog--sheet":""} ${e.layer.className??""??""}`,"svelte-1ervcvh"),Ae(a,"data-locale",me.locale),Ae(a,"aria-modal",e.layer.kind==="modal"?"true":void 0),Ae(a,"aria-labelledby",(p=e.layer.shell)!=null&&p.title?r:void 0),Ae(a,"aria-describedby",(g=e.layer.shell)!=null&&g.description?i:void 0),Ks(a,f(o))}),C(t,a),Le()}at(["click"]);const oP=1e4;function aP(t){switch(t){case"modal":return{placement:"center",closeOnEscape:!0,closeOnOutsideClick:!1,trapFocus:!0,restoreFocus:!0,lockScroll:!0,backdrop:!0};case"drawer":return{placement:"right",closeOnEscape:!0,closeOnOutsideClick:!0,trapFocus:!0,restoreFocus:!0,lockScroll:!0,backdrop:!0};case"popover":return{placement:"bottom-start",closeOnEscape:!0,closeOnOutsideClick:!0,trapFocus:!1,restoreFocus:!1,lockScroll:!1,backdrop:!1};case"custom":return{placement:"center",closeOnEscape:!1,closeOnOutsideClick:!1,trapFocus:!1,restoreFocus:!1,lockScroll:!1,backdrop:!1}}}var vo,bo,_o,wo,yo,ko;class Ah{constructor(e,n,r,i,s){G(this,"id");G(this,"pluginName");G(this,"instanceId");G(this,"kind");G(this,"hostElement");G(this,"contentElement");be(this,vo,Y("opening"));be(this,bo,Y(null));be(this,_o,Y("center"));G(this,"mobileSheet");be(this,wo,Y(void 0));be(this,yo,Y(it({})));be(this,ko,Y(null));G(this,"behavior");G(this,"closeOnEscape");G(this,"closeOnOutsideClick");G(this,"trapFocus");G(this,"restoreFocus");G(this,"lockScroll");G(this,"backdrop");G(this,"closed");G(this,"abortController",new AbortController);G(this,"anchorElement");G(this,"cleanup",null);G(this,"onCloseListeners",new Set);G(this,"previousFocus");G(this,"closedResolve");G(this,"openTimeout");G(this,"focusTrap",null);G(this,"repositionHandler",null);G(this,"anchorObserver",null);G(this,"runtime");var a;this.runtime=e,this.id=e.allocateLayerId(),this.pluginName=n,this.instanceId=r,this.kind=i.kind;const o=aP(i.kind);this.behavior=o,this.closeOnEscape=i.closeOnEscape??o.closeOnEscape,this.closeOnOutsideClick=i.closeOnOutsideClick??o.closeOnOutsideClick,this.trapFocus=i.trapFocus??o.trapFocus,this.restoreFocus=i.restoreFocus??o.restoreFocus,this.lockScroll=i.lockScroll??o.lockScroll,this.backdrop=o.backdrop,this.shell=s,this.placement=Ud(i.kind,i.placement),this.mobileSheet=tb(i.kind),this.className=i.className,this.sizing=jd(i.kind,i,this.mobileSheet),this.anchorElement=((a=i.anchor)==null?void 0:a.element)??null,this.hostElement=document.createElement("div"),this.hostElement.className="mndw-overlay-layer",this.contentElement=document.createElement("div"),this.contentElement.className="mndw-overlay-content",s||this.hostElement.appendChild(this.contentElement),this.previousFocus=this.restoreFocus&&document.activeElement instanceof HTMLElement?document.activeElement:null,this.closed=new Promise(l=>{this.closedResolve=l}),this.openTimeout=setTimeout(()=>{this.state==="opening"&&this.closeInternal("mount-failed")},oP),this.attachAnchorObservers()}get state(){return f(E(this,vo))}set state(e){b(E(this,vo),e,!0)}get shell(){return f(E(this,bo))}set shell(e){b(E(this,bo),e,!0)}get placement(){return f(E(this,_o))}set placement(e){b(E(this,_o),e,!0)}get className(){return f(E(this,wo))}set className(e){b(E(this,wo),e,!0)}get sizing(){return f(E(this,yo))}set sizing(e){b(E(this,yo),e,!0)}get position(){return f(E(this,ko))}set position(e){b(E(this,ko),e,!0)}get isOpen(){return this.state==="opening"||this.state==="open"}get signal(){return this.abortController.signal}close(e,n="api"){this.closeInternal(n,e)}closeWithReason(e,n){this.closeInternal(e,n)}setCleanup(e){this.state!=="closed"&&(this.cleanup=e)}markReady(){this.state==="opening"&&(this.clearOpenTimeout(),this.state="open",this.trapFocus&&requestAnimationFrame(()=>this.activateFocusTrap()))}update(e){if(this.isOpen){if(e.className!==void 0&&(this.className=e.className),e.placement!==void 0&&(this.placement=Ud(this.kind,e.placement)),e.anchor!==void 0&&!this.shell&&(this.anchorElement=e.anchor.element,this.attachAnchorObservers()),this.shell){const n={...this.shell??{showCloseButton:!0}};e.title!==void 0&&(n.title=e.title),e.description!==void 0&&(n.description=e.description),e.showCloseButton!==void 0&&(n.showCloseButton=e.showCloseButton),this.shell=n}(e.width!==void 0||e.height!==void 0||e.maxWidth!==void 0||e.maxHeight!==void 0)&&(this.sizing=jd(this.kind,{kind:this.kind,width:e.width,height:e.height,maxWidth:e.maxWidth,maxHeight:e.maxHeight},this.mobileSheet)),this.reposition()}}onClose(e){return this.onCloseListeners.add(e),()=>{this.onCloseListeners.delete(e)}}reposition(){if(this.kind!=="popover"||!this.anchorElement)return;const e=this.contentElement.getBoundingClientRect();if(e.width<=0||e.height<=0)return;const n=nb({element:this.anchorElement},{width:e.width,height:e.height},this.placement);this.placement=n.placement,this.position={top:n.top,left:n.left}}attachAnchorObservers(){if(this.detachAnchorObservers(),this.kind!=="popover"||!this.anchorElement)return;const e=this.anchorElement;this.repositionHandler=()=>{requestAnimationFrame(()=>this.reposition())},window.addEventListener("scroll",this.repositionHandler,!0),window.addEventListener("resize",this.repositionHandler),this.anchorObserver=new MutationObserver(()=>{e.isConnected||this.closeInternal("anchor-lost")}),this.anchorObserver.observe(document.body,{childList:!0,subtree:!0})}detachAnchorObservers(){var e;this.repositionHandler&&(window.removeEventListener("scroll",this.repositionHandler,!0),window.removeEventListener("resize",this.repositionHandler),this.repositionHandler=null),(e=this.anchorObserver)==null||e.disconnect(),this.anchorObserver=null}clearOpenTimeout(){this.openTimeout!==void 0&&(clearTimeout(this.openTimeout),this.openTimeout=void 0)}async closeInternal(e,n){var s;if(this.state==="closing"||this.state==="closed")return;this.state="closing",(s=this.focusTrap)==null||s.deactivate(),this.focusTrap=null,this.clearOpenTimeout(),this.abortController.abort(),this.detachAnchorObservers();const r=this.cleanup;if(r)try{await(r instanceof Promise?await r:r)()}catch(o){console.error(`[mndw] Overlay cleanup for "${this.pluginName}" failed:`,o)}this.restoreFocusOnClose(),this.runtime.removeLayer(this),this.state="closed";const i={reason:e,result:n};this.closedResolve(i);for(const o of this.onCloseListeners)try{o(i)}catch(a){console.error(`[mndw] Overlay onClose listener for "${this.pluginName}" failed:`,a)}}restoreFocusOnClose(){var n,r;const e=document.activeElement;if(this.kind==="popover"&&((n=this.anchorElement)!=null&&n.isConnected)){const i=this.contentElement.contains(e),s=!e||e===document.body;(i||s)&&this.anchorElement.focus();return}this.restoreFocus&&((r=this.previousFocus)!=null&&r.isConnected)&&this.previousFocus.focus()}activateFocusTrap(){this.state!=="open"||this.focusTrap||!this.hostElement.isConnected||(this.focusTrap=Mc(this.hostElement,{initialFocus:()=>ib(this.contentElement)[0]??null,restoreFocus:!1,allowFocus:e=>this.runtime.store.layers.some(n=>n.id>this.id&&rb(n.hostElement,e))}))}}vo=new WeakMap,bo=new WeakMap,_o=new WeakMap,wo=new WeakMap,yo=new WeakMap,ko=new WeakMap;var Eo;class lP{constructor(){be(this,Eo,Y(it([])))}get layers(){return f(E(this,Eo))}set layers(e){b(E(this,Eo),e,!0)}}Eo=new WeakMap;function cP(){const t=new lP;let e=1;return{store:t,allocateLayerId:()=>e++,removeLayer:n=>{const r=t.layers.indexOf(n);r!==-1&&t.layers.splice(r,1)},addLayer:n=>{if(n.kind==="modal")for(const r of[...t.layers])r.instanceId===n.instanceId&&r.kind==="popover"&&r.closeWithReason("replaced");t.layers.push(n)}}}const Ev=cP(),uP=Ev;function Ed(t,e,n=Ev){let r=!1;function i(){if(r)throw new Error(`[mndw] Overlay service for "${t}" (${e}) is disposed; the plugin instance was unmounted.`)}function s(){return n.store.layers.filter(l=>l.instanceId===e)}const o={createLayer(l){i();const c=new Ah(n,t,e,l,null);return n.addLayer(c),c},open(l){i();const{title:c,description:u,showCloseButton:d,mount:h,kind:p,...g}=l,m=new Ah(n,t,e,{kind:p,...g},{title:c,description:u,showCloseButton:d??!0});n.addLayer(m);try{const _=h(m.contentElement,m,m.signal);_ instanceof Promise?_.then(()=>m.markReady()).catch(k=>{console.error(`[mndw] Overlay mount for "${t}" failed:`,k),m.closeWithReason("mount-failed")}):m.markReady()}catch(_){console.error(`[mndw] Overlay mount for "${t}" failed:`,_),m.closeWithReason("mount-failed")}return m},closeAll(){for(const l of s())l.close(void 0,"api")}};function a(l="plugin-unmount"){if(!r){r=!0;for(const c of s())c.closeWithReason(l)}}return{service:o,dispose:a}}var dP=z('<div class="mndw-overlay-backdrop svelte-11o3k6p" aria-hidden="true"></div>'),fP=z("<div><!> <div></div></div>");function hP(t,e){Ie(e,!0);let n=Yt(e,"runtime",3,uP);const r=1e3,i=fe(()=>n().store.layers);function s(p){return r+p}function o(p){return p.kind==="modal"||p.kind==="drawer"}function a(p){return p.kind==="popover"?p.position?`position:absolute;top:${p.position.top}px;left:${p.position.left}px`:"position:absolute;visibility:hidden":""}function l(p,g){p.appendChild(g.hostElement),g.kind==="drawer"&&g.placement==="bottom"&&(g.hostElement.style.display="flex",g.hostElement.style.flexDirection="column",g.hostElement.style.justifyContent="flex-end",g.hostElement.style.width="100%",g.hostElement.style.height="100%",g.hostElement.style.minHeight="0");let m;return g.shell&&(m=hl(sP,{target:g.hostElement,props:{layer:g}})),requestAnimationFrame(()=>{g.state!=="closed"&&g.reposition()}),{destroy(){m&&ju(m),g.hostElement.remove()}}}function c(p){if(p.key==="Escape"){for(let g=f(i).length-1;g>=0;g--)if(f(i)[g].closeOnEscape){f(i)[g].closeWithReason("escape"),p.stopPropagation();return}}}function u(p){const g=p.composedPath();for(let m=f(i).length-1;m>=0;m--){const _=f(i)[m];if(g.includes(_.hostElement)||_.anchorElement&&g.includes(_.anchorElement))return;if(_.closeOnOutsideClick){_.closeWithReason("outside-click");return}if(o(_))return}}hn(()=>{const p=f(i).some(m=>m.lockScroll),g=document.body.style.overflow;return p&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=g}});var d=kn();ut("keydown",Ys,c),ut("pointerdown",Ys,u);var h=Xe(d);ft(h,19,()=>f(i),p=>p.id,(p,g,m)=>{var _=fP();let k;var O=v(_);{var I=T=>{var M=dP();C(T,M)},R=fe(()=>o(f(g))&&f(g).backdrop);Z(O,T=>{f(R)&&T(I)})}var A=x(O,2);Kr(A,(T,M)=>l==null?void 0:l(T,M),()=>f(g)),y((T,M)=>{Ne(_,1,`mndw-overlay-layer mndw-overlay-layer--${f(g).kind??""}`,"svelte-11o3k6p"),k=Ks(_,"",k,T),Ne(A,1,`mndw-overlay-positioner mndw-overlay-positioner--${f(g).kind??""} mndw-overlay-positioner--${f(g).placement??""} ${f(g).mobileSheet?"mndw-overlay-positioner--sheet":""}`,"svelte-11o3k6p"),Ks(A,M)},[()=>({"z-index":s(f(m))}),()=>a(f(g))]),C(p,_)}),C(t,d),Le()}const pP={success:4e3,info:4e3,error:0},gP=4,mP=.35,vP=.5;function bP(t,e,n){return e<=0?!1:Math.abs(t)>=e*mP||Math.abs(n)>=vP}var So;class _P{constructor(){be(this,So,Y(it([])));G(this,"nextId",1);G(this,"maxToasts",gP);G(this,"timers",new ns)}get toasts(){return f(E(this,So))}set toasts(e){b(E(this,So),e,!0)}show(e){const n=e.variant??"info",r=e.duration??pP[n],i=this.nextId++;return this.toasts.push({id:i,message:e.message,variant:n,duration:r}),this.enforceCap(),r>0&&this.timers.set(i,setTimeout(()=>this.dismiss(i),r)),i}success(e,n){return this.show({...n,message:e,variant:"success"})}info(e,n){return this.show({...n,message:e,variant:"info"})}error(e,n){return this.show({...n,message:e,variant:"error"})}dismiss(e){this.clearTimer(e);const n=this.toasts.findIndex(r=>r.id===e);n!==-1&&this.toasts.splice(n,1)}setMaxToasts(e){this.maxToasts=Math.max(1,Math.trunc(e)),this.enforceCap()}clear(){for(const e of this.timers.keys())this.clearTimer(e);this.toasts=[]}enforceCap(){for(;this.toasts.length>this.maxToasts;){const e=this.toasts.shift();e!==void 0&&this.clearTimer(e.id)}}clearTimer(e){const n=this.timers.get(e);n!==void 0&&(clearTimeout(n),this.timers.delete(e))}}So=new WeakMap;const si=new _P;var wP=z('<div><span class="mndw-toast__body svelte-1g105wt"> </span> <button type="button" class="mndw-toast__dismiss svelte-1g105wt"><mndw-icon></mndw-icon></button></div>',2),yP=z('<div role="region"></div>');function kP(t,e){Ie(e,!0);let n=Yt(e,"store",3,si);const r=pl();let i=Y(it(r.matches));const s=d=>{b(i,d.matches,!0),n().setMaxToasts(d.matches?3:4)};function o(d){return d==="error"?"danger":d}function a(d,h){let p=h,g=null,m=0,_=0,k=!1;const O=T=>{d.style.transition="transform 0.15s ease, opacity 0.15s ease",d.style.transform="",d.style.opacity=""},I=T=>{!p.enabled||T.pointerType==="mouse"||g!==null||(g=T.pointerId,m=T.clientX,_=T.timeStamp,k=!0,d.style.transition="",d.setPointerCapture(T.pointerId))},R=T=>{if(!k||T.pointerId!==g)return;const M=T.clientX-m;d.style.transform=`translateX(${M}px)`,d.style.opacity=String(Math.max(.3,1-Math.abs(M)/d.offsetWidth))},A=T=>{if(!k||T.pointerId!==g)return;const M=T.clientX-m,N=Math.max(1,T.timeStamp-_),j=M/N;k=!1,g=null,bP(M,d.offsetWidth,j)?p.onDismiss():O()};return d.style.touchAction="pan-y",d.addEventListener("pointerdown",I),d.addEventListener("pointermove",R),d.addEventListener("pointerup",A),d.addEventListener("pointercancel",A),{update(T){p=T},destroy(){d.removeEventListener("pointerdown",I),d.removeEventListener("pointermove",R),d.removeEventListener("pointerup",A),d.removeEventListener("pointercancel",A)}}}zn(()=>(n().setMaxToasts(f(i)?3:4),r.addEventListener("change",s),()=>{r.removeEventListener("change",s)}));var l=kn(),c=Xe(l);{var u=d=>{var h=yP();let p;ft(h,21,()=>n().toasts,g=>g.id,(g,m)=>{var _=wP(),k=v(_),O=v(k),I=x(k,2),R=v(I);P(R,"name","x"),Kr(_,(A,T)=>a==null?void 0:a(A,T),()=>({enabled:f(i),onDismiss:()=>n().dismiss(f(m).id)})),y((A,T)=>{Ne(_,1,`mndw-toast mndw-alert mndw-alert--${A??""}`,"svelte-1g105wt"),Ae(_,"role",f(m).variant==="error"?"alert":"status"),Ae(_,"aria-live",f(m).variant==="error"?"assertive":"polite"),S(O,f(m).message),Ae(I,"aria-label",T)},[()=>o(f(m).variant),()=>w("toast.dismiss")]),pe("click",I,()=>n().dismiss(f(m).id)),C(g,_)}),y(g=>{p=Ne(h,1,"mndw-toast-host svelte-1g105wt",null,p,{"mndw-toast-host--mobile":f(i)}),Ae(h,"aria-label",g)},[()=>w("toast.region")]),C(d,h)};Z(c,d=>{n().toasts.length>0&&d(u)})}C(t,l),Le()}at(["click"]);class yu extends Error{constructor(n,r,i){super(r,i);G(this,"code");this.name="PageRouteError",this.code=n}}const EP=["execute","queue","initBackgroundProcess","queueBackgroundProcess"],SP={light:{bg:"#f7fcfd",surface:"#edf2f3",surfaceRaised:"#f2f7f8",border:"#80878a",textSubtle:"#2f353a",textMuted:"#1d2328",text:"#0c1217",accent:"#016ca5",accentHover:"#005583",accentContrast:"#ffffff",danger:"#c5001b",dangerBg:"#ffe9e6",success:"#137738",successBg:"#d7f9dc",warning:"#916100",warningBg:"#ffebd1",info:"#016ca5",infoBg:"#e0f1ff",focusRing:"#004f7a",surfaceHover:"#e8edee",shadowColor:"#4145462e"},dark:{bg:"#030405",surface:"#0d0f10",surfaceRaised:"#151719",border:"#606569",textSubtle:"#b9c0c7",textMuted:"#d1d9e1",text:"#eaf3fb",accent:"#016ca5",accentHover:"#2b84bf",accentContrast:"#ffffff",danger:"#ed3f3f",dangerBg:"#390204",success:"#5cb572",successBg:"#05210d",warning:"#efa831",warningBg:"#271700",info:"#338ac5",infoBg:"#021d2f",focusRing:"#338ac5",surfaceHover:"#1e2022",shadowColor:"#0102038c"}},Sd="0.1.4",xP=1;function TP(t){return typeof t!="object"||t===null||Array.isArray(t)?!1:Object.values(t).every(e=>typeof e=="string")}async function CP(t,e=fetch){try{const n=await e(`${t}/mndw.lock.json`);if(!n.ok)return null;const r=await n.json();if(typeof r!="object"||r===null)return null;const i=r;if(i.lockVersion!==xP)return null;const s=i.sdkVersion,o=i.sharedDependencies;return typeof s!="string"||!TP(o)?null:{sdkVersion:s,sharedDependencies:o}}catch{return null}}function Us(t){if(typeof t!="string")return null;const e=/^(\d+)(?:\.(\d+))?(?:[.+-]|$)/.exec(t.trim());return e===null?null:{major:Number(e[1]),minor:e[2]===void 0?null:Number(e[2])}}function jr(t){const e=Us(t);return e===null?null:e.major>0?String(e.major):e.minor===null?"0":`0.${e.minor}`}function PP(t,e=yd(),n=Sd){const r=[],i=Us(t.sdkVersion),s=Us(n),o=jr(t.sdkVersion),a=jr(n);i!==null&&s!==null&&o!==null&&a!==null&&(o!==a?r.push({kind:"sdk-major",name:"@mndw/sdk",pluginVersion:t.sdkVersion,hostVersion:n}):i.major>0&&i.minor!==null&&s.minor!==null&&i.minor>s.minor&&r.push({kind:"sdk-newer-minor",name:"@mndw/sdk",pluginVersion:t.sdkVersion,hostVersion:n}));for(const[l,c]of Object.entries(t.sharedDependencies)){const u=e[l];if(u===void 0)continue;const d=Us(c),h=Us(u),p=jr(c),g=jr(u);d!==null&&h!==null&&p!==null&&g!==null&&p!==g&&r.push({kind:"shared-major",name:l,pluginVersion:c,hostVersion:u})}return r}function RP(t,e=yd(),n=Sd){const r=[];for(const[o,a]of Object.entries(t.sharedDependencies)){const l=e[o];if(l===void 0)continue;const c=jr(a),u=jr(l);c===null||u===null||c!==u&&r.push(`${o} @${c} (host provides @${u})`)}const i=jr(t.sdkVersion),s=jr(n);return i!==null&&s!==null&&i!==s&&r.push(`@mndw/sdk @${i} (host provides @${s})`),r}function AP(t,e,n=yd(),r=Sd){const i=RP(e,n,r);return i.length>0&&console.warn(`[mndw] plugin "${t}" was built against ${i.join(", ")}; it may misbehave with the versions this host provides`),i}class MP{constructor(e={catalog:Do}){G(this,"plugins",new Map);G(this,"catalog");this.catalog=e.catalog}register(e){if(this.plugins.has(e.entry.name))throw new Error(`Duplicate plugin name "${e.entry.name}"`);this.plugins.set(e.entry.name,e),e.catalog!==void 0&&this.catalog.registerPluginCatalogCell(e.catalog)}replace(e){const n=this.plugins.get(e.entry.name);if(n===void 0)throw new Error(`Cannot replace unknown plugin "${e.entry.name}"`);if(n.entry.type!==e.entry.type)throw new Error(`Cannot change plugin "${e.entry.name}" type from ${n.entry.type} to ${e.entry.type}`);if(n.entry.type==="page"&&e.entry.type==="page"&&n.entry.route!==e.entry.route)throw new Error(`Cannot change page "${e.entry.name}" route from ${n.entry.route} to ${e.entry.route}`);return this.plugins.set(e.entry.name,e),n.catalog!==void 0&&this.catalog.unregisterPluginCatalogCell(n.catalog),e.catalog!==void 0&&this.catalog.registerPluginCatalogCell(e.catalog),n}get(e){return this.plugins.get(e)}getWidgets(){return[...this.plugins.values()].filter(e=>e.entry.type==="widget")}getPages(){return[...this.plugins.values()].filter(e=>e.entry.type==="page")}getAll(){return[...this.plugins.values()]}clear(){for(const e of this.plugins.values())e.catalog!==void 0&&this.catalog.unregisterPluginCatalogCell(e.catalog);this.plugins.clear(),this.catalog.clearPluginCatalogCells()}}const bs=new MP,io=it({});function OP(){for(const t of Object.keys(io))delete io[t]}function NP(t,e){if(e.length===0){delete io[t];return}io[t]=[...e]}function zP(t){return io[t]??[]}const IP=15e3,Pc=new Set;function LP(t,e,n){return`${t}/${e}?v=${encodeURIComponent(n)}`}async function DP(t,e){Pc.has(t)||await new Promise(n=>{if(document.querySelector(`link[data-plugin-style="${e}"][href="${t}"]`)){Pc.add(t),n();return}const i=document.createElement("link");i.rel="stylesheet",i.href=t,i.dataset.pluginStyle=e,i.onload=()=>{Pc.add(t),n()},i.onerror=()=>{console.warn(`[mndw] No stylesheet for plugin "${e}" at ${t}`),n()},document.head.appendChild(i)})}function HP(t,e){const n=t;if(typeof n.createInstance!="function")throw new Error(`Plugin "${e}" does not export { createInstance }`);return n}async function BP(){const t=await fetch(Km);if(!t.ok)throw new Error(`HTTP ${t.status}`);return kv(await t.json())}async function $P(t,e){const n=await CP(e);return n?AP(t.name,n):[]}function UP(t){const e=new Set,n=new Set;return t.filter(r=>{if(e.has(r.name))return console.error(`[mndw] Skipping duplicate plugin "${r.name}"`),!1;if(e.add(r.name),r.type==="page"){if(n.has(r.route))return console.error(`[mndw] Skipping duplicate page route "${r.route}"`),!1;n.add(r.route)}return!0})}async function jP(t,e,n){const i=`${t.source==="builtin"?yh.builtin:yh.user}${t.name}`,s=o=>LP(i,o,t.version);await e.loadStylesheet(s("index.css"),t.name);try{const o=await e.importModule(s(t.entry)),a=HP(o,t.name),l=rv(t.name,t.version,t.catalogBaseUrl??i,t.i18n),c=l===void 0?void 0:e.catalogService.createPluginCatalogCell(l,e.getLocale());if(c!==void 0&&await e.catalogService.loadInitialPluginCatalog(c,e.getLocale()),n.aborted)return;e.registry.register({entry:t,module:a,...c===void 0?{}:{catalog:c}}),console.log(`[mndw] Loaded plugin: ${t.name} (${t.source})`),Promise.resolve().then(()=>e.checkVersions(t,i)).then(u=>{NP(t.name,u)}).catch(u=>{console.error(`[mndw] Version check failed for "${t.name}":`,u)})}catch(o){console.error(`[mndw] Failed to load plugin "${t.name}":`,o)}}async function FP(t,e){const n=new AbortController,r=new Promise(s=>{n.signal.addEventListener("abort",()=>{console.error(`[mndw] Plugin "${t.name}" did not load within ${e.loadTimeoutMs} ms; skipping it`),s()},{once:!0})}),i=setTimeout(()=>n.abort(),e.loadTimeoutMs);try{await Promise.race([jP(t,e,n.signal),r])}finally{clearTimeout(i)}}async function GP(t={}){const e=t.fetchList??BP,n={importModule:t.importModule??(s=>import(s)),loadStylesheet:t.loadStylesheet??DP,checkVersions:t.checkVersions??$P,catalogService:t.catalogService??Do,registry:t.registry??bs,getLocale:t.getLocale??os,loadTimeoutMs:t.loadTimeoutMs??IP};n.registry.clear(),Ph([]),me.pluginLoadError=null,OP();let r;try{r=await e()}catch(s){console.error("[mndw] Failed to load plugin list:",s),me.pluginLoadError="Failed to load plugins. Check the console for details.";return}Ph(r);const i=UP(r.filter(s=>s.enabled&&s.approval==="approved"));await Promise.all(i.map(s=>FP(s,n)))}const VP=Ue({id:de(),label:de(),index:Vt().finite().int().nonnegative(),type:de(),group:de(),color:de(),interfaceId:de()}),ZP=Ue({list:vt(VP),layout:vt(vt(de())),hasPortStats:xr()}),WP=Ue({switchports:ZP,usbPortCount:Vt().finite().int().nonnegative()});function ku(){return{list:[],layout:[],hasPortStats:!1}}function qP(t){return WP.parse(t)}const Xt=Object.freeze({"X-Mndw-Csrf":"1"}),sn=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),_r=t=>typeof t=="string"&&t.length>0,Ml=async t=>{try{return await t.json()}catch{return}};function Ol(t,e){const n=sn(t)?t:void 0,r=n==null?void 0:n.error,i=sn(r)?r:void 0,s=i==null?void 0:i.code,o=i==null?void 0:i.message;return{code:_r(s)?s:"UNKNOWN",message:_r(o)?o:e,detail:i==null?void 0:i.detail}}class Fi extends Error{constructor(n,r,i){super(n);G(this,"code");G(this,"detail");this.name="MgmtError",this.code=r,this.detail=i}}function XP(t){switch(t){case"read":return Jm;case"mutation":return tT;case"install":return nT}}async function zr(t){const e=Ol(await Ml(t),t.statusText);return new Fi(e.message,e.code,e.detail)}function YP(t){return t instanceof DOMException&&t.name==="TimeoutError"||t instanceof TypeError?"ambiguous":t instanceof Fi&&t.code==="BACKEND_MAINTENANCE"?"rejected-maintenance":"error"}function JP(t=globalThis.fetch,e=n=>AbortSignal.timeout(XP(n))){function n(o){return e(o)}async function r(o){if(o.status!==204)throw o.ok?new Fi("The device returned an unexpected response.","UNKNOWN"):await zr(o)}async function i(o,a,l){const c=await t(o,{method:"POST",headers:{"Content-Type":"application/json",...Xt},body:JSON.stringify({name:a}),signal:n(l)});if(!c.ok)throw await zr(c);return c}async function s(o,a){const l=await i(o,a,o===_h?"install":"mutation");return Tc(await l.json())}return{async listPlugins(){const o=await t(Km,{method:"GET",signal:n("read")});if(!o.ok)throw await zr(o);return kv(await o.json())},async uploadPlugin(o){const a=await t(iT,{method:"POST",headers:{"Content-Type":"application/zip",...Xt},body:o});if(a.status===201||a.status===202){const l=Tc(await a.json());return{status:a.status===201?"installed":"pending",entry:l}}throw await zr(a)},approvePlugin:o=>s(_h,o),enablePlugin:o=>s(oT,o),disablePlugin:o=>s(aT,o),async setPluginPermission(o,a,l){const c=await t(rT,{method:"POST",headers:{"Content-Type":"application/json",...Xt},body:JSON.stringify({name:o,permission:a,enabled:l}),signal:n("mutation")});if(!c.ok)throw await zr(c);return Tc(await c.json())},async denyPlugin(o){await i(sT,o,"mutation")},async deletePlugin(o){await i(lT,o,"mutation")},async restartPlugin(o){await i(cT,o,"mutation")},async getRuntime(){const o=await t(uT,{method:"GET",signal:n("read")});if(!o.ok)throw await zr(o);return await o.json()},async getDeviceHardware(){try{const o=await t(dT,{method:"GET",signal:n("read")});return o.ok?qP(await o.json()):{switchports:ku(),usbPortCount:0}}catch{return{switchports:ku(),usbPortCount:0}}},async getPalette(){const o=await t(kc,{method:"GET",cache:"no-store",signal:n("read")});if(!o.ok)throw await zr(o);const a=await o.json().catch(()=>null);if(a===null||typeof a!="object"||Array.isArray(a)||!Object.prototype.hasOwnProperty.call(a,"palette"))throw new Fi("The device returned an unexpected palette response.","UNKNOWN");return a.palette??null},async putPalette(o){const a=await t(kc,{method:"PUT",headers:{"Content-Type":"application/json",...Xt},body:JSON.stringify(o),signal:n("mutation")});await r(a)},async deletePalette(){const o=await t(kc,{method:"DELETE",headers:{...Xt},signal:n("mutation")});await r(o)},async getTelemetry(){const o=await t(wh,{method:"GET",signal:n("read")});if(!o.ok)throw await zr(o);const a=await o.json();if(a===null||typeof a!="object"||typeof a.enabled!="boolean")throw new Fi("The device returned an unexpected telemetry response.","UNKNOWN");return{enabled:a.enabled}},async setTelemetry(o){const a=await t(wh,{method:"PUT",headers:{"Content-Type":"application/json",...Xt},body:JSON.stringify({enabled:o}),signal:n("mutation")});await r(a)}}}const xd=JP(),Mh={INVALID_ZIP:"errors.invalid-zip",MANIFEST_MISSING:"errors.manifest-missing",UNSUPPORTED_MANIFEST_VERSION:"errors.unsupported-manifest-version",CONFLICT:"errors.conflict",UPLOAD_TOO_LARGE:"errors.upload-too-large",OPKG_FAILED:"errors.opkg-failed",DAEMON_FAILED:"errors.daemon-failed",UNAUTHORIZED:"errors.unauthorized",SERVICE_CAPACITY_EXCEEDED:"errors.service-capacity",BACKEND_BUSY:"errors.backend-busy",BACKEND_UNAVAILABLE:"errors.backend-unavailable",BACKEND_INCOMPATIBLE:"errors.backend-incompatible",BACKEND_MAINTENANCE:"errors.backend-maintenance",CONTROLLER_SESSION_UNAVAILABLE:"errors.controller-session-unavailable",RCI_SOCKET_START_FAILED:"errors.rci-socket-start-failed"};function sr(t){return t instanceof DOMException&&t.name==="TimeoutError"?Rn("errors.device-timeout"):t instanceof Fi?t.code==="MANIFEST_INVALID"?_r(t.detail)?`${Rn("errors.invalid-manifest")}: ${t.detail}`:Rn("errors.invalid-manifest"):(Mh[t.code]===void 0?t.message:Rn(Mh[t.code]))||Rn("app.error"):t instanceof Error?t.message:Rn("app.error")}const Eu="mndw-palette-override",KP=":root:root";function QP(t){const e=t.getElementById(Eu);if(e instanceof HTMLStyleElement)return e;const n=t.createElement("style");return n.id=Eu,t.head.appendChild(n),n}function Rs(t,e){var n;if(e===null){(n=t.getElementById(Eu))==null||n.remove();return}QP(t).textContent=mS(e,{selector:KP})}function Mi(t){return Object.freeze({dark:{...t.dark},light:{...t.light}})}function eR(t,e){return JSON.stringify(t)!==JSON.stringify(e)}function tR(t){const e=t.document??globalThis.document;let n=null;const r=new Set,i=()=>Mi(n??SP),s=()=>{const a=i();for(const l of r)l(Mi(a))},o=async a=>{const l=await t.mgmtClient.getPalette();let c=null;if(l!==null){const d=Vm(l);if(d.palette===null)throw new Error("The device returned an invalid palette.");c=d.palette}const u=eR(n,c);n=c,Rs(e,c),a&&u&&s()};return{getApplied:()=>n===null?null:Mi(n),getExportable:i,getTokens:i,refreshPalette:async()=>{await o(!0)},initPalette:async()=>{try{await o(!1)}catch(a){console.warn("[mndw] Could not load the device palette; using defaults.",a)}},previewOverride:a=>{const l=Mi(a);Rs(e,l);for(const c of r)c(Mi(l))},discardPreview:()=>{Rs(e,n),s()},commitOverride:async a=>{await t.mgmtClient.putPalette(a),n=Mi(a),Rs(e,n),s()},resetToDefault:async()=>{await t.mgmtClient.deletePalette(),n=null,Rs(e,null),s()},subscribePalette:a=>(r.add(a),()=>{r.delete(a)})}}const Td=tR({mgmtClient:xd}),Oh=()=>Td.getTokens(),nR=t=>Td.subscribePalette(t),rR=["transient","unauthorized","validation","redemption-failed","controller-unavailable","malformed-response"],iR=globalThis.fetch.bind(globalThis);async function js(t,e={},n=2e4){const r=new AbortController,i=globalThis.setTimeout(()=>r.abort(),n);try{return await iR(t,{...e,signal:r.signal})}finally{globalThis.clearTimeout(i)}}class Qn extends Error{constructor(n,r){super(n);G(this,"code");G(this,"status");this.name="PersistentRciSessionError",this.code=n,this.status=r}}const ta="/api/mndw/rci-session",sR=["offline","establishing","live","dead"],oR=["certificate-invalid","no-auth-token","missing-fqdn"],aR=["token","none","unknown"],lR=["supported","invalid","unsupported","unknown","needs-token"],cR=["ok","empty","disabled","decrypt-failed"];class uR{async getCapability(){const e=await this.read(await js(`${ta}/capability`,{headers:{...Xt}}));return this.parseCapability(e)}async testController(e){return await this.read(await this.post("/controller/test",{token:e}))}async saveController(e){return await this.read(await this.post("/controller",{token:e}))}async clearController(){await this.read(await js(`${ta}/controller`,{method:"DELETE",headers:{...Xt}}))}async setEnabled(e){await this.read(await js(`${ta}/enabled`,{method:"PUT",headers:{"Content-Type":"application/json",...Xt},body:JSON.stringify({enabled:e})}))}async post(e,n){return await js(`${ta}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Xt},body:JSON.stringify(n)})}async read(e){const n=await e.text();let r;try{r=n===""?void 0:JSON.parse(n)}catch{throw new Qn("MALFORMED_RESPONSE",e.status)}if(!e.ok){const i=this.errorCode(r)??`HTTP_${e.status}`;throw new Qn(i,e.status)}return r}parseCapability(e){if(!this.isRecord(e)||!this.isRecord(e.store)||!this.isRecord(e.controller)||!Array.isArray(e.extenders)||typeof e.stale!="boolean"||!this.isStoreState(e.store.state)||!this.isSupport(e.controller.support)||!this.isAuthMode(e.controller.auth)||typeof e.controller.enabled!="boolean")throw new Qn("MALFORMED_RESPONSE",200);const n={support:e.controller.support,auth:e.controller.auth,enabled:e.controller.enabled};if(e.controller.lastCheckedAt!==void 0){if(typeof e.controller.lastCheckedAt!="string")throw new Qn("MALFORMED_RESPONSE",200);n.lastCheckedAt=e.controller.lastCheckedAt}const r=e.extenders.map(s=>this.parseExtender(s)),i={store:{state:e.store.state},controller:n,extenders:r,stale:e.stale};if(e.lastEnumerationError!==void 0){if(!this.isFailureCategory(e.lastEnumerationError))throw new Qn("MALFORMED_RESPONSE",200);i.lastEnumerationError=e.lastEnumerationError}if(e.lastEnumerationErrorAt!==void 0){if(typeof e.lastEnumerationErrorAt!="string")throw new Qn("MALFORMED_RESPONSE",200);i.lastEnumerationErrorAt=e.lastEnumerationErrorAt}return i}parseExtender(e){if(!this.isRecord(e)||typeof e.identity!="string"||typeof e.name!="string"||typeof e.eligible!="boolean")throw new Qn("MALFORMED_RESPONSE",200);if(!e.eligible){if(!this.isEligibilityReason(e.reason)||e.state!==void 0||e.lastError!==void 0||e.lastHeartbeatAt!==void 0)throw new Qn("MALFORMED_RESPONSE",200);return{identity:e.identity,name:e.name,eligible:!1,reason:e.reason}}if(e.reason!==void 0||e.state!==void 0&&!this.isSessionState(e.state)||e.lastError!==void 0&&!this.isFailureCategory(e.lastError)||e.lastHeartbeatAt!==void 0&&typeof e.lastHeartbeatAt!="string")throw new Qn("MALFORMED_RESPONSE",200);const n={identity:e.identity,name:e.name,eligible:!0};return e.state!==void 0&&(n.state=e.state),e.lastError!==void 0&&(n.lastError=e.lastError),e.lastHeartbeatAt!==void 0&&(n.lastHeartbeatAt=e.lastHeartbeatAt),n}errorCode(e){if(this.isRecord(e)&&this.isRecord(e.error)&&typeof e.error.code=="string")return e.error.code}isRecord(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}isStoreState(e){return typeof e=="string"&&cR.includes(e)}isSupport(e){return typeof e=="string"&&lR.includes(e)}isAuthMode(e){return typeof e=="string"&&aR.includes(e)}isSessionState(e){return typeof e=="string"&&sR.includes(e)}isEligibilityReason(e){return typeof e=="string"&&oR.includes(e)}isFailureCategory(e){return typeof e=="string"&&rR.includes(e)}}function dR(){return new uR}const fR=dR(),hR=3e4,pR={path:"show.system"};class gR{constructor(){G(this,"transport");G(this,"heartbeatSubscription",null);G(this,"driver");G(this,"auth");const e=window.location.origin;this.transport=new gb,this.auth=new mb(e,this.transport),this.driver=new vb(e,this.transport)}login(e,n){return this.auth.login(e,n).pipe(Dl(r=>{r?this.startHeartbeat():this.stopHeartbeat()}))}logout(){return this.stopHeartbeat(),this.auth.logout()}isAuthenticated(){return this.auth.isAuthenticated().pipe(Dl(e=>{e?this.startHeartbeat():this.stopHeartbeat()}))}get authError$(){return this.transport.authError$.pipe(Dl(()=>this.stopHeartbeat()))}startHeartbeat(){this.heartbeatSubscription===null&&(this.heartbeatSubscription=ab(0,hR).pipe(lb(()=>this.heartbeatRequest())).subscribe())}stopHeartbeat(){var e;(e=this.heartbeatSubscription)==null||e.unsubscribe(),this.heartbeatSubscription=null}heartbeatRequest(){return this.driver.queue(pR).pipe(cb(()=>ub))}}const Cd=new gR,{service:mR}=Ed("@mndw/ui","@mndw/ui"),vR=mR;function bR(t=globalThis.fetch){return N2(t)}const _R=bR(),wR=500,yR=5e3,Nh=.2,kR=100,ER=1024,SR=2048,xR=t=>(typeof t=="string"?[t]:[...t]).flatMap(n=>n.split(",")).filter(n=>n.length>0),TR=(t,e)=>t==="*"||e===t||e.startsWith(`${t}.`),CR=(t,e)=>{if(t==="*"||t===e||t.startsWith(`${e}.`))return t;if(e==="*"||e.startsWith(`${t}.`))return e},PR=(t,e)=>{const n=new Set;for(const r of t)for(const i of e){const s=CR(r,i);s!==void 0&&n.add(s)}return[...n]},RR=t=>{const e=new Set;for(const n of t){if(!n.startsWith("events:"))continue;const r=n.slice(7);for(const i of r.split(","))(i==="*"||/^[a-z][a-z0-9]*(?:\.[a-z][a-z0-9]*)*$/.test(i))&&e.add(i)}return[...e]},AR=t=>t!==null&&typeof t=="object"&&!Array.isArray(t)?t:void 0;class MR{constructor(e={}){G(this,"socketFactory");G(this,"schedule");G(this,"cancelSchedule");G(this,"random");G(this,"diagnostic");G(this,"registrations",new Map);G(this,"deliveredIds",new Set);G(this,"deliveredOrder",[]);G(this,"liveBuffer",[]);G(this,"socket");G(this,"reconnectTimer");G(this,"reconnectAttempt",0);G(this,"nextHandlerId",1);G(this,"lastSeenId","");G(this,"replayCursor","");G(this,"catchingUp",!1);G(this,"replaying",!1);G(this,"closing",!1);this.socketFactory=e.WebSocket??(typeof WebSocket>"u"?void 0:WebSocket),this.schedule=e.setTimeout??globalThis.setTimeout,this.cancelSchedule=e.clearTimeout??globalThis.clearTimeout,this.random=e.random??Math.random,this.diagnostic=e.diagnostic??((n,r)=>console.warn(`[mndw] ${n}`,r))}createFacade(e,n,r,i){const s=RR(r);if(s.length!==0)return this.disposeFacade(e),this.registrations.set(e,{id:e,pluginName:n,grants:s,subscriptions:new Map,resyncHandlers:new Map}),{select$:o=>new _a(a=>{const l=this.registrations.get(e);if(l===void 0){a.complete();return}const c=PR(xR(o),l.grants);if(c.length===0){a.complete();return}const u=this.nextHandlerId++;return l.subscriptions.set(u,{filters:c,handler:d=>a.next(d)}),this.updateWireSubscription(),()=>{l.subscriptions.delete(u)&&this.updateWireSubscription()}}).pipe(Fd(i.ended$)),resync$:new _a(o=>{const a=this.registrations.get(e);if(a===void 0){o.complete();return}const l=this.nextHandlerId++;return a.resyncHandlers.set(l,()=>o.next()),()=>{a.resyncHandlers.delete(l)}}).pipe(Fd(i.ended$))}}disposeFacade(e){this.registrations.delete(e)&&(this.updateWireSubscription(),this.registrations.size===0&&this.closeSocket())}effectiveWireFilters(){const e=new Set;for(const n of this.registrations.values())for(const r of n.subscriptions.values())for(const i of r.filters)e.add(i);return[...e].sort()}ensureSocket(){if(this.socket!==void 0||this.reconnectTimer!==void 0||this.closing||this.effectiveWireFilters().length===0)return;if(this.socketFactory===void 0){this.diagnostic("event stream WebSocket is unavailable");return}const e=new this.socketFactory("/ws/events");this.socket=e,e.addEventListener("open",()=>this.handleOpen(e)),e.addEventListener("message",n=>this.handleMessage(e,n.data)),e.addEventListener("close",()=>this.handleClose(e)),e.addEventListener("error",n=>this.diagnostic("event stream socket error",n))}handleOpen(e){this.socket===e&&(this.reconnectAttempt=0,this.sendSubscribe(),this.catchingUp=!0,this.replaying=!1,this.replayCursor=this.lastSeenId,this.requestReplay(this.lastSeenId))}handleClose(e){this.socket===e&&(this.socket=void 0,this.registrations.size>0&&!this.closing&&this.scheduleReconnect())}handleMessage(e,n){if(this.socket!==e||typeof n!="string")return;let r;try{r=JSON.parse(n)}catch(s){this.diagnostic("event stream returned invalid JSON",s);return}const i=AR(r);(i==null?void 0:i.type)==="event"?this.handleIncomingEvent(i.event):(i==null?void 0:i.type)==="replay"?this.handleReplay(i):(i==null?void 0:i.type)==="error"&&this.handleServerError(i)}handleIncomingEvent(e){const n=Lf.safeParse(e);if(!n.success){this.diagnostic("event stream returned invalid event",n.error);return}if(this.catchingUp){if(this.liveBuffer.length>=ER){this.liveBuffer.length=0,this.closeActiveSocket();return}this.liveBuffer.push(n.data);return}this.deliver(n.data)}handleReplay(e){if(!this.catchingUp||!Array.isArray(e.events)||typeof e.hasMore!="boolean")return;const n=e.events.map(i=>Lf.safeParse(i)).filter(i=>i.success);for(const i of n)i.success&&(this.replayCursor=i.data.id,this.deliver(i.data));if(this.replaying=!1,e.hasMore&&this.replayCursor!==""){this.requestReplay(this.replayCursor);return}this.catchingUp=!1,this.replaying=!1;const r=this.liveBuffer.splice(0);for(const i of r)this.deliver(i);for(const i of this.registrations.values())for(const s of i.resyncHandlers.values())try{s()}catch(o){this.diagnostic(`event resync handler failed for ${i.pluginName}`,o)}}handleServerError(e){if(e.code==="CURSOR_EXPIRED"){this.catchingUp=!1,this.replaying=!1;const r=this.liveBuffer.splice(0);for(const i of r)this.deliver(i);this.diagnostic("event stream replay cursor expired");for(const i of this.registrations.values())for(const s of i.resyncHandlers.values())try{s()}catch(o){this.diagnostic(`event resync handler failed for ${i.pluginName}`,o)}return}const n=typeof e.message=="string"?e.message:typeof e.code=="string"?e.code:"unknown";this.diagnostic(`event stream server error: ${n}`)}deliver(e){if(this.lastSeenId=e.id,!this.deliveredIds.has(e.id)){for(this.deliveredIds.add(e.id),this.deliveredOrder.push(e.id);this.deliveredOrder.length>SR;){const n=this.deliveredOrder.shift();n!==void 0&&this.deliveredIds.delete(n)}for(const n of this.registrations.values())for(const r of n.subscriptions.values())if(r.filters.some(i=>TR(i,e.topic)))try{r.handler(e)}catch(i){this.diagnostic(`event handler failed for ${n.pluginName}`,i)}}}sendSubscribe(){this.send({type:"subscribe",topics:this.effectiveWireFilters()})}updateWireSubscription(){const e=this.effectiveWireFilters();if(e.length===0){this.closeSocket();return}const n=this.socket;(n==null?void 0:n.readyState)===1&&!this.catchingUp&&this.send({type:"subscribe",topics:e}),this.ensureSocket()}requestReplay(e){this.replaying||(this.replaying=!0,this.send({type:"replay",after:e,limit:kR}))}send(e){const n=this.socket;(n==null?void 0:n.readyState)===1&&n.send(JSON.stringify(e))}scheduleReconnect(){if(this.reconnectTimer!==void 0||this.effectiveWireFilters().length===0)return;const e=Math.min(yR,wR*2**this.reconnectAttempt++),n=1-Nh+this.random()*2*Nh;this.reconnectTimer=this.schedule(()=>{this.reconnectTimer=void 0,this.ensureSocket()},Math.round(e*n))}closeActiveSocket(){const e=this.socket;e!==void 0&&(this.catchingUp=!1,this.replaying=!1,e.close(1008,"event stream catch-up overflow"))}closeSocket(){this.reconnectTimer!==void 0&&(this.cancelSchedule(this.reconnectTimer),this.reconnectTimer=void 0),this.catchingUp=!1,this.replaying=!1,this.liveBuffer.length=0;const e=this.socket;this.socket=void 0,e!==void 0&&e.close(1e3,"no event subscribers")}}function OR(t={}){return new MR(t)}const NR=Object.freeze({mgmtClient:xd,palette:Td,catalog:Do,locale:nC,registry:bs,persistentRci:fR,rci:Cd,telemetry:_R,eventStream:OR(),overlay:vR});function so(){return NR}const Su="mndw:sandbox-reloaded";function zR(t){const e=t;if(typeof e.createInstance!="function")throw new Error("Sandbox plugin does not export { createInstance }");return e}function IR(t){const e={};if(t===void 0)return{routes:e};for(const n of t.routes)e[n.id]=n.transport==="http"?{transport:"http",method:n.method,path:n.path}:{transport:"websocket",path:n.path,...n.protocols===void 0?{}:{protocols:n.protocols}};return{routes:e}}function LR(t,e){const n={name:t.name,version:t.version,label:t.label,entry:t.entry,...t.icon!==void 0?{icon:t.icon}:{},...t.i18n===void 0?{}:{i18n:t.i18n},...e===void 0?{}:{catalogBaseUrl:e},source:"builtin",approval:"approved",enabled:!0,depsStatus:"ready",backend:IR(t.backend)};return t.type==="widget"?{...n,type:"widget",size:t.size,...t.fixedHeight===!0?{fixedHeight:!0}:{}}:{...n,type:"page",route:t.route}}async function Sv(t){if(t.importPluginModule===void 0||t.importManifestModule===void 0)throw new Error("Sandbox imports were not provided");const e=zR(await t.importPluginModule()),n=await t.importManifestModule();if(n.default===void 0||n.default===null)throw new Error("Sandbox manifest module has no default export");const r=LC(n.default),i=t.catalogBaseUrl??n.__catalogBaseUrl,s=LR(r,i),o=t.catalogService??Do,a=t.getLocale??os,l=rv(s.name,s.version,i??`/plugins/${s.name}`,s.i18n),c=l===void 0?void 0:o.createPluginCatalogCell(l,a());return c!==void 0&&await o.loadInitialPluginCatalog(c,a()),{entry:s,module:e,...c===void 0?{}:{catalog:c}}}async function DR(t={}){const e=t.registry??bs;try{const n=await Sv(t);e.register(n),console.log(`[mndw] Sandbox plugin loaded: ${n.entry.name}`)}catch(n){console.error("[mndw] Failed to load sandbox plugin:",n)}}async function HR(t={}){const e=t.registry??bs,n=t.remountWidgets??BR,r=t.reloadPage??$R,i=t.pluginContextServices??(()=>{const c=so();return{locale:c.locale,palette:c.palette,telemetry:c.telemetry,eventStream:c.eventStream}})();let s;try{s=await Sv(t)}catch(c){return console.error("[mndw] Sandbox reload rejected (invalid update kept previous plugin):",c),"failed"}const o=s.entry.name,a=e.get(o);if(a===void 0)return e.register(s),"reloaded";let l;try{l=e.replace(s)}catch(c){return console.error(`[mndw] Sandbox reload needs a restart of \`mndw dev\`: ${c.message}`),"restart-required"}try{const c=await n(o,s,a,e,i),u=await r(o,s,a);if(!c||!u)throw new Error("a widget or page remount reported failure");return console.log(`[mndw] Sandbox plugin reloaded: ${o}`),"reloaded"}catch(c){return e.replace(l),console.error(`[mndw] Sandbox reload failed, kept previous plugin "${o}":`,c),"failed"}}async function BR(t,e,n,r,i){const{remountWidgetTiles:s}=await Pa(async()=>{const{remountWidgetTiles:o}=await Promise.resolve().then(()=>xA);return{remountWidgetTiles:o}},[]);return s(i,r,t,e,n)}async function $R(t,e,n){const r=[],i={pluginName:t,next:e,prior:n,register:o=>r.push(o)};return window.dispatchEvent(new CustomEvent(Su,{detail:i})),(await Promise.all(r)).every(Boolean)}const xv={importPluginModule:()=>Pa(()=>import("./_virtual_sandbox-plugin-Cg-1CvkF.js"),[]),importManifestModule:()=>Pa(()=>import("./_virtual_sandbox-manifest-DbTeSIus.js"),[])};function na(){return{received:!1,value:void 0}}function UR(t,e){let n=na(),r=na(),i=!1,s=Promise.resolve();const o=()=>{i||(i=!0,queueMicrotask(()=>{i=!1;const a=n,l=r;n=na(),r=na();const c={importPluginModule:a.received?()=>Promise.resolve(a.value):e.importPluginModule,importManifestModule:l.received?()=>Promise.resolve(l.value):e.importManifestModule};s=s.then(()=>HR({...c,registry:t.registry,catalogService:t.catalog,getLocale:()=>t.locale.getLocale(),pluginContextServices:{locale:t.locale,palette:t.palette,telemetry:t.telemetry,eventStream:t.eventStream}})).then(()=>{}).catch(u=>{console.error("[mndw] Sandbox HMR transaction failed:",u)})}))};return{plugin:a=>{n={received:!0,value:a},o()},manifest:a=>{r={received:!0,value:a},o()}}}function jR(t,e=void 0,n=xv){if(e===void 0)return;const r=UR(t,n);e.accept("virtual:sandbox-plugin",i=>{r.plugin(i)}),e.accept("virtual:sandbox-manifest",i=>{r.manifest(i)})}class D{static getElements(e,n=document){if(typeof e=="string"){const r="getElementById"in n?n:void 0;if(r&&!isNaN(+e[0])){const s=r.getElementById(e);return s?[s]:[]}let i=n.querySelectorAll(e);if(!i.length&&e[0]!=="."&&e[0]!=="#"&&(i=n.querySelectorAll("."+e),i.length||(i=n.querySelectorAll("#"+e)),!i.length)){const s=n.querySelector(`[gs-id="${e}"]`);return s?[s]:[]}return Array.from(i)}return[e]}static getElement(e,n=document){if(typeof e=="string"){const r="getElementById"in n?n:void 0;if(!e.length)return null;if(r&&e[0]==="#")return r.getElementById(e.substring(1));if(e[0]==="#"||e[0]==="."||e[0]==="[")return n.querySelector(e);if(r&&!isNaN(+e[0]))return r.getElementById(e);let i=n.querySelector(e);return r&&!i&&(i=r.getElementById(e)),i||(i=n.querySelector("."+e)),i}return e}static lazyLoad(e){var n,r;return e.lazyLoad||((r=(n=e.grid)==null?void 0:n.opts)==null?void 0:r.lazyLoad)&&e.lazyLoad!==!1}static createDiv(e,n){const r=document.createElement("div");return e.forEach(i=>{i&&r.classList.add(i)}),n==null||n.appendChild(r),r}static shouldSizeToContent(e,n=!1){return(e==null?void 0:e.grid)&&(n?e.sizeToContent===!0||e.grid.opts.sizeToContent===!0&&e.sizeToContent===void 0:!!e.sizeToContent||e.grid.opts.sizeToContent&&e.sizeToContent!==!1)}static isIntercepted(e,n){return!(e.y>=n.y+n.h||e.y+e.h<=n.y||e.x+e.w<=n.x||e.x>=n.x+n.w)}static isTouching(e,n){return D.isIntercepted(e,{x:n.x-.5,y:n.y-.5,w:n.w+1,h:n.h+1})}static areaIntercept(e,n){const r=e.x>n.x?e.x:n.x,i=e.x+e.w<n.x+n.w?e.x+e.w:n.x+n.w;if(i<=r)return 0;const s=e.y>n.y?e.y:n.y,o=e.y+e.h<n.y+n.h?e.y+e.h:n.y+n.h;return o<=s?0:(i-r)*(o-s)}static area(e){return e.w*e.h}static sort(e,n=1){return e.sort((i,s)=>{const o=n*((i.y??1e4)-(s.y??1e4));return o===0?n*((i.x??1e4)-(s.x??1e4)):o})}static find(e,n){return n?e.find(r=>r.id===n):void 0}static toBool(e){return typeof e=="boolean"?e:typeof e=="string"?(e=e.toLowerCase(),!(e===""||e==="no"||e==="false"||e==="0")):!!e}static toNumber(e){return e===null||e.length===0?void 0:Number(e)}static parseHeight(e){let n,r="px";if(typeof e=="string")if(e==="auto"||e==="")n=0;else{const i=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!i)throw new Error(`Invalid height val = ${e}`);r=i[2]||"px",n=parseFloat(i[1])}else n=e;return{h:n,unit:r}}static defaults(e,...n){return n.forEach(r=>{for(const i in r){if(!r.hasOwnProperty(i))return;e[i]===null||e[i]===void 0?e[i]=r[i]:typeof r[i]=="object"&&typeof e[i]=="object"&&D.defaults(e[i],r[i])}}),e}static same(e,n){if(typeof e!="object")return e==n;if(typeof e!=typeof n||Object.keys(e).length!==Object.keys(n).length)return!1;for(const r in e)if(e[r]!==n[r])return!1;return!0}static copyPos(e,n,r=!1){return n.x!==void 0&&(e.x=n.x),n.y!==void 0&&(e.y=n.y),n.w!==void 0&&(e.w=n.w),n.h!==void 0&&(e.h=n.h),r&&(n.minW&&(e.minW=n.minW),n.minH&&(e.minH=n.minH),n.maxW&&(e.maxW=n.maxW),n.maxH&&(e.maxH=n.maxH)),e}static samePos(e,n){return e&&n&&e.x===n.x&&e.y===n.y&&(e.w||1)===(n.w||1)&&(e.h||1)===(n.h||1)}static sanitizeMinMax(e){e.minW||delete e.minW,e.minH||delete e.minH,e.maxW||delete e.maxW,e.maxH||delete e.maxH}static removeInternalAndSame(e,n){if(!(typeof e!="object"||typeof n!="object")&&!(Array.isArray(e)||Array.isArray(n)))for(let r in e){const i=e[r],s=n[r];r[0]==="_"||i===s?delete e[r]:i&&typeof i=="object"&&s!==void 0&&(D.removeInternalAndSame(i,s),Object.keys(i).length||delete e[r])}}static removeInternalForSave(e,n=!0){for(let r in e)(r[0]==="_"||e[r]===null||e[r]===void 0)&&delete e[r];delete e.grid,n&&delete e.el,e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,e.locked||delete e.locked,(e.w===1||e.w===e.minW)&&delete e.w,(e.h===1||e.h===e.minH)&&delete e.h}static throttle(e,n){let r=!1;return(...i)=>{r||(r=!0,setTimeout(()=>{e(...i),r=!1},n))}}static removePositioningStyles(e){const n=e.style;n.position&&n.removeProperty("position"),n.left&&n.removeProperty("left"),n.top&&n.removeProperty("top"),n.width&&n.removeProperty("width"),n.height&&n.removeProperty("height")}static getScrollElement(e){if(!e)return document.scrollingElement||document.documentElement;const n=getComputedStyle(e).overflowY;return(n==="auto"||n==="scroll")&&e.scrollHeight>e.clientHeight?e:D.getScrollElement(e.parentElement)}static updateScrollResize(e,n,r){const i=D.getScrollElement(n),s=i.clientHeight,o=i===D.getScrollElement()?0:i.getBoundingClientRect().top,a=e.clientY-o,l=a<r,c=a>s-r;l?i.scrollBy({behavior:"smooth",top:a-r}):c&&i.scrollBy({behavior:"smooth",top:r-(s-a)})}static clone(e){return e==null||typeof e!="object"?e:e instanceof Array?[...e]:{...e}}static cloneDeep(e){const n=["parentGrid","el","grid","subGrid","engine"],r=D.clone(e);for(const i in r)r.hasOwnProperty(i)&&typeof r[i]=="object"&&i.substring(0,2)!=="__"&&!n.find(s=>s===i)&&(r[i]=D.cloneDeep(e[i]));return r}static cloneNode(e){const n=e.cloneNode(!0);return n.removeAttribute("id"),n}static appendTo(e,n){let r;typeof n=="string"?r=D.getElement(n):r=n,r&&r.appendChild(e)}static addElStyles(e,n){if(n instanceof Object)for(const r in n)n.hasOwnProperty(r)&&(Array.isArray(n[r])?n[r].forEach(i=>{e.style[r]=i}):e.style[r]=n[r])}static initEvent(e,n){const r={type:n.type},i={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:n.target?n.target:e.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(s=>r[s]=e[s]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(s=>r[s]=e[s]),{...r,...i}}static simulateMouseEvent(e,n,r){const i=e,s=new MouseEvent(n,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,ctrlKey:i.ctrlKey??!1,altKey:i.altKey??!1,shiftKey:i.shiftKey??!1,metaKey:i.metaKey??!1,button:0,relatedTarget:e.target});(r||e.target).dispatchEvent(s)}static getValuesFromTransformedElement(e){const n=document.createElement("div");D.addElStyles(n,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),e.appendChild(n);const r=n.getBoundingClientRect();return e.removeChild(n),n.remove(),{xScale:1/r.width,yScale:1/r.height,xOffset:r.left,yOffset:r.top}}static swap(e,n,r){if(!e)return;const i=e[n];e[n]=e[r],e[r]=i}static canBeRotated(e){var n;return!(!e||e.w===e.h||e.locked||e.noResize||(n=e.grid)!=null&&n.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class vr{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange}batchUpdate(e=!0,n=!0){return!!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,n&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,n){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||n.y<=e.y)}_fixCollisions(e,n=e,r,i={}){if(this.sortNodes(-1),r=r||this.collide(e,n),!r)return!1;if(e._moving&&!i.nested&&!this.float&&this.swap(e,r))return!0;let s=n;!this._loading&&this._useEntireRowArea(e,n)&&(s={x:0,w:this.column,y:n.y,h:n.h},r=this.collide(e,s,i.skip));let o=!1;const a={nested:!0,pack:!1};let l=0;for(;r=r||this.collide(e,s,i.skip);){if(l++>this.nodes.length*2)throw new Error("Infinite collide check");let c;if(r.locked||this._loading||e._moving&&!e._skipDown&&n.y>e.y&&!this.float&&(!this.collide(r,{...r,y:e.y},e)||!this.collide(r,{...r,y:n.y-r.h},e))){e._skipDown=e._skipDown||n.y>e.y;const u={...n,y:r.y+r.h,...a};c=this._loading&&D.samePos(e,u)?!0:this.moveNode(e,u),(r.locked||this._loading)&&c?D.copyPos(n,e):!r.locked&&c&&i.pack&&(this._packNodes(),n.y=r.y+r.h,D.copyPos(e,n)),o=o||c}else c=this.moveNode(r,{...r,y:n.y+n.h,skip:e,...a});if(!c)return o;r=void 0}return o}collide(e,n=e,r){const i=e._id,s=r==null?void 0:r._id;return this.nodes.find(o=>o._id!==i&&o._id!==s&&D.isIntercepted(o,n))}collideAll(e,n=e,r){const i=e._id,s=r==null?void 0:r._id;return this.nodes.filter(o=>o._id!==i&&o._id!==s&&D.isIntercepted(o,n))}directionCollideCoverage(e,n,r){if(!n.rect||!e._rect)return;const i=e._rect,s={...n.rect};s.y>i.y?(s.h+=s.y-i.y,s.y=i.y):s.h+=i.y-s.y,s.x>i.x?(s.w+=s.x-i.x,s.x=i.x):s.w+=i.x-s.x;let o,a=.5;for(let l of r){if(l.locked||!l._rect)break;const c=l._rect;let u=Number.MAX_VALUE,d=Number.MAX_VALUE;i.y<c.y?u=(s.y+s.h-c.y)/c.h:i.y+i.h>c.y+c.h&&(u=(c.y+c.h-s.y)/c.h),i.x<c.x?d=(s.x+s.w-c.x)/c.w:i.x+i.w>c.x+c.w&&(d=(c.x+c.w-s.x)/c.w);const h=Math.min(d,u);h>a&&(a=h,o=l)}return n.collide=o,o}cacheRects(e,n,r,i,s,o){return this.nodes.forEach(a=>a._rect={y:a.y*n+r,x:a.x*e+o,w:a.w*e-o-i,h:a.h*n-r-s}),this}swap(e,n){if(!n||n.locked||!e||e.locked)return!1;function r(){const s=n.x,o=n.y;return n.x=e.x,n.y=e.y,e.h!=n.h?(e.x=s,e.y=n.y+n.h):e.w!=n.w?(e.x=n.x+n.w,e.y=o):(e.x=s,e.y=o),e._dirty=n._dirty=!0,!0}let i;if(e.w===n.w&&e.h===n.h&&(e.x===n.x||e.y===n.y)&&(i=D.isTouching(e,n)))return r();if(i!==!1){if(e.w===n.w&&e.x===n.x&&(i||(i=D.isTouching(e,n)))){if(n.y<e.y){const s=e;e=n,n=s}return r()}if(i!==!1){if(e.h===n.h&&e.y===n.y&&(i||(i=D.isTouching(e,n)))){if(n.x<e.x){const s=e;e=n,n=s}return r()}return!1}}}isAreaEmpty(e,n,r,i){const s={x:e||0,y:n||0,w:r||1,h:i||1};return!this.collide(s)}compact(e="compact",n=!0){if(this.nodes.length===0)return this;n&&this.sortNodes();const r=this.batchMode;r||this.batchUpdate();const i=this._inColumnResize;i||(this._inColumnResize=!0);const s=this.nodes;return this.nodes=[],s.forEach((o,a,l)=>{let c;o.locked||(o.autoPosition=!0,e==="list"&&a&&(c=l[a-1])),this.addNode(o,!1,c)}),i||delete this._inColumnResize,r||this.batchUpdate(!1),this}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(e=1){return this.nodes=D.sort(this.nodes,e),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(e=>{if(e._updating||e._orig===void 0||e.y===e._orig.y)return;let n=e.y;for(;n>e._orig.y;)--n,this.collide(e,{x:e.x,y:n,w:e.w,h:e.h})||(e._dirty=!0,e.y=n)}):this.nodes.forEach((e,n)=>{if(!e.locked)for(;e.y>0;){const r=n===0?0:e.y-1;if(!(n===0||!this.collide(e,{x:e.x,y:r,w:e.w,h:e.h})))break;e._dirty=e.y!==r,e.y=r}}),this)}prepareNode(e,n){e._id=e._id??vr._idSeq++;const r=e.id;if(r){let s=1;for(;this.nodes.find(o=>o.id===e.id&&o!==e);)e.id=r+"_"+s++}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=!0);const i={x:0,y:0,w:1,h:1};return D.defaults(e,i),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,D.sanitizeMinMax(e),typeof e.x=="string"&&(e.x=Number(e.x)),typeof e.y=="string"&&(e.y=Number(e.y)),typeof e.w=="string"&&(e.w=Number(e.w)),typeof e.h=="string"&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=i.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=i.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=i.w),isNaN(e.h)&&(e.h=i.h),this.nodeBoundFix(e,n),e}nodeBoundFix(e,n){const r=e._orig||D.copyPos({},e);if(e.maxW&&(e.w=Math.min(e.w||1,e.maxW)),e.maxH&&(e.h=Math.min(e.h||1,e.maxH)),e.minW&&(e.w=Math.max(e.w||1,e.minW)),e.minH&&(e.h=Math.max(e.h||1,e.minH)),(e.x||0)+(e.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&e._id!=null&&this.findCacheLayout(e,this.defaultColumn)===-1){const s={...e};s.autoPosition||s.x===void 0?(delete s.x,delete s.y):s.x=Math.min(this.defaultColumn-1,s.x),s.w=Math.min(this.defaultColumn,s.w||1),this.cacheOneLayout(s,this.defaultColumn)}return e.w>this.column?e.w=this.column:e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(n?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(n?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),D.samePos(e,r)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(n=>n._dirty&&!D.samePos(n,n._orig)):this.nodes.filter(n=>n._dirty)}_notify(e){if(this.batchMode||!this.onChange)return this;const n=(e||[]).concat(this.getDirtyNodes());return this.onChange(n),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(e=>{delete e._dirty,delete e._lastTried}),this)}saveInitial(){return this.nodes.forEach(e=>{e._orig=D.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||D.samePos(e,e._orig)||(D.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,n=this.nodes,r=this.column,i){const s=i?i.y*r+(i.x+i.w):0;let o=!1;for(let a=s;!o;++a){const l=a%r,c=Math.floor(a/r);if(l+e.w>r)continue;const u={x:l,y:c,w:e.w,h:e.h};n.find(d=>D.isIntercepted(u,d))||((e.x!==l||e.y!==c)&&(e._dirty=!0),e.x=l,e.y=c,delete e.autoPosition,o=!0)}return o}addNode(e,n=!1,r){const i=this.nodes.find(o=>o._id===e._id);if(i)return i;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let s;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,r)&&(delete e.autoPosition,s=!0),this.nodes.push(e),n&&this.addedNodes.push(e),s||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,n=!0,r=!1){return this.nodes.find(i=>i._id===e._id)?(r&&this.removedNodes.push(e),n&&(e._removeDOM=!0),this.nodes=this.nodes.filter(i=>i._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=!0,n=!0){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(i=>i._removeDOM=!0);const r=this.nodes;return this.removedNodes=n?r:[],this.nodes=[],this._notify(r)}moveNodeCheck(e,n){if(!this.changedPosConstrain(e,n))return!1;if(n.pack=!0,!this.maxRow)return this.moveNode(e,n);let r;const i=new vr({column:this.column,float:this.float,nodes:this.nodes.map(o=>o._id===e._id?(r={...o},r):{...o})});if(!r)return!1;const s=i.moveNode(r,n)&&i.getRow()<=Math.max(this.getRow(),this.maxRow);if(!s&&!n.resizing&&n.collide){const o=n.collide.el.gridstackNode;if(this.swap(e,o))return this._notify(),!0}return s?(i.nodes.filter(o=>o._dirty).forEach(o=>{const a=this.nodes.find(l=>l._id===o._id);a&&(D.copyPos(a,o),a._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const n=new vr({column:this.column,float:this.float,nodes:this.nodes.map(i=>({...i}))}),r={...e};return this.cleanupNode(r),delete r.el,delete r._id,delete r.content,delete r.grid,n.addNode(r),n.getRow()<=this.maxRow?(e._willFitPos=D.copyPos({},r),!0):!1}changedPosConstrain(e,n){return n.w=n.w||e.w,n.h=n.h||e.h,e.x!==n.x||e.y!==n.y?!0:(e.maxW&&(n.w=Math.min(n.w,e.maxW)),e.maxH&&(n.h=Math.min(n.h,e.maxH)),e.minW&&(n.w=Math.max(n.w,e.minW)),e.minH&&(n.h=Math.max(n.h,e.minH)),e.w!==n.w||e.h!==n.h)}moveNode(e,n){var c,u;if(!e||!n)return!1;let r;n.pack===void 0&&!this.batchMode&&(r=n.pack=!0),typeof n.x!="number"&&(n.x=e.x),typeof n.y!="number"&&(n.y=e.y),typeof n.w!="number"&&(n.w=e.w),typeof n.h!="number"&&(n.h=e.h);const i=e.w!==n.w||e.h!==n.h,s=D.copyPos({},e,!0);if(D.copyPos(s,n),this.nodeBoundFix(s,i),D.copyPos(n,s),!n.forceCollide&&D.samePos(e,n))return!1;const o=D.copyPos({},e),a=this.collideAll(e,s,n.skip);let l=!0;if(a.length){const d=e._moving&&!n.nested;let h=d?this.directionCollideCoverage(e,n,a):a[0];if(d&&h&&((u=(c=e.grid)==null?void 0:c.opts)!=null&&u.subGridDynamic)&&!e.grid._isTemp){const p=D.areaIntercept(n.rect,h._rect),g=D.area(n.rect),m=D.area(h._rect);p/(g<m?g:m)>.8&&(h.grid.makeSubGrid(h.el,void 0,e),h=void 0)}h?l=!this._fixCollisions(e,s,h,n):(l=!1,r&&delete n.pack)}return l&&!D.samePos(e,s)&&(e._dirty=!0,D.copyPos(e,s)),n.pack&&this._packNodes()._notify(),!D.samePos(e,o)}getRow(){return this.nodes.reduce((e,n)=>Math.max(e,n.y+n.h),0)}beginUpdate(e){return e._updating||(e._updating=!0,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const e=this.nodes.find(n=>n._updating);return e&&(delete e._updating,delete e._skipDown),this}save(e=!0,n,r){var a;const i=((a=this._layouts)==null?void 0:a.length)||0;let s;i&&(r?r!==this.column&&(s=this._layouts[r]):this.column!==i-1&&(s=this._layouts[i-1]));const o=[];return this.sortNodes(),this.nodes.forEach(l=>{const c=s==null?void 0:s.find(d=>d._id===l._id),u={...l,...c||{}};D.removeInternalForSave(u,!e),n&&n(l,u),o.push(u)}),o}layoutsNodesChange(e){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((n,r)=>{if(!n||r===this.column)return this;if(r<this.column)this._layouts[r]=void 0;else{const i=r/this.column;e.forEach(s=>{if(!s._orig)return;const o=n.find(a=>a._id===s._id);o&&(o.y>=0&&s.y!==s._orig.y&&(o.y+=s.y-s._orig.y,o.y<0&&(o.y=0)),s.x!==s._orig.x&&(o.x=Math.round(s.x*i),o.x<0&&(o.x=0)),s.w!==s._orig.w&&(o.w=Math.round(s.w*i),o.w<1&&(o.w=1)))})}}),this)}columnChanged(e,n,r="moveScale"){var a;if(!this.nodes.length||!n||e===n)return this;const i=r==="compact"||r==="list";i&&this.sortNodes(1),n<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let s=[],o=i?this.nodes:D.sort(this.nodes,-1);if(n>e&&this._layouts){const l=this._layouts[n]||[],c=this._layouts.length-1;!l.length&&e!==c&&((a=this._layouts[c])!=null&&a.length)&&(e=c,this._layouts[c].forEach(u=>{const d=o.find(h=>h._id===u._id);d&&(!i&&!u.autoPosition&&(d.x=u.x??d.x,d.y=u.y??d.y),d.w=u.w??d.w,(u.x==null||u.y===void 0)&&(d.autoPosition=!0))})),l.forEach(u=>{const d=o.findIndex(h=>h._id===u._id);if(d!==-1){const h=o[d];if(i){h.w=u.w;return}(u.autoPosition||isNaN(u.x)||isNaN(u.y))&&this.findEmptyPosition(u,s),u.autoPosition||(h.x=u.x??h.x,h.y=u.y??h.y,h.w=u.w??h.w,s.push(h)),o.splice(d,1)}})}if(i)this.compact(r,!1);else{if(o.length)if(typeof r=="function")r(n,e,s,o);else{const l=i||r==="none"?1:n/e,c=r==="move"||r==="moveScale",u=r==="scale"||r==="moveScale";o.forEach(d=>{d.x=n===1?0:c?Math.round(d.x*l):Math.min(d.x,n-1),d.w=n===1||e===1?1:u?Math.round(d.w*l)||1:Math.min(d.w,n),s.push(d)}),o=[]}s=D.sort(s,-1),this._inColumnResize=!0,this.nodes=[],s.forEach(l=>{this.addNode(l,!1),delete l._orig})}return this.nodes.forEach(l=>delete l._orig),this.batchUpdate(!1,!i),delete this._inColumnResize,this}cacheLayout(e,n,r=!1){const i=[];return e.forEach((s,o)=>{if(s._id===void 0){const a=s.id?this.nodes.find(l=>l.id===s.id):void 0;s._id=(a==null?void 0:a._id)??vr._idSeq++}i[o]={x:s.x,y:s.y,w:s.w,_id:s._id}}),this._layouts=r?[]:this._layouts||[],this._layouts[n]=i,this}cacheOneLayout(e,n){e._id=e._id??vr._idSeq++;const r={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete r.x,delete r.y,e.autoPosition&&(r.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[n]=this._layouts[n]||[];const i=this.findCacheLayout(e,n);return i===-1?this._layouts[n].push(r):this._layouts[n][i]=r,this}findCacheLayout(e,n){var r,i;return((i=(r=this._layouts)==null?void 0:r[n])==null?void 0:i.findIndex(s=>s._id===e._id))??-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let n=0;n<this._layouts.length;n++){const r=this.findCacheLayout(e,n);r!==-1&&this._layouts[n].splice(r,1)}}cleanupNode(e){for(const n in e)n[0]==="_"&&n!=="_id"&&delete e[n];return this}}vr._idSeq=0;const vn={alwaysShowResizeHandle:"mobile",animate:!0,auto:!0,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:!0},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"};class xe{}const Fn=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0);class yn{}function Ga(t,e){t.touches.length>1||(t.cancelable&&t.preventDefault(),D.simulateMouseEvent(t.changedTouches[0],e))}function Tv(t,e){t.cancelable&&t.preventDefault(),D.simulateMouseEvent(t,e)}function Va(t){yn.touchHandled||(yn.touchHandled=!0,Ga(t,"mousedown"))}function Za(t){yn.touchHandled&&Ga(t,"mousemove")}function Wa(t){if(!yn.touchHandled)return;yn.pointerLeaveTimeout&&(window.clearTimeout(yn.pointerLeaveTimeout),delete yn.pointerLeaveTimeout);const e=!!xe.dragElement;Ga(t,"mouseup"),e||Ga(t,"click"),yn.touchHandled=!1}function qa(t){t.pointerType!=="mouse"&&t.target.releasePointerCapture(t.pointerId)}function zh(t){xe.dragElement&&t.pointerType!=="mouse"&&Tv(t,"mouseenter")}function Ih(t){xe.dragElement&&t.pointerType!=="mouse"&&(yn.pointerLeaveTimeout=window.setTimeout(()=>{delete yn.pointerLeaveTimeout,Tv(t,"mouseleave")},10))}class Nl{constructor(e,n,r){this.host=e,this.dir=n,this.option=r,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){if(this.option.element)try{this.el=this.option.element instanceof HTMLElement?this.option.element:this.host.querySelector(this.option.element)}catch(e){this.option.element=void 0,console.error("Query for resizeable handle failed, falling back",e)}return this.el||(this.el=document.createElement("div"),this.host.appendChild(this.el)),this.el.classList.add("ui-resizable-handle"),this.el.classList.add(`${Nl.prefix}${this.dir}`),this.el.style.zIndex="100",this.el.style.userSelect="none",this.el.addEventListener("mousedown",this._mouseDown),Fn&&(this.el.addEventListener("touchstart",Va),this.el.addEventListener("pointerdown",qa)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),Fn&&(this.el.removeEventListener("touchstart",Va),this.el.removeEventListener("pointerdown",qa)),this.option.element||this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(e){this.mouseDownEvent=e,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Fn&&(this.el.addEventListener("touchmove",Za),this.el.addEventListener("touchend",Wa)),e.stopPropagation(),e.preventDefault()}_mouseMove(e){const n=this.mouseDownEvent;this.moving?this._triggerEvent("move",e):Math.abs(e.x-n.x)+Math.abs(e.y-n.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",e),document.addEventListener("keydown",this._keyEvent)),e.stopPropagation()}_mouseUp(e){this.moving&&(this._triggerEvent("stop",e),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Fn&&(this.el.removeEventListener("touchmove",Za),this.el.removeEventListener("touchend",Wa)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault()}_keyEvent(e){var n,r;e.key==="Escape"&&((r=(n=this.host.gridstackNode)==null?void 0:n.grid)==null||r.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(e,n){return this.option[e]&&this.option[e](n),this}}Nl.prefix="ui-resizable-";class Pd{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(e,n){this._eventRegister[e]=n}off(e){delete this._eventRegister[e]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(e,n){if(!this.disabled&&this._eventRegister&&this._eventRegister[e])return this._eventRegister[e](n)}}class oo extends Pd{constructor(e,n={}){super(),this.el=e,this.option=n,this.rectScale={x:1,y:1},this._ui=()=>{const i=this.el.parentElement.getBoundingClientRect(),s={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,right:this.originalRect.right,top:this.originalRect.top-this.scrolled},o=this.temporalRect||s;return{position:{left:this.option.rtl?(i.right-o.right)*this.rectScale.x:(o.left-i.left)*this.rectScale.x,top:(o.top-i.top)*this.rectScale.y},size:{width:o.width*this.rectScale.x,height:o.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(e,n){super.on(e,n)}off(e){super.off(e)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(e){const n=e.handles&&e.handles!==this.option.handles,r=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(i=>this.option[i]=e[i]),n&&(this._removeHandlers(),this._setupHandlers()),r&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),xe.overResizeElement===this&&delete xe.overResizeElement),this}_mouseOver(e){xe.overResizeElement||xe.dragElement||(xe.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){xe.overResizeElement===this&&(delete xe.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Nl(this.el,e,{element:this.option.element,start:n=>this._resizeStart(n),stop:n=>this._resizeStop(n),move:n=>this._resizing(n,e)})),this}_resizeStart(e){this.sizeToContent=D.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=D.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const n=D.initEvent(e,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(n,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",n),this}_resizing(e,n){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(e,n),this._applyChange();const r=D.initEvent(e,{type:"resize",target:this.el});return r.resizeDir=n,r.hasMovedX=this.option.rtl?n.includes("e"):n.includes("w"),r.hasMovedY=n.includes("n"),this.option.resize&&this.option.resize(r,this._ui()),this.triggerEvent("resize",r),this}_resizeStop(e){const n=D.initEvent(e,{type:"resizestop",target:this.el});return this._cleanHelper(),this.option.stop&&this.option.stop(n),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",n),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=oo._originStyleProp.map(r=>this.el.style[r]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,n=D.getValuesFromTransformedElement(e);return this.rectScale={x:n.xScale,y:n.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return oo._originStyleProp.forEach((e,n)=>{this.el.style[e]=this.elOriginStyleVal[n]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,n){const r=this.startEvent,i={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,right:this.originalRect.right,top:this.originalRect.top-this.scrolled},s=e.clientX-r.clientX,o=this.sizeToContent?0:e.clientY-r.clientY;let a,l;const c=this.option.rtl;!c&&n.indexOf("e")>-1?i.width+=s:c&&n.indexOf("w")>-1?i.width-=s:!c&&n.indexOf("w")>-1?(i.width-=s,i.left+=s,a=!0):c&&n.indexOf("e")>-1&&(i.width+=s,i.right+=s,a=!0),n.indexOf("s")>-1?i.height+=o:n.indexOf("n")>-1&&(i.height-=o,i.top+=o,l=!0);const u=this._constrainSize(i.width,i.height,a,l);return Math.round(i.width)!==Math.round(u.width)&&(!c&&n.indexOf("w")>-1?i.left+=i.width-u.width:c&&n.indexOf("e")>-1&&(i.right-=i.width-u.width),i.width=u.width),Math.round(i.height)!==Math.round(u.height)&&(n.indexOf("n")>-1&&(i.top+=i.height-u.height),i.height=u.height),i}_constrainSize(e,n,r,i){const s=this.option,o=(r?s.maxWidthMoveLeft:s.maxWidth)||Number.MAX_SAFE_INTEGER,a=s.minWidth/this.rectScale.x||e,l=(i?s.maxHeightMoveUp:s.maxHeight)||Number.MAX_SAFE_INTEGER,c=s.minHeight/this.rectScale.y||n,u=Math.min(o,Math.max(a,e)),d=Math.min(l,Math.max(c,n));return{width:u,height:d}}_applyChange(){let e={left:0,right:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const n=this.el.parentElement,{left:r,right:i,top:s}=n.getBoundingClientRect();e={left:r,right:i,top:s,width:0,height:0}}return this.temporalRect?(Object.entries(this.temporalRect).forEach(([n,r])=>{if(this.option.rtl?n==="left":n==="right")return;const i=n==="width"||n==="left"||n==="right"?this.rectScale.x:n==="height"||n==="top"?this.rectScale.y:1;let s;n==="right"?s=(e.right-r)*this.rectScale.x+"px":s=(r-e[n])*i+"px",this.el.style[n]=s}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}}oo._originStyleProp=["width","height","position","left","right","top","opacity","zIndex"];const FR='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class ao extends Pd{constructor(e,n={}){var s;super(),this.el=e,this.option=n,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},this._autoScrollTick=()=>{const o=this.helper,a=this._autoScrollContainer;if(!o||!a){this._stopScrolling();return}const l=this._getClipping(o,a);if(l===0){this._stopScrolling();return}if(!this._autoScrollMaxSpeed){const p=window.innerHeight||document.documentElement.clientHeight;this._autoScrollMaxSpeed=Math.max(p/150,4)}const c=Math.abs(l),u=Math.min(c*.5,this._autoScrollMaxSpeed),d=l>0?u:-u,h=a.scrollTop;if(a.scrollTop+=d,a.scrollTop===h){this._stopScrolling();return}this.dragging&&this.lastDrag&&(this._dragFollow(this.lastDrag),this._callDrag(this.lastDrag)),this._autoScrollAnimId=requestAnimationFrame(this._autoScrollTick)};const r=(s=n==null?void 0:n.handle)==null?void 0:s.substring(1),i=e.gridstackNode;this.dragEls=!r||e.classList.contains(r)?[e]:i!=null&&i.subGrid?[e.querySelector(n.handle)||e]:this.getAllHandles(),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}getAllHandles(){return Array.from(this.el.querySelectorAll(this.option.handle)).filter(e=>{if(!(e instanceof HTMLElement))return!1;const n=e.closest(".grid-stack-item");return n===this.el||!n})}on(e,n){super.on(e,n)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),Fn&&(e.addEventListener("touchstart",Va),e.addEventListener("pointerdown",qa))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(n=>{n.removeEventListener("mousedown",this._mouseDown),Fn&&(n.removeEventListener("touchstart",Va),n.removeEventListener("pointerdown",qa))}),e||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(e){return Object.keys(e).forEach(n=>this.option[n]=e[n]),this}_mouseDown(e){if(yn.touchHandled&&e.isTrusted&&(yn.touchHandled=!1),!xe.mouseHandled)return e.button!==0||!this.dragEls.find(n=>n===e.target)&&e.target.closest(FR)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete xe.dragElement,delete xe.dropElement,delete this._autoScrollMaxSpeed,delete this._autoScrollContainer,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Fn&&(e.currentTarget.addEventListener("touchmove",Za),e.currentTarget.addEventListener("touchend",Wa)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),xe.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const n=D.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(n,this.ui()),this.triggerEvent("drag",n)}_mouseMove(e){var r;const n=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),xe.pauseDrag){const i=Number.isInteger(xe.pauseDrag)?xe.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),i)}else this._callDrag(e);else if(Math.abs(e.x-n.x)+Math.abs(e.y-n.y)>3){this.dragging=!0,xe.dragElement=this;const i=(r=this.el.gridstackNode)==null?void 0:r.grid;i?xe.dropElement=i.el.ddElement.ddDroppable:delete xe.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=D.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const s=D.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(s,this.ui()),this.triggerEvent("dragstart",s),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){var n,r;if(this._stopScrolling(),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Fn&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",Za,!0),e.currentTarget.removeEventListener("touchend",Wa,!0)),this.dragging){delete this.dragging,(n=this.el.gridstackNode)==null||delete n._origRotate,document.removeEventListener("keydown",this._keyEvent),((r=xe.dropElement)==null?void 0:r.el)===this.el.parentElement&&delete xe.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const i=D.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(i),this.triggerEvent("dragstop",i),xe.dropElement&&xe.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete xe.dragElement,delete xe.dropElement,delete xe.mouseHandled,e.preventDefault()}_keyEvent(e){var i,s;const n=this.el.gridstackNode,r=(n==null?void 0:n.grid)||((s=(i=xe.dropElement)==null?void 0:i.el)==null?void 0:s.gridstack);if(e.key==="Escape")n&&n._origRotate&&(n._orig=n._origRotate,delete n._origRotate),r==null||r.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(n&&r&&(e.key==="r"||e.key==="R")){if(!D.canBeRotated(n))return;n._origRotate=n._origRotate||{...n._orig},delete n._moving,r.setAnimation(!1).rotate(n.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetX}).setAnimation(),n._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,n.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",D.swap(n._orig,"w","h"),delete n._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let e=this.el;return typeof this.option.helper=="function"?e=this.option.helper(this.el):this.option.helper==="clone"&&(e=D.cloneNode(this.el)),e.parentElement||D.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=ao.originStyleProp.map(n=>this.el.style[n]),e}_setupHelperStyle(e){var r,i;this.helper.classList.add("ui-draggable-dragging"),(i=(r=this.el.gridstackNode)==null?void 0:r.grid)==null||i.el.classList.add("grid-stack-dragging");const n=this.helper.style;return n.pointerEvents="none",n.width=this.dragOffset.width+"px",n.height=this.dragOffset.height+"px",n.willChange="left, right, top",n.position="fixed",this._dragFollow(e),n.transition="none",setTimeout(()=>{this.helper&&(n.transition=null)},0),this}_removeHelperStyle(){var n,r,i;this.helper.classList.remove("ui-draggable-dragging"),(r=(n=this.el.gridstackNode)==null?void 0:n.grid)==null||r.el.classList.remove("grid-stack-dragging");const e=(i=this.helper)==null?void 0:i.gridstackNode;if(!(e!=null&&e._isAboutToRemove)&&this.dragElementOriginStyle){const s=this.helper,o=this.dragElementOriginStyle.transition||null;s.style.transition=this.dragElementOriginStyle.transition="none",ao.originStyleProp.forEach(a=>s.style[a]=this.dragElementOriginStyle[a]||null),setTimeout(()=>s.style.transition=o,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const n=this.helper.style,r=this.dragOffset;this.option.rtl?(n.right=(window.innerWidth-e.clientX+r.offsetX)*this.dragTransform.xScale+"px",n.left&&(n.left="")):(n.left=(e.clientX+r.offsetX)*this.dragTransform.xScale+"px",n.right&&(n.right="")),n.top=(e.clientY+r.offsetTop)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,n,r){let i=0,s=0;r&&(i=this.dragTransform.xOffset,s=this.dragTransform.yOffset);const o=n.getBoundingClientRect();let a=this.option.rtl?o.right:o.left,l=this.option.rtl?e.clientX-o.right+i:-e.clientX+o.left-i;return{x:a,top:o.top,offsetX:l,offsetTop:-e.clientY+o.top-s,width:o.width*this.dragTransform.xScale,height:o.height*this.dragTransform.yScale}}updateScrollPosition(e){this._autoScrollContainer=D.getScrollElement(e),this._getClipping(this.helper,this._autoScrollContainer)===0?this._stopScrolling():this._autoScrollAnimId||(this._autoScrollAnimId=requestAnimationFrame(this._autoScrollTick))}_getClipping(e,n){const r=e.getBoundingClientRect(),i=n.getBoundingClientRect(),s=window.innerHeight||document.documentElement.clientHeight;if(r.bottom<i.top||r.top>i.bottom)return 0;const o=r.bottom-Math.min(i.bottom,s),a=r.top-Math.max(i.top,0);return a<0?a:o>0?o:0}_stopScrolling(){this._autoScrollAnimId&&(cancelAnimationFrame(this._autoScrollAnimId),delete this._autoScrollAnimId)}ui(){const n=this.el.parentElement.getBoundingClientRect(),r=this.helper.getBoundingClientRect(),i=this.option.rtl?(n.right-r.right)*this.dragTransform.xScale:(r.left-n.left)*this.dragTransform.xScale;return{position:{top:(r.top-n.top)*this.dragTransform.yScale,left:i}}}}ao.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","right","top","minWidth","willChange"];class GR extends Pd{constructor(e,n={}){super(),this.el=e,this.option=n,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(e,n){super.on(e,n)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),Fn&&(this.el.addEventListener("pointerenter",zh),this.el.addEventListener("pointerleave",Ih)))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),e||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),Fn&&(this.el.removeEventListener("pointerenter",zh),this.el.removeEventListener("pointerleave",Ih)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(e){return Object.keys(e).forEach(n=>this.option[n]=e[n]),this._setupAccept(),this}_mouseEnter(e){if(!xe.dragElement||yn.touchHandled&&e.isTrusted||!this._canDrop(xe.dragElement.el))return;e.preventDefault(),e.stopPropagation(),xe.dragElement._stopScrolling(),xe.dropElement&&xe.dropElement!==this&&xe.dropElement._mouseLeave(e,!0),xe.dropElement=this;const n=D.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(n,this._ui(xe.dragElement)),this.triggerEvent("dropover",n),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,n=!1){var i;if(!xe.dragElement||xe.dropElement!==this)return;e.preventDefault(),e.stopPropagation(),n&&xe.dragElement._stopScrolling();const r=D.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(r,this._ui(xe.dragElement)),this.triggerEvent("dropout",r),xe.dropElement===this&&(delete xe.dropElement,!n)){let s,o=this.el.parentElement;for(;!s&&o;)s=(i=o.ddElement)==null?void 0:i.ddDroppable,o=o.parentElement;s&&s._mouseEnter(e)}}drop(e){e.preventDefault();const n=D.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(n,this._ui(xe.dragElement)),this.triggerEvent("drop",n)}_canDrop(e){return e&&(!this.accept||this.accept(e))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=e=>e.classList.contains(this.option.accept)||e.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(e){return{draggable:e.el,...e.ui()}}}class Rd{static init(e){return e.ddElement||(e.ddElement=new Rd(e)),e.ddElement}constructor(e){this.el=e}on(e,n){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.on(e,n):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.on(e,n):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.on(e,n),this}off(e){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.off(e):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.off(e):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.off(e),this}setupDraggable(e){return this.ddDraggable?this.ddDraggable.updateOption(e):this.ddDraggable=new ao(this.el,e),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(e){return this.ddResizable?this.ddResizable.updateOption(e):this.ddResizable=new oo(this.el,e),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(e){return this.ddDroppable?this.ddDroppable.updateOption(e):this.ddDroppable=new GR(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class VR{resizable(e,n,r,i){return this._getDDElements(e,n).forEach(s=>{if(n==="disable"||n==="enable")s.ddResizable&&s.ddResizable[n]();else if(n==="destroy")s.ddResizable&&s.cleanResizable();else if(n==="option")s.setupResizable({[r]:i});else{const a=s.el.gridstackNode.grid;let l=s.el.getAttribute("gs-resize-handles")||a.opts.resizable.handles||"e,s,se";l==="all"&&(l="n,e,s,w,se,sw,ne,nw");const c=!a.opts.alwaysShowResizeHandle;s.setupResizable({...a.opts.resizable,handles:l,autoHide:c,start:n.start,stop:n.stop,resize:n.resize,rtl:n.rtl})}}),this}draggable(e,n,r,i){return this._getDDElements(e,n).forEach(s=>{if(n==="disable"||n==="enable")s.ddDraggable&&s.ddDraggable[n]();else if(n==="destroy")s.ddDraggable&&s.cleanDraggable();else if(n==="option")s.setupDraggable({[r]:i});else{const o=s.el.gridstackNode.grid;s.setupDraggable({...o.opts.draggable,start:n.start,stop:n.stop,drag:n.drag,rtl:n.rtl})}}),this}dragIn(e,n){return this._getDDElements(e).forEach(r=>r.setupDraggable(n)),this}droppable(e,n,r,i){return typeof n.accept=="function"&&!n._accept&&(n._accept=n.accept,n.accept=s=>n._accept(s)),this._getDDElements(e,n).forEach(s=>{n==="disable"||n==="enable"?s.ddDroppable&&s.ddDroppable[n]():n==="destroy"?s.ddDroppable&&s.cleanDroppable():n==="option"?s.setupDroppable({[r]:i}):s.setupDroppable(n)}),this}isDroppable(e){var n;return!!((n=e==null?void 0:e.ddElement)!=null&&n.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){var n;return!!((n=e==null?void 0:e.ddElement)!=null&&n.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){var n;return!!((n=e==null?void 0:e.ddElement)!=null&&n.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,n,r){return this._getDDElements(e).forEach(i=>i.on(n,s=>{r(s,xe.dragElement?xe.dragElement.el:s.target,xe.dragElement?xe.dragElement.helper:null)})),this}off(e,n){return this._getDDElements(e).forEach(r=>r.off(n)),this}_getDDElements(e,n){const r=e.gridstack||n!=="destroy"&&n!=="disable",i=D.getElements(e);return i.length?i.map(o=>o.ddElement||(r?Rd.init(o):null)).filter(o=>o):[]}}/*!
|
|
81
81
|
* GridStack 12.6.0
|
|
82
82
|
* https://gridstackjs.com/
|
|
83
83
|
*
|
|
@@ -91,4 +91,4 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
91
91
|
${f(o).currentExec??""}/${f(o).maxConcurrentExecTotal??""}`),S(qn,`${ze??""}:
|
|
92
92
|
${f(o).reservedServices??""}/${f(o).maxSupervisedServices??""}`),S(Xn,`${V??""}:
|
|
93
93
|
${f(o).maxConcurrentExecPerPlugin??""}`),S(cr,`${ge??""}:
|
|
94
|
-
${Ce??""}`)},[()=>w("settings.backend-capacity"),()=>w("settings.backend-capacity"),()=>w("settings.plugin-manager.exec"),()=>w("settings.plugin-manager.services"),()=>w("settings.plugin-manager.per-plugin-exec-limit"),()=>w("settings.plugin-manager.service-protocols"),()=>f(o).supportedServiceProtocols.join(", ")]),C(X,ve)},ce=X=>{var ve=GN(),Ze=v(ve);y(nt=>S(Ze,nt),[()=>w("settings.plugin-manager.runtime-status-unavailable",{error:f(a)})]),C(X,ve)};Z(je,X=>{f(o)?X(Ke):f(a)&&X(ce,1)})}var ae=x(je,2);{var U=X=>{CN(X,{get items(){return f(k)},get confirmingName(){return f(d)},rowStateFor:O,onApprove:ve=>M(ve,{kind:"approve"},()=>n().approvePlugin(ve),!0),onDeny:ve=>M(ve,{kind:"deny"},()=>n().denyPlugin(ve),!1),onRequestConfirm:ve=>b(d,ve,!0),onCancelConfirm:()=>b(d,null),onRefresh:()=>void A()})};Z(ae,X=>{f(k).length>0&&X(U)})}var re=x(ae,2);mN(re,{get items(){return f(_)},get confirmingName(){return f(d)},rowStateFor:O,get permissionVisible(){return r()},get permissionAvailable(){return i()},onEnable:X=>M(X,{kind:"enable"},()=>n().enablePlugin(X),!0),onDisable:X=>M(X,{kind:"disable"},()=>n().disablePlugin(X),!0),onPermissionChange:(X,ve,Ze)=>M(X,{kind:"permission",permission:ve,enabled:Ze},()=>n().setPluginPermission(X,ve,Ze),!1),onRestart:X=>M(X,{kind:"restart"},()=>n().restartPlugin(X),!1),onDelete:X=>M(X,{kind:"delete"},()=>n().deletePlugin(X),!0),onRequestConfirm:X=>b(d,X,!0),onCancelConfirm:()=>b(d,null),onRefresh:()=>void A()}),C(oe,ue)};Z(W,oe=>{f(l)?oe(J):f(c)?oe(ne,1):oe(le,-1)})}y(oe=>S(B,oe),[()=>w("settings.plugin-manager.title")]),C(t,H),Le()}at(["click"]);var qN=z('<section class="mndw-plugin-settings"><!></section>');function XN(t,e){var n=qN(),r=v(n);WN(r,{get permissionVisible(){return e.permissionVisible},get permissionAvailable(){return e.permissionAvailable}}),C(t,n)}class Id extends Error{constructor(n,r){super(n);G(this,"code");this.name="SelfUpdateError",this.code=r}}const Gv=t=>t==="update"||t==="revert",$n=()=>new Id("Malformed response","UNKNOWN");async function YN(t){try{return await t.json()}catch{throw $n()}}async function JN(t){const e=Ol(await Ml(t),t.statusText);return new Id(e.message,e.code)}function KN(t){if(!sn(t)||t.state!=="idle"&&t.state!=="in-progress"&&t.state!=="failed"||!_r(t.version)||t.operation!==void 0&&!Gv(t.operation))throw $n();for(const i of["targetVersion","failureCode","rollbackVersion"])if(t[i]!==void 0&&!_r(t[i]))throw $n();const e=t.targetVersion===void 0?void 0:t.targetVersion,n=t.failureCode===void 0?void 0:t.failureCode,r=t.rollbackVersion===void 0?void 0:t.rollbackVersion;return{state:t.state,version:t.version,...t.operation===void 0?{}:{operation:t.operation},...e===void 0?{}:{targetVersion:e},...n===void 0?{}:{failureCode:n},...r===void 0?{}:{rollbackVersion:r}}}function QN(t){if(!sn(t)||!_r(t.currentVersion)||typeof t.updateAvailable!="boolean"||typeof t.rollbackAvailable!="boolean"||t.targetVersion!==void 0&&!_r(t.targetVersion)||t.rollbackVersion!==void 0&&!_r(t.rollbackVersion)||t.updateAvailable!==(t.targetVersion!==void 0)||t.rollbackAvailable!==(t.rollbackVersion!==void 0))throw $n();const e=t.targetVersion===void 0?void 0:t.targetVersion,n=t.rollbackVersion===void 0?void 0:t.rollbackVersion;return{currentVersion:t.currentVersion,updateAvailable:t.updateAvailable,rollbackAvailable:t.rollbackAvailable,...e===void 0?{}:{targetVersion:e},...n===void 0?{}:{rollbackVersion:n}}}function np(t){if(!sn(t)||!Gv(t.operation)||!_r(t.targetVersion))throw $n();return{operation:t.operation,targetVersion:t.targetVersion}}function e3(t=globalThis.fetch){async function e(r,i){const s=await t(r,i);if(!s.ok)throw await JN(s);return YN(s)}async function n(r){return e(r,{method:"POST",headers:{"Content-Type":"application/json",...Xt},body:"{}"})}return{async status(){return KN(await e(bT,{method:"GET"}))},async check(){return QN(await n(_T))},async apply(){return np(await n(wT))},async revert(){return np(await n(yT))}}}const t3=e3();var n3=z("<mndw-button> </mndw-button>",2),r3=z('<div class="mndw-self-update-progress-modal svelte-1khkewm"><p class="svelte-1khkewm"> </p> <!></div>');function i3(t,e){Ie(e,!0);const n=fe(()=>e.progress.phase==="preparing"?w("settings.self-update-preparing"):e.progress.phase==="unconfirmed"?w("settings.self-update-unconfirmed-modal"):e.progress.operation==="revert"?w("settings.self-update-reverting",{version:e.progress.targetVersion}):w("settings.self-update-updating",{version:e.progress.targetVersion}));var r=r3(),i=v(r),s=v(i),o=x(i,2);{var a=l=>{var c=n3();P(c,"variant","secondary"),Ne(c,1,"svelte-1khkewm");var u=v(c);y(d=>S(u,d),[()=>w("common.close")]),pe("click",c,()=>e.close("close")),C(l,c)};Z(o,l=>{e.progress.phase==="unconfirmed"&&l(a)})}y(()=>{Ae(i,"role",e.progress.phase==="unconfirmed"?"alert":"status"),S(s,f(n))}),C(t,r),Le()}at(["click"]);var Ac=z('<p class="svelte-1ffuaq9"> </p>'),oa=z('<p role="status" class="svelte-1ffuaq9"> </p>'),Ni=z('<p role="alert" class="svelte-1ffuaq9"> </p>'),s3=z('<section class="mndw-self-update-settings svelte-1ffuaq9"><h3 class="svelte-1ffuaq9"> </h3> <p class="svelte-1ffuaq9"> </p> <!> <!> <!> <!> <div class="mndw-self-update-actions svelte-1ffuaq9"><mndw-button> </mndw-button> <mndw-button> </mndw-button> <mndw-button> </mndw-button></div></section>',2);function o3(t,e){Ie(e,!0);let n=Yt(e,"pollIntervalMs",3,2e3),r=Yt(e,"pollAttempts",3,90),i=fe(()=>e.client??t3),s=Y(null),o=Y(null),a=Y(""),l=Y(""),c=Y("idle"),u=Y(""),d=Y(!1),h=null,p=0,g=0,m=!1,_=!1,k=Y(null),O=null;zn(()=>{A()}),Oo(()=>{m=!0,I(),q()});function I(){p+=1,h!==null&&(window.clearTimeout(h),h=null)}function R(L){b(s,L,!0),L.state==="failed"?(b(u,L.failureCode??"unknown",!0),b(c,"failure"),_=!1,q()):L.state==="idle"&&_?(b(c,"success"),q()):L.state==="in-progress"&&(b(c,"idle"),f(k)!==null&&(f(k).phase="running",f(k).targetVersion=L.targetVersion??f(k).targetVersion,L.operation!==void 0&&(f(k).operation=L.operation)))}async function A(){b(d,!0);try{const L=await f(i).status();if(m)return;R(L),L.state==="in-progress"&&(_=!0,T())}catch{b(c,"error")}finally{b(d,!1)}}function T(){if(I(),g=Math.max(0,r()),g===0){N();return}M(p)}function M(L){m||L!==p||g<=0||(h=window.setTimeout(()=>{h=null,j(L)},n()))}function N(){I(),b(c,"unconfirmed"),f(k)!==null&&(f(k).phase="unconfirmed")}async function j(L){if(!(m||L!==p)){g-=1;try{const K=await f(i).status();if(m||L!==p)return;R(K),K.state==="in-progress"?g<=0?N():M(L):I()}catch{if(g<=0){N();return}M(L)}}}function H(L){return L instanceof Id?L.code:"UNKNOWN"}async function se(L,K){const we=L==="update";return(await as(Ya,{title:w(we?"settings.self-update-confirm-update-title":"settings.self-update-confirm-revert-title"),props:{message:w(we?"settings.self-update-confirm-update":"settings.self-update-confirm-revert",{version:K}),confirmLabel:w(we?"settings.self-update-apply":"settings.self-update-revert")}}).closed).result===!0}function B(L){b(k,{operation:L,phase:"preparing",targetVersion:""},!0);const we=f(k);if(we===null)return;const _e=as(i3,{title:w("settings.self-update-progress-title"),showCloseButton:!1,closeOnEscape:!1,props:{progress:we}});O=_e,_e.closed.then(()=>{O===_e&&(O=null,b(k,null))})}function q(){O==null||O.close(void 0,"api")}async function ee(){try{const L=await f(i).status();if(m)return;R(L),L.state==="in-progress"?(_=!0,T()):b(c,"busy")}catch{b(c,"busy")}}async function te(){I(),_=!1,b(d,!0),b(c,"checking"),b(u,"");try{b(o,await f(i).check(),!0),b(c,"idle")}catch(L){b(o,null),H(L)==="OPKG_BUSY"?await ee():b(c,"error")}finally{b(d,!1)}}async function W(){const L=f(o);L===null||!L.updateAvailable||L.targetVersion===void 0||await se("update",L.targetVersion)&&await ue("update",()=>f(i).apply())}async function J(){f(Ke)!==""&&await se("revert",f(Ke))&&await ue("revert",()=>f(i).revert())}function ne(L){I(),b(o,null),b(a,""),b(l,L,!0),b(u,""),b(d,!0),b(c,"preparing"),_=!1}async function le(L){const K=await L();b(a,K.targetVersion,!0),b(l,K.operation,!0),f(k)!==null&&(f(k).phase="running",f(k).targetVersion=K.targetVersion),b(c,"idle"),_=!0,T()}async function oe(L){switch(q(),H(L)){case"OPKG_BUSY":await ee();return;case"SELF_UPDATE_NOT_AVAILABLE":b(u,"no-update");break;case"SELF_UPDATE_ROLLBACK_UNAVAILABLE":b(u,"rollback-unavailable");break;default:b(u,"")}b(c,"error")}async function ue(L,K){ne(L),B(L);try{await le(K)}catch(we){await oe(we)}finally{b(d,!1)}}function De(L){return w({"update-missing":"settings.self-update-failure-update-missing","opkg-install-failed":"settings.self-update-failure-opkg-install-failed","opkg-revert-failed":"settings.self-update-failure-opkg-revert-failed","rollback-missing":"settings.self-update-failure-rollback-missing","helper-exited":"settings.self-update-failure-helper-exited","unexpected-version":"settings.self-update-failure-unexpected-version","state-corrupt":"settings.self-update-failure-state-corrupt"}[L]??"settings.self-update-failure-generic")}const Ye=fe(()=>{var L;return((L=f(s))==null?void 0:L.version)??""}),je=fe(()=>{var L,K;return((L=f(s))==null?void 0:L.state)==="in-progress"?f(a)||f(s).targetVersion||"":((K=f(o))==null?void 0:K.targetVersion)||""}),Ke=fe(()=>{var L,K;return((L=f(o))==null?void 0:L.rollbackVersion)||((K=f(s))==null?void 0:K.rollbackVersion)||""}),ce=fe(()=>{var L;return((L=f(o))==null?void 0:L.updateAvailable)===!0&&!f(d)}),ae=fe(()=>{var L,K;return(((L=f(o))==null?void 0:L.rollbackAvailable)===!0||!!((K=f(s))!=null&&K.rollbackVersion))&&!f(d)});var U=s3(),re=v(U),X=v(re),ve=x(re,2),Ze=v(ve),nt=x(ve,2);{var yt=L=>{var K=Ac(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-current",{version:f(Ye)})]),C(L,K)};Z(nt,L=>{f(Ye)&&L(yt)})}var Ut=x(nt,2);{var on=L=>{var K=Ac(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-rollback",{version:f(Ke)})]),C(L,K)};Z(Ut,L=>{f(Ke)&&L(on)})}var qn=x(Ut,2);{var En=L=>{var K=oa(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-checking")]),C(L,K)},Xn=L=>{var K=oa(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-preparing")]),C(L,K)},Yn=L=>{var K=oa(),we=v(K);y(_e=>S(we,_e),[()=>w(f(l)==="revert"||f(s).operation==="revert"?"settings.self-update-reverting":"settings.self-update-updating",{version:f(je)})]),C(L,K)},cr=L=>{var K=oa(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-success",{version:f(Ye)})]),C(L,K)},an=L=>{var K=Ni(),we=v(K);y(_e=>S(we,_e),[()=>De(f(u))]),C(L,K)},ur=L=>{var K=Ni(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-unconfirmed")]),C(L,K)},Ee=L=>{var K=Ni(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-busy")]),C(L,K)},ze=L=>{var K=Ni(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-no-update")]),C(L,K)},V=L=>{var K=Ni(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-rollback-unavailable")]),C(L,K)},ge=L=>{var K=Ni(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-failure-generic")]),C(L,K)};Z(qn,L=>{var K;f(c)==="checking"?L(En):f(c)==="preparing"?L(Xn,1):((K=f(s))==null?void 0:K.state)==="in-progress"?L(Yn,2):f(c)==="success"?L(cr,3):f(c)==="failure"?L(an,4):f(c)==="unconfirmed"?L(ur,5):f(c)==="busy"?L(Ee,6):f(c)==="error"&&f(u)==="no-update"?L(ze,7):f(c)==="error"&&f(u)==="rollback-unavailable"?L(V,8):f(c)==="error"&&L(ge,9)})}var Ce=x(qn,2);{var Ge=L=>{var K=Ac(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-available",{version:f(o).targetVersion})]),C(L,K)};Z(Ce,L=>{f(o)!==null&&f(o).updateAvailable&&f(o).targetVersion!==void 0&&L(Ge)})}var Qe=x(Ce,2),lt=v(Qe);P(lt,"variant","secondary"),y(()=>P(lt,"disabled",f(d)));var xt=v(lt),$e=x(lt,2);P($e,"variant","primary"),y(()=>P($e,"disabled",!f(ce)));var He=v($e),We=x($e,2);P(We,"variant","secondary"),y(()=>P(We,"disabled",!f(ae)));var Re=v(We);y((L,K,we,_e,kt,pt)=>{Ae(U,"data-locale",me.locale),Ae(U,"aria-label",L),S(X,K),S(Ze,we),S(xt,_e),S(He,kt),S(Re,pt)},[()=>w("settings.self-update-tab"),()=>w("settings.self-update-tab"),()=>w("settings.self-update-description"),()=>f(c)==="checking"?w("settings.self-update-checking"):w("settings.self-update-check"),()=>w("settings.self-update-apply"),()=>w("settings.self-update-revert")]),pe("click",lt,()=>void te()),pe("click",$e,()=>void W()),pe("click",We,()=>void J()),C(t,U),Le()}at(["click"]);const co=[{id:"general",route:"/settings/general",labelKey:"settings.general-tab",icon:"settings"},{id:"diagnostics",route:"/settings/diagnostics",labelKey:"settings.diagnostics-tab",icon:"diagnostics"},{id:"plugins",route:"/settings/plugins",labelKey:"settings.plugins-tab",icon:"plugins"},{id:"self-update",route:"/settings/self-update",labelKey:"settings.self-update-tab",icon:"refresh"}],rp="general";function ip(t){var e;return((e=co.find(n=>n.id===t))==null?void 0:e.route)??`/settings/${t}`}function a3(t){const e=t.length>1&&t.endsWith("/")?t.slice(0,-1):t;for(const n of co)if(e===n.route)return n.id;return null}var l3=z("<mndw-tab> </mndw-tab>",2),c3=z('<div class="mndw-settings"><h2> </h2> <mndw-tabs><!> <mndw-tab-panel><!></mndw-tab-panel> <mndw-tab-panel><!></mndw-tab-panel> <mndw-tab-panel><!></mndw-tab-panel> <mndw-tab-panel><!></mndw-tab-panel></mndw-tabs></div>',2);function sp(t,e){Ie(e,!0);let n=Y(!1),r=Y(!1);const i=fe(()=>{const R=(Jt==null?void 0:Jt.route.pathname)??globalThis.location.pathname;return a3(R)??rp});zn(()=>{const R=Jt;(R==null?void 0:R.route.pathname)==="/settings"&&R.navigate(ip(rp),{replace:!0})});function s(R){const A=co.find(M=>M.id===R.detail.value),T=Jt;A===void 0||T===void 0||T.navigate(ip(A.id))}function o(R){b(n,R.visible,!0),b(r,R.available,!0)}var a=c3(),l=v(a),c=v(l),u=x(l,2);y(()=>P(u,"value",f(i)));var d=v(u);ft(d,17,()=>co,R=>R.id,(R,A)=>{var T=l3();y(()=>P(T,"id",f(A).id)),y(()=>P(T,"data-icon",f(A).icon));var M=v(T);y(N=>S(M,N),[()=>w(f(A).labelKey)]),C(R,T)});var h=x(d,2);P(h,"for","general");var p=v(h);JO(p,{onPermissionStateChange:o});var g=x(h,2);P(g,"for","diagnostics");var m=v(g);hO(m,{});var _=x(g,2);P(_,"for","plugins");var k=v(_);XN(k,{get permissionVisible(){return f(n)},get permissionAvailable(){return f(r)}});var O=x(_,2);P(O,"for","self-update");var I=v(O);o3(I,{}),y(R=>{Ae(a,"data-locale",me.locale),S(c,R)},[()=>w("settings.title")]),ut("mndwchange",u,s),C(t,a),Le()}const op=new Map;let Qa=[],Jt;function el(t){return(t.length>1&&t.endsWith("/")?t.slice(0,-1):t).toLowerCase()}function u3(t,e){if(!/^\/[^/?#*]+\/?$/.test(t)||el(t)==="/")throw new Error(`Page plugin "${e}" must declare a single-segment route; received "${t}"`)}function d3(t,e){if(dv(t))throw new Error(`Page plugin "${e}" route "${t}" conflicts with a reserved static route`)}function f3(t=bs){const e=t.getPages().slice().sort((s,o)=>s.entry.label.localeCompare(o.entry.label)||s.entry.name.localeCompare(o.entry.name)),n={},r=new Map,i=[];for(const s of e){const{name:o,route:a}=s.entry;u3(a,o),d3(el(a),o);const l=el(a),c=`${l}/*child`,u=r.get(l);if(u!==void 0)throw new Error(`Page route collision: plugin "${o}" route "${a}" conflicts with plugin "${u}" route "${l}"`);n[l]=$h,n[c]=$h,r.set(l,o),i.push({route:l,name:o})}op.clear();for(const[s,o]of r)op.set(s,o);return Qa=i,n}function ap(){return Qa}function h3(t){return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function Vv(t,e){const n=h3(t),r=n.toLowerCase();for(const i of e){const s=el(i.route),o=s.toLowerCase();if(r===o)return{name:i.name,childPath:""};const a=`${o}/`;if(r.startsWith(a)){const l=n.slice(s.length);return{name:i.name,childPath:l==="/"?"":l}}}return null}function p3(){const t=globalThis.location.pathname,e=Vv(t,Qa);if(e!==null)try{decodeURIComponent(t)}catch{const r=Qa.find(i=>i.name===e.name);if(r===void 0)return;globalThis.history.replaceState(globalThis.history.state,"",`${r.route}${globalThis.location.search}${globalThis.location.hash}`)}}function g3(t=bs){const e=f3(t),n=Mw({"/":{layout:XA,"/":Bh,"/packages":Wh,"/packages/services":Wh,"/settings":sp,...Object.fromEntries(co.map(r=>[r.route,sp])),...e,"*":Bh}});return Jt=n,p3(),n}function m3(t,e){const n=e("single_usb_port")?1:Math.max(0,Math.trunc(t));if(n===0)return{ports:[]};if(!(e("usb_3")||e("usb_3_conf")))return{ports:Array.from({length:n},()=>"usb2")};const i=e("usb_3_first")?0:n-1;return{ports:Array.from({length:n},(o,a)=>a===i?"usb3":"usb2")}}const lp=Ue({exact:de(),cdate:de()}),cp=Ue({version:de()}),v3=Ue({release:de(),sandbox:de().optional(),title:de().optional(),arch:de(),ndm:lp,bsp:lp,ndw:Ue({version:de().optional(),features:de(),components:de()}),ndw3:cp.optional(),ndw4:cp.optional(),manufacturer:de(),vendor:de(),series:de(),model:de(),hw_version:de(),hw_type:de().optional(),hw_id:de(),device:de(),region:de(),description:de()}),b3=()=>{const t={path:"show.version"};return Cd.driver.queue(t).pipe(pb(e=>v3.parse(e)))};function _3(){return Promise.resolve({theme:ja(),locale:os()})}function w3(){return{deviceName:"Unknown",vendor:"Unknown",manufacturer:"Unknown",model:"Unknown",series:"Unknown",region:"Unknown",hwId:"Unknown",hwVersion:"Unknown",firmwareVersion:"Unknown",firmwareRelease:"Unknown",features:[],components:[]}}async function y3(){try{const t=await hp(b3().pipe(pp(Jm)));return{deviceName:t.device??"Unknown",vendor:t.vendor??"Unknown",manufacturer:t.manufacturer??"Unknown",model:t.model??"Unknown",series:t.series??"Unknown",region:t.region??"Unknown",hwId:t.hw_id??"Unknown",hwVersion:t.hw_version??"Unknown",hwType:t.hw_type,firmwareVersion:t.title??"Unknown",firmwareRelease:t.release??"Unknown",architecture:t.arch,features:xh(t.ndw.features),components:xh(t.ndw.components)}}catch{return w3()}}async function k3(t){const e=y3(),n=Promise.resolve().then(()=>t.getDeviceHardware()).catch(()=>({switchports:ku(),usbPortCount:0})),[r,i]=await Promise.all([e,n]),s=new Set(r.features.map(a=>a.toLowerCase())),o=m3(i.usbPortCount,a=>s.has(a.toLowerCase()));return{...r,switchports:i.switchports,usb:o}}async function Zv(t=so(),e={}){e.loadPlugins;const n=e.loadSandboxPlugin??DR,r=e.createRouter??g3;try{me.hostInfo=await _3()}catch(i){console.error("[mndw] Failed to fetch host info:",i)}try{me.deviceInfo=await k3(t.mgmtClient)}catch(i){console.error("[mndw] Failed to fetch device info:",i)}{let i=xv,s=e.setupHmr??jR;{const o=await Pa(()=>import("./sandbox-url-ClgdqetH.js"),[]);i=o.sandboxUrlImports(),s=e.setupHmr??o.setupSandboxUrlHmr}await n({...i,registry:t.registry,catalogService:t.catalog,getLocale:()=>t.locale.getLocale()}),s(t)}r(t.registry),me.ready=!0}var E3=z('<div class="mndw-alert mndw-alert--danger" role="alert"> </div>'),S3=z('<div class="mndw-login"><form class="mndw-login__form"><mndw-select><mndw-option>EN</mndw-option> <mndw-option>RU</mndw-option></mndw-select> <h1 class="mndw-login__title">mndw</h1> <mndw-field><mndw-input></mndw-input></mndw-field> <mndw-field><mndw-input></mndw-input></mndw-field> <!> <mndw-button> </mndw-button></form></div>',2);function x3(t,e){Ie(e,!0);const n=Rr();let r=Y(""),i=Y(""),s=Y(""),o=Y(!1),a=Y(!1);function l(){return f(r).trim()!==""&&f(i)!==""}function c(){return l()&&!f(o)&&!f(a)}function u(B){n.locale.setLocale(B.detail.value).catch(()=>{})}function d(B){b(r,B.detail.value,!0),b(a,!1)}function h(B){b(i,B.detail.value,!0),b(a,!1)}function p(B){const q=B.target,ee=B.composedPath()[0];B.key!=="Enter"||!(q instanceof HTMLElement)||q.localName!=="mndw-input"||ee instanceof HTMLButtonElement||(B.preventDefault(),c()&&g(B))}function g(B){B.preventDefault(),c()&&(b(o,!0),b(s,""),n.rci.login(f(r),f(i)).subscribe({next(q){q?(me.authenticated=!0,Zv(n).catch(()=>{kd(),b(s,w("login.connection-failed"),!0),b(o,!1)}).finally(()=>{b(r,""),b(i,"")})):(b(s,w("login.invalid-credentials"),!0),b(o,!1),b(a,!0))},error(){b(s,w("login.connection-failed"),!0),b(o,!1),b(a,!0)}}))}var m=S3(),_=v(m),k=v(_);Ne(k,1,"mndw-login__locale-select"),y(()=>P(k,"label",w("nav.language"))),y(()=>P(k,"value",me.locale)),y(()=>P(k,"disabled",me.localeSwitchPending));var O=v(k);P(O,"value","en");var I=x(O,2);P(I,"value","ru");var R=x(k,4);y(()=>P(R,"label",w("login.username")));var A=v(R);P(A,"name","username"),P(A,"autocomplete","username"),y(()=>P(A,"value",f(r))),y(()=>P(A,"disabled",f(o)));var T=x(R,2);y(()=>P(T,"label",w("login.password")));var M=v(T);P(M,"type","password"),P(M,"name","password"),P(M,"autocomplete","current-password"),y(()=>P(M,"value",f(i))),y(()=>P(M,"disabled",f(o)));var N=x(T,2);{var j=B=>{var q=E3(),ee=v(q);y(()=>S(ee,f(s))),C(B,q)};Z(N,B=>{f(s)&&B(j)})}var H=x(N,2);Ne(H,1,"mndw-login__submit"),P(H,"variant","primary"),P(H,"type","submit"),y(()=>P(H,"disabled",!c()));var se=v(H);y(B=>{Ae(m,"data-locale",me.locale),S(se,B)},[()=>f(o)?w("login.logging-in"):w("login.submit")]),ut("submit",_,g),ut("mndwchange",k,u),ut("mndwinput",A,d),pe("keydown",A,p),ut("mndwinput",M,h),pe("keydown",M,p),C(t,m),Le()}at(["keydown"]);var T3=z('<div class="mndw-loading"> </div>'),C3=z("<!> <!> <!>",1);function P3(t,e){Ie(e,!0),iA(e.services);var n=C3(),r=Xe(n);hP(r,{});var i=x(r,2);kP(i,{});var s=x(i,2);{var o=c=>{x3(c,{})},a=c=>{Iw(c,{})},l=c=>{var u=T3(),d=v(u);y(h=>{Ae(u,"data-locale",me.locale),S(d,h)},[()=>w("app.loading")]),C(c,u)};Z(s,c=>{me.authenticated?me.ready?c(a,1):c(l,-1):c(o)})}C(t,n),Le()}async function R3(t){const e=t.initLocale();t.defineUi(e),t.initTheme();try{await t.initPalette()}catch(r){console.warn("[mndw] Palette startup load failed; continuing to login.",r)}let n=!1;try{n=await t.checkAuthenticated()}catch{n=!1}if(t.setAuthenticated(n),n)try{await t.initAuthenticated()}catch{t.resetToLogin()}t.subscribeAuthErrors(()=>{t.resetToLogin()}),t.mountApp()}const ci=so();function aa(t){return t?t.includes("/plugins/")||t.includes("/user-plugins/"):!1}function A3(){window.addEventListener("error",t=>{const e=typeof t.message=="string"?t.message:"",n=typeof t.filename=="string"?t.filename:"",r=t.error instanceof Error?t.error.stack:"";(aa(n)||aa(r)||aa(e))&&(console.error("[mndw] Plugin runtime error:",t.error||t.message),t.preventDefault())}),window.addEventListener("unhandledrejection",t=>{const e=t.reason,n=e instanceof Error?e.stack:String(e);aa(n)&&(console.error("[mndw] Plugin unhandled rejection:",e),t.preventDefault())})}function M3(){const t=document.getElementById("app");if(t===null)throw new Error("Missing #app mount target");hl(P3,{target:t,props:{services:ci}})}async function O3(){const t=ci.rci.isAuthenticated().pipe(pp(5e3));return hp(t)}function N3(t){ci.rci.authError$.subscribe(t)}async function z3(){A3(),await R3({initLocale:()=>ci.locale.initLocale(),defineUi:t=>sb({overlay:ci.overlay,initialLocale:t,iconSpriteUrl:bb}),initTheme:sC,initPalette:()=>ci.palette.initPalette(),checkAuthenticated:O3,setAuthenticated:t=>{me.authenticated=t},initAuthenticated:()=>Zv(ci),subscribeAuthErrors:N3,resetToLogin:kd,mountApp:M3})}z3();export{UR as s};
|
|
94
|
+
${Ce??""}`)},[()=>w("settings.backend-capacity"),()=>w("settings.backend-capacity"),()=>w("settings.plugin-manager.exec"),()=>w("settings.plugin-manager.services"),()=>w("settings.plugin-manager.per-plugin-exec-limit"),()=>w("settings.plugin-manager.service-protocols"),()=>f(o).supportedServiceProtocols.join(", ")]),C(X,ve)},ce=X=>{var ve=GN(),Ze=v(ve);y(nt=>S(Ze,nt),[()=>w("settings.plugin-manager.runtime-status-unavailable",{error:f(a)})]),C(X,ve)};Z(je,X=>{f(o)?X(Ke):f(a)&&X(ce,1)})}var ae=x(je,2);{var U=X=>{CN(X,{get items(){return f(k)},get confirmingName(){return f(d)},rowStateFor:O,onApprove:ve=>M(ve,{kind:"approve"},()=>n().approvePlugin(ve),!0),onDeny:ve=>M(ve,{kind:"deny"},()=>n().denyPlugin(ve),!1),onRequestConfirm:ve=>b(d,ve,!0),onCancelConfirm:()=>b(d,null),onRefresh:()=>void A()})};Z(ae,X=>{f(k).length>0&&X(U)})}var re=x(ae,2);mN(re,{get items(){return f(_)},get confirmingName(){return f(d)},rowStateFor:O,get permissionVisible(){return r()},get permissionAvailable(){return i()},onEnable:X=>M(X,{kind:"enable"},()=>n().enablePlugin(X),!0),onDisable:X=>M(X,{kind:"disable"},()=>n().disablePlugin(X),!0),onPermissionChange:(X,ve,Ze)=>M(X,{kind:"permission",permission:ve,enabled:Ze},()=>n().setPluginPermission(X,ve,Ze),!1),onRestart:X=>M(X,{kind:"restart"},()=>n().restartPlugin(X),!1),onDelete:X=>M(X,{kind:"delete"},()=>n().deletePlugin(X),!0),onRequestConfirm:X=>b(d,X,!0),onCancelConfirm:()=>b(d,null),onRefresh:()=>void A()}),C(oe,ue)};Z(W,oe=>{f(l)?oe(J):f(c)?oe(ne,1):oe(le,-1)})}y(oe=>S(B,oe),[()=>w("settings.plugin-manager.title")]),C(t,H),Le()}at(["click"]);var qN=z('<section class="mndw-plugin-settings"><!></section>');function XN(t,e){var n=qN(),r=v(n);WN(r,{get permissionVisible(){return e.permissionVisible},get permissionAvailable(){return e.permissionAvailable}}),C(t,n)}class Id extends Error{constructor(n,r){super(n);G(this,"code");this.name="SelfUpdateError",this.code=r}}const Gv=t=>t==="update"||t==="revert",$n=()=>new Id("Malformed response","UNKNOWN");async function YN(t){try{return await t.json()}catch{throw $n()}}async function JN(t){const e=Ol(await Ml(t),t.statusText);return new Id(e.message,e.code)}function KN(t){if(!sn(t)||t.state!=="idle"&&t.state!=="in-progress"&&t.state!=="failed"||!_r(t.version)||t.operation!==void 0&&!Gv(t.operation))throw $n();for(const i of["targetVersion","failureCode","rollbackVersion"])if(t[i]!==void 0&&!_r(t[i]))throw $n();const e=t.targetVersion===void 0?void 0:t.targetVersion,n=t.failureCode===void 0?void 0:t.failureCode,r=t.rollbackVersion===void 0?void 0:t.rollbackVersion;return{state:t.state,version:t.version,...t.operation===void 0?{}:{operation:t.operation},...e===void 0?{}:{targetVersion:e},...n===void 0?{}:{failureCode:n},...r===void 0?{}:{rollbackVersion:r}}}function QN(t){if(!sn(t)||!_r(t.currentVersion)||typeof t.updateAvailable!="boolean"||typeof t.rollbackAvailable!="boolean"||t.targetVersion!==void 0&&!_r(t.targetVersion)||t.rollbackVersion!==void 0&&!_r(t.rollbackVersion)||t.updateAvailable!==(t.targetVersion!==void 0)||t.rollbackAvailable!==(t.rollbackVersion!==void 0))throw $n();const e=t.targetVersion===void 0?void 0:t.targetVersion,n=t.rollbackVersion===void 0?void 0:t.rollbackVersion;return{currentVersion:t.currentVersion,updateAvailable:t.updateAvailable,rollbackAvailable:t.rollbackAvailable,...e===void 0?{}:{targetVersion:e},...n===void 0?{}:{rollbackVersion:n}}}function np(t){if(!sn(t)||!Gv(t.operation)||!_r(t.targetVersion))throw $n();return{operation:t.operation,targetVersion:t.targetVersion}}function e3(t=globalThis.fetch){async function e(r,i){const s=await t(r,i);if(!s.ok)throw await JN(s);return YN(s)}async function n(r){return e(r,{method:"POST",headers:{"Content-Type":"application/json",...Xt},body:"{}"})}return{async status(){return KN(await e(bT,{method:"GET"}))},async check(){return QN(await n(_T))},async apply(){return np(await n(wT))},async revert(){return np(await n(yT))}}}const t3=e3();var n3=z("<mndw-button> </mndw-button>",2),r3=z('<div class="mndw-self-update-progress-modal svelte-1khkewm"><p class="svelte-1khkewm"> </p> <!></div>');function i3(t,e){Ie(e,!0);const n=fe(()=>e.progress.phase==="preparing"?w("settings.self-update-preparing"):e.progress.phase==="unconfirmed"?w("settings.self-update-unconfirmed-modal"):e.progress.operation==="revert"?w("settings.self-update-reverting",{version:e.progress.targetVersion}):w("settings.self-update-updating",{version:e.progress.targetVersion}));var r=r3(),i=v(r),s=v(i),o=x(i,2);{var a=l=>{var c=n3();P(c,"variant","secondary"),Ne(c,1,"svelte-1khkewm");var u=v(c);y(d=>S(u,d),[()=>w("common.close")]),pe("click",c,()=>e.close("close")),C(l,c)};Z(o,l=>{e.progress.phase==="unconfirmed"&&l(a)})}y(()=>{Ae(i,"role",e.progress.phase==="unconfirmed"?"alert":"status"),S(s,f(n))}),C(t,r),Le()}at(["click"]);var Ac=z('<p class="svelte-1ffuaq9"> </p>'),oa=z('<p role="status" class="svelte-1ffuaq9"> </p>'),Ni=z('<p role="alert" class="svelte-1ffuaq9"> </p>'),s3=z('<section class="mndw-self-update-settings svelte-1ffuaq9"><h3 class="svelte-1ffuaq9"> </h3> <p class="svelte-1ffuaq9"> </p> <!> <!> <!> <!> <div class="mndw-self-update-actions svelte-1ffuaq9"><mndw-button> </mndw-button> <mndw-button> </mndw-button> <mndw-button> </mndw-button></div></section>',2);function o3(t,e){Ie(e,!0);let n=Yt(e,"pollIntervalMs",3,2e3),r=Yt(e,"pollAttempts",3,90),i=fe(()=>e.client??t3),s=Y(null),o=Y(null),a=Y(""),l=Y(""),c=Y("idle"),u=Y(""),d=Y(!1),h=null,p=0,g=0,m=!1,_=!1,k=Y(null),O=null;zn(()=>{A()}),Oo(()=>{m=!0,I(),q()});function I(){p+=1,h!==null&&(window.clearTimeout(h),h=null)}function R(L){b(s,L,!0),L.state==="failed"?(b(u,L.failureCode??"unknown",!0),b(c,"failure"),_=!1,q()):L.state==="idle"&&_?(b(c,"success"),q()):L.state==="in-progress"&&(b(c,"idle"),f(k)!==null&&(f(k).phase="running",f(k).targetVersion=L.targetVersion??f(k).targetVersion,L.operation!==void 0&&(f(k).operation=L.operation)))}async function A(){b(d,!0);try{const L=await f(i).status();if(m)return;R(L),L.state==="in-progress"&&(_=!0,T())}catch{b(c,"error")}finally{b(d,!1)}}function T(){if(I(),g=Math.max(0,r()),g===0){N();return}M(p)}function M(L){m||L!==p||g<=0||(h=window.setTimeout(()=>{h=null,j(L)},n()))}function N(){I(),b(c,"unconfirmed"),f(k)!==null&&(f(k).phase="unconfirmed")}async function j(L){if(!(m||L!==p)){g-=1;try{const K=await f(i).status();if(m||L!==p)return;R(K),K.state==="in-progress"?g<=0?N():M(L):I()}catch{if(g<=0){N();return}M(L)}}}function H(L){return L instanceof Id?L.code:"UNKNOWN"}async function se(L,K){const we=L==="update";return(await as(Ya,{title:w(we?"settings.self-update-confirm-update-title":"settings.self-update-confirm-revert-title"),props:{message:w(we?"settings.self-update-confirm-update":"settings.self-update-confirm-revert",{version:K}),confirmLabel:w(we?"settings.self-update-apply":"settings.self-update-revert")}}).closed).result===!0}function B(L){b(k,{operation:L,phase:"preparing",targetVersion:""},!0);const we=f(k);if(we===null)return;const _e=as(i3,{title:w("settings.self-update-progress-title"),showCloseButton:!1,closeOnEscape:!1,props:{progress:we}});O=_e,_e.closed.then(()=>{O===_e&&(O=null,b(k,null))})}function q(){O==null||O.close(void 0,"api")}async function ee(){try{const L=await f(i).status();if(m)return;R(L),L.state==="in-progress"?(_=!0,T()):b(c,"busy")}catch{b(c,"busy")}}async function te(){I(),_=!1,b(d,!0),b(c,"checking"),b(u,"");try{b(o,await f(i).check(),!0),b(c,"idle")}catch(L){b(o,null),H(L)==="OPKG_BUSY"?await ee():b(c,"error")}finally{b(d,!1)}}async function W(){const L=f(o);L===null||!L.updateAvailable||L.targetVersion===void 0||await se("update",L.targetVersion)&&await ue("update",()=>f(i).apply())}async function J(){f(Ke)!==""&&await se("revert",f(Ke))&&await ue("revert",()=>f(i).revert())}function ne(L){I(),b(o,null),b(a,""),b(l,L,!0),b(u,""),b(d,!0),b(c,"preparing"),_=!1}async function le(L){const K=await L();b(a,K.targetVersion,!0),b(l,K.operation,!0),f(k)!==null&&(f(k).phase="running",f(k).targetVersion=K.targetVersion),b(c,"idle"),_=!0,T()}async function oe(L){switch(q(),H(L)){case"OPKG_BUSY":await ee();return;case"SELF_UPDATE_NOT_AVAILABLE":b(u,"no-update");break;case"SELF_UPDATE_ROLLBACK_UNAVAILABLE":b(u,"rollback-unavailable");break;default:b(u,"")}b(c,"error")}async function ue(L,K){ne(L),B(L);try{await le(K)}catch(we){await oe(we)}finally{b(d,!1)}}function De(L){return w({"update-missing":"settings.self-update-failure-update-missing","opkg-install-failed":"settings.self-update-failure-opkg-install-failed","opkg-revert-failed":"settings.self-update-failure-opkg-revert-failed","rollback-missing":"settings.self-update-failure-rollback-missing","helper-exited":"settings.self-update-failure-helper-exited","unexpected-version":"settings.self-update-failure-unexpected-version","state-corrupt":"settings.self-update-failure-state-corrupt"}[L]??"settings.self-update-failure-generic")}const Ye=fe(()=>{var L;return((L=f(s))==null?void 0:L.version)??""}),je=fe(()=>{var L,K;return((L=f(s))==null?void 0:L.state)==="in-progress"?f(a)||f(s).targetVersion||"":((K=f(o))==null?void 0:K.targetVersion)||""}),Ke=fe(()=>{var L,K;return((L=f(o))==null?void 0:L.rollbackVersion)||((K=f(s))==null?void 0:K.rollbackVersion)||""}),ce=fe(()=>{var L;return((L=f(o))==null?void 0:L.updateAvailable)===!0&&!f(d)}),ae=fe(()=>{var L,K;return(((L=f(o))==null?void 0:L.rollbackAvailable)===!0||!!((K=f(s))!=null&&K.rollbackVersion))&&!f(d)});var U=s3(),re=v(U),X=v(re),ve=x(re,2),Ze=v(ve),nt=x(ve,2);{var yt=L=>{var K=Ac(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-current",{version:f(Ye)})]),C(L,K)};Z(nt,L=>{f(Ye)&&L(yt)})}var Ut=x(nt,2);{var on=L=>{var K=Ac(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-rollback",{version:f(Ke)})]),C(L,K)};Z(Ut,L=>{f(Ke)&&L(on)})}var qn=x(Ut,2);{var En=L=>{var K=oa(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-checking")]),C(L,K)},Xn=L=>{var K=oa(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-preparing")]),C(L,K)},Yn=L=>{var K=oa(),we=v(K);y(_e=>S(we,_e),[()=>w(f(l)==="revert"||f(s).operation==="revert"?"settings.self-update-reverting":"settings.self-update-updating",{version:f(je)})]),C(L,K)},cr=L=>{var K=oa(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-success",{version:f(Ye)})]),C(L,K)},an=L=>{var K=Ni(),we=v(K);y(_e=>S(we,_e),[()=>De(f(u))]),C(L,K)},ur=L=>{var K=Ni(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-unconfirmed")]),C(L,K)},Ee=L=>{var K=Ni(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-busy")]),C(L,K)},ze=L=>{var K=Ni(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-no-update")]),C(L,K)},V=L=>{var K=Ni(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-rollback-unavailable")]),C(L,K)},ge=L=>{var K=Ni(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-failure-generic")]),C(L,K)};Z(qn,L=>{var K;f(c)==="checking"?L(En):f(c)==="preparing"?L(Xn,1):((K=f(s))==null?void 0:K.state)==="in-progress"?L(Yn,2):f(c)==="success"?L(cr,3):f(c)==="failure"?L(an,4):f(c)==="unconfirmed"?L(ur,5):f(c)==="busy"?L(Ee,6):f(c)==="error"&&f(u)==="no-update"?L(ze,7):f(c)==="error"&&f(u)==="rollback-unavailable"?L(V,8):f(c)==="error"&&L(ge,9)})}var Ce=x(qn,2);{var Ge=L=>{var K=Ac(),we=v(K);y(_e=>S(we,_e),[()=>w("settings.self-update-available",{version:f(o).targetVersion})]),C(L,K)};Z(Ce,L=>{f(o)!==null&&f(o).updateAvailable&&f(o).targetVersion!==void 0&&L(Ge)})}var Qe=x(Ce,2),lt=v(Qe);P(lt,"variant","secondary"),y(()=>P(lt,"disabled",f(d)));var xt=v(lt),$e=x(lt,2);P($e,"variant","primary"),y(()=>P($e,"disabled",!f(ce)));var He=v($e),We=x($e,2);P(We,"variant","secondary"),y(()=>P(We,"disabled",!f(ae)));var Re=v(We);y((L,K,we,_e,kt,pt)=>{Ae(U,"data-locale",me.locale),Ae(U,"aria-label",L),S(X,K),S(Ze,we),S(xt,_e),S(He,kt),S(Re,pt)},[()=>w("settings.self-update-tab"),()=>w("settings.self-update-tab"),()=>w("settings.self-update-description"),()=>f(c)==="checking"?w("settings.self-update-checking"):w("settings.self-update-check"),()=>w("settings.self-update-apply"),()=>w("settings.self-update-revert")]),pe("click",lt,()=>void te()),pe("click",$e,()=>void W()),pe("click",We,()=>void J()),C(t,U),Le()}at(["click"]);const co=[{id:"general",route:"/settings/general",labelKey:"settings.general-tab",icon:"settings"},{id:"diagnostics",route:"/settings/diagnostics",labelKey:"settings.diagnostics-tab",icon:"diagnostics"},{id:"plugins",route:"/settings/plugins",labelKey:"settings.plugins-tab",icon:"plugins"},{id:"self-update",route:"/settings/self-update",labelKey:"settings.self-update-tab",icon:"refresh"}],rp="general";function ip(t){var e;return((e=co.find(n=>n.id===t))==null?void 0:e.route)??`/settings/${t}`}function a3(t){const e=t.length>1&&t.endsWith("/")?t.slice(0,-1):t;for(const n of co)if(e===n.route)return n.id;return null}var l3=z("<mndw-tab> </mndw-tab>",2),c3=z('<div class="mndw-settings"><h2> </h2> <mndw-tabs><!> <mndw-tab-panel><!></mndw-tab-panel> <mndw-tab-panel><!></mndw-tab-panel> <mndw-tab-panel><!></mndw-tab-panel> <mndw-tab-panel><!></mndw-tab-panel></mndw-tabs></div>',2);function sp(t,e){Ie(e,!0);let n=Y(!1),r=Y(!1);const i=fe(()=>{const R=(Jt==null?void 0:Jt.route.pathname)??globalThis.location.pathname;return a3(R)??rp});zn(()=>{const R=Jt;(R==null?void 0:R.route.pathname)==="/settings"&&R.navigate(ip(rp),{replace:!0})});function s(R){const A=co.find(M=>M.id===R.detail.value),T=Jt;A===void 0||T===void 0||T.navigate(ip(A.id))}function o(R){b(n,R.visible,!0),b(r,R.available,!0)}var a=c3(),l=v(a),c=v(l),u=x(l,2);y(()=>P(u,"value",f(i)));var d=v(u);ft(d,17,()=>co,R=>R.id,(R,A)=>{var T=l3();y(()=>P(T,"id",f(A).id)),y(()=>P(T,"data-icon",f(A).icon));var M=v(T);y(N=>S(M,N),[()=>w(f(A).labelKey)]),C(R,T)});var h=x(d,2);P(h,"for","general");var p=v(h);JO(p,{onPermissionStateChange:o});var g=x(h,2);P(g,"for","diagnostics");var m=v(g);hO(m,{});var _=x(g,2);P(_,"for","plugins");var k=v(_);XN(k,{get permissionVisible(){return f(n)},get permissionAvailable(){return f(r)}});var O=x(_,2);P(O,"for","self-update");var I=v(O);o3(I,{}),y(R=>{Ae(a,"data-locale",me.locale),S(c,R)},[()=>w("settings.title")]),ut("mndwchange",u,s),C(t,a),Le()}const op=new Map;let Qa=[],Jt;function el(t){return(t.length>1&&t.endsWith("/")?t.slice(0,-1):t).toLowerCase()}function u3(t,e){if(!/^\/[^/?#*]+\/?$/.test(t)||el(t)==="/")throw new Error(`Page plugin "${e}" must declare a single-segment route; received "${t}"`)}function d3(t,e){if(dv(t))throw new Error(`Page plugin "${e}" route "${t}" conflicts with a reserved static route`)}function f3(t=bs){const e=t.getPages().slice().sort((s,o)=>s.entry.label.localeCompare(o.entry.label)||s.entry.name.localeCompare(o.entry.name)),n={},r=new Map,i=[];for(const s of e){const{name:o,route:a}=s.entry;u3(a,o),d3(el(a),o);const l=el(a),c=`${l}/*child`,u=r.get(l);if(u!==void 0)throw new Error(`Page route collision: plugin "${o}" route "${a}" conflicts with plugin "${u}" route "${l}"`);n[l]=$h,n[c]=$h,r.set(l,o),i.push({route:l,name:o})}op.clear();for(const[s,o]of r)op.set(s,o);return Qa=i,n}function ap(){return Qa}function h3(t){return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function Vv(t,e){const n=h3(t),r=n.toLowerCase();for(const i of e){const s=el(i.route),o=s.toLowerCase();if(r===o)return{name:i.name,childPath:""};const a=`${o}/`;if(r.startsWith(a)){const l=n.slice(s.length);return{name:i.name,childPath:l==="/"?"":l}}}return null}function p3(){const t=globalThis.location.pathname,e=Vv(t,Qa);if(e!==null)try{decodeURIComponent(t)}catch{const r=Qa.find(i=>i.name===e.name);if(r===void 0)return;globalThis.history.replaceState(globalThis.history.state,"",`${r.route}${globalThis.location.search}${globalThis.location.hash}`)}}function g3(t=bs){const e=f3(t),n=Mw({"/":{layout:XA,"/":Bh,"/packages":Wh,"/packages/services":Wh,"/settings":sp,...Object.fromEntries(co.map(r=>[r.route,sp])),...e,"*":Bh}});return Jt=n,p3(),n}function m3(t,e){const n=e("single_usb_port")?1:Math.max(0,Math.trunc(t));if(n===0)return{ports:[]};if(!(e("usb_3")||e("usb_3_conf")))return{ports:Array.from({length:n},()=>"usb2")};const i=e("usb_3_first")?0:n-1;return{ports:Array.from({length:n},(o,a)=>a===i?"usb3":"usb2")}}const lp=Ue({exact:de(),cdate:de()}),cp=Ue({version:de()}),v3=Ue({release:de(),sandbox:de().optional(),title:de().optional(),arch:de(),ndm:lp,bsp:lp,ndw:Ue({version:de().optional(),features:de(),components:de()}),ndw3:cp.optional(),ndw4:cp.optional(),manufacturer:de(),vendor:de(),series:de(),model:de(),hw_version:de(),hw_type:de().optional(),hw_id:de(),device:de(),region:de(),description:de()}),b3=()=>{const t={path:"show.version"};return Cd.driver.queue(t).pipe(pb(e=>v3.parse(e)))};function _3(){return Promise.resolve({theme:ja(),locale:os()})}function w3(){return{deviceName:"Unknown",vendor:"Unknown",manufacturer:"Unknown",model:"Unknown",series:"Unknown",region:"Unknown",hwId:"Unknown",hwVersion:"Unknown",firmwareVersion:"Unknown",firmwareRelease:"Unknown",features:[],components:[]}}async function y3(){try{const t=await hp(b3().pipe(pp(Jm)));return{deviceName:t.device??"Unknown",vendor:t.vendor??"Unknown",manufacturer:t.manufacturer??"Unknown",model:t.model??"Unknown",series:t.series??"Unknown",region:t.region??"Unknown",hwId:t.hw_id??"Unknown",hwVersion:t.hw_version??"Unknown",hwType:t.hw_type,firmwareVersion:t.title??"Unknown",firmwareRelease:t.release??"Unknown",architecture:t.arch,features:xh(t.ndw.features),components:xh(t.ndw.components)}}catch{return w3()}}async function k3(t){const e=y3(),n=Promise.resolve().then(()=>t.getDeviceHardware()).catch(()=>({switchports:ku(),usbPortCount:0})),[r,i]=await Promise.all([e,n]),s=new Set(r.features.map(a=>a.toLowerCase())),o=m3(i.usbPortCount,a=>s.has(a.toLowerCase()));return{...r,switchports:i.switchports,usb:o}}async function Zv(t=so(),e={}){e.loadPlugins;const n=e.loadSandboxPlugin??DR,r=e.createRouter??g3;try{me.hostInfo=await _3()}catch(i){console.error("[mndw] Failed to fetch host info:",i)}try{me.deviceInfo=await k3(t.mgmtClient)}catch(i){console.error("[mndw] Failed to fetch device info:",i)}{let i=xv,s=e.setupHmr??jR;{const o=await Pa(()=>import("./sandbox-url-BRfzhk02.js"),[]);i=o.sandboxUrlImports(),s=e.setupHmr??o.setupSandboxUrlHmr}await n({...i,registry:t.registry,catalogService:t.catalog,getLocale:()=>t.locale.getLocale()}),s(t)}r(t.registry),me.ready=!0}var E3=z('<div class="mndw-alert mndw-alert--danger" role="alert"> </div>'),S3=z('<div class="mndw-login"><form class="mndw-login__form"><mndw-select><mndw-option>EN</mndw-option> <mndw-option>RU</mndw-option></mndw-select> <h1 class="mndw-login__title">mndw</h1> <mndw-field><mndw-input></mndw-input></mndw-field> <mndw-field><mndw-input></mndw-input></mndw-field> <!> <mndw-button> </mndw-button></form></div>',2);function x3(t,e){Ie(e,!0);const n=Rr();let r=Y(""),i=Y(""),s=Y(""),o=Y(!1),a=Y(!1);function l(){return f(r).trim()!==""&&f(i)!==""}function c(){return l()&&!f(o)&&!f(a)}function u(B){n.locale.setLocale(B.detail.value).catch(()=>{})}function d(B){b(r,B.detail.value,!0),b(a,!1)}function h(B){b(i,B.detail.value,!0),b(a,!1)}function p(B){const q=B.target,ee=B.composedPath()[0];B.key!=="Enter"||!(q instanceof HTMLElement)||q.localName!=="mndw-input"||ee instanceof HTMLButtonElement||(B.preventDefault(),c()&&g(B))}function g(B){B.preventDefault(),c()&&(b(o,!0),b(s,""),n.rci.login(f(r),f(i)).subscribe({next(q){q?(me.authenticated=!0,Zv(n).catch(()=>{kd(),b(s,w("login.connection-failed"),!0),b(o,!1)}).finally(()=>{b(r,""),b(i,"")})):(b(s,w("login.invalid-credentials"),!0),b(o,!1),b(a,!0))},error(){b(s,w("login.connection-failed"),!0),b(o,!1),b(a,!0)}}))}var m=S3(),_=v(m),k=v(_);Ne(k,1,"mndw-login__locale-select"),y(()=>P(k,"label",w("nav.language"))),y(()=>P(k,"value",me.locale)),y(()=>P(k,"disabled",me.localeSwitchPending));var O=v(k);P(O,"value","en");var I=x(O,2);P(I,"value","ru");var R=x(k,4);y(()=>P(R,"label",w("login.username")));var A=v(R);P(A,"name","username"),P(A,"autocomplete","username"),y(()=>P(A,"value",f(r))),y(()=>P(A,"disabled",f(o)));var T=x(R,2);y(()=>P(T,"label",w("login.password")));var M=v(T);P(M,"type","password"),P(M,"name","password"),P(M,"autocomplete","current-password"),y(()=>P(M,"value",f(i))),y(()=>P(M,"disabled",f(o)));var N=x(T,2);{var j=B=>{var q=E3(),ee=v(q);y(()=>S(ee,f(s))),C(B,q)};Z(N,B=>{f(s)&&B(j)})}var H=x(N,2);Ne(H,1,"mndw-login__submit"),P(H,"variant","primary"),P(H,"type","submit"),y(()=>P(H,"disabled",!c()));var se=v(H);y(B=>{Ae(m,"data-locale",me.locale),S(se,B)},[()=>f(o)?w("login.logging-in"):w("login.submit")]),ut("submit",_,g),ut("mndwchange",k,u),ut("mndwinput",A,d),pe("keydown",A,p),ut("mndwinput",M,h),pe("keydown",M,p),C(t,m),Le()}at(["keydown"]);var T3=z('<div class="mndw-loading"> </div>'),C3=z("<!> <!> <!>",1);function P3(t,e){Ie(e,!0),iA(e.services);var n=C3(),r=Xe(n);hP(r,{});var i=x(r,2);kP(i,{});var s=x(i,2);{var o=c=>{x3(c,{})},a=c=>{Iw(c,{})},l=c=>{var u=T3(),d=v(u);y(h=>{Ae(u,"data-locale",me.locale),S(d,h)},[()=>w("app.loading")]),C(c,u)};Z(s,c=>{me.authenticated?me.ready?c(a,1):c(l,-1):c(o)})}C(t,n),Le()}async function R3(t){const e=t.initLocale();t.defineUi(e),t.initTheme();try{await t.initPalette()}catch(r){console.warn("[mndw] Palette startup load failed; continuing to login.",r)}let n=!1;try{n=await t.checkAuthenticated()}catch{n=!1}if(t.setAuthenticated(n),n)try{await t.initAuthenticated()}catch{t.resetToLogin()}t.subscribeAuthErrors(()=>{t.resetToLogin()}),t.mountApp()}const ci=so();function aa(t){return t?t.includes("/plugins/")||t.includes("/user-plugins/"):!1}function A3(){window.addEventListener("error",t=>{const e=typeof t.message=="string"?t.message:"",n=typeof t.filename=="string"?t.filename:"",r=t.error instanceof Error?t.error.stack:"";(aa(n)||aa(r)||aa(e))&&(console.error("[mndw] Plugin runtime error:",t.error||t.message),t.preventDefault())}),window.addEventListener("unhandledrejection",t=>{const e=t.reason,n=e instanceof Error?e.stack:String(e);aa(n)&&(console.error("[mndw] Plugin unhandled rejection:",e),t.preventDefault())})}function M3(){const t=document.getElementById("app");if(t===null)throw new Error("Missing #app mount target");hl(P3,{target:t,props:{services:ci}})}async function O3(){const t=ci.rci.isAuthenticated().pipe(pp(5e3));return hp(t)}function N3(t){ci.rci.authError$.subscribe(t)}async function z3(){A3(),await R3({initLocale:()=>ci.locale.initLocale(),defineUi:t=>sb({overlay:ci.overlay,initialLocale:t,iconSpriteUrl:bb}),initTheme:sC,initPalette:()=>ci.palette.initPalette(),checkAuthenticated:O3,setAuthenticated:t=>{me.authenticated=t},initAuthenticated:()=>Zv(ci),subscribeAuthErrors:N3,resetToLogin:kd,mountApp:M3})}z3();export{UR as s};
|